@uwdata/mosaic-spec 0.6.1 → 0.7.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.
@@ -1,19 +1,19 @@
1
- var lz=Object.create;var I_=Object.defineProperty;var uz=Object.getOwnPropertyDescriptor;var fz=Object.getOwnPropertyNames;var dz=Object.getPrototypeOf,hz=Object.prototype.hasOwnProperty;var ID=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ir=(e,t)=>{for(var n in t)I_(e,n,{get:t[n],enumerable:!0})},pz=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fz(t))!hz.call(e,i)&&i!==n&&I_(e,i,{get:()=>t[i],enumerable:!(r=uz(t,i))||r.enumerable});return e};var mz=(e,t,n)=>(n=e!=null?lz(dz(e)):{},pz(t||!e||!e.__esModule?I_(n,"default",{value:e,enumerable:!0}):n,e));var iP=ID(($9t,rP)=>{"use strict";function Vtt(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 Ytt(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 Xtt(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 Gtt(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 Wtt(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 _y(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)}rP.exports={ge:function(e,t,n,r,i){return _y(e,t,n,r,i,Vtt)},gt:function(e,t,n,r,i){return _y(e,t,n,r,i,Ytt)},lt:function(e,t,n,r,i){return _y(e,t,n,r,i,Xtt)},le:function(e,t,n,r,i){return _y(e,t,n,r,i,Gtt)},eq:function(e,t,n,r,i){return _y(e,t,n,r,i,Wtt)}}});var dP=ID((P9t,fP)=>{"use strict";var Tv=iP(),fd=0,zl=1,Av=2;fP.exports=Ztt;function A3(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 Sy=A3.prototype;function I3(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 aP(e,t){var n=dd(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 oP(e,t){var n=e.intervals([]);n.push(t),aP(e,n)}function sP(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?fd:(n.splice(r,1),aP(e,n),zl)}Sy.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Sy.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)?oP(this,e):this.left.insert(e):this.left=dd([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?oP(this,e):this.right.insert(e):this.right=dd([e]);else{var n=Tv.ge(this.leftPoints,e,T3),r=Tv.ge(this.rightPoints,e,E3);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Sy.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return fd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return sP(this,e);var r=this.left.remove(e);return r===Av?(this.left=null,this.count-=1,zl):(r===zl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return fd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return sP(this,e);var r=this.right.remove(e);return r===Av?(this.right=null,this.count-=1,zl):(r===zl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?Av:fd;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}I3(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?I3(this,this.left):I3(this,this.right);return zl}for(var a=Tv.ge(this.leftPoints,e,T3);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=Tv.ge(this.rightPoints,e,E3);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),zl}return fd}};function cP(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 lP(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 uP(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Sy.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return cP(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return lP(this.rightPoints,e,t)}else return uP(this.leftPoints,t)};Sy.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?cP(this.leftPoints,t,n):e>this.mid?lP(this.rightPoints,e,n):uP(this.leftPoints,n)};function Htt(e,t){return e-t}function T3(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function E3(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function dd(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(Htt);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(T3),l.sort(E3),new A3(r,dd(i),dd(o),c,l)}function M3(e){this.root=e}var hd=M3.prototype;hd.insert=function(e){this.root?this.root.insert(e):this.root=new A3(e[0],null,null,[e],[e])};hd.remove=function(e){if(this.root){var t=this.root.remove(e);return t===Av&&(this.root=null),t!==fd}return!1};hd.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};hd.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(hd,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(hd,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function Ztt(e){return!e||e.length===0?new M3(null):new M3(dd(e))}});var MD={};function Ld(e,t=!1){let n,r,i=MD;function o(l){n=e(l).then(()=>{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=MD,a(u)}),i=l}return t?c:a}var ur=class{constructor(t){this._filterBy=t,this._requestUpdate=Ld(()=>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(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function TD(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 AD(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 Ft(e){return this instanceof Ft?(this.v=e,this):new Ft(e)}function Mr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){o.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Ft?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Hl(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:Ft(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 AD=="function"?AD(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 D_={};Ir(D_,{compareArrayLike:()=>N_,joinUint8Arrays:()=>Tr,memcpy:()=>Fd,rebaseValueOffsets:()=>fg,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>vi,toArrayBufferViewIterator:()=>Ji,toBigInt64Array:()=>ug,toBigUint64Array:()=>Iz,toFloat32Array:()=>Mz,toFloat32ArrayAsyncIterator:()=>zz,toFloat32ArrayIterator:()=>Lz,toFloat64Array:()=>Az,toFloat64ArrayAsyncIterator:()=>jz,toFloat64ArrayIterator:()=>Cz,toInt16Array:()=>vz,toInt16ArrayAsyncIterator:()=>Rz,toInt16ArrayIterator:()=>Nz,toInt32Array:()=>wc,toInt32ArrayAsyncIterator:()=>$z,toInt32ArrayIterator:()=>Dz,toInt8Array:()=>wz,toInt8ArrayAsyncIterator:()=>Fz,toInt8ArrayIterator:()=>Ez,toUint16Array:()=>_z,toUint16ArrayAsyncIterator:()=>Pz,toUint16ArrayIterator:()=>Oz,toUint32Array:()=>Sz,toUint32ArrayAsyncIterator:()=>Uz,toUint32ArrayIterator:()=>Bz,toUint8Array:()=>_t,toUint8ArrayAsyncIterator:()=>E_,toUint8ArrayIterator:()=>T_,toUint8ClampedArray:()=>Tz,toUint8ClampedArrayAsyncIterator:()=>qz,toUint8ClampedArrayIterator:()=>kz});var yz=new TextDecoder("utf-8"),Cd=e=>yz.decode(e),gz=new TextEncoder,Zi=e=>gz.encode(e);var xz=e=>typeof e=="number",ED=e=>typeof e=="boolean",nn=e=>typeof e=="function",Yn=e=>e!=null&&Object(e)===e,Ar=e=>Yn(e)&&nn(e.then);var wi=e=>Yn(e)&&nn(e[Symbol.iterator]),Wr=e=>Yn(e)&&nn(e[Symbol.asyncIterator]),ig=e=>Yn(e)&&Yn(e.schema);var og=e=>Yn(e)&&"done"in e&&"value"in e;var sg=e=>Yn(e)&&nn(e.stat)&&xz(e.fd);var ag=e=>Yn(e)&&kd(e.body),cg=e=>"_getDOMStream"in e&&"_getNodeStream"in e,ND=e=>Yn(e)&&nn(e.abort)&&nn(e.getWriter)&&!cg(e),kd=e=>Yn(e)&&nn(e.cancel)&&nn(e.getReader)&&!cg(e),DD=e=>Yn(e)&&nn(e.end)&&nn(e.write)&&ED(e.writable)&&!cg(e),lg=e=>Yn(e)&&nn(e.read)&&nn(e.pipe)&&ED(e.readable)&&!cg(e),OD=e=>Yn(e)&&nn(e.clear)&&nn(e.bytes)&&nn(e.position)&&nn(e.setPosition)&&nn(e.capacity)&&nn(e.getBufferIdentifier)&&nn(e.createLong);var A_=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function bz(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 Fd(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 Tr(e,t){let n=bz(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?Fd(s,o,a):s=o;break}Fd(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Pt(e,t){let n=og(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Zi(n)),n instanceof ArrayBuffer?new e(n):n instanceof A_?new e(n):OD(n)?Pt(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 wz=e=>Pt(Int8Array,e),vz=e=>Pt(Int16Array,e),wc=e=>Pt(Int32Array,e),ug=e=>Pt(BigInt64Array,e),_t=e=>Pt(Uint8Array,e),_z=e=>Pt(Uint16Array,e),Sz=e=>Pt(Uint32Array,e),Iz=e=>Pt(BigUint64Array,e),Mz=e=>Pt(Float32Array,e),Az=e=>Pt(Float64Array,e),Tz=e=>Pt(Uint8ClampedArray,e),M_=e=>(e.next(),e);function*Ji(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof A_?n(t):wi(t)?t:n(t);return yield*M_(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var Ez=e=>Ji(Int8Array,e),Nz=e=>Ji(Int16Array,e),Dz=e=>Ji(Int32Array,e),T_=e=>Ji(Uint8Array,e),Oz=e=>Ji(Uint16Array,e),Bz=e=>Ji(Uint32Array,e),Lz=e=>Ji(Float32Array,e),Cz=e=>Ji(Float64Array,e),kz=e=>Ji(Uint8ClampedArray,e);function vi(e,t){return Mr(this,arguments,function*(){if(Ar(t))return yield Ft(yield Ft(yield*Hl(bi(vi(e,yield Ft(t))))));let r=function(s){return Mr(this,arguments,function*(){yield yield Ft(yield Ft(s))})},i=function(s){return Mr(this,arguments,function*(){yield Ft(yield*Hl(bi(M_(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 A_?r(t):wi(t)?i(t):Wr(t)?t:r(t);return yield Ft(yield*Hl(bi(M_(function(s){return Mr(this,arguments,function*(){let a=null;do a=yield Ft(s.next(yield yield Ft(Pt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ft(new e)})}var Fz=e=>vi(Int8Array,e),Rz=e=>vi(Int16Array,e),$z=e=>vi(Int32Array,e),E_=e=>vi(Uint8Array,e),Pz=e=>vi(Uint16Array,e),Uz=e=>vi(Uint32Array,e),zz=e=>vi(Float32Array,e),jz=e=>vi(Float64Array,e),qz=e=>vi(Uint8ClampedArray,e);function fg(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 N_(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 bn={fromIterable(e){return dg(Vz(e))},fromAsyncIterable(e){return dg(Yz(e))},fromDOMStream(e){return dg(Xz(e))},fromNodeStream(e){return dg(Gz(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')}},dg=e=>(e.next(),e);function*Vz(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Tr(r,s)[0]:([i,r,a]=Tr(r,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=T_(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 Yz(e){return Mr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=E_(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.next()):yield Ft(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ft(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ft(u.return(new Uint8Array(0))))}return yield Ft(null)})}function Xz(e){return Mr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=new B_(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.read()):yield Ft(u.read(a-c)),!n&&o.byteLength>0&&(i.push(_t(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ft(u.cancel(f)))}finally{r===!1?yield Ft(u.cancel()):e.locked&&u.releaseLock()}return yield Ft(null)})}var B_=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=_t(n)),n})}},O_=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Gz(e){return Mr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Tr(l,a)[0]:([u,l,c]=Tr(l,a),u)}if({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ft(new Uint8Array(0)),yield Ft(null);try{n[0]=O_(e,"end"),n[1]=O_(e,"error");do{if(n[2]=O_(e,"readable"),[r,o]=yield Ft(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=_t(e.read(a-c)),u.byteLength<a-c&&(u=_t(e.read()))):u=_t(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ft(f()));while(a<c)}while(!i)}finally{yield Ft(d(n,r==="error"?o:null))}return yield Ft(null);function d(h,p){return u=l=null,new Promise((m,g)=>{for(let[y,x]of h)e.off(y,x);try{let y=e.destroy;y&&y.call(e,p),p=void 0}catch(y){p=y||p}finally{p!=null?g(p):m()}})}})}var ce;(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"})(ce||(ce={}));var ge;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(ge||(ge={}));var he;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(he||(he={}));var Ve;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Ve||(Ve={}));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 an;(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"})(an||(an={}));var Qi=new Int32Array(2),hg=new Float32Array(Qi.buffer),pg=new Float64Array(Qi.buffer),Zl=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Rd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Rd||(Rd={}));var Er=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 Qi[0]=this.readInt32(t),hg[0]}readFloat64(t){return Qi[Zl?0:1]=this.readInt32(t),Qi[Zl?1:0]=this.readInt32(t+4),pg[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){hg[0]=n,this.writeInt32(t,Qi[0])}writeFloat64(t,n){pg[0]=n,this.writeInt32(t,Qi[Zl?0:1]),this.writeInt32(t+4,Qi[Zl?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===Rd.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 vc=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=Er.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=Er.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 $d;(function(e){e[e.BUFFER=0]="BUFFER"})($d||($d={}));var Pd;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Pd||(Pd={}));var yg=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):Pd.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):$d.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Pd.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,$d.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 Jl=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 Ql=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 Nr=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 Ql).__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 Jl).__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 yg).__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 Wo=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 Nr).__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 da;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(da||(da={}));var Ud;(function(e){e[e.DenseArray=0]="DenseArray"})(Ud||(Ud={}));var Si=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 Ki=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 Si).__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):Ud.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,Ud.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var rn=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 zd=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 jd=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 ha=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):Ve.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Ve.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var to=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 pa=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):ct.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,ct.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var ma=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 ya=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 ga=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):he.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,he.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var xa=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):an.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,an.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var qd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||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 Vd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||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 Yd=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 ba=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 Xd=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 Gd=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 Ho=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):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,n){t.addFieldInt16(0,n,ct.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 Zo=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):ct.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,ct.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 Ii=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):ge.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,ge.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 Wd=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 pe;(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"})(pe||(pe={}));var Cn=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):pe.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 Ki).__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 rn).__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,pe.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 fr=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):da.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Cn).__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 rn).__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,da.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 jt;(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"})(jt||(jt={}));var B;(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"})(B||(B={}));var Mi;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Mi||(Mi={}));var J_={};Ir(J_,{clampIndex:()=>Cj,clampRange:()=>Qd,createElementComparator:()=>_a});var L_={};Ir(L_,{valueToString:()=>Ai});function Ai(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=>Ai(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var k_={};Ir(k_,{BN:()=>Zd,bigNumToBigInt:()=>CD,bigNumToString:()=>eu,isArrowBigNumSymbol:()=>BD});var BD=Symbol.for("isArrowBigNum");function Ti(e,...t){return t.length===0?Object.setPrototypeOf(Pt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ti.prototype[BD]=!0;Ti.prototype.toJSON=function(){return`"${eu(this)}"`};Ti.prototype.valueOf=function(){return LD(this)};Ti.prototype.toString=function(){return eu(this)};Ti.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return LD(this);case"string":return eu(this);case"default":return CD(this)}return eu(this)};function Kl(...e){return Ti.apply(this,e)}function tu(...e){return Ti.apply(this,e)}function Hd(...e){return Ti.apply(this,e)}Object.setPrototypeOf(Kl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(tu.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Hd.prototype,Object.create(Uint32Array.prototype));Object.assign(Kl.prototype,Ti.prototype,{constructor:Kl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(tu.prototype,Ti.prototype,{constructor:tu,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Hd.prototype,Ti.prototype,{constructor:Hd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function LD(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 eu=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return C_(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return C_(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`-${C_(t)}`},CD=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:eu(e);function C_(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 Zd=class e{static new(t,n){switch(n){case!0:return new Kl(t);case!1:return new tu(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Kl(t)}return t.byteLength===16?new Hd(t):new tu(t)}static signed(t){return new Kl(t)}static unsigned(t){return new tu(t)}static decimal(t){return new Hd(t)}constructor(t,n){return e.new(t,n)}};function De(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 kD,FD,RD,$D,PD,UD,zD,jD,qD,VD,YD,XD,GD,WD,HD,ZD,JD,QD,KD,tO,eO,nO,st=class e{static isNull(t){return t?.typeId===B.Null}static isInt(t){return t?.typeId===B.Int}static isFloat(t){return t?.typeId===B.Float}static isBinary(t){return t?.typeId===B.Binary}static isLargeBinary(t){return t?.typeId===B.LargeBinary}static isUtf8(t){return t?.typeId===B.Utf8}static isLargeUtf8(t){return t?.typeId===B.LargeUtf8}static isBool(t){return t?.typeId===B.Bool}static isDecimal(t){return t?.typeId===B.Decimal}static isDate(t){return t?.typeId===B.Date}static isTime(t){return t?.typeId===B.Time}static isTimestamp(t){return t?.typeId===B.Timestamp}static isInterval(t){return t?.typeId===B.Interval}static isDuration(t){return t?.typeId===B.Duration}static isList(t){return t?.typeId===B.List}static isStruct(t){return t?.typeId===B.Struct}static isUnion(t){return t?.typeId===B.Union}static isFixedSizeBinary(t){return t?.typeId===B.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===B.FixedSizeList}static isMap(t){return t?.typeId===B.Map}static isDictionary(t){return t?.typeId===B.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===ge.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===ge.Sparse}constructor(t){this.typeId=t}};kD=Symbol.toStringTag;st[kD]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(st.prototype);var Xn=class extends st{constructor(){super(B.Null)}toString(){return"Null"}};FD=Symbol.toStringTag;Xn[FD]=(e=>e[Symbol.toStringTag]="Null")(Xn.prototype);var Pe=class extends st{constructor(t,n){super(B.Int),this.isSigned=t,this.bitWidth=n}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}`}};RD=Symbol.toStringTag;Pe[RD]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Pe.prototype);var gg=class extends Pe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},xg=class extends Pe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},eo=class extends Pe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},bg=class extends Pe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},wg=class extends Pe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},vg=class extends Pe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},_g=class extends Pe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Sg=class extends Pe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(gg.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(xg.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(eo.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(bg.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(wg.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(vg.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(_g.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Sg.prototype,"ArrayType",{value:BigUint64Array});var dr=class extends st{constructor(t){super(B.Float),this.precision=t}get ArrayType(){switch(this.precision){case he.HALF:return Uint16Array;case he.SINGLE:return Float32Array;case he.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};$D=Symbol.toStringTag;dr[$D]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(dr.prototype);var Ig=class extends dr{constructor(){super(he.HALF)}},Mg=class extends dr{constructor(){super(he.SINGLE)}},Ag=class extends dr{constructor(){super(he.DOUBLE)}};Object.defineProperty(Ig.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Mg.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Ag.prototype,"ArrayType",{value:Float64Array});var Jo=class extends st{constructor(){super(B.Binary)}toString(){return"Binary"}};PD=Symbol.toStringTag;Jo[PD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Jo.prototype);var Qo=class extends st{constructor(){super(B.LargeBinary)}toString(){return"LargeBinary"}};UD=Symbol.toStringTag;Qo[UD]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Qo.prototype);var Ko=class extends st{constructor(){super(B.Utf8)}toString(){return"Utf8"}};zD=Symbol.toStringTag;Ko[zD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ko.prototype);var ts=class extends st{constructor(){super(B.LargeUtf8)}toString(){return"LargeUtf8"}};jD=Symbol.toStringTag;ts[jD]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(ts.prototype);var es=class extends st{constructor(){super(B.Bool)}toString(){return"Bool"}};qD=Symbol.toStringTag;es[qD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(es.prototype);var ns=class extends st{constructor(t,n,r=128){super(B.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};VD=Symbol.toStringTag;ns[VD]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(ns.prototype);var rs=class extends st{constructor(t){super(B.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Ve[this.unit]}>`}};YD=Symbol.toStringTag;rs[YD]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(rs.prototype);var Ei=class extends st{constructor(t,n){super(B.Time),this.unit=t,this.bitWidth=n}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`)}};XD=Symbol.toStringTag;Ei[XD]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Ei.prototype);var is=class extends st{constructor(t,n){super(B.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${ct[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};GD=Symbol.toStringTag;is[GD]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(is.prototype);var os=class extends st{constructor(t){super(B.Interval),this.unit=t}toString(){return`Interval<${an[this.unit]}>`}};WD=Symbol.toStringTag;os[WD]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(os.prototype);var ss=class extends st{constructor(t){super(B.Duration),this.unit=t}toString(){return`Duration<${ct[this.unit]}>`}};HD=Symbol.toStringTag;ss[HD]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(ss.prototype);var Ni=class extends st{constructor(t){super(B.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}};ZD=Symbol.toStringTag;Ni[ZD]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ni.prototype);var be=class extends st{constructor(t){super(B.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};JD=Symbol.toStringTag;be[JD]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(be.prototype);var Di=class extends st{constructor(t,n,r){super(B.Union),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))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};QD=Symbol.toStringTag;Di[QD]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Di.prototype);var as=class extends st{constructor(t){super(B.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};KD=Symbol.toStringTag;as[KD]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(as.prototype);var Oi=class extends st{constructor(t,n){super(B.FixedSizeList),this.listSize=t,this.children=[n]}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}>`}};tO=Symbol.toStringTag;Oi[tO]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Oi.prototype);var Bi=class extends st{constructor(t,n=!1){var r,i,o;if(super(B.Map),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 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(", ")}}>`}};eO=Symbol.toStringTag;Bi[eO]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Bi.prototype);var Wz=(e=>()=>++e)(-1),Dr=class extends st{constructor(t,n,r,i){super(B.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Wz():De(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};nO=Symbol.toStringTag;Dr[nO]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Dr.prototype);function Or(e){let t=e;switch(e.typeId){case B.Decimal:return e.bitWidth/32;case B.Timestamp:return 2;case B.Date:return 1+t.unit;case B.Interval:return 1+t.unit;case B.FixedSizeList:return t.listSize;case B.FixedSizeBinary:return t.byteWidth;default:return 1}}var pt=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 Hz(this,t,n)}getVisitFnByTypeId(t,n=!0){return nu(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}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(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 Hz(e,t,n=!0){return typeof t=="number"?nu(e,t,n):typeof t=="string"&&t in B?nu(e,B[t],n):t&&t instanceof st?nu(e,rO(t),n):t?.type&&t.type instanceof st?nu(e,rO(t.type),n):nu(e,B.NONE,n)}function nu(e,t,n=!0){let r=null;switch(t){case B.Null:r=e.visitNull;break;case B.Bool:r=e.visitBool;break;case B.Int:r=e.visitInt;break;case B.Int8:r=e.visitInt8||e.visitInt;break;case B.Int16:r=e.visitInt16||e.visitInt;break;case B.Int32:r=e.visitInt32||e.visitInt;break;case B.Int64:r=e.visitInt64||e.visitInt;break;case B.Uint8:r=e.visitUint8||e.visitInt;break;case B.Uint16:r=e.visitUint16||e.visitInt;break;case B.Uint32:r=e.visitUint32||e.visitInt;break;case B.Uint64:r=e.visitUint64||e.visitInt;break;case B.Float:r=e.visitFloat;break;case B.Float16:r=e.visitFloat16||e.visitFloat;break;case B.Float32:r=e.visitFloat32||e.visitFloat;break;case B.Float64:r=e.visitFloat64||e.visitFloat;break;case B.Utf8:r=e.visitUtf8;break;case B.LargeUtf8:r=e.visitLargeUtf8;break;case B.Binary:r=e.visitBinary;break;case B.LargeBinary:r=e.visitLargeBinary;break;case B.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case B.Date:r=e.visitDate;break;case B.DateDay:r=e.visitDateDay||e.visitDate;break;case B.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case B.Timestamp:r=e.visitTimestamp;break;case B.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case B.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case B.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case B.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case B.Time:r=e.visitTime;break;case B.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case B.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case B.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case B.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case B.Decimal:r=e.visitDecimal;break;case B.List:r=e.visitList;break;case B.Struct:r=e.visitStruct;break;case B.Union:r=e.visitUnion;break;case B.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case B.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case B.Dictionary:r=e.visitDictionary;break;case B.Interval:r=e.visitInterval;break;case B.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case B.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case B.Duration:r=e.visitDuration;break;case B.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case B.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case B.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case B.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case B.FixedSizeList:r=e.visitFixedSizeList;break;case B.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${B[t]}'`)}function rO(e){switch(e.typeId){case B.Null:return B.Null;case B.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?B.Int8:B.Uint8;case 16:return n?B.Int16:B.Uint16;case 32:return n?B.Int32:B.Uint32;case 64:return n?B.Int64:B.Uint64}return B.Int}case B.Float:switch(e.precision){case he.HALF:return B.Float16;case he.SINGLE:return B.Float32;case he.DOUBLE:return B.Float64}return B.Float;case B.Binary:return B.Binary;case B.LargeBinary:return B.LargeBinary;case B.Utf8:return B.Utf8;case B.LargeUtf8:return B.LargeUtf8;case B.Bool:return B.Bool;case B.Decimal:return B.Decimal;case B.Time:switch(e.unit){case ct.SECOND:return B.TimeSecond;case ct.MILLISECOND:return B.TimeMillisecond;case ct.MICROSECOND:return B.TimeMicrosecond;case ct.NANOSECOND:return B.TimeNanosecond}return B.Time;case B.Timestamp:switch(e.unit){case ct.SECOND:return B.TimestampSecond;case ct.MILLISECOND:return B.TimestampMillisecond;case ct.MICROSECOND:return B.TimestampMicrosecond;case ct.NANOSECOND:return B.TimestampNanosecond}return B.Timestamp;case B.Date:switch(e.unit){case Ve.DAY:return B.DateDay;case Ve.MILLISECOND:return B.DateMillisecond}return B.Date;case B.Interval:switch(e.unit){case an.DAY_TIME:return B.IntervalDayTime;case an.YEAR_MONTH:return B.IntervalYearMonth}return B.Interval;case B.Duration:switch(e.unit){case ct.SECOND:return B.DurationSecond;case ct.MILLISECOND:return B.DurationMillisecond;case ct.MICROSECOND:return B.DurationMicrosecond;case ct.NANOSECOND:return B.DurationNanosecond}return B.Duration;case B.Map:return B.Map;case B.List:return B.List;case B.Struct:return B.Struct;case B.Union:switch(e.mode){case ge.Dense:return B.DenseUnion;case ge.Sparse:return B.SparseUnion}return B.Union;case B.FixedSizeBinary:return B.FixedSizeBinary;case B.FixedSizeList:return B.FixedSizeList;case B.Dictionary:return B.Dictionary}throw new Error(`Unrecognized type '${B[e.typeId]}'`)}pt.prototype.visitInt8=null;pt.prototype.visitInt16=null;pt.prototype.visitInt32=null;pt.prototype.visitInt64=null;pt.prototype.visitUint8=null;pt.prototype.visitUint16=null;pt.prototype.visitUint32=null;pt.prototype.visitUint64=null;pt.prototype.visitFloat16=null;pt.prototype.visitFloat32=null;pt.prototype.visitFloat64=null;pt.prototype.visitDateDay=null;pt.prototype.visitDateMillisecond=null;pt.prototype.visitTimestampSecond=null;pt.prototype.visitTimestampMillisecond=null;pt.prototype.visitTimestampMicrosecond=null;pt.prototype.visitTimestampNanosecond=null;pt.prototype.visitTimeSecond=null;pt.prototype.visitTimeMillisecond=null;pt.prototype.visitTimeMicrosecond=null;pt.prototype.visitTimeNanosecond=null;pt.prototype.visitDenseUnion=null;pt.prototype.visitSparseUnion=null;pt.prototype.visitIntervalDayTime=null;pt.prototype.visitIntervalYearMonth=null;pt.prototype.visitDuration=null;pt.prototype.visitDurationSecond=null;pt.prototype.visitDurationMillisecond=null;pt.prototype.visitDurationMicrosecond=null;pt.prototype.visitDurationNanosecond=null;var F_={};Ir(F_,{float64ToUint16:()=>Jd,uint16ToFloat64:()=>Tg});var iO=new Float64Array(1),ru=new Uint32Array(iO.buffer);function Tg(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 Jd(e){if(e!==e)return 32256;iO[0]=e;let t=(ru[1]&2147483648)>>16&65535,n=ru[1]&2146435072,r=0;return n>=1089470464?ru[0]>0?n=31744:(n=(n&2080374784)>>16,r=(ru[1]&1048575)>>10):n<=1056964608?(r=1048576+(ru[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(ru[1]&1048575)+512>>10),t|n|r&65535}var wt=class extends pt{};function Tt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Zz=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},R_=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},Jz=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},Qz=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},oO=(e,t,n,r)=>{if(n+1<t.length){let i=De(t[n]),o=De(t[n+1]);e.set(r.subarray(0,o-i),i)}},Kz=({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},$_=({values:e},t,n)=>{e[t]=n},sO=({values:e},t,n)=>{e[t]=Jd(n)},tj=(e,t,n)=>{switch(e.type.precision){case he.HALF:return sO(e,t,n);case he.SINGLE:case he.DOUBLE:return $_(e,t,n)}},Eg=({values:e},t,n)=>{Zz(e,t,n.valueOf())},Ng=({values:e},t,n)=>{R_(e,t*2,n.valueOf())},P_=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},aO=({values:e,valueOffsets:t},n,r)=>oO(e,t,n,r),cO=({values:e,valueOffsets:t},n,r)=>oO(e,t,n,Zi(r)),U_=(e,t,n)=>{e.type.unit===Ve.DAY?Eg(e,t,n):Ng(e,t,n)},Dg=({values:e},t,n)=>R_(e,t*2,n/1e3),Og=({values:e},t,n)=>R_(e,t*2,n),Bg=({values:e},t,n)=>Jz(e,t*2,n),Lg=({values:e},t,n)=>Qz(e,t*2,n),z_=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return Dg(e,t,n);case ct.MILLISECOND:return Og(e,t,n);case ct.MICROSECOND:return Bg(e,t,n);case ct.NANOSECOND:return Lg(e,t,n)}},Cg=({values:e},t,n)=>{e[t]=n},kg=({values:e},t,n)=>{e[t]=n},Fg=({values:e},t,n)=>{e[t]=n},Rg=({values:e},t,n)=>{e[t]=n},j_=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return Cg(e,t,n);case ct.MILLISECOND:return kg(e,t,n);case ct.MICROSECOND:return Fg(e,t,n);case ct.NANOSECOND:return Rg(e,t,n)}},q_=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},ej=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=wn.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))},nj=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=wn.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},rj=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),ij=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),oj=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),sj=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),aj=(e,t,n)=>{let r=e.type.children.map(o=>wn.getVisitFn(o.type)),i=n instanceof Map?oj(t,n):n instanceof Xt?ij(t,n):Array.isArray(n)?rj(t,n):sj(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},cj=(e,t,n)=>{e.type.mode===ge.Dense?lO(e,t,n):uO(e,t,n)},lO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,e.valueOffsets[t],n)},uO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,t,n)},lj=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},V_=(e,t,n)=>{e.type.unit===an.DAY_TIME?$g(e,t,n):Pg(e,t,n)},$g=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Pg=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Ug=({values:e},t,n)=>{e[t]=n},zg=({values:e},t,n)=>{e[t]=n},jg=({values:e},t,n)=>{e[t]=n},qg=({values:e},t,n)=>{e[t]=n},Y_=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return Ug(e,t,n);case ct.MILLISECOND:return zg(e,t,n);case ct.MICROSECOND:return jg(e,t,n);case ct.NANOSECOND:return qg(e,t,n)}},uj=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=wn.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))};wt.prototype.visitBool=Tt(Kz);wt.prototype.visitInt=Tt(cs);wt.prototype.visitInt8=Tt(cs);wt.prototype.visitInt16=Tt(cs);wt.prototype.visitInt32=Tt(cs);wt.prototype.visitInt64=Tt(cs);wt.prototype.visitUint8=Tt(cs);wt.prototype.visitUint16=Tt(cs);wt.prototype.visitUint32=Tt(cs);wt.prototype.visitUint64=Tt(cs);wt.prototype.visitFloat=Tt(tj);wt.prototype.visitFloat16=Tt(sO);wt.prototype.visitFloat32=Tt($_);wt.prototype.visitFloat64=Tt($_);wt.prototype.visitUtf8=Tt(cO);wt.prototype.visitLargeUtf8=Tt(cO);wt.prototype.visitBinary=Tt(aO);wt.prototype.visitLargeBinary=Tt(aO);wt.prototype.visitFixedSizeBinary=Tt(P_);wt.prototype.visitDate=Tt(U_);wt.prototype.visitDateDay=Tt(Eg);wt.prototype.visitDateMillisecond=Tt(Ng);wt.prototype.visitTimestamp=Tt(z_);wt.prototype.visitTimestampSecond=Tt(Dg);wt.prototype.visitTimestampMillisecond=Tt(Og);wt.prototype.visitTimestampMicrosecond=Tt(Bg);wt.prototype.visitTimestampNanosecond=Tt(Lg);wt.prototype.visitTime=Tt(j_);wt.prototype.visitTimeSecond=Tt(Cg);wt.prototype.visitTimeMillisecond=Tt(kg);wt.prototype.visitTimeMicrosecond=Tt(Fg);wt.prototype.visitTimeNanosecond=Tt(Rg);wt.prototype.visitDecimal=Tt(q_);wt.prototype.visitList=Tt(ej);wt.prototype.visitStruct=Tt(aj);wt.prototype.visitUnion=Tt(cj);wt.prototype.visitDenseUnion=Tt(lO);wt.prototype.visitSparseUnion=Tt(uO);wt.prototype.visitDictionary=Tt(lj);wt.prototype.visitInterval=Tt(V_);wt.prototype.visitIntervalDayTime=Tt($g);wt.prototype.visitIntervalYearMonth=Tt(Pg);wt.prototype.visitDuration=Tt(Y_);wt.prototype.visitDurationSecond=Tt(Ug);wt.prototype.visitDurationMillisecond=Tt(zg);wt.prototype.visitDurationMicrosecond=Tt(jg);wt.prototype.visitDurationNanosecond=Tt(qg);wt.prototype.visitFixedSizeList=Tt(uj);wt.prototype.visitMap=Tt(nj);var wn=new wt;var Li=Symbol.for("parent"),iu=Symbol.for("rowIndex"),wa=class{constructor(t,n){return this[Li]=t,this[iu]=n,new Proxy(this,new G_)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[iu],n=this[Li],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=Ye.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Ai(t)}: ${Ai(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new X_(this[Li],this[iu])}},X_=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,Ye.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(wa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Li]:{writable:!0,enumerable:!1,configurable:!1,value:null},[iu]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var G_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Li].type.children.map(n=>n.name)}has(t,n){return t[Li].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Li].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[Li].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=Ye.visit(t[Li].children[r],t[iu]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Li].type.children.findIndex(o=>o.name===n);return i!==-1?(wn.visit(t[Li].children[i],t[iu],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var mt=class extends pt{};function It(e){return(t,n)=>t.getValid(n)?e(t,n):null}var fj=(e,t)=>864e5*e[t],W_=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),dj=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,hj=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,fO=e=>new Date(e),pj=(e,t)=>fO(fj(e,t)),mj=(e,t)=>fO(W_(e,t)),yj=(e,t)=>null,dO=(e,t,n)=>{if(n+1>=t.length)return null;let r=De(t[n]),i=De(t[n+1]);return e.subarray(r,i)},gj=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},hO=({values:e},t)=>pj(e,t),pO=({values:e},t)=>mj(e,t*2),va=({stride:e,values:t},n)=>t[e*n],xj=({stride:e,values:t},n)=>Tg(t[e*n]),mO=({values:e},t)=>e[t],bj=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),yO=({values:e,valueOffsets:t},n)=>dO(e,t,n),gO=({values:e,valueOffsets:t},n)=>{let r=dO(e,t,n);return r!==null?Cd(r):null},wj=({values:e},t)=>e[t],vj=({type:e,values:t},n)=>e.precision!==he.HALF?t[n]:Tg(t[n]),_j=(e,t)=>e.type.unit===Ve.DAY?hO(e,t):pO(e,t),xO=({values:e},t)=>1e3*W_(e,t*2),bO=({values:e},t)=>W_(e,t*2),wO=({values:e},t)=>dj(e,t*2),vO=({values:e},t)=>hj(e,t*2),Sj=(e,t)=>{switch(e.type.unit){case ct.SECOND:return xO(e,t);case ct.MILLISECOND:return bO(e,t);case ct.MICROSECOND:return wO(e,t);case ct.NANOSECOND:return vO(e,t)}},_O=({values:e},t)=>e[t],SO=({values:e},t)=>e[t],IO=({values:e},t)=>e[t],MO=({values:e},t)=>e[t],Ij=(e,t)=>{switch(e.type.unit){case ct.SECOND:return _O(e,t);case ct.MILLISECOND:return SO(e,t);case ct.MICROSECOND:return IO(e,t);case ct.NANOSECOND:return MO(e,t)}},Mj=({values:e,stride:t},n)=>Zd.decimal(e.subarray(t*n,t*(n+1))),Aj=(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 Xt([c])},Tj=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new no(s.slice(i,o-i))},Ej=(e,t)=>new wa(e,t),Nj=(e,t)=>e.type.mode===ge.Dense?AO(e,t):TO(e,t),AO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ye.visit(r,e.valueOffsets[t])},TO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ye.visit(r,t)},Dj=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},Oj=(e,t)=>e.type.unit===an.DAY_TIME?EO(e,t):NO(e,t),EO=({values:e},t)=>e.subarray(2*t,2*(t+1)),NO=({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},DO=({values:e},t)=>e[t],OO=({values:e},t)=>e[t],BO=({values:e},t)=>e[t],LO=({values:e},t)=>e[t],Bj=(e,t)=>{switch(e.type.unit){case ct.SECOND:return DO(e,t);case ct.MILLISECOND:return OO(e,t);case ct.MICROSECOND:return BO(e,t);case ct.NANOSECOND:return LO(e,t)}},Lj=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Xt([o])};mt.prototype.visitNull=It(yj);mt.prototype.visitBool=It(gj);mt.prototype.visitInt=It(wj);mt.prototype.visitInt8=It(va);mt.prototype.visitInt16=It(va);mt.prototype.visitInt32=It(va);mt.prototype.visitInt64=It(mO);mt.prototype.visitUint8=It(va);mt.prototype.visitUint16=It(va);mt.prototype.visitUint32=It(va);mt.prototype.visitUint64=It(mO);mt.prototype.visitFloat=It(vj);mt.prototype.visitFloat16=It(xj);mt.prototype.visitFloat32=It(va);mt.prototype.visitFloat64=It(va);mt.prototype.visitUtf8=It(gO);mt.prototype.visitLargeUtf8=It(gO);mt.prototype.visitBinary=It(yO);mt.prototype.visitLargeBinary=It(yO);mt.prototype.visitFixedSizeBinary=It(bj);mt.prototype.visitDate=It(_j);mt.prototype.visitDateDay=It(hO);mt.prototype.visitDateMillisecond=It(pO);mt.prototype.visitTimestamp=It(Sj);mt.prototype.visitTimestampSecond=It(xO);mt.prototype.visitTimestampMillisecond=It(bO);mt.prototype.visitTimestampMicrosecond=It(wO);mt.prototype.visitTimestampNanosecond=It(vO);mt.prototype.visitTime=It(Ij);mt.prototype.visitTimeSecond=It(_O);mt.prototype.visitTimeMillisecond=It(SO);mt.prototype.visitTimeMicrosecond=It(IO);mt.prototype.visitTimeNanosecond=It(MO);mt.prototype.visitDecimal=It(Mj);mt.prototype.visitList=It(Aj);mt.prototype.visitStruct=It(Ej);mt.prototype.visitUnion=It(Nj);mt.prototype.visitDenseUnion=It(AO);mt.prototype.visitSparseUnion=It(TO);mt.prototype.visitDictionary=It(Dj);mt.prototype.visitInterval=It(Oj);mt.prototype.visitIntervalDayTime=It(EO);mt.prototype.visitIntervalYearMonth=It(NO);mt.prototype.visitDuration=It(Bj);mt.prototype.visitDurationSecond=It(DO);mt.prototype.visitDurationMillisecond=It(OO);mt.prototype.visitDurationMicrosecond=It(BO);mt.prototype.visitDurationNanosecond=It(LO);mt.prototype.visitFixedSizeList=It(Lj);mt.prototype.visitMap=It(Tj);var Ye=new mt;var Zr=Symbol.for("keys"),ou=Symbol.for("vals"),no=class{constructor(t){return this[Zr]=new Xt([t.children[0]]).memoize(),this[ou]=t.children[1],new Proxy(this,new Z_)}[Symbol.iterator](){return new H_(this[Zr],this[ou])}get size(){return this[Zr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Zr],n=this[ou],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=Ye.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Ai(t)}: ${Ai(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},H_=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),Ye.visit(this.vals,t)]})}},Z_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Zr].toArray().map(String)}has(t,n){return t[Zr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Zr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Zr].indexOf(n);if(r!==-1){let i=Ye.visit(Reflect.get(t,ou),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Zr].indexOf(n);return i!==-1?(wn.visit(Reflect.get(t,ou),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(no.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Zr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ou]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Cj(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var CO;function Qd(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&&(CO=o,o=s,s=CO),s>i&&(s=i),r?r(e,o,s):[o,s]}var kO=e=>e!==e;function _a(e){if(typeof e!=="object"||e===null)return kO(e)?kO: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?N_(e,n):!1:e instanceof Map?Fj(e):Array.isArray(e)?kj(e):e instanceof Xt?Rj(e):$j(e,!0)}function kj(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=_a(e[n]);return Vg(t)}function Fj(e){let t=-1,n=[];for(let r of e.values())n[++t]=_a(r);return Vg(n)}function Rj(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=_a(e.get(n));return Vg(t)}function $j(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]=_a(e[n[i]]);return Vg(r,n)}function Vg(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return Pj(e,n);case Map:return FO(e,n,n.keys());case no:case wa:case Object:case void 0:return FO(e,n,t||Object.keys(n))}return n instanceof Xt?Uj(e,n):!1}}function Pj(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 Uj(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 FO(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 Q_={};Ir(Q_,{BitIterator:()=>_c,getBit:()=>RO,getBool:()=>Xg,packBools:()=>Ic,popcnt_array:()=>$O,popcnt_bit_range:()=>Kd,popcnt_uint32:()=>Yg,setBool:()=>zj,truncateBitmap:()=>Sc});function Xg(e,t,n,r){return(n&1<<r)!==0}function RO(e,t,n,r){return(n&1<<r)>>r}function zj(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Sc(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):Ic(new _c(n,e,t,null,Xg)).subarray(0,r)),i}return n}function Ic(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 _c=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 Kd(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new _c(e,t,n-t,e,RO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Kd(e,t,i)+Kd(e,r,n)+$O(e,i>>3,r-i>>3)}function $O(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+=Yg(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=Yg(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=Yg(o.getUint8(i)),i+=1;return r}function Yg(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 jj=-1,te=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 st.isSparseUnion(t)?this.children.some(n=>n.nullable):st.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(st.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=jj&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Kd(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=Or(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(st.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===ge.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(st.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===ge.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(Sc(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===B.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(Sc(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Mi.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[Mi.TYPE])&&(s[Mi.TYPE]=o.subarray(t,t+n)),(o=s[Mi.OFFSET])&&(s[Mi.OFFSET]=o.subarray(t,t+n+1))||(o=s[Mi.DATA])&&(s[Mi.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};te.prototype.children=Object.freeze([]);var K_=class e extends pt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new te(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=ug(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=ug(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=_t(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Pt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(st.isSparseUnion(n))return new te(n,r,s,a,[void 0,void 0,void 0,o],i);let c=wc(t.valueOffsets);return new te(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new Xt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(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=_t(t.nullBitmap),{["length"]:s=i.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(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=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,void 0,o],[i])}},qj=new K_;function Nt(e){return qj.visit(e)}var th=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 PO(e){return e.some(t=>t.nullable)}function Gg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Wg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Hg(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 t2(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 eh(e,t){return e.getValid(t)}function su(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return t2(r,this._offsets,n,t)}}function Zg(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=t2(o,this._offsets,r,n);return t=void 0,s}}function Jg(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):t2(o,this._offsets,i,n);return t=void 0,s}}var yt=class extends pt{};function Vj(e,t){return t===null&&e.length>0?0:-1}function Yj(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new _c(n,e.offset+(t||0),e.length,n,Xg)){if(!i)return r;++r}return-1}function Dt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case B.Union:break;case B.Dictionary:break;default:return Yj(e,n)}let r=Ye.getVisitFn(e),i=_a(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function UO(e,t,n){let r=Ye.getVisitFn(e),i=_a(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}yt.prototype.visitNull=Vj;yt.prototype.visitBool=Dt;yt.prototype.visitInt=Dt;yt.prototype.visitInt8=Dt;yt.prototype.visitInt16=Dt;yt.prototype.visitInt32=Dt;yt.prototype.visitInt64=Dt;yt.prototype.visitUint8=Dt;yt.prototype.visitUint16=Dt;yt.prototype.visitUint32=Dt;yt.prototype.visitUint64=Dt;yt.prototype.visitFloat=Dt;yt.prototype.visitFloat16=Dt;yt.prototype.visitFloat32=Dt;yt.prototype.visitFloat64=Dt;yt.prototype.visitUtf8=Dt;yt.prototype.visitLargeUtf8=Dt;yt.prototype.visitBinary=Dt;yt.prototype.visitLargeBinary=Dt;yt.prototype.visitFixedSizeBinary=Dt;yt.prototype.visitDate=Dt;yt.prototype.visitDateDay=Dt;yt.prototype.visitDateMillisecond=Dt;yt.prototype.visitTimestamp=Dt;yt.prototype.visitTimestampSecond=Dt;yt.prototype.visitTimestampMillisecond=Dt;yt.prototype.visitTimestampMicrosecond=Dt;yt.prototype.visitTimestampNanosecond=Dt;yt.prototype.visitTime=Dt;yt.prototype.visitTimeSecond=Dt;yt.prototype.visitTimeMillisecond=Dt;yt.prototype.visitTimeMicrosecond=Dt;yt.prototype.visitTimeNanosecond=Dt;yt.prototype.visitDecimal=Dt;yt.prototype.visitList=Dt;yt.prototype.visitStruct=Dt;yt.prototype.visitUnion=Dt;yt.prototype.visitDenseUnion=UO;yt.prototype.visitSparseUnion=UO;yt.prototype.visitDictionary=Dt;yt.prototype.visitInterval=Dt;yt.prototype.visitIntervalDayTime=Dt;yt.prototype.visitIntervalYearMonth=Dt;yt.prototype.visitDuration=Dt;yt.prototype.visitDurationSecond=Dt;yt.prototype.visitDurationMillisecond=Dt;yt.prototype.visitDurationMicrosecond=Dt;yt.prototype.visitDurationNanosecond=Dt;yt.prototype.visitFixedSizeList=Dt;yt.prototype.visitMap=Dt;var Mc=new yt;var gt=class extends pt{};function Mt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===B.Timestamp||t instanceof Pe&&t.bitWidth!==64||t instanceof Ei&&t.bitWidth!==64||t instanceof dr&&t.precision!==he.HALF))return new th(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new th(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new e2(s)})}var e2=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}};gt.prototype.visitNull=Mt;gt.prototype.visitBool=Mt;gt.prototype.visitInt=Mt;gt.prototype.visitInt8=Mt;gt.prototype.visitInt16=Mt;gt.prototype.visitInt32=Mt;gt.prototype.visitInt64=Mt;gt.prototype.visitUint8=Mt;gt.prototype.visitUint16=Mt;gt.prototype.visitUint32=Mt;gt.prototype.visitUint64=Mt;gt.prototype.visitFloat=Mt;gt.prototype.visitFloat16=Mt;gt.prototype.visitFloat32=Mt;gt.prototype.visitFloat64=Mt;gt.prototype.visitUtf8=Mt;gt.prototype.visitLargeUtf8=Mt;gt.prototype.visitBinary=Mt;gt.prototype.visitLargeBinary=Mt;gt.prototype.visitFixedSizeBinary=Mt;gt.prototype.visitDate=Mt;gt.prototype.visitDateDay=Mt;gt.prototype.visitDateMillisecond=Mt;gt.prototype.visitTimestamp=Mt;gt.prototype.visitTimestampSecond=Mt;gt.prototype.visitTimestampMillisecond=Mt;gt.prototype.visitTimestampMicrosecond=Mt;gt.prototype.visitTimestampNanosecond=Mt;gt.prototype.visitTime=Mt;gt.prototype.visitTimeSecond=Mt;gt.prototype.visitTimeMillisecond=Mt;gt.prototype.visitTimeMicrosecond=Mt;gt.prototype.visitTimeNanosecond=Mt;gt.prototype.visitDecimal=Mt;gt.prototype.visitList=Mt;gt.prototype.visitStruct=Mt;gt.prototype.visitUnion=Mt;gt.prototype.visitDenseUnion=Mt;gt.prototype.visitSparseUnion=Mt;gt.prototype.visitDictionary=Mt;gt.prototype.visitInterval=Mt;gt.prototype.visitIntervalDayTime=Mt;gt.prototype.visitIntervalYearMonth=Mt;gt.prototype.visitDuration=Mt;gt.prototype.visitDurationSecond=Mt;gt.prototype.visitDurationMillisecond=Mt;gt.prototype.visitDurationMicrosecond=Mt;gt.prototype.visitDurationNanosecond=Mt;gt.prototype.visitFixedSizeList=Mt;gt.prototype.visitMap=Mt;var au=new gt;var zO,jO={},qO={},Xt=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 te)))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}=jO[s.typeId],u=o[0];this.isValid=f=>eh(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,qO[s.typeId]),this._offsets=Wg(o);break}this.data=o,this.type=s,this.stride=Or(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 nullable(){return PO(this.data)}get nullCount(){return Gg(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${B[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}[Symbol.iterator](){return au.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(Qd(this,t,n,({data:r,_offsets:i},o,s)=>Hg(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case B.Int:case B.Float:case B.Decimal:case B.Time:case B.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 st.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(st.isDictionary(this.type)){let t=new Qg(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Qg(this)}unmemoize(){if(st.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}};zO=Symbol.toStringTag;Xt[zO]=(e=>{e.type=st.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(B).map(n=>B[n]).filter(n=>typeof n=="number"&&n!==B.NONE);for(let n of t){let r=Ye.getVisitFnByTypeId(n),i=wn.getVisitFnByTypeId(n),o=Mc.getVisitFnByTypeId(n);jO[n]={get:r,set:i,indexOf:o},qO[n]=Object.create(e,{isValid:{value:su(eh)},get:{value:su(Ye.getVisitFnByTypeId(n))},set:{value:Zg(wn.getVisitFnByTypeId(n))},indexOf:{value:Jg(Mc.getVisitFnByTypeId(n))}})}return"Vector"})(Xt.prototype);var Qg=class e extends Xt{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 Xt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function VO(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
1
+ var uz=Object.create;var I_=Object.defineProperty;var fz=Object.getOwnPropertyDescriptor;var dz=Object.getOwnPropertyNames;var hz=Object.getPrototypeOf,pz=Object.prototype.hasOwnProperty;var TD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ir=(e,t)=>{for(var n in t)I_(e,n,{get:t[n],enumerable:!0})},mz=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dz(t))!pz.call(e,i)&&i!==n&&I_(e,i,{get:()=>t[i],enumerable:!(r=fz(t,i))||r.enumerable});return e};var yz=(e,t,n)=>(n=e!=null?uz(hz(e)):{},mz(t||!e||!e.__esModule?I_(n,"default",{value:e,enumerable:!0}):n,e));var aP=TD((U9t,sP)=>{"use strict";function Gtt(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 Wtt(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 Htt(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 Ztt(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 Jtt(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 Ay(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)}sP.exports={ge:function(e,t,n,r,i){return Ay(e,t,n,r,i,Gtt)},gt:function(e,t,n,r,i){return Ay(e,t,n,r,i,Wtt)},lt:function(e,t,n,r,i){return Ay(e,t,n,r,i,Htt)},le:function(e,t,n,r,i){return Ay(e,t,n,r,i,Ztt)},eq:function(e,t,n,r,i){return Ay(e,t,n,r,i,Jtt)}}});var mP=TD((z9t,pP)=>{"use strict";var Tv=aP(),hd=0,zl=1,Av=2;pP.exports=Ktt;function N3(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 Ty=N3.prototype;function T3(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 uP(e,t){var n=pd(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 cP(e,t){var n=e.intervals([]);n.push(t),uP(e,n)}function lP(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?hd:(n.splice(r,1),uP(e,n),zl)}Ty.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Ty.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)?cP(this,e):this.left.insert(e):this.left=pd([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?cP(this,e):this.right.insert(e):this.right=pd([e]);else{var n=Tv.ge(this.leftPoints,e,D3),r=Tv.ge(this.rightPoints,e,O3);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Ty.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return hd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return lP(this,e);var r=this.left.remove(e);return r===Av?(this.left=null,this.count-=1,zl):(r===zl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return hd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return lP(this,e);var r=this.right.remove(e);return r===Av?(this.right=null,this.count-=1,zl):(r===zl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?Av:hd;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}T3(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?T3(this,this.left):T3(this,this.right);return zl}for(var a=Tv.ge(this.leftPoints,e,D3);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=Tv.ge(this.rightPoints,e,O3);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),zl}return hd}};function fP(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 dP(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 hP(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Ty.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return fP(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return dP(this.rightPoints,e,t)}else return hP(this.leftPoints,t)};Ty.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?fP(this.leftPoints,t,n):e>this.mid?dP(this.rightPoints,e,n):hP(this.leftPoints,n)};function Qtt(e,t){return e-t}function D3(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function O3(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function pd(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(Qtt);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(D3),l.sort(O3),new N3(r,pd(i),pd(o),c,l)}function E3(e){this.root=e}var md=E3.prototype;md.insert=function(e){this.root?this.root.insert(e):this.root=new N3(e[0],null,null,[e],[e])};md.remove=function(e){if(this.root){var t=this.root.remove(e);return t===Av&&(this.root=null),t!==hd}return!1};md.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};md.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(md,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(md,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function Ktt(e){return!e||e.length===0?new E3(null):new E3(pd(e))}});var ED={};function kd(e,t=!1){let n,r,i=ED;function o(l){n=e(l).then(()=>{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=ED,a(u)}),i=l}return t?c:a}var ur=class{constructor(t){this._filterBy=t,this._requestUpdate=kd(()=>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(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function DD(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 ND(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 Ft(e){return this instanceof Ft?(this.v=e,this):new Ft(e)}function Mr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){o.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Ft?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Hl(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:Ft(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 ND=="function"?ND(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 D_={};Ir(D_,{compareArrayLike:()=>N_,joinUint8Arrays:()=>Tr,memcpy:()=>$d,rebaseValueOffsets:()=>hg,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>vi,toArrayBufferViewIterator:()=>Ji,toBigInt64Array:()=>dg,toBigUint64Array:()=>Mz,toFloat32Array:()=>Az,toFloat32ArrayAsyncIterator:()=>qz,toFloat32ArrayIterator:()=>Cz,toFloat64Array:()=>Tz,toFloat64ArrayAsyncIterator:()=>jz,toFloat64ArrayIterator:()=>kz,toInt16Array:()=>_z,toInt16ArrayAsyncIterator:()=>$z,toInt16ArrayIterator:()=>Dz,toInt32Array:()=>wc,toInt32ArrayAsyncIterator:()=>Pz,toInt32ArrayIterator:()=>Oz,toInt8Array:()=>vz,toInt8ArrayAsyncIterator:()=>Rz,toInt8ArrayIterator:()=>Nz,toUint16Array:()=>Sz,toUint16ArrayAsyncIterator:()=>Uz,toUint16ArrayIterator:()=>Bz,toUint32Array:()=>Iz,toUint32ArrayAsyncIterator:()=>zz,toUint32ArrayIterator:()=>Lz,toUint8Array:()=>_t,toUint8ArrayAsyncIterator:()=>E_,toUint8ArrayIterator:()=>T_,toUint8ClampedArray:()=>Ez,toUint8ClampedArrayAsyncIterator:()=>Vz,toUint8ClampedArrayIterator:()=>Fz});var gz=new TextDecoder("utf-8"),Fd=e=>gz.decode(e),xz=new TextEncoder,Zi=e=>xz.encode(e);var bz=e=>typeof e=="number",OD=e=>typeof e=="boolean",nn=e=>typeof e=="function",Yn=e=>e!=null&&Object(e)===e,Ar=e=>Yn(e)&&nn(e.then);var wi=e=>Yn(e)&&nn(e[Symbol.iterator]),Wr=e=>Yn(e)&&nn(e[Symbol.asyncIterator]),sg=e=>Yn(e)&&Yn(e.schema);var ag=e=>Yn(e)&&"done"in e&&"value"in e;var cg=e=>Yn(e)&&nn(e.stat)&&bz(e.fd);var lg=e=>Yn(e)&&Rd(e.body),ug=e=>"_getDOMStream"in e&&"_getNodeStream"in e,BD=e=>Yn(e)&&nn(e.abort)&&nn(e.getWriter)&&!ug(e),Rd=e=>Yn(e)&&nn(e.cancel)&&nn(e.getReader)&&!ug(e),LD=e=>Yn(e)&&nn(e.end)&&nn(e.write)&&OD(e.writable)&&!ug(e),fg=e=>Yn(e)&&nn(e.read)&&nn(e.pipe)&&OD(e.readable)&&!ug(e),CD=e=>Yn(e)&&nn(e.clear)&&nn(e.bytes)&&nn(e.position)&&nn(e.setPosition)&&nn(e.capacity)&&nn(e.getBufferIdentifier)&&nn(e.createLong);var A_=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function wz(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 $d(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 Tr(e,t){let n=wz(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?$d(s,o,a):s=o;break}$d(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Pt(e,t){let n=ag(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Zi(n)),n instanceof ArrayBuffer?new e(n):n instanceof A_?new e(n):CD(n)?Pt(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 vz=e=>Pt(Int8Array,e),_z=e=>Pt(Int16Array,e),wc=e=>Pt(Int32Array,e),dg=e=>Pt(BigInt64Array,e),_t=e=>Pt(Uint8Array,e),Sz=e=>Pt(Uint16Array,e),Iz=e=>Pt(Uint32Array,e),Mz=e=>Pt(BigUint64Array,e),Az=e=>Pt(Float32Array,e),Tz=e=>Pt(Float64Array,e),Ez=e=>Pt(Uint8ClampedArray,e),M_=e=>(e.next(),e);function*Ji(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof A_?n(t):wi(t)?t:n(t);return yield*M_(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var Nz=e=>Ji(Int8Array,e),Dz=e=>Ji(Int16Array,e),Oz=e=>Ji(Int32Array,e),T_=e=>Ji(Uint8Array,e),Bz=e=>Ji(Uint16Array,e),Lz=e=>Ji(Uint32Array,e),Cz=e=>Ji(Float32Array,e),kz=e=>Ji(Float64Array,e),Fz=e=>Ji(Uint8ClampedArray,e);function vi(e,t){return Mr(this,arguments,function*(){if(Ar(t))return yield Ft(yield Ft(yield*Hl(bi(vi(e,yield Ft(t))))));let r=function(s){return Mr(this,arguments,function*(){yield yield Ft(yield Ft(s))})},i=function(s){return Mr(this,arguments,function*(){yield Ft(yield*Hl(bi(M_(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 A_?r(t):wi(t)?i(t):Wr(t)?t:r(t);return yield Ft(yield*Hl(bi(M_(function(s){return Mr(this,arguments,function*(){let a=null;do a=yield Ft(s.next(yield yield Ft(Pt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ft(new e)})}var Rz=e=>vi(Int8Array,e),$z=e=>vi(Int16Array,e),Pz=e=>vi(Int32Array,e),E_=e=>vi(Uint8Array,e),Uz=e=>vi(Uint16Array,e),zz=e=>vi(Uint32Array,e),qz=e=>vi(Float32Array,e),jz=e=>vi(Float64Array,e),Vz=e=>vi(Uint8ClampedArray,e);function hg(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 N_(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 bn={fromIterable(e){return pg(Yz(e))},fromAsyncIterable(e){return pg(Xz(e))},fromDOMStream(e){return pg(Gz(e))},fromNodeStream(e){return pg(Wz(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')}},pg=e=>(e.next(),e);function*Yz(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Tr(r,s)[0]:([i,r,a]=Tr(r,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=T_(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 Xz(e){return Mr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=E_(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.next()):yield Ft(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ft(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ft(u.return(new Uint8Array(0))))}return yield Ft(null)})}function Gz(e){return Mr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=new B_(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.read()):yield Ft(u.read(a-c)),!n&&o.byteLength>0&&(i.push(_t(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ft(u.cancel(f)))}finally{r===!1?yield Ft(u.cancel()):e.locked&&u.releaseLock()}return yield Ft(null)})}var B_=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=_t(n)),n})}},O_=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Wz(e){return Mr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Tr(l,a)[0]:([u,l,c]=Tr(l,a),u)}if({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ft(new Uint8Array(0)),yield Ft(null);try{n[0]=O_(e,"end"),n[1]=O_(e,"error");do{if(n[2]=O_(e,"readable"),[r,o]=yield Ft(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=_t(e.read(a-c)),u.byteLength<a-c&&(u=_t(e.read()))):u=_t(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ft(f()));while(a<c)}while(!i)}finally{yield Ft(d(n,r==="error"?o:null))}return yield Ft(null);function d(h,p){return u=l=null,new Promise((m,g)=>{for(let[y,x]of h)e.off(y,x);try{let y=e.destroy;y&&y.call(e,p),p=void 0}catch(y){p=y||p}finally{p!=null?g(p):m()}})}})}var ce;(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"})(ce||(ce={}));var ge;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(ge||(ge={}));var he;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(he||(he={}));var Ve;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Ve||(Ve={}));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 an;(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"})(an||(an={}));var Qi=new Int32Array(2),mg=new Float32Array(Qi.buffer),yg=new Float64Array(Qi.buffer),Zl=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Pd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Pd||(Pd={}));var Er=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 Qi[0]=this.readInt32(t),mg[0]}readFloat64(t){return Qi[Zl?0:1]=this.readInt32(t),Qi[Zl?1:0]=this.readInt32(t+4),yg[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){mg[0]=n,this.writeInt32(t,Qi[0])}writeFloat64(t,n){yg[0]=n,this.writeInt32(t,Qi[Zl?0:1]),this.writeInt32(t+4,Qi[Zl?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===Pd.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 vc=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=Er.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=Er.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 Ud;(function(e){e[e.BUFFER=0]="BUFFER"})(Ud||(Ud={}));var zd;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(zd||(zd={}));var xg=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):zd.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Ud.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,zd.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Ud.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 Jl=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 Ql=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 Nr=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 Ql).__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 Jl).__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 xg).__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 Wo=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 Nr).__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 da;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(da||(da={}));var qd;(function(e){e[e.DenseArray=0]="DenseArray"})(qd||(qd={}));var Si=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 Ki=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 Si).__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):qd.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,qd.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var rn=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 jd=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 Vd=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 ha=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):Ve.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Ve.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var to=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 pa=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):ct.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,ct.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var ma=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 ya=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 ga=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):he.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,he.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var xa=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):an.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,an.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Yd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||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 Xd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||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 Gd=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 ba=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 Wd=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 Hd=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 Ho=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):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,n){t.addFieldInt16(0,n,ct.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 Zo=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):ct.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,ct.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 Ii=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):ge.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,ge.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 Zd=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 pe;(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"})(pe||(pe={}));var Cn=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):pe.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 Ki).__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 rn).__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,pe.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 fr=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):da.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Cn).__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 rn).__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,da.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 qt;(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"})(qt||(qt={}));var B;(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"})(B||(B={}));var Mi;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Mi||(Mi={}));var J_={};Ir(J_,{clampIndex:()=>kq,clampRange:()=>th,createElementComparator:()=>_a});var L_={};Ir(L_,{valueToString:()=>Ai});function Ai(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=>Ai(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var k_={};Ir(k_,{BN:()=>Qd,bigNumToBigInt:()=>RD,bigNumToString:()=>eu,isArrowBigNumSymbol:()=>kD});var kD=Symbol.for("isArrowBigNum");function Ti(e,...t){return t.length===0?Object.setPrototypeOf(Pt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ti.prototype[kD]=!0;Ti.prototype.toJSON=function(){return`"${eu(this)}"`};Ti.prototype.valueOf=function(){return FD(this)};Ti.prototype.toString=function(){return eu(this)};Ti.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return FD(this);case"string":return eu(this);case"default":return RD(this)}return eu(this)};function Kl(...e){return Ti.apply(this,e)}function tu(...e){return Ti.apply(this,e)}function Jd(...e){return Ti.apply(this,e)}Object.setPrototypeOf(Kl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(tu.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Jd.prototype,Object.create(Uint32Array.prototype));Object.assign(Kl.prototype,Ti.prototype,{constructor:Kl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(tu.prototype,Ti.prototype,{constructor:tu,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Jd.prototype,Ti.prototype,{constructor:Jd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function FD(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 eu=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return C_(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return C_(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`-${C_(t)}`},RD=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:eu(e);function C_(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 Qd=class e{static new(t,n){switch(n){case!0:return new Kl(t);case!1:return new tu(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Kl(t)}return t.byteLength===16?new Jd(t):new tu(t)}static signed(t){return new Kl(t)}static unsigned(t){return new tu(t)}static decimal(t){return new Jd(t)}constructor(t,n){return e.new(t,n)}};function De(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 $D,PD,UD,zD,qD,jD,VD,YD,XD,GD,WD,HD,ZD,JD,QD,KD,tO,eO,nO,rO,iO,oO,st=class e{static isNull(t){return t?.typeId===B.Null}static isInt(t){return t?.typeId===B.Int}static isFloat(t){return t?.typeId===B.Float}static isBinary(t){return t?.typeId===B.Binary}static isLargeBinary(t){return t?.typeId===B.LargeBinary}static isUtf8(t){return t?.typeId===B.Utf8}static isLargeUtf8(t){return t?.typeId===B.LargeUtf8}static isBool(t){return t?.typeId===B.Bool}static isDecimal(t){return t?.typeId===B.Decimal}static isDate(t){return t?.typeId===B.Date}static isTime(t){return t?.typeId===B.Time}static isTimestamp(t){return t?.typeId===B.Timestamp}static isInterval(t){return t?.typeId===B.Interval}static isDuration(t){return t?.typeId===B.Duration}static isList(t){return t?.typeId===B.List}static isStruct(t){return t?.typeId===B.Struct}static isUnion(t){return t?.typeId===B.Union}static isFixedSizeBinary(t){return t?.typeId===B.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===B.FixedSizeList}static isMap(t){return t?.typeId===B.Map}static isDictionary(t){return t?.typeId===B.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===ge.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===ge.Sparse}constructor(t){this.typeId=t}};$D=Symbol.toStringTag;st[$D]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(st.prototype);var Xn=class extends st{constructor(){super(B.Null)}toString(){return"Null"}};PD=Symbol.toStringTag;Xn[PD]=(e=>e[Symbol.toStringTag]="Null")(Xn.prototype);var Pe=class extends st{constructor(t,n){super(B.Int),this.isSigned=t,this.bitWidth=n}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}`}};UD=Symbol.toStringTag;Pe[UD]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Pe.prototype);var bg=class extends Pe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},wg=class extends Pe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},eo=class extends Pe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},vg=class extends Pe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},_g=class extends Pe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Sg=class extends Pe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ig=class extends Pe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Mg=class extends Pe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(bg.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(wg.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(eo.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(vg.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(_g.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Sg.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ig.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Mg.prototype,"ArrayType",{value:BigUint64Array});var dr=class extends st{constructor(t){super(B.Float),this.precision=t}get ArrayType(){switch(this.precision){case he.HALF:return Uint16Array;case he.SINGLE:return Float32Array;case he.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};zD=Symbol.toStringTag;dr[zD]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(dr.prototype);var Ag=class extends dr{constructor(){super(he.HALF)}},Tg=class extends dr{constructor(){super(he.SINGLE)}},Eg=class extends dr{constructor(){super(he.DOUBLE)}};Object.defineProperty(Ag.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Tg.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Eg.prototype,"ArrayType",{value:Float64Array});var Jo=class extends st{constructor(){super(B.Binary)}toString(){return"Binary"}};qD=Symbol.toStringTag;Jo[qD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Jo.prototype);var Qo=class extends st{constructor(){super(B.LargeBinary)}toString(){return"LargeBinary"}};jD=Symbol.toStringTag;Qo[jD]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Qo.prototype);var Ko=class extends st{constructor(){super(B.Utf8)}toString(){return"Utf8"}};VD=Symbol.toStringTag;Ko[VD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ko.prototype);var ts=class extends st{constructor(){super(B.LargeUtf8)}toString(){return"LargeUtf8"}};YD=Symbol.toStringTag;ts[YD]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(ts.prototype);var es=class extends st{constructor(){super(B.Bool)}toString(){return"Bool"}};XD=Symbol.toStringTag;es[XD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(es.prototype);var ns=class extends st{constructor(t,n,r=128){super(B.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};GD=Symbol.toStringTag;ns[GD]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(ns.prototype);var rs=class extends st{constructor(t){super(B.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Ve[this.unit]}>`}};WD=Symbol.toStringTag;rs[WD]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(rs.prototype);var Ei=class extends st{constructor(t,n){super(B.Time),this.unit=t,this.bitWidth=n}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`)}};HD=Symbol.toStringTag;Ei[HD]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Ei.prototype);var is=class extends st{constructor(t,n){super(B.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${ct[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};ZD=Symbol.toStringTag;is[ZD]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(is.prototype);var os=class extends st{constructor(t){super(B.Interval),this.unit=t}toString(){return`Interval<${an[this.unit]}>`}};JD=Symbol.toStringTag;os[JD]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(os.prototype);var ss=class extends st{constructor(t){super(B.Duration),this.unit=t}toString(){return`Duration<${ct[this.unit]}>`}};QD=Symbol.toStringTag;ss[QD]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(ss.prototype);var Ni=class extends st{constructor(t){super(B.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}};KD=Symbol.toStringTag;Ni[KD]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ni.prototype);var be=class extends st{constructor(t){super(B.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};tO=Symbol.toStringTag;be[tO]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(be.prototype);var Di=class extends st{constructor(t,n,r){super(B.Union),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))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};eO=Symbol.toStringTag;Di[eO]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Di.prototype);var as=class extends st{constructor(t){super(B.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};nO=Symbol.toStringTag;as[nO]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(as.prototype);var Oi=class extends st{constructor(t,n){super(B.FixedSizeList),this.listSize=t,this.children=[n]}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}>`}};rO=Symbol.toStringTag;Oi[rO]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Oi.prototype);var Bi=class extends st{constructor(t,n=!1){var r,i,o;if(super(B.Map),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 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(", ")}}>`}};iO=Symbol.toStringTag;Bi[iO]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Bi.prototype);var Hz=(e=>()=>++e)(-1),Dr=class extends st{constructor(t,n,r,i){super(B.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Hz():De(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};oO=Symbol.toStringTag;Dr[oO]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Dr.prototype);function Or(e){let t=e;switch(e.typeId){case B.Decimal:return e.bitWidth/32;case B.Timestamp:return 2;case B.Date:return 1+t.unit;case B.Interval:return 1+t.unit;case B.FixedSizeList:return t.listSize;case B.FixedSizeBinary:return t.byteWidth;default:return 1}}var mt=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 Zz(this,t,n)}getVisitFnByTypeId(t,n=!0){return nu(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}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(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 Zz(e,t,n=!0){return typeof t=="number"?nu(e,t,n):typeof t=="string"&&t in B?nu(e,B[t],n):t&&t instanceof st?nu(e,sO(t),n):t?.type&&t.type instanceof st?nu(e,sO(t.type),n):nu(e,B.NONE,n)}function nu(e,t,n=!0){let r=null;switch(t){case B.Null:r=e.visitNull;break;case B.Bool:r=e.visitBool;break;case B.Int:r=e.visitInt;break;case B.Int8:r=e.visitInt8||e.visitInt;break;case B.Int16:r=e.visitInt16||e.visitInt;break;case B.Int32:r=e.visitInt32||e.visitInt;break;case B.Int64:r=e.visitInt64||e.visitInt;break;case B.Uint8:r=e.visitUint8||e.visitInt;break;case B.Uint16:r=e.visitUint16||e.visitInt;break;case B.Uint32:r=e.visitUint32||e.visitInt;break;case B.Uint64:r=e.visitUint64||e.visitInt;break;case B.Float:r=e.visitFloat;break;case B.Float16:r=e.visitFloat16||e.visitFloat;break;case B.Float32:r=e.visitFloat32||e.visitFloat;break;case B.Float64:r=e.visitFloat64||e.visitFloat;break;case B.Utf8:r=e.visitUtf8;break;case B.LargeUtf8:r=e.visitLargeUtf8;break;case B.Binary:r=e.visitBinary;break;case B.LargeBinary:r=e.visitLargeBinary;break;case B.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case B.Date:r=e.visitDate;break;case B.DateDay:r=e.visitDateDay||e.visitDate;break;case B.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case B.Timestamp:r=e.visitTimestamp;break;case B.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case B.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case B.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case B.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case B.Time:r=e.visitTime;break;case B.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case B.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case B.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case B.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case B.Decimal:r=e.visitDecimal;break;case B.List:r=e.visitList;break;case B.Struct:r=e.visitStruct;break;case B.Union:r=e.visitUnion;break;case B.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case B.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case B.Dictionary:r=e.visitDictionary;break;case B.Interval:r=e.visitInterval;break;case B.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case B.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case B.Duration:r=e.visitDuration;break;case B.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case B.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case B.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case B.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case B.FixedSizeList:r=e.visitFixedSizeList;break;case B.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${B[t]}'`)}function sO(e){switch(e.typeId){case B.Null:return B.Null;case B.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?B.Int8:B.Uint8;case 16:return n?B.Int16:B.Uint16;case 32:return n?B.Int32:B.Uint32;case 64:return n?B.Int64:B.Uint64}return B.Int}case B.Float:switch(e.precision){case he.HALF:return B.Float16;case he.SINGLE:return B.Float32;case he.DOUBLE:return B.Float64}return B.Float;case B.Binary:return B.Binary;case B.LargeBinary:return B.LargeBinary;case B.Utf8:return B.Utf8;case B.LargeUtf8:return B.LargeUtf8;case B.Bool:return B.Bool;case B.Decimal:return B.Decimal;case B.Time:switch(e.unit){case ct.SECOND:return B.TimeSecond;case ct.MILLISECOND:return B.TimeMillisecond;case ct.MICROSECOND:return B.TimeMicrosecond;case ct.NANOSECOND:return B.TimeNanosecond}return B.Time;case B.Timestamp:switch(e.unit){case ct.SECOND:return B.TimestampSecond;case ct.MILLISECOND:return B.TimestampMillisecond;case ct.MICROSECOND:return B.TimestampMicrosecond;case ct.NANOSECOND:return B.TimestampNanosecond}return B.Timestamp;case B.Date:switch(e.unit){case Ve.DAY:return B.DateDay;case Ve.MILLISECOND:return B.DateMillisecond}return B.Date;case B.Interval:switch(e.unit){case an.DAY_TIME:return B.IntervalDayTime;case an.YEAR_MONTH:return B.IntervalYearMonth}return B.Interval;case B.Duration:switch(e.unit){case ct.SECOND:return B.DurationSecond;case ct.MILLISECOND:return B.DurationMillisecond;case ct.MICROSECOND:return B.DurationMicrosecond;case ct.NANOSECOND:return B.DurationNanosecond}return B.Duration;case B.Map:return B.Map;case B.List:return B.List;case B.Struct:return B.Struct;case B.Union:switch(e.mode){case ge.Dense:return B.DenseUnion;case ge.Sparse:return B.SparseUnion}return B.Union;case B.FixedSizeBinary:return B.FixedSizeBinary;case B.FixedSizeList:return B.FixedSizeList;case B.Dictionary:return B.Dictionary}throw new Error(`Unrecognized type '${B[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 F_={};Ir(F_,{float64ToUint16:()=>Kd,uint16ToFloat64:()=>Ng});var aO=new Float64Array(1),ru=new Uint32Array(aO.buffer);function Ng(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 Kd(e){if(e!==e)return 32256;aO[0]=e;let t=(ru[1]&2147483648)>>16&65535,n=ru[1]&2146435072,r=0;return n>=1089470464?ru[0]>0?n=31744:(n=(n&2080374784)>>16,r=(ru[1]&1048575)>>10):n<=1056964608?(r=1048576+(ru[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(ru[1]&1048575)+512>>10),t|n|r&65535}var vt=class extends mt{};function Tt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Jz=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},R_=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},Qz=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},Kz=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},cO=(e,t,n,r)=>{if(n+1<t.length){let i=De(t[n]),o=De(t[n+1]);e.set(r.subarray(0,o-i),i)}},tq=({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},$_=({values:e},t,n)=>{e[t]=n},lO=({values:e},t,n)=>{e[t]=Kd(n)},eq=(e,t,n)=>{switch(e.type.precision){case he.HALF:return lO(e,t,n);case he.SINGLE:case he.DOUBLE:return $_(e,t,n)}},Dg=({values:e},t,n)=>{Jz(e,t,n.valueOf())},Og=({values:e},t,n)=>{R_(e,t*2,n.valueOf())},P_=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},uO=({values:e,valueOffsets:t},n,r)=>cO(e,t,n,r),fO=({values:e,valueOffsets:t},n,r)=>cO(e,t,n,Zi(r)),U_=(e,t,n)=>{e.type.unit===Ve.DAY?Dg(e,t,n):Og(e,t,n)},Bg=({values:e},t,n)=>R_(e,t*2,n/1e3),Lg=({values:e},t,n)=>R_(e,t*2,n),Cg=({values:e},t,n)=>Qz(e,t*2,n),kg=({values:e},t,n)=>Kz(e,t*2,n),z_=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return Bg(e,t,n);case ct.MILLISECOND:return Lg(e,t,n);case ct.MICROSECOND:return Cg(e,t,n);case ct.NANOSECOND:return kg(e,t,n)}},Fg=({values:e},t,n)=>{e[t]=n},Rg=({values:e},t,n)=>{e[t]=n},$g=({values:e},t,n)=>{e[t]=n},Pg=({values:e},t,n)=>{e[t]=n},q_=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return Fg(e,t,n);case ct.MILLISECOND:return Rg(e,t,n);case ct.MICROSECOND:return $g(e,t,n);case ct.NANOSECOND:return Pg(e,t,n)}},j_=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},nq=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=wn.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))},rq=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=wn.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},iq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),oq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),sq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),aq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),cq=(e,t,n)=>{let r=e.type.children.map(o=>wn.getVisitFn(o.type)),i=n instanceof Map?sq(t,n):n instanceof Xt?oq(t,n):Array.isArray(n)?iq(t,n):aq(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},lq=(e,t,n)=>{e.type.mode===ge.Dense?dO(e,t,n):hO(e,t,n)},dO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,e.valueOffsets[t],n)},hO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,t,n)},uq=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},V_=(e,t,n)=>{e.type.unit===an.DAY_TIME?Ug(e,t,n):zg(e,t,n)},Ug=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},zg=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},qg=({values:e},t,n)=>{e[t]=n},jg=({values:e},t,n)=>{e[t]=n},Vg=({values:e},t,n)=>{e[t]=n},Yg=({values:e},t,n)=>{e[t]=n},Y_=(e,t,n)=>{switch(e.type.unit){case ct.SECOND:return qg(e,t,n);case ct.MILLISECOND:return jg(e,t,n);case ct.MICROSECOND:return Vg(e,t,n);case ct.NANOSECOND:return Yg(e,t,n)}},fq=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=wn.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))};vt.prototype.visitBool=Tt(tq);vt.prototype.visitInt=Tt(cs);vt.prototype.visitInt8=Tt(cs);vt.prototype.visitInt16=Tt(cs);vt.prototype.visitInt32=Tt(cs);vt.prototype.visitInt64=Tt(cs);vt.prototype.visitUint8=Tt(cs);vt.prototype.visitUint16=Tt(cs);vt.prototype.visitUint32=Tt(cs);vt.prototype.visitUint64=Tt(cs);vt.prototype.visitFloat=Tt(eq);vt.prototype.visitFloat16=Tt(lO);vt.prototype.visitFloat32=Tt($_);vt.prototype.visitFloat64=Tt($_);vt.prototype.visitUtf8=Tt(fO);vt.prototype.visitLargeUtf8=Tt(fO);vt.prototype.visitBinary=Tt(uO);vt.prototype.visitLargeBinary=Tt(uO);vt.prototype.visitFixedSizeBinary=Tt(P_);vt.prototype.visitDate=Tt(U_);vt.prototype.visitDateDay=Tt(Dg);vt.prototype.visitDateMillisecond=Tt(Og);vt.prototype.visitTimestamp=Tt(z_);vt.prototype.visitTimestampSecond=Tt(Bg);vt.prototype.visitTimestampMillisecond=Tt(Lg);vt.prototype.visitTimestampMicrosecond=Tt(Cg);vt.prototype.visitTimestampNanosecond=Tt(kg);vt.prototype.visitTime=Tt(q_);vt.prototype.visitTimeSecond=Tt(Fg);vt.prototype.visitTimeMillisecond=Tt(Rg);vt.prototype.visitTimeMicrosecond=Tt($g);vt.prototype.visitTimeNanosecond=Tt(Pg);vt.prototype.visitDecimal=Tt(j_);vt.prototype.visitList=Tt(nq);vt.prototype.visitStruct=Tt(cq);vt.prototype.visitUnion=Tt(lq);vt.prototype.visitDenseUnion=Tt(dO);vt.prototype.visitSparseUnion=Tt(hO);vt.prototype.visitDictionary=Tt(uq);vt.prototype.visitInterval=Tt(V_);vt.prototype.visitIntervalDayTime=Tt(Ug);vt.prototype.visitIntervalYearMonth=Tt(zg);vt.prototype.visitDuration=Tt(Y_);vt.prototype.visitDurationSecond=Tt(qg);vt.prototype.visitDurationMillisecond=Tt(jg);vt.prototype.visitDurationMicrosecond=Tt(Vg);vt.prototype.visitDurationNanosecond=Tt(Yg);vt.prototype.visitFixedSizeList=Tt(fq);vt.prototype.visitMap=Tt(rq);var wn=new vt;var Li=Symbol.for("parent"),iu=Symbol.for("rowIndex"),wa=class{constructor(t,n){return this[Li]=t,this[iu]=n,new Proxy(this,new G_)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[iu],n=this[Li],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=Ye.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Ai(t)}: ${Ai(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new X_(this[Li],this[iu])}},X_=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,Ye.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(wa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Li]:{writable:!0,enumerable:!1,configurable:!1,value:null},[iu]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var G_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Li].type.children.map(n=>n.name)}has(t,n){return t[Li].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Li].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[Li].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=Ye.visit(t[Li].children[r],t[iu]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Li].type.children.findIndex(o=>o.name===n);return i!==-1?(wn.visit(t[Li].children[i],t[iu],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var yt=class extends mt{};function It(e){return(t,n)=>t.getValid(n)?e(t,n):null}var dq=(e,t)=>864e5*e[t],W_=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),hq=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,pq=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,pO=e=>new Date(e),mq=(e,t)=>pO(dq(e,t)),yq=(e,t)=>pO(W_(e,t)),gq=(e,t)=>null,mO=(e,t,n)=>{if(n+1>=t.length)return null;let r=De(t[n]),i=De(t[n+1]);return e.subarray(r,i)},xq=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},yO=({values:e},t)=>mq(e,t),gO=({values:e},t)=>yq(e,t*2),va=({stride:e,values:t},n)=>t[e*n],bq=({stride:e,values:t},n)=>Ng(t[e*n]),xO=({values:e},t)=>e[t],wq=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),bO=({values:e,valueOffsets:t},n)=>mO(e,t,n),wO=({values:e,valueOffsets:t},n)=>{let r=mO(e,t,n);return r!==null?Fd(r):null},vq=({values:e},t)=>e[t],_q=({type:e,values:t},n)=>e.precision!==he.HALF?t[n]:Ng(t[n]),Sq=(e,t)=>e.type.unit===Ve.DAY?yO(e,t):gO(e,t),vO=({values:e},t)=>1e3*W_(e,t*2),_O=({values:e},t)=>W_(e,t*2),SO=({values:e},t)=>hq(e,t*2),IO=({values:e},t)=>pq(e,t*2),Iq=(e,t)=>{switch(e.type.unit){case ct.SECOND:return vO(e,t);case ct.MILLISECOND:return _O(e,t);case ct.MICROSECOND:return SO(e,t);case ct.NANOSECOND:return IO(e,t)}},MO=({values:e},t)=>e[t],AO=({values:e},t)=>e[t],TO=({values:e},t)=>e[t],EO=({values:e},t)=>e[t],Mq=(e,t)=>{switch(e.type.unit){case ct.SECOND:return MO(e,t);case ct.MILLISECOND:return AO(e,t);case ct.MICROSECOND:return TO(e,t);case ct.NANOSECOND:return EO(e,t)}},Aq=({values:e,stride:t},n)=>Qd.decimal(e.subarray(t*n,t*(n+1))),Tq=(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 Xt([c])},Eq=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new no(s.slice(i,o-i))},Nq=(e,t)=>new wa(e,t),Dq=(e,t)=>e.type.mode===ge.Dense?NO(e,t):DO(e,t),NO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ye.visit(r,e.valueOffsets[t])},DO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ye.visit(r,t)},Oq=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},Bq=(e,t)=>e.type.unit===an.DAY_TIME?OO(e,t):BO(e,t),OO=({values:e},t)=>e.subarray(2*t,2*(t+1)),BO=({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},LO=({values:e},t)=>e[t],CO=({values:e},t)=>e[t],kO=({values:e},t)=>e[t],FO=({values:e},t)=>e[t],Lq=(e,t)=>{switch(e.type.unit){case ct.SECOND:return LO(e,t);case ct.MILLISECOND:return CO(e,t);case ct.MICROSECOND:return kO(e,t);case ct.NANOSECOND:return FO(e,t)}},Cq=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Xt([o])};yt.prototype.visitNull=It(gq);yt.prototype.visitBool=It(xq);yt.prototype.visitInt=It(vq);yt.prototype.visitInt8=It(va);yt.prototype.visitInt16=It(va);yt.prototype.visitInt32=It(va);yt.prototype.visitInt64=It(xO);yt.prototype.visitUint8=It(va);yt.prototype.visitUint16=It(va);yt.prototype.visitUint32=It(va);yt.prototype.visitUint64=It(xO);yt.prototype.visitFloat=It(_q);yt.prototype.visitFloat16=It(bq);yt.prototype.visitFloat32=It(va);yt.prototype.visitFloat64=It(va);yt.prototype.visitUtf8=It(wO);yt.prototype.visitLargeUtf8=It(wO);yt.prototype.visitBinary=It(bO);yt.prototype.visitLargeBinary=It(bO);yt.prototype.visitFixedSizeBinary=It(wq);yt.prototype.visitDate=It(Sq);yt.prototype.visitDateDay=It(yO);yt.prototype.visitDateMillisecond=It(gO);yt.prototype.visitTimestamp=It(Iq);yt.prototype.visitTimestampSecond=It(vO);yt.prototype.visitTimestampMillisecond=It(_O);yt.prototype.visitTimestampMicrosecond=It(SO);yt.prototype.visitTimestampNanosecond=It(IO);yt.prototype.visitTime=It(Mq);yt.prototype.visitTimeSecond=It(MO);yt.prototype.visitTimeMillisecond=It(AO);yt.prototype.visitTimeMicrosecond=It(TO);yt.prototype.visitTimeNanosecond=It(EO);yt.prototype.visitDecimal=It(Aq);yt.prototype.visitList=It(Tq);yt.prototype.visitStruct=It(Nq);yt.prototype.visitUnion=It(Dq);yt.prototype.visitDenseUnion=It(NO);yt.prototype.visitSparseUnion=It(DO);yt.prototype.visitDictionary=It(Oq);yt.prototype.visitInterval=It(Bq);yt.prototype.visitIntervalDayTime=It(OO);yt.prototype.visitIntervalYearMonth=It(BO);yt.prototype.visitDuration=It(Lq);yt.prototype.visitDurationSecond=It(LO);yt.prototype.visitDurationMillisecond=It(CO);yt.prototype.visitDurationMicrosecond=It(kO);yt.prototype.visitDurationNanosecond=It(FO);yt.prototype.visitFixedSizeList=It(Cq);yt.prototype.visitMap=It(Eq);var Ye=new yt;var Zr=Symbol.for("keys"),ou=Symbol.for("vals"),no=class{constructor(t){return this[Zr]=new Xt([t.children[0]]).memoize(),this[ou]=t.children[1],new Proxy(this,new Z_)}[Symbol.iterator](){return new H_(this[Zr],this[ou])}get size(){return this[Zr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Zr],n=this[ou],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=Ye.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Ai(t)}: ${Ai(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},H_=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),Ye.visit(this.vals,t)]})}},Z_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Zr].toArray().map(String)}has(t,n){return t[Zr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Zr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Zr].indexOf(n);if(r!==-1){let i=Ye.visit(Reflect.get(t,ou),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Zr].indexOf(n);return i!==-1?(wn.visit(Reflect.get(t,ou),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(no.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Zr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ou]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function kq(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var RO;function th(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&&(RO=o,o=s,s=RO),s>i&&(s=i),r?r(e,o,s):[o,s]}var $O=e=>e!==e;function _a(e){if(typeof e!=="object"||e===null)return $O(e)?$O: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?N_(e,n):!1:e instanceof Map?Rq(e):Array.isArray(e)?Fq(e):e instanceof Xt?$q(e):Pq(e,!0)}function Fq(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=_a(e[n]);return Xg(t)}function Rq(e){let t=-1,n=[];for(let r of e.values())n[++t]=_a(r);return Xg(n)}function $q(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=_a(e.get(n));return Xg(t)}function Pq(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]=_a(e[n[i]]);return Xg(r,n)}function Xg(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return Uq(e,n);case Map:return PO(e,n,n.keys());case no:case wa:case Object:case void 0:return PO(e,n,t||Object.keys(n))}return n instanceof Xt?zq(e,n):!1}}function Uq(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 zq(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 PO(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 Q_={};Ir(Q_,{BitIterator:()=>_c,getBit:()=>UO,getBool:()=>Wg,packBools:()=>Ic,popcnt_array:()=>zO,popcnt_bit_range:()=>eh,popcnt_uint32:()=>Gg,setBool:()=>qq,truncateBitmap:()=>Sc});function Wg(e,t,n,r){return(n&1<<r)!==0}function UO(e,t,n,r){return(n&1<<r)>>r}function qq(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Sc(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):Ic(new _c(n,e,t,null,Wg)).subarray(0,r)),i}return n}function Ic(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 _c=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 eh(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new _c(e,t,n-t,e,UO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return eh(e,t,i)+eh(e,r,n)+zO(e,i>>3,r-i>>3)}function zO(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+=Gg(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=Gg(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=Gg(o.getUint8(i)),i+=1;return r}function Gg(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 jq=-1,te=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 st.isSparseUnion(t)?this.children.some(n=>n.nullable):st.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(st.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=jq&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-eh(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=Or(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(st.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===ge.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(st.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===ge.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(Sc(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===B.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(Sc(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Mi.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[Mi.TYPE])&&(s[Mi.TYPE]=o.subarray(t,t+n)),(o=s[Mi.OFFSET])&&(s[Mi.OFFSET]=o.subarray(t,t+n+1))||(o=s[Mi.DATA])&&(s[Mi.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};te.prototype.children=Object.freeze([]);var K_=class e extends mt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new te(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=dg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.data),o=_t(t.nullBitmap),s=dg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=_t(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Pt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(st.isSparseUnion(n))return new te(n,r,s,a,[void 0,void 0,void 0,o],i);let c=wc(t.valueOffsets);return new te(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new Xt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=_t(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(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=_t(t.nullBitmap),{["length"]:s=i.length/Or(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new te(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=_t(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new te(n,r,a,c,[s,void 0,o],[i])}},Vq=new K_;function Nt(e){return Vq.visit(e)}var nh=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 qO(e){return e.some(t=>t.nullable)}function Hg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Zg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Jg(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 t2(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 rh(e,t){return e.getValid(t)}function su(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return t2(r,this._offsets,n,t)}}function Qg(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=t2(o,this._offsets,r,n);return t=void 0,s}}function Kg(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):t2(o,this._offsets,i,n);return t=void 0,s}}var gt=class extends mt{};function Yq(e,t){return t===null&&e.length>0?0:-1}function Xq(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new _c(n,e.offset+(t||0),e.length,n,Wg)){if(!i)return r;++r}return-1}function Dt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case B.Union:break;case B.Dictionary:break;default:return Xq(e,n)}let r=Ye.getVisitFn(e),i=_a(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function jO(e,t,n){let r=Ye.getVisitFn(e),i=_a(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}gt.prototype.visitNull=Yq;gt.prototype.visitBool=Dt;gt.prototype.visitInt=Dt;gt.prototype.visitInt8=Dt;gt.prototype.visitInt16=Dt;gt.prototype.visitInt32=Dt;gt.prototype.visitInt64=Dt;gt.prototype.visitUint8=Dt;gt.prototype.visitUint16=Dt;gt.prototype.visitUint32=Dt;gt.prototype.visitUint64=Dt;gt.prototype.visitFloat=Dt;gt.prototype.visitFloat16=Dt;gt.prototype.visitFloat32=Dt;gt.prototype.visitFloat64=Dt;gt.prototype.visitUtf8=Dt;gt.prototype.visitLargeUtf8=Dt;gt.prototype.visitBinary=Dt;gt.prototype.visitLargeBinary=Dt;gt.prototype.visitFixedSizeBinary=Dt;gt.prototype.visitDate=Dt;gt.prototype.visitDateDay=Dt;gt.prototype.visitDateMillisecond=Dt;gt.prototype.visitTimestamp=Dt;gt.prototype.visitTimestampSecond=Dt;gt.prototype.visitTimestampMillisecond=Dt;gt.prototype.visitTimestampMicrosecond=Dt;gt.prototype.visitTimestampNanosecond=Dt;gt.prototype.visitTime=Dt;gt.prototype.visitTimeSecond=Dt;gt.prototype.visitTimeMillisecond=Dt;gt.prototype.visitTimeMicrosecond=Dt;gt.prototype.visitTimeNanosecond=Dt;gt.prototype.visitDecimal=Dt;gt.prototype.visitList=Dt;gt.prototype.visitStruct=Dt;gt.prototype.visitUnion=Dt;gt.prototype.visitDenseUnion=jO;gt.prototype.visitSparseUnion=jO;gt.prototype.visitDictionary=Dt;gt.prototype.visitInterval=Dt;gt.prototype.visitIntervalDayTime=Dt;gt.prototype.visitIntervalYearMonth=Dt;gt.prototype.visitDuration=Dt;gt.prototype.visitDurationSecond=Dt;gt.prototype.visitDurationMillisecond=Dt;gt.prototype.visitDurationMicrosecond=Dt;gt.prototype.visitDurationNanosecond=Dt;gt.prototype.visitFixedSizeList=Dt;gt.prototype.visitMap=Dt;var Mc=new gt;var xt=class extends mt{};function Mt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===B.Timestamp||t instanceof Pe&&t.bitWidth!==64||t instanceof Ei&&t.bitWidth!==64||t instanceof dr&&t.precision!==he.HALF))return new nh(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new nh(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new e2(s)})}var e2=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=Mt;xt.prototype.visitBool=Mt;xt.prototype.visitInt=Mt;xt.prototype.visitInt8=Mt;xt.prototype.visitInt16=Mt;xt.prototype.visitInt32=Mt;xt.prototype.visitInt64=Mt;xt.prototype.visitUint8=Mt;xt.prototype.visitUint16=Mt;xt.prototype.visitUint32=Mt;xt.prototype.visitUint64=Mt;xt.prototype.visitFloat=Mt;xt.prototype.visitFloat16=Mt;xt.prototype.visitFloat32=Mt;xt.prototype.visitFloat64=Mt;xt.prototype.visitUtf8=Mt;xt.prototype.visitLargeUtf8=Mt;xt.prototype.visitBinary=Mt;xt.prototype.visitLargeBinary=Mt;xt.prototype.visitFixedSizeBinary=Mt;xt.prototype.visitDate=Mt;xt.prototype.visitDateDay=Mt;xt.prototype.visitDateMillisecond=Mt;xt.prototype.visitTimestamp=Mt;xt.prototype.visitTimestampSecond=Mt;xt.prototype.visitTimestampMillisecond=Mt;xt.prototype.visitTimestampMicrosecond=Mt;xt.prototype.visitTimestampNanosecond=Mt;xt.prototype.visitTime=Mt;xt.prototype.visitTimeSecond=Mt;xt.prototype.visitTimeMillisecond=Mt;xt.prototype.visitTimeMicrosecond=Mt;xt.prototype.visitTimeNanosecond=Mt;xt.prototype.visitDecimal=Mt;xt.prototype.visitList=Mt;xt.prototype.visitStruct=Mt;xt.prototype.visitUnion=Mt;xt.prototype.visitDenseUnion=Mt;xt.prototype.visitSparseUnion=Mt;xt.prototype.visitDictionary=Mt;xt.prototype.visitInterval=Mt;xt.prototype.visitIntervalDayTime=Mt;xt.prototype.visitIntervalYearMonth=Mt;xt.prototype.visitDuration=Mt;xt.prototype.visitDurationSecond=Mt;xt.prototype.visitDurationMillisecond=Mt;xt.prototype.visitDurationMicrosecond=Mt;xt.prototype.visitDurationNanosecond=Mt;xt.prototype.visitFixedSizeList=Mt;xt.prototype.visitMap=Mt;var au=new xt;var VO,YO={},XO={},Xt=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 te)))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}=YO[s.typeId],u=o[0];this.isValid=f=>rh(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,XO[s.typeId]),this._offsets=Zg(o);break}this.data=o,this.type=s,this.stride=Or(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 nullable(){return qO(this.data)}get nullCount(){return Hg(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${B[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}[Symbol.iterator](){return au.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(th(this,t,n,({data:r,_offsets:i},o,s)=>Jg(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case B.Int:case B.Float:case B.Decimal:case B.Time:case B.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 st.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(st.isDictionary(this.type)){let t=new t0(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new t0(this)}unmemoize(){if(st.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}};VO=Symbol.toStringTag;Xt[VO]=(e=>{e.type=st.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(B).map(n=>B[n]).filter(n=>typeof n=="number"&&n!==B.NONE);for(let n of t){let r=Ye.getVisitFnByTypeId(n),i=wn.getVisitFnByTypeId(n),o=Mc.getVisitFnByTypeId(n);YO[n]={get:r,set:i,indexOf:o},XO[n]=Object.create(e,{isValid:{value:su(rh)},get:{value:su(Ye.getVisitFnByTypeId(n))},set:{value:Qg(wn.getVisitFnByTypeId(n))},indexOf:{value:Kg(Mc.getVisitFnByTypeId(n))}})}return"Vector"})(Xt.prototype);var t0=class e extends Xt{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 Xt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function GO(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
2
2
  switch (x) {${n.map(r=>`
3
- case ${Xj(r)}:`).join("")}
3
+ case ${Gq(r)}:`).join("")}
4
4
  return false;
5
5
  }`),e.length!==n.length&&(t=`if (x !== x) return false;
6
6
  ${t}`),new Function("x",`${t}
7
- return true;`)}function Xj(e){return typeof e!="bigint"?Ai(e):`${Ai(e)}n`}function n2(e,t){let n=Math.ceil(e)*t-1;return(n-n%64+64||64)/t}function YO(e,t=0){return e.length>=t?e.subarray(0,t):Fd(new e.constructor(t),e,0)}var Ci=class{constructor(t,n=0,r=1){this.length=Math.ceil(n/r),this.buffer=new t(this.length),this.stride=r,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,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?n2(r*1,this.BYTES_PER_ELEMENT):n2(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=n2(t*this.stride,this.BYTES_PER_ELEMENT);let n=YO(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=YO(this.buffer,t)}},ls=class extends Ci{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}},cu=class extends ls{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,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()}},lu=class extends ls{constructor(t){super(t.OffsetArrayType,1,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++&&r>=0&&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,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var ve=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=Or(t),this._nulls=new cu,n&&n.length>0&&(this._isValid=VO(n))}toVector(){return new Xt([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(),Nt({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}};ve.prototype.length=1;ve.prototype.stride=1;ve.prototype.children=null;ve.prototype.finished=!1;ve.prototype.nullValues=null;ve.prototype._isValid=()=>!0;var Xe=class extends ve{constructor(t){super(t),this._values=new ls(this.ArrayType,0,this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},hr=class extends ve{constructor(t){super(t),this._pendingLength=0,this._offsets=new lu(t.type)}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof no?n[Zr].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 Ac=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 Br=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):ce.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new fr).__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 Ac).__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 Ac).__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 rn).__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,ce.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 oe=class e{constructor(t=[],n,r,i=ce.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=r2(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=Kg(Kg(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:Kg(Kg(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=r2(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};oe.prototype.fields=null;oe.prototype.metadata=null;oe.prototype.dictionaries=null;var Ut=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)}};Ut.prototype.type=null;Ut.prototype.name=null;Ut.prototype.nullable=null;Ut.prototype.metadata=null;function Kg(e,t){return new Map([...e||new Map,...t||new Map])}function r2(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(st.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&&r2(o.children,t)}return t}var Gj=vc,Wj=Er,us=class{static decode(t){t=new Wj(_t(t));let n=Br.getRootAsFooter(t),r=oe.decode(n.schema(),new Map,n.version());return new i2(r,n)}static encode(t){let n=new Gj,r=oe.encode(n,t.schema);Br.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())fs.encode(n,s);let i=n.endVector();Br.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())fs.encode(n,s);let o=n.endVector();return Br.startFooter(n),Br.addSchema(n,r),Br.addVersion(n,ce.V5),Br.addRecordBatches(n,i),Br.addDictionaries(n,o),Br.finishFooterBuffer(n,Br.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=ce.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 i2=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 fs.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return fs.decode(n)}return null}},fs=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 Ac.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=De(r),this.bodyLength=De(n)}};var we=Object.freeze({done:!0,value:void 0}),nh=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Tc=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())}},t0=class extends Tc{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(we);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return bn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),we})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),we})}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(we)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var ro=class extends t0{write(t){if((t=_t(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Cd(this.toUint8Array(!0)):this.toUint8Array(!1).then(Cd)}toUint8Array(t=!1){return t?Tr(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 Tr(s,a)[0]})}},io=class{constructor(t){t&&(this.source=new o2(bn.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)}},Jr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof ro?this.source=new ds(bn.fromAsyncIterable(t)):lg(t)?this.source=new ds(bn.fromNodeStream(t)):kd(t)?this.source=new ds(bn.fromDOMStream(t)):ag(t)?this.source=new ds(bn.fromDOMStream(t.body)):wi(t)?this.source=new ds(bn.fromIterable(t)):Ar(t)?this.source=new ds(bn.fromAsyncIterable(t)):Wr(t)&&(this.source=new ds(bn.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)}},o2=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)||we)}return(t){return Object.create(this.source.return&&this.source.return(t)||we)}},ds=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))||we;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))||we;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var rh=class extends io{constructor(t,n){super(),this.position=0,this.buffer=_t(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}}},Sa=class extends Jr{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 a2={};Ir(a2,{BaseInt64:()=>ih,Int128:()=>oh,Int64:()=>hs,Uint64:()=>Oe});function uu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var fu=8,s2=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],ih=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`${uu(this.buffer[1])} ${uu(this.buffer[0])}`}},Oe=class e extends ih{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=fu<r-o?fu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([s2[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)}},hs=class e extends ih{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=fu<i-s?fu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([s2[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)}},oh=class e{constructor(t){this.buffer=t}high(){return new hs(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new hs(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 Oe(new Uint32Array([this.buffer[3],0])),r=new Oe(new Uint32Array([this.buffer[2],0])),i=new Oe(new Uint32Array([this.buffer[1],0])),o=new Oe(new Uint32Array([this.buffer[0],0])),s=new Oe(new Uint32Array([t.buffer[3],0])),a=new Oe(new Uint32Array([t.buffer[2],0])),c=new Oe(new Uint32Array([t.buffer[1],0])),l=new Oe(new Uint32Array([t.buffer[0],0])),u=Oe.multiply(o,l);this.buffer[0]=u.low();let f=new Oe(new Uint32Array([u.high(),0]));return u=Oe.multiply(i,l),f.plus(u),u=Oe.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 Oe(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Oe.multiply(r,l)).plus(Oe.multiply(i,c)).plus(Oe.multiply(o,a)),this.buffer[3]+=Oe.multiply(n,l).plus(Oe.multiply(r,c)).plus(Oe.multiply(i,a)).plus(Oe.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`${uu(this.buffer[3])} ${uu(this.buffer[2])} ${uu(this.buffer[1])} ${uu(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=fu<i-s?fu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([s2[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 sh=class extends pt{constructor(t,n,r,i,o=ce.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 Ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Nt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({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<ce.V5&&this.readNullBitmap(t,r),t.mode===ge.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({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)}},e0=class extends sh{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):Ic(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return st.isTimestamp(t)?Pt(Uint8Array,hs.convertArray(r[n])):(st.isInt(t)||st.isTime(t))&&t.bitWidth===64||st.isDuration(t)?Pt(Uint8Array,hs.convertArray(r[n])):st.isDate(t)&&t.unit===Ve.MILLISECOND?Pt(Uint8Array,hs.convertArray(r[n])):st.isDecimal(t)?Pt(Uint8Array,oh.convertArray(r[n])):st.isBinary(t)||st.isLargeBinary(t)||st.isFixedSizeBinary(t)?Hj(r[n]):st.isBool(t)?Ic(r[n]):st.isUtf8(t)||st.isLargeUtf8(t)?Zi(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Hj(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 du=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,_t(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 hu=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,_t(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,BigInt(0));else{let c=a.length;i.set(a,o),r.set(s,BigInt(c)),o+=c}}};var n0=class extends ve{constructor(t){super(t),this._values=new cu}setValue(t,n){this._values.set(t,+n)}};var Ec=class extends Xe{};Ec.prototype._setValue=U_;var ah=class extends Ec{};ah.prototype._setValue=Eg;var ch=class extends Ec{};ch.prototype._setValue=Ng;var lh=class extends Xe{};lh.prototype._setValue=q_;var r0=class extends ve{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Dr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Nc({type:this.type.indices,nullValues:n}),this.dictionary=Nc({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 uh=class extends Xe{};uh.prototype._setValue=P_;var i0=class extends ve{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 Oi(this.type.listSize,new Ut(n,t.type,!0)),r}};var Dc=class extends Xe{setValue(t,n){this._values.set(t,n)}},o0=class extends Dc{setValue(t,n){super.setValue(t,Jd(n))}},s0=class extends Dc{},a0=class extends Dc{};var Oc=class extends Xe{};Oc.prototype._setValue=V_;var fh=class extends Oc{};fh.prototype._setValue=$g;var dh=class extends Oc{};dh.prototype._setValue=Pg;var ps=class extends Xe{};ps.prototype._setValue=Y_;var hh=class extends ps{};hh.prototype._setValue=Ug;var ph=class extends ps{};ph.prototype._setValue=zg;var mh=class extends ps{};mh.prototype._setValue=jg;var yh=class extends ps{};yh.prototype._setValue=qg;var Qr=class extends Xe{setValue(t,n){this._values.set(t,n)}},c0=class extends Qr{},l0=class extends Qr{},u0=class extends Qr{},f0=class extends Qr{},d0=class extends Qr{},h0=class extends Qr{},p0=class extends Qr{},m0=class extends Qr{};var y0=class extends hr{constructor(t){super(t),this._offsets=new lu(t.type)}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 Ni(new Ut(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 g0=class extends hr{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 Bi(new Ut(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 x0=class extends ve{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var b0=class extends ve{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 be([...this.type.children,new Ut(n,t.type,!0)]),r}};var ms=class extends Xe{};ms.prototype._setValue=z_;var gh=class extends ms{};gh.prototype._setValue=Dg;var xh=class extends ms{};xh.prototype._setValue=Og;var bh=class extends ms{};bh.prototype._setValue=Bg;var wh=class extends ms{};wh.prototype._setValue=Lg;var ys=class extends Xe{};ys.prototype._setValue=j_;var vh=class extends ys{};vh.prototype._setValue=Cg;var _h=class extends ys{};_h.prototype._setValue=kg;var Sh=class extends ys{};Sh.prototype._setValue=Fg;var Ih=class extends ys{};Ih.prototype._setValue=Rg;var pu=class extends ve{constructor(t){super(t),this._typeIds=new ls(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 Ut(n,t.type)];return this.type=new Di(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.")}},w0=class extends pu{},v0=class extends pu{constructor(t){super(t),this._offsets=new ls(Int32Array)}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 Mh=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,Zi(n))}_flushPending(t,n){}};Mh.prototype._flushPending=du.prototype._flushPending;var Ah=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,Zi(n))}_flushPending(t,n){}};Ah.prototype._flushPending=hu.prototype._flushPending;var c2=class extends pt{visitNull(){return x0}visitBool(){return n0}visitInt(){return Qr}visitInt8(){return c0}visitInt16(){return l0}visitInt32(){return u0}visitInt64(){return f0}visitUint8(){return d0}visitUint16(){return h0}visitUint32(){return p0}visitUint64(){return m0}visitFloat(){return Dc}visitFloat16(){return o0}visitFloat32(){return s0}visitFloat64(){return a0}visitUtf8(){return Mh}visitLargeUtf8(){return Ah}visitBinary(){return du}visitLargeBinary(){return hu}visitFixedSizeBinary(){return uh}visitDate(){return Ec}visitDateDay(){return ah}visitDateMillisecond(){return ch}visitTimestamp(){return ms}visitTimestampSecond(){return gh}visitTimestampMillisecond(){return xh}visitTimestampMicrosecond(){return bh}visitTimestampNanosecond(){return wh}visitTime(){return ys}visitTimeSecond(){return vh}visitTimeMillisecond(){return _h}visitTimeMicrosecond(){return Sh}visitTimeNanosecond(){return Ih}visitDecimal(){return lh}visitList(){return y0}visitStruct(){return b0}visitUnion(){return pu}visitDenseUnion(){return v0}visitSparseUnion(){return w0}visitDictionary(){return r0}visitInterval(){return Oc}visitIntervalDayTime(){return fh}visitIntervalYearMonth(){return dh}visitDuration(){return ps}visitDurationSecond(){return hh}visitDurationMillisecond(){return ph}visitDurationMicrosecond(){return mh}visitDurationNanosecond(){return yh}visitFixedSizeList(){return i0}visitMap(){return g0}},XO=new c2;var xt=class extends pt{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 Gn(e,t){return t instanceof e.constructor}function Bc(e,t){return e===t||Gn(e,t)}function gs(e,t){return e===t||Gn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function _0(e,t){return e===t||Gn(e,t)&&e.precision===t.precision}function Zj(e,t){return e===t||Gn(e,t)&&e.byteWidth===t.byteWidth}function l2(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function Th(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Eh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Jj(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}function Qj(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}function u2(e,t){return e===t||Gn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&oo.compareManyFields(e.children,t.children)}function Kj(e,t){return e===t||Gn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&oo.visit(e.indices,t.indices)&&oo.visit(e.dictionary,t.dictionary)}function f2(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function Nh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function tq(e,t){return e===t||Gn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}function eq(e,t){return e===t||Gn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}xt.prototype.visitNull=Bc;xt.prototype.visitBool=Bc;xt.prototype.visitInt=gs;xt.prototype.visitInt8=gs;xt.prototype.visitInt16=gs;xt.prototype.visitInt32=gs;xt.prototype.visitInt64=gs;xt.prototype.visitUint8=gs;xt.prototype.visitUint16=gs;xt.prototype.visitUint32=gs;xt.prototype.visitUint64=gs;xt.prototype.visitFloat=_0;xt.prototype.visitFloat16=_0;xt.prototype.visitFloat32=_0;xt.prototype.visitFloat64=_0;xt.prototype.visitUtf8=Bc;xt.prototype.visitLargeUtf8=Bc;xt.prototype.visitBinary=Bc;xt.prototype.visitLargeBinary=Bc;xt.prototype.visitFixedSizeBinary=Zj;xt.prototype.visitDate=l2;xt.prototype.visitDateDay=l2;xt.prototype.visitDateMillisecond=l2;xt.prototype.visitTimestamp=Th;xt.prototype.visitTimestampSecond=Th;xt.prototype.visitTimestampMillisecond=Th;xt.prototype.visitTimestampMicrosecond=Th;xt.prototype.visitTimestampNanosecond=Th;xt.prototype.visitTime=Eh;xt.prototype.visitTimeSecond=Eh;xt.prototype.visitTimeMillisecond=Eh;xt.prototype.visitTimeMicrosecond=Eh;xt.prototype.visitTimeNanosecond=Eh;xt.prototype.visitDecimal=Bc;xt.prototype.visitList=Jj;xt.prototype.visitStruct=Qj;xt.prototype.visitUnion=u2;xt.prototype.visitDenseUnion=u2;xt.prototype.visitSparseUnion=u2;xt.prototype.visitDictionary=Kj;xt.prototype.visitInterval=f2;xt.prototype.visitIntervalDayTime=f2;xt.prototype.visitIntervalYearMonth=f2;xt.prototype.visitDuration=Nh;xt.prototype.visitDurationSecond=Nh;xt.prototype.visitDurationMillisecond=Nh;xt.prototype.visitDurationMicrosecond=Nh;xt.prototype.visitDurationNanosecond=Nh;xt.prototype.visitFixedSizeList=tq;xt.prototype.visitMap=eq;var oo=new xt;function Lc(e,t){return oo.compareSchemas(e,t)}function GO(e,t){return oo.compareFields(e,t)}function WO(e,t){return oo.visit(e,t)}function Nc(e){let t=e.type,n=new(XO.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(Nc(Object.assign(Object.assign({},l),{type:c})))}}return n}function S0(e,t){return nq(e,t.map(n=>n.data.concat()))}function nq(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=rq(n,s,u,t,i),s>0&&(r[o++]=Nt({type:new be(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new ke(e,f))]}function rq(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:Nt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var HO,pr=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new oe([]),this._offsets=[0],this;let i,o;t[0]instanceof oe&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof ke)return[c];if(c instanceof e)return c.batches;if(c instanceof te){if(c.type instanceof be)return[new ke(new oe(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 Xt([c[h]])),f=i??new oe(l.map((h,p)=>new Ut(String(h),u[p].type,u[p].nullable))),[,d]=S0(f,u);return d.length===0?[new ke(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 oe([]),!(i instanceof oe))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof ke))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Lc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Wg(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=Gg(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?au.visit(new Xt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
7
+ return true;`)}function Gq(e){return typeof e!="bigint"?Ai(e):`${Ai(e)}n`}function n2(e,t){let n=Math.ceil(e)*t-1;return(n-n%64+64||64)/t}function WO(e,t=0){return e.length>=t?e.subarray(0,t):$d(new e.constructor(t),e,0)}var Ci=class{constructor(t,n=0,r=1){this.length=Math.ceil(n/r),this.buffer=new t(this.length),this.stride=r,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,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?n2(r*1,this.BYTES_PER_ELEMENT):n2(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=n2(t*this.stride,this.BYTES_PER_ELEMENT);let n=WO(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=WO(this.buffer,t)}},ls=class extends Ci{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}},cu=class extends ls{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,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()}},lu=class extends ls{constructor(t){super(t.OffsetArrayType,1,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++&&r>=0&&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,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var ve=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=Or(t),this._nulls=new cu,n&&n.length>0&&(this._isValid=GO(n))}toVector(){return new Xt([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(),Nt({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}};ve.prototype.length=1;ve.prototype.stride=1;ve.prototype.children=null;ve.prototype.finished=!1;ve.prototype.nullValues=null;ve.prototype._isValid=()=>!0;var Xe=class extends ve{constructor(t){super(t),this._values=new ls(this.ArrayType,0,this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},hr=class extends ve{constructor(t){super(t),this._pendingLength=0,this._offsets=new lu(t.type)}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof no?n[Zr].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 Ac=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 Br=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):ce.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new fr).__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 Ac).__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 Ac).__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 rn).__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,ce.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 oe=class e{constructor(t=[],n,r,i=ce.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=r2(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=e0(e0(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:e0(e0(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=r2(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};oe.prototype.fields=null;oe.prototype.metadata=null;oe.prototype.dictionaries=null;var Ut=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)}};Ut.prototype.type=null;Ut.prototype.name=null;Ut.prototype.nullable=null;Ut.prototype.metadata=null;function e0(e,t){return new Map([...e||new Map,...t||new Map])}function r2(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(st.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&&r2(o.children,t)}return t}var Wq=vc,Hq=Er,us=class{static decode(t){t=new Hq(_t(t));let n=Br.getRootAsFooter(t),r=oe.decode(n.schema(),new Map,n.version());return new i2(r,n)}static encode(t){let n=new Wq,r=oe.encode(n,t.schema);Br.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())fs.encode(n,s);let i=n.endVector();Br.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())fs.encode(n,s);let o=n.endVector();return Br.startFooter(n),Br.addSchema(n,r),Br.addVersion(n,ce.V5),Br.addRecordBatches(n,i),Br.addDictionaries(n,o),Br.finishFooterBuffer(n,Br.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=ce.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 i2=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 fs.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return fs.decode(n)}return null}},fs=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 Ac.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=De(r),this.bodyLength=De(n)}};var we=Object.freeze({done:!0,value:void 0}),ih=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Tc=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())}},n0=class extends Tc{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(we);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return bn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),we})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),we})}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(we)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var ro=class extends n0{write(t){if((t=_t(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Fd(this.toUint8Array(!0)):this.toUint8Array(!1).then(Fd)}toUint8Array(t=!1){return t?Tr(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 Tr(s,a)[0]})}},io=class{constructor(t){t&&(this.source=new o2(bn.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)}},Jr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof ro?this.source=new ds(bn.fromAsyncIterable(t)):fg(t)?this.source=new ds(bn.fromNodeStream(t)):Rd(t)?this.source=new ds(bn.fromDOMStream(t)):lg(t)?this.source=new ds(bn.fromDOMStream(t.body)):wi(t)?this.source=new ds(bn.fromIterable(t)):Ar(t)?this.source=new ds(bn.fromAsyncIterable(t)):Wr(t)&&(this.source=new ds(bn.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)}},o2=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)||we)}return(t){return Object.create(this.source.return&&this.source.return(t)||we)}},ds=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))||we;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))||we;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var oh=class extends io{constructor(t,n){super(),this.position=0,this.buffer=_t(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}}},Sa=class extends Jr{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 a2={};Ir(a2,{BaseInt64:()=>sh,Int128:()=>ah,Int64:()=>hs,Uint64:()=>Oe});function uu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var fu=8,s2=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],sh=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`${uu(this.buffer[1])} ${uu(this.buffer[0])}`}},Oe=class e extends sh{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=fu<r-o?fu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([s2[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)}},hs=class e extends sh{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=fu<i-s?fu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([s2[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)}},ah=class e{constructor(t){this.buffer=t}high(){return new hs(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new hs(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 Oe(new Uint32Array([this.buffer[3],0])),r=new Oe(new Uint32Array([this.buffer[2],0])),i=new Oe(new Uint32Array([this.buffer[1],0])),o=new Oe(new Uint32Array([this.buffer[0],0])),s=new Oe(new Uint32Array([t.buffer[3],0])),a=new Oe(new Uint32Array([t.buffer[2],0])),c=new Oe(new Uint32Array([t.buffer[1],0])),l=new Oe(new Uint32Array([t.buffer[0],0])),u=Oe.multiply(o,l);this.buffer[0]=u.low();let f=new Oe(new Uint32Array([u.high(),0]));return u=Oe.multiply(i,l),f.plus(u),u=Oe.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 Oe(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Oe.multiply(r,l)).plus(Oe.multiply(i,c)).plus(Oe.multiply(o,a)),this.buffer[3]+=Oe.multiply(n,l).plus(Oe.multiply(r,c)).plus(Oe.multiply(i,a)).plus(Oe.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`${uu(this.buffer[3])} ${uu(this.buffer[2])} ${uu(this.buffer[1])} ${uu(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=fu<i-s?fu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([s2[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 ch=class extends mt{constructor(t,n,r,i,o=ce.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 Ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Nt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({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<ce.V5&&this.readNullBitmap(t,r),t.mode===ge.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Nt({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 Nt({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)}},r0=class extends ch{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):Ic(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return st.isTimestamp(t)?Pt(Uint8Array,hs.convertArray(r[n])):(st.isInt(t)||st.isTime(t))&&t.bitWidth===64||st.isDuration(t)?Pt(Uint8Array,hs.convertArray(r[n])):st.isDate(t)&&t.unit===Ve.MILLISECOND?Pt(Uint8Array,hs.convertArray(r[n])):st.isDecimal(t)?Pt(Uint8Array,ah.convertArray(r[n])):st.isBinary(t)||st.isLargeBinary(t)||st.isFixedSizeBinary(t)?Zq(r[n]):st.isBool(t)?Ic(r[n]):st.isUtf8(t)||st.isLargeUtf8(t)?Zi(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Zq(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 du=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,_t(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 hu=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,_t(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,BigInt(0));else{let c=a.length;i.set(a,o),r.set(s,BigInt(c)),o+=c}}};var i0=class extends ve{constructor(t){super(t),this._values=new cu}setValue(t,n){this._values.set(t,+n)}};var Ec=class extends Xe{};Ec.prototype._setValue=U_;var lh=class extends Ec{};lh.prototype._setValue=Dg;var uh=class extends Ec{};uh.prototype._setValue=Og;var fh=class extends Xe{};fh.prototype._setValue=j_;var o0=class extends ve{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Dr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Nc({type:this.type.indices,nullValues:n}),this.dictionary=Nc({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 dh=class extends Xe{};dh.prototype._setValue=P_;var s0=class extends ve{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 Oi(this.type.listSize,new Ut(n,t.type,!0)),r}};var Dc=class extends Xe{setValue(t,n){this._values.set(t,n)}},a0=class extends Dc{setValue(t,n){super.setValue(t,Kd(n))}},c0=class extends Dc{},l0=class extends Dc{};var Oc=class extends Xe{};Oc.prototype._setValue=V_;var hh=class extends Oc{};hh.prototype._setValue=Ug;var ph=class extends Oc{};ph.prototype._setValue=zg;var ps=class extends Xe{};ps.prototype._setValue=Y_;var mh=class extends ps{};mh.prototype._setValue=qg;var yh=class extends ps{};yh.prototype._setValue=jg;var gh=class extends ps{};gh.prototype._setValue=Vg;var xh=class extends ps{};xh.prototype._setValue=Yg;var Qr=class extends Xe{setValue(t,n){this._values.set(t,n)}},u0=class extends Qr{},f0=class extends Qr{},d0=class extends Qr{},h0=class extends Qr{},p0=class extends Qr{},m0=class extends Qr{},y0=class extends Qr{},g0=class extends Qr{};var x0=class extends hr{constructor(t){super(t),this._offsets=new lu(t.type)}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 Ni(new Ut(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 b0=class extends hr{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 Bi(new Ut(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 w0=class extends ve{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var v0=class extends ve{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 be([...this.type.children,new Ut(n,t.type,!0)]),r}};var ms=class extends Xe{};ms.prototype._setValue=z_;var bh=class extends ms{};bh.prototype._setValue=Bg;var wh=class extends ms{};wh.prototype._setValue=Lg;var vh=class extends ms{};vh.prototype._setValue=Cg;var _h=class extends ms{};_h.prototype._setValue=kg;var ys=class extends Xe{};ys.prototype._setValue=q_;var Sh=class extends ys{};Sh.prototype._setValue=Fg;var Ih=class extends ys{};Ih.prototype._setValue=Rg;var Mh=class extends ys{};Mh.prototype._setValue=$g;var Ah=class extends ys{};Ah.prototype._setValue=Pg;var pu=class extends ve{constructor(t){super(t),this._typeIds=new ls(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 Ut(n,t.type)];return this.type=new Di(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.")}},_0=class extends pu{},S0=class extends pu{constructor(t){super(t),this._offsets=new ls(Int32Array)}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 Th=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,Zi(n))}_flushPending(t,n){}};Th.prototype._flushPending=du.prototype._flushPending;var Eh=class extends hr{constructor(t){super(t),this._values=new Ci(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,n){return super.setValue(t,Zi(n))}_flushPending(t,n){}};Eh.prototype._flushPending=hu.prototype._flushPending;var c2=class extends mt{visitNull(){return w0}visitBool(){return i0}visitInt(){return Qr}visitInt8(){return u0}visitInt16(){return f0}visitInt32(){return d0}visitInt64(){return h0}visitUint8(){return p0}visitUint16(){return m0}visitUint32(){return y0}visitUint64(){return g0}visitFloat(){return Dc}visitFloat16(){return a0}visitFloat32(){return c0}visitFloat64(){return l0}visitUtf8(){return Th}visitLargeUtf8(){return Eh}visitBinary(){return du}visitLargeBinary(){return hu}visitFixedSizeBinary(){return dh}visitDate(){return Ec}visitDateDay(){return lh}visitDateMillisecond(){return uh}visitTimestamp(){return ms}visitTimestampSecond(){return bh}visitTimestampMillisecond(){return wh}visitTimestampMicrosecond(){return vh}visitTimestampNanosecond(){return _h}visitTime(){return ys}visitTimeSecond(){return Sh}visitTimeMillisecond(){return Ih}visitTimeMicrosecond(){return Mh}visitTimeNanosecond(){return Ah}visitDecimal(){return fh}visitList(){return x0}visitStruct(){return v0}visitUnion(){return pu}visitDenseUnion(){return S0}visitSparseUnion(){return _0}visitDictionary(){return o0}visitInterval(){return Oc}visitIntervalDayTime(){return hh}visitIntervalYearMonth(){return ph}visitDuration(){return ps}visitDurationSecond(){return mh}visitDurationMillisecond(){return yh}visitDurationMicrosecond(){return gh}visitDurationNanosecond(){return xh}visitFixedSizeList(){return s0}visitMap(){return b0}},HO=new c2;var bt=class extends mt{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 Gn(e,t){return t instanceof e.constructor}function Bc(e,t){return e===t||Gn(e,t)}function gs(e,t){return e===t||Gn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function I0(e,t){return e===t||Gn(e,t)&&e.precision===t.precision}function Jq(e,t){return e===t||Gn(e,t)&&e.byteWidth===t.byteWidth}function l2(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function Nh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Dh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Qq(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}function Kq(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}function u2(e,t){return e===t||Gn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&oo.compareManyFields(e.children,t.children)}function tj(e,t){return e===t||Gn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&oo.visit(e.indices,t.indices)&&oo.visit(e.dictionary,t.dictionary)}function f2(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function Oh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function ej(e,t){return e===t||Gn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}function nj(e,t){return e===t||Gn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&oo.compareManyFields(e.children,t.children)}bt.prototype.visitNull=Bc;bt.prototype.visitBool=Bc;bt.prototype.visitInt=gs;bt.prototype.visitInt8=gs;bt.prototype.visitInt16=gs;bt.prototype.visitInt32=gs;bt.prototype.visitInt64=gs;bt.prototype.visitUint8=gs;bt.prototype.visitUint16=gs;bt.prototype.visitUint32=gs;bt.prototype.visitUint64=gs;bt.prototype.visitFloat=I0;bt.prototype.visitFloat16=I0;bt.prototype.visitFloat32=I0;bt.prototype.visitFloat64=I0;bt.prototype.visitUtf8=Bc;bt.prototype.visitLargeUtf8=Bc;bt.prototype.visitBinary=Bc;bt.prototype.visitLargeBinary=Bc;bt.prototype.visitFixedSizeBinary=Jq;bt.prototype.visitDate=l2;bt.prototype.visitDateDay=l2;bt.prototype.visitDateMillisecond=l2;bt.prototype.visitTimestamp=Nh;bt.prototype.visitTimestampSecond=Nh;bt.prototype.visitTimestampMillisecond=Nh;bt.prototype.visitTimestampMicrosecond=Nh;bt.prototype.visitTimestampNanosecond=Nh;bt.prototype.visitTime=Dh;bt.prototype.visitTimeSecond=Dh;bt.prototype.visitTimeMillisecond=Dh;bt.prototype.visitTimeMicrosecond=Dh;bt.prototype.visitTimeNanosecond=Dh;bt.prototype.visitDecimal=Bc;bt.prototype.visitList=Qq;bt.prototype.visitStruct=Kq;bt.prototype.visitUnion=u2;bt.prototype.visitDenseUnion=u2;bt.prototype.visitSparseUnion=u2;bt.prototype.visitDictionary=tj;bt.prototype.visitInterval=f2;bt.prototype.visitIntervalDayTime=f2;bt.prototype.visitIntervalYearMonth=f2;bt.prototype.visitDuration=Oh;bt.prototype.visitDurationSecond=Oh;bt.prototype.visitDurationMillisecond=Oh;bt.prototype.visitDurationMicrosecond=Oh;bt.prototype.visitDurationNanosecond=Oh;bt.prototype.visitFixedSizeList=ej;bt.prototype.visitMap=nj;var oo=new bt;function Lc(e,t){return oo.compareSchemas(e,t)}function ZO(e,t){return oo.compareFields(e,t)}function JO(e,t){return oo.visit(e,t)}function Nc(e){let t=e.type,n=new(HO.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(Nc(Object.assign(Object.assign({},l),{type:c})))}}return n}function M0(e,t){return rj(e,t.map(n=>n.data.concat()))}function rj(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=ij(n,s,u,t,i),s>0&&(r[o++]=Nt({type:new be(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new ke(e,f))]}function ij(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:Nt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var QO,pr=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new oe([]),this._offsets=[0],this;let i,o;t[0]instanceof oe&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof ke)return[c];if(c instanceof e)return c.batches;if(c instanceof te){if(c.type instanceof be)return[new ke(new oe(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 Xt([c[h]])),f=i??new oe(l.map((h,p)=>new Ut(String(h),u[p].type,u[p].nullable))),[,d]=M0(f,u);return d.length===0?[new ke(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 oe([]),!(i instanceof oe))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof ke))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Lc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Zg(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=Hg(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?au.visit(new Xt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
8
  ${this.toArray().join(`,
9
9
  `)}
10
- ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new ke(n,i)))}slice(t,n){let r=this.schema;[t,n]=Qd({length:this.numRows},t,n);let i=Hg(this.data,this._offsets,t,n);return new e(r,i.map(o=>new ke(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=Nt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Xt(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 Xt([Nt({type:new Xn,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]=S0(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(...S0(o,s))}};HO=Symbol.toStringTag;pr[HO]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=su(eh),e.get=su(Ye.getVisitFn(B.Struct)),e.set=Zg(wn.getVisitFn(B.Struct)),e.indexOf=Jg(Mc.getVisitFn(B.Struct)),"Table"))(pr.prototype);var JO,ke=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof oe))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Nt({nullCount:0,type:new be(this.schema.fields),children:this.schema.fields.map(n=>Nt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof te))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=ZO(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]=Ut.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new oe(r),a=Nt({type:new be(r),length:o,children:i,nullCount:0});[this.schema,this.data]=ZO(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=QO(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 Ye.visit(this.data,t)}set(t,n){return wn.visit(this.data,t,n)}indexOf(t,n){return Mc.visit(this.data,t,n)}[Symbol.iterator](){return au.visit(new Xt([this.data]))}toArray(){return[...this]}concat(...t){return new pr(this.schema,[this,...t])}slice(t,n){let[r]=new Xt([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 Xt([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 Xt([Nt({type:new Xn,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 oe(o,new Map(this.schema.metadata)),i=Nt({type:new be(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new be(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,Nt({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=Nt({type:new be(n.fields),length:this.numRows,children:r});return new e(n,i)}};JO=Symbol.toStringTag;ke[JO]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function ZO(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:Nt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Nt({type:new be(i),length:n,children:o})]}function QO(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)||[]])QO(a.children,l?.children,n);if(st.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 Cc=class extends ke{constructor(t){let n=t.fields.map(i=>Nt({type:i.type})),r=Nt({type:new be(t.fields),nullCount:0,children:n});super(t,r)}};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 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):ce.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):jt.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 rn).__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,ce.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,jt.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 d2=class extends pt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Xd.startNull(n),Xd.endNull(n)}visitInt(t,n){return Si.startInt(n),Si.addBitWidth(n,t.bitWidth),Si.addIsSigned(n,t.isSigned),Si.endInt(n)}visitFloat(t,n){return ga.startFloatingPoint(n),ga.addPrecision(n,t.precision),ga.endFloatingPoint(n)}visitBinary(t,n){return zd.startBinary(n),zd.endBinary(n)}visitLargeBinary(t,n){return qd.startLargeBinary(n),qd.endLargeBinary(n)}visitBool(t,n){return jd.startBool(n),jd.endBool(n)}visitUtf8(t,n){return Wd.startUtf8(n),Wd.endUtf8(n)}visitLargeUtf8(t,n){return Vd.startLargeUtf8(n),Vd.endLargeUtf8(n)}visitDecimal(t,n){return to.startDecimal(n),to.addScale(n,t.scale),to.addPrecision(n,t.precision),to.addBitWidth(n,t.bitWidth),to.endDecimal(n)}visitDate(t,n){return ha.startDate(n),ha.addUnit(n,t.unit),ha.endDate(n)}visitTime(t,n){return Ho.startTime(n),Ho.addUnit(n,t.unit),Ho.addBitWidth(n,t.bitWidth),Ho.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return Zo.startTimestamp(n),Zo.addUnit(n,t.unit),r!==void 0&&Zo.addTimezone(n,r),Zo.endTimestamp(n)}visitInterval(t,n){return xa.startInterval(n),xa.addUnit(n,t.unit),xa.endInterval(n)}visitDuration(t,n){return pa.startDuration(n),pa.addUnit(n,t.unit),pa.endDuration(n)}visitList(t,n){return Yd.startList(n),Yd.endList(n)}visitStruct(t,n){return Gd.startStruct_(n),Gd.endStruct_(n)}visitUnion(t,n){Ii.startTypeIdsVector(n,t.typeIds.length);let r=Ii.createTypeIdsVector(n,t.typeIds);return Ii.startUnion(n),Ii.addMode(n,t.mode),Ii.addTypeIds(n,r),Ii.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return Ki.startDictionaryEncoding(n),Ki.addId(n,BigInt(t.id)),Ki.addIsOrdered(n,t.isOrdered),r!==void 0&&Ki.addIndexType(n,r),Ki.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return ma.startFixedSizeBinary(n),ma.addByteWidth(n,t.byteWidth),ma.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return ya.startFixedSizeList(n),ya.addListSize(n,t.listSize),ya.endFixedSizeList(n)}visitMap(t,n){return ba.startMap(n),ba.addKeysSorted(n,t.keysSorted),ba.endMap(n)}},I0=new d2;function n5(e,t=new Map){return new oe(oq(e,t),M0(e.metadata),t)}function h2(e){return new vn(e.count,i5(e.columns),o5(e.columns))}function r5(e){return new yr(h2(e.data),e.id,e.isDelta)}function oq(e,t){return(e.fields||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function KO(e,t){return(e.children||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function i5(e){return(e||[]).reduce((t,n)=>[...t,new Kr(n.count,sq(n.VALIDITY)),...i5(n.children)],[])}function o5(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new mr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new mr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new mr(t.length,i.OFFSET.length)),i.DATA&&t.push(new mr(t.length,i.DATA.length)),t=o5(i.children,t)}return t}function sq(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function s5(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=e5(e,KO(e,t)),i=new Ut(e.name,s,e.nullable,M0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?t5(r):new eo,a=new Dr(t.get(n),r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,M0(e.metadata))):(r=(r=o.indexType)?t5(r):new eo,t.set(n,s=e5(e,KO(e,t))),a=new Dr(s,r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,M0(e.metadata))),i||null}function M0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function t5(e){return new Pe(e.isSigned,e.bitWidth)}function e5(e,t){let n=e.type.name;switch(n){case"NONE":return new Xn;case"null":return new Xn;case"binary":return new Jo;case"largebinary":return new Qo;case"utf8":return new Ko;case"largeutf8":return new ts;case"bool":return new es;case"list":return new Ni((t||[])[0]);case"struct":return new be(t||[]);case"struct_":return new be(t||[])}switch(n){case"int":{let r=e.type;return new Pe(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new dr(he[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 rs(Ve[r.unit])}case"time":{let r=e.type;return new Ei(ct[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new is(ct[r.unit],r.timezone)}case"interval":{let r=e.type;return new os(an[r.unit])}case"duration":{let r=e.type;return new ss(ct[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Di(ge[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new as(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Oi(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Bi((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var aq=vc,cq=Er,gr=class e{static fromJSON(t,n){let r=new e(0,ce.V5,n);return r._createHeader=lq(t,n),r}static decode(t){t=new cq(_t(t));let n=ki.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=uq(n,o),s}static encode(t){let n=new aq,r=-1;return t.isSchema()?r=oe.encode(n,t.header()):t.isRecordBatch()?r=vn.encode(n,t.header()):t.isDictionaryBatch()&&(r=yr.encode(n,t.header())),ki.startMessage(n),ki.addVersion(n,ce.V5),ki.addHeader(n,r),ki.addHeaderType(n,t.headerType),ki.addBodyLength(n,BigInt(t.bodyLength)),ki.finishMessageBuffer(n,ki.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof oe)return new e(0,ce.V5,jt.Schema,t);if(t instanceof vn)return new e(n,ce.V5,jt.RecordBatch,t);if(t instanceof yr)return new e(n,ce.V5,jt.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===jt.Schema}isRecordBatch(){return this.headerType===jt.RecordBatch}isDictionaryBatch(){return this.headerType===jt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=De(t)}},vn=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=De(t)}},yr=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=De(n)}},mr=class{constructor(t,n){this.offset=De(t),this.length=De(n)}},Kr=class{constructor(t,n){this.length=De(t),this.nullCount=De(n)}};function lq(e,t){return()=>{switch(t){case jt.Schema:return oe.fromJSON(e);case jt.RecordBatch:return vn.fromJSON(e);case jt.DictionaryBatch:return yr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${jt[t]}, type: ${t} }`)}}function uq(e,t){return()=>{switch(t){case jt.Schema:return oe.decode(e.header(new fr),new Map,e.version());case jt.RecordBatch:return vn.decode(e.header(new Nr),e.version());case jt.DictionaryBatch:return yr.decode(e.header(new Wo),e.version())}throw new Error(`Unrecognized Message type: { name: ${jt[t]}, type: ${t} }`)}}Ut.encode=vq;Ut.decode=bq;Ut.fromJSON=s5;oe.encode=wq;oe.decode=fq;oe.fromJSON=n5;vn.encode=_q;vn.decode=dq;vn.fromJSON=h2;yr.encode=Sq;yr.decode=hq;yr.fromJSON=r5;Kr.encode=Iq;Kr.decode=mq;mr.encode=Mq;mr.decode=pq;function fq(e,t=new Map,n=ce.V5){let r=xq(e,t);return new oe(r,A0(e),t,n)}function dq(e,t=ce.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new vn(e.length(),yq(e),gq(e,t))}function hq(e,t=ce.V5){return new yr(vn.decode(e.data(),t),e.id(),e.isDelta())}function pq(e){return new mr(e.offset(),e.length())}function mq(e){return new Kr(e.length(),e.nullCount())}function yq(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Kr.decode(n));return t}function gq(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<ce.V4&&(r.bb_pos+=8*(i+1)),n[++o]=mr.decode(r));return n}function xq(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Ut.decode(r,t));return n}function a5(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Ut.decode(r,t));return n}function bq(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=l5(e,a5(e,t)),r=new Ut(e.name(),i,e.nullable(),A0(e))):t.has(n=De(a.id()))?(o=(o=a.indexType())?c5(o):new eo,s=new Dr(t.get(n),o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),A0(e))):(o=(o=a.indexType())?c5(o):new eo,t.set(n,i=l5(e,a5(e,t))),s=new Dr(i,o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),A0(e))),r||null}function A0(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 c5(e){return new Pe(e.isSigned(),e.bitWidth())}function l5(e,t){let n=e.typeType();switch(n){case pe.NONE:return new Xn;case pe.Null:return new Xn;case pe.Binary:return new Jo;case pe.LargeBinary:return new Qo;case pe.Utf8:return new Ko;case pe.LargeUtf8:return new ts;case pe.Bool:return new es;case pe.List:return new Ni((t||[])[0]);case pe.Struct_:return new be(t||[])}switch(n){case pe.Int:{let r=e.type(new Si);return new Pe(r.isSigned(),r.bitWidth())}case pe.FloatingPoint:{let r=e.type(new ga);return new dr(r.precision())}case pe.Decimal:{let r=e.type(new to);return new ns(r.scale(),r.precision(),r.bitWidth())}case pe.Date:{let r=e.type(new ha);return new rs(r.unit())}case pe.Time:{let r=e.type(new Ho);return new Ei(r.unit(),r.bitWidth())}case pe.Timestamp:{let r=e.type(new Zo);return new is(r.unit(),r.timezone())}case pe.Interval:{let r=e.type(new xa);return new os(r.unit())}case pe.Duration:{let r=e.type(new pa);return new ss(r.unit())}case pe.Union:{let r=e.type(new Ii);return new Di(r.mode(),r.typeIdsArray()||[],t||[])}case pe.FixedSizeBinary:{let r=e.type(new ma);return new as(r.byteWidth())}case pe.FixedSizeList:{let r=e.type(new ya);return new Oi(r.listSize(),(t||[])[0])}case pe.Map:{let r=e.type(new ba);return new Bi((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${pe[n]}" (${n})`)}function wq(e,t){let n=t.fields.map(o=>Ut.encode(e,o));fr.startFieldsVector(e,n.length);let r=fr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?fr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return rn.startKeyValue(e),rn.addKey(e,a),rn.addValue(e,c),rn.endKeyValue(e)})):-1;return fr.startSchema(e),fr.addFields(e,r),fr.addEndianness(e,Aq?da.Little:da.Big),i!==-1&&fr.addCustomMetadata(e,i),fr.endSchema(e)}function vq(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;st.isDictionary(o)?(s=o.dictionary.typeId,i=I0.visit(o,e),r=I0.visit(o.dictionary,e)):r=I0.visit(o,e);let a=(o.children||[]).map(u=>Ut.encode(e,u)),c=Cn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Cn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return rn.startKeyValue(e),rn.addKey(e,d),rn.addValue(e,h),rn.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Cn.startField(e),Cn.addType(e,r),Cn.addTypeType(e,s),Cn.addChildren(e,c),Cn.addNullable(e,!!t.nullable),n!==-1&&Cn.addName(e,n),i!==-1&&Cn.addDictionary(e,i),l!==-1&&Cn.addCustomMetadata(e,l),Cn.endField(e)}function _q(e,t){let n=t.nodes||[],r=t.buffers||[];Nr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Kr.encode(e,s);let i=e.endVector();Nr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())mr.encode(e,s);let o=e.endVector();return Nr.startRecordBatch(e),Nr.addLength(e,BigInt(t.length)),Nr.addNodes(e,i),Nr.addBuffers(e,o),Nr.endRecordBatch(e)}function Sq(e,t){let n=vn.encode(e,t.data);return Wo.startDictionaryBatch(e),Wo.addId(e,BigInt(t.id)),Wo.addIsDelta(e,t.isDelta),Wo.addData(e,n),Wo.endDictionaryBatch(e)}function Iq(e,t){return Ql.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Mq(e,t){return Jl.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Aq=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var m2=e=>`Expected ${jt[e]} Message in stream, but was null or length 0.`,y2=e=>`Header pointer of flatbuffer-encoded ${jt[e]} Message is null or length 0.`,u5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,f5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,mu=class{constructor(t){this.source=t instanceof io?t:new io(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?we:t.value===-1&&(t=this.readMetadataLength()).done?we:(t=this.readMetadata(t.value)).done?we: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(m2(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=_t(this.source.read(t));if(n.byteLength<t)throw new Error(f5(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=jt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(y2(n));return i}readMetadataLength(){let t=this.source.read(T0),n=t&&new Er(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return we;if(n.byteLength<t)throw new Error(u5(t,n.byteLength));return{done:!1,value:gr.decode(n)}}},Dh=class{constructor(t,n){this.source=t instanceof Jr?t:sg(t)?new Sa(t,n):new Jr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?we:t.value===-1&&(t=yield this.readMetadataLength()).done?we:(t=yield this.readMetadata(t.value)).done?we: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(m2(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=_t(yield this.source.read(t));if(n.byteLength<t)throw new Error(f5(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=jt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(y2(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(T0),n=t&&new Er(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 we;if(n.byteLength<t)throw new Error(u5(t,n.byteLength));return{done:!1,value:gr.decode(n)}})}},Oh=class extends mu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof nh?t:new nh(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gr.fromJSON(t.schema,jt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:gr.fromJSON(n,jt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:gr.fromJSON(n,jt.RecordBatch)}}return this._body=[],we}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(m2(t));return n.value}readSchema(){let t=jt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(y2(t));return r}},T0=4,p2="ARROW1",yu=new Uint8Array(p2.length);for(let e=0;e<p2.length;e+=1)yu[e]=p2.codePointAt(e);function E0(e,t=0){for(let n=-1,r=yu.length;++n<r;)if(yu[n]!==e[t+n])return!1;return!0}var gu=yu.length,g2=gu+T0,d5=gu*2+T0;var Lr=class e extends Tc{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 Ar(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 bn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bn.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:ig(t)?Eq(t):sg(t)?Oq(t):Ar(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):ag(t)||kd(t)||lg(t)||Wr(t)?Dq(new Jr(t)):Nq(new io(t))}static readAll(t){return t instanceof e?t.isSync()?h5(t):p5(t):ig(t)||ArrayBuffer.isView(t)||wi(t)||og(t)?h5(t):p5(t)}},xs=class extends Lr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Mr(this,arguments,function*(){yield Ft(yield*Hl(bi(this[Symbol.iterator]())))})}},kc=class extends Lr{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]()}},Fc=class extends xs{constructor(t){super(t),this._impl=t}},N0=class extends kc{constructor(t){super(t),this._impl=t}},D0=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=Nt({type:new be(this.schema.fields),length:t.length,children:r});return new ke(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 Xt(l)):new Xt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new sh(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},xu=class extends D0{constructor(t,n){super(n),this._reader=ig(t)?new Oh(this._handle=t):new mu(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=m5(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):we}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):we}next(){if(this.closed)return we;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 Cc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},bu=class extends D0{constructor(t,n){super(n),this._reader=new Dh(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=m5(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):we})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):we})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return we;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 Cc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},O0=class extends xu{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 rh?t:new rh(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(jt.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(jt.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-g2,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}},x2=class extends bu{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 Sa?t:new Sa(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(jt.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(jt.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-g2,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})}},b2=class extends xu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new e0(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function m5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*h5(e){let t=Lr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function p5(e){return Mr(this,arguments,function*(){let n=yield Ft(Lr.from(e));try{if(!(yield Ft(n.open({autoDestroy:!1}))).closed)do yield yield Ft(n);while(!(yield Ft(n.reset().open())).closed)}finally{yield Ft(n.cancel())}})}function Eq(e){return new xs(new b2(e))}function Nq(e){let t=e.peek(gu+7&-8);return t&&t.byteLength>=4?E0(t)?new Fc(new O0(e.read())):new xs(new xu(e)):new xs(new xu(function*(){}()))}function Dq(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(gu+7&-8);return t&&t.byteLength>=4?E0(t)?new Fc(new O0(yield e.read())):new kc(new bu(e)):new kc(new bu(function(){return Mr(this,arguments,function*(){})}()))})}function Oq(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Sa(e,t);return t>=d5&&E0(yield n.readAt(0,gu+7&-8))?new N0(new x2(n)):new kc(new bu(n))})}var Me=class e extends pt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof ke?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 Xt)return this.visitMany(t.data),this;let{type:n}=t;if(!st.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(st.isUnion(n))this.nodes.push(new Kr(r,0));else{let{nullCount:i}=t;st.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):Sc(t.offset,r,t.nullBitmap)),this.nodes.push(new Kr(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 Fi(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new mr(this._byteLength,t)),this._byteLength+=t,this}function Bq(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===ge.Sparse)return w2.call(this,e);if(n.mode===ge.Dense){if(e.offset<=0)return Fi.call(this,o),w2.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);Fi.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 Lq(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,Sc(e.offset,e.length,t)):Fi.call(this,Ic(e.values))}function bs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function B0(e){let{length:t,values:n,valueOffsets:r}=e,i=De(r[0]),o=De(r[t]),s=Math.min(o-i,n.byteLength-i);return Fi.call(this,fg(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function v2(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,fg(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function w2(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Me.prototype.visitBool=Lq;Me.prototype.visitInt=bs;Me.prototype.visitFloat=bs;Me.prototype.visitUtf8=B0;Me.prototype.visitLargeUtf8=B0;Me.prototype.visitBinary=B0;Me.prototype.visitLargeBinary=B0;Me.prototype.visitFixedSizeBinary=bs;Me.prototype.visitDate=bs;Me.prototype.visitTimestamp=bs;Me.prototype.visitTime=bs;Me.prototype.visitDecimal=bs;Me.prototype.visitList=v2;Me.prototype.visitStruct=w2;Me.prototype.visitUnion=Bq;Me.prototype.visitInterval=bs;Me.prototype.visitDuration=bs;Me.prototype.visitFixedSizeList=v2;Me.prototype.visitMap=v2;var Rc=class extends Tc{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 ro,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Yn(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 Ar(t)?t.then(n=>this.writeAll(n)):Wr(t)?S2(this,t):_2(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 ro?this._sink=t:(this._sink=new ro,t&&ND(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&DD(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||!Lc(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 pr&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof ke&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Lc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Cc||this._writeRecordBatch(t):t instanceof pr?this.writeAll(t.batches):wi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=gr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===jt.RecordBatch?this._recordBatchBlocks.push(new fs(a,t.bodyLength,this._position)):t.headerType===jt.DictionaryBatch&&this._dictionaryBlocks.push(new fs(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=_t(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(gr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(yu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Me.assemble(t),s=new vn(t.numRows,r,i),a=gr.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}=Me.assemble(new Xt([t])),c=new vn(t.length,o,s),l=new yr(c,n,r),u=gr.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}},Bh=class e extends Rc{static writeAll(t,n){let r=new e(n);return Ar(t)?t.then(i=>r.writeAll(i)):Wr(t)?S2(r,t):_2(r,t)}},Lh=class e extends Rc{static writeAll(t){let n=new e;return Ar(t)?t.then(r=>n.writeAll(r)):Wr(t)?S2(n,t):_2(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=us.encode(new us(t,ce.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function _2(e,t){let n=t;t instanceof pr&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function S2(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 y5(e,t){if(Wr(e))return kq(e,t);if(wi(e))return Cq(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Cq(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=_t(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 kq(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=_t(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 b5(e){return new I2(e)}var I2=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=TD(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Nc(o),this._getSize=i!=="bytes"?g5:x5;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"?g5:x5}),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)}},g5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},x5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function L0(e,t){let n=new ro,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 Lr.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 C0(e,t){let n=new this(e),r=new Jr(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 Ch(e){let t=Lr.from(e);return Ar(t)?t.then(n=>Ch(n)):t.isAsync()?t.readAll().then(n=>new pr(n)):new pr(t.readAll())}var Rq=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k_),a2),Q_),F_),D_),J_),L_),{compareSchemas:Lc,compareFields:GO,compareTypes:WO});bn.toDOMStream=y5;ve.throughDOM=b5;Lr.throughDOM=L0;Fc.throughDOM=L0;xs.throughDOM=L0;Rc.throughDOM=C0;Lh.throughDOM=C0;Bh.throughDOM=C0;function k0(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(Ch(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);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 xr=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?`${w5(t)}.`:""}${r}`}else return t?w5(t):"NULL"}};function w5(e){return e.split(".").map(n=>`"${n}"`).join(".")}function v5(e,t){return e instanceof xr&&e.column===t}function qt(e){return typeof e=="string"?Ia(e):e}function $c(e){return typeof e=="string"?_5(e):e}function _5(e){return new xr(e)}function Ia(e,t){return arguments.length===1&&(t=e,e=null),new xr(e,t)}function so(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;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 ws=e=>typeof e?.addEventListener=="function";function F0(e){return e instanceof Ma}var Ma=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>ws(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>$q(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=>ws(t)&&!F0(t)?so(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 $q(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function M2(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];ws(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:so(a));let c=e[++o];ws(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=M2(e,t);return new Ma(n,r)}function A2(e){let t=qt(e);return q`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Cr=e=>({value:e,toString:()=>so(e)});function kh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function S5(e,t){let n=t.filter(i=>i!=null).map(qt),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:kh})}var Wn=(...e)=>S5("AND",e.flat()),Pc=(...e)=>S5("OR",e.flat()),Pq=e=>t=>q`(${e} ${qt(t)})`.annotate({op:e,a:t,visit:kh}),T2=Pq("NOT"),I5=e=>t=>q`(${qt(t)} ${e})`.annotate({op:e,a:t,visit:kh}),Uc=I5("IS NULL"),vs=I5("IS NOT NULL"),Aa=e=>(t,n)=>q`(${qt(t)} ${e} ${qt(n)})`.annotate({op:e,a:t,b:n,visit:kh}),_s=Aa("="),zc=Aa("<>"),Ss=Aa("<"),Fh=Aa(">"),Is=Aa("<="),E2=Aa(">="),N2=Aa("IS DISTINCT FROM"),Rh=Aa("IS NOT DISTINCT FROM");function M5(e,t,n,r){t=qt(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:kh,field:t,range:n})}var Ae=(e,t,n)=>M5("BETWEEN",e,t,n),D2=(e,t,n)=>M5("NOT BETWEEN",e,t,n);function jc(e,t){return Array.from({length:e},()=>t)}function _n(e,t){return(...n)=>{let r=n.map(qt),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...jc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var O2=_n("REGEXP_MATCHES"),B2=_n("CONTAINS"),L2=_n("PREFIX"),C2=_n("SUFFIX"),Uq=_n("LOWER"),zq=_n("UPPER"),jq=_n("LENGTH"),qq=_n("ISNAN"),Vq=_n("ISFINITE"),Yq=_n("ISINF");var $h=class e extends Ma{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,{window:t,func:n,type:r,name:i,group:o,order:s,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(qt),r=q(["PARTITION BY ",jc(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(qt),r=q(["ORDER BY ",jc(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=A5("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=A5("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 A5(e,t){if(ws(t)){let n=q`${t}`;return n.toString=()=>`${e} ${T5(t.value)}`,n}return`${e} ${T5(t)}`}function T5(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 Ri(e,t){return(...n)=>{let r=_n(e)(...n);return new $h(e,r,t)}}var k2=Ri("ROW_NUMBER","INTEGER"),F2=Ri("RANK","INTEGER"),R2=Ri("DENSE_RANK","INTEGER"),$2=Ri("PERCENT_RANK"),P2=Ri("CUME_DIST"),U2=Ri("NTILE"),z2=Ri("LAG"),j2=Ri("LEAD"),q2=Ri("FIRST_VALUE"),V2=Ri("LAST_VALUE"),Y2=Ri("NTH_VALUE");function G2(e,...t){return q(e,...t).annotate({aggregate:!0})}var X2=class e extends Ma{constructor(t,n,r,i,o){n=(n||[]).map(qt);let{strings:s,exprs:a}=Xq(t,n,r,i,o),{spans:c,cols:l}=M2(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,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(Gq).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 $h(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function Xq(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...jc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Gq(e){let t=so(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Jt(e,t){return(...n)=>new X2(e,n,t)}var kr=Jt("COUNT","INTEGER"),W2=Jt("AVG"),Wq=Jt("AVG"),H2=Jt("MAD"),ti=Jt("MAX"),ei=Jt("MIN"),Fr=Jt("SUM","DOUBLE"),Z2=Jt("PRODUCT"),J2=Jt("MEDIAN"),Q2=Jt("QUANTILE"),K2=Jt("MODE"),tS=Jt("VARIANCE"),eS=Jt("STDDEV"),nS=Jt("SKEWNESS"),rS=Jt("KURTOSIS"),iS=Jt("ENTROPY"),oS=Jt("VAR_POP"),sS=Jt("STDDEV_POP"),aS=Jt("CORR"),cS=Jt("COVAR_POP"),lS=Jt("REGR_INTERCEPT"),uS=Jt("REGR_SLOPE"),fS=Jt("REGR_COUNT"),Hq=Jt("REGR_R2"),dS=Jt("REGR_SYY"),hS=Jt("REGR_SXX"),Zq=Jt("REGR_SXY"),pS=Jt("REGR_AVGX"),Jq=Jt("REGR_AVGY"),mS=Jt("FIRST"),yS=Jt("LAST"),wu=Jt("ARG_MIN"),vu=Jt("ARG_MAX"),gS=Jt("STRING_AGG"),xS=Jt("ARRAY_AGG");function Ph(e,t){let n=qt(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 _u=e=>Ph(e,"DOUBLE"),bS=e=>Ph(e,"INTEGER");var wS=e=>q`epoch_ms(${qt(e)})`,vS=e=>{let t=qt(e);return q`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},_S=e=>{let t=qt(e);return q`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},SS=e=>{let t=qt(e);return q`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Uh=_n("ST_AsGeoJSON"),E5=_n("ST_X"),N5=_n("ST_Y"),zh=_n("ST_CENTROID"),IS=e=>E5(zh(e)),MS=e=>N5(zh(e));var vt=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 qc("UNION",t.flat())}static unionAll(...t){return new qc("UNION ALL",t.flat())}static intersect(...t){return new qc("INTERSECT",t.flat())}static except(...t){return new qc("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}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 i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:qt(i)});else if(i instanceof xr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:R0(o),expr:qt(i[o])});return n.select=n.select.concat(r),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:$c(i)});else if(i instanceof xr)r.push({as:i.table,from:i});else if($0(i)||F0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:R0(i[0]),from:$c(i[1])});else for(let o in i)r.push({as:R0(o),from:$c(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(qt)),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:R0(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(qt)),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($0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:y,query:x})=>`"${y}" AS (${x})`);p.push(`WITH ${g.join(", ")}`)}let m=t.map(({as:g,expr:y})=>v5(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${m.join(", ")}`),r.length){let g=r.map(({as:y,from:x})=>{let b=$0(x)?`(${x})`:`${x}`;return!y||y===x.table?b:`${b} AS "${y}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(y=>y).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:y,method:x,seed:b}=i,w=g?`${g} ROWS`:`${y} PERCENT`,_=x?` (${x}${b!=null?`, ${b}`:""})`:"";p.push(`USING SAMPLE ${w}${_}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let g=a.map(String).filter(y=>y).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:y,expr:x})=>`"${y}" AS (${x})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(y=>y).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},qc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}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(qt)),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 $0(e){return e instanceof vt||e instanceof qc}function R0(e){return Qq(e)?e.slice(1,-1):e}function Qq(e){return e[0]==='"'&&e[e.length-1]==='"'}var P0=e=>e;function Kq(){return{apply:P0,invert:P0,sqlApply:qt,sqlInvert:P0}}function tV({base:e}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>q`LN(${qt(t)})`,sqlInvert:t=>q`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>q`LOG(${qt(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(${qt(n)}) / LN(${t})`,sqlInvert:n=>q`POW(${t}, ${n})`}}}function eV({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=qt(n),q`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>q`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function nV(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=qt(e),q`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>q`SIGN(${e}) * (${e}) ** 2`}}function rV({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=qt(n),q`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>q`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function D5(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:wS(qt(e)),sqlInvert:P0}}var iV={linear:Kq,log:tV,symlog:eV,sqrt:nV,pow:rV,time:D5,utc:D5};function jh(e){let t=iV[e.type];return t?{...e,...t(e)}:null}function ao(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 qh(e){return`INSTALL ${e}; LOAD ${e}`}function O5(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=>`${so(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function U0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=oV({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return ao(t,p,{view:a,temp:c,replace:l})}function TS(e,t,n){return U0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function ES(e,t,n){return U0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function NS(e,t,n){return U0("read_parquet",e,t,n)}function DS(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(", ");i.open_options=o.toUpperCase()}return U0("st_read",e,t,i)}function OS(e,t,n={}){let{select:r=["*"],...i}=n,o=O5(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return ao(e,s,i)}function oV(e){return Object.entries(e).map(([t,n])=>`${t}=${AS(n)}`).join(", ")}function AS(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=>AS(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${AS(n)}`).join(", ")+"}";default:return e}}function B5(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":case"DECIMAL":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":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var sV="count",aV="nulls",cV="max",lV="min",uV="distinct";var fV={[sV]:kr,[uV]:e=>kr(e).distinct(),[cV]:ti,[lV]:ei,[aV]:e=>kr().where(Uc(e))};function L5({table:e,column:t},n){return vt.from(e).select(n.map(r=>[r,fV[r](t)]))}var C5=()=>Object.create(null),z0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=C5()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=dV(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(L5(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await hV(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function dV(e,t){let n=await e.query(`DESCRIBE ${$c(t)}`,{type:"json",cache:!1}),r=C5();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:B5(i.column_type),nullable:i.null==="YES"};return r}async function hV(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function F5(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=k5(t^o>>8)),t=k5(t^i&255)}return pV(t)}function k5(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function pV(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var j0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,$5),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=mV(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=$5(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let x=Object.values(i.columns).map(b=>b.columns[0]);gV(d,x)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(F5(p)>>>0).toString(16)}`,y=a.exec(ao(g,p,{temp:c}));s.set(l,{table:g,result:y,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=vt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function mV(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>yV(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Ae("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Wn(l.children.map(({range:u},f)=>Ae(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=c=>c,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function yV(e,t){let{apply:n,sqlApply:r}=jh(e);if(n){let{domain:i,range:o}=e,s=n(Math.min(...i)),a=n(Math.max(...i)),c=Math.abs(o[1]-o[0])/(a-s)/t,l=t===1?"":`${t}::INTEGER * `;return u=>q`${l}FLOOR(${c}::DOUBLE * (${r(u)} - ${s}::DOUBLE))::INTEGER`}}var R5={from:NaN};function $5(e){if(!e.filterIndexable)return R5;let t=e.query(),n=BS(t);if(!n||!t.groupby)return R5;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:q`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:q`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:q`MAX("${a}")`});break;case"MIN":i.push({[a]:q`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:q`COUNT(*)`}:{},from:n}}function BS(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=BS(t[0]);for(let r=1;r<t.length;++r){let i=BS(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function gV(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 q0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new j0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():xV(t,r,i)}};function xV(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function V0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function bV(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function P5(e,t,n){let r=[],i=0;function o(){let s=wV(r,t);r=[],i=0;for(let a of s)_V(a,e,n),MV(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||bV(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function wV(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=vV(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function vV(e,t){let n=`${e}`;if(e instanceof vt&&!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 xr&&o[s.column]||s))}return`${r}`}else return n}function _V(e,t,n){if(SV(e))t({request:{type:"arrow",cache:!1,record:!1,query:IV(e,n)},result:e.result=V0()});else for(let{entry:r,priority:i}of e)t(r,i)}function SV(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 IV(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 xr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function MV(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=AV(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function AV(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var TV=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,U5=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function z5({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&&TV(r),o},clear(){n=new Map}}}function j5(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var co={High:0,Normal:1,Low:2};function q5(){let e=j5(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=co.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:m=!1,record:g=!0,options:y}=f,x=h?`${h}`:null;if(g&&l(x),m){let _=n.get(x);if(_){r.debug("Cache"),d.fulfill(_);return}}let b=performance.now(),w=await t.query({type:p,sql:x,...y});m&&n.set(x,w),r.debug(`Request: ${(performance.now()-b).toFixed(1)}`),d.fulfill(w)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?z5():f||U5():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=P5(c,n,l):!f&&s&&(s=null)},request(f,d=co.Normal){let h=V0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function V5(){return{debug(){},info(){},log(){},warn(){},error(){}}}var Y0;function ni(e){return e?Y0=e:Y0==null&&(Y0=new Vh),Y0}var Vh=class{constructor(t=k0(),n={}){let{logger:r=console,manager:i=q5()}=n;this.catalog=new z0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||V5(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=co.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
- `):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=co.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:co.Low})}createBundle(t,n,r=co.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=co.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=co.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new q0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var X0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new LS}),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(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}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=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},LS=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 Yh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?EV(e,t):!0}function EV(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 br(e){return e instanceof Ta}var Ta=class e extends X0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>br(n))){let n=new e,r=()=>n.update(t.map(i=>br(i)?i.value:i));return r(),t.forEach(i=>br(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Yh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ri(e){return e instanceof Ms}var Ms=class e extends Ta{static intersect({cross:t=!1}={}){return new e(new Vc({cross:t}))}static union({cross:t=!1}={}){return new e(new Vc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new Vc({cross:t,single:!0}))}static crossfilter(){return new e(new Vc({cross:!0}))}constructor(t=new Vc){super([]),this._resolved=this._value,this._resolver=t}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 active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=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)}},Vc=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}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{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?Pc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function CS(){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}}}var dD={};Ir(dD,{Fixed:()=>lo,Param:()=>Ta,Query:()=>vt,Selection:()=>Ms,agg:()=>G2,align:()=>c6,and:()=>Wn,area:()=>U8,areaX:()=>z8,areaY:()=>j8,argmax:()=>vu,argmin:()=>wu,arrayAgg:()=>xS,arrow:()=>LN,aspectRatio:()=>l6,avg:()=>W2,axis:()=>u6,axisFx:()=>$N,axisFy:()=>PN,axisX:()=>FN,axisY:()=>RN,barX:()=>X8,barY:()=>G8,bin:()=>Uv,cast:()=>Ph,castDouble:()=>_u,castInteger:()=>bS,cell:()=>W8,cellX:()=>H8,cellY:()=>Z8,centroid:()=>zh,centroidX:()=>IS,centroidY:()=>MS,circle:()=>rN,colorBase:()=>HE,colorClamp:()=>$E,colorConstant:()=>JE,colorDomain:()=>FE,colorExponent:()=>ZE,colorInterpolate:()=>jE,colorLabel:()=>YE,colorLegend:()=>lD,colorN:()=>PE,colorNice:()=>UE,colorPivot:()=>qE,colorRange:()=>RE,colorReverse:()=>XE,colorScale:()=>kE,colorScheme:()=>zE,colorSymmetric:()=>VE,colorTickFormat:()=>WE,colorZero:()=>GE,column:()=>Ia,contour:()=>vN,coordinator:()=>ni,corr:()=>aS,count:()=>kr,covarPop:()=>cS,create:()=>ao,cume_dist:()=>P2,dateDay:()=>SS,dateMonth:()=>vS,dateMonthDay:()=>_S,delaunayLink:()=>DN,delaunayMesh:()=>ON,denseLine:()=>wN,dense_rank:()=>R2,density:()=>bN,densityX:()=>gN,densityY:()=>xN,dot:()=>tN,dotX:()=>eN,dotY:()=>nN,entropy:()=>iS,eq:()=>_s,facetGrid:()=>L4,facetLabel:()=>C4,facetMargin:()=>E4,facetMarginBottom:()=>D4,facetMarginLeft:()=>O4,facetMarginRight:()=>B4,facetMarginTop:()=>N4,first:()=>mS,first_value:()=>q2,frame:()=>kN,from:()=>yU,fxAlign:()=>j4,fxAriaDescription:()=>sE,fxAriaLabel:()=>oE,fxAxis:()=>X4,fxDomain:()=>k4,fxFontVariant:()=>iE,fxGrid:()=>K4,fxInset:()=>$4,fxInsetLeft:()=>P4,fxInsetRight:()=>U4,fxLabel:()=>eE,fxLabelAnchor:()=>nE,fxLabelOffset:()=>rE,fxLine:()=>tE,fxNice:()=>R4,fxPadding:()=>q4,fxPaddingInner:()=>V4,fxPaddingOuter:()=>Y4,fxRange:()=>F4,fxReverse:()=>aE,fxRound:()=>z4,fxTickFormat:()=>J4,fxTickPadding:()=>Z4,fxTickRotate:()=>Q4,fxTickSize:()=>W4,fxTickSpacing:()=>H4,fxTicks:()=>G4,fyAlign:()=>mE,fyAriaDescription:()=>LE,fyAriaLabel:()=>BE,fyAxis:()=>bE,fyDomain:()=>cE,fyFontVariant:()=>OE,fyGrid:()=>AE,fyInset:()=>fE,fyInsetBottom:()=>hE,fyInsetTop:()=>dE,fyLabel:()=>EE,fyLabelAnchor:()=>NE,fyLabelOffset:()=>DE,fyLine:()=>TE,fyNice:()=>uE,fyPadding:()=>yE,fyPaddingInner:()=>gE,fyPaddingOuter:()=>xE,fyRange:()=>lE,fyReverse:()=>CE,fyRound:()=>pE,fyTickFormat:()=>IE,fyTickPadding:()=>SE,fyTickRotate:()=>ME,fyTickSize:()=>vE,fyTickSpacing:()=>_E,fyTicks:()=>wE,geo:()=>VN,geojson:()=>Uh,graticule:()=>XN,grid:()=>d6,gridFx:()=>jN,gridFy:()=>qN,gridX:()=>UN,gridY:()=>zN,gt:()=>Fh,gte:()=>E2,hconcat:()=>uU,heatmap:()=>_N,height:()=>r6,hexagon:()=>iN,hexbin:()=>MN,hexgrid:()=>AN,highlight:()=>GN,hspace:()=>hU,hull:()=>BN,image:()=>yN,inset:()=>f6,intervalX:()=>KN,intervalXY:()=>eD,intervalY:()=>tD,isBetween:()=>Ae,isDistinct:()=>N2,isNotBetween:()=>D2,isNotDistinct:()=>Rh,isNotNull:()=>vs,isNull:()=>Uc,kurtosis:()=>rS,label:()=>h6,lag:()=>z2,last:()=>yS,last_value:()=>V2,lead:()=>j2,lengthBase:()=>M8,lengthClamp:()=>_8,lengthConstant:()=>T8,lengthDomain:()=>w8,lengthExponent:()=>A8,lengthNice:()=>S8,lengthRange:()=>v8,lengthScale:()=>b8,lengthZero:()=>I8,line:()=>q8,lineX:()=>V8,lineY:()=>Y8,link:()=>CN,literal:()=>Cr,loadCSV:()=>TS,loadExtension:()=>qh,loadJSON:()=>ES,loadObjects:()=>OS,loadParquet:()=>NS,loadSpatial:()=>DS,lt:()=>Ss,lte:()=>Is,mad:()=>H2,margin:()=>K3,marginBottom:()=>a6,marginLeft:()=>i6,marginRight:()=>o6,marginTop:()=>s6,margins:()=>Q3,max:()=>ti,median:()=>J2,menu:()=>iU,min:()=>ei,mode:()=>K2,name:()=>Z3,nearestX:()=>JN,nearestY:()=>QN,neq:()=>zc,not:()=>T2,nth_value:()=>Y2,ntile:()=>U2,opacityBase:()=>a8,opacityClamp:()=>e8,opacityConstant:()=>l8,opacityDomain:()=>KE,opacityExponent:()=>c8,opacityLabel:()=>r8,opacityLegend:()=>uD,opacityNice:()=>n8,opacityRange:()=>t8,opacityReverse:()=>i8,opacityScale:()=>QE,opacityTickFormat:()=>s8,opacityZero:()=>o8,or:()=>Pc,padding:()=>p6,pan:()=>nD,panX:()=>rD,panY:()=>iD,panZoom:()=>oD,panZoomX:()=>sD,panZoomY:()=>aD,percent_rank:()=>$2,plot:()=>gU,product:()=>Z2,projectionClip:()=>$8,projectionDomain:()=>B8,projectionInset:()=>L8,projectionInsetBottom:()=>R8,projectionInsetLeft:()=>C8,projectionInsetRight:()=>k8,projectionInsetTop:()=>F8,projectionParallels:()=>N8,projectionPrecision:()=>D8,projectionRotate:()=>O8,projectionType:()=>E8,quantile:()=>Q2,rBase:()=>y8,rClamp:()=>h8,rConstant:()=>x8,rDomain:()=>f8,rExponent:()=>g8,rNice:()=>p8,rRange:()=>d8,rScale:()=>u8,rZero:()=>m8,rank:()=>F2,raster:()=>SN,rasterTile:()=>IN,rect:()=>J8,rectX:()=>Q8,rectY:()=>K8,regressionY:()=>TN,round:()=>m6,row_number:()=>k2,ruleX:()=>cN,ruleY:()=>lN,search:()=>oU,skewness:()=>nS,slider:()=>sU,sphere:()=>YN,spike:()=>mN,sql:()=>q,stddev:()=>eS,stddevPop:()=>sS,stringAgg:()=>gS,style:()=>e6,sum:()=>Fr,symbolLegend:()=>fD,table:()=>aU,text:()=>oN,textX:()=>sN,textY:()=>aN,tickX:()=>uN,tickY:()=>fN,toggle:()=>vd,toggleColor:()=>ZN,toggleX:()=>WN,toggleY:()=>HN,varPop:()=>oS,variance:()=>tS,vconcat:()=>lU,vector:()=>dN,vectorX:()=>hN,vectorY:()=>pN,voronoi:()=>EN,voronoiMesh:()=>NN,vspace:()=>dU,width:()=>n6,xAlign:()=>M6,xAriaDescription:()=>q6,xAriaLabel:()=>j6,xAxis:()=>N6,xBase:()=>X6,xClamp:()=>S6,xConstant:()=>W6,xDomain:()=>g6,xExponent:()=>G6,xFontVariant:()=>z6,xGrid:()=>F6,xInset:()=>w6,xInsetLeft:()=>v6,xInsetRight:()=>_6,xLabel:()=>$6,xLabelAnchor:()=>P6,xLabelOffset:()=>U6,xLine:()=>R6,xNice:()=>b6,xPadding:()=>A6,xPaddingInner:()=>T6,xPaddingOuter:()=>E6,xRange:()=>x6,xReverse:()=>V6,xRound:()=>I6,xScale:()=>y6,xTickFormat:()=>C6,xTickPadding:()=>L6,xTickRotate:()=>k6,xTickSize:()=>O6,xTickSpacing:()=>B6,xTicks:()=>D6,xZero:()=>Y6,xyDomain:()=>t6,yAlign:()=>i4,yAriaDescription:()=>_4,yAriaLabel:()=>v4,yAxis:()=>c4,yBase:()=>M4,yClamp:()=>n4,yConstant:()=>T4,yDomain:()=>Z6,yExponent:()=>A4,yFontVariant:()=>w4,yGrid:()=>m4,yInset:()=>K6,yInsetBottom:()=>e4,yInsetTop:()=>t4,yLabel:()=>g4,yLabelAnchor:()=>x4,yLabelOffset:()=>b4,yLine:()=>y4,yNice:()=>Q6,yPadding:()=>o4,yPaddingInner:()=>s4,yPaddingOuter:()=>a4,yRange:()=>J6,yReverse:()=>S4,yRound:()=>r4,yScale:()=>H6,yTickFormat:()=>h4,yTickPadding:()=>d4,yTickRotate:()=>p4,yTickSize:()=>u4,yTickSpacing:()=>f4,yTicks:()=>l4,yZero:()=>I4});var lo=Symbol("Fixed"),Sn=Symbol("Transient"),Xh=Symbol("Transform");var Dv={};Ir(Dv,{Area:()=>kl,Arrow:()=>ry,BarX:()=>iy,BarY:()=>oy,Cell:()=>Fl,Contour:()=>py,Density:()=>gy,Dot:()=>Rl,Frame:()=>Hm,Geo:()=>xy,Hexgrid:()=>by,Image:()=>wy,Line:()=>$l,Link:()=>ey,Mark:()=>St,Raster:()=>hy,Rect:()=>Ul,RuleX:()=>Vm,RuleY:()=>Ym,Text:()=>Bl,TickX:()=>ly,TickY:()=>uy,Tip:()=>Zm,Vector:()=>Cl,area:()=>ty,areaX:()=>cc,areaY:()=>aa,arrow:()=>P$,auto:()=>Z$,autoSpec:()=>t3,axisFx:()=>Hw,axisFy:()=>Ww,axisX:()=>Gm,axisY:()=>Xm,barX:()=>jo,barY:()=>qo,bin:()=>sa,binX:()=>Uo,binY:()=>zo,bollinger:()=>dc,bollingerX:()=>n9,bollingerY:()=>r9,boxX:()=>i9,boxY:()=>o9,cell:()=>lc,cellX:()=>z$,cellY:()=>j$,centroid:()=>eP,circle:()=>Y$,cluster:()=>tP,column:()=>mn,contour:()=>p9,crosshair:()=>g9,crosshairX:()=>x9,crosshairY:()=>b9,delaunayLink:()=>_9,delaunayMesh:()=>S9,density:()=>E9,differenceY:()=>O9,dodgeX:()=>mP,dodgeY:()=>yP,dot:()=>yi,dotX:()=>q$,dotY:()=>V$,filter:()=>QF,find:()=>aR,formatIsoDate:()=>lT,formatMonth:()=>dR,formatWeekday:()=>hR,frame:()=>Yf,geo:()=>bv,geoCentroid:()=>nP,graticule:()=>L9,gridFx:()=>Kw,gridFy:()=>Jw,gridX:()=>Qw,gridY:()=>Zw,group:()=>Fm,groupX:()=>tc,groupY:()=>ec,groupZ:()=>km,hexagon:()=>X$,hexbin:()=>C9,hexgrid:()=>k9,hull:()=>I9,identity:()=>G,image:()=>R9,indexOf:()=>Ee,initializer:()=>Ie,interpolateNearest:()=>a3,interpolateNone:()=>xv,interpolatorBarycentric:()=>s3,interpolatorRandomWalk:()=>c3,legend:()=>a$,line:()=>Pl,lineX:()=>uc,lineY:()=>fc,linearRegressionX:()=>U9,linearRegressionY:()=>z9,link:()=>lv,map:()=>vr,mapX:()=>id,mapY:()=>od,marks:()=>en,normalize:()=>Ev,normalizeX:()=>wP,normalizeY:()=>vP,plot:()=>Qm,pointer:()=>Uf,pointerX:()=>zf,pointerY:()=>El,raster:()=>u9,rect:()=>ay,rectX:()=>ed,rectY:()=>nd,reverse:()=>KF,ruleX:()=>Yr,ruleY:()=>Xr,scale:()=>$f,select:()=>SP,selectFirst:()=>N3,selectLast:()=>D3,selectMaxX:()=>AP,selectMaxY:()=>TP,selectMinX:()=>IP,selectMinY:()=>MP,shiftX:()=>_P,shuffle:()=>tR,sort:()=>dw,sphere:()=>B9,spike:()=>z7,stackX:()=>JT,stackX1:()=>D$,stackX2:()=>O$,stackY:()=>QT,stackY1:()=>B$,stackY2:()=>L$,text:()=>Po,textX:()=>zw,textY:()=>jw,tickX:()=>mv,tickY:()=>yv,tip:()=>nv,transform:()=>yn,tree:()=>S3,treeLink:()=>Iv,treeNode:()=>vy,valueof:()=>bt,vector:()=>UT,vectorX:()=>Yw,vectorY:()=>Xw,voronoi:()=>M9,voronoiMesh:()=>A9,window:()=>sd,windowX:()=>J$,windowY:()=>Q$});function zt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function As(e){let t,n,r;e.length!==2?(t=zt,n=(a,c)=>zt(e(a),c),r=(a,c)=>e(a)-c):(t=e===zt||e===Hn?e:OV,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 OV(){return 0}function Gh(e){return e===null?NaN:+e}function*Y5(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 X5=As(zt),G5=X5.right,BV=X5.left,LV=As(Gh).center,Ts=G5;var Wh=W5(H5),kS=W5(CV);function W5(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?(Su(a,l,i,o,s),Su(a,i,l,o,s),Su(a,l,i,o,s),Iu(c,i,l,o,s),Iu(c,l,i,o,s),Iu(c,i,l,o,s)):a?(Su(a,i,l,o,s),Su(a,l,i,o,s),Su(a,i,l,o,s)):c&&(Iu(c,i,l,o,s),Iu(c,l,i,o,s),Iu(c,i,l,o,s)),t}}function Su(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Iu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function CV(e){let t=H5(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 H5(e){let t=Math.floor(e);if(t===e)return kV(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 kV(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 uo(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 FV(e){return e.length|0}function RV(e){return!(e>0)}function $V(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function PV(e){return t=>e(...t)}function G0(...e){let t=typeof e[e.length-1]=="function"&&PV(e.pop());e=e.map($V);let n=e.map(FV),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(RV))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 W0(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 Ea(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 ii(e,t){let n=Ea(e,t);return n&&Math.sqrt(n)}function le(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 In=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 Zn=class extends Map{constructor(t,n=Q5){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(FS(this,t))}has(t){return super.has(FS(this,t))}set(t,n){return super.set(Z5(this,t),n)}delete(t){return super.delete(J5(this,t))}},Jn=class extends Set{constructor(t,n=Q5){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(FS(this,t))}add(t){return super.add(Z5(this,t))}delete(t){return super.delete(J5(this,t))}};function FS({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Z5({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function J5({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Q5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Hh(e){return e}function cn(e,...t){return $S(e,Hh,Hh,t)}function $i(e,t,...n){return $S(e,Hh,t,n)}function RS(e,t,...n){return $S(e,Array.from,t,n)}function $S(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Zn,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 PS(e,t){return Array.from(t,n=>e[n])}function fo(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=Yc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Yc(n[i],n[o]))),PS(e,r)}return e.sort(Zh(n))}function Zh(e=zt){if(e===zt)return Yc;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 Yc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Mu(e,t,n){return(t.length!==2?fo($i(e,t,n),([r,i],[o,s])=>zt(i,s)||zt(r,o)):fo(cn(e,n),([r,i],[o,s])=>t(i,s)||zt(r,o))).map(([r])=>r)}var UV=Math.sqrt(50),zV=Math.sqrt(10),jV=Math.sqrt(2);function H0(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>=UV?10:o>=zV?5:o>=jV?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?H0(e,t,n*2):[a,c,l]}function Mn(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?H0(t,e,n):H0(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 Es(e,t,n){return t=+t,e=+e,n=+n,H0(e,t,n)[2]}function Au(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Es(t,e,n):Es(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Tu(e,t,n){let r;for(;;){let i=Es(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 Na(e){return Math.max(1,Math.ceil(Math.log(uo(e))/Math.LN2)+1)}function Wt(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 Z0(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 J0(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 Q0(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?Yc:Zh(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));Q0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Jh(e,n,t),i(e[r],o)>0&&Jh(e,n,r);s<a;){for(Jh(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Jh(e,n,a):(++a,Jh(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Jh(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Xc(e,t=zt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?zt(s,i)>0:zt(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 Qn(e,t,n){if(e=Float64Array.from(Y5(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ue(e);if(t>=1)return Wt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Wt(Q0(e,o).subarray(0,o+1)),a=ue(e.subarray(o+1));return s+(a-s)*(i-o)}}function US(e,t,n=Gh){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 K0(e,t,n){let r=uo(e),i=Qn(e,.75)-Qn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Qh(e,t,n){let r=uo(e),i=ii(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Ns(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 Pi(e,t){return Qn(e,.5,t)}function*VV(e){for(let t of e)yield*t}function Eu(e){return Array.from(VV(e))}function Nu(e,t){let n=new Zn;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 tx(e,t=YV){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function YV(e,t){return[e,t]}function Ue(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 Kh(e,t=zt){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=zt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===zt?(a,c)=>Yc(n[a],n[c]):Zh(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 ex(e,t=zt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?zt(s,i)<0:zt(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 An(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 Da(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function K5(e){return e}var zS=1,jS=2,qS=3,nx=4,tB=1e-6;function XV(e){return"translate("+e+",0)"}function GV(e){return"translate(0,"+e+")"}function WV(e){return t=>+e(t)}function HV(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function ZV(){return!this.__axis}function JV(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===zS||e===nx?-1:1,u=e===nx||e===jS?"x":"y",f=e===zS||e===qS?XV:GV;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):K5),g=Math.max(o,0)+a,y=t.range(),x=+y[0]+c,b=+y[y.length-1]+c,w=(t.bandwidth?HV:WV)(t.copy(),c),_=h.selection?h.selection():h,v=_.selectAll(".domain").data([null]),I=_.selectAll(".tick").data(p,t).order(),N=I.exit(),A=I.enter().append("g").attr("class","tick"),D=I.select("line"),T=I.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(A),D=D.merge(A.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),T=T.merge(A.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===zS?"0em":e===qS?"0.71em":"0.32em")),h!==_&&(v=v.transition(h),I=I.transition(h),D=D.transition(h),T=T.transition(h),N=N.transition(h).attr("opacity",tB).attr("transform",function(O){return isFinite(O=w(O))?f(O+c):this.getAttribute("transform")}),A.attr("opacity",tB).attr("transform",function(O){var C=this.parentNode.__axis;return f((C&&isFinite(C=C(O))?C:w(O))+c)})),N.remove(),v.attr("d",e===nx||e===jS?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),I.attr("opacity",1).attr("transform",function(O){return f(w(O)+c)}),D.attr(u+"2",l*o),T.attr(u,l*g).text(m),_.filter(ZV).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===jS?"start":e===nx?"end":"middle"),_.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 VS(e){return JV(qS,e)}var QV={value:()=>{}};function nB(){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 rx(n)}function rx(e){this._=e}function KV(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}})}rx.prototype=nB.prototype={constructor:rx,on:function(e,t){var n=this._,r=KV(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=tY(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]=eB(n[i],e.name,t);else if(t==null)for(i in n)n[i]=eB(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 rx(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 tY(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function eB(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=QV,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Gc=nB;var ix="http://www.w3.org/1999/xhtml",oi={svg:"http://www.w3.org/2000/svg",xhtml:ix,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ds(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oi.hasOwnProperty(t)?{space:oi[t],local:e}:e}function eY(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ix&&t.documentElement.namespaceURI===ix?t.createElement(e):t.createElementNS(n,e)}}function nY(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Os(e){var t=Ds(e);return(t.local?nY:eY)(t)}function rY(){}function Wc(e){return e==null?rY:function(){return this.querySelector(e)}}function rB(e){typeof e!="function"&&(e=Wc(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 Fe(r,this._parents)}function YS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function iY(){return[]}function tp(e){return e==null?iY:function(){return this.querySelectorAll(e)}}function oY(e){return function(){return YS(e.apply(this,arguments))}}function iB(e){typeof e=="function"?e=oY(e):e=tp(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 Fe(r,i)}function ep(e){return function(){return this.matches(e)}}function ox(e){return function(t){return t.matches(e)}}var sY=Array.prototype.find;function aY(e){return function(){return sY.call(this.children,e)}}function cY(){return this.firstElementChild}function oB(e){return this.select(e==null?cY:aY(typeof e=="function"?e:ox(e)))}var lY=Array.prototype.filter;function uY(){return Array.from(this.children)}function fY(e){return function(){return lY.call(this.children,e)}}function sB(e){return this.selectAll(e==null?uY:fY(typeof e=="function"?e:ox(e)))}function aB(e){typeof e!="function"&&(e=ep(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 Fe(r,this._parents)}function sx(e){return new Array(e.length)}function cB(){return new Fe(this._enter||this._groups.map(sx),this._parents)}function np(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}np.prototype={constructor:np,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 lB(e){return function(){return e}}function dY(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 np(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function hY(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 np(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function pY(e){return e.__data__}function uB(e,t){if(!arguments.length)return Array.from(this,pY);var n=t?hY:dY,r=this._parents,i=this._groups;typeof e!="function"&&(e=lB(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=mY(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),g=s[l]=new Array(p),y=c[l]=new Array(d);n(u,f,m,g,y,h,t);for(var x=0,b=0,w,_;x<p;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(_=g[b])&&++b<p;);w._next=_||null}}return s=new Fe(s,r),s._enter=a,s._exit=c,s}function mY(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fB(){return new Fe(this._exit||this._groups.map(sx),this._parents)}function dB(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 hB(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 Fe(a,this._parents)}function pB(){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 mB(e){e||(e=yY);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 Fe(i,this._parents).order()}function yY(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function yB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gB(){return Array.from(this)}function xB(){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 bB(){let e=0;for(let t of this)++e;return e}function wB(){return!this.node()}function vB(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 gY(e){return function(){this.removeAttribute(e)}}function xY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bY(e,t){return function(){this.setAttribute(e,t)}}function wY(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function vY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function _Y(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 _B(e,t){var n=Ds(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?xY:gY:typeof t=="function"?n.local?_Y:vY:n.local?wY:bY)(n,t))}function ax(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function SY(e){return function(){this.style.removeProperty(e)}}function IY(e,t,n){return function(){this.style.setProperty(e,t,n)}}function MY(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function SB(e,t,n){return arguments.length>1?this.each((t==null?SY:typeof t=="function"?MY:IY)(e,t,n??"")):Oa(this.node(),e)}function Oa(e,t){return e.style.getPropertyValue(t)||ax(e).getComputedStyle(e,null).getPropertyValue(t)}function AY(e){return function(){delete this[e]}}function TY(e,t){return function(){this[e]=t}}function EY(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function IB(e,t){return arguments.length>1?this.each((t==null?AY:typeof t=="function"?EY:TY)(e,t)):this.node()[e]}function MB(e){return e.trim().split(/^|\s+/)}function XS(e){return e.classList||new AB(e)}function AB(e){this._node=e,this._names=MB(e.getAttribute("class")||"")}AB.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 TB(e,t){for(var n=XS(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function EB(e,t){for(var n=XS(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function NY(e){return function(){TB(this,e)}}function DY(e){return function(){EB(this,e)}}function OY(e,t){return function(){(t.apply(this,arguments)?TB:EB)(this,e)}}function NB(e,t){var n=MB(e+"");if(arguments.length<2){for(var r=XS(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?OY:t?NY:DY)(n,t))}function BY(){this.textContent=""}function LY(e){return function(){this.textContent=e}}function CY(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function DB(e){return arguments.length?this.each(e==null?BY:(typeof e=="function"?CY:LY)(e)):this.node().textContent}function kY(){this.innerHTML=""}function FY(e){return function(){this.innerHTML=e}}function RY(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function OB(e){return arguments.length?this.each(e==null?kY:(typeof e=="function"?RY:FY)(e)):this.node().innerHTML}function $Y(){this.nextSibling&&this.parentNode.appendChild(this)}function BB(){return this.each($Y)}function PY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function LB(){return this.each(PY)}function CB(e){var t=typeof e=="function"?e:Os(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function UY(){return null}function kB(e,t){var n=typeof e=="function"?e:Os(e),r=t==null?UY:typeof t=="function"?t:Wc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zY(){var e=this.parentNode;e&&e.removeChild(this)}function FB(){return this.each(zY)}function jY(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qY(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function RB(e){return this.select(e?qY:jY)}function $B(e){return arguments.length?this.property("__data__",e):this.node().__data__}function VY(e){return function(t){e.call(this,t,this.__data__)}}function YY(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 XY(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 GY(e,t,n){return function(){var r=this.__on,i,o=VY(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 PB(e,t,n){var r=YY(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?GY:XY,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function UB(e,t,n){var r=ax(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 WY(e,t){return function(){return UB(this,e,t)}}function HY(e,t){return function(){return UB(this,e,t.apply(this,arguments))}}function zB(e,t){return this.each((typeof t=="function"?HY:WY)(e,t))}function*jB(){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 GS=[null];function Fe(e,t){this._groups=e,this._parents=t}function qB(){return new Fe([[document.documentElement]],GS)}function ZY(){return this}Fe.prototype=qB.prototype={constructor:Fe,select:rB,selectAll:iB,selectChild:oB,selectChildren:sB,filter:aB,data:uB,enter:cB,exit:fB,join:dB,merge:hB,selection:ZY,order:pB,sort:mB,call:yB,nodes:gB,node:xB,size:bB,empty:wB,each:vB,attr:_B,style:SB,property:IB,classed:NB,text:DB,html:OB,raise:BB,lower:LB,append:CB,insert:kB,remove:FB,clone:RB,datum:$B,on:PB,dispatch:zB,[Symbol.iterator]:jB};var Bs=qB;function Vt(e){return typeof e=="string"?new Fe([[document.querySelector(e)]],[document.documentElement]):new Fe([[e]],GS)}function VB(e){let t;for(;t=e.sourceEvent;)e=t;return e}function kn(e,t){if(e=VB(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 cx={capture:!0,passive:!1};function lx(e){e.preventDefault(),e.stopImmediatePropagation()}function rp(e){var t=e.document.documentElement,n=Vt(e).on("dragstart.drag",lx,cx);"onselectstart"in t?n.on("selectstart.drag",lx,cx):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ip(e,t){var n=e.document.documentElement,r=Vt(e).on("dragstart.drag",null);t&&(r.on("click.drag",lx,cx),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 Ls(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ba(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function po(){}var La=.7,Jc=1/La,Du="\\s*([+-]?\\d+)\\s*",op="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ho="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",JY=/^#([0-9a-f]{3,8})$/,QY=new RegExp(`^rgb\\(${Du},${Du},${Du}\\)$`),KY=new RegExp(`^rgb\\(${ho},${ho},${ho}\\)$`),tX=new RegExp(`^rgba\\(${Du},${Du},${Du},${op}\\)$`),eX=new RegExp(`^rgba\\(${ho},${ho},${ho},${op}\\)$`),nX=new RegExp(`^hsl\\(${op},${ho},${ho}\\)$`),rX=new RegExp(`^hsla\\(${op},${ho},${ho},${op}\\)$`),YB={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};Ls(po,Rr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:XB,formatHex:XB,formatHex8:iX,formatHsl:oX,formatRgb:GB,toString:GB});function XB(){return this.rgb().formatHex()}function iX(){return this.rgb().formatHex8()}function oX(){return KB(this).formatHsl()}function GB(){return this.rgb().formatRgb()}function Rr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=JY.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?WB(t):n===3?new Ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ux(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ux(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=QY.exec(e))?new Ge(t[1],t[2],t[3],1):(t=KY.exec(e))?new Ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tX.exec(e))?ux(t[1],t[2],t[3],t[4]):(t=eX.exec(e))?ux(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nX.exec(e))?JB(t[1],t[2]/100,t[3]/100,1):(t=rX.exec(e))?JB(t[1],t[2]/100,t[3]/100,t[4]):YB.hasOwnProperty(e)?WB(YB[e]):e==="transparent"?new Ge(NaN,NaN,NaN,0):null}function WB(e){return new Ge(e>>16&255,e>>8&255,e&255,1)}function ux(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ge(e,t,n,r)}function sp(e){return e instanceof po||(e=Rr(e)),e?(e=e.rgb(),new Ge(e.r,e.g,e.b,e.opacity)):new Ge}function on(e,t,n,r){return arguments.length===1?sp(e):new Ge(e,t,n,r??1)}function Ge(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ls(Ge,on,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Ge(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Ge(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ge(Zc(this.r),Zc(this.g),Zc(this.b),dx(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:HB,formatHex:HB,formatHex8:sX,formatRgb:ZB,toString:ZB}));function HB(){return`#${Hc(this.r)}${Hc(this.g)}${Hc(this.b)}`}function sX(){return`#${Hc(this.r)}${Hc(this.g)}${Hc(this.b)}${Hc((isNaN(this.opacity)?1:this.opacity)*255)}`}function ZB(){let e=dx(this.opacity);return`${e===1?"rgb(":"rgba("}${Zc(this.r)}, ${Zc(this.g)}, ${Zc(this.b)}${e===1?")":`, ${e})`}`}function dx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hc(e){return e=Zc(e),(e<16?"0":"")+e.toString(16)}function JB(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ui(e,t,n,r)}function KB(e){if(e instanceof Ui)return new Ui(e.h,e.s,e.l,e.opacity);if(e instanceof po||(e=Rr(e)),!e)return new Ui;if(e instanceof Ui)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 Ui(s,a,c,e.opacity)}function ap(e,t,n,r){return arguments.length===1?KB(e):new Ui(e,t,n,r??1)}function Ui(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ls(Ui,ap,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Ui(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 Ge(WS(e>=240?e-240:e+120,i,r),WS(e,i,r),WS(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ui(QB(this.h),fx(this.s),fx(this.l),dx(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=dx(this.opacity);return`${e===1?"hsl(":"hsla("}${QB(this.h)}, ${fx(this.s)*100}%, ${fx(this.l)*100}%${e===1?")":`, ${e})`}`}}));function QB(e){return e=(e||0)%360,e<0?e+360:e}function fx(e){return Math.max(0,Math.min(1,e||0))}function WS(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 hx=Math.PI/180,px=180/Math.PI;var mx=18,tL=.96422,eL=1,nL=.82521,rL=4/29,Ou=6/29,iL=3*Ou*Ou,aX=Ou*Ou*Ou;function oL(e){if(e instanceof mo)return new mo(e.l,e.a,e.b,e.opacity);if(e instanceof Cs)return sL(e);e instanceof Ge||(e=sp(e));var t=QS(e.r),n=QS(e.g),r=QS(e.b),i=HS((.2225045*t+.7168786*n+.0606169*r)/eL),o,s;return t===n&&n===r?o=s=i:(o=HS((.4360747*t+.3850649*n+.1430804*r)/tL),s=HS((.0139322*t+.0971045*n+.7141733*r)/nL)),new mo(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Bu(e,t,n,r){return arguments.length===1?oL(e):new mo(e,t,n,r??1)}function mo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Ls(mo,Bu,Ba(po,{brighter(e){return new mo(this.l+mx*(e??1),this.a,this.b,this.opacity)},darker(e){return new mo(this.l-mx*(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=tL*ZS(t),e=eL*ZS(e),n=nL*ZS(n),new Ge(JS(3.1338561*t-1.6168667*e-.4906146*n),JS(-.9787684*t+1.9161415*e+.033454*n),JS(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function HS(e){return e>aX?Math.pow(e,1/3):e/iL+rL}function ZS(e){return e>Ou?e*e*e:iL*(e-rL)}function JS(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function QS(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function cX(e){if(e instanceof Cs)return new Cs(e.h,e.c,e.l,e.opacity);if(e instanceof mo||(e=oL(e)),e.a===0&&e.b===0)return new Cs(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*px;return new Cs(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function cp(e,t,n,r){return arguments.length===1?cX(e):new Cs(e,t,n,r??1)}function Cs(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function sL(e){if(isNaN(e.h))return new mo(e.l,0,0,e.opacity);var t=e.h*hx;return new mo(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ls(Cs,cp,Ba(po,{brighter(e){return new Cs(this.h,this.c,this.l+mx*(e??1),this.opacity)},darker(e){return new Cs(this.h,this.c,this.l-mx*(e??1),this.opacity)},rgb(){return sL(this).rgb()}}));var uL=-.14861,KS=1.78277,tI=-.29227,yx=-.90649,lp=1.97294,aL=lp*yx,cL=lp*KS,lL=KS*tI-yx*uL;function lX(e){if(e instanceof Qc)return new Qc(e.h,e.s,e.l,e.opacity);e instanceof Ge||(e=sp(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(lL*r+aL*t-cL*n)/(lL+aL-cL),o=r-i,s=(lp*(n-i)-tI*o)/yx,a=Math.sqrt(s*s+o*o)/(lp*i*(1-i)),c=a?Math.atan2(s,o)*px-120:NaN;return new Qc(c<0?c+360:c,a,i,e.opacity)}function Kn(e,t,n,r){return arguments.length===1?lX(e):new Qc(e,t,n,r??1)}function Qc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ls(Qc,Kn,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Qc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Qc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*hx,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ge(255*(t+n*(uL*r+KS*i)),255*(t+n*(tI*r+yx*i)),255*(t+n*(lp*r)),this.opacity)}}));function eI(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 fL(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 eI((n-r/t)*t,s,i,o,a)}}function dL(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 eI((n-r/t)*t,i,o,s,a)}}var Lu=e=>()=>e;function hL(e,t){return function(n){return e+n*t}}function uX(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 Cu(e,t){var n=t-e;return n?hL(e,n>180||n<-180?n-360*Math.round(n/360):n):Lu(isNaN(e)?t:e)}function pL(e){return(e=+e)==1?Te:function(t,n){return n-t?uX(t,n,e):Lu(isNaN(t)?n:t)}}function Te(e,t){var n=t-e;return n?hL(e,n):Lu(isNaN(e)?t:e)}var si=function e(t){var n=pL(t);function r(i,o){var s=n((i=on(i)).r,(o=on(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Te(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 mL(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=on(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 nI=mL(fL),fX=mL(dL);function yL(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 gL(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xL(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]=$r(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 bL(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function _e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function wL(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]=$r(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var iI=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rI=new RegExp(iI.source,"g");function dX(e){return function(){return e}}function hX(e){return function(t){return e(t)+""}}function up(e,t){var n=iI.lastIndex=rI.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=iI.exec(e))&&(i=rI.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:_e(r,i)})),n=rI.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?hX(c[0].x):dX(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 $r(e,t){var n=typeof t,r;return t==null||n==="boolean"?Lu(t):(n==="number"?_e:n==="string"?(r=Rr(t))?(t=r,si):up:t instanceof Rr?si:t instanceof Date?bL:gL(t)?yL:Array.isArray(t)?xL:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?wL:_e)(e,t)}function Kc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var vL=180/Math.PI,gx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oI(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)*vL,skewX:Math.atan(c)*vL,scaleX:s,scaleY:a}}var xx;function _L(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?gx:oI(t.a,t.b,t.c,t.d,t.e,t.f)}function SL(e){return e==null?gx:(xx||(xx=document.createElementNS("http://www.w3.org/2000/svg","g")),xx.setAttribute("transform",e),(e=xx.transform.baseVal.consolidate())?(e=e.matrix,oI(e.a,e.b,e.c,e.d,e.e,e.f)):gx)}function IL(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:_e(l,f)},{i:m-2,x:_e(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:_e(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:_e(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:_e(l,f)},{i:m-2,x:_e(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,g;++p<m;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var sI=IL(_L,"px, ","px)","deg)"),aI=IL(SL,", ",")",")");var pX=1e-12;function ML(e){return((e=Math.exp(e))+1/e)/2}function mX(e){return((e=Math.exp(e))-1/e)/2}function yX(e){return((e=Math.exp(2*e))-1)/(e+1)}var cI=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,g,y;if(m<pX)y=Math.log(d/l)/t,g=function(I){return[a+I*h,c+I*p,l*Math.exp(t*I*y)]};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),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);y=(v-_)/t,g=function(I){var N=I*y,A=ML(_),D=l/(n*x)*(A*yX(t*N+_)-mX(_));return[a+D*h,c+D*p,l*A/ML(t*N+_)]}}return g.duration=y*1e3*t/Math.SQRT2,g}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 AL(e){return function(t,n){var r=e((t=ap(t)).h,(n=ap(n)).h),i=Te(t.s,n.s),o=Te(t.l,n.l),s=Te(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 lI=AL(Cu),gX=AL(Te);function bx(e,t){var n=Te((e=Bu(e)).l,(t=Bu(t)).l),r=Te(e.a,t.a),i=Te(e.b,t.b),o=Te(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 TL(e){return function(t,n){var r=e((t=cp(t)).h,(n=cp(n)).h),i=Te(t.c,n.c),o=Te(t.l,n.l),s=Te(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 uI=TL(Cu),xX=TL(Te);function EL(e){return function t(n){n=+n;function r(i,o){var s=e((i=Kn(i)).h,(o=Kn(o)).h),a=Te(i.s,o.s),c=Te(i.l,o.l),l=Te(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 bX=EL(Cu),ku=EL(Te);function yo(e,t){t===void 0&&(t=e,e=$r);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 Fn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Fu=0,dp=0,fp=0,DL=1e3,wx,hp,vx=0,tl=0,_x=0,pp=typeof performance=="object"&&performance.now?performance:Date,OL=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yp(){return tl||(OL(wX),tl=pp.now()+_x)}function wX(){tl=0}function mp(){this._call=this._time=this._next=null}mp.prototype=Sx.prototype={constructor:mp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?yp():+n)+(t==null?0:+t),!this._next&&hp!==this&&(hp?hp._next=this:wx=this,hp=this),this._call=e,this._time=n,fI()},stop:function(){this._call&&(this._call=null,this._time=1/0,fI())}};function Sx(e,t,n){var r=new mp;return r.restart(e,t,n),r}function BL(){yp(),++Fu;for(var e=wx,t;e;)(t=tl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fu}function NL(){tl=(vx=pp.now())+_x,Fu=dp=0;try{BL()}finally{Fu=0,_X(),tl=0}}function vX(){var e=pp.now(),t=e-vx;t>DL&&(_x-=t,vx=e)}function _X(){for(var e,t=wx,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:wx=n);hp=e,fI(r)}function fI(e){if(!Fu){dp&&(dp=clearTimeout(dp));var t=e-tl;t>24?(e<1/0&&(dp=setTimeout(NL,e-pp.now()-_x)),fp&&(fp=clearInterval(fp))):(fp||(vx=pp.now(),fp=setInterval(vX,DL)),Fu=1,OL(NL))}}function Ix(e,t,n){var r=new mp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var SX=Gc("start","end","cancel","interrupt"),IX=[],kL=0,LL=1,Ax=2,Mx=3,CL=4,Tx=5,gp=6;function Ca(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;MX(e,n,{name:t,index:r,group:i,on:SX,tween:IX,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:kL})}function xp(e,t){var n=sn(e,t);if(n.state>kL)throw new Error("too late; already scheduled");return n}function Tn(e,t){var n=sn(e,t);if(n.state>Mx)throw new Error("too late; already running");return n}function sn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function MX(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Sx(o,0,n.time);function o(l){n.state=LL,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!==LL)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Mx)return Ix(s);h.state===CL?(h.state=gp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=gp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Ix(function(){n.state===Mx&&(n.state=CL,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ax,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ax){for(n.state=Mx,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=Tx,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===Tx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=gp,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function go(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>Ax&&r.state<Tx,r.state=gp,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function FL(e){return this.each(function(){go(this,e)})}function AX(e,t){var n,r;return function(){var i=Tn(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 TX(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Tn(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 RL(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=sn(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?AX:TX)(n,e,t))}function Ru(e,t,n){var r=e._id;return e.each(function(){var i=Tn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return sn(i,r).value[t]}}function Ex(e,t){var n;return(typeof t=="number"?_e:t instanceof Rr?si:(n=Rr(t))?(t=n,si):up)(e,t)}function EX(e){return function(){this.removeAttribute(e)}}function NX(e){return function(){this.removeAttributeNS(e.space,e.local)}}function DX(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 OX(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 BX(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 LX(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 $L(e,t){var n=Ds(e),r=n==="transform"?aI:Ex;return this.attrTween(e,typeof t=="function"?(n.local?LX:BX)(n,r,Ru(this,"attr."+e,t)):t==null?(n.local?NX:EX)(n):(n.local?OX:DX)(n,r,t))}function CX(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function kX(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function FX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&kX(e,o)),n}return i._value=t,i}function RX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&CX(e,o)),n}return i._value=t,i}function PL(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=Ds(e);return this.tween(n,(r.local?FX:RX)(r,t))}function $X(e,t){return function(){xp(this,e).delay=+t.apply(this,arguments)}}function PX(e,t){return t=+t,function(){xp(this,e).delay=t}}function UL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?$X:PX)(t,e)):sn(this.node(),t).delay}function UX(e,t){return function(){Tn(this,e).duration=+t.apply(this,arguments)}}function zX(e,t){return t=+t,function(){Tn(this,e).duration=t}}function zL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?UX:zX)(t,e)):sn(this.node(),t).duration}function jX(e,t){if(typeof t!="function")throw new Error;return function(){Tn(this,e).ease=t}}function jL(e){var t=this._id;return arguments.length?this.each(jX(t,e)):sn(this.node(),t).ease}function qX(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Tn(this,e).ease=n}}function qL(e){if(typeof e!="function")throw new Error;return this.each(qX(this._id,e))}function VL(e){typeof e!="function"&&(e=ep(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 tr(r,this._parents,this._name,this._id)}function YL(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 tr(s,this._parents,this._name,this._id)}function VX(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 YX(e,t,n){var r,i,o=VX(t)?xp:Tn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function XL(e,t){var n=this._id;return arguments.length<2?sn(this.node(),n).on.on(e):this.each(YX(n,e,t))}function XX(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function GL(){return this.on("end.remove",XX(this._id))}function WL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wc(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,Ca(l[d],t,n,d,l,sn(u,n)));return new tr(o,this._parents,t,n)}function HL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tp(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=sn(u,n),m=0,g=d.length;m<g;++m)(h=d[m])&&Ca(h,t,n,m,d,p);o.push(d),s.push(u)}return new tr(o,s,t,n)}var GX=Bs.prototype.constructor;function ZL(){return new GX(this._groups,this._parents)}function WX(e,t){var n,r,i;return function(){var o=Oa(this,e),s=(this.style.removeProperty(e),Oa(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function JL(e){return function(){this.style.removeProperty(e)}}function HX(e,t,n){var r,i=n+"",o;return function(){var s=Oa(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function ZX(e,t,n){var r,i,o;return function(){var s=Oa(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oa(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function JX(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Tn(this,e),l=c.on,u=c.value[o]==null?a||(a=JL(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function QL(e,t,n){var r=(e+="")=="transform"?sI:Ex;return t==null?this.styleTween(e,WX(e,r)).on("end.style."+e,JL(e)):typeof t=="function"?this.styleTween(e,ZX(e,r,Ru(this,"style."+e,t))).each(JX(this._id,e)):this.styleTween(e,HX(e,r,t),n).on("end.style."+e,null)}function QX(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function KX(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&QX(e,s,n)),r}return o._value=t,o}function KL(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,KX(e,t,n??""))}function tG(e){return function(){this.textContent=e}}function eG(e){return function(){var t=e(this);this.textContent=t??""}}function tC(e){return this.tween("text",typeof e=="function"?eG(Ru(this,"text",e)):tG(e==null?"":e+""))}function nG(e){return function(t){this.textContent=e.call(this,t)}}function rG(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&nG(i)),t}return r._value=e,r}function eC(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,rG(e))}function nC(){for(var e=this._name,t=this._id,n=Nx(),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=sn(c,t);Ca(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new tr(r,this._parents,e,n)}function rC(){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=Tn(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 iG=0;function tr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function iC(e){return Bs().transition(e)}function Nx(){return++iG}var ks=Bs.prototype;tr.prototype=iC.prototype={constructor:tr,select:WL,selectAll:HL,selectChild:ks.selectChild,selectChildren:ks.selectChildren,filter:VL,merge:YL,selection:ZL,transition:nC,call:ks.call,nodes:ks.nodes,node:ks.node,size:ks.size,empty:ks.empty,each:ks.each,on:XL,attr:$L,attrTween:PL,style:QL,styleTween:KL,text:tC,textTween:eC,remove:GL,tween:RL,delay:UL,duration:zL,ease:jL,easeVarying:qL,end:rC,[Symbol.iterator]:ks[Symbol.iterator]};function Dx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var oG={time:null,delay:0,duration:250,ease:Dx};function sG(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 oC(e){var t,n;e instanceof tr?(t=e._id,e=e._name):(t=Nx(),(n=oG).time=yp(),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])&&Ca(c,e,t,l,s,n||sG(c,t));return new tr(r,this._parents,e,t)}Bs.prototype.interrupt=FL;Bs.prototype.transition=oC;var Ox=e=>()=>e;function dI(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 sC(e){e.stopImmediatePropagation()}function Bx(e){e.preventDefault(),e.stopImmediatePropagation()}var aC={name:"drag"},hI={name:"space"},$u={name:"handle"},Pu={name:"center"},{abs:cC,max:Rn,min:$n}=Math;function lC(e){return[+e[0],+e[1]]}function mI(e){return[lC(e[0]),lC(e[1])]}var Lx={name:"x",handles:["w","e"].map(bp),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]]}},Cx={name:"y",handles:["n","s"].map(bp),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]]}},aG={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(bp),input:function(e){return e==null?null:mI(e)},output:function(e){return e}},Fs={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"},uC={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},fC={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},cG={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},lG={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function bp(e){return{type:e}}function uG(e){return!e.ctrlKey&&!e.button}function fG(){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 dG(){return navigator.maxTouchPoints||"ontouchstart"in this}function pI(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function hG(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function yI(){return bI(Lx)}function gI(){return bI(Cx)}function xI(){return bI(aG)}function bI(e){var t=fG,n=uG,r=dG,i=!0,o=Gc("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([bp("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Fs.overlay).merge(y).each(function(){var b=pI(this).extent;Vt(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])}),g.selectAll(".selection").data([bp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Fs.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=g.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 Fs[b.type]}),g.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(g,y,x){g.tween?g.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,_=u(b,arguments),v=w.selection,I=e.input(typeof y=="function"?y.apply(this,arguments):y,w.extent),N=$r(v,I);function A(D){w.selection=D===1&&I===null?null:N(D),l.call(b),_.brush()}return v!==null&&I!==null?A:A(1)}):g.each(function(){var b=this,w=arguments,_=b.__brush,v=e.input(typeof y=="function"?y.apply(b,w):y,_.extent),I=u(b,w).beforestart();go(b),_.selection=v===null?null:v,l.call(b),I.start(x).brush(x).end(x)})},c.clear=function(g,y){c.move(g,null,y)};function l(){var g=Vt(this),y=pI(this).selection;y?(g.selectAll(".selection").style("display",null).attr("x",y[0][0]).attr("y",y[0][1]).attr("width",y[1][0]-y[0][0]).attr("height",y[1][1]-y[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?y[1][1]-y[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,y,x){var b=g.__brush.emitter;return b&&(!x||!b.clean)?b:new f(g,y,x)}function f(g,y,x){this.that=g,this.args=y,this.state=g.__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(g,y){return this.starting?(this.starting=!1,this.emit("start",g,y)):this.emit("brush",g),this},brush:function(g,y){return this.emit("brush",g,y),this},end:function(g,y){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,y)),this},emit:function(g,y,x){var b=Vt(this.that).datum();o.call(g,this.that,new dI(g,{sourceEvent:y,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,x=g.target.__data__.type,b=(i&&g.metaKey?x="overlay":x)==="selection"?aC:i&&g.altKey?Pu:$u,w=e===Cx?null:cG[x],_=e===Lx?null:lG[x],v=pI(y),I=v.extent,N=v.selection,A=I[0][0],D,T,O=I[0][1],C,S,M=I[1][0],E,F,R=I[1][1],k,$,P=0,U=0,W,tt=w&&_&&i&&g.shiftKey,nt,at,Y=Array.from(g.touches||[g],et=>{let ae=et.identifier;return et=kn(et,y),et.point0=et.slice(),et.identifier=ae,et});go(y);var rt=u(y,arguments,!0).beforestart();if(x==="overlay"){N&&(W=!0);let et=[Y[0],Y[1]||Y[0]];v.selection=N=[[D=e===Cx?A:$n(et[0][0],et[1][0]),C=e===Lx?O:$n(et[0][1],et[1][1])],[E=e===Cx?M:Rn(et[0][0],et[1][0]),k=e===Lx?R:Rn(et[0][1],et[1][1])]],Y.length>1&&kt(g)}else D=N[0][0],C=N[0][1],E=N[1][0],k=N[1][1];T=D,S=C,F=E,$=k;var j=Vt(y).attr("pointer-events","none"),H=j.selectAll(".overlay").attr("cursor",Fs[x]);if(g.touches)rt.moved=z,rt.ended=dt;else{var ot=Vt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Ht,!0).on("keyup.brush",Zt,!0),rp(g.view)}l.call(y),rt.start(g,b.name);function z(et){for(let ae of et.changedTouches||[et])for(let Sr of Y)Sr.identifier===ae.identifier&&(Sr.cur=kn(ae,y));if(tt&&!nt&&!at&&Y.length===1){let ae=Y[0];cC(ae.cur[0]-ae[0])>cC(ae.cur[1]-ae[1])?at=!0:nt=!0}for(let ae of Y)ae.cur&&(ae[0]=ae.cur[0],ae[1]=ae.cur[1]);W=!0,Bx(et),kt(et)}function kt(et){let ae=Y[0],Sr=ae.point0;var Wi;switch(P=ae[0]-Sr[0],U=ae[1]-Sr[1],b){case hI:case aC:{w&&(P=Rn(A-D,$n(M-E,P)),T=D+P,F=E+P),_&&(U=Rn(O-C,$n(R-k,U)),S=C+U,$=k+U);break}case $u:{Y[1]?(w&&(T=Rn(A,$n(M,Y[0][0])),F=Rn(A,$n(M,Y[1][0])),w=1),_&&(S=Rn(O,$n(R,Y[0][1])),$=Rn(O,$n(R,Y[1][1])),_=1)):(w<0?(P=Rn(A-D,$n(M-D,P)),T=D+P,F=E):w>0&&(P=Rn(A-E,$n(M-E,P)),T=D,F=E+P),_<0?(U=Rn(O-C,$n(R-C,U)),S=C+U,$=k):_>0&&(U=Rn(O-k,$n(R-k,U)),S=C,$=k+U));break}case Pu:{w&&(T=Rn(A,$n(M,D-P*w)),F=Rn(A,$n(M,E+P*w))),_&&(S=Rn(O,$n(R,C-U*_)),$=Rn(O,$n(R,k+U*_)));break}}F<T&&(w*=-1,Wi=D,D=E,E=Wi,Wi=T,T=F,F=Wi,x in uC&&H.attr("cursor",Fs[x=uC[x]])),$<S&&(_*=-1,Wi=C,C=k,k=Wi,Wi=S,S=$,$=Wi,x in fC&&H.attr("cursor",Fs[x=fC[x]])),v.selection&&(N=v.selection),nt&&(T=N[0][0],F=N[1][0]),at&&(S=N[0][1],$=N[1][1]),(N[0][0]!==T||N[0][1]!==S||N[1][0]!==F||N[1][1]!==$)&&(v.selection=[[T,S],[F,$]],l.call(y),rt.brush(et,b.name))}function dt(et){if(sC(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else ip(et.view,W),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);j.attr("pointer-events","all"),H.attr("cursor",Fs.overlay),v.selection&&(N=v.selection),hG(N)&&(v.selection=null,l.call(y)),rt.end(et,b.name)}function Ht(et){switch(et.keyCode){case 16:{tt=w&&_;break}case 18:{b===$u&&(w&&(E=F-P*w,D=T+P*w),_&&(k=$-U*_,C=S+U*_),b=Pu,kt(et));break}case 32:{(b===$u||b===Pu)&&(w<0?E=F-P:w>0&&(D=T-P),_<0?k=$-U:_>0&&(C=S-U),b=hI,H.attr("cursor",Fs.selection),kt(et));break}default:return}Bx(et)}function Zt(et){switch(et.keyCode){case 16:{tt&&(nt=at=tt=!1,kt(et));break}case 18:{b===Pu&&(w<0?E=F:w>0&&(D=T),_<0?k=$:_>0&&(C=S),b=$u,kt(et));break}case 32:{b===hI&&(et.altKey?(w&&(E=F-P*w,D=T+P*w),_&&(k=$-U*_,C=S+U*_),b=Pu):(w<0?E=F:w>0&&(D=T),_<0?k=$:_>0&&(C=S),b=$u),H.attr("cursor",Fs[x]),kt(et));break}default:return}Bx(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=mI(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:Ox(mI(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:Ox(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:Ox(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var wI=Math.PI,vI=2*wI,el=1e-6,pG=vI-el;function dC(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function mG(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return dC;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 ka=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?dC:mG(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>el)if(!(Math.abs(f*c-l*u)>el)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,g=h*h+p*p,y=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((wI-Math.acos((m+d-g)/(2*y*x)))/2),w=b/x,_=b/y;Math.abs(w-1)>el&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+_*c},${this._y1=n+_*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)>el||Math.abs(this._y1-u)>el)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%vI+vI),d>pG?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>el&&this._append`A${r},${r},0,${+(d>=wI)},${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 hC(){return new ka}hC.prototype=ka.prototype;function er(e=3){return new ka(+e)}var yG=Array.prototype,kx=yG.slice;function pC(e,t){return e-t}function mC(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 xo=e=>()=>e;function yC(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=gG(e,t[n]))return i;return 0}function gG(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(xG(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function xG(e,t,n){var r;return bG(e,t,n)&&wG(e[r=+(e[0]===t[0])],n[r],t[r])}function bG(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function wG(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function gC(){}var Rs=[[],[[[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 Fa(){var e=1,t=1,n=Na,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(pC);else{let f=le(l,vG);for(u=Mn(...Tu(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),mC(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,g=d.length,y;m<g;++m)if(yC((y=d[m])[0],p)!==-1){y.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,g,y,x,b;for(p=m=-1,y=nl(l[0],u),Rs[y<<1].forEach(w);++p<e-1;)g=y,y=nl(l[p+1],u),Rs[g|y<<1].forEach(w);for(Rs[y<<0].forEach(w);++m<t-1;){for(p=-1,y=nl(l[m*e+e],u),x=nl(l[m*e],u),Rs[y<<1|x<<2].forEach(w);++p<e-1;)g=y,y=nl(l[m*e+e+p+1],u),b=x,x=nl(l[m*e+p+1],u),Rs[g|y<<1|x<<2|b<<3].forEach(w);Rs[y|x<<3].forEach(w)}for(p=-1,x=l[m*e]>=u,Rs[x<<2].forEach(w);++p<e-1;)b=x,x=nl(l[m*e+p+1],u),Rs[x<<2|b<<3].forEach(w);Rs[x<<3].forEach(w);function w(_){var v=[_[0][0]+p,_[0][1]+m],I=[_[1][0]+p,_[1][1]+m],N=a(v),A=a(I),D,T;(D=h[N])?(T=d[A])?(delete h[D.end],delete d[T.start],D===T?(D.ring.push(I),f(D.ring)):d[D.start]=h[T.end]={start:D.start,end:T.end,ring:D.ring.concat(T.ring)}):(delete h[D.end],D.ring.push(I),h[D.end=A]=D):(D=d[A])?(T=h[N])?(delete d[D.start],delete h[T.end],D===T?(D.ring.push(I),f(D.ring)):d[T.start]=h[D.end]={start:T.start,end:D.end,ring:T.ring.concat(D.ring)}):(delete d[D.start],D.ring.unshift(v),d[D.start=N]=D):d[N]=h[A]={start:N,end:A,ring:[v,I]}}}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,g=p|0,y=_I(u[g*e+m]);h>0&&h<e&&m===h&&(d[0]=xC(h,_I(u[g*e+m-1]),y,f)),p>0&&p<t&&g===p&&(d[1]=xC(p,_I(u[(g-1)*e+m]),y,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)?xo(kx.call(l)):xo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:gC,i):r===c},i}function vG(e){return isFinite(e)?e:NaN}function nl(e,t){return e==null?!1:+e>=t}function _I(e){return e==null||isNaN(e=+e)?-1/0:e}function xC(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 _G(e){return e[0]}function SG(e){return e[1]}function IG(){return 1}function SI(){var e=_G,t=SG,n=IG,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=xo(20);function f(x){var b=new Float32Array(c*l),w=Math.pow(2,-s),_=-1;for(let C of x){var v=(e(C,++_,x)+a)*w,I=(t(C,_,x)+a)*w,N=+n(C,_,x);if(N&&v>=0&&v<c&&I>=0&&I<l){var A=Math.floor(v),D=Math.floor(I),T=v-A-.5,O=I-D-.5;b[A+D*c]+=(1-T)*(1-O)*N,b[A+1+D*c]+=T*(1-O)*N,b[A+1+(D+1)*c]+=T*O*N,b[A+(D+1)*c]+=(1-T)*O*N}}return Wh({data:b,width:c,height:l},o*w),b}function d(x){var b=f(x),w=u(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=Mn(Number.MIN_VALUE,Wt(b)/_,w)),Fa().size([c,l]).thresholds(w.map(v=>v*_))(b).map((v,I)=>(v.value=+w[I],h(v)))}d.contours=function(x){var b=f(x),w=Fa().size([c,l]),_=Math.pow(2,2*s),v=I=>{I=+I;var N=h(w.contour(b,I*_));return N.value=I,N};return Object.defineProperty(v,"max",{get:()=>Wt(b)/_}),v};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(g)}function g(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function y(){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:xo(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:xo(+x),d):t},d.weight=function(x){return arguments.length?(n=typeof x=="function"?x:xo(+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,y()},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),y()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?xo(kx.call(x)):xo(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,y()},d}var Kt=11102230246251565e-32,We=134217729,wp=(3+8*Kt)*Kt;function rl(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 vp(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var MG=(3+16*Kt)*Kt,AG=(2+12*Kt)*Kt,TG=(9+64*Kt)*Kt*Kt,Uu=V(4),bC=V(8),wC=V(12),vC=V(16),nr=V(4);function EG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,g,y,x,b,w,_,v,I,N,A=e-i,D=n-i,T=t-o,O=r-o;w=A*O,d=We*A,h=d-(d-A),p=A-h,d=We*O,m=d-(d-O),g=O-m,_=p*g-(w-h*m-p*m-h*g),v=T*D,d=We*T,h=d-(d-T),p=T-h,d=We*D,m=d-(d-D),g=D-m,I=p*g-(v-h*m-p*m-h*g),y=_-I,f=_-y,Uu[0]=_-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,Uu[1]=b-(y+f)+(f-v),N=x+y,f=N-x,Uu[2]=x-(N-f)+(y-f),Uu[3]=N;let C=vp(4,Uu),S=AG*s;if(C>=S||-C>=S||(f=e-A,a=e-(A+f)+(f-i),f=n-D,l=n-(D+f)+(f-i),f=t-T,c=t-(T+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=TG*s+wp*Math.abs(C),C+=A*u+O*a-(T*l+D*c),C>=S||-C>=S))return C;w=a*O,d=We*a,h=d-(d-a),p=a-h,d=We*O,m=d-(d-O),g=O-m,_=p*g-(w-h*m-p*m-h*g),v=c*D,d=We*c,h=d-(d-c),p=c-h,d=We*D,m=d-(d-D),g=D-m,I=p*g-(v-h*m-p*m-h*g),y=_-I,f=_-y,nr[0]=_-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,nr[1]=b-(y+f)+(f-v),N=x+y,f=N-x,nr[2]=x-(N-f)+(y-f),nr[3]=N;let M=rl(4,Uu,4,nr,bC);w=A*u,d=We*A,h=d-(d-A),p=A-h,d=We*u,m=d-(d-u),g=u-m,_=p*g-(w-h*m-p*m-h*g),v=T*l,d=We*T,h=d-(d-T),p=T-h,d=We*l,m=d-(d-l),g=l-m,I=p*g-(v-h*m-p*m-h*g),y=_-I,f=_-y,nr[0]=_-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,nr[1]=b-(y+f)+(f-v),N=x+y,f=N-x,nr[2]=x-(N-f)+(y-f),nr[3]=N;let E=rl(M,bC,4,nr,wC);w=a*u,d=We*a,h=d-(d-a),p=a-h,d=We*u,m=d-(d-u),g=u-m,_=p*g-(w-h*m-p*m-h*g),v=c*l,d=We*c,h=d-(d-c),p=c-h,d=We*l,m=d-(d-l),g=l-m,I=p*g-(v-h*m-p*m-h*g),y=_-I,f=_-y,nr[0]=_-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,nr[1]=b-(y+f)+(f-v),N=x+y,f=N-x,nr[2]=x-(N-f)+(y-f),nr[3]=N;let F=rl(E,wC,4,nr,vC);return vC[F-1]}function zu(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)>=MG*l?c:-EG(e,t,n,r,i,o,l)}var t_t=(7+56*Kt)*Kt,e_t=(3+28*Kt)*Kt,n_t=(26+288*Kt)*Kt*Kt,r_t=V(4),i_t=V(4),o_t=V(4),s_t=V(4),a_t=V(4),c_t=V(4),l_t=V(4),u_t=V(4),f_t=V(4),d_t=V(8),h_t=V(8),p_t=V(8),m_t=V(4),y_t=V(8),g_t=V(8),x_t=V(8),b_t=V(12),w_t=V(192),v_t=V(192);var I_t=(10+96*Kt)*Kt,M_t=(4+48*Kt)*Kt,A_t=(44+576*Kt)*Kt*Kt,T_t=V(4),E_t=V(4),N_t=V(4),D_t=V(4),O_t=V(4),B_t=V(4),L_t=V(4),C_t=V(4),k_t=V(8),F_t=V(8),R_t=V(8),$_t=V(8),P_t=V(8),U_t=V(8),z_t=V(8),j_t=V(8),q_t=V(8),V_t=V(4),Y_t=V(4),X_t=V(4),G_t=V(8),W_t=V(16),H_t=V(16),Z_t=V(16),J_t=V(32),Q_t=V(32),K_t=V(48),t2t=V(64),e2t=V(1152),n2t=V(1152);var s2t=(16+224*Kt)*Kt,a2t=(5+72*Kt)*Kt,c2t=(71+1408*Kt)*Kt*Kt,l2t=V(4),u2t=V(4),f2t=V(4),d2t=V(4),h2t=V(4),p2t=V(4),m2t=V(4),y2t=V(4),g2t=V(4),x2t=V(4),b2t=V(24),w2t=V(24),v2t=V(24),_2t=V(24),S2t=V(24),I2t=V(24),M2t=V(24),A2t=V(24),T2t=V(24),E2t=V(24),N2t=V(1152),D2t=V(1152),O2t=V(1152),B2t=V(1152),L2t=V(1152),C2t=V(2304),k2t=V(2304),F2t=V(3456),R2t=V(5760),$2t=V(8),P2t=V(8),U2t=V(8),z2t=V(16),j2t=V(24),q2t=V(48),V2t=V(48),Y2t=V(96),X2t=V(192),G2t=V(384),W2t=V(384),H2t=V(384),Z2t=V(768);var J2t=V(96),Q2t=V(96),K2t=V(96),tSt=V(1152);var SC=Math.pow(2,-52),Fx=new Uint32Array(512),qu=class e{static from(t,n=CG,r=kG){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 A=0;A<s;A++){let D=t[2*A],T=t[2*A+1];D<a&&(a=D),T<c&&(c=T),D>l&&(l=D),T>u&&(u=T),this._ids[A]=A}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let A=0,D=1/0;A<s;A++){let T=II(f,d,t[2*A],t[2*A+1]);T<D&&(h=A,D=T)}let g=t[2*h],y=t[2*h+1];for(let A=0,D=1/0;A<s;A++){if(A===h)continue;let T=II(g,y,t[2*A],t[2*A+1]);T<D&&T>0&&(p=A,D=T)}let x=t[2*p],b=t[2*p+1],w=1/0;for(let A=0;A<s;A++){if(A===h||A===p)continue;let D=BG(g,y,x,b,t[2*A],t[2*A+1]);D<w&&(m=A,w=D)}let _=t[2*m],v=t[2*m+1];if(w===1/0){for(let T=0;T<s;T++)this._dists[T]=t[2*T]-t[0]||t[2*T+1]-t[1];ju(this._ids,this._dists,0,s-1);let A=new Uint32Array(s),D=0;for(let T=0,O=-1/0;T<s;T++){let C=this._ids[T],S=this._dists[C];S>O&&(A[D++]=C,O=S)}this.hull=A.subarray(0,D),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(zu(g,y,x,b,_,v)<0){let A=p,D=x,T=b;p=m,x=_,b=v,m=A,_=D,v=T}let I=LG(g,y,x,b,_,v);this._cx=I.x,this._cy=I.y;for(let A=0;A<s;A++)this._dists[A]=II(t[2*A],t[2*A+1],I.x,I.y);ju(this._ids,this._dists,0,s-1),this._hullStart=h;let N=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(g,y)]=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 A=0,D,T;A<this._ids.length;A++){let O=this._ids[A],C=t[2*O],S=t[2*O+1];if(A>0&&Math.abs(C-D)<=SC&&Math.abs(S-T)<=SC||(D=C,T=S,O===h||O===p||O===m))continue;let M=0;for(let $=0,P=this._hashKey(C,S);$<this._hashSize&&(M=o[(P+$)%this._hashSize],!(M!==-1&&M!==r[M]));$++);M=n[M];let E=M,F;for(;F=r[E],zu(C,S,t[2*E],t[2*E+1],t[2*F],t[2*F+1])>=0;)if(E=F,E===M){E=-1;break}if(E===-1)continue;let R=this._addTriangle(E,O,r[E],-1,-1,i[E]);i[O]=this._legalize(R+2),i[E]=R,N++;let k=r[E];for(;F=r[k],zu(C,S,t[2*k],t[2*k+1],t[2*F],t[2*F+1])<0;)R=this._addTriangle(k,O,F,i[O],-1,i[k]),i[O]=this._legalize(R+2),r[k]=k,N--,k=F;if(E===M)for(;F=n[E],zu(C,S,t[2*F],t[2*F+1],t[2*E],t[2*E+1])<0;)R=this._addTriangle(F,O,E,-1,i[E],i[F]),this._legalize(R+2),i[F]=R,r[E]=E,N--,E=F;this._hullStart=n[O]=E,r[E]=n[k]=O,r[O]=k,o[this._hashKey(C,S)]=O,o[this._hashKey(t[2*E],t[2*E+1])]=E}this.hull=new Uint32Array(N);for(let A=0,D=this._hullStart;A<N;A++)this.hull[A]=D,D=r[D];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(DG(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=Fx[--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(OG(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 y=r[f];if(y===-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,y),this._link(a,r[s]),this._link(s,f);let x=l+(a+1)%3;o<Fx.length&&(Fx[o++]=x)}else{if(o===0)break;t=Fx[--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 DG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function II(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function OG(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,g=d*d+h*h;return c*(f*g-m*h)-l*(u*g-m*d)+p*(u*h-f*d)<0}function BG(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 LG(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 ju(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;_p(e,i,o),t[e[n]]>t[e[r]]&&_p(e,n,r),t[e[o]]>t[e[r]]&&_p(e,o,r),t[e[n]]>t[e[o]]&&_p(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;_p(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(ju(e,t,o,r),ju(e,t,n,s-1)):(ju(e,t,n,s-1),ju(e,t,o,r))}}function _p(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function CG(e){return e[0]}function kG(e){return e[1]}var ai=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 Ra=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 Sp=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,g=0,y=r.length,x,b;m<y;m+=3,g+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,I=t[w],N=t[w+1],A=t[_],D=t[_+1],T=t[v],O=t[v+1],C=A-I,S=D-N,M=T-I,E=O-N,F=(C*E-S*M)*2;if(Math.abs(F)<1e-9){if(o===void 0){o=s=0;for(let k of n)o+=t[k*2],s+=t[k*2+1];o/=n.length,s/=n.length}let R=1e9*Math.sign((o-I)*E-(s-N)*M);x=(I+T)/2-R*E,b=(N+O)/2+R*M}else{let R=1/F,k=C*C+S*S,$=M*M+E*E;x=I+(E*k-S*$)*R,b=N+(C*$-M*k)*R}a[g]=x,a[g+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 ai: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],g=s[h+1],y=s[p],x=s[p+1];this._renderSegment(m,g,y,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 ai: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 ai: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 Ra;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,g,y,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,g,y,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[y,x,m,g]=p,f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}f=d,d=this._edgecode(y,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,x):i=[y,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 FG=2*Math.PI,Vu=Math.pow;function RG(e){return e[0]}function $G(e){return e[1]}function PG(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 UG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var Pn=class e{static from(t,n=RG,r=$G,i){return new e("length"in t?zG(t,n,r,i):Float64Array.from(jG(t,n,r,i)))}constructor(t){this._delaunator=new qu(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&&PG(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=UG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new qu(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 Sp(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=Vu(n-l[t*2],2)+Vu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=Vu(n-l[p*2],2)+Vu(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&&Vu(n-l[h*2],2)+Vu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new ai: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 ai: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,FG)}return r&&r.value()}renderHull(t){let n=t==null?t=new ai: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 Ra;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new ai: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 Ra;return this.renderTriangle(t,n),n.value()}};function zG(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*jG(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 IC(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function il(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 bo(e){return e=il(Math.abs(e)),e?e[1]:NaN}function MC(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 AC(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var qG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wo(e){if(!(t=qG.exec(e)))throw new Error("invalid format: "+e);var t;return new Rx({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]})}wo.prototype=Rx.prototype;function Rx(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+""}Rx.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 TC(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 MI;function EC(e,t){var n=il(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(MI=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")+il(e,Math.max(0,t+o-1))[0]}function AI(e,t){var n=il(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 TI={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:IC,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)=>AI(e*100,t),r:AI,s:EC,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function EI(e){return e}var NC=Array.prototype.map,DC=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function OC(e){var t=e.grouping===void 0||e.thousands===void 0?EI:MC(NC.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?EI:AC(NC.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=wo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,g=f.zero,y=f.width,x=f.comma,b=f.precision,w=f.trim,_=f.type;_==="n"?(x=!0,_="g"):TI[_]||(b===void 0&&(b=12),w=!0,_="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",I=m==="$"?r:/[%p]/.test(_)?s:"",N=TI[_],A=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function D(T){var O=v,C=I,S,M,E;if(_==="c")C=N(T)+C,T="";else{T=+T;var F=T<0||1/T<0;if(T=isNaN(T)?c:N(Math.abs(T),b),w&&(T=TC(T)),F&&+T==0&&p!=="+"&&(F=!1),O=(F?p==="("?p:a:p==="-"||p==="("?"":p)+O,C=(_==="s"?DC[8+MI/3]:"")+C+(F&&p==="("?")":""),A){for(S=-1,M=T.length;++S<M;)if(E=T.charCodeAt(S),48>E||E>57){C=(E===46?i+T.slice(S+1):T.slice(S))+C,T=T.slice(0,S);break}}}x&&!g&&(T=t(T,1/0));var R=O.length+T.length+C.length,k=R<y?new Array(y-R+1).join(d):"";switch(x&&g&&(T=t(k+T,k.length?y-C.length:1/0),k=""),h){case"<":T=O+T+C+k;break;case"=":T=O+k+T+C;break;case"^":T=k.slice(0,R=k.length>>1)+O+T+C+k.slice(R);break;default:T=k+O+T+C;break}return o(T)}return D.toString=function(){return f+""},D}function u(f,d){var h=l((f=wo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(bo(d)/3)))*3,m=Math.pow(10,-p),g=DC[8+p/3];return function(y){return h(m*y)+g}}return{format:l,formatPrefix:u}}var $x,ci,Px;NI({thousands:",",grouping:[3],currency:["$",""]});function NI(e){return $x=OC(e),ci=$x.format,Px=$x.formatPrefix,$x}function DI(e){return Math.max(0,-bo(Math.abs(e)))}function OI(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bo(t)/3)))*3-bo(Math.abs(e)))}function BI(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bo(t)-bo(e))+1}var K=1e-6,ol=1e-12,Ot=Math.PI,me=Ot/2,LI=Ot/4,ln=Ot*2,Re=180/Ot,Yt=Ot/180,Rt=Math.abs,li=Math.atan,He=Math.atan2,Q=Math.cos,Ip=Math.ceil,Ux=Math.exp;var zx=Math.hypot,sl=Math.log,jx=Math.pow,J=Math.sin,Un=Math.sign||function(e){return e>0?1:e<0?-1:0},ye=Math.sqrt,Yu=Math.tan;function qx(e){return e>1?0:e<-1?Ot:Math.acos(e)}function Se(e){return e>1?me:e<-1?-me:Math.asin(e)}function Ze(){}function Vx(e,t){e&&LC.hasOwnProperty(e.type)&&LC[e.type](e,t)}var BC={Feature:function(e,t){Vx(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Vx(n[r].geometry,t)}},LC={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){CI(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)CI(n[r],t,0)},Polygon:function(e,t){CC(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)CC(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Vx(n[r],t)}};function CI(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 CC(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)CI(e[n],t,1);t.polygonEnd()}function Pr(e,t){e&&BC.hasOwnProperty(e.type)?BC[e.type](e,t):Vx(e,t)}function Mp(e){return[He(e[1],e[0]),Se(e[2])]}function vo(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*J(t),J(n)]}function Ap(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Xu(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 Yx(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Tp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ep(e){var t=ye(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Np,Xx,Gx,Wx,Hx,Zx,Jx,Qx,kI,FI,RI,RC,$C,rr,ir,or,zi={sphere:Ze,point:$I,lineStart:kC,lineEnd:FC,polygonStart:function(){zi.lineStart=XG,zi.lineEnd=GG},polygonEnd:function(){zi.lineStart=kC,zi.lineEnd=FC}};function $I(e,t){e*=Yt,t*=Yt;var n=Q(t);Dp(n*Q(e),n*J(e),J(t))}function Dp(e,t,n){++Np,Gx+=(e-Gx)/Np,Wx+=(t-Wx)/Np,Hx+=(n-Hx)/Np}function kC(){zi.point=VG}function VG(e,t){e*=Yt,t*=Yt;var n=Q(t);rr=n*Q(e),ir=n*J(e),or=J(t),zi.point=YG,Dp(rr,ir,or)}function YG(e,t){e*=Yt,t*=Yt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=He(ye((s=ir*o-or*i)*s+(s=or*r-rr*o)*s+(s=rr*i-ir*r)*s),rr*r+ir*i+or*o);Xx+=s,Zx+=s*(rr+(rr=r)),Jx+=s*(ir+(ir=i)),Qx+=s*(or+(or=o)),Dp(rr,ir,or)}function FC(){zi.point=$I}function XG(){zi.point=WG}function GG(){PC(RC,$C),zi.point=$I}function WG(e,t){RC=e,$C=t,e*=Yt,t*=Yt,zi.point=PC;var n=Q(t);rr=n*Q(e),ir=n*J(e),or=J(t),Dp(rr,ir,or)}function PC(e,t){e*=Yt,t*=Yt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=ir*o-or*i,a=or*r-rr*o,c=rr*i-ir*r,l=zx(s,a,c),u=Se(l),f=l&&-u/l;kI.add(f*s),FI.add(f*a),RI.add(f*c),Xx+=u,Zx+=u*(rr+(rr=r)),Jx+=u*(ir+(ir=i)),Qx+=u*(or+(or=o)),Dp(rr,ir,or)}function PI(e){Np=Xx=Gx=Wx=Hx=Zx=Jx=Qx=0,kI=new In,FI=new In,RI=new In,Pr(e,zi);var t=+kI,n=+FI,r=+RI,i=zx(t,n,r);return i<ol&&(t=Zx,n=Jx,r=Qx,Xx<K&&(t=Gx,n=Wx,r=Hx),i=zx(t,n,r),i<ol)?[NaN,NaN]:[He(n,t)*Re,Se(r/i)*Re]}function Op(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 UI(e,t){return Rt(e)>Ot&&(e-=Math.round(e/ln)*ln),[e,t]}UI.invert=UI;function zI(e,t,n){return(e%=ln)?t||n?Op(zC(e),jC(t,n)):zC(e):t||n?jC(t,n):UI}function UC(e){return function(t,n){return t+=e,Rt(t)>Ot&&(t-=Math.round(t/ln)*ln),[t,n]}}function zC(e){var t=UC(e);return t.invert=UC(-e),t}function jC(e,t){var n=Q(e),r=J(e),i=Q(t),o=J(t);function s(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*n+u*r;return[He(f*i-h*o,u*n-d*r),Se(h*i+f*o)]}return s.invert=function(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*i-f*o;return[He(f*i+d*o,u*n+h*r),Se(h*n-u*r)]},s}function qC(e){e=zI(e[0]*Yt,e[1]*Yt,e.length>2?e[2]*Yt:0);function t(n){return n=e(n[0]*Yt,n[1]*Yt),n[0]*=Re,n[1]*=Re,n}return t.invert=function(n){return n=e.invert(n[0]*Yt,n[1]*Yt),n[0]*=Re,n[1]*=Re,n},t}function YC(e,t,n,r,i,o){if(n){var s=Q(t),a=J(t),c=r*n;i==null?(i=t+r*ln,o=t-c/2):(i=VC(s,i),o=VC(s,o),(r>0?i<o:i>o)&&(i+=r*ln));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Mp([s,-a*Q(u),-a*J(u)]),e.point(l[0],l[1])}}function VC(e,t){t=vo(t),t[0]-=e,Ep(t);var n=qx(-t[1]);return((-t[2]<0?-n:n)+ln-K)%ln}function Kx(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Ze,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Gu(e,t){return Rt(e[0]-t[0])<K&&Rt(e[1]-t[1])<K}function tb(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 eb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,g=p[0],y=p[m],x;if(Gu(g,y)){if(!g[2]&&!y[2]){for(i.lineStart(),a=0;a<m;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}y[0]+=2*K}o.push(x=new tb(g,p,null,!0)),s.push(x.o=new tb(g,null,x,!1)),o.push(x=new tb(y,p,null,!1)),s.push(x.o=new tb(y,null,x,!0))}}),!!o.length){for(s.sort(t),XC(o),XC(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 XC(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 jI(e){return Rt(e[0])<=Ot?e[0]:Un(e[0])*((Rt(e[0])+Ot)%ln-Ot)}function GC(e,t){var n=jI(t),r=t[1],i=J(r),o=[J(n),-Q(n),0],s=0,a=0,c=new In;i===1?r=me+K:i===-1&&(r=-me-K);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=jI(h),m=h[1]/2+LI,g=J(m),y=Q(m),x=0;x<d;++x,p=w,g=v,y=I,h=b){var b=f[x],w=jI(b),_=b[1]/2+LI,v=J(_),I=Q(_),N=w-p,A=N>=0?1:-1,D=A*N,T=D>Ot,O=g*v;if(c.add(He(O*A*J(D),y*I+O*Q(D))),s+=T?N+A*ln:N,T^p>=n^w>=n){var C=Xu(vo(h),vo(b));Ep(C);var S=Xu(o,C);Ep(S);var M=(T^N>=0?-1:1)*Se(S[2]);(r>M||r===M&&(C[0]||C[1]))&&(a+=T^N>=0?1:-1)}}return(s<-K||s<K&&c<-ol)^a&1}function nb(e,t,n,r){return function(i){var o=t(i),s=Kx(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,u=Eu(u);var w=GC(l,r);u.length?(c||(i.polygonStart(),c=!0),eb(u,ZG,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,_){e(w,_)&&i.point(w,_)}function p(w,_){o.point(w,_)}function m(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function y(w,_){f.push([w,_]),a.point(w,_)}function x(){a.lineStart(),f=[]}function b(){y(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,I=_.length,N,A,D;if(f.pop(),l.push(f),f=null,!!I){if(w&1){if(A=_[0],(N=A.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),v=0;v<N;++v)i.point((D=A[v])[0],D[1]);i.lineEnd()}return}I>1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(HG))}}return d}}function HG(e){return e.length>1}function ZG(e,t){return((e=e.x)[0]<0?e[1]-me-K:me-e[1])-((t=t.x)[0]<0?t[1]-me-K:me-t[1])}var qI=nb(function(){return!0},JG,KG,[-Ot,-me]);function JG(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Ot:-Ot,c=Rt(o-t);Rt(c-Ot)<K?(e.point(t,n=(n+s)/2>0?me:-me),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Ot&&(Rt(t-r)<K&&(t-=r*K),Rt(o-a)<K&&(o-=a*K),n=QG(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 QG(e,t,n,r){var i,o,s=J(e-n);return Rt(s)>K?li((J(t)*(o=Q(r))*J(n)-J(r)*(i=Q(t))*J(e))/(i*o*s)):(t+r)/2}function KG(e,t,n,r){var i;if(e==null)i=n*me,r.point(-Ot,i),r.point(0,i),r.point(Ot,i),r.point(Ot,0),r.point(Ot,-i),r.point(0,-i),r.point(-Ot,-i),r.point(-Ot,0),r.point(-Ot,i);else if(Rt(e[0]-t[0])>K){var o=e[0]<t[0]?Ot:-Ot;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function WC(e){var t=Q(e),n=6*Yt,r=t>0,i=Rt(t)>K;function o(u,f,d,h){YC(h,e,n,d,u,f)}function s(u,f){return Q(u)*Q(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(g,y){var x=[g,y],b,w=s(g,y),_=r?w?0:l(g,y):w?l(g+(g<0?Ot:-Ot),y):0;if(!f&&(p=h=w)&&u.lineStart(),w!==h&&(b=c(f,x),(!b||Gu(f,b)||Gu(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)&&(v=c(x,f,!0))&&(m=0,r?(u.lineStart(),u.point(v[0][0],v[0][1]),u.point(v[1][0],v[1][1]),u.lineEnd()):(u.point(v[1][0],v[1][1]),u.lineEnd(),u.lineStart(),u.point(v[0][0],v[0][1],3)))}w&&(!f||!Gu(f,x))&&u.point(x[0],x[1]),f=x,h=w,d=_},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=vo(u),p=vo(f),m=[1,0,0],g=Xu(h,p),y=Ap(g,g),x=g[0],b=y-x*x;if(!b)return!d&&u;var w=t*y/b,_=-t*x/b,v=Xu(m,g),I=Tp(m,w),N=Tp(g,_);Yx(I,N);var A=v,D=Ap(I,A),T=Ap(A,A),O=D*D-T*(Ap(I,I)-1);if(!(O<0)){var C=ye(O),S=Tp(A,(-D-C)/T);if(Yx(S,I),S=Mp(S),!d)return S;var M=u[0],E=f[0],F=u[1],R=f[1],k;E<M&&(k=M,M=E,E=k);var $=E-M,P=Rt($-Ot)<K,U=P||$<K;if(!P&&R<F&&(k=F,F=R,R=k),U?P?F+R>0^S[1]<(Rt(S[0]-M)<K?F:R):F<=S[1]&&S[1]<=R:$>Ot^(M<=S[0]&&S[0]<=E)){var W=Tp(A,(-D+C)/T);return Yx(W,I),[S,Mp(W)]}}}function l(u,f){var d=r?e:Ot-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return nb(s,a,o,r?[0,-e]:[-Ot,e-Ot])}function HC(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 Bp=1e9,rb=-Bp;function Wu(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 Rt(l[0]-e)<K?u>0?0:3:Rt(l[0]-n)<K?u>0?2:1:Rt(l[1]-t)<K?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=Kx(),d,h,p,m,g,y,x,b,w,_,v,I={point:N,lineStart:O,lineEnd:C,polygonStart:D,polygonEnd:T};function N(M,E){i(M,E)&&u.point(M,E)}function A(){for(var M=0,E=0,F=h.length;E<F;++E)for(var R=h[E],k=1,$=R.length,P=R[0],U,W,tt=P[0],nt=P[1];k<$;++k)U=tt,W=nt,P=R[k],tt=P[0],nt=P[1],W<=r?nt>r&&(tt-U)*(r-W)>(nt-W)*(e-U)&&++M:nt<=r&&(tt-U)*(r-W)<(nt-W)*(e-U)&&--M;return M}function D(){u=f,d=[],h=[],v=!0}function T(){var M=A(),E=v&&M,F=(d=Eu(d)).length;(E||F)&&(l.polygonStart(),E&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),F&&eb(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){I.point=S,h&&h.push(p=[]),_=!0,w=!1,x=b=NaN}function C(){d&&(S(m,g),y&&w&&f.rejoin(),d.push(f.result())),I.point=N,w&&u.lineEnd()}function S(M,E){var F=i(M,E);if(h&&p.push([M,E]),_)m=M,g=E,y=F,_=!1,F&&(u.lineStart(),u.point(M,E));else if(F&&w)u.point(M,E);else{var R=[x=Math.max(rb,Math.min(Bp,x)),b=Math.max(rb,Math.min(Bp,b))],k=[M=Math.max(rb,Math.min(Bp,M)),E=Math.max(rb,Math.min(Bp,E))];HC(R,k,e,t,n,r)?(w||(u.lineStart(),u.point(R[0],R[1])),u.point(k[0],k[1]),F||u.lineEnd(),v=!1):F&&(u.lineStart(),u.point(M,E),v=!1)}x=M,b=E,w=F}return I}}function ZC(e,t,n){var r=Ue(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function JC(e,t,n){var r=Ue(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function VI(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:x()}}function x(){return Ue(Ip(r/u)*u,n,u).map(p).concat(Ue(Ip(a/f)*f,s,f).map(m)).concat(Ue(Ip(t/c)*c,e,c).filter(function(b){return Rt(b%u)>K}).map(d)).concat(Ue(Ip(o/l)*l,i,l).filter(function(b){return Rt(b%f)>K}).map(h))}return y.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(b){return arguments.length?y.extentMajor(b).extentMinor(b):y.extentMinor()},y.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),y.precision(g)):[[r,a],[n,s]]},y.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),y.precision(g)):[[t,o],[e,i]]},y.step=function(b){return arguments.length?y.stepMajor(b).stepMinor(b):y.stepMinor()},y.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],y):[u,f]},y.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],y):[c,l]},y.precision=function(b){return arguments.length?(g=+b,d=ZC(o,i,90),h=JC(t,e,g),p=ZC(a,s,90),m=JC(r,n,g),y):g},y.extentMajor([[-180,-90+K],[180,90-K]]).extentMinor([[-180,-80-K],[180,80+K]])}function YI(){return VI()()}var Lp=e=>e;var XI=new In,GI=new In,QC,KC,WI,HI,$a={point:Ze,lineStart:Ze,lineEnd:Ze,polygonStart:function(){$a.lineStart=tW,$a.lineEnd=nW},polygonEnd:function(){$a.lineStart=$a.lineEnd=$a.point=Ze,XI.add(Rt(GI)),GI=new In},result:function(){var e=XI/2;return XI=new In,e}};function tW(){$a.point=eW}function eW(e,t){$a.point=tk,QC=WI=e,KC=HI=t}function tk(e,t){GI.add(HI*e-WI*t),WI=e,HI=t}function nW(){tk(QC,KC)}var ZI=$a;var Hu=1/0,ib=Hu,Cp=-Hu,ob=Cp,rW={point:iW,lineStart:Ze,lineEnd:Ze,polygonStart:Ze,polygonEnd:Ze,result:function(){var e=[[Hu,ib],[Cp,ob]];return Cp=ob=-(ib=Hu=1/0),e}};function iW(e,t){e<Hu&&(Hu=e),e>Cp&&(Cp=e),t<ib&&(ib=t),t>ob&&(ob=t)}var Zu=rW;var JI=0,QI=0,kp=0,sb=0,ab=0,Ju=0,KI=0,tM=0,Fp=0,rk,ik,_o,So,ji={point:al,lineStart:ek,lineEnd:nk,polygonStart:function(){ji.lineStart=aW,ji.lineEnd=cW},polygonEnd:function(){ji.point=al,ji.lineStart=ek,ji.lineEnd=nk},result:function(){var e=Fp?[KI/Fp,tM/Fp]:Ju?[sb/Ju,ab/Ju]:kp?[JI/kp,QI/kp]:[NaN,NaN];return JI=QI=kp=sb=ab=Ju=KI=tM=Fp=0,e}};function al(e,t){JI+=e,QI+=t,++kp}function ek(){ji.point=oW}function oW(e,t){ji.point=sW,al(_o=e,So=t)}function sW(e,t){var n=e-_o,r=t-So,i=ye(n*n+r*r);sb+=i*(_o+e)/2,ab+=i*(So+t)/2,Ju+=i,al(_o=e,So=t)}function nk(){ji.point=al}function aW(){ji.point=lW}function cW(){ok(rk,ik)}function lW(e,t){ji.point=ok,al(rk=_o=e,ik=So=t)}function ok(e,t){var n=e-_o,r=t-So,i=ye(n*n+r*r);sb+=i*(_o+e)/2,ab+=i*(So+t)/2,Ju+=i,i=So*e-_o*t,KI+=i*(_o+e),tM+=i*(So+t),Fp+=i*3,al(_o=e,So=t)}var eM=ji;function cb(e){this._context=e}cb.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,ln);break}}},result:Ze};var rM=new In,nM,sk,ak,Rp,$p,lb={point:Ze,lineStart:function(){lb.point=uW},lineEnd:function(){nM&&ck(sk,ak),lb.point=Ze},polygonStart:function(){nM=!0},polygonEnd:function(){nM=null},result:function(){var e=+rM;return rM=new In,e}};function uW(e,t){lb.point=ck,sk=Rp=e,ak=$p=t}function ck(e,t){Rp-=e,$p-=t,rM.add(ye(Rp*Rp+$p*$p)),Rp=e,$p=t}var iM=lb;var lk,ub,uk,fk,Qu=class{constructor(t){this._append=t==null?dk:fW(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!==uk||this._append!==ub){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`,uk=r,ub=this._append,fk=this._,this._=i}this._+=fk;break}}}result(){let t=this._;return this._="",t.length?t:null}};function dk(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function fW(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return dk;if(t!==lk){let n=10**t;lk=t,ub=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 ub}function En(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Pr(a,i(o))),o.result()}return s.area=function(a){return Pr(a,i(ZI)),ZI.result()},s.measure=function(a){return Pr(a,i(iM)),iM.result()},s.bounds=function(a){return Pr(a,i(Zu)),Zu.result()},s.centroid=function(a){return Pr(a,i(eM)),eM.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Lp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Qu(n)):new cb(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 Qu(n)),s},s.projection(e).digits(n).context(t)}function cl(e){return{stream:Ku(e)}}function Ku(e){return function(t){var n=new oM;for(var r in e)n[r]=e[r];return n.stream=t,n}}function oM(){}oM.prototype={constructor:oM,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 sM(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Pr(n,e.stream(Zu)),t(Zu.result()),r!=null&&e.clipExtent(r),e}function Pp(e,t,n){return sM(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 fb(e,t,n){return Pp(e,[[0,0],t],n)}function db(e,t,n){return sM(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 hb(e,t,n){return sM(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 hk=16,dW=Q(30*Yt);function aM(e,t){return+t?pW(e,t):hW(e)}function hW(e){return Ku({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function pW(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,g){var y=l-r,x=u-i,b=y*y+x*x;if(b>4*t&&m--){var w=s+d,_=a+h,v=c+p,I=ye(w*w+_*_+v*v),N=Se(v/=I),A=Rt(Rt(v)-1)<K||Rt(o-f)<K?(o+f)/2:He(_,w),D=e(A,N),T=D[0],O=D[1],C=T-r,S=O-i,M=x*C-y*S;(M*M/b>t||Rt((y*C+x*S)/b-.5)>.3||s*d+a*h+c*p<dW)&&(n(r,i,o,s,a,c,T,O,A,w/=I,_/=I,v,m,g),g.point(T,O),n(T,O,A,w,_,v,l,u,f,d,h,p,m,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,g={point:y,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),g.lineStart=_},polygonEnd:function(){r.polygonEnd(),g.lineStart=x}};function y(N,A){N=e(N,A),r.point(N[0],N[1])}function x(){f=NaN,g.point=b,r.lineStart()}function b(N,A){var D=vo([N,A]),T=e(N,A);n(f,d,u,h,p,m,f=T[0],d=T[1],u=N,h=D[0],p=D[1],m=D[2],hk,r),r.point(f,d)}function w(){g.point=y,r.lineEnd()}function _(){x(),g.point=v,g.lineEnd=I}function v(N,A){b(i=N,A),o=f,s=d,a=h,c=p,l=m,g.point=b}function I(){n(f,d,u,h,p,m,o,s,i,a,c,l,hk,r),g.lineEnd=w,w()}return g}}var mW=Ku({point:function(e,t){this.stream.point(e*Yt,t*Yt)}});function yW(e){return Ku({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function gW(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 pk(e,t,n,r,i,o){if(!o)return gW(e,t,n,r,i);var s=Q(o),a=J(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,g){return m*=r,g*=i,[c*m-l*g+t,n-l*m-c*g]}return p.invert=function(m,g){return[r*(u*m-f*g+d),i*(h-f*m-u*g)]},p}function Nn(e){return cM(function(){return e})()}function cM(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=qI,g=null,y,x,b,w=Lp,_=.5,v,I,N,A,D;function T(M){return N(M[0]*Yt,M[1]*Yt)}function O(M){return M=N.invert(M[0],M[1]),M&&[M[0]*Re,M[1]*Re]}T.stream=function(M){return A&&D===M?A:A=mW(yW(u)(m(v(w(D=M)))))},T.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},T.postclip=function(M){return arguments.length?(w=M,g=y=x=b=null,S()):w},T.clipAngle=function(M){return arguments.length?(m=+M?WC(p=M*Yt):(p=null,qI),S()):p*Re},T.clipExtent=function(M){return arguments.length?(w=M==null?(g=y=x=b=null,Lp):Wu(g=+M[0][0],y=+M[0][1],x=+M[1][0],b=+M[1][1]),S()):g==null?null:[[g,y],[x,b]]},T.scale=function(M){return arguments.length?(n=+M,C()):n},T.translate=function(M){return arguments.length?(r=+M[0],i=+M[1],C()):[r,i]},T.center=function(M){return arguments.length?(o=M[0]%360*Yt,s=M[1]%360*Yt,C()):[o*Re,s*Re]},T.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*Re,c*Re,l*Re]},T.angle=function(M){return arguments.length?(f=M%360*Yt,C()):f*Re},T.reflectX=function(M){return arguments.length?(d=M?-1:1,C()):d<0},T.reflectY=function(M){return arguments.length?(h=M?-1:1,C()):h<0},T.precision=function(M){return arguments.length?(v=aM(I,_=M*M),S()):ye(_)},T.fitExtent=function(M,E){return Pp(T,M,E)},T.fitSize=function(M,E){return fb(T,M,E)},T.fitWidth=function(M,E){return db(T,M,E)},T.fitHeight=function(M,E){return hb(T,M,E)};function C(){var M=pk(n,0,0,d,h,f).apply(null,t(o,s)),E=pk(n,r-M[0],i-M[1],d,h,f);return u=zI(a,c,l),I=Op(t,E),N=Op(u,I),v=aM(I,_),S()}function S(){return A=D=null,T}return function(){return t=e.apply(this,arguments),T.invert=t.invert&&O,C()}}function tf(e){var t=0,n=Ot/3,r=cM(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*Yt,n=o[1]*Yt):[t*Re,n*Re]},i}function mk(e){var t=Q(e);function n(r,i){return[r*t,J(i)/t]}return n.invert=function(r,i){return[r/t,Se(i*t)]},n}function yk(e,t){var n=J(e),r=(n+J(t))/2;if(Rt(r)<K)return mk(e);var i=1+n*(2*r-n),o=ye(i)/r;function s(a,c){var l=ye(i-2*r*J(c))/r;return[l*J(a*=r),o-l*Q(a)]}return s.invert=function(a,c){var l=o-c,u=He(a,Rt(l))*Un(l);return l*r<0&&(u-=Ot*Un(a)*Un(l)),[u/r,Se((i-(a*a+l*l)*r*r)/(2*r))]},s}function Pa(){return tf(yk).scale(155.424).center([0,33.6442])}function Up(){return Pa().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function xW(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 lM(){var e,t,n=Up(),r,i=Pa().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Pa().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,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?i:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=xW([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+K,m+.12*h+K],[p-.214*h-K,m+.234*h-K]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+K,m+.166*h+K],[p-.115*h-K,m+.234*h-K]]).stream(l),f()},u.fitExtent=function(d,h){return Pp(u,d,h)},u.fitSize=function(d,h){return fb(u,d,h)},u.fitWidth=function(d,h){return db(u,d,h)},u.fitHeight=function(d,h){return hb(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function pb(e){return function(t,n){var r=Q(t),i=Q(n),o=e(r*i);return o===1/0?[2,0]:[o*i*J(t),o*J(n)]}}function Io(e){return function(t,n){var r=ye(t*t+n*n),i=e(r),o=J(i),s=Q(i);return[He(t*o,r*s),Se(r&&n*o/r)]}}var uM=pb(function(e){return ye(2/(1+e))});uM.invert=Io(function(e){return 2*Se(e/2)});function fM(){return Nn(uM).scale(124.75).clipAngle(180-.001)}var dM=pb(function(e){return(e=qx(e))&&e/J(e)});dM.invert=Io(function(e){return e});function hM(){return Nn(dM).scale(79.4188).clipAngle(180-.001)}function ef(e,t){return[e,sl(Yu((me+t)/2))]}ef.invert=function(e,t){return[e,2*li(Ux(t))-me]};function pM(){return mM(ef).scale(961/ln)}function mM(e){var t=Nn(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=Ot*r(),d=t(qC(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===ef?[[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 mb(e){return Yu((me+e)/2)}function gk(e,t){var n=Q(e),r=e===t?J(e):sl(n/Q(t))/sl(mb(t)/mb(e)),i=n*jx(mb(e),r)/r;if(!r)return ef;function o(s,a){i>0?a<-me+K&&(a=-me+K):a>me-K&&(a=me-K);var c=i/jx(mb(a),r);return[c*J(r*s),i-c*Q(r*s)]}return o.invert=function(s,a){var c=i-a,l=Un(r)*ye(s*s+c*c),u=He(s,Rt(c))*Un(c);return c*r<0&&(u-=Ot*Un(s)*Un(c)),[u/r,2*li(jx(i/l,1/r))-me]},o}function yM(){return tf(gk).scale(109.5).parallels([30,30])}function nf(e,t){return[e,t]}nf.invert=nf;function gM(){return Nn(nf).scale(152.63)}function xk(e,t){var n=Q(e),r=e===t?J(e):(n-Q(t))/(t-e),i=n/r+e;if(Rt(r)<K)return nf;function o(s,a){var c=i-a,l=r*s;return[c*J(l),i-c*Q(l)]}return o.invert=function(s,a){var c=i-a,l=He(s,Rt(c))*Un(c);return c*r<0&&(l-=Ot*Un(s)*Un(c)),[l/r,i-Un(r)*ye(s*s+c*c)]},o}function xM(){return tf(xk).scale(131.154).center([0,13.9389])}var zp=1.340264,jp=-.081106,qp=893e-6,Vp=.003796,yb=ye(3)/2,bW=12;function bM(e,t){var n=Se(yb*J(t)),r=n*n,i=r*r*r;return[e*Q(n)/(yb*(zp+3*jp*r+i*(7*qp+9*Vp*r))),n*(zp+jp*r+i*(qp+Vp*r))]}bM.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<bW&&(a=n*(zp+jp*r+i*(qp+Vp*r))-t,c=zp+3*jp*r+i*(7*qp+9*Vp*r),n-=s=a/c,r=n*n,i=r*r*r,!(Rt(s)<ol));++o);return[yb*e*(zp+3*jp*r+i*(7*qp+9*Vp*r))/Q(n),Se(J(n)/yb)]};function wM(){return Nn(bM).scale(177.158)}function vM(e,t){var n=Q(t),r=Q(e)*n;return[n*J(e)/r,J(t)/r]}vM.invert=Io(li);function _M(){return Nn(vM).scale(144.049).clipAngle(60)}function SM(e,t){return[Q(t)*J(e),J(t)]}SM.invert=Io(Se);function IM(){return Nn(SM).scale(249.5).clipAngle(90+K)}function MM(e,t){var n=Q(t),r=1+Q(e)*n;return[n*J(e)/r,J(t)/r]}MM.invert=Io(function(e){return 2*li(e)});function AM(){return Nn(MM).scale(250).clipAngle(142)}function TM(e,t){return[sl(Yu((me+t)/2)),-e]}TM.invert=function(e,t){return[-t,2*li(Ux(e))-me]};function EM(){var e=mM(TM),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 wW(e,t){return e.parent===t.parent?1:2}function vW(e){return e.reduce(_W,0)/e.length}function _W(e,t){return e+t.x}function SW(e){return 1+e.reduce(IW,0)}function IW(e,t){return Math.max(e,t.y)}function MW(e){for(var t;t=e.children;)e=t[0];return e}function AW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function gb(){var e=wW,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=vW(h),d.y=SW(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=MW(o),l=AW(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 TW(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 bk(){return this.eachAfter(TW)}function wk(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function vk(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 _k(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 Sk(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function Ik(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 Mk(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Ak(e){for(var t=this,n=EW(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 EW(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 Tk(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Ek(){return Array.from(this)}function Nk(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function Dk(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*Ok(){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 NM(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=OW)):t===void 0&&(t=DW);for(var n=new Ua(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 Ua(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(DM)}function NW(){return NM(this).eachBefore(BW)}function DW(e){return e.children}function OW(e){return Array.isArray(e)?e[1]:null}function BW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function DM(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Ua(e){this.data=e,this.depth=this.height=0,this.parent=null}Ua.prototype=NM.prototype={constructor:Ua,count:bk,each:wk,eachAfter:_k,eachBefore:vk,find:Sk,sum:Ik,sort:Mk,path:Ak,ancestors:Tk,descendants:Ek,leaves:Nk,links:Dk,copy:NW,[Symbol.iterator]:Ok};function xb(e){return e==null?null:LW(e)}function LW(e){if(typeof e!="function")throw new Error;return e}var CW={depth:-1},Bk={},OM={};function kW(e){return e.id}function FW(e){return e.parentId}function bb(){var e=kW,t=FW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,g=new Map;if(n!=null){let y=o.map((w,_)=>RW(n(w,_,i))),x=y.map(Lk),b=new Set(y).add("");for(let w of x)b.has(w)||(b.add(w),y.push(w),x.push(Lk(w)),o.push(OM));s=(w,_)=>y[_],a=(w,_)=>x[_]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Ua(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,g.set(m,g.has(m)?Bk: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=g.get(p),!d)throw new Error("missing: "+p);if(d===Bk)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===OM&&f.children.length===1;)f=f.children[0],--c;for(let y=o.length-1;y>=0&&(h=o[y],h.data===OM);--y)h.data=null}if(f.parent=CW,f.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(DM),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=xb(i),r):e},r.parentId=function(i){return arguments.length?(t=xb(i),r):t},r.path=function(i){return arguments.length?(n=xb(i),r):n},r}function RW(e){e=`${e}`;let t=e.length;return BM(e,t-1)&&!BM(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Lk(e){let t=e.length;if(t<2)return"";for(;--t>1&&!BM(e,t););return e.slice(0,t)}function BM(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function $W(e,t){return e.parent===t.parent?1:2}function LM(e){var t=e.children;return t?t[0]:e.t}function CM(e){var t=e.children;return t?t[t.length-1]:e.t}function PW(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 UW(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 zW(e,t,n){return e.a.parent===t.parent?e.a:n}function wb(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}wb.prototype=Object.create(Ua.prototype);function jW(e){for(var t=new wb(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 wb(o[s],s)),i.parent=n;return(t.parent=new wb(null,0)).children=[t],t}function ll(){var e=$W,t=1,n=1,r=null;function i(l){var u=jW(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,g=t/(d.x+p+m),y=n/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*g,x.y=x.depth*y})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){UW(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],g=d.m,y=h.m,x=p.m,b=m.m,w;p=CM(p),d=LM(d),p&&d;)m=LM(m),h=CM(h),h.a=l,w=p.z+x-d.z-g+e(p._,d._),w>0&&(PW(zW(p,l,f),l,w),g+=w,y+=w),x+=p.m,g+=d.m,b+=m.m,y+=h.m;p&&!CM(h)&&(h.t=p,h.m+=x-y),d&&!LM(m)&&(m.t=d,m.m+=g-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 Ck=23283064365386963e-26;function Mo(e=Math.random()){let t=(0<=e&&e<1?e/Ck:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,Ck*(t>>>0))}function Je(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Yp(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 Xp=Symbol("implicit");function ul(){var e=new Zn,t=[],n=[],r=Xp;function i(o){let s=e.get(o);if(s===void 0){if(r!==Xp)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 Zn;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 ul(t,n).unknown(r)},Je.apply(i,arguments),i}function za(){var e=ul().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 g=Ue(d).map(function(y){return p+o*y});return n(h?g.reverse():g)}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 za(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Je.apply(f(),arguments)}function kk(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return kk(t())},e}function kM(){return kk(za.apply(null,arguments).paddingInner(1))}function FM(e){return function(){return e}}function rf(e){return+e}var Fk=[0,1];function wr(e){return e}function RM(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:FM(isNaN(t)?NaN:.5)}function qW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function VW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=RM(i,r),o=n(s,o)):(r=RM(r,i),o=n(o,s)),function(a){return o(r(a))}}function YW(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]=RM(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Ts(e,a,1,r)-1;return o[c](i[c](a))}}function Ao(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function fl(){var e=Fk,t=Fk,n=$r,r,i,o,s=wr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==wr&&(s=qW(e[0],e[d-1])),a=d>2?YW:VW,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),_e)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,rf),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=Kc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:wr,u()):s!==wr},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 Gp(){return fl()(wr,wr)}function $M(e,t,n,r){var i=Au(e,t,n),o;switch(r=wo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=OI(i,s))&&(r.precision=o),Px(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=BI(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=DI(i))&&(r.precision=o-(r.type==="%")*2);break}}return ci(r)}function $s(e){var t=e.domain;return e.ticks=function(n){var r=t();return Mn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return $M(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=Es(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 Ps(){var e=Gp();return e.copy=function(){return Ao(e,Ps())},Je.apply(e,arguments),$s(e)}function Wp(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,rf),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Wp(e).unknown(t)},e=arguments.length?Array.from(e,rf):[0,1],$s(n)}function Hp(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 Rk(e){return Math.log(e)}function $k(e){return Math.exp(e)}function XW(e){return-Math.log(-e)}function GW(e){return-Math.exp(-e)}function WW(e){return isFinite(e)?+("1e"+e):e<0?0:e}function HW(e){return e===10?WW:e===Math.E?Math.exp:t=>Math.pow(e,t)}function ZW(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 Pk(e){return(t,n)=>-e(-t,n)}function PM(e){let t=e(Rk,$k),n=t.domain,r=10,i,o;function s(){return i=ZW(r),o=HW(r),n()[0]<0?(i=Pk(i),o=Pk(o),e(XW,GW)):e(Rk,$k),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,g=a==null?10:+a,y=[];if(!(r%1)&&h-d<g){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;y.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;y.push(m)}y.length*2<g&&(y=Mn(l,u,g))}else y=Mn(d,h,Math.min(h-d,g)).map(o);return f?y.reverse():y},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=wo(c)).precision==null&&(c.trim=!0),c=ci(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(Hp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Zp(){let e=PM(fl()).domain([1,10]);return e.copy=()=>Ao(e,Zp()).base(e.base()),Je.apply(e,arguments),e}function Uk(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function zk(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function UM(e){var t=1,n=e(Uk(t),zk(t));return n.constant=function(r){return arguments.length?e(Uk(t=+r),zk(t)):t},$s(n)}function Jp(){var e=UM(fl());return e.copy=function(){return Ao(e,Jp()).constant(e.constant())},Je.apply(e,arguments)}function jk(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function JW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function QW(e){return e<0?-e*e:e*e}function zM(e){var t=e(wr,wr),n=1;function r(){return n===1?e(wr,wr):n===.5?e(JW,QW):e(jk(n),jk(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},$s(t)}function Qp(){var e=zM(fl());return e.copy=function(){return Ao(e,Qp()).exponent(e.exponent())},Je.apply(e,arguments),e}function Kp(){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]=US(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[Ts(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(zt),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 Kp().domain(e).range(t).unknown(r)},Je.apply(o,arguments)}function tm(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Ts(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 tm().domain(e).range(t).unknown(n)},Je.apply(i,arguments)}var jM=new Date,qM=new Date;function xe(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=>xe(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)=>(jM.setTime(+o),qM.setTime(+s),e(jM),e(qM),Math.floor(n(jM,qM))),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 em=xe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);em.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):em);var u6t=em.range;var un=xe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),qk=un.range;var Us=xe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),KW=Us.range,zs=xe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),tH=zs.range;var js=xe(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()),eH=js.range,qs=xe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),nH=qs.range;var ui=xe(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),rH=ui.range,pl=xe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),iH=pl.range,ml=xe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),oH=ml.range;function yl(e){return xe(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 Ur=yl(0),ja=yl(1),vb=yl(2),_b=yl(3),Eo=yl(4),Sb=yl(5),Ib=yl(6),Yk=Ur.range,sH=ja.range,aH=vb.range,cH=_b.range,lH=Eo.range,uH=Sb.range,fH=Ib.range;function gl(e){return xe(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 zr=gl(0),qa=gl(1),Mb=gl(2),Ab=gl(3),No=gl(4),Tb=gl(5),Eb=gl(6),Xk=zr.range,dH=qa.range,hH=Mb.range,pH=Ab.range,mH=No.range,yH=Tb.range,gH=Eb.range;var Vs=xe(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()),xH=Vs.range,Ys=xe(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()),bH=Ys.range;var zn=xe(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());zn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xe(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 wH=zn.range,jn=xe(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());jn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xe(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 vH=jn.range;function Wk(e,t,n,r,i,o){let s=[[un,1,1e3],[un,5,5*1e3],[un,15,15*1e3],[un,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=As(([,,g])=>g).right(s,d);if(h===s.length)return e.every(Au(l/31536e6,u/31536e6,f));if(h===0)return em.every(Math.max(Au(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[VM,rm]=Wk(jn,Ys,zr,ml,qs,zs),[YM,XM]=Wk(zn,Vs,Ur,ui,js,Us);function GM(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 WM(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 im(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function HM(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=om(i),u=sm(i),f=om(o),d=sm(o),h=om(s),p=sm(s),m=om(a),g=sm(a),y=om(c),x=sm(c),b={a:F,A:R,b:k,B:$,c:null,d:tF,e:tF,f:YH,g:eZ,G:rZ,H:jH,I:qH,j:VH,L:oF,m:XH,M:GH,p:P,q:U,Q:rF,s:iF,S:WH,u:HH,U:ZH,V:JH,w:QH,W:KH,x:null,X:null,y:tZ,Y:nZ,Z:iZ,"%":nF},w={a:W,A:tt,b:nt,B:at,c:null,d:eF,e:eF,f:cZ,g:xZ,G:wZ,H:oZ,I:sZ,j:aZ,L:aF,m:lZ,M:uZ,p:Y,q:rt,Q:rF,s:iF,S:fZ,u:dZ,U:hZ,V:pZ,w:mZ,W:yZ,x:null,X:null,y:gZ,Y:bZ,Z:vZ,"%":nF},_={a:D,A:T,b:O,B:C,c:S,d:Qk,e:Qk,f:$H,g:Jk,G:Zk,H:Kk,I:Kk,j:CH,L:RH,m:LH,M:kH,p:A,q:BH,Q:UH,s:zH,S:FH,u:TH,U:EH,V:NH,w:AH,W:DH,x:M,X:E,y:Jk,Y:Zk,Z:OH,"%":PH};b.x=v(n,b),b.X=v(r,b),b.c=v(t,b),w.x=v(n,w),w.X=v(r,w),w.c=v(t,w);function v(j,H){return function(ot){var z=[],kt=-1,dt=0,Ht=j.length,Zt,et,ae;for(ot instanceof Date||(ot=new Date(+ot));++kt<Ht;)j.charCodeAt(kt)===37&&(z.push(j.slice(dt,kt)),(et=Hk[Zt=j.charAt(++kt)])!=null?Zt=j.charAt(++kt):et=Zt==="e"?" ":"0",(ae=H[Zt])&&(Zt=ae(ot,et)),z.push(Zt),dt=kt+1);return z.push(j.slice(dt,kt)),z.join("")}}function I(j,H){return function(ot){var z=im(1900,void 0,1),kt=N(z,j,ot+="",0),dt,Ht;if(kt!=ot.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?(dt=WM(im(z.y,0,1)),Ht=dt.getUTCDay(),dt=Ht>4||Ht===0?qa.ceil(dt):qa(dt),dt=pl.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=GM(im(z.y,0,1)),Ht=dt.getDay(),dt=Ht>4||Ht===0?ja.ceil(dt):ja(dt),dt=ui.offset(dt,(z.V-1)*7),z.y=dt.getFullYear(),z.m=dt.getMonth(),z.d=dt.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),Ht="Z"in z?WM(im(z.y,0,1)).getUTCDay():GM(im(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Ht+5)%7:z.w+z.U*7-(Ht+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,WM(z)):GM(z)}}function N(j,H,ot,z){for(var kt=0,dt=H.length,Ht=ot.length,Zt,et;kt<dt;){if(z>=Ht)return-1;if(Zt=H.charCodeAt(kt++),Zt===37){if(Zt=H.charAt(kt++),et=_[Zt in Hk?H.charAt(kt++):Zt],!et||(z=et(j,ot,z))<0)return-1}else if(Zt!=ot.charCodeAt(z++))return-1}return z}function A(j,H,ot){var z=l.exec(H.slice(ot));return z?(j.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function D(j,H,ot){var z=h.exec(H.slice(ot));return z?(j.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function T(j,H,ot){var z=f.exec(H.slice(ot));return z?(j.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(j,H,ot){var z=y.exec(H.slice(ot));return z?(j.m=x.get(z[0].toLowerCase()),ot+z[0].length):-1}function C(j,H,ot){var z=m.exec(H.slice(ot));return z?(j.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(j,H,ot){return N(j,t,H,ot)}function M(j,H,ot){return N(j,n,H,ot)}function E(j,H,ot){return N(j,r,H,ot)}function F(j){return s[j.getDay()]}function R(j){return o[j.getDay()]}function k(j){return c[j.getMonth()]}function $(j){return a[j.getMonth()]}function P(j){return i[+(j.getHours()>=12)]}function U(j){return 1+~~(j.getMonth()/3)}function W(j){return s[j.getUTCDay()]}function tt(j){return o[j.getUTCDay()]}function nt(j){return c[j.getUTCMonth()]}function at(j){return a[j.getUTCMonth()]}function Y(j){return i[+(j.getUTCHours()>=12)]}function rt(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var H=v(j+="",b);return H.toString=function(){return j},H},parse:function(j){var H=I(j+="",!1);return H.toString=function(){return j},H},utcFormat:function(j){var H=v(j+="",w);return H.toString=function(){return j},H},utcParse:function(j){var H=I(j+="",!0);return H.toString=function(){return j},H}}}var Hk={"-":"",_:" ",0:"0"},fn=/^\s*\d+/,SH=/^%/,IH=/[\\^$*+?|[\]().{}]/g;function ee(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 MH(e){return e.replace(IH,"\\$&")}function om(e){return new RegExp("^(?:"+e.map(MH).join("|")+")","i")}function sm(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function AH(e,t,n){var r=fn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function TH(e,t,n){var r=fn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function EH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function NH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function DH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Zk(e,t,n){var r=fn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Jk(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function OH(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 BH(e,t,n){var r=fn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function LH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Qk(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function CH(e,t,n){var r=fn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Kk(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function kH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function FH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function RH(e,t,n){var r=fn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function $H(e,t,n){var r=fn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function PH(e,t,n){var r=SH.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function UH(e,t,n){var r=fn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function zH(e,t,n){var r=fn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function tF(e,t){return ee(e.getDate(),t,2)}function jH(e,t){return ee(e.getHours(),t,2)}function qH(e,t){return ee(e.getHours()%12||12,t,2)}function VH(e,t){return ee(1+ui.count(zn(e),e),t,3)}function oF(e,t){return ee(e.getMilliseconds(),t,3)}function YH(e,t){return oF(e,t)+"000"}function XH(e,t){return ee(e.getMonth()+1,t,2)}function GH(e,t){return ee(e.getMinutes(),t,2)}function WH(e,t){return ee(e.getSeconds(),t,2)}function HH(e){var t=e.getDay();return t===0?7:t}function ZH(e,t){return ee(Ur.count(zn(e)-1,e),t,2)}function sF(e){var t=e.getDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function JH(e,t){return e=sF(e),ee(Eo.count(zn(e),e)+(zn(e).getDay()===4),t,2)}function QH(e){return e.getDay()}function KH(e,t){return ee(ja.count(zn(e)-1,e),t,2)}function tZ(e,t){return ee(e.getFullYear()%100,t,2)}function eZ(e,t){return e=sF(e),ee(e.getFullYear()%100,t,2)}function nZ(e,t){return ee(e.getFullYear()%1e4,t,4)}function rZ(e,t){var n=e.getDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),ee(e.getFullYear()%1e4,t,4)}function iZ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ee(t/60|0,"0",2)+ee(t%60,"0",2)}function eF(e,t){return ee(e.getUTCDate(),t,2)}function oZ(e,t){return ee(e.getUTCHours(),t,2)}function sZ(e,t){return ee(e.getUTCHours()%12||12,t,2)}function aZ(e,t){return ee(1+pl.count(jn(e),e),t,3)}function aF(e,t){return ee(e.getUTCMilliseconds(),t,3)}function cZ(e,t){return aF(e,t)+"000"}function lZ(e,t){return ee(e.getUTCMonth()+1,t,2)}function uZ(e,t){return ee(e.getUTCMinutes(),t,2)}function fZ(e,t){return ee(e.getUTCSeconds(),t,2)}function dZ(e){var t=e.getUTCDay();return t===0?7:t}function hZ(e,t){return ee(zr.count(jn(e)-1,e),t,2)}function cF(e){var t=e.getUTCDay();return t>=4||t===0?No(e):No.ceil(e)}function pZ(e,t){return e=cF(e),ee(No.count(jn(e),e)+(jn(e).getUTCDay()===4),t,2)}function mZ(e){return e.getUTCDay()}function yZ(e,t){return ee(qa.count(jn(e)-1,e),t,2)}function gZ(e,t){return ee(e.getUTCFullYear()%100,t,2)}function xZ(e,t){return e=cF(e),ee(e.getUTCFullYear()%100,t,2)}function bZ(e,t){return ee(e.getUTCFullYear()%1e4,t,4)}function wZ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?No(e):No.ceil(e),ee(e.getUTCFullYear()%1e4,t,4)}function vZ(){return"+0000"}function nF(){return"%"}function rF(e){return+e}function iF(e){return Math.floor(+e/1e3)}var of,sf,lF,Do,uF;ZM({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 ZM(e){return of=HM(e),sf=of.format,lF=of.parse,Do=of.utcFormat,uF=of.utcParse,of}function _Z(e){return new Date(e)}function SZ(e){return e instanceof Date?+e:+new Date(+e)}function Nb(e,t,n,r,i,o,s,a,c,l){var u=Gp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),w=l("%Y");function _(v){return(c(v)<v?h:a(v)<v?p:s(v)<v?m:o(v)<v?g:r(v)<v?i(v)<v?y:x:n(v)<v?b:w)(v)}return u.invert=function(v){return new Date(f(v))},u.domain=function(v){return arguments.length?d(Array.from(v,SZ)):d().map(_Z)},u.ticks=function(v){var I=d();return e(I[0],I[I.length-1],v??10)},u.tickFormat=function(v,I){return I==null?_:l(I)},u.nice=function(v){var I=d();return(!v||typeof v.range!="function")&&(v=t(I[0],I[I.length-1],v??10)),v?d(Hp(I,v)):u},u.copy=function(){return Ao(u,Nb(e,t,n,r,i,o,s,a,c,l))},u}function Db(){return Je.apply(Nb(YM,XM,zn,Vs,Ur,ui,js,Us,un,sf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ob(){return Je.apply(Nb(VM,rm,jn,Ys,zr,pl,qs,zs,un,Do).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function am(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Bb(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=wr,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(g){var y,x,b;return arguments.length?([y,x,b]=g,l=yo(m,[y,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p($r),h.rangeRound=p(Kc),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 cm(){var e=$s(Bb()(wr));return e.copy=function(){return am(e,cm())},Yp.apply(e,arguments)}function Lb(){var e=PM(Bb()).domain([.1,1,10]);return e.copy=function(){return am(e,Lb()).base(e.base())},Yp.apply(e,arguments)}function Cb(){var e=UM(Bb());return e.copy=function(){return am(e,Cb()).constant(e.constant())},Yp.apply(e,arguments)}function kb(){var e=zM(Bb());return e.copy=function(){return am(e,kb()).exponent(e.exponent())},Yp.apply(e,arguments)}function X(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 JM=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var QM=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var KM=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var tA=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var eA=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var nA=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var rA=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var iA=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var oA=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var sA=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>nI(e[e.length-1]);var Fb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),Rb=ht(Fb);var $b=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),Pb=ht($b);var Ub=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),zb=ht(Ub);var jb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),qb=ht(jb);var lm=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),af=ht(lm);var Vb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),Yb=ht(Vb);var um=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),cf=ht(um);var Xb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),Gb=ht(Xb);var Wb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),Hb=ht(Wb);var Zb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),Jb=ht(Zb);var Qb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),Kb=ht(Qb);var t1=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),e1=ht(t1);var n1=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),r1=ht(n1);var i1=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),o1=ht(i1);var s1=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),a1=ht(s1);var c1=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),l1=ht(c1);var u1=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),f1=ht(u1);var d1=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),h1=ht(d1);var p1=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),m1=ht(p1);var y1=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),g1=ht(y1);var x1=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),b1=ht(x1);var w1=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),v1=ht(w1);var _1=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),S1=ht(_1);var I1=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),M1=ht(I1);var A1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),T1=ht(A1);var E1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),N1=ht(E1);var D1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),O1=ht(D1);function B1(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 L1=ku(Kn(300,.5,0),Kn(-240,.5,1));var k1=ku(Kn(-100,.75,.35),Kn(80,1.5,.8)),F1=ku(Kn(260,.75,.35),Kn(80,1.5,.8)),C1=Kn();function R1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return C1.h=360*e-100,C1.s=1.5-1.5*t,C1.l=.8-.9*t,C1+""}var $1=on(),IZ=Math.PI/3,MZ=Math.PI*2/3;function P1(e){var t;return e=(.5-e)*Math.PI,$1.r=255*(t=Math.sin(e))*t,$1.g=255*(t=Math.sin(e+IZ))*t,$1.b=255*(t=Math.sin(e+MZ))*t,$1+""}function U1(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 z1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var j1=z1(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),q1=z1(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),V1=z1(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Y1=z1(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Qe(e){return function(){return e}}var aA=Math.cos;var lf=Math.min,fm=Math.sin,ne=Math.sqrt,cA=1e-12,xl=Math.PI,BNt=xl/2,uf=2*xl;function X1(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 ka(t)}var FNt=Array.prototype.slice;function G1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fF(e){this._context=e}fF.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 Xs(e){return new fF(e)}function W1(e){return e[0]}function H1(e){return e[1]}function dm(e,t){var n=Qe(!0),r=null,i=Xs,o=null,s=X1(a);e=typeof e=="function"?e:e===void 0?W1:Qe(e),t=typeof t=="function"?t:t===void 0?H1:Qe(t);function a(c){var l,u=(c=G1(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:Qe(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Qe(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Qe(!!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 ff(e,t,n){var r=null,i=Qe(!0),o=null,s=Xs,a=null,c=X1(l);e=typeof e=="function"?e:e===void 0?W1:Qe(+e),t=typeof t=="function"?t:t===void 0?Qe(0):Qe(+t),n=typeof n=="function"?n:n===void 0?H1:Qe(+n);function l(f){var d,h,p,m=(f=G1(f)).length,g,y=!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(g=f[d],d,f))===y)if(y=!y)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()}y&&(b[d]=+e(g,d,f),w[d]=+t(g,d,f),a.point(r?+r(g,d,f):b[d],n?+n(g,d,f):w[d]))}if(x)return a=null,x+""||null}function u(){return dm().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Qe(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Qe(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Qe(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Qe(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Qe(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Qe(+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:Qe(!!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 Z1=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 lA(e){return new Z1(e,!0)}function uA(e){return new Z1(e,!1)}var AZ=ne(3),hm={draw(e,t){let n=ne(t+lf(t/28,.75))*.59436,r=n/2,i=r*AZ;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 Gs={draw(e,t){let n=ne(t/xl);e.moveTo(n,0),e.arc(0,0,n,0,uf)}};var pm={draw(e,t){let n=ne(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 dF=ne(1/3),TZ=dF*2,mm={draw(e,t){let n=ne(t/TZ),r=n*dF;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var ym={draw(e,t){let n=ne(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var gm={draw(e,t){let n=ne(t-lf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var xm={draw(e,t){let n=ne(t),r=-n/2;e.rect(r,r,n,n)}};var bm={draw(e,t){let n=ne(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var EZ=.8908130915292852,hF=fm(xl/10)/fm(7*xl/10),NZ=fm(uf/10)*hF,DZ=-aA(uf/10)*hF,wm={draw(e,t){let n=ne(t*EZ),r=NZ*n,i=DZ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=uf*o/5,a=aA(s),c=fm(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var fA=ne(3),vm={draw(e,t){let n=-ne(t/(fA*3));e.moveTo(0,n*2),e.lineTo(-fA*n,-n),e.lineTo(fA*n,-n),e.closePath()}};var OZ=ne(3),_m={draw(e,t){let n=ne(t)*.6824,r=n/2,i=n*OZ/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ne(3)/2,dA=1/ne(12),BZ=(dA/2+1)*3,Sm={draw(e,t){let n=ne(t/BZ),r=n/2,i=n*dA,o=r,s=n*dA+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(fi*r-di*i,di*r+fi*i),e.lineTo(fi*o-di*s,di*o+fi*s),e.lineTo(fi*a-di*c,di*a+fi*c),e.lineTo(fi*r+di*i,fi*i-di*r),e.lineTo(fi*o+di*s,fi*s-di*o),e.lineTo(fi*a+di*c,fi*c-di*a),e.closePath()}};var df={draw(e,t){let n=ne(t-lf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var J1=[Gs,pm,mm,xm,wm,vm,Sm],hA=[Gs,gm,df,_m,hm,bm,ym];function hi(){}function hf(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 Im(e){this._context=e}Im.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:hf(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:hf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function pA(e){return new Im(e)}function pF(e){this._context=e}pF.prototype={areaStart:hi,areaEnd:hi,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:hf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function mA(e){return new pF(e)}function mF(e){this._context=e}mF.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:hf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yA(e){return new mF(e)}function yF(e,t){this._basis=new Im(e),this._beta=t}yF.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 gA=function e(t){function n(r){return t===1?new Im(r):new yF(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function pf(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 Q1(e,t){this._context=e,this._k=(1-t)/6}Q1.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:pf(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:pf(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 xA=function e(t){function n(r){return new Q1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function K1(e,t){this._context=e,this._k=(1-t)/6}K1.prototype={areaStart:hi,areaEnd:hi,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:pf(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 bA=function e(t){function n(r){return new K1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function tw(e,t){this._context=e,this._k=(1-t)/6}tw.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:pf(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 wA=function e(t){function n(r){return new tw(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Mm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>cA){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>cA){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 gF(e,t){this._context=e,this._alpha=t}gF.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:Mm(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 vA=function e(t){function n(r){return t?new gF(r,t):new Q1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function xF(e,t){this._context=e,this._alpha=t}xF.prototype={areaStart:hi,areaEnd:hi,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:Mm(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 _A=function e(t){function n(r){return t?new xF(r,t):new K1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function bF(e,t){this._context=e,this._alpha=t}bF.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:Mm(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 SA=function e(t){function n(r){return t?new bF(r,t):new tw(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function wF(e){this._context=e}wF.prototype={areaStart:hi,areaEnd:hi,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 IA(e){return new wF(e)}function vF(e){return e<0?-1:1}function _F(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(vF(o)+vF(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function SF(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function MA(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 ew(e){this._context=e}ew.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:MA(this,this._t0,SF(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,MA(this,SF(this,n=_F(this,e,t)),n);break;default:MA(this,this._t0,n=_F(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function IF(e){this._context=new MF(e)}(IF.prototype=Object.create(ew.prototype)).point=function(e,t){ew.prototype.point.call(this,t,e)};function MF(e){this._context=e}MF.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 AA(e){return new ew(e)}function TA(e){return new IF(e)}function TF(e){this._context=e}TF.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=AF(e),i=AF(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 AF(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 EA(e){return new TF(e)}function nw(e,t){this._context=e,this._t=t}nw.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 NA(e){return new nw(e,.5)}function DA(e){return new nw(e,0)}function OA(e){return new nw(e,1)}var Am=e=>()=>e;function BA(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 Tm=new jr(1,0,0);LA.prototype=jr.prototype;function LA(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Tm;return e.__zoom}function rw(e){e.stopImmediatePropagation()}function mf(e){e.preventDefault(),e.stopImmediatePropagation()}function LZ(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function CZ(){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 EF(){return this.__zoom||Tm}function kZ(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function FZ(){return navigator.maxTouchPoints||"ontouchstart"in this}function RZ(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 CA(){var e=LZ,t=CZ,n=RZ,r=kZ,i=FZ,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=cI,l=Gc("start","zoom","end"),u,f,d,h=500,p=150,m=0,g=10;function y(S){S.property("__zoom",EF).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,M,E,F){var R=S.selection?S.selection():S;R.property("__zoom",EF),S!==R?_(S,M,E,F):R.interrupt().each(function(){v(this,arguments).event(F).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},y.scaleBy=function(S,M,E,F){y.scaleTo(S,function(){var R=this.__zoom.k,k=typeof M=="function"?M.apply(this,arguments):M;return R*k},E,F)},y.scaleTo=function(S,M,E,F){y.transform(S,function(){var R=t.apply(this,arguments),k=this.__zoom,$=E==null?w(R):typeof E=="function"?E.apply(this,arguments):E,P=k.invert($),U=typeof M=="function"?M.apply(this,arguments):M;return n(b(x(k,U),$,P),R,s)},E,F)},y.translateBy=function(S,M,E,F){y.transform(S,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,F)},y.translateTo=function(S,M,E,F,R){y.transform(S,function(){var k=t.apply(this,arguments),$=this.__zoom,P=F==null?w(k):typeof F=="function"?F.apply(this,arguments):F;return n(Tm.translate(P[0],P[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof E=="function"?-E.apply(this,arguments):-E),k,s)},F,R)};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,E){var F=M[0]-E[0]*S.k,R=M[1]-E[1]*S.k;return F===S.x&&R===S.y?S:new jr(S.k,F,R)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,M,E,F){S.on("start.zoom",function(){v(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(F).end()}).tween("zoom",function(){var R=this,k=arguments,$=v(R,k).event(F),P=t.apply(R,k),U=E==null?w(P):typeof E=="function"?E.apply(R,k):E,W=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),tt=R.__zoom,nt=typeof M=="function"?M.apply(R,k):M,at=c(tt.invert(U).concat(W/tt.k),nt.invert(U).concat(W/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=at(Y),j=W/rt[2];Y=new jr(j,U[0]-rt[0]*j,U[1]-rt[1]*j)}$.zoom(null,Y)}})}function v(S,M,E){return!E&&S.__zooming||new I(S,M)}function I(S,M){this.that=S,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,M),this.taps=0}I.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=Vt(this.that).datum();l.call(S,this.that,new BA(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function N(S,...M){if(!e.apply(this,arguments))return;var E=v(this,M).event(S),F=this.__zoom,R=Math.max(o[0],Math.min(o[1],F.k*Math.pow(2,r.apply(this,arguments)))),k=kn(S);if(E.wheel)(E.mouse[0][0]!==k[0]||E.mouse[0][1]!==k[1])&&(E.mouse[1]=F.invert(E.mouse[0]=k)),clearTimeout(E.wheel);else{if(F.k===R)return;E.mouse=[k,F.invert(k)],go(this),E.start()}mf(S),E.wheel=setTimeout($,p),E.zoom("mouse",n(b(x(F,R),E.mouse[0],E.mouse[1]),E.extent,s));function $(){E.wheel=null,E.end()}}function A(S,...M){if(d||!e.apply(this,arguments))return;var E=S.currentTarget,F=v(this,M,!0).event(S),R=Vt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",W,!0),k=kn(S,E),$=S.clientX,P=S.clientY;rp(S.view),rw(S),F.mouse=[k,this.__zoom.invert(k)],go(this),F.start();function U(tt){if(mf(tt),!F.moved){var nt=tt.clientX-$,at=tt.clientY-P;F.moved=nt*nt+at*at>m}F.event(tt).zoom("mouse",n(b(F.that.__zoom,F.mouse[0]=kn(tt,E),F.mouse[1]),F.extent,s))}function W(tt){R.on("mousemove.zoom mouseup.zoom",null),ip(tt.view,F.moved),mf(tt),F.event(tt).end()}}function D(S,...M){if(e.apply(this,arguments)){var E=this.__zoom,F=kn(S.changedTouches?S.changedTouches[0]:S,this),R=E.invert(F),k=E.k*(S.shiftKey?.5:2),$=n(b(x(E,k),F,R),t.apply(this,M),s);mf(S),a>0?Vt(this).transition().duration(a).call(_,$,F,S):Vt(this).call(y.transform,$,F,S)}}function T(S,...M){if(e.apply(this,arguments)){var E=S.touches,F=E.length,R=v(this,M,S.changedTouches.length===F).event(S),k,$,P,U;for(rw(S),$=0;$<F;++$)P=E[$],U=kn(P,this),U=[U,this.__zoom.invert(U),P.identifier],R.touch0?!R.touch1&&R.touch0[2]!==U[2]&&(R.touch1=U,R.taps=0):(R.touch0=U,k=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(R.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),go(this),R.start())}}function O(S,...M){if(this.__zooming){var E=v(this,M).event(S),F=S.changedTouches,R=F.length,k,$,P,U;for(mf(S),k=0;k<R;++k)$=F[k],P=kn($,this),E.touch0&&E.touch0[2]===$.identifier?E.touch0[0]=P:E.touch1&&E.touch1[2]===$.identifier&&(E.touch1[0]=P);if($=E.that.__zoom,E.touch1){var W=E.touch0[0],tt=E.touch0[1],nt=E.touch1[0],at=E.touch1[1],Y=(Y=nt[0]-W[0])*Y+(Y=nt[1]-W[1])*Y,rt=(rt=at[0]-tt[0])*rt+(rt=at[1]-tt[1])*rt;$=x($,Math.sqrt(Y/rt)),P=[(W[0]+nt[0])/2,(W[1]+nt[1])/2],U=[(tt[0]+at[0])/2,(tt[1]+at[1])/2]}else if(E.touch0)P=E.touch0[0],U=E.touch0[1];else return;E.zoom("touch",n(b($,P,U),E.extent,s))}}function C(S,...M){if(this.__zooming){var E=v(this,M).event(S),F=S.changedTouches,R=F.length,k,$;for(rw(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),k=0;k<R;++k)$=F[k],E.touch0&&E.touch0[2]===$.identifier?delete E.touch0:E.touch1&&E.touch1[2]===$.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&($=kn($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<g)){var P=Vt(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Am(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Am(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Am(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Am([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.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],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(a=+S,y):a},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=l.on.apply(l,arguments);return S===l?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(g=+S,y):g},y}function ze(e){return e!=null&&!Number.isNaN(e)}function dn(e,t){return+ze(t)-+ze(e)||zt(e,t)}function bl(e,t){return+ze(t)-+ze(e)||Hn(e,t)}function Em(e){return e!=null&&`${e}`!=""}function yf(e){return isFinite(e)?e:NaN}function sr(e){return e>0&&isFinite(e)?e:NaN}function Va(e){return e<0&&isFinite(e)?e:NaN}function gf(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`${$Z(e.getUTCFullYear(),4)}-${Ws(e.getUTCMonth()+1,2)}-${Ws(e.getUTCDate(),2)}${n||r||i||o?`T${Ws(n,2)}:${Ws(r,2)}${i||o?`:${Ws(i,2)}${o?`.${Ws(o,3)}`:""}`:""}Z`:""}`}function $Z(e){return e<0?`-${Ws(-e,6)}`:e>9999?`+${Ws(e,6)}`:Ws(e,4)}function Ws(e,t){return`${e}`.padStart(t,"0")}var PZ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function wl(e,t){return PZ.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var bf=1e3,Xa=bf*60,Ga=Xa*60,Bo=Ga*24,Oo=Bo*7,vl=Bo*30,Ya=Bo*365,kA=[["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",bf],["5 seconds",5*bf],["15 seconds",15*bf],["30 seconds",30*bf],["minute",Xa],["5 minutes",5*Xa],["15 minutes",15*Xa],["30 minutes",30*Xa],["hour",Ga],["3 hours",3*Ga],["6 hours",6*Ga],["12 hours",12*Ga],["day",Bo],["2 days",2*Bo],["week",Oo],["2 weeks",2*Oo],["month",vl],["3 months",3*vl],["6 months",6*vl],["year",Ya],["2 years",2*Ya],["5 years",5*Ya],["10 years",10*Ya],["20 years",20*Ya],["50 years",50*Ya],["100 years",100*Ya]],FA=new Map([["second",bf],["minute",Xa],["hour",Ga],["day",Bo],["monday",Oo],["tuesday",Oo],["wednesday",Oo],["thursday",Oo],["friday",Oo],["saturday",Oo],["sunday",Oo],["week",Oo],["month",vl],["year",Ya]]),DF=new Map([["second",un],["minute",Us],["hour",js],["day",ui],["monday",ja],["tuesday",vb],["wednesday",_b],["thursday",Eo],["friday",Sb],["saturday",Ib],["sunday",Ur],["week",Ur],["month",Vs],["year",zn]]),RA=new Map([["second",un],["minute",zs],["hour",qs],["day",ml],["monday",qa],["tuesday",Mb],["wednesday",Ab],["thursday",No],["friday",Tb],["saturday",Eb],["sunday",zr],["week",zr],["month",Ys],["year",jn]]),wf=Symbol("intervalDuration"),ow=Symbol("intervalType");for(let[e,t]of DF)t[wf]=FA.get(e),t[ow]="time";for(let[e,t]of RA)t[wf]=FA.get(e),t[ow]="utc";var Nm=[["year",jn,"utc"],["month",Ys,"utc"],["day",ml,"utc",6*vl],["hour",qs,"utc",3*Bo],["minute",zs,"utc",6*Ga],["second",un,"utc",30*Xa]],iw=[["year",zn,"time"],["month",Vs,"time"],["day",ui,"time",6*vl],["hour",js,"time",3*Bo],["minute",Us,"time",6*Ga],["second",un,"time",30*Xa]],UZ=[Nm[0],iw[0],Nm[1],iw[1],Nm[2],iw[2],...Nm.slice(3)];function sw(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=RA.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 $A(e){return OF(sw(e),"time")}function Dm(e){return OF(sw(e),"utc")}function OF([e,t],n){let r=(n==="time"?DF:RA).get(e);return t>1&&(r=r.every(t),r[wf]=FA.get(e)*t,r[ow]=n),r}function PA(e,t){if(!(t>1))return;let n=e[wf];if(!kA.some(([,i])=>i===n)||n%Bo===0&&Bo<n&&n<vl)return;let[r]=kA[As(([,i])=>Math.log(i)).center(kA,Math.log(n*t))];return(e[ow]==="time"?$A:Dm)(r)}function NF(e,t,n){let r=t==="time"?sf:Do;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=zZ(n);switch(e){case"millisecond":return xf(r(".%L"),r(":%M:%S"),i);case"second":return xf(r(":%S"),r("%-I:%M"),i);case"minute":return xf(r("%-I:%M"),r("%p"),i);case"hour":return xf(r("%-I %p"),r("%b %-d"),i);case"day":return xf(r("%-d"),r("%b"),i);case"month":return xf(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function zZ(e){return e==="left"||e==="right"?(t,n)=>`
10
+ ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new ke(n,i)))}slice(t,n){let r=this.schema;[t,n]=th({length:this.numRows},t,n);let i=Jg(this.data,this._offsets,t,n);return new e(r,i.map(o=>new ke(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=Nt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Xt(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 Xt([Nt({type:new Xn,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]=M0(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(...M0(o,s))}};QO=Symbol.toStringTag;pr[QO]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=su(rh),e.get=su(Ye.getVisitFn(B.Struct)),e.set=Qg(wn.getVisitFn(B.Struct)),e.indexOf=Kg(Mc.getVisitFn(B.Struct)),"Table"))(pr.prototype);var tB,ke=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof oe))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Nt({nullCount:0,type:new be(this.schema.fields),children:this.schema.fields.map(n=>Nt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof te))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=KO(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]=Ut.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new oe(r),a=Nt({type:new be(r),length:o,children:i,nullCount:0});[this.schema,this.data]=KO(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=eB(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 Ye.visit(this.data,t)}set(t,n){return wn.visit(this.data,t,n)}indexOf(t,n){return Mc.visit(this.data,t,n)}[Symbol.iterator](){return au.visit(new Xt([this.data]))}toArray(){return[...this]}concat(...t){return new pr(this.schema,[this,...t])}slice(t,n){let[r]=new Xt([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 Xt([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 Xt([Nt({type:new Xn,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 oe(o,new Map(this.schema.metadata)),i=Nt({type:new be(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new be(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,Nt({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=Nt({type:new be(n.fields),length:this.numRows,children:r});return new e(n,i)}};tB=Symbol.toStringTag;ke[tB]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function KO(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:Nt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Nt({type:new be(i),length:n,children:o})]}function eB(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)||[]])eB(a.children,l?.children,n);if(st.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 Cc=class extends ke{constructor(t){let n=t.fields.map(i=>Nt({type:i.type})),r=Nt({type:new be(t.fields),nullCount:0,children:n});super(t,r)}};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 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):ce.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):qt.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 rn).__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,ce.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,qt.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 d2=class extends mt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Wd.startNull(n),Wd.endNull(n)}visitInt(t,n){return Si.startInt(n),Si.addBitWidth(n,t.bitWidth),Si.addIsSigned(n,t.isSigned),Si.endInt(n)}visitFloat(t,n){return ga.startFloatingPoint(n),ga.addPrecision(n,t.precision),ga.endFloatingPoint(n)}visitBinary(t,n){return jd.startBinary(n),jd.endBinary(n)}visitLargeBinary(t,n){return Yd.startLargeBinary(n),Yd.endLargeBinary(n)}visitBool(t,n){return Vd.startBool(n),Vd.endBool(n)}visitUtf8(t,n){return Zd.startUtf8(n),Zd.endUtf8(n)}visitLargeUtf8(t,n){return Xd.startLargeUtf8(n),Xd.endLargeUtf8(n)}visitDecimal(t,n){return to.startDecimal(n),to.addScale(n,t.scale),to.addPrecision(n,t.precision),to.addBitWidth(n,t.bitWidth),to.endDecimal(n)}visitDate(t,n){return ha.startDate(n),ha.addUnit(n,t.unit),ha.endDate(n)}visitTime(t,n){return Ho.startTime(n),Ho.addUnit(n,t.unit),Ho.addBitWidth(n,t.bitWidth),Ho.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return Zo.startTimestamp(n),Zo.addUnit(n,t.unit),r!==void 0&&Zo.addTimezone(n,r),Zo.endTimestamp(n)}visitInterval(t,n){return xa.startInterval(n),xa.addUnit(n,t.unit),xa.endInterval(n)}visitDuration(t,n){return pa.startDuration(n),pa.addUnit(n,t.unit),pa.endDuration(n)}visitList(t,n){return Gd.startList(n),Gd.endList(n)}visitStruct(t,n){return Hd.startStruct_(n),Hd.endStruct_(n)}visitUnion(t,n){Ii.startTypeIdsVector(n,t.typeIds.length);let r=Ii.createTypeIdsVector(n,t.typeIds);return Ii.startUnion(n),Ii.addMode(n,t.mode),Ii.addTypeIds(n,r),Ii.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return Ki.startDictionaryEncoding(n),Ki.addId(n,BigInt(t.id)),Ki.addIsOrdered(n,t.isOrdered),r!==void 0&&Ki.addIndexType(n,r),Ki.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return ma.startFixedSizeBinary(n),ma.addByteWidth(n,t.byteWidth),ma.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return ya.startFixedSizeList(n),ya.addListSize(n,t.listSize),ya.endFixedSizeList(n)}visitMap(t,n){return ba.startMap(n),ba.addKeysSorted(n,t.keysSorted),ba.endMap(n)}},A0=new d2;function oB(e,t=new Map){return new oe(sj(e,t),T0(e.metadata),t)}function h2(e){return new vn(e.count,aB(e.columns),cB(e.columns))}function sB(e){return new yr(h2(e.data),e.id,e.isDelta)}function sj(e,t){return(e.fields||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function nB(e,t){return(e.children||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function aB(e){return(e||[]).reduce((t,n)=>[...t,new Kr(n.count,aj(n.VALIDITY)),...aB(n.children)],[])}function cB(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new mr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new mr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new mr(t.length,i.OFFSET.length)),i.DATA&&t.push(new mr(t.length,i.DATA.length)),t=cB(i.children,t)}return t}function aj(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function lB(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=iB(e,nB(e,t)),i=new Ut(e.name,s,e.nullable,T0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?rB(r):new eo,a=new Dr(t.get(n),r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,T0(e.metadata))):(r=(r=o.indexType)?rB(r):new eo,t.set(n,s=iB(e,nB(e,t))),a=new Dr(s,r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,T0(e.metadata))),i||null}function T0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function rB(e){return new Pe(e.isSigned,e.bitWidth)}function iB(e,t){let n=e.type.name;switch(n){case"NONE":return new Xn;case"null":return new Xn;case"binary":return new Jo;case"largebinary":return new Qo;case"utf8":return new Ko;case"largeutf8":return new ts;case"bool":return new es;case"list":return new Ni((t||[])[0]);case"struct":return new be(t||[]);case"struct_":return new be(t||[])}switch(n){case"int":{let r=e.type;return new Pe(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new dr(he[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 rs(Ve[r.unit])}case"time":{let r=e.type;return new Ei(ct[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new is(ct[r.unit],r.timezone)}case"interval":{let r=e.type;return new os(an[r.unit])}case"duration":{let r=e.type;return new ss(ct[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Di(ge[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new as(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Oi(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Bi((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var cj=vc,lj=Er,gr=class e{static fromJSON(t,n){let r=new e(0,ce.V5,n);return r._createHeader=uj(t,n),r}static decode(t){t=new lj(_t(t));let n=ki.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=fj(n,o),s}static encode(t){let n=new cj,r=-1;return t.isSchema()?r=oe.encode(n,t.header()):t.isRecordBatch()?r=vn.encode(n,t.header()):t.isDictionaryBatch()&&(r=yr.encode(n,t.header())),ki.startMessage(n),ki.addVersion(n,ce.V5),ki.addHeader(n,r),ki.addHeaderType(n,t.headerType),ki.addBodyLength(n,BigInt(t.bodyLength)),ki.finishMessageBuffer(n,ki.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof oe)return new e(0,ce.V5,qt.Schema,t);if(t instanceof vn)return new e(n,ce.V5,qt.RecordBatch,t);if(t instanceof yr)return new e(n,ce.V5,qt.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===qt.Schema}isRecordBatch(){return this.headerType===qt.RecordBatch}isDictionaryBatch(){return this.headerType===qt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=De(t)}},vn=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=De(t)}},yr=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=De(n)}},mr=class{constructor(t,n){this.offset=De(t),this.length=De(n)}},Kr=class{constructor(t,n){this.length=De(t),this.nullCount=De(n)}};function uj(e,t){return()=>{switch(t){case qt.Schema:return oe.fromJSON(e);case qt.RecordBatch:return vn.fromJSON(e);case qt.DictionaryBatch:return yr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${qt[t]}, type: ${t} }`)}}function fj(e,t){return()=>{switch(t){case qt.Schema:return oe.decode(e.header(new fr),new Map,e.version());case qt.RecordBatch:return vn.decode(e.header(new Nr),e.version());case qt.DictionaryBatch:return yr.decode(e.header(new Wo),e.version())}throw new Error(`Unrecognized Message type: { name: ${qt[t]}, type: ${t} }`)}}Ut.encode=_j;Ut.decode=wj;Ut.fromJSON=lB;oe.encode=vj;oe.decode=dj;oe.fromJSON=oB;vn.encode=Sj;vn.decode=hj;vn.fromJSON=h2;yr.encode=Ij;yr.decode=pj;yr.fromJSON=sB;Kr.encode=Mj;Kr.decode=yj;mr.encode=Aj;mr.decode=mj;function dj(e,t=new Map,n=ce.V5){let r=bj(e,t);return new oe(r,E0(e),t,n)}function hj(e,t=ce.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new vn(e.length(),gj(e),xj(e,t))}function pj(e,t=ce.V5){return new yr(vn.decode(e.data(),t),e.id(),e.isDelta())}function mj(e){return new mr(e.offset(),e.length())}function yj(e){return new Kr(e.length(),e.nullCount())}function gj(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Kr.decode(n));return t}function xj(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<ce.V4&&(r.bb_pos+=8*(i+1)),n[++o]=mr.decode(r));return n}function bj(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Ut.decode(r,t));return n}function uB(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Ut.decode(r,t));return n}function wj(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=dB(e,uB(e,t)),r=new Ut(e.name(),i,e.nullable(),E0(e))):t.has(n=De(a.id()))?(o=(o=a.indexType())?fB(o):new eo,s=new Dr(t.get(n),o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),E0(e))):(o=(o=a.indexType())?fB(o):new eo,t.set(n,i=dB(e,uB(e,t))),s=new Dr(i,o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),E0(e))),r||null}function E0(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 fB(e){return new Pe(e.isSigned(),e.bitWidth())}function dB(e,t){let n=e.typeType();switch(n){case pe.NONE:return new Xn;case pe.Null:return new Xn;case pe.Binary:return new Jo;case pe.LargeBinary:return new Qo;case pe.Utf8:return new Ko;case pe.LargeUtf8:return new ts;case pe.Bool:return new es;case pe.List:return new Ni((t||[])[0]);case pe.Struct_:return new be(t||[])}switch(n){case pe.Int:{let r=e.type(new Si);return new Pe(r.isSigned(),r.bitWidth())}case pe.FloatingPoint:{let r=e.type(new ga);return new dr(r.precision())}case pe.Decimal:{let r=e.type(new to);return new ns(r.scale(),r.precision(),r.bitWidth())}case pe.Date:{let r=e.type(new ha);return new rs(r.unit())}case pe.Time:{let r=e.type(new Ho);return new Ei(r.unit(),r.bitWidth())}case pe.Timestamp:{let r=e.type(new Zo);return new is(r.unit(),r.timezone())}case pe.Interval:{let r=e.type(new xa);return new os(r.unit())}case pe.Duration:{let r=e.type(new pa);return new ss(r.unit())}case pe.Union:{let r=e.type(new Ii);return new Di(r.mode(),r.typeIdsArray()||[],t||[])}case pe.FixedSizeBinary:{let r=e.type(new ma);return new as(r.byteWidth())}case pe.FixedSizeList:{let r=e.type(new ya);return new Oi(r.listSize(),(t||[])[0])}case pe.Map:{let r=e.type(new ba);return new Bi((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${pe[n]}" (${n})`)}function vj(e,t){let n=t.fields.map(o=>Ut.encode(e,o));fr.startFieldsVector(e,n.length);let r=fr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?fr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return rn.startKeyValue(e),rn.addKey(e,a),rn.addValue(e,c),rn.endKeyValue(e)})):-1;return fr.startSchema(e),fr.addFields(e,r),fr.addEndianness(e,Tj?da.Little:da.Big),i!==-1&&fr.addCustomMetadata(e,i),fr.endSchema(e)}function _j(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;st.isDictionary(o)?(s=o.dictionary.typeId,i=A0.visit(o,e),r=A0.visit(o.dictionary,e)):r=A0.visit(o,e);let a=(o.children||[]).map(u=>Ut.encode(e,u)),c=Cn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Cn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return rn.startKeyValue(e),rn.addKey(e,d),rn.addValue(e,h),rn.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Cn.startField(e),Cn.addType(e,r),Cn.addTypeType(e,s),Cn.addChildren(e,c),Cn.addNullable(e,!!t.nullable),n!==-1&&Cn.addName(e,n),i!==-1&&Cn.addDictionary(e,i),l!==-1&&Cn.addCustomMetadata(e,l),Cn.endField(e)}function Sj(e,t){let n=t.nodes||[],r=t.buffers||[];Nr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Kr.encode(e,s);let i=e.endVector();Nr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())mr.encode(e,s);let o=e.endVector();return Nr.startRecordBatch(e),Nr.addLength(e,BigInt(t.length)),Nr.addNodes(e,i),Nr.addBuffers(e,o),Nr.endRecordBatch(e)}function Ij(e,t){let n=vn.encode(e,t.data);return Wo.startDictionaryBatch(e),Wo.addId(e,BigInt(t.id)),Wo.addIsDelta(e,t.isDelta),Wo.addData(e,n),Wo.endDictionaryBatch(e)}function Mj(e,t){return Ql.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Aj(e,t){return Jl.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Tj=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var m2=e=>`Expected ${qt[e]} Message in stream, but was null or length 0.`,y2=e=>`Header pointer of flatbuffer-encoded ${qt[e]} Message is null or length 0.`,hB=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,pB=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,mu=class{constructor(t){this.source=t instanceof io?t:new io(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?we:t.value===-1&&(t=this.readMetadataLength()).done?we:(t=this.readMetadata(t.value)).done?we: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(m2(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=_t(this.source.read(t));if(n.byteLength<t)throw new Error(pB(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=qt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(y2(n));return i}readMetadataLength(){let t=this.source.read(N0),n=t&&new Er(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return we;if(n.byteLength<t)throw new Error(hB(t,n.byteLength));return{done:!1,value:gr.decode(n)}}},Bh=class{constructor(t,n){this.source=t instanceof Jr?t:cg(t)?new Sa(t,n):new Jr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?we:t.value===-1&&(t=yield this.readMetadataLength()).done?we:(t=yield this.readMetadata(t.value)).done?we: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(m2(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=_t(yield this.source.read(t));if(n.byteLength<t)throw new Error(pB(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=qt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(y2(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(N0),n=t&&new Er(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 we;if(n.byteLength<t)throw new Error(hB(t,n.byteLength));return{done:!1,value:gr.decode(n)}})}},Lh=class extends mu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ih?t:new ih(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gr.fromJSON(t.schema,qt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:gr.fromJSON(n,qt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:gr.fromJSON(n,qt.RecordBatch)}}return this._body=[],we}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(m2(t));return n.value}readSchema(){let t=qt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(y2(t));return r}},N0=4,p2="ARROW1",yu=new Uint8Array(p2.length);for(let e=0;e<p2.length;e+=1)yu[e]=p2.codePointAt(e);function D0(e,t=0){for(let n=-1,r=yu.length;++n<r;)if(yu[n]!==e[t+n])return!1;return!0}var gu=yu.length,g2=gu+N0,mB=gu*2+N0;var Lr=class e extends Tc{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 Ar(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 bn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bn.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:sg(t)?Nj(t):cg(t)?Bj(t):Ar(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):lg(t)||Rd(t)||fg(t)||Wr(t)?Oj(new Jr(t)):Dj(new io(t))}static readAll(t){return t instanceof e?t.isSync()?yB(t):gB(t):sg(t)||ArrayBuffer.isView(t)||wi(t)||ag(t)?yB(t):gB(t)}},xs=class extends Lr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Mr(this,arguments,function*(){yield Ft(yield*Hl(bi(this[Symbol.iterator]())))})}},kc=class extends Lr{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]()}},Fc=class extends xs{constructor(t){super(t),this._impl=t}},O0=class extends kc{constructor(t){super(t),this._impl=t}},B0=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=Nt({type:new be(this.schema.fields),length:t.length,children:r});return new ke(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 Xt(l)):new Xt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new ch(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},xu=class extends B0{constructor(t,n){super(n),this._reader=sg(t)?new Lh(this._handle=t):new mu(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=xB(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):we}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):we}next(){if(this.closed)return we;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 Cc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},bu=class extends B0{constructor(t,n){super(n),this._reader=new Bh(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=xB(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):we})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):we})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return we;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 Cc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},L0=class extends xu{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 oh?t:new oh(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(qt.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(qt.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-g2,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}},x2=class extends bu{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 Sa?t:new Sa(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(qt.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(qt.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-g2,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})}},b2=class extends xu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new r0(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function xB(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*yB(e){let t=Lr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function gB(e){return Mr(this,arguments,function*(){let n=yield Ft(Lr.from(e));try{if(!(yield Ft(n.open({autoDestroy:!1}))).closed)do yield yield Ft(n);while(!(yield Ft(n.reset().open())).closed)}finally{yield Ft(n.cancel())}})}function Nj(e){return new xs(new b2(e))}function Dj(e){let t=e.peek(gu+7&-8);return t&&t.byteLength>=4?D0(t)?new Fc(new L0(e.read())):new xs(new xu(e)):new xs(new xu(function*(){}()))}function Oj(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(gu+7&-8);return t&&t.byteLength>=4?D0(t)?new Fc(new L0(yield e.read())):new kc(new bu(e)):new kc(new bu(function(){return Mr(this,arguments,function*(){})}()))})}function Bj(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Sa(e,t);return t>=mB&&D0(yield n.readAt(0,gu+7&-8))?new O0(new x2(n)):new kc(new bu(n))})}var Me=class e extends mt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof ke?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 Xt)return this.visitMany(t.data),this;let{type:n}=t;if(!st.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(st.isUnion(n))this.nodes.push(new Kr(r,0));else{let{nullCount:i}=t;st.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):Sc(t.offset,r,t.nullBitmap)),this.nodes.push(new Kr(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 Fi(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new mr(this._byteLength,t)),this._byteLength+=t,this}function Lj(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===ge.Sparse)return w2.call(this,e);if(n.mode===ge.Dense){if(e.offset<=0)return Fi.call(this,o),w2.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);Fi.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 Cj(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,Sc(e.offset,e.length,t)):Fi.call(this,Ic(e.values))}function bs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function C0(e){let{length:t,values:n,valueOffsets:r}=e,i=De(r[0]),o=De(r[t]),s=Math.min(o-i,n.byteLength-i);return Fi.call(this,hg(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function v2(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,hg(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function w2(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Me.prototype.visitBool=Cj;Me.prototype.visitInt=bs;Me.prototype.visitFloat=bs;Me.prototype.visitUtf8=C0;Me.prototype.visitLargeUtf8=C0;Me.prototype.visitBinary=C0;Me.prototype.visitLargeBinary=C0;Me.prototype.visitFixedSizeBinary=bs;Me.prototype.visitDate=bs;Me.prototype.visitTimestamp=bs;Me.prototype.visitTime=bs;Me.prototype.visitDecimal=bs;Me.prototype.visitList=v2;Me.prototype.visitStruct=w2;Me.prototype.visitUnion=Lj;Me.prototype.visitInterval=bs;Me.prototype.visitDuration=bs;Me.prototype.visitFixedSizeList=v2;Me.prototype.visitMap=v2;var Rc=class extends Tc{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 ro,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Yn(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 Ar(t)?t.then(n=>this.writeAll(n)):Wr(t)?S2(this,t):_2(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 ro?this._sink=t:(this._sink=new ro,t&&BD(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&LD(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||!Lc(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 pr&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof ke&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Lc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Cc||this._writeRecordBatch(t):t instanceof pr?this.writeAll(t.batches):wi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=gr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===qt.RecordBatch?this._recordBatchBlocks.push(new fs(a,t.bodyLength,this._position)):t.headerType===qt.DictionaryBatch&&this._dictionaryBlocks.push(new fs(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=_t(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(gr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(yu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Me.assemble(t),s=new vn(t.numRows,r,i),a=gr.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}=Me.assemble(new Xt([t])),c=new vn(t.length,o,s),l=new yr(c,n,r),u=gr.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}},Ch=class e extends Rc{static writeAll(t,n){let r=new e(n);return Ar(t)?t.then(i=>r.writeAll(i)):Wr(t)?S2(r,t):_2(r,t)}},kh=class e extends Rc{static writeAll(t){let n=new e;return Ar(t)?t.then(r=>n.writeAll(r)):Wr(t)?S2(n,t):_2(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=us.encode(new us(t,ce.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function _2(e,t){let n=t;t instanceof pr&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function S2(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 bB(e,t){if(Wr(e))return Fj(e,t);if(wi(e))return kj(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function kj(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=_t(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 Fj(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=_t(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 _B(e){return new I2(e)}var I2=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=DD(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Nc(o),this._getSize=i!=="bytes"?wB:vB;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"?wB:vB}),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)}},wB=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},vB=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function k0(e,t){let n=new ro,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 Lr.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 F0(e,t){let n=new this(e),r=new Jr(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 Fh(e){let t=Lr.from(e);return Ar(t)?t.then(n=>Fh(n)):t.isAsync()?t.readAll().then(n=>new pr(n)):new pr(t.readAll())}var $j=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k_),a2),Q_),F_),D_),J_),L_),{compareSchemas:Lc,compareFields:ZO,compareTypes:JO});bn.toDOMStream=bB;ve.throughDOM=_B;Lr.throughDOM=k0;Fc.throughDOM=k0;xs.throughDOM=k0;Rc.throughDOM=F0;kh.throughDOM=F0;Ch.throughDOM=F0;function R0(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(Fh(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);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 xr=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?`${SB(t)}.`:""}${r}`}else return t?SB(t):"NULL"}};function SB(e){return e.split(".").map(n=>`"${n}"`).join(".")}function IB(e,t){return e instanceof xr&&e.column===t}function jt(e){return typeof e=="string"?Ia(e):e}function $c(e){return typeof e=="string"?MB(e):e}function MB(e){return new xr(e)}function Ia(e,t){return arguments.length===1&&(t=e,e=null),new xr(e,t)}function so(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;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 ws=e=>typeof e?.addEventListener=="function";function $0(e){return e instanceof Ma}var Ma=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>ws(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>Pj(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=>ws(t)&&!$0(t)?so(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 Pj(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function M2(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];ws(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:so(a));let c=e[++o];ws(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=M2(e,t);return new Ma(n,r)}function A2(e){let t=jt(e);return q`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Cr=e=>({value:e,toString:()=>so(e)});function Rh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function AB(e,t){let n=t.filter(i=>i!=null).map(jt),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 Wn=(...e)=>AB("AND",e.flat()),Pc=(...e)=>AB("OR",e.flat()),Uj=e=>t=>q`(${e} ${jt(t)})`.annotate({op:e,a:t,visit:Rh}),T2=Uj("NOT"),TB=e=>t=>q`(${jt(t)} ${e})`.annotate({op:e,a:t,visit:Rh}),Uc=TB("IS NULL"),vs=TB("IS NOT NULL"),Aa=e=>(t,n)=>q`(${jt(t)} ${e} ${jt(n)})`.annotate({op:e,a:t,b:n,visit:Rh}),_s=Aa("="),zc=Aa("<>"),Ss=Aa("<"),$h=Aa(">"),Is=Aa("<="),E2=Aa(">="),N2=Aa("IS DISTINCT FROM"),Ph=Aa("IS NOT DISTINCT FROM");function EB(e,t,n,r){t=jt(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 Ae=(e,t,n)=>EB("BETWEEN",e,t,n),D2=(e,t,n)=>EB("NOT BETWEEN",e,t,n);function qc(e,t){return Array.from({length:e},()=>t)}function _n(e,t){return(...n)=>{let r=n.map(jt),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...qc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var O2=_n("REGEXP_MATCHES"),B2=_n("CONTAINS"),L2=_n("PREFIX"),C2=_n("SUFFIX"),zj=_n("LOWER"),qj=_n("UPPER"),jj=_n("LENGTH"),Vj=_n("ISNAN"),Yj=_n("ISFINITE"),Xj=_n("ISINF");var Uh=class e extends Ma{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,{window:t,func:n,type:r,name:i,group:o,order:s,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(jt),r=q(["PARTITION BY ",qc(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(jt),r=q(["ORDER BY ",qc(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=NB("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=NB("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 NB(e,t){if(ws(t)){let n=q`${t}`;return n.toString=()=>`${e} ${DB(t.value)}`,n}return`${e} ${DB(t)}`}function DB(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 Ri(e,t){return(...n)=>{let r=_n(e)(...n);return new Uh(e,r,t)}}var k2=Ri("ROW_NUMBER","INTEGER"),F2=Ri("RANK","INTEGER"),R2=Ri("DENSE_RANK","INTEGER"),$2=Ri("PERCENT_RANK"),P2=Ri("CUME_DIST"),U2=Ri("NTILE"),z2=Ri("LAG"),q2=Ri("LEAD"),j2=Ri("FIRST_VALUE"),V2=Ri("LAST_VALUE"),Y2=Ri("NTH_VALUE");function G2(e,...t){return q(e,...t).annotate({aggregate:!0})}var X2=class e extends Ma{constructor(t,n,r,i,o){n=(n||[]).map(jt);let{strings:s,exprs:a}=Gj(t,n,r,i,o),{spans:c,cols:l}=M2(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,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(Wj).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 Uh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function Gj(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...qc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Wj(e){let t=so(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Jt(e,t){return(...n)=>new X2(e,n,t)}var kr=Jt("COUNT","INTEGER"),W2=Jt("AVG"),Hj=Jt("AVG"),H2=Jt("MAD"),ti=Jt("MAX"),ei=Jt("MIN"),Fr=Jt("SUM","DOUBLE"),Z2=Jt("PRODUCT"),J2=Jt("MEDIAN"),Q2=Jt("QUANTILE"),K2=Jt("MODE"),tS=Jt("VARIANCE"),eS=Jt("STDDEV"),nS=Jt("SKEWNESS"),rS=Jt("KURTOSIS"),iS=Jt("ENTROPY"),oS=Jt("VAR_POP"),sS=Jt("STDDEV_POP"),aS=Jt("CORR"),cS=Jt("COVAR_POP"),lS=Jt("REGR_INTERCEPT"),uS=Jt("REGR_SLOPE"),fS=Jt("REGR_COUNT"),Zj=Jt("REGR_R2"),dS=Jt("REGR_SYY"),hS=Jt("REGR_SXX"),Jj=Jt("REGR_SXY"),pS=Jt("REGR_AVGX"),Qj=Jt("REGR_AVGY"),mS=Jt("FIRST"),yS=Jt("LAST"),wu=Jt("ARG_MIN"),vu=Jt("ARG_MAX"),gS=Jt("STRING_AGG"),xS=Jt("ARRAY_AGG");function zh(e,t){let n=jt(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 _u=e=>zh(e,"DOUBLE"),bS=e=>zh(e,"INTEGER");var wS=e=>q`epoch_ms(${jt(e)})`,vS=e=>{let t=jt(e);return q`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},_S=e=>{let t=jt(e);return q`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},SS=e=>{let t=jt(e);return q`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var qh=_n("ST_AsGeoJSON"),OB=_n("ST_X"),BB=_n("ST_Y"),jh=_n("ST_CENTROID"),IS=e=>OB(jh(e)),MS=e=>BB(jh(e));var ht=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 jc("UNION",t.flat())}static unionAll(...t){return new jc("UNION ALL",t.flat())}static intersect(...t){return new jc("INTERSECT",t.flat())}static except(...t){return new jc("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:[]}}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 i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:jt(i)});else if(i instanceof xr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:P0(o),expr:jt(i[o])});return n.select=n.select.concat(r),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:$c(i)});else if(i instanceof xr)r.push({as:i.table,from:i});else if(Vh(i)||$0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:P0(i[0]),from:$c(i[1])});else for(let o in i)r.push({as:P0(o),from:$c(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(jt)),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:P0(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(jt)),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(Vh(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 g=t.map(({as:y,query:x})=>`"${y}" AS (${x})`);p.push(`WITH ${g.join(", ")}`)}let m=n.map(({as:g,expr:y})=>IB(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(p.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),i.length){let g=i.map(({as:y,from:x})=>{let b=Vh(x)?`(${x})`:`${x}`;return!y||y===x.table?b:`${b} AS "${y}"`});p.push(`FROM ${g.join(", ")}`)}if(s.length){let g=s.map(String).filter(y=>y).join(" AND ");g&&p.push(`WHERE ${g}`)}if(o){let{rows:g,perc:y,method:x,seed:b}=o,w=g?`${g} ROWS`:`${y} 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 g=c.map(String).filter(y=>y).join(" AND ");g&&p.push(`HAVING ${g}`)}if(l.length){let g=l.map(({as:y,expr:x})=>`"${y}" AS (${x})`);p.push(`WINDOW ${g.join(", ")}`)}if(u.length){let g=u.map(String).filter(y=>y).join(" AND ");g&&p.push(`QUALIFY ${g}`)}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(" ")}},jc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}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(jt)),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 Vh(e){return e instanceof ht||e instanceof jc}function AS(e){return Vh(e)&&e.describe}function P0(e){return Kj(e)?e.slice(1,-1):e}function Kj(e){return e[0]==='"'&&e[e.length-1]==='"'}var U0=e=>e;function tV(){return{apply:U0,invert:U0,sqlApply:jt,sqlInvert:U0}}function eV({base:e}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>q`LN(${jt(t)})`,sqlInvert:t=>q`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>q`LOG(${jt(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(${jt(n)}) / LN(${t})`,sqlInvert:n=>q`POW(${t}, ${n})`}}}function nV({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=jt(n),q`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>q`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function rV(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=jt(e),q`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>q`SIGN(${e}) * (${e}) ** 2`}}function iV({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=jt(n),q`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>q`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function LB(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:wS(jt(e)),sqlInvert:U0}}var oV={linear:tV,log:eV,symlog:nV,sqrt:rV,pow:iV,time:LB,utc:LB};function Yh(e){let t=oV[e.type];return t?{...e,...t(e)}:null}function ao(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 Xh(e){return`INSTALL ${e}; LOAD ${e}`}function CB(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=>`${so(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function z0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=sV({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return ao(t,p,{view:a,temp:c,replace:l})}function ES(e,t,n){return z0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function NS(e,t,n){return z0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function DS(e,t,n){return z0("read_parquet",e,t,n)}function OS(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(", ");i.open_options=o.toUpperCase()}return z0("st_read",e,t,i)}function BS(e,t,n={}){let{select:r=["*"],...i}=n,o=CB(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return ao(e,s,i)}function sV(e){return Object.entries(e).map(([t,n])=>`${t}=${TS(n)}`).join(", ")}function TS(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=>TS(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${TS(n)}`).join(", ")+"}";default:return e}}function FB(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=kB(t^o>>8)),t=kB(t^i&255)}return aV(t)}function kB(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function aV(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var q0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,$B),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=cV(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=$B(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let x=Object.values(i.columns).map(b=>b.columns[0]);uV(d,x)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(FB(p)>>>0).toString(16)}`,y=a.exec(ao(g,p,{temp:c}));s.set(l,{table:g,result:y,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=ht.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function cV(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>lV(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Ae("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Wn(l.children.map(({range:u},f)=>Ae(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=c=>c,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function lV(e,t){let{apply:n,sqlApply:r}=Yh(e);if(n){let{domain:i,range:o}=e,s=n(Math.min(...i)),a=n(Math.max(...i)),c=Math.abs(o[1]-o[0])/(a-s)/t,l=t===1?"":`${t}::INTEGER * `;return u=>q`${l}FLOOR(${c}::DOUBLE * (${r(u)} - ${s}::DOUBLE))::INTEGER`}}var RB={from:NaN};function $B(e){if(!e.filterIndexable)return RB;let t=e.query(),n=LS(t);if(!n||!t.groupby)return RB;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:q`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:q`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:q`MAX("${a}")`});break;case"MIN":i.push({[a]:q`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:q`COUNT(*)`}:{},from:n}}function LS(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=LS(t[0]);for(let r=1;r<t.length;++r){let i=LS(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function uV(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 j0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new q0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():fV(t,r,i)}};function fV(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function V0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function dV(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function PB(e,t,n){let r=[],i=0;function o(){let s=hV(r,t);r=[],i=0;for(let a of s)mV(a,e,n),xV(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||dV(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function hV(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=pV(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function pV(e,t){let n=`${e}`;if(e instanceof ht&&!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 xr&&o[s.column]||s))}return`${r}`}else return n}function mV(e,t,n){if(yV(e))t({request:{type:"arrow",cache:!1,record:!1,query:e.query=gV(e,n)},result:e.result=V0()});else for(let{entry:r,priority:i}of e)t(r,i)}function yV(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 gV(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 xr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function xV(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=AS(r);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=n[c],d=s&&f?wV(o,f):f?bV(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function bV(e,t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}function wV(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 vV=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,UB=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function zB({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&&vV(r),o},clear(){n=new Map}}}function qB(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var co={High:0,Normal:1,Low:2};function jB(){let e=qB(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=co.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:m=!1,record:g=!0,options:y}=f,x=h?`${h}`:null;if(g&&l(x),m){let v=n.get(x);if(v){r.debug("Cache"),d.fulfill(v);return}}let b=performance.now(),w=await t.query({type:p,sql:x,...y});m&&n.set(x,w),r.debug(`Request: ${(performance.now()-b).toFixed(1)}`),d.fulfill(w)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?zB():f||UB():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=PB(c,n,l):!f&&s&&(s=null)},request(f,d=co.Normal){let h=V0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function CS(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":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}`)}}function Su(e){return typeof e?.getChild=="function"}function kS(e){switch(e.typeId){case 2:case 3:case 7:return Float64Array;default:return Array}}function Gh(e){let{typeId:t}=e;if(t===10)return n=>n==null?n:new Date(n);if(t===2&&e.bitWidth>=64)return n=>n==null?n:Number(n);if(t===7){let n=1/Math.pow(10,e.scale);return r=>r==null?r:YB(r,n)}return n=>n}function Iu(e){let{type:t}=e,{typeId:n}=t;if(n===10){let r=e.length,i=new Array(r);for(let o=0;o<r;++o){let s=e.get(o);i[o]=s==null?null:new Date(s)}return i}if(n===2&&t.bitWidth>=64){let r=e.length,i=new Float64Array(r);for(let o=0;o<r;++o){let s=e.get(o);i[o]=s==null?NaN:Number(s)}return i}if(n===7){let r=1/Math.pow(10,t.scale),i=e.length,o=new Float64Array(i);for(let s=0;s<i;++s){let a=e.get(s);o[s]=a==null?NaN:YB(a,r)}return o}return e.toArray()}var VB=Array.from({length:8},(e,t)=>Math.pow(2,t*32));function YB(e,t){let n=e.length,r=0;if(e.signed&&(e[n-1]|0)<0){for(let i=0;i<n;++i)r+=~(e[i]|0)*VB[i];r=-(r+1)}else for(let i=0;i<n;++i)r+=e[i]*VB[i];return r*t}var _V="count",SV="nulls",IV="max",MV="min",AV="distinct";var TV={[_V]:kr,[AV]:e=>kr(e).distinct(),[IV]:ti,[MV]:ei,[SV]:e=>kr().where(Uc(e))};function EV(e,t,n){return ht.from(e).select(Array.from(n,r=>[r,TV[r](t)]))}async function XB(e,t){return t.length===1&&`${t[0].column}`=="*"?DV(e,t[0].table):(await Promise.all(t.map(n=>NV(e,n)))).filter(n=>n)}async function NV(e,{table:t,column:n,stats:r}){let i=ht.from({source:t}).select({column:n}).groupby(n.aggregate?q`ALL`:[]),[o]=Array.from(await e.query(ht.describe(i))),s={table:t,column:`${n}`,sqlType:o.column_type,type:CS(o.column_type),nullable:o.null==="YES"};if(!(r?.length||r?.size))return s;let a=await e.query(EV(t,n,r),{persist:!0});for(let c=0;c<a.numCols;++c){let{name:l}=a.schema.fields[c],u=a.getChildAt(c),f=Gh(u.type);s[l]=f(u.get(0))}return s}async function DV(e,t){let n=await e.query(`DESCRIBE ${$c(t)}`);return Array.from(n).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:CS(r.column_type),nullable:r.null==="YES"}))}function GB(){return{debug(){},info(){},log(){},warn(){},error(){}}}var Y0;function ni(e){return e?Y0=e:Y0==null&&(Y0=new Wh),Y0}var Wh=class{constructor(t=R0(),n={}){let{logger:r=console,manager:i=jB()}=n;this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||GB(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0}={}){this.manager.clear(),t&&(this.clients?.forEach(r=>this.disconnect(r)),this.filterGroups?.forEach(r=>r.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=co.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
+ `):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=co.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:co.Low})}createBundle(t,n,r=co.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=co.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=co.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{clients:n,filterGroups:r,indexes:i}=this;if(n.has(t))throw new Error("Client already connected.");n.add(t),t.coordinator=this;let o=t.fields();o?.length&&t.fieldInfo(await XB(this,o));let s=t.filterBy;if(s)if(r.has(s))r.get(s).add(t);else{let a=new j0(this,s,i);r.set(s,a.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var X0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new FS}),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(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}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=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},FS=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 Hh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?OV(e,t):!0}function OV(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 br(e){return e instanceof Ta}var Ta=class e extends X0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>br(n))){let n=new e,r=()=>n.update(t.map(i=>br(i)?i.value:i));return r(),t.forEach(i=>br(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Hh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ri(e){return e instanceof Ms}var Ms=class e extends Ta{static intersect({cross:t=!1}={}){return new e(new Vc({cross:t}))}static union({cross:t=!1}={}){return new e(new Vc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new Vc({cross:t,single:!0}))}static crossfilter(){return new e(new Vc({cross:!0}))}constructor(t=new Vc){super([]),this._resolved=this._value,this._resolver=t}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 active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=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)}},Vc=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}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{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?Pc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function RS(){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}}}var mD={};Ir(mD,{Fixed:()=>lo,Param:()=>Ta,Query:()=>ht,Selection:()=>Ms,agg:()=>G2,align:()=>f6,and:()=>Wn,area:()=>j8,areaX:()=>V8,areaY:()=>Y8,argmax:()=>vu,argmin:()=>wu,arrayAgg:()=>xS,arrow:()=>FN,aspectRatio:()=>d6,avg:()=>W2,axis:()=>h6,axisFx:()=>zN,axisFy:()=>qN,axisX:()=>PN,axisY:()=>UN,barX:()=>H8,barY:()=>Z8,bin:()=>Uv,cast:()=>zh,castDouble:()=>_u,castInteger:()=>bS,cell:()=>J8,cellX:()=>Q8,cellY:()=>K8,centroid:()=>jh,centroidX:()=>IS,centroidY:()=>MS,circle:()=>sN,colorBase:()=>QE,colorClamp:()=>zE,colorConstant:()=>t8,colorDomain:()=>PE,colorExponent:()=>KE,colorInterpolate:()=>YE,colorLabel:()=>WE,colorLegend:()=>dD,colorN:()=>qE,colorNice:()=>jE,colorPivot:()=>XE,colorRange:()=>UE,colorReverse:()=>HE,colorScale:()=>$E,colorScheme:()=>VE,colorSymmetric:()=>GE,colorTickFormat:()=>JE,colorZero:()=>ZE,column:()=>Ia,contour:()=>IN,coordinator:()=>ni,corr:()=>aS,count:()=>kr,covarPop:()=>cS,create:()=>ao,cume_dist:()=>P2,dateDay:()=>SS,dateMonth:()=>vS,dateMonthDay:()=>_S,delaunayLink:()=>LN,delaunayMesh:()=>CN,denseLine:()=>SN,dense_rank:()=>R2,density:()=>_N,densityX:()=>wN,densityY:()=>vN,dot:()=>rN,dotX:()=>iN,dotY:()=>oN,entropy:()=>iS,eq:()=>_s,facetGrid:()=>F4,facetLabel:()=>R4,facetMargin:()=>O4,facetMarginBottom:()=>L4,facetMarginLeft:()=>C4,facetMarginRight:()=>k4,facetMarginTop:()=>B4,first:()=>mS,first_value:()=>j2,frame:()=>$N,from:()=>gU,fxAlign:()=>Y4,fxAriaDescription:()=>lE,fxAriaLabel:()=>cE,fxAxis:()=>H4,fxDomain:()=>$4,fxFontVariant:()=>aE,fxGrid:()=>nE,fxInset:()=>z4,fxInsetLeft:()=>q4,fxInsetRight:()=>j4,fxLabel:()=>iE,fxLabelAnchor:()=>oE,fxLabelOffset:()=>sE,fxLine:()=>rE,fxNice:()=>U4,fxPadding:()=>X4,fxPaddingInner:()=>G4,fxPaddingOuter:()=>W4,fxRange:()=>P4,fxReverse:()=>uE,fxRound:()=>V4,fxTickFormat:()=>tE,fxTickPadding:()=>K4,fxTickRotate:()=>eE,fxTickSize:()=>J4,fxTickSpacing:()=>Q4,fxTicks:()=>Z4,fyAlign:()=>xE,fyAriaDescription:()=>FE,fyAriaLabel:()=>kE,fyAxis:()=>_E,fyDomain:()=>fE,fyFontVariant:()=>CE,fyGrid:()=>NE,fyInset:()=>pE,fyInsetBottom:()=>yE,fyInsetTop:()=>mE,fyLabel:()=>OE,fyLabelAnchor:()=>BE,fyLabelOffset:()=>LE,fyLine:()=>DE,fyNice:()=>hE,fyPadding:()=>bE,fyPaddingInner:()=>wE,fyPaddingOuter:()=>vE,fyRange:()=>dE,fyReverse:()=>RE,fyRound:()=>gE,fyTickFormat:()=>TE,fyTickPadding:()=>AE,fyTickRotate:()=>EE,fyTickSize:()=>IE,fyTickSpacing:()=>ME,fyTicks:()=>SE,geo:()=>GN,geojson:()=>qh,graticule:()=>HN,grid:()=>m6,gridFx:()=>YN,gridFy:()=>XN,gridX:()=>jN,gridY:()=>VN,gt:()=>$h,gte:()=>E2,hconcat:()=>fU,heatmap:()=>MN,height:()=>s6,hexagon:()=>aN,hexbin:()=>EN,hexgrid:()=>NN,highlight:()=>ZN,hspace:()=>pU,hull:()=>kN,image:()=>bN,inset:()=>p6,intervalX:()=>nD,intervalXY:()=>iD,intervalY:()=>rD,isBetween:()=>Ae,isDistinct:()=>N2,isNotBetween:()=>D2,isNotDistinct:()=>Ph,isNotNull:()=>vs,isNull:()=>Uc,kurtosis:()=>rS,label:()=>y6,lag:()=>z2,last:()=>yS,last_value:()=>V2,lead:()=>q2,lengthBase:()=>E8,lengthClamp:()=>M8,lengthConstant:()=>D8,lengthDomain:()=>S8,lengthExponent:()=>N8,lengthNice:()=>A8,lengthRange:()=>I8,lengthScale:()=>_8,lengthZero:()=>T8,line:()=>X8,lineX:()=>G8,lineY:()=>W8,link:()=>RN,literal:()=>Cr,loadCSV:()=>ES,loadExtension:()=>Xh,loadJSON:()=>NS,loadObjects:()=>BS,loadParquet:()=>DS,loadSpatial:()=>OS,lt:()=>Ss,lte:()=>Is,mad:()=>H2,margin:()=>n6,marginBottom:()=>u6,marginLeft:()=>a6,marginRight:()=>c6,marginTop:()=>l6,margins:()=>e6,max:()=>ti,median:()=>J2,menu:()=>oU,min:()=>ei,mode:()=>K2,name:()=>K3,nearestX:()=>tD,nearestY:()=>eD,neq:()=>zc,not:()=>T2,nth_value:()=>Y2,ntile:()=>U2,opacityBase:()=>u8,opacityClamp:()=>i8,opacityConstant:()=>d8,opacityDomain:()=>n8,opacityExponent:()=>f8,opacityLabel:()=>s8,opacityLegend:()=>hD,opacityNice:()=>o8,opacityRange:()=>r8,opacityReverse:()=>a8,opacityScale:()=>e8,opacityTickFormat:()=>l8,opacityZero:()=>c8,or:()=>Pc,padding:()=>g6,pan:()=>oD,panX:()=>sD,panY:()=>aD,panZoom:()=>cD,panZoomX:()=>lD,panZoomY:()=>uD,percent_rank:()=>$2,plot:()=>xU,product:()=>Z2,projectionClip:()=>z8,projectionDomain:()=>k8,projectionInset:()=>F8,projectionInsetBottom:()=>U8,projectionInsetLeft:()=>R8,projectionInsetRight:()=>$8,projectionInsetTop:()=>P8,projectionParallels:()=>B8,projectionPrecision:()=>L8,projectionRotate:()=>C8,projectionType:()=>O8,quantile:()=>Q2,rBase:()=>b8,rClamp:()=>y8,rConstant:()=>v8,rDomain:()=>p8,rExponent:()=>w8,rNice:()=>g8,rRange:()=>m8,rScale:()=>h8,rZero:()=>x8,rank:()=>F2,raster:()=>AN,rasterTile:()=>TN,rect:()=>tN,rectX:()=>eN,rectY:()=>nN,regressionY:()=>DN,round:()=>x6,row_number:()=>k2,ruleX:()=>fN,ruleY:()=>dN,search:()=>sU,skewness:()=>nS,slider:()=>aU,sphere:()=>WN,spike:()=>xN,sql:()=>q,stddev:()=>eS,stddevPop:()=>sS,stringAgg:()=>gS,style:()=>i6,sum:()=>Fr,symbolLegend:()=>pD,table:()=>cU,text:()=>cN,textX:()=>lN,textY:()=>uN,tickX:()=>hN,tickY:()=>pN,toggle:()=>Sd,toggleColor:()=>KN,toggleX:()=>JN,toggleY:()=>QN,varPop:()=>oS,variance:()=>tS,vconcat:()=>uU,vector:()=>mN,vectorX:()=>yN,vectorY:()=>gN,voronoi:()=>ON,voronoiMesh:()=>BN,vspace:()=>hU,width:()=>o6,xAlign:()=>E6,xAriaDescription:()=>X6,xAriaLabel:()=>Y6,xAxis:()=>B6,xBase:()=>H6,xClamp:()=>A6,xConstant:()=>J6,xDomain:()=>w6,xExponent:()=>Z6,xFontVariant:()=>V6,xGrid:()=>P6,xInset:()=>S6,xInsetLeft:()=>I6,xInsetRight:()=>M6,xLabel:()=>z6,xLabelAnchor:()=>q6,xLabelOffset:()=>j6,xLine:()=>U6,xNice:()=>_6,xPadding:()=>N6,xPaddingInner:()=>D6,xPaddingOuter:()=>O6,xRange:()=>v6,xReverse:()=>G6,xRound:()=>T6,xScale:()=>b6,xTickFormat:()=>R6,xTickPadding:()=>F6,xTickRotate:()=>$6,xTickSize:()=>C6,xTickSpacing:()=>k6,xTicks:()=>L6,xZero:()=>W6,xyDomain:()=>r6,yAlign:()=>a4,yAriaDescription:()=>M4,yAriaLabel:()=>I4,yAxis:()=>f4,yBase:()=>E4,yClamp:()=>o4,yConstant:()=>D4,yDomain:()=>K6,yExponent:()=>N4,yFontVariant:()=>S4,yGrid:()=>x4,yInset:()=>n4,yInsetBottom:()=>i4,yInsetTop:()=>r4,yLabel:()=>w4,yLabelAnchor:()=>v4,yLabelOffset:()=>_4,yLine:()=>b4,yNice:()=>e4,yPadding:()=>c4,yPaddingInner:()=>l4,yPaddingOuter:()=>u4,yRange:()=>t4,yReverse:()=>A4,yRound:()=>s4,yScale:()=>Q6,yTickFormat:()=>y4,yTickPadding:()=>m4,yTickRotate:()=>g4,yTickSize:()=>h4,yTickSpacing:()=>p4,yTicks:()=>d4,yZero:()=>T4});var lo=Symbol("Fixed"),Sn=Symbol("Transient"),Zh=Symbol("Transform");var Dv={};Ir(Dv,{Area:()=>kl,Arrow:()=>ay,BarX:()=>cy,BarY:()=>ly,Cell:()=>Fl,Contour:()=>xy,Density:()=>vy,Dot:()=>Rl,Frame:()=>Km,Geo:()=>_y,Hexgrid:()=>Sy,Image:()=>Iy,Line:()=>$l,Link:()=>oy,Mark:()=>St,Raster:()=>gy,Rect:()=>Ul,RuleX:()=>Wm,RuleY:()=>Hm,Text:()=>Bl,TickX:()=>hy,TickY:()=>py,Tip:()=>ty,Vector:()=>Cl,area:()=>iy,areaX:()=>cc,areaY:()=>aa,arrow:()=>q$,auto:()=>K$,autoSpec:()=>r3,axisFx:()=>Hw,axisFy:()=>Ww,axisX:()=>Jm,axisY:()=>Zm,barX:()=>qo,barY:()=>jo,bin:()=>sa,binX:()=>Uo,binY:()=>zo,bollinger:()=>dc,bollingerX:()=>o9,bollingerY:()=>s9,boxX:()=>a9,boxY:()=>c9,cell:()=>lc,cellX:()=>V$,cellY:()=>Y$,centroid:()=>iP,circle:()=>W$,cluster:()=>rP,column:()=>mn,contour:()=>g9,crosshair:()=>w9,crosshairX:()=>v9,crosshairY:()=>_9,delaunayLink:()=>M9,delaunayMesh:()=>A9,density:()=>O9,differenceY:()=>C9,dodgeX:()=>xP,dodgeY:()=>bP,dot:()=>yi,dotX:()=>X$,dotY:()=>G$,filter:()=>eR,find:()=>uR,formatIsoDate:()=>dT,formatMonth:()=>mR,formatWeekday:()=>yR,frame:()=>Gf,geo:()=>bv,geoCentroid:()=>oP,graticule:()=>F9,gridFx:()=>Kw,gridFy:()=>Jw,gridX:()=>Qw,gridY:()=>Zw,group:()=>Um,groupX:()=>tc,groupY:()=>ec,groupZ:()=>Pm,hexagon:()=>H$,hexbin:()=>R9,hexgrid:()=>$9,hull:()=>T9,identity:()=>G,image:()=>U9,indexOf:()=>Ee,initializer:()=>Ie,interpolateNearest:()=>u3,interpolateNone:()=>xv,interpolatorBarycentric:()=>l3,interpolatorRandomWalk:()=>f3,legend:()=>u$,line:()=>Pl,lineX:()=>uc,lineY:()=>fc,linearRegressionX:()=>j9,linearRegressionY:()=>V9,link:()=>lv,map:()=>vr,mapX:()=>sd,mapY:()=>ad,marks:()=>en,normalize:()=>Ev,normalizeX:()=>SP,normalizeY:()=>IP,plot:()=>ny,pointer:()=>qf,pointerX:()=>jf,pointerY:()=>El,raster:()=>h9,rect:()=>fy,rectX:()=>rd,rectY:()=>id,reverse:()=>nR,ruleX:()=>Yr,ruleY:()=>Xr,scale:()=>Uf,select:()=>AP,selectFirst:()=>B3,selectLast:()=>L3,selectMaxX:()=>NP,selectMaxY:()=>DP,selectMinX:()=>TP,selectMinY:()=>EP,shiftX:()=>MP,shuffle:()=>rR,sort:()=>dw,sphere:()=>k9,spike:()=>V7,stackX:()=>t3,stackX1:()=>L$,stackX2:()=>C$,stackY:()=>e3,stackY1:()=>k$,stackY2:()=>F$,text:()=>Po,textX:()=>zw,textY:()=>qw,tickX:()=>mv,tickY:()=>yv,tip:()=>nv,transform:()=>yn,tree:()=>A3,treeLink:()=>Iv,treeNode:()=>My,valueof:()=>wt,vector:()=>jT,vectorX:()=>Yw,vectorY:()=>Xw,voronoi:()=>E9,voronoiMesh:()=>N9,window:()=>cd,windowX:()=>t9,windowY:()=>e9});function zt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function As(e){let t,n,r;e.length!==2?(t=zt,n=(a,c)=>zt(e(a),c),r=(a,c)=>e(a)-c):(t=e===zt||e===Hn?e:CV,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 CV(){return 0}function Jh(e){return e===null?NaN:+e}function*WB(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 HB=As(zt),ZB=HB.right,kV=HB.left,FV=As(Jh).center,Ts=ZB;var Qh=JB(QB),$S=JB(RV);function JB(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?(Mu(a,l,i,o,s),Mu(a,i,l,o,s),Mu(a,l,i,o,s),Au(c,i,l,o,s),Au(c,l,i,o,s),Au(c,i,l,o,s)):a?(Mu(a,i,l,o,s),Mu(a,l,i,o,s),Mu(a,i,l,o,s)):c&&(Au(c,i,l,o,s),Au(c,l,i,o,s),Au(c,i,l,o,s)),t}}function Mu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Au(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function RV(e){let t=QB(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 QB(e){let t=Math.floor(e);if(t===e)return $V(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 $V(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 uo(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 PV(e){return e.length|0}function UV(e){return!(e>0)}function zV(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function qV(e){return t=>e(...t)}function G0(...e){let t=typeof e[e.length-1]=="function"&&qV(e.pop());e=e.map(zV);let n=e.map(PV),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(UV))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 W0(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 Ea(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 ii(e,t){let n=Ea(e,t);return n&&Math.sqrt(n)}function le(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 In=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 Zn=class extends Map{constructor(t,n=e5){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(PS(this,t))}has(t){return super.has(PS(this,t))}set(t,n){return super.set(KB(this,t),n)}delete(t){return super.delete(t5(this,t))}},Jn=class extends Set{constructor(t,n=e5){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(PS(this,t))}add(t){return super.add(KB(this,t))}delete(t){return super.delete(t5(this,t))}};function PS({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function KB({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function t5({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function e5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Kh(e){return e}function cn(e,...t){return zS(e,Kh,Kh,t)}function $i(e,t,...n){return zS(e,Kh,t,n)}function US(e,t,...n){return zS(e,Array.from,t,n)}function zS(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Zn,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 qS(e,t){return Array.from(t,n=>e[n])}function fo(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=Yc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Yc(n[i],n[o]))),qS(e,r)}return e.sort(tp(n))}function tp(e=zt){if(e===zt)return Yc;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 Yc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Tu(e,t,n){return(t.length!==2?fo($i(e,t,n),([r,i],[o,s])=>zt(i,s)||zt(r,o)):fo(cn(e,n),([r,i],[o,s])=>t(i,s)||zt(r,o))).map(([r])=>r)}var jV=Math.sqrt(50),VV=Math.sqrt(10),YV=Math.sqrt(2);function H0(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>=jV?10:o>=VV?5:o>=YV?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?H0(e,t,n*2):[a,c,l]}function Mn(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?H0(t,e,n):H0(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 Es(e,t,n){return t=+t,e=+e,n=+n,H0(e,t,n)[2]}function Eu(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Es(t,e,n):Es(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Nu(e,t,n){let r;for(;;){let i=Es(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 Na(e){return Math.max(1,Math.ceil(Math.log(uo(e))/Math.LN2)+1)}function Wt(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 Z0(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 J0(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 Q0(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?Yc:tp(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));Q0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(ep(e,n,t),i(e[r],o)>0&&ep(e,n,r);s<a;){for(ep(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?ep(e,n,a):(++a,ep(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function ep(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Xc(e,t=zt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?zt(s,i)>0:zt(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 Qn(e,t,n){if(e=Float64Array.from(WB(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ue(e);if(t>=1)return Wt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Wt(Q0(e,o).subarray(0,o+1)),a=ue(e.subarray(o+1));return s+(a-s)*(i-o)}}function jS(e,t,n=Jh){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 K0(e,t,n){let r=uo(e),i=Qn(e,.75)-Qn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function np(e,t,n){let r=uo(e),i=ii(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Ns(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 Pi(e,t){return Qn(e,.5,t)}function*GV(e){for(let t of e)yield*t}function Du(e){return Array.from(GV(e))}function Ou(e,t){let n=new Zn;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 tx(e,t=WV){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function WV(e,t){return[e,t]}function Ue(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 rp(e,t=zt){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=zt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===zt?(a,c)=>Yc(n[a],n[c]):tp(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 ex(e,t=zt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?zt(s,i)<0:zt(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 An(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 Da(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function n5(e){return e}var VS=1,YS=2,XS=3,nx=4,r5=1e-6;function HV(e){return"translate("+e+",0)"}function ZV(e){return"translate(0,"+e+")"}function JV(e){return t=>+e(t)}function QV(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function KV(){return!this.__axis}function tY(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===VS||e===nx?-1:1,u=e===nx||e===YS?"x":"y",f=e===VS||e===XS?HV:ZV;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):n5),g=Math.max(o,0)+a,y=t.range(),x=+y[0]+c,b=+y[y.length-1]+c,w=(t.bandwidth?QV:JV)(t.copy(),c),v=h.selection?h.selection():h,_=v.selectAll(".domain").data([null]),I=v.selectAll(".tick").data(p,t).order(),D=I.exit(),A=I.enter().append("g").attr("class","tick"),E=I.select("line"),T=I.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(A),E=E.merge(A.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),T=T.merge(A.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===VS?"0em":e===XS?"0.71em":"0.32em")),h!==v&&(_=_.transition(h),I=I.transition(h),E=E.transition(h),T=T.transition(h),D=D.transition(h).attr("opacity",r5).attr("transform",function(O){return isFinite(O=w(O))?f(O+c):this.getAttribute("transform")}),A.attr("opacity",r5).attr("transform",function(O){var C=this.parentNode.__axis;return f((C&&isFinite(C=C(O))?C:w(O))+c)})),D.remove(),_.attr("d",e===nx||e===YS?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),I.attr("opacity",1).attr("transform",function(O){return f(w(O)+c)}),E.attr(u+"2",l*o),T.attr(u,l*g).text(m),v.filter(KV).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===YS?"start":e===nx?"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 GS(e){return tY(XS,e)}var eY={value:()=>{}};function o5(){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 rx(n)}function rx(e){this._=e}function nY(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}})}rx.prototype=o5.prototype={constructor:rx,on:function(e,t){var n=this._,r=nY(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=rY(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]=i5(n[i],e.name,t);else if(t==null)for(i in n)n[i]=i5(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 rx(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 rY(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function i5(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=eY,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Gc=o5;var ix="http://www.w3.org/1999/xhtml",oi={svg:"http://www.w3.org/2000/svg",xhtml:ix,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ds(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oi.hasOwnProperty(t)?{space:oi[t],local:e}:e}function iY(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ix&&t.documentElement.namespaceURI===ix?t.createElement(e):t.createElementNS(n,e)}}function oY(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Os(e){var t=Ds(e);return(t.local?oY:iY)(t)}function sY(){}function Wc(e){return e==null?sY:function(){return this.querySelector(e)}}function s5(e){typeof e!="function"&&(e=Wc(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 Fe(r,this._parents)}function WS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function aY(){return[]}function ip(e){return e==null?aY:function(){return this.querySelectorAll(e)}}function cY(e){return function(){return WS(e.apply(this,arguments))}}function a5(e){typeof e=="function"?e=cY(e):e=ip(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 Fe(r,i)}function op(e){return function(){return this.matches(e)}}function ox(e){return function(t){return t.matches(e)}}var lY=Array.prototype.find;function uY(e){return function(){return lY.call(this.children,e)}}function fY(){return this.firstElementChild}function c5(e){return this.select(e==null?fY:uY(typeof e=="function"?e:ox(e)))}var dY=Array.prototype.filter;function hY(){return Array.from(this.children)}function pY(e){return function(){return dY.call(this.children,e)}}function l5(e){return this.selectAll(e==null?hY:pY(typeof e=="function"?e:ox(e)))}function u5(e){typeof e!="function"&&(e=op(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 Fe(r,this._parents)}function sx(e){return new Array(e.length)}function f5(){return new Fe(this._enter||this._groups.map(sx),this._parents)}function sp(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}sp.prototype={constructor:sp,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 d5(e){return function(){return e}}function mY(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 sp(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function yY(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 sp(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function gY(e){return e.__data__}function h5(e,t){if(!arguments.length)return Array.from(this,gY);var n=t?yY:mY,r=this._parents,i=this._groups;typeof e!="function"&&(e=d5(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=xY(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),g=s[l]=new Array(p),y=c[l]=new Array(d);n(u,f,m,g,y,h,t);for(var x=0,b=0,w,v;x<p;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(v=g[b])&&++b<p;);w._next=v||null}}return s=new Fe(s,r),s._enter=a,s._exit=c,s}function xY(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function p5(){return new Fe(this._exit||this._groups.map(sx),this._parents)}function m5(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 y5(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 Fe(a,this._parents)}function g5(){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 x5(e){e||(e=bY);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 Fe(i,this._parents).order()}function bY(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function b5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function w5(){return Array.from(this)}function v5(){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 _5(){let e=0;for(let t of this)++e;return e}function S5(){return!this.node()}function I5(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 wY(e){return function(){this.removeAttribute(e)}}function vY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _Y(e,t){return function(){this.setAttribute(e,t)}}function SY(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function IY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function MY(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 M5(e,t){var n=Ds(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?vY:wY:typeof t=="function"?n.local?MY:IY:n.local?SY:_Y)(n,t))}function ax(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function AY(e){return function(){this.style.removeProperty(e)}}function TY(e,t,n){return function(){this.style.setProperty(e,t,n)}}function EY(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function A5(e,t,n){return arguments.length>1?this.each((t==null?AY:typeof t=="function"?EY:TY)(e,t,n??"")):Oa(this.node(),e)}function Oa(e,t){return e.style.getPropertyValue(t)||ax(e).getComputedStyle(e,null).getPropertyValue(t)}function NY(e){return function(){delete this[e]}}function DY(e,t){return function(){this[e]=t}}function OY(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function T5(e,t){return arguments.length>1?this.each((t==null?NY:typeof t=="function"?OY:DY)(e,t)):this.node()[e]}function E5(e){return e.trim().split(/^|\s+/)}function HS(e){return e.classList||new N5(e)}function N5(e){this._node=e,this._names=E5(e.getAttribute("class")||"")}N5.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 D5(e,t){for(var n=HS(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function O5(e,t){for(var n=HS(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function BY(e){return function(){D5(this,e)}}function LY(e){return function(){O5(this,e)}}function CY(e,t){return function(){(t.apply(this,arguments)?D5:O5)(this,e)}}function B5(e,t){var n=E5(e+"");if(arguments.length<2){for(var r=HS(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?CY:t?BY:LY)(n,t))}function kY(){this.textContent=""}function FY(e){return function(){this.textContent=e}}function RY(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function L5(e){return arguments.length?this.each(e==null?kY:(typeof e=="function"?RY:FY)(e)):this.node().textContent}function $Y(){this.innerHTML=""}function PY(e){return function(){this.innerHTML=e}}function UY(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function C5(e){return arguments.length?this.each(e==null?$Y:(typeof e=="function"?UY:PY)(e)):this.node().innerHTML}function zY(){this.nextSibling&&this.parentNode.appendChild(this)}function k5(){return this.each(zY)}function qY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function F5(){return this.each(qY)}function R5(e){var t=typeof e=="function"?e:Os(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function jY(){return null}function $5(e,t){var n=typeof e=="function"?e:Os(e),r=t==null?jY:typeof t=="function"?t:Wc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function VY(){var e=this.parentNode;e&&e.removeChild(this)}function P5(){return this.each(VY)}function YY(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function XY(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function U5(e){return this.select(e?XY:YY)}function z5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function GY(e){return function(t){e.call(this,t,this.__data__)}}function WY(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 HY(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 ZY(e,t,n){return function(){var r=this.__on,i,o=GY(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=WY(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?ZY:HY,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function j5(e,t,n){var r=ax(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 JY(e,t){return function(){return j5(this,e,t)}}function QY(e,t){return function(){return j5(this,e,t.apply(this,arguments))}}function V5(e,t){return this.each((typeof t=="function"?QY:JY)(e,t))}function*Y5(){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 ZS=[null];function Fe(e,t){this._groups=e,this._parents=t}function X5(){return new Fe([[document.documentElement]],ZS)}function KY(){return this}Fe.prototype=X5.prototype={constructor:Fe,select:s5,selectAll:a5,selectChild:c5,selectChildren:l5,filter:u5,data:h5,enter:f5,exit:p5,join:m5,merge:y5,selection:KY,order:g5,sort:x5,call:b5,nodes:w5,node:v5,size:_5,empty:S5,each:I5,attr:M5,style:A5,property:T5,classed:B5,text:L5,html:C5,raise:k5,lower:F5,append:R5,insert:$5,remove:P5,clone:U5,datum:z5,on:q5,dispatch:V5,[Symbol.iterator]:Y5};var Bs=X5;function Vt(e){return typeof e=="string"?new Fe([[document.querySelector(e)]],[document.documentElement]):new Fe([[e]],ZS)}function G5(e){let t;for(;t=e.sourceEvent;)e=t;return e}function kn(e,t){if(e=G5(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 cx={capture:!0,passive:!1};function lx(e){e.preventDefault(),e.stopImmediatePropagation()}function ap(e){var t=e.document.documentElement,n=Vt(e).on("dragstart.drag",lx,cx);"onselectstart"in t?n.on("selectstart.drag",lx,cx):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function cp(e,t){var n=e.document.documentElement,r=Vt(e).on("dragstart.drag",null);t&&(r.on("click.drag",lx,cx),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 Ls(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ba(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function po(){}var La=.7,Jc=1/La,Bu="\\s*([+-]?\\d+)\\s*",lp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ho="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",tX=/^#([0-9a-f]{3,8})$/,eX=new RegExp(`^rgb\\(${Bu},${Bu},${Bu}\\)$`),nX=new RegExp(`^rgb\\(${ho},${ho},${ho}\\)$`),rX=new RegExp(`^rgba\\(${Bu},${Bu},${Bu},${lp}\\)$`),iX=new RegExp(`^rgba\\(${ho},${ho},${ho},${lp}\\)$`),oX=new RegExp(`^hsl\\(${lp},${ho},${ho}\\)$`),sX=new RegExp(`^hsla\\(${lp},${ho},${ho},${lp}\\)$`),W5={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};Ls(po,Rr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:H5,formatHex:H5,formatHex8:aX,formatHsl:cX,formatRgb:Z5,toString:Z5});function H5(){return this.rgb().formatHex()}function aX(){return this.rgb().formatHex8()}function cX(){return nL(this).formatHsl()}function Z5(){return this.rgb().formatRgb()}function Rr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=tX.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?J5(t):n===3?new Ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ux(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ux(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=eX.exec(e))?new Ge(t[1],t[2],t[3],1):(t=nX.exec(e))?new Ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=rX.exec(e))?ux(t[1],t[2],t[3],t[4]):(t=iX.exec(e))?ux(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oX.exec(e))?tL(t[1],t[2]/100,t[3]/100,1):(t=sX.exec(e))?tL(t[1],t[2]/100,t[3]/100,t[4]):W5.hasOwnProperty(e)?J5(W5[e]):e==="transparent"?new Ge(NaN,NaN,NaN,0):null}function J5(e){return new Ge(e>>16&255,e>>8&255,e&255,1)}function ux(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ge(e,t,n,r)}function up(e){return e instanceof po||(e=Rr(e)),e?(e=e.rgb(),new Ge(e.r,e.g,e.b,e.opacity)):new Ge}function on(e,t,n,r){return arguments.length===1?up(e):new Ge(e,t,n,r??1)}function Ge(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ls(Ge,on,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Ge(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Ge(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ge(Zc(this.r),Zc(this.g),Zc(this.b),dx(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:Q5,formatHex:Q5,formatHex8:lX,formatRgb:K5,toString:K5}));function Q5(){return`#${Hc(this.r)}${Hc(this.g)}${Hc(this.b)}`}function lX(){return`#${Hc(this.r)}${Hc(this.g)}${Hc(this.b)}${Hc((isNaN(this.opacity)?1:this.opacity)*255)}`}function K5(){let e=dx(this.opacity);return`${e===1?"rgb(":"rgba("}${Zc(this.r)}, ${Zc(this.g)}, ${Zc(this.b)}${e===1?")":`, ${e})`}`}function dx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hc(e){return e=Zc(e),(e<16?"0":"")+e.toString(16)}function tL(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ui(e,t,n,r)}function nL(e){if(e instanceof Ui)return new Ui(e.h,e.s,e.l,e.opacity);if(e instanceof po||(e=Rr(e)),!e)return new Ui;if(e instanceof Ui)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 Ui(s,a,c,e.opacity)}function fp(e,t,n,r){return arguments.length===1?nL(e):new Ui(e,t,n,r??1)}function Ui(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ls(Ui,fp,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Ui(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 Ge(JS(e>=240?e-240:e+120,i,r),JS(e,i,r),JS(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ui(eL(this.h),fx(this.s),fx(this.l),dx(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=dx(this.opacity);return`${e===1?"hsl(":"hsla("}${eL(this.h)}, ${fx(this.s)*100}%, ${fx(this.l)*100}%${e===1?")":`, ${e})`}`}}));function eL(e){return e=(e||0)%360,e<0?e+360:e}function fx(e){return Math.max(0,Math.min(1,e||0))}function JS(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 hx=Math.PI/180,px=180/Math.PI;var mx=18,rL=.96422,iL=1,oL=.82521,sL=4/29,Lu=6/29,aL=3*Lu*Lu,uX=Lu*Lu*Lu;function cL(e){if(e instanceof mo)return new mo(e.l,e.a,e.b,e.opacity);if(e instanceof Cs)return lL(e);e instanceof Ge||(e=up(e));var t=eI(e.r),n=eI(e.g),r=eI(e.b),i=QS((.2225045*t+.7168786*n+.0606169*r)/iL),o,s;return t===n&&n===r?o=s=i:(o=QS((.4360747*t+.3850649*n+.1430804*r)/rL),s=QS((.0139322*t+.0971045*n+.7141733*r)/oL)),new mo(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Cu(e,t,n,r){return arguments.length===1?cL(e):new mo(e,t,n,r??1)}function mo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Ls(mo,Cu,Ba(po,{brighter(e){return new mo(this.l+mx*(e??1),this.a,this.b,this.opacity)},darker(e){return new mo(this.l-mx*(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=rL*KS(t),e=iL*KS(e),n=oL*KS(n),new Ge(tI(3.1338561*t-1.6168667*e-.4906146*n),tI(-.9787684*t+1.9161415*e+.033454*n),tI(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function QS(e){return e>uX?Math.pow(e,1/3):e/aL+sL}function KS(e){return e>Lu?e*e*e:aL*(e-sL)}function tI(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function eI(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function fX(e){if(e instanceof Cs)return new Cs(e.h,e.c,e.l,e.opacity);if(e instanceof mo||(e=cL(e)),e.a===0&&e.b===0)return new Cs(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*px;return new Cs(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function dp(e,t,n,r){return arguments.length===1?fX(e):new Cs(e,t,n,r??1)}function Cs(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function lL(e){if(isNaN(e.h))return new mo(e.l,0,0,e.opacity);var t=e.h*hx;return new mo(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ls(Cs,dp,Ba(po,{brighter(e){return new Cs(this.h,this.c,this.l+mx*(e??1),this.opacity)},darker(e){return new Cs(this.h,this.c,this.l-mx*(e??1),this.opacity)},rgb(){return lL(this).rgb()}}));var hL=-.14861,nI=1.78277,rI=-.29227,yx=-.90649,hp=1.97294,uL=hp*yx,fL=hp*nI,dL=nI*rI-yx*hL;function dX(e){if(e instanceof Qc)return new Qc(e.h,e.s,e.l,e.opacity);e instanceof Ge||(e=up(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(dL*r+uL*t-fL*n)/(dL+uL-fL),o=r-i,s=(hp*(n-i)-rI*o)/yx,a=Math.sqrt(s*s+o*o)/(hp*i*(1-i)),c=a?Math.atan2(s,o)*px-120:NaN;return new Qc(c<0?c+360:c,a,i,e.opacity)}function Kn(e,t,n,r){return arguments.length===1?dX(e):new Qc(e,t,n,r??1)}function Qc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ls(Qc,Kn,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Qc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Qc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*hx,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ge(255*(t+n*(hL*r+nI*i)),255*(t+n*(rI*r+yx*i)),255*(t+n*(hp*r)),this.opacity)}}));function iI(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 pL(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 iI((n-r/t)*t,s,i,o,a)}}function mL(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 iI((n-r/t)*t,i,o,s,a)}}var ku=e=>()=>e;function yL(e,t){return function(n){return e+n*t}}function hX(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 Fu(e,t){var n=t-e;return n?yL(e,n>180||n<-180?n-360*Math.round(n/360):n):ku(isNaN(e)?t:e)}function gL(e){return(e=+e)==1?Te:function(t,n){return n-t?hX(t,n,e):ku(isNaN(t)?n:t)}}function Te(e,t){var n=t-e;return n?yL(e,n):ku(isNaN(e)?t:e)}var si=function e(t){var n=gL(t);function r(i,o){var s=n((i=on(i)).r,(o=on(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Te(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 xL(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=on(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 oI=xL(pL),pX=xL(mL);function bL(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 wL(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vL(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]=$r(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 _L(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function _e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function SL(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]=$r(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var aI=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sI=new RegExp(aI.source,"g");function mX(e){return function(){return e}}function yX(e){return function(t){return e(t)+""}}function pp(e,t){var n=aI.lastIndex=sI.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=aI.exec(e))&&(i=sI.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:_e(r,i)})),n=sI.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?yX(c[0].x):mX(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 $r(e,t){var n=typeof t,r;return t==null||n==="boolean"?ku(t):(n==="number"?_e:n==="string"?(r=Rr(t))?(t=r,si):pp:t instanceof Rr?si:t instanceof Date?_L:wL(t)?bL:Array.isArray(t)?vL:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?SL:_e)(e,t)}function Kc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var IL=180/Math.PI,gx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cI(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)*IL,skewX:Math.atan(c)*IL,scaleX:s,scaleY:a}}var xx;function ML(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?gx:cI(t.a,t.b,t.c,t.d,t.e,t.f)}function AL(e){return e==null?gx:(xx||(xx=document.createElementNS("http://www.w3.org/2000/svg","g")),xx.setAttribute("transform",e),(e=xx.transform.baseVal.consolidate())?(e=e.matrix,cI(e.a,e.b,e.c,e.d,e.e,e.f)):gx)}function TL(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:_e(l,f)},{i:m-2,x:_e(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:_e(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:_e(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:_e(l,f)},{i:m-2,x:_e(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,g;++p<m;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var lI=TL(ML,"px, ","px)","deg)"),uI=TL(AL,", ",")",")");var gX=1e-12;function EL(e){return((e=Math.exp(e))+1/e)/2}function xX(e){return((e=Math.exp(e))-1/e)/2}function bX(e){return((e=Math.exp(2*e))-1)/(e+1)}var fI=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,g,y;if(m<gX)y=Math.log(d/l)/t,g=function(I){return[a+I*h,c+I*p,l*Math.exp(t*I*y)]};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);y=(_-v)/t,g=function(I){var D=I*y,A=EL(v),E=l/(n*x)*(A*bX(t*D+v)-xX(v));return[a+E*h,c+E*p,l*A/EL(t*D+v)]}}return g.duration=y*1e3*t/Math.SQRT2,g}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 NL(e){return function(t,n){var r=e((t=fp(t)).h,(n=fp(n)).h),i=Te(t.s,n.s),o=Te(t.l,n.l),s=Te(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 dI=NL(Fu),wX=NL(Te);function bx(e,t){var n=Te((e=Cu(e)).l,(t=Cu(t)).l),r=Te(e.a,t.a),i=Te(e.b,t.b),o=Te(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 DL(e){return function(t,n){var r=e((t=dp(t)).h,(n=dp(n)).h),i=Te(t.c,n.c),o=Te(t.l,n.l),s=Te(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 hI=DL(Fu),vX=DL(Te);function OL(e){return function t(n){n=+n;function r(i,o){var s=e((i=Kn(i)).h,(o=Kn(o)).h),a=Te(i.s,o.s),c=Te(i.l,o.l),l=Te(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 _X=OL(Fu),Ru=OL(Te);function yo(e,t){t===void 0&&(t=e,e=$r);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 Fn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var $u=0,yp=0,mp=0,LL=1e3,wx,gp,vx=0,tl=0,_x=0,xp=typeof performance=="object"&&performance.now?performance:Date,CL=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wp(){return tl||(CL(SX),tl=xp.now()+_x)}function SX(){tl=0}function bp(){this._call=this._time=this._next=null}bp.prototype=Sx.prototype={constructor:bp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?wp():+n)+(t==null?0:+t),!this._next&&gp!==this&&(gp?gp._next=this:wx=this,gp=this),this._call=e,this._time=n,pI()},stop:function(){this._call&&(this._call=null,this._time=1/0,pI())}};function Sx(e,t,n){var r=new bp;return r.restart(e,t,n),r}function kL(){wp(),++$u;for(var e=wx,t;e;)(t=tl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$u}function BL(){tl=(vx=xp.now())+_x,$u=yp=0;try{kL()}finally{$u=0,MX(),tl=0}}function IX(){var e=xp.now(),t=e-vx;t>LL&&(_x-=t,vx=e)}function MX(){for(var e,t=wx,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:wx=n);gp=e,pI(r)}function pI(e){if(!$u){yp&&(yp=clearTimeout(yp));var t=e-tl;t>24?(e<1/0&&(yp=setTimeout(BL,e-xp.now()-_x)),mp&&(mp=clearInterval(mp))):(mp||(vx=xp.now(),mp=setInterval(IX,LL)),$u=1,CL(BL))}}function Ix(e,t,n){var r=new bp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var AX=Gc("start","end","cancel","interrupt"),TX=[],$L=0,FL=1,Ax=2,Mx=3,RL=4,Tx=5,vp=6;function Ca(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;EX(e,n,{name:t,index:r,group:i,on:AX,tween:TX,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:$L})}function _p(e,t){var n=sn(e,t);if(n.state>$L)throw new Error("too late; already scheduled");return n}function Tn(e,t){var n=sn(e,t);if(n.state>Mx)throw new Error("too late; already running");return n}function sn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function EX(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Sx(o,0,n.time);function o(l){n.state=FL,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!==FL)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Mx)return Ix(s);h.state===RL?(h.state=vp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=vp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Ix(function(){n.state===Mx&&(n.state=RL,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ax,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ax){for(n.state=Mx,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=Tx,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===Tx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=vp,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function go(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>Ax&&r.state<Tx,r.state=vp,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function PL(e){return this.each(function(){go(this,e)})}function NX(e,t){var n,r;return function(){var i=Tn(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 DX(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Tn(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 UL(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=sn(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?NX:DX)(n,e,t))}function Pu(e,t,n){var r=e._id;return e.each(function(){var i=Tn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return sn(i,r).value[t]}}function Ex(e,t){var n;return(typeof t=="number"?_e:t instanceof Rr?si:(n=Rr(t))?(t=n,si):pp)(e,t)}function OX(e){return function(){this.removeAttribute(e)}}function BX(e){return function(){this.removeAttributeNS(e.space,e.local)}}function LX(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 CX(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 kX(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 FX(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 zL(e,t){var n=Ds(e),r=n==="transform"?uI:Ex;return this.attrTween(e,typeof t=="function"?(n.local?FX:kX)(n,r,Pu(this,"attr."+e,t)):t==null?(n.local?BX:OX)(n):(n.local?CX:LX)(n,r,t))}function RX(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function $X(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function PX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&$X(e,o)),n}return i._value=t,i}function UX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&RX(e,o)),n}return i._value=t,i}function qL(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=Ds(e);return this.tween(n,(r.local?PX:UX)(r,t))}function zX(e,t){return function(){_p(this,e).delay=+t.apply(this,arguments)}}function qX(e,t){return t=+t,function(){_p(this,e).delay=t}}function jL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?zX:qX)(t,e)):sn(this.node(),t).delay}function jX(e,t){return function(){Tn(this,e).duration=+t.apply(this,arguments)}}function VX(e,t){return t=+t,function(){Tn(this,e).duration=t}}function VL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jX:VX)(t,e)):sn(this.node(),t).duration}function YX(e,t){if(typeof t!="function")throw new Error;return function(){Tn(this,e).ease=t}}function YL(e){var t=this._id;return arguments.length?this.each(YX(t,e)):sn(this.node(),t).ease}function XX(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Tn(this,e).ease=n}}function XL(e){if(typeof e!="function")throw new Error;return this.each(XX(this._id,e))}function GL(e){typeof e!="function"&&(e=op(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 tr(r,this._parents,this._name,this._id)}function WL(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 tr(s,this._parents,this._name,this._id)}function GX(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 WX(e,t,n){var r,i,o=GX(t)?_p:Tn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function HL(e,t){var n=this._id;return arguments.length<2?sn(this.node(),n).on.on(e):this.each(WX(n,e,t))}function HX(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ZL(){return this.on("end.remove",HX(this._id))}function JL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wc(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,Ca(l[d],t,n,d,l,sn(u,n)));return new tr(o,this._parents,t,n)}function QL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ip(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=sn(u,n),m=0,g=d.length;m<g;++m)(h=d[m])&&Ca(h,t,n,m,d,p);o.push(d),s.push(u)}return new tr(o,s,t,n)}var ZX=Bs.prototype.constructor;function KL(){return new ZX(this._groups,this._parents)}function JX(e,t){var n,r,i;return function(){var o=Oa(this,e),s=(this.style.removeProperty(e),Oa(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function tC(e){return function(){this.style.removeProperty(e)}}function QX(e,t,n){var r,i=n+"",o;return function(){var s=Oa(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function KX(e,t,n){var r,i,o;return function(){var s=Oa(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oa(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function tG(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Tn(this,e),l=c.on,u=c.value[o]==null?a||(a=tC(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function eC(e,t,n){var r=(e+="")=="transform"?lI:Ex;return t==null?this.styleTween(e,JX(e,r)).on("end.style."+e,tC(e)):typeof t=="function"?this.styleTween(e,KX(e,r,Pu(this,"style."+e,t))).each(tG(this._id,e)):this.styleTween(e,QX(e,r,t),n).on("end.style."+e,null)}function eG(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function nG(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&eG(e,s,n)),r}return o._value=t,o}function nC(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,nG(e,t,n??""))}function rG(e){return function(){this.textContent=e}}function iG(e){return function(){var t=e(this);this.textContent=t??""}}function rC(e){return this.tween("text",typeof e=="function"?iG(Pu(this,"text",e)):rG(e==null?"":e+""))}function oG(e){return function(t){this.textContent=e.call(this,t)}}function sG(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&oG(i)),t}return r._value=e,r}function iC(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,sG(e))}function oC(){for(var e=this._name,t=this._id,n=Nx(),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=sn(c,t);Ca(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new tr(r,this._parents,e,n)}function sC(){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=Tn(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 aG=0;function tr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function aC(e){return Bs().transition(e)}function Nx(){return++aG}var ks=Bs.prototype;tr.prototype=aC.prototype={constructor:tr,select:JL,selectAll:QL,selectChild:ks.selectChild,selectChildren:ks.selectChildren,filter:GL,merge:WL,selection:KL,transition:oC,call:ks.call,nodes:ks.nodes,node:ks.node,size:ks.size,empty:ks.empty,each:ks.each,on:HL,attr:zL,attrTween:qL,style:eC,styleTween:nC,text:rC,textTween:iC,remove:ZL,tween:UL,delay:jL,duration:VL,ease:YL,easeVarying:XL,end:sC,[Symbol.iterator]:ks[Symbol.iterator]};function Dx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cG={time:null,delay:0,duration:250,ease:Dx};function lG(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 cC(e){var t,n;e instanceof tr?(t=e._id,e=e._name):(t=Nx(),(n=cG).time=wp(),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])&&Ca(c,e,t,l,s,n||lG(c,t));return new tr(r,this._parents,e,t)}Bs.prototype.interrupt=PL;Bs.prototype.transition=cC;var Ox=e=>()=>e;function mI(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 lC(e){e.stopImmediatePropagation()}function Bx(e){e.preventDefault(),e.stopImmediatePropagation()}var uC={name:"drag"},yI={name:"space"},Uu={name:"handle"},zu={name:"center"},{abs:fC,max:Rn,min:$n}=Math;function dC(e){return[+e[0],+e[1]]}function xI(e){return[dC(e[0]),dC(e[1])]}var Lx={name:"x",handles:["w","e"].map(Sp),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]]}},Cx={name:"y",handles:["n","s"].map(Sp),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]]}},uG={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Sp),input:function(e){return e==null?null:xI(e)},output:function(e){return e}},Fs={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"},hC={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},pC={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},fG={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},dG={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Sp(e){return{type:e}}function hG(e){return!e.ctrlKey&&!e.button}function pG(){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 mG(){return navigator.maxTouchPoints||"ontouchstart"in this}function gI(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function yG(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function bI(){return _I(Lx)}function wI(){return _I(Cx)}function vI(){return _I(uG)}function _I(e){var t=pG,n=hG,r=mG,i=!0,o=Gc("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([Sp("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Fs.overlay).merge(y).each(function(){var b=gI(this).extent;Vt(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])}),g.selectAll(".selection").data([Sp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Fs.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=g.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 Fs[b.type]}),g.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(g,y,x){g.tween?g.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,I=e.input(typeof y=="function"?y.apply(this,arguments):y,w.extent),D=$r(_,I);function A(E){w.selection=E===1&&I===null?null:D(E),l.call(b),v.brush()}return _!==null&&I!==null?A:A(1)}):g.each(function(){var b=this,w=arguments,v=b.__brush,_=e.input(typeof y=="function"?y.apply(b,w):y,v.extent),I=u(b,w).beforestart();go(b),v.selection=_===null?null:_,l.call(b),I.start(x).brush(x).end(x)})},c.clear=function(g,y){c.move(g,null,y)};function l(){var g=Vt(this),y=gI(this).selection;y?(g.selectAll(".selection").style("display",null).attr("x",y[0][0]).attr("y",y[0][1]).attr("width",y[1][0]-y[0][0]).attr("height",y[1][1]-y[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?y[1][1]-y[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,y,x){var b=g.__brush.emitter;return b&&(!x||!b.clean)?b:new f(g,y,x)}function f(g,y,x){this.that=g,this.args=y,this.state=g.__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(g,y){return this.starting?(this.starting=!1,this.emit("start",g,y)):this.emit("brush",g),this},brush:function(g,y){return this.emit("brush",g,y),this},end:function(g,y){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,y)),this},emit:function(g,y,x){var b=Vt(this.that).datum();o.call(g,this.that,new mI(g,{sourceEvent:y,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,x=g.target.__data__.type,b=(i&&g.metaKey?x="overlay":x)==="selection"?uC:i&&g.altKey?zu:Uu,w=e===Cx?null:fG[x],v=e===Lx?null:dG[x],_=gI(y),I=_.extent,D=_.selection,A=I[0][0],E,T,O=I[0][1],C,S,M=I[1][0],N,F,R=I[1][1],k,$,P=0,U=0,W,tt=w&&v&&i&&g.shiftKey,nt,at,Y=Array.from(g.touches||[g],et=>{let ae=et.identifier;return et=kn(et,y),et.point0=et.slice(),et.identifier=ae,et});go(y);var rt=u(y,arguments,!0).beforestart();if(x==="overlay"){D&&(W=!0);let et=[Y[0],Y[1]||Y[0]];_.selection=D=[[E=e===Cx?A:$n(et[0][0],et[1][0]),C=e===Lx?O:$n(et[0][1],et[1][1])],[N=e===Cx?M:Rn(et[0][0],et[1][0]),k=e===Lx?R:Rn(et[0][1],et[1][1])]],Y.length>1&&kt(g)}else E=D[0][0],C=D[0][1],N=D[1][0],k=D[1][1];T=E,S=C,F=N,$=k;var j=Vt(y).attr("pointer-events","none"),H=j.selectAll(".overlay").attr("cursor",Fs[x]);if(g.touches)rt.moved=z,rt.ended=dt;else{var ot=Vt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Ht,!0).on("keyup.brush",Zt,!0),ap(g.view)}l.call(y),rt.start(g,b.name);function z(et){for(let ae of et.changedTouches||[et])for(let Sr of Y)Sr.identifier===ae.identifier&&(Sr.cur=kn(ae,y));if(tt&&!nt&&!at&&Y.length===1){let ae=Y[0];fC(ae.cur[0]-ae[0])>fC(ae.cur[1]-ae[1])?at=!0:nt=!0}for(let ae of Y)ae.cur&&(ae[0]=ae.cur[0],ae[1]=ae.cur[1]);W=!0,Bx(et),kt(et)}function kt(et){let ae=Y[0],Sr=ae.point0;var Wi;switch(P=ae[0]-Sr[0],U=ae[1]-Sr[1],b){case yI:case uC:{w&&(P=Rn(A-E,$n(M-N,P)),T=E+P,F=N+P),v&&(U=Rn(O-C,$n(R-k,U)),S=C+U,$=k+U);break}case Uu:{Y[1]?(w&&(T=Rn(A,$n(M,Y[0][0])),F=Rn(A,$n(M,Y[1][0])),w=1),v&&(S=Rn(O,$n(R,Y[0][1])),$=Rn(O,$n(R,Y[1][1])),v=1)):(w<0?(P=Rn(A-E,$n(M-E,P)),T=E+P,F=N):w>0&&(P=Rn(A-N,$n(M-N,P)),T=E,F=N+P),v<0?(U=Rn(O-C,$n(R-C,U)),S=C+U,$=k):v>0&&(U=Rn(O-k,$n(R-k,U)),S=C,$=k+U));break}case zu:{w&&(T=Rn(A,$n(M,E-P*w)),F=Rn(A,$n(M,N+P*w))),v&&(S=Rn(O,$n(R,C-U*v)),$=Rn(O,$n(R,k+U*v)));break}}F<T&&(w*=-1,Wi=E,E=N,N=Wi,Wi=T,T=F,F=Wi,x in hC&&H.attr("cursor",Fs[x=hC[x]])),$<S&&(v*=-1,Wi=C,C=k,k=Wi,Wi=S,S=$,$=Wi,x in pC&&H.attr("cursor",Fs[x=pC[x]])),_.selection&&(D=_.selection),nt&&(T=D[0][0],F=D[1][0]),at&&(S=D[0][1],$=D[1][1]),(D[0][0]!==T||D[0][1]!==S||D[1][0]!==F||D[1][1]!==$)&&(_.selection=[[T,S],[F,$]],l.call(y),rt.brush(et,b.name))}function dt(et){if(lC(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else cp(et.view,W),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);j.attr("pointer-events","all"),H.attr("cursor",Fs.overlay),_.selection&&(D=_.selection),yG(D)&&(_.selection=null,l.call(y)),rt.end(et,b.name)}function Ht(et){switch(et.keyCode){case 16:{tt=w&&v;break}case 18:{b===Uu&&(w&&(N=F-P*w,E=T+P*w),v&&(k=$-U*v,C=S+U*v),b=zu,kt(et));break}case 32:{(b===Uu||b===zu)&&(w<0?N=F-P:w>0&&(E=T-P),v<0?k=$-U:v>0&&(C=S-U),b=yI,H.attr("cursor",Fs.selection),kt(et));break}default:return}Bx(et)}function Zt(et){switch(et.keyCode){case 16:{tt&&(nt=at=tt=!1,kt(et));break}case 18:{b===zu&&(w<0?N=F:w>0&&(E=T),v<0?k=$:v>0&&(C=S),b=Uu,kt(et));break}case 32:{b===yI&&(et.altKey?(w&&(N=F-P*w,E=T+P*w),v&&(k=$-U*v,C=S+U*v),b=zu):(w<0?N=F:w>0&&(E=T),v<0?k=$:v>0&&(C=S),b=Uu),H.attr("cursor",Fs[x]),kt(et));break}default:return}Bx(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=xI(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:Ox(xI(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:Ox(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:Ox(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var SI=Math.PI,II=2*SI,el=1e-6,gG=II-el;function mC(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function xG(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return mC;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 ka=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?mC:xG(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>el)if(!(Math.abs(f*c-l*u)>el)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,g=h*h+p*p,y=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((SI-Math.acos((m+d-g)/(2*y*x)))/2),w=b/x,v=b/y;Math.abs(w-1)>el&&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)>el||Math.abs(this._y1-u)>el)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%II+II),d>gG?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>el&&this._append`A${r},${r},0,${+(d>=SI)},${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 yC(){return new ka}yC.prototype=ka.prototype;function er(e=3){return new ka(+e)}var bG=Array.prototype,kx=bG.slice;function gC(e,t){return e-t}function xC(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 xo=e=>()=>e;function bC(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=wG(e,t[n]))return i;return 0}function wG(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(vG(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function vG(e,t,n){var r;return _G(e,t,n)&&SG(e[r=+(e[0]===t[0])],n[r],t[r])}function _G(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function SG(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function wC(){}var Rs=[[],[[[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 Fa(){var e=1,t=1,n=Na,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(gC);else{let f=le(l,IG);for(u=Mn(...Nu(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),xC(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,g=d.length,y;m<g;++m)if(bC((y=d[m])[0],p)!==-1){y.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,g,y,x,b;for(p=m=-1,y=nl(l[0],u),Rs[y<<1].forEach(w);++p<e-1;)g=y,y=nl(l[p+1],u),Rs[g|y<<1].forEach(w);for(Rs[y<<0].forEach(w);++m<t-1;){for(p=-1,y=nl(l[m*e+e],u),x=nl(l[m*e],u),Rs[y<<1|x<<2].forEach(w);++p<e-1;)g=y,y=nl(l[m*e+e+p+1],u),b=x,x=nl(l[m*e+p+1],u),Rs[g|y<<1|x<<2|b<<3].forEach(w);Rs[y|x<<3].forEach(w)}for(p=-1,x=l[m*e]>=u,Rs[x<<2].forEach(w);++p<e-1;)b=x,x=nl(l[m*e+p+1],u),Rs[x<<2|b<<3].forEach(w);Rs[x<<3].forEach(w);function w(v){var _=[v[0][0]+p,v[0][1]+m],I=[v[1][0]+p,v[1][1]+m],D=a(_),A=a(I),E,T;(E=h[D])?(T=d[A])?(delete h[E.end],delete d[T.start],E===T?(E.ring.push(I),f(E.ring)):d[E.start]=h[T.end]={start:E.start,end:T.end,ring:E.ring.concat(T.ring)}):(delete h[E.end],E.ring.push(I),h[E.end=A]=E):(E=d[A])?(T=h[D])?(delete d[E.start],delete h[T.end],E===T?(E.ring.push(I),f(E.ring)):d[T.start]=h[E.end]={start:T.start,end:E.end,ring:T.ring.concat(E.ring)}):(delete d[E.start],E.ring.unshift(_),d[E.start=D]=E):d[D]=h[A]={start:D,end:A,ring:[_,I]}}}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,g=p|0,y=MI(u[g*e+m]);h>0&&h<e&&m===h&&(d[0]=vC(h,MI(u[g*e+m-1]),y,f)),p>0&&p<t&&g===p&&(d[1]=vC(p,MI(u[(g-1)*e+m]),y,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)?xo(kx.call(l)):xo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:wC,i):r===c},i}function IG(e){return isFinite(e)?e:NaN}function nl(e,t){return e==null?!1:+e>=t}function MI(e){return e==null||isNaN(e=+e)?-1/0:e}function vC(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 MG(e){return e[0]}function AG(e){return e[1]}function TG(){return 1}function AI(){var e=MG,t=AG,n=TG,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=xo(20);function f(x){var b=new Float32Array(c*l),w=Math.pow(2,-s),v=-1;for(let C of x){var _=(e(C,++v,x)+a)*w,I=(t(C,v,x)+a)*w,D=+n(C,v,x);if(D&&_>=0&&_<c&&I>=0&&I<l){var A=Math.floor(_),E=Math.floor(I),T=_-A-.5,O=I-E-.5;b[A+E*c]+=(1-T)*(1-O)*D,b[A+1+E*c]+=T*(1-O)*D,b[A+1+(E+1)*c]+=T*O*D,b[A+(E+1)*c]+=(1-T)*O*D}}return Qh({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=Mn(Number.MIN_VALUE,Wt(b)/v,w)),Fa().size([c,l]).thresholds(w.map(_=>_*v))(b).map((_,I)=>(_.value=+w[I],h(_)))}d.contours=function(x){var b=f(x),w=Fa().size([c,l]),v=Math.pow(2,2*s),_=I=>{I=+I;var D=h(w.contour(b,I*v));return D.value=I,D};return Object.defineProperty(_,"max",{get:()=>Wt(b)/v}),_};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(g)}function g(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function y(){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:xo(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:xo(+x),d):t},d.weight=function(x){return arguments.length?(n=typeof x=="function"?x:xo(+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,y()},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),y()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?xo(kx.call(x)):xo(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,y()},d}var Kt=11102230246251565e-32,We=134217729,Ip=(3+8*Kt)*Kt;function rl(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 Mp(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var EG=(3+16*Kt)*Kt,NG=(2+12*Kt)*Kt,DG=(9+64*Kt)*Kt*Kt,qu=V(4),_C=V(8),SC=V(12),IC=V(16),nr=V(4);function OG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,g,y,x,b,w,v,_,I,D,A=e-i,E=n-i,T=t-o,O=r-o;w=A*O,d=We*A,h=d-(d-A),p=A-h,d=We*O,m=d-(d-O),g=O-m,v=p*g-(w-h*m-p*m-h*g),_=T*E,d=We*T,h=d-(d-T),p=T-h,d=We*E,m=d-(d-E),g=E-m,I=p*g-(_-h*m-p*m-h*g),y=v-I,f=v-y,qu[0]=v-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-_,f=b-y,qu[1]=b-(y+f)+(f-_),D=x+y,f=D-x,qu[2]=x-(D-f)+(y-f),qu[3]=D;let C=Mp(4,qu),S=NG*s;if(C>=S||-C>=S||(f=e-A,a=e-(A+f)+(f-i),f=n-E,l=n-(E+f)+(f-i),f=t-T,c=t-(T+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=DG*s+Ip*Math.abs(C),C+=A*u+O*a-(T*l+E*c),C>=S||-C>=S))return C;w=a*O,d=We*a,h=d-(d-a),p=a-h,d=We*O,m=d-(d-O),g=O-m,v=p*g-(w-h*m-p*m-h*g),_=c*E,d=We*c,h=d-(d-c),p=c-h,d=We*E,m=d-(d-E),g=E-m,I=p*g-(_-h*m-p*m-h*g),y=v-I,f=v-y,nr[0]=v-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-_,f=b-y,nr[1]=b-(y+f)+(f-_),D=x+y,f=D-x,nr[2]=x-(D-f)+(y-f),nr[3]=D;let M=rl(4,qu,4,nr,_C);w=A*u,d=We*A,h=d-(d-A),p=A-h,d=We*u,m=d-(d-u),g=u-m,v=p*g-(w-h*m-p*m-h*g),_=T*l,d=We*T,h=d-(d-T),p=T-h,d=We*l,m=d-(d-l),g=l-m,I=p*g-(_-h*m-p*m-h*g),y=v-I,f=v-y,nr[0]=v-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-_,f=b-y,nr[1]=b-(y+f)+(f-_),D=x+y,f=D-x,nr[2]=x-(D-f)+(y-f),nr[3]=D;let N=rl(M,_C,4,nr,SC);w=a*u,d=We*a,h=d-(d-a),p=a-h,d=We*u,m=d-(d-u),g=u-m,v=p*g-(w-h*m-p*m-h*g),_=c*l,d=We*c,h=d-(d-c),p=c-h,d=We*l,m=d-(d-l),g=l-m,I=p*g-(_-h*m-p*m-h*g),y=v-I,f=v-y,nr[0]=v-(y+f)+(f-I),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-_,f=b-y,nr[1]=b-(y+f)+(f-_),D=x+y,f=D-x,nr[2]=x-(D-f)+(y-f),nr[3]=D;let F=rl(N,SC,4,nr,IC);return IC[F-1]}function ju(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)>=EG*l?c:-OG(e,t,n,r,i,o,l)}var n_t=(7+56*Kt)*Kt,r_t=(3+28*Kt)*Kt,i_t=(26+288*Kt)*Kt*Kt,o_t=V(4),s_t=V(4),a_t=V(4),c_t=V(4),l_t=V(4),u_t=V(4),f_t=V(4),d_t=V(4),h_t=V(4),p_t=V(8),m_t=V(8),y_t=V(8),g_t=V(4),x_t=V(8),b_t=V(8),w_t=V(8),v_t=V(12),__t=V(192),S_t=V(192);var A_t=(10+96*Kt)*Kt,T_t=(4+48*Kt)*Kt,E_t=(44+576*Kt)*Kt*Kt,N_t=V(4),D_t=V(4),O_t=V(4),B_t=V(4),L_t=V(4),C_t=V(4),k_t=V(4),F_t=V(4),R_t=V(8),$_t=V(8),P_t=V(8),U_t=V(8),z_t=V(8),q_t=V(8),j_t=V(8),V_t=V(8),Y_t=V(8),X_t=V(4),G_t=V(4),W_t=V(4),H_t=V(8),Z_t=V(16),J_t=V(16),Q_t=V(16),K_t=V(32),t2t=V(32),e2t=V(48),n2t=V(64),r2t=V(1152),i2t=V(1152);var c2t=(16+224*Kt)*Kt,l2t=(5+72*Kt)*Kt,u2t=(71+1408*Kt)*Kt*Kt,f2t=V(4),d2t=V(4),h2t=V(4),p2t=V(4),m2t=V(4),y2t=V(4),g2t=V(4),x2t=V(4),b2t=V(4),w2t=V(4),v2t=V(24),_2t=V(24),S2t=V(24),I2t=V(24),M2t=V(24),A2t=V(24),T2t=V(24),E2t=V(24),N2t=V(24),D2t=V(24),O2t=V(1152),B2t=V(1152),L2t=V(1152),C2t=V(1152),k2t=V(1152),F2t=V(2304),R2t=V(2304),$2t=V(3456),P2t=V(5760),U2t=V(8),z2t=V(8),q2t=V(8),j2t=V(16),V2t=V(24),Y2t=V(48),X2t=V(48),G2t=V(96),W2t=V(192),H2t=V(384),Z2t=V(384),J2t=V(384),Q2t=V(768);var K2t=V(96),tSt=V(96),eSt=V(96),nSt=V(1152);var AC=Math.pow(2,-52),Fx=new Uint32Array(512),Yu=class e{static from(t,n=RG,r=$G){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 A=0;A<s;A++){let E=t[2*A],T=t[2*A+1];E<a&&(a=E),T<c&&(c=T),E>l&&(l=E),T>u&&(u=T),this._ids[A]=A}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let A=0,E=1/0;A<s;A++){let T=TI(f,d,t[2*A],t[2*A+1]);T<E&&(h=A,E=T)}let g=t[2*h],y=t[2*h+1];for(let A=0,E=1/0;A<s;A++){if(A===h)continue;let T=TI(g,y,t[2*A],t[2*A+1]);T<E&&T>0&&(p=A,E=T)}let x=t[2*p],b=t[2*p+1],w=1/0;for(let A=0;A<s;A++){if(A===h||A===p)continue;let E=kG(g,y,x,b,t[2*A],t[2*A+1]);E<w&&(m=A,w=E)}let v=t[2*m],_=t[2*m+1];if(w===1/0){for(let T=0;T<s;T++)this._dists[T]=t[2*T]-t[0]||t[2*T+1]-t[1];Vu(this._ids,this._dists,0,s-1);let A=new Uint32Array(s),E=0;for(let T=0,O=-1/0;T<s;T++){let C=this._ids[T],S=this._dists[C];S>O&&(A[E++]=C,O=S)}this.hull=A.subarray(0,E),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(ju(g,y,x,b,v,_)<0){let A=p,E=x,T=b;p=m,x=v,b=_,m=A,v=E,_=T}let I=FG(g,y,x,b,v,_);this._cx=I.x,this._cy=I.y;for(let A=0;A<s;A++)this._dists[A]=TI(t[2*A],t[2*A+1],I.x,I.y);Vu(this._ids,this._dists,0,s-1),this._hullStart=h;let D=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(g,y)]=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 A=0,E,T;A<this._ids.length;A++){let O=this._ids[A],C=t[2*O],S=t[2*O+1];if(A>0&&Math.abs(C-E)<=AC&&Math.abs(S-T)<=AC||(E=C,T=S,O===h||O===p||O===m))continue;let M=0;for(let $=0,P=this._hashKey(C,S);$<this._hashSize&&(M=o[(P+$)%this._hashSize],!(M!==-1&&M!==r[M]));$++);M=n[M];let N=M,F;for(;F=r[N],ju(C,S,t[2*N],t[2*N+1],t[2*F],t[2*F+1])>=0;)if(N=F,N===M){N=-1;break}if(N===-1)continue;let R=this._addTriangle(N,O,r[N],-1,-1,i[N]);i[O]=this._legalize(R+2),i[N]=R,D++;let k=r[N];for(;F=r[k],ju(C,S,t[2*k],t[2*k+1],t[2*F],t[2*F+1])<0;)R=this._addTriangle(k,O,F,i[O],-1,i[k]),i[O]=this._legalize(R+2),r[k]=k,D--,k=F;if(N===M)for(;F=n[N],ju(C,S,t[2*F],t[2*F+1],t[2*N],t[2*N+1])<0;)R=this._addTriangle(F,O,N,-1,i[N],i[F]),this._legalize(R+2),i[F]=R,r[N]=N,D--,N=F;this._hullStart=n[O]=N,r[N]=n[k]=O,r[O]=k,o[this._hashKey(C,S)]=O,o[this._hashKey(t[2*N],t[2*N+1])]=N}this.hull=new Uint32Array(D);for(let A=0,E=this._hullStart;A<D;A++)this.hull[A]=E,E=r[E];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(LG(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=Fx[--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(CG(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 y=r[f];if(y===-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,y),this._link(a,r[s]),this._link(s,f);let x=l+(a+1)%3;o<Fx.length&&(Fx[o++]=x)}else{if(o===0)break;t=Fx[--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 LG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function TI(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function CG(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,g=d*d+h*h;return c*(f*g-m*h)-l*(u*g-m*d)+p*(u*h-f*d)<0}function kG(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 FG(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 Vu(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;Ap(e,i,o),t[e[n]]>t[e[r]]&&Ap(e,n,r),t[e[o]]>t[e[r]]&&Ap(e,o,r),t[e[n]]>t[e[o]]&&Ap(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;Ap(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Vu(e,t,o,r),Vu(e,t,n,s-1)):(Vu(e,t,n,s-1),Vu(e,t,o,r))}}function Ap(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function RG(e){return e[0]}function $G(e){return e[1]}var ai=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 Ra=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 Tp=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,g=0,y=r.length,x,b;m<y;m+=3,g+=2){let w=r[m]*2,v=r[m+1]*2,_=r[m+2]*2,I=t[w],D=t[w+1],A=t[v],E=t[v+1],T=t[_],O=t[_+1],C=A-I,S=E-D,M=T-I,N=O-D,F=(C*N-S*M)*2;if(Math.abs(F)<1e-9){if(o===void 0){o=s=0;for(let k of n)o+=t[k*2],s+=t[k*2+1];o/=n.length,s/=n.length}let R=1e9*Math.sign((o-I)*N-(s-D)*M);x=(I+T)/2-R*N,b=(D+O)/2+R*M}else{let R=1/F,k=C*C+S*S,$=M*M+N*N;x=I+(N*k-S*$)*R,b=D+(C*$-M*k)*R}a[g]=x,a[g+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 ai: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],g=s[h+1],y=s[p],x=s[p+1];this._renderSegment(m,g,y,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 ai: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 ai: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 Ra;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,g,y,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,g,y,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[y,x,m,g]=p,f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}f=d,d=this._edgecode(y,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,x):i=[y,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 PG=2*Math.PI,Xu=Math.pow;function UG(e){return e[0]}function zG(e){return e[1]}function qG(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 jG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var Pn=class e{static from(t,n=UG,r=zG,i){return new e("length"in t?VG(t,n,r,i):Float64Array.from(YG(t,n,r,i)))}constructor(t){this._delaunator=new Yu(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&&qG(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=jG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Yu(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 Tp(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=Xu(n-l[t*2],2)+Xu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=Xu(n-l[p*2],2)+Xu(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&&Xu(n-l[h*2],2)+Xu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new ai: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 ai: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,PG)}return r&&r.value()}renderHull(t){let n=t==null?t=new ai: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 Ra;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new ai: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 Ra;return this.renderTriangle(t,n),n.value()}};function VG(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*YG(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 TC(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function il(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 bo(e){return e=il(Math.abs(e)),e?e[1]:NaN}function EC(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 NC(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var XG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wo(e){if(!(t=XG.exec(e)))throw new Error("invalid format: "+e);var t;return new Rx({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]})}wo.prototype=Rx.prototype;function Rx(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+""}Rx.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 DC(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 EI;function OC(e,t){var n=il(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(EI=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")+il(e,Math.max(0,t+o-1))[0]}function NI(e,t){var n=il(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 DI={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:TC,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)=>NI(e*100,t),r:NI,s:OC,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function OI(e){return e}var BC=Array.prototype.map,LC=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function CC(e){var t=e.grouping===void 0||e.thousands===void 0?OI:EC(BC.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?OI:NC(BC.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=wo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,g=f.zero,y=f.width,x=f.comma,b=f.precision,w=f.trim,v=f.type;v==="n"?(x=!0,v="g"):DI[v]||(b===void 0&&(b=12),w=!0,v="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",I=m==="$"?r:/[%p]/.test(v)?s:"",D=DI[v],A=/[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 E(T){var O=_,C=I,S,M,N;if(v==="c")C=D(T)+C,T="";else{T=+T;var F=T<0||1/T<0;if(T=isNaN(T)?c:D(Math.abs(T),b),w&&(T=DC(T)),F&&+T==0&&p!=="+"&&(F=!1),O=(F?p==="("?p:a:p==="-"||p==="("?"":p)+O,C=(v==="s"?LC[8+EI/3]:"")+C+(F&&p==="("?")":""),A){for(S=-1,M=T.length;++S<M;)if(N=T.charCodeAt(S),48>N||N>57){C=(N===46?i+T.slice(S+1):T.slice(S))+C,T=T.slice(0,S);break}}}x&&!g&&(T=t(T,1/0));var R=O.length+T.length+C.length,k=R<y?new Array(y-R+1).join(d):"";switch(x&&g&&(T=t(k+T,k.length?y-C.length:1/0),k=""),h){case"<":T=O+T+C+k;break;case"=":T=O+k+T+C;break;case"^":T=k.slice(0,R=k.length>>1)+O+T+C+k.slice(R);break;default:T=k+O+T+C;break}return o(T)}return E.toString=function(){return f+""},E}function u(f,d){var h=l((f=wo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(bo(d)/3)))*3,m=Math.pow(10,-p),g=LC[8+p/3];return function(y){return h(m*y)+g}}return{format:l,formatPrefix:u}}var $x,ci,Px;BI({thousands:",",grouping:[3],currency:["$",""]});function BI(e){return $x=CC(e),ci=$x.format,Px=$x.formatPrefix,$x}function LI(e){return Math.max(0,-bo(Math.abs(e)))}function CI(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bo(t)/3)))*3-bo(Math.abs(e)))}function kI(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bo(t)-bo(e))+1}var K=1e-6,ol=1e-12,Ot=Math.PI,me=Ot/2,FI=Ot/4,ln=Ot*2,Re=180/Ot,Yt=Ot/180,Rt=Math.abs,li=Math.atan,He=Math.atan2,Q=Math.cos,Ep=Math.ceil,Ux=Math.exp;var zx=Math.hypot,sl=Math.log,qx=Math.pow,J=Math.sin,Un=Math.sign||function(e){return e>0?1:e<0?-1:0},ye=Math.sqrt,Gu=Math.tan;function jx(e){return e>1?0:e<-1?Ot:Math.acos(e)}function Se(e){return e>1?me:e<-1?-me:Math.asin(e)}function Ze(){}function Vx(e,t){e&&FC.hasOwnProperty(e.type)&&FC[e.type](e,t)}var kC={Feature:function(e,t){Vx(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Vx(n[r].geometry,t)}},FC={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){RI(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)RI(n[r],t,0)},Polygon:function(e,t){RC(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)RC(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Vx(n[r],t)}};function RI(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 RC(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)RI(e[n],t,1);t.polygonEnd()}function Pr(e,t){e&&kC.hasOwnProperty(e.type)?kC[e.type](e,t):Vx(e,t)}function Np(e){return[He(e[1],e[0]),Se(e[2])]}function vo(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*J(t),J(n)]}function Dp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Wu(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 Yx(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Op(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Bp(e){var t=ye(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Lp,Xx,Gx,Wx,Hx,Zx,Jx,Qx,$I,PI,UI,UC,zC,rr,ir,or,zi={sphere:Ze,point:zI,lineStart:$C,lineEnd:PC,polygonStart:function(){zi.lineStart=HG,zi.lineEnd=ZG},polygonEnd:function(){zi.lineStart=$C,zi.lineEnd=PC}};function zI(e,t){e*=Yt,t*=Yt;var n=Q(t);Cp(n*Q(e),n*J(e),J(t))}function Cp(e,t,n){++Lp,Gx+=(e-Gx)/Lp,Wx+=(t-Wx)/Lp,Hx+=(n-Hx)/Lp}function $C(){zi.point=GG}function GG(e,t){e*=Yt,t*=Yt;var n=Q(t);rr=n*Q(e),ir=n*J(e),or=J(t),zi.point=WG,Cp(rr,ir,or)}function WG(e,t){e*=Yt,t*=Yt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=He(ye((s=ir*o-or*i)*s+(s=or*r-rr*o)*s+(s=rr*i-ir*r)*s),rr*r+ir*i+or*o);Xx+=s,Zx+=s*(rr+(rr=r)),Jx+=s*(ir+(ir=i)),Qx+=s*(or+(or=o)),Cp(rr,ir,or)}function PC(){zi.point=zI}function HG(){zi.point=JG}function ZG(){qC(UC,zC),zi.point=zI}function JG(e,t){UC=e,zC=t,e*=Yt,t*=Yt,zi.point=qC;var n=Q(t);rr=n*Q(e),ir=n*J(e),or=J(t),Cp(rr,ir,or)}function qC(e,t){e*=Yt,t*=Yt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=ir*o-or*i,a=or*r-rr*o,c=rr*i-ir*r,l=zx(s,a,c),u=Se(l),f=l&&-u/l;$I.add(f*s),PI.add(f*a),UI.add(f*c),Xx+=u,Zx+=u*(rr+(rr=r)),Jx+=u*(ir+(ir=i)),Qx+=u*(or+(or=o)),Cp(rr,ir,or)}function qI(e){Lp=Xx=Gx=Wx=Hx=Zx=Jx=Qx=0,$I=new In,PI=new In,UI=new In,Pr(e,zi);var t=+$I,n=+PI,r=+UI,i=zx(t,n,r);return i<ol&&(t=Zx,n=Jx,r=Qx,Xx<K&&(t=Gx,n=Wx,r=Hx),i=zx(t,n,r),i<ol)?[NaN,NaN]:[He(n,t)*Re,Se(r/i)*Re]}function kp(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 jI(e,t){return Rt(e)>Ot&&(e-=Math.round(e/ln)*ln),[e,t]}jI.invert=jI;function VI(e,t,n){return(e%=ln)?t||n?kp(VC(e),YC(t,n)):VC(e):t||n?YC(t,n):jI}function jC(e){return function(t,n){return t+=e,Rt(t)>Ot&&(t-=Math.round(t/ln)*ln),[t,n]}}function VC(e){var t=jC(e);return t.invert=jC(-e),t}function YC(e,t){var n=Q(e),r=J(e),i=Q(t),o=J(t);function s(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*n+u*r;return[He(f*i-h*o,u*n-d*r),Se(h*i+f*o)]}return s.invert=function(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*i-f*o;return[He(f*i+d*o,u*n+h*r),Se(h*n-u*r)]},s}function XC(e){e=VI(e[0]*Yt,e[1]*Yt,e.length>2?e[2]*Yt:0);function t(n){return n=e(n[0]*Yt,n[1]*Yt),n[0]*=Re,n[1]*=Re,n}return t.invert=function(n){return n=e.invert(n[0]*Yt,n[1]*Yt),n[0]*=Re,n[1]*=Re,n},t}function WC(e,t,n,r,i,o){if(n){var s=Q(t),a=J(t),c=r*n;i==null?(i=t+r*ln,o=t-c/2):(i=GC(s,i),o=GC(s,o),(r>0?i<o:i>o)&&(i+=r*ln));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Np([s,-a*Q(u),-a*J(u)]),e.point(l[0],l[1])}}function GC(e,t){t=vo(t),t[0]-=e,Bp(t);var n=jx(-t[1]);return((-t[2]<0?-n:n)+ln-K)%ln}function Kx(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Ze,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Hu(e,t){return Rt(e[0]-t[0])<K&&Rt(e[1]-t[1])<K}function tb(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 eb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,g=p[0],y=p[m],x;if(Hu(g,y)){if(!g[2]&&!y[2]){for(i.lineStart(),a=0;a<m;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}y[0]+=2*K}o.push(x=new tb(g,p,null,!0)),s.push(x.o=new tb(g,null,x,!1)),o.push(x=new tb(y,p,null,!1)),s.push(x.o=new tb(y,null,x,!0))}}),!!o.length){for(s.sort(t),HC(o),HC(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 HC(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 YI(e){return Rt(e[0])<=Ot?e[0]:Un(e[0])*((Rt(e[0])+Ot)%ln-Ot)}function ZC(e,t){var n=YI(t),r=t[1],i=J(r),o=[J(n),-Q(n),0],s=0,a=0,c=new In;i===1?r=me+K:i===-1&&(r=-me-K);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=YI(h),m=h[1]/2+FI,g=J(m),y=Q(m),x=0;x<d;++x,p=w,g=_,y=I,h=b){var b=f[x],w=YI(b),v=b[1]/2+FI,_=J(v),I=Q(v),D=w-p,A=D>=0?1:-1,E=A*D,T=E>Ot,O=g*_;if(c.add(He(O*A*J(E),y*I+O*Q(E))),s+=T?D+A*ln:D,T^p>=n^w>=n){var C=Wu(vo(h),vo(b));Bp(C);var S=Wu(o,C);Bp(S);var M=(T^D>=0?-1:1)*Se(S[2]);(r>M||r===M&&(C[0]||C[1]))&&(a+=T^D>=0?1:-1)}}return(s<-K||s<K&&c<-ol)^a&1}function nb(e,t,n,r){return function(i){var o=t(i),s=Kx(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,u=Du(u);var w=ZC(l,r);u.length?(c||(i.polygonStart(),c=!0),eb(u,KG,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 g(){d.point=h,o.lineEnd()}function y(w,v){f.push([w,v]),a.point(w,v)}function x(){a.lineStart(),f=[]}function b(){y(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),v=s.result(),_,I=v.length,D,A,E;if(f.pop(),l.push(f),f=null,!!I){if(w&1){if(A=v[0],(D=A.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),_=0;_<D;++_)i.point((E=A[_])[0],E[1]);i.lineEnd()}return}I>1&&w&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(QG))}}return d}}function QG(e){return e.length>1}function KG(e,t){return((e=e.x)[0]<0?e[1]-me-K:me-e[1])-((t=t.x)[0]<0?t[1]-me-K:me-t[1])}var XI=nb(function(){return!0},tW,nW,[-Ot,-me]);function tW(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Ot:-Ot,c=Rt(o-t);Rt(c-Ot)<K?(e.point(t,n=(n+s)/2>0?me:-me),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Ot&&(Rt(t-r)<K&&(t-=r*K),Rt(o-a)<K&&(o-=a*K),n=eW(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 eW(e,t,n,r){var i,o,s=J(e-n);return Rt(s)>K?li((J(t)*(o=Q(r))*J(n)-J(r)*(i=Q(t))*J(e))/(i*o*s)):(t+r)/2}function nW(e,t,n,r){var i;if(e==null)i=n*me,r.point(-Ot,i),r.point(0,i),r.point(Ot,i),r.point(Ot,0),r.point(Ot,-i),r.point(0,-i),r.point(-Ot,-i),r.point(-Ot,0),r.point(-Ot,i);else if(Rt(e[0]-t[0])>K){var o=e[0]<t[0]?Ot:-Ot;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function JC(e){var t=Q(e),n=6*Yt,r=t>0,i=Rt(t)>K;function o(u,f,d,h){WC(h,e,n,d,u,f)}function s(u,f){return Q(u)*Q(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(g,y){var x=[g,y],b,w=s(g,y),v=r?w?0:l(g,y):w?l(g+(g<0?Ot:-Ot),y):0;if(!f&&(p=h=w)&&u.lineStart(),w!==h&&(b=c(f,x),(!b||Hu(f,b)||Hu(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||!Hu(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=vo(u),p=vo(f),m=[1,0,0],g=Wu(h,p),y=Dp(g,g),x=g[0],b=y-x*x;if(!b)return!d&&u;var w=t*y/b,v=-t*x/b,_=Wu(m,g),I=Op(m,w),D=Op(g,v);Yx(I,D);var A=_,E=Dp(I,A),T=Dp(A,A),O=E*E-T*(Dp(I,I)-1);if(!(O<0)){var C=ye(O),S=Op(A,(-E-C)/T);if(Yx(S,I),S=Np(S),!d)return S;var M=u[0],N=f[0],F=u[1],R=f[1],k;N<M&&(k=M,M=N,N=k);var $=N-M,P=Rt($-Ot)<K,U=P||$<K;if(!P&&R<F&&(k=F,F=R,R=k),U?P?F+R>0^S[1]<(Rt(S[0]-M)<K?F:R):F<=S[1]&&S[1]<=R:$>Ot^(M<=S[0]&&S[0]<=N)){var W=Op(A,(-E+C)/T);return Yx(W,I),[S,Np(W)]}}}function l(u,f){var d=r?e:Ot-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return nb(s,a,o,r?[0,-e]:[-Ot,e-Ot])}function QC(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 Fp=1e9,rb=-Fp;function Zu(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 Rt(l[0]-e)<K?u>0?0:3:Rt(l[0]-n)<K?u>0?2:1:Rt(l[1]-t)<K?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=Kx(),d,h,p,m,g,y,x,b,w,v,_,I={point:D,lineStart:O,lineEnd:C,polygonStart:E,polygonEnd:T};function D(M,N){i(M,N)&&u.point(M,N)}function A(){for(var M=0,N=0,F=h.length;N<F;++N)for(var R=h[N],k=1,$=R.length,P=R[0],U,W,tt=P[0],nt=P[1];k<$;++k)U=tt,W=nt,P=R[k],tt=P[0],nt=P[1],W<=r?nt>r&&(tt-U)*(r-W)>(nt-W)*(e-U)&&++M:nt<=r&&(tt-U)*(r-W)<(nt-W)*(e-U)&&--M;return M}function E(){u=f,d=[],h=[],_=!0}function T(){var M=A(),N=_&&M,F=(d=Du(d)).length;(N||F)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),F&&eb(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){I.point=S,h&&h.push(p=[]),v=!0,w=!1,x=b=NaN}function C(){d&&(S(m,g),y&&w&&f.rejoin(),d.push(f.result())),I.point=D,w&&u.lineEnd()}function S(M,N){var F=i(M,N);if(h&&p.push([M,N]),v)m=M,g=N,y=F,v=!1,F&&(u.lineStart(),u.point(M,N));else if(F&&w)u.point(M,N);else{var R=[x=Math.max(rb,Math.min(Fp,x)),b=Math.max(rb,Math.min(Fp,b))],k=[M=Math.max(rb,Math.min(Fp,M)),N=Math.max(rb,Math.min(Fp,N))];QC(R,k,e,t,n,r)?(w||(u.lineStart(),u.point(R[0],R[1])),u.point(k[0],k[1]),F||u.lineEnd(),_=!1):F&&(u.lineStart(),u.point(M,N),_=!1)}x=M,b=N,w=F}return I}}function KC(e,t,n){var r=Ue(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function tk(e,t,n){var r=Ue(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function GI(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:x()}}function x(){return Ue(Ep(r/u)*u,n,u).map(p).concat(Ue(Ep(a/f)*f,s,f).map(m)).concat(Ue(Ep(t/c)*c,e,c).filter(function(b){return Rt(b%u)>K}).map(d)).concat(Ue(Ep(o/l)*l,i,l).filter(function(b){return Rt(b%f)>K}).map(h))}return y.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(b){return arguments.length?y.extentMajor(b).extentMinor(b):y.extentMinor()},y.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),y.precision(g)):[[r,a],[n,s]]},y.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),y.precision(g)):[[t,o],[e,i]]},y.step=function(b){return arguments.length?y.stepMajor(b).stepMinor(b):y.stepMinor()},y.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],y):[u,f]},y.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],y):[c,l]},y.precision=function(b){return arguments.length?(g=+b,d=KC(o,i,90),h=tk(t,e,g),p=KC(a,s,90),m=tk(r,n,g),y):g},y.extentMajor([[-180,-90+K],[180,90-K]]).extentMinor([[-180,-80-K],[180,80+K]])}function WI(){return GI()()}var Rp=e=>e;var HI=new In,ZI=new In,ek,nk,JI,QI,$a={point:Ze,lineStart:Ze,lineEnd:Ze,polygonStart:function(){$a.lineStart=rW,$a.lineEnd=oW},polygonEnd:function(){$a.lineStart=$a.lineEnd=$a.point=Ze,HI.add(Rt(ZI)),ZI=new In},result:function(){var e=HI/2;return HI=new In,e}};function rW(){$a.point=iW}function iW(e,t){$a.point=rk,ek=JI=e,nk=QI=t}function rk(e,t){ZI.add(QI*e-JI*t),JI=e,QI=t}function oW(){rk(ek,nk)}var KI=$a;var Ju=1/0,ib=Ju,$p=-Ju,ob=$p,sW={point:aW,lineStart:Ze,lineEnd:Ze,polygonStart:Ze,polygonEnd:Ze,result:function(){var e=[[Ju,ib],[$p,ob]];return $p=ob=-(ib=Ju=1/0),e}};function aW(e,t){e<Ju&&(Ju=e),e>$p&&($p=e),t<ib&&(ib=t),t>ob&&(ob=t)}var Qu=sW;var tM=0,eM=0,Pp=0,sb=0,ab=0,Ku=0,nM=0,rM=0,Up=0,sk,ak,_o,So,qi={point:al,lineStart:ik,lineEnd:ok,polygonStart:function(){qi.lineStart=uW,qi.lineEnd=fW},polygonEnd:function(){qi.point=al,qi.lineStart=ik,qi.lineEnd=ok},result:function(){var e=Up?[nM/Up,rM/Up]:Ku?[sb/Ku,ab/Ku]:Pp?[tM/Pp,eM/Pp]:[NaN,NaN];return tM=eM=Pp=sb=ab=Ku=nM=rM=Up=0,e}};function al(e,t){tM+=e,eM+=t,++Pp}function ik(){qi.point=cW}function cW(e,t){qi.point=lW,al(_o=e,So=t)}function lW(e,t){var n=e-_o,r=t-So,i=ye(n*n+r*r);sb+=i*(_o+e)/2,ab+=i*(So+t)/2,Ku+=i,al(_o=e,So=t)}function ok(){qi.point=al}function uW(){qi.point=dW}function fW(){ck(sk,ak)}function dW(e,t){qi.point=ck,al(sk=_o=e,ak=So=t)}function ck(e,t){var n=e-_o,r=t-So,i=ye(n*n+r*r);sb+=i*(_o+e)/2,ab+=i*(So+t)/2,Ku+=i,i=So*e-_o*t,nM+=i*(_o+e),rM+=i*(So+t),Up+=i*3,al(_o=e,So=t)}var iM=qi;function cb(e){this._context=e}cb.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,ln);break}}},result:Ze};var sM=new In,oM,lk,uk,zp,qp,lb={point:Ze,lineStart:function(){lb.point=hW},lineEnd:function(){oM&&fk(lk,uk),lb.point=Ze},polygonStart:function(){oM=!0},polygonEnd:function(){oM=null},result:function(){var e=+sM;return sM=new In,e}};function hW(e,t){lb.point=fk,lk=zp=e,uk=qp=t}function fk(e,t){zp-=e,qp-=t,sM.add(ye(zp*zp+qp*qp)),zp=e,qp=t}var aM=lb;var dk,ub,hk,pk,tf=class{constructor(t){this._append=t==null?mk:pW(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!==hk||this._append!==ub){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`,hk=r,ub=this._append,pk=this._,this._=i}this._+=pk;break}}}result(){let t=this._;return this._="",t.length?t:null}};function mk(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function pW(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return mk;if(t!==dk){let n=10**t;dk=t,ub=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 ub}function En(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Pr(a,i(o))),o.result()}return s.area=function(a){return Pr(a,i(KI)),KI.result()},s.measure=function(a){return Pr(a,i(aM)),aM.result()},s.bounds=function(a){return Pr(a,i(Qu)),Qu.result()},s.centroid=function(a){return Pr(a,i(iM)),iM.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Rp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new tf(n)):new cb(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 tf(n)),s},s.projection(e).digits(n).context(t)}function cl(e){return{stream:ef(e)}}function ef(e){return function(t){var n=new cM;for(var r in e)n[r]=e[r];return n.stream=t,n}}function cM(){}cM.prototype={constructor:cM,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 lM(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Pr(n,e.stream(Qu)),t(Qu.result()),r!=null&&e.clipExtent(r),e}function jp(e,t,n){return lM(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 fb(e,t,n){return jp(e,[[0,0],t],n)}function db(e,t,n){return lM(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 hb(e,t,n){return lM(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 yk=16,mW=Q(30*Yt);function uM(e,t){return+t?gW(e,t):yW(e)}function yW(e){return ef({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function gW(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,g){var y=l-r,x=u-i,b=y*y+x*x;if(b>4*t&&m--){var w=s+d,v=a+h,_=c+p,I=ye(w*w+v*v+_*_),D=Se(_/=I),A=Rt(Rt(_)-1)<K||Rt(o-f)<K?(o+f)/2:He(v,w),E=e(A,D),T=E[0],O=E[1],C=T-r,S=O-i,M=x*C-y*S;(M*M/b>t||Rt((y*C+x*S)/b-.5)>.3||s*d+a*h+c*p<mW)&&(n(r,i,o,s,a,c,T,O,A,w/=I,v/=I,_,m,g),g.point(T,O),n(T,O,A,w,v,_,l,u,f,d,h,p,m,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,g={point:y,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),g.lineStart=v},polygonEnd:function(){r.polygonEnd(),g.lineStart=x}};function y(D,A){D=e(D,A),r.point(D[0],D[1])}function x(){f=NaN,g.point=b,r.lineStart()}function b(D,A){var E=vo([D,A]),T=e(D,A);n(f,d,u,h,p,m,f=T[0],d=T[1],u=D,h=E[0],p=E[1],m=E[2],yk,r),r.point(f,d)}function w(){g.point=y,r.lineEnd()}function v(){x(),g.point=_,g.lineEnd=I}function _(D,A){b(i=D,A),o=f,s=d,a=h,c=p,l=m,g.point=b}function I(){n(f,d,u,h,p,m,o,s,i,a,c,l,yk,r),g.lineEnd=w,w()}return g}}var xW=ef({point:function(e,t){this.stream.point(e*Yt,t*Yt)}});function bW(e){return ef({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function wW(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 gk(e,t,n,r,i,o){if(!o)return wW(e,t,n,r,i);var s=Q(o),a=J(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,g){return m*=r,g*=i,[c*m-l*g+t,n-l*m-c*g]}return p.invert=function(m,g){return[r*(u*m-f*g+d),i*(h-f*m-u*g)]},p}function Nn(e){return fM(function(){return e})()}function fM(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=XI,g=null,y,x,b,w=Rp,v=.5,_,I,D,A,E;function T(M){return D(M[0]*Yt,M[1]*Yt)}function O(M){return M=D.invert(M[0],M[1]),M&&[M[0]*Re,M[1]*Re]}T.stream=function(M){return A&&E===M?A:A=xW(bW(u)(m(_(w(E=M)))))},T.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},T.postclip=function(M){return arguments.length?(w=M,g=y=x=b=null,S()):w},T.clipAngle=function(M){return arguments.length?(m=+M?JC(p=M*Yt):(p=null,XI),S()):p*Re},T.clipExtent=function(M){return arguments.length?(w=M==null?(g=y=x=b=null,Rp):Zu(g=+M[0][0],y=+M[0][1],x=+M[1][0],b=+M[1][1]),S()):g==null?null:[[g,y],[x,b]]},T.scale=function(M){return arguments.length?(n=+M,C()):n},T.translate=function(M){return arguments.length?(r=+M[0],i=+M[1],C()):[r,i]},T.center=function(M){return arguments.length?(o=M[0]%360*Yt,s=M[1]%360*Yt,C()):[o*Re,s*Re]},T.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*Re,c*Re,l*Re]},T.angle=function(M){return arguments.length?(f=M%360*Yt,C()):f*Re},T.reflectX=function(M){return arguments.length?(d=M?-1:1,C()):d<0},T.reflectY=function(M){return arguments.length?(h=M?-1:1,C()):h<0},T.precision=function(M){return arguments.length?(_=uM(I,v=M*M),S()):ye(v)},T.fitExtent=function(M,N){return jp(T,M,N)},T.fitSize=function(M,N){return fb(T,M,N)},T.fitWidth=function(M,N){return db(T,M,N)},T.fitHeight=function(M,N){return hb(T,M,N)};function C(){var M=gk(n,0,0,d,h,f).apply(null,t(o,s)),N=gk(n,r-M[0],i-M[1],d,h,f);return u=VI(a,c,l),I=kp(t,N),D=kp(u,I),_=uM(I,v),S()}function S(){return A=E=null,T}return function(){return t=e.apply(this,arguments),T.invert=t.invert&&O,C()}}function nf(e){var t=0,n=Ot/3,r=fM(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*Yt,n=o[1]*Yt):[t*Re,n*Re]},i}function xk(e){var t=Q(e);function n(r,i){return[r*t,J(i)/t]}return n.invert=function(r,i){return[r/t,Se(i*t)]},n}function bk(e,t){var n=J(e),r=(n+J(t))/2;if(Rt(r)<K)return xk(e);var i=1+n*(2*r-n),o=ye(i)/r;function s(a,c){var l=ye(i-2*r*J(c))/r;return[l*J(a*=r),o-l*Q(a)]}return s.invert=function(a,c){var l=o-c,u=He(a,Rt(l))*Un(l);return l*r<0&&(u-=Ot*Un(a)*Un(l)),[u/r,Se((i-(a*a+l*l)*r*r)/(2*r))]},s}function Pa(){return nf(bk).scale(155.424).center([0,33.6442])}function Vp(){return Pa().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function vW(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 dM(){var e,t,n=Vp(),r,i=Pa().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Pa().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,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?i:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=vW([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+K,m+.12*h+K],[p-.214*h-K,m+.234*h-K]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+K,m+.166*h+K],[p-.115*h-K,m+.234*h-K]]).stream(l),f()},u.fitExtent=function(d,h){return jp(u,d,h)},u.fitSize=function(d,h){return fb(u,d,h)},u.fitWidth=function(d,h){return db(u,d,h)},u.fitHeight=function(d,h){return hb(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function pb(e){return function(t,n){var r=Q(t),i=Q(n),o=e(r*i);return o===1/0?[2,0]:[o*i*J(t),o*J(n)]}}function Io(e){return function(t,n){var r=ye(t*t+n*n),i=e(r),o=J(i),s=Q(i);return[He(t*o,r*s),Se(r&&n*o/r)]}}var hM=pb(function(e){return ye(2/(1+e))});hM.invert=Io(function(e){return 2*Se(e/2)});function pM(){return Nn(hM).scale(124.75).clipAngle(180-.001)}var mM=pb(function(e){return(e=jx(e))&&e/J(e)});mM.invert=Io(function(e){return e});function yM(){return Nn(mM).scale(79.4188).clipAngle(180-.001)}function rf(e,t){return[e,sl(Gu((me+t)/2))]}rf.invert=function(e,t){return[e,2*li(Ux(t))-me]};function gM(){return xM(rf).scale(961/ln)}function xM(e){var t=Nn(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=Ot*r(),d=t(XC(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===rf?[[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 mb(e){return Gu((me+e)/2)}function wk(e,t){var n=Q(e),r=e===t?J(e):sl(n/Q(t))/sl(mb(t)/mb(e)),i=n*qx(mb(e),r)/r;if(!r)return rf;function o(s,a){i>0?a<-me+K&&(a=-me+K):a>me-K&&(a=me-K);var c=i/qx(mb(a),r);return[c*J(r*s),i-c*Q(r*s)]}return o.invert=function(s,a){var c=i-a,l=Un(r)*ye(s*s+c*c),u=He(s,Rt(c))*Un(c);return c*r<0&&(u-=Ot*Un(s)*Un(c)),[u/r,2*li(qx(i/l,1/r))-me]},o}function bM(){return nf(wk).scale(109.5).parallels([30,30])}function of(e,t){return[e,t]}of.invert=of;function wM(){return Nn(of).scale(152.63)}function vk(e,t){var n=Q(e),r=e===t?J(e):(n-Q(t))/(t-e),i=n/r+e;if(Rt(r)<K)return of;function o(s,a){var c=i-a,l=r*s;return[c*J(l),i-c*Q(l)]}return o.invert=function(s,a){var c=i-a,l=He(s,Rt(c))*Un(c);return c*r<0&&(l-=Ot*Un(s)*Un(c)),[l/r,i-Un(r)*ye(s*s+c*c)]},o}function vM(){return nf(vk).scale(131.154).center([0,13.9389])}var Yp=1.340264,Xp=-.081106,Gp=893e-6,Wp=.003796,yb=ye(3)/2,_W=12;function _M(e,t){var n=Se(yb*J(t)),r=n*n,i=r*r*r;return[e*Q(n)/(yb*(Yp+3*Xp*r+i*(7*Gp+9*Wp*r))),n*(Yp+Xp*r+i*(Gp+Wp*r))]}_M.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<_W&&(a=n*(Yp+Xp*r+i*(Gp+Wp*r))-t,c=Yp+3*Xp*r+i*(7*Gp+9*Wp*r),n-=s=a/c,r=n*n,i=r*r*r,!(Rt(s)<ol));++o);return[yb*e*(Yp+3*Xp*r+i*(7*Gp+9*Wp*r))/Q(n),Se(J(n)/yb)]};function SM(){return Nn(_M).scale(177.158)}function IM(e,t){var n=Q(t),r=Q(e)*n;return[n*J(e)/r,J(t)/r]}IM.invert=Io(li);function MM(){return Nn(IM).scale(144.049).clipAngle(60)}function AM(e,t){return[Q(t)*J(e),J(t)]}AM.invert=Io(Se);function TM(){return Nn(AM).scale(249.5).clipAngle(90+K)}function EM(e,t){var n=Q(t),r=1+Q(e)*n;return[n*J(e)/r,J(t)/r]}EM.invert=Io(function(e){return 2*li(e)});function NM(){return Nn(EM).scale(250).clipAngle(142)}function DM(e,t){return[sl(Gu((me+t)/2)),-e]}DM.invert=function(e,t){return[-t,2*li(Ux(e))-me]};function OM(){var e=xM(DM),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 SW(e,t){return e.parent===t.parent?1:2}function IW(e){return e.reduce(MW,0)/e.length}function MW(e,t){return e+t.x}function AW(e){return 1+e.reduce(TW,0)}function TW(e,t){return Math.max(e,t.y)}function EW(e){for(var t;t=e.children;)e=t[0];return e}function NW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function gb(){var e=SW,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=IW(h),d.y=AW(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=EW(o),l=NW(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 DW(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 _k(){return this.eachAfter(DW)}function Sk(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function Ik(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 Mk(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 Ak(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function Tk(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 Ek(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Nk(e){for(var t=this,n=OW(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 OW(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 Dk(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Ok(){return Array.from(this)}function Bk(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function Lk(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*Ck(){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 BM(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=CW)):t===void 0&&(t=LW);for(var n=new Ua(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 Ua(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(LM)}function BW(){return BM(this).eachBefore(kW)}function LW(e){return e.children}function CW(e){return Array.isArray(e)?e[1]:null}function kW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function LM(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Ua(e){this.data=e,this.depth=this.height=0,this.parent=null}Ua.prototype=BM.prototype={constructor:Ua,count:_k,each:Sk,eachAfter:Mk,eachBefore:Ik,find:Ak,sum:Tk,sort:Ek,path:Nk,ancestors:Dk,descendants:Ok,leaves:Bk,links:Lk,copy:BW,[Symbol.iterator]:Ck};function xb(e){return e==null?null:FW(e)}function FW(e){if(typeof e!="function")throw new Error;return e}var RW={depth:-1},kk={},CM={};function $W(e){return e.id}function PW(e){return e.parentId}function bb(){var e=$W,t=PW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,g=new Map;if(n!=null){let y=o.map((w,v)=>UW(n(w,v,i))),x=y.map(Fk),b=new Set(y).add("");for(let w of x)b.has(w)||(b.add(w),y.push(w),x.push(Fk(w)),o.push(CM));s=(w,v)=>y[v],a=(w,v)=>x[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Ua(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,g.set(m,g.has(m)?kk: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=g.get(p),!d)throw new Error("missing: "+p);if(d===kk)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===CM&&f.children.length===1;)f=f.children[0],--c;for(let y=o.length-1;y>=0&&(h=o[y],h.data===CM);--y)h.data=null}if(f.parent=RW,f.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(LM),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=xb(i),r):e},r.parentId=function(i){return arguments.length?(t=xb(i),r):t},r.path=function(i){return arguments.length?(n=xb(i),r):n},r}function UW(e){e=`${e}`;let t=e.length;return kM(e,t-1)&&!kM(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Fk(e){let t=e.length;if(t<2)return"";for(;--t>1&&!kM(e,t););return e.slice(0,t)}function kM(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function zW(e,t){return e.parent===t.parent?1:2}function FM(e){var t=e.children;return t?t[0]:e.t}function RM(e){var t=e.children;return t?t[t.length-1]:e.t}function qW(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 jW(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 VW(e,t,n){return e.a.parent===t.parent?e.a:n}function wb(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}wb.prototype=Object.create(Ua.prototype);function YW(e){for(var t=new wb(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 wb(o[s],s)),i.parent=n;return(t.parent=new wb(null,0)).children=[t],t}function ll(){var e=zW,t=1,n=1,r=null;function i(l){var u=YW(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,g=t/(d.x+p+m),y=n/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*g,x.y=x.depth*y})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){jW(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],g=d.m,y=h.m,x=p.m,b=m.m,w;p=RM(p),d=FM(d),p&&d;)m=FM(m),h=RM(h),h.a=l,w=p.z+x-d.z-g+e(p._,d._),w>0&&(qW(VW(p,l,f),l,w),g+=w,y+=w),x+=p.m,g+=d.m,b+=m.m,y+=h.m;p&&!RM(h)&&(h.t=p,h.m+=x-y),d&&!FM(m)&&(m.t=d,m.m+=g-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 Rk=23283064365386963e-26;function Mo(e=Math.random()){let t=(0<=e&&e<1?e/Rk:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,Rk*(t>>>0))}function Je(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Hp(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 Zp=Symbol("implicit");function ul(){var e=new Zn,t=[],n=[],r=Zp;function i(o){let s=e.get(o);if(s===void 0){if(r!==Zp)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 Zn;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 ul(t,n).unknown(r)},Je.apply(i,arguments),i}function za(){var e=ul().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 g=Ue(d).map(function(y){return p+o*y});return n(h?g.reverse():g)}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 za(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Je.apply(f(),arguments)}function $k(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return $k(t())},e}function $M(){return $k(za.apply(null,arguments).paddingInner(1))}function PM(e){return function(){return e}}function sf(e){return+e}var Pk=[0,1];function wr(e){return e}function UM(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:PM(isNaN(t)?NaN:.5)}function XW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function GW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=UM(i,r),o=n(s,o)):(r=UM(r,i),o=n(o,s)),function(a){return o(r(a))}}function WW(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]=UM(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Ts(e,a,1,r)-1;return o[c](i[c](a))}}function Ao(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function fl(){var e=Pk,t=Pk,n=$r,r,i,o,s=wr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==wr&&(s=XW(e[0],e[d-1])),a=d>2?WW:GW,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),_e)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,sf),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=Kc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:wr,u()):s!==wr},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 Jp(){return fl()(wr,wr)}function zM(e,t,n,r){var i=Eu(e,t,n),o;switch(r=wo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=CI(i,s))&&(r.precision=o),Px(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=kI(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=LI(i))&&(r.precision=o-(r.type==="%")*2);break}}return ci(r)}function $s(e){var t=e.domain;return e.ticks=function(n){var r=t();return Mn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return zM(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=Es(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 Ps(){var e=Jp();return e.copy=function(){return Ao(e,Ps())},Je.apply(e,arguments),$s(e)}function Qp(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,sf),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Qp(e).unknown(t)},e=arguments.length?Array.from(e,sf):[0,1],$s(n)}function Kp(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 Uk(e){return Math.log(e)}function zk(e){return Math.exp(e)}function HW(e){return-Math.log(-e)}function ZW(e){return-Math.exp(-e)}function JW(e){return isFinite(e)?+("1e"+e):e<0?0:e}function QW(e){return e===10?JW:e===Math.E?Math.exp:t=>Math.pow(e,t)}function KW(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 qk(e){return(t,n)=>-e(-t,n)}function qM(e){let t=e(Uk,zk),n=t.domain,r=10,i,o;function s(){return i=KW(r),o=QW(r),n()[0]<0?(i=qk(i),o=qk(o),e(HW,ZW)):e(Uk,zk),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,g=a==null?10:+a,y=[];if(!(r%1)&&h-d<g){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;y.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;y.push(m)}y.length*2<g&&(y=Mn(l,u,g))}else y=Mn(d,h,Math.min(h-d,g)).map(o);return f?y.reverse():y},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=wo(c)).precision==null&&(c.trim=!0),c=ci(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(Kp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function tm(){let e=qM(fl()).domain([1,10]);return e.copy=()=>Ao(e,tm()).base(e.base()),Je.apply(e,arguments),e}function jk(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Vk(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function jM(e){var t=1,n=e(jk(t),Vk(t));return n.constant=function(r){return arguments.length?e(jk(t=+r),Vk(t)):t},$s(n)}function em(){var e=jM(fl());return e.copy=function(){return Ao(e,em()).constant(e.constant())},Je.apply(e,arguments)}function Yk(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function tH(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function eH(e){return e<0?-e*e:e*e}function VM(e){var t=e(wr,wr),n=1;function r(){return n===1?e(wr,wr):n===.5?e(tH,eH):e(Yk(n),Yk(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},$s(t)}function nm(){var e=VM(fl());return e.copy=function(){return Ao(e,nm()).exponent(e.exponent())},Je.apply(e,arguments),e}function rm(){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]=jS(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[Ts(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(zt),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 rm().domain(e).range(t).unknown(r)},Je.apply(o,arguments)}function im(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Ts(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 im().domain(e).range(t).unknown(n)},Je.apply(i,arguments)}var YM=new Date,XM=new Date;function xe(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=>xe(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)=>(YM.setTime(+o),XM.setTime(+s),e(YM),e(XM),Math.floor(n(YM,XM))),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 om=xe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);om.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):om);var d6t=om.range;var un=xe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),Xk=un.range;var Us=xe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),nH=Us.range,zs=xe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),rH=zs.range;var qs=xe(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()),iH=qs.range,js=xe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),oH=js.range;var ui=xe(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),sH=ui.range,pl=xe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),aH=pl.range,ml=xe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),cH=ml.range;function yl(e){return xe(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 Ur=yl(0),qa=yl(1),vb=yl(2),_b=yl(3),Eo=yl(4),Sb=yl(5),Ib=yl(6),Wk=Ur.range,lH=qa.range,uH=vb.range,fH=_b.range,dH=Eo.range,hH=Sb.range,pH=Ib.range;function gl(e){return xe(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 zr=gl(0),ja=gl(1),Mb=gl(2),Ab=gl(3),No=gl(4),Tb=gl(5),Eb=gl(6),Hk=zr.range,mH=ja.range,yH=Mb.range,gH=Ab.range,xH=No.range,bH=Tb.range,wH=Eb.range;var Vs=xe(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()),vH=Vs.range,Ys=xe(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()),_H=Ys.range;var zn=xe(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());zn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xe(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 SH=zn.range,qn=xe(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());qn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xe(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 IH=qn.range;function Jk(e,t,n,r,i,o){let s=[[un,1,1e3],[un,5,5*1e3],[un,15,15*1e3],[un,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=As(([,,g])=>g).right(s,d);if(h===s.length)return e.every(Eu(l/31536e6,u/31536e6,f));if(h===0)return om.every(Math.max(Eu(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[GM,am]=Jk(qn,Ys,zr,ml,js,zs),[WM,HM]=Jk(zn,Vs,Ur,ui,qs,Us);function ZM(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 JM(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 cm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function QM(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=lm(i),u=um(i),f=lm(o),d=um(o),h=lm(s),p=um(s),m=lm(a),g=um(a),y=lm(c),x=um(c),b={a:F,A:R,b:k,B:$,c:null,d:rF,e:rF,f:WH,g:iZ,G:sZ,H:YH,I:XH,j:GH,L:cF,m:HH,M:ZH,p:P,q:U,Q:sF,s:aF,S:JH,u:QH,U:KH,V:tZ,w:eZ,W:nZ,x:null,X:null,y:rZ,Y:oZ,Z:aZ,"%":oF},w={a:W,A:tt,b:nt,B:at,c:null,d:iF,e:iF,f:fZ,g:vZ,G:SZ,H:cZ,I:lZ,j:uZ,L:uF,m:dZ,M:hZ,p:Y,q:rt,Q:sF,s:aF,S:pZ,u:mZ,U:yZ,V:gZ,w:xZ,W:bZ,x:null,X:null,y:wZ,Y:_Z,Z:IZ,"%":oF},v={a:E,A:T,b:O,B:C,c:S,d:eF,e:eF,f:zH,g:tF,G:Kk,H:nF,I:nF,j:RH,L:UH,m:FH,M:$H,p:A,q:kH,Q:jH,s:VH,S:PH,u:DH,U:OH,V:BH,w:NH,W:LH,x:M,X:N,y:tF,Y:Kk,Z:CH,"%":qH};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 _(j,H){return function(ot){var z=[],kt=-1,dt=0,Ht=j.length,Zt,et,ae;for(ot instanceof Date||(ot=new Date(+ot));++kt<Ht;)j.charCodeAt(kt)===37&&(z.push(j.slice(dt,kt)),(et=Qk[Zt=j.charAt(++kt)])!=null?Zt=j.charAt(++kt):et=Zt==="e"?" ":"0",(ae=H[Zt])&&(Zt=ae(ot,et)),z.push(Zt),dt=kt+1);return z.push(j.slice(dt,kt)),z.join("")}}function I(j,H){return function(ot){var z=cm(1900,void 0,1),kt=D(z,j,ot+="",0),dt,Ht;if(kt!=ot.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?(dt=JM(cm(z.y,0,1)),Ht=dt.getUTCDay(),dt=Ht>4||Ht===0?ja.ceil(dt):ja(dt),dt=pl.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=ZM(cm(z.y,0,1)),Ht=dt.getDay(),dt=Ht>4||Ht===0?qa.ceil(dt):qa(dt),dt=ui.offset(dt,(z.V-1)*7),z.y=dt.getFullYear(),z.m=dt.getMonth(),z.d=dt.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),Ht="Z"in z?JM(cm(z.y,0,1)).getUTCDay():ZM(cm(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Ht+5)%7:z.w+z.U*7-(Ht+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,JM(z)):ZM(z)}}function D(j,H,ot,z){for(var kt=0,dt=H.length,Ht=ot.length,Zt,et;kt<dt;){if(z>=Ht)return-1;if(Zt=H.charCodeAt(kt++),Zt===37){if(Zt=H.charAt(kt++),et=v[Zt in Qk?H.charAt(kt++):Zt],!et||(z=et(j,ot,z))<0)return-1}else if(Zt!=ot.charCodeAt(z++))return-1}return z}function A(j,H,ot){var z=l.exec(H.slice(ot));return z?(j.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function E(j,H,ot){var z=h.exec(H.slice(ot));return z?(j.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function T(j,H,ot){var z=f.exec(H.slice(ot));return z?(j.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(j,H,ot){var z=y.exec(H.slice(ot));return z?(j.m=x.get(z[0].toLowerCase()),ot+z[0].length):-1}function C(j,H,ot){var z=m.exec(H.slice(ot));return z?(j.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(j,H,ot){return D(j,t,H,ot)}function M(j,H,ot){return D(j,n,H,ot)}function N(j,H,ot){return D(j,r,H,ot)}function F(j){return s[j.getDay()]}function R(j){return o[j.getDay()]}function k(j){return c[j.getMonth()]}function $(j){return a[j.getMonth()]}function P(j){return i[+(j.getHours()>=12)]}function U(j){return 1+~~(j.getMonth()/3)}function W(j){return s[j.getUTCDay()]}function tt(j){return o[j.getUTCDay()]}function nt(j){return c[j.getUTCMonth()]}function at(j){return a[j.getUTCMonth()]}function Y(j){return i[+(j.getUTCHours()>=12)]}function rt(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var H=_(j+="",b);return H.toString=function(){return j},H},parse:function(j){var H=I(j+="",!1);return H.toString=function(){return j},H},utcFormat:function(j){var H=_(j+="",w);return H.toString=function(){return j},H},utcParse:function(j){var H=I(j+="",!0);return H.toString=function(){return j},H}}}var Qk={"-":"",_:" ",0:"0"},fn=/^\s*\d+/,AH=/^%/,TH=/[\\^$*+?|[\]().{}]/g;function ee(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 EH(e){return e.replace(TH,"\\$&")}function lm(e){return new RegExp("^(?:"+e.map(EH).join("|")+")","i")}function um(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function NH(e,t,n){var r=fn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function DH(e,t,n){var r=fn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function OH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function BH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function LH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Kk(e,t,n){var r=fn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function tF(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function CH(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 kH(e,t,n){var r=fn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function FH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function eF(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function RH(e,t,n){var r=fn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function nF(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function $H(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function PH(e,t,n){var r=fn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function UH(e,t,n){var r=fn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function zH(e,t,n){var r=fn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qH(e,t,n){var r=AH.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function jH(e,t,n){var r=fn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function VH(e,t,n){var r=fn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function rF(e,t){return ee(e.getDate(),t,2)}function YH(e,t){return ee(e.getHours(),t,2)}function XH(e,t){return ee(e.getHours()%12||12,t,2)}function GH(e,t){return ee(1+ui.count(zn(e),e),t,3)}function cF(e,t){return ee(e.getMilliseconds(),t,3)}function WH(e,t){return cF(e,t)+"000"}function HH(e,t){return ee(e.getMonth()+1,t,2)}function ZH(e,t){return ee(e.getMinutes(),t,2)}function JH(e,t){return ee(e.getSeconds(),t,2)}function QH(e){var t=e.getDay();return t===0?7:t}function KH(e,t){return ee(Ur.count(zn(e)-1,e),t,2)}function lF(e){var t=e.getDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function tZ(e,t){return e=lF(e),ee(Eo.count(zn(e),e)+(zn(e).getDay()===4),t,2)}function eZ(e){return e.getDay()}function nZ(e,t){return ee(qa.count(zn(e)-1,e),t,2)}function rZ(e,t){return ee(e.getFullYear()%100,t,2)}function iZ(e,t){return e=lF(e),ee(e.getFullYear()%100,t,2)}function oZ(e,t){return ee(e.getFullYear()%1e4,t,4)}function sZ(e,t){var n=e.getDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),ee(e.getFullYear()%1e4,t,4)}function aZ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ee(t/60|0,"0",2)+ee(t%60,"0",2)}function iF(e,t){return ee(e.getUTCDate(),t,2)}function cZ(e,t){return ee(e.getUTCHours(),t,2)}function lZ(e,t){return ee(e.getUTCHours()%12||12,t,2)}function uZ(e,t){return ee(1+pl.count(qn(e),e),t,3)}function uF(e,t){return ee(e.getUTCMilliseconds(),t,3)}function fZ(e,t){return uF(e,t)+"000"}function dZ(e,t){return ee(e.getUTCMonth()+1,t,2)}function hZ(e,t){return ee(e.getUTCMinutes(),t,2)}function pZ(e,t){return ee(e.getUTCSeconds(),t,2)}function mZ(e){var t=e.getUTCDay();return t===0?7:t}function yZ(e,t){return ee(zr.count(qn(e)-1,e),t,2)}function fF(e){var t=e.getUTCDay();return t>=4||t===0?No(e):No.ceil(e)}function gZ(e,t){return e=fF(e),ee(No.count(qn(e),e)+(qn(e).getUTCDay()===4),t,2)}function xZ(e){return e.getUTCDay()}function bZ(e,t){return ee(ja.count(qn(e)-1,e),t,2)}function wZ(e,t){return ee(e.getUTCFullYear()%100,t,2)}function vZ(e,t){return e=fF(e),ee(e.getUTCFullYear()%100,t,2)}function _Z(e,t){return ee(e.getUTCFullYear()%1e4,t,4)}function SZ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?No(e):No.ceil(e),ee(e.getUTCFullYear()%1e4,t,4)}function IZ(){return"+0000"}function oF(){return"%"}function sF(e){return+e}function aF(e){return Math.floor(+e/1e3)}var af,cf,dF,Do,hF;KM({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 KM(e){return af=QM(e),cf=af.format,dF=af.parse,Do=af.utcFormat,hF=af.utcParse,af}function MZ(e){return new Date(e)}function AZ(e){return e instanceof Date?+e:+new Date(+e)}function Nb(e,t,n,r,i,o,s,a,c,l){var u=Jp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),w=l("%Y");function v(_){return(c(_)<_?h:a(_)<_?p:s(_)<_?m:o(_)<_?g:r(_)<_?i(_)<_?y:x:n(_)<_?b:w)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?d(Array.from(_,AZ)):d().map(MZ)},u.ticks=function(_){var I=d();return e(I[0],I[I.length-1],_??10)},u.tickFormat=function(_,I){return I==null?v:l(I)},u.nice=function(_){var I=d();return(!_||typeof _.range!="function")&&(_=t(I[0],I[I.length-1],_??10)),_?d(Kp(I,_)):u},u.copy=function(){return Ao(u,Nb(e,t,n,r,i,o,s,a,c,l))},u}function Db(){return Je.apply(Nb(WM,HM,zn,Vs,Ur,ui,qs,Us,un,cf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ob(){return Je.apply(Nb(GM,am,qn,Ys,zr,pl,js,zs,un,Do).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function fm(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Bb(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=wr,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(g){var y,x,b;return arguments.length?([y,x,b]=g,l=yo(m,[y,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p($r),h.rangeRound=p(Kc),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 dm(){var e=$s(Bb()(wr));return e.copy=function(){return fm(e,dm())},Hp.apply(e,arguments)}function Lb(){var e=qM(Bb()).domain([.1,1,10]);return e.copy=function(){return fm(e,Lb()).base(e.base())},Hp.apply(e,arguments)}function Cb(){var e=jM(Bb());return e.copy=function(){return fm(e,Cb()).constant(e.constant())},Hp.apply(e,arguments)}function kb(){var e=VM(Bb());return e.copy=function(){return fm(e,kb()).exponent(e.exponent())},Hp.apply(e,arguments)}function X(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 tA=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var eA=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var nA=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var rA=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var iA=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var oA=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var sA=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var aA=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var cA=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var lA=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var pt=e=>oI(e[e.length-1]);var Fb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),Rb=pt(Fb);var $b=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),Pb=pt($b);var Ub=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),zb=pt(Ub);var qb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),jb=pt(qb);var hm=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),lf=pt(hm);var Vb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),Yb=pt(Vb);var pm=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),uf=pt(pm);var Xb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),Gb=pt(Xb);var Wb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),Hb=pt(Wb);var Zb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),Jb=pt(Zb);var Qb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),Kb=pt(Qb);var t1=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),e1=pt(t1);var n1=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),r1=pt(n1);var i1=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),o1=pt(i1);var s1=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),a1=pt(s1);var c1=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),l1=pt(c1);var u1=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),f1=pt(u1);var d1=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),h1=pt(d1);var p1=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),m1=pt(p1);var y1=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),g1=pt(y1);var x1=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),b1=pt(x1);var w1=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),v1=pt(w1);var _1=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),S1=pt(_1);var I1=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),M1=pt(I1);var A1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),T1=pt(A1);var E1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),N1=pt(E1);var D1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),O1=pt(D1);function B1(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 L1=Ru(Kn(300,.5,0),Kn(-240,.5,1));var k1=Ru(Kn(-100,.75,.35),Kn(80,1.5,.8)),F1=Ru(Kn(260,.75,.35),Kn(80,1.5,.8)),C1=Kn();function R1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return C1.h=360*e-100,C1.s=1.5-1.5*t,C1.l=.8-.9*t,C1+""}var $1=on(),TZ=Math.PI/3,EZ=Math.PI*2/3;function P1(e){var t;return e=(.5-e)*Math.PI,$1.r=255*(t=Math.sin(e))*t,$1.g=255*(t=Math.sin(e+TZ))*t,$1.b=255*(t=Math.sin(e+EZ))*t,$1+""}function U1(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 z1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var q1=z1(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),j1=z1(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),V1=z1(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Y1=z1(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Qe(e){return function(){return e}}var uA=Math.cos;var ff=Math.min,mm=Math.sin,ne=Math.sqrt,fA=1e-12,xl=Math.PI,CNt=xl/2,df=2*xl;function X1(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 ka(t)}var $Nt=Array.prototype.slice;function G1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function pF(e){this._context=e}pF.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 Xs(e){return new pF(e)}function W1(e){return e[0]}function H1(e){return e[1]}function ym(e,t){var n=Qe(!0),r=null,i=Xs,o=null,s=X1(a);e=typeof e=="function"?e:e===void 0?W1:Qe(e),t=typeof t=="function"?t:t===void 0?H1:Qe(t);function a(c){var l,u=(c=G1(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:Qe(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Qe(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Qe(!!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 hf(e,t,n){var r=null,i=Qe(!0),o=null,s=Xs,a=null,c=X1(l);e=typeof e=="function"?e:e===void 0?W1:Qe(+e),t=typeof t=="function"?t:t===void 0?Qe(0):Qe(+t),n=typeof n=="function"?n:n===void 0?H1:Qe(+n);function l(f){var d,h,p,m=(f=G1(f)).length,g,y=!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(g=f[d],d,f))===y)if(y=!y)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()}y&&(b[d]=+e(g,d,f),w[d]=+t(g,d,f),a.point(r?+r(g,d,f):b[d],n?+n(g,d,f):w[d]))}if(x)return a=null,x+""||null}function u(){return ym().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Qe(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Qe(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Qe(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Qe(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Qe(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Qe(+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:Qe(!!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 Z1=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 dA(e){return new Z1(e,!0)}function hA(e){return new Z1(e,!1)}var NZ=ne(3),gm={draw(e,t){let n=ne(t+ff(t/28,.75))*.59436,r=n/2,i=r*NZ;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 Gs={draw(e,t){let n=ne(t/xl);e.moveTo(n,0),e.arc(0,0,n,0,df)}};var xm={draw(e,t){let n=ne(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 mF=ne(1/3),DZ=mF*2,bm={draw(e,t){let n=ne(t/DZ),r=n*mF;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var wm={draw(e,t){let n=ne(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var vm={draw(e,t){let n=ne(t-ff(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var _m={draw(e,t){let n=ne(t),r=-n/2;e.rect(r,r,n,n)}};var Sm={draw(e,t){let n=ne(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var OZ=.8908130915292852,yF=mm(xl/10)/mm(7*xl/10),BZ=mm(df/10)*yF,LZ=-uA(df/10)*yF,Im={draw(e,t){let n=ne(t*OZ),r=BZ*n,i=LZ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=df*o/5,a=uA(s),c=mm(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var pA=ne(3),Mm={draw(e,t){let n=-ne(t/(pA*3));e.moveTo(0,n*2),e.lineTo(-pA*n,-n),e.lineTo(pA*n,-n),e.closePath()}};var CZ=ne(3),Am={draw(e,t){let n=ne(t)*.6824,r=n/2,i=n*CZ/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ne(3)/2,mA=1/ne(12),kZ=(mA/2+1)*3,Tm={draw(e,t){let n=ne(t/kZ),r=n/2,i=n*mA,o=r,s=n*mA+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(fi*r-di*i,di*r+fi*i),e.lineTo(fi*o-di*s,di*o+fi*s),e.lineTo(fi*a-di*c,di*a+fi*c),e.lineTo(fi*r+di*i,fi*i-di*r),e.lineTo(fi*o+di*s,fi*s-di*o),e.lineTo(fi*a+di*c,fi*c-di*a),e.closePath()}};var pf={draw(e,t){let n=ne(t-ff(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var J1=[Gs,xm,bm,_m,Im,Mm,Tm],yA=[Gs,vm,pf,Am,gm,Sm,wm];function hi(){}function mf(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 Em(e){this._context=e}Em.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:mf(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:mf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function gA(e){return new Em(e)}function gF(e){this._context=e}gF.prototype={areaStart:hi,areaEnd:hi,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:mf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function xA(e){return new gF(e)}function xF(e){this._context=e}xF.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:mf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function bA(e){return new xF(e)}function bF(e,t){this._basis=new Em(e),this._beta=t}bF.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 wA=function e(t){function n(r){return t===1?new Em(r):new bF(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function yf(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 Q1(e,t){this._context=e,this._k=(1-t)/6}Q1.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:yf(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:yf(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 vA=function e(t){function n(r){return new Q1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function K1(e,t){this._context=e,this._k=(1-t)/6}K1.prototype={areaStart:hi,areaEnd:hi,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:yf(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 _A=function e(t){function n(r){return new K1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function tw(e,t){this._context=e,this._k=(1-t)/6}tw.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:yf(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 SA=function e(t){function n(r){return new tw(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Nm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>fA){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>fA){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 wF(e,t){this._context=e,this._alpha=t}wF.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:Nm(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 IA=function e(t){function n(r){return t?new wF(r,t):new Q1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function vF(e,t){this._context=e,this._alpha=t}vF.prototype={areaStart:hi,areaEnd:hi,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:Nm(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 MA=function e(t){function n(r){return t?new vF(r,t):new K1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function _F(e,t){this._context=e,this._alpha=t}_F.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:Nm(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 AA=function e(t){function n(r){return t?new _F(r,t):new tw(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function SF(e){this._context=e}SF.prototype={areaStart:hi,areaEnd:hi,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 TA(e){return new SF(e)}function IF(e){return e<0?-1:1}function MF(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(IF(o)+IF(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function AF(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function EA(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 ew(e){this._context=e}ew.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:EA(this,this._t0,AF(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,EA(this,AF(this,n=MF(this,e,t)),n);break;default:EA(this,this._t0,n=MF(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function TF(e){this._context=new EF(e)}(TF.prototype=Object.create(ew.prototype)).point=function(e,t){ew.prototype.point.call(this,t,e)};function EF(e){this._context=e}EF.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 NA(e){return new ew(e)}function DA(e){return new TF(e)}function DF(e){this._context=e}DF.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=NF(e),i=NF(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 NF(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 OA(e){return new DF(e)}function nw(e,t){this._context=e,this._t=t}nw.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 BA(e){return new nw(e,.5)}function LA(e){return new nw(e,0)}function CA(e){return new nw(e,1)}var Dm=e=>()=>e;function kA(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 qr(e,t,n){this.k=e,this.x=t,this.y=n}qr.prototype={constructor:qr,scale:function(e){return e===1?this:new qr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qr(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 Om=new qr(1,0,0);FA.prototype=qr.prototype;function FA(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Om;return e.__zoom}function rw(e){e.stopImmediatePropagation()}function gf(e){e.preventDefault(),e.stopImmediatePropagation()}function FZ(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function RZ(){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 OF(){return this.__zoom||Om}function $Z(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function PZ(){return navigator.maxTouchPoints||"ontouchstart"in this}function UZ(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 RA(){var e=FZ,t=RZ,n=UZ,r=$Z,i=PZ,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=fI,l=Gc("start","zoom","end"),u,f,d,h=500,p=150,m=0,g=10;function y(S){S.property("__zoom",OF).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",E).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,M,N,F){var R=S.selection?S.selection():S;R.property("__zoom",OF),S!==R?v(S,M,N,F):R.interrupt().each(function(){_(this,arguments).event(F).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},y.scaleBy=function(S,M,N,F){y.scaleTo(S,function(){var R=this.__zoom.k,k=typeof M=="function"?M.apply(this,arguments):M;return R*k},N,F)},y.scaleTo=function(S,M,N,F){y.transform(S,function(){var R=t.apply(this,arguments),k=this.__zoom,$=N==null?w(R):typeof N=="function"?N.apply(this,arguments):N,P=k.invert($),U=typeof M=="function"?M.apply(this,arguments):M;return n(b(x(k,U),$,P),R,s)},N,F)},y.translateBy=function(S,M,N,F){y.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,F)},y.translateTo=function(S,M,N,F,R){y.transform(S,function(){var k=t.apply(this,arguments),$=this.__zoom,P=F==null?w(k):typeof F=="function"?F.apply(this,arguments):F;return n(Om.translate(P[0],P[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),k,s)},F,R)};function x(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new qr(M,S.x,S.y)}function b(S,M,N){var F=M[0]-N[0]*S.k,R=M[1]-N[1]*S.k;return F===S.x&&R===S.y?S:new qr(S.k,F,R)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,N,F){S.on("start.zoom",function(){_(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(F).end()}).tween("zoom",function(){var R=this,k=arguments,$=_(R,k).event(F),P=t.apply(R,k),U=N==null?w(P):typeof N=="function"?N.apply(R,k):N,W=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),tt=R.__zoom,nt=typeof M=="function"?M.apply(R,k):M,at=c(tt.invert(U).concat(W/tt.k),nt.invert(U).concat(W/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=at(Y),j=W/rt[2];Y=new qr(j,U[0]-rt[0]*j,U[1]-rt[1]*j)}$.zoom(null,Y)}})}function _(S,M,N){return!N&&S.__zooming||new I(S,M)}function I(S,M){this.that=S,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,M),this.taps=0}I.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=Vt(this.that).datum();l.call(S,this.that,new kA(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function D(S,...M){if(!e.apply(this,arguments))return;var N=_(this,M).event(S),F=this.__zoom,R=Math.max(o[0],Math.min(o[1],F.k*Math.pow(2,r.apply(this,arguments)))),k=kn(S);if(N.wheel)(N.mouse[0][0]!==k[0]||N.mouse[0][1]!==k[1])&&(N.mouse[1]=F.invert(N.mouse[0]=k)),clearTimeout(N.wheel);else{if(F.k===R)return;N.mouse=[k,F.invert(k)],go(this),N.start()}gf(S),N.wheel=setTimeout($,p),N.zoom("mouse",n(b(x(F,R),N.mouse[0],N.mouse[1]),N.extent,s));function $(){N.wheel=null,N.end()}}function A(S,...M){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,F=_(this,M,!0).event(S),R=Vt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",W,!0),k=kn(S,N),$=S.clientX,P=S.clientY;ap(S.view),rw(S),F.mouse=[k,this.__zoom.invert(k)],go(this),F.start();function U(tt){if(gf(tt),!F.moved){var nt=tt.clientX-$,at=tt.clientY-P;F.moved=nt*nt+at*at>m}F.event(tt).zoom("mouse",n(b(F.that.__zoom,F.mouse[0]=kn(tt,N),F.mouse[1]),F.extent,s))}function W(tt){R.on("mousemove.zoom mouseup.zoom",null),cp(tt.view,F.moved),gf(tt),F.event(tt).end()}}function E(S,...M){if(e.apply(this,arguments)){var N=this.__zoom,F=kn(S.changedTouches?S.changedTouches[0]:S,this),R=N.invert(F),k=N.k*(S.shiftKey?.5:2),$=n(b(x(N,k),F,R),t.apply(this,M),s);gf(S),a>0?Vt(this).transition().duration(a).call(v,$,F,S):Vt(this).call(y.transform,$,F,S)}}function T(S,...M){if(e.apply(this,arguments)){var N=S.touches,F=N.length,R=_(this,M,S.changedTouches.length===F).event(S),k,$,P,U;for(rw(S),$=0;$<F;++$)P=N[$],U=kn(P,this),U=[U,this.__zoom.invert(U),P.identifier],R.touch0?!R.touch1&&R.touch0[2]!==U[2]&&(R.touch1=U,R.taps=0):(R.touch0=U,k=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(R.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),go(this),R.start())}}function O(S,...M){if(this.__zooming){var N=_(this,M).event(S),F=S.changedTouches,R=F.length,k,$,P,U;for(gf(S),k=0;k<R;++k)$=F[k],P=kn($,this),N.touch0&&N.touch0[2]===$.identifier?N.touch0[0]=P:N.touch1&&N.touch1[2]===$.identifier&&(N.touch1[0]=P);if($=N.that.__zoom,N.touch1){var W=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],at=N.touch1[1],Y=(Y=nt[0]-W[0])*Y+(Y=nt[1]-W[1])*Y,rt=(rt=at[0]-tt[0])*rt+(rt=at[1]-tt[1])*rt;$=x($,Math.sqrt(Y/rt)),P=[(W[0]+nt[0])/2,(W[1]+nt[1])/2],U=[(tt[0]+at[0])/2,(tt[1]+at[1])/2]}else if(N.touch0)P=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(b($,P,U),N.extent,s))}}function C(S,...M){if(this.__zooming){var N=_(this,M).event(S),F=S.changedTouches,R=F.length,k,$;for(rw(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),k=0;k<R;++k)$=F[k],N.touch0&&N.touch0[2]===$.identifier?delete N.touch0:N.touch1&&N.touch1[2]===$.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&&($=kn($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<g)){var P=Vt(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Dm(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Dm(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Dm(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Dm([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.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],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(a=+S,y):a},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=l.on.apply(l,arguments);return S===l?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(g=+S,y):g},y}function ze(e){return e!=null&&!Number.isNaN(e)}function dn(e,t){return+ze(t)-+ze(e)||zt(e,t)}function bl(e,t){return+ze(t)-+ze(e)||Hn(e,t)}function Bm(e){return e!=null&&`${e}`!=""}function xf(e){return isFinite(e)?e:NaN}function sr(e){return e>0&&isFinite(e)?e:NaN}function Va(e){return e<0&&isFinite(e)?e:NaN}function bf(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`${zZ(e.getUTCFullYear(),4)}-${Ws(e.getUTCMonth()+1,2)}-${Ws(e.getUTCDate(),2)}${n||r||i||o?`T${Ws(n,2)}:${Ws(r,2)}${i||o?`:${Ws(i,2)}${o?`.${Ws(o,3)}`:""}`:""}Z`:""}`}function zZ(e){return e<0?`-${Ws(-e,6)}`:e>9999?`+${Ws(e,6)}`:Ws(e,4)}function Ws(e,t){return`${e}`.padStart(t,"0")}var qZ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function wl(e,t){return qZ.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var vf=1e3,Xa=vf*60,Ga=Xa*60,Bo=Ga*24,Oo=Bo*7,vl=Bo*30,Ya=Bo*365,$A=[["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",vf],["5 seconds",5*vf],["15 seconds",15*vf],["30 seconds",30*vf],["minute",Xa],["5 minutes",5*Xa],["15 minutes",15*Xa],["30 minutes",30*Xa],["hour",Ga],["3 hours",3*Ga],["6 hours",6*Ga],["12 hours",12*Ga],["day",Bo],["2 days",2*Bo],["week",Oo],["2 weeks",2*Oo],["month",vl],["3 months",3*vl],["6 months",6*vl],["year",Ya],["2 years",2*Ya],["5 years",5*Ya],["10 years",10*Ya],["20 years",20*Ya],["50 years",50*Ya],["100 years",100*Ya]],PA=new Map([["second",vf],["minute",Xa],["hour",Ga],["day",Bo],["monday",Oo],["tuesday",Oo],["wednesday",Oo],["thursday",Oo],["friday",Oo],["saturday",Oo],["sunday",Oo],["week",Oo],["month",vl],["year",Ya]]),LF=new Map([["second",un],["minute",Us],["hour",qs],["day",ui],["monday",qa],["tuesday",vb],["wednesday",_b],["thursday",Eo],["friday",Sb],["saturday",Ib],["sunday",Ur],["week",Ur],["month",Vs],["year",zn]]),UA=new Map([["second",un],["minute",zs],["hour",js],["day",ml],["monday",ja],["tuesday",Mb],["wednesday",Ab],["thursday",No],["friday",Tb],["saturday",Eb],["sunday",zr],["week",zr],["month",Ys],["year",qn]]),_f=Symbol("intervalDuration"),ow=Symbol("intervalType");for(let[e,t]of LF)t[_f]=PA.get(e),t[ow]="time";for(let[e,t]of UA)t[_f]=PA.get(e),t[ow]="utc";var Lm=[["year",qn,"utc"],["month",Ys,"utc"],["day",ml,"utc",6*vl],["hour",js,"utc",3*Bo],["minute",zs,"utc",6*Ga],["second",un,"utc",30*Xa]],iw=[["year",zn,"time"],["month",Vs,"time"],["day",ui,"time",6*vl],["hour",qs,"time",3*Bo],["minute",Us,"time",6*Ga],["second",un,"time",30*Xa]],jZ=[Lm[0],iw[0],Lm[1],iw[1],Lm[2],iw[2],...Lm.slice(3)];function sw(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=UA.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 zA(e){return CF(sw(e),"time")}function Cm(e){return CF(sw(e),"utc")}function CF([e,t],n){let r=(n==="time"?LF:UA).get(e);return t>1&&(r=r.every(t),r[_f]=PA.get(e)*t,r[ow]=n),r}function qA(e,t){if(!(t>1))return;let n=e[_f];if(!$A.some(([,i])=>i===n)||n%Bo===0&&Bo<n&&n<vl)return;let[r]=$A[As(([,i])=>Math.log(i)).center($A,Math.log(n*t))];return(e[ow]==="time"?zA:Cm)(r)}function BF(e,t,n){let r=t==="time"?cf:Do;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=VZ(n);switch(e){case"millisecond":return wf(r(".%L"),r(":%M:%S"),i);case"second":return wf(r(":%S"),r("%-I:%M"),i);case"minute":return wf(r("%-I:%M"),r("%p"),i);case"hour":return wf(r("%-I %p"),r("%b %-d"),i);case"day":return wf(r("%-d"),r("%b"),i);case"month":return wf(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function VZ(e){return e==="left"||e==="right"?(t,n)=>`
12
12
  ${t}
13
13
  ${n}`:e==="top"?(t,n)=>`${n}
14
14
  ${t}`:(t,n)=>`${t}
15
- ${n}`}function jZ(e){return e==="time"?iw:e==="utc"?Nm:UZ}function BF(e,t,n){let r=Wt(tx(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return NF("millisecond","utc",n);for(let[i,o,s,a]of jZ(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return NF(i,s,n)}}function xf(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-Hs(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var _l=Object.getPrototypeOf(Uint8Array),qZ=Object.prototype.toString,UA=Symbol("reindex");function bt(e,t,n){let r=typeof t;return r==="string"?LF(e,zA(t),n):r==="function"?LF(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Gt(e,hn(t),n):typeof t?.transform=="function"?CF(t.transform(e),n):VZ(CF(t,n),e?.[UA])}function VZ(e,t){return t?Bm(e,t):e}function LF(e,t,n){return Gt(e,n?.prototype instanceof _l?YZ(t):t,n)}function CF(e,t){return t===void 0?qe(e):e instanceof t?e:t.prototype instanceof _l&&!(e instanceof _l)?t.from(e,jA):t.from(e)}function YZ(e){return(t,n)=>jA(e(t,n))}var Wa=[null],zA=e=>t=>t[e],Ee={transform:ar},G={transform:e=>e};var Om=()=>1,kF=()=>!0,je=e=>e==null?e:`${e}`,Bt=e=>e==null?e:+e;var Zs=e=>e?e[0]:void 0,Ha=e=>e?e[1]:void 0,FF=e=>e?e[2]:void 0,hn=e=>()=>e;function vf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Qn(n,t,r)}function Ke(e){return e instanceof _l?e:Gt(e,jA,Float64Array)}function jA(e){return e==null?NaN:Number(e)}function RF(e){return Gt(e,qA)}function qA(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?wl(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Be(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Qa(e)?[void 0,e]:[e,void 0]}function se(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function VA(e,t,n){if(e!=null)return tn(e,t,n)}function tn(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function qe(e){return e==null||e instanceof Array||e instanceof _l?e:Array.from(e)}function Gt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Za(e,t=Array){return e instanceof t?e.slice():t.from(e)}function YA({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function XA({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function _f(e){return YA(e)||XA(e)||e.interval!==void 0}function pn(e){return e?.toString===qZ}function Lo(e){return pn(e)&&(e.type!==void 0||e.domain!==void 0)}function qr(e){return pn(e)&&typeof e.transform!="function"}function Co(e){return qr(e)&&e.value===void 0&&e.channel===void 0}function GA(e,t,n,r=G){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 $e(e,t){return e===void 0&&t===void 0?[Zs,Ha]:[e,t]}function qn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Be(t)),e===void 0&&([e]=Be(n)),e}function ar(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Bm(e,t){return Gt(t,n=>e[n],e.constructor)}function Sf(e){return e.length===1?(t,n)=>e(Bm(n,t)):e}function Js(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Qs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function aw(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 mn(e){let t;return[{transform:()=>t,label:On(e)},n=>t=n]}function Dn(e){return e==null?[e]:mn(e)}function On(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function If(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Le(r)||Le(i)?Gt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Gt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function Sl(e,t){let n=WA(t?.interval,t?.type);return n?Gt(e,n):e}function WA(e,t){let n=Mf(e,t);return n&&(r=>ze(r)?n.floor(r):r)}function Mf(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>Ue(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Ue(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?$A:Dm)(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 ko(e,t){if(e=Mf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function $F(e,t){if(e=ko(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function PF(e){return Ja(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Ja(e){return typeof e?.range=="function"}function pi(e){return e===void 0||qr(e)?e:{value:e}}function UF(e){return e==null?null:{transform:t=>bt(t,e,Float64Array),label:On(e)}}function zF(e){if(!cr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function cr(e){return e&&typeof e[Symbol.iterator]=="function"}function cw(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ne(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Le(e){for(let t of e)if(t!=null)return t instanceof Date}function jF(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&wl(t)}function qF(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Ks(e){for(let t of e)if(t!=null)return typeof t=="number"}function lw(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var XZ=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 Qa(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)||XZ.has(e))}function VF(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function re(e){return e==null||ta(e)}function ta(e){return/^\s*none\s*$/i.test(e)}function YF(e){return/^\s*round\s*$/i.test(e)}function uw(e,t){return VA(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Fo(e="middle"){return uw(e,"frameAnchor")}function Hs(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Hn(t,n)}function XF(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 GZ(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 Lm(e){return cr(e)?GZ(e):e}var mi=Symbol("position"),Vr=Symbol("color"),Il=Symbol("radius"),Ml=Symbol("length"),Al=Symbol("opacity"),Af=Symbol("symbol"),GF=Symbol("projection"),de=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",Il],["color",Vr],["opacity",Al],["symbol",Af],["length",Ml],["projection",GF]]);function WF(e){return e===mi||e===GF}function HF(e){return e===mi||e===Il||e===Ml||e===Al}var HA=Math.sqrt(3),ZA=2/HA,WZ={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*ZA,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()}},JA=new Map([["asterisk",hm],["circle",Gs],["cross",pm],["diamond",mm],["diamond2",ym],["hexagon",WZ],["plus",gm],["square",xm],["square2",bm],["star",wm],["times",df],["triangle",vm],["triangle2",_m],["wye",Sm]]);function QA(e){return e&&typeof e.draw=="function"}function ZF(e){return QA(e)?!0:typeof e!="string"?!1:JA.has(e.toLowerCase())}function Tf(e){if(e==null||QA(e))return e;let t=JA.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function JF(e){if(e==null||QA(e))return[void 0,e];if(typeof e=="string"){let t=JA.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function yn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=eT(e)),t!=null&&!Co(t)&&(r=KA(r,rT(t))),n&&(r=KA(r,nT))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Co(t))&&{sort:t},transform:KA(r,s)}}function Ie({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=eT(e)),t!=null&&!Co(t)&&(r=tT(r,rT(t))),n&&(r=tT(r,nT))),{...i,...(t===null||Co(t))&&{sort:t},initializer:tT(r,o)}}function KA(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,qe(n),r,i)}}function tT(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 fw(e,t){return(e.initializer!=null?Ie:yn)(e,t)}function QF(e,t){return fw(t,eT(e))}function eT(e){return(t,n)=>{let r=bt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function KF({sort:e,...t}={}){return{...fw(t,nT),sort:Co(e)?e:null}}function nT(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function tR({seed:e,sort:t,...n}={}){return{...fw(n,eR(e==null?Math.random:Mo(e))),sort:Co(t)?t:null}}function dw(e,{sort:t,...n}={}){return{...(qr(e)&&e.channel!==void 0?Ie:fw)(n,rT(e)),sort:Co(t)?t:null}}function rT(e){return(typeof e=="function"&&e.length!==1?HZ:eR)(e)}function HZ(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function eR(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?bl:dn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=dn;break;case"descending":n=bl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=bt(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 km(e,t){return hw(null,null,e,t)}function tc(e={y:"count"},t={}){let{x:n=G}=t;if(n==null)throw new Error("missing channel: x");return hw(n,null,e,t)}function ec(e={x:"count"},t={}){let{y:n=G}=t;if(n==null)throw new Error("missing channel: y");return hw(null,n,e,t)}function Fm(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=$e(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return hw(n,r,e,t)}function hw(e,t,{data:n=yw,filter:r,sort:i,reverse:o,...s}={},a={}){s=oT(s,a),n=sR(n,G),i=i==null?void 0:iR("sort",i,a),r=r==null?void 0:oR("filter",r,a);let[c,l]=Dn(e),[u,f]=Dn(t),{z:d,fill:h,stroke:p,x1:m,x2:g,y1:y,y2:x,...b}=a,[w,_]=Dn(d),[v]=Be(h),[I]=Be(p),[N,A]=Dn(v),[D,T]=Dn(I);return{..."z"in a&&{z:w||d},..."fill"in a&&{fill:N||h},..."stroke"in a&&{stroke:D||p},...yn(b,(O,C,S)=>{let M=Sl(bt(O,e),S?.x),E=Sl(bt(O,t),S?.y),F=bt(O,d),R=bt(O,v),k=bt(O,I),$=Rm(s,{z:F,fill:R,stroke:k}),P=[],U=[],W=M&&l([]),tt=E&&f([]),nt=F&&_([]),at=R&&A([]),Y=k&&T([]),rt=0;for(let j of s)j.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let j of C){let H=[];for(let ot of s)ot.scope("facet",j);i&&i.scope("facet",j),r&&r.scope("facet",j);for(let[ot,z]of Ka(j,$))for(let[kt,dt]of Ka(z,E))for(let[Ht,Zt]of Ka(dt,M)){let et={data:O};if(M&&(et.x=Ht),E&&(et.y=kt),!(r&&!r.reduce(Zt,et))){H.push(rt++),U.push(n.reduceIndex(Zt,O,et)),M&&W.push(Ht),E&&tt.push(kt),F&&nt.push($===F?ot:F[Zt[0]]),R&&at.push($===R?ot:R[Zt[0]]),k&&Y.push($===k?ot:k[Zt[0]]);for(let ae of s)ae.reduce(Zt,et);i&&i.reduce(Zt,et)}}P.push(H)}return sT(P,i,o),{data:U,facets:P}}),...!Ro(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!Ro(s,"y")&&(u?{y:u}:{y1:y,y2:x}),...Object.fromEntries(s.map(({name:O,output:C})=>[O,C]))}}function Ro(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function iT(e,t,n=pw){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",eJ]),t.href!=null&&e.href===void 0&&r.push(["href",gw]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?ZZ(i):n(i,o,t))}function pw(e,t,n,r=mw){let i;pn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=mn(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 ZZ(e){return{name:e,initialize(){},scope(){},reduce(){}}}function mw(e,t,n,r=Ef){let i=aw(e,n),o=r(t,i),s,a;return{label:On(o===Cm?null:i,o.label),initialize(c){s=i===void 0?c:bt(c,i),o.scope==="data"&&(a=o.reduceIndex(ar(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 Ka(e,t){return t?fo(cn(e,n=>t[n]),Zs):[[,e]]}function Ef(e,t,n=JZ){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&pn(e))return KZ(e);if(typeof e=="function")return tJ(e);if(/^p\d{2}$/i.test(e))return ea(vf(e));switch(`${e}`.toLowerCase()){case"first":return gw;case"last":return nJ;case"identity":return yw;case"count":return Cm;case"distinct":return rJ;case"sum":return t==null?Cm:iJ;case"proportion":return rR(t,"data");case"proportion-facet":return rR(t,"facet");case"deviation":return ea(ii);case"min":return ea(ue);case"min-index":return ea(J0);case"max":return ea(Wt);case"max-index":return ea(Z0);case"mean":return nR(Ns);case"median":return nR(Pi);case"variance":return ea(Ea);case"mode":return ea(Nu)}return n(e)}function JZ(e){throw new Error(`invalid reduce: ${e}`)}function oT(e,t){return iT(e,t,iR)}function iR(e,t,n){return pw(e,t,n,oR)}function oR(e,t,n){return mw(e,t,n,sR)}function sR(e,t){return Ef(e,t,QZ)}function QZ(e){switch(`${e}`.toLowerCase()){case"x":return oJ;case"y":return sJ}throw new Error(`invalid group reduce: ${e}`)}function Rm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function sT(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>dn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function KZ(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function tJ(e){return{reduceIndex(t,n,r){return e(Bm(n,t),r)}}}function ea(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function nR(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Le(n)?new Date(r):r}}}var yw={reduceIndex(e,t){return Bm(t,e)}},gw={reduceIndex(e,t){return t[e[0]]}},eJ={reduceIndex(e,t){let r=fo($i(e,o=>o.length,o=>t[o]),Ha),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`,An(o,Ha)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
- `)}},nJ={reduceIndex(e,t){return t[e[e.length-1]]}},Cm={label:"Frequency",reduceIndex(e){return e.length}},rJ={label:"Distinct",reduceIndex(e,t){let n=new Jn;for(let r of e)n.add(t[r]);return n.size}},iJ=ea(An);function rR(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>An(n,o=>r[o])/i}}var oJ={reduceIndex(e,t,{x:n}){return n}},sJ={reduceIndex(e,t,{y:n}){return n}};function aR(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function Nf(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=On(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),cT(a,{scale:t,type:n,value:bt(e,r),label:s,filter:i,hint:o})}function xw(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Nf(t,r,n)]))}function Df(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:Gt(o,s)]}));return n.channels=e,n}function cT(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&&lw(r,Qa)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&lw(r,VF)?null:"opacity";break;case"symbol":n!==!0&&lw(r,ZF)?(t.scale=null,t.value=Gt(r,Tf)):t.scale="symbol";break;default:t.scale=de.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!de.has(n))throw new Error(`unknown scale: ${n}`);return t}function lR(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!de.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?fR:uR:lJ(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?cJ(t,r[l]):aJ(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let y=g.value,[x=0,b=1/0]=cr(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let w=Array.from(new Jn(y));return d&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=u==="data"?e:u==="height"?cR(n,"y1","y2"):u==="width"?cR(n,"x1","x2"):aT(n,u,u==="y"?"y2":u==="x"?"x2":void 0),_=Ef(h===!0?"max":h,w);g.domain=()=>{let v=RS(ar(y),I=>_.reduceIndex(I,w),I=>y[I]);return f&&v.sort(f),d&&v.reverse(),(x!==0||b!==1/0)&&(v=v.slice(x,b)),v.map(Zs)}}}}function aJ(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function cJ(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 cR(e,t,n){let r=aT(e,t),i=aT(e,n);return Gt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function aT(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 lJ(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return uR;case"descending":return fR}throw new Error(`invalid order: ${e}`)}function uR([e,t],[n,r]){return dn(t,r)||dn(e,n)}function fR([e,t],[n,r]){return bl(t,r)||dn(e,n)}function $m(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function bw(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var uJ=bw(e=>new Intl.NumberFormat(e)),fJ=bw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),dJ=bw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function hJ(e="en-US"){let t=uJ(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function dR(e="en-US",t="short"){let n=fJ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function hR(e="en-US",t="short"){let n=dJ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function lT(e){return gf(e,"Invalid Date")}function pJ(e="en-US"){let t=hJ(e);return n=>(n instanceof Date?lT:typeof n=="number"?t:je)(n)}var qi=pJ();var uT=0,fT;function pR(){let e=uT;return uT=0,fT=void 0,e}function Vn(e){e!==fT&&(fT=e,console.warn(e),++uT)}var Ce=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,mJ=0;function ww(){return`plot-clip-${++mJ}`}function vw(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:g,opacity:y,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:I},{ariaLabel:N,fill:A="currentColor",fillOpacity:D,stroke:T="none",strokeOpacity:O,strokeWidth:C,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:E,paintOrder:F}){A===null&&(a=null,c=null),T===null&&(l=null,f=null),re(A)?!re(T)&&(!re(a)||I?.fill)&&(T="none"):re(T)&&(!re(l)||I?.stroke)&&(A="none");let[R,k]=Be(a,A),[$,P]=se(c,D),[U,W]=Be(l,T),[tt,nt]=se(f,O),[at,Y]=se(y);ta(W)||(u===void 0&&(u=C),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!YF(d)&&(p=E),!ta(k)&&w===void 0&&(w=F));let[rt,j]=se(u);return A!==null&&(e.fill=fe(k,"currentColor"),e.fillOpacity=Pm(P,1)),T!==null&&(e.stroke=fe(W,"none"),e.strokeWidth=Pm(j,1),e.strokeOpacity=Pm(nt,1),e.strokeLinejoin=fe(d,"miter"),e.strokeLinecap=fe(h,"butt"),e.strokeMiterlimit=Pm(p,4),e.strokeDasharray=fe(m,"none"),e.strokeDashoffset=fe(g,"0")),e.target=je(s),e.ariaLabel=je(N),e.ariaDescription=je(i),e.ariaHidden=je(o),e.opacity=Pm(Y,1),e.mixBlendMode=fe(x,"normal"),e.imageFilter=fe(b,"none"),e.paintOrder=fe(w,"normal"),e.pointerEvents=fe(_,"auto"),e.shapeRendering=fe(v,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:R,scale:"auto",optional:!0},fillOpacity:{value:$,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function yJ(e,t){t&&e.filter(n=>Em(t[n])).append("title").call(xJ,t)}function gJ(e,t){t&&e.filter(([n])=>Em(t[n])).append("title").call(bJ,t)}function xJ(e,t){t&&e.text(n=>qi(t[n]))}function bJ(e,t){t&&e.text(([n])=>qi(t[n]))}function Qt(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&&mR(e,d=>f[d],t),n||yJ(e,i)}function Tl(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&&mR(e,([d])=>f[d],t),n||gJ(e,i)}function wJ({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 Um(e,t,n){let r=cn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Vn("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*_w(e,t,n,r){let{z:i}=n,{z:o}=r,s=wJ(r,n),a=[...t,...s];for(let c of o?Um(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!ze(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Qs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Qs(s[d][f])!==l[d]){yield u,l=s.map(p=>Qs(p[f])),u=[f];continue t}}u&&(yield u)}}function Sw(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=tn(e,"clip",["frame","sphere"])),e}function vJ(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=ww();i=`url(#${d})`,e=ut("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=ww();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",En(s)({type:"Sphere"}));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 Ct(e,t,n,r){vJ(e,t,n,r),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 Lt(e,t){_J(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function mR(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(oi.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(oi.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 _J(e,t,n){n!=null&&e.style(t,n)}function Et(e,t,{x:n,y:r},i=Ce,o=Ce){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 fe(e,t){if((e=je(e))!==t)return e}function Pm(e,t){if((e=Bt(e))!==t)return e}var SJ=/^-?([_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 Of(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!SJ.test(e))throw new Error(`invalid class name: ${e}`);return e}function Bf(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 gn({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]}function nc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:Sw(n)}}function ut(e,{document:t}){return Vt(Os(e).call(t.documentElement))}var gR=Math.PI,na=2*gR,yR=.618;function xR({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(pn(e)){let _;if({type:e,domain:c,inset:_,insetTop:n=_!==void 0?_:n,insetRight:r=_!==void 0?_:r,insetBottom:i=_!==void 0?_:i,insetLeft:o=_!==void 0?_:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=bR(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,g=u-d-h-o-r,y=f-p-m-n-i;if(e=e?.({width:g,height:y,clip:l,...a}),e==null)return;l=IJ(l,d,p,u-h,f-m);let x=d+o,b=p+n,w;if(c!=null){let[[_,v],[I,N]]=En(e).bounds(c),A=Math.min(g/(I-_),y/(N-v));A>0?(x-=(A*(_+I)-g)/2,b-=(A*(v+N)-y)/2,w=cl({point(D,T){this.stream.point(D*A+x,T*A+b)}})):Vn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?wR():cl({point(_,v){this.stream.point(_+x,v+b)}}),{stream:_=>e.stream(w.stream(l(_)))}}function bR(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Vi(lM,.7463,.4673);case"albers":return Iw(Up,.7463,.4673);case"azimuthal-equal-area":return Vi(fM,4,4);case"azimuthal-equidistant":return Vi(hM,na,na);case"conic-conformal":return Iw(yM,na,na);case"conic-equal-area":return Iw(Pa,6.1702,2.9781);case"conic-equidistant":return Iw(xM,7.312,3.6282);case"equal-earth":return Vi(wM,5.4133,2.6347);case"equirectangular":return Vi(gM,na,gR);case"gnomonic":return Vi(_M,3.4641,3.4641);case"identity":return{type:wR};case"reflect-y":return{type:MJ};case"mercator":return Vi(pM,na,na);case"orthographic":return Vi(IM,2,2);case"stereographic":return Vi(AM,2,2);case"transverse-mercator":return Vi(EM,na,na);default:throw new Error(`unknown projection type: ${e}`)}}function IJ(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 Wu(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Vi(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),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function Iw(e,t,n){let{type:r,aspectRatio:i}=Vi(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&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var wR=hn({stream:e=>e}),MJ=hn(cl({point(e,t){this.stream.point(e,-t)}}));function dT(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 vR({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(pn(e)&&(e=e.type),e!=null)}function _R(e){if(typeof e?.stream=="function")return yR;if(pn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=bR(e);if(t)return t}return yR}}function rc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Df(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&dT("x","y",o,n),r&&(o.x=Ke(o.x)),i&&(o.y=Ke(o.y)),o}function SR(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)Pr(s,o);return[r,i]}var AJ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],ER=new Map([["accent",QM],["category10",JM],["dark2",KM],["observable10",AJ],["paired",tA],["pastel1",eA],["pastel2",nA],["set1",rA],["set2",iA],["set3",oA],["tableau10",sA]]);function NR(e){return e!=null&&ER.has(`${e}`.toLowerCase())}var IR=new Map([...ER,["brbg",ra(Fb,Rb)],["prgn",ra($b,Pb)],["piyg",ra(Ub,zb)],["puor",ra(jb,qb)],["rdbu",ra(lm,af)],["rdgy",ra(Vb,Yb)],["rdylbu",ra(um,cf)],["rdylgn",ra(Xb,Gb)],["spectral",ra(Wb,Hb)],["burd",MR(lm,af)],["buylrd",MR(um,cf)],["blues",xn(w1,v1)],["greens",xn(_1,S1)],["greys",xn(I1,M1)],["oranges",xn(D1,O1)],["purples",xn(A1,T1)],["reds",xn(E1,N1)],["turbo",ia(U1)],["viridis",ia(j1)],["magma",ia(q1)],["inferno",ia(V1)],["plasma",ia(Y1)],["cividis",ia(B1)],["cubehelix",ia(L1)],["warm",ia(k1)],["cool",ia(F1)],["bugn",xn(Zb,Jb)],["bupu",xn(Qb,Kb)],["gnbu",xn(t1,e1)],["orrd",xn(n1,r1)],["pubu",xn(s1,a1)],["pubugn",xn(i1,o1)],["purd",xn(c1,l1)],["rdpu",xn(u1,f1)],["ylgn",xn(p1,m1)],["ylgnbu",xn(d1,h1)],["ylorbr",xn(y1,g1)],["ylorrd",xn(x1,b1)],["rainbow",AR(R1)],["sinebow",AR(P1)]]);function xn(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?Fn(t,n):e[n])}function ra(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Fn(t,n):e[n])}function MR(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Fn(r=>t(1-r),n):e[n].slice().reverse())}function ia(e){return({length:t})=>Fn(e,Math.max(2,Math.floor(t)))}function AR(e){return({length:t})=>Fn(e,Math.floor(t)+1).slice(0,-1)}function hT(e){let t=`${e}`.toLowerCase();if(!IR.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return IR.get(t)}function zm(e,t){let n=hT(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function DR(e,t="greys"){let n=new Set,[r,i]=zm(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 TR=new Map([["brbg",Rb],["prgn",Pb],["piyg",zb],["puor",qb],["rdbu",af],["rdgy",Yb],["rdylbu",cf],["rdylgn",Gb],["spectral",Hb],["burd",e=>af(1-e)],["buylrd",e=>cf(1-e)],["blues",v1],["greens",S1],["greys",M1],["purples",T1],["reds",N1],["oranges",O1],["turbo",U1],["viridis",j1],["magma",q1],["inferno",V1],["plasma",Y1],["cividis",B1],["cubehelix",L1],["warm",k1],["cool",F1],["bugn",Jb],["bupu",Kb],["gnbu",e1],["orrd",r1],["pubugn",o1],["pubu",a1],["purd",l1],["rdpu",f1],["ylgnbu",h1],["ylgn",m1],["ylorbr",g1],["ylorrd",b1],["rainbow",R1],["sinebow",P1]]);function Lf(e){let t=`${e}`.toLowerCase();if(!TR.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return TR.get(t)}var TJ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function OR(e){return e!=null&&TJ.has(`${e}`.toLowerCase())}var mT=e=>t=>e(1-t),pT=[0,1],BR=new Map([["number",_e],["rgb",si],["hsl",lI],["hcl",uI],["lab",bx]]);function yT(e){let t=`${e}`.toLowerCase();if(!BR.has(t))throw new Error(`unknown interpolator: ${t}`);return BR.get(t)}function kf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=UR(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=de.get(e)===Il?OJ(n,a):de.get(e)===Ml?BJ(n,a):de.get(e)===Al?pT:void 0,interpolate:h=de.get(e)===Vr?u==null&&d!==void 0?si:Lf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Kc:_e,reverse:p}){if(f=ko(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=yT(h)),p=!!p,d!==void 0){let m=(a=qe(a)).length,g=(d=qe(d)).length;if(m!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=yo(h,d),d=void 0}}if(h.length===1?(p&&(h=mT(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,g)=>g/(a.length-1)),d.length===2&&(d=pT)),t.interpolate((d===pT?hn:jm)(h))):t.interpolate(h),s){let[m,g]=le(a);(m>0||g<0)&&(a=Za(a),Hs(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=Da(a)),t.domain(a).unknown(c),i&&(t.nice(EJ(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 EJ(e,t){return e===!0?void 0:typeof e=="number"?e:$F(e,t)}function LR(e,t,n){return kf(e,Ps(),t,n)}function CR(e,t,n){return gT(e,t,{...n,exponent:.5})}function gT(e,t,{exponent:n=1,...r}){return kf(e,Qp().exponent(n),t,{...r,type:"pow"})}function kR(e,t,{base:n=10,domain:r=LJ(t),...i}){return kf(e,Zp().base(n),t,{...i,domain:r})}function FR(e,t,{constant:n=1,...r}){return kf(e,Jp().constant(n),t,r)}function RR(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=CJ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Fn(c,i):de.get(e)===Vr?zm(o,i):void 0),s.length>0&&(s=Kp(s,n===void 0?{length:i}:n).quantiles()),Mw(e,t,{domain:s,range:n,reverse:l,unknown:a})}function $R(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=UR(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=le(o),f;return n===void 0?(f=Mn(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?Fn(a,r):de.get(e)===Vr?zm(i,r):void 0):(f=Fn(_e(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Hs(qe(o))<0&&f.reverse(),Mw(e,t,{domain:f,range:n,reverse:c,unknown:s})}function Mw(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Fn(o,n.length+1):de.get(e)===Vr?zm(i,n.length+1):void 0,reverse:a}){n=qe(n);let c=Hs(n);if(!isNaN(c)&&!NJ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Da(s)),{type:"threshold",scale:tm(c<0?Da(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function NJ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Hn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function PR(e){return{type:"identity",scale:HF(de.get(e))?Wp():t=>t}}function Cf(e,t=yf){return e.length?[ue(e,({value:n})=>n===void 0?n:ue(n,t)),Wt(e,({value:n})=>n===void 0?n:Wt(n,t))]:[0,1]}function UR(e,t){let n=de.get(e);return(n===Il||n===Al||n===Ml?DJ:Cf)(t)}function DJ(e){return[0,e.length?Wt(e,({value:t})=>t===void 0?t:Wt(t,yf)):1]}function OJ(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Qn(e,.5,({value:s})=>s===void 0?NaN:Qn(s,.25,sr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Wt(i);return o<1?i.map(s=>s*o):i}function BJ(e,t){let n=Pi(e,({value:o})=>o===void 0?NaN:Pi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Wt(r);return i<1?r.map(o=>o*i):r}function LJ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Cf(e,sr);if(n<0)return Cf(e,Va)}return[1,10]}function CJ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function jm(e){return(t,n)=>r=>e(t+r*(n-t))}function Aw(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Cf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=de.get(e)===Vr?u==null&&f!==void 0?si:Lf(u!==void 0?u:"rdbu"):_e,reverse:p}){l=+l,a=qe(a);let[m,g]=a;if(a.length>2&&Vn(`Warning: the diverging ${e} scale domain contains extra elements.`),Hn(m,g)<0&&([m,g]=[g,m],p=!p),m=Math.min(m,l),g=Math.max(g,l),typeof h!="function"&&(h=yT(h)),f!==void 0&&(h=h.length===1?jm(h)(...f):yo(h,f)),p&&(h=mT(h)),d){let y=n.apply(l),x=y-n.apply(m),b=n.apply(g)-y;x<b?m=n.invert(y-b):x>b&&(g=n.invert(y+x))}return t.domain([m,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,g],pivot:l,interpolate:h,scale:t}}function zR(e,t,n){return Aw(e,cm(),kJ,t,n)}function jR(e,t,n){return xT(e,t,{...n,exponent:.5})}function xT(e,t,{exponent:n=1,...r}){return Aw(e,kb().exponent(n=+n),$J(n),t,{...r,type:"diverging-pow"})}function qR(e,t,{base:n=10,pivot:r=1,domain:i=Cf(t,r<0?Va:sr),...o}){return Aw(e,Lb().base(n=+n),FJ,t,{domain:i,pivot:r,...o})}function VR(e,t,{constant:n=1,...r}){return Aw(e,Cb().constant(n=+n),PJ(n),t,r)}var kJ={apply(e){return e},invert(e){return e}},FJ={apply:Math.log,invert:Math.exp},RJ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function $J(e){return e===.5?RJ:{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 PJ(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 YR(e,t,n,r){return kf(e,t,n,r)}function XR(e,t,n){return YR(e,Db(),t,n)}function GR(e,t,n){return YR(e,Ob(),t,n)}var Ff=Symbol("ordinal");function HR(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=ko(i,r),o===void 0&&(o=t7(n,i,e)),(r==="categorical"||r===Ff)&&(r="ordinal"),a&&(o=Da(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 ZR(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=ko(r,n),i===void 0&&(i=t7(t,r,e));let l;if(de.get(e)===Af)l=UJ(t),o=o===void 0?zJ(l):Gt(o,Tf);else if(de.get(e)===Vr&&(o===void 0&&(n==="ordinal"||n===Ff)&&(o=DR(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=Lf(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Fn(p=>u(f+d*p),h)}else o=hT(s);if(a===Xp)throw new Error(`implicit unknown on ${e} scale is not supported`);return HR(e,ul().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function JR(e,t,{align:n=.5,padding:r=.5,...i}){return KR(kM().align(n).padding(r),t,i,e)}function QR(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return KR(za().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function KR(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=HR(r,e,t,n),e.round=i,e}function t7(e,t,n){let r=new Jn;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]=le(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&de.get(n)===mi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return fo(r,dn)}function WR(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 UJ(e){return{fill:WR(e,"fill"),stroke:WR(e,"stroke")}}function zJ(e){return re(e.fill)?hA:J1}function qm(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 g={};for(let[y,x]of e){let b=m[y],w=c7(y,x,{round:de.get(y)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(w){let{label:_=y==="fx"||y==="fy"?p:t,percent:v,transform:I,inset:N,insetTop:A=N!==void 0?N:y==="y"?r:0,insetRight:D=N!==void 0?N:y==="x"?i:0,insetBottom:T=N!==void 0?N:y==="y"?o:0,insetLeft:O=N!==void 0?N:y==="x"?s:0}=b||{};if(I==null)I=void 0;else if(typeof I!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?jJ(x,w):_,w.transform=I,y==="x"||y==="fx"?(w.insetLeft=+O,w.insetRight=+D):(y==="y"||y==="fy")&&(w.insetTop=+A,w.insetBottom=+T),g[y]=w}}return g}function wT(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]=u7(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function o7(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?Nw(t):t;i&&e7(i,s),o&&n7(o,s);let a=i||o?vT(e,t):t;n&&e7(n,a),r&&n7(r,a)}function jJ(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!$o(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Ew(e){return Math.sign(Hs(e.domain()))*Math.sign(Hs(e.range()))}function Nw(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 vT({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Nw(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 e7(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)],$o(e)||(e.range=a7(e)),e.scale.range(e.range)}s7(e)}function n7(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],$o(e)?e.range.reverse():e.range=a7(e),e.scale.range(e.range)}s7(e)}function s7(e){e.round===void 0&&YJ(e)&&qJ(e)<=30&&e.scale.round(!0)}function qJ({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 a7(e){let t=e.scale.domain().length+_T(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 Dw(e,t,n){return c7(e,n===void 0?void 0:[{hint:n}],{...t})}function c7(e,t=[],n={}){let r=VJ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&$o({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Le)?Vn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Rf(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 "${Rf(r)}".`):i.some(jF)?Vn(`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 "${Rf(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 "${Rf(r)}".`):i.some(qF)&&Vn(`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 "${Rf(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 "${Rf(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=Tw(t,n,Ke);break;case"identity":switch(de.get(e)){case mi:n=Tw(t,n,Ke);break;case Af:n=Tw(t,n,XJ);break}break;case"utc":case"time":n=Tw(t,n,RF);break}switch(r){case"diverging":return zR(e,t,n);case"diverging-sqrt":return jR(e,t,n);case"diverging-pow":return xT(e,t,n);case"diverging-log":return qR(e,t,n);case"diverging-symlog":return VR(e,t,n);case"categorical":case"ordinal":case Ff:return ZR(e,t,n);case"cyclical":case"sequential":case"linear":return LR(e,t,n);case"sqrt":return CR(e,t,n);case"threshold":return Mw(e,t,n);case"quantile":return RR(e,t,n);case"quantize":return $R(e,t,n);case"pow":return gT(e,t,n);case"log":return kR(e,t,n);case"symlog":return FR(e,t,n);case"utc":return GR(e,t,n);case"time":return XR(e,t,n);case"point":return JR(e,t,n);case"band":return QR(e,t,n);case"identity":return PR(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Rf(e){return typeof e=="symbol"?e.description:e}function r7(e){return typeof e=="string"?`${e}`.toLowerCase():e}var i7={toString:()=>"projection"};function VJ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=r7(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=i7);for(let l of t){let u=r7(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===i7)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=de.get(e);if(c===Il)return"sqrt";if(c===Al||c===Ml)return"linear";if(c===Af)return"ordinal";if((r||i||[]).length>2)return bT(c);if(r!==void 0){if(Ne(r))return bT(c);if(Le(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ne))return bT(c);if(l.some(Le))return"utc"}if(c===Vr){if(s!=null||OR(o))return"diverging";if(NR(o))return"categorical"}return"linear"}function bT(e){switch(e){case mi:return"point";case Vr:return Ff;default:return"ordinal"}}function $o({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Ff}function _T({type:e}){return e==="threshold"}function YJ({type:e}){return e==="point"||e==="band"}function lr(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 Tw(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 XJ(e){return Gt(e,Tf)}function $f(e={}){let t;for(let n in e)if(de.has(n)&&Lo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=u7(Dw(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function l7(e){return t=>{if(!de.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function u7({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:Za(n),...r!==void 0&&{range:Za(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 d7(e,t,n={}){let r=.5-Ce,i=.5+Ce,o=.5+Ce,s=.5-Ce;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:x}of t)m>r&&(r=m),g>i&&(i=g),y>o&&(o=y),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=GJ(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:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=n.facet??{};g=+g,y=+y,x=+x,b=+b,p.facet={marginTop:g,marginRight:y,marginBottom:x,marginLeft:b}}return p}function GJ({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=_R(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*g+a+l)}let h=t?$o(t)?t.scale.domain().length:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=f7("y",t)/(f7("x",e)*o),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*y+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function f7(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]=le(r);return Math.abs(i(s)-i(o))}function p7(e,t){let{fx:n,fy:r}=qm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?G0(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 m7(e,{x:t,y:n}){return t&&=TT(t),n&&=TT(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 Bw(e,{fx:t,fy:n}){let r=ar(e),i=t?.value,o=n?.value;return t&&n?$i(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?$i(r,s=>(s.fx=i[s[0]],s),s=>i[s]):$i(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function y7(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 g7(e){let t=[],n=new Uint32Array(An(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 WJ=new Map([["top",ST],["right",AT],["bottom",IT],["left",MT],["top-left",Ow(ST,MT)],["top-right",Ow(ST,AT)],["bottom-left",Ow(IT,MT)],["bottom-right",Ow(IT,AT)],["top-empty",ZJ],["right-empty",KJ],["bottom-empty",JJ],["left-empty",QJ],["empty",tQ]]);function x7(e){if(e==null)return null;let t=WJ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var h7=new WeakMap;function TT(e){let t=h7.get(e);return t||h7.set(e,t=new Zn(Gt(e,(n,r)=>[n,r]))),t}function ic(e,t){return TT(e).get(t)}function HJ(e,t,n){return t=Qs(t),n=Qs(n),e.find(r=>Object.is(Qs(r.x),t)&&Object.is(Qs(r.y),n))}function Lw(e,t,n){return HJ(e,t,n)?.empty}function ST(e,{y:t},{y:n}){return t?ic(t,n)===0:!0}function IT(e,{y:t},{y:n}){return t?ic(t,n)===t.length-1:!0}function MT(e,{x:t},{x:n}){return t?ic(t,n)===0:!0}function AT(e,{x:t},{x:n}){return t?ic(t,n)===t.length-1:!0}function ZJ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o>0)return Lw(e,n,t[o-1])}function JJ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o<t.length-1)return Lw(e,n,t[o+1])}function QJ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o>0)return Lw(e,t[o-1],r)}function KJ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o<t.length-1)return Lw(e,t[o+1],r)}function tQ(e,t,{empty:n}){return n}function Ow(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function Cw(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 St=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:g=d,clip:y=i?.clip,channels:x,tip:b,render:w}=r;if(this.data=t,this.sort=Co(l)?l:null,this.initializer=Ie(r).initializer,this.transform=this.initializer?r.transform:yn(r).transform,o===null||o===!1?this.facet=null:(this.facet=tn(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Wa&&typeof a=="string"?[a]:a,this.fy=t===Wa&&typeof c=="string"?[c]:c),this.facetAnchor=x7(s),n=Lm(n),x!==void 0&&(n={...eQ(x),...n}),i!==void 0&&(n={...vw(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([_,v])=>{if(qr(v.value)){let{value:I,label:N=v.label,scale:A=v.scale}=v.value;v={...v,label:N,scale:A,value:I}}if(t===Wa&&typeof v.value=="string"){let{value:I}=v;v={...v,value:[I]}}return[_,v]}).filter(([_,{value:v,optional:I}])=>{if(v!=null)return!0;if(I)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=+g,this.clip=Sw(y),this.tip=nQ(b),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let _ in this.channels){let{scale:v}=n[_];if(!(v!=="x"&&v!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=Pf(w,this.render))}initialize(t,n,r){let i=qe(this.data);t===void 0&&i!=null&&(t=[ar(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=qe(i)),t!==void 0&&(t.original=o);let s=xw(this.channels,i);return this.sort!=null&&lR(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=ze}=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"&&dT(i,o,n,r.projection)}}scale(t,n,r){let i=Df(t,n);return r.projection&&this.project(t,i,r),i}};function en(...e){return e.plot=St.prototype.plot,e}function Pf(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 eQ(e){return Object.fromEntries(Object.entries(Lm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:pi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function nQ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?tn(e,"tip",["x","y","xy"]):e}function Yi(e,t){return e?.tip===!0?{...e,tip:t}:pn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var b7=new WeakMap;function ET(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:Pf(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:y}=p.getMarkState(this),x=b7.get(g);x||b7.set(g,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(W)-1,{x:w,y:_,fx:v,fy:I}=f,N=v?v(u.fx)-h.marginLeft:0,A=I?I(u.fy)-h.marginTop:0;w?.bandwidth&&(N+=w.bandwidth()/2),_?.bandwidth&&(A+=_.bandwidth()/2);let D=u.fi!=null,T;if(D){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),T=Y.get(this),T||Y.set(this,T=new Map)}let[O,C]=gn(this,h),{px:S,py:M}=d,E=S?Y=>S[Y]:NT(d,O),F=M?Y=>M[Y]:DT(d,C),R,k,$,P;function U(Y,rt){if(D)if(P&&(P=cancelAnimationFrame(P)),Y==null)T.delete(u.fi);else{T.set(u.fi,rt),P=requestAnimationFrame(()=>{P=null;for(let[j,H]of T)if(H<rt||H===rt&&j<u.fi){Y=null;break}W(Y)});return}W(Y)}function W(Y){if(R===Y&&$===x.sticky)return;R=Y,$=p.pointerSticky=x.sticky;let rt=R==null?[]:[R];D&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let j=m(rt,f,d,h,p);if(k){if(D){let H=k.parentNode,ot=k.getAttribute("transform"),z=j.getAttribute("transform");ot?j.setAttribute("transform",ot):j.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),j.removeAttribute("aria-label"),j.removeAttribute("aria-description"),j.removeAttribute("aria-hidden")}k.replaceWith(j)}return x.roots[b]=k=j,R==null&&T?.size>1||p.dispatchValue(R==null?null:y[R]),j}function tt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,j]=kn(Y);rt-=N,j-=A;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=j<h.marginTop||j>h.height-h.marginBottom?1:t,z=null,kt=s*s;for(let dt of u){let Ht=H*(E(dt)-rt),Zt=ot*(F(dt)-j),et=Ht*Ht+Zt*Zt;et<=kt&&(z=dt,kt=et)}if(z!=null&&(e!==1||t!==1)){let dt=E(z)-rt,Ht=F(z)-j;kt=dt*dt+Ht*Ht}U(z,kt)}function nt(Y){Y.pointerType==="mouse"&&R!=null&&(x.sticky&&x.roots.some(rt=>rt?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(rt=>rt(null))):(x.sticky=!0,W(R)),Y.stopImmediatePropagation()))}function at(Y){Y.pointerType==="mouse"&&(x.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",at),W(null)},c)}}function Uf(e){return ET(1,1,e)}function zf(e){return ET(1,.01,e)}function El(e){return ET(.01,1,e)}function NT({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function DT({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function kw(e){return $o(e)&&e.interval===void 0?void 0:"tabular-nums"}function w7(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=kw(e),round:p=!0,opacity:m,className:g}=t,y=nc(t);g=Of(g),m=se(m)[1],d===null&&(d=()=>null);let x=ut("svg",y).attr("class",`${g}-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(O=>O.append("style").text(`:where(.${g}-ramp) {
15
+ ${n}`}function YZ(e){return e==="time"?iw:e==="utc"?Lm:jZ}function kF(e,t,n){let r=Wt(tx(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return BF("millisecond","utc",n);for(let[i,o,s,a]of YZ(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return BF(i,s,n)}}function wf(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-Hs(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var _l=Object.getPrototypeOf(Uint8Array),XZ=Object.prototype.toString,jA=Symbol("reindex");function wt(e,t,n){let r=typeof t;return r==="string"?FF(e,VA(t),n):r==="function"?FF(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Gt(e,hn(t),n):typeof t?.transform=="function"?RF(t.transform(e),n):GZ(RF(t,n),e?.[jA])}function GZ(e,t){return t?Fm(e,t):e}function FF(e,t,n){return Gt(e,n?.prototype instanceof _l?WZ(t):t,n)}function RF(e,t){return t===void 0?je(e):e instanceof t?e:t.prototype instanceof _l&&!(e instanceof _l)?t.from(e,YA):t.from(e)}function WZ(e){return(t,n)=>YA(e(t,n))}var Wa=[null],VA=e=>t=>t[e],Ee={transform:ar},G={transform:e=>e};var km=()=>1,$F=()=>!0,qe=e=>e==null?e:`${e}`,Bt=e=>e==null?e:+e;var Zs=e=>e?e[0]:void 0,Ha=e=>e?e[1]:void 0,PF=e=>e?e[2]:void 0,hn=e=>()=>e;function Sf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Qn(n,t,r)}function Ke(e){return e instanceof _l?e:Gt(e,YA,Float64Array)}function YA(e){return e==null?NaN:Number(e)}function UF(e){return Gt(e,XA)}function XA(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?wl(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Be(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Qa(e)?[void 0,e]:[e,void 0]}function se(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function GA(e,t,n){if(e!=null)return tn(e,t,n)}function tn(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function je(e){return e==null||e instanceof Array||e instanceof _l?e:Array.from(e)}function Gt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Za(e,t=Array){return e instanceof t?e.slice():t.from(e)}function WA({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function HA({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function If(e){return WA(e)||HA(e)||e.interval!==void 0}function pn(e){return e?.toString===XZ}function Lo(e){return pn(e)&&(e.type!==void 0||e.domain!==void 0)}function jr(e){return pn(e)&&typeof e.transform!="function"}function Co(e){return jr(e)&&e.value===void 0&&e.channel===void 0}function ZA(e,t,n,r=G){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 $e(e,t){return e===void 0&&t===void 0?[Zs,Ha]:[e,t]}function jn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Be(t)),e===void 0&&([e]=Be(n)),e}function ar(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Fm(e,t){return Gt(t,n=>e[n],e.constructor)}function Mf(e){return e.length===1?(t,n)=>e(Fm(n,t)):e}function Js(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Qs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function aw(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 mn(e){let t;return[{transform:()=>t,label:On(e)},n=>t=n]}function Dn(e){return e==null?[e]:mn(e)}function On(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Af(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Le(r)||Le(i)?Gt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Gt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function Sl(e,t){let n=JA(t?.interval,t?.type);return n?Gt(e,n):e}function JA(e,t){let n=Tf(e,t);return n&&(r=>ze(r)?n.floor(r):r)}function Tf(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>Ue(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Ue(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?zA:Cm)(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 ko(e,t){if(e=Tf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function zF(e,t){if(e=ko(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function qF(e){return Ja(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Ja(e){return typeof e?.range=="function"}function pi(e){return e===void 0||jr(e)?e:{value:e}}function jF(e){return e==null?null:{transform:t=>wt(t,e,Float64Array),label:On(e)}}function VF(e){if(!cr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function cr(e){return e&&typeof e[Symbol.iterator]=="function"}function cw(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ne(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Le(e){for(let t of e)if(t!=null)return t instanceof Date}function YF(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&wl(t)}function XF(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Ks(e){for(let t of e)if(t!=null)return typeof t=="number"}function lw(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var HZ=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 Qa(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)||HZ.has(e))}function GF(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function re(e){return e==null||ta(e)}function ta(e){return/^\s*none\s*$/i.test(e)}function WF(e){return/^\s*round\s*$/i.test(e)}function uw(e,t){return GA(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Fo(e="middle"){return uw(e,"frameAnchor")}function Hs(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Hn(t,n)}function HF(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 ZZ(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 Rm(e){return cr(e)?ZZ(e):e}var mi=Symbol("position"),Vr=Symbol("color"),Il=Symbol("radius"),Ml=Symbol("length"),Al=Symbol("opacity"),Ef=Symbol("symbol"),ZF=Symbol("projection"),de=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",Il],["color",Vr],["opacity",Al],["symbol",Ef],["length",Ml],["projection",ZF]]);function JF(e){return e===mi||e===ZF}function QF(e){return e===mi||e===Il||e===Ml||e===Al}var QA=Math.sqrt(3),KA=2/QA,JZ={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*KA,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()}},tT=new Map([["asterisk",gm],["circle",Gs],["cross",xm],["diamond",bm],["diamond2",wm],["hexagon",JZ],["plus",vm],["square",_m],["square2",Sm],["star",Im],["times",pf],["triangle",Mm],["triangle2",Am],["wye",Tm]]);function eT(e){return e&&typeof e.draw=="function"}function KF(e){return eT(e)?!0:typeof e!="string"?!1:tT.has(e.toLowerCase())}function Nf(e){if(e==null||eT(e))return e;let t=tT.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function tR(e){if(e==null||eT(e))return[void 0,e];if(typeof e=="string"){let t=tT.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function yn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=iT(e)),t!=null&&!Co(t)&&(r=nT(r,sT(t))),n&&(r=nT(r,oT))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Co(t))&&{sort:t},transform:nT(r,s)}}function Ie({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=iT(e)),t!=null&&!Co(t)&&(r=rT(r,sT(t))),n&&(r=rT(r,oT))),{...i,...(t===null||Co(t))&&{sort:t},initializer:rT(r,o)}}function nT(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,je(n),r,i)}}function rT(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 fw(e,t){return(e.initializer!=null?Ie:yn)(e,t)}function eR(e,t){return fw(t,iT(e))}function iT(e){return(t,n)=>{let r=wt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function nR({sort:e,...t}={}){return{...fw(t,oT),sort:Co(e)?e:null}}function oT(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function rR({seed:e,sort:t,...n}={}){return{...fw(n,iR(e==null?Math.random:Mo(e))),sort:Co(t)?t:null}}function dw(e,{sort:t,...n}={}){return{...(jr(e)&&e.channel!==void 0?Ie:fw)(n,sT(e)),sort:Co(t)?t:null}}function sT(e){return(typeof e=="function"&&e.length!==1?QZ:iR)(e)}function QZ(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function iR(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?bl:dn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=dn;break;case"descending":n=bl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=wt(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 Pm(e,t){return hw(null,null,e,t)}function tc(e={y:"count"},t={}){let{x:n=G}=t;if(n==null)throw new Error("missing channel: x");return hw(n,null,e,t)}function ec(e={x:"count"},t={}){let{y:n=G}=t;if(n==null)throw new Error("missing channel: y");return hw(null,n,e,t)}function Um(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=$e(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return hw(n,r,e,t)}function hw(e,t,{data:n=yw,filter:r,sort:i,reverse:o,...s}={},a={}){s=cT(s,a),n=lR(n,G),i=i==null?void 0:aR("sort",i,a),r=r==null?void 0:cR("filter",r,a);let[c,l]=Dn(e),[u,f]=Dn(t),{z:d,fill:h,stroke:p,x1:m,x2:g,y1:y,y2:x,...b}=a,[w,v]=Dn(d),[_]=Be(h),[I]=Be(p),[D,A]=Dn(_),[E,T]=Dn(I);return{..."z"in a&&{z:w||d},..."fill"in a&&{fill:D||h},..."stroke"in a&&{stroke:E||p},...yn(b,(O,C,S)=>{let M=Sl(wt(O,e),S?.x),N=Sl(wt(O,t),S?.y),F=wt(O,d),R=wt(O,_),k=wt(O,I),$=zm(s,{z:F,fill:R,stroke:k}),P=[],U=[],W=M&&l([]),tt=N&&f([]),nt=F&&v([]),at=R&&A([]),Y=k&&T([]),rt=0;for(let j of s)j.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let j of C){let H=[];for(let ot of s)ot.scope("facet",j);i&&i.scope("facet",j),r&&r.scope("facet",j);for(let[ot,z]of Ka(j,$))for(let[kt,dt]of Ka(z,N))for(let[Ht,Zt]of Ka(dt,M)){let et={data:O};if(M&&(et.x=Ht),N&&(et.y=kt),!(r&&!r.reduce(Zt,et))){H.push(rt++),U.push(n.reduceIndex(Zt,O,et)),M&&W.push(Ht),N&&tt.push(kt),F&&nt.push($===F?ot:F[Zt[0]]),R&&at.push($===R?ot:R[Zt[0]]),k&&Y.push($===k?ot:k[Zt[0]]);for(let ae of s)ae.reduce(Zt,et);i&&i.reduce(Zt,et)}}P.push(H)}return lT(P,i,o),{data:U,facets:P}}),...!Ro(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!Ro(s,"y")&&(u?{y:u}:{y1:y,y2:x}),...Object.fromEntries(s.map(({name:O,output:C})=>[O,C]))}}function Ro(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function aT(e,t,n=pw){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",iJ]),t.href!=null&&e.href===void 0&&r.push(["href",gw]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?KZ(i):n(i,o,t))}function pw(e,t,n,r=mw){let i;pn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=mn(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 KZ(e){return{name:e,initialize(){},scope(){},reduce(){}}}function mw(e,t,n,r=Df){let i=aw(e,n),o=r(t,i),s,a;return{label:On(o===$m?null:i,o.label),initialize(c){s=i===void 0?c:wt(c,i),o.scope==="data"&&(a=o.reduceIndex(ar(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 Ka(e,t){return t?fo(cn(e,n=>t[n]),Zs):[[,e]]}function Df(e,t,n=tJ){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&pn(e))return nJ(e);if(typeof e=="function")return rJ(e);if(/^p\d{2}$/i.test(e))return ea(Sf(e));switch(`${e}`.toLowerCase()){case"first":return gw;case"last":return oJ;case"identity":return yw;case"count":return $m;case"distinct":return sJ;case"sum":return t==null?$m:aJ;case"proportion":return sR(t,"data");case"proportion-facet":return sR(t,"facet");case"deviation":return ea(ii);case"min":return ea(ue);case"min-index":return ea(J0);case"max":return ea(Wt);case"max-index":return ea(Z0);case"mean":return oR(Ns);case"median":return oR(Pi);case"variance":return ea(Ea);case"mode":return ea(Ou)}return n(e)}function tJ(e){throw new Error(`invalid reduce: ${e}`)}function cT(e,t){return aT(e,t,aR)}function aR(e,t,n){return pw(e,t,n,cR)}function cR(e,t,n){return mw(e,t,n,lR)}function lR(e,t){return Df(e,t,eJ)}function eJ(e){switch(`${e}`.toLowerCase()){case"x":return cJ;case"y":return lJ}throw new Error(`invalid group reduce: ${e}`)}function zm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function lT(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>dn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function nJ(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function rJ(e){return{reduceIndex(t,n,r){return e(Fm(n,t),r)}}}function ea(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function oR(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Le(n)?new Date(r):r}}}var yw={reduceIndex(e,t){return Fm(t,e)}},gw={reduceIndex(e,t){return t[e[0]]}},iJ={reduceIndex(e,t){let r=fo($i(e,o=>o.length,o=>t[o]),Ha),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`,An(o,Ha)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},oJ={reduceIndex(e,t){return t[e[e.length-1]]}},$m={label:"Frequency",reduceIndex(e){return e.length}},sJ={label:"Distinct",reduceIndex(e,t){let n=new Jn;for(let r of e)n.add(t[r]);return n.size}},aJ=ea(An);function sR(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>An(n,o=>r[o])/i}}var cJ={reduceIndex(e,t,{x:n}){return n}},lJ={reduceIndex(e,t,{y:n}){return n}};function uR(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function Of(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=On(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),fT(a,{scale:t,type:n,value:wt(e,r),label:s,filter:i,hint:o})}function xw(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Of(t,r,n)]))}function Bf(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:Gt(o,s)]}));return n.channels=e,n}function fT(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&&lw(r,Qa)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&lw(r,GF)?null:"opacity";break;case"symbol":n!==!0&&lw(r,KF)?(t.scale=null,t.value=Gt(r,Nf)):t.scale="symbol";break;default:t.scale=de.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!de.has(n))throw new Error(`unknown scale: ${n}`);return t}function dR(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!de.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?pR:hR:dJ(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?fJ(t,r[l]):uJ(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let y=g.value,[x=0,b=1/0]=cr(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let w=Array.from(new Jn(y));return d&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=u==="data"?e:u==="height"?fR(n,"y1","y2"):u==="width"?fR(n,"x1","x2"):uT(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Df(h===!0?"max":h,w);g.domain=()=>{let _=US(ar(y),I=>v.reduceIndex(I,w),I=>y[I]);return f&&_.sort(f),d&&_.reverse(),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_.map(Zs)}}}}function uJ(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function fJ(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 fR(e,t,n){let r=uT(e,t),i=uT(e,n);return Gt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function uT(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 dJ(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return hR;case"descending":return pR}throw new Error(`invalid order: ${e}`)}function hR([e,t],[n,r]){return dn(t,r)||dn(e,n)}function pR([e,t],[n,r]){return bl(t,r)||dn(e,n)}function qm(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function bw(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var hJ=bw(e=>new Intl.NumberFormat(e)),pJ=bw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),mJ=bw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function yJ(e="en-US"){let t=hJ(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function mR(e="en-US",t="short"){let n=pJ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function yR(e="en-US",t="short"){let n=mJ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function dT(e){return bf(e,"Invalid Date")}function gJ(e="en-US"){let t=yJ(e);return n=>(n instanceof Date?dT:typeof n=="number"?t:qe)(n)}var ji=gJ();var hT=0,pT;function gR(){let e=hT;return hT=0,pT=void 0,e}function Vn(e){e!==pT&&(pT=e,console.warn(e),++hT)}var Ce=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,xJ=0;function ww(){return`plot-clip-${++xJ}`}function vw(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:g,opacity:y,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:v,shapeRendering:_,channels:I},{ariaLabel:D,fill:A="currentColor",fillOpacity:E,stroke:T="none",strokeOpacity:O,strokeWidth:C,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:N,paintOrder:F}){A===null&&(a=null,c=null),T===null&&(l=null,f=null),re(A)?!re(T)&&(!re(a)||I?.fill)&&(T="none"):re(T)&&(!re(l)||I?.stroke)&&(A="none");let[R,k]=Be(a,A),[$,P]=se(c,E),[U,W]=Be(l,T),[tt,nt]=se(f,O),[at,Y]=se(y);ta(W)||(u===void 0&&(u=C),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!WF(d)&&(p=N),!ta(k)&&w===void 0&&(w=F));let[rt,j]=se(u);return A!==null&&(e.fill=fe(k,"currentColor"),e.fillOpacity=jm(P,1)),T!==null&&(e.stroke=fe(W,"none"),e.strokeWidth=jm(j,1),e.strokeOpacity=jm(nt,1),e.strokeLinejoin=fe(d,"miter"),e.strokeLinecap=fe(h,"butt"),e.strokeMiterlimit=jm(p,4),e.strokeDasharray=fe(m,"none"),e.strokeDashoffset=fe(g,"0")),e.target=qe(s),e.ariaLabel=qe(D),e.ariaDescription=qe(i),e.ariaHidden=qe(o),e.opacity=jm(Y,1),e.mixBlendMode=fe(x,"normal"),e.imageFilter=fe(b,"none"),e.paintOrder=fe(w,"normal"),e.pointerEvents=fe(v,"auto"),e.shapeRendering=fe(_,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:R,scale:"auto",optional:!0},fillOpacity:{value:$,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function bJ(e,t){t&&e.filter(n=>Bm(t[n])).append("title").call(vJ,t)}function wJ(e,t){t&&e.filter(([n])=>Bm(t[n])).append("title").call(_J,t)}function vJ(e,t){t&&e.text(n=>ji(t[n]))}function _J(e,t){t&&e.text(([n])=>ji(t[n]))}function Qt(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&&xR(e,d=>f[d],t),n||bJ(e,i)}function Tl(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&&xR(e,([d])=>f[d],t),n||wJ(e,i)}function SJ({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 Vm(e,t,n){let r=cn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Vn("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*_w(e,t,n,r){let{z:i}=n,{z:o}=r,s=SJ(r,n),a=[...t,...s];for(let c of o?Vm(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!ze(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Qs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Qs(s[d][f])!==l[d]){yield u,l=s.map(p=>Qs(p[f])),u=[f];continue t}}u&&(yield u)}}function Sw(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=tn(e,"clip",["frame","sphere"])),e}function IJ(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=ww();i=`url(#${d})`,e=ut("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=ww();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",En(s)({type:"Sphere"}));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 Ct(e,t,n,r){IJ(e,t,n,r),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 Lt(e,t){MJ(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function xR(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(oi.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(oi.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 MJ(e,t,n){n!=null&&e.style(t,n)}function Et(e,t,{x:n,y:r},i=Ce,o=Ce){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 fe(e,t){if((e=qe(e))!==t)return e}function jm(e,t){if((e=Bt(e))!==t)return e}var AJ=/^-?([_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 Lf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!AJ.test(e))throw new Error(`invalid class name: ${e}`);return e}function Cf(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 gn({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]}function nc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:Sw(n)}}function ut(e,{document:t}){return Vt(Os(e).call(t.documentElement))}var wR=Math.PI,na=2*wR,bR=.618;function vR({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(pn(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}=_R(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,g=u-d-h-o-r,y=f-p-m-n-i;if(e=e?.({width:g,height:y,clip:l,...a}),e==null)return;l=TJ(l,d,p,u-h,f-m);let x=d+o,b=p+n,w;if(c!=null){let[[v,_],[I,D]]=En(e).bounds(c),A=Math.min(g/(I-v),y/(D-_));A>0?(x-=(A*(v+I)-g)/2,b-=(A*(_+D)-y)/2,w=Object.assign(cl({point(E,T){this.stream.point(E*A+x,T*A+b)}}),{invert:([E,T])=>[(E-x)/A,(T-b)/A]})):Vn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?SR():Object.assign(cl({point(v,_){this.stream.point(v+x,_+b)}}),{invert:([v,_])=>[v-x,_-b]}),{stream:v=>e.stream(w.stream(l(v))),invert:v=>e.invert(w.invert(v))}}function _R(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Vi(dM,.7463,.4673);case"albers":return Iw(Vp,.7463,.4673);case"azimuthal-equal-area":return Vi(pM,4,4);case"azimuthal-equidistant":return Vi(yM,na,na);case"conic-conformal":return Iw(bM,na,na);case"conic-equal-area":return Iw(Pa,6.1702,2.9781);case"conic-equidistant":return Iw(vM,7.312,3.6282);case"equal-earth":return Vi(SM,5.4133,2.6347);case"equirectangular":return Vi(wM,na,wR);case"gnomonic":return Vi(MM,3.4641,3.4641);case"identity":return{type:SR};case"reflect-y":return{type:EJ};case"mercator":return Vi(gM,na,na);case"orthographic":return Vi(TM,2,2);case"stereographic":return Vi(NM,2,2);case"transverse-mercator":return Vi(OM,na,na);default:throw new Error(`unknown projection type: ${e}`)}}function TJ(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 Zu(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Vi(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),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function Iw(e,t,n){let{type:r,aspectRatio:i}=Vi(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&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var SR=hn({stream:e=>e,invert:e=>e}),EJ=hn(Object.assign(cl({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function mT(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 IR({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(pn(e)&&(e=e.type),e!=null)}function MR(e){if(typeof e?.stream=="function")return bR;if(pn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=_R(e);if(t)return t}return bR}}function rc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Bf(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&mT("x","y",o,n),r&&(o.x=Ke(o.x)),i&&(o.y=Ke(o.y)),o}function AR(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)Pr(s,o);return[r,i]}var NJ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],OR=new Map([["accent",eA],["category10",tA],["dark2",nA],["observable10",NJ],["paired",rA],["pastel1",iA],["pastel2",oA],["set1",sA],["set2",aA],["set3",cA],["tableau10",lA]]);function BR(e){return e!=null&&OR.has(`${e}`.toLowerCase())}var TR=new Map([...OR,["brbg",ra(Fb,Rb)],["prgn",ra($b,Pb)],["piyg",ra(Ub,zb)],["puor",ra(qb,jb)],["rdbu",ra(hm,lf)],["rdgy",ra(Vb,Yb)],["rdylbu",ra(pm,uf)],["rdylgn",ra(Xb,Gb)],["spectral",ra(Wb,Hb)],["burd",ER(hm,lf)],["buylrd",ER(pm,uf)],["blues",xn(w1,v1)],["greens",xn(_1,S1)],["greys",xn(I1,M1)],["oranges",xn(D1,O1)],["purples",xn(A1,T1)],["reds",xn(E1,N1)],["turbo",ia(U1)],["viridis",ia(q1)],["magma",ia(j1)],["inferno",ia(V1)],["plasma",ia(Y1)],["cividis",ia(B1)],["cubehelix",ia(L1)],["warm",ia(k1)],["cool",ia(F1)],["bugn",xn(Zb,Jb)],["bupu",xn(Qb,Kb)],["gnbu",xn(t1,e1)],["orrd",xn(n1,r1)],["pubu",xn(s1,a1)],["pubugn",xn(i1,o1)],["purd",xn(c1,l1)],["rdpu",xn(u1,f1)],["ylgn",xn(p1,m1)],["ylgnbu",xn(d1,h1)],["ylorbr",xn(y1,g1)],["ylorrd",xn(x1,b1)],["rainbow",NR(R1)],["sinebow",NR(P1)]]);function xn(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?Fn(t,n):e[n])}function ra(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Fn(t,n):e[n])}function ER(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Fn(r=>t(1-r),n):e[n].slice().reverse())}function ia(e){return({length:t})=>Fn(e,Math.max(2,Math.floor(t)))}function NR(e){return({length:t})=>Fn(e,Math.floor(t)+1).slice(0,-1)}function yT(e){let t=`${e}`.toLowerCase();if(!TR.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return TR.get(t)}function Ym(e,t){let n=yT(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function LR(e,t="greys"){let n=new Set,[r,i]=Ym(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 DR=new Map([["brbg",Rb],["prgn",Pb],["piyg",zb],["puor",jb],["rdbu",lf],["rdgy",Yb],["rdylbu",uf],["rdylgn",Gb],["spectral",Hb],["burd",e=>lf(1-e)],["buylrd",e=>uf(1-e)],["blues",v1],["greens",S1],["greys",M1],["purples",T1],["reds",N1],["oranges",O1],["turbo",U1],["viridis",q1],["magma",j1],["inferno",V1],["plasma",Y1],["cividis",B1],["cubehelix",L1],["warm",k1],["cool",F1],["bugn",Jb],["bupu",Kb],["gnbu",e1],["orrd",r1],["pubugn",o1],["pubu",a1],["purd",l1],["rdpu",f1],["ylgnbu",h1],["ylgn",m1],["ylorbr",g1],["ylorrd",b1],["rainbow",R1],["sinebow",P1]]);function kf(e){let t=`${e}`.toLowerCase();if(!DR.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return DR.get(t)}var DJ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function CR(e){return e!=null&&DJ.has(`${e}`.toLowerCase())}var xT=e=>t=>e(1-t),gT=[0,1],kR=new Map([["number",_e],["rgb",si],["hsl",dI],["hcl",hI],["lab",bx]]);function bT(e){let t=`${e}`.toLowerCase();if(!kR.has(t))throw new Error(`unknown interpolator: ${t}`);return kR.get(t)}function Rf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=jR(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=de.get(e)===Il?CJ(n,a):de.get(e)===Ml?kJ(n,a):de.get(e)===Al?gT:void 0,interpolate:h=de.get(e)===Vr?u==null&&d!==void 0?si:kf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Kc:_e,reverse:p}){if(f=ko(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=bT(h)),p=!!p,d!==void 0){let m=(a=je(a)).length,g=(d=je(d)).length;if(m!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=yo(h,d),d=void 0}}if(h.length===1?(p&&(h=xT(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,g)=>g/(a.length-1)),d.length===2&&(d=gT)),t.interpolate((d===gT?hn:Xm)(h))):t.interpolate(h),s){let[m,g]=le(a);(m>0||g<0)&&(a=Za(a),Hs(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=Da(a)),t.domain(a).unknown(c),i&&(t.nice(OJ(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 OJ(e,t){return e===!0?void 0:typeof e=="number"?e:zF(e,t)}function FR(e,t,n){return Rf(e,Ps(),t,n)}function RR(e,t,n){return wT(e,t,{...n,exponent:.5})}function wT(e,t,{exponent:n=1,...r}){return Rf(e,nm().exponent(n),t,{...r,type:"pow"})}function $R(e,t,{base:n=10,domain:r=FJ(t),...i}){return Rf(e,tm().base(n),t,{...i,domain:r})}function PR(e,t,{constant:n=1,...r}){return Rf(e,em().constant(n),t,r)}function UR(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=RJ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Fn(c,i):de.get(e)===Vr?Ym(o,i):void 0),s.length>0&&(s=rm(s,n===void 0?{length:i}:n).quantiles()),Mw(e,t,{domain:s,range:n,reverse:l,unknown:a})}function zR(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=jR(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=le(o),f;return n===void 0?(f=Mn(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?Fn(a,r):de.get(e)===Vr?Ym(i,r):void 0):(f=Fn(_e(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Hs(je(o))<0&&f.reverse(),Mw(e,t,{domain:f,range:n,reverse:c,unknown:s})}function Mw(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Fn(o,n.length+1):de.get(e)===Vr?Ym(i,n.length+1):void 0,reverse:a}){n=je(n);let c=Hs(n);if(!isNaN(c)&&!BJ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Da(s)),{type:"threshold",scale:im(c<0?Da(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function BJ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Hn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function qR(e){return{type:"identity",scale:QF(de.get(e))?Qp():t=>t}}function Ff(e,t=xf){return e.length?[ue(e,({value:n})=>n===void 0?n:ue(n,t)),Wt(e,({value:n})=>n===void 0?n:Wt(n,t))]:[0,1]}function jR(e,t){let n=de.get(e);return(n===Il||n===Al||n===Ml?LJ:Ff)(t)}function LJ(e){return[0,e.length?Wt(e,({value:t})=>t===void 0?t:Wt(t,xf)):1]}function CJ(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Qn(e,.5,({value:s})=>s===void 0?NaN:Qn(s,.25,sr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Wt(i);return o<1?i.map(s=>s*o):i}function kJ(e,t){let n=Pi(e,({value:o})=>o===void 0?NaN:Pi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Wt(r);return i<1?r.map(o=>o*i):r}function FJ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Ff(e,sr);if(n<0)return Ff(e,Va)}return[1,10]}function RJ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function Xm(e){return(t,n)=>r=>e(t+r*(n-t))}function Aw(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Ff(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=de.get(e)===Vr?u==null&&f!==void 0?si:kf(u!==void 0?u:"rdbu"):_e,reverse:p}){l=+l,a=je(a);let[m,g]=a;if(a.length>2&&Vn(`Warning: the diverging ${e} scale domain contains extra elements.`),Hn(m,g)<0&&([m,g]=[g,m],p=!p),m=Math.min(m,l),g=Math.max(g,l),typeof h!="function"&&(h=bT(h)),f!==void 0&&(h=h.length===1?Xm(h)(...f):yo(h,f)),p&&(h=xT(h)),d){let y=n.apply(l),x=y-n.apply(m),b=n.apply(g)-y;x<b?m=n.invert(y-b):x>b&&(g=n.invert(y+x))}return t.domain([m,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,g],pivot:l,interpolate:h,scale:t}}function VR(e,t,n){return Aw(e,dm(),$J,t,n)}function YR(e,t,n){return vT(e,t,{...n,exponent:.5})}function vT(e,t,{exponent:n=1,...r}){return Aw(e,kb().exponent(n=+n),zJ(n),t,{...r,type:"diverging-pow"})}function XR(e,t,{base:n=10,pivot:r=1,domain:i=Ff(t,r<0?Va:sr),...o}){return Aw(e,Lb().base(n=+n),PJ,t,{domain:i,pivot:r,...o})}function GR(e,t,{constant:n=1,...r}){return Aw(e,Cb().constant(n=+n),qJ(n),t,r)}var $J={apply(e){return e},invert(e){return e}},PJ={apply:Math.log,invert:Math.exp},UJ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function zJ(e){return e===.5?UJ:{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 qJ(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 WR(e,t,n,r){return Rf(e,t,n,r)}function HR(e,t,n){return WR(e,Db(),t,n)}function ZR(e,t,n){return WR(e,Ob(),t,n)}var $f=Symbol("ordinal");function QR(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=ko(i,r),o===void 0&&(o=r7(n,i,e)),(r==="categorical"||r===$f)&&(r="ordinal"),a&&(o=Da(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 KR(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=ko(r,n),i===void 0&&(i=r7(t,r,e));let l;if(de.get(e)===Ef)l=jJ(t),o=o===void 0?VJ(l):Gt(o,Nf);else if(de.get(e)===Vr&&(o===void 0&&(n==="ordinal"||n===$f)&&(o=LR(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=kf(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Fn(p=>u(f+d*p),h)}else o=yT(s);if(a===Zp)throw new Error(`implicit unknown on ${e} scale is not supported`);return QR(e,ul().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function t7(e,t,{align:n=.5,padding:r=.5,...i}){return n7($M().align(n).padding(r),t,i,e)}function e7(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return n7(za().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function n7(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=QR(r,e,t,n),e.round=i,e}function r7(e,t,n){let r=new Jn;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]=le(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&de.get(n)===mi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return fo(r,dn)}function JR(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 jJ(e){return{fill:JR(e,"fill"),stroke:JR(e,"stroke")}}function VJ(e){return re(e.fill)?yA:J1}function Gm(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 g={};for(let[y,x]of e){let b=m[y],w=f7(y,x,{round:de.get(y)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(w){let{label:v=y==="fx"||y==="fy"?p:t,percent:_,transform:I,inset:D,insetTop:A=D!==void 0?D:y==="y"?r:0,insetRight:E=D!==void 0?D:y==="x"?i:0,insetBottom:T=D!==void 0?D:y==="y"?o:0,insetLeft:O=D!==void 0?D:y==="x"?s:0}=b||{};if(I==null)I=void 0;else if(typeof I!="function")throw new Error("invalid scale transform; not a function");w.percent=!!_,w.label=v===void 0?YJ(x,w):v,w.transform=I,y==="x"||y==="fx"?(w.insetLeft=+O,w.insetRight=+E):(y==="y"||y==="fy")&&(w.insetTop=+A,w.insetBottom=+T),g[y]=w}}return g}function ST(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]=h7(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function c7(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?Nw(t):t;i&&i7(i,s),o&&o7(o,s);let a=i||o?IT(e,t):t;n&&i7(n,a),r&&o7(r,a)}function YJ(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!$o(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Ew(e){return Math.sign(Hs(e.domain()))*Math.sign(Hs(e.range()))}function Nw(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 IT({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Nw(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 i7(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)],$o(e)||(e.range=u7(e)),e.scale.range(e.range)}l7(e)}function o7(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],$o(e)?e.range.reverse():e.range=u7(e),e.scale.range(e.range)}l7(e)}function l7(e){e.round===void 0&&WJ(e)&&XJ(e)<=30&&e.scale.round(!0)}function XJ({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 u7(e){let t=e.scale.domain().length+MT(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 Dw(e,t,n){return f7(e,n===void 0?void 0:[{hint:n}],{...t})}function f7(e,t=[],n={}){let r=GJ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&$o({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Le)?Vn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Pf(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 "${Pf(r)}".`):i.some(YF)?Vn(`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 "${Pf(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 "${Pf(r)}".`):i.some(XF)&&Vn(`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 "${Pf(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 "${Pf(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=Tw(t,n,Ke);break;case"identity":switch(de.get(e)){case mi:n=Tw(t,n,Ke);break;case Ef:n=Tw(t,n,HJ);break}break;case"utc":case"time":n=Tw(t,n,UF);break}switch(r){case"diverging":return VR(e,t,n);case"diverging-sqrt":return YR(e,t,n);case"diverging-pow":return vT(e,t,n);case"diverging-log":return XR(e,t,n);case"diverging-symlog":return GR(e,t,n);case"categorical":case"ordinal":case $f:return KR(e,t,n);case"cyclical":case"sequential":case"linear":return FR(e,t,n);case"sqrt":return RR(e,t,n);case"threshold":return Mw(e,t,n);case"quantile":return UR(e,t,n);case"quantize":return zR(e,t,n);case"pow":return wT(e,t,n);case"log":return $R(e,t,n);case"symlog":return PR(e,t,n);case"utc":return ZR(e,t,n);case"time":return HR(e,t,n);case"point":return t7(e,t,n);case"band":return e7(e,t,n);case"identity":return qR(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Pf(e){return typeof e=="symbol"?e.description:e}function s7(e){return typeof e=="string"?`${e}`.toLowerCase():e}var a7={toString:()=>"projection"};function GJ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=s7(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=a7);for(let l of t){let u=s7(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===a7)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=de.get(e);if(c===Il)return"sqrt";if(c===Al||c===Ml)return"linear";if(c===Ef)return"ordinal";if((r||i||[]).length>2)return _T(c);if(r!==void 0){if(Ne(r))return _T(c);if(Le(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ne))return _T(c);if(l.some(Le))return"utc"}if(c===Vr){if(s!=null||CR(o))return"diverging";if(BR(o))return"categorical"}return"linear"}function _T(e){switch(e){case mi:return"point";case Vr:return $f;default:return"ordinal"}}function $o({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===$f}function MT({type:e}){return e==="threshold"}function WJ({type:e}){return e==="point"||e==="band"}function lr(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 Tw(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 HJ(e){return Gt(e,Nf)}function Uf(e={}){let t;for(let n in e)if(de.has(n)&&Lo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=h7(Dw(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function d7(e){return t=>{if(!de.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function h7({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:Za(n),...r!==void 0&&{range:Za(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 m7(e,t,n={}){let r=.5-Ce,i=.5+Ce,o=.5+Ce,s=.5-Ce;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:x}of t)m>r&&(r=m),g>i&&(i=g),y>o&&(o=y),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=ZJ(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:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=n.facet??{};g=+g,y=+y,x=+x,b=+b,p.facet={marginTop:g,marginRight:y,marginBottom:x,marginLeft:b}}return p}function ZJ({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=MR(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*g+a+l)}let h=t?$o(t)?t.scale.domain().length:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=p7("y",t)/(p7("x",e)*o),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*y+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function p7(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]=le(r);return Math.abs(i(s)-i(o))}function g7(e,t){let{fx:n,fy:r}=Gm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?G0(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 x7(e,{x:t,y:n}){return t&&=DT(t),n&&=DT(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 Bw(e,{fx:t,fy:n}){let r=ar(e),i=t?.value,o=n?.value;return t&&n?$i(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?$i(r,s=>(s.fx=i[s[0]],s),s=>i[s]):$i(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function b7(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 w7(e){let t=[],n=new Uint32Array(An(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 JJ=new Map([["top",AT],["right",NT],["bottom",TT],["left",ET],["top-left",Ow(AT,ET)],["top-right",Ow(AT,NT)],["bottom-left",Ow(TT,ET)],["bottom-right",Ow(TT,NT)],["top-empty",KJ],["right-empty",nQ],["bottom-empty",tQ],["left-empty",eQ],["empty",rQ]]);function v7(e){if(e==null)return null;let t=JJ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var y7=new WeakMap;function DT(e){let t=y7.get(e);return t||y7.set(e,t=new Zn(Gt(e,(n,r)=>[n,r]))),t}function ic(e,t){return DT(e).get(t)}function QJ(e,t,n){return t=Qs(t),n=Qs(n),e.find(r=>Object.is(Qs(r.x),t)&&Object.is(Qs(r.y),n))}function Lw(e,t,n){return QJ(e,t,n)?.empty}function AT(e,{y:t},{y:n}){return t?ic(t,n)===0:!0}function TT(e,{y:t},{y:n}){return t?ic(t,n)===t.length-1:!0}function ET(e,{x:t},{x:n}){return t?ic(t,n)===0:!0}function NT(e,{x:t},{x:n}){return t?ic(t,n)===t.length-1:!0}function KJ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o>0)return Lw(e,n,t[o-1])}function tQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o<t.length-1)return Lw(e,n,t[o+1])}function eQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o>0)return Lw(e,t[o-1],r)}function nQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o<t.length-1)return Lw(e,t[o+1],r)}function rQ(e,t,{empty:n}){return n}function Ow(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function Cw(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 St=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:g=d,clip:y=i?.clip,channels:x,tip:b,render:w}=r;if(this.data=t,this.sort=Co(l)?l:null,this.initializer=Ie(r).initializer,this.transform=this.initializer?r.transform:yn(r).transform,o===null||o===!1?this.facet=null:(this.facet=tn(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Wa&&typeof a=="string"?[a]:a,this.fy=t===Wa&&typeof c=="string"?[c]:c),this.facetAnchor=v7(s),n=Rm(n),x!==void 0&&(n={...iQ(x),...n}),i!==void 0&&(n={...vw(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,_])=>{if(jr(_.value)){let{value:I,label:D=_.label,scale:A=_.scale}=_.value;_={..._,label:D,scale:A,value:I}}if(t===Wa&&typeof _.value=="string"){let{value:I}=_;_={..._,value:[I]}}return[v,_]}).filter(([v,{value:_,optional:I}])=>{if(_!=null)return!0;if(I)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+g,this.clip=Sw(y),this.tip=oQ(b),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:_}=n[v];if(!(_!=="x"&&_!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=zf(w,this.render))}initialize(t,n,r){let i=je(this.data);t===void 0&&i!=null&&(t=[ar(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=je(i)),t!==void 0&&(t.original=o);let s=xw(this.channels,i);return this.sort!=null&&dR(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=ze}=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"&&mT(i,o,n,r.projection)}}scale(t,n,r){let i=Bf(t,n);return r.projection&&this.project(t,i,r),i}};function en(...e){return e.plot=St.prototype.plot,e}function zf(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 iQ(e){return Object.fromEntries(Object.entries(Rm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:pi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function oQ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?tn(e,"tip",["x","y","xy"]):e}function Yi(e,t){return e?.tip===!0?{...e,tip:t}:pn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var _7=new WeakMap;function OT(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:zf(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:y}=p.getMarkState(this),x=_7.get(g);x||_7.set(g,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(W)-1,{x:w,y:v,fx:_,fy:I}=f,D=_?_(u.fx)-h.marginLeft:0,A=I?I(u.fy)-h.marginTop:0;w?.bandwidth&&(D+=w.bandwidth()/2),v?.bandwidth&&(A+=v.bandwidth()/2);let E=u.fi!=null,T;if(E){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),T=Y.get(this),T||Y.set(this,T=new Map)}let[O,C]=gn(this,h),{px:S,py:M}=d,N=S?Y=>S[Y]:BT(d,O),F=M?Y=>M[Y]:LT(d,C),R,k,$,P;function U(Y,rt){if(E)if(P&&(P=cancelAnimationFrame(P)),Y==null)T.delete(u.fi);else{T.set(u.fi,rt),P=requestAnimationFrame(()=>{P=null;for(let[j,H]of T)if(H<rt||H===rt&&j<u.fi){Y=null;break}W(Y)});return}W(Y)}function W(Y){if(R===Y&&$===x.sticky)return;R=Y,$=p.pointerSticky=x.sticky;let rt=R==null?[]:[R];E&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let j=m(rt,f,d,h,p);if(k){if(E){let H=k.parentNode,ot=k.getAttribute("transform"),z=j.getAttribute("transform");ot?j.setAttribute("transform",ot):j.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),j.removeAttribute("aria-label"),j.removeAttribute("aria-description"),j.removeAttribute("aria-hidden")}k.replaceWith(j)}return x.roots[b]=k=j,R==null&&T?.size>1||p.dispatchValue(R==null?null:y[R]),j}function tt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,j]=kn(Y);rt-=D,j-=A;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=j<h.marginTop||j>h.height-h.marginBottom?1:t,z=null,kt=s*s;for(let dt of u){let Ht=H*(N(dt)-rt),Zt=ot*(F(dt)-j),et=Ht*Ht+Zt*Zt;et<=kt&&(z=dt,kt=et)}if(z!=null&&(e!==1||t!==1)){let dt=N(z)-rt,Ht=F(z)-j;kt=dt*dt+Ht*Ht}U(z,kt)}function nt(Y){Y.pointerType==="mouse"&&R!=null&&(x.sticky&&x.roots.some(rt=>rt?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(rt=>rt(null))):(x.sticky=!0,W(R)),Y.stopImmediatePropagation()))}function at(Y){Y.pointerType==="mouse"&&(x.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",at),W(null)},c)}}function qf(e){return OT(1,1,e)}function jf(e){return OT(1,.01,e)}function El(e){return OT(.01,1,e)}function BT({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function LT({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function kw(e){return $o(e)&&e.interval===void 0?void 0:"tabular-nums"}function S7(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=kw(e),round:p=!0,opacity:m,className:g}=t,y=nc(t);g=Lf(g),m=se(m)[1],d===null&&(d=()=>null);let x=ut("svg",y).attr("class",`${g}-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(O=>O.append("style").text(`:where(.${g}-ramp) {
17
17
  display: block;
18
18
  height: auto;
19
19
  height: intrinsic;
@@ -22,9 +22,9 @@ ${n}`}function jZ(e){return e==="time"?iw:e==="utc"?Nm:UZ}function BF(e,t,n){let
22
22
  }
23
23
  :where(.${g}-ramp text) {
24
24
  white-space: pre;
25
- }`)).call(Bf,u),b=O=>O.selectAll(".tick line").attr("y1",s+c-o),w,_=p?(O,C)=>O.rangeRound(C):(O,C)=>O.range(C),{type:v,domain:I,range:N,interpolate:A,scale:D,pivot:T}=e;if(A){let O=N===void 0?A:yo(A.length===1?jm(A):A,N);w=_(D.copy(),Fn(_e(l,i-a),Math.min(I.length+(T!==void 0),N===void 0?1/0:N.length)));let C=256,S=y.document.createElement("canvas");S.width=C,S.height=1;let M=S.getContext("2d");for(let E=0,F=C-1;E<C;++E)M.fillStyle=O(E/F),M.fillRect(E,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(v==="threshold"){let O=I,C=d===void 0?S=>S:typeof d=="string"?ci(d):d;w=_(Ps().domain([-1,N.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(N).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=Gt(O,(S,M)=>M),d=S=>C(O[S],S)}else w=_(za().domain(I),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(I).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",D),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(VS(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",fe(h,"normal")).call(b).call(O=>O.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 jf=Math.PI/180;function Xi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=OT(n),e.markerMid=OT(r),e.markerEnd=OT(i)}function OT(e){if(e==null||e===!1)return null;if(e===!0)return _7;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return v7("auto");case"arrow-reverse":return v7("auto-start-reverse");case"dot":return rQ;case"circle":case"circle-fill":return _7;case"circle-stroke":return iQ;case"tick":return BT("auto");case"tick-x":return BT(90);case"tick-y":return BT(0)}throw new Error(`invalid marker: ${e}`)}function v7(e){return(t,n)=>ut("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 rQ(e,t){return ut("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 _7(e,t){return ut("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 iQ(e,t){return ut("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 BT(e){return(t,n)=>ut("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 oQ=0;function oa(e,t,{stroke:n},r){return I7(e,t,n&&(i=>n[i]),r)}function S7(e,t,{stroke:n},r){return I7(e,t,n&&(([i])=>n[i]),r)}function I7(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++oQ}`;p.setAttribute("id",m),d.set(f,h=`url(#${m})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Nl({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=M7(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Dl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=M7(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function M7(e,t,n){return e===void 0&&t===void 0&&n===void 0?Ce?[1,0]:[.5,.5]:[t,n]}function A7(e,{interval:t}){return e={...pi(e)},e.interval=Mf(e.interval===void 0?t:e.interval),e}function Fw(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=A7(i,n);if(a==null||c==null&&!r)return n;let l=On(i);if(c==null){let h,p={transform:m=>h||(h=bt(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=Gt(bt(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 T7(e,t,n){let{[e]:r}=n,{value:i,interval:o}=A7(r,n);return i==null||o==null?n:t({...n,[e]:{label:On(r),transform:s=>{let a=Gt(bt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Le(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 LT(e={}){return Fw("x",Nl,e,!0)}function CT(e={}){return Fw("y",Dl,e,!0)}function Rw(e={}){return Fw("x",Nl,e)}function $w(e={}){return Fw("y",Dl,e)}function Pw(e={}){return T7("x",Nl,e)}function Uw(e={}){return T7("y",Dl,e)}var E7={ariaLabel:"rule",fill:null,stroke:"currentColor"},Vm=class extends St{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}},Yi(n,"x"),E7),this.insetTop=Bt(a),this.insetBottom=Bt(c),Xi(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:g}=i,{insetTop:y,insetBottom:x}=this;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s},Ce,0).call(b=>b.selectAll().data(t).enter().append("line").call(Lt,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!lr(a)?w=>l[w]+y:h+y).attr("y2",u&&!lr(a)?a.bandwidth?w=>u[w]+a.bandwidth()-x:w=>u[w]-x:d-g-x).call(Qt,this,r).call(oa,this,r,o)).node()}},Ym=class extends St{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}},Yi(n,"y"),E7),this.insetRight=Bt(a),this.insetLeft=Bt(c),Xi(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:g}=i,{insetLeft:y,insetRight:x}=this;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{y:c&&a},0,Ce).call(b=>b.selectAll().data(t).enter().append("line").call(Lt,this).attr("x1",l&&!lr(s)?w=>l[w]+y:m+y).attr("x2",u&&!lr(s)?s.bandwidth?w=>u[w]+s.bandwidth()-x:w=>u[w]-x:f-p-x).attr("y1",c?w=>c[w]:(h+d-g)/2).attr("y2",c?w=>c[w]:(h+d-g)/2).call(Qt,this,r).call(oa,this,r,o)).node()}};function Yr(e,t){let{x:n=G,y:r,y1:i,y2:o,...s}=$w(t);return[i,o]=N7(r,i,o),new Vm(e,{...s,x:n,y1:i,y2:o})}function Xr(e,t){let{y:n=G,x:r,x1:i,x2:o,...s}=Rw(t);return[i,o]=N7(r,i,o),new Ym(e,{...s,y:n,x1:i,x2:o})}function N7(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 oc(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 sQ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},C7="\xAD",Bl=class extends St{constructor(t,n={}){let{x:r,y:i,text:o=cr(t)&&cw(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:g,fontWeight:y,rotate:x}=n,[b,w]=se(x,0),[_,v]=uQ(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:UF(b),optional:!0},text:{value:o,filter:Em,optional:!0}},n,sQ),this.rotate=w,this.textAnchor=fe(a,"middle"),this.lineAnchor=tn(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=FT(f),this.monospace=!!d,this.fontFamily=je(h),this.fontSize=v,this.fontStyle=je(m),this.fontVariant=je(g),this.fontWeight=je(y),this.frameAnchor=Fo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=$T(this),this.clipLine=PT(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,g]=gn(this,i);return ut("svg:g",o).call(Ct,this,i,o).call(RT,this,f,i).call(Et,this,{x:c&&s,y:l&&a}).call(y=>y.selectAll().data(t).enter().append("text").call(Lt,this).call(aQ,this,f,d).attr("transform",oc`translate(${c?x=>c[x]:m},${l?x=>l[x]:g})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(x=>h[x])).call(Qt,this,r)).node()}};function FT(e){return e==null?null:tn(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function aQ(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(qi(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(oi.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(oi.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Po(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new Bl(e,{...r,x:t,y:n})}function zw(e,{x:t=G,...n}={}){return new Bl(e,Uw({...n,x:t}))}function jw(e,{y:t=G,...n}={}){return new Bl(e,Pw({...n,y:t}))}function RT(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?cQ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function cQ(e){return e&&(Ks(e)||Le(e))?"tabular-nums":void 0}var lQ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function uQ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),lQ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function fQ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of dQ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===C7?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*dQ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case C7: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(Cf,u),b=O=>O.selectAll(".tick line").attr("y1",s+c-o),w,v=p?(O,C)=>O.rangeRound(C):(O,C)=>O.range(C),{type:_,domain:I,range:D,interpolate:A,scale:E,pivot:T}=e;if(A){let O=D===void 0?A:yo(A.length===1?Xm(A):A,D);w=v(E.copy(),Fn(_e(l,i-a),Math.min(I.length+(T!==void 0),D===void 0?1/0:D.length)));let C=256,S=y.document.createElement("canvas");S.width=C,S.height=1;let M=S.getContext("2d");for(let N=0,F=C-1;N<C;++N)M.fillStyle=O(N/F),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 O=I,C=d===void 0?S=>S:typeof d=="string"?ci(d):d;w=v(Ps().domain([-1,D.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(D).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=Gt(O,(S,M)=>M),d=S=>C(O[S],S)}else w=v(za().domain(I),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(I).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",E),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(GS(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",fe(h,"normal")).call(b).call(O=>O.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 Vf=Math.PI/180;function Xi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=CT(n),e.markerMid=CT(r),e.markerEnd=CT(i)}function CT(e){if(e==null||e===!1)return null;if(e===!0)return M7;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return I7("auto");case"arrow-reverse":return I7("auto-start-reverse");case"dot":return sQ;case"circle":case"circle-fill":return M7;case"circle-stroke":return aQ;case"tick":return kT("auto");case"tick-x":return kT(90);case"tick-y":return kT(0)}throw new Error(`invalid marker: ${e}`)}function I7(e){return(t,n)=>ut("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 sQ(e,t){return ut("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 M7(e,t){return ut("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 aQ(e,t){return ut("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 kT(e){return(t,n)=>ut("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 cQ=0;function oa(e,t,{stroke:n},r){return T7(e,t,n&&(i=>n[i]),r)}function A7(e,t,{stroke:n},r){return T7(e,t,n&&(([i])=>n[i]),r)}function T7(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++cQ}`;p.setAttribute("id",m),d.set(f,h=`url(#${m})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Nl({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=E7(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Dl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=E7(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function E7(e,t,n){return e===void 0&&t===void 0&&n===void 0?Ce?[1,0]:[.5,.5]:[t,n]}function N7(e,{interval:t}){return e={...pi(e)},e.interval=Tf(e.interval===void 0?t:e.interval),e}function Fw(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=N7(i,n);if(a==null||c==null&&!r)return n;let l=On(i);if(c==null){let h,p={transform:m=>h||(h=wt(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=Gt(wt(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 D7(e,t,n){let{[e]:r}=n,{value:i,interval:o}=N7(r,n);return i==null||o==null?n:t({...n,[e]:{label:On(r),transform:s=>{let a=Gt(wt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Le(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 FT(e={}){return Fw("x",Nl,e,!0)}function RT(e={}){return Fw("y",Dl,e,!0)}function Rw(e={}){return Fw("x",Nl,e)}function $w(e={}){return Fw("y",Dl,e)}function Pw(e={}){return D7("x",Nl,e)}function Uw(e={}){return D7("y",Dl,e)}var O7={ariaLabel:"rule",fill:null,stroke:"currentColor"},Wm=class extends St{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}},Yi(n,"x"),O7),this.insetTop=Bt(a),this.insetBottom=Bt(c),Xi(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:g}=i,{insetTop:y,insetBottom:x}=this;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s},Ce,0).call(b=>b.selectAll().data(t).enter().append("line").call(Lt,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!lr(a)?w=>l[w]+y:h+y).attr("y2",u&&!lr(a)?a.bandwidth?w=>u[w]+a.bandwidth()-x:w=>u[w]-x:d-g-x).call(Qt,this,r).call(oa,this,r,o)).node()}},Hm=class extends St{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}},Yi(n,"y"),O7),this.insetRight=Bt(a),this.insetLeft=Bt(c),Xi(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:g}=i,{insetLeft:y,insetRight:x}=this;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{y:c&&a},0,Ce).call(b=>b.selectAll().data(t).enter().append("line").call(Lt,this).attr("x1",l&&!lr(s)?w=>l[w]+y:m+y).attr("x2",u&&!lr(s)?s.bandwidth?w=>u[w]+s.bandwidth()-x:w=>u[w]-x:f-p-x).attr("y1",c?w=>c[w]:(h+d-g)/2).attr("y2",c?w=>c[w]:(h+d-g)/2).call(Qt,this,r).call(oa,this,r,o)).node()}};function Yr(e,t){let{x:n=G,y:r,y1:i,y2:o,...s}=$w(t);return[i,o]=B7(r,i,o),new Wm(e,{...s,x:n,y1:i,y2:o})}function Xr(e,t){let{y:n=G,x:r,x1:i,x2:o,...s}=Rw(t);return[i,o]=B7(r,i,o),new Hm(e,{...s,y:n,x1:i,x2:o})}function B7(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 oc(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 lQ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},R7="\xAD",Bl=class extends St{constructor(t,n={}){let{x:r,y:i,text:o=cr(t)&&cw(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:g,fontWeight:y,rotate:x}=n,[b,w]=se(x,0),[v,_]=hQ(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:jF(b),optional:!0},text:{value:o,filter:Bm,optional:!0}},n,lQ),this.rotate=w,this.textAnchor=fe(a,"middle"),this.lineAnchor=tn(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=PT(f),this.monospace=!!d,this.fontFamily=qe(h),this.fontSize=_,this.fontStyle=qe(m),this.fontVariant=qe(g),this.fontWeight=qe(y),this.frameAnchor=Fo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=zT(this),this.clipLine=qT(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,g]=gn(this,i);return ut("svg:g",o).call(Ct,this,i,o).call(UT,this,f,i).call(Et,this,{x:c&&s,y:l&&a}).call(y=>y.selectAll().data(t).enter().append("text").call(Lt,this).call(uQ,this,f,d).attr("transform",oc`translate(${c?x=>c[x]:m},${l?x=>l[x]:g})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(x=>h[x])).call(Qt,this,r)).node()}};function PT(e){return e==null?null:tn(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function uQ(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(ji(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(oi.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(oi.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Po(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new Bl(e,{...r,x:t,y:n})}function zw(e,{x:t=G,...n}={}){return new Bl(e,Uw({...n,x:t}))}function qw(e,{y:t=G,...n}={}){return new Bl(e,Pw({...n,y:t}))}function UT(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?fQ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function fQ(e){return e&&(Ks(e)||Le(e))?"tabular-nums":void 0}var dQ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function hQ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),dQ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function pQ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of mQ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===R7?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*mQ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case R7: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]===`
26
26
  `&&++i;case`
27
- `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var D7={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 qw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qf(e,i))r+=D7[e[i]]??(F7(e,i)?120:D7.e);return r}function Vw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qf(e,i))r+=F7(e,i)?126:63;return r}function $T({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?Vw:qw,i=t*100;return o=>fQ(o,i,r)}function PT({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?Vw:qw,i=t*100;switch(n){case"clip-start":return o=>B7(o,i,r,"");case"clip-end":return o=>O7(o,i,r,"");case"ellipsis-start":return o=>B7(o,i,r,Ol);case"ellipsis-middle":return o=>hQ(o,i,r,Ol);case"ellipsis-end":return o=>O7(o,i,r,Ol)}}var Ol="\u2026";function Ll(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=qf(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 O7(e,t,n,r){e=e.trim();let i=n(r),[o]=Ll(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function hQ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Ll(e,t/2,n,o),[c]=Ll(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(qf(e,c)).trimStart()}function B7(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Ll(e,i-t+o,n,-o);return s<0?r:r+e.slice(qf(e,s)).trimStart()}var kT=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,L7=/\p{Extended_Pictographic}/uy;function qf(e,t){return t+=pQ(e,t)?2:1,yQ(e,t)&&(t=kT.lastIndex),mQ(e,t)?qf(e,t+1):t}function k7(e,t){return e.charCodeAt(t)<128}function pQ(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 mQ(e,t){return e.charCodeAt(t)===8205}function yQ(e,t){return k7(e,t)?!1:(kT.lastIndex=t,kT.test(e))}function F7(e,t){return k7(e,t)?!1:(L7.lastIndex=t,L7.test(e))}var R7={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},$7=3.5,gQ=$7*5,P7={draw(e,t,n){let r=t*n/gQ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},U7={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},xQ=new Map([["arrow",P7],["spike",U7]]);function bQ(e){return e&&typeof e.draw=="function"}function wQ(e){if(bQ(e))return e;let t=xQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Cl=class extends St{constructor(t,n={}){let{x:r,y:i,r:o=$7,length:s,rotate:a,shape:c=P7,anchor:l="middle",frameAnchor:u}=n,[f,d]=se(s,12),[h,p]=se(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,R7),this.r=+o,this.length=d,this.rotate=p,this.shape=wQ(c),this.anchor=tn(l,"anchor",["start","middle","end"]),this.frameAnchor=Fo(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:g}=this,[y,x]=gn(this,i);return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Lt,this).attr("transform",oc`translate(${c?w=>c[w]:y},${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 _=er();return m.draw(_,u[w],g),_}:(()=>{let w=er();return m.draw(w,d,g),w})()).call(Qt,this,r)).node()}};function UT(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=$e(n,r)),new Cl(e,{...i,x:n,y:r})}function Yw(e,t={}){let{x:n=G,...r}=t;return new Cl(e,{...r,x:n})}function Xw(e,t={}){let{y:n=G,...r}=t;return new Cl(e,{...r,y:n})}function z7(e,t={}){let{shape:n=U7,stroke:r=R7.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return UT(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function sc(e,t){return arguments.length<2&&!cr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function Gw({anchor:e}={},t){return e===void 0?t[0]:tn(e,"anchor",t)}function j7(e){return Gw(e,["left","right"])}function q7(e){return Gw(e,["right","left"])}function V7(e){return Gw(e,["bottom","top"])}function Y7(e){return Gw(e,["top","bottom"])}function Xm(){let[e,t]=sc(...arguments);return X7("y",j7(t),e,t)}function Ww(){let[e,t]=sc(...arguments);return X7("fy",q7(t),e,t)}function Gm(){let[e,t]=sc(...arguments);return G7("x",V7(t),e,t)}function Hw(){let[e,t]=sc(...arguments);return G7("fx",Y7(t),e,t)}function X7(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:g,x:y,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?t==="right"?40:0:x,marginBottom:_=x===void 0?20:x,marginLeft:v=x===void 0?t==="left"?40:0:x,label:I,labelAnchor:N,labelArrow:A,labelOffset:D,...T}){return p=Bt(p),m=Bt(m),g=Bt(g),N!==void 0&&(N=tn(N,"labelAnchor",["center","top","bottom"])),A=e$(A),en(p&&!re(o)?vQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,x:y,...T}):null,re(c)?null:SQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,x:y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...T}),!re(c)&&I!==null?Po([],J7({fill:c,fillOpacity:l,...T},function(O,C,S,M,E){let F=M[e],{marginTop:R,marginRight:k,marginBottom:$,marginLeft:P}=e==="y"&&E.inset||E,U=N??(F.bandwidth?"center":"top"),W=D??(t==="right"?k:P)-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-R:U==="bottom"?$-3:0,this.dx=t==="right"?W:-W,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[t$(e,F,{anchor:t,label:I,labelAnchor:U,labelArrow:A})]}}}})):null)}function G7(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:g,y,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:_=x===void 0?t==="bottom"?30:0:x,marginLeft:v=x===void 0?20:x,label:I,labelAnchor:N,labelArrow:A,labelOffset:D,...T}){return p=Bt(p),m=Bt(m),g=Bt(g),N!==void 0&&(N=tn(N,"labelAnchor",["center","left","right"])),A=e$(A),en(p&&!re(o)?_Q(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,y,...T}):null,re(c)?null:IQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...T}),!re(c)&&I!==null?Po([],J7({fill:c,fillOpacity:l,...T},function(O,C,S,M,E){let F=M[e],{marginTop:R,marginRight:k,marginBottom:$,marginLeft:P}=e==="x"&&E.inset||E,U=N??(F.bandwidth?"center":"right"),W=D??(t==="top"?R:$)-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"?-W:W,this.dx=U==="right"?k-3:U==="left"?3-P:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[t$(e,F,{anchor:t,label:I,labelAnchor:U,labelArrow:A})]}}}})):null)}function vQ(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 Vf(Xw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Ce+ +u:+d+Ce-f,anchor:"start",length:c,shape:t==="left"?EQ:NQ})}function _Q(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 Vf(Yw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Ce-f:+d+Ce+ +u,anchor:"start",length:c,shape:t==="bottom"?AQ:TQ})}function SQ(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*jf):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:g=e==="y"?void 0:null,...y}){return Vf(jw,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...y,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,w,_,v){f===void 0&&(this.fontVariant=K7(x)),c===void 0&&(v.text=Q7(x,b,w,_,t))})}function IQ(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*jf):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:g=e==="x"?void 0:null,...y}){return Vf(zw,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...y,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,w,_,v){f===void 0&&(this.fontVariant=K7(x)),c===void 0&&(v.text=Q7(x,b,w,_,t))})}function Zw(){let[e,t]=sc(...arguments);return W7("y",j7(t),e,t)}function Jw(){let[e,t]=sc(...arguments);return W7("fy",q7(t),e,t)}function Qw(){let[e,t]=sc(...arguments);return H7("x",V7(t),e,t)}function Kw(){let[e,t]=sc(...arguments);return H7("fx",Y7(t),e,t)}function W7(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 Vf(Xr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...Z7(a)})}function H7(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 Vf(Yr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...Z7(a)})}function Z7({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 J7({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]=Be(e),[,t]=se(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 Vf(e,t,n,r,i,o,s){let a;function c(f,d,h,p,m,g){let y=f==null&&(t==="fx"||t==="fy"),{[t]:x}=p;if(!x)throw new Error(`missing scale: ${t}`);let b=x.domain(),{interval:w,ticks:_,tickFormat:v,tickSpacing:I=t==="x"?80:35}=o;if(typeof _=="string"&&n$(x)&&(w=_,_=void 0),_===void 0&&(_=ko(w,x.type)??MQ(x,I)),f==null){if(cr(_))f=qe(_);else if(Ja(_))f=zT(_,...le(b));else if(x.interval){let A=x.interval;if(x.ticks){let[D,T]=le(b),O=(T-D)/A[wf];A=PA(A,O/_)??A,f=zT(A,D,T)}else{f=b;let D=f.length;A=PA(A,D/_)??A,A!==x.interval&&(f=zT(A,...le(f)))}if(A===x.interval){let D=Math.round(f.length/_);D>1&&(f=f.filter((T,O)=>O%D===0))}}else x.ticks?f=x.ticks(_):f=b;if(!x.ticks&&f.length&&f!==b){let A=new Jn(b);f=f.filter(D=>A.has(D)),f.length||Vn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[ar(f)]:a[t]={scale:t,value:G}}s?.call(this,x,f,_,v,a);let N=Object.fromEntries(Object.entries(a).map(([A,D])=>[A,{...D,value:bt(f,D.value)}]));return y&&(d=g.filterFacets(f,N)),{data:f,facets:d,channels:N}}let l=Ie(o).initializer,u=e(i,Ie({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function MQ(e,t){let[n,r]=le(e.range());return(r-n)/t}function Q7(e,t,n,r,i){return{value:Wm(e,t,n,r,i)}}function Wm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Le(t)?BF(e.type,t,i)??qi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?qi:typeof r=="string"?(Le(e.domain())?Do:ci)(r):hn(r)}function zT(e,t,n){return e.range(t,e.offset(e.floor(n)))}var AQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},TQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},EQ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},NQ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function K7(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function t$(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&n$(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=Ew(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 e$(e="auto"){return re(e)?!1:typeof e=="boolean"?e:tn(e,"labelArrow",["auto","up","right","down","left"])}function n$(e){return Le(e.domain())}function r$(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function i$(e,{opacity:t,...n}={}){if(!$o(e)&&!_T(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return s$(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",se(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function o$(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:re(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Be(t),[f,d]=Be(r),h=r$(c,l),p=r$(c,f),m=s*s*Math.PI;return n=se(n)[1],i=se(i)[1],o=se(o)[1],s$(e,a,(g,y,x,b)=>g.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 _=er();return e.scale(w).draw(_,m),_}))}function s$(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=kw(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=nc(t);u=Of(u),i=Wm(e.scale,e.domain,void 0,i);let p=ut("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,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var L7={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 jw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Yf(e,i))r+=L7[e[i]]??(P7(e,i)?120:L7.e);return r}function Vw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Yf(e,i))r+=P7(e,i)?126:63;return r}function zT({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?Vw:jw,i=t*100;return o=>pQ(o,i,r)}function qT({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?Vw:jw,i=t*100;switch(n){case"clip-start":return o=>k7(o,i,r,"");case"clip-end":return o=>C7(o,i,r,"");case"ellipsis-start":return o=>k7(o,i,r,Ol);case"ellipsis-middle":return o=>yQ(o,i,r,Ol);case"ellipsis-end":return o=>C7(o,i,r,Ol)}}var Ol="\u2026";function Ll(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Yf(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 C7(e,t,n,r){e=e.trim();let i=n(r),[o]=Ll(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function yQ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Ll(e,t/2,n,o),[c]=Ll(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Yf(e,c)).trimStart()}function k7(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Ll(e,i-t+o,n,-o);return s<0?r:r+e.slice(Yf(e,s)).trimStart()}var $T=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,F7=/\p{Extended_Pictographic}/uy;function Yf(e,t){return t+=gQ(e,t)?2:1,bQ(e,t)&&(t=$T.lastIndex),xQ(e,t)?Yf(e,t+1):t}function $7(e,t){return e.charCodeAt(t)<128}function gQ(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 xQ(e,t){return e.charCodeAt(t)===8205}function bQ(e,t){return $7(e,t)?!1:($T.lastIndex=t,$T.test(e))}function P7(e,t){return $7(e,t)?!1:(F7.lastIndex=t,F7.test(e))}var U7={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},z7=3.5,wQ=z7*5,q7={draw(e,t,n){let r=t*n/wQ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},j7={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},vQ=new Map([["arrow",q7],["spike",j7]]);function _Q(e){return e&&typeof e.draw=="function"}function SQ(e){if(_Q(e))return e;let t=vQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Cl=class extends St{constructor(t,n={}){let{x:r,y:i,r:o=z7,length:s,rotate:a,shape:c=q7,anchor:l="middle",frameAnchor:u}=n,[f,d]=se(s,12),[h,p]=se(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,U7),this.r=+o,this.length=d,this.rotate=p,this.shape=SQ(c),this.anchor=tn(l,"anchor",["start","middle","end"]),this.frameAnchor=Fo(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:g}=this,[y,x]=gn(this,i);return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Lt,this).attr("transform",oc`translate(${c?w=>c[w]:y},${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=er();return m.draw(v,u[w],g),v}:(()=>{let w=er();return m.draw(w,d,g),w})()).call(Qt,this,r)).node()}};function jT(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=$e(n,r)),new Cl(e,{...i,x:n,y:r})}function Yw(e,t={}){let{x:n=G,...r}=t;return new Cl(e,{...r,x:n})}function Xw(e,t={}){let{y:n=G,...r}=t;return new Cl(e,{...r,y:n})}function V7(e,t={}){let{shape:n=j7,stroke:r=U7.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return jT(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function sc(e,t){return arguments.length<2&&!cr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function Gw({anchor:e}={},t){return e===void 0?t[0]:tn(e,"anchor",t)}function Y7(e){return Gw(e,["left","right"])}function X7(e){return Gw(e,["right","left"])}function G7(e){return Gw(e,["bottom","top"])}function W7(e){return Gw(e,["top","bottom"])}function Zm(){let[e,t]=sc(...arguments);return H7("y",Y7(t),e,t)}function Ww(){let[e,t]=sc(...arguments);return H7("fy",X7(t),e,t)}function Jm(){let[e,t]=sc(...arguments);return Z7("x",G7(t),e,t)}function Hw(){let[e,t]=sc(...arguments);return Z7("fx",W7(t),e,t)}function H7(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:g,x:y,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:I,labelAnchor:D,labelArrow:A,labelOffset:E,...T}){return p=Bt(p),m=Bt(m),g=Bt(g),D!==void 0&&(D=tn(D,"labelAnchor",["center","top","bottom"])),A=i$(A),en(p&&!re(o)?IQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,x:y,...T}):null,re(c)?null:AQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,x:y,marginTop:b,marginRight:w,marginBottom:v,marginLeft:_,...T}),!re(c)&&I!==null?Po([],t$({fill:c,fillOpacity:l,...T},function(O,C,S,M,N){let F=M[e],{marginTop:R,marginRight:k,marginBottom:$,marginLeft:P}=e==="y"&&N.inset||N,U=D??(F.bandwidth?"center":"top"),W=E??(t==="right"?k:P)-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-R:U==="bottom"?$-3:0,this.dx=t==="right"?W:-W,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[r$(e,F,{anchor:t,label:I,labelAnchor:U,labelArrow:A})]}}}})):null)}function Z7(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:g,y,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:I,labelAnchor:D,labelArrow:A,labelOffset:E,...T}){return p=Bt(p),m=Bt(m),g=Bt(g),D!==void 0&&(D=tn(D,"labelAnchor",["center","left","right"])),A=i$(A),en(p&&!re(o)?MQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,y,...T}):null,re(c)?null:TQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,y,marginTop:b,marginRight:w,marginBottom:v,marginLeft:_,...T}),!re(c)&&I!==null?Po([],t$({fill:c,fillOpacity:l,...T},function(O,C,S,M,N){let F=M[e],{marginTop:R,marginRight:k,marginBottom:$,marginLeft:P}=e==="x"&&N.inset||N,U=D??(F.bandwidth?"center":"right"),W=E??(t==="top"?R:$)-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"?-W:W,this.dx=U==="right"?k-3:U==="left"?3-P:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[r$(e,F,{anchor:t,label:I,labelAnchor:U,labelArrow:A})]}}}})):null)}function IQ(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 Xf(Xw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Ce+ +u:+d+Ce-f,anchor:"start",length:c,shape:t==="left"?OQ:BQ})}function MQ(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 Xf(Yw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Ce-f:+d+Ce+ +u,anchor:"start",length:c,shape:t==="bottom"?NQ:DQ})}function AQ(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*Vf):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:g=e==="y"?void 0:null,...y}){return Xf(qw,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...y,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,w,v,_){f===void 0&&(this.fontVariant=n$(x)),c===void 0&&(_.text=e$(x,b,w,v,t))})}function TQ(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*Vf):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:g=e==="x"?void 0:null,...y}){return Xf(zw,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...y,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,w,v,_){f===void 0&&(this.fontVariant=n$(x)),c===void 0&&(_.text=e$(x,b,w,v,t))})}function Zw(){let[e,t]=sc(...arguments);return J7("y",Y7(t),e,t)}function Jw(){let[e,t]=sc(...arguments);return J7("fy",X7(t),e,t)}function Qw(){let[e,t]=sc(...arguments);return Q7("x",G7(t),e,t)}function Kw(){let[e,t]=sc(...arguments);return Q7("fx",W7(t),e,t)}function J7(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 Xf(Xr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...K7(a)})}function Q7(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 Xf(Yr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...K7(a)})}function K7({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 t$({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]=Be(e),[,t]=se(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 Xf(e,t,n,r,i,o,s){let a;function c(f,d,h,p,m,g){let y=f==null&&(t==="fx"||t==="fy"),{[t]:x}=p;if(!x)throw new Error(`missing scale: ${t}`);let b=x.domain(),{interval:w,ticks:v,tickFormat:_,tickSpacing:I=t==="x"?80:35}=o;if(typeof v=="string"&&o$(x)&&(w=v,v=void 0),v===void 0&&(v=ko(w,x.type)??EQ(x,I)),f==null){if(cr(v))f=je(v);else if(Ja(v))f=VT(v,...le(b));else if(x.interval){let A=x.interval;if(x.ticks){let[E,T]=le(b),O=(T-E)/A[_f];A=qA(A,O/v)??A,f=VT(A,E,T)}else{f=b;let E=f.length;A=qA(A,E/v)??A,A!==x.interval&&(f=VT(A,...le(f)))}if(A===x.interval){let E=Math.round(f.length/v);E>1&&(f=f.filter((T,O)=>O%E===0))}}else x.ticks?f=x.ticks(v):f=b;if(!x.ticks&&f.length&&f!==b){let A=new Jn(b);f=f.filter(E=>A.has(E)),f.length||Vn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[ar(f)]:a[t]={scale:t,value:G}}s?.call(this,x,f,v,_,a);let D=Object.fromEntries(Object.entries(a).map(([A,E])=>[A,{...E,value:wt(f,E.value)}]));return y&&(d=g.filterFacets(f,D)),{data:f,facets:d,channels:D}}let l=Ie(o).initializer,u=e(i,Ie({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function EQ(e,t){let[n,r]=le(e.range());return(r-n)/t}function e$(e,t,n,r,i){return{value:Qm(e,t,n,r,i)}}function Qm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Le(t)?kF(e.type,t,i)??ji:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?ji:typeof r=="string"?(Le(e.domain())?Do:ci)(r):hn(r)}function VT(e,t,n){return e.range(t,e.offset(e.floor(n)))}var NQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},DQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},OQ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},BQ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function n$(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function r$(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&o$(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=Ew(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 i$(e="auto"){return re(e)?!1:typeof e=="boolean"?e:tn(e,"labelArrow",["auto","up","right","down","left"])}function o$(e){return Le(e.domain())}function s$(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function a$(e,{opacity:t,...n}={}){if(!$o(e)&&!MT(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return l$(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",se(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function c$(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:re(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Be(t),[f,d]=Be(r),h=s$(c,l),p=s$(c,f),m=s*s*Math.PI;return n=se(n)[1],i=se(i)[1],o=se(o)[1],l$(e,a,(g,y,x,b)=>g.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=er();return e.scale(w).draw(v,m),v}))}function l$(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=kw(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=nc(t);u=Lf(u),i=Qm(e.scale,e.domain,void 0,i);let p=ut("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
28
28
  display: flex;
29
29
  align-items: center;
30
30
  break-inside: avoid;
@@ -56,7 +56,7 @@ ${n}`}function jZ(e){return e==="time"?iw:e==="utc"?Nm:UZ}function BF(e,t,n){let
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",fe(o,"normal")).call(Bf,f).node()}var tv=new Map([["symbol",o$],["color",l$],["opacity",DQ]]);function a$(e={}){for(let[t,n]of tv){let r=e[t];if(Lo(r)){let i=nc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Lo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(Dw(t,r,o),jT(i,r,e),s=>Lo(e[s])?Dw(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function c$(e,t,n={}){return(r,i)=>{if(!tv.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return tv.get(r)(e[r],jT(t,n[r],i),o=>e[o])}}function jT({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return XF(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function l$(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return i$(e,n);case"ramp":return w7(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function DQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=on(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 l$({type:e,...n,interpolate:OQ(i)},{legend:r,...o})}function OQ(e){let{r:t,g:n,b:r}=on(e)||on(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function u$(e,t,n){let r=[];for(let[i,o]of tv){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],jT(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var BQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},LQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Hm=class extends St{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Wa,void 0,t,n==null?BQ:LQ),this.anchor=VA(n,"anchor",["top","right","bottom","left"]),this.insetTop=Bt(i),this.insetRight=Bt(o),this.insetBottom=Bt(s),this.insetLeft=Bt(a),this.rx=Bt(c),this.ry=Bt(l)}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:g,rx:y,ry:x}=this,b=l+g,w=u-a-p,_=s+h,v=f-c-m;return ut(d?"svg:line":"svg:rect",o).datum(0).call(Ct,this,i,o).call(Lt,this).call(Qt,this,r).call(Et,this,{}).call(d==="left"?I=>I.attr("x1",b).attr("x2",b).attr("y1",_).attr("y2",v):d==="right"?I=>I.attr("x1",w).attr("x2",w).attr("y1",_).attr("y2",v):d==="top"?I=>I.attr("x1",b).attr("x2",w).attr("y1",_).attr("y2",_):d==="bottom"?I=>I.attr("x1",b).attr("x2",w).attr("y1",v).attr("y2",v):I=>I.attr("x",b).attr("y",_).attr("width",w-b).attr("height",v-_).attr("rx",y).attr("ry",x)).node()}};function Yf(e){return new Hm(e)}var qT={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},CQ=new Set(["geometry","href","src","ariaLabel","scales"]),Zm=class extends St{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&cr(t)&&cw(t)&&(n={...n,title:G});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:g,lineHeight:y=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:I=8,title:N,pointerSize:A=12,pathFilter:D="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:N,optional:!0}},n,qT),this.anchor=uw(l,"anchor"),this.preferredAnchor=uw(u,"preferredAnchor"),this.frameAnchor=Fo(b),this.textAnchor=fe(_,"middle"),this.textPadding=+I,this.pointerSize=+A,this.pathFilter=je(D),this.lineHeight=+y,this.lineWidth=+x,this.textOverflow=FT(v),this.monospace=!!f,this.fontFamily=je(d),this.fontSize=Bt(h),this.fontStyle=je(p),this.fontVariant=je(m),this.fontWeight=je(g);for(let T in qT)T in this.channels&&(this[T]=qT[T]);this.splitLines=$T(this),this.clipLine=PT(this),this.format={...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:g}=this,{textPadding:y,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:_}=i,{x1:v,y1:I,x2:N,y2:A,x:D=v??N,y:T=I??A}=r,O=l?l(t.fx)-_:0,C=u?u(t.fy)-w:0,[S,M]=gn(this,i),E=NT(r,S),F=DT(r,M),R=p?Vw:qw,k=R(Ol),$,P;"title"in r?($=r.channels,P=PQ):($=$Q.call(this,r,n),P=UQ);let U=ut("svg:g",o).call(Ct,this,i,o).call(RT,this).call(Et,this,{x:D&&a,y:T&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(E(at))},${Math.round(F(at))})`).call(Lt,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(Y){let rt=Vt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let j=P.call(s,Y,t,$,n,r);if(typeof j=="string")for(let H of s.splitLines(j))W(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of j){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),W(rt,ot))}}})));function W(nt,{label:at,value:Y,color:rt,opacity:j}){at??="",Y??="";let H=rt!=null||j!=null,ot,z=g*100,[kt]=Ll(at,z,R,k);if(kt>=0)at=at.slice(0,kt).trimEnd()+Ol,ot=Y.trim(),Y="";else{(at||!Y&&!H)&&(Y=" "+Y);let[Ht]=Ll(Y,z-R(at),R,k);Ht>=0&&(ot=Y.trim(),Y=Y.slice(0,Ht).trimEnd()+Ol)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&dt.append("tspan").attr("font-weight","bold").text(at),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",j).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:at}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:j,height:H}=this.getBBox();j=Math.round(j),H=Math.round(H);let ot=h;if(ot===void 0){let dt=E(Y)+O,Ht=F(Y)+C,Zt=dt+j+x+y*2<nt,et=dt-j-x-y*2>0,ae=Ht+H+x+y*2<at,Sr=Ht-H-x-y*2>0;ot=Zt&&et?ae&&Sr?s.preferredAnchor:Sr?"bottom":"top":ae&&Sr?Zt?"left":"right":(Zt||et)&&(ae||Sr)?`${Sr?"bottom":"top"}-${Zt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,kt=this.lastChild;if(z.setAttribute("d",RQ(ot,x,y,j,H)),rt)for(let dt of kt.childNodes)dt.setAttribute("x",-rt);kt.setAttribute("y",`${+kQ(ot,kt.childNodes.length,m).toFixed(6)}em`),kt.setAttribute("transform",`translate(${FQ(ot,x,y,j,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function nv(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new Zm(e,{...r,x:t,y:n})}function kQ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function FQ(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 RQ(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 $Q({channels:e},t){let n={},r=this.format;r=f$(r,e,"x"),r=f$(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=$m(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||CQ.has(i))continue;let o=$m(e,i);o&&(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]=(Le(s)?Do:ci)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Wm(s,s.domain()):qi}}return n}function f$(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 PQ(e,t,{title:n}){return qi(n.value[e],e)}function*UQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:ev(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:h$(r,n,"x"),value:d$(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:h$(r,n,"y"),value:d$(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!ze(a)&&c==null)continue;yield{label:ev(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function d$(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 h$(e,t,n){let r=ev(e,t,`${n}1`,n),i=ev(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function ev(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Qm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Of(e.className),l=e.marks===void 0?[]:m$(e.marks);l.push(...GQ(l));let u=YQ(t,e),f=new Map;for(let k of l){let $=y$(k,u,e);$&&f.set(k,$)}let d=new Map;u&&Jm(d,[u],e),Jm(d,f,e);let h=m$(WQ(l,d,e));for(let k of h){let $=y$(k,u,e);$&&f.set(k,$)}l.unshift(...h);let p=p7(d,e);if(p!==void 0){let k=u?Cw(p,u):void 0;for(let P of l){if(P.facet===null||P.facet==="super")continue;let U=f.get(P);U!==void 0&&(U.facetsIndex=P.fx!=null||P.fy!=null?Cw(p,U):k)}let $=new Set;for(let{facetsIndex:P}of f.values())P?.forEach((U,W)=>{U?.length>0&&$.add(W)});p.forEach(0<$.size&&$.size<p.length?(P,U)=>P.empty=!$.has(U):P=>P.empty=!1);for(let P of l)if(P.facet==="exclude"){let U=f.get(P);U!==void 0&&(U.facetsIndex=g7(U.facetsIndex))}}for(let k of de.keys())Lo(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:$,channels:P}=f.get(k)??{},{data:U,facets:W,channels:tt}=k.initialize($,P,e);XT(tt,e),m.set(k,{data:U,facets:W,channels:tt})}let g=qm(Jm(d,m,e),e),y=d7(g,l,e);o7(g,y);let x=wT(g),{fx:b,fy:w}=x,_=b||w?vT(g,y):y,v=b||w?eK(x,y):y,I=nc(e),N=I.document,A=Os("svg").call(N.documentElement),D=A;I.ownerSVGElement=A,I.className=c,I.projection=xR(e,_),I.filterFacets=(k,$)=>Cw(p,{channels:$,groups:Bw(k,$)}),I.getMarkState=k=>{let $=m.get(k),P=f.get(k);return{...$,channels:{...$.channels,...P?.channels}}},I.dispatchValue=k=>{D.value!==k&&(D.value=k,D.dispatchEvent(new Event("input",{bubbles:!0})))};let T=new Set;for(let[k,$]of m)if(k.initializer!=null){let P=k.facet==="super"?v:_,U=k.initializer($.data,$.facets,$.channels,x,P,I);if(U.data!==void 0&&($.data=U.data),U.facets!==void 0&&($.facets=U.facets),U.channels!==void 0){let{fx:W,fy:tt,...nt}=U.channels;VQ(nt),Object.assign($.channels,nt);for(let at of Object.values(nt)){let{scale:Y}=at;Y!=null&&!WF(de.get(Y))&&(b$(at,e),T.add(Y))}(W!=null||tt!=null)&&f.set(k,!0)}}if(T.size){let k=new Map;Jm(k,m,e,W=>T.has(W)),Jm(d,m,e,W=>T.has(W));let $=tK(qm(k,e),g),{scales:P,...U}=wT($);Object.assign(g,$),Object.assign(x,U),Object.assign(x.scales,P)}let O,C;p!==void 0&&(O={x:b?.domain(),y:w?.domain()},p=m7(p,O),C=y7(b,w,y));for(let[k,$]of m)$.values=k.scale($.channels,x,I);let{width:S,height:M}=y;Vt(A).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}) {
59
+ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",fe(o,"normal")).call(Cf,f).node()}var tv=new Map([["symbol",c$],["color",d$],["opacity",LQ]]);function u$(e={}){for(let[t,n]of tv){let r=e[t];if(Lo(r)){let i=nc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Lo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(Dw(t,r,o),YT(i,r,e),s=>Lo(e[s])?Dw(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function f$(e,t,n={}){return(r,i)=>{if(!tv.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return tv.get(r)(e[r],YT(t,n[r],i),o=>e[o])}}function YT({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return HF(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function d$(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return a$(e,n);case"ramp":return S7(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function LQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=on(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 d$({type:e,...n,interpolate:CQ(i)},{legend:r,...o})}function CQ(e){let{r:t,g:n,b:r}=on(e)||on(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function h$(e,t,n){let r=[];for(let[i,o]of tv){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],YT(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var kQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},FQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Km=class extends St{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Wa,void 0,t,n==null?kQ:FQ),this.anchor=GA(n,"anchor",["top","right","bottom","left"]),this.insetTop=Bt(i),this.insetRight=Bt(o),this.insetBottom=Bt(s),this.insetLeft=Bt(a),this.rx=Bt(c),this.ry=Bt(l)}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:g,rx:y,ry:x}=this,b=l+g,w=u-a-p,v=s+h,_=f-c-m;return ut(d?"svg:line":"svg:rect",o).datum(0).call(Ct,this,i,o).call(Lt,this).call(Qt,this,r).call(Et,this,{}).call(d==="left"?I=>I.attr("x1",b).attr("x2",b).attr("y1",v).attr("y2",_):d==="right"?I=>I.attr("x1",w).attr("x2",w).attr("y1",v).attr("y2",_):d==="top"?I=>I.attr("x1",b).attr("x2",w).attr("y1",v).attr("y2",v):d==="bottom"?I=>I.attr("x1",b).attr("x2",w).attr("y1",_).attr("y2",_):I=>I.attr("x",b).attr("y",v).attr("width",w-b).attr("height",_-v).attr("rx",y).attr("ry",x)).node()}};function Gf(e){return new Km(e)}var XT={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},RQ=new Set(["geometry","href","src","ariaLabel","scales"]),ty=class extends St{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&cr(t)&&cw(t)&&(n={...n,title:G});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:g,lineHeight:y=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:v="start",textOverflow:_,textPadding:I=8,title:D,pointerSize:A=12,pathFilter:E="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:D,optional:!0}},n,XT),this.anchor=uw(l,"anchor"),this.preferredAnchor=uw(u,"preferredAnchor"),this.frameAnchor=Fo(b),this.textAnchor=fe(v,"middle"),this.textPadding=+I,this.pointerSize=+A,this.pathFilter=qe(E),this.lineHeight=+y,this.lineWidth=+x,this.textOverflow=PT(_),this.monospace=!!f,this.fontFamily=qe(d),this.fontSize=Bt(h),this.fontStyle=qe(p),this.fontVariant=qe(m),this.fontWeight=qe(g);for(let T in XT)T in this.channels&&(this[T]=XT[T]);this.splitLines=zT(this),this.clipLine=qT(this),this.format={...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:g}=this,{textPadding:y,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:v}=i,{x1:_,y1:I,x2:D,y2:A,x:E=_??D,y:T=I??A}=r,O=l?l(t.fx)-v:0,C=u?u(t.fy)-w:0,[S,M]=gn(this,i),N=BT(r,S),F=LT(r,M),R=p?Vw:jw,k=R(Ol),$,P;"title"in r?($=r.channels,P=qQ):($=zQ.call(this,r,n),P=jQ);let U=ut("svg:g",o).call(Ct,this,i,o).call(UT,this).call(Et,this,{x:E&&a,y:T&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(N(at))},${Math.round(F(at))})`).call(Lt,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(Y){let rt=Vt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let j=P.call(s,Y,t,$,n,r);if(typeof j=="string")for(let H of s.splitLines(j))W(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of j){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),W(rt,ot))}}})));function W(nt,{label:at,value:Y,color:rt,opacity:j}){at??="",Y??="";let H=rt!=null||j!=null,ot,z=g*100,[kt]=Ll(at,z,R,k);if(kt>=0)at=at.slice(0,kt).trimEnd()+Ol,ot=Y.trim(),Y="";else{(at||!Y&&!H)&&(Y=" "+Y);let[Ht]=Ll(Y,z-R(at),R,k);Ht>=0&&(ot=Y.trim(),Y=Y.slice(0,Ht).trimEnd()+Ol)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&dt.append("tspan").attr("font-weight","bold").text(at),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",j).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:at}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:j,height:H}=this.getBBox();j=Math.round(j),H=Math.round(H);let ot=h;if(ot===void 0){let dt=N(Y)+O,Ht=F(Y)+C,Zt=dt+j+x+y*2<nt,et=dt-j-x-y*2>0,ae=Ht+H+x+y*2<at,Sr=Ht-H-x-y*2>0;ot=Zt&&et?ae&&Sr?s.preferredAnchor:Sr?"bottom":"top":ae&&Sr?Zt?"left":"right":(Zt||et)&&(ae||Sr)?`${Sr?"bottom":"top"}-${Zt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,kt=this.lastChild;if(z.setAttribute("d",UQ(ot,x,y,j,H)),rt)for(let dt of kt.childNodes)dt.setAttribute("x",-rt);kt.setAttribute("y",`${+$Q(ot,kt.childNodes.length,m).toFixed(6)}em`),kt.setAttribute("transform",`translate(${PQ(ot,x,y,j,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function nv(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new ty(e,{...r,x:t,y:n})}function $Q(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function PQ(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 UQ(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 zQ({channels:e},t){let n={},r=this.format;r=p$(r,e,"x"),r=p$(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=qm(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||RQ.has(i))continue;let o=qm(e,i);o&&(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]=(Le(s)?Do:ci)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Qm(s,s.domain()):ji}}return n}function p$(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 qQ(e,t,{title:n}){return ji(n.value[e],e)}function*jQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:ev(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:y$(r,n,"x"),value:m$(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:y$(r,n,"y"),value:m$(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!ze(a)&&c==null)continue;yield{label:ev(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function m$(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 y$(e,t,n){let r=ev(e,t,`${n}1`,n),i=ev(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function ev(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function ny(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Lf(e.className),l=e.marks===void 0?[]:x$(e.marks);l.push(...ZQ(l));let u=WQ(t,e),f=new Map;for(let k of l){let $=b$(k,u,e);$&&f.set(k,$)}let d=new Map;u&&ey(d,[u],e),ey(d,f,e);let h=x$(JQ(l,d,e));for(let k of h){let $=b$(k,u,e);$&&f.set(k,$)}l.unshift(...h);let p=g7(d,e);if(p!==void 0){let k=u?Cw(p,u):void 0;for(let P of l){if(P.facet===null||P.facet==="super")continue;let U=f.get(P);U!==void 0&&(U.facetsIndex=P.fx!=null||P.fy!=null?Cw(p,U):k)}let $=new Set;for(let{facetsIndex:P}of f.values())P?.forEach((U,W)=>{U?.length>0&&$.add(W)});p.forEach(0<$.size&&$.size<p.length?(P,U)=>P.empty=!$.has(U):P=>P.empty=!1);for(let P of l)if(P.facet==="exclude"){let U=f.get(P);U!==void 0&&(U.facetsIndex=w7(U.facetsIndex))}}for(let k of de.keys())Lo(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:$,channels:P}=f.get(k)??{},{data:U,facets:W,channels:tt}=k.initialize($,P,e);HT(tt,e),m.set(k,{data:U,facets:W,channels:tt})}let g=Gm(ey(d,m,e),e),y=m7(g,l,e);c7(g,y);let x=ST(g),{fx:b,fy:w}=x,v=b||w?IT(g,y):y,_=b||w?iK(x,y):y,I=nc(e),D=I.document,A=Os("svg").call(D.documentElement),E=A;I.ownerSVGElement=A,I.className=c,I.projection=vR(e,v),I.filterFacets=(k,$)=>Cw(p,{channels:$,groups:Bw(k,$)}),I.getMarkState=k=>{let $=m.get(k),P=f.get(k);return{...$,channels:{...$.channels,...P?.channels}}},I.dispatchValue=k=>{E.value!==k&&(E.value=k,E.dispatchEvent(new Event("input",{bubbles:!0})))};let T=new Set;for(let[k,$]of m)if(k.initializer!=null){let P=k.facet==="super"?_:v,U=k.initializer($.data,$.facets,$.channels,x,P,I);if(U.data!==void 0&&($.data=U.data),U.facets!==void 0&&($.facets=U.facets),U.channels!==void 0){let{fx:W,fy:tt,...nt}=U.channels;GQ(nt),Object.assign($.channels,nt);for(let at of Object.values(nt)){let{scale:Y}=at;Y!=null&&!JF(de.get(Y))&&(_$(at,e),T.add(Y))}(W!=null||tt!=null)&&f.set(k,!0)}}if(T.size){let k=new Map;ey(k,m,e,W=>T.has(W)),ey(d,m,e,W=>T.has(W));let $=rK(Gm(k,e),g),{scales:P,...U}=ST($);Object.assign(g,$),Object.assign(x,U),Object.assign(x.scales,P)}let O,C;p!==void 0&&(O={x:b?.domain(),y:w?.domain()},p=x7(p,O),C=b7(b,w,y));for(let[k,$]of m)$.values=k.scale($.channels,x,I);let{width:S,height:M}=y;Vt(A).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,24 +66,24 @@ ${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(Bf,n);for(let k of l){let{channels:$,values:P,facets:U}=m.get(k);if(p===void 0||k.facet==="super"){let W=null;if(U&&(W=U[0],W=k.filter(W,$,P),W.length===0))continue;let tt=k.render(W,x,P,v,I);if(tt==null)continue;A.appendChild(tt)}else{let W;for(let tt of p){if(!(k.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if(U){let Y=f.has(k);if(nt=U[Y?tt.i:0],nt=k.filter(nt,$,P),nt.length===0)continue;!Y&&nt===U[0]&&(nt=Js(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let at=k.render(nt,x,P,_,I);if(at!=null){(W??=Vt(A).append("g")).append(()=>at).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(Y)&&(W.attr(Y,at.getAttribute(Y)),at.removeAttribute(Y))}}W?.selectChildren().attr("transform",C)}}let E=u$(g,I,e),{figure:F=r!=null||i!=null||o!=null||E.length>0}=e;F&&(D=N.createElement("figure"),D.className=`${c}-figure`,D.style.maxWidth="initial",r!=null&&D.append(p$(N,r,"h2")),i!=null&&D.append(p$(N,i,"h3")),D.append(...E,A),o!=null&&D.append(zQ(N,o))),D.scale=l7(x.scales),D.legend=c$(g,I,e);let R=pR();return R>0&&Vt(A).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(`${R.toLocaleString("en-US")} warning${R===1?"":"s"}. Please check the console.`),D}function p$(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function zQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function jQ({marks:e=[],...t}={}){return Qm({...t,marks:[...e,this]})}St.prototype.plot=jQ;function m$(e){return e.flat(1/0).filter(t=>t!=null).map(qQ)}function qQ(e){return typeof e.render=="function"?e:new YT(e)}var YT=class extends St{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function XT(e,t){for(let n in e)b$(e[n],t);return e}function b$(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*100:WA(s,i)}=t[n]??{};a!=null&&(e.value=Gt(e.value,a),e.transform=!1)}function VQ(e){for(let t in e)cT(t,e[t])}function Jm(e,t,n,r=kF){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(!vR(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=SR(s);c&&VT(e,"x",u),l&&VT(e,"y",f)}}}else VT(e,a,s)}return e}function VT(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function YQ(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=qe(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Nf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Nf(i,{value:r,scale:"fy"})),XT(o,t);let s=Bw(i,o);return{channels:o,groups:s,data:e.data}}function y$(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=qe(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=Nf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Nf(c,{value:i,scale:"fy"})),XT(l,n),{channels:l,groups:Bw(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)&&qe(e.data)?.length===a.length&&Vn(`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 XQ(e,t={}){return Ie({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function GQ(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)?zf:/^y$/i.test(i)?El:Uf,r=i(XQ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===El?"left":"bottom");let s=nv(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function WQ(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:g=m===null?null:l}=o,fx:{axis:y=f,grid:x=y===null?null:d}=s,fy:{axis:b=f,grid:w=b===null?null:d}=a}=n;(r||!Lo(i)&&!g$("x",e))&&(h=p=null),(r||!Lo(o)&&!g$("y",e))&&(m=g=null),t.has("fx")||(y=x=null),t.has("fy")||(b=w=null),h===void 0&&(h=!ov(e,"x")),m===void 0&&(m=!ov(e,"y")),y===void 0&&(y=!ov(e,"fx")),b===void 0&&(b=!ov(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),y===!0&&(y=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return iv(_,w,Jw,a),rv(_,b,Ww,"right","left",u,a),iv(_,x,Kw,s),rv(_,y,Hw,"top","bottom",u,s),iv(_,g,Zw,o),rv(_,m,Xm,"left","right",n,o),iv(_,p,Qw,i),rv(_,h,Gm,"bottom","top",n,i),_}function rv(e,t,n,r,i,o,s){if(!t)return;let a=HQ(t);s=ZQ(a?r:t,o,s);let{line:c}=s;(n===Xm||n===Gm)&&c&&!ta(c)&&e.push(Yf(JQ(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function iv(e,t,n,r){!t||ta(t)||e.push(n(QQ(t,r)))}function HQ(e){return/^\s*both\s*$/i.test(e)}function ZQ(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 JQ(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function QQ(e,{stroke:t=Qa(e)?e:void 0,ticks:n=KQ(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function KQ(e){switch(typeof e){case"number":return!0;case"string":return!Qa(e)}return cr(e)||typeof e?.range=="function"}function ov(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function g$(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 tK(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 eK({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Nw(n),l=e&&x$(e),u=t&&x$(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 x$(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var nK=new Map([["basis",pA],["basis-closed",mA],["basis-open",yA],["bundle",gA],["bump-x",lA],["bump-y",uA],["cardinal",xA],["cardinal-closed",bA],["cardinal-open",wA],["catmull-rom",vA],["catmull-rom-closed",_A],["catmull-rom-open",SA],["linear",Xs],["linear-closed",IA],["monotone-x",AA],["monotone-y",TA],["natural",EA],["step",NA],["step-after",OA],["step-before",DA]]);function Km(e=Xs,t){if(typeof e=="function")return e;let n=nK.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 sv(e=ac,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?ac:Km(e,t)}function ac(e){return Xs(e)}function Uo(e={y:"count"},t={}){[e,t]=WT(e,t);let{x:n,y:r}=t;return GT(av(n,t,G),null,null,r,e,Nl(t))}function zo(e={x:"count"},t={}){[e,t]=WT(e,t);let{x:n,y:r}=t;return GT(null,av(r,t,G),n,null,e,Dl(t))}function sa(e={fill:"count"},t={}){[e,t]=WT(e,t);let{x:n,y:r}=rK(t);return GT(n,r,null,null,e,Nl(Dl(t)))}function _$(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=gw}=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 Xf(e={}){return _$(Uo,"y",Yi(e,"x"))}function Gf(e={}){return _$(zo,"x",Yi(e,"y"))}function GT(e,t,n,r,{data:i=yw,filter:o=Cm,sort:s,reverse:a,...c}={},l={}){e=w$(e),t=w$(t),c=iK(c,l),i=M$(i,G),s=s==null?void 0:S$("sort",s,l),o=o==null?void 0:I$("filter",o,l),n!=null&&Ro(c,"x","x1","x2")&&(n=null),r!=null&&Ro(c,"y","y1","y2")&&(r=null);let[u,f]=Dn(e),[d,h]=Dn(e),[p,m]=Dn(t),[g,y]=Dn(t),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=Dn(x),{x:v,y:I,z:N,fill:A,stroke:D,x1:T,x2:O,y1:C,y2:S,domain:M,cumulative:E,thresholds:F,interval:R,...k}=l,[$,P]=Dn(N),[U]=Be(A),[W]=Be(D),[tt,nt]=Dn(U),[at,Y]=Dn(W);return{..."z"in l&&{z:$||N},..."fill"in l&&{fill:tt||A},..."stroke"in l&&{stroke:at||D},...yn(k,(rt,j,H)=>{let ot=Sl(bt(rt,x),H?.[b]),z=bt(rt,N),kt=bt(rt,U),dt=bt(rt,W),Ht=Rm(c,{z,fill:kt,stroke:dt}),Zt=[],et=[],ae=ot&&_([]),Sr=z&&P([]),Wi=kt&&nt([]),ez=dt&&Y([]),vD=e&&f([]),nz=e&&h([]),_D=t&&m([]),rz=t&&y([]),iz=aK(e,t,rt),oz=0;for(let Wl of c)Wl.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let Wl of j){let SD=[];for(let Bd of c)Bd.scope("facet",Wl);s&&s.scope("facet",Wl),o&&o.scope("facet",Wl);for(let[Bd,sz]of Ka(Wl,Ht))for(let[az,rg]of Ka(sz,ot))for(let[Hi,bc]of iz(rg))if(!(o&&!o.reduce(Hi,bc))){SD.push(oz++),et.push(i.reduceIndex(Hi,rt,bc)),ot&&ae.push(az),z&&Sr.push(Ht===z?Bd:z[(Hi.length>0?Hi:rg)[0]]),kt&&Wi.push(Ht===kt?Bd:kt[(Hi.length>0?Hi:rg)[0]]),dt&&ez.push(Ht===dt?Bd:dt[(Hi.length>0?Hi:rg)[0]]),vD&&(vD.push(bc.x1),nz.push(bc.x2)),_D&&(_D.push(bc.y1),rz.push(bc.y2));for(let cz of c)cz.reduce(Hi,bc);s&&s.reduce(Hi)}Zt.push(SD)}return sT(Zt,s,a),{data:et,facets:Zt}}),...!Ro(c,"x")&&(u?{x1:u,x2:d,x:If(u,d)}:{x:v,x1:T,x2:O}),...!Ro(c,"y")&&(p?{y1:p,y2:g,y:If(p,g)}:{y:I,y1:C,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:rt,output:j})=>[rt,j]))}}function WT({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function av(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...pi(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=HT(e.thresholds,e.interval),e}function rK(e){let{x:t,y:n}=e;return t=av(t,e),n=av(n,e),[t.value,n.value]=$e(t.value,n.value),{x:t,y:n}}function w$(e){if(e==null)return;let{value:t,cumulative:n,domain:r=le,thresholds:i}=e,o=s=>{let a=bt(s,t),c;if(Le(a)||sK(i)){a=Gt(a,qA,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ja(i)?i(a,u,f):i;typeof d=="number"&&(d=rm(u,f,d)),Ja(d)&&(r===le&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Ke(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ja(i)?i(a,u,f):i;if(typeof d=="number")if(r===le){let h=Es(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 g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)*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 g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)/h}else d=[u];else d=[u]}else d=Mn(u,f,d);else Ja(d)&&(r===le&&(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?lK:n>0?cK:ZT)(l,c,a),l};return o.label=On(t),o}function HT(e,t,n=v$){if(e===void 0)return t===void 0?n:ko(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return K0;case"scott":return Qh;case"sturges":return Na;case"auto":return v$}return Dm(e)}return e}function iK(e,t){return iT(e,t,S$)}function S$(e,t,n){return pw(e,t,n,I$)}function I$(e,t,n){return mw(e,t,n,M$)}function M$(e,t){return Ef(e,t,oK)}function oK(e){switch(`${e}`.toLowerCase()){case"x":return uK;case"x1":return dK;case"x2":return hK;case"y":return fK;case"y1":return pK;case"y2":return mK}throw new Error(`invalid bin reduce: ${e}`)}function v$(e,t,n){return Math.min(200,Qh(e,t,n))}function sK(e){return PF(e)||cr(e)&&Le(e)}function aK(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 ZT(e,t,n){return t=Ke(t),r=>{let i=e.map(()=>[]);for(let o of r)i[Ts(t,n[o])-1]?.push(o);return i}}function cK(e,t,n){let r=ZT(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 lK(e,t,n){let r=ZT(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 A$(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var uK={reduceIndex(e,t,{x1:n,x2:r}){return A$(n,r)}},fK={reduceIndex(e,t,{y1:n,y2:r}){return A$(n,r)}},dK={reduceIndex(e,t,{x1:n}){return n}},hK={reduceIndex(e,t,{x2:n}){return n}},pK={reduceIndex(e,t,{y1:n}){return n}},mK={reduceIndex(e,t,{y2:n}){return n}};function Wf(e={}){return YA(e)?e:{...e,x:G}}function Hf(e={}){return XA(e)?e:{...e,y:G}}function T$(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,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=Za(e);let o=e[UA]=new Uint32Array(n+i);t=t.map(a=>Za(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 JT(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Kf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:If(c,l)}}function D$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Kf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function O$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Kf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function QT(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Kf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:If(c,l)}}function B$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Kf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function L$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Kf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Zf({x:e,x1:t,x2:n,...r}={}){return r=Yi(r,"y"),t===void 0&&n===void 0?JT({x:e,...r}):([t,n]=GA(e,t,n),{...r,x1:t,x2:n})}function Jf({y:e,y1:t,y2:n,...r}={}){return r=Yi(r,"x"),t===void 0&&n===void 0?QT({y:e,...r}):([t,n]=GA(e,t,n),{...r,y1:t,y2:n})}function Qf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var yK={length:!0};function Kf(e,t=Om,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=qn(a),[l,u]=Dn(e),[f,d]=mn(t),[h,p]=mn(t);return f.hint=h.hint=yK,i=gK(i),o=wK(o,i,r),[yn(a,(m,g,y)=>{({data:m,facets:g}=T$(m,g));let x=e==null?void 0:u(Sl(bt(m,e),y?.[n])),b=bt(m,t,Float64Array),w=bt(m,c),_=o&&o(m,x,b,w),v=m.length,I=d(new Float64Array(v)),N=p(new Float64Array(v)),A=[];for(let D of g){let T=x?Array.from(cn(D,O=>x[O]).values()):[D];if(_)for(let O of T)O.sort(_);for(let O of T){let C=0,S=0;s&&O.reverse();for(let M of O){let E=b[M];E<0?C=N[M]=(I[M]=C)+E:E>0?S=N[M]=(I[M]=S)+E:N[M]=I[M]=S}}A.push(T)}return i&&i(A,I,N,w),{data:m,facets:g}}),l,f,h]}function gK(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return xK;case"center":case"silhouette":return bK;case"wiggle":return k$}throw new Error(`unknown offset: ${e}`)}}function C$(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 xK(e,t,n){for(let r of e)for(let i of r){let[o,s]=C$(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 bK(e,t,n){for(let r of e){for(let i of r){let[o,s]=C$(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}F$(r,t,n)}R$(e,t,n)}function k$(e,t,n,r){for(let i of e){let o=new Zn,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,...W0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=An(l);d&&(s-=An(l,(h,p)=>(u[p]/2+f[p])*h)/d)}F$(i,t,n)}R$(e,t,n)}function F$(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 R$(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])+Wt(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 wK(e,t,n){if(e===void 0&&t===k$)return E$(dn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?bl:dn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return vK(i);case"z":return _K(i);case"sum":return SK(i);case"appearance":return IK(i);case"inside-out":return E$(i)}return N$(zA(e))}if(typeof e=="function")return(e.length===1?N$:MK)(e);if(Array.isArray(e))return AK(e);throw new Error(`invalid order: ${e}`)}}function vK(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function _K(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function SK(e){return cv(e,(t,n,r,i)=>Mu(ar(t),o=>An(o,s=>r[s]),o=>i[o]))}function IK(e){return cv(e,(t,n,r,i)=>Mu(ar(t),o=>n[Xc(o,s=>r[s])],o=>i[o]))}function E$(e){return cv(e,(t,n,r,i)=>{let o=ar(t),s=Mu(o,f=>n[Xc(f,d=>r[d])],f=>i[f]),a=$i(o,f=>An(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 N$(e){return t=>{let n=bt(t,e);return(r,i)=>dn(n[r],n[i])}}function MK(e){return t=>(n,r)=>e(t[n],t[r])}function AK(e){return cv(dn,()=>e)}function cv(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Zn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var TK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},kl=class extends St{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:qn(n),optional:!0}},n,TK),this.z=a,this.curve=Km(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 ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n,0,0).call(u=>u.selectAll().data(_w(t,[s,a,c,l],this,r)).enter().append("path").call(Lt,this).call(Tl,this,r).attr("d",ff().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 ty(e,t){return t===void 0?aa(e,{x:Zs,y:Ha}):new kl(e,t)}function cc(e,t){let{y:n=Ee,...r}=Gf(t);return new kl(e,Zf(Wf({...r,y1:n,y2:void 0})))}function aa(e,t){let{x:n=Ee,...r}=Xf(t);return new kl(e,Jf(Hf({...r,x1:n,x2:void 0})))}var EK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ey=class extends St{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,EK),this.curve=sv(a,c),Xi(this,n)}project(t,n,r){this.curve!==ac&&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 ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",u===ac&&o.projection?NK(o.projection,s,a,c,l):d=>{let h=er(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Qt,this,r).call(oa,this,r,o)).node()}};function NK(e,t,n,r,i){let o=En(e);return t=Ke(t),n=Ke(n),r=Ke(r),i=Ke(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function lv(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=ny(t,n,r),[o,s]=ny(i,o,s),new ey(e,{...a,x1:n,x2:r,y1:o,y2:s})}function ny(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 DK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},ry=class extends St{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,DK),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=OK(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:g}=this,y=u?w=>u[w]:hn(f===void 0?1:f),x=h*jf/2,b=p/1.5;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",_=>{let v=s[_],I=a[_],N=c[_],A=l[_],D=Math.hypot(N-v,A-I);if(D<=m+g)return null;let T=Math.atan2(A-I,N-v),O=Math.min(b*y(_),D/3),C=this.sweep(v,I,N,A)*d*jf,S=Math.hypot(D/Math.tan(C),D)/2;if(m||g)if(S<1e5){let tt=Math.sign(C),[nt,at]=BK([v,I],[N,A],S,tt);if(m&&([v,I]=$$([nt,at,S],[v,I,m],-tt*Math.sign(m))),g){let[Y,rt]=$$([nt,at,S],[N,A,g],tt*Math.sign(g));T+=Math.atan2(rt-at,Y-nt)-Math.atan2(A-at,N-nt),N=Y,A=rt}}else{let tt=N-v,nt=A-I,at=Math.hypot(tt,nt);m&&(v+=tt/at*m,I+=nt/at*m),g&&(N-=tt/at*g,A-=nt/at*g)}let M=T+C,E=M+x,F=M-x,R=N-O*Math.cos(E),k=A-O*Math.sin(E),$=N-O*Math.cos(F),P=A-O*Math.sin(F),U=S<1e5?`A${S},${S} 0,0,${C>0?1:0} `:"L",W=O?`M${R},${k}L${N},${A}L${$},${P}`:"";return`M${v},${I}${U}${N},${A}${W}`}).call(Qt,this,r)).node()}};function OK(e=1){if(typeof e=="number")return hn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(tn(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>zt(t,r);case"-x":return(t,n,r)=>Hn(t,r);case"+y":return(t,n,r,i)=>zt(n,i);case"-y":return(t,n,r,i)=>Hn(n,i)}}function BK([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 $$([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 P$(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=ny(t,n,r),[o,s]=ny(i,o,s),new ry(e,{...a,x1:n,x2:r,y1:o,y2:s})}var td=class extends St{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Bt(s),this.insetRight=Bt(a),this.insetBottom=Bt(c),this.insetLeft=Bt(l),this.rx=fe(u,"auto"),this.ry=fe(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ut("svg:g",o).call(Ct,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Lt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ft,"rx",s).call(ft,"ry",a).call(Qt,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)}},U$={ariaLabel:"bar"},iy=class extends td{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,U$)}_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 lr(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 lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},oy=class extends td{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,U$)}_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 lr(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 lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function jo(e,t={}){return _f(t)||(t={...t,y:Ee,x2:G}),new iy(e,Zf(Rw(Wf(t))))}function qo(e,t={}){return _f(t)||(t={...t,x:Ee,y2:G}),new oy(e,Jf($w(Hf(t))))}var LK={ariaLabel:"cell"},Fl=class extends td{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,LK)}_transform(t,n){t.call(Et,n,{},0,0)}};function lc(e,{x:t,y:n,...r}={}){return[t,n]=$e(t,n),new Fl(e,{...r,x:t,y:n})}function z$(e,{x:t=Ee,fill:n,stroke:r,...i}={}){return n===void 0&&Be(r)[0]===void 0&&(n=G),new Fl(e,{...i,x:t,fill:n,stroke:r})}function j$(e,{y:t=Ee,fill:n,stroke:r,...i}={}){return n===void 0&&Be(r)[0]===void 0&&(n=G),new Fl(e,{...i,y:t,fill:n,stroke:r})}var CK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function sy(e){return e.sort===void 0&&e.reverse===void 0?dw({channel:"-r"},e):e}var Rl=class extends St{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Gs,frameAnchor:c}=n,[l,u]=se(s,0),[f,d]=JF(a),[h,p]=se(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:sr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},sy(n),CK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Fo(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:x}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===g.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,[g,y]=gn(this,i),x=m===Gs,b=u?void 0:h*h*Math.PI;return Va(h)&&(t=[]),ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(x?"circle":"path").call(Lt,this).call(x?_=>{_.attr("cx",c?v=>c[v]:g).attr("cy",l?v=>l[v]:y).attr("r",u?v=>u[v]:h)}:_=>{_.attr("transform",oc`translate(${c?v=>c[v]:g},${l?v=>l[v]:y})${f?v=>` rotate(${f[v]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?v=>{let I=er();return d[v].draw(I,u[v]*u[v]*Math.PI),I}:u?v=>{let I=er();return m.draw(I,u[v]*u[v]*Math.PI),I}:d?v=>{let I=er();return d[v].draw(I,b),I}:(()=>{let v=er();return m.draw(v,b),v})())}).call(Qt,this,r)).node()}};function yi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new Rl(e,{...r,x:t,y:n})}function q$(e,{x:t=G,...n}={}){return new Rl(e,Uw({...n,x:t}))}function V$(e,{y:t=G,...n}={}){return new Rl(e,Pw({...n,y:t}))}function Y$(e,t){return yi(e,{...t,symbol:"circle"})}function X$(e,t){return yi(e,{...t,symbol:"hexagon"})}var kK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},$l=class extends St{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:qn(n),optional:!0}},n,kK),this.z=o,this.curve=sv(s,a),Xi(this,n)}filter(t){return t}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(l=>l.selectAll().data(_w(t,[s,a],this,r)).enter().append("path").call(Lt,this).call(Tl,this,r).call(S7,this,r,o).attr("d",c===ac&&o.projection?FK(o.projection,s,a):dm().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function FK(e,t,n){let r=En(e);return t=Ke(t),n=Ke(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 Pl(e,{x:t,y:n,...r}={}){return[t,n]=$e(t,n),new $l(e,{...r,x:t,y:n})}function uc(e,{x:t=G,y:n=Ee,...r}={}){return new $l(e,Gf({...r,x:t,y:n}))}function fc(e,{x:t=Ee,y:n=G,...r}={}){return new $l(e,Xf({...r,x:t,y:n}))}var RK={ariaLabel:"rect"},Ul=class extends St{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=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,RK),this.insetTop=Bt(c),this.insetRight=Bt(l),this.insetBottom=Bt(u),this.insetLeft=Bt(f),this.rx=fe(d,"auto"),this.ry=fe(h,"auto")}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:g,height:y}=i,{projection:x}=o,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v,rx:I,ry:N}=this,A=(s?.bandwidth?s.bandwidth():0)-v-w,D=(a?.bandwidth?a.bandwidth():0)-b-_;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{},0,0).call(T=>T.selectAll().data(t).enter().append("rect").call(Lt,this).attr("x",c&&(x||!lr(s))?u?O=>Math.min(c[O],u[O])+v:O=>c[O]+v:m+v).attr("y",l&&(x||!lr(a))?f?O=>Math.min(l[O],f[O])+b:O=>l[O]+b:d+b).attr("width",c&&(x||!lr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+A):A:g-h-m-w-v).attr("height",l&&(x||!lr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+D):D:y-d-p-b-_).call(ft,"rx",I).call(ft,"ry",N).call(Qt,this,r)).node()}};function ay(e,t){return new Ul(e,LT(CT(t)))}function ed(e,t={}){return _f(t)||(t={...t,y:Ee,x2:G,interval:1}),new Ul(e,Zf(CT(Wf(t))))}function nd(e,t={}){return _f(t)||(t={...t,x:Ee,y2:G,interval:1}),new Ul(e,Jf(LT(Hf(t))))}function t3(e,t){t=$K(t);let{x:n,y:r,color:i,size:o}=t,s=uv(e,n),a=uv(e,r),c=uv(e,i),l=uv(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:g,reduce:y,zero:x,...b},color:{value:w,color:_,reduce:v},size:{value:I,reduce:N},mark:A}=t;if(h===void 0&&(h=y==null&&d==null&&I==null&&g!=null?"count":null),y===void 0&&(y=h==null&&g==null&&I==null&&d!=null?"count":null),N===void 0&&I==null&&v==null&&h==null&&y==null&&(d==null||Ne(s))&&(g==null||Ne(a))&&(N="count"),p===void 0&&(p=fv(h)?!0:void 0),x===void 0&&(x=fv(y)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&d==null)throw new Error("reducing y requires x");A===void 0&&(A=I!=null||N!=null?"dot":fv(h)||fv(y)||v!=null?"bar":d!=null&&g!=null?Ne(s)||Ne(a)||h==null&&y==null&&!cy(s)&&!cy(a)?"dot":"line":d!=null||g!=null?"rule":null);let D,T,O;switch(A){case"dot":O=yi,T="stroke";break;case"line":O=s&&a||h!=null||y!=null?x||y!=null||s&&cy(s)?fc:p||h!=null||a&&cy(a)?uc:Pl:s?uc:fc,T="stroke",W$(c)&&(D=null);break;case"area":O=!(x||y!=null)&&(p||h!=null||a&&cy(a))?cc:aa,T="fill",W$(c)&&(D=null);break;case"rule":O=s?Yr:Xr,T="stroke";break;case"bar":O=h!=null?Ne(a)?G$(h)&&s&&Ne(s)?lc:jo:ed:y!=null?Ne(s)?G$(y)&&a&&Ne(a)?lc:qo:nd:v!=null||N!=null?s&&Ne(s)&&a&&Ne(a)?lc:s&&Ne(s)?qo:a&&Ne(a)?jo:ay:s&&Ks(s)&&!(a&&Ks(a))?jo:a&&Ks(a)&&!(s&&Ks(s))?qo:lc,T="fill";break;default:throw new Error(`invalid mark: ${A}`)}let C={fx:u,fy:f,x:s??void 0,y:a??void 0,[T]:c??_,z:D,r:l??void 0,tip:!0},S,M={[T]:v??void 0,r:N??void 0};if(h!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(M.y=y,S=Ne(s)?tc:Uo):h!=null?(M.x=h,S=Ne(a)?ec:zo):(v!=null||N!=null)&&(s&&a?S=Ne(s)&&Ne(a)?Fm:Ne(s)?zo:Ne(a)?Uo:sa:s?S=Ne(s)?tc:Uo:a&&(S=Ne(a)?ec:zo)),(S===sa||S===Uo)&&(C.x={value:s,...m}),(S===sa||S===zo)&&(C.y={value:a,...b}),p===void 0&&(p=s&&!(S===sa||S===Uo)&&(O===jo||O===cc||O===ed||O===Xr)),x===void 0&&(x=a&&!(S===sa||S===zo)&&(O===qo||O===aa||O===nd||O===Yr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:g??null,reduce:y??null,zero:!!x,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:I??null,reduce:N??null},mark:A,markImpl:H$[O],markOptions:C,transformImpl:H$[S],transformOptions:M,colorMode:T}}function Z$(e,t){let n=t3(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=KT[n.markImpl],f=KT[n.transformImpl],d=r!=null||i!=null?Yf({strokeOpacity:.1}):null,h=[o?Yr([0]):null,s?Xr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?en(d,h,p):en(d,p,h)}function cy(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(zt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function $K({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return qr(e)||(e=rd(e)),qr(t)||(t=rd(t)),qr(n)||(n=Qa(n)?{color:n}:rd(n)),qr(r)||(r=rd(r)),qr(i)&&({value:i}=rd(i)),qr(o)&&({value:o}=rd(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function uv(e,t){let n=bt(e,t.value);return n&&(n.label=On(t.value)),n}function rd(e){return PK(e)?{reduce:e}:{value:e}}function fv(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function G$(e){return/^(?:first|last|mode)$/i.test(e)}function PK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&pn(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 W$(e){return e?new Jn(e).size>e.length>>1:!1}var KT={dot:yi,line:Pl,lineX:uc,lineY:fc,areaX:cc,areaY:aa,ruleX:Yr,ruleY:Xr,barX:jo,barY:qo,rect:ay,rectX:ed,rectY:nd,cell:lc,bin:sa,binX:Uo,binY:zo,group:Fm,groupX:tc,groupY:ec},H$=Object.fromEntries(Object.entries(KT).map(([e,t])=>[t,e]));function id(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=G});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),vr(o,t)}function od(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=G});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),vr(o,t)}function vr(e={},t={}){let n=qn(t),r=Object.entries(e).map(([i,o])=>{let s=aw(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=mn(s);return{key:i,input:s,output:a,setOutput:c,map:UK(o)}});return{...yn(t,(i,o)=>{let s=bt(i,n),a=r.map(({input:l})=>bt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?cn(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 UK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&pn(e))return zK(e);if(typeof e=="function")return e3(Sf(e));switch(`${e}`.toLowerCase()){case"cumsum":return qK;case"rank":return e3((t,n)=>Kh(t,r=>n[r]));case"quantile":return e3((t,n)=>jK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function zK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function jK(e,t){let n=uo(e,t)-1;return Kh(e,t).map(r=>r/n)}function e3(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 qK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function J$(e={},t){return arguments.length===1&&(t=e),id(sd(e),t)}function Q$(e={},t){return arguments.length===1&&(t=e),od(sd(e),t)}function sd(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=YK(r),Vn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return XK(n)(t,VK(i,t),o)}function VK(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 YK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function XK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return dv(vf(e));switch(e.toLowerCase()){case"deviation":return dv(ii);case"max":return hv((t,n)=>Wt(t,r=>n[r]));case"mean":return GK;case"median":return dv(Pi);case"min":return hv((t,n)=>ue(t,r=>n[r]));case"mode":return hv((t,n)=>Nu(t,r=>n[r]));case"sum":return K$;case"variance":return dv(Ea);case"difference":return ZK;case"ratio":return JK;case"first":return QK;case"last":return KK}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return hv(Sf(e))}function dv(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(Js(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(Js(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Js(i,c,c+t),a)}}}function hv(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=ze(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=ze(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Js(i,c,c+t),o)),a-=ze(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Js(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Js(i,a,a+t),o)}}}function K$(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 GK(e,t,n){if(n){let r=K$(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 WK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(ze(o))return o}}function HK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(ze(o))return o}}function t9(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 e9(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 ZK(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]]=e9(i,r,s,e)-t9(i,r,s,e)}}}function JK(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]]=e9(i,r,s,e)/t9(i,r,s,e)}}}function QK(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]]=WK(i,r,s,e)}}}function KK(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]]=HK(i,r,s,e)}}}var ca={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function n9(e,{x:t=G,y:n,k:r=ca.k,color:i=ca.color,opacity:o=ca.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return en(re(s)?null:cc(e,vr({x1:dc({k:-r,...f}),x2:dc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),re(c)?null:uc(e,vr({x:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function r9(e,{x:t,y:n=G,k:r=ca.k,color:i=ca.color,opacity:o=ca.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return en(re(s)?null:aa(e,vr({y1:dc({k:-r,...f}),y2:dc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),re(c)?null:fc(e,vr({y:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function dc({n:e=ca.n,k:t=0,strict:n=ca.strict,anchor:r=ca.anchor}={}){return sd({k:e,reduce:i=>Ns(i)+t*(ii(i)||0),strict:n,anchor:r})}var ttt={ariaLabel:"tick",fill:null,stroke:"currentColor"},pv=class extends St{constructor(t,n,r){super(t,n,r,ttt),Xi(this,r)}render(t,n,r,i,o){return ut("svg:g",o).call(Ct,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Lt,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(Qt,this,r).call(oa,this,r,o)).node()}},ly=class extends pv{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=Bt(s),this.insetBottom=Bt(a)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},Ce,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}},uy=class extends pv{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=Bt(s),this.insetLeft=Bt(a)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,Ce)}_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 mv(e,{x:t=G,...n}={}){return new ly(e,{...n,x:t})}function yv(e,{y:t=G,...n}={}){return new uy(e,{...n,y:t})}function i9(e,{x:t=G,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?ec:km;return en(Xr(e,u({x1:n3,x2:r3},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),jo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),mv(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,vr({x:s9},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function o9(e,{y:t=G,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?tc:km;return en(Yr(e,u({y1:n3,y2:r3},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),qo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),yv(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,vr({y:s9},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function s9(e){let t=n3(e),n=r3(e);return e.map(r=>r<t||r>n?r:NaN)}function n3(e){let t=a9(e)*2.5-c9(e)*1.5;return ue(e,n=>n>=t?n:NaN)}function r3(e){let t=c9(e)*2.5-a9(e)*1.5;return Wt(e,n=>n<=t?n:NaN)}function a9(e){return Qn(e,.25)}function c9(e){return Qn(e,.75)}var ett={ariaLabel:"raster",stroke:null,pixelSize:1};function ad(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function l9(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var dy=class extends St{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=l9(o,"width")),s!=null&&(s=l9(s,"height")),l!=null&&(l=ad(l,"x1")),u!=null&&(u=ad(u,"y1")),f!=null&&(f=ad(f,"x2")),d!=null&&(d=ad(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=ltt(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=utt(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=ad(h,"pixelSize"),this.blur=ad(p,"blur"),this.interpolate=a==null||c==null?null:ntt(m)}},hy=class extends dy{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;se(o)[0]!==void 0&&(n=gv("fillOpacity",n)),Be(i)[0]!==void 0&&(n=gv("fill",n))}super(t,void 0,n,ett),this.imageRendering=fe(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]=f9(r,i,o),p=d-u,m=h-f,{pixelSize:g,width:y=Math.round(Math.abs(p)/g),height:x=Math.round(Math.abs(m)/g)}=this,b=y*x,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let M=y/p,E=x/m,F=Gt(a,k=>(k-u)*M,Float64Array),R=Gt(c,k=>(k-f)*E,Float64Array);w&&(w=this.interpolate(t,y,x,F,R,w)),_&&(_=this.interpolate(t,y,x,F,R,_))}else this.data==null&&t&&(v=t.fi*b);let I=l.createElement("canvas");I.width=y,I.height=x;let N=I.getContext("2d"),A=N.createImageData(y,x),D=A.data,{r:T,g:O,b:C}=on(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<b;++M){let E=M<<2;if(w){let F=s(w[M+v]);if(F==null){D[E+3]=0;continue}({r:T,g:O,b:C}=on(F))}_&&(S=_[M+v]*255),D[E+0]=T,D[E+1]=O,D[E+2]=C,D[E+3]=S}return this.blur>0&&kS(A,this.blur),N.putImageData(A,0,0),ut("svg:g",o).call(Ct,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(Lt,this).attr("xlink:href",I.toDataURL())).node()}};function i3(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&&zF(t)&&(r=Zs,i=Ha,o===void 0&&(o=FF)),[t,{...s,x:r,y:i,[e]:o}]}function u9(){let[e,t]=i3("fill",...arguments);return new hy(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function f9({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 o3({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),f9(Df(a,i),o,s)}function gv(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return Ie({...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]=o3(o,s,a,c),m=h-f,g=p-d,{pixelSize:y}=this,{width:x=Math.round(Math.abs(m)/y),height:b=Math.round(Math.abs(g)/y)}=t,w=new Array(x*b*(i?i.length:1)),_=m/x,v=g/b,I=0;for(let N of i??[void 0])for(let A=.5;A<b;++A)for(let D=.5;D<x;++D,++I)w[I]=n(l.invert(f+D*_),u.invert(d+A*v),N);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function ntt(e){if(typeof e=="function")return e;if(e==null)return xv;switch(`${e}`.toLowerCase()){case"none":return xv;case"nearest":return a3;case"barycentric":return s3();case"random-walk":return c3()}throw new Error(`invalid interpolate: ${e}`)}function xv(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 s3({random:e=Mo(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=Pn.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=ctt(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],g=c[h+2],y=a[2*p],x=a[2*m],b=a[2*g],w=a[2*p+1],_=a[2*m+1],v=a[2*g+1],I=Math.min(y,x,b),N=Math.max(y,x,b),A=Math.min(w,_,v),D=Math.max(w,_,v),T=(_-v)*(y-b)+(w-v)*(b-x);if(!T)continue;let O=s[t[p]],C=s[t[m]],S=s[t[g]];for(let M=Math.floor(I);M<N;++M)for(let E=Math.floor(A);E<D;++E){if(M<0||M>=n||E<0||E>=r)continue;let F=M+.5,R=E+.5,k=((_-v)*(F-b)+(R-v)*(b-x))/T;if(k<0)continue;let $=((v-w)*(F-b)+(R-v)*(y-b))/T;if($<0)continue;let P=1-k-$;if(P<0)continue;let U=M+n*E;u[U]=d(O,k,C,$,S,P,M,E),f[U]=1}}return rtt(u,f,i,o,s,n,r,l,t,d),u}}function rtt(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)=>ott(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](y,p)){let w=itt(n.at(b-1),r.at(b-1),n[b],r[b],y,p);e[g]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function itt(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 fy(e,t,n,r){return e*r-n*t}function ott(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,g=c-u,y=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(g,y);return(_,v)=>{let I=_-s,N=v-a,A=_-c,D=v-l;return fy(I,N,A,D)>-1e-6&&fy(I,N,d,h)*b-fy(I,N,p,m)*x>-1e-6&&fy(A,D,g,y)*x-fy(A,D,d,h)*w<=0}}function a3(e,t,n,r,i,o){let s=new o.constructor(t*n),a=Pn.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 c3({random:e=Mo(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Pn.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,x=p;h=d=u.find(y,x,d),g===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-y,a[r[h]]-x))>t&&w<n;){let _=e(g,p,w)*2*Math.PI;y+=Math.cos(_)*b,x+=Math.sin(_)*b,h=u.find(y,x,h),++w}l[m]=c[r[h]]}}return l}}function stt(e,t,n,r,i,o){return t*e+r*n+o*i}function att(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 ctt(e,t){return Ks(e)||Le(e)?stt:att(t)}function ltt(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 utt(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 d9={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},py=class extends dy{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=vw({},i,d9);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:On(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=gv("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},ftt(i),d9);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=!!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=En();return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",l=>a(s[l])).call(Qt,this,r)}).node()}};function ftt({thresholds:e,interval:t,...n}){return e=HT(e,t,Na),Ie(n,function(r,i,o,s,a,c){let[l,u,f,d]=o3(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:g=Math.round(Math.abs(h)/m),height:y=Math.round(Math.abs(p)/m)}=this,x=g/h,b=y/p,w=o.value.value,_=[];if(this.interpolate){let{x:D,y:T}=rc(o,s,c),O=Gt(D,E=>(E-l)*x,Float64Array),C=Gt(T,E=>(E-u)*b,Float64Array),S=[o.x,o.y,o.value],M=[O,C,w];for(let E of i){let F=this.filter(E,S,M);_.push(this.interpolate(F,g,y,O,C,w))}}else if(i){let D=g*y,T=i.length;for(let O=0;O<T;++O)_.push(w.slice(O*D,O*D+D))}else _.push(w);if(this.blur>0)for(let D of _)Wh({data:D,width:g,height:y},this.blur);let v=dtt(e,w,...htt(_));if(v===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:I}=Fa().size([g,y]).smooth(this.smooth),N=[],A=[];for(let D of _)A.push(Ue(N.length,N.push(...Gt(v,T=>I(D,T)))));for(let{coordinates:D}of N)for(let T of D)for(let O of T)for(let C of O)C[0]=C[0]/x+l,C[1]=C[1]/b+u;return{data:N,facets:A,channels:xw(this.contourChannels,N)}})}function dtt(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 qe(e);let i=Mn(...Tu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function p9(){return new py(...i3("value",...arguments))}function htt(e){return[ue(e,t=>ue(t,h9)),Wt(e,t=>Wt(t,h9))]}function h9(e){return isFinite(e)?e:NaN}function g9(e,t){return l3(Uf,e,t)}function x9(e,t={}){return l3(zf,e,t)}function b9(e,t={}){return l3(El,e,t)}function l3(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Yr(t,m9("x",{...s,inset:-6},n))),i!=null&&a.push(Xr(t,m9("y",{...s,inset:-6},n))),r!=null&&a.push(Po(t,y9("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Po(t,y9("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return en(...a)}function w9(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:ptt(e,u)}}function ptt(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 m9(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...w9(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function y9(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...w9(e,t,mtt(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function mtt(e,t){return Ie(t,(n,r,i)=>({channels:{text:{value:$m(i,e)?.value}}}))}var ytt={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},gtt={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},xtt={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},btt={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},wtt={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},u3=class extends St{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,ytt),this.curve=Km(s,a),Xi(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]=gn(this,i),p=c?x=>c[x]:hn(d),m=l?x=>l[x]:hn(h),g=this;function y(x){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],I=[],N=[],A=[];function D(S,M){S=x[S],M=x[M],w.push(++b),v[b]=p(S),N[b]=m(S),I[b]=p(M),A[b]=m(M);for(let E in r)_[E].push(r[E][M])}let{halfedges:T,hull:O,triangles:C}=Pn.from(x,p,m);for(let S=0;S<T.length;++S){let M=T[S];M>S&&D(C[S],C[M])}for(let S=0;S<O.length;++S)D(O[S],O[(S+1)%O.length]);Vt(this).selectAll().data(w).enter().append("path").call(Lt,g).attr("d",S=>{let M=er(),E=f(M);return E.lineStart(),E.point(v[S],N[S]),E.point(I[S],A[S]),E.lineEnd(),M}).call(Qt,g,_).call(oa,g,_,o)}return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(cn(t,b=>u[b]).values()).enter().append("g").each(y):x=>x.datum(t).each(y)).node()}},my=class extends St{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]=gn(this,i),h=c?y=>c[y]:hn(f),p=l?y=>l[y]:hn(d),m=this;function g(y){let x=Pn.from(y,h,p);Vt(this).append("path").datum(y[0]).call(Lt,m).attr("d",m._render(x,i)).call(Qt,m,r)}return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(cn(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},f3=class extends my{constructor(t,n={}){super(t,n,gtt),this.fill="none"}_render(t){return t.render()}},d3=class extends my{constructor(t,n={}){super(t,n,xtt,qn)}_render(t){return t.renderHull()}},h3=class extends St{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}},n,btt)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=gn(this,i),h=c?y=>c[y]:hn(f),p=l?y=>l[y]:hn(d),m=this;function g(y){let x=Pn.from(y,h,p),b=v9(x,i);Vt(this).selectAll().data(y).enter().append("path").call(Lt,m).attr("d",(w,_)=>b.renderCell(_)).call(Qt,m,r)}return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(cn(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},p3=class extends my{constructor(t,n){super(t,n,wtt),this.fill="none"}_render(t,n){return v9(t,n).render()}};function v9(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 yy(e,t,{x:n,y:r,...i}={}){return[n,r]=$e(n,r),new e(t,{...i,x:n,y:r})}function _9(e,t){return yy(u3,e,t)}function S9(e,t){return yy(f3,e,t)}function I9(e,t){return yy(d3,e,t)}function M9(e,t){return yy(h3,e,t)}function A9(e,t){return yy(p3,e,t)}var vtt={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},gy=class extends St{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=T9(s)&&(s="currentColor",!0),u=T9(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:qn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Stt({...c,fill:s,stroke:a},l,u),vtt),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=En();return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Lt,this).call(Qt,this,r).attr("d",l=>a(s[l]))).node()}};function E9(e,{x:t,y:n,...r}={}){return[t,n]=$e(t,n),new gy(e,{...r,x:t,y:n})}var _tt=new Set(["x","y","z","weight"]);function Stt(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"?Ke(o):+o,Ie(e,function(s,a,c,l,u,f){let d=c.weight?Ke(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,g]=gn(this,u),{width:y,height:x}=u,{x:b,y:w}=rc(c,l,f),_=Object.fromEntries(Object.entries(c).filter(([C])=>!_tt.has(C)).map(([C,S])=>[C,{...S,value:[]}])),v=t&&[],I=n&&[],N=SI().x(b?C=>b[C]:m).y(w?C=>w[C]:g).weight(d?C=>d[C]:1).size([y,x]).bandwidth(i),A=[];for(let C of a){let S=[];A.push(S);for(let M of h?Um(C,h,p):[C]){let E=N.contours(M);S.push([M,E])}}let D=o;if(!(D instanceof _l)){let C=0;for(let S of A)for(let[,M]of S){let E=M.max;E>C&&(C=E)}D=Float64Array.from({length:o-1},(S,M)=>C*100*(M+1)/o)}let T=[],O=[];for(let C of A){let S=[];T.push(S);for(let[M,E]of C)for(let F of D){S.push(O.length),O.push(E(F/100)),v&&v.push(F),I&&I.push(F);for(let R in _)_[R].value.push(c[R].value[M[0]])}}return v&&v.push(0),I&&I.push(0),{data:s,facets:T,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...I&&{stroke:{value:I,scale:"color"}},contours:{value:O}}}})}function T9(e){return/^density$/i.test(e)}function O9(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ee:void 0,y:s=r===void 0&&i===void 0?G:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:m=Be(h)[0],clip:g,tip:y,render:x,...b}={}){return[t,n]=N9(o,t,n),[r,i]=N9(s,r,i),t===n&&r===i&&(r=hc(0)),{tip:y}=Yi({tip:y},"x"),en(re(c)?null:Object.assign(ty(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:Pf(x,D9(!0)),clip:g,...b}),{ariaLabel:"positive difference"}),re(l)?null:Object.assign(ty(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:d,render:Pf(x,D9(!1)),clip:g,...b}),{ariaLabel:"negative difference"}),Pl(e,{x:n,y:i,z:m,stroke:h,strokeOpacity:p,tip:y,clip:!0,...b}))}function N9(e,t,n){return t===void 0&&n===void 0?t=n=hc(e):t===void 0?(n=hc(n),t=e===void 0?n:hc(e)):n===void 0?(t=hc(t),n=e===void 0?t:hc(e)):(t=hc(t),n=hc(n)),[t,n]}function hc(e){let t,{value:n,label:r=On(n)}=pi(e);return{transform:i=>t||(t=bt(i,n)),label:r}}function D9(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===Ew(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,m=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let y=ww(),x=ut("svg:clipPath",o).attr("id",y).node();x.appendChild(p.firstChild),m.childNodes[g].setAttribute("clip-path",`url(#${y})`),m.insertBefore(x,m.childNodes[g])}return h}}var Itt={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},xy=class extends St{constructor(t,n={}){let[r,i]=se(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:sr,optional:!0}},sy(n),Itt),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=En(o.projection??Mtt(n)),{r:l}=this;return Va(l)?t=[]:l!==void 0&&c.pointRadius(l),ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Qt,this,r)}).node()}};function Mtt({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,cl({point(n,r){this.stream.point(e(n),t(r))}})}function bv(e,{geometry:t=G,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new xy(e,{geometry:t,...n})}function B9({strokeWidth:e=1.5,...t}={}){return bv({type:"Sphere"},{strokeWidth:e,...t})}function L9({strokeOpacity:e=.1,...t}={}){return bv(YI(),{strokeOpacity:e,...t})}var cd=.5,ld=0;function C9(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Bt(t),e=oT(e,n),Ro(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Ro(e,"r")&&(n.r=t/2),Ie(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}=rc(s,a,l)),d=d?d.value:bt(i,r),h=h?.value,p=p?.value,m=m?.value;let g=Rm(e,{z:d,fill:h,stroke:p,symbol:m}),y=d&&[],x=h&&[],b=p&&[],w=m&&[],_=[],v=[],I=[],N=-1;for(let O of e)O.initialize(i);for(let O of o){let C=[];for(let S of e)S.scope("facet",O);for(let[S,M]of Ka(O,g))for(let{index:E,extent:F}of Att(i,M,u,f,t)){C.push(++N),v.push(F.x),I.push(F.y),d&&y.push(g===d?S:d[E[0]]),h&&x.push(g===h?S:h[E[0]]),p&&b.push(g===p?S:p[E[0]]),m&&w.push(g===m?S:m[E[0]]);for(let R of e)R.reduce(E,F)}_.push(C)}let A=s.x.scale,D=s.y.scale,T={x:{value:v,source:a[A]?{value:Gt(v,a[A].invert),scale:A}:null},y:{value:I,source:a[D]?{value:Gt(I,a[D].invert),scale:D}:null},...d&&{z:{value:y}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:C})=>[O,{scale:"auto",label:C.label,radius:O==="r"?t/2:void 0,value:C.transform()}]))};return{data:i,facets:_,channels:T}})}function Att(e,t,n,r,i){let o=i*(1.5/HA),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-ld)/o),f=Math.round(c=(c-cd)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,g=f+(c<f?-1:1)/2,y=u+(l<u?-1:1),x=c-g,b=l-y;m*m+d*d>x*x+b*b&&(f=g+(u&1?1:-1)/2,u=y)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+cd,y:u*o+ld}},s.set(h,p)),p.index.push(a)}return s.values()}var Ttt={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function k9(e){return new by(e)}var by=class extends St{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Wa,void 0,{clip:n,...r},Ttt),this.binWidth=Bt(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-cd,p=f-c-cd,m=a-ld,g=d-l-ld,y=s/2,x=y*ZA,b=x/2,w=y*2,_=x*1.5,v=Math.floor(h/w),I=Math.ceil(p/w),N=Math.floor((m+b)/_),A=Math.ceil((g-b)/_)+1,D=`m0,${pc(-x)}l${pc(y)},${pc(b)}v${pc(x)}l${pc(-y)},${pc(b)}`,T=D;for(let O=N;O<A;++O)for(let C=v;C<I;++C)T+=`M${pc(C*w+(O&1)*y)},${pc(O*_)}${D}`;return ut("svg:g",o).datum(0).call(Ct,this,i,o).call(Et,this,{},Ce+cd,Ce+ld).call(O=>O.append("path").call(Lt,this).call(Qt,this,r).attr("d",T)).node()}};function pc(e){return Math.round(e*1e3)/1e3}var Ett={ariaLabel:"image",fill:null,stroke:null};function Ntt(e){return/^\.*\//.test(e)}function Dtt(e){return/^(blob|data|file|http|https):/i.test(e)}function Ott(e){return typeof e=="string"&&(Ntt(e)||Dtt(e))?[void 0,e]:[e,void 0]}var wy=class extends St{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]=Ott(l),[g,y]=se(o),[x,b]=se(s,y!==void 0?y*2:void 0),[w,_]=se(a,y!==void 0?y*2:void 0),[v,I]=se(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:sr,optional:!0},width:{value:x,filter:sr,optional:!0},height:{value:w,filter:sr,optional:!0},rotate:{value:v,optional:!0},src:{value:p,optional:!0}},sy(n),Ett),this.src=m,this.width=b,this.rotate=I,this.height=_,this.r=y,this.preserveAspectRatio=fe(u,"xMidYMid"),this.crossOrigin=je(f),this.frameAnchor=Fo(d),this.imageRendering=fe(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:g,height:y,rotate:x}=this,[b,w]=gn(this,i);return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append("image").call(Lt,this).attr("x",F9(c,u,d,b,g,m)).attr("y",F9(l,f,d,w,y,m)).attr("width",u?v=>u[v]:g!==void 0?g:d?v=>d[v]*2:m*2).attr("height",f?v=>f[v]:y!==void 0?y:d?v=>d[v]*2:m*2).attr("transform",h?v=>`rotate(${h[v]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?oc`${c?v=>c[v]:b}px ${l?v=>l[v]:w}px`:null).call(ft,"href",p?v=>p[v]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?v=>`circle(${d[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Qt,this,r)).node()}};function F9(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 R9(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new wy(e,{...r,x:t,y:n})}function Btt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;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)),g=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*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-ud(t)-ud(n)+ud(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Ltt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),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 Ltt(e,t,n){var r=e===0||e===1?0:Math.exp(ud(t+n)-ud(t)-ud(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*$9(e,t,n)/t:1-r*$9(1-e,n,t)/n}function $9(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 ud(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 P9(e,t){var n=Btt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Ctt={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},wv=class extends St{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:qn(n),optional:!0}},n,Ctt),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 ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(u=>u.selectAll().data(c?Um(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Lt,this).call(Tl,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!ta(this.fill)?d=>d.select(ktt).attr("stroke","none").call(Lt,this).call(Tl,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function ktt(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(oi.svg,"path"),this)}var m3=class extends wv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=le(t,u=>r[u]),c=vv(t,r,n),l=j9(t,r,n,(1-i)/2,c);return ff().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=le(t,a=>r[a]),s=vv(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},y3=class extends wv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=le(t,u=>n[u]),c=vv(t,n,r),l=j9(t,n,r,(1-i)/2,c);return ff().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=le(t,a=>n[a]),s=vv(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function U9(e,{y:t=Ee,x:n=G,stroke:r,fill:i=re(r)?"currentColor":r,...o}={}){return new m3(e,Gf({...o,x:n,y:t,fill:i,stroke:r}))}function z9(e,{x:t=Ee,y:n=G,stroke:r,fill:i=re(r)?"currentColor":r,...o}={}){return new y3(e,Xf({...o,x:t,y:n,fill:i,stroke:r}))}function vv(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 j9(e,t,n,r,i){let o=An(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=P9(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 vy({path:e=G,delimiter:t,frameAnchor:n,treeLayout:r=ll,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=Mv(s),i=Y9(i),a!=null&&(a=x3(a)),n===void 0&&(n=s.frameAnchor);let l=X9(t),u=K9(c,x3),[f,d]=mn(),[h,p]=mn();return{x:f,y:h,frameAnchor:n,...yn(c,(m,g)=>{let y=l(bt(m,e)),x=d([]),b=p([]),w=-1,_=[],v=[],I=bb().path(A=>y[A]),N=r();N.nodeSize&&N.nodeSize([1,1]),N.separation&&o!==void 0&&N.separation(o??Om);for(let A of u)A[Sv]=A[J9]([]);for(let A of g){let D=[],T=I(A.filter(O=>y[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&T.sort(i),N(T);for(let O of T.descendants())if(!(a!=null&&!a(O))){D.push(++w),_[w]=O.data,s.position(O,w,x,b);for(let C of u)C[Sv][w]=C[Q9](O)}v.push(D)}return{data:_,facets:v}}),...Object.fromEntries(u)}}function Iv({path:e=G,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=ll,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=Mv(l),a=Y9(a),u!=null&&(u=V9(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=X9(t),h=K9(f,V9),[p,m]=mn(),[g,y]=mn(),[x,b]=mn(),[w,_]=mn();return{x1:p,x2:g,y1:x,y2:w,...yn(f,(v,I)=>{let N=d(bt(v,e)),A=m([]),D=y([]),T=b([]),O=_([]),C=-1,S=[],M=[],E=bb().path(R=>N[R]),F=s();F.nodeSize&&F.nodeSize([1,1]),F.separation&&c!==void 0&&F.separation(c??Om);for(let R of h)R[Sv]=R[J9]([]);for(let R of I){let k=[],$=E(R.filter(P=>N[P]!=null)).each(P=>P.data=v[P.data]);a!=null&&$.sort(a),F($);for(let{source:P,target:U}of $.links())if(!(u!=null&&!u(U,P))){k.push(++C),S[C]=U.data,l.position(P,C,A,T),l.position(U,C,D,O);for(let W of h)W[Sv][C]=W[Q9](U,P)}M.push(k)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function Mv(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Ftt;case"right":return Rtt}throw new Error(`invalid tree anchor: ${e}`)}var Ftt={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},Rtt={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function Y9(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?q9(x3(e)):q9($tt(e))}function q9(e){return(t,n)=>dn(e(t),e(n))}function $tt(e){return t=>t.data?.[e]}function X9(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=>Ptt(r,t))}var g3=92,G9=47;function Ptt(e,t){if(t===g3)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 g3: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 G9: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 Utt(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case g3:if(!t){t=!0;continue}case G9:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function W9(e){return pn(e)&&typeof e.node=="function"}function ztt(e){return pn(e)&&typeof e.link=="function"}function x3(e){if(W9(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return w3;case"node:path":return b3;case"node:internal":return H9;case"node:external":return Z9;case"node:depth":return v3;case"node:height":return _3}throw new Error(`invalid node value: ${e}`)}}function V9(e){if(W9(e))return e.node;if(ztt(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return _v(w3);case"parent:path":return _v(b3);case"parent:depth":return _v(v3);case"parent:height":return _v(_3);case"node:name":return w3;case"node:path":return b3;case"node:internal":return H9;case"node:external":return Z9;case"node:depth":return v3;case"node:height":return _3}throw new Error(`invalid link value: ${e}`)}}function b3(e){return e.id}function w3(e){return jtt(e.id)}function v3(e){return e.depth}function _3(e){return e.height}function H9(e){return!!e.children}function Z9(e){return!e.children}function _v(e){return(t,n)=>n==null?void 0:e(n)}function jtt(e){let t=e.length;for(;--t>0&&!qtt(e,t););return Utt(e.slice(t+1))}function qtt(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var J9=2,Q9=3,Sv=4;function K9(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...mn(i),o])}return n}function S3(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=re(f)&&re(d),text:p="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:x,textAnchor:b,treeLayout:w=ll,textLayout:_=w===ll||w===gb?"mirrored":"normal",tip:v,...I}={}){if(y===void 0&&(y=Mv(I.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=tn(_,"textLayout",["mirrored","normal"]);function N(A){return Po(e,vy({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:y,dy:x,title:g,...A,...I}))}return en(lv(e,Iv({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,...I})),h?yi(e,vy({treeLayout:w,fill:t===void 0?"node:internal":t,title:g,tip:v,...I})):null,p!=null?_==="mirrored"?[N({textAnchor:"start",treeFilter:"node:external"}),N({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:N():null)}function tP(e,t){return S3(e,{...t,treeLayout:gb})}function eP({geometry:e=G,...t}={}){return Ie({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=bt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=En(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function nP({geometry:e=G,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=bt(bt(r,e),PI),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var hP=mz(dP(),1);var Jtt=({marginLeft:e})=>[1,e],Qtt=({width:e,marginRight:t})=>[-1,e-t],Ktt=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],tet=({marginTop:e})=>[1,e],eet=({height:e,marginBottom:t})=>[-1,e-t],net=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function pP(e){return typeof e=="string"?{anchor:e}:e}function mP(e={},t={}){arguments.length===1&&([e,t]=gP(e));let{anchor:n="left",padding:r=1,r:i=t.r}=pP(e);switch(`${n}`.toLowerCase()){case"left":n=Jtt;break;case"right":n=Qtt;break;case"middle":n=Ktt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return xP("x","y",n,Bt(r),i,t)}function yP(e={},t={}){arguments.length===1&&([e,t]=gP(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=pP(e);switch(`${n}`.toLowerCase()){case"top":n=tet;break;case"bottom":n=eet;break;case"middle":n=net;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return xP("y","x",n,Bt(r),i,t)}function gP(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function xP(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Lm(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 Ie(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}=rc(c,l,f));let p=h?void 0:i!==void 0?Bt(i):this.r!==void 0?this.r:3;h&&(h=bt(h.value,l[h.scale]||G,Float64Array));let[m,g]=n(u),y=m?iet:ret,x=new Float64Array(d.length),b=h?w=>h[w]:()=>p;for(let w of a){let _=(0,hP.default)();w=w.filter(h?I=>yf(d[I])&&sr(h[I]):I=>yf(d[I]));let v=new Float64Array(2*w.length+2);for(let I of w){let N=b(I),A=m?N+r:0,D=d[I]-N,T=d[I]+N,O=2;_.queryInterval(D-r,T+r,([,,S])=>{let M=x[S]-A,E=d[I]-d[S],F=r+(h?h[I]+h[S]:2*p),R=Math.sqrt(F*F-E*E);v[O++]=M-R,v[O++]=M+R});let C=v.slice(0,O);m&&(C=C.filter(S=>S>=0));t:for(let S of C.sort(y)){for(let M=0;M<O;M+=2)if(v[M]+1e-6<S&&S<v[M+1]-1e-6)continue t;x[I]=S+A;break}_.insert([D,T,I])}}m||(m=1);for(let w of a)for(let _ of w)x[_]=x[_]*m+g;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 ret(e,t){return Math.abs(e)-Math.abs(t)}function iet(e,t){return e-t}function wP(e,t){return arguments.length===1&&({basis:e,...t}=e),id(Ev(e),t)}function vP(e,t){return arguments.length===1&&({basis:e,...t}=e),od(Ev(e),t)}function Ev(e){if(e===void 0)return bP;if(typeof e=="function")return Nv(Sf(e));if(/^p\d{2}$/i.test(e))return pd(vf(e));switch(`${e}`.toLowerCase()){case"deviation":return aet;case"first":return bP;case"last":return set;case"max":return cet;case"mean":return uet;case"median":return fet;case"min":return det;case"sum":return het;case"extent":return oet}throw new Error(`invalid basis: ${e}`)}function Nv(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 pd(e){return Nv((t,n)=>e(t,r=>n[r]))}var oet={mapIndex(e,t,n){let[r,i]=le(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},bP=Nv((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(ze(r))return r}}),set=Nv((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(ze(r))return r}}),aet={mapIndex(e,t,n){let r=Ns(e,o=>t[o]),i=ii(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},cet=pd(Wt),uet=pd(Ns),fet=pd(Pi),det=pd(ue),het=pd(An);function _P(e,t){return pet("x",e,t)}function pet(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]=sw(t.replace(/^[+-]/,"")),i*=l}t=Mf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=vr({[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]=le(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function SP(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return N3(t);case"last":return D3(t)}if(typeof e=="function")return mc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=met(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return mc(n,r,t)}function met(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return O3;case"max":return B3}throw new Error(`unknown selector: ${e}`)}function N3(e){return mc(null,yet,e)}function D3(e){return mc(null,get,e)}function IP(e){return mc("x",O3,e)}function MP(e){return mc("y",O3,e)}function AP(e){return mc("x",B3,e)}function TP(e){return mc("y",B3,e)}function*yet(e){yield e[0]}function*get(e){yield e[e.length-1]}function*O3(e,t){yield ex(e,n=>t[n])}function*B3(e,t){yield Xc(e,n=>t[n])}function mc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=qn(n);return yn(n,(i,o)=>{let s=bt(i,r),a=bt(i,e),c=[];for(let l of o){let u=[];for(let f of s?cn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var xet=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"],["round","round"],["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"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["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"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["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"],["fxNice","fx.nice"],["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"],["fyNice","fy.mice"],["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"],["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"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["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"],["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 bet(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 EP(e,t,n){for(let r in e){let i=xet.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&&bet(t,i.split("."),o)}}var wet=new Set(["frame","hexgrid","sphere","graticule"]);async function DP(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;EP(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())wet.has(c)?t.marks.push(Dv[c](u)):t.marks.push(Dv[c](l,u)),o.push(a.index);_et(t,e);let s=Qm(t);Iet(s,o),vet(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function vet(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===lo){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 _et(e,t){let{marks:n}=t;Ov("x",e,n,["x","x1","x2"]),Ov("y",e,n,["y","y1","y2"]),Ov("fx",e,n),Ov("fy",e,n)}function Ov(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=Met(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function Iet(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)NP(r,t);else NP(e,t)}function NP(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 Met(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var Aet={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Iy=class{constructor(t){this.attributes={...Aet},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=CS()}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&&t!=null&&(i=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 DP(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 Yh(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.requestQuery()))))}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 Bv(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Rr(e)!==null)}var Tet=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"]);function OP(e){return Tet.has(e)}var Eet=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function BP(e){return Eet.has(`${e}`.toLowerCase())}function My(e){return typeof e?.getChild=="function"}function LP(e){switch(e.typeId){case 2:case 3:case 7:return Float64Array;default:return Array}}function CP(e){let{typeId:t}=e;return t===10?n=>n==null?n:new Date(n):t===2&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}function Ay(e){let{type:t}=e,{typeId:n}=t;if(n===2&&t.bitWidth>=64){let r=e.length,i=new Float64Array(r);for(let o=0;o<r;++o){let s=e.get(o);i[o]=s==null?NaN:Number(s)}return i}return e.toArray()}function Lv(e){return My(e)?Net(e):e}function Net(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=CP(h);for(let m=i,g=0;g<c;++g,++m)r[m][d]=p(f.get(g))}i+=c}return r}var kP=e=>e==="stroke"||e==="fill",Det=e=>e==="symbol",Oet=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),L3=(e,t)=>({channel:e,field:t,as:t instanceof xr?t.column:e}),C3=(e,t)=>({channel:e,value:t}),Cv=e=>Array.isArray(e),Bn=class extends ur{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Cv(this.source)&&(this.data=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[Xh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")OP(l)||kP(l)&&Bv(u)||Det(l)&&BP(u)?o.push(C3(l,u)):o.push(L3(l,Ia(u)));else if(ws(u))if(Array.isArray(u.columns))o.push(L3(l,u)),a.add(u);else{let d=C3(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&Oet(l,u)?o.push(L3(l,u)):u!==void 0&&o.push(C3(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||Cv(this.source)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return 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){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return k3(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Lv(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=gi(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function gi(e){return Object.hasOwn(e,"value")?e.value:kP(e.channel)?{value:e.as,scale:"color"}:e.as}function k3(e,t,n=[]){let r=vt.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 jl(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{field:o}=e.channelField(t,`${t}1`,`${t}2`),{type:s}=e.stats[o.column];r=s==="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 jh(i)}function Gr(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=jl(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),g=m!==1?` * ${m}::DOUBLE`:"";return[u?q`(${d} - ${h}::DOUBLE)${g}`:q`(${h}::DOUBLE - ${f})${g}`,p]}var F3={x:["min","max"]},R3={y:["min","max"]},kv={...F3,...R3};function FP(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[Sn])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=$3(t,u)||(c?Ps().domain([f,d]).nice().domain():[f,d]);return a!==lo&&(h[Sn]=!0),o.setAttribute(r,h,{silent:!0}),h}}function Vo(e,t){return FP(e,t,"x","xDomain","xNice")}function Yo(e,t){return FP(e,t,"y","yDomain","yNice")}function $3(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===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 Ty=class extends Bn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(!r)return a;let c=r==="x"?"y":"x",l=this.channelField(c)?.as,{field:u,as:f}=this.channelField(r),{type:d}=o[u.column];if(s&&(d==="date"||d==="number")&&l){let{column:p}=u,{max:m,min:g}=o[p],y=r==="x"?n.innerWidth():n.innerHeight(),[x,b]=$3(t,p)||[g,m],[w]=Gr(this,r,y,[x,b],1,f),_=a.select().map(v=>v.as).filter(v=>v!==f&&v!==l);return Bet(a,w,f,l,_)}else return a.orderby(u)}};function Bet(e,t,n,r,i=[]){let o=q`FLOOR(${t})::INTEGER`,s=a=>vt.from(e).select(a).groupby(o,i);return vt.union(s([{[n]:ei(n),[r]:wu(r,n)},...i]),s([{[n]:ti(n),[r]:vu(r,n)},...i]),s([{[n]:wu(n,r),[r]:ei(r)},...i]),s([{[n]:vu(n,r),[r]:ti(r)},...i])).orderby(i,n)}function RP(e,t="density"){return My(e)?LP(e.getChild(t).type):typeof e[0][t]=="number"?Float64Array:Array}function $P(e,t){let n=RP(t);return Let(new n(e),t)}function Let(e,t,n="density"){if(My(t)){let r=t.numRows;if(r===0)return e;let i=Ay(t.getChild("index")),o=Ay(t.getChild(n));for(let s=0;s<r;++s)e[i[s]]=o[s]}else for(let r of t)e[r.index]=r[n];return e}function PP(e,t,n,r,i=[],o){let s=e*t,a=r.map(y=>RP(n,y)),c=r.length,l=y=>{let x={};return i.forEach((b,w)=>x[b]=y[w]),r.forEach((b,w)=>x[b]=new a[w](s)),x},u={},f=i.length?null:u[[]]=l([]),d=i.length?y=>u[y]??(u[y]=l(y)):()=>f,h=n.numRows;if(h===0)return Object.values(u);let p=Ay(n.getChild("index")),m=r.map(y=>Ay(n.getChild(y))),g=i.map(y=>n.getChild(y));if(o){let y=p.map(b=>b%e),x=p.map(b=>Math.floor(b/e));if(i.length)for(let b=0;b<h;++b){let w=g.map(v=>v.get(b)),_=d(w);_.index||(_.index=[]),_.index.push(b)}else f.index=p.map((b,w)=>w);Object.values(u).forEach(b=>{for(let w=0;w<c;++w)o(b.index,e,t,y,x,m[w],b[r[w]]);delete b.index})}else for(let y=0;y<h;++y){let x=g.map(w=>w.get(y)),b=d(x);for(let w=0;w<c;++w)b[r[w]][p[y]]=m[w][y]}return Object.values(u)}function Ey(e,t){let n=0,r=0;return e.forEach(i=>{let o=i[t],s=o.length;for(let a=0;a<s;++a){let c=o[a];c<n&&(n=c),c>r&&(r=c)}}),n===0&&r===0?[0,1]:[n,r]}function UP(e,t){let n=new Jn;return e.forEach(r=>{let i=r[t],o=i.length;for(let s=0;s<o;++s)n.add(i[s])}),Array.from(n).sort(zt)}function Ln(e,t,n,r){br(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function Ny(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Cet(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 Cet(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 zP(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);Fv(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);Fv(t,u,i,r,o,s,a,u)}return c}function Fv(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=ket){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 ket(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,g;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,g=1;g<=a&&g<=m;++g)l[m]-=s[g]*l[m-g];for(g=0;g<a;++g)for(e[g]=0,m=1;m<=g;++m)p=h+r*m,p>=0&&p<d&&(e[g]+=l[g-m]*t[p]);let y=t[h],x=Math.ceil(u*10);for(m=0;m<x;++m){for(g=0;g<a;++g)e[g]+=l[g]*y;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,g=1;g<=a;++g)l[a]-=s[g]*l[a-g];for(g=0;g<a;++g)l[g]=l[g+1]}}function jP({random:e=Mo(42)}={}){return(t,n,r,i,o,s,a)=>{let{points:c,triangles:l,hull:u}=Pn.from(t,h=>i[h],h=>o[h]),f=new Uint8Array(n*r),d=zet(s,e);for(let h=0;h<l.length;h+=3){let p=l[h],m=l[h+1],g=l[h+2],y=c[2*p],x=c[2*m],b=c[2*g],w=c[2*p+1],_=c[2*m+1],v=c[2*g+1],I=Math.min(y,x,b),N=Math.max(y,x,b),A=Math.min(w,_,v),D=Math.max(w,_,v),T=(_-v)*(y-b)+(w-v)*(b-x);if(!T)continue;let O=s[t[p]],C=s[t[m]],S=s[t[g]];for(let M=Math.floor(I);M<N;++M)for(let E=Math.floor(A);E<D;++E){if(M<0||M>=n||E<0||E>=r)continue;let F=M+.5,R=E+.5,k=((_-v)*(F-b)+(R-v)*(b-x))/T;if(k<0)continue;let $=((v-w)*(F-b)+(R-v)*(y-b))/T;if($<0)continue;let P=1-k-$;if(P<0)continue;let U=M+n*E;a[U]=d(O,k,C,$,S,P,M,E),f[U]=1}}return Fet(a,f,i,o,s,n,r,u,t,d),a}}function Fet(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)=>$et(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](y,p)){let w=Ret(n.at(b-1),r.at(b-1),n[b],r[b],y,p);e[g]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function Ret(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 Dy(e,t,n,r){return e*r-n*t}function $et(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,g=c-u,y=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(g,y);return(_,v)=>{let I=_-s,N=v-a,A=_-c,D=v-l;return Dy(I,N,A,D)>-1e-6&&Dy(I,N,d,h)*b-Dy(I,N,p,m)*x>-1e-6&&Dy(A,D,g,y)*x-Dy(A,D,d,h)*w<=0}}function qP(e,t,n,r,i,o,s){let a=Pn.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 VP({random:e=Mo(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c,l)=>{let u=Pn.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,x=p;h=d=u.find(y,x,d),g===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-y,a[r[h]]-x))>t&&w<n;){let _=e(g,p,w)*2*Math.PI;y+=Math.cos(_)*b,x+=Math.sin(_)*b,h=u.find(y,x,h),++w}l[m]=c[r[h]]}}return l}}function Pet(e,t,n,r,i,o){return t*e+r*n+o*i}function Uet(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 zet(e,t){return jet(e)||qet(e)?Pet:Uet(t)}function jet(e){for(let t of e)if(t!=null)return typeof t=="number"}function qet(e){for(let t of e)if(t!=null)return t instanceof Date}var la="density",Gi=class extends Bn{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=Vet(u);super(t,n,u,kv),this.densityMap=f,Ln(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),Ln(this,"pixelSize",s),Ln(this,"interpolate",o),Ln(this,"pad",a),Ln(this,"width",c),Ln(this,"height",l)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=Vo(this,t),[l,u]=this.extentY=Yo(this,t),[f,d]=this.bins=this.binDimensions(this),[h,p]=Gr(this,"x",f,[a,c],r),[m,g]=Gr(this,"y",d,[l,u],r),y=r?[Ae(p,[+a,+c]),Ae(g,[+l,+u])]:[Is(+a,p),Ss(p,+c),Is(+l,g),Ss(g,+u)],x=vt.from(s.table).where(t.concat(y)),b=this.groupby=[],w={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:I,channel:N,field:A}=v;A.aggregate?(w[N]=A,o[N]=!0):N==="weight"?w[la]=Fr(A):N!=="x"&&N!=="y"&&(x.select({[I]:A}),b.push(I))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(la),w.density=kr()),n==="linear"){if(_.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 Get(x,h,m,w[la],f,b)}else return Xet(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=Yet(this.interpolate);return this.grids=PP(n,r,t,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids:i,plot:o}=this;if(this.kde=this.grids,n>0){let s=t.length===1?t[0]:t.includes(la)?la:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.innerWidth(),c=o.innerHeight(),[l,u]=r,f=i.some(p=>p[s].some(m=>m<0)),d=Ny(n*(l-1)/a,f),h=Ny(n*(u-1)/c,f);this.kde=this.grids.map(p=>{let m=zP(d,h,p[s],r);return{...p,[s]:m}})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function Vet(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function Yet(e="none"){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":case"linear":return;case"nearest":return qP;case"barycentric":return jP();case"random-walk":return VP()}throw new Error(`invalid interpolate: ${e}`)}function Xet(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Get(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 vt.from(vt.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(zc("density",0))}var Oy=class extends Gi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),Ln(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,plot:o}=this,s=i;if(!Array.isArray(s)){let[,w]=Ey(r,"density");s=Array.from({length:s-1},(_,v)=>w*(v+1)/s)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[a,c]=t,[l,u]=o.getAttribute("xDomain"),[f,d]=o.getAttribute("yDomain"),h=(u-l)/a,p=(d-f)/c,m=+l,g=+f,y=w=>m+w*h,x=w=>g+w*p,b=Fa().size(t);return this.data=r.flatMap(w=>s.map(_=>Object.assign(Wet(b.contour(w.density,_),y,x),{...w,density:_}))),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=gi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function Wet(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 Rv(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 YP(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 XP(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 GP(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?on(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 WP(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"?on(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 HP(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"?on(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 yc=class extends Gi{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=Qet(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=P3(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}},By=class extends yc{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function P3(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(la),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":Bv(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"?la:null),d=c?.as??(u==="grid"?la:null),h=l!=="grid"&&l!=="group"?GP(l):Zet(e,f),p=u!=="grid"?YP(u):Het(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Het(e,t){let{plot:n,kde:r}=e,i=n.getAttribute("opacityDomain"),o=i===lo,s=i?.[Sn],a=!o&&!s&&i||Ey(r,t);(o||s)&&(s&&(a[Sn]=!0),n.setAttribute("colorDomain",a));let c=$f({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 XP(c)}function Zet(e,t){let{plot:n,kde:r}=e,i=!r[0][t]?.map,o=i||Array.isArray(r[0][t]),s=n.getAttribute("colorDomain"),a=s===lo,c=s?.[Sn],l=!a&&!c&&s||(i?r.map(f=>f[t]).sort(zt):o?UP(r,t):Ey(r,t));(a||c)&&(c&&(l[Sn]=!0),n.setAttribute("colorDomain",l));let u=$f({color:{type:n.getAttribute("colorScale"),domain:l,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(o)return WP(u);{let f=$f({x:{type:Jet(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return HP(1024,u,f.apply)}}function Jet(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Qet(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Rv(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 Ly=class extends yc{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),Ln(this,"normalize",r)}query(t=[]){let{channels:n,normalize:r,source:i,binPad:o}=this,[s,a]=this.bins=this.binDimensions(this),[c]=Gr(this,"x",s,Vo(this,t),o),[l]=Gr(this,"y",a,Yo(this,t),o),u=vt.from(i.table).where(Ket(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 tnt(u,c,l,d,s,a,f,r)}};function Ket(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?Wn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function tnt(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=vt.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(Wn(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=vt.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=vt.select({i:q`UNNEST(range((${f})))::INTEGER`}),h=vt.unionAll(vt.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)`),vt.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)`),vt.select(c,{x:"x0",y:"y0"}).from("pairs").where(Uc("dx"))),p=["x"].concat(c).join(", "),m=vt.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Wn(Ae("x",[0,i],!0),Ae("y",[0,o],!0)));return vt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,density:a?Fr("w"):kr()}).groupby("index",s)}var md=class extends Bn{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"?F3:R3),this.dim=a,Ln(this,"bins",i),Ln(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[Sn]}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"?Vo:Yo)(this,t),[a,c]=Gr(this,i,n,s),l=k3(r,o,[i]).where(t.concat(Ae(c,s))),u=this.channelField("weight")?"weight":null;return ent(l,a,u)}queryResult(t){return this.grid=$P(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(x=>x<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=Ny(n*(t-1)/l,c),f=Fv(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,m=+s,g=(a-m)/(t-1),y=1/g;for(let x=0;x<t;++x)d.push({[p]:m+x*g,[h]:f[x]*y});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function ent(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 vt.from(vt.unionAll(i,o)).select({index:"i",density:Fr("w")}).groupby("index").having(Fh("density",0))}var Cy=class extends Gi{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=jl(this,"x"),c=jl(this,"y"),[l,u]=r.map(g=>a.apply(g)),[f,d]=i.map(g=>c.apply(g)),h=(u-l)/(o-n),p=(d-f)/(s-n),m=n?0:.5;return this.data=nnt(this.kde,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function nnt(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=[];for(let h of e){let p=h.density;for(let m=0,g=0;g<f;++g)for(let y=0;y<u;++y,++m)d.push({...h,x:s(n+(y+c)*i),y:a(r+(g+c)*o),density:p[m]*l})}return d}var rnt="geom",ky=class extends Bn{constructor(t,n={},r){!Cv(t)&&!n?.geometry&&(n.geometry=Uh(rnt)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var Fy=class extends Bn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},kv),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Vo(this,t),[c,l]=Yo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,g,y,x=new Set,b={};for(let N of i)N.channel==="orderby"?w.orderby(N.value):N.channel==="x"?g=N:N.channel==="y"?y=N:Object.hasOwn(N,"field")&&(b[N.as]=N.field,N.field.aggregate&&N.field.columns.forEach(A=>x.add(A)));let w=vt.select({[g.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[y.as]:q`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${m}`,...b}).groupby("x","y"),_=`${p} * (${g.field} - ${s}::DOUBLE)`,v=`${m} * (${l}::DOUBLE - ${y.field})`,I=vt.select({py:q`(${v} - ${f}) / ${h}`,pj:q`ROUND(py)::INTEGER`,px:q`(${_} - ${u}) / ${d} - 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`}).select(Array.from(x)).from(o.table).where(vs(g.field),vs(y.field),t);return w.from(I)}};var Ry=class extends Gi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{binType:n,binPad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=Gr(this,"x",f,[a,c],r),[m,g]=Gr(this,"y",d,[l,u],r),y=r?[Ae(p,[+a,+c]),Ae(g,[+l,+u])]:[Is(+a,p),Ss(p,+c),Is(+l,g),Ss(g,+u)],x=vt.from(s.table).where(y),b=this.groupby=[],w={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:I,channel:N,field:A}=v;A.aggregate?(w[N]=A,o[N]=!0):N==="weight"?w.density=Fr(A):N!=="x"&&N!=="y"&&(x.select({[I]:A}),b.push(I))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),w.density=kr()),n==="linear"){if(_.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 cnt(x,h,m,w.density,f,b)}else return ant(x,h,m,w,f,b)}async requestTiles(){let t=ni();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=Vo(this,this._filter),[f,d]=Yo(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),y=(D,T)=>[[o+D*h,o+(D+1)*h],[s+T*p,s+(T+1)*p]],x=Math.floor((l-o)/h),b=r?ZP((u-o)/h):x,w=Math.floor((f-s)/p),_=i?ZP((d-s)/p):w,v=[];for(let D=x;D<=b;++D)for(let T=w;T<=_;++T)v.push([D,T]);let I=v.map(([D,T])=>t.query(this.tileQuery(y(D,T)))),N=[];if(r)for(let D=w;D<=_;++D)N.push([b+1,D]),N.push([x-1,D]);if(i){let D=r?x-1:x,T=r?b+1:b;for(let O=D;O<=T;++O)N.push([O,_+1]),N.push([O,w-1])}this.prefetch=N.map(([D,T])=>t.prefetch(this.tileQuery(y(D,T))));let A=await Promise.all(I);this.grids=[{density:int(a,c,m,g,v,A)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=snt(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=P3(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function int(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;ont(e,t,s,a,f,d)}),s}function ont(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 snt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Rv(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 ant(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function cnt(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 vt.from(vt.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(zc("density",0))}function ZP(e){let t=Math.floor(e);return t===e?t-1:t}function lnt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;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)),g=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*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-yd(t)-yd(n)+yd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=unt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),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 unt(e,t,n){var r=e===0||e===1?0:Math.exp(yd(t+n)-yd(t)-yd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*JP(e,t,n)/t:1-r*JP(1-e,n,t)/n}function JP(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 yd(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 QP(e,t){var n=lnt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var $y=class extends Bn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;Ln(this,"ci",r,s),Ln(this,"precision",i,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 vt.from(super.query(t)).select({intercept:lS(r,n),slope:uS(r,n),n:fS(r,n),ssy:dS(r,n),ssx:hS(r,n),xm:pS(r,n),x0:_u(ei(n).where(vs(r))),x1:_u(ti(n).where(vs(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Lv(t),this.lineData=this.modelFit.flatMap(n=>fnt(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>dnt(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function fnt(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function dnt(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=QP((1-e)/2,l-2)*Math.sqrt(f/(l-2));return Ue(i,o-h/2,h).concat(o).map(m=>{let g=a+m*c,y=p*Math.sqrt(1/l+(m-s)**2/u);return{x:m,y1:g-y,y2:g+y,...d}})}function KP(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 gd(e){let t={};for(let n in e)t[KP(n)]=e[n];return t}function hnt(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 Py=class{constructor(t,{selection:n,channels:r={}}){this.mark=hnt(t),this.selection=n;let i=Object.entries(gd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",Ld(()=>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 pnt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function pnt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Wn(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await e.coordinator.query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}function U3(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 tU(){return U3(xI())}function eU(){return U3(yI())}function nU(){return U3(gI())}function Uy(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 Xo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function zy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function $v(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var xd=class{constructor(t,{channel:n,selection:r,field:i,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||Xo(t,[n,n+"1",n+"2"]),this.style=a&&gd(a),this.brush=n==="y"?nU():eU(),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=>zy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),Uy(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{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Ae(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ue(o),ue(s)],[Wt(o),Wt(s)]]);let a=Vt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:Vt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each($v).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var Pv=(e,t)=>e-t,jy=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||Xo(t,["x","x1","x2"]),this.yfield=i||Xo(t,["y","y1","y2"]),this.style=a&&gd(a),this.brush=tU(),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=>zy(u,i,r)).sort(Pv),a=[c[1],l[1]].map(u=>zy(u,o,r)).sort(Pv)}(!Uy(s,n?.[0])||!Uy(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{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Wn(Ae(i,t[0]),Ae(o,t[1])):null}}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)],[Wt(s),Wt(a)]]);let c=Vt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Vt(t);if(this.g=l.append("g").attr("class","interval-xy").each($v).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(Pv),[d,h]=this.value[1].map(o.apply).sort(Pv);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var bd=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Xo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?_s(r,Cr(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=Vt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Vt(t),u=t.scale(i),f=!ri(o);l.on("pointerdown pointermove",function(d){let[h,p]=kn(d,this),m=mnt(s,a,u.invert(i==="x"?h:p));o.update(f?m:n.clause(m))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function mnt(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var rU=(e,t)=>e-t,qy=class{constructor(t,{x:n=new Ms,y:r=new Ms,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||Xo(t,["x","x1","x2"]),this.yfield=o||Xo(t,["y","y1","y2"]),this.zoom=z3(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=ynt(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=gnt(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Ae(n,t):null}}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(rU),c=this.yscale.range.slice().sort(rU),l=z3(n,[-1/0,1/0],a),u=z3(r,[-1/0,1/0],c),f=CA().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(Vt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function z3(e,t,n){return e?Array.isArray(e)?e:t:n}function ynt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function gnt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var ql=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Rh(n[l].field,Cr(c)));return a.length>1?Wn(a):a[0]});i=o.length>1?Pc(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=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(xnt(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>j3(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!j3(u[0],h)?d=null:d=[h]}this.value=d,bnt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function xnt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function bnt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>j3(n,t[r]))}function j3(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 wd=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=wnt(t,n);this.selection&&i&&(this.handler=new ql(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function wnt({marks: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)if(e[r].channelField(n))return e[r];return null}var vnt=new Set(["rectY-x","rectX-y","rect-x","rect-y"]);function Uv(e,t={steps:25}){let n=(r,i)=>vnt.has(`${r.type}-${i}`)?{[`${i}1`]:q3(r,i,e,t),[`${i}2`]:q3(r,i,e,{...t,offset:1})}:{[i]:q3(r,i,e,t)};return n[Xh]=!0,n}function q3(e,t,n,r){return{column:n,label:n,get stats(){return["min","max"]},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=jl(e,t),{min:a,max:c}=e.stats[n],l=_nt(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,d=`${(l.max-l.min)/l.steps}::DOUBLE`,h=r.offset?`${r.offset} + `:"",p=`${l.min} + ${d} * (${h}FLOOR(${f} / ${d}))`;return`${s(p)}`}}}function _nt(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let m=0,g=f.length;m<g;++m)d=u/f[m],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var Snt=e=>e&&typeof e=="object"&&!Array.isArray(e);var Vy=class extends ur{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>Snt(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ri(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}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,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?_s(r,Cr(t)):null}):br(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?vt.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}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var Int={contains:B2,prefix:L2,suffix:C2,regexp:O2},Mnt=0;var Yy=class extends ur{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++Mnt,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}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)}),ri(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ri(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?Int[i](r,Cr(t)):null}):br(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?vt.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 Ant=0;var Xy=class extends ur{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++Ant,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ri(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:vt.select({min:ei(r),max:ti(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:_s(r,Cr(t))}):br(this.selection)&&n.update(t)}};var Y3=G3(e=>{let t=zv(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?X3(n):`${n}`}),zv=G3(e=>t=>t===0?"0":t.toLocaleString(e)),Pqt=Y3(),Uqt=zv();function X3(e){return gf(e,"Invalid Date")}function G3(e){let t=G3,n;return(r="en")=>r===t?n:n=e(t=r)}var Tnt=-1;var Gy=class extends ur{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++Tnt}`,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.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.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 f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:m,scrollTop:g,clientHeight:y}=d.target,x=g<f;f=g,!(x||h||p)&&m-g<2*y&&(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.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ni().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Ia(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=Ent(this.format,t),this.style.innerText=Ont(this.id,Nnt(this.align,t),Dnt(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return vt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?A2(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<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 Ent(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return zv(n);case"date":return X3;default:return Y3(n)}})}function Nnt(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Dnt(e={},t){return t.map(({column:n})=>e[n])}function Ont(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 Wy(e,...t){let n=e?.context?.coordinator??ni();for(let r of t)n.connect(r)}function jv(e,t,n){let r=new t(n);return Wy(e,r),r.element}function iU(e){return jv(this,Vy,e)}function oU(e){return jv(this,Yy,e)}function sU(e){return jv(this,Xy,e)}function aU(e){return jv(this,Gy,e)}function cU({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)),r.value={element:r},r}function lU(...e){return cU({direction:"vertical"},e.flat())}function uU(...e){return cU({direction:"horizontal"},e.flat())}function fU({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function dU(e){return fU({dim:"height",size:e})}function hU(e){return fU({dim:"width",size:e})}var qv={};Ir(qv,{align:()=>c6,aspectRatio:()=>l6,axis:()=>u6,colorBase:()=>HE,colorClamp:()=>$E,colorConstant:()=>JE,colorDomain:()=>FE,colorExponent:()=>ZE,colorInterpolate:()=>jE,colorLabel:()=>YE,colorN:()=>PE,colorNice:()=>UE,colorPivot:()=>qE,colorRange:()=>RE,colorReverse:()=>XE,colorScale:()=>kE,colorScheme:()=>zE,colorSymmetric:()=>VE,colorTickFormat:()=>WE,colorZero:()=>GE,facetGrid:()=>L4,facetLabel:()=>C4,facetMargin:()=>E4,facetMarginBottom:()=>D4,facetMarginLeft:()=>O4,facetMarginRight:()=>B4,facetMarginTop:()=>N4,fxAlign:()=>j4,fxAriaDescription:()=>sE,fxAriaLabel:()=>oE,fxAxis:()=>X4,fxDomain:()=>k4,fxFontVariant:()=>iE,fxGrid:()=>K4,fxInset:()=>$4,fxInsetLeft:()=>P4,fxInsetRight:()=>U4,fxLabel:()=>eE,fxLabelAnchor:()=>nE,fxLabelOffset:()=>rE,fxLine:()=>tE,fxNice:()=>R4,fxPadding:()=>q4,fxPaddingInner:()=>V4,fxPaddingOuter:()=>Y4,fxRange:()=>F4,fxReverse:()=>aE,fxRound:()=>z4,fxTickFormat:()=>J4,fxTickPadding:()=>Z4,fxTickRotate:()=>Q4,fxTickSize:()=>W4,fxTickSpacing:()=>H4,fxTicks:()=>G4,fyAlign:()=>mE,fyAriaDescription:()=>LE,fyAriaLabel:()=>BE,fyAxis:()=>bE,fyDomain:()=>cE,fyFontVariant:()=>OE,fyGrid:()=>AE,fyInset:()=>fE,fyInsetBottom:()=>hE,fyInsetTop:()=>dE,fyLabel:()=>EE,fyLabelAnchor:()=>NE,fyLabelOffset:()=>DE,fyLine:()=>TE,fyNice:()=>uE,fyPadding:()=>yE,fyPaddingInner:()=>gE,fyPaddingOuter:()=>xE,fyRange:()=>lE,fyReverse:()=>CE,fyRound:()=>pE,fyTickFormat:()=>IE,fyTickPadding:()=>SE,fyTickRotate:()=>ME,fyTickSize:()=>vE,fyTickSpacing:()=>_E,fyTicks:()=>wE,grid:()=>d6,height:()=>r6,inset:()=>f6,label:()=>h6,lengthBase:()=>M8,lengthClamp:()=>_8,lengthConstant:()=>T8,lengthDomain:()=>w8,lengthExponent:()=>A8,lengthNice:()=>S8,lengthRange:()=>v8,lengthScale:()=>b8,lengthZero:()=>I8,margin:()=>K3,marginBottom:()=>a6,marginLeft:()=>i6,marginRight:()=>o6,marginTop:()=>s6,margins:()=>Q3,name:()=>Z3,opacityBase:()=>a8,opacityClamp:()=>e8,opacityConstant:()=>l8,opacityDomain:()=>KE,opacityExponent:()=>c8,opacityLabel:()=>r8,opacityNice:()=>n8,opacityRange:()=>t8,opacityReverse:()=>i8,opacityScale:()=>QE,opacityTickFormat:()=>s8,opacityZero:()=>o8,padding:()=>p6,projectionClip:()=>$8,projectionDomain:()=>B8,projectionInset:()=>L8,projectionInsetBottom:()=>R8,projectionInsetLeft:()=>C8,projectionInsetRight:()=>k8,projectionInsetTop:()=>F8,projectionParallels:()=>N8,projectionPrecision:()=>D8,projectionRotate:()=>O8,projectionType:()=>E8,rBase:()=>y8,rClamp:()=>h8,rConstant:()=>x8,rDomain:()=>f8,rExponent:()=>g8,rNice:()=>p8,rRange:()=>d8,rScale:()=>u8,rZero:()=>m8,round:()=>m6,style:()=>e6,width:()=>n6,xAlign:()=>M6,xAriaDescription:()=>q6,xAriaLabel:()=>j6,xAxis:()=>N6,xBase:()=>X6,xClamp:()=>S6,xConstant:()=>W6,xDomain:()=>g6,xExponent:()=>G6,xFontVariant:()=>z6,xGrid:()=>F6,xInset:()=>w6,xInsetLeft:()=>v6,xInsetRight:()=>_6,xLabel:()=>$6,xLabelAnchor:()=>P6,xLabelOffset:()=>U6,xLine:()=>R6,xNice:()=>b6,xPadding:()=>A6,xPaddingInner:()=>T6,xPaddingOuter:()=>E6,xRange:()=>x6,xReverse:()=>V6,xRound:()=>I6,xScale:()=>y6,xTickFormat:()=>C6,xTickPadding:()=>L6,xTickRotate:()=>k6,xTickSize:()=>O6,xTickSpacing:()=>B6,xTicks:()=>D6,xZero:()=>Y6,xyDomain:()=>t6,yAlign:()=>i4,yAriaDescription:()=>_4,yAriaLabel:()=>v4,yAxis:()=>c4,yBase:()=>M4,yClamp:()=>n4,yConstant:()=>T4,yDomain:()=>Z6,yExponent:()=>A4,yFontVariant:()=>w4,yGrid:()=>m4,yInset:()=>K6,yInsetBottom:()=>e4,yInsetTop:()=>t4,yLabel:()=>g4,yLabelAnchor:()=>x4,yLabelOffset:()=>b4,yLine:()=>y4,yNice:()=>Q6,yPadding:()=>o4,yPaddingInner:()=>s4,yPaddingOuter:()=>a4,yRange:()=>J6,yReverse:()=>S4,yRound:()=>r4,yScale:()=>H6,yTickFormat:()=>h4,yTickPadding:()=>d4,yTickRotate:()=>p4,yTickSize:()=>u4,yTickSpacing:()=>f4,yTicks:()=>l4,yZero:()=>I4});var Hy=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)}},W3=new Hy;function H3(e,t,n){(e?.context?.namedPlots??W3).request(t,n)}function pU(e,t,n){(e?.context?.namedPlots??W3).set(t,n)}function Z3(e){return t=>pU(this,e,t)}function mU(e,t,n){br(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 Bnt(e,t){return n=>{mU(n,e,t)}}function J3(e){return t=>{for(let[n,r]of Object.entries(e))mU(t,n,r)}}function Q3(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),J3(o)}function K3(e){return J3({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function t6(e){return J3({xDomain:e,yDomain:e})}var L=e=>t=>Bnt(e,t),e6=L("style"),n6=L("width"),r6=L("height"),i6=L("marginLeft"),o6=L("marginRight"),s6=L("marginTop"),a6=L("marginBottom"),c6=L("align"),l6=L("aspectRatio"),u6=L("axis"),f6=L("inset"),d6=L("grid"),h6=L("label"),p6=L("padding"),m6=L("round"),y6=L("xScale"),g6=L("xDomain"),x6=L("xRange"),b6=L("xNice"),w6=L("xInset"),v6=L("xInsetLeft"),_6=L("xInsetRight"),S6=L("xClamp"),I6=L("xRound"),M6=L("xAlign"),A6=L("xPadding"),T6=L("xPaddingInner"),E6=L("xPaddingOuter"),N6=L("xAxis"),D6=L("xTicks"),O6=L("xTickSize"),B6=L("xTickSpacing"),L6=L("xTickPadding"),C6=L("xTickFormat"),k6=L("xTickRotate"),F6=L("xGrid"),R6=L("xLine"),$6=L("xLabel"),P6=L("xLabelAnchor"),U6=L("xLabelOffset"),z6=L("xFontVariant"),j6=L("xAriaLabel"),q6=L("xAriaDescription"),V6=L("xReverse"),Y6=L("xZero"),X6=L("xBase"),G6=L("xExponent"),W6=L("xConstant"),H6=L("yScale"),Z6=L("yDomain"),J6=L("yRange"),Q6=L("yNice"),K6=L("yInset"),t4=L("yInsetTop"),e4=L("yInsetBottom"),n4=L("yClamp"),r4=L("yRound"),i4=L("yAlign"),o4=L("yPadding"),s4=L("yPaddingInner"),a4=L("yPaddingOuter"),c4=L("yAxis"),l4=L("yTicks"),u4=L("yTickSize"),f4=L("yTickSpacing"),d4=L("yTickPadding"),h4=L("yTickFormat"),p4=L("yTickRotate"),m4=L("yGrid"),y4=L("yLine"),g4=L("yLabel"),x4=L("yLabelAnchor"),b4=L("yLabelOffset"),w4=L("yFontVariant"),v4=L("yAriaLabel"),_4=L("yAriaDescription"),S4=L("yReverse"),I4=L("yZero"),M4=L("yBase"),A4=L("yExponent"),T4=L("yConstant"),E4=L("facetMargin"),N4=L("facetMarginTop"),D4=L("facetMarginBottom"),O4=L("facetMarginLeft"),B4=L("facetMarginRight"),L4=L("facetGrid"),C4=L("facetLabel"),k4=L("fxDomain"),F4=L("fxRange"),R4=L("fxNice"),$4=L("fxInset"),P4=L("fxInsetLeft"),U4=L("fxInsetRight"),z4=L("fxRound"),j4=L("fxAlign"),q4=L("fxPadding"),V4=L("fxPaddingInner"),Y4=L("fxPaddingOuter"),X4=L("fxAxis"),G4=L("fxTicks"),W4=L("fxTickSize"),H4=L("fxTickSpacing"),Z4=L("fxTickPadding"),J4=L("fxTickFormat"),Q4=L("fxTickRotate"),K4=L("fxGrid"),tE=L("fxLine"),eE=L("fxLabel"),nE=L("fxLabelAnchor"),rE=L("fxLabelOffset"),iE=L("fxFontVariant"),oE=L("fxAriaLabel"),sE=L("fxAriaDescription"),aE=L("fxReverse"),cE=L("fyDomain"),lE=L("fyRange"),uE=L("fyNice"),fE=L("fyInset"),dE=L("fyInsetTop"),hE=L("fyInsetBottom"),pE=L("fyRound"),mE=L("fyAlign"),yE=L("fyPadding"),gE=L("fyPaddingInner"),xE=L("fyPaddingOuter"),bE=L("fyAxis"),wE=L("fyTicks"),vE=L("fyTickSize"),_E=L("fyTickSpacing"),SE=L("fyTickPadding"),IE=L("fyTickFormat"),ME=L("fyTickRotate"),AE=L("fyGrid"),TE=L("fyLine"),EE=L("fyLabel"),NE=L("fyLabelAnchor"),DE=L("fyLabelOffset"),OE=L("fyFontVariant"),BE=L("fyAriaLabel"),LE=L("fyAriaDescription"),CE=L("fyReverse"),kE=L("colorScale"),FE=L("colorDomain"),RE=L("colorRange"),$E=L("colorClamp"),PE=L("colorN"),UE=L("colorNice"),zE=L("colorScheme"),jE=L("colorInterpolate"),qE=L("colorPivot"),VE=L("colorSymmetric"),YE=L("colorLabel"),XE=L("colorReverse"),GE=L("colorZero"),WE=L("colorTickFormat"),HE=L("colorBase"),ZE=L("colorExponent"),JE=L("colorConstant"),QE=L("opacityScale"),KE=L("opacityDomain"),t8=L("opacityRange"),e8=L("opacityClamp"),n8=L("opacityNice"),r8=L("opacityLabel"),i8=L("opacityReverse"),o8=L("opacityZero"),s8=L("opacityTickFormat"),a8=L("opacityBase"),c8=L("opacityExponent"),l8=L("opacityConstant"),u8=L("rScale"),f8=L("rDomain"),d8=L("rRange"),h8=L("rClamp"),p8=L("rNice"),m8=L("rZero"),y8=L("rBase"),g8=L("rExponent"),x8=L("rConstant"),b8=L("lengthScale"),w8=L("lengthDomain"),v8=L("lengthRange"),_8=L("lengthClamp"),S8=L("lengthNice"),I8=L("lengthZero"),M8=L("lengthBase"),A8=L("lengthExponent"),T8=L("lengthConstant"),E8=L("projectionType"),N8=L("projectionParallels"),D8=L("projectionPrecision"),O8=L("projectionRotate"),B8=L("projectionDomain"),L8=L("projectionInset"),C8=L("projectionInsetLeft"),k8=L("projectionInsetRight"),F8=L("projectionInsetTop"),R8=L("projectionInsetBottom"),$8=L("projectionClip");function yU(e,t){return{table:e,options:t}}var Vv={};Ir(Vv,{area:()=>U8,areaX:()=>z8,areaY:()=>j8,arrow:()=>LN,axisFx:()=>$N,axisFy:()=>PN,axisX:()=>FN,axisY:()=>RN,barX:()=>X8,barY:()=>G8,cell:()=>W8,cellX:()=>H8,cellY:()=>Z8,circle:()=>rN,contour:()=>vN,delaunayLink:()=>DN,delaunayMesh:()=>ON,denseLine:()=>wN,density:()=>bN,densityX:()=>gN,densityY:()=>xN,dot:()=>tN,dotX:()=>eN,dotY:()=>nN,frame:()=>kN,geo:()=>VN,graticule:()=>XN,gridFx:()=>jN,gridFy:()=>qN,gridX:()=>UN,gridY:()=>zN,heatmap:()=>_N,hexagon:()=>iN,hexbin:()=>MN,hexgrid:()=>AN,hull:()=>BN,image:()=>yN,line:()=>q8,lineX:()=>V8,lineY:()=>Y8,link:()=>CN,raster:()=>SN,rasterTile:()=>IN,rect:()=>J8,rectX:()=>Q8,rectY:()=>K8,regressionY:()=>TN,ruleX:()=>cN,ruleY:()=>lN,sphere:()=>YN,spike:()=>mN,text:()=>oN,textX:()=>sN,textY:()=>aN,tickX:()=>uN,tickY:()=>fN,vector:()=>dN,vectorX:()=>hN,vectorY:()=>pN,voronoi:()=>EN,voronoiMesh:()=>NN});var Lnt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function At(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=Lnt.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?Ty:Bn;return P8(r,e,t,n)}function P8(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function ua(e,t,n){return r=>{r.addMark(new e(t,n))}}var U8=(...e)=>At("area",...e),z8=(...e)=>At("areaX",...e),j8=(...e)=>At("areaY",...e),q8=(...e)=>At("line",...e),V8=(...e)=>At("lineX",...e),Y8=(...e)=>At("lineY",...e),X8=(...e)=>At("barX",...e),G8=(...e)=>At("barY",...e),W8=(...e)=>At("cell",...e),H8=(...e)=>At("cellX",...e),Z8=(...e)=>At("cellY",...e),J8=(...e)=>At("rect",...e),Q8=(...e)=>At("rectX",...e),K8=(...e)=>At("rectY",...e),tN=(...e)=>At("dot",...e),eN=(...e)=>At("dotX",...e),nN=(...e)=>At("dotY",...e),rN=(...e)=>At("circle",...e),iN=(...e)=>At("hexagon",...e),oN=(...e)=>At("text",...e),sN=(...e)=>At("textX",...e),aN=(...e)=>At("textY",...e),cN=(...e)=>At("ruleX",...e),lN=(...e)=>At("ruleY",...e),uN=(...e)=>At("tickX",...e),fN=(...e)=>At("tickY",...e),dN=(...e)=>At("vector",...e),hN=(...e)=>At("vectoX",...e),pN=(...e)=>At("vectorY",...e),mN=(...e)=>At("spike",...e),yN=(...e)=>At("image",...e),gN=(...e)=>P8(md,"areaX",...e),xN=(...e)=>P8(md,"areaY",...e),bN=(...e)=>ua(Cy,...e),wN=(...e)=>ua(Ly,...e),vN=(...e)=>ua(Oy,...e),_N=(...e)=>ua(By,...e),SN=(...e)=>ua(yc,...e),IN=(...e)=>ua(Ry,...e),MN=(...e)=>ua(Fy,...e),AN=(...e)=>At("hexgrid",...e),TN=(...e)=>ua($y,...e),EN=(...e)=>At("voronoi",...e),NN=(...e)=>At("voronoiMesh",...e),DN=(...e)=>At("delaunayLink",...e),ON=(...e)=>At("delaunayMesh",...e),BN=(...e)=>At("hull",...e),LN=(...e)=>At("arrow",...e),CN=(...e)=>At("link",...e),kN=(...e)=>At("frame",...e),FN=(...e)=>At("axisX",...e),RN=(...e)=>At("axisY",...e),$N=(...e)=>At("axisFx",...e),PN=(...e)=>At("axisFy",...e),UN=(...e)=>At("gridX",...e),zN=(...e)=>At("gridY",...e),jN=(...e)=>At("gridFx",...e),qN=(...e)=>At("gridFy",...e),VN=(...e)=>ua(ky,...e),YN=(...e)=>At("sphere",...e),XN=(...e)=>At("graticule",...e);var Yv={};Ir(Yv,{highlight:()=>GN,intervalX:()=>KN,intervalXY:()=>eD,intervalY:()=>tD,nearestX:()=>JN,nearestY:()=>QN,pan:()=>nD,panX:()=>rD,panY:()=>iD,panZoom:()=>oD,panZoomX:()=>sD,panZoomY:()=>aD,toggle:()=>vd,toggleColor:()=>ZN,toggleX:()=>WN,toggleY:()=>HN});function gc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function GN({by:e,...t}){return gc(Py,{selection:e,channels:t})}function vd({as:e,...t}){return gc(ql,{...t,selection:e})}function WN(e){return vd({...e,channels:["x"]})}function HN(e){return vd({...e,channels:["y"]})}function ZN(e){return vd({...e,channels:["color"]})}function JN({as:e,...t}){return gc(bd,{...t,selection:e,channel:"x"})}function QN({as:e,...t}){return gc(bd,{...t,selection:e,channel:"y"})}function KN({as:e,...t}){return gc(xd,{...t,selection:e,channel:"x"})}function tD({as:e,...t}){return gc(xd,{...t,selection:e,channel:"y"})}function eD({as:e,...t}){return gc(jy,{...t,selection:e})}function _d(e){return gc(qy,e)}function nD(e={}){return _d({...e,zoom:!1})}function rD(e={}){return _d({...e,zoom:!1,pany:!1})}function iD(e={}){return _d({...e,zoom:!1,panx:!1})}function oD(e={}){return _d(e)}function sD(e={}){return _d({...e,pany:!1})}function aD(e={}){return _d({...e,panx:!1})}var Xv={};Ir(Xv,{colorLegend:()=>lD,opacityLegend:()=>uD,symbolLegend:()=>fD});function cD(e,t={}){if(t.for){let{for:n,...r}=t,i=new wd(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?H3(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new wd(e,t))}function lD(e){return cD.call(this,"color",e)}function uD(e){return cD.call(this,"opacity",e)}function fD(e){return cD.call(this,"symbol",e)}function gU(...e){let t=new Iy;return e.flat().forEach(n=>n(t)),Wy(this,...t.marks),t.element}function hD({coordinator:e=ni(),namedPlots:t=new Hy,extensions:n=null,...r}={}){return{...dD,...n,context:{coordinator:e,namedPlots:t,...r}}}var xU="spec",Gv="literal",zVt="dataref",bU="options",wU="selection",vU="paramref",_U="param",pD="select",Wv="value",SU="crossfilter",Hv="intersect",IU="union",MU="single",AU="data",TU="expression",xc="sql",fa="agg",Zy="input",Sd="hconcat",Id="vconcat",Md="hspace",Ad="vspace",Zv="mark",mD="from",Td="plot",Jy="legend",EU="attribute",NU="transform",DU="interactor",Qy="Fixed";var $t=class{constructor(t,n=null){this.type=t,this.children=n}instantiate(){throw Error("instantiate not implemented")}codegen(){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var Ky=class extends $t{constructor(t,n,r,i,o,s){super(xU,[t]),this.root=t,this.meta=n,this.config=r,this.data=i,this.params=o,this.plotDefaults=s}toJSON(){let{root:t,meta:n,config:r,plotDefaults:i}=this,o=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),o?.size){let c=a.data={};for(let[l,u]of o)c[l]=u.toJSON()}if(s?.size){let c=a.params={};for(let[l,u]of s)c[l]=u.toJSON()}if(i?.length){let c=a.plotDefaults={};for(let l of i)Object.assign(c,l.toJSON())}return Object.assign(a,t.toJSON())}};function OU(e){let t=typeof e;return t==="object"?e?.param:t==="string"?Cnt(e):null}function Cnt(e){return e?.[0]==="$"?e.slice(1):null}function tg(e){return`$${e}`}function BU(e){return[e].flat()}function xi(e){return Array.isArray(e)}function Ed(e){return e!==null&&typeof e=="object"&&!xi(e)}function Go(e){return typeof e=="string"}function Nd(e,t){throw Object.assign(Error(e),{data:t})}function _r(e,t){let n={};for(let r in e)n[r]=t.maybeSelection(e[r]);return new Dd(n)}var Dd=class e extends $t{constructor(t){super(bU),this.options=t}filter(t){let n=Object.fromEntries(Object.entries(this.options).filter(([r,i])=>t(r,i)));return new e(n)}instantiate(t){let{options:n}=this,r={};for(let i in n)r[i]=n[i].instantiate(t);return r}codegen(t){let{options:n}=this,r=[];for(let i in n)r.push(`${i}: ${n[i].codegen(t)}`);return r.length?`{${t.maybeLineWrap(r)}}`:""}toJSON(){let{options:t}=this,n={};for(let r in t)n[r]=t[r].toJSON();return n}};var kU="table",FU="parquet",RU="csv",yD="json",i_="spatial",LU=new Map([[kU,knt],[FU,Fnt],[RU,Rnt],[yD,$nt],[i_,Pnt]]);function $U(e,t,n){if(t=Unt(t),LU.has(t.type))return LU.get(t.type)(e,t,n);n.error("Unrecognized data format type.",t)}function knt(e,t,n){let{query:r,type:i,...o}=t;return new Qv(e,r,_r(o,n))}function Fnt(e,t,n){let{file:r,type:i,...o}=t;return new t_(e,r,_r(o,n))}function Rnt(e,t,n){let{file:r,type:i,...o}=t;return new e_(e,r,_r(o,n))}function $nt(e,t,n){let{data:r,file:i,type:o,...s}=t,a=_r(s,n);return r?new r_(e,r,a):new n_(e,i,a)}function Pnt(e,t,n){let{file:r,type:i,...o}=t;return new Kv(e,r,_r(o,n))}function Unt(e){return xi(e)&&(e={type:"json",data:e}),Go(e)&&(e={type:"table",query:e}),{...e,type:znt(e)}}function znt(e){return e.type||jnt(e.file)||"table"}function jnt(e){let t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function CU(e,t){return t?new URL(e,t).toString():e}function qnt(e,t){let n=e?.codegen(t);return n?`, ${n}`:""}var Jv=class extends $t{constructor(t,n){super(AU),this.name=t,this.format=n}},Od=class extends Jv{constructor(t,n){super(t,n)}instantiateQuery(t){t.error("instantiateQuery not implemented")}codegenQuery(t){t.error("codegenQuery not implemented")}instantiate(t){let n=this.instantiateQuery(t);if(n)return n}codegen(t){let n=this.codegenQuery(t);if(n)return n}},Qv=class extends Od{constructor(t,n,r){super(t,kU),this.query=n?.trim(),this.options=r}instantiateQuery(t){let{name:n,query:r,options:i}=this;if(r)return t.api.create(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,query:r,options:i}=this;if(r)return`\`${ao(n,r,i.instantiate(t))}\``}toJSON(){let{format:t,query:n,options:r}=this;return{type:t,query:n,...r.toJSON()}}},Vl=class extends Od{constructor(t,n,r,i,o){super(t,n),this.file=i,this.method=r,this.options=o}instantiateQuery(t){let{name:n,method:r,file:i,options:o}=this,s=CU(i,t.baseURL),a=o?.instantiate(t);return t.api[r](n,s,a)}codegenQuery(t){let{name:n,method:r,file:i,options:o}=this,s=CU(i,t.baseURL),a=qnt(o,t);return`${t.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:t,file:n,options:r}=this;return{type:t,file:n,...r.toJSON()}}},Kv=class extends Vl{constructor(t,n,r){super(t,i_,"loadSpatial",n,r)}},t_=class extends Vl{constructor(t,n,r){super(t,FU,"loadParquet",n,r)}},e_=class extends Vl{constructor(t,n,r){super(t,RU,"loadCSV",n,r)}},n_=class extends Vl{constructor(t,n,r){super(t,yD,"loadJSON",n,r)}},r_=class extends Od{constructor(t,n,r){super(t,yD),this.data=n,this.options=r}instantiateQuery(t){let{name:n,data:r,options:i}=this;return t.api.loadObjects(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,data:r,options:i}=this,o=i?","+i.codegen(t):"",s=`[
69
+ }`)).call(Cf,n);for(let k of l){let{channels:$,values:P,facets:U}=m.get(k);if(p===void 0||k.facet==="super"){let W=null;if(U&&(W=U[0],W=k.filter(W,$,P),W.length===0))continue;let tt=k.render(W,x,P,_,I);if(tt==null)continue;A.appendChild(tt)}else{let W;for(let tt of p){if(!(k.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if(U){let Y=f.has(k);if(nt=U[Y?tt.i:0],nt=k.filter(nt,$,P),nt.length===0)continue;!Y&&nt===U[0]&&(nt=Js(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let at=k.render(nt,x,P,v,I);if(at!=null){(W??=Vt(A).append("g")).append(()=>at).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(Y)&&(W.attr(Y,at.getAttribute(Y)),at.removeAttribute(Y))}}W?.selectChildren().attr("transform",C)}}let N=h$(g,I,e),{figure:F=r!=null||i!=null||o!=null||N.length>0}=e;F&&(E=D.createElement("figure"),E.className=`${c}-figure`,E.style.maxWidth="initial",r!=null&&E.append(g$(D,r,"h2")),i!=null&&E.append(g$(D,i,"h3")),E.append(...N,A),o!=null&&E.append(VQ(D,o))),E.scale=d7(x.scales),E.legend=f$(g,I,e),E.projection=I.projection;let R=gR();return R>0&&Vt(A).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(`${R.toLocaleString("en-US")} warning${R===1?"":"s"}. Please check the console.`),E}function g$(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function VQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function YQ({marks:e=[],...t}={}){return ny({...t,marks:[...e,this]})}St.prototype.plot=YQ;function x$(e){return e.flat(1/0).filter(t=>t!=null).map(XQ)}function XQ(e){return typeof e.render=="function"?e:new WT(e)}var WT=class extends St{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function HT(e,t){for(let n in e)_$(e[n],t);return e}function _$(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*100:JA(s,i)}=t[n]??{};a!=null&&(e.value=Gt(e.value,a),e.transform=!1)}function GQ(e){for(let t in e)fT(t,e[t])}function ey(e,t,n,r=$F){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(!IR(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=AR(s);c&&GT(e,"x",u),l&&GT(e,"y",f)}}}else GT(e,a,s)}return e}function GT(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function WQ(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=je(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Of(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Of(i,{value:r,scale:"fy"})),HT(o,t);let s=Bw(i,o);return{channels:o,groups:s,data:e.data}}function b$(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=je(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=Of(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Of(c,{value:i,scale:"fy"})),HT(l,n),{channels:l,groups:Bw(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)&&je(e.data)?.length===a.length&&Vn(`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 HQ(e,t={}){return Ie({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function ZQ(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)?jf:/^y$/i.test(i)?El:qf,r=i(HQ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===El?"left":"bottom");let s=nv(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function JQ(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:g=m===null?null:l}=o,fx:{axis:y=f,grid:x=y===null?null:d}=s,fy:{axis:b=f,grid:w=b===null?null:d}=a}=n;(r||!Lo(i)&&!w$("x",e))&&(h=p=null),(r||!Lo(o)&&!w$("y",e))&&(m=g=null),t.has("fx")||(y=x=null),t.has("fy")||(b=w=null),h===void 0&&(h=!ov(e,"x")),m===void 0&&(m=!ov(e,"y")),y===void 0&&(y=!ov(e,"fx")),b===void 0&&(b=!ov(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),y===!0&&(y=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let v=[];return iv(v,w,Jw,a),rv(v,b,Ww,"right","left",u,a),iv(v,x,Kw,s),rv(v,y,Hw,"top","bottom",u,s),iv(v,g,Zw,o),rv(v,m,Zm,"left","right",n,o),iv(v,p,Qw,i),rv(v,h,Jm,"bottom","top",n,i),v}function rv(e,t,n,r,i,o,s){if(!t)return;let a=QQ(t);s=KQ(a?r:t,o,s);let{line:c}=s;(n===Zm||n===Jm)&&c&&!ta(c)&&e.push(Gf(tK(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function iv(e,t,n,r){!t||ta(t)||e.push(n(eK(t,r)))}function QQ(e){return/^\s*both\s*$/i.test(e)}function KQ(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 tK(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function eK(e,{stroke:t=Qa(e)?e:void 0,ticks:n=nK(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function nK(e){switch(typeof e){case"number":return!0;case"string":return!Qa(e)}return cr(e)||typeof e?.range=="function"}function ov(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function w$(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 rK(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 iK({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Nw(n),l=e&&v$(e),u=t&&v$(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 v$(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var oK=new Map([["basis",gA],["basis-closed",xA],["basis-open",bA],["bundle",wA],["bump-x",dA],["bump-y",hA],["cardinal",vA],["cardinal-closed",_A],["cardinal-open",SA],["catmull-rom",IA],["catmull-rom-closed",MA],["catmull-rom-open",AA],["linear",Xs],["linear-closed",TA],["monotone-x",NA],["monotone-y",DA],["natural",OA],["step",BA],["step-after",CA],["step-before",LA]]);function ry(e=Xs,t){if(typeof e=="function")return e;let n=oK.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 sv(e=ac,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?ac:ry(e,t)}function ac(e){return Xs(e)}function Uo(e={y:"count"},t={}){[e,t]=JT(e,t);let{x:n,y:r}=t;return ZT(av(n,t,G),null,null,r,e,Nl(t))}function zo(e={x:"count"},t={}){[e,t]=JT(e,t);let{x:n,y:r}=t;return ZT(null,av(r,t,G),n,null,e,Dl(t))}function sa(e={fill:"count"},t={}){[e,t]=JT(e,t);let{x:n,y:r}=sK(t);return ZT(n,r,null,null,e,Nl(Dl(t)))}function M$(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=gw}=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 Wf(e={}){return M$(Uo,"y",Yi(e,"x"))}function Hf(e={}){return M$(zo,"x",Yi(e,"y"))}function ZT(e,t,n,r,{data:i=yw,filter:o=$m,sort:s,reverse:a,...c}={},l={}){e=S$(e),t=S$(t),c=aK(c,l),i=E$(i,G),s=s==null?void 0:A$("sort",s,l),o=o==null?void 0:T$("filter",o,l),n!=null&&Ro(c,"x","x1","x2")&&(n=null),r!=null&&Ro(c,"y","y1","y2")&&(r=null);let[u,f]=Dn(e),[d,h]=Dn(e),[p,m]=Dn(t),[g,y]=Dn(t),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,v]=Dn(x),{x:_,y:I,z:D,fill:A,stroke:E,x1:T,x2:O,y1:C,y2:S,domain:M,cumulative:N,thresholds:F,interval:R,...k}=l,[$,P]=Dn(D),[U]=Be(A),[W]=Be(E),[tt,nt]=Dn(U),[at,Y]=Dn(W);return{..."z"in l&&{z:$||D},..."fill"in l&&{fill:tt||A},..."stroke"in l&&{stroke:at||E},...yn(k,(rt,j,H)=>{let ot=Sl(wt(rt,x),H?.[b]),z=wt(rt,D),kt=wt(rt,U),dt=wt(rt,W),Ht=zm(c,{z,fill:kt,stroke:dt}),Zt=[],et=[],ae=ot&&v([]),Sr=z&&P([]),Wi=kt&&nt([]),nz=dt&&Y([]),ID=e&&f([]),rz=e&&h([]),MD=t&&m([]),iz=t&&y([]),oz=uK(e,t,rt),sz=0;for(let Wl of c)Wl.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let Wl of j){let AD=[];for(let Cd of c)Cd.scope("facet",Wl);s&&s.scope("facet",Wl),o&&o.scope("facet",Wl);for(let[Cd,az]of Ka(Wl,Ht))for(let[cz,og]of Ka(az,ot))for(let[Hi,bc]of oz(og))if(!(o&&!o.reduce(Hi,bc))){AD.push(sz++),et.push(i.reduceIndex(Hi,rt,bc)),ot&&ae.push(cz),z&&Sr.push(Ht===z?Cd:z[(Hi.length>0?Hi:og)[0]]),kt&&Wi.push(Ht===kt?Cd:kt[(Hi.length>0?Hi:og)[0]]),dt&&nz.push(Ht===dt?Cd:dt[(Hi.length>0?Hi:og)[0]]),ID&&(ID.push(bc.x1),rz.push(bc.x2)),MD&&(MD.push(bc.y1),iz.push(bc.y2));for(let lz of c)lz.reduce(Hi,bc);s&&s.reduce(Hi)}Zt.push(AD)}return lT(Zt,s,a),{data:et,facets:Zt}}),...!Ro(c,"x")&&(u?{x1:u,x2:d,x:Af(u,d)}:{x:_,x1:T,x2:O}),...!Ro(c,"y")&&(p?{y1:p,y2:g,y:Af(p,g)}:{y:I,y1:C,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:rt,output:j})=>[rt,j]))}}function JT({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function av(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...pi(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=QT(e.thresholds,e.interval),e}function sK(e){let{x:t,y:n}=e;return t=av(t,e),n=av(n,e),[t.value,n.value]=$e(t.value,n.value),{x:t,y:n}}function S$(e){if(e==null)return;let{value:t,cumulative:n,domain:r=le,thresholds:i}=e,o=s=>{let a=wt(s,t),c;if(Le(a)||lK(i)){a=Gt(a,XA,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ja(i)?i(a,u,f):i;typeof d=="number"&&(d=am(u,f,d)),Ja(d)&&(r===le&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Ke(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ja(i)?i(a,u,f):i;if(typeof d=="number")if(r===le){let h=Es(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 g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)*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 g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)/h}else d=[u];else d=[u]}else d=Mn(u,f,d);else Ja(d)&&(r===le&&(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?dK:n>0?fK:KT)(l,c,a),l};return o.label=On(t),o}function QT(e,t,n=I$){if(e===void 0)return t===void 0?n:ko(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return K0;case"scott":return np;case"sturges":return Na;case"auto":return I$}return Cm(e)}return e}function aK(e,t){return aT(e,t,A$)}function A$(e,t,n){return pw(e,t,n,T$)}function T$(e,t,n){return mw(e,t,n,E$)}function E$(e,t){return Df(e,t,cK)}function cK(e){switch(`${e}`.toLowerCase()){case"x":return hK;case"x1":return mK;case"x2":return yK;case"y":return pK;case"y1":return gK;case"y2":return xK}throw new Error(`invalid bin reduce: ${e}`)}function I$(e,t,n){return Math.min(200,np(e,t,n))}function lK(e){return qF(e)||cr(e)&&Le(e)}function uK(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 KT(e,t,n){return t=Ke(t),r=>{let i=e.map(()=>[]);for(let o of r)i[Ts(t,n[o])-1]?.push(o);return i}}function fK(e,t,n){let r=KT(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 dK(e,t,n){let r=KT(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 N$(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var hK={reduceIndex(e,t,{x1:n,x2:r}){return N$(n,r)}},pK={reduceIndex(e,t,{y1:n,y2:r}){return N$(n,r)}},mK={reduceIndex(e,t,{x1:n}){return n}},yK={reduceIndex(e,t,{x2:n}){return n}},gK={reduceIndex(e,t,{y1:n}){return n}},xK={reduceIndex(e,t,{y2:n}){return n}};function Zf(e={}){return WA(e)?e:{...e,x:G}}function Jf(e={}){return HA(e)?e:{...e,y:G}}function D$(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,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=Za(e);let o=e[jA]=new Uint32Array(n+i);t=t.map(a=>Za(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 t3(e={},t={}){arguments.length===1&&([e,t]=td(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=ed(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:Af(c,l)}}function L$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=ed(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function C$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=ed(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function e3(e={},t={}){arguments.length===1&&([e,t]=td(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=ed(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:Af(c,l)}}function k$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=ed(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function F$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=ed(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Qf({x:e,x1:t,x2:n,...r}={}){return r=Yi(r,"y"),t===void 0&&n===void 0?t3({x:e,...r}):([t,n]=ZA(e,t,n),{...r,x1:t,x2:n})}function Kf({y:e,y1:t,y2:n,...r}={}){return r=Yi(r,"x"),t===void 0&&n===void 0?e3({y:e,...r}):([t,n]=ZA(e,t,n),{...r,y1:t,y2:n})}function td(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var bK={length:!0};function ed(e,t=km,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=jn(a),[l,u]=Dn(e),[f,d]=mn(t),[h,p]=mn(t);return f.hint=h.hint=bK,i=wK(i),o=SK(o,i,r),[yn(a,(m,g,y)=>{({data:m,facets:g}=D$(m,g));let x=e==null?void 0:u(Sl(wt(m,e),y?.[n])),b=wt(m,t,Float64Array),w=wt(m,c),v=o&&o(m,x,b,w),_=m.length,I=d(new Float64Array(_)),D=p(new Float64Array(_)),A=[];for(let E of g){let T=x?Array.from(cn(E,O=>x[O]).values()):[E];if(v)for(let O of T)O.sort(v);for(let O of T){let C=0,S=0;s&&O.reverse();for(let M of O){let N=b[M];N<0?C=D[M]=(I[M]=C)+N:N>0?S=D[M]=(I[M]=S)+N:D[M]=I[M]=S}}A.push(T)}return i&&i(A,I,D,w),{data:m,facets:g}}),l,f,h]}function wK(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return vK;case"center":case"silhouette":return _K;case"wiggle":return $$}throw new Error(`unknown offset: ${e}`)}}function R$(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 vK(e,t,n){for(let r of e)for(let i of r){let[o,s]=R$(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 _K(e,t,n){for(let r of e){for(let i of r){let[o,s]=R$(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}P$(r,t,n)}U$(e,t,n)}function $$(e,t,n,r){for(let i of e){let o=new Zn,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,...W0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=An(l);d&&(s-=An(l,(h,p)=>(u[p]/2+f[p])*h)/d)}P$(i,t,n)}U$(e,t,n)}function P$(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 U$(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])+Wt(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 SK(e,t,n){if(e===void 0&&t===$$)return O$(dn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?bl:dn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return IK(i);case"z":return MK(i);case"sum":return AK(i);case"appearance":return TK(i);case"inside-out":return O$(i)}return B$(VA(e))}if(typeof e=="function")return(e.length===1?B$:EK)(e);if(Array.isArray(e))return NK(e);throw new Error(`invalid order: ${e}`)}}function IK(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function MK(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function AK(e){return cv(e,(t,n,r,i)=>Tu(ar(t),o=>An(o,s=>r[s]),o=>i[o]))}function TK(e){return cv(e,(t,n,r,i)=>Tu(ar(t),o=>n[Xc(o,s=>r[s])],o=>i[o]))}function O$(e){return cv(e,(t,n,r,i)=>{let o=ar(t),s=Tu(o,f=>n[Xc(f,d=>r[d])],f=>i[f]),a=$i(o,f=>An(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 B$(e){return t=>{let n=wt(t,e);return(r,i)=>dn(n[r],n[i])}}function EK(e){return t=>(n,r)=>e(t[n],t[r])}function NK(e){return cv(dn,()=>e)}function cv(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Zn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var DK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},kl=class extends St{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:jn(n),optional:!0}},n,DK),this.z=a,this.curve=ry(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 ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n,0,0).call(u=>u.selectAll().data(_w(t,[s,a,c,l],this,r)).enter().append("path").call(Lt,this).call(Tl,this,r).attr("d",hf().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 iy(e,t){return t===void 0?aa(e,{x:Zs,y:Ha}):new kl(e,t)}function cc(e,t){let{y:n=Ee,...r}=Hf(t);return new kl(e,Qf(Zf({...r,y1:n,y2:void 0})))}function aa(e,t){let{x:n=Ee,...r}=Wf(t);return new kl(e,Kf(Jf({...r,x1:n,x2:void 0})))}var OK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},oy=class extends St{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,OK),this.curve=sv(a,c),Xi(this,n)}project(t,n,r){this.curve!==ac&&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 ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",u===ac&&o.projection?BK(o.projection,s,a,c,l):d=>{let h=er(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Qt,this,r).call(oa,this,r,o)).node()}};function BK(e,t,n,r,i){let o=En(e);return t=Ke(t),n=Ke(n),r=Ke(r),i=Ke(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function lv(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=sy(t,n,r),[o,s]=sy(i,o,s),new oy(e,{...a,x1:n,x2:r,y1:o,y2:s})}function sy(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 LK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},ay=class extends St{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,LK),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=CK(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:g}=this,y=u?w=>u[w]:hn(f===void 0?1:f),x=h*Vf/2,b=p/1.5;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",v=>{let _=s[v],I=a[v],D=c[v],A=l[v],E=Math.hypot(D-_,A-I);if(E<=m+g)return null;let T=Math.atan2(A-I,D-_),O=Math.min(b*y(v),E/3),C=this.sweep(_,I,D,A)*d*Vf,S=Math.hypot(E/Math.tan(C),E)/2;if(m||g)if(S<1e5){let tt=Math.sign(C),[nt,at]=kK([_,I],[D,A],S,tt);if(m&&([_,I]=z$([nt,at,S],[_,I,m],-tt*Math.sign(m))),g){let[Y,rt]=z$([nt,at,S],[D,A,g],tt*Math.sign(g));T+=Math.atan2(rt-at,Y-nt)-Math.atan2(A-at,D-nt),D=Y,A=rt}}else{let tt=D-_,nt=A-I,at=Math.hypot(tt,nt);m&&(_+=tt/at*m,I+=nt/at*m),g&&(D-=tt/at*g,A-=nt/at*g)}let M=T+C,N=M+x,F=M-x,R=D-O*Math.cos(N),k=A-O*Math.sin(N),$=D-O*Math.cos(F),P=A-O*Math.sin(F),U=S<1e5?`A${S},${S} 0,0,${C>0?1:0} `:"L",W=O?`M${R},${k}L${D},${A}L${$},${P}`:"";return`M${_},${I}${U}${D},${A}${W}`}).call(Qt,this,r)).node()}};function CK(e=1){if(typeof e=="number")return hn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(tn(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>zt(t,r);case"-x":return(t,n,r)=>Hn(t,r);case"+y":return(t,n,r,i)=>zt(n,i);case"-y":return(t,n,r,i)=>Hn(n,i)}}function kK([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 z$([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 q$(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=sy(t,n,r),[o,s]=sy(i,o,s),new ay(e,{...a,x1:n,x2:r,y1:o,y2:s})}var nd=class extends St{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Bt(s),this.insetRight=Bt(a),this.insetBottom=Bt(c),this.insetLeft=Bt(l),this.rx=fe(u,"auto"),this.ry=fe(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ut("svg:g",o).call(Ct,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Lt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ft,"rx",s).call(ft,"ry",a).call(Qt,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)}},j$={ariaLabel:"bar"},cy=class extends nd{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,j$)}_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 lr(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 lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},ly=class extends nd{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,j$)}_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 lr(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 lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function qo(e,t={}){return If(t)||(t={...t,y:Ee,x2:G}),new cy(e,Qf(Rw(Zf(t))))}function jo(e,t={}){return If(t)||(t={...t,x:Ee,y2:G}),new ly(e,Kf($w(Jf(t))))}var FK={ariaLabel:"cell"},Fl=class extends nd{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,FK)}_transform(t,n){t.call(Et,n,{},0,0)}};function lc(e,{x:t,y:n,...r}={}){return[t,n]=$e(t,n),new Fl(e,{...r,x:t,y:n})}function V$(e,{x:t=Ee,fill:n,stroke:r,...i}={}){return n===void 0&&Be(r)[0]===void 0&&(n=G),new Fl(e,{...i,x:t,fill:n,stroke:r})}function Y$(e,{y:t=Ee,fill:n,stroke:r,...i}={}){return n===void 0&&Be(r)[0]===void 0&&(n=G),new Fl(e,{...i,y:t,fill:n,stroke:r})}var RK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function uy(e){return e.sort===void 0&&e.reverse===void 0?dw({channel:"-r"},e):e}var Rl=class extends St{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Gs,frameAnchor:c}=n,[l,u]=se(s,0),[f,d]=tR(a),[h,p]=se(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:sr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},uy(n),RK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Fo(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:x}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===g.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,[g,y]=gn(this,i),x=m===Gs,b=u?void 0:h*h*Math.PI;return Va(h)&&(t=[]),ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(x?"circle":"path").call(Lt,this).call(x?v=>{v.attr("cx",c?_=>c[_]:g).attr("cy",l?_=>l[_]:y).attr("r",u?_=>u[_]:h)}:v=>{v.attr("transform",oc`translate(${c?_=>c[_]:g},${l?_=>l[_]:y})${f?_=>` rotate(${f[_]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?_=>{let I=er();return d[_].draw(I,u[_]*u[_]*Math.PI),I}:u?_=>{let I=er();return m.draw(I,u[_]*u[_]*Math.PI),I}:d?_=>{let I=er();return d[_].draw(I,b),I}:(()=>{let _=er();return m.draw(_,b),_})())}).call(Qt,this,r)).node()}};function yi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new Rl(e,{...r,x:t,y:n})}function X$(e,{x:t=G,...n}={}){return new Rl(e,Uw({...n,x:t}))}function G$(e,{y:t=G,...n}={}){return new Rl(e,Pw({...n,y:t}))}function W$(e,t){return yi(e,{...t,symbol:"circle"})}function H$(e,t){return yi(e,{...t,symbol:"hexagon"})}var $K={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},$l=class extends St{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:jn(n),optional:!0}},n,$K),this.z=o,this.curve=sv(s,a),Xi(this,n)}filter(t){return t}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(l=>l.selectAll().data(_w(t,[s,a],this,r)).enter().append("path").call(Lt,this).call(Tl,this,r).call(A7,this,r,o).attr("d",c===ac&&o.projection?PK(o.projection,s,a):ym().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function PK(e,t,n){let r=En(e);return t=Ke(t),n=Ke(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 Pl(e,{x:t,y:n,...r}={}){return[t,n]=$e(t,n),new $l(e,{...r,x:t,y:n})}function uc(e,{x:t=G,y:n=Ee,...r}={}){return new $l(e,Hf({...r,x:t,y:n}))}function fc(e,{x:t=Ee,y:n=G,...r}={}){return new $l(e,Wf({...r,x:t,y:n}))}var UK={ariaLabel:"rect"},Ul=class extends St{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=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,UK),this.insetTop=Bt(c),this.insetRight=Bt(l),this.insetBottom=Bt(u),this.insetLeft=Bt(f),this.rx=fe(d,"auto"),this.ry=fe(h,"auto")}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:g,height:y}=i,{projection:x}=o,{insetTop:b,insetRight:w,insetBottom:v,insetLeft:_,rx:I,ry:D}=this,A=(s?.bandwidth?s.bandwidth():0)-_-w,E=(a?.bandwidth?a.bandwidth():0)-b-v;return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{},0,0).call(T=>T.selectAll().data(t).enter().append("rect").call(Lt,this).attr("x",c&&(x||!lr(s))?u?O=>Math.min(c[O],u[O])+_:O=>c[O]+_:m+_).attr("y",l&&(x||!lr(a))?f?O=>Math.min(l[O],f[O])+b:O=>l[O]+b:d+b).attr("width",c&&(x||!lr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+A):A:g-h-m-w-_).attr("height",l&&(x||!lr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+E):E:y-d-p-b-v).call(ft,"rx",I).call(ft,"ry",D).call(Qt,this,r)).node()}};function fy(e,t){return new Ul(e,FT(RT(t)))}function rd(e,t={}){return If(t)||(t={...t,y:Ee,x2:G,interval:1}),new Ul(e,Qf(RT(Zf(t))))}function id(e,t={}){return If(t)||(t={...t,x:Ee,y2:G,interval:1}),new Ul(e,Kf(FT(Jf(t))))}function r3(e,t){t=zK(t);let{x:n,y:r,color:i,size:o}=t,s=uv(e,n),a=uv(e,r),c=uv(e,i),l=uv(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:g,reduce:y,zero:x,...b},color:{value:w,color:v,reduce:_},size:{value:I,reduce:D},mark:A}=t;if(h===void 0&&(h=y==null&&d==null&&I==null&&g!=null?"count":null),y===void 0&&(y=h==null&&g==null&&I==null&&d!=null?"count":null),D===void 0&&I==null&&_==null&&h==null&&y==null&&(d==null||Ne(s))&&(g==null||Ne(a))&&(D="count"),p===void 0&&(p=fv(h)?!0:void 0),x===void 0&&(x=fv(y)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&d==null)throw new Error("reducing y requires x");A===void 0&&(A=I!=null||D!=null?"dot":fv(h)||fv(y)||_!=null?"bar":d!=null&&g!=null?Ne(s)||Ne(a)||h==null&&y==null&&!dy(s)&&!dy(a)?"dot":"line":d!=null||g!=null?"rule":null);let E,T,O;switch(A){case"dot":O=yi,T="stroke";break;case"line":O=s&&a||h!=null||y!=null?x||y!=null||s&&dy(s)?fc:p||h!=null||a&&dy(a)?uc:Pl:s?uc:fc,T="stroke",J$(c)&&(E=null);break;case"area":O=!(x||y!=null)&&(p||h!=null||a&&dy(a))?cc:aa,T="fill",J$(c)&&(E=null);break;case"rule":O=s?Yr:Xr,T="stroke";break;case"bar":O=h!=null?Ne(a)?Z$(h)&&s&&Ne(s)?lc:qo:rd:y!=null?Ne(s)?Z$(y)&&a&&Ne(a)?lc:jo:id:_!=null||D!=null?s&&Ne(s)&&a&&Ne(a)?lc:s&&Ne(s)?jo:a&&Ne(a)?qo:fy:s&&Ks(s)&&!(a&&Ks(a))?qo:a&&Ks(a)&&!(s&&Ks(s))?jo:lc,T="fill";break;default:throw new Error(`invalid mark: ${A}`)}let C={fx:u,fy:f,x:s??void 0,y:a??void 0,[T]:c??v,z:E,r:l??void 0,tip:!0},S,M={[T]:_??void 0,r:D??void 0};if(h!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(M.y=y,S=Ne(s)?tc:Uo):h!=null?(M.x=h,S=Ne(a)?ec:zo):(_!=null||D!=null)&&(s&&a?S=Ne(s)&&Ne(a)?Um:Ne(s)?zo:Ne(a)?Uo:sa:s?S=Ne(s)?tc:Uo:a&&(S=Ne(a)?ec:zo)),(S===sa||S===Uo)&&(C.x={value:s,...m}),(S===sa||S===zo)&&(C.y={value:a,...b}),p===void 0&&(p=s&&!(S===sa||S===Uo)&&(O===qo||O===cc||O===rd||O===Xr)),x===void 0&&(x=a&&!(S===sa||S===zo)&&(O===jo||O===aa||O===id||O===Yr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:g??null,reduce:y??null,zero:!!x,...b},color:{value:w??null,reduce:_??null,...v!==void 0&&{color:v}},size:{value:I??null,reduce:D??null},mark:A,markImpl:Q$[O],markOptions:C,transformImpl:Q$[S],transformOptions:M,colorMode:T}}function K$(e,t){let n=r3(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=n3[n.markImpl],f=n3[n.transformImpl],d=r!=null||i!=null?Gf({strokeOpacity:.1}):null,h=[o?Yr([0]):null,s?Xr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?en(d,h,p):en(d,p,h)}function dy(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(zt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function zK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return jr(e)||(e=od(e)),jr(t)||(t=od(t)),jr(n)||(n=Qa(n)?{color:n}:od(n)),jr(r)||(r=od(r)),jr(i)&&({value:i}=od(i)),jr(o)&&({value:o}=od(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function uv(e,t){let n=wt(e,t.value);return n&&(n.label=On(t.value)),n}function od(e){return qK(e)?{reduce:e}:{value:e}}function fv(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function Z$(e){return/^(?:first|last|mode)$/i.test(e)}function qK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&pn(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 J$(e){return e?new Jn(e).size>e.length>>1:!1}var n3={dot:yi,line:Pl,lineX:uc,lineY:fc,areaX:cc,areaY:aa,ruleX:Yr,ruleY:Xr,barX:qo,barY:jo,rect:fy,rectX:rd,rectY:id,cell:lc,bin:sa,binX:Uo,binY:zo,group:Um,groupX:tc,groupY:ec},Q$=Object.fromEntries(Object.entries(n3).map(([e,t])=>[t,e]));function sd(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=G});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),vr(o,t)}function ad(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=G});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),vr(o,t)}function vr(e={},t={}){let n=jn(t),r=Object.entries(e).map(([i,o])=>{let s=aw(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=mn(s);return{key:i,input:s,output:a,setOutput:c,map:jK(o)}});return{...yn(t,(i,o)=>{let s=wt(i,n),a=r.map(({input:l})=>wt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?cn(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 jK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&pn(e))return VK(e);if(typeof e=="function")return i3(Mf(e));switch(`${e}`.toLowerCase()){case"cumsum":return XK;case"rank":return i3((t,n)=>rp(t,r=>n[r]));case"quantile":return i3((t,n)=>YK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function VK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function YK(e,t){let n=uo(e,t)-1;return rp(e,t).map(r=>r/n)}function i3(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 XK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function t9(e={},t){return arguments.length===1&&(t=e),sd(cd(e),t)}function e9(e={},t){return arguments.length===1&&(t=e),ad(cd(e),t)}function cd(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=WK(r),Vn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return HK(n)(t,GK(i,t),o)}function GK(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 WK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function HK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return dv(Sf(e));switch(e.toLowerCase()){case"deviation":return dv(ii);case"max":return hv((t,n)=>Wt(t,r=>n[r]));case"mean":return ZK;case"median":return dv(Pi);case"min":return hv((t,n)=>ue(t,r=>n[r]));case"mode":return hv((t,n)=>Ou(t,r=>n[r]));case"sum":return n9;case"variance":return dv(Ea);case"difference":return KK;case"ratio":return ttt;case"first":return ett;case"last":return ntt}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return hv(Mf(e))}function dv(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(Js(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(Js(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Js(i,c,c+t),a)}}}function hv(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=ze(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=ze(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Js(i,c,c+t),o)),a-=ze(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Js(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Js(i,a,a+t),o)}}}function n9(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 ZK(e,t,n){if(n){let r=n9(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 JK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(ze(o))return o}}function QK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(ze(o))return o}}function r9(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 i9(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 KK(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]]=i9(i,r,s,e)-r9(i,r,s,e)}}}function ttt(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]]=i9(i,r,s,e)/r9(i,r,s,e)}}}function ett(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]]=JK(i,r,s,e)}}}function ntt(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]]=QK(i,r,s,e)}}}var ca={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function o9(e,{x:t=G,y:n,k:r=ca.k,color:i=ca.color,opacity:o=ca.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return en(re(s)?null:cc(e,vr({x1:dc({k:-r,...f}),x2:dc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),re(c)?null:uc(e,vr({x:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function s9(e,{x:t,y:n=G,k:r=ca.k,color:i=ca.color,opacity:o=ca.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return en(re(s)?null:aa(e,vr({y1:dc({k:-r,...f}),y2:dc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),re(c)?null:fc(e,vr({y:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function dc({n:e=ca.n,k:t=0,strict:n=ca.strict,anchor:r=ca.anchor}={}){return cd({k:e,reduce:i=>Ns(i)+t*(ii(i)||0),strict:n,anchor:r})}var rtt={ariaLabel:"tick",fill:null,stroke:"currentColor"},pv=class extends St{constructor(t,n,r){super(t,n,r,rtt),Xi(this,r)}render(t,n,r,i,o){return ut("svg:g",o).call(Ct,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Lt,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(Qt,this,r).call(oa,this,r,o)).node()}},hy=class extends pv{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=Bt(s),this.insetBottom=Bt(a)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},Ce,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}},py=class extends pv{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=Bt(s),this.insetLeft=Bt(a)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,Ce)}_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 mv(e,{x:t=G,...n}={}){return new hy(e,{...n,x:t})}function yv(e,{y:t=G,...n}={}){return new py(e,{...n,y:t})}function a9(e,{x:t=G,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?ec:Pm;return en(Xr(e,u({x1:o3,x2:s3},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),qo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),mv(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,vr({x:l9},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function c9(e,{y:t=G,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?tc:Pm;return en(Yr(e,u({y1:o3,y2:s3},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),jo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),yv(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,vr({y:l9},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function l9(e){let t=o3(e),n=s3(e);return e.map(r=>r<t||r>n?r:NaN)}function o3(e){let t=u9(e)*2.5-f9(e)*1.5;return ue(e,n=>n>=t?n:NaN)}function s3(e){let t=f9(e)*2.5-u9(e)*1.5;return Wt(e,n=>n<=t?n:NaN)}function u9(e){return Qn(e,.25)}function f9(e){return Qn(e,.75)}var itt={ariaLabel:"raster",stroke:null,pixelSize:1};function ld(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function d9(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var yy=class extends St{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=d9(o,"width")),s!=null&&(s=d9(s,"height")),l!=null&&(l=ld(l,"x1")),u!=null&&(u=ld(u,"y1")),f!=null&&(f=ld(f,"x2")),d!=null&&(d=ld(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=dtt(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=htt(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=ld(h,"pixelSize"),this.blur=ld(p,"blur"),this.interpolate=a==null||c==null?null:ott(m)}},gy=class extends yy{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;se(o)[0]!==void 0&&(n=gv("fillOpacity",n)),Be(i)[0]!==void 0&&(n=gv("fill",n))}super(t,void 0,n,itt),this.imageRendering=fe(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]=p9(r,i,o),p=d-u,m=h-f,{pixelSize:g,width:y=Math.round(Math.abs(p)/g),height:x=Math.round(Math.abs(m)/g)}=this,b=y*x,{fill:w,fillOpacity:v}=r,_=0;if(this.interpolate){let M=y/p,N=x/m,F=Gt(a,k=>(k-u)*M,Float64Array),R=Gt(c,k=>(k-f)*N,Float64Array);w&&(w=this.interpolate(t,y,x,F,R,w)),v&&(v=this.interpolate(t,y,x,F,R,v))}else this.data==null&&t&&(_=t.fi*b);let I=l.createElement("canvas");I.width=y,I.height=x;let D=I.getContext("2d"),A=D.createImageData(y,x),E=A.data,{r:T,g:O,b:C}=on(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 F=s(w[M+_]);if(F==null){E[N+3]=0;continue}({r:T,g:O,b:C}=on(F))}v&&(S=v[M+_]*255),E[N+0]=T,E[N+1]=O,E[N+2]=C,E[N+3]=S}return this.blur>0&&$S(A,this.blur),D.putImageData(A,0,0),ut("svg:g",o).call(Ct,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(Lt,this).attr("xlink:href",I.toDataURL())).node()}};function a3(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&&VF(t)&&(r=Zs,i=Ha,o===void 0&&(o=PF)),[t,{...s,x:r,y:i,[e]:o}]}function h9(){let[e,t]=a3("fill",...arguments);return new gy(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function p9({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 c3({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),p9(Bf(a,i),o,s)}function gv(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return Ie({...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]=c3(o,s,a,c),m=h-f,g=p-d,{pixelSize:y}=this,{width:x=Math.round(Math.abs(m)/y),height:b=Math.round(Math.abs(g)/y)}=t,w=new Array(x*b*(i?i.length:1)),v=m/x,_=g/b,I=0;for(let D of i??[void 0])for(let A=.5;A<b;++A)for(let E=.5;E<x;++E,++I)w[I]=n(l.invert(f+E*v),u.invert(d+A*_),D);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function ott(e){if(typeof e=="function")return e;if(e==null)return xv;switch(`${e}`.toLowerCase()){case"none":return xv;case"nearest":return u3;case"barycentric":return l3();case"random-walk":return f3()}throw new Error(`invalid interpolate: ${e}`)}function xv(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 l3({random:e=Mo(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=Pn.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=ftt(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],g=c[h+2],y=a[2*p],x=a[2*m],b=a[2*g],w=a[2*p+1],v=a[2*m+1],_=a[2*g+1],I=Math.min(y,x,b),D=Math.max(y,x,b),A=Math.min(w,v,_),E=Math.max(w,v,_),T=(v-_)*(y-b)+(w-_)*(b-x);if(!T)continue;let O=s[t[p]],C=s[t[m]],S=s[t[g]];for(let M=Math.floor(I);M<D;++M)for(let N=Math.floor(A);N<E;++N){if(M<0||M>=n||N<0||N>=r)continue;let F=M+.5,R=N+.5,k=((v-_)*(F-b)+(R-_)*(b-x))/T;if(k<0)continue;let $=((_-w)*(F-b)+(R-_)*(y-b))/T;if($<0)continue;let P=1-k-$;if(P<0)continue;let U=M+n*N;u[U]=d(O,k,C,$,S,P,M,N),f[U]=1}}return stt(u,f,i,o,s,n,r,l,t,d),u}}function stt(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)=>ctt(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](y,p)){let w=att(n.at(b-1),r.at(b-1),n[b],r[b],y,p);e[g]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function att(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 my(e,t,n,r){return e*r-n*t}function ctt(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,g=c-u,y=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(g,y);return(v,_)=>{let I=v-s,D=_-a,A=v-c,E=_-l;return my(I,D,A,E)>-1e-6&&my(I,D,d,h)*b-my(I,D,p,m)*x>-1e-6&&my(A,E,g,y)*x-my(A,E,d,h)*w<=0}}function u3(e,t,n,r,i,o){let s=new o.constructor(t*n),a=Pn.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 f3({random:e=Mo(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Pn.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,x=p;h=d=u.find(y,x,d),g===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-y,a[r[h]]-x))>t&&w<n;){let v=e(g,p,w)*2*Math.PI;y+=Math.cos(v)*b,x+=Math.sin(v)*b,h=u.find(y,x,h),++w}l[m]=c[r[h]]}}return l}}function ltt(e,t,n,r,i,o){return t*e+r*n+o*i}function utt(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 ftt(e,t){return Ks(e)||Le(e)?ltt:utt(t)}function dtt(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 htt(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 m9={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},xy=class extends yy{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=vw({},i,m9);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:On(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=gv("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},ptt(i),m9);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=!!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=En();return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",l=>a(s[l])).call(Qt,this,r)}).node()}};function ptt({thresholds:e,interval:t,...n}){return e=QT(e,t,Na),Ie(n,function(r,i,o,s,a,c){let[l,u,f,d]=c3(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:g=Math.round(Math.abs(h)/m),height:y=Math.round(Math.abs(p)/m)}=this,x=g/h,b=y/p,w=o.value.value,v=[];if(this.interpolate){let{x:E,y:T}=rc(o,s,c),O=Gt(E,N=>(N-l)*x,Float64Array),C=Gt(T,N=>(N-u)*b,Float64Array),S=[o.x,o.y,o.value],M=[O,C,w];for(let N of i){let F=this.filter(N,S,M);v.push(this.interpolate(F,g,y,O,C,w))}}else if(i){let E=g*y,T=i.length;for(let O=0;O<T;++O)v.push(w.slice(O*E,O*E+E))}else v.push(w);if(this.blur>0)for(let E of v)Qh({data:E,width:g,height:y},this.blur);let _=mtt(e,w,...ytt(v));if(_===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:I}=Fa().size([g,y]).smooth(this.smooth),D=[],A=[];for(let E of v)A.push(Ue(D.length,D.push(...Gt(_,T=>I(E,T)))));for(let{coordinates:E}of D)for(let T of E)for(let O of T)for(let C of O)C[0]=C[0]/x+l,C[1]=C[1]/b+u;return{data:D,facets:A,channels:xw(this.contourChannels,D)}})}function mtt(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 je(e);let i=Mn(...Nu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function g9(){return new xy(...a3("value",...arguments))}function ytt(e){return[ue(e,t=>ue(t,y9)),Wt(e,t=>Wt(t,y9))]}function y9(e){return isFinite(e)?e:NaN}function w9(e,t){return d3(qf,e,t)}function v9(e,t={}){return d3(jf,e,t)}function _9(e,t={}){return d3(El,e,t)}function d3(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Yr(t,x9("x",{...s,inset:-6},n))),i!=null&&a.push(Xr(t,x9("y",{...s,inset:-6},n))),r!=null&&a.push(Po(t,b9("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Po(t,b9("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return en(...a)}function S9(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:gtt(e,u)}}function gtt(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 x9(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...S9(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function b9(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...S9(e,t,xtt(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function xtt(e,t){return Ie(t,(n,r,i)=>({channels:{text:{value:qm(i,e)?.value}}}))}var btt={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},wtt={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},vtt={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},_tt={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Stt={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},h3=class extends St{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,btt),this.curve=ry(s,a),Xi(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]=gn(this,i),p=c?x=>c[x]:hn(d),m=l?x=>l[x]:hn(h),g=this;function y(x){let b=-1,w=[],v={};for(let S in r)v[S]=[];let _=[],I=[],D=[],A=[];function E(S,M){S=x[S],M=x[M],w.push(++b),_[b]=p(S),D[b]=m(S),I[b]=p(M),A[b]=m(M);for(let N in r)v[N].push(r[N][M])}let{halfedges:T,hull:O,triangles:C}=Pn.from(x,p,m);for(let S=0;S<T.length;++S){let M=T[S];M>S&&E(C[S],C[M])}for(let S=0;S<O.length;++S)E(O[S],O[(S+1)%O.length]);Vt(this).selectAll().data(w).enter().append("path").call(Lt,g).attr("d",S=>{let M=er(),N=f(M);return N.lineStart(),N.point(_[S],D[S]),N.point(I[S],A[S]),N.lineEnd(),M}).call(Qt,g,v).call(oa,g,v,o)}return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(cn(t,b=>u[b]).values()).enter().append("g").each(y):x=>x.datum(t).each(y)).node()}},by=class extends St{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]=gn(this,i),h=c?y=>c[y]:hn(f),p=l?y=>l[y]:hn(d),m=this;function g(y){let x=Pn.from(y,h,p);Vt(this).append("path").datum(y[0]).call(Lt,m).attr("d",m._render(x,i)).call(Qt,m,r)}return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(cn(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},p3=class extends by{constructor(t,n={}){super(t,n,wtt),this.fill="none"}_render(t){return t.render()}},m3=class extends by{constructor(t,n={}){super(t,n,vtt,jn)}_render(t){return t.renderHull()}},y3=class extends St{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}},n,_tt)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=gn(this,i),h=c?y=>c[y]:hn(f),p=l?y=>l[y]:hn(d),m=this;function g(y){let x=Pn.from(y,h,p),b=I9(x,i);Vt(this).selectAll().data(y).enter().append("path").call(Lt,m).attr("d",(w,v)=>b.renderCell(v)).call(Qt,m,r)}return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(cn(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},g3=class extends by{constructor(t,n){super(t,n,Stt),this.fill="none"}_render(t,n){return I9(t,n).render()}};function I9(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 wy(e,t,{x:n,y:r,...i}={}){return[n,r]=$e(n,r),new e(t,{...i,x:n,y:r})}function M9(e,t){return wy(h3,e,t)}function A9(e,t){return wy(p3,e,t)}function T9(e,t){return wy(m3,e,t)}function E9(e,t){return wy(y3,e,t)}function N9(e,t){return wy(g3,e,t)}var Itt={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},vy=class extends St{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=D9(s)&&(s="currentColor",!0),u=D9(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:jn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Att({...c,fill:s,stroke:a},l,u),Itt),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=En();return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Lt,this).call(Qt,this,r).attr("d",l=>a(s[l]))).node()}};function O9(e,{x:t,y:n,...r}={}){return[t,n]=$e(t,n),new vy(e,{...r,x:t,y:n})}var Mtt=new Set(["x","y","z","weight"]);function Att(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"?Ke(o):+o,Ie(e,function(s,a,c,l,u,f){let d=c.weight?Ke(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,g]=gn(this,u),{width:y,height:x}=u,{x:b,y:w}=rc(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([C])=>!Mtt.has(C)).map(([C,S])=>[C,{...S,value:[]}])),_=t&&[],I=n&&[],D=AI().x(b?C=>b[C]:m).y(w?C=>w[C]:g).weight(d?C=>d[C]:1).size([y,x]).bandwidth(i),A=[];for(let C of a){let S=[];A.push(S);for(let M of h?Vm(C,h,p):[C]){let N=D.contours(M);S.push([M,N])}}let E=o;if(!(E instanceof _l)){let C=0;for(let S of A)for(let[,M]of S){let N=M.max;N>C&&(C=N)}E=Float64Array.from({length:o-1},(S,M)=>C*100*(M+1)/o)}let T=[],O=[];for(let C of A){let S=[];T.push(S);for(let[M,N]of C)for(let F of E){S.push(O.length),O.push(N(F/100)),_&&_.push(F),I&&I.push(F);for(let R in v)v[R].value.push(c[R].value[M[0]])}}return _&&_.push(0),I&&I.push(0),{data:s,facets:T,channels:{...v,..._&&{fill:{value:_,scale:"color"}},...I&&{stroke:{value:I,scale:"color"}},contours:{value:O}}}})}function D9(e){return/^density$/i.test(e)}function C9(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ee:void 0,y:s=r===void 0&&i===void 0?G:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:m=Be(h)[0],clip:g,tip:y,render:x,...b}={}){return[t,n]=B9(o,t,n),[r,i]=B9(s,r,i),t===n&&r===i&&(r=hc(0)),{tip:y}=Yi({tip:y},"x"),en(re(c)?null:Object.assign(iy(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:zf(x,L9(!0)),clip:g,...b}),{ariaLabel:"positive difference"}),re(l)?null:Object.assign(iy(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:d,render:zf(x,L9(!1)),clip:g,...b}),{ariaLabel:"negative difference"}),Pl(e,{x:n,y:i,z:m,stroke:h,strokeOpacity:p,tip:y,clip:!0,...b}))}function B9(e,t,n){return t===void 0&&n===void 0?t=n=hc(e):t===void 0?(n=hc(n),t=e===void 0?n:hc(e)):n===void 0?(t=hc(t),n=e===void 0?t:hc(e)):(t=hc(t),n=hc(n)),[t,n]}function hc(e){let t,{value:n,label:r=On(n)}=pi(e);return{transform:i=>t||(t=wt(i,n)),label:r}}function L9(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===Ew(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,m=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let y=ww(),x=ut("svg:clipPath",o).attr("id",y).node();x.appendChild(p.firstChild),m.childNodes[g].setAttribute("clip-path",`url(#${y})`),m.insertBefore(x,m.childNodes[g])}return h}}var Ttt={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},_y=class extends St{constructor(t,n={}){let[r,i]=se(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:sr,optional:!0}},uy(n),Ttt),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=En(o.projection??Ett(n)),{r:l}=this;return Va(l)?t=[]:l!==void 0&&c.pointRadius(l),ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Lt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Qt,this,r)}).node()}};function Ett({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,cl({point(n,r){this.stream.point(e(n),t(r))}})}function bv(e,{geometry:t=G,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new _y(e,{geometry:t,...n})}function k9({strokeWidth:e=1.5,...t}={}){return bv({type:"Sphere"},{strokeWidth:e,...t})}function F9({strokeOpacity:e=.1,...t}={}){return bv(WI(),{strokeOpacity:e,...t})}var ud=.5,fd=0;function R9(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Bt(t),e=cT(e,n),Ro(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Ro(e,"r")&&(n.r=t/2),Ie(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}=rc(s,a,l)),d=d?d.value:wt(i,r),h=h?.value,p=p?.value,m=m?.value;let g=zm(e,{z:d,fill:h,stroke:p,symbol:m}),y=d&&[],x=h&&[],b=p&&[],w=m&&[],v=[],_=[],I=[],D=-1;for(let O of e)O.initialize(i);for(let O of o){let C=[];for(let S of e)S.scope("facet",O);for(let[S,M]of Ka(O,g))for(let{index:N,extent:F}of Ntt(i,M,u,f,t)){C.push(++D),_.push(F.x),I.push(F.y),d&&y.push(g===d?S:d[N[0]]),h&&x.push(g===h?S:h[N[0]]),p&&b.push(g===p?S:p[N[0]]),m&&w.push(g===m?S:m[N[0]]);for(let R of e)R.reduce(N,F)}v.push(C)}let A=s.x.scale,E=s.y.scale,T={x:{value:_,source:a[A]?{value:Gt(_,a[A].invert),scale:A}:null},y:{value:I,source:a[E]?{value:Gt(I,a[E].invert),scale:E}:null},...d&&{z:{value:y}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:C})=>[O,{scale:"auto",label:C.label,radius:O==="r"?t/2:void 0,value:C.transform()}]))};return{data:i,facets:v,channels:T}})}function Ntt(e,t,n,r,i){let o=i*(1.5/QA),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-fd)/o),f=Math.round(c=(c-ud)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,g=f+(c<f?-1:1)/2,y=u+(l<u?-1:1),x=c-g,b=l-y;m*m+d*d>x*x+b*b&&(f=g+(u&1?1:-1)/2,u=y)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+ud,y:u*o+fd}},s.set(h,p)),p.index.push(a)}return s.values()}var Dtt={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function $9(e){return new Sy(e)}var Sy=class extends St{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Wa,void 0,{clip:n,...r},Dtt),this.binWidth=Bt(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-ud,p=f-c-ud,m=a-fd,g=d-l-fd,y=s/2,x=y*KA,b=x/2,w=y*2,v=x*1.5,_=Math.floor(h/w),I=Math.ceil(p/w),D=Math.floor((m+b)/v),A=Math.ceil((g-b)/v)+1,E=`m0,${pc(-x)}l${pc(y)},${pc(b)}v${pc(x)}l${pc(-y)},${pc(b)}`,T=E;for(let O=D;O<A;++O)for(let C=_;C<I;++C)T+=`M${pc(C*w+(O&1)*y)},${pc(O*v)}${E}`;return ut("svg:g",o).datum(0).call(Ct,this,i,o).call(Et,this,{},Ce+ud,Ce+fd).call(O=>O.append("path").call(Lt,this).call(Qt,this,r).attr("d",T)).node()}};function pc(e){return Math.round(e*1e3)/1e3}var Ott={ariaLabel:"image",fill:null,stroke:null};function Btt(e){return/^\.*\//.test(e)}function Ltt(e){return/^(blob|data|file|http|https):/i.test(e)}function Ctt(e){return typeof e=="string"&&(Btt(e)||Ltt(e))?[void 0,e]:[e,void 0]}var Iy=class extends St{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]=Ctt(l),[g,y]=se(o),[x,b]=se(s,y!==void 0?y*2:void 0),[w,v]=se(a,y!==void 0?y*2:void 0),[_,I]=se(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:sr,optional:!0},width:{value:x,filter:sr,optional:!0},height:{value:w,filter:sr,optional:!0},rotate:{value:_,optional:!0},src:{value:p,optional:!0}},uy(n),Ott),this.src=m,this.width=b,this.rotate=I,this.height=v,this.r=y,this.preserveAspectRatio=fe(u,"xMidYMid"),this.crossOrigin=qe(f),this.frameAnchor=Fo(d),this.imageRendering=fe(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:g,height:y,rotate:x}=this,[b,w]=gn(this,i);return ut("svg:g",o).call(Ct,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Lt,this).attr("x",P9(c,u,d,b,g,m)).attr("y",P9(l,f,d,w,y,m)).attr("width",u?_=>u[_]:g!==void 0?g:d?_=>d[_]*2:m*2).attr("height",f?_=>f[_]:y!==void 0?y:d?_=>d[_]*2:m*2).attr("transform",h?_=>`rotate(${h[_]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?oc`${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(Qt,this,r)).node()}};function P9(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 U9(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=$e(t,n)),new Iy(e,{...r,x:t,y:n})}function ktt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;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)),g=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*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-dd(t)-dd(n)+dd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Ftt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),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 Ftt(e,t,n){var r=e===0||e===1?0:Math.exp(dd(t+n)-dd(t)-dd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*z9(e,t,n)/t:1-r*z9(1-e,n,t)/n}function z9(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 dd(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 q9(e,t){var n=ktt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Rtt={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},wv=class extends St{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:jn(n),optional:!0}},n,Rtt),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 ut("svg:g",o).call(Ct,this,i,o).call(Et,this,n).call(u=>u.selectAll().data(c?Vm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Lt,this).call(Tl,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!ta(this.fill)?d=>d.select($tt).attr("stroke","none").call(Lt,this).call(Tl,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function $tt(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(oi.svg,"path"),this)}var x3=class extends wv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=le(t,u=>r[u]),c=vv(t,r,n),l=Y9(t,r,n,(1-i)/2,c);return hf().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=le(t,a=>r[a]),s=vv(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},b3=class extends wv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=le(t,u=>n[u]),c=vv(t,n,r),l=Y9(t,n,r,(1-i)/2,c);return hf().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=le(t,a=>n[a]),s=vv(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function j9(e,{y:t=Ee,x:n=G,stroke:r,fill:i=re(r)?"currentColor":r,...o}={}){return new x3(e,Hf({...o,x:n,y:t,fill:i,stroke:r}))}function V9(e,{x:t=Ee,y:n=G,stroke:r,fill:i=re(r)?"currentColor":r,...o}={}){return new b3(e,Wf({...o,x:t,y:n,fill:i,stroke:r}))}function vv(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 Y9(e,t,n,r,i){let o=An(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=q9(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 My({path:e=G,delimiter:t,frameAnchor:n,treeLayout:r=ll,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=Mv(s),i=W9(i),a!=null&&(a=v3(a)),n===void 0&&(n=s.frameAnchor);let l=H9(t),u=nP(c,v3),[f,d]=mn(),[h,p]=mn();return{x:f,y:h,frameAnchor:n,...yn(c,(m,g)=>{let y=l(wt(m,e)),x=d([]),b=p([]),w=-1,v=[],_=[],I=bb().path(A=>y[A]),D=r();D.nodeSize&&D.nodeSize([1,1]),D.separation&&o!==void 0&&D.separation(o??km);for(let A of u)A[Sv]=A[tP]([]);for(let A of g){let E=[],T=I(A.filter(O=>y[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&T.sort(i),D(T);for(let O of T.descendants())if(!(a!=null&&!a(O))){E.push(++w),v[w]=O.data,s.position(O,w,x,b);for(let C of u)C[Sv][w]=C[eP](O)}_.push(E)}return{data:v,facets:_}}),...Object.fromEntries(u)}}function Iv({path:e=G,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=ll,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=Mv(l),a=W9(a),u!=null&&(u=G9(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=H9(t),h=nP(f,G9),[p,m]=mn(),[g,y]=mn(),[x,b]=mn(),[w,v]=mn();return{x1:p,x2:g,y1:x,y2:w,...yn(f,(_,I)=>{let D=d(wt(_,e)),A=m([]),E=y([]),T=b([]),O=v([]),C=-1,S=[],M=[],N=bb().path(R=>D[R]),F=s();F.nodeSize&&F.nodeSize([1,1]),F.separation&&c!==void 0&&F.separation(c??km);for(let R of h)R[Sv]=R[tP]([]);for(let R of I){let k=[],$=N(R.filter(P=>D[P]!=null)).each(P=>P.data=_[P.data]);a!=null&&$.sort(a),F($);for(let{source:P,target:U}of $.links())if(!(u!=null&&!u(U,P))){k.push(++C),S[C]=U.data,l.position(P,C,A,T),l.position(U,C,E,O);for(let W of h)W[Sv][C]=W[eP](U,P)}M.push(k)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function Mv(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Ptt;case"right":return Utt}throw new Error(`invalid tree anchor: ${e}`)}var Ptt={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},Utt={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function W9(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?X9(v3(e)):X9(ztt(e))}function X9(e){return(t,n)=>dn(e(t),e(n))}function ztt(e){return t=>t.data?.[e]}function H9(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=>qtt(r,t))}var w3=92,Z9=47;function qtt(e,t){if(t===w3)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 w3: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 Z9: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 jtt(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case w3:if(!t){t=!0;continue}case Z9:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function J9(e){return pn(e)&&typeof e.node=="function"}function Vtt(e){return pn(e)&&typeof e.link=="function"}function v3(e){if(J9(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return S3;case"node:path":return _3;case"node:internal":return Q9;case"node:external":return K9;case"node:depth":return I3;case"node:height":return M3}throw new Error(`invalid node value: ${e}`)}}function G9(e){if(J9(e))return e.node;if(Vtt(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return _v(S3);case"parent:path":return _v(_3);case"parent:depth":return _v(I3);case"parent:height":return _v(M3);case"node:name":return S3;case"node:path":return _3;case"node:internal":return Q9;case"node:external":return K9;case"node:depth":return I3;case"node:height":return M3}throw new Error(`invalid link value: ${e}`)}}function _3(e){return e.id}function S3(e){return Ytt(e.id)}function I3(e){return e.depth}function M3(e){return e.height}function Q9(e){return!!e.children}function K9(e){return!e.children}function _v(e){return(t,n)=>n==null?void 0:e(n)}function Ytt(e){let t=e.length;for(;--t>0&&!Xtt(e,t););return jtt(e.slice(t+1))}function Xtt(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var tP=2,eP=3,Sv=4;function nP(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...mn(i),o])}return n}function A3(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=re(f)&&re(d),text:p="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:x,textAnchor:b,treeLayout:w=ll,textLayout:v=w===ll||w===gb?"mirrored":"normal",tip:_,...I}={}){if(y===void 0&&(y=Mv(I.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");v=tn(v,"textLayout",["mirrored","normal"]);function D(A){return Po(e,My({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:y,dy:x,title:g,...A,...I}))}return en(lv(e,Iv({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,...I})),h?yi(e,My({treeLayout:w,fill:t===void 0?"node:internal":t,title:g,tip:_,...I})):null,p!=null?v==="mirrored"?[D({textAnchor:"start",treeFilter:"node:external"}),D({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:D():null)}function rP(e,t){return A3(e,{...t,treeLayout:gb})}function iP({geometry:e=G,...t}={}){return Ie({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=wt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=En(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function oP({geometry:e=G,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=wt(wt(r,e),qI),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var yP=yz(mP(),1);var tet=({marginLeft:e})=>[1,e],eet=({width:e,marginRight:t})=>[-1,e-t],net=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],ret=({marginTop:e})=>[1,e],iet=({height:e,marginBottom:t})=>[-1,e-t],oet=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function gP(e){return typeof e=="string"?{anchor:e}:e}function xP(e={},t={}){arguments.length===1&&([e,t]=wP(e));let{anchor:n="left",padding:r=1,r:i=t.r}=gP(e);switch(`${n}`.toLowerCase()){case"left":n=tet;break;case"right":n=eet;break;case"middle":n=net;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return vP("x","y",n,Bt(r),i,t)}function bP(e={},t={}){arguments.length===1&&([e,t]=wP(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=gP(e);switch(`${n}`.toLowerCase()){case"top":n=ret;break;case"bottom":n=iet;break;case"middle":n=oet;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return vP("y","x",n,Bt(r),i,t)}function wP(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function vP(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Rm(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 Ie(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}=rc(c,l,f));let p=h?void 0:i!==void 0?Bt(i):this.r!==void 0?this.r:3;h&&(h=wt(h.value,l[h.scale]||G,Float64Array));let[m,g]=n(u),y=m?aet:set,x=new Float64Array(d.length),b=h?w=>h[w]:()=>p;for(let w of a){let v=(0,yP.default)();w=w.filter(h?I=>xf(d[I])&&sr(h[I]):I=>xf(d[I]));let _=new Float64Array(2*w.length+2);for(let I of w){let D=b(I),A=m?D+r:0,E=d[I]-D,T=d[I]+D,O=2;v.queryInterval(E-r,T+r,([,,S])=>{let M=x[S]-A,N=d[I]-d[S],F=r+(h?h[I]+h[S]:2*p),R=Math.sqrt(F*F-N*N);_[O++]=M-R,_[O++]=M+R});let C=_.slice(0,O);m&&(C=C.filter(S=>S>=0));t:for(let S of C.sort(y)){for(let M=0;M<O;M+=2)if(_[M]+1e-6<S&&S<_[M+1]-1e-6)continue t;x[I]=S+A;break}v.insert([E,T,I])}}m||(m=1);for(let w of a)for(let v of w)x[v]=x[v]*m+g;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 set(e,t){return Math.abs(e)-Math.abs(t)}function aet(e,t){return e-t}function SP(e,t){return arguments.length===1&&({basis:e,...t}=e),sd(Ev(e),t)}function IP(e,t){return arguments.length===1&&({basis:e,...t}=e),ad(Ev(e),t)}function Ev(e){if(e===void 0)return _P;if(typeof e=="function")return Nv(Mf(e));if(/^p\d{2}$/i.test(e))return yd(Sf(e));switch(`${e}`.toLowerCase()){case"deviation":return fet;case"first":return _P;case"last":return uet;case"max":return det;case"mean":return het;case"median":return pet;case"min":return met;case"sum":return yet;case"extent":return cet}throw new Error(`invalid basis: ${e}`)}function Nv(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 yd(e){return Nv((t,n)=>e(t,r=>n[r]))}var cet={mapIndex(e,t,n){let[r,i]=le(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},_P=Nv((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(ze(r))return r}}),uet=Nv((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(ze(r))return r}}),fet={mapIndex(e,t,n){let r=Ns(e,o=>t[o]),i=ii(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},det=yd(Wt),het=yd(Ns),pet=yd(Pi),met=yd(ue),yet=yd(An);function MP(e,t){return get("x",e,t)}function get(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]=sw(t.replace(/^[+-]/,"")),i*=l}t=Tf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=vr({[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]=le(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function AP(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return B3(t);case"last":return L3(t)}if(typeof e=="function")return mc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=xet(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return mc(n,r,t)}function xet(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return C3;case"max":return k3}throw new Error(`unknown selector: ${e}`)}function B3(e){return mc(null,bet,e)}function L3(e){return mc(null,wet,e)}function TP(e){return mc("x",C3,e)}function EP(e){return mc("y",C3,e)}function NP(e){return mc("x",k3,e)}function DP(e){return mc("y",k3,e)}function*bet(e){yield e[0]}function*wet(e){yield e[e.length-1]}function*C3(e,t){yield ex(e,n=>t[n])}function*k3(e,t){yield Xc(e,n=>t[n])}function mc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=jn(n);return yn(n,(i,o)=>{let s=wt(i,r),a=wt(i,e),c=[];for(let l of o){let u=[];for(let f of s?cn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var vet=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"],["round","round"],["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"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["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"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["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"],["fxNice","fx.nice"],["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"],["fyNice","fy.mice"],["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"],["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"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["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"],["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 _et(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 OP(e,t,n){for(let r in e){let i=vet.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&&_et(t,i.split("."),o)}}var Iet=new Set(["frame","hexgrid","sphere","graticule"]);async function LP(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;OP(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())Iet.has(c)?t.marks.push(Dv[c](u)):t.marks.push(Dv[c](l,u)),o.push(a.index);Aet(t,e);let s=ny(t);Tet(s,o),Met(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function Met(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===lo){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 Aet(e,t){let{marks:n}=t;Ov("x",e,n),Ov("y",e,n),Ov("fx",e,n),Ov("fy",e,n)}function Ov(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=Eet(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 Tet(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)BP(r,t);else BP(e,t)}function BP(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 Eet(e,t){for(let n of e){let r=n[t]??n[t+"1"]??n[t+"2"];if(r!=null)return r instanceof Date?"date":typeof r}}var Net={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Ey=class{constructor(t){this.attributes={...Net},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=RS()}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&&t!=null&&(i=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 LP(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 Hh(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.requestQuery()))))}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 Bv(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Rr(e)!==null)}var Det=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"]);function CP(e){return Det.has(e)}var Oet=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function kP(e){return Oet.has(`${e}`.toLowerCase())}function Lv(e){return Su(e)?Bet(e):e}function Bet(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=Gh(h);for(let m=i,g=0;g<c;++g,++m)r[m][d]=p(f.get(g))}i+=c}return r}var FP=e=>e==="stroke"||e==="fill",Let=e=>e==="symbol",Cet=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),F3=(e,t)=>({channel:e,field:t,as:t instanceof xr?t.column:e}),R3=(e,t)=>({channel:e,value:t}),Cv=e=>Array.isArray(e),Bn=class extends ur{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Cv(this.source)&&(this.data=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[Zh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")CP(l)||FP(l)&&Bv(u)||Let(l)&&kP(u)?o.push(R3(l,u)):o.push(F3(l,Ia(u)));else if(ws(u))if(Array.isArray(u.columns))o.push(F3(l,u)),a.add(u);else{let d=R3(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&Cet(l,u)?o.push(F3(l,u)):u!==void 0&&o.push(R3(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||Cv(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(n=>n.channel===t)}channelField(t,{exact:n}={}){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 $3(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Lv(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=gi(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function gi(e){return Object.hasOwn(e,"value")?e.value:FP(e.channel)?{value:e.as,scale:"color"}:e.as}function $3(e,t,n=[]){let r=ht.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 ql(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 Yh(i)}function Gr(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=ql(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),g=m!==1?` * ${m}::DOUBLE`:"";return[u?q`(${d} - ${h}::DOUBLE)${g}`:q`(${h}::DOUBLE - ${f})${g}`,p]}var P3={x:["min","max"]},U3={y:["min","max"]},kv={...P3,...U3};function RP(e,t,n,r,i){let{plot:o}=e,s=o.getAttribute(r),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Sn])return s;{let{column:c,min:l,max:u}=e.channelField(n),f=z3(t,c)||(a?Ps().domain([l,u]).nice().domain():[l,u]);return s!==lo&&(f[Sn]=!0),o.setAttribute(r,f,{silent:!0}),f}}function Vo(e,t){return RP(e,t,"x","xDomain","xNice")}function Yo(e,t){return RP(e,t,"y","yDomain","yNice")}function z3(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 Ny=class extends Bn{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(),[g,y]=z3(t,l)||[d,h],[x]=Gr(this,r,m,[g,y],1,u),b=s.select().map(w=>w.as).filter(w=>w!==u&&w!==c);return ket(s,x,u,c,b)}else return s.orderby(l)}};function ket(e,t,n,r,i=[]){let o=q`FLOOR(${t})::INTEGER`,s=a=>ht.from(e).select(a).groupby(o,i);return ht.union(s([{[n]:ei(n),[r]:wu(r,n)},...i]),s([{[n]:ti(n),[r]:vu(r,n)},...i]),s([{[n]:wu(n,r),[r]:ei(r)},...i]),s([{[n]:vu(n,r),[r]:ti(r)},...i])).orderby(i,n)}function $P(e,t="density"){return Su(e)?kS(e.getChild(t).type):typeof e[0]?.[t]=="number"?Float64Array:Array}function PP(e,t,n="density"){let r=new($P(t))(e);if(Su(t)){let i=t.numRows;if(i===0)return r;let o=Iu(t.getChild("index")),s=Iu(t.getChild(n));for(let a=0;a<i;++a)r[o[a]]=s[a]}else for(let i of t)r[i.index]=i[n];return r}function UP(e,t,n,r,i=[],o){let s=e*t,a=r.map(y=>$P(n,y)),c=r.length,l=y=>{let x={};return i.forEach((b,w)=>x[b]=y[w]),r.forEach((b,w)=>x[b]=new a[w](s)),x},u={},f=i.length?null:u[[]]=l([]),d=i.length?y=>u[y]??(u[y]=l(y)):()=>f,h=n.numRows;if(h===0)return Object.values(u);let p=Iu(n.getChild("index")),m=r.map(y=>Iu(n.getChild(y))),g=i.map(y=>n.getChild(y));if(o){let y=p.map(b=>b%e),x=p.map(b=>Math.floor(b/e));if(i.length)for(let b=0;b<h;++b){let w=g.map(_=>_.get(b)),v=d(w);v.index||(v.index=[]),v.index.push(b)}else f.index=p.map((b,w)=>w);Object.values(u).forEach(b=>{for(let w=0;w<c;++w)o(b.index,e,t,y,x,m[w],b[r[w]]);delete b.index})}else for(let y=0;y<h;++y){let x=g.map(w=>w.get(y)),b=d(x);for(let w=0;w<c;++w)b[r[w]][p[y]]=m[w][y]}return Object.values(u)}function Dy(e,t){let n=0,r=0;return e.forEach(i=>{let o=i[t],s=o.length;for(let a=0;a<s;++a){let c=o[a];c<n&&(n=c),c>r&&(r=c)}}),n===0&&r===0?[0,1]:[n,r]}function zP(e,t){let n=new Jn;return e.forEach(r=>{let i=r[t],o=i.length;for(let s=0;s<o;++s)n.add(i[s])}),Array.from(n).sort(zt)}function Ln(e,t,n,r){br(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function Oy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Fet(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 Fet(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 qP(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);Fv(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);Fv(t,u,i,r,o,s,a,u)}return c}function Fv(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Ret){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 Ret(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,g;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,g=1;g<=a&&g<=m;++g)l[m]-=s[g]*l[m-g];for(g=0;g<a;++g)for(e[g]=0,m=1;m<=g;++m)p=h+r*m,p>=0&&p<d&&(e[g]+=l[g-m]*t[p]);let y=t[h],x=Math.ceil(u*10);for(m=0;m<x;++m){for(g=0;g<a;++g)e[g]+=l[g]*y;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,g=1;g<=a;++g)l[a]-=s[g]*l[a-g];for(g=0;g<a;++g)l[g]=l[g+1]}}function jP({random:e=Mo(42)}={}){return(t,n,r,i,o,s,a)=>{let{points:c,triangles:l,hull:u}=Pn.from(t,h=>i[h],h=>o[h]),f=new Uint8Array(n*r),d=jet(s,e);for(let h=0;h<l.length;h+=3){let p=l[h],m=l[h+1],g=l[h+2],y=c[2*p],x=c[2*m],b=c[2*g],w=c[2*p+1],v=c[2*m+1],_=c[2*g+1],I=Math.min(y,x,b),D=Math.max(y,x,b),A=Math.min(w,v,_),E=Math.max(w,v,_),T=(v-_)*(y-b)+(w-_)*(b-x);if(!T)continue;let O=s[t[p]],C=s[t[m]],S=s[t[g]];for(let M=Math.floor(I);M<D;++M)for(let N=Math.floor(A);N<E;++N){if(M<0||M>=n||N<0||N>=r)continue;let F=M+.5,R=N+.5,k=((v-_)*(F-b)+(R-_)*(b-x))/T;if(k<0)continue;let $=((_-w)*(F-b)+(R-_)*(y-b))/T;if($<0)continue;let P=1-k-$;if(P<0)continue;let U=M+n*N;a[U]=d(O,k,C,$,S,P,M,N),f[U]=1}}return $et(a,f,i,o,s,n,r,u,t,d),a}}function $et(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)=>Uet(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](y,p)){let w=Pet(n.at(b-1),r.at(b-1),n[b],r[b],y,p);e[g]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function Pet(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 By(e,t,n,r){return e*r-n*t}function Uet(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,g=c-u,y=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(g,y);return(v,_)=>{let I=v-s,D=_-a,A=v-c,E=_-l;return By(I,D,A,E)>-1e-6&&By(I,D,d,h)*b-By(I,D,p,m)*x>-1e-6&&By(A,E,g,y)*x-By(A,E,d,h)*w<=0}}function VP(e,t,n,r,i,o,s){let a=Pn.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 YP({random:e=Mo(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c,l)=>{let u=Pn.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,x=p;h=d=u.find(y,x,d),g===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-y,a[r[h]]-x))>t&&w<n;){let v=e(g,p,w)*2*Math.PI;y+=Math.cos(v)*b,x+=Math.sin(v)*b,h=u.find(y,x,h),++w}l[m]=c[r[h]]}}return l}}function zet(e,t,n,r,i,o){return t*e+r*n+o*i}function qet(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 jet(e,t){return Vet(e)||Yet(e)?zet:qet(t)}function Vet(e){for(let t of e)if(t!=null)return typeof t=="number"}function Yet(e){for(let t of e)if(t!=null)return t instanceof Date}var la="density",Gi=class extends Bn{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=Xet(u);super(t,n,u,kv),this.densityMap=f,Ln(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),Ln(this,"pixelSize",s),Ln(this,"interpolate",o),Ln(this,"pad",a),Ln(this,"width",c),Ln(this,"height",l)}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=Vo(this,t),[l,u]=this.extentY=Yo(this,t),[f,d]=this.bins=this.binDimensions(this),[h,p]=Gr(this,"x",f,[a,c],r),[m,g]=Gr(this,"y",d,[l,u],r),y=r?[Ae(p,[+a,+c]),Ae(g,[+l,+u])]:[Is(+a,p),Ss(p,+c),Is(+l,g),Ss(g,+u)],x=ht.from(s.table).where(t.concat(y)),b=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:I,channel:D,field:A}=_;A.aggregate?(w[D]=A,o[D]=!0):D==="weight"?w[la]=Fr(A):D!=="x"&&D!=="y"&&(x.select({[I]:A}),b.push(I))}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(la),w.density=kr()),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 Het(x,h,m,w[la],f,b)}else return Wet(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=Get(this.interpolate);return this.grids=UP(n,r,t,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids:i,plot:o}=this;if(this.kde=this.grids,n>0){let s=t.length===1?t[0]:t.includes(la)?la:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.innerWidth(),c=o.innerHeight(),[l,u]=r,f=i.some(p=>p[s].some(m=>m<0)),d=Oy(n*(l-1)/a,f),h=Oy(n*(u-1)/c,f);this.kde=this.grids.map(p=>{let m=qP(d,h,p[s],r);return{...p,[s]:m}})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function Xet(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function Get(e="none"){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":case"linear":return;case"nearest":return VP;case"barycentric":return jP();case"random-walk":return YP()}throw new Error(`invalid interpolate: ${e}`)}function Wet(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Het(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 ht.from(ht.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(zc("density",0))}var Ly=class extends Gi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),Ln(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,plot:o}=this,s=i;if(!Array.isArray(s)){let[,w]=Dy(r,"density");s=Array.from({length:s-1},(v,_)=>w*(_+1)/s)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[a,c]=t,[l,u]=o.getAttribute("xDomain"),[f,d]=o.getAttribute("yDomain"),h=(u-l)/a,p=(d-f)/c,m=+l,g=+f,y=w=>m+w*h,x=w=>g+w*p,b=Fa().size(t);return this.data=r.flatMap(w=>s.map(v=>Object.assign(Zet(b.contour(w.density,v),y,x),{...w,density:v}))),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=gi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function Zet(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 Rv(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 XP(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 GP(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 WP(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?on(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 HP(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"?on(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 ZP(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"?on(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 yc=class extends Gi{constructor(t,n){super("image",t,n)}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,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=tnt(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=q3(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}},Cy=class extends yc{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function q3(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(la),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":Bv(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"?la:null),d=c?.as??(u==="grid"?la:null),h=l!=="grid"&&l!=="group"?WP(l):Qet(e,f),p=u!=="grid"?XP(u):Jet(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Jet(e,t){let{plot:n,kde:r}=e,i=n.getAttribute("opacityDomain"),o=i===lo,s=i?.[Sn],a=!o&&!s&&i||Dy(r,t);(o||s)&&(s&&(a[Sn]=!0),n.setAttribute("colorDomain",a));let c=Uf({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 GP(c)}function Qet(e,t){let{plot:n,kde:r}=e,i=!r[0][t]?.map,o=i||Array.isArray(r[0][t]),s=n.getAttribute("colorDomain"),a=s===lo,c=s?.[Sn],l=!a&&!c&&s||(i?r.map(f=>f[t]).sort(zt):o?zP(r,t):Dy(r,t));(a||c)&&(c&&(l[Sn]=!0),n.setAttribute("colorDomain",l));let u=Uf({color:{type:n.getAttribute("colorScale"),domain:l,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(o)return HP(u);{let f=Uf({x:{type:Ket(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return ZP(1024,u,f.apply)}}function Ket(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function tnt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Rv(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 ky=class extends yc{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),Ln(this,"normalize",r)}query(t=[]){let{channels:n,normalize:r,source:i,binPad:o}=this,[s,a]=this.bins=this.binDimensions(this),[c]=Gr(this,"x",s,Vo(this,t),o),[l]=Gr(this,"y",a,Yo(this,t),o),u=ht.from(i.table).where(ent(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 nnt(u,c,l,d,s,a,f,r)}};function ent(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"?Wn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function nnt(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=ht.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(Wn(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=ht.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=ht.select({i:q`UNNEST(range((${f})))::INTEGER`}),h=ht.unionAll(ht.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)`),ht.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)`),ht.select(c,{x:"x0",y:"y0"}).from("pairs").where(Uc("dx"))),p=["x"].concat(c).join(", "),m=ht.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Wn(Ae("x",[0,i],!0),Ae("y",[0,o],!0)));return ht.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,density:a?Fr("w"):kr()}).groupby("index",s)}var gd=class extends Bn{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"?P3:U3),this.dim=a,Ln(this,"bins",i),Ln(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[Sn]}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"?Vo:Yo)(this,t),[a,c]=Gr(this,i,n,s),l=$3(r,o,[i]).where(t.concat(Ae(c,s))),u=this.channelField("weight")?"weight":null;return rnt(l,a,u)}queryResult(t){return this.grid=PP(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(x=>x<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=Oy(n*(t-1)/l,c),f=Fv(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,m=+s,g=(a-m)/(t-1),y=1/g;for(let x=0;x<t;++x)d.push({[p]:m+x*g,[h]:f[x]*y});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function rnt(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 ht.from(ht.unionAll(i,o)).select({index:"i",density:Fr("w")}).groupby("index").having($h("density",0))}var Fy=class extends Gi{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=ql(this,"x"),c=ql(this,"y"),[l,u]=r.map(g=>a.apply(g)),[f,d]=i.map(g=>c.apply(g)),h=(u-l)/(o-n),p=(d-f)/(s-n),m=n?0:.5;return this.data=int(this.kde,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function int(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=[];for(let h of e){let p=h.density;for(let m=0,g=0;g<f;++g)for(let y=0;y<u;++y,++m)d.push({...h,x:s(n+(y+c)*i),y:a(r+(g+c)*o),density:p[m]*l})}return d}var ont="geom",Ry=class extends Bn{constructor(t,n={},r){!Cv(t)&&!n?.geometry&&(n.geometry=qh(ont)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var $y=class extends Bn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},kv),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Vo(this,t),[c,l]=Yo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,g,y,x=new Set,b={};for(let D of i)D.channel==="orderby"?w.orderby(D.value):D.channel==="x"?g=D:D.channel==="y"?y=D:Object.hasOwn(D,"field")&&(b[D.as]=D.field,D.field.aggregate&&D.field.columns.forEach(A=>x.add(A)));let w=ht.select({[g.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[y.as]:q`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${m}`,...b}).groupby("x","y"),v=`${p} * (${g.field} - ${s}::DOUBLE)`,_=`${m} * (${l}::DOUBLE - ${y.field})`,I=ht.select({py:q`(${_} - ${f}) / ${h}`,pj:q`ROUND(py)::INTEGER`,px:q`(${v} - ${u}) / ${d} - 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`}).select(Array.from(x)).from(o.table).where(vs(g.field),vs(y.field),t);return w.from(I)}};var Py=class extends Gi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),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{binType:n,binPad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=Gr(this,"x",f,[a,c],r),[m,g]=Gr(this,"y",d,[l,u],r),y=r?[Ae(p,[+a,+c]),Ae(g,[+l,+u])]:[Is(+a,p),Ss(p,+c),Is(+l,g),Ss(g,+u)],x=ht.from(s.table).where(y),b=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:I,channel:D,field:A}=_;A.aggregate?(w[D]=A,o[D]=!0):D==="weight"?w.density=Fr(A):D!=="x"&&D!=="y"&&(x.select({[I]:A}),b.push(I))}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=kr()),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 unt(x,h,m,w.density,f,b)}else return lnt(x,h,m,w,f,b)}async requestTiles(){let t=ni();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=Vo(this,this._filter),[f,d]=Yo(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),y=(E,T)=>[[o+E*h,o+(E+1)*h],[s+T*p,s+(T+1)*p]],x=Math.floor((l-o)/h),b=r?JP((u-o)/h):x,w=Math.floor((f-s)/p),v=i?JP((d-s)/p):w,_=[];for(let E=x;E<=b;++E)for(let T=w;T<=v;++T)_.push([E,T]);let I=_.map(([E,T])=>t.query(this.tileQuery(y(E,T)))),D=[];if(r)for(let E=w;E<=v;++E)D.push([b+1,E]),D.push([x-1,E]);if(i){let E=r?x-1:x,T=r?b+1:b;for(let O=E;O<=T;++O)D.push([O,v+1]),D.push([O,w-1])}this.prefetch=D.map(([E,T])=>t.prefetch(this.tileQuery(y(E,T))));let A=await Promise.all(I);this.grids=[{density:snt(a,c,m,g,_,A)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=cnt(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=q3(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function snt(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;ant(e,t,s,a,f,d)}),s}function ant(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 cnt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Rv(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 lnt(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function unt(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 ht.from(ht.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(zc("density",0))}function JP(e){let t=Math.floor(e);return t===e?t-1:t}function fnt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;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)),g=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*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-xd(t)-xd(n)+xd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=dnt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),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 dnt(e,t,n){var r=e===0||e===1?0:Math.exp(xd(t+n)-xd(t)-xd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*QP(e,t,n)/t:1-r*QP(1-e,n,t)/n}function QP(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 xd(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 KP(e,t){var n=fnt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Uy=class extends Bn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;Ln(this,"ci",r,s),Ln(this,"precision",i,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 ht.from(super.query(t)).select({intercept:lS(r,n),slope:uS(r,n),n:fS(r,n),ssy:dS(r,n),ssx:hS(r,n),xm:pS(r,n),x0:_u(ei(n).where(vs(r))),x1:_u(ti(n).where(vs(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Lv(t),this.lineData=this.modelFit.flatMap(n=>hnt(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>pnt(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function hnt(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function pnt(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=KP((1-e)/2,l-2)*Math.sqrt(f/(l-2));return Ue(i,o-h/2,h).concat(o).map(m=>{let g=a+m*c,y=p*Math.sqrt(1/l+(m-s)**2/u);return{x:m,y1:g-y,y2:g+y,...d}})}function tU(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 bd(e){let t={};for(let n in e)t[tU(n)]=e[n];return t}function mnt(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 zy=class{constructor(t,{selection:n,channels:r={}}){this.mark=mnt(t),this.selection=n;let i=Object.entries(bd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",kd(()=>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 ynt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function ynt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Wn(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await e.coordinator.query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}function j3(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 eU(){return j3(vI())}function nU(){return j3(bI())}function rU(){return j3(wI())}function qy(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 Xo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function jy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function $v(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var wd=class{constructor(t,{channel:n,selection:r,field:i,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||Xo(t,n),this.style=a&&bd(a),this.brush=n==="y"?rU():nU(),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=>jy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),qy(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{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Ae(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ue(o),ue(s)],[Wt(o),Wt(s)]]);let a=Vt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:Vt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each($v).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var Pv=(e,t)=>e-t,Vy=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||Xo(t,"x"),this.yfield=i||Xo(t,"y"),this.style=a&&bd(a),this.brush=eU(),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=>jy(u,i,r)).sort(Pv),a=[c[1],l[1]].map(u=>jy(u,o,r)).sort(Pv)}(!qy(s,n?.[0])||!qy(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{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Wn(Ae(i,t[0]),Ae(o,t[1])):null}}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)],[Wt(s),Wt(a)]]);let c=Vt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Vt(t);if(this.g=l.append("g").attr("class","interval-xy").each($v).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(Pv),[d,h]=this.value[1].map(o.apply).sort(Pv);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var vd=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Xo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?_s(r,Cr(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=Vt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Vt(t),u=t.scale(i),f=!ri(o);l.on("pointerdown pointermove",function(d){let[h,p]=kn(d,this),m=gnt(s,a,u.invert(i==="x"?h:p));o.update(f?m:n.clause(m))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function gnt(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var iU=(e,t)=>e-t,Yy=class{constructor(t,{x:n=new Ms,y:r=new Ms,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||Xo(t,"x"),this.yfield=o||Xo(t,"y"),this.zoom=V3(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=xnt(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=bnt(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Ae(n,t):null}}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(iU),c=this.yscale.range.slice().sort(iU),l=V3(n,[-1/0,1/0],a),u=V3(r,[-1/0,1/0],c),f=RA().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 qr(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(Vt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function V3(e,t,n){return e?Array.isArray(e)?e:t:n}function xnt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function bnt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var jl=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Ph(n[l].field,Cr(c)));return a.length>1?Wn(a):a[0]});i=o.length>1?Pc(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=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(wnt(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>Y3(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!Y3(u[0],h)?d=null:d=[h]}this.value=d,vnt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function wnt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function vnt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>Y3(n,t[r]))}function Y3(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 _d=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=_nt(t,n);this.selection&&i&&(this.handler=new jl(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function _nt({marks: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)if(e[r].channelField(i,{exact:!0}))return e[r];return null}var Snt=new Set(["rectY-x","rectX-y","rect-x","rect-y"]);function Uv(e,t={steps:25}){let n=(r,i)=>Snt.has(`${r.type}-${i}`)?{[`${i}1`]:X3(r,i,e,t),[`${i}2`]:X3(r,i,e,{...t,offset:1})}:{[i]:X3(r,i,e,t)};return n[Zh]=!0,n}function X3(e,t,n,r){return{column:n,label:n,get stats(){return{column:n,stats:["min","max"]}},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=ql(e,t),{min:a,max:c}=e.channelField(t),l=Int(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,d=`${(l.max-l.min)/l.steps}::DOUBLE`,h=r.offset?`${r.offset} + `:"",p=`${l.min} + ${d} * (${h}FLOOR(${f} / ${d}))`;return`${s(p)}`}}}function Int(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let m=0,g=f.length;m<g;++m)d=u/f[m],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var Mnt=e=>e&&typeof e=="object"&&!Array.isArray(e);var Xy=class extends ur{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>Mnt(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ri(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}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,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?_s(r,Cr(t)):null}):br(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?ht.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}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var Ant={contains:B2,prefix:L2,suffix:C2,regexp:O2},Tnt=0;var Gy=class extends ur{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++Tnt,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}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)}),ri(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ri(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?Ant[i](r,Cr(t)):null}):br(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?ht.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 Ent=0;var Wy=class extends ur{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++Ent,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ri(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:ht.select({min:ei(r),max:ti(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:_s(r,Cr(t))}):br(this.selection)&&n.update(t)}};var W3=Z3(e=>{let t=zv(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?H3(n):`${n}`}),zv=Z3(e=>t=>t===0?"0":t.toLocaleString(e)),Ujt=W3(),zjt=zv();function H3(e){return bf(e,"Invalid Date")}function Z3(e){let t=Z3,n;return(r="en")=>r===t?n:n=e(t=r)}var Nnt=-1;var Hy=class extends ur{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++Nnt}`,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.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.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 f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:m,scrollTop:g,clientHeight:y}=d.target,x=g<f;f=g,!(x||h||p)&&m-g<2*y&&(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.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ni().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Ia(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=Dnt(this.format,t),this.style.innerText=Lnt(this.id,Ont(this.align,t),Bnt(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return ht.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?A2(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<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 Dnt(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return zv(n);case"date":return H3;default:return W3(n)}})}function Ont(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Bnt(e={},t){return t.map(({column:n})=>e[n])}function Lnt(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 Zy(e,...t){let n=e?.context?.coordinator??ni();for(let r of t)n.connect(r)}function qv(e,t,n){let r=new t(n);return Zy(e,r),r.element}function oU(e){return qv(this,Xy,e)}function sU(e){return qv(this,Gy,e)}function aU(e){return qv(this,Wy,e)}function cU(e){return qv(this,Hy,e)}function lU({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)),r.value={element:r},r}function uU(...e){return lU({direction:"vertical"},e.flat())}function fU(...e){return lU({direction:"horizontal"},e.flat())}function dU({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function hU(e){return dU({dim:"height",size:e})}function pU(e){return dU({dim:"width",size:e})}var jv={};Ir(jv,{align:()=>f6,aspectRatio:()=>d6,axis:()=>h6,colorBase:()=>QE,colorClamp:()=>zE,colorConstant:()=>t8,colorDomain:()=>PE,colorExponent:()=>KE,colorInterpolate:()=>YE,colorLabel:()=>WE,colorN:()=>qE,colorNice:()=>jE,colorPivot:()=>XE,colorRange:()=>UE,colorReverse:()=>HE,colorScale:()=>$E,colorScheme:()=>VE,colorSymmetric:()=>GE,colorTickFormat:()=>JE,colorZero:()=>ZE,facetGrid:()=>F4,facetLabel:()=>R4,facetMargin:()=>O4,facetMarginBottom:()=>L4,facetMarginLeft:()=>C4,facetMarginRight:()=>k4,facetMarginTop:()=>B4,fxAlign:()=>Y4,fxAriaDescription:()=>lE,fxAriaLabel:()=>cE,fxAxis:()=>H4,fxDomain:()=>$4,fxFontVariant:()=>aE,fxGrid:()=>nE,fxInset:()=>z4,fxInsetLeft:()=>q4,fxInsetRight:()=>j4,fxLabel:()=>iE,fxLabelAnchor:()=>oE,fxLabelOffset:()=>sE,fxLine:()=>rE,fxNice:()=>U4,fxPadding:()=>X4,fxPaddingInner:()=>G4,fxPaddingOuter:()=>W4,fxRange:()=>P4,fxReverse:()=>uE,fxRound:()=>V4,fxTickFormat:()=>tE,fxTickPadding:()=>K4,fxTickRotate:()=>eE,fxTickSize:()=>J4,fxTickSpacing:()=>Q4,fxTicks:()=>Z4,fyAlign:()=>xE,fyAriaDescription:()=>FE,fyAriaLabel:()=>kE,fyAxis:()=>_E,fyDomain:()=>fE,fyFontVariant:()=>CE,fyGrid:()=>NE,fyInset:()=>pE,fyInsetBottom:()=>yE,fyInsetTop:()=>mE,fyLabel:()=>OE,fyLabelAnchor:()=>BE,fyLabelOffset:()=>LE,fyLine:()=>DE,fyNice:()=>hE,fyPadding:()=>bE,fyPaddingInner:()=>wE,fyPaddingOuter:()=>vE,fyRange:()=>dE,fyReverse:()=>RE,fyRound:()=>gE,fyTickFormat:()=>TE,fyTickPadding:()=>AE,fyTickRotate:()=>EE,fyTickSize:()=>IE,fyTickSpacing:()=>ME,fyTicks:()=>SE,grid:()=>m6,height:()=>s6,inset:()=>p6,label:()=>y6,lengthBase:()=>E8,lengthClamp:()=>M8,lengthConstant:()=>D8,lengthDomain:()=>S8,lengthExponent:()=>N8,lengthNice:()=>A8,lengthRange:()=>I8,lengthScale:()=>_8,lengthZero:()=>T8,margin:()=>n6,marginBottom:()=>u6,marginLeft:()=>a6,marginRight:()=>c6,marginTop:()=>l6,margins:()=>e6,name:()=>K3,opacityBase:()=>u8,opacityClamp:()=>i8,opacityConstant:()=>d8,opacityDomain:()=>n8,opacityExponent:()=>f8,opacityLabel:()=>s8,opacityNice:()=>o8,opacityRange:()=>r8,opacityReverse:()=>a8,opacityScale:()=>e8,opacityTickFormat:()=>l8,opacityZero:()=>c8,padding:()=>g6,projectionClip:()=>z8,projectionDomain:()=>k8,projectionInset:()=>F8,projectionInsetBottom:()=>U8,projectionInsetLeft:()=>R8,projectionInsetRight:()=>$8,projectionInsetTop:()=>P8,projectionParallels:()=>B8,projectionPrecision:()=>L8,projectionRotate:()=>C8,projectionType:()=>O8,rBase:()=>b8,rClamp:()=>y8,rConstant:()=>v8,rDomain:()=>p8,rExponent:()=>w8,rNice:()=>g8,rRange:()=>m8,rScale:()=>h8,rZero:()=>x8,round:()=>x6,style:()=>i6,width:()=>o6,xAlign:()=>E6,xAriaDescription:()=>X6,xAriaLabel:()=>Y6,xAxis:()=>B6,xBase:()=>H6,xClamp:()=>A6,xConstant:()=>J6,xDomain:()=>w6,xExponent:()=>Z6,xFontVariant:()=>V6,xGrid:()=>P6,xInset:()=>S6,xInsetLeft:()=>I6,xInsetRight:()=>M6,xLabel:()=>z6,xLabelAnchor:()=>q6,xLabelOffset:()=>j6,xLine:()=>U6,xNice:()=>_6,xPadding:()=>N6,xPaddingInner:()=>D6,xPaddingOuter:()=>O6,xRange:()=>v6,xReverse:()=>G6,xRound:()=>T6,xScale:()=>b6,xTickFormat:()=>R6,xTickPadding:()=>F6,xTickRotate:()=>$6,xTickSize:()=>C6,xTickSpacing:()=>k6,xTicks:()=>L6,xZero:()=>W6,xyDomain:()=>r6,yAlign:()=>a4,yAriaDescription:()=>M4,yAriaLabel:()=>I4,yAxis:()=>f4,yBase:()=>E4,yClamp:()=>o4,yConstant:()=>D4,yDomain:()=>K6,yExponent:()=>N4,yFontVariant:()=>S4,yGrid:()=>x4,yInset:()=>n4,yInsetBottom:()=>i4,yInsetTop:()=>r4,yLabel:()=>w4,yLabelAnchor:()=>v4,yLabelOffset:()=>_4,yLine:()=>b4,yNice:()=>e4,yPadding:()=>c4,yPaddingInner:()=>l4,yPaddingOuter:()=>u4,yRange:()=>t4,yReverse:()=>A4,yRound:()=>s4,yScale:()=>Q6,yTickFormat:()=>y4,yTickPadding:()=>m4,yTickRotate:()=>g4,yTickSize:()=>h4,yTickSpacing:()=>p4,yTicks:()=>d4,yZero:()=>T4});var Jy=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)}},J3=new Jy;function Q3(e,t,n){(e?.context?.namedPlots??J3).request(t,n)}function mU(e,t,n){(e?.context?.namedPlots??J3).set(t,n)}function K3(e){return t=>mU(this,e,t)}function yU(e,t,n){br(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 Cnt(e,t){return n=>{yU(n,e,t)}}function t6(e){return t=>{for(let[n,r]of Object.entries(e))yU(t,n,r)}}function e6(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),t6(o)}function n6(e){return t6({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function r6(e){return t6({xDomain:e,yDomain:e})}var L=e=>t=>Cnt(e,t),i6=L("style"),o6=L("width"),s6=L("height"),a6=L("marginLeft"),c6=L("marginRight"),l6=L("marginTop"),u6=L("marginBottom"),f6=L("align"),d6=L("aspectRatio"),h6=L("axis"),p6=L("inset"),m6=L("grid"),y6=L("label"),g6=L("padding"),x6=L("round"),b6=L("xScale"),w6=L("xDomain"),v6=L("xRange"),_6=L("xNice"),S6=L("xInset"),I6=L("xInsetLeft"),M6=L("xInsetRight"),A6=L("xClamp"),T6=L("xRound"),E6=L("xAlign"),N6=L("xPadding"),D6=L("xPaddingInner"),O6=L("xPaddingOuter"),B6=L("xAxis"),L6=L("xTicks"),C6=L("xTickSize"),k6=L("xTickSpacing"),F6=L("xTickPadding"),R6=L("xTickFormat"),$6=L("xTickRotate"),P6=L("xGrid"),U6=L("xLine"),z6=L("xLabel"),q6=L("xLabelAnchor"),j6=L("xLabelOffset"),V6=L("xFontVariant"),Y6=L("xAriaLabel"),X6=L("xAriaDescription"),G6=L("xReverse"),W6=L("xZero"),H6=L("xBase"),Z6=L("xExponent"),J6=L("xConstant"),Q6=L("yScale"),K6=L("yDomain"),t4=L("yRange"),e4=L("yNice"),n4=L("yInset"),r4=L("yInsetTop"),i4=L("yInsetBottom"),o4=L("yClamp"),s4=L("yRound"),a4=L("yAlign"),c4=L("yPadding"),l4=L("yPaddingInner"),u4=L("yPaddingOuter"),f4=L("yAxis"),d4=L("yTicks"),h4=L("yTickSize"),p4=L("yTickSpacing"),m4=L("yTickPadding"),y4=L("yTickFormat"),g4=L("yTickRotate"),x4=L("yGrid"),b4=L("yLine"),w4=L("yLabel"),v4=L("yLabelAnchor"),_4=L("yLabelOffset"),S4=L("yFontVariant"),I4=L("yAriaLabel"),M4=L("yAriaDescription"),A4=L("yReverse"),T4=L("yZero"),E4=L("yBase"),N4=L("yExponent"),D4=L("yConstant"),O4=L("facetMargin"),B4=L("facetMarginTop"),L4=L("facetMarginBottom"),C4=L("facetMarginLeft"),k4=L("facetMarginRight"),F4=L("facetGrid"),R4=L("facetLabel"),$4=L("fxDomain"),P4=L("fxRange"),U4=L("fxNice"),z4=L("fxInset"),q4=L("fxInsetLeft"),j4=L("fxInsetRight"),V4=L("fxRound"),Y4=L("fxAlign"),X4=L("fxPadding"),G4=L("fxPaddingInner"),W4=L("fxPaddingOuter"),H4=L("fxAxis"),Z4=L("fxTicks"),J4=L("fxTickSize"),Q4=L("fxTickSpacing"),K4=L("fxTickPadding"),tE=L("fxTickFormat"),eE=L("fxTickRotate"),nE=L("fxGrid"),rE=L("fxLine"),iE=L("fxLabel"),oE=L("fxLabelAnchor"),sE=L("fxLabelOffset"),aE=L("fxFontVariant"),cE=L("fxAriaLabel"),lE=L("fxAriaDescription"),uE=L("fxReverse"),fE=L("fyDomain"),dE=L("fyRange"),hE=L("fyNice"),pE=L("fyInset"),mE=L("fyInsetTop"),yE=L("fyInsetBottom"),gE=L("fyRound"),xE=L("fyAlign"),bE=L("fyPadding"),wE=L("fyPaddingInner"),vE=L("fyPaddingOuter"),_E=L("fyAxis"),SE=L("fyTicks"),IE=L("fyTickSize"),ME=L("fyTickSpacing"),AE=L("fyTickPadding"),TE=L("fyTickFormat"),EE=L("fyTickRotate"),NE=L("fyGrid"),DE=L("fyLine"),OE=L("fyLabel"),BE=L("fyLabelAnchor"),LE=L("fyLabelOffset"),CE=L("fyFontVariant"),kE=L("fyAriaLabel"),FE=L("fyAriaDescription"),RE=L("fyReverse"),$E=L("colorScale"),PE=L("colorDomain"),UE=L("colorRange"),zE=L("colorClamp"),qE=L("colorN"),jE=L("colorNice"),VE=L("colorScheme"),YE=L("colorInterpolate"),XE=L("colorPivot"),GE=L("colorSymmetric"),WE=L("colorLabel"),HE=L("colorReverse"),ZE=L("colorZero"),JE=L("colorTickFormat"),QE=L("colorBase"),KE=L("colorExponent"),t8=L("colorConstant"),e8=L("opacityScale"),n8=L("opacityDomain"),r8=L("opacityRange"),i8=L("opacityClamp"),o8=L("opacityNice"),s8=L("opacityLabel"),a8=L("opacityReverse"),c8=L("opacityZero"),l8=L("opacityTickFormat"),u8=L("opacityBase"),f8=L("opacityExponent"),d8=L("opacityConstant"),h8=L("rScale"),p8=L("rDomain"),m8=L("rRange"),y8=L("rClamp"),g8=L("rNice"),x8=L("rZero"),b8=L("rBase"),w8=L("rExponent"),v8=L("rConstant"),_8=L("lengthScale"),S8=L("lengthDomain"),I8=L("lengthRange"),M8=L("lengthClamp"),A8=L("lengthNice"),T8=L("lengthZero"),E8=L("lengthBase"),N8=L("lengthExponent"),D8=L("lengthConstant"),O8=L("projectionType"),B8=L("projectionParallels"),L8=L("projectionPrecision"),C8=L("projectionRotate"),k8=L("projectionDomain"),F8=L("projectionInset"),R8=L("projectionInsetLeft"),$8=L("projectionInsetRight"),P8=L("projectionInsetTop"),U8=L("projectionInsetBottom"),z8=L("projectionClip");function gU(e,t){return{table:e,options:t}}var Vv={};Ir(Vv,{area:()=>j8,areaX:()=>V8,areaY:()=>Y8,arrow:()=>FN,axisFx:()=>zN,axisFy:()=>qN,axisX:()=>PN,axisY:()=>UN,barX:()=>H8,barY:()=>Z8,cell:()=>J8,cellX:()=>Q8,cellY:()=>K8,circle:()=>sN,contour:()=>IN,delaunayLink:()=>LN,delaunayMesh:()=>CN,denseLine:()=>SN,density:()=>_N,densityX:()=>wN,densityY:()=>vN,dot:()=>rN,dotX:()=>iN,dotY:()=>oN,frame:()=>$N,geo:()=>GN,graticule:()=>HN,gridFx:()=>YN,gridFy:()=>XN,gridX:()=>jN,gridY:()=>VN,heatmap:()=>MN,hexagon:()=>aN,hexbin:()=>EN,hexgrid:()=>NN,hull:()=>kN,image:()=>bN,line:()=>X8,lineX:()=>G8,lineY:()=>W8,link:()=>RN,raster:()=>AN,rasterTile:()=>TN,rect:()=>tN,rectX:()=>eN,rectY:()=>nN,regressionY:()=>DN,ruleX:()=>fN,ruleY:()=>dN,sphere:()=>WN,spike:()=>xN,text:()=>cN,textX:()=>lN,textY:()=>uN,tickX:()=>hN,tickY:()=>pN,vector:()=>mN,vectorX:()=>yN,vectorY:()=>gN,voronoi:()=>ON,voronoiMesh:()=>BN});var knt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function At(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=knt.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?Ny:Bn;return q8(r,e,t,n)}function q8(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function ua(e,t,n){return r=>{r.addMark(new e(t,n))}}var j8=(...e)=>At("area",...e),V8=(...e)=>At("areaX",...e),Y8=(...e)=>At("areaY",...e),X8=(...e)=>At("line",...e),G8=(...e)=>At("lineX",...e),W8=(...e)=>At("lineY",...e),H8=(...e)=>At("barX",...e),Z8=(...e)=>At("barY",...e),J8=(...e)=>At("cell",...e),Q8=(...e)=>At("cellX",...e),K8=(...e)=>At("cellY",...e),tN=(...e)=>At("rect",...e),eN=(...e)=>At("rectX",...e),nN=(...e)=>At("rectY",...e),rN=(...e)=>At("dot",...e),iN=(...e)=>At("dotX",...e),oN=(...e)=>At("dotY",...e),sN=(...e)=>At("circle",...e),aN=(...e)=>At("hexagon",...e),cN=(...e)=>At("text",...e),lN=(...e)=>At("textX",...e),uN=(...e)=>At("textY",...e),fN=(...e)=>At("ruleX",...e),dN=(...e)=>At("ruleY",...e),hN=(...e)=>At("tickX",...e),pN=(...e)=>At("tickY",...e),mN=(...e)=>At("vector",...e),yN=(...e)=>At("vectoX",...e),gN=(...e)=>At("vectorY",...e),xN=(...e)=>At("spike",...e),bN=(...e)=>At("image",...e),wN=(...e)=>q8(gd,"areaX",...e),vN=(...e)=>q8(gd,"areaY",...e),_N=(...e)=>ua(Fy,...e),SN=(...e)=>ua(ky,...e),IN=(...e)=>ua(Ly,...e),MN=(...e)=>ua(Cy,...e),AN=(...e)=>ua(yc,...e),TN=(...e)=>ua(Py,...e),EN=(...e)=>ua($y,...e),NN=(...e)=>At("hexgrid",...e),DN=(...e)=>ua(Uy,...e),ON=(...e)=>At("voronoi",...e),BN=(...e)=>At("voronoiMesh",...e),LN=(...e)=>At("delaunayLink",...e),CN=(...e)=>At("delaunayMesh",...e),kN=(...e)=>At("hull",...e),FN=(...e)=>At("arrow",...e),RN=(...e)=>At("link",...e),$N=(...e)=>At("frame",...e),PN=(...e)=>At("axisX",...e),UN=(...e)=>At("axisY",...e),zN=(...e)=>At("axisFx",...e),qN=(...e)=>At("axisFy",...e),jN=(...e)=>At("gridX",...e),VN=(...e)=>At("gridY",...e),YN=(...e)=>At("gridFx",...e),XN=(...e)=>At("gridFy",...e),GN=(...e)=>ua(Ry,...e),WN=(...e)=>At("sphere",...e),HN=(...e)=>At("graticule",...e);var Yv={};Ir(Yv,{highlight:()=>ZN,intervalX:()=>nD,intervalXY:()=>iD,intervalY:()=>rD,nearestX:()=>tD,nearestY:()=>eD,pan:()=>oD,panX:()=>sD,panY:()=>aD,panZoom:()=>cD,panZoomX:()=>lD,panZoomY:()=>uD,toggle:()=>Sd,toggleColor:()=>KN,toggleX:()=>JN,toggleY:()=>QN});function gc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function ZN({by:e,...t}){return gc(zy,{selection:e,channels:t})}function Sd({as:e,...t}){return gc(jl,{...t,selection:e})}function JN(e){return Sd({...e,channels:["x"]})}function QN(e){return Sd({...e,channels:["y"]})}function KN(e){return Sd({...e,channels:["color"]})}function tD({as:e,...t}){return gc(vd,{...t,selection:e,channel:"x"})}function eD({as:e,...t}){return gc(vd,{...t,selection:e,channel:"y"})}function nD({as:e,...t}){return gc(wd,{...t,selection:e,channel:"x"})}function rD({as:e,...t}){return gc(wd,{...t,selection:e,channel:"y"})}function iD({as:e,...t}){return gc(Vy,{...t,selection:e})}function Id(e){return gc(Yy,e)}function oD(e={}){return Id({...e,zoom:!1})}function sD(e={}){return Id({...e,zoom:!1,pany:!1})}function aD(e={}){return Id({...e,zoom:!1,panx:!1})}function cD(e={}){return Id(e)}function lD(e={}){return Id({...e,pany:!1})}function uD(e={}){return Id({...e,panx:!1})}var Xv={};Ir(Xv,{colorLegend:()=>dD,opacityLegend:()=>hD,symbolLegend:()=>pD});function fD(e,t={}){if(t.for){let{for:n,...r}=t,i=new _d(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?Q3(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new _d(e,t))}function dD(e){return fD.call(this,"color",e)}function hD(e){return fD.call(this,"opacity",e)}function pD(e){return fD.call(this,"symbol",e)}function xU(...e){let t=new Ey;return e.flat().forEach(n=>n(t)),Zy(this,...t.marks),t.element}function yD({coordinator:e=ni(),namedPlots:t=new Jy,extensions:n=null,...r}={}){return{...mD,...n,context:{coordinator:e,namedPlots:t,...r}}}var bU="spec",Gv="literal",qVt="dataref",wU="options",vU="selection",_U="paramref",SU="param",gD="select",Wv="value",IU="crossfilter",Hv="intersect",MU="union",AU="single",TU="data",EU="expression",xc="sql",fa="agg",Qy="input",Md="hconcat",Ad="vconcat",Td="hspace",Ed="vspace",Zv="mark",xD="from",Nd="plot",Ky="legend",NU="attribute",DU="transform",OU="interactor",tg="Fixed";var $t=class{constructor(t,n=null){this.type=t,this.children=n}instantiate(){throw Error("instantiate not implemented")}codegen(){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var eg=class extends $t{constructor(t,n,r,i,o,s){super(bU,[t]),this.root=t,this.meta=n,this.config=r,this.data=i,this.params=o,this.plotDefaults=s}toJSON(){let{root:t,meta:n,config:r,plotDefaults:i}=this,o=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),o?.size){let c=a.data={};for(let[l,u]of o)c[l]=u.toJSON()}if(s?.size){let c=a.params={};for(let[l,u]of s)c[l]=u.toJSON()}if(i?.length){let c=a.plotDefaults={};for(let l of i)Object.assign(c,l.toJSON())}return Object.assign(a,t.toJSON())}};function BU(e){let t=typeof e;return t==="object"?e?.param:t==="string"?Fnt(e):null}function Fnt(e){return e?.[0]==="$"?e.slice(1):null}function ng(e){return`$${e}`}function LU(e){return[e].flat()}function xi(e){return Array.isArray(e)}function Dd(e){return e!==null&&typeof e=="object"&&!xi(e)}function Go(e){return typeof e=="string"}function Od(e,t){throw Object.assign(Error(e),{data:t})}function _r(e,t){let n={};for(let r in e)n[r]=t.maybeSelection(e[r]);return new Bd(n)}var Bd=class e extends $t{constructor(t){super(wU),this.options=t}filter(t){let n=Object.fromEntries(Object.entries(this.options).filter(([r,i])=>t(r,i)));return new e(n)}instantiate(t){let{options:n}=this,r={};for(let i in n)r[i]=n[i].instantiate(t);return r}codegen(t){let{options:n}=this,r=[];for(let i in n)r.push(`${i}: ${n[i].codegen(t)}`);return r.length?`{${t.maybeLineWrap(r)}}`:""}toJSON(){let{options:t}=this,n={};for(let r in t)n[r]=t[r].toJSON();return n}};var FU="table",RU="parquet",$U="csv",bD="json",i_="spatial",CU=new Map([[FU,Rnt],[RU,$nt],[$U,Pnt],[bD,Unt],[i_,znt]]);function PU(e,t,n){if(t=qnt(t),CU.has(t.type))return CU.get(t.type)(e,t,n);n.error("Unrecognized data format type.",t)}function Rnt(e,t,n){let{query:r,type:i,...o}=t;return new Qv(e,r,_r(o,n))}function $nt(e,t,n){let{file:r,type:i,...o}=t;return new t_(e,r,_r(o,n))}function Pnt(e,t,n){let{file:r,type:i,...o}=t;return new e_(e,r,_r(o,n))}function Unt(e,t,n){let{data:r,file:i,type:o,...s}=t,a=_r(s,n);return r?new r_(e,r,a):new n_(e,i,a)}function znt(e,t,n){let{file:r,type:i,...o}=t;return new Kv(e,r,_r(o,n))}function qnt(e){return xi(e)&&(e={type:"json",data:e}),Go(e)&&(e={type:"table",query:e}),{...e,type:jnt(e)}}function jnt(e){return e.type||Vnt(e.file)||"table"}function Vnt(e){let t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function kU(e,t){return t?new URL(e,t).toString():e}function Ynt(e,t){let n=e?.codegen(t);return n?`, ${n}`:""}var Jv=class extends $t{constructor(t,n){super(TU),this.name=t,this.format=n}},Ld=class extends Jv{constructor(t,n){super(t,n)}instantiateQuery(t){t.error("instantiateQuery not implemented")}codegenQuery(t){t.error("codegenQuery not implemented")}instantiate(t){let n=this.instantiateQuery(t);if(n)return n}codegen(t){let n=this.codegenQuery(t);if(n)return n}},Qv=class extends Ld{constructor(t,n,r){super(t,FU),this.query=n?.trim(),this.options=r}instantiateQuery(t){let{name:n,query:r,options:i}=this;if(r)return t.api.create(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,query:r,options:i}=this;if(r)return`\`${ao(n,r,i.instantiate(t))}\``}toJSON(){let{format:t,query:n,options:r}=this;return{type:t,query:n,...r.toJSON()}}},Vl=class extends Ld{constructor(t,n,r,i,o){super(t,n),this.file=i,this.method=r,this.options=o}instantiateQuery(t){let{name:n,method:r,file:i,options:o}=this,s=kU(i,t.baseURL),a=o?.instantiate(t);return t.api[r](n,s,a)}codegenQuery(t){let{name:n,method:r,file:i,options:o}=this,s=kU(i,t.baseURL),a=Ynt(o,t);return`${t.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:t,file:n,options:r}=this;return{type:t,file:n,...r.toJSON()}}},Kv=class extends Vl{constructor(t,n,r){super(t,i_,"loadSpatial",n,r)}},t_=class extends Vl{constructor(t,n,r){super(t,RU,"loadParquet",n,r)}},e_=class extends Vl{constructor(t,n,r){super(t,$U,"loadCSV",n,r)}},n_=class extends Vl{constructor(t,n,r){super(t,bD,"loadJSON",n,r)}},r_=class extends Ld{constructor(t,n,r){super(t,bD),this.data=n,this.options=r}instantiateQuery(t){let{name:n,data:r,options:i}=this;return t.api.loadObjects(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,data:r,options:i}=this,o=i?","+i.codegen(t):"",s=`[
70
70
  `+r.map(a=>JSON.stringify(a)).join(`,
71
71
  `)+`
72
- ]`;return`${t.ns()}loadObjects("${n}", ${s}${o})`}toJSON(){let{format:t,data:n,options:r}=this;return{type:t,data:n,...r.toJSON()}}};function o_(e){let t=e.config?.extensions,n=new Set(t?BU(t):[]);for(let r of Object.values(e.data))r.format===i_&&n.add("spatial");return n}async function Vnt(e,t){let{data:n,params:r,plotDefaults:i}=e,o=new s_({plotDefaults:i,...t}),s=[],a=o_(e);s.push(...Array.from(a).map(c=>qh(c)));for(let c of Object.values(n)){let l=c.instantiate(o);l&&s.push(l)}s.length>0&&await o.coordinator.exec(s);for(let[c,l]of Object.entries(r)){let u=l.instantiate(o);o.activeParams.set(c,u)}return{element:e.root.instantiate(o),params:o.activeParams}}var s_=class{constructor({api:t=hD(),plotDefaults:n=[],activeParams:r=new Map,baseURL:i=null}={}){this.api=t,this.plotDefaults=n,this.activeParams=r,this.baseURL=i,this.coordinator=t.context.coordinator}error(t,n){Nd(t,n)}};function Ynt(e,t){let{root:n,data:r,params:i,plotDefaults:o}=e,s=new a_({plotDefaults:o,...t}),a=[];for(let[m,g]of s.imports)a.push(Go(g)?`import ${g} from "${m}";`:`import { ${g.join(", ")} } from "${m}";`);let c=[];if(s.connector){let m=`${s.ns()}${s.connector}Connector()`;c.push(`${s.tab()}${s.ns()}coordinator().databaseConnector(${m});`)}let l=[];for(let m of o_(e))l.push(`${s.ns()}loadExtension("${m}")`);for(let m of Object.values(r)){let g=m.codegen(s);g&&l.push(g)}let u=[];l.length&&(u.push(`${s.tab()}await ${s.ns()}coordinator().exec([`),s.indent(),u.push(l.map(m=>`${s.tab()}${m}`).join(`,
73
- `)),s.undent(),u.push(`${s.tab()}]);`));let f=[];for(let[m,g]of Object.entries(i))f.push(`const ${tg(m)} = ${g.codegen(s)};`);let d=[],h=o;h.length&&(d=["const defaultAttributes = [",h.map(m=>" "+m.codegen(s)).join(`,
74
- `),"];"]);let p=[`export default ${n.codegen(s)};`];return[...a,...eg(a),...c,...eg(c),...u,...eg(u),...f,...eg(f),...d,...eg(d),...p].join(`
75
- `)}var a_=class{constructor({plotDefaults:t=null,namespace:n="vg",connector:r=null,imports:i=new Map([["@uwdata/vgplot","* as vg"]]),baseURL:o=null,depth:s=0}={}){this.plotDefaults=t,this.namespace=`${n}.`,this.connector=r,this.imports=i,this.baseURL=o,this.depth=s}addImport(t,n){this.imports.has(t)||this.imports.set(t,[]),this.imports.get(t).push(n)}setImports(t,n){this.imports.set(t,n)}ns(){return this.namespace}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}stringify(t){if(xi(t)){let n=t.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(Ed(t)){let n=Object.entries(t).map(([r,i])=>`${Xnt(r)}: ${this.stringify(i)}`);return`{${this.maybeLineWrap(n)}}`}else return JSON.stringify(t)}maybeLineWrap(t){let n=80-2*this.depth;if(2*t.length+t.reduce((i,o)=>i+o.length,0)>n){this.indent();let i=t.map(o=>`
72
+ ]`;return`${t.ns()}loadObjects("${n}", ${s}${o})`}toJSON(){let{format:t,data:n,options:r}=this;return{type:t,data:n,...r.toJSON()}}};function o_(e){let t=e.config?.extensions,n=new Set(t?LU(t):[]);for(let r of Object.values(e.data))r.format===i_&&n.add("spatial");return n}async function Xnt(e,t){let{data:n,params:r,plotDefaults:i}=e,o=new s_({plotDefaults:i,...t}),s=[],a=o_(e);s.push(...Array.from(a).map(c=>Xh(c)));for(let c of Object.values(n)){let l=c.instantiate(o);l&&s.push(l)}s.length>0&&await o.coordinator.exec(s);for(let[c,l]of Object.entries(r)){let u=l.instantiate(o);o.activeParams.set(c,u)}return{element:e.root.instantiate(o),params:o.activeParams}}var s_=class{constructor({api:t=yD(),plotDefaults:n=[],activeParams:r=new Map,baseURL:i=null}={}){this.api=t,this.plotDefaults=n,this.activeParams=r,this.baseURL=i,this.coordinator=t.context.coordinator}error(t,n){Od(t,n)}};function Gnt(e,t){let{root:n,data:r,params:i,plotDefaults:o}=e,s=new a_({plotDefaults:o,...t}),a=[];for(let[m,g]of s.imports)a.push(Go(g)?`import ${g} from "${m}";`:`import { ${g.join(", ")} } from "${m}";`);let c=[];if(s.connector){let m=`${s.ns()}${s.connector}Connector()`;c.push(`${s.tab()}${s.ns()}coordinator().databaseConnector(${m});`)}let l=[];for(let m of o_(e))l.push(`${s.ns()}loadExtension("${m}")`);for(let m of Object.values(r)){let g=m.codegen(s);g&&l.push(g)}let u=[];l.length&&(u.push(`${s.tab()}await ${s.ns()}coordinator().exec([`),s.indent(),u.push(l.map(m=>`${s.tab()}${m}`).join(`,
73
+ `)),s.undent(),u.push(`${s.tab()}]);`));let f=[];for(let[m,g]of Object.entries(i))f.push(`const ${ng(m)} = ${g.codegen(s)};`);let d=[],h=o;h.length&&(d=["const defaultAttributes = [",h.map(m=>" "+m.codegen(s)).join(`,
74
+ `),"];"]);let p=[`export default ${n.codegen(s)};`];return[...a,...rg(a),...c,...rg(c),...u,...rg(u),...f,...rg(f),...d,...rg(d),...p].join(`
75
+ `)}var a_=class{constructor({plotDefaults:t=null,namespace:n="vg",connector:r=null,imports:i=new Map([["@uwdata/vgplot","* as vg"]]),baseURL:o=null,depth:s=0}={}){this.plotDefaults=t,this.namespace=`${n}.`,this.connector=r,this.imports=i,this.baseURL=o,this.depth=s}addImport(t,n){this.imports.has(t)||this.imports.set(t,[]),this.imports.get(t).push(n)}setImports(t,n){this.imports.set(t,n)}ns(){return this.namespace}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}stringify(t){if(xi(t)){let n=t.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(Dd(t)){let n=Object.entries(t).map(([r,i])=>`${Wnt(r)}: ${this.stringify(i)}`);return`{${this.maybeLineWrap(n)}}`}else return JSON.stringify(t)}maybeLineWrap(t){let n=80-2*this.depth;if(2*t.length+t.reduce((i,o)=>i+o.length,0)>n){this.indent();let i=t.map(o=>`
76
76
  ${this.tab()}${o}`).join(",");return this.undent(),i+`
77
- `+this.tab()}else return t.join(", ")}error(t,n){Nd(t,n)}};function Xnt(e){return/^[A-Za-z_$]\w*/.test(e)?e:JSON.stringify(e)}function eg(e){return e?.length?[""]:[]}var Yl=class extends $t{constructor(t){super(Gv),this.value=t}instantiate(){return this.value}codegen(t){return t.stringify(this.value)}toJSON(){return this.value}};var Xl=class extends $t{constructor(t=Hv,n){super(wU),this.select=t,this.cross=n}instantiate(t){let{select:n,cross:r}=this;return t.api.Selection[n]({cross:r})}codegen(t){let{select:n,cross:r}=this,i=r!=null?`{ cross: ${r} }`:"";return`${t.ns()}Selection.${n}(${i})`}toJSON(){let{select:t,cross:n}=this;return{select:t,cross:n}}};var Gnt=new Set([Wv,MU,SU,Hv,IU]);function PU(e,t){let n=Ed(e)?e:{value:e},{select:r=Wv,cross:i,date:o,value:s}=n;return Gnt.has(r)||t.error(`Unrecognized param type: ${r}`,n),r!==Wv?new Xl(r,i):xi(s)?new Gl(s.map(a=>t.maybeParam(a))):new Gl(s,o)}var Gl=class extends $t{constructor(t,n){super(_U),this.value=t,this.date=n}instantiate(t){let{date:n,value:r}=this,{Param:i}=t.api;return xi(r)?i.array(r.map(o=>o.instantiate(t))):i.value(wl(n,r))}codegen(t){let{value:n,date:r}=this,i=`${t.ns()}Param.`;return xi(n)?`${i}array([${n.map(o=>o.codegen(t)).join(", ")}])`:r?`${i}value(new Date(${JSON.stringify(r)}))`:`${i}value(${JSON.stringify(n)})`}toJSON(){let{date:t,value:n}=this;return xi(n)?n.map(r=>r.toJSON()):t?{date:t}:n}};var ng=class extends $t{constructor(t){super(vU),this.name=t}instantiate(t){return t.activeParams?.get(this.name)}codegen(){return tg(this.name)}toJSON(){return tg(this.name)}};function u_(e,t,n){return n.plot?.attributes?.has(e)||n.error(`Unrecognized attribute: ${e}`),new c_(e,t===Qy?new l_:n.maybeParam(t))}var c_=class extends $t{constructor(t,n){super(EU),this.name=t,this.value=n}instantiate(t){let{name:n,value:r}=this,i=t.api[n];return i(r.instantiate(t))}codegen(t){let{name:n,value:r}=this;return`${t.tab()}${t.ns()}${n}(${r.codegen(t)})`}toJSON(){let{name:t,value:n}=this;return{[t]:n.toJSON()}}},l_=class extends $t{constructor(){super(Gv),this.value=Qy}instantiate(t){return t.api[Qy]}codegen(t){return`${t.ns()}${Qy}`}toJSON(){return this.value}};function UU(e,t){let n=e[Sd].map(r=>t.parseComponent(r));return new f_(n)}var f_=class extends $t{constructor(t){super(Sd,t)}instantiate(t){return t.api[Sd](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
77
+ `+this.tab()}else return t.join(", ")}error(t,n){Od(t,n)}};function Wnt(e){return/^[A-Za-z_$]\w*/.test(e)?e:JSON.stringify(e)}function rg(e){return e?.length?[""]:[]}var Yl=class extends $t{constructor(t){super(Gv),this.value=t}instantiate(){return this.value}codegen(t){return t.stringify(this.value)}toJSON(){return this.value}};var Xl=class extends $t{constructor(t=Hv,n){super(vU),this.select=t,this.cross=n}instantiate(t){let{select:n,cross:r}=this;return t.api.Selection[n]({cross:r})}codegen(t){let{select:n,cross:r}=this,i=r!=null?`{ cross: ${r} }`:"";return`${t.ns()}Selection.${n}(${i})`}toJSON(){let{select:t,cross:n}=this;return{select:t,cross:n}}};var Hnt=new Set([Wv,AU,IU,Hv,MU]);function UU(e,t){let n=Dd(e)?e:{value:e},{select:r=Wv,cross:i,date:o,value:s}=n;return Hnt.has(r)||t.error(`Unrecognized param type: ${r}`,n),r!==Wv?new Xl(r,i):xi(s)?new Gl(s.map(a=>t.maybeParam(a))):new Gl(s,o)}var Gl=class extends $t{constructor(t,n){super(SU),this.value=t,this.date=n}instantiate(t){let{date:n,value:r}=this,{Param:i}=t.api;return xi(r)?i.array(r.map(o=>o.instantiate(t))):i.value(wl(n,r))}codegen(t){let{value:n,date:r}=this,i=`${t.ns()}Param.`;return xi(n)?`${i}array([${n.map(o=>o.codegen(t)).join(", ")}])`:r?`${i}value(new Date(${JSON.stringify(r)}))`:`${i}value(${JSON.stringify(n)})`}toJSON(){let{date:t,value:n}=this;return xi(n)?n.map(r=>r.toJSON()):t?{date:t}:n}};var ig=class extends $t{constructor(t){super(_U),this.name=t}instantiate(t){return t.activeParams?.get(this.name)}codegen(){return ng(this.name)}toJSON(){return ng(this.name)}};function u_(e,t,n){return n.plot?.attributes?.has(e)||n.error(`Unrecognized attribute: ${e}`),new c_(e,t===tg?new l_:n.maybeParam(t))}var c_=class extends $t{constructor(t,n){super(NU),this.name=t,this.value=n}instantiate(t){let{name:n,value:r}=this,i=t.api[n];return i(r.instantiate(t))}codegen(t){let{name:n,value:r}=this;return`${t.tab()}${t.ns()}${n}(${r.codegen(t)})`}toJSON(){let{name:t,value:n}=this;return{[t]:n.toJSON()}}},l_=class extends $t{constructor(){super(Gv),this.value=tg}instantiate(t){return t.api[tg]}codegen(t){return`${t.ns()}${tg}`}toJSON(){return this.value}};function zU(e,t){let n=e[Md].map(r=>t.parseComponent(r));return new f_(n)}var f_=class extends $t{constructor(t){super(Md,t)}instantiate(t){return t.api[Md](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
78
78
  ${n.join(`,
79
79
  `)}
80
- ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function zU(e){return new d_(e[Md])}var d_=class extends $t{constructor(t){super(Md),this.value=t}instantiate(t){return t.api[Md](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function jU(e,t){let{[Zy]:n,...r}=e;return t.inputs?.has(n)||t.error(`Unrecognized input type: ${n}`,e),new h_(n,_r(r,t))}var h_=class extends $t{constructor(t,n){super(Zy),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function m_(e,t){let{[Jy]:n,...r}=e,i=`${n}Legend`;return t.plot?.legends?.has(i)||t.error(`Unrecognized legend type: ${n}`,e),new p_(i,n,_r(r,t))}var p_=class extends $t{constructor(t,n,r){super(Jy),this.key=t,this.name=n,this.options=r}instantiate(t){let n=t.api[this.key];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.key}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function qU(e,t){let{[pD]:n,...r}=e;return t.plot?.interactors?.has(n)||t.error(`Unrecognized interactor type: ${n}`,e),new y_(n,_r(r,t))}var y_=class extends $t{constructor(t,n){super(DU),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{name:t,options:n}=this;return{[pD]:t,...n.toJSON()}}};function VU(e,t){let{label:n}=e,r=e[xc]?xc:e[fa]?fa:t.error("Unrecognized expression type",e),i=e[r],o=i.split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),s=[""],a=[];for(let c=0,l=0;c<o.length;++c){let u=o[c];u.startsWith("$")?(a[l]=t.maybeParam(u),s[++l]=""):s[l]+=u}return new g_(i,s,a,n,r===fa)}var g_=class extends $t{constructor(t,n,r,i,o){super(TU),this.value=t,this.spans=n,this.params=r,this.label=i,this.aggregate=o}instantiate(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=t.api[o?fa:xc],a=r.map(c=>c.instantiate(t));return s(n,...a).annotate({label:i})}codegen(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=o?fa:xc,a="",c=r.length;for(let l=0;l<c;++l)a+=n[l]+"${"+r[l].codegen(t)+"}";return a+=n[c],`${t.ns()}${s}\`${a}\``+(i?`.annotate({ label: ${JSON.stringify(i)} })`:"")}toJSON(){return{[this.aggregate?fa:xc]:this.value}}};function YU(e,t){if(!e)return null;if(xi(e))return new Yl(e);let{from:n,...r}=e;return new x_(n,_r(r,t))}var x_=class extends $t{constructor(t,n){super(mD),this.table=t,this.options=n}instantiate(t){let{table:n,options:r}=this;return t.api[mD](n,r.instantiate(t))}codegen(t){let{type:n,table:r,options:i}=this,o=i.codegen(t);return`${t.ns()}${n}("${r}"${o?", "+o:""})`}toJSON(){let{type:t,table:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function gD(e){return e==null?[]:[e].flat()}function XU(e,t){let n;for(let o in e)t.transforms.has(o)&&(n=o);if(!n)return;let r=n==="count"||n==null?[]:gD(e[n]),i={distinct:e.distinct,orderby:gD(e.orderby).map(o=>t.maybeParam(o)),partitionby:gD(e.partitionby).map(o=>t.maybeParam(o)),rows:e.rows?t.maybeParam(e.rows):null,range:e.range?t.maybeParam(e.range):null};return new b_(n,r,i)}var b_=class extends $t{constructor(t,n,r){super(NU),this.name=t,this.args=n,this.options=r}instantiate(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=t.api[n],f=u(...r);return o&&(f=f.distinct()),s.length&&(f=f.orderby(s.map(d=>d.instantiate(t)))),a.length&&(f=f.partitionby(a.map(d=>d.instantiate(t)))),c!=null?f=f.rows(c.instantiate(t)):l!=null&&(f=f.range(l.instantiate(t))),f}codegen(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=`${t.ns()}${n}(`+r.map(f=>JSON.stringify(f)).join(", ")+")";if(o&&(u+=".distinct()"),s.length){let f=s.map(d=>d.codegen(t));u+=`.orderby(${f.join(", ")})`}if(a.length){let f=a.map(d=>d.codegen(t));u+=`.partitionby(${f.join(", ")})`}return c?u+=`.rows(${c.codegen(t)})`:l&&(u+=`.range(${l.codegen(t)})`),u}toJSON(){let{name:t,args:n,options:r}=this,{distinct:i,orderby:o,partitionby:s,rows:a,range:c}=r,l={[t]:xD(n)};return i&&(l.distinct=!0),o.length&&(l.orderby=xD(o.map(u=>u.toJSON()))),s.length&&(l.partitionby=xD(s.map(u=>u.toJSON()))),a?l.rows=a.toJSON():c&&(l.range=c.toJSON()),l}};function xD(e){return e.length===0?"":e.length===1?e[0]:e}function Wnt(e,t){if(Ed(e))return e[xc]||e[fa]?VU(e,t):XU(e,t)}function GU(e,t){let{mark:n,data:r,...i}=e;t.plot?.marks?.has(n)||t.error(`Unrecognized mark type: ${n}`,e);let o=YU(r,t),s={};for(let a in i){let c=i[a];s[a]=Wnt(c,t)||t.maybeParam(c)}return new w_(n,o,new Dd(s))}var w_=class extends $t{constructor(t,n,r){super(Zv),this.name=t,this.data=n,this.options=r}instantiate(t){let{name:n,data:r,options:i}=this,o=t.api[n],s=i.instantiate(t);return r?o(r.instantiate(t),s):o(s)}codegen(t){let{name:n,data:r,options:i}=this,o=r?r.codegen(t):"",s=i.codegen(t),a;if(o&&s){t.indent();let c=i.codegen(t);a=`
80
+ ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function qU(e){return new d_(e[Td])}var d_=class extends $t{constructor(t){super(Td),this.value=t}instantiate(t){return t.api[Td](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function jU(e,t){let{[Qy]:n,...r}=e;return t.inputs?.has(n)||t.error(`Unrecognized input type: ${n}`,e),new h_(n,_r(r,t))}var h_=class extends $t{constructor(t,n){super(Qy),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function m_(e,t){let{[Ky]:n,...r}=e,i=`${n}Legend`;return t.plot?.legends?.has(i)||t.error(`Unrecognized legend type: ${n}`,e),new p_(i,n,_r(r,t))}var p_=class extends $t{constructor(t,n,r){super(Ky),this.key=t,this.name=n,this.options=r}instantiate(t){let n=t.api[this.key];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.key}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function VU(e,t){let{[gD]:n,...r}=e;return t.plot?.interactors?.has(n)||t.error(`Unrecognized interactor type: ${n}`,e),new y_(n,_r(r,t))}var y_=class extends $t{constructor(t,n){super(OU),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{name:t,options:n}=this;return{[gD]:t,...n.toJSON()}}};function YU(e,t){let{label:n}=e,r=e[xc]?xc:e[fa]?fa:t.error("Unrecognized expression type",e),i=e[r],o=i.split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),s=[""],a=[];for(let c=0,l=0;c<o.length;++c){let u=o[c];u.startsWith("$")?(a[l]=t.maybeParam(u),s[++l]=""):s[l]+=u}return new g_(i,s,a,n,r===fa)}var g_=class extends $t{constructor(t,n,r,i,o){super(EU),this.value=t,this.spans=n,this.params=r,this.label=i,this.aggregate=o}instantiate(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=t.api[o?fa:xc],a=r.map(c=>c.instantiate(t));return s(n,...a).annotate({label:i})}codegen(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=o?fa:xc,a="",c=r.length;for(let l=0;l<c;++l)a+=n[l]+"${"+r[l].codegen(t)+"}";return a+=n[c],`${t.ns()}${s}\`${a}\``+(i?`.annotate({ label: ${JSON.stringify(i)} })`:"")}toJSON(){return{[this.aggregate?fa:xc]:this.value}}};function XU(e,t){if(!e)return null;if(xi(e))return new Yl(e);let{from:n,...r}=e;return new x_(n,_r(r,t))}var x_=class extends $t{constructor(t,n){super(xD),this.table=t,this.options=n}instantiate(t){let{table:n,options:r}=this;return t.api[xD](n,r.instantiate(t))}codegen(t){let{type:n,table:r,options:i}=this,o=i.codegen(t);return`${t.ns()}${n}("${r}"${o?", "+o:""})`}toJSON(){let{type:t,table:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function wD(e){return e==null?[]:[e].flat()}function GU(e,t){let n;for(let o in e)t.transforms.has(o)&&(n=o);if(!n)return;let r=n==="count"||n==null?[]:wD(e[n]),i={distinct:e.distinct,orderby:wD(e.orderby).map(o=>t.maybeParam(o)),partitionby:wD(e.partitionby).map(o=>t.maybeParam(o)),rows:e.rows?t.maybeParam(e.rows):null,range:e.range?t.maybeParam(e.range):null};return new b_(n,r,i)}var b_=class extends $t{constructor(t,n,r){super(DU),this.name=t,this.args=n,this.options=r}instantiate(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=t.api[n],f=u(...r);return o&&(f=f.distinct()),s.length&&(f=f.orderby(s.map(d=>d.instantiate(t)))),a.length&&(f=f.partitionby(a.map(d=>d.instantiate(t)))),c!=null?f=f.rows(c.instantiate(t)):l!=null&&(f=f.range(l.instantiate(t))),f}codegen(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=`${t.ns()}${n}(`+r.map(f=>JSON.stringify(f)).join(", ")+")";if(o&&(u+=".distinct()"),s.length){let f=s.map(d=>d.codegen(t));u+=`.orderby(${f.join(", ")})`}if(a.length){let f=a.map(d=>d.codegen(t));u+=`.partitionby(${f.join(", ")})`}return c?u+=`.rows(${c.codegen(t)})`:l&&(u+=`.range(${l.codegen(t)})`),u}toJSON(){let{name:t,args:n,options:r}=this,{distinct:i,orderby:o,partitionby:s,rows:a,range:c}=r,l={[t]:vD(n)};return i&&(l.distinct=!0),o.length&&(l.orderby=vD(o.map(u=>u.toJSON()))),s.length&&(l.partitionby=vD(s.map(u=>u.toJSON()))),a?l.rows=a.toJSON():c&&(l.range=c.toJSON()),l}};function vD(e){return e.length===0?"":e.length===1?e[0]:e}function Znt(e,t){if(Dd(e))return e[xc]||e[fa]?YU(e,t):GU(e,t)}function WU(e,t){let{mark:n,data:r,...i}=e;t.plot?.marks?.has(n)||t.error(`Unrecognized mark type: ${n}`,e);let o=XU(r,t),s={};for(let a in i){let c=i[a];s[a]=Znt(c,t)||t.maybeParam(c)}return new w_(n,o,new Bd(s))}var w_=class extends $t{constructor(t,n,r){super(Zv),this.name=t,this.data=n,this.options=r}instantiate(t){let{name:n,data:r,options:i}=this,o=t.api[n],s=i.instantiate(t);return r?o(r.instantiate(t),s):o(s)}codegen(t){let{name:n,data:r,options:i}=this,o=r?r.codegen(t):"",s=i.codegen(t),a;if(o&&s){t.indent();let c=i.codegen(t);a=`
81
81
  ${t.tab()}${o},
82
82
  ${t.tab()}${c}
83
- `,t.undent(),a+=t.tab()}else a=`${o}${s}`;return`${t.tab()}${t.ns()}${n}(${a})`}toJSON(){let{type:t,name:n,data:r,options:i}=this;return{[t]:n,...r?{data:r.toJSON()}:{},...i.toJSON()}}};function WU(e,t){return bD({plot:[e]},t)}function bD(e,t){let{[Td]:n,...r}=e,i=Object.entries(r).map(([s,a])=>u_(s,a,t)),o=n.map(s=>Go(s.mark)?GU(s,t):Go(s.legend)?m_(s,t):Go(s.select)?qU(s,t):t.error("Invalid plot entry.",s));return new v_(o,i)}var v_=class extends $t{constructor(t,n){super(Td,t),this.attributes=n}instantiate(t){let n=[...t.plotDefaults||[],...this.attributes||[]];return t.api[Td](this.children.map(r=>r.instantiate(t)),n.map(r=>r.instantiate(t)))}codegen(t){let{type:n,children:r,attributes:i}=this;t.indent();let o=[...r.map(s=>s.codegen(t)),...t.plotDefaults?.length?[`${t.tab()}...defaultAttributes`]:[],...i.map(s=>s.codegen(t))].join(`,
83
+ `,t.undent(),a+=t.tab()}else a=`${o}${s}`;return`${t.tab()}${t.ns()}${n}(${a})`}toJSON(){let{type:t,name:n,data:r,options:i}=this;return{[t]:n,...r?{data:r.toJSON()}:{},...i.toJSON()}}};function HU(e,t){return _D({plot:[e]},t)}function _D(e,t){let{[Nd]:n,...r}=e,i=Object.entries(r).map(([s,a])=>u_(s,a,t)),o=n.map(s=>Go(s.mark)?WU(s,t):Go(s.legend)?m_(s,t):Go(s.select)?VU(s,t):t.error("Invalid plot entry.",s));return new v_(o,i)}var v_=class extends $t{constructor(t,n){super(Nd,t),this.attributes=n}instantiate(t){let n=[...t.plotDefaults||[],...this.attributes||[]];return t.api[Nd](this.children.map(r=>r.instantiate(t)),n.map(r=>r.instantiate(t)))}codegen(t){let{type:n,children:r,attributes:i}=this;t.indent();let o=[...r.map(s=>s.codegen(t)),...t.plotDefaults?.length?[`${t.tab()}...defaultAttributes`]:[],...i.map(s=>s.codegen(t))].join(`,
84
84
  `);return t.undent(),`${t.tab()}${t.ns()}${n}(
85
85
  ${o}
86
- ${t.tab()})`}toJSON(){let{type:t,children:n,attributes:r}=this,i={[t]:n.map(o=>o.toJSON())};for(let o of r)Object.assign(i,o.toJSON());return i}};function HU(e,t){let n=e[Id].map(r=>t.parseComponent(r));return new __(n)}var __=class extends $t{constructor(t){super(Id,t)}instantiate(t){return t.api[Id](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
86
+ ${t.tab()})`}toJSON(){let{type:t,children:n,attributes:r}=this,i={[t]:n.map(o=>o.toJSON())};for(let o of r)Object.assign(i,o.toJSON());return i}};function ZU(e,t){let n=e[Ad].map(r=>t.parseComponent(r));return new __(n)}var __=class extends $t{constructor(t){super(Ad,t)}instantiate(t){return t.api[Ad](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
87
87
  ${n.join(`,
88
88
  `)}
89
- ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function ZU(e){return new S_(e[Ad])}var S_=class extends $t{constructor(t){super(Ad),this.value=t}instantiate(t){return t.api[Ad](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function JU(e=[]){return new Map([[Td,bD],[Zv,WU],[Jy,m_],[Zy,jU],[Sd,UU],[Id,HU],[Md,zU],[Ad,ZU],...e])}function QU(e=[]){return new Set(["menu","search","slider","table",...e])}function KU({attributes:e=Hnt(),interactors:t=Znt(),legends:n=Jnt(),marks:r=Qnt()}={}){return{attributes:e,interactors:t,legends:n,marks:r}}function Hnt(e=[]){return new Set([...Object.keys(qv),...e])}function Znt(e=[]){return new Set([...Object.keys(Yv),...e])}function Jnt(e=[]){return new Set([...Object.keys(Xv),...e])}function Qnt(e=[]){return new Set([...Object.keys(Vv),...e])}function tz(e=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","count","dateMonth","dateMonthDay","dateDay","first","geojson","last","max","median","min","mode","product","quantile","sum","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value",...e])}function Knt(e,t){return e=Go(e)?JSON.parse(e):e,new wD(t).parse(e)}var wD=class{constructor({components:t=JU(),transforms:n=tz(),inputs:r=QU(),plot:i=KU(),params:o=[],datasets:s=[]}={}){this.components=t,this.transforms=n,this.inputs=r,this.plot=i,this.params=new Map(o),this.datasets=new Map(s)}parse(t){let{meta:n,config:r,data:i={},params:o,plotDefaults:s={},...a}=t;for(let c in i)this.datasets.set(c,$U(c,i[c],this));this.plotDefaults=Object.entries(s).map(([c,l])=>u_(c,l,this));for(let c in o)this.params.set(c,PU(o[c],this));return new Ky(this.parseComponent(a),n?{...n}:void 0,r?{...r}:void 0,Object.fromEntries(this.datasets),Object.fromEntries(this.params),this.plotDefaults)}parseComponent(t){for(let[n,r]of this.components)if(t[n]!=null)return r(t,this);this.error("Invalid specification.",t)}maybeParam(t,n=()=>new Gl){let{params:r}=this,i=OU(t);if(i){if(!r.has(i)){let o=n();r.set(i,o)}return new ng(i)}return new Yl(t)}maybeSelection(t){return this.maybeParam(t,()=>new Xl)}error(t,n){Nd(t,n)}};export{fa as AGG,$t as ASTNode,EU as ATTRIBUTE,SU as CROSSFILTER,e_ as CSVDataNode,a_ as CodegenContext,AU as DATA,zVt as DATAREF,Jv as DataNode,TU as EXPRESSION,g_ as ExpressionNode,Qy as FIXED,mD as FROM,Vl as FileDataNode,Sd as HCONCAT,f_ as HConcatNode,Md as HSPACE,d_ as HSpaceNode,Zy as INPUT,DU as INTERACTOR,Hv as INTERSECT,h_ as InputNode,s_ as InstantiateContext,n_ as JSONDataNode,Jy as LEGEND,Gv as LITERAL,r_ as LiteralJSONDataNode,Yl as LiteralNode,Zv as MARK,bU as OPTIONS,Dd as OptionsNode,_U as PARAM,vU as PARAMREF,Td as PLOT,Gl as ParamNode,ng as ParamRefNode,t_ as ParquetDataNode,c_ as PlotAttributeNode,l_ as PlotFixedNode,x_ as PlotFromNode,y_ as PlotInteractorNode,p_ as PlotLegendNode,w_ as PlotMarkNode,v_ as PlotNode,Od as QueryDataNode,pD as SELECT,wU as SELECTION,MU as SINGLE,xU as SPEC,xc as SQL,Xl as SelectionNode,Kv as SpatialDataNode,Ky as SpecNode,NU as TRANSFORM,Qv as TableDataNode,b_ as TransformNode,IU as UNION,Wv as VALUE,Id as VCONCAT,__ as VConcatNode,Ad as VSPACE,S_ as VSpaceNode,Vnt as astToDOM,Ynt as astToESM,Knt as parseSpec};
89
+ ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function JU(e){return new S_(e[Ed])}var S_=class extends $t{constructor(t){super(Ed),this.value=t}instantiate(t){return t.api[Ed](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function QU(e=[]){return new Map([[Nd,_D],[Zv,HU],[Ky,m_],[Qy,jU],[Md,zU],[Ad,ZU],[Td,qU],[Ed,JU],...e])}function KU(e=[]){return new Set(["menu","search","slider","table",...e])}function tz({attributes:e=Jnt(),interactors:t=Qnt(),legends:n=Knt(),marks:r=trt()}={}){return{attributes:e,interactors:t,legends:n,marks:r}}function Jnt(e=[]){return new Set([...Object.keys(jv),...e])}function Qnt(e=[]){return new Set([...Object.keys(Yv),...e])}function Knt(e=[]){return new Set([...Object.keys(Xv),...e])}function trt(e=[]){return new Set([...Object.keys(Vv),...e])}function ez(e=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","count","dateMonth","dateMonthDay","dateDay","first","geojson","last","max","median","min","mode","product","quantile","sum","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value",...e])}function ert(e,t){return e=Go(e)?JSON.parse(e):e,new SD(t).parse(e)}var SD=class{constructor({components:t=QU(),transforms:n=ez(),inputs:r=KU(),plot:i=tz(),params:o=[],datasets:s=[]}={}){this.components=t,this.transforms=n,this.inputs=r,this.plot=i,this.params=new Map(o),this.datasets=new Map(s)}parse(t){let{meta:n,config:r,data:i={},params:o,plotDefaults:s={},...a}=t;for(let c in i)this.datasets.set(c,PU(c,i[c],this));this.plotDefaults=Object.entries(s).map(([c,l])=>u_(c,l,this));for(let c in o)this.params.set(c,UU(o[c],this));return new eg(this.parseComponent(a),n?{...n}:void 0,r?{...r}:void 0,Object.fromEntries(this.datasets),Object.fromEntries(this.params),this.plotDefaults)}parseComponent(t){for(let[n,r]of this.components)if(t[n]!=null)return r(t,this);this.error("Invalid specification.",t)}maybeParam(t,n=()=>new Gl){let{params:r}=this,i=BU(t);if(i){if(!r.has(i)){let o=n();r.set(i,o)}return new ig(i)}return new Yl(t)}maybeSelection(t){return this.maybeParam(t,()=>new Xl)}error(t,n){Od(t,n)}};export{fa as AGG,$t as ASTNode,NU as ATTRIBUTE,IU as CROSSFILTER,e_ as CSVDataNode,a_ as CodegenContext,TU as DATA,qVt as DATAREF,Jv as DataNode,EU as EXPRESSION,g_ as ExpressionNode,tg as FIXED,xD as FROM,Vl as FileDataNode,Md as HCONCAT,f_ as HConcatNode,Td as HSPACE,d_ as HSpaceNode,Qy as INPUT,OU as INTERACTOR,Hv as INTERSECT,h_ as InputNode,s_ as InstantiateContext,n_ as JSONDataNode,Ky as LEGEND,Gv as LITERAL,r_ as LiteralJSONDataNode,Yl as LiteralNode,Zv as MARK,wU as OPTIONS,Bd as OptionsNode,SU as PARAM,_U as PARAMREF,Nd as PLOT,Gl as ParamNode,ig as ParamRefNode,t_ as ParquetDataNode,c_ as PlotAttributeNode,l_ as PlotFixedNode,x_ as PlotFromNode,y_ as PlotInteractorNode,p_ as PlotLegendNode,w_ as PlotMarkNode,v_ as PlotNode,Ld as QueryDataNode,gD as SELECT,vU as SELECTION,AU as SINGLE,bU as SPEC,xc as SQL,Xl as SelectionNode,Kv as SpatialDataNode,eg as SpecNode,DU as TRANSFORM,Qv as TableDataNode,b_ as TransformNode,MU as UNION,Wv as VALUE,Ad as VCONCAT,__ as VConcatNode,Ed as VSPACE,S_ as VSpaceNode,Xnt as astToDOM,Gnt as astToESM,ert as parseSpec};