@uwdata/vgplot 0.9.0 → 0.11.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,28 +1,19 @@
1
- var VX=Object.create;var wA=Object.defineProperty;var jX=Object.getOwnPropertyDescriptor;var qX=Object.getOwnPropertyNames;var YX=Object.getPrototypeOf,WX=Object.prototype.hasOwnProperty;var $k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Tr=(e,t)=>{for(var r in t)wA(e,r,{get:t[r],enumerable:!0})},GX=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qX(t))!WX.call(e,i)&&i!==r&&wA(e,i,{get:()=>t[i],enumerable:!(n=jX(t,i))||n.enumerable});return e};var XX=(e,t,r)=>(r=e!=null?VX(YX(e)):{},GX(t||!e||!e.__esModule?wA(r,"default",{value:e,enumerable:!0}):r,e));var wG=$k((jie,_G)=>{"use strict";function ldt(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>=0?(o=s,i=s-1):n=s+1}return o}function udt(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>0?(o=s,i=s-1):n=s+1}return o}function fdt(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<0?(o=s,n=s+1):i=s-1}return o}function ddt(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<=0?(o=s,n=s+1):i=s-1}return o}function hdt(e,t,r,n,i){for(;n<=i;){var o=n+i>>>1,s=e[o],a=r!==void 0?r(s,t):s-t;if(a===0)return o;a<=0?n=o+1:i=o-1}return-1}function Cx(e,t,r,n,i,o){return typeof r=="function"?o(e,t,r,n===void 0?0:n|0,i===void 0?e.length-1:i|0):o(e,t,void 0,r===void 0?0:r|0,n===void 0?e.length-1:n|0)}_G.exports={ge:function(e,t,r,n,i){return Cx(e,t,r,n,i,ldt)},gt:function(e,t,r,n,i){return Cx(e,t,r,n,i,udt)},lt:function(e,t,r,n,i){return Cx(e,t,r,n,i,fdt)},le:function(e,t,r,n,i){return Cx(e,t,r,n,i,ddt)},eq:function(e,t,r,n,i){return Cx(e,t,r,n,i,hdt)}}});var DG=$k((qie,EG)=>{"use strict";var eA=wG(),wm=0,Nd=1,tA=2;EG.exports=mdt;function $6(e,t,r,n,i){this.mid=e,this.left=t,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(t?t.count:0)+(r?r.count:0)+n.length}var Ux=$6.prototype;function U6(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 IG(e,t){var r=vm(t);e.mid=r.mid,e.left=r.left,e.right=r.right,e.leftPoints=r.leftPoints,e.rightPoints=r.rightPoints,e.count=r.count}function vG(e,t){var r=e.intervals([]);r.push(t),IG(e,r)}function SG(e,t){var r=e.intervals([]),n=r.indexOf(t);return n<0?wm:(r.splice(n,1),IG(e,r),Nd)}Ux.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Ux.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)?vG(this,e):this.left.insert(e):this.left=vm([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?vG(this,e):this.right.insert(e):this.right=vm([e]);else{var r=eA.ge(this.leftPoints,e,z6),n=eA.ge(this.rightPoints,e,V6);this.leftPoints.splice(r,0,e),this.rightPoints.splice(n,0,e)}};Ux.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return wm;var r=this.right?this.right.count:0;if(4*r>3*(t-1))return SG(this,e);var n=this.left.remove(e);return n===tA?(this.left=null,this.count-=1,Nd):(n===Nd&&(this.count-=1),n)}else if(e[0]>this.mid){if(!this.right)return wm;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return SG(this,e);var n=this.right.remove(e);return n===tA?(this.right=null,this.count-=1,Nd):(n===Nd&&(this.count-=1),n)}else{if(this.count===1)return this.leftPoints[0]===e?tA:wm;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,n=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=n}U6(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?U6(this,this.left):U6(this,this.right);return Nd}for(var a=eA.ge(this.leftPoints,e,z6);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var n=eA.ge(this.rightPoints,e,V6);n<this.rightPoints.length&&this.rightPoints[n][1]===e[1];++n)if(this.rightPoints[n]===e)return this.rightPoints.splice(n,1),Nd}return wm}};function TG(e,t,r){for(var n=0;n<e.length&&e[n][0]<=t;++n){var i=r(e[n]);if(i)return i}}function AG(e,t,r){for(var n=e.length-1;n>=0&&e[n][1]>=t;--n){var i=r(e[n]);if(i)return i}}function MG(e,t){for(var r=0;r<e.length;++r){var n=t(e[r]);if(n)return n}}Ux.queryPoint=function(e,t){if(e<this.mid){if(this.left){var r=this.left.queryPoint(e,t);if(r)return r}return TG(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var r=this.right.queryPoint(e,t);if(r)return r}return AG(this.rightPoints,e,t)}else return MG(this.leftPoints,t)};Ux.queryInterval=function(e,t,r){if(e<this.mid&&this.left){var n=this.left.queryInterval(e,t,r);if(n)return n}if(t>this.mid&&this.right){var n=this.right.queryInterval(e,t,r);if(n)return n}return t<this.mid?TG(this.leftPoints,t,r):e>this.mid?AG(this.rightPoints,e,r):MG(this.leftPoints,r)};function pdt(e,t){return e-t}function z6(e,t){var r=e[0]-t[0];return r||e[1]-t[1]}function V6(e,t){var r=e[1]-t[1];return r||e[0]-t[0]}function vm(e){if(e.length===0)return null;for(var t=[],r=0;r<e.length;++r)t.push(e[r][0],e[r][1]);t.sort(pdt);for(var n=t[t.length>>1],i=[],o=[],s=[],r=0;r<e.length;++r){var a=e[r];a[1]<n?i.push(a):n<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(z6),l.sort(V6),new $6(n,vm(i),vm(o),c,l)}function P6(e){this.root=e}var Sm=P6.prototype;Sm.insert=function(e){this.root?this.root.insert(e):this.root=new $6(e[0],null,null,[e],[e])};Sm.remove=function(e){if(this.root){var t=this.root.remove(e);return t===tA&&(this.root=null),t!==wm}return!1};Sm.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};Sm.queryInterval=function(e,t,r){if(e<=t&&this.root)return this.root.queryInterval(e,t,r)};Object.defineProperty(Sm,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(Sm,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function mdt(e){return!e||e.length===0?new P6(null):new P6(vm(e))}});var zk={};function Om(e,t=!1){let r,n,i=zk;function o(l){r=e(l).then(()=>{if(n){let{value:u}=n;n=null,o(u)}else r=null})}function s(l){n={event:l}}function a(l){r?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=zk,a(u)}),i=l}return t?c:a}var li=class{constructor(t){this._filterBy=t,this._requestUpdate=Om(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(t){return this}query(t){return null}queryPending(){return this}queryResult(t){return this}queryError(t){return console.error(t),this}requestQuery(t){let r=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,r)}requestUpdate(){this._requestUpdate()}update(){return this}};function h_(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function P(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(f){s(f)}}function c(u){try{l(n.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function Vk(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(e){return this instanceof H?(this.v=e,this):new H(e)}function Ve(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){n[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(n[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof H?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 to(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:H(e[i](s)),done:!1}:o?o(s):s}:o}}function fr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Vk=="function"?Vk(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var MA={};Tr(MA,{compareArrayLike:()=>AA,joinUint8Arrays:()=>Bi,memcpy:()=>Rm,rebaseValueOffsets:()=>w_,toArrayBufferView:()=>ee,toArrayBufferViewAsyncIterator:()=>Co,toArrayBufferViewIterator:()=>Es,toBigInt64Array:()=>__,toBigUint64Array:()=>nH,toFloat32Array:()=>iH,toFloat32ArrayAsyncIterator:()=>_H,toFloat32ArrayIterator:()=>dH,toFloat64Array:()=>oH,toFloat64ArrayAsyncIterator:()=>wH,toFloat64ArrayIterator:()=>hH,toInt16Array:()=>tH,toInt16ArrayAsyncIterator:()=>yH,toInt16ArrayIterator:()=>cH,toInt32Array:()=>Wu,toInt32ArrayAsyncIterator:()=>gH,toInt32ArrayIterator:()=>lH,toInt8Array:()=>JX,toInt8ArrayAsyncIterator:()=>mH,toInt8ArrayIterator:()=>aH,toUint16Array:()=>eH,toUint16ArrayAsyncIterator:()=>bH,toUint16ArrayIterator:()=>uH,toUint32Array:()=>rH,toUint32ArrayAsyncIterator:()=>xH,toUint32ArrayIterator:()=>fH,toUint8Array:()=>Et,toUint8ArrayAsyncIterator:()=>TA,toUint8ArrayIterator:()=>IA,toUint8ClampedArray:()=>sH,toUint8ClampedArrayAsyncIterator:()=>vH,toUint8ClampedArrayIterator:()=>pH});var HX=new TextDecoder("utf-8"),Nm=e=>HX.decode(e),ZX=new TextEncoder,Ms=e=>ZX.encode(e);var KX=e=>typeof e=="number",jk=e=>typeof e=="boolean",zr=e=>typeof e=="function",Pn=e=>e!=null&&Object(e)===e,Di=e=>Pn(e)&&zr(e.then);var ko=e=>Pn(e)&&zr(e[Symbol.iterator]),eo=e=>Pn(e)&&zr(e[Symbol.asyncIterator]),p_=e=>Pn(e)&&Pn(e.schema);var m_=e=>Pn(e)&&"done"in e&&"value"in e;var y_=e=>Pn(e)&&zr(e.stat)&&KX(e.fd);var g_=e=>Pn(e)&&Fm(e.body),b_=e=>"_getDOMStream"in e&&"_getNodeStream"in e,qk=e=>Pn(e)&&zr(e.abort)&&zr(e.getWriter)&&!b_(e),Fm=e=>Pn(e)&&zr(e.cancel)&&zr(e.getReader)&&!b_(e),Yk=e=>Pn(e)&&zr(e.end)&&zr(e.write)&&jk(e.writable)&&!b_(e),x_=e=>Pn(e)&&zr(e.read)&&zr(e.pipe)&&jk(e.readable)&&!b_(e),Wk=e=>Pn(e)&&zr(e.clear)&&zr(e.bytes)&&zr(e.position)&&zr(e.setPosition)&&zr(e.capacity)&&zr(e.getBufferIdentifier)&&zr(e.createLong);var SA=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function QX(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function Rm(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function Bi(e,t){let r=QX(e),n=r.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=r.length;++c<u;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?Rm(s,o,a):s=o;break}Rm(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function ee(e,t){let r=m_(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Ms(r)),r instanceof ArrayBuffer?new e(r):r instanceof SA?new e(r):Wk(r)?ee(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var JX=e=>ee(Int8Array,e),tH=e=>ee(Int16Array,e),Wu=e=>ee(Int32Array,e),__=e=>ee(BigInt64Array,e),Et=e=>ee(Uint8Array,e),eH=e=>ee(Uint16Array,e),rH=e=>ee(Uint32Array,e),nH=e=>ee(BigUint64Array,e),iH=e=>ee(Float32Array,e),oH=e=>ee(Float64Array,e),sH=e=>ee(Uint8ClampedArray,e),vA=e=>(e.next(),e);function*Es(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof SA?r(t):ko(t)?t:r(t);return yield*vA(function*(i){let o=null;do o=i.next(yield ee(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var aH=e=>Es(Int8Array,e),cH=e=>Es(Int16Array,e),lH=e=>Es(Int32Array,e),IA=e=>Es(Uint8Array,e),uH=e=>Es(Uint16Array,e),fH=e=>Es(Uint32Array,e),dH=e=>Es(Float32Array,e),hH=e=>Es(Float64Array,e),pH=e=>Es(Uint8ClampedArray,e);function Co(e,t){return Ve(this,arguments,function*(){if(Di(t))return yield H(yield H(yield*to(fr(Co(e,yield H(t))))));let n=function(s){return Ve(this,arguments,function*(){yield yield H(yield H(s))})},i=function(s){return Ve(this,arguments,function*(){yield H(yield*to(fr(vA(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 SA?n(t):ko(t)?i(t):eo(t)?t:n(t);return yield H(yield*to(fr(vA(function(s){return Ve(this,arguments,function*(){let a=null;do a=yield H(s.next(yield yield H(ee(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield H(new e)})}var mH=e=>Co(Int8Array,e),yH=e=>Co(Int16Array,e),gH=e=>Co(Int32Array,e),TA=e=>Co(Uint8Array,e),bH=e=>Co(Uint16Array,e),xH=e=>Co(Uint32Array,e),_H=e=>Co(Float32Array,e),wH=e=>Co(Float64Array,e),vH=e=>Co(Uint8ClampedArray,e);function w_(e,t,r){if(e!==0){r=r.slice(0,t);for(let n=-1,i=r.length;++n<i;)r[n]+=e}return r.subarray(0,t)}function AA(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var cn={fromIterable(e){return v_(SH(e))},fromAsyncIterable(e){return v_(IH(e))},fromDOMStream(e){return v_(TH(e))},fromNodeStream(e){return v_(AH(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')}},v_=e=>(e.next(),e);function*SH(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?Bi(n,s)[0]:([i,n,a]=Bi(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=IA(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(r=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function IH(e){return Ve(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Bi(i,a)[0]:([o,i,c]=Bi(i,a),o)}({cmd:s,size:a}=(yield yield H(null))||{cmd:"read",size:0});let u=TA(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.next()):yield H(u.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&typeof u.throw=="function"&&(yield H(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield H(u.return(new Uint8Array(0))))}return yield H(null)})}function TH(e){return Ve(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Bi(i,a)[0]:([o,i,c]=Bi(i,a),o)}({cmd:s,size:a}=(yield yield H(null))||{cmd:"read",size:0});let u=new DA(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.read()):yield H(u.read(a-c)),!r&&o.byteLength>0&&(i.push(Et(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&(yield H(u.cancel(f)))}finally{n===!1?yield H(u.cancel()):e.locked&&u.releaseLock()}return yield H(null)})}var DA=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 P(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return P(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Et(r)),r})}},EA=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function AH(e){return Ve(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Bi(l,a)[0]:([u,l,c]=Bi(l,a),u)}if({cmd:s,size:a}=(yield yield H(null))||{cmd:"read",size:0},e.isTTY)return yield yield H(new Uint8Array(0)),yield H(null);try{r[0]=EA(e,"end"),r[1]=EA(e,"error");do{if(r[2]=EA(e,"readable"),[n,o]=yield H(Promise.race(r.map(h=>h[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=Et(e.read(a-c)),u.byteLength<a-c&&(u=Et(e.read()))):u=Et(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield H(f()));while(a<c)}while(!i)}finally{yield H(d(r,n==="error"?o:null))}return yield H(null);function d(h,p){return u=l=null,new Promise((m,y)=>{for(let[g,b]of h)e.off(g,b);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var De;(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"})(De||(De={}));var Pe;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Pe||(Pe={}));var Le;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Le||(Le={}));var Ar;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Ar||(Ar={}));var ft;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ft||(ft={}));var Hr;(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"})(Hr||(Hr={}));var Ds=new Int32Array(2),S_=new Float32Array(Ds.buffer),I_=new Float64Array(Ds.buffer),Pd=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Lm;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Lm||(Lm={}));var Mr=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 Ds[0]=this.readInt32(t),S_[0]}readFloat64(t){return Ds[Pd?0:1]=this.readInt32(t),Ds[Pd?1:0]=this.readInt32(t+4),I_[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){S_[0]=r,this.writeInt32(t,Ds[0])}writeFloat64(t,r){I_[0]=r,this.writeInt32(t,Ds[Pd?0:1]),this.writeInt32(t+4,Ds[Pd?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===Lm.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var Po=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=Mr.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=Mr.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length);for(let n=0,i=this.space,o=this.bb.bytes();n<r.length;n++)o[i++]=r[n];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var km;(function(e){e[e.BUFFER=0]="BUFFER"})(km||(km={}));var Cm;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Cm||(Cm={}));var A_=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Cm.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):km.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,Cm.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,km.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}};var $d=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var zd=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Oi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new zd).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new $d).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new A_).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var ja=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Oi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var xl;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(xl||(xl={}));var Um;(function(e){e[e.DenseArray=0]="DenseArray"})(Um||(Um={}));var $o=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}};var Bs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new $o).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Um.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,Um.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Vr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}};var Pm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var $m=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var _l=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ar.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Ar.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}};var Os=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}};var wl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ft.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ft.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}};var vl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}};var Sl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}};var Il=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Le.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,Le.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}};var Tl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Hr.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Hr.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}};var zm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}};var Vm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}};var jm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var Al=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}};var qm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var Ym=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var qa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ft.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ft.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}};var Ya=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ft.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ft.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}};var zo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Pe.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,Pe.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}};var Wm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var ke;(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"})(ke||(ke={}));var An=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ke.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Bs).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new Vr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,ke.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var ui=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):xl.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new An).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Vr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,xl.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var se;(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"})(se||(se={}));var R;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.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"})(R||(R={}));var Vo;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Vo||(Vo={}));var XA={};Tr(XA,{clampIndex:()=>hZ,clampRange:()=>sy,createElementComparator:()=>Dl});var BA={};Tr(BA,{valueToString:()=>jo});function jo(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=>jo(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var NA={};Tr(NA,{BN:()=>Xm,bigNumToBigInt:()=>Hk,bigNumToString:()=>qd,isArrowBigNumSymbol:()=>Gk});var Gk=Symbol.for("isArrowBigNum");function qo(e,...t){return t.length===0?Object.setPrototypeOf(ee(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}qo.prototype[Gk]=!0;qo.prototype.toJSON=function(){return`"${qd(this)}"`};qo.prototype.valueOf=function(){return Xk(this)};qo.prototype.toString=function(){return qd(this)};qo.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Xk(this);case"string":return qd(this);case"default":return Hk(this)}return qd(this)};function Vd(...e){return qo.apply(this,e)}function jd(...e){return qo.apply(this,e)}function Gm(...e){return qo.apply(this,e)}Object.setPrototypeOf(Vd.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(jd.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Gm.prototype,Object.create(Uint32Array.prototype));Object.assign(Vd.prototype,qo.prototype,{constructor:Vd,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(jd.prototype,qo.prototype,{constructor:jd,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Gm.prototype,qo.prototype,{constructor:Gm,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function Xk(e){let{buffer:t,byteOffset:r,length:n,signed:i}=e,o=new BigUint64Array(t,r,n),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 qd=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return OA(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return OA(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${OA(t)}`},Hk=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:qd(e);function OA(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Xm=class e{static new(t,r){switch(r){case!0:return new Vd(t);case!1:return new jd(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Vd(t)}return t.byteLength===16?new Gm(t):new jd(t)}static signed(t){return new Vd(t)}static unsigned(t){return new jd(t)}static decimal(t){return new Gm(t)}constructor(t,r){return e.new(t,r)}};function or(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 Zk,Kk,Qk,Jk,tC,eC,rC,nC,iC,oC,sC,aC,cC,lC,uC,fC,dC,hC,pC,mC,yC,gC,J=class e{static isNull(t){return t?.typeId===R.Null}static isInt(t){return t?.typeId===R.Int}static isFloat(t){return t?.typeId===R.Float}static isBinary(t){return t?.typeId===R.Binary}static isLargeBinary(t){return t?.typeId===R.LargeBinary}static isUtf8(t){return t?.typeId===R.Utf8}static isLargeUtf8(t){return t?.typeId===R.LargeUtf8}static isBool(t){return t?.typeId===R.Bool}static isDecimal(t){return t?.typeId===R.Decimal}static isDate(t){return t?.typeId===R.Date}static isTime(t){return t?.typeId===R.Time}static isTimestamp(t){return t?.typeId===R.Timestamp}static isInterval(t){return t?.typeId===R.Interval}static isDuration(t){return t?.typeId===R.Duration}static isList(t){return t?.typeId===R.List}static isStruct(t){return t?.typeId===R.Struct}static isUnion(t){return t?.typeId===R.Union}static isFixedSizeBinary(t){return t?.typeId===R.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===R.FixedSizeList}static isMap(t){return t?.typeId===R.Map}static isDictionary(t){return t?.typeId===R.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===Pe.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===Pe.Sparse}constructor(t){this.typeId=t}};Zk=Symbol.toStringTag;J[Zk]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(J.prototype);var Mn=class extends J{constructor(){super(R.Null)}toString(){return"Null"}};Kk=Symbol.toStringTag;Mn[Kk]=(e=>e[Symbol.toStringTag]="Null")(Mn.prototype);var dr=class extends J{constructor(t,r){super(R.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Qk=Symbol.toStringTag;dr[Qk]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(dr.prototype);var Hm=class extends dr{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Zm=class extends dr{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Yo=class extends dr{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Km=class extends dr{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Qm=class extends dr{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Jm=class extends dr{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ty=class extends dr{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},ey=class extends dr{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Hm.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Zm.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Yo.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Km.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Qm.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Jm.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ty.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(ey.prototype,"ArrayType",{value:BigUint64Array});var $n=class extends J{constructor(t){super(R.Float),this.precision=t}get ArrayType(){switch(this.precision){case Le.HALF:return Uint16Array;case Le.SINGLE:return Float32Array;case Le.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Jk=Symbol.toStringTag;$n[Jk]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))($n.prototype);var ry=class extends $n{constructor(){super(Le.HALF)}},ny=class extends $n{constructor(){super(Le.SINGLE)}},iy=class extends $n{constructor(){super(Le.DOUBLE)}};Object.defineProperty(ry.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ny.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(iy.prototype,"ArrayType",{value:Float64Array});var Ns=class extends J{constructor(){super(R.Binary)}toString(){return"Binary"}};tC=Symbol.toStringTag;Ns[tC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Ns.prototype);var Fs=class extends J{constructor(){super(R.LargeBinary)}toString(){return"LargeBinary"}};eC=Symbol.toStringTag;Fs[eC]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Fs.prototype);var Rs=class extends J{constructor(){super(R.Utf8)}toString(){return"Utf8"}};rC=Symbol.toStringTag;Rs[rC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Rs.prototype);var Ls=class extends J{constructor(){super(R.LargeUtf8)}toString(){return"LargeUtf8"}};nC=Symbol.toStringTag;Ls[nC]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(Ls.prototype);var ks=class extends J{constructor(){super(R.Bool)}toString(){return"Bool"}};iC=Symbol.toStringTag;ks[iC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(ks.prototype);var Cs=class extends J{constructor(t,r,n=128){super(R.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};oC=Symbol.toStringTag;Cs[oC]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Cs.prototype);var Us=class extends J{constructor(t){super(R.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Ar[this.unit]}>`}};sC=Symbol.toStringTag;Us[sC]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Us.prototype);var no=class extends J{constructor(t,r){super(R.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${ft[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};aC=Symbol.toStringTag;no[aC]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(no.prototype);var Ps=class extends J{constructor(t,r){super(R.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${ft[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};cC=Symbol.toStringTag;Ps[cC]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Ps.prototype);var $s=class extends J{constructor(t){super(R.Interval),this.unit=t}toString(){return`Interval<${Hr[this.unit]}>`}};lC=Symbol.toStringTag;$s[lC]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))($s.prototype);var zs=class extends J{constructor(t){super(R.Duration),this.unit=t}toString(){return`Duration<${ft[this.unit]}>`}};uC=Symbol.toStringTag;zs[uC]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(zs.prototype);var io=class extends J{constructor(t){super(R.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}};fC=Symbol.toStringTag;io[fC]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(io.prototype);var $e=class extends J{constructor(t){super(R.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};dC=Symbol.toStringTag;$e[dC]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))($e.prototype);var oo=class extends J{constructor(t,r,n){super(R.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};hC=Symbol.toStringTag;oo[hC]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(oo.prototype);var Vs=class extends J{constructor(t){super(R.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};pC=Symbol.toStringTag;Vs[pC]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Vs.prototype);var so=class extends J{constructor(t,r){super(R.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};mC=Symbol.toStringTag;so[mC]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(so.prototype);var ao=class extends J{constructor(t,r=!1){var n,i,o;if(super(R.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};yC=Symbol.toStringTag;ao[yC]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(ao.prototype);var MH=(e=>()=>++e)(-1),fi=class extends J{constructor(t,r,n,i){super(R.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?MH():or(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};gC=Symbol.toStringTag;fi[gC]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(fi.prototype);function Ni(e){let t=e;switch(e.typeId){case R.Decimal:return e.bitWidth/32;case R.Timestamp:return 2;case R.Date:return 1+t.unit;case R.Interval:return 1+t.unit;case R.FixedSizeList:return t.listSize;case R.FixedSizeBinary:return t.byteWidth;default:return 1}}var _t=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return EH(this,t,r)}getVisitFnByTypeId(t,r=!0){return Yd(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function EH(e,t,r=!0){return typeof t=="number"?Yd(e,t,r):typeof t=="string"&&t in R?Yd(e,R[t],r):t&&t instanceof J?Yd(e,bC(t),r):t?.type&&t.type instanceof J?Yd(e,bC(t.type),r):Yd(e,R.NONE,r)}function Yd(e,t,r=!0){let n=null;switch(t){case R.Null:n=e.visitNull;break;case R.Bool:n=e.visitBool;break;case R.Int:n=e.visitInt;break;case R.Int8:n=e.visitInt8||e.visitInt;break;case R.Int16:n=e.visitInt16||e.visitInt;break;case R.Int32:n=e.visitInt32||e.visitInt;break;case R.Int64:n=e.visitInt64||e.visitInt;break;case R.Uint8:n=e.visitUint8||e.visitInt;break;case R.Uint16:n=e.visitUint16||e.visitInt;break;case R.Uint32:n=e.visitUint32||e.visitInt;break;case R.Uint64:n=e.visitUint64||e.visitInt;break;case R.Float:n=e.visitFloat;break;case R.Float16:n=e.visitFloat16||e.visitFloat;break;case R.Float32:n=e.visitFloat32||e.visitFloat;break;case R.Float64:n=e.visitFloat64||e.visitFloat;break;case R.Utf8:n=e.visitUtf8;break;case R.LargeUtf8:n=e.visitLargeUtf8;break;case R.Binary:n=e.visitBinary;break;case R.LargeBinary:n=e.visitLargeBinary;break;case R.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case R.Date:n=e.visitDate;break;case R.DateDay:n=e.visitDateDay||e.visitDate;break;case R.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case R.Timestamp:n=e.visitTimestamp;break;case R.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case R.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case R.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case R.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case R.Time:n=e.visitTime;break;case R.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case R.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case R.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case R.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case R.Decimal:n=e.visitDecimal;break;case R.List:n=e.visitList;break;case R.Struct:n=e.visitStruct;break;case R.Union:n=e.visitUnion;break;case R.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case R.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case R.Dictionary:n=e.visitDictionary;break;case R.Interval:n=e.visitInterval;break;case R.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case R.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case R.Duration:n=e.visitDuration;break;case R.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case R.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case R.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case R.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case R.FixedSizeList:n=e.visitFixedSizeList;break;case R.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${R[t]}'`)}function bC(e){switch(e.typeId){case R.Null:return R.Null;case R.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?R.Int8:R.Uint8;case 16:return r?R.Int16:R.Uint16;case 32:return r?R.Int32:R.Uint32;case 64:return r?R.Int64:R.Uint64}return R.Int}case R.Float:switch(e.precision){case Le.HALF:return R.Float16;case Le.SINGLE:return R.Float32;case Le.DOUBLE:return R.Float64}return R.Float;case R.Binary:return R.Binary;case R.LargeBinary:return R.LargeBinary;case R.Utf8:return R.Utf8;case R.LargeUtf8:return R.LargeUtf8;case R.Bool:return R.Bool;case R.Decimal:return R.Decimal;case R.Time:switch(e.unit){case ft.SECOND:return R.TimeSecond;case ft.MILLISECOND:return R.TimeMillisecond;case ft.MICROSECOND:return R.TimeMicrosecond;case ft.NANOSECOND:return R.TimeNanosecond}return R.Time;case R.Timestamp:switch(e.unit){case ft.SECOND:return R.TimestampSecond;case ft.MILLISECOND:return R.TimestampMillisecond;case ft.MICROSECOND:return R.TimestampMicrosecond;case ft.NANOSECOND:return R.TimestampNanosecond}return R.Timestamp;case R.Date:switch(e.unit){case Ar.DAY:return R.DateDay;case Ar.MILLISECOND:return R.DateMillisecond}return R.Date;case R.Interval:switch(e.unit){case Hr.DAY_TIME:return R.IntervalDayTime;case Hr.YEAR_MONTH:return R.IntervalYearMonth}return R.Interval;case R.Duration:switch(e.unit){case ft.SECOND:return R.DurationSecond;case ft.MILLISECOND:return R.DurationMillisecond;case ft.MICROSECOND:return R.DurationMicrosecond;case ft.NANOSECOND:return R.DurationNanosecond}return R.Duration;case R.Map:return R.Map;case R.List:return R.List;case R.Struct:return R.Struct;case R.Union:switch(e.mode){case Pe.Dense:return R.DenseUnion;case Pe.Sparse:return R.SparseUnion}return R.Union;case R.FixedSizeBinary:return R.FixedSizeBinary;case R.FixedSizeList:return R.FixedSizeList;case R.Dictionary:return R.Dictionary}throw new Error(`Unrecognized type '${R[e.typeId]}'`)}_t.prototype.visitInt8=null;_t.prototype.visitInt16=null;_t.prototype.visitInt32=null;_t.prototype.visitInt64=null;_t.prototype.visitUint8=null;_t.prototype.visitUint16=null;_t.prototype.visitUint32=null;_t.prototype.visitUint64=null;_t.prototype.visitFloat16=null;_t.prototype.visitFloat32=null;_t.prototype.visitFloat64=null;_t.prototype.visitDateDay=null;_t.prototype.visitDateMillisecond=null;_t.prototype.visitTimestampSecond=null;_t.prototype.visitTimestampMillisecond=null;_t.prototype.visitTimestampMicrosecond=null;_t.prototype.visitTimestampNanosecond=null;_t.prototype.visitTimeSecond=null;_t.prototype.visitTimeMillisecond=null;_t.prototype.visitTimeMicrosecond=null;_t.prototype.visitTimeNanosecond=null;_t.prototype.visitDenseUnion=null;_t.prototype.visitSparseUnion=null;_t.prototype.visitIntervalDayTime=null;_t.prototype.visitIntervalYearMonth=null;_t.prototype.visitDuration=null;_t.prototype.visitDurationSecond=null;_t.prototype.visitDurationMillisecond=null;_t.prototype.visitDurationMicrosecond=null;_t.prototype.visitDurationNanosecond=null;var FA={};Tr(FA,{float64ToUint16:()=>oy,uint16ToFloat64:()=>M_});var xC=new Float64Array(1),Wd=new Uint32Array(xC.buffer);function M_(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function oy(e){if(e!==e)return 32256;xC[0]=e;let t=(Wd[1]&2147483648)>>16&65535,r=Wd[1]&2146435072,n=0;return r>=1089470464?Wd[0]>0?r=31744:(r=(r&2080374784)>>16,n=(Wd[1]&1048575)>>10):r<=1056964608?(n=1048576+(Wd[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(Wd[1]&1048575)+512>>10),t|r|n&65535}var Mt=class extends _t{};function Ut(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var DH=(e,t,r)=>{e[t]=Math.trunc(r/864e5)},RA=(e,t,r)=>{e[t]=Math.trunc(r%4294967296),e[t+1]=Math.trunc(r/4294967296)},BH=(e,t,r)=>{e[t]=Math.trunc(r*1e3%4294967296),e[t+1]=Math.trunc(r*1e3/4294967296)},OH=(e,t,r)=>{e[t]=Math.trunc(r*1e6%4294967296),e[t+1]=Math.trunc(r*1e6/4294967296)},_C=(e,t,r,n)=>{if(r+1<t.length){let i=or(t[r]),o=or(t[r+1]);e.set(n.subarray(0,o-i),i)}},NH=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Wa=({values:e},t,r)=>{e[t]=r},LA=({values:e},t,r)=>{e[t]=r},wC=({values:e},t,r)=>{e[t]=oy(r)},FH=(e,t,r)=>{switch(e.type.precision){case Le.HALF:return wC(e,t,r);case Le.SINGLE:case Le.DOUBLE:return LA(e,t,r)}},E_=({values:e},t,r)=>{DH(e,t,r.valueOf())},D_=({values:e},t,r)=>{RA(e,t*2,r.valueOf())},kA=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},vC=({values:e,valueOffsets:t},r,n)=>_C(e,t,r,n),SC=({values:e,valueOffsets:t},r,n)=>_C(e,t,r,Ms(n)),CA=(e,t,r)=>{e.type.unit===Ar.DAY?E_(e,t,r):D_(e,t,r)},B_=({values:e},t,r)=>RA(e,t*2,r/1e3),O_=({values:e},t,r)=>RA(e,t*2,r),N_=({values:e},t,r)=>BH(e,t*2,r),F_=({values:e},t,r)=>OH(e,t*2,r),UA=(e,t,r)=>{switch(e.type.unit){case ft.SECOND:return B_(e,t,r);case ft.MILLISECOND:return O_(e,t,r);case ft.MICROSECOND:return N_(e,t,r);case ft.NANOSECOND:return F_(e,t,r)}},R_=({values:e},t,r)=>{e[t]=r},L_=({values:e},t,r)=>{e[t]=r},k_=({values:e},t,r)=>{e[t]=r},C_=({values:e},t,r)=>{e[t]=r},PA=(e,t,r)=>{switch(e.type.unit){case ft.SECOND:return R_(e,t,r);case ft.MILLISECOND:return L_(e,t,r);case ft.MICROSECOND:return k_(e,t,r);case ft.NANOSECOND:return C_(e,t,r)}},$A=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},RH=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=ln.getVisitFn(n);if(Array.isArray(r))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r.get(++s))},LH=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=ln.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},kH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),CH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),UH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),PH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),$H=(e,t,r)=>{let n=e.type.children.map(o=>ln.getVisitFn(o.type)),i=r instanceof Map?UH(t,r):r instanceof ue?CH(t,r):Array.isArray(r)?kH(t,r):PH(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},zH=(e,t,r)=>{e.type.mode===Pe.Dense?IC(e,t,r):TC(e,t,r)},IC=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];ln.visit(i,e.valueOffsets[t],r)},TC=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];ln.visit(i,t,r)},VH=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},zA=(e,t,r)=>{e.type.unit===Hr.DAY_TIME?U_(e,t,r):P_(e,t,r)},U_=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},P_=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},$_=({values:e},t,r)=>{e[t]=r},z_=({values:e},t,r)=>{e[t]=r},V_=({values:e},t,r)=>{e[t]=r},j_=({values:e},t,r)=>{e[t]=r},VA=(e,t,r)=>{switch(e.type.unit){case ft.SECOND:return $_(e,t,r);case ft.MILLISECOND:return z_(e,t,r);case ft.MICROSECOND:return V_(e,t,r);case ft.NANOSECOND:return j_(e,t,r)}},jH=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=ln.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};Mt.prototype.visitBool=Ut(NH);Mt.prototype.visitInt=Ut(Wa);Mt.prototype.visitInt8=Ut(Wa);Mt.prototype.visitInt16=Ut(Wa);Mt.prototype.visitInt32=Ut(Wa);Mt.prototype.visitInt64=Ut(Wa);Mt.prototype.visitUint8=Ut(Wa);Mt.prototype.visitUint16=Ut(Wa);Mt.prototype.visitUint32=Ut(Wa);Mt.prototype.visitUint64=Ut(Wa);Mt.prototype.visitFloat=Ut(FH);Mt.prototype.visitFloat16=Ut(wC);Mt.prototype.visitFloat32=Ut(LA);Mt.prototype.visitFloat64=Ut(LA);Mt.prototype.visitUtf8=Ut(SC);Mt.prototype.visitLargeUtf8=Ut(SC);Mt.prototype.visitBinary=Ut(vC);Mt.prototype.visitLargeBinary=Ut(vC);Mt.prototype.visitFixedSizeBinary=Ut(kA);Mt.prototype.visitDate=Ut(CA);Mt.prototype.visitDateDay=Ut(E_);Mt.prototype.visitDateMillisecond=Ut(D_);Mt.prototype.visitTimestamp=Ut(UA);Mt.prototype.visitTimestampSecond=Ut(B_);Mt.prototype.visitTimestampMillisecond=Ut(O_);Mt.prototype.visitTimestampMicrosecond=Ut(N_);Mt.prototype.visitTimestampNanosecond=Ut(F_);Mt.prototype.visitTime=Ut(PA);Mt.prototype.visitTimeSecond=Ut(R_);Mt.prototype.visitTimeMillisecond=Ut(L_);Mt.prototype.visitTimeMicrosecond=Ut(k_);Mt.prototype.visitTimeNanosecond=Ut(C_);Mt.prototype.visitDecimal=Ut($A);Mt.prototype.visitList=Ut(RH);Mt.prototype.visitStruct=Ut($H);Mt.prototype.visitUnion=Ut(zH);Mt.prototype.visitDenseUnion=Ut(IC);Mt.prototype.visitSparseUnion=Ut(TC);Mt.prototype.visitDictionary=Ut(VH);Mt.prototype.visitInterval=Ut(zA);Mt.prototype.visitIntervalDayTime=Ut(U_);Mt.prototype.visitIntervalYearMonth=Ut(P_);Mt.prototype.visitDuration=Ut(VA);Mt.prototype.visitDurationSecond=Ut($_);Mt.prototype.visitDurationMillisecond=Ut(z_);Mt.prototype.visitDurationMicrosecond=Ut(V_);Mt.prototype.visitDurationNanosecond=Ut(j_);Mt.prototype.visitFixedSizeList=Ut(jH);Mt.prototype.visitMap=Ut(LH);var ln=new Mt;var Wo=Symbol.for("parent"),Gd=Symbol.for("rowIndex"),Ml=class{constructor(t,r){return this[Wo]=t,this[Gd]=r,new Proxy(this,new qA)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Gd],r=this[Wo],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=Er.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${jo(t)}: ${jo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new jA(this[Wo],this[Gd])}},jA=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Er.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ml.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Gd]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var qA=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Wo].type.children.map(r=>r.name)}has(t,r){return t[Wo].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[Wo].type.children.findIndex(n=>n.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Wo].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=Er.visit(t[Wo].children[n],t[Gd]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Wo].type.children.findIndex(o=>o.name===r);return i!==-1?(ln.visit(t[Wo].children[i],t[Gd],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}};var wt=class extends _t{};function Rt(e){return(t,r)=>t.getValid(r)?e(t,r):null}var qH=(e,t)=>864e5*e[t],YA=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),YH=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,WH=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,AC=e=>new Date(e),GH=(e,t)=>AC(qH(e,t)),XH=(e,t)=>AC(YA(e,t)),HH=(e,t)=>null,MC=(e,t,r)=>{if(r+1>=t.length)return null;let n=or(t[r]),i=or(t[r+1]);return e.subarray(n,i)},ZH=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},EC=({values:e},t)=>GH(e,t),DC=({values:e},t)=>XH(e,t*2),El=({stride:e,values:t},r)=>t[e*r],KH=({stride:e,values:t},r)=>M_(t[e*r]),BC=({values:e},t)=>e[t],QH=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),OC=({values:e,valueOffsets:t},r)=>MC(e,t,r),NC=({values:e,valueOffsets:t},r)=>{let n=MC(e,t,r);return n!==null?Nm(n):null},JH=({values:e},t)=>e[t],tZ=({type:e,values:t},r)=>e.precision!==Le.HALF?t[r]:M_(t[r]),eZ=(e,t)=>e.type.unit===Ar.DAY?EC(e,t):DC(e,t),FC=({values:e},t)=>1e3*YA(e,t*2),RC=({values:e},t)=>YA(e,t*2),LC=({values:e},t)=>YH(e,t*2),kC=({values:e},t)=>WH(e,t*2),rZ=(e,t)=>{switch(e.type.unit){case ft.SECOND:return FC(e,t);case ft.MILLISECOND:return RC(e,t);case ft.MICROSECOND:return LC(e,t);case ft.NANOSECOND:return kC(e,t)}},CC=({values:e},t)=>e[t],UC=({values:e},t)=>e[t],PC=({values:e},t)=>e[t],$C=({values:e},t)=>e[t],nZ=(e,t)=>{switch(e.type.unit){case ft.SECOND:return CC(e,t);case ft.MILLISECOND:return UC(e,t);case ft.MICROSECOND:return PC(e,t);case ft.NANOSECOND:return $C(e,t)}},iZ=({values:e,stride:t},r)=>Xm.decimal(e.subarray(t*r,t*(r+1))),oZ=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,{[t*n]:o,[t*n+1]:s}=r,c=i[0].slice(o,s-o);return new ue([c])},sZ=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new js(s.slice(i,o-i))},aZ=(e,t)=>new Ml(e,t),cZ=(e,t)=>e.type.mode===Pe.Dense?zC(e,t):VC(e,t),zC=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Er.visit(n,e.valueOffsets[t])},VC=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Er.visit(n,t)},lZ=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},uZ=(e,t)=>e.type.unit===Hr.DAY_TIME?jC(e,t):qC(e,t),jC=({values:e},t)=>e.subarray(2*t,2*(t+1)),qC=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},YC=({values:e},t)=>e[t],WC=({values:e},t)=>e[t],GC=({values:e},t)=>e[t],XC=({values:e},t)=>e[t],fZ=(e,t)=>{switch(e.type.unit){case ft.SECOND:return YC(e,t);case ft.MILLISECOND:return WC(e,t);case ft.MICROSECOND:return GC(e,t);case ft.NANOSECOND:return XC(e,t)}},dZ=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new ue([o])};wt.prototype.visitNull=Rt(HH);wt.prototype.visitBool=Rt(ZH);wt.prototype.visitInt=Rt(JH);wt.prototype.visitInt8=Rt(El);wt.prototype.visitInt16=Rt(El);wt.prototype.visitInt32=Rt(El);wt.prototype.visitInt64=Rt(BC);wt.prototype.visitUint8=Rt(El);wt.prototype.visitUint16=Rt(El);wt.prototype.visitUint32=Rt(El);wt.prototype.visitUint64=Rt(BC);wt.prototype.visitFloat=Rt(tZ);wt.prototype.visitFloat16=Rt(KH);wt.prototype.visitFloat32=Rt(El);wt.prototype.visitFloat64=Rt(El);wt.prototype.visitUtf8=Rt(NC);wt.prototype.visitLargeUtf8=Rt(NC);wt.prototype.visitBinary=Rt(OC);wt.prototype.visitLargeBinary=Rt(OC);wt.prototype.visitFixedSizeBinary=Rt(QH);wt.prototype.visitDate=Rt(eZ);wt.prototype.visitDateDay=Rt(EC);wt.prototype.visitDateMillisecond=Rt(DC);wt.prototype.visitTimestamp=Rt(rZ);wt.prototype.visitTimestampSecond=Rt(FC);wt.prototype.visitTimestampMillisecond=Rt(RC);wt.prototype.visitTimestampMicrosecond=Rt(LC);wt.prototype.visitTimestampNanosecond=Rt(kC);wt.prototype.visitTime=Rt(nZ);wt.prototype.visitTimeSecond=Rt(CC);wt.prototype.visitTimeMillisecond=Rt(UC);wt.prototype.visitTimeMicrosecond=Rt(PC);wt.prototype.visitTimeNanosecond=Rt($C);wt.prototype.visitDecimal=Rt(iZ);wt.prototype.visitList=Rt(oZ);wt.prototype.visitStruct=Rt(aZ);wt.prototype.visitUnion=Rt(cZ);wt.prototype.visitDenseUnion=Rt(zC);wt.prototype.visitSparseUnion=Rt(VC);wt.prototype.visitDictionary=Rt(lZ);wt.prototype.visitInterval=Rt(uZ);wt.prototype.visitIntervalDayTime=Rt(jC);wt.prototype.visitIntervalYearMonth=Rt(qC);wt.prototype.visitDuration=Rt(fZ);wt.prototype.visitDurationSecond=Rt(YC);wt.prototype.visitDurationMillisecond=Rt(WC);wt.prototype.visitDurationMicrosecond=Rt(GC);wt.prototype.visitDurationNanosecond=Rt(XC);wt.prototype.visitFixedSizeList=Rt(dZ);wt.prototype.visitMap=Rt(sZ);var Er=new wt;var co=Symbol.for("keys"),Xd=Symbol.for("vals"),js=class{constructor(t){return this[co]=new ue([t.children[0]]).memoize(),this[Xd]=t.children[1],new Proxy(this,new GA)}[Symbol.iterator](){return new WA(this[co],this[Xd])}get size(){return this[co].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[co],r=this[Xd],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=Er.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${jo(t)}: ${jo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},WA=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Er.visit(this.vals,t)]})}},GA=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[co].toArray().map(String)}has(t,r){return t[co].includes(r)}getOwnPropertyDescriptor(t,r){if(t[co].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[co].indexOf(r);if(n!==-1){let i=Er.visit(Reflect.get(t,Xd),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[co].indexOf(r);return i!==-1?(ln.visit(Reflect.get(t,Xd),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(js.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[co]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xd]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function hZ(e,t,r){let n=e.length,i=t>-1?t:n+t%n;return r?r(e,i):i}var HC;function sy(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(HC=o,o=s,s=HC),s>i&&(s=i),n?n(e,o,s):[o,s]}var ZC=e=>e!==e;function Dl(e){if(typeof e!=="object"||e===null)return ZC(e)?ZC:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?AA(e,r):!1:e instanceof Map?mZ(e):Array.isArray(e)?pZ(e):e instanceof ue?yZ(e):gZ(e,!0)}function pZ(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Dl(e[r]);return q_(t)}function mZ(e){let t=-1,r=[];for(let n of e.values())r[++t]=Dl(n);return q_(r)}function yZ(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Dl(e.get(r));return q_(t)}function gZ(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Dl(e[r[i]]);return q_(n,r)}function q_(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return bZ(e,r);case Map:return KC(e,r,r.keys());case js:case Ml:case Object:case void 0:return KC(e,r,t||Object.keys(r))}return r instanceof ue?xZ(e,r):!1}}function bZ(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function xZ(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function KC(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=n.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var HA={};Tr(HA,{BitIterator:()=>Gu,getBit:()=>QC,getBool:()=>W_,packBools:()=>Hu,popcnt_array:()=>JC,popcnt_bit_range:()=>ay,popcnt_uint32:()=>Y_,setBool:()=>_Z,truncateBitmap:()=>Xu});function W_(e,t,r,n){return(r&1<<n)!==0}function QC(e,t,r,n){return(r&1<<n)>>n}function _Z(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Xu(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):Hu(new Gu(r,e,t,null,W_)).subarray(0,n)),i}return r}function Hu(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var Gu=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ay(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new Gu(e,t,r-t,e,QC))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return ay(e,t,i)+ay(e,n,r)+JC(e,i>>3,n-i>>3)}function JC(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=Y_(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=Y_(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=Y_(o.getUint8(i)),i+=1;return n}function Y_(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 wZ=-1,we=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 J.isSparseUnion(t)?this.children.some(r=>r.nullable):J.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(J.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=wZ&&(r=this.nullBitmap)&&(this._nullCount=t=this.length-ay(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Ni(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:r}=this;if(J.isUnion(r)){let n=r,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Pe.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(J.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Pe.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(Xu(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];n=(f&l)!==0,r?o[u]=f|l:o[u]=f&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,r,n,i,o,s,this.dictionary)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===R.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(Xu(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[Vo.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;return(o=s[Vo.TYPE])&&(s[Vo.TYPE]=o.subarray(t,t+r)),(o=s[Vo.OFFSET])&&(s[Vo.OFFSET]=o.subarray(t,t+r+1))||(o=s[Vo.DATA])&&(s[Vo.DATA]=i===6?o:o.subarray(n*t,n*(t+r))),s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};we.prototype.children=Object.freeze([]);var ZA=class e extends _t{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new we(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Wu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new we(r,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=__(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new we(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Wu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new we(r,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=__(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new we(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ni(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ni(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ni(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ni(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ni(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=Et(t.nullBitmap),s=Wu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new we(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Et(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=ee(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(J.isSparseUnion(r))return new we(r,n,s,a,[void 0,void 0,void 0,o],i);let c=Wu(t.valueOffsets);return new we(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.indices.ArrayType,t.data),{["dictionary"]:s=new ue([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new we(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ni(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=Et(t.nullBitmap),{["length"]:s=i.length/Ni(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new we(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=Et(t.nullBitmap),s=Wu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new we(r,n,a,c,[s,void 0,o],[i])}},vZ=new ZA;function Vt(e){return vZ.visit(e)}var cy=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function t5(e){return e.some(t=>t.nullable)}function G_(e){return e.reduce((t,r)=>t+r.nullCount,0)}function X_(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function H_(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let u=Math.max(0,r-c),f=Math.min(n-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function KA(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function ly(e,t){return e.getValid(t)}function Hd(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return KA(n,this._offsets,r,t)}}function Z_(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=KA(o,this._offsets,n,r);return t=void 0,s}}function K_(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let f=n[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):KA(o,this._offsets,i,r);return t=void 0,s}}var vt=class extends _t{};function SZ(e,t){return t===null&&e.length>0?0:-1}function IZ(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new Gu(r,e.offset+(t||0),e.length,r,W_)){if(!i)return n;++n}return-1}function jt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case R.Union:break;case R.Dictionary:break;default:return IZ(e,r)}let n=Er.getVisitFn(e),i=Dl(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function e5(e,t,r){let n=Er.getVisitFn(e),i=Dl(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}vt.prototype.visitNull=SZ;vt.prototype.visitBool=jt;vt.prototype.visitInt=jt;vt.prototype.visitInt8=jt;vt.prototype.visitInt16=jt;vt.prototype.visitInt32=jt;vt.prototype.visitInt64=jt;vt.prototype.visitUint8=jt;vt.prototype.visitUint16=jt;vt.prototype.visitUint32=jt;vt.prototype.visitUint64=jt;vt.prototype.visitFloat=jt;vt.prototype.visitFloat16=jt;vt.prototype.visitFloat32=jt;vt.prototype.visitFloat64=jt;vt.prototype.visitUtf8=jt;vt.prototype.visitLargeUtf8=jt;vt.prototype.visitBinary=jt;vt.prototype.visitLargeBinary=jt;vt.prototype.visitFixedSizeBinary=jt;vt.prototype.visitDate=jt;vt.prototype.visitDateDay=jt;vt.prototype.visitDateMillisecond=jt;vt.prototype.visitTimestamp=jt;vt.prototype.visitTimestampSecond=jt;vt.prototype.visitTimestampMillisecond=jt;vt.prototype.visitTimestampMicrosecond=jt;vt.prototype.visitTimestampNanosecond=jt;vt.prototype.visitTime=jt;vt.prototype.visitTimeSecond=jt;vt.prototype.visitTimeMillisecond=jt;vt.prototype.visitTimeMicrosecond=jt;vt.prototype.visitTimeNanosecond=jt;vt.prototype.visitDecimal=jt;vt.prototype.visitList=jt;vt.prototype.visitStruct=jt;vt.prototype.visitUnion=jt;vt.prototype.visitDenseUnion=e5;vt.prototype.visitSparseUnion=e5;vt.prototype.visitDictionary=jt;vt.prototype.visitInterval=jt;vt.prototype.visitIntervalDayTime=jt;vt.prototype.visitIntervalYearMonth=jt;vt.prototype.visitDuration=jt;vt.prototype.visitDurationSecond=jt;vt.prototype.visitDurationMillisecond=jt;vt.prototype.visitDurationMicrosecond=jt;vt.prototype.visitDurationNanosecond=jt;vt.prototype.visitFixedSizeList=jt;vt.prototype.visitMap=jt;var Zu=new vt;var St=class extends _t{};function Lt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===R.Timestamp||t instanceof dr&&t.bitWidth!==64||t instanceof no&&t.bitWidth!==64||t instanceof $n&&t.precision!==Le.HALF))return new cy(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new cy(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new QA(s)})}var QA=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}};St.prototype.visitNull=Lt;St.prototype.visitBool=Lt;St.prototype.visitInt=Lt;St.prototype.visitInt8=Lt;St.prototype.visitInt16=Lt;St.prototype.visitInt32=Lt;St.prototype.visitInt64=Lt;St.prototype.visitUint8=Lt;St.prototype.visitUint16=Lt;St.prototype.visitUint32=Lt;St.prototype.visitUint64=Lt;St.prototype.visitFloat=Lt;St.prototype.visitFloat16=Lt;St.prototype.visitFloat32=Lt;St.prototype.visitFloat64=Lt;St.prototype.visitUtf8=Lt;St.prototype.visitLargeUtf8=Lt;St.prototype.visitBinary=Lt;St.prototype.visitLargeBinary=Lt;St.prototype.visitFixedSizeBinary=Lt;St.prototype.visitDate=Lt;St.prototype.visitDateDay=Lt;St.prototype.visitDateMillisecond=Lt;St.prototype.visitTimestamp=Lt;St.prototype.visitTimestampSecond=Lt;St.prototype.visitTimestampMillisecond=Lt;St.prototype.visitTimestampMicrosecond=Lt;St.prototype.visitTimestampNanosecond=Lt;St.prototype.visitTime=Lt;St.prototype.visitTimeSecond=Lt;St.prototype.visitTimeMillisecond=Lt;St.prototype.visitTimeMicrosecond=Lt;St.prototype.visitTimeNanosecond=Lt;St.prototype.visitDecimal=Lt;St.prototype.visitList=Lt;St.prototype.visitStruct=Lt;St.prototype.visitUnion=Lt;St.prototype.visitDenseUnion=Lt;St.prototype.visitSparseUnion=Lt;St.prototype.visitDictionary=Lt;St.prototype.visitInterval=Lt;St.prototype.visitIntervalDayTime=Lt;St.prototype.visitIntervalYearMonth=Lt;St.prototype.visitDuration=Lt;St.prototype.visitDurationSecond=Lt;St.prototype.visitDurationMillisecond=Lt;St.prototype.visitDurationMicrosecond=Lt;St.prototype.visitDurationNanosecond=Lt;St.prototype.visitFixedSizeList=Lt;St.prototype.visitMap=Lt;var Zd=new St;var r5,n5={},i5={},ue=class e{constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof we)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=n5[s.typeId],u=o[0];this.isValid=f=>ly(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,i5[s.typeId]),this._offsets=X_(o);break}this.data=o,this.type=s,this.stride=Ni(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return t5(this.data)}get nullCount(){return G_(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${R[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return Zd.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(sy(this,t,r,({data:n,_offsets:i},o,s)=>H_(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case R.Int:case R.Float:case R.Decimal:case R.Time:case R.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return J.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(J.isDictionary(this.type)){let t=new Q_(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new Q_(this)}unmemoize(){if(J.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};r5=Symbol.toStringTag;ue[r5]=(e=>{e.type=J.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(R).map(r=>R[r]).filter(r=>typeof r=="number"&&r!==R.NONE);for(let r of t){let n=Er.getVisitFnByTypeId(r),i=ln.getVisitFnByTypeId(r),o=Zu.getVisitFnByTypeId(r);n5[r]={get:n,set:i,indexOf:o},i5[r]=Object.create(e,{isValid:{value:Hd(ly)},get:{value:Hd(Er.getVisitFnByTypeId(r))},set:{value:Z_(ln.getVisitFnByTypeId(r))},indexOf:{value:K_(Zu.getVisitFnByTypeId(r))}})}return"Vector"})(ue.prototype);var Q_=class e extends ue{constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new ue(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function o5(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
2
- switch (x) {${r.map(n=>`
3
- case ${TZ(n)}:`).join("")}
1
+ var QV=Object.create;var tS=Object.defineProperty;var ZV=Object.getOwnPropertyDescriptor;var KV=Object.getOwnPropertyNames;var JV=Object.getPrototypeOf,tq=Object.prototype.hasOwnProperty;var QR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kr=(e,t)=>{for(var n in t)tS(e,n,{get:t[n],enumerable:!0})},eq=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of KV(t))!tq.call(e,i)&&i!==n&&tS(e,i,{get:()=>t[i],enumerable:!(r=ZV(t,i))||r.enumerable});return e};var nq=(e,t,n)=>(n=e!=null?QV(JV(e)):{},eq(t||!e||!e.__esModule?tS(n,"default",{value:e,enumerable:!0}):n,e));var wj=QR((dHt,bj)=>{"use strict";function Cot(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>=0?(o=s,i=s-1):r=s+1}return o}function Bot(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>0?(o=s,i=s-1):r=s+1}return o}function Pot(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<0?(o=s,r=s+1):i=s-1}return o}function $ot(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<=0?(o=s,r=s+1):i=s-1}return o}function Uot(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function M0(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}bj.exports={ge:function(e,t,n,r,i){return M0(e,t,n,r,i,Cot)},gt:function(e,t,n,r,i){return M0(e,t,n,r,i,Bot)},lt:function(e,t,n,r,i){return M0(e,t,n,r,i,Pot)},le:function(e,t,n,r,i){return M0(e,t,n,r,i,$ot)},eq:function(e,t,n,r,i){return M0(e,t,n,r,i,Uot)}}});var Mj=QR((hHt,Aj)=>{"use strict";var O2=wj(),lh=0,Pu=1,M2=2;Aj.exports=jot;function H6(e,t,n,r,i){this.mid=e,this.left=t,this.right=n,this.leftPoints=r,this.rightPoints=i,this.count=(t?t.count:0)+(n?n.count:0)+r.length}var O0=H6.prototype;function W6(e,t){e.mid=t.mid,e.left=t.left,e.right=t.right,e.leftPoints=t.leftPoints,e.rightPoints=t.rightPoints,e.count=t.count}function Sj(e,t){var n=uh(t);e.mid=n.mid,e.left=n.left,e.right=n.right,e.leftPoints=n.leftPoints,e.rightPoints=n.rightPoints,e.count=n.count}function _j(e,t){var n=e.intervals([]);n.push(t),Sj(e,n)}function vj(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?lh:(n.splice(r,1),Sj(e,n),Pu)}O0.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};O0.insert=function(e){var t=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(t+1)?_j(this,e):this.left.insert(e):this.left=uh([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?_j(this,e):this.right.insert(e):this.right=uh([e]);else{var n=O2.ge(this.leftPoints,e,Q6),r=O2.ge(this.rightPoints,e,Z6);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};O0.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return lh;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return vj(this,e);var r=this.left.remove(e);return r===M2?(this.left=null,this.count-=1,Pu):(r===Pu&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return lh;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return vj(this,e);var r=this.right.remove(e);return r===M2?(this.right=null,this.count-=1,Pu):(r===Pu&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?M2:lh;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,r=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=r}W6(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?W6(this,this.left):W6(this,this.right);return Pu}for(var a=O2.ge(this.leftPoints,e,Q6);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var r=O2.ge(this.rightPoints,e,Z6);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Pu}return lh}};function Ij(e,t,n){for(var r=0;r<e.length&&e[r][0]<=t;++r){var i=n(e[r]);if(i)return i}}function Tj(e,t,n){for(var r=e.length-1;r>=0&&e[r][1]>=t;--r){var i=n(e[r]);if(i)return i}}function Ej(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}O0.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return Ij(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return Tj(this.rightPoints,e,t)}else return Ej(this.leftPoints,t)};O0.queryInterval=function(e,t,n){if(e<this.mid&&this.left){var r=this.left.queryInterval(e,t,n);if(r)return r}if(t>this.mid&&this.right){var r=this.right.queryInterval(e,t,n);if(r)return r}return t<this.mid?Ij(this.leftPoints,t,n):e>this.mid?Tj(this.rightPoints,e,n):Ej(this.leftPoints,n)};function zot(e,t){return e-t}function Q6(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function Z6(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function uh(e){if(e.length===0)return null;for(var t=[],n=0;n<e.length;++n)t.push(e[n][0],e[n][1]);t.sort(zot);for(var r=t[t.length>>1],i=[],o=[],s=[],n=0;n<e.length;++n){var a=e[n];a[1]<r?i.push(a):r<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(Q6),l.sort(Z6),new H6(r,uh(i),uh(o),c,l)}function X6(e){this.root=e}var fh=X6.prototype;fh.insert=function(e){this.root?this.root.insert(e):this.root=new H6(e[0],null,null,[e],[e])};fh.remove=function(e){if(this.root){var t=this.root.remove(e);return t===M2&&(this.root=null),t!==lh}return!1};fh.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};fh.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(fh,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(fh,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function jot(e){return!e||e.length===0?new X6(null):new X6(uh(e))}});var ZR={};function bh(e,t=!1){let n,r,i=ZR;function o(l){n=e(l).finally(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=ZR,a(u)}),i=l}return t?c:a}var xr=class{constructor(t){this._filterBy=t,this._requestUpdate=bh(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(t){return this}query(t){return null}queryPending(){return this}queryResult(t){return this}queryError(t){return this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var wh=Uint8Array.of(65,82,82,79,87,49),ai={V1:0,V2:1,V3:2,V4:3,V5:4};var ci={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},j={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},Yu={HALF:0,SINGLE:1,DOUBLE:2},xs={DAY:0,MILLISECOND:1},dn={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},li={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},bs={Sparse:0,Dense:1};var Gu=Uint8Array,cg=Uint16Array,lg=Uint32Array,ug=BigUint64Array,_h=Int8Array,KR=Int16Array,br=Int32Array,Cr=BigInt64Array,eS=Float32Array,Pa=Float64Array;function JR(e,t){let n=Math.log2(e)-3;return(t?[_h,KR,br,Cr]:[Gu,cg,lg,ug])[n]}var Oat=Object.getPrototypeOf(Int8Array);function Wu(e,t){let n=0,r=e.length;if(r<=2147483648)do{let i=n+r>>>1;e[i]<=t?n=i+1:r=i}while(n<r);else do{let i=Math.trunc((n+r)/2);e[i]<=t?n=i+1:r=i}while(n<r);return n}function fg(e,t,n){if(t(e))return e;throw new Error(n(e))}function wr(e,t,n){return t=Array.isArray(t)?t:Object.values(t),fg(e,r=>t.includes(r),n??(()=>`${e} must be one of ${t}`))}function dg(e,t){for(let[n,r]of Object.entries(e))if(r===t)return n;return"<Unknown>"}var ws=e=>`Unsupported data type: "${dg(j,e)}" (id ${e})`,vh=(e,t,n=!0,r=null)=>({name:e,type:t,nullable:n,metadata:r});function tL(e){return Object.hasOwn(e,"name")&&eL(e.type)}function eL(e){return typeof e?.typeId=="number"}function $a(e,t="",n=!0){return tL(e)?e:vh(t,fg(e,eL,()=>"Data type expected."),n)}var hg=(e,t,n=!1,r=-1)=>({typeId:j.Dictionary,id:r,dictionary:e,indices:t||Xu(),ordered:n});var pg=(e=32,t=!0)=>({typeId:j.Int,bitWidth:wr(e,[8,16,32,64]),signed:t,values:JR(e,t)});var Xu=()=>pg(32);var nS=(e=2)=>({typeId:j.Float,precision:wr(e,Yu),values:[cg,eS,Pa][e]});var rS=()=>({typeId:j.Binary,offsets:br}),mg=()=>({typeId:j.Utf8,offsets:br});var iS=(e,t,n=128)=>({typeId:j.Decimal,precision:e,scale:t,bitWidth:wr(n,[128,256]),values:ug}),oS=e=>({typeId:j.Date,unit:wr(e,xs),values:e===xs.DAY?br:Cr});var sS=(e=dn.MILLISECOND,t=32)=>({typeId:j.Time,unit:wr(e,dn),bitWidth:wr(t,[32,64]),values:t===32?br:Cr});var yg=(e=dn.MILLISECOND,t=null)=>({typeId:j.Timestamp,unit:wr(e,dn),timezone:t,values:Cr}),aS=(e=li.MONTH_DAY_NANO)=>({typeId:j.Interval,unit:wr(e,li),values:e===li.MONTH_DAY_NANO?void 0:br}),gg=e=>({typeId:j.List,children:[$a(e)],offsets:br}),xg=e=>({typeId:j.Struct,children:Array.isArray(e)&&tL(e[0])?e:Object.entries(e).map(([t,n])=>vh(t,n))}),cS=(e,t,n,r)=>(n??=t.map((i,o)=>o),{typeId:j.Union,mode:wr(e,bs),typeIds:n,typeMap:n.reduce((i,o,s)=>(i[o]=s,i),{}),children:t.map((i,o)=>$a(i,`_${o}`)),typeIdForValue:r,offsets:br}),lS=e=>({typeId:j.FixedSizeBinary,stride:e}),bg=(e,t)=>({typeId:j.FixedSizeList,stride:t,children:[$a(e)]}),nL=(e,t)=>({typeId:j.Map,keysSorted:e,children:[t],offsets:br});var uS=(e=dn.MILLISECOND)=>({typeId:j.Duration,unit:wr(e,dn),values:Cr}),fS=()=>({typeId:j.LargeBinary,offsets:Cr}),dS=()=>({typeId:j.LargeUtf8,offsets:Cr}),hS=e=>({typeId:j.LargeList,children:[$a(e)],offsets:Cr}),pS=(e,t)=>({typeId:j.RunEndEncoded,children:[fg($a(e,"run_ends"),n=>n.type.typeId===j.Int,()=>"Run-ends must have an integer type."),$a(t,"values")]});var mS=e=>({typeId:j.ListView,children:[$a(e,"value")],offsets:br}),yS=e=>({typeId:j.LargeListView,children:[$a(e,"value")],offsets:Cr});var rq=new Pa(2),wg=rq.buffer,Pat=new Cr(wg),$at=new lg(wg),Uat=new br(wg),zat=new Gu(wg);function mo(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function _g(e,t){return Number(e/t)+Number(e%t)/Number(t)}var Hu=e=>BigInt.asUintN(64,e);function iL(e,t){let n=t<<1,r;return BigInt.asIntN(64,e[n+1])<0?(r=Hu(~e[n])|Hu(~e[n+1])<<64n,r=-(r+1n)):r=e[n]|e[n+1]<<64n,r}function oL(e,t){let n=t<<2,r;return BigInt.asIntN(64,e[n+3])<0?(r=Hu(~e[n])|Hu(~e[n+1])<<64n|Hu(~e[n+2])<<128n|Hu(~e[n+3])<<192n,r=-(r+1n)):r=e[n]|e[n+1]<<64n|e[n+2]<<128n|e[n+3]<<192n,r}var oq=new TextDecoder("utf-8"),Gat=new TextEncoder;function Qu(e){return oq.decode(e)}var al=4;function gS(e,t){return(e[t>>3]&1<<t%8)!==0}function $n(e,t){let n=t+fe(e,t),r=n-fe(e,n),i=Sn(e,r);return(o,s,a=null)=>{if(o<i){let c=Sn(e,r+o);if(c)return s(e,n+c)}return a}}function Fi(e,t){return t}function Ua(e,t){return!!sq(e,t)}function sq(e,t){return Sh(e,t)<<24>>24}function Sh(e,t){return e[t]}function Sn(e,t){return aq(e,t)<<16>>16}function aq(e,t){return e[t]|e[t+1]<<8}function fe(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function sL(e,t){return fe(e,t)>>>0}function hn(e,t){return mo(BigInt.asIntN(64,BigInt(sL(e,t))+(BigInt(sL(e,t+al))<<32n)))}function cl(e,t){let n=t+fe(e,t),r=fe(e,n);return n+=al,Qu(e.subarray(n,n+r))}function Br(e,t,n,r){if(!t)return[];let i=t+fe(e,t);return Array.from({length:fe(e,i)},(o,s)=>r(e,i+al+s*n))}var xS=Symbol("rowIndex");function Ih(e,t){class n{constructor(o){this[xS]=o}toJSON(){return aL(e,t,this[xS])}}let r=n.prototype;for(let i=0;i<e.length;++i){if(Object.hasOwn(r,e[i]))continue;let o=t[i];Object.defineProperty(r,e[i],{get(){return o.at(this[xS])},enumerable:!0})}return i=>new n(i)}function vg(e,t){return n=>aL(e,t,n)}function aL(e,t,n){let r={};for(let i=0;i<e.length;++i)r[e[i]]=t[i].at(n);return r}function cL(e){return e instanceof za}var ll=class{static ArrayType=null;constructor({length:t,nullCount:n,type:r,validity:i,values:o,offsets:s,sizes:a,children:c}){this.length=t,this.nullCount=n,this.type=r,this.validity=i,this.values=o,this.offsets=s,this.sizes=a,this.children=c,(!n||!this.validity)&&(this.at=l=>this.value(l))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return gS(this.validity,t)}value(t){return this.values[t]}slice(t,n){let r=n-t,i=Array(r);for(let o=0;o<r;++o)i[o]=this.at(t+o);return i}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t)}},za=class extends ll{constructor(t){super(t);let{length:n,values:r}=this;this.values=r.subarray(0,n)}slice(t,n){return this.nullCount?super.slice(t,n):this.values.subarray(t,n)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},Th=class extends ll{static ArrayType=Pa},Re=class extends ll{static ArrayType=Array},Eh=class extends Re{value(t){return null}},yo=class extends Th{value(t){return mo(this.values[t])}},Sg=class extends Th{value(t){let n=this.values[t],r=(n&31744)>>10,i=(n&1023)/1024,o=(-1)**((n&32768)>>15);switch(r){case 31:return o*(i?Number.NaN:1/0);case 0:return o*(i?6103515625e-14*i:0)}return o*2**(r-15)*(1+i)}},Ig=class extends Re{value(t){return gS(this.values,t)}},Tg=class extends ll{constructor(t){super(t);let{bitWidth:n,scale:r}=this.type;this.decimal=n===128?iL:oL,this.scale=10n**BigInt(r)}},Eg=class extends Tg{static ArrayType=Pa;value(t){return _g(this.decimal(this.values,t),this.scale)}},Ag=class extends Tg{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},Ah=class extends Re{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},Mg=class extends Th{value(t){return 864e5*this.values[t]}},lL=yo,Og=class extends yo{value(t){return super.value(t)*1e3}},uL=yo,Ng=class extends yo{value(t){return _g(this.values[t],1000n)}},Dg=class extends yo{value(t){return _g(this.values[t],1000000n)}},Rg=class extends Re{value(t){return this.values.subarray(t<<1,t+1<<1)}},Lg=class extends Re{value(t){let n=this.values,r=t<<4;return Float64Array.of(fe(n,r),fe(n,r+4),hn(n,r+8))}},fL=({values:e,offsets:t},n)=>e.subarray(t[n],t[n+1]),dL=({values:e,offsets:t},n)=>e.subarray(mo(t[n]),mo(t[n+1])),Fg=class extends Re{value(t){return fL(this,t)}},kg=class extends Re{value(t){return dL(this,t)}},Cg=class extends Re{value(t){return Qu(fL(this,t))}},Bg=class extends Re{value(t){return Qu(dL(this,t))}},Pg=class extends Re{value(t){let n=this.offsets;return this.children[0].slice(n[t],n[t+1])}},$g=class extends Re{value(t){let n=this.offsets;return this.children[0].slice(mo(n[t]),mo(n[t+1]))}},Ug=class extends Re{value(t){let n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(n,r)}},zg=class extends Re{value(t){let n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(mo(n),mo(r))}},jg=class extends Re{constructor(t){super(t),this.stride=this.type.stride}},Vg=class extends jg{value(t){let{stride:n,values:r}=this;return r.subarray(t*n,(t+1)*n)}},qg=class extends jg{value(t){let{children:n,stride:r}=this;return n[0].slice(t*r,(t+1)*r)}};function hL({children:e,offsets:t},n){let[r,i]=e[0].children,o=t[n],s=t[n+1],a=[];for(let c=o;c<s;++c)a.push([r.at(c),i.at(c)]);return a}var Yg=class extends Re{value(t){return hL(this,t)}},Gg=class extends Re{value(t){return new Map(hL(this,t))}},Mh=class extends Re{constructor({typeIds:t,...n}){super(n),this.typeIds=t,this.typeMap=this.type.typeMap}value(t,n=t){let{typeIds:r,children:i,typeMap:o}=this;return i[o[r[t]]].at(n)}},Wg=class extends Mh{value(t){return super.value(t,this.offsets[t])}},Oh=class extends Re{constructor(t,n=vg){super(t),this.names=this.type.children.map(r=>r.name),this.factory=n(this.names,this.children)}value(t){return this.factory(t)}},Xg=class extends Oh{constructor(t){super(t,Ih)}},Hg=class extends Re{value(t){let[{values:n},r]=this.children;return r.at(Wu(n,t))}},Qg=class extends Re{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}},Zg=class extends Re{constructor({data:t,...n}){super(n),this.data=t}view(t){let{values:n,data:r}=this,i=t<<4,o=i+4,s=n,a=fe(s,i);return a>12&&(o=fe(s,i+12),s=r[fe(s,i+8)]),s.subarray(o,o+a)}},Kg=class extends Zg{value(t){return this.view(t)}},Jg=class extends Zg{value(t){return Qu(this.view(t))}};function bS(e){let t=[];return{add(n){return t.push(n),this},clear:()=>t=[],done:()=>new ul(t,e)}}var ul=class{constructor(t,n=t[0]?.type){this.type=n,this.length=t.reduce((o,s)=>o+s.length,0),this.nullCount=t.reduce((o,s)=>o+s.nullCount,0),this.data=t;let r=t.length,i=new Int32Array(r+1);if(r===1){let[o]=t;i[1]=o.length,this.at=s=>o.at(s)}else for(let o=0,s=0;o<r;++o)i[o+1]=s+=t[o].length;this.offsets=i}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():cq(t)}at(t){let{data:n,offsets:r}=this,i=Wu(r,t)-1;return n[i]?.at(t-r[i])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:n,data:r}=this,i=!n&&cL(r[0]),o=r.length;if(i&&o===1)return r[0].values;let s=!o||n>0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new s(t);return i?lq(a,r):uq(a,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*cq(e){for(let t=0;t<e.length;++t){let n=e[t][Symbol.iterator]();for(let r=n.next();!r.done;r=n.next())yield r.value}}function lq(e,t){for(let n=0,r=0;n<t.length;++n){let{values:i}=t[n];e.set(i,r),r+=i.length}return e}function uq(e,t){let n=-1;for(let r=0;r<t.length;++r){let i=t[r];for(let o=0;o<i.length;++o)e[++n]=i.at(o)}return e}var Zu=class e{constructor(t,n,r=!1){let i=t.fields.map(s=>s.name);this.schema=t,this.names=i,this.children=n,this.factory=r?Ih:vg;let o=[];this.getFactory=s=>o[s]??(o[s]=this.factory(i,n.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let n=this.names.findIndex(r=>r===t);return n>-1?this.children[n]:void 0}selectAt(t,n=[]){let{children:r,factory:i,schema:o}=this,{fields:s}=o;return new e({...o,fields:t.map((a,c)=>fq(s[a],n[c]))},t.map(a=>r[a]),i===Ih)}select(t,n){let r=this.names,i=t.map(o=>r.indexOf(o));return this.selectAt(i,n)}toColumns(){let{children:t,names:n}=this,r={};return n.forEach((i,o)=>r[i]=t[o]?.toArray()??[]),r}toArray(){let{children:t,getFactory:n,numRows:r}=this,i=t[0]?.data??[],o=Array(r);for(let s=0,a=-1;s<i.length;++s){let c=n(s);for(let l=0;l<i[s].length;++l)o[++a]=c(l)}return o}*[Symbol.iterator](){let{children:t,getFactory:n}=this,r=t[0]?.data??[];for(let i=0;i<r.length;++i){let o=n(i);for(let s=0;s<r[i].length;++s)yield o(s)}}at(t){let{children:n,getFactory:r,numRows:i}=this;if(t<0||t>=i)return null;let[{offsets:o}]=n,s=Wu(o,t)-1;return r(s)(t-o[s])}get(t){return this.at(t)}};function fq(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function Nh(e,t={}){let{typeId:n,bitWidth:r,precision:i,unit:o}=e,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:l,useProxy:u}=t;switch(n){case j.Null:return Eh;case j.Bool:return Ig;case j.Int:case j.Time:case j.Duration:return s||r<64?za:yo;case j.Float:return i?za:Sg;case j.Date:return pL(o===xs.DAY?Mg:lL,a&&Ah);case j.Timestamp:return pL(o===dn.SECOND?Og:o===dn.MILLISECOND?uL:o===dn.MICROSECOND?Ng:Dg,a&&Ah);case j.Decimal:return c?Ag:Eg;case j.Interval:return o===li.DAY_TIME?Rg:o===li.YEAR_MONTH?za:Lg;case j.FixedSizeBinary:return Vg;case j.Utf8:return Cg;case j.LargeUtf8:return Bg;case j.Binary:return Fg;case j.LargeBinary:return kg;case j.BinaryView:return Kg;case j.Utf8View:return Jg;case j.List:return Pg;case j.LargeList:return $g;case j.Map:return l?Gg:Yg;case j.ListView:return Ug;case j.LargeListView:return zg;case j.FixedSizeList:return qg;case j.Struct:return u?Xg:Oh;case j.RunEndEncoded:return Hg;case j.Dictionary:return Qg;case j.Union:return e.mode?Wg:Mh}throw new Error(ws(n))}function pL(e,t){return t?class extends t{constructor(r){super(new e(r))}}:e}function dq(e,t){return{offset:hn(e,t),metadataLength:fe(e,t+8),bodyLength:hn(e,t+16)}}function wS(e,t){return Br(e,t,24,dq)}function tx(e,t,n){let r=$n(e,t);if(r(10,Fi,0))throw new Error("Record batch compression not implemented");let i=n<ai.V4?8:0;return{length:r(4,hn,0),nodes:Br(e,r(6,Fi),16,(o,s)=>({length:hn(o,s),nullCount:hn(o,s+8)})),regions:Br(e,r(8,Fi),16+i,(o,s)=>({offset:hn(o,s+i),length:hn(o,s+i+8)})),variadic:Br(e,r(12,Fi),8,hn)}}function mL(e,t,n){let r=$n(e,t);return{id:r(4,hn,0),data:r(6,(i,o)=>tx(i,o,n)),isDelta:r(8,Ua,!1)}}function _S(e,t,n,r){wr(n,j,ws);let i=$n(e,t);switch(n){case j.Binary:return rS();case j.Utf8:return mg();case j.LargeBinary:return fS();case j.LargeUtf8:return dS();case j.List:return gg(r[0]);case j.ListView:return mS(r[0]);case j.LargeList:return hS(r[0]);case j.LargeListView:return yS(r[0]);case j.Struct:return xg(r);case j.RunEndEncoded:return pS(r[0],r[1]);case j.Int:return pg(i(4,fe,0),i(6,Ua,!1));case j.Float:return nS(i(4,Sn,Yu.HALF));case j.Decimal:return iS(i(4,fe,0),i(6,fe,0),i(8,fe,128));case j.Date:return oS(i(4,Sn,xs.MILLISECOND));case j.Time:return sS(i(4,Sn,dn.MILLISECOND),i(6,fe,32));case j.Timestamp:return yg(i(4,Sn,dn.SECOND),i(6,cl));case j.Interval:return aS(i(4,Sn,li.YEAR_MONTH));case j.Duration:return uS(i(4,Sn,dn.MILLISECOND));case j.FixedSizeBinary:return lS(i(4,fe,0));case j.FixedSizeList:return bg(r[0],i(4,fe,0));case j.Map:return nL(i(4,Ua,!1),r[0]);case j.Union:return cS(i(4,Sn,bs.Sparse),r,Br(e,i(6,Fi),4,fe))}return{typeId:n}}function Dh(e,t){let n=Br(e,t,4,(r,i)=>{let o=$n(r,i);return[o(4,cl),o(6,cl)]});return n.length?new Map(n):null}function ex(e,t,n){let r=$n(e,t);return{version:n,endianness:r(4,Sn,0),fields:r(6,hq,[]),metadata:r(8,Dh)}}function hq(e,t){return Br(e,t,4,yL)}function yL(e,t){let n=$n(e,t),r=n(8,Sh,j.NONE),i=n(10,Fi,0),o=n(12,mq),s=n(14,(c,l)=>pq(c,l)),a=_S(e,i,r,s);return o&&(o.dictionary=a,a=o),{name:n(4,cl),type:a,nullable:n(6,Ua,!1),metadata:n(16,Dh)}}function pq(e,t){let n=Br(e,t,4,yL);return n.length?n:null}function mq(e,t){if(!t)return null;let n=$n(e,t);return hg(null,n(6,yq,Xu()),n(8,Ua,!1),n(4,hn,0))}function yq(e,t){return _S(e,t,j.Int)}var gq=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,xq=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,bq=e=>`Unsupported message type: ${e} (${dg(ci,e)})`;function nx(e,t){let n=fe(e,t)||0;if(t+=al,n===-1&&(n=fe(e,t)||0,t+=al),n===0)return null;let r=e.subarray(t,t+=n);if(r.byteLength<n)throw new Error(gq(n,r.byteLength));let i=$n(r,0),o=i(4,Sn,ai.V1),s=i(6,Sh,ci.NONE),a=i(8,Fi,0),c=i(10,hn,0),l;if(a){let u=s===ci.Schema?ex:s===ci.DictionaryBatch?mL:s===ci.RecordBatch?tx:null;if(!u)throw new Error(bq(s));if(l=u(r,a,o),c>0){let f=e.subarray(t,t+=c);if(f.byteLength<c)throw new Error(xq(c,f.byteLength));l.body=f}}return{version:o,type:s,index:t,content:l}}function gL(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return t instanceof Uint8Array&&wq(t)?vq(t):_q(t)}function wq(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(wh[t]!==e[t])return!1;return!0}function _q(e){let t=[e].flat(),n,r=[],i=[];for(let o of t){if(!(o instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=nx(o,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case ci.Schema:n||(n=a.content);break;case ci.RecordBatch:r.push(a.content);break;case ci.DictionaryBatch:i.push(a.content);break}}}return{schema:n,dictionaries:i,records:r,metadata:null}}function vq(e){let t=e.byteLength-(wh.length+4),n=fe(e,t),r=$n(e,t-n),i=r(4,Sn,ai.V1),o=r(8,wS,[]),s=r(10,wS,[]);return{schema:r(6,(a,c)=>ex(a,c,i)),dictionaries:o.map(({offset:a})=>nx(e,a).content),records:s.map(({offset:a})=>nx(e,a).content),metadata:r(12,Dh)}}function SS(e,t){return Sq(gL(e),t)}function Sq(e,t={}){let{schema:n={fields:[]},dictionaries:r,records:i}=e,{version:o,fields:s}=n,a=new Map,c=Tq(t,o,a),l=new Map;Iq(n,d=>{let h=d.type;h.typeId===j.Dictionary&&l.set(h.id,h.dictionary)});let u=new Map;for(let d of r){let{id:h,data:p,isDelta:m,body:y}=d,g=l.get(h),x=vS(g,c({...p,body:y}));if(u.has(h)){let b=u.get(h);m||b.clear(),b.add(x)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(h,bS(g).add(x))}}u.forEach((d,h)=>a.set(h,d.done()));let f=s.map(d=>bS(d.type));for(let d of i){let h=c(d);s.forEach((p,m)=>f[m].add(vS(p.type,h)))}return new Zu(n,f.map(d=>d.done()),t.useProxy)}function Iq(e,t){e.fields.forEach(function n(r){t(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Tq(e,t,n){let r={version:t,options:e,dictionary:i=>n.get(i)};return i=>{let{length:o,nodes:s,regions:a,variadic:c,body:l}=i,u=-1,f=-1,d=-1;return{...r,length:o,node:()=>s[++u],buffer:h=>{let{length:p,offset:m}=a[++f];return h?new h(l.buffer,l.byteOffset+m,p/h.BYTES_PER_ELEMENT):l.subarray(m,m+p)},variadic:()=>c[++d],visit(h){return h.map(p=>vS(p.type,this))}}}}function vS(e,t){let{typeId:n}=e,{length:r,options:i,node:o,buffer:s,variadic:a,version:c}=t,l=Nh(e,i);if(n===j.Null)return new l({length:r,nullCount:r,type:e});let u={...o(),type:e};switch(n){case j.Bool:case j.Int:case j.Time:case j.Duration:case j.Float:case j.Decimal:case j.Date:case j.Timestamp:case j.Interval:case j.FixedSizeBinary:return new l({...u,validity:s(),values:s(e.values)});case j.Utf8:case j.LargeUtf8:case j.Binary:case j.LargeBinary:return new l({...u,validity:s(),offsets:s(e.offsets),values:s()});case j.BinaryView:case j.Utf8View:return new l({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case j.List:case j.LargeList:case j.Map:return new l({...u,validity:s(),offsets:s(e.offsets),children:t.visit(e.children)});case j.ListView:case j.LargeListView:return new l({...u,validity:s(),offsets:s(e.offsets),sizes:s(e.offsets),children:t.visit(e.children)});case j.FixedSizeList:case j.Struct:return new l({...u,validity:s(),children:t.visit(e.children)});case j.RunEndEncoded:return new l({...u,children:t.visit(e.children)});case j.Dictionary:{let{id:f,indices:d}=e;return new l({...u,validity:s(),values:s(d.values)}).setDictionary(t.dictionary(f))}case j.Union:return c<ai.V5&&s(),new l({...u,typeIds:s(_h),offsets:e.mode===bs.Sparse?null:s(e.offsets),children:t.visit(e.children)});default:throw new Error(ws(n))}}var _lt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function ja(e){return SS(e,{useDate:!0})}function rx(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(ja(l));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e),i.binaryType="arraybuffer";for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var _r=class{constructor(t,n){t&&(this.table=String(t)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${t?`${IL(t)}.`:""}${r}`}else return t?IL(t):"NULL"}};function IL(e){return e.split(".").map(n=>`"${n}"`).join(".")}function TL(e,t){return e instanceof _r&&e.column===t}function $t(e){return typeof e=="string"?Va(e):e}function dl(e){return typeof e=="string"?EL(e):e}function EL(e){return new _r(e)}function Va(e,t=null){return arguments.length===1&&(t=e,e=null),new _r(e,t)}function go(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e.replace("'","''")}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var vs=e=>typeof e?.addEventListener=="function";function ix(e){return e instanceof Ss}var Ss=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>vs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>Xq(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:n}=this;if(t){let r=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(r.size){let i=new Set(n);return r.forEach(o=>i.add(o)),Array.from(i)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...t){return Object.assign(this,...t)}toString(){return this._expr.map(t=>vs(t)&&!ix(t)?go(t.value):t).join("")}addEventListener(t,n){let r=this.map||(this.map=new Map);(r.get(t)||(r.set(t,new Set),r.get(t))).add(n)}};function Xq(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function IS(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];vs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:go(a));let c=e[++o];vs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=IS(e,t);return new Ss(n,r)}function TS(e){let t=$t(e);return q`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var hl=e=>({value:e,toString:()=>go(e)});function Rh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function AL(e,t){let n=t.filter(i=>i!=null).map($t),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),q(r,...n).annotate({op:e,children:n,visit:Rh})}var vr=(...e)=>AL("AND",e.flat()),pl=(...e)=>AL("OR",e.flat()),Hq=e=>t=>q`(${e} ${$t(t)})`.annotate({op:e,a:t,visit:Rh}),ES=Hq("NOT"),ML=e=>t=>q`(${$t(t)} ${e})`.annotate({op:e,a:t,visit:Rh}),ml=ML("IS NULL"),Is=ML("IS NOT NULL"),qa=e=>(t,n)=>q`(${$t(t)} ${e} ${$t(n)})`.annotate({op:e,a:t,b:n,visit:Rh}),AS=qa("="),yl=qa("<>"),Ts=qa("<"),Lh=qa(">"),Es=qa("<="),MS=qa(">="),OS=qa("IS DISTINCT FROM"),Ku=qa("IS NOT DISTINCT FROM");function OL(e,t,n,r){t=$t(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?q`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:q`(${t} ${e} ${n[0]} AND ${n[1]})`:q``).annotate({op:e,visit:Rh,field:t,range:n})}var We=(e,t,n)=>OL("BETWEEN",e,t,n),NS=(e,t,n)=>OL("NOT BETWEEN",e,t,n);function gl(e,t){return Array.from({length:e},()=>t)}function In(e,t){return(...n)=>{let r=n.map($t),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...gl(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var DS=In("REGEXP_MATCHES"),RS=In("CONTAINS"),LS=In("PREFIX"),FS=In("SUFFIX"),Qq=In("LOWER"),Zq=In("UPPER"),Kq=In("LENGTH"),Jq=In("ISNAN"),tY=In("ISFINITE"),eY=In("ISINF");var Fh=class e extends Ss{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?q`${n} OVER "${i}"`:q`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=q`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f),this.window=t,this.func=n,this.type=r,this.name=i,this.group=o,this.order=s,this.frame=a}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map($t),r=q(["PARTITION BY ",gl(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,r,c,l)}orderby(...t){let n=t.flat().filter(u=>u).map($t),r=q(["ORDER BY ",gl(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,r,l)}rows(t){let n=NL("ROWS",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}range(t){let n=NL("RANGE",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}};function NL(e,t){if(vs(t)){let n=q`${t}`;return n.toString=()=>`${e} ${DL(t.value)}`,n}return`${e} ${DL(t)}`}function DL(e){let[t,n]=e,r=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${i}`}function ki(e,t){return(...n)=>{let r=In(e)(...n);return new Fh(e,r,t)}}var kS=ki("ROW_NUMBER","INTEGER"),CS=ki("RANK","INTEGER"),BS=ki("DENSE_RANK","INTEGER"),PS=ki("PERCENT_RANK"),$S=ki("CUME_DIST"),US=ki("NTILE"),zS=ki("LAG"),jS=ki("LEAD"),VS=ki("FIRST_VALUE"),qS=ki("LAST_VALUE"),YS=ki("NTH_VALUE");function Vt(e,...t){return q(e,...t).annotate({aggregate:!0})}var GS=class e extends Ss{constructor(t,n,r,i,o){n=(n||[]).map($t);let{strings:s,exprs:a}=nY(t,n,r,i,o),{spans:c,cols:l}=IS(s,a);super(c,l),this.aggregate=t,this.args=n,this.type=r,this.isDistinct=i,this.filter=o}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(rY).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:n,type:r,filter:i}=this;return new e(t,n,r,!0,i)}where(t){let{aggregate:n,args:r,type:i,isDistinct:o}=this;return new e(n,r,i,o,t)}window(){let{aggregate:t,args:n,type:r,isDistinct:i}=this,o=new e(t,n,null,i);return new Fh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t){return this.window().rows(t)}range(t){return this.window().range(t)}};function nY(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...gl(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function rY(e){let t=go(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Ht(e,t){return(...n)=>new GS(e,n,t)}var Zn=Ht("COUNT","INTEGER"),kh=Ht("AVG"),iY=Ht("AVG"),WS=Ht("MAD"),ui=Ht("MAX"),fi=Ht("MIN"),Pr=Ht("SUM","DOUBLE"),XS=Ht("PRODUCT"),HS=Ht("MEDIAN"),QS=Ht("QUANTILE"),ZS=Ht("MODE"),KS=Ht("VARIANCE"),Ch=Ht("STDDEV"),JS=Ht("SKEWNESS"),tI=Ht("KURTOSIS"),eI=Ht("ENTROPY"),nI=Ht("VAR_POP"),rI=Ht("STDDEV_POP"),iI=Ht("CORR"),oI=Ht("COVAR_SAMP"),sI=Ht("COVAR_POP"),aI=Ht("REGR_INTERCEPT"),cI=Ht("REGR_SLOPE"),lI=Ht("REGR_COUNT"),oY=Ht("REGR_R2"),uI=Ht("REGR_SYY"),fI=Ht("REGR_SXX"),sY=Ht("REGR_SXY"),dI=Ht("REGR_AVGX"),aY=Ht("REGR_AVGY"),hI=Ht("FIRST"),pI=Ht("LAST"),Ju=Ht("ARG_MIN"),tf=Ht("ARG_MAX"),mI=Ht("STRING_AGG"),yI=Ht("ARRAY_AGG");function Bh(e,t){let n=$t(e),r=q`CAST(${n} AS ${t})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),r}var ef=e=>Bh(e,"DOUBLE"),gI=e=>Bh(e,"INTEGER");var xI=e=>q`epoch_ms(${$t(e)})`;function bI(e,t,n=1){let r=`INTERVAL ${n} ${t}`,i=$t(e);return q`TIME_BUCKET(${r}, ${i})`.annotate({label:t})}var wI=e=>{let t=$t(e);return q`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},_I=e=>{let t=$t(e);return q`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},vI=e=>{let t=$t(e);return q`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Ph=In("ST_AsGeoJSON"),RL=In("ST_X"),LL=In("ST_Y"),$h=In("ST_CENTROID"),SI=e=>RL($h(e)),II=e=>LL($h(e));var pt=class e{static select(...t){return new e().select(...t)}static from(...t){return new e().from(...t)}static with(...t){return new e().with(...t)}static union(...t){return new xl("UNION",t.flat())}static unionAll(...t){return new xl("UNION ALL",t.flat())}static intersect(...t){return new xl("INTERSECT",t.flat())}static except(...t){return new xl("EXCEPT",t.flat())}static describe(t){let n=t.clone(),{clone:r,toString:i}=n;return Object.assign(n,{describe:!0,clone:()=>e.describe(r.call(n)),toString:()=>`DESCRIBE ${i.call(n)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let o of t.flat())if(o!=null)if(typeof o=="string")r.push({as:o,expr:$t(o)});else if(o instanceof _r)r.push({as:o.column,expr:o});else if(Array.isArray(o))r.push({as:o[0],expr:o[1]});else for(let s in o)r.push({as:ox(s),expr:$t(o[s])});let i=new Set(r.map(o=>o.as));return n.select=n.select.filter(o=>!i.has(o.as)).concat(r.filter(o=>o.expr)),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:dl(i)});else if(i instanceof _r)r.push({as:i.table,from:i});else if(Uh(i)||ix(i))r.push({from:i});else if(Array.isArray(i))r.push({as:ox(i[0]),from:dl(i[1])});else for(let o in i)r.push({as:ox(o),from:dl(i[o])})}),n.from=n.from.concat(r),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:n}:{rows:Math.round(t),method:n}),r.sample=i,this}}where(...t){let{query:n}=this;return t.length===0?n.where:(n.where=n.where.concat(t.flat().filter(r=>r)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:n}=this;return t.length===0?n.groupby:(n.groupby=n.groupby.concat(t.flat().filter(r=>r).map($t)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:ox(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map($t)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:n}=this,i=(n?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(Uh(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{with:t,select:n,distinct:r,from:i,sample:o,where:s,groupby:a,having:c,window:l,qualify:u,orderby:f,limit:d,offset:h}=this.query,p=[];if(t.length){let y=t.map(({as:g,query:x})=>`"${g}" AS (${x})`);p.push(`WITH ${y.join(", ")}`)}let m=n.map(({as:y,expr:g})=>TL(g,y)&&!g.table?`${g}`:`${g} AS "${y}"`);if(p.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),i.length){let y=i.map(({as:g,from:x})=>{let b=Uh(x)?`(${x})`:`${x}`;return!g||g===x.table?b:`${b} AS "${g}"`});p.push(`FROM ${y.join(", ")}`)}if(s.length){let y=s.map(String).filter(g=>g).join(" AND ");y&&p.push(`WHERE ${y}`)}if(o){let{rows:y,perc:g,method:x,seed:b}=o,w=y?`${y} ROWS`:`${g} PERCENT`,v=x?` (${x}${b!=null?`, ${b}`:""})`:"";p.push(`USING SAMPLE ${w}${v}`)}if(a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let y=c.map(String).filter(g=>g).join(" AND ");y&&p.push(`HAVING ${y}`)}if(l.length){let y=l.map(({as:g,expr:x})=>`"${g}" AS (${x})`);p.push(`WINDOW ${y.join(", ")}`)}if(u.length){let y=u.map(String).filter(g=>g).join(" AND ");y&&p.push(`QUALIFY ${y}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(d)&&p.push(`LIMIT ${d}`),Number.isFinite(h)&&p.push(`OFFSET ${h}`),p.join(" ")}},xl=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]},this.cteFor=null}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map($t)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}toString(){let{op:t,queries:n,query:{orderby:r,limit:i,offset:o}}=this,s=[n.join(` ${t} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function Uh(e){return e instanceof pt||e instanceof xl}function TI(e){return Uh(e)&&e.describe}function ox(e){return cY(e)?e.slice(1,-1):e}function cY(e){return e[0]==='"'&&e[e.length-1]==='"'}var sx=e=>e;function FL(){return{apply:sx,invert:sx,sqlApply:$t,sqlInvert:sx}}function lY({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>q`LN(${$t(t)})`,sqlInvert:t=>q`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>q`LOG(${$t(t)})`,sqlInvert:t=>q`POW(10, ${t})`};{let t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>q`LN(${$t(n)}) / LN(${t})`,sqlInvert:n=>q`POW(${t}, ${n})`}}}function uY({constant:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-t),sqlApply:n=>(n=$t(n),q`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>q`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function fY(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=$t(e),q`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>q`SIGN(${e}) * (${e}) ** 2`}}function dY({exponent:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),t),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/t),sqlApply:n=>(n=$t(n),q`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>q`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function kL(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:xI($t(e)),sqlInvert:sx}}var hY={identity:FL,linear:FL,log:lY,symlog:uY,sqrt:fY,pow:dY,time:kL,utc:kL};function zh(e){let t=hY[e.type];return t?{...e,...t(e)}:null}function Ya(e,t,{replace:n=!1,temp:r=!0,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+e+" AS "+t}function EI(e){return`INSTALL ${e}; LOAD ${e}`}function CL(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${go(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function ax(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=pY({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Ya(t,p,{view:a,temp:c,replace:l})}function MI(e,t,n){return ax("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function OI(e,t,n){return ax("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function NI(e,t,n){return ax("read_parquet",e,t,n)}function DI(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(i,{open_options:o.toUpperCase()})}return ax("st_read",e,t,i)}function RI(e,t,n={}){let{select:r=["*"],...i}=n,o=CL(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return Ya(e,s,i)}function pY(e){return Object.entries(e).map(([t,n])=>`${t}=${AI(n)}`).join(", ")}function AI(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>AI(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${AI(n)}`).join(", ")+"}";default:return e}}function PL(e){if(!e.filterIndexable)return null;let t=e.query(),n=ux(t,a=>a.from()?.[0].from.table);if(typeof n!="string"||!t.select)return null;let r=[],i=[],o={},s=a=>{let c=a.column;return`(SELECT AVG(${ux(t,u=>u.select().find(f=>f.as===c)?.expr)??a}) FROM "${n}")`};for(let a of t.select()){let{as:c,expr:{aggregate:l,args:u}}=a,f=l?.toUpperCase?.();switch(f){case"COUNT":case"SUM":r.push({[c]:Vt`SUM("${c}")::DOUBLE`});break;case"AVG":r.push({[c]:yY(o,c,u[0])});break;case"ARG_MAX":r.push({[c]:gY(o,c,u)});break;case"ARG_MIN":r.push({[c]:xY(o,c,u)});break;case"VARIANCE":case"VAR_SAMP":o[c]=null,r.push({[c]:cx(o,u[0],s)});break;case"VAR_POP":o[c]=null,r.push({[c]:cx(o,u[0],s,!1)});break;case"STDDEV":case"STDDEV_SAMP":o[c]=null,r.push({[c]:Vt`SQRT(${cx(o,u[0],s)})`});break;case"STDDEV_POP":o[c]=null,r.push({[c]:Vt`SQRT(${cx(o,u[0],s,!1)})`});break;case"COVAR_SAMP":o[c]=null,r.push({[c]:lx(o,u,s)});break;case"COVAR_POP":o[c]=null,r.push({[c]:lx(o,u,s,!1)});break;case"CORR":o[c]=null,r.push({[c]:BL(o,u,s)});break;case"REGR_COUNT":o[c]=null,r.push({[c]:Vt`${nf(o,u)}::DOUBLE`});break;case"REGR_AVGX":o[c]=null,r.push({[c]:zL(o,u)});break;case"REGR_AVGY":o[c]=null,r.push({[c]:jL(o,u)});break;case"REGR_SYY":o[c]=null,r.push({[c]:FI(o,0,u,s)});break;case"REGR_SXX":o[c]=null,r.push({[c]:FI(o,1,u,s)});break;case"REGR_SXY":o[c]=null,r.push({[c]:lx(o,u,s,null)});break;case"REGR_SLOPE":o[c]=null,r.push({[c]:VL(o,u,s)});break;case"REGR_INTERCEPT":o[c]=null,r.push({[c]:bY(o,u,s)});break;case"REGR_R2":o[c]=null,r.push({[c]:Vt`(${BL(o,u,s)}) ** 2`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":r.push({[c]:Vt`${f}("${c}")`});break;default:if(!l)i.push(c);else return null}}return r.length?{from:n,dims:i,aggr:r,aux:o}:null}function Ci(e,...t){let n=t.length?"_"+t.map(mY).join("_"):"";return`__${e}${n}__`}function mY(e){return`${e}`.replaceAll('"',"").replaceAll(" ","_")}function ux(e,t){let n=e.subqueries;if(e.select&&n.length===0)return t(e);let r=ux(n[0],t);for(let i=1;i<n.length;++i){let o=ux(n[i],t);if(o!==void 0&&o!==r)return NaN}return r}function $L(e,t){let n=Ci("count",t);return e[n]=Vt`COUNT(${t})`,Vt`SUM(${n})`.annotate({name:n})}function yY(e,t,n){let r=$L(e,n);return Vt`(SUM("${t}" * ${r.name}) / ${r})`}function gY(e,t,[,n]){let r=Ci("max",n);return e[r]=Vt`MAX(${n})`,Vt`ARG_MAX("${t}", ${r})`}function xY(e,t,[,n]){let r=Ci("min",n);return e[r]=Vt`MIN(${n})`,Vt`ARG_MIN("${t}", ${r})`}function cx(e,t,n,r=!0){let i=$L(e,t),o=Ci("rssq",t),s=Ci("rsum",t),a=q`${t} - ${n(t)}`;return e[o]=Vt`SUM((${a}) ** 2)`,e[s]=Vt`SUM(${a})`,Vt`(SUM(${o}) - (SUM(${s}) ** 2 / ${i})) / (${i}${r?" - 1":""})`}function lx(e,t,n,r=!0){let i=nf(e,t),o=UL(e,t,n),s=jh(e,1,t,n),a=jh(e,0,t,n),c=r===null?"":r?` / (${i} - 1)`:` / ${i}`;return Vt`(${o} - ${s} * ${a} / ${i})${c}`}function BL(e,t,n){let r=nf(e,t),i=UL(e,t,n),o=LI(e,1,t,n),s=LI(e,0,t,n),a=jh(e,1,t,n),c=jh(e,0,t,n),l=Vt`(${o} - (${a} ** 2) / ${r})`,u=Vt`(${s} - (${c} ** 2) / ${r})`;return Vt`(${i} - ${a} * ${c} / ${r}) / SQRT(${l} * ${u})`}function nf(e,[t,n]){let r=Ci("count",t,n);return e[r]=Vt`REGR_COUNT(${t}, ${n})`,Vt`SUM(${r})`.annotate({name:r})}function jh(e,t,n,r){let i=n[t],o=n[1-t],s=Ci("rs",i);return e[s]=Vt`SUM(${i} - ${r(i)}) FILTER (${o} IS NOT NULL)`,Vt`SUM(${s})`}function LI(e,t,n,r){let i=n[t],o=n[1-t],s=Ci("rss",i);return e[s]=Vt`SUM((${i} - ${r(i)}) ** 2) FILTER (${o} IS NOT NULL)`,Vt`SUM(${s})`}function UL(e,t,n){let[r,i]=t,o=Ci("sxy",r,i);return e[o]=Vt`SUM((${i} - ${n(i)}) * (${r} - ${n(r)}))`,Vt`SUM(${o})`}function zL(e,t){let[n,r]=t,i=nf(e,t),o=Ci("avg",r,n);return e[o]=Vt`REGR_AVGX(${n}, ${r})`,Vt`(SUM(${o} * ${i.name}) / ${i})`}function jL(e,t){let[n,r]=t,i=nf(e,t),o=Ci("avg",n,r);return e[o]=Vt`REGR_AVGY(${n}, ${r})`,Vt`(SUM(${o} * ${i.name}) / ${i})`}function FI(e,t,n,r){let i=nf(e,n),o=jh(e,t,n,r),s=LI(e,t,n,r);return Vt`(${s} - (${o} ** 2 / ${i}))`}function VL(e,t,n){let r=lx(e,t,n,null),i=FI(e,1,t,n);return Vt`(${r}) / ${i}`}function bY(e,t,n){let r=zL(e,t),i=jL(e,t),o=VL(e,t,n);return Vt`${i} - (${o}) * ${r}`}function YL(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=qL(t^o>>8)),t=qL(t^i&255)}return wY(t)}function qL(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function wY(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var _Y={skip:!0,result:null},fx=class{constructor(t,{schema:n="mosaic",enabled:r=!0}={}){this.indexes=new Map,this.active=null,this.mc=t,this._schema=n,this._enabled=r}set enabled(t){this._enabled!==t&&(t||this.clear(),this._enabled=t)}get enabled(){return this._enabled}set schema(t){this._schema!==t&&(this.clear(),this._schema=t)}get schema(){return this._schema}dropIndexTables(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.indexes.clear(),this.active=null}index(t,n,r){if(!this.enabled)return null;let{indexes:i,mc:o,schema:s}=this,{source:a}=r;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=vY(r),c.source===null))return null;if(i.has(t))return i.get(t);let l=PL(t),u;if(!l)u=null;else if(n.skip(t,r))u=_Y;else{let f=n.remove(a).predicate(t);u=TY(t.query(f),c,l,s),u.result=o.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,Ya(u.table,u.create,{temp:!1})]),u.result.catch(d=>o.logger().error(d))}return i.set(t,u),u}};function vY(e){let{source:t,meta:n}=e,r=e.predicate,i=r?.columns,o,s;if(!n||!i)return{source:null,columns:s,predicate:o};let{type:a,scales:c,bin:l,pixelSize:u=1}=n;if(a==="point")o=f=>f,s=Object.fromEntries(i.map(f=>[`${f}`,$t(f)]));else if(a==="interval"&&c){let f=c.map(d=>IY(d,u,l));f.some(d=>!d)||(f.length===1?(o=d=>d?We("active0",d.range.map(f[0])):[],s={active0:f[0](r.field)}):(o=d=>d?vr(d.children.map(({range:h},p)=>We(`active${p}`,h.map(f[p])))):[],s=Object.fromEntries(r.children.map((d,h)=>[`active${h}`,f[h](d.field)]))))}return{source:s?t:null,columns:s,predicate:o}}var SY={ceil:"CEIL",round:"ROUND"};function IY(e,t,n){let{type:r,domain:i,range:o,apply:s,sqlApply:a}=zh(e);if(!s)return;let c=SY[`${n}`.toLowerCase()]||"FLOOR",l=s(Math.min(...i)),u=s(Math.max(...i)),f=r==="identity"?1:Math.abs(o[1]-o[0])/(u-l),d=f/t===1?"":`${f/t}::DOUBLE * `,h=l===0?"":` - ${l}::DOUBLE`;return p=>q`${c}(${d}(${a(p)}${h}))::INTEGER`}function TY(e,t,n,r){let{dims:i,aggr:o,aux:s}=n,{columns:a}=t,c=e.select({...a,...s}).groupby(Object.keys(a)),[l]=c.subqueries;if(l){let m=Object.values(a).flatMap(y=>y.columns);EY(l,m)}let u=c.orderby();c.query.orderby=[];let f=c.toString(),d=(YL(f)>>>0).toString(16),h=`${r}.cube_${d}`,p=pt.select(i,o).from(h).groupby(i).orderby(u);return new kI({id:d,table:h,create:f,active:t,select:p})}function EY(e,t){let n=new Set,r=i=>{n.has(i)||(n.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(r))};r(e)}var kI=class{constructor({table:t,create:n,active:r,select:i}={}){this.table=t,this.create=n,this.result=null,this.active=r,this.select=i,this.skip=!1}query(t){return this.select.clone().where(this.active.predicate(t))}};var bl=class extends Promise{constructor(){let t,n;super((r,i)=>{t=r,n=i}),this._resolve=t,this._reject=n}fulfill(t){return this._resolve(t),this}reject(t){return this._reject(t),this}};bl.prototype.constructor=Promise;function AY(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function GL(e,t,n){let r=[],i=0;function o(){let s=MY(r,t);r=[],i=0;for(let a of s)NY(a,e,n),LY(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||AY(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function MY(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=OY(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function OY(e,t){let n=`${e}`;if(e instanceof pt&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof _r&&o[s.column]||s))}else e.select().some(({expr:o})=>o.aggregate)&&r.$groupby("ALL");return`${r}`}else return n}function NY(e,t,n){if(DY(e))t({request:{type:"arrow",cache:!1,record:!1,query:e.query=RY(e,n)},result:e.result=new bl});else for(let{entry:r,priority:i}of e)t(r,i)}function DY(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let n=1;n<e.length;++n)if(t!==`${e[n].entry.request.query}`)return!0}return!1}function RY(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[d]=r.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof _r&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function LY(e,t){let{maps:n,query:r,result:i}=e;if(!n)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=TI(r);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=n[c],d=s&&f?kY(o,f):f?FY(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function FY(e,t){return e.select(t.map(n=>n[0]),t.map(n=>n[1]))}function kY(e,t){let n=new Map(t),r=[];for(let i of e)n.has(i.column_name)&&r.push({...i,column_name:n.get(i.column_name)});return r}var CY=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,WL=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function XL({max:e=1e3,ttl:t=3*60*60*1e3}={}){let n=new Map;function r(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of n){let{last:l}=c;l<s&&(o=a,s=l),i>l&&n.delete(a)}o&&n.delete(o)}return{get(i){let o=n.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return n.set(i,{last:performance.now(),value:o}),n.size>e&&CY(r),o},clear(){n=new Map}}}var dx=class{constructor(t){this.queue=Array.from({length:t},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(t=>!t.head)}insert(t,n){let r=this.queue[n];if(!r)throw new Error(`Invalid queue priority rank: ${n}`);let i={item:t,next:null};r.head===null?r.head=r.tail=i:r.tail=r.tail.next=i}remove(t){for(let n of this.queue){let{head:r,tail:i}=n;for(let o=null,s=r;s;o=s,s=s.next)t(s.item)&&(s===r?r=s.next:o.next=s.next,s===i&&(i=o||r));n.head=r,n.tail=i}}next(){for(let t of this.queue){let{head:n}=t;if(n!==null)return t.head=n.next,t.tail===n&&(t.tail=null),n.item}}};var xo={High:0,Normal:1,Low:2},hx=class{constructor(){this.queue=new dx(3),this.db=null,this.clientCache=null,this._logger=null,this._logQueries=!1,this.recorders=[],this.pending=null,this._consolidate=null}next(){if(this.pending||this.queue.isEmpty())return;let{request:t,result:n}=this.queue.next();this.pending=this.submit(t,n),this.pending.finally(()=>{this.pending=null,this.next()})}enqueue(t,n=xo.Normal){this.queue.insert(t,n),this.next()}recordQuery(t){this.recorders.length&&t&&this.recorders.forEach(n=>n.add(t))}async submit(t,n){try{let{query:r,type:i,cache:o=!1,record:s=!0,options:a}=t,c=r?`${r}`:null;if(s&&this.recordQuery(c),o){let f=this.clientCache.get(c);if(f){this._logger.debug("Cache"),n.fulfill(f);return}}let l=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:c,...a});let u=await this.db.query({type:i,sql:c,...a});o&&this.clientCache.set(c,u),this._logger.debug(`Request: ${(performance.now()-l).toFixed(1)}`),n.fulfill(u)}catch(r){n.reject(r)}}cache(t){return t!==void 0?this.clientCache=t===!0?XL():t||WL():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=GL(this.enqueue.bind(this),this.clientCache,this.recordQuery.bind(this)):!t&&this._consolidate&&(this._consolidate=null)}request(t,n=xo.Normal){let r=new bl,i={request:t,result:r};return this._consolidate?this._consolidate.add(i,n):this.enqueue(i,n),r}cancel(t){let n=new Set(t);n.size&&this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1)}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0))}record(){let t=[],n={add(r){t.push(r)},reset(){t=[]},snapshot(){return t.slice()},stop(){return this.recorders=this.recorders.filter(r=>r!==n),t}};return this.recorders.push(n),n}};function CI(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}var BY="count",PY="nulls",$Y="max",UY="min",zY="distinct";var jY={[BY]:Zn,[zY]:e=>Zn(e).distinct(),[$Y]:ui,[UY]:fi,[PY]:e=>Zn().where(ml(e))};function VY(e,t,n){return pt.from(e).select(Array.from(n,r=>[r,jY[r](t)]))}async function HL(e,t){return t.length===1&&`${t[0].column}`=="*"?YY(e,t[0].table):(await Promise.all(t.map(n=>qY(e,n)))).filter(n=>n)}async function qY(e,{table:t,column:n,stats:r}){let i=pt.from({source:t}).select({column:n}).groupby(n.aggregate?q`ALL`:[]),[o]=Array.from(await e.query(pt.describe(i))),s={table:t,column:`${n}`,sqlType:o.column_type,type:CI(o.column_type),nullable:o.null==="YES"};if(!(r?.length||r?.size))return s;let[a]=await e.query(VY(t,n,r),{persist:!0});return Object.assign(s,a)}async function YY(e,t){let n=await e.query(`DESCRIBE ${dl(t)}`);return Array.from(n).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:CI(r.column_type),nullable:r.null==="YES"}))}function QL(){return{debug(){},info(){},log(){},warn(){},error(){}}}var px;function di(e){return e?px=e:px==null&&(px=new Vh),px}var Vh=class{constructor(t=rx(),{logger:n=console,manager:r=new hx,cache:i=!0,consolidate:o=!0,indexes:s={}}={}){this.manager=r,this.manager.cache(i),this.manager.consolidate(o),this.databaseConnector(t),this.logger(n),this.clear(),this.dataCubeIndexer=new fx(this,s)}clear({clients:t=!0,cache:n=!0}={}){this.manager.clear(),t&&(this.filterGroups?.forEach(r=>r.disconnect()),this.filterGroups=new Map,this.clients?.forEach(r=>this.disconnect(r)),this.clients=new Set),n&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}logger(t){return arguments.length&&(this._logger=t||QL(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=xo.Normal}={}){return t=Array.isArray(t)?t.filter(r=>r).join(`;
2
+ `):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=xo.Normal,...o}={}){return this.manager.request({type:n,query:t,cache:r,options:o},i)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:xo.Low})}createBundle(t,n,r=xo.Low){let i={name:t,queries:n.map(o=>typeof o=="string"?{sql:o}:o)};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=xo.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=xo.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{this._logger.error(i),t.queryError(i)}).catch(i=>this._logger.error(i))}requestQuery(t,n){return this.dataCubeIndexer.clear(),n?this.updateClient(t,n):Promise.resolve(t.update())}async connect(t){let{clients:n}=this;if(n.has(t))throw new Error("Client already connected.");n.add(t),t.coordinator=this,this.initializeClient(t),GY(this,t.filterBy,t)}async initializeClient(t){let n=t.fields();return n?.length&&t.fieldInfo(await HL(this,n)),t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;if(!n.has(t))return;n.delete(t),t.coordinator=null;let i=r.get(t.filterBy);i&&i.clients.delete(t)}};function GY(e,t,n){if(!t)return;let r=e.filterGroups.get(t);if(!r){let i=s=>WY(e,t,s),o=()=>XY(e,t);t.addEventListener("activate",i),t.addEventListener("value",o),r={selection:t,clients:new Set,disconnect(){t.removeEventListener("activate",i),t.removeEventListener("value",o)}},e.filterGroups.set(t,r)}r.clients.add(n)}function WY(e,t,n){let{dataCubeIndexer:r,filterGroups:i}=e,{clients:o}=i.get(t);for(let s of o)r.index(s,t,n)}function XY(e,t){let{dataCubeIndexer:n,filterGroups:r}=e,{clients:i}=r.get(t),{active:o}=t;return Promise.allSettled(Array.from(i,s=>{let a=n.index(s,t,o),c=a?null:t.predicate(s);if(a?.skip||!a&&!c)return;let l=a?.query(o.predicate)??s.query(c);return e.updateClient(s,l)}))}var mx=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new BI}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(t,n){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}async pending(t){await this._callbacks.get(t)?.pending}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Array.from(o,c=>c(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},BI=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,n){let r={value:t};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function qh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?HY(e,t):!0}function HY(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!0;return!1}function Sr(e){return e instanceof Ga}var Ga=class e extends mx{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>Sr(n))){let n=new e,r=()=>{n.update(t.map(i=>Sr(i)?i.value:i))};return r(),t.forEach(i=>Sr(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return qh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function $r(e){return e instanceof bo}function yx(e,t){return new bo(new gx(e),t&&[t].flat())}var bo=class e extends Ga{static intersect({cross:t=!1,empty:n=!1,include:r=[]}={}){return yx({cross:t,empty:n},r)}static union({cross:t=!1,empty:n=!1,include:r=[]}={}){return yx({cross:t,empty:n,union:!0},r)}static single({cross:t=!1,empty:n=!1,include:r=[]}={}){return yx({cross:t,empty:n,single:!0},r)}static crossfilter({empty:t=!1,include:n=[]}={}){return yx({cross:!0,empty:t},n)}constructor(t=new gx,n=[]){if(super([]),this._resolved=this._value,this._resolver=t,this._relay=new Set,Array.isArray(n))for(let r of n)r._relay.add(this)}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(n=>n.source===t)?.value}activate(t){this.emit("activate",t),this._relay.forEach(n=>n.activate(t))}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,this._relay.forEach(n=>n.update(t)),super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},gx=class{constructor({union:t,cross:n,single:r,empty:i}={}){this.union=!!t,this.cross=!!n,this.single=!!r,this.empty=!!i}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{empty:i,union:o}=this;if(i&&!t.length)return["FALSE"];if(this.skip(r,n))return;let s=t.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return o&&s.length>1?pl(s):s}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}return null}};function ZL(e="http://localhost:3000/"){return{async query(t){let n=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?n:t.type==="arrow"?ja(await(await n).arrayBuffer()):(await n).json()}}}function JL(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Z(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function KL(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Bt(e){return this instanceof Bt?(this.v=e,this):new Bt(e)}function Ur(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(p){return Promise.resolve(p).then(h,f)}}function a(h,p){r[h]&&(i[h]=function(m){return new Promise(function(y,g){o.push([h,m,y,g])>1||c(h,m)})},p&&(i[h]=p(i[h])))}function c(h,p){try{l(r[h](p))}catch(m){d(o[0][3],m)}}function l(h){h.value instanceof Bt?Promise.resolve(h.value.v).then(u,f):d(o[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function rf(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Bt(e[i](s)),done:!1}:o?o(s):s}:o}}function Bi(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof KL=="function"?KL(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var VI={};kr(VI,{compareArrayLike:()=>jI,joinUint8Arrays:()=>zr,memcpy:()=>of,rebaseValueOffsets:()=>Ix,toArrayBufferView:()=>Ut,toArrayBufferViewAsyncIterator:()=>Ui,toArrayBufferViewIterator:()=>wo,toBigInt64Array:()=>nG,toBigUint64Array:()=>oG,toFloat32Array:()=>sG,toFloat32ArrayAsyncIterator:()=>vG,toFloat32ArrayIterator:()=>pG,toFloat64Array:()=>aG,toFloat64ArrayAsyncIterator:()=>SG,toFloat64ArrayIterator:()=>mG,toInt16Array:()=>eG,toInt16ArrayAsyncIterator:()=>xG,toInt16ArrayIterator:()=>uG,toInt32Array:()=>wl,toInt32ArrayAsyncIterator:()=>bG,toInt32ArrayIterator:()=>fG,toInt8Array:()=>tG,toInt8ArrayAsyncIterator:()=>gG,toInt8ArrayIterator:()=>lG,toUint16Array:()=>rG,toUint16ArrayAsyncIterator:()=>wG,toUint16ArrayIterator:()=>dG,toUint32Array:()=>iG,toUint32ArrayAsyncIterator:()=>_G,toUint32ArrayIterator:()=>hG,toUint8Array:()=>Lt,toUint8ArrayAsyncIterator:()=>zI,toUint8ArrayIterator:()=>UI,toUint8ClampedArray:()=>cG,toUint8ClampedArrayAsyncIterator:()=>IG,toUint8ClampedArrayIterator:()=>yG});var QY=new TextDecoder("utf-8"),Yh=e=>QY.decode(e),ZY=new TextEncoder,Wa=e=>ZY.encode(e);var KY=e=>typeof e=="number",tF=e=>typeof e=="boolean",sn=e=>typeof e=="function",Kn=e=>e!=null&&Object(e)===e,Pi=e=>Kn(e)&&sn(e.then);var $i=e=>Kn(e)&&sn(e[Symbol.iterator]),hi=e=>Kn(e)&&sn(e[Symbol.asyncIterator]),xx=e=>Kn(e)&&Kn(e.schema);var bx=e=>Kn(e)&&"done"in e&&"value"in e;var wx=e=>Kn(e)&&sn(e.stat)&&KY(e.fd);var _x=e=>Kn(e)&&Gh(e.body),vx=e=>"_getDOMStream"in e&&"_getNodeStream"in e,eF=e=>Kn(e)&&sn(e.abort)&&sn(e.getWriter)&&!vx(e),Gh=e=>Kn(e)&&sn(e.cancel)&&sn(e.getReader)&&!vx(e),nF=e=>Kn(e)&&sn(e.end)&&sn(e.write)&&tF(e.writable)&&!vx(e),Sx=e=>Kn(e)&&sn(e.read)&&sn(e.pipe)&&tF(e.readable)&&!vx(e),rF=e=>Kn(e)&&sn(e.clear)&&sn(e.bytes)&&sn(e.position)&&sn(e.setPosition)&&sn(e.capacity)&&sn(e.getBufferIdentifier)&&sn(e.createLong);var $I=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function JY(e){let t=e[0]?[e[0]]:[],n,r,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:n,byteLength:i}=s,{byteOffset:r,byteLength:o}=a,n+i<r||r+o<n){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,n,r-n+o)}return t}function of(e,t,n=0,r=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return o.set(s,n),e}function zr(e,t){let n=JY(e),r=n.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,r);for(let u=n.length;++c<u;){if(i=n[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?n[c]=i.subarray(o.length):o.length===i.length&&c++,s?of(s,o,a):s=o;break}of(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Ut(e,t){let n=bx(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Wa(n)),n instanceof ArrayBuffer?new e(n):n instanceof $I?new e(n):rF(n)?Ut(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var tG=e=>Ut(Int8Array,e),eG=e=>Ut(Int16Array,e),wl=e=>Ut(Int32Array,e),nG=e=>Ut(BigInt64Array,e),Lt=e=>Ut(Uint8Array,e),rG=e=>Ut(Uint16Array,e),iG=e=>Ut(Uint32Array,e),oG=e=>Ut(BigUint64Array,e),sG=e=>Ut(Float32Array,e),aG=e=>Ut(Float64Array,e),cG=e=>Ut(Uint8ClampedArray,e),PI=e=>(e.next(),e);function*wo(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $I?n(t):$i(t)?t:n(t);return yield*PI(function*(i){let o=null;do o=i.next(yield Ut(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var lG=e=>wo(Int8Array,e),uG=e=>wo(Int16Array,e),fG=e=>wo(Int32Array,e),UI=e=>wo(Uint8Array,e),dG=e=>wo(Uint16Array,e),hG=e=>wo(Uint32Array,e),pG=e=>wo(Float32Array,e),mG=e=>wo(Float64Array,e),yG=e=>wo(Uint8ClampedArray,e);function Ui(e,t){return Ur(this,arguments,function*(){if(Pi(t))return yield Bt(yield Bt(yield*rf(Bi(Ui(e,yield Bt(t))))));let r=function(s){return Ur(this,arguments,function*(){yield yield Bt(yield Bt(s))})},i=function(s){return Ur(this,arguments,function*(){yield Bt(yield*rf(Bi(PI(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $I?r(t):$i(t)?i(t):hi(t)?t:r(t);return yield Bt(yield*rf(Bi(PI(function(s){return Ur(this,arguments,function*(){let a=null;do a=yield Bt(s.next(yield yield Bt(Ut(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Bt(new e)})}var gG=e=>Ui(Int8Array,e),xG=e=>Ui(Int16Array,e),bG=e=>Ui(Int32Array,e),zI=e=>Ui(Uint8Array,e),wG=e=>Ui(Uint16Array,e),_G=e=>Ui(Uint32Array,e),vG=e=>Ui(Float32Array,e),SG=e=>Ui(Float64Array,e),IG=e=>Ui(Uint8ClampedArray,e);function Ix(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function jI(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var Tn={fromIterable(e){return Tx(TG(e))},fromAsyncIterable(e){return Tx(EG(e))},fromDOMStream(e){return Tx(AG(e))},fromNodeStream(e){return Tx(MG(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},Tx=e=>(e.next(),e);function*TG(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?zr(r,s)[0]:([i,r,a]=zr(r,s),i)}({cmd:o,size:s}=yield null);let l=UI(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(n=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{n===!1&&typeof l.return=="function"&&l.return(null)}return null}function EG(e){return Ur(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?zr(i,a)[0]:([o,i,c]=zr(i,a),o)}({cmd:s,size:a}=yield yield Bt(null));let u=zI(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Bt(u.next()):yield Bt(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Bt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Bt(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Bt(u.return(new Uint8Array(0))))}return yield Bt(null)})}function AG(e){return Ur(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?zr(i,a)[0]:([o,i,c]=zr(i,a),o)}({cmd:s,size:a}=yield yield Bt(null));let u=new YI(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Bt(u.read()):yield Bt(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Lt(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Bt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Bt(u.cancel(f)))}finally{r===!1?yield Bt(u.cancel()):e.locked&&u.releaseLock()}return yield Bt(null)})}var YI=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Z(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Z(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Lt(n)),n})}},qI=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function MG(e){return Ur(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?zr(l,a)[0]:([u,l,c]=zr(l,a),u)}if({cmd:s,size:a}=yield yield Bt(null),e.isTTY)return yield yield Bt(new Uint8Array(0)),yield Bt(null);try{n[0]=qI(e,"end"),n[1]=qI(e,"error");do{if(n[2]=qI(e,"readable"),[r,o]=yield Bt(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Lt(e.read(a-c)),u.byteLength<a-c&&(u=Lt(e.read()))):u=Lt(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Bt(f()));while(a<c)}while(!i)}finally{yield Bt(d(n,r==="error"?o:null))}return yield Bt(null);function d(h,p){return u=l=null,new Promise((m,y)=>{for(let[g,x]of h)e.off(g,x);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var Me;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Me||(Me={}));var we;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(we||(we={}));var Ie;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Ie||(Ie={}));var En;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(En||(En={}));var yt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(yt||(yt={}));var Jn;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Jn||(Jn={}));var Kt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Kt||(Kt={}));var R;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(R||(R={}));var pi;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(pi||(pi={}));var uT={};kr(uT,{clampIndex:()=>bW,clampRange:()=>Qh,createElementComparator:()=>Qa});var GI={};kr(GI,{valueToString:()=>zi});function zi(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>zi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var XI={};kr(XI,{BN:()=>Xh,bigNumToBigInt:()=>sF,bigNumToString:()=>cf,isArrowBigNumSymbol:()=>iF});var iF=Symbol.for("isArrowBigNum");function ji(e,...t){return t.length===0?Object.setPrototypeOf(Ut(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}ji.prototype[iF]=!0;ji.prototype.toJSON=function(){return`"${cf(this)}"`};ji.prototype.valueOf=function(){return oF(this)};ji.prototype.toString=function(){return cf(this)};ji.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return oF(this);case"string":return cf(this);case"default":return sF(this)}return cf(this)};function sf(...e){return ji.apply(this,e)}function af(...e){return ji.apply(this,e)}function Wh(...e){return ji.apply(this,e)}Object.setPrototypeOf(sf.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(af.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Wh.prototype,Object.create(Uint32Array.prototype));Object.assign(sf.prototype,ji.prototype,{constructor:sf,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(af.prototype,ji.prototype,{constructor:af,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Wh.prototype,ji.prototype,{constructor:Wh,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function oF(e){let{buffer:t,byteOffset:n,length:r,signed:i}=e,o=new BigUint64Array(t,n,r),s=i&&o.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(s?1:0),c=BigInt(0);if(s){for(let l of o)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of o)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var cf=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return WI(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return WI(e);t=t.slice();let r=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+r;t[o]=a,r&=s===0?1:0}return`-${WI(t)}`},sF=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:cf(e);function WI(e){let t="",n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Xh=class e{static new(t,n){switch(n){case!0:return new sf(t);case!1:return new af(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new sf(t)}return t.byteLength===16?new Wh(t):new af(t)}static signed(t){return new sf(t)}static unsigned(t){return new af(t)}static decimal(t){return new Wh(t)}constructor(t,n){return e.new(t,n)}};function Ir(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var aF,cF,lF,uF,fF,dF,hF,pF,mF,yF,gF,xF,bF,wF,_F,vF,SF,IF,TF,EF,lt=class e{static isNull(t){return t?.typeId===R.Null}static isInt(t){return t?.typeId===R.Int}static isFloat(t){return t?.typeId===R.Float}static isBinary(t){return t?.typeId===R.Binary}static isUtf8(t){return t?.typeId===R.Utf8}static isBool(t){return t?.typeId===R.Bool}static isDecimal(t){return t?.typeId===R.Decimal}static isDate(t){return t?.typeId===R.Date}static isTime(t){return t?.typeId===R.Time}static isTimestamp(t){return t?.typeId===R.Timestamp}static isInterval(t){return t?.typeId===R.Interval}static isDuration(t){return t?.typeId===R.Duration}static isList(t){return t?.typeId===R.List}static isStruct(t){return t?.typeId===R.Struct}static isUnion(t){return t?.typeId===R.Union}static isFixedSizeBinary(t){return t?.typeId===R.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===R.FixedSizeList}static isMap(t){return t?.typeId===R.Map}static isDictionary(t){return t?.typeId===R.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===we.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===we.Sparse}get typeId(){return R.NONE}};aF=Symbol.toStringTag;lt[aF]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(lt.prototype);var tr=class extends lt{toString(){return"Null"}get typeId(){return R.Null}};cF=Symbol.toStringTag;tr[cF]=(e=>e[Symbol.toStringTag]="Null")(tr.prototype);var Ve=class extends lt{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return R.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};lF=Symbol.toStringTag;Ve[lF]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Ve.prototype);var Ex=class extends Ve{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ax=class extends Ve{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},_o=class extends Ve{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Mx=class extends Ve{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ox=class extends Ve{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Nx=class extends Ve{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Dx=class extends Ve{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Rx=class extends Ve{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ex.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ax.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(_o.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Mx.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ox.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Nx.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Dx.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Rx.prototype,"ArrayType",{value:BigUint64Array});var Tr=class extends lt{constructor(t){super(),this.precision=t}get typeId(){return R.Float}get ArrayType(){switch(this.precision){case Ie.HALF:return Uint16Array;case Ie.SINGLE:return Float32Array;case Ie.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};uF=Symbol.toStringTag;Tr[uF]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Tr.prototype);var Lx=class extends Tr{constructor(){super(Ie.HALF)}},Fx=class extends Tr{constructor(){super(Ie.SINGLE)}},kx=class extends Tr{constructor(){super(Ie.DOUBLE)}};Object.defineProperty(Lx.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Fx.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(kx.prototype,"ArrayType",{value:Float64Array});var As=class extends lt{constructor(){super()}get typeId(){return R.Binary}toString(){return"Binary"}};fF=Symbol.toStringTag;As[fF]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(As.prototype);var Ms=class extends lt{constructor(){super()}get typeId(){return R.Utf8}toString(){return"Utf8"}};dF=Symbol.toStringTag;Ms[dF]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ms.prototype);var Os=class extends lt{constructor(){super()}get typeId(){return R.Bool}toString(){return"Bool"}};hF=Symbol.toStringTag;Os[hF]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Os.prototype);var Ns=class extends lt{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return R.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};pF=Symbol.toStringTag;Ns[pF]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Ns.prototype);var Ds=class extends lt{constructor(t){super(),this.unit=t}get typeId(){return R.Date}toString(){return`Date${(this.unit+1)*32}<${En[this.unit]}>`}};mF=Symbol.toStringTag;Ds[mF]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Ds.prototype);var Vi=class extends lt{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return R.Time}toString(){return`Time${this.bitWidth}<${yt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};yF=Symbol.toStringTag;Vi[yF]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Vi.prototype);var Rs=class extends lt{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return R.Timestamp}toString(){return`Timestamp<${yt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};gF=Symbol.toStringTag;Rs[gF]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Rs.prototype);var Ls=class extends lt{constructor(t){super(),this.unit=t}get typeId(){return R.Interval}toString(){return`Interval<${Jn[this.unit]}>`}};xF=Symbol.toStringTag;Ls[xF]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Ls.prototype);var Fs=class extends lt{constructor(t){super(),this.unit=t}get typeId(){return R.Duration}toString(){return`Duration<${yt[this.unit]}>`}};bF=Symbol.toStringTag;Fs[bF]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Fs.prototype);var qi=class extends lt{constructor(t){super(),this.children=[t]}get typeId(){return R.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};wF=Symbol.toStringTag;qi[wF]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(qi.prototype);var _e=class extends lt{constructor(t){super(),this.children=t}get typeId(){return R.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};_F=Symbol.toStringTag;_e[_F]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(_e.prototype);var Yi=class extends lt{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return R.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};vF=Symbol.toStringTag;Yi[vF]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Yi.prototype);var ks=class extends lt{constructor(t){super(),this.byteWidth=t}get typeId(){return R.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};SF=Symbol.toStringTag;ks[SF]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(ks.prototype);var Gi=class extends lt{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return R.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};IF=Symbol.toStringTag;Gi[IF]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Gi.prototype);var Wi=class extends lt{constructor(t,n=!1){var r,i,o;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return R.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};TF=Symbol.toStringTag;Wi[TF]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Wi.prototype);var OG=(e=>()=>++e)(-1),jr=class extends lt{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?OG():Ir(r)}get typeId(){return R.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};EF=Symbol.toStringTag;jr[EF]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(jr.prototype);function Vr(e){let t=e;switch(e.typeId){case R.Decimal:return e.bitWidth/32;case R.Timestamp:return 2;case R.Date:return 1+t.unit;case R.Interval:return 1+t.unit;case R.FixedSizeList:return t.listSize;case R.FixedSizeBinary:return t.byteWidth;default:return 1}}var dt=class{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return NG(this,t,n)}getVisitFnByTypeId(t,n=!0){return lf(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function NG(e,t,n=!0){return typeof t=="number"?lf(e,t,n):typeof t=="string"&&t in R?lf(e,R[t],n):t&&t instanceof lt?lf(e,AF(t),n):t?.type&&t.type instanceof lt?lf(e,AF(t.type),n):lf(e,R.NONE,n)}function lf(e,t,n=!0){let r=null;switch(t){case R.Null:r=e.visitNull;break;case R.Bool:r=e.visitBool;break;case R.Int:r=e.visitInt;break;case R.Int8:r=e.visitInt8||e.visitInt;break;case R.Int16:r=e.visitInt16||e.visitInt;break;case R.Int32:r=e.visitInt32||e.visitInt;break;case R.Int64:r=e.visitInt64||e.visitInt;break;case R.Uint8:r=e.visitUint8||e.visitInt;break;case R.Uint16:r=e.visitUint16||e.visitInt;break;case R.Uint32:r=e.visitUint32||e.visitInt;break;case R.Uint64:r=e.visitUint64||e.visitInt;break;case R.Float:r=e.visitFloat;break;case R.Float16:r=e.visitFloat16||e.visitFloat;break;case R.Float32:r=e.visitFloat32||e.visitFloat;break;case R.Float64:r=e.visitFloat64||e.visitFloat;break;case R.Utf8:r=e.visitUtf8;break;case R.Binary:r=e.visitBinary;break;case R.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case R.Date:r=e.visitDate;break;case R.DateDay:r=e.visitDateDay||e.visitDate;break;case R.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case R.Timestamp:r=e.visitTimestamp;break;case R.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case R.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case R.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case R.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case R.Time:r=e.visitTime;break;case R.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case R.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case R.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case R.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case R.Decimal:r=e.visitDecimal;break;case R.List:r=e.visitList;break;case R.Struct:r=e.visitStruct;break;case R.Union:r=e.visitUnion;break;case R.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case R.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case R.Dictionary:r=e.visitDictionary;break;case R.Interval:r=e.visitInterval;break;case R.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case R.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case R.Duration:r=e.visitDuration;break;case R.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case R.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case R.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case R.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case R.FixedSizeList:r=e.visitFixedSizeList;break;case R.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${R[t]}'`)}function AF(e){switch(e.typeId){case R.Null:return R.Null;case R.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?R.Int8:R.Uint8;case 16:return n?R.Int16:R.Uint16;case 32:return n?R.Int32:R.Uint32;case 64:return n?R.Int64:R.Uint64}return R.Int}case R.Float:switch(e.precision){case Ie.HALF:return R.Float16;case Ie.SINGLE:return R.Float32;case Ie.DOUBLE:return R.Float64}return R.Float;case R.Binary:return R.Binary;case R.Utf8:return R.Utf8;case R.Bool:return R.Bool;case R.Decimal:return R.Decimal;case R.Time:switch(e.unit){case yt.SECOND:return R.TimeSecond;case yt.MILLISECOND:return R.TimeMillisecond;case yt.MICROSECOND:return R.TimeMicrosecond;case yt.NANOSECOND:return R.TimeNanosecond}return R.Time;case R.Timestamp:switch(e.unit){case yt.SECOND:return R.TimestampSecond;case yt.MILLISECOND:return R.TimestampMillisecond;case yt.MICROSECOND:return R.TimestampMicrosecond;case yt.NANOSECOND:return R.TimestampNanosecond}return R.Timestamp;case R.Date:switch(e.unit){case En.DAY:return R.DateDay;case En.MILLISECOND:return R.DateMillisecond}return R.Date;case R.Interval:switch(e.unit){case Jn.DAY_TIME:return R.IntervalDayTime;case Jn.YEAR_MONTH:return R.IntervalYearMonth}return R.Interval;case R.Duration:switch(e.unit){case yt.SECOND:return R.DurationSecond;case yt.MILLISECOND:return R.DurationMillisecond;case yt.MICROSECOND:return R.DurationMicrosecond;case yt.NANOSECOND:return R.DurationNanosecond}return R.Duration;case R.Map:return R.Map;case R.List:return R.List;case R.Struct:return R.Struct;case R.Union:switch(e.mode){case we.Dense:return R.DenseUnion;case we.Sparse:return R.SparseUnion}return R.Union;case R.FixedSizeBinary:return R.FixedSizeBinary;case R.FixedSizeList:return R.FixedSizeList;case R.Dictionary:return R.Dictionary}throw new Error(`Unrecognized type '${R[e.typeId]}'`)}dt.prototype.visitInt8=null;dt.prototype.visitInt16=null;dt.prototype.visitInt32=null;dt.prototype.visitInt64=null;dt.prototype.visitUint8=null;dt.prototype.visitUint16=null;dt.prototype.visitUint32=null;dt.prototype.visitUint64=null;dt.prototype.visitFloat16=null;dt.prototype.visitFloat32=null;dt.prototype.visitFloat64=null;dt.prototype.visitDateDay=null;dt.prototype.visitDateMillisecond=null;dt.prototype.visitTimestampSecond=null;dt.prototype.visitTimestampMillisecond=null;dt.prototype.visitTimestampMicrosecond=null;dt.prototype.visitTimestampNanosecond=null;dt.prototype.visitTimeSecond=null;dt.prototype.visitTimeMillisecond=null;dt.prototype.visitTimeMicrosecond=null;dt.prototype.visitTimeNanosecond=null;dt.prototype.visitDenseUnion=null;dt.prototype.visitSparseUnion=null;dt.prototype.visitIntervalDayTime=null;dt.prototype.visitIntervalYearMonth=null;dt.prototype.visitDuration=null;dt.prototype.visitDurationSecond=null;dt.prototype.visitDurationMillisecond=null;dt.prototype.visitDurationMicrosecond=null;dt.prototype.visitDurationNanosecond=null;var HI={};kr(HI,{float64ToUint16:()=>Hh,uint16ToFloat64:()=>Cx});var MF=new Float64Array(1),uf=new Uint32Array(MF.buffer);function Cx(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Hh(e){if(e!==e)return 32256;MF[0]=e;let t=(uf[1]&2147483648)>>16&65535,n=uf[1]&2146435072,r=0;return n>=1089470464?uf[0]>0?n=31744:(n=(n&2080374784)>>16,r=(uf[1]&1048575)>>10):n<=1056964608?(r=1048576+(uf[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(uf[1]&1048575)+512>>10),t|n|r&65535}var St=class extends dt{};function Ot(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var DG=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},QI=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},RG=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},LG=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},OF=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},FG=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Cs=({values:e},t,n)=>{e[t]=n},ZI=({values:e},t,n)=>{e[t]=n},NF=({values:e},t,n)=>{e[t]=Hh(n)},kG=(e,t,n)=>{switch(e.type.precision){case Ie.HALF:return NF(e,t,n);case Ie.SINGLE:case Ie.DOUBLE:return ZI(e,t,n)}},Bx=({values:e},t,n)=>{DG(e,t,n.valueOf())},Px=({values:e},t,n)=>{QI(e,t*2,n.valueOf())},KI=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},CG=({values:e,valueOffsets:t},n,r)=>OF(e,t,n,r),BG=({values:e,valueOffsets:t},n,r)=>{OF(e,t,n,Wa(r))},JI=(e,t,n)=>{e.type.unit===En.DAY?Bx(e,t,n):Px(e,t,n)},$x=({values:e},t,n)=>QI(e,t*2,n/1e3),Ux=({values:e},t,n)=>QI(e,t*2,n),zx=({values:e},t,n)=>RG(e,t*2,n),jx=({values:e},t,n)=>LG(e,t*2,n),tT=(e,t,n)=>{switch(e.type.unit){case yt.SECOND:return $x(e,t,n);case yt.MILLISECOND:return Ux(e,t,n);case yt.MICROSECOND:return zx(e,t,n);case yt.NANOSECOND:return jx(e,t,n)}},Vx=({values:e},t,n)=>{e[t]=n},qx=({values:e},t,n)=>{e[t]=n},Yx=({values:e},t,n)=>{e[t]=n},Gx=({values:e},t,n)=>{e[t]=n},eT=(e,t,n)=>{switch(e.type.unit){case yt.SECOND:return Vx(e,t,n);case yt.MILLISECOND:return qx(e,t,n);case yt.MICROSECOND:return Yx(e,t,n);case yt.NANOSECOND:return Gx(e,t,n)}},nT=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},PG=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=An.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n.get(++s))},$G=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=An.getVisitFn(r),{[t]:s,[t+1]:a}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let l of c)if(o(r,s,l),++s>=a)break},UG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),zG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),jG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),VG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),qG=(e,t,n)=>{let r=e.type.children.map(o=>An.getVisitFn(o.type)),i=n instanceof Map?jG(t,n):n instanceof Gt?zG(t,n):Array.isArray(n)?UG(t,n):VG(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},YG=(e,t,n)=>{e.type.mode===we.Dense?DF(e,t,n):RF(e,t,n)},DF=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];An.visit(i,e.valueOffsets[t],n)},RF=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];An.visit(i,t,n)},GG=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},rT=(e,t,n)=>{e.type.unit===Jn.DAY_TIME?Wx(e,t,n):Xx(e,t,n)},Wx=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Xx=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Hx=({values:e},t,n)=>{e[t]=n},Qx=({values:e},t,n)=>{e[t]=n},Zx=({values:e},t,n)=>{e[t]=n},Kx=({values:e},t,n)=>{e[t]=n},iT=(e,t,n)=>{switch(e.type.unit){case yt.SECOND:return Hx(e,t,n);case yt.MILLISECOND:return Qx(e,t,n);case yt.MICROSECOND:return Zx(e,t,n);case yt.NANOSECOND:return Kx(e,t,n)}},WG=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=An.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s<r;)o(i,a+s,n[s]);else for(let s=-1,a=t*r;++s<r;)o(i,a+s,n.get(s))};St.prototype.visitBool=Ot(FG);St.prototype.visitInt=Ot(Cs);St.prototype.visitInt8=Ot(Cs);St.prototype.visitInt16=Ot(Cs);St.prototype.visitInt32=Ot(Cs);St.prototype.visitInt64=Ot(Cs);St.prototype.visitUint8=Ot(Cs);St.prototype.visitUint16=Ot(Cs);St.prototype.visitUint32=Ot(Cs);St.prototype.visitUint64=Ot(Cs);St.prototype.visitFloat=Ot(kG);St.prototype.visitFloat16=Ot(NF);St.prototype.visitFloat32=Ot(ZI);St.prototype.visitFloat64=Ot(ZI);St.prototype.visitUtf8=Ot(BG);St.prototype.visitBinary=Ot(CG);St.prototype.visitFixedSizeBinary=Ot(KI);St.prototype.visitDate=Ot(JI);St.prototype.visitDateDay=Ot(Bx);St.prototype.visitDateMillisecond=Ot(Px);St.prototype.visitTimestamp=Ot(tT);St.prototype.visitTimestampSecond=Ot($x);St.prototype.visitTimestampMillisecond=Ot(Ux);St.prototype.visitTimestampMicrosecond=Ot(zx);St.prototype.visitTimestampNanosecond=Ot(jx);St.prototype.visitTime=Ot(eT);St.prototype.visitTimeSecond=Ot(Vx);St.prototype.visitTimeMillisecond=Ot(qx);St.prototype.visitTimeMicrosecond=Ot(Yx);St.prototype.visitTimeNanosecond=Ot(Gx);St.prototype.visitDecimal=Ot(nT);St.prototype.visitList=Ot(PG);St.prototype.visitStruct=Ot(qG);St.prototype.visitUnion=Ot(YG);St.prototype.visitDenseUnion=Ot(DF);St.prototype.visitSparseUnion=Ot(RF);St.prototype.visitDictionary=Ot(GG);St.prototype.visitInterval=Ot(rT);St.prototype.visitIntervalDayTime=Ot(Wx);St.prototype.visitIntervalYearMonth=Ot(Xx);St.prototype.visitDuration=Ot(iT);St.prototype.visitDurationSecond=Ot(Hx);St.prototype.visitDurationMillisecond=Ot(Qx);St.prototype.visitDurationMicrosecond=Ot(Zx);St.prototype.visitDurationNanosecond=Ot(Kx);St.prototype.visitFixedSizeList=Ot(WG);St.prototype.visitMap=Ot($G);var An=new St;var Xi=Symbol.for("parent"),ff=Symbol.for("rowIndex"),Xa=class{constructor(t,n){return this[Xi]=t,this[ff]=n,new Proxy(this,new sT)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ff],n=this[Xi],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=Xe.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${zi(t)}: ${zi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new oT(this[Xi],this[ff])}},oT=class{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Xe.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Xa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Xi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ff]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var sT=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Xi].type.children.map(n=>n.name)}has(t,n){return t[Xi].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Xi].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Xi].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=Xe.visit(t[Xi].children[r],t[ff]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Xi].type.children.findIndex(o=>o.name===n);return i!==-1?(An.visit(t[Xi].children[i],t[ff],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var bt=class extends dt{};function At(e){return(t,n)=>t.getValid(n)?e(t,n):null}var XG=(e,t)=>864e5*e[t],aT=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),HG=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,QG=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,LF=e=>new Date(e),ZG=(e,t)=>LF(XG(e,t)),KG=(e,t)=>LF(aT(e,t)),JG=(e,t)=>null,FF=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},tW=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},kF=({values:e},t)=>ZG(e,t),CF=({values:e},t)=>KG(e,t*2),Ha=({stride:e,values:t},n)=>t[e*n],eW=({stride:e,values:t},n)=>Cx(t[e*n]),BF=({values:e},t)=>e[t],nW=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),rW=({values:e,valueOffsets:t},n)=>FF(e,t,n),iW=({values:e,valueOffsets:t},n)=>{let r=FF(e,t,n);return r!==null?Yh(r):null},oW=({values:e},t)=>e[t],sW=({type:e,values:t},n)=>e.precision!==Ie.HALF?t[n]:Cx(t[n]),aW=(e,t)=>e.type.unit===En.DAY?kF(e,t):CF(e,t),PF=({values:e},t)=>1e3*aT(e,t*2),$F=({values:e},t)=>aT(e,t*2),UF=({values:e},t)=>HG(e,t*2),zF=({values:e},t)=>QG(e,t*2),cW=(e,t)=>{switch(e.type.unit){case yt.SECOND:return PF(e,t);case yt.MILLISECOND:return $F(e,t);case yt.MICROSECOND:return UF(e,t);case yt.NANOSECOND:return zF(e,t)}},jF=({values:e},t)=>e[t],VF=({values:e},t)=>e[t],qF=({values:e},t)=>e[t],YF=({values:e},t)=>e[t],lW=(e,t)=>{switch(e.type.unit){case yt.SECOND:return jF(e,t);case yt.MILLISECOND:return VF(e,t);case yt.MICROSECOND:return qF(e,t);case yt.NANOSECOND:return YF(e,t)}},uW=({values:e,stride:t},n)=>Xh.decimal(e.subarray(t*n,t*(n+1))),fW=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,c=i[0].slice(o,s-o);return new Gt([c])},dW=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new vo(s.slice(i,o-i))},hW=(e,t)=>new Xa(e,t),pW=(e,t)=>e.type.mode===we.Dense?GF(e,t):WF(e,t),GF=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Xe.visit(r,e.valueOffsets[t])},WF=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Xe.visit(r,t)},mW=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},yW=(e,t)=>e.type.unit===Jn.DAY_TIME?XF(e,t):HF(e,t),XF=({values:e},t)=>e.subarray(2*t,2*(t+1)),HF=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},QF=({values:e},t)=>e[t],ZF=({values:e},t)=>e[t],KF=({values:e},t)=>e[t],JF=({values:e},t)=>e[t],gW=(e,t)=>{switch(e.type.unit){case yt.SECOND:return QF(e,t);case yt.MILLISECOND:return ZF(e,t);case yt.MICROSECOND:return KF(e,t);case yt.NANOSECOND:return JF(e,t)}},xW=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Gt([o])};bt.prototype.visitNull=At(JG);bt.prototype.visitBool=At(tW);bt.prototype.visitInt=At(oW);bt.prototype.visitInt8=At(Ha);bt.prototype.visitInt16=At(Ha);bt.prototype.visitInt32=At(Ha);bt.prototype.visitInt64=At(BF);bt.prototype.visitUint8=At(Ha);bt.prototype.visitUint16=At(Ha);bt.prototype.visitUint32=At(Ha);bt.prototype.visitUint64=At(BF);bt.prototype.visitFloat=At(sW);bt.prototype.visitFloat16=At(eW);bt.prototype.visitFloat32=At(Ha);bt.prototype.visitFloat64=At(Ha);bt.prototype.visitUtf8=At(iW);bt.prototype.visitBinary=At(rW);bt.prototype.visitFixedSizeBinary=At(nW);bt.prototype.visitDate=At(aW);bt.prototype.visitDateDay=At(kF);bt.prototype.visitDateMillisecond=At(CF);bt.prototype.visitTimestamp=At(cW);bt.prototype.visitTimestampSecond=At(PF);bt.prototype.visitTimestampMillisecond=At($F);bt.prototype.visitTimestampMicrosecond=At(UF);bt.prototype.visitTimestampNanosecond=At(zF);bt.prototype.visitTime=At(lW);bt.prototype.visitTimeSecond=At(jF);bt.prototype.visitTimeMillisecond=At(VF);bt.prototype.visitTimeMicrosecond=At(qF);bt.prototype.visitTimeNanosecond=At(YF);bt.prototype.visitDecimal=At(uW);bt.prototype.visitList=At(fW);bt.prototype.visitStruct=At(hW);bt.prototype.visitUnion=At(pW);bt.prototype.visitDenseUnion=At(GF);bt.prototype.visitSparseUnion=At(WF);bt.prototype.visitDictionary=At(mW);bt.prototype.visitInterval=At(yW);bt.prototype.visitIntervalDayTime=At(XF);bt.prototype.visitIntervalYearMonth=At(HF);bt.prototype.visitDuration=At(gW);bt.prototype.visitDurationSecond=At(QF);bt.prototype.visitDurationMillisecond=At(ZF);bt.prototype.visitDurationMicrosecond=At(KF);bt.prototype.visitDurationNanosecond=At(JF);bt.prototype.visitFixedSizeList=At(xW);bt.prototype.visitMap=At(dW);var Xe=new bt;var mi=Symbol.for("keys"),df=Symbol.for("vals"),vo=class{constructor(t){return this[mi]=new Gt([t.children[0]]).memoize(),this[df]=t.children[1],new Proxy(this,new lT)}[Symbol.iterator](){return new cT(this[mi],this[df])}get size(){return this[mi].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[mi],n=this[df],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=Xe.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${zi(t)}: ${zi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},cT=class{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Xe.visit(this.vals,t)]})}},lT=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[mi].toArray().map(String)}has(t,n){return t[mi].includes(n)}getOwnPropertyDescriptor(t,n){if(t[mi].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[mi].indexOf(n);if(r!==-1){let i=Xe.visit(Reflect.get(t,df),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[mi].indexOf(n);return i!==-1?(An.visit(Reflect.get(t,df),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(vo.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[mi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[df]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function bW(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var tk;function Qh(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(tk=o,o=s,s=tk),s>i&&(s=i),r?r(e,o,s):[o,s]}var ek=e=>e!==e;function Qa(e){if(typeof e!=="object"||e===null)return ek(e)?ek:n=>n===e;if(e instanceof Date){let n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?jI(e,n):!1:e instanceof Map?_W(e):Array.isArray(e)?wW(e):e instanceof Gt?vW(e):SW(e,!0)}function wW(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Qa(e[n]);return Jx(t)}function _W(e){let t=-1,n=[];for(let r of e.values())n[++t]=Qa(r);return Jx(n)}function vW(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Qa(e.get(n));return Jx(t)}function SW(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let i=-1,o=n.length;++i<o;)r[i]=Qa(e[n[i]]);return Jx(r,n)}function Jx(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return IW(e,n);case Map:return nk(e,n,n.keys());case vo:case Xa:case Object:case void 0:return nk(e,n,t||Object.keys(n))}return n instanceof Gt?TW(e,n):!1}}function IW(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function TW(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function nk(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=r.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=r.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}var fT={};kr(fT,{BitIterator:()=>_l,getBit:()=>rk,getBool:()=>eb,packBools:()=>Sl,popcnt_array:()=>ik,popcnt_bit_range:()=>Zh,popcnt_uint32:()=>tb,setBool:()=>EW,truncateBitmap:()=>vl});function eb(e,t,n,r){return(n&1<<r)!==0}function rk(e,t,n,r){return(n&1<<r)>>r}function EW(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function vl(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):Sl(new _l(n,e,t,null,eb)).subarray(0,r)),i}return n}function Sl(e){let t=[],n=0,r=0,i=0;for(let s of e)s&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var _l=class{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Zh(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new _l(e,t,n-t,e,rk))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Zh(e,t,i)+Zh(e,r,n)+ik(e,i>>3,r-i>>3)}function ik(e,t,n){let r=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=n===void 0?e.byteLength:i+n;for(;s-i>=4;)r+=tb(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=tb(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=tb(o.getUint8(i)),i+=1;return r}function tb(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var AW=-1,le=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return lt.isSparseUnion(t)?this.children.some(n=>n.nullable):lt.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:n,values:r,nullBitmap:i,typeIds:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(lt.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=AW&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Zh(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Vr(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:n}=this;if(lt.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===we.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r,{type:i}=this;if(lt.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===we.Dense?this.valueOffsets[t]:t;r=s.getValid(a),s.setValid(a,n)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(vl(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];r=(f&l)!==0,n?o[u]=f|l:o[u]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,n,r,i,o,s,this.dictionary)}slice(t,n){let{stride:r,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?r:1,c=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===R.Null)return this.clone(this.type,0,t,0);let{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(vl(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[pi.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),o)}_sliceBuffers(t,n,r,i){let o,{buffers:s}=this;return(o=s[pi.TYPE])&&(s[pi.TYPE]=o.subarray(t,t+n)),(o=s[pi.OFFSET])&&(s[pi.OFFSET]=o.subarray(t,t+n+1))||(o=s[pi.DATA])&&(s[pi.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};le.prototype.children=Object.freeze([]);var dT=class e extends dt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new le(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.data),o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.data),o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Lt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ut(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(lt.isSparseUnion(n))return new le(n,r,s,a,[void 0,void 0,void 0,o],i);let c=wl(t.valueOffsets);return new le(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.indices.ArrayType,t.data),{["dictionary"]:s=new Gt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.valueType})}=t,o=Lt(t.nullBitmap),{["length"]:s=i.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.childType})}=t,o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,void 0,o],[i])}},MW=new dT;function Ft(e){return MW.visit(e)}var Kh=class{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function nb(e){return e.reduce((t,n)=>t+n.nullCount,0)}function rb(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function ib(e,t,n,r){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=r)break;if(n>=c+l)continue;if(c>=n&&c+l<=r){i.push(a);continue}let u=Math.max(0,n-c),f=Math.min(r-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function hT(e,t,n,r){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return n<t[s]?r(e,i,n-t[i]):null;o=i+Math.trunc((s-i)*.5),n<t[o]?s=o:i=o}while(i<s)}function Jh(e,t){return e.getValid(t)}function Za(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return hT(r,this._offsets,n,t)}}function ob(e){let t;function n(r,i,o){return e(r[i],o,t)}return function(r,i){let o=this.data;t=i;let s=hT(o,this._offsets,r,n);return t=void 0,s}}function sb(e){let t;function n(r,i,o){let s=o,a=0,c=0;for(let l=i-1,u=r.length;++l<u;){let f=r[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(r,i){t=r;let o=this.data,s=typeof i!="number"?n(o,0,0):hT(o,this._offsets,i,n);return t=void 0,s}}var wt=class extends dt{};function OW(e,t){return t===null&&e.length>0?0:-1}function NW(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new _l(n,e.offset+(t||0),e.length,n,eb)){if(!i)return r;++r}return-1}function kt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case R.Union:break;case R.Dictionary:break;default:return NW(e,n)}let r=Xe.getVisitFn(e),i=Qa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function ok(e,t,n){let r=Xe.getVisitFn(e),i=Qa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}wt.prototype.visitNull=OW;wt.prototype.visitBool=kt;wt.prototype.visitInt=kt;wt.prototype.visitInt8=kt;wt.prototype.visitInt16=kt;wt.prototype.visitInt32=kt;wt.prototype.visitInt64=kt;wt.prototype.visitUint8=kt;wt.prototype.visitUint16=kt;wt.prototype.visitUint32=kt;wt.prototype.visitUint64=kt;wt.prototype.visitFloat=kt;wt.prototype.visitFloat16=kt;wt.prototype.visitFloat32=kt;wt.prototype.visitFloat64=kt;wt.prototype.visitUtf8=kt;wt.prototype.visitBinary=kt;wt.prototype.visitFixedSizeBinary=kt;wt.prototype.visitDate=kt;wt.prototype.visitDateDay=kt;wt.prototype.visitDateMillisecond=kt;wt.prototype.visitTimestamp=kt;wt.prototype.visitTimestampSecond=kt;wt.prototype.visitTimestampMillisecond=kt;wt.prototype.visitTimestampMicrosecond=kt;wt.prototype.visitTimestampNanosecond=kt;wt.prototype.visitTime=kt;wt.prototype.visitTimeSecond=kt;wt.prototype.visitTimeMillisecond=kt;wt.prototype.visitTimeMicrosecond=kt;wt.prototype.visitTimeNanosecond=kt;wt.prototype.visitDecimal=kt;wt.prototype.visitList=kt;wt.prototype.visitStruct=kt;wt.prototype.visitUnion=kt;wt.prototype.visitDenseUnion=ok;wt.prototype.visitSparseUnion=ok;wt.prototype.visitDictionary=kt;wt.prototype.visitInterval=kt;wt.prototype.visitIntervalDayTime=kt;wt.prototype.visitIntervalYearMonth=kt;wt.prototype.visitDuration=kt;wt.prototype.visitDurationSecond=kt;wt.prototype.visitDurationMillisecond=kt;wt.prototype.visitDurationMicrosecond=kt;wt.prototype.visitDurationNanosecond=kt;wt.prototype.visitFixedSizeList=kt;wt.prototype.visitMap=kt;var Il=new wt;var _t=class extends dt{};function Mt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===R.Timestamp||t instanceof Ve&&t.bitWidth!==64||t instanceof Vi&&t.bitWidth!==64||t instanceof Tr&&t.precision!==Ie.HALF))return new Kh(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Kh(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new pT(s)})}var pT=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};_t.prototype.visitNull=Mt;_t.prototype.visitBool=Mt;_t.prototype.visitInt=Mt;_t.prototype.visitInt8=Mt;_t.prototype.visitInt16=Mt;_t.prototype.visitInt32=Mt;_t.prototype.visitInt64=Mt;_t.prototype.visitUint8=Mt;_t.prototype.visitUint16=Mt;_t.prototype.visitUint32=Mt;_t.prototype.visitUint64=Mt;_t.prototype.visitFloat=Mt;_t.prototype.visitFloat16=Mt;_t.prototype.visitFloat32=Mt;_t.prototype.visitFloat64=Mt;_t.prototype.visitUtf8=Mt;_t.prototype.visitBinary=Mt;_t.prototype.visitFixedSizeBinary=Mt;_t.prototype.visitDate=Mt;_t.prototype.visitDateDay=Mt;_t.prototype.visitDateMillisecond=Mt;_t.prototype.visitTimestamp=Mt;_t.prototype.visitTimestampSecond=Mt;_t.prototype.visitTimestampMillisecond=Mt;_t.prototype.visitTimestampMicrosecond=Mt;_t.prototype.visitTimestampNanosecond=Mt;_t.prototype.visitTime=Mt;_t.prototype.visitTimeSecond=Mt;_t.prototype.visitTimeMillisecond=Mt;_t.prototype.visitTimeMicrosecond=Mt;_t.prototype.visitTimeNanosecond=Mt;_t.prototype.visitDecimal=Mt;_t.prototype.visitList=Mt;_t.prototype.visitStruct=Mt;_t.prototype.visitUnion=Mt;_t.prototype.visitDenseUnion=Mt;_t.prototype.visitSparseUnion=Mt;_t.prototype.visitDictionary=Mt;_t.prototype.visitInterval=Mt;_t.prototype.visitIntervalDayTime=Mt;_t.prototype.visitIntervalYearMonth=Mt;_t.prototype.visitDuration=Mt;_t.prototype.visitDurationSecond=Mt;_t.prototype.visitDurationMillisecond=Mt;_t.prototype.visitDurationMicrosecond=Mt;_t.prototype.visitDurationNanosecond=Mt;_t.prototype.visitFixedSizeList=Mt;_t.prototype.visitMap=Mt;var hf=new _t;var DW=(e,t)=>e+t,So=class extends dt{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===yt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+qr.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+qr.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}},RW=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),LW=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),FW=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=qr.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},kW=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=qr.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},CW=(e,t)=>e.type.mode===we.Dense?sk(e,t):ak(e,t),sk=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+qr.visit(t[o],r[i])},ak=({children:e},t)=>4+qr.visitMany(e,e.map(()=>t)).reduce(DW,0);So.prototype.visitUtf8=RW;So.prototype.visitBinary=LW;So.prototype.visitList=FW;So.prototype.visitFixedSizeList=kW;So.prototype.visitUnion=CW;So.prototype.visitDenseUnion=sk;So.prototype.visitSparseUnion=ak;var qr=new So;var ck,lk={},uk={},Gt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof le)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=lk[s.typeId],f=o[0];this.isValid=d=>Jh(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,uk[s.typeId]),this._offsets=rb(o);break}this.data=o,this.type=s,this.stride=Vr(s),this.numChildren=(i=(r=s.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return nb(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${R[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return hf.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new e(Qh(this,t,n,({data:r,_offsets:i},o,s)=>ib(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case R.Int:case R.Float:case R.Decimal:case R.Time:case R.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return lt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(lt.isDictionary(this.type)){let t=new ab(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new ab(this)}unmemoize(){if(lt.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};ck=Symbol.toStringTag;Gt[ck]=(e=>{e.type=lt.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(R).map(n=>R[n]).filter(n=>typeof n=="number"&&n!==R.NONE);for(let n of t){let r=Xe.getVisitFnByTypeId(n),i=An.getVisitFnByTypeId(n),o=Il.getVisitFnByTypeId(n),s=qr.getVisitFnByTypeId(n);lk[n]={get:r,set:i,indexOf:o,byteLength:s},uk[n]=Object.create(e,{isValid:{value:Za(Jh)},get:{value:Za(Xe.getVisitFnByTypeId(n))},set:{value:ob(An.getVisitFnByTypeId(n))},indexOf:{value:sb(Il.getVisitFnByTypeId(n))},getByteLength:{value:Za(qr.getVisitFnByTypeId(n))}})}return"Vector"})(Gt.prototype);var ab=class e extends Gt{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=n.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Gt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function fk(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
3
+ switch (x) {${n.map(r=>`
4
+ case ${BW(r)}:`).join("")}
4
5
  return false;
5
- }`),e.length!==r.length&&(t=`if (x !== x) return false;
6
+ }`),e.length!==n.length&&(t=`if (x !== x) return false;
6
7
  ${t}`),new Function("x",`${t}
7
- return true;`)}function TZ(e){return typeof e!="bigint"?jo(e):`${jo(e)}n`}function JA(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function s5(e,t=0){return e.length>=t?e.subarray(0,t):Rm(new e.constructor(t),e,0)}var Go=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?JA(n*1,this.BYTES_PER_ELEMENT):JA(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=JA(t*this.stride,this.BYTES_PER_ELEMENT);let r=s5(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=s5(this.buffer,t)}},Ga=class extends Go{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},Kd=class extends Ga{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Qd=class extends Ga{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Xe=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ni(t),this._nulls=new Kd,r&&r.length>0&&(this._isValid=o5(r))}toVector(){return new ue([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(n=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Vt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Xe.prototype.length=1;Xe.prototype.stride=1;Xe.prototype.children=null;Xe.prototype.finished=!1;Xe.prototype.nullValues=null;Xe.prototype._isValid=()=>!0;var Dr=class extends Xe{constructor(t){super(t),this._values=new Ga(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},di=class extends Xe{constructor(t){super(t),this._pendingLength=0,this._offsets=new Qd(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof js?r[co].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var Ku=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}};var Fi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):De.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ui).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Ku).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new Ku).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Vr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,De.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var Te=class e{constructor(t=[],r,n,i=De.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=tM(t)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=J_(J_(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:J_(J_(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=tM(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};Te.prototype.fields=null;Te.prototype.metadata=null;Te.prototype.dictionaries=null;var ie=class e{static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};ie.prototype.type=null;ie.prototype.name=null;ie.prototype.nullable=null;ie.prototype.metadata=null;function J_(e,t){return new Map([...e||new Map,...t||new Map])}function tM(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(J.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&&tM(o.children,t)}return t}var AZ=Po,MZ=Mr,Xa=class{static decode(t){t=new MZ(Et(t));let r=Fi.getRootAsFooter(t),n=Te.decode(r.schema(),new Map,r.version());return new eM(n,r)}static encode(t){let r=new AZ,n=Te.encode(r,t.schema);Fi.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Ha.encode(r,s);let i=r.endVector();Fi.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Ha.encode(r,s);let o=r.endVector();return Fi.startFooter(r),Fi.addSchema(r,n),Fi.addVersion(r,De.V5),Fi.addRecordBatches(r,i),Fi.addDictionaries(r,o),Fi.finishFooterBuffer(r,Fi.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=De.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var eM=class extends Xa{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Ha.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Ha.decode(r)}return null}},Ha=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return Ku.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=or(n),this.bodyLength=or(r)}};var je=Object.freeze({done:!0,value:void 0}),uy=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Qu=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},t1=class extends Qu{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return P(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(je);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return cn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return cn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return P(this,void 0,void 0,function*(){return yield this.abort(t),je})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),je})}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(je)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var qs=class extends t1{write(t){if((t=Et(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Nm(this.toUint8Array(!0)):this.toUint8Array(!1).then(Nm)}toUint8Array(t=!1){return t?Bi(this._values)[0]:P(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=fr(this),u;u=yield l.next(),r=u.done,!r;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return Bi(s,a)[0]})}},Ys=class{constructor(t){t&&(this.source=new rM(cn.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)}},lo=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof qs?this.source=new Za(cn.fromAsyncIterable(t)):x_(t)?this.source=new Za(cn.fromNodeStream(t)):Fm(t)?this.source=new Za(cn.fromDOMStream(t)):g_(t)?this.source=new Za(cn.fromDOMStream(t.body)):ko(t)?this.source=new Za(cn.fromIterable(t)):Di(t)?this.source=new Za(cn.fromAsyncIterable(t)):eo(t)&&(this.source=new Za(cn.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)}},rM=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||je)}return(t){return Object.create(this.source.return&&this.source.return(t)||je)}},Za=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return P(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,r="read"){return P(this,void 0,void 0,function*(){return yield this.source.next({cmd:r,size:t})})}throw(t){return P(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||je;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return P(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||je;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var fy=class extends Ys{constructor(t,r){super(),this.position=0,this.buffer=Et(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Bl=class extends lo{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=P(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return P(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return P(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 P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return P(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var iM={};Tr(iM,{BaseInt64:()=>dy,Int128:()=>hy,Int64:()=>Ka,Uint64:()=>sr});function Jd(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var th=8,nM=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],dy=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Jd(this.buffer[1])} ${Jd(this.buffer[0])}`}},sr=class e extends dy{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=th<n-o?th:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([nM[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Ka=class e extends dy{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=th<i-s?th:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([nM[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},hy=class e{constructor(t){this.buffer=t}high(){return new Ka(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ka(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new sr(new Uint32Array([this.buffer[3],0])),n=new sr(new Uint32Array([this.buffer[2],0])),i=new sr(new Uint32Array([this.buffer[1],0])),o=new sr(new Uint32Array([this.buffer[0],0])),s=new sr(new Uint32Array([t.buffer[3],0])),a=new sr(new Uint32Array([t.buffer[2],0])),c=new sr(new Uint32Array([t.buffer[1],0])),l=new sr(new Uint32Array([t.buffer[0],0])),u=sr.multiply(o,l);this.buffer[0]=u.low();let f=new sr(new Uint32Array([u.high(),0]));return u=sr.multiply(i,l),f.plus(u),u=sr.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 sr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(sr.multiply(n,l)).plus(sr.multiply(i,c)).plus(sr.multiply(o,a)),this.buffer[3]+=sr.multiply(r,l).plus(sr.multiply(n,c)).plus(sr.multiply(i,a)).plus(sr.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Jd(this.buffer[3])} ${Jd(this.buffer[2])} ${Jd(this.buffer[1])} ${Jd(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=th<i-s?th:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([nM[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}};var py=class extends _t{constructor(t,r,n,i,o=De.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof ie?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Vt({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<De.V5&&this.readNullBitmap(t,n),t.mode===Pe.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}},e1=class extends py{constructor(t,r,n,i,o){super(new Uint8Array(0),r,n,i,o),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Hu(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return ee(Uint8Array,ee(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return ee(Uint8Array,ee(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;return J.isTimestamp(t)?ee(Uint8Array,Ka.convertArray(n[r])):(J.isInt(t)||J.isTime(t))&&t.bitWidth===64||J.isDuration(t)?ee(Uint8Array,Ka.convertArray(n[r])):J.isDate(t)&&t.unit===Ar.MILLISECOND?ee(Uint8Array,Ka.convertArray(n[r])):J.isDecimal(t)?ee(Uint8Array,hy.convertArray(n[r])):J.isBinary(t)||J.isLargeBinary(t)||J.isFixedSizeBinary(t)?EZ(n[r]):J.isBool(t)?Hu(n[r]):J.isUtf8(t)||J.isLargeUtf8(t)?Ms(n[r].join("")):ee(Uint8Array,ee(t.ArrayType,n[r].map(i=>+i)))}};function EZ(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var eh=class extends di{constructor(t){super(t),this._values=new Go(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Et(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var rh=class extends di{constructor(t){super(t),this._values=new Go(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Et(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var r1=class extends Xe{constructor(t){super(t),this._values=new Kd}setValue(t,r){this._values.set(t,+r)}};var Ju=class extends Dr{};Ju.prototype._setValue=CA;var my=class extends Ju{};my.prototype._setValue=E_;var yy=class extends Ju{};yy.prototype._setValue=D_;var gy=class extends Dr{};gy.prototype._setValue=$A;var n1=class extends Xe{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new fi(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=tf({type:this.type.indices,nullValues:r}),this.dictionary=tf({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var by=class extends Dr{};by.prototype._setValue=kA;var i1=class extends Xe{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=r.length;++o<s;)n.set(i+o,r[o])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new so(this.type.listSize,new ie(r,t.type,!0)),n}};var ef=class extends Dr{setValue(t,r){this._values.set(t,r)}},o1=class extends ef{setValue(t,r){super.setValue(t,oy(r))}},s1=class extends ef{},a1=class extends ef{};var rf=class extends Dr{};rf.prototype._setValue=zA;var xy=class extends rf{};xy.prototype._setValue=U_;var _y=class extends rf{};_y.prototype._setValue=P_;var Qa=class extends Dr{};Qa.prototype._setValue=VA;var wy=class extends Qa{};wy.prototype._setValue=$_;var vy=class extends Qa{};vy.prototype._setValue=z_;var Sy=class extends Qa{};Sy.prototype._setValue=V_;var Iy=class extends Qa{};Iy.prototype._setValue=j_;var uo=class extends Dr{setValue(t,r){this._values.set(t,r)}},c1=class extends uo{},l1=class extends uo{},u1=class extends uo{},f1=class extends uo{},d1=class extends uo{},h1=class extends uo{},p1=class extends uo{},m1=class extends uo{};var y1=class extends di{constructor(t){super(t),this._offsets=new Qd(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new io(new ie(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var g1=class extends di{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ao(new ie(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var b1=class extends Xe{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var x1=class extends Xe{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new $e([...this.type.children,new ie(r,t.type,!0)]),n}};var Ja=class extends Dr{};Ja.prototype._setValue=UA;var Ty=class extends Ja{};Ty.prototype._setValue=B_;var Ay=class extends Ja{};Ay.prototype._setValue=O_;var My=class extends Ja{};My.prototype._setValue=N_;var Ey=class extends Ja{};Ey.prototype._setValue=F_;var tc=class extends Dr{};tc.prototype._setValue=PA;var Dy=class extends tc{};Dy.prototype._setValue=R_;var By=class extends tc{};By.prototype._setValue=L_;var Oy=class extends tc{};Oy.prototype._setValue=k_;var Ny=class extends tc{};Ny.prototype._setValue=C_;var nh=class extends Xe{constructor(t){super(t),this._typeIds=new Ga(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new ie(r,t.type)];return this.type=new oo(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},_1=class extends nh{},w1=class extends nh{constructor(t){super(t),this._offsets=new Ga(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r)}};var Fy=class extends di{constructor(t){super(t),this._values=new Go(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Ms(r))}_flushPending(t,r){}};Fy.prototype._flushPending=eh.prototype._flushPending;var Ry=class extends di{constructor(t){super(t),this._values=new Go(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Ms(r))}_flushPending(t,r){}};Ry.prototype._flushPending=rh.prototype._flushPending;var oM=class extends _t{visitNull(){return b1}visitBool(){return r1}visitInt(){return uo}visitInt8(){return c1}visitInt16(){return l1}visitInt32(){return u1}visitInt64(){return f1}visitUint8(){return d1}visitUint16(){return h1}visitUint32(){return p1}visitUint64(){return m1}visitFloat(){return ef}visitFloat16(){return o1}visitFloat32(){return s1}visitFloat64(){return a1}visitUtf8(){return Fy}visitLargeUtf8(){return Ry}visitBinary(){return eh}visitLargeBinary(){return rh}visitFixedSizeBinary(){return by}visitDate(){return Ju}visitDateDay(){return my}visitDateMillisecond(){return yy}visitTimestamp(){return Ja}visitTimestampSecond(){return Ty}visitTimestampMillisecond(){return Ay}visitTimestampMicrosecond(){return My}visitTimestampNanosecond(){return Ey}visitTime(){return tc}visitTimeSecond(){return Dy}visitTimeMillisecond(){return By}visitTimeMicrosecond(){return Oy}visitTimeNanosecond(){return Ny}visitDecimal(){return gy}visitList(){return y1}visitStruct(){return x1}visitUnion(){return nh}visitDenseUnion(){return w1}visitSparseUnion(){return _1}visitDictionary(){return n1}visitInterval(){return rf}visitIntervalDayTime(){return xy}visitIntervalYearMonth(){return _y}visitDuration(){return Qa}visitDurationSecond(){return wy}visitDurationMillisecond(){return vy}visitDurationMicrosecond(){return Sy}visitDurationNanosecond(){return Iy}visitFixedSizeList(){return i1}visitMap(){return g1}},a5=new oM;var It=class extends _t{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function zn(e,t){return t instanceof e.constructor}function nf(e,t){return e===t||zn(e,t)}function ec(e,t){return e===t||zn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function v1(e,t){return e===t||zn(e,t)&&e.precision===t.precision}function DZ(e,t){return e===t||zn(e,t)&&e.byteWidth===t.byteWidth}function sM(e,t){return e===t||zn(e,t)&&e.unit===t.unit}function Ly(e,t){return e===t||zn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ky(e,t){return e===t||zn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function BZ(e,t){return e===t||zn(e,t)&&e.children.length===t.children.length&&Ws.compareManyFields(e.children,t.children)}function OZ(e,t){return e===t||zn(e,t)&&e.children.length===t.children.length&&Ws.compareManyFields(e.children,t.children)}function aM(e,t){return e===t||zn(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Ws.compareManyFields(e.children,t.children)}function NZ(e,t){return e===t||zn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Ws.visit(e.indices,t.indices)&&Ws.visit(e.dictionary,t.dictionary)}function cM(e,t){return e===t||zn(e,t)&&e.unit===t.unit}function Cy(e,t){return e===t||zn(e,t)&&e.unit===t.unit}function FZ(e,t){return e===t||zn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Ws.compareManyFields(e.children,t.children)}function RZ(e,t){return e===t||zn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Ws.compareManyFields(e.children,t.children)}It.prototype.visitNull=nf;It.prototype.visitBool=nf;It.prototype.visitInt=ec;It.prototype.visitInt8=ec;It.prototype.visitInt16=ec;It.prototype.visitInt32=ec;It.prototype.visitInt64=ec;It.prototype.visitUint8=ec;It.prototype.visitUint16=ec;It.prototype.visitUint32=ec;It.prototype.visitUint64=ec;It.prototype.visitFloat=v1;It.prototype.visitFloat16=v1;It.prototype.visitFloat32=v1;It.prototype.visitFloat64=v1;It.prototype.visitUtf8=nf;It.prototype.visitLargeUtf8=nf;It.prototype.visitBinary=nf;It.prototype.visitLargeBinary=nf;It.prototype.visitFixedSizeBinary=DZ;It.prototype.visitDate=sM;It.prototype.visitDateDay=sM;It.prototype.visitDateMillisecond=sM;It.prototype.visitTimestamp=Ly;It.prototype.visitTimestampSecond=Ly;It.prototype.visitTimestampMillisecond=Ly;It.prototype.visitTimestampMicrosecond=Ly;It.prototype.visitTimestampNanosecond=Ly;It.prototype.visitTime=ky;It.prototype.visitTimeSecond=ky;It.prototype.visitTimeMillisecond=ky;It.prototype.visitTimeMicrosecond=ky;It.prototype.visitTimeNanosecond=ky;It.prototype.visitDecimal=nf;It.prototype.visitList=BZ;It.prototype.visitStruct=OZ;It.prototype.visitUnion=aM;It.prototype.visitDenseUnion=aM;It.prototype.visitSparseUnion=aM;It.prototype.visitDictionary=NZ;It.prototype.visitInterval=cM;It.prototype.visitIntervalDayTime=cM;It.prototype.visitIntervalYearMonth=cM;It.prototype.visitDuration=Cy;It.prototype.visitDurationSecond=Cy;It.prototype.visitDurationMillisecond=Cy;It.prototype.visitDurationMicrosecond=Cy;It.prototype.visitDurationNanosecond=Cy;It.prototype.visitFixedSizeList=FZ;It.prototype.visitMap=RZ;var Ws=new It;function of(e,t){return Ws.compareSchemas(e,t)}function c5(e,t){return Ws.compareFields(e,t)}function l5(e,t){return Ws.visit(e,t)}function tf(e){let t=e.type,r=new(a5.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(tf(Object.assign(Object.assign({},l),{type:c})))}}return r}function S1(e,t){return LZ(e,t.map(r=>r.data.concat()))}function LZ(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=kZ(r,s,u,t,i),s>0&&(n[o++]=Vt({type:new $e(r),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(r),n.map(f=>new hr(e,f))]}function kZ(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],u=l?.length;if(u>=t)u===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Vt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var u5,hi=class e{constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new Te([]),this._offsets=[0],this;let i,o;t[0]instanceof Te&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof hr)return[c];if(c instanceof e)return c.batches;if(c instanceof we){if(c.type instanceof $e)return[new hr(new Te(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 ue([c[h]])),f=i??new Te(l.map((h,p)=>new ie(String(h),u[p].type,u[p].nullable))),[,d]=S1(f,u);return d.length===0?[new hr(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new Te([]),!(i instanceof Te))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof hr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!of(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??X_(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=G_(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?Zd.visit(new ue(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
+ return true;`)}function BW(e){return typeof e!="bigint"?zi(e):`${zi(e)}n`}var mT=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,PW=(e,t=0)=>e.length>=t?e.subarray(0,t):of(new e.constructor(t),e,0),Ka=class{constructor(t,n=1){this.buffer=t,this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/n))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,n){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let n=this.stride,r=this.length*n,i=this.buffer.length;r>=i&&this._resize(i===0?mT(r*1,this.BYTES_PER_ELEMENT):mT(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=mT(t*this.stride,this.BYTES_PER_ELEMENT);let n=PW(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=of(new this.ArrayType(t),this.buffer)}};Ka.prototype.offset=0;var Bs=class extends Ka{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,n){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=n,this}},pf=class extends Bs{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,n){let{buffer:r}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=r[i]>>o&1;return n?s===0&&(r[i]|=1<<o,++this.numValid):s===1&&(r[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},mf=class extends Bs{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,n){let r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+n,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var Te=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:n}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=n,this.stride=Vr(t),this._nulls=new pf,n&&n.length>0&&(this._isValid=fk(n))}toVector(){return new Gt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Ft({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Te.prototype.length=1;Te.prototype.stride=1;Te.prototype.children=null;Te.prototype.finished=!1;Te.prototype.nullValues=null;Te.prototype._isValid=()=>!0;var He=class extends Te{constructor(t){super(t),this._values=new Bs(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},Io=class extends Te{constructor(t){super(t),this._pendingLength=0,this._offsets=new mf}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof vo?n[mi].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var Tl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var To=new Int32Array(2),cb=new Float32Array(To.buffer),lb=new Float64Array(To.buffer),yf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var tp;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(tp||(tp={}));var Yr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return To[0]=this.readInt32(t),cb[0]}readFloat64(t){return To[yf?0:1]=this.readInt32(t),To[yf?1:0]=this.readInt32(t+4),lb[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){cb[0]=n,this.writeInt32(t,To[0])}writeFloat64(t,n){lb[0]=n,this.writeInt32(t,To[yf?0:1]),this.writeInt32(t+4,To[yf?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<4;n++)t+=String.fromCharCode(this.readInt8(this.position_+4+n));return t}__offset(t,n){let r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);let r=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+r);return n===tp.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var El=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Yr.allocate(n),this.space=n}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let r=n<<1,i=Yr.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var an=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var Ja;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Ja||(Ja={}));var tc;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(tc||(tc={}));var ep;(function(e){e[e.DenseArray=0]="DenseArray"})(ep||(ep={}));var Qi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}};var Eo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Qi).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):ep.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,ep.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var np=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var rp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var ip;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(ip||(ip={}));var ec=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ip.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,ip.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var Ao=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}};var Zi;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Zi||(Zi={}));var nc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zi.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Zi.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var rc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}};var ic=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}};var op;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(op||(op={}));var oc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):op.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,op.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var sp;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(sp||(sp={}));var sc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):sp.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,sp.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var ap=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var ac=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}};var cp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var lp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var Ps=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zi.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Zi.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}};var $s=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zi.SECOND}timezone(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Zi.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}};var up;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(up||(up={}));var Ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):up.Sparse}typeIds(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,n){t.addFieldInt16(0,n,up.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}};var fp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var ve;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(ve||(ve={}));var Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ve.NONE}type(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new Eo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,16);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,ve.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var Er=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tc.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Un).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,tc.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,o){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Gr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ja.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Er).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Tl).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new Tl).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,Ja.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}};var se=class e{constructor(t=[],n,r,i=Me.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=yT(t)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){let n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(r=>this.fields[r]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=fb(fb(new Map,this.metadata),n.metadata),o=n.fields.filter(a=>{let c=r.findIndex(l=>l.name===a.name);return~c?(r[c]=a.clone({metadata:fb(fb(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=yT(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};se.prototype.fields=null;se.prototype.metadata=null;se.prototype.dictionaries=null;var zt=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};zt.prototype.type=null;zt.prototype.name=null;zt.prototype.nullable=null;zt.prototype.metadata=null;function fb(e,t){return new Map([...e||new Map,...t||new Map])}function yT(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(lt.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&yT(o.children,t)}return t}var $W=El,UW=Yr,Us=class{static decode(t){t=new UW(Lt(t));let n=Gr.getRootAsFooter(t),r=se.decode(n.schema(),new Map,n.version());return new gT(r,n)}static encode(t){let n=new $W,r=se.encode(n,t.schema);Gr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())zs.encode(n,s);let i=n.endVector();Gr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())zs.encode(n,s);let o=n.endVector();return Gr.startFooter(n),Gr.addSchema(n,r),Gr.addVersion(n,Me.V5),Gr.addRecordBatches(n,i),Gr.addDictionaries(n,o),Gr.finishFooterBuffer(n,Gr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Me.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var gT=class extends Us{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let n=this._footer.recordBatches(t);if(n)return zs.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return zs.decode(n)}return null}},zs=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return Tl.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=Ir(r),this.bodyLength=Ir(n)}};var Se=Object.freeze({done:!0,value:void 0}),dp=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Al=class{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},db=class extends Al{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Se);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Tn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Tn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),Se})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),Se})}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(Se)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Mo=class extends db{write(t){if((t=Lt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Yh(this.toUint8Array(!0)):this.toUint8Array(!1).then(Yh)}toUint8Array(t=!1){return t?zr(this._values)[0]:Z(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=Bi(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return zr(s,a)[0]})}},Oo=class{constructor(t){t&&(this.source=new xT(Tn.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},gi=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Mo?this.source=new js(Tn.fromAsyncIterable(t)):Sx(t)?this.source=new js(Tn.fromNodeStream(t)):Gh(t)?this.source=new js(Tn.fromDOMStream(t)):_x(t)?this.source=new js(Tn.fromDOMStream(t.body)):$i(t)?this.source=new js(Tn.fromIterable(t)):Pi(t)?this.source=new js(Tn.fromAsyncIterable(t)):hi(t)&&(this.source=new js(Tn.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},xT=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Se)}return(t){return Object.create(this.source.return&&this.source.return(t)||Se)}},js=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return Z(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return Z(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||Se;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Z(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||Se;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var hp=class extends Oo{constructor(t,n){super(),this.position=0,this.buffer=Lt(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){let{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){let r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},cc=class extends gi{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Z(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Z(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Z(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var wT={};kr(wT,{BaseInt64:()=>pp,Int128:()=>mp,Int64:()=>Vs,Uint64:()=>Le});function gf(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var xf=8,bT=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],pp=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=n[3]*r[3];this.buffer[0]=i&65535;let o=i>>>16;return i=n[2]*r[3],o+=i,i=n[3]*r[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){let n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${gf(this.buffer[1])} ${gf(this.buffer[0])}`}},Le=class e extends pp{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let o=0;o<r;){let s=xf<r-o?xf:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([bT[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Vs=class e extends pp{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=xf<i-s?xf:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([bT[a],0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},mp=class e{constructor(t){this.buffer=t}high(){return new Vs(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Vs(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let n=new Le(new Uint32Array([this.buffer[3],0])),r=new Le(new Uint32Array([this.buffer[2],0])),i=new Le(new Uint32Array([this.buffer[1],0])),o=new Le(new Uint32Array([this.buffer[0],0])),s=new Le(new Uint32Array([t.buffer[3],0])),a=new Le(new Uint32Array([t.buffer[2],0])),c=new Le(new Uint32Array([t.buffer[1],0])),l=new Le(new Uint32Array([t.buffer[0],0])),u=Le.multiply(o,l);this.buffer[0]=u.low();let f=new Le(new Uint32Array([u.high(),0]));return u=Le.multiply(i,l),f.plus(u),u=Le.multiply(o,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Le(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Le.multiply(r,l)).plus(Le.multiply(i,c)).plus(Le.multiply(o,a)),this.buffer[3]+=Le.multiply(n,l).plus(Le.multiply(r,c)).plus(Le.multiply(i,a)).plus(Le.multiply(o,s)).low(),this}plus(t){let n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${gf(this.buffer[3])} ${gf(this.buffer[2])} ${gf(this.buffer[1])} ${gf(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=xf<i-s?xf:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([bT[a],0,0,0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+4*4*r,4));return n}};var yp=class extends dt{constructor(t,n,r,i,o=Me.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof zt?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Ft({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<Me.V5&&this.readNullBitmap(t,r),t.mode===we.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}},hb=class extends yp{constructor(t,n,r,i,o){super(new Uint8Array(0),n,r,i,o),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):Sl(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Ut(Uint8Array,Ut(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Ut(Uint8Array,Ut(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return lt.isTimestamp(t)?Ut(Uint8Array,Vs.convertArray(r[n])):(lt.isInt(t)||lt.isTime(t))&&t.bitWidth===64||lt.isDuration(t)?Ut(Uint8Array,Vs.convertArray(r[n])):lt.isDate(t)&&t.unit===En.MILLISECOND?Ut(Uint8Array,Vs.convertArray(r[n])):lt.isDecimal(t)?Ut(Uint8Array,mp.convertArray(r[n])):lt.isBinary(t)||lt.isFixedSizeBinary(t)?zW(r[n]):lt.isBool(t)?Sl(r[n]):lt.isUtf8(t)?Wa(r[n].join("")):Ut(Uint8Array,Ut(t.ArrayType,r[n].map(i=>+i)))}};function zW(e){let t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}var bf=class extends Io{constructor(t){super(t),this._values=new Ka(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Lt(n))}_flushPending(t,n){let r=this._offsets,i=this._values.reserve(n).buffer,o=0;for(let[s,a]of t)if(a===void 0)r.set(s,0);else{let c=a.length;i.set(a,o),r.set(s,c),o+=c}}};var pb=class extends Te{constructor(t){super(t),this._values=new pf}setValue(t,n){this._values.set(t,+n)}};var Ml=class extends He{};Ml.prototype._setValue=JI;var gp=class extends Ml{};gp.prototype._setValue=Bx;var xp=class extends Ml{};xp.prototype._setValue=Px;var bp=class extends He{};bp.prototype._setValue=nT;var mb=class extends Te{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new jr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ol({type:this.type.indices,nullValues:n}),this.dictionary=Ol({type:this.type.dictionary,nullValues:null}),typeof r=="function"&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,n){let r=this.indices;return n=r.setValid(t,n),this.length=r.length,n}setValue(t,n){let r=this._keysToIndices,i=this.valueToKey(n),o=r[i];return o===void 0&&(r[i]=o=this._dictionaryOffset+this.dictionary.append(n).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,n=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=n?n.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var wp=class extends He{};wp.prototype._setValue=KI;var yb=class extends Te{setValue(t,n){let[r]=this.children,i=t*this.stride;for(let o=-1,s=n.length;++o<s;)r.set(i+o,n[o])}addChild(t,n="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let r=this.children.push(t);return this.type=new Gi(this.type.listSize,new zt(n,t.type,!0)),r}};var Nl=class extends He{setValue(t,n){this._values.set(t,n)}},gb=class extends Nl{setValue(t,n){super.setValue(t,Hh(n))}},xb=class extends Nl{},bb=class extends Nl{};var Dl=class extends He{};Dl.prototype._setValue=rT;var _p=class extends Dl{};_p.prototype._setValue=Wx;var vp=class extends Dl{};vp.prototype._setValue=Xx;var qs=class extends He{};qs.prototype._setValue=iT;var Sp=class extends qs{};Sp.prototype._setValue=Hx;var Ip=class extends qs{};Ip.prototype._setValue=Qx;var Tp=class extends qs{};Tp.prototype._setValue=Zx;var Ep=class extends qs{};Ep.prototype._setValue=Kx;var xi=class extends He{setValue(t,n){this._values.set(t,n)}},wb=class extends xi{},_b=class extends xi{},vb=class extends xi{},Sb=class extends xi{},Ib=class extends xi{},Tb=class extends xi{},Eb=class extends xi{},Ab=class extends xi{};var Mb=class extends Io{constructor(t){super(t),this._offsets=new mf}addChild(t,n="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new qi(new zt(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var Ob=class extends Io{set(t,n){return super.set(t,n)}setValue(t,n){let r=n instanceof Map?n:new Map(Object.entries(n)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=r.size,i.set(t,r)}addChild(t,n=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Wi(new zt(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var Nb=class extends Te{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var Db=class extends Te{setValue(t,n){let{children:r,type:i}=this;switch(Array.isArray(n)||n.constructor){case!0:return i.children.forEach((o,s)=>r[s].set(t,n[s]));case Map:return i.children.forEach((o,s)=>r[s].set(t,n.get(o.name)));default:return i.children.forEach((o,s)=>r[s].set(t,n[o.name]))}}setValid(t,n){return super.setValid(t,n)||this.children.forEach(r=>r.setValid(t,n)),n}addChild(t,n=`${this.numChildren}`){let r=this.children.push(t);return this.type=new _e([...this.type.children,new zt(n,t.type,!0)]),r}};var Ys=class extends He{};Ys.prototype._setValue=tT;var Ap=class extends Ys{};Ap.prototype._setValue=$x;var Mp=class extends Ys{};Mp.prototype._setValue=Ux;var Op=class extends Ys{};Op.prototype._setValue=zx;var Np=class extends Ys{};Np.prototype._setValue=jx;var Gs=class extends He{};Gs.prototype._setValue=eT;var Dp=class extends Gs{};Dp.prototype._setValue=Vx;var Rp=class extends Gs{};Rp.prototype._setValue=qx;var Lp=class extends Gs{};Lp.prototype._setValue=Yx;var Fp=class extends Gs{};Fp.prototype._setValue=Gx;var wf=class extends Te{constructor(t){super(t),this._typeIds=new Bs(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,n){return this.set(this.length,t,n)}set(t,n,r){return r===void 0&&(r=this._valueToChildTypeId(this,n,t)),this.setValue(t,n,r),this}setValue(t,n,r){this._typeIds.set(t,r);let i=this.type.typeIdToChildIndex[r],o=this.children[i];o?.set(t,n)}addChild(t,n=`${this.children.length}`){let r=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new zt(n,t.type)];return this.type=new Yi(o,[...s,r],a),r}_valueToChildTypeId(t,n,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Rb=class extends wf{},Lb=class extends wf{constructor(t){super(t),this._offsets=new Bs(new Int32Array(0))}setValue(t,n,r){let i=this._typeIds.set(t,r).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,n)}};var kp=class extends Io{constructor(t){super(t),this._values=new Ka(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Wa(n))}_flushPending(t,n){}};kp.prototype._flushPending=bf.prototype._flushPending;var _T=class extends dt{visitNull(){return Nb}visitBool(){return pb}visitInt(){return xi}visitInt8(){return wb}visitInt16(){return _b}visitInt32(){return vb}visitInt64(){return Sb}visitUint8(){return Ib}visitUint16(){return Tb}visitUint32(){return Eb}visitUint64(){return Ab}visitFloat(){return Nl}visitFloat16(){return gb}visitFloat32(){return xb}visitFloat64(){return bb}visitUtf8(){return kp}visitBinary(){return bf}visitFixedSizeBinary(){return wp}visitDate(){return Ml}visitDateDay(){return gp}visitDateMillisecond(){return xp}visitTimestamp(){return Ys}visitTimestampSecond(){return Ap}visitTimestampMillisecond(){return Mp}visitTimestampMicrosecond(){return Op}visitTimestampNanosecond(){return Np}visitTime(){return Gs}visitTimeSecond(){return Dp}visitTimeMillisecond(){return Rp}visitTimeMicrosecond(){return Lp}visitTimeNanosecond(){return Fp}visitDecimal(){return bp}visitList(){return Mb}visitStruct(){return Db}visitUnion(){return wf}visitDenseUnion(){return Lb}visitSparseUnion(){return Rb}visitDictionary(){return mb}visitInterval(){return Dl}visitIntervalDayTime(){return _p}visitIntervalYearMonth(){return vp}visitDuration(){return qs}visitDurationSecond(){return Sp}visitDurationMillisecond(){return Ip}visitDurationMicrosecond(){return Tp}visistDurationNanosecond(){return Ep}visitFixedSizeList(){return yb}visitMap(){return Ob}},dk=new _T;var vt=class extends dt{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function er(e,t){return t instanceof e.constructor}function Cp(e,t){return e===t||er(e,t)}function Ws(e,t){return e===t||er(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Fb(e,t){return e===t||er(e,t)&&e.precision===t.precision}function jW(e,t){return e===t||er(e,t)&&e.byteWidth===t.byteWidth}function vT(e,t){return e===t||er(e,t)&&e.unit===t.unit}function Bp(e,t){return e===t||er(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Pp(e,t){return e===t||er(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function VW(e,t){return e===t||er(e,t)&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}function qW(e,t){return e===t||er(e,t)&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}function ST(e,t){return e===t||er(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&No.compareManyFields(e.children,t.children)}function YW(e,t){return e===t||er(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&No.visit(e.indices,t.indices)&&No.visit(e.dictionary,t.dictionary)}function IT(e,t){return e===t||er(e,t)&&e.unit===t.unit}function $p(e,t){return e===t||er(e,t)&&e.unit===t.unit}function GW(e,t){return e===t||er(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}function WW(e,t){return e===t||er(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}vt.prototype.visitNull=Cp;vt.prototype.visitBool=Cp;vt.prototype.visitInt=Ws;vt.prototype.visitInt8=Ws;vt.prototype.visitInt16=Ws;vt.prototype.visitInt32=Ws;vt.prototype.visitInt64=Ws;vt.prototype.visitUint8=Ws;vt.prototype.visitUint16=Ws;vt.prototype.visitUint32=Ws;vt.prototype.visitUint64=Ws;vt.prototype.visitFloat=Fb;vt.prototype.visitFloat16=Fb;vt.prototype.visitFloat32=Fb;vt.prototype.visitFloat64=Fb;vt.prototype.visitUtf8=Cp;vt.prototype.visitBinary=Cp;vt.prototype.visitFixedSizeBinary=jW;vt.prototype.visitDate=vT;vt.prototype.visitDateDay=vT;vt.prototype.visitDateMillisecond=vT;vt.prototype.visitTimestamp=Bp;vt.prototype.visitTimestampSecond=Bp;vt.prototype.visitTimestampMillisecond=Bp;vt.prototype.visitTimestampMicrosecond=Bp;vt.prototype.visitTimestampNanosecond=Bp;vt.prototype.visitTime=Pp;vt.prototype.visitTimeSecond=Pp;vt.prototype.visitTimeMillisecond=Pp;vt.prototype.visitTimeMicrosecond=Pp;vt.prototype.visitTimeNanosecond=Pp;vt.prototype.visitDecimal=Cp;vt.prototype.visitList=VW;vt.prototype.visitStruct=qW;vt.prototype.visitUnion=ST;vt.prototype.visitDenseUnion=ST;vt.prototype.visitSparseUnion=ST;vt.prototype.visitDictionary=YW;vt.prototype.visitInterval=IT;vt.prototype.visitIntervalDayTime=IT;vt.prototype.visitIntervalYearMonth=IT;vt.prototype.visitDuration=$p;vt.prototype.visitDurationSecond=$p;vt.prototype.visitDurationMillisecond=$p;vt.prototype.visitDurationMicrosecond=$p;vt.prototype.visitDurationNanosecond=$p;vt.prototype.visitFixedSizeList=GW;vt.prototype.visitMap=WW;var No=new vt;function Rl(e,t){return No.compareSchemas(e,t)}function hk(e,t){return No.compareFields(e,t)}function pk(e,t){return No.visit(e,t)}function Ol(e){let t=e.type,n=new(dk.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let r=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(r)?(s,a)=>r[a]||i:({name:s})=>r[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);n.children.push(Ol(Object.assign(Object.assign({},l),{type:c})))}}return n}function kb(e,t){return XW(e,t.map(n=>n.data.concat()))}function XW(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=HW(n,s,u,t,i),s>0&&(r[o++]=Ft({type:new _e(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Pe(e,f))]}function HW(e,t,n,r,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=r.length;++a<c;){let l=n[a],u=l?.length;if(u>=t)u===t?n[a]=l:(n[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Ft({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var mk,nr=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new se([]),this._offsets=[0],this;let i,o;t[0]instanceof se&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Pe)return[c];if(c instanceof e)return c.batches;if(c instanceof le){if(c.type instanceof _e)return[new Pe(new se(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new Gt([c[h]])),f=new se(l.map((h,p)=>new zt(String(h),u[p].type))),[,d]=kb(f,u);return d.length===0?[new Pe(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new se([]),!(i instanceof se))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Pe))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Rl(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??rb(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=nb(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?hf.visit(new Gt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
9
  ${this.toArray().join(`,
9
10
  `)}
10
- ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new hr(r,i)))}slice(t,r){let n=this.schema;[t,r]=sy({length:this.numRows},t,r);let i=H_(this.data,this._offsets,t,r);return new e(n,i.map(o=>new hr(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Vt({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new ue(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new ue([Vt({type:new Mn,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=S1(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=r.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...S1(o,s))}};u5=Symbol.toStringTag;hi[u5]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Hd(ly),e.get=Hd(Er.getVisitFn(R.Struct)),e.set=Z_(ln.getVisitFn(R.Struct)),e.indexOf=K_(Zu.getVisitFn(R.Struct)),"Table"))(hi.prototype);var d5,hr=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Te))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Vt({nullCount:0,type:new $e(this.schema.fields),children:this.schema.fields.map(r=>Vt({type:r.type,nullCount:0}))})]=t,!(this.data instanceof we))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=f5(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,u)=>(c.children[u]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[u]=ie.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new Te(n),a=Vt({type:new $e(n),length:o,children:i,nullCount:0});[this.schema,this.data]=f5(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=h5(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 Er.visit(this.data,t)}set(t,r){return ln.visit(this.data,t,r)}indexOf(t,r){return Zu.visit(this.data,t,r)}[Symbol.iterator](){return Zd.visit(new ue([this.data]))}toArray(){return[...this]}concat(...t){return new hi(this.schema,[this,...t])}slice(t,r){let[n]=new ue([this.data]).slice(t,r).data;return new e(this.schema,n)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new ue([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new ue([Vt({type:new Mn,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new Te(o,new Map(this.schema.metadata)),i=Vt({type:new $e(o),children:s})}return new e(n,i)}select(t){let r=this.schema.select(t),n=new $e(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Vt({type:n,length:this.numRows,children:i}))}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Vt({type:new $e(r.fields),length:this.numRows,children:n});return new e(r,i)}};d5=Symbol.toStringTag;hr[d5]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(hr.prototype);function f5(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Vt({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Vt({type:new $e(i),length:r,children:o})]}function h5(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])h5(a.children,l?.children,r);if(J.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var sf=class extends hr{constructor(t){let r=t.fields.map(i=>Vt({type:i.type})),n=Vt({type:new $e(t.fields),nullCount:0,children:r});super(t,n)}};var Xo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):De.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):se.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Vr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,De.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,se.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var lM=class extends _t{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return qm.startNull(r),qm.endNull(r)}visitInt(t,r){return $o.startInt(r),$o.addBitWidth(r,t.bitWidth),$o.addIsSigned(r,t.isSigned),$o.endInt(r)}visitFloat(t,r){return Il.startFloatingPoint(r),Il.addPrecision(r,t.precision),Il.endFloatingPoint(r)}visitBinary(t,r){return Pm.startBinary(r),Pm.endBinary(r)}visitLargeBinary(t,r){return zm.startLargeBinary(r),zm.endLargeBinary(r)}visitBool(t,r){return $m.startBool(r),$m.endBool(r)}visitUtf8(t,r){return Wm.startUtf8(r),Wm.endUtf8(r)}visitLargeUtf8(t,r){return Vm.startLargeUtf8(r),Vm.endLargeUtf8(r)}visitDecimal(t,r){return Os.startDecimal(r),Os.addScale(r,t.scale),Os.addPrecision(r,t.precision),Os.addBitWidth(r,t.bitWidth),Os.endDecimal(r)}visitDate(t,r){return _l.startDate(r),_l.addUnit(r,t.unit),_l.endDate(r)}visitTime(t,r){return qa.startTime(r),qa.addUnit(r,t.unit),qa.addBitWidth(r,t.bitWidth),qa.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return Ya.startTimestamp(r),Ya.addUnit(r,t.unit),n!==void 0&&Ya.addTimezone(r,n),Ya.endTimestamp(r)}visitInterval(t,r){return Tl.startInterval(r),Tl.addUnit(r,t.unit),Tl.endInterval(r)}visitDuration(t,r){return wl.startDuration(r),wl.addUnit(r,t.unit),wl.endDuration(r)}visitList(t,r){return jm.startList(r),jm.endList(r)}visitStruct(t,r){return Ym.startStruct_(r),Ym.endStruct_(r)}visitUnion(t,r){zo.startTypeIdsVector(r,t.typeIds.length);let n=zo.createTypeIdsVector(r,t.typeIds);return zo.startUnion(r),zo.addMode(r,t.mode),zo.addTypeIds(r,n),zo.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Bs.startDictionaryEncoding(r),Bs.addId(r,BigInt(t.id)),Bs.addIsOrdered(r,t.isOrdered),n!==void 0&&Bs.addIndexType(r,n),Bs.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return vl.startFixedSizeBinary(r),vl.addByteWidth(r,t.byteWidth),vl.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Sl.startFixedSizeList(r),Sl.addListSize(r,t.listSize),Sl.endFixedSizeList(r)}visitMap(t,r){return Al.startMap(r),Al.addKeysSorted(r,t.keysSorted),Al.endMap(r)}},I1=new lM;function g5(e,t=new Map){return new Te(UZ(e,t),T1(e.metadata),t)}function uM(e){return new un(e.count,x5(e.columns),_5(e.columns))}function b5(e){return new mi(uM(e.data),e.id,e.isDelta)}function UZ(e,t){return(e.fields||[]).filter(Boolean).map(r=>ie.fromJSON(r,t))}function p5(e,t){return(e.children||[]).filter(Boolean).map(r=>ie.fromJSON(r,t))}function x5(e){return(e||[]).reduce((t,r)=>[...t,new fo(r.count,PZ(r.VALIDITY)),...x5(r.children)],[])}function _5(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new pi(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new pi(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new pi(t.length,i.OFFSET.length)),i.DATA&&t.push(new pi(t.length,i.DATA.length)),t=_5(i.children,t)}return t}function PZ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function w5(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=y5(e,p5(e,t)),i=new ie(e.name,s,e.nullable,T1(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?m5(n):new Yo,a=new fi(t.get(r),n,r,o.isOrdered),i=new ie(e.name,a,e.nullable,T1(e.metadata))):(n=(n=o.indexType)?m5(n):new Yo,t.set(r,s=y5(e,p5(e,t))),a=new fi(s,n,r,o.isOrdered),i=new ie(e.name,a,e.nullable,T1(e.metadata))),i||null}function T1(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function m5(e){return new dr(e.isSigned,e.bitWidth)}function y5(e,t){let r=e.type.name;switch(r){case"NONE":return new Mn;case"null":return new Mn;case"binary":return new Ns;case"largebinary":return new Fs;case"utf8":return new Rs;case"largeutf8":return new Ls;case"bool":return new ks;case"list":return new io((t||[])[0]);case"struct":return new $e(t||[]);case"struct_":return new $e(t||[])}switch(r){case"int":{let n=e.type;return new dr(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new $n(Le[n.precision])}case"decimal":{let n=e.type;return new Cs(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new Us(Ar[n.unit])}case"time":{let n=e.type;return new no(ft[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new Ps(ft[n.unit],n.timezone)}case"interval":{let n=e.type;return new $s(Hr[n.unit])}case"duration":{let n=e.type;return new zs(ft[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new oo(Pe[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new Vs(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new so(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new ao((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var $Z=Po,zZ=Mr,yi=class e{static fromJSON(t,r){let n=new e(0,De.V5,r);return n._createHeader=VZ(t,r),n}static decode(t){t=new zZ(Et(t));let r=Xo.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=jZ(r,o),s}static encode(t){let r=new $Z,n=-1;return t.isSchema()?n=Te.encode(r,t.header()):t.isRecordBatch()?n=un.encode(r,t.header()):t.isDictionaryBatch()&&(n=mi.encode(r,t.header())),Xo.startMessage(r),Xo.addVersion(r,De.V5),Xo.addHeader(r,n),Xo.addHeaderType(r,t.headerType),Xo.addBodyLength(r,BigInt(t.bodyLength)),Xo.finishMessageBuffer(r,Xo.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof Te)return new e(0,De.V5,se.Schema,t);if(t instanceof un)return new e(r,De.V5,se.RecordBatch,t);if(t instanceof mi)return new e(r,De.V5,se.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===se.Schema}isRecordBatch(){return this.headerType===se.RecordBatch}isDictionaryBatch(){return this.headerType===se.DictionaryBatch}constructor(t,r,n,i){this._version=r,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=or(t)}},un=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=or(t)}},mi=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=or(r)}},pi=class{constructor(t,r){this.offset=or(t),this.length=or(r)}},fo=class{constructor(t,r){this.length=or(t),this.nullCount=or(r)}};function VZ(e,t){return()=>{switch(t){case se.Schema:return Te.fromJSON(e);case se.RecordBatch:return un.fromJSON(e);case se.DictionaryBatch:return mi.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${se[t]}, type: ${t} }`)}}function jZ(e,t){return()=>{switch(t){case se.Schema:return Te.decode(e.header(new ui),new Map,e.version());case se.RecordBatch:return un.decode(e.header(new Oi),e.version());case se.DictionaryBatch:return mi.decode(e.header(new ja),e.version())}throw new Error(`Unrecognized Message type: { name: ${se[t]}, type: ${t} }`)}}ie.encode=tK;ie.decode=QZ;ie.fromJSON=w5;Te.encode=JZ;Te.decode=qZ;Te.fromJSON=g5;un.encode=eK;un.decode=YZ;un.fromJSON=uM;mi.encode=rK;mi.decode=WZ;mi.fromJSON=b5;fo.encode=nK;fo.decode=XZ;pi.encode=iK;pi.decode=GZ;function qZ(e,t=new Map,r=De.V5){let n=KZ(e,t);return new Te(n,A1(e),t,r)}function YZ(e,t=De.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new un(e.length(),HZ(e),ZZ(e,t))}function WZ(e,t=De.V5){return new mi(un.decode(e.data(),t),e.id(),e.isDelta())}function GZ(e){return new pi(e.offset(),e.length())}function XZ(e){return new fo(e.length(),e.nullCount())}function HZ(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=fo.decode(r));return t}function ZZ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<De.V4&&(n.bb_pos+=8*(i+1)),r[++o]=pi.decode(n));return r}function KZ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=ie.decode(n,t));return r}function v5(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=ie.decode(n,t));return r}function QZ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=I5(e,v5(e,t)),n=new ie(e.name(),i,e.nullable(),A1(e))):t.has(r=or(a.id()))?(o=(o=a.indexType())?S5(o):new Yo,s=new fi(t.get(r),o,r,a.isOrdered()),n=new ie(e.name(),s,e.nullable(),A1(e))):(o=(o=a.indexType())?S5(o):new Yo,t.set(r,i=I5(e,v5(e,t))),s=new fi(i,o,r,a.isOrdered()),n=new ie(e.name(),s,e.nullable(),A1(e))),n||null}function A1(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function S5(e){return new dr(e.isSigned(),e.bitWidth())}function I5(e,t){let r=e.typeType();switch(r){case ke.NONE:return new Mn;case ke.Null:return new Mn;case ke.Binary:return new Ns;case ke.LargeBinary:return new Fs;case ke.Utf8:return new Rs;case ke.LargeUtf8:return new Ls;case ke.Bool:return new ks;case ke.List:return new io((t||[])[0]);case ke.Struct_:return new $e(t||[])}switch(r){case ke.Int:{let n=e.type(new $o);return new dr(n.isSigned(),n.bitWidth())}case ke.FloatingPoint:{let n=e.type(new Il);return new $n(n.precision())}case ke.Decimal:{let n=e.type(new Os);return new Cs(n.scale(),n.precision(),n.bitWidth())}case ke.Date:{let n=e.type(new _l);return new Us(n.unit())}case ke.Time:{let n=e.type(new qa);return new no(n.unit(),n.bitWidth())}case ke.Timestamp:{let n=e.type(new Ya);return new Ps(n.unit(),n.timezone())}case ke.Interval:{let n=e.type(new Tl);return new $s(n.unit())}case ke.Duration:{let n=e.type(new wl);return new zs(n.unit())}case ke.Union:{let n=e.type(new zo);return new oo(n.mode(),n.typeIdsArray()||[],t||[])}case ke.FixedSizeBinary:{let n=e.type(new vl);return new Vs(n.byteWidth())}case ke.FixedSizeList:{let n=e.type(new Sl);return new so(n.listSize(),(t||[])[0])}case ke.Map:{let n=e.type(new Al);return new ao((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${ke[r]}" (${r})`)}function JZ(e,t){let r=t.fields.map(o=>ie.encode(e,o));ui.startFieldsVector(e,r.length);let n=ui.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?ui.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Vr.startKeyValue(e),Vr.addKey(e,a),Vr.addValue(e,c),Vr.endKeyValue(e)})):-1;return ui.startSchema(e),ui.addFields(e,n),ui.addEndianness(e,oK?xl.Little:xl.Big),i!==-1&&ui.addCustomMetadata(e,i),ui.endSchema(e)}function tK(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;J.isDictionary(o)?(s=o.dictionary.typeId,i=I1.visit(o,e),n=I1.visit(o.dictionary,e)):n=I1.visit(o,e);let a=(o.children||[]).map(u=>ie.encode(e,u)),c=An.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?An.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return Vr.startKeyValue(e),Vr.addKey(e,d),Vr.addValue(e,h),Vr.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),An.startField(e),An.addType(e,n),An.addTypeType(e,s),An.addChildren(e,c),An.addNullable(e,!!t.nullable),r!==-1&&An.addName(e,r),i!==-1&&An.addDictionary(e,i),l!==-1&&An.addCustomMetadata(e,l),An.endField(e)}function eK(e,t){let r=t.nodes||[],n=t.buffers||[];Oi.startNodesVector(e,r.length);for(let s of r.slice().reverse())fo.encode(e,s);let i=e.endVector();Oi.startBuffersVector(e,n.length);for(let s of n.slice().reverse())pi.encode(e,s);let o=e.endVector();return Oi.startRecordBatch(e),Oi.addLength(e,BigInt(t.length)),Oi.addNodes(e,i),Oi.addBuffers(e,o),Oi.endRecordBatch(e)}function rK(e,t){let r=un.encode(e,t.data);return ja.startDictionaryBatch(e),ja.addId(e,BigInt(t.id)),ja.addIsDelta(e,t.isDelta),ja.addData(e,r),ja.endDictionaryBatch(e)}function nK(e,t){return zd.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function iK(e,t){return $d.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var oK=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var dM=e=>`Expected ${se[e]} Message in stream, but was null or length 0.`,hM=e=>`Header pointer of flatbuffer-encoded ${se[e]} Message is null or length 0.`,T5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,A5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,ih=class{constructor(t){this.source=t instanceof Ys?t:new Ys(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?je:t.value===-1&&(t=this.readMetadataLength()).done?je:(t=this.readMetadata(t.value)).done?je:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(dM(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=Et(this.source.read(t));if(r.byteLength<t)throw new Error(A5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=se.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(hM(r));return i}readMetadataLength(){let t=this.source.read(M1),r=t&&new Mr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return je;if(r.byteLength<t)throw new Error(T5(t,r.byteLength));return{done:!1,value:yi.decode(r)}}},Uy=class{constructor(t,r){this.source=t instanceof lo?t:y_(t)?new Bl(t,r):new lo(t)}[Symbol.asyncIterator](){return this}next(){return P(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?je:t.value===-1&&(t=yield this.readMetadataLength()).done?je:(t=yield this.readMetadata(t.value)).done?je:t})}throw(t){return P(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return P(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return P(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(dM(t));return r.value})}readMessageBody(t){return P(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=Et(yield this.source.read(t));if(r.byteLength<t)throw new Error(A5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(t=!1){return P(this,void 0,void 0,function*(){let r=se.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(hM(r));return i})}readMetadataLength(){return P(this,void 0,void 0,function*(){let t=yield this.source.read(M1),r=t&&new Mr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return P(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return je;if(r.byteLength<t)throw new Error(T5(t,r.byteLength));return{done:!1,value:yi.decode(r)}})}},Py=class extends ih{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof uy?t:new uy(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:yi.fromJSON(t.schema,se.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:yi.fromJSON(r,se.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:yi.fromJSON(r,se.RecordBatch)}}return this._body=[],je}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(dM(t));return r.value}readSchema(){let t=se.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(hM(t));return n}},M1=4,fM="ARROW1",oh=new Uint8Array(fM.length);for(let e=0;e<fM.length;e+=1)oh[e]=fM.codePointAt(e);function E1(e,t=0){for(let r=-1,n=oh.length;++r<n;)if(oh[r]!==e[t+r])return!1;return!0}var sh=oh.length,pM=sh+M1,M5=sh*2+M1;var Ri=class e extends Qu{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Di(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return cn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return cn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:p_(t)?aK(t):y_(t)?uK(t):Di(t)?P(this,void 0,void 0,function*(){return yield e.from(yield t)}):g_(t)||Fm(t)||x_(t)||eo(t)?lK(new lo(t)):cK(new Ys(t))}static readAll(t){return t instanceof e?t.isSync()?E5(t):D5(t):p_(t)||ArrayBuffer.isView(t)||ko(t)||m_(t)?E5(t):D5(t)}},rc=class extends Ri{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ve(this,arguments,function*(){yield H(yield*to(fr(this[Symbol.iterator]())))})}},af=class extends Ri{constructor(t){super(t),this._impl=t}readAll(){var t,r,n,i;return P(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=fr(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},cf=class extends rc{constructor(t){super(t),this._impl=t}},D1=class extends af{constructor(t){super(t),this._impl=t}},B1=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let n=this._loadVectors(t,r,this.schema.fields),i=Vt({type:new $e(this.schema.fields),length:t.length,children:n});return new hr(this.schema,i)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n);if(i||!a){let c=s.dictionaries.get(n),l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new ue(l)):new ue(l)).memoize()}return a.memoize()}_loadVectors(t,r,n){return new py(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},ah=class extends B1{constructor(t,r){super(r),this._reader=p_(t)?new Py(this._handle=t):new ih(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=B5(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):je}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):je}next(){if(this.closed)return je;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new sf(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},ch=class extends B1{constructor(t,r){super(r),this._reader=new Uy(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return P(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 P(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=B5(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):je})}return(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):je})}next(){return P(this,void 0,void 0,function*(){if(this.closed)return je;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new sf(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},O1=class extends ah{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof fy?t:new fy(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(se.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(se.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-pM,n=t.readInt32(r),i=t.readAt(r-n,n);return Xa.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},mM=class extends ch{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Bl?t:new Bl(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return P(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){var r;return P(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(se.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 r;return P(this,void 0,void 0,function*(){let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(se.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 P(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-pM,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return Xa.decode(i)})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},yM=class extends ah{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new e1(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function B5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*E5(e){let t=Ri.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function D5(e){return Ve(this,arguments,function*(){let r=yield H(Ri.from(e));try{if(!(yield H(r.open({autoDestroy:!1}))).closed)do yield yield H(r);while(!(yield H(r.reset().open())).closed)}finally{yield H(r.cancel())}})}function aK(e){return new rc(new yM(e))}function cK(e){let t=e.peek(sh+7&-8);return t&&t.byteLength>=4?E1(t)?new cf(new O1(e.read())):new rc(new ah(e)):new rc(new ah(function*(){}()))}function lK(e){return P(this,void 0,void 0,function*(){let t=yield e.peek(sh+7&-8);return t&&t.byteLength>=4?E1(t)?new cf(new O1(yield e.read())):new af(new ch(e)):new af(new ch(function(){return Ve(this,arguments,function*(){})}()))})}function uK(e){return P(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Bl(e,t);return t>=M5&&E1(yield r.readAt(0,sh+7&-8))?new D1(new mM(r)):new af(new ch(r))})}var tr=class e extends _t{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof hr?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof ue)return this.visitMany(t.data),this;let{type:r}=t;if(!J.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(J.isUnion(r))this.nodes.push(new fo(n,0));else{let{nullCount:i}=t;J.isNull(r)||Ho.call(this,i<=0?new Uint8Array(0):Xu(t.offset,n,t.nullBitmap)),this.nodes.push(new fo(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Ho(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new pi(this._byteLength,t)),this._byteLength+=t,this}function fK(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Ho.call(this,i),r.mode===Pe.Sparse)return gM.call(this,e);if(r.mode===Pe.Dense){if(e.offset<=0)return Ho.call(this,o),gM.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Ho.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=r.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(n,h))}))}}return this}function dK(e){let t;return e.nullCount>=e.length?Ho.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Ho.call(this,Xu(e.offset,e.length,t)):Ho.call(this,Hu(e.values))}function nc(e){return Ho.call(this,e.values.subarray(0,e.length*e.stride))}function N1(e){let{length:t,values:r,valueOffsets:n}=e,i=or(n[0]),o=or(n[t]),s=Math.min(o-i,r.byteLength-i);return Ho.call(this,w_(-i,t+1,n)),Ho.call(this,r.subarray(i,i+s)),this}function bM(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return Ho.call(this,w_(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function gM(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}tr.prototype.visitBool=dK;tr.prototype.visitInt=nc;tr.prototype.visitFloat=nc;tr.prototype.visitUtf8=N1;tr.prototype.visitLargeUtf8=N1;tr.prototype.visitBinary=N1;tr.prototype.visitLargeBinary=N1;tr.prototype.visitFixedSizeBinary=nc;tr.prototype.visitDate=nc;tr.prototype.visitTimestamp=nc;tr.prototype.visitTime=nc;tr.prototype.visitDecimal=nc;tr.prototype.visitList=bM;tr.prototype.visitStruct=gM;tr.prototype.visitUnion=fK;tr.prototype.visitInterval=nc;tr.prototype.visitDuration=nc;tr.prototype.visitFixedSizeList=bM;tr.prototype.visitMap=bM;var lf=class extends Qu{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new qs,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Pn(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 Di(t)?t.then(r=>this.writeAll(r)):eo(t)?_M(this,t):xM(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof qs?this._sink=t:(this._sink=new qs,t&&qk(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Yk(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,(!r||!of(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof hi&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof hr&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!of(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof hr?t instanceof sf||this._writeRecordBatch(t):t instanceof hi?this.writeAll(t.batches):ko(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=yi.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===se.RecordBatch?this._recordBatchBlocks.push(new Ha(a,t.bodyLength,this._position)):t.headerType===se.DictionaryBatch&&this._dictionaryBlocks.push(new Ha(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=Et(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(yi.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(oh)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=tr.assemble(t),s=new un(t.numRows,n,i),a=yi.from(s,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,r,n=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=tr.assemble(new ue([t])),c=new un(t.length,o,s),l=new mi(c,r,n),u=yi.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,n,i;for(let o=-1,s=t.length;++o<s;)(r=t[o])&&(n=r.byteLength)>0&&(this._write(r),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[r,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(r)||0;if(i===0||(n=n?.slice(i)).length>0)for(let o of n.data)this._writeDictionaryBatch(o,r,i>0),i+=o.length}return this}},$y=class e extends lf{static writeAll(t,r){let n=new e(r);return Di(t)?t.then(i=>n.writeAll(i)):eo(t)?_M(n,t):xM(n,t)}},zy=class e extends lf{static writeAll(t){let r=new e;return Di(t)?t.then(n=>r.writeAll(n)):eo(t)?_M(r,t):xM(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let r=Xa.encode(new Xa(t,De.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function xM(e,t){let r=t;t instanceof hi&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function _M(e,t){var r,n,i,o,s,a,c;return P(this,void 0,void 0,function*(){try{for(r=!0,n=fr(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function O5(e,t){if(eo(e))return pK(e,t);if(ko(e))return hK(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function hK(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Et(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function pK(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return P(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return P(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return P(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return P(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Et(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function R5(e){return new wM(e)}var wM=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=h_(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=tf(o),this._getSize=i!=="bytes"?N5:F5;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?N5:F5}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},N5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},F5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function F1(e,t){let r=new qs,n=null,i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield r.close()})},start(a){return P(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return P(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return P(this,void 0,void 0,function*(){return yield(yield Ri.from(r)).open(t)})}function s(a,c){return P(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 R1(e,t){let r=new this(e),n=new lo(r),i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return P(this,void 0,void 0,function*(){yield o(s)})},start(s){return P(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return P(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function uf(e){let t=Ri.from(e);return Di(t)?t.then(r=>uf(r)):t.isAsync()?t.readAll().then(r=>new hi(r)):new hi(t.readAll())}var RK=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},NA),iM),HA),FA),MA),XA),BA),{compareSchemas:of,compareFields:c5,compareTypes:l5});cn.toDOMStream=O5;Xe.throughDOM=R5;Ri.throughDOM=F1;cf.throughDOM=F1;rc.throughDOM=F1;lf.throughDOM=R1;zy.throughDOM=R1;$y.throughDOM=R1;function L1(e="ws://localhost:3000/"){let t=[],r=!1,n=null,i,o={open(){r=!0,c()},close(){for(r=!1,n=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(n){let{reject:u}=n;n=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(n){let{query:u,resolve:f,reject:d}=n;if(n=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(uf(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}),r&&!n&&c()}function c(){t.length&&(n=t.shift(),i.send(JSON.stringify(n.query)))}return{get connected(){return r},query(l){return new Promise((u,f)=>a(l,u,f))}}}var gi=class{constructor(t,r){t&&(this.table=String(t)),r&&(this.column=r)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:r}=this;if(r){let n=r.startsWith("*")?r:`"${r}"`;return`${t?`${L5(t)}.`:""}${n}`}else return t?L5(t):"NULL"}};function L5(e){return e.split(".").map(r=>`"${r}"`).join(".")}function k5(e,t){return e instanceof gi&&e.column===t}function re(e){return typeof e=="string"?Ol(e):e}function ff(e){return typeof e=="string"?C5(e):e}function C5(e){return new gi(e)}function Ol(e,t=null){return arguments.length===1&&(t=e,e=null),new gi(e,t)}function Gs(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e.replace("'","''")}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let r=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(r,n,i)?`MAKE_DATE(${r}, ${n+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var ic=e=>typeof e?.addEventListener=="function";function k1(e){return e instanceof oc}var oc=class{constructor(t,r,n){this._expr=Array.isArray(t)?t:[t],this._deps=r||[],this.annotate(n);let i=this._expr.filter(o=>ic(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>LK(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:r}=this;if(t){let n=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(n.size){let i=new Set(r);return n.forEach(o=>i.add(o)),Array.from(i)}}return r}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=>ic(t)&&!k1(t)?Gs(t.value):t).join("")}addEventListener(t,r){let n=this.map||(this.map=new Map);(n.get(t)||(n.set(t,new Set),n.get(t))).add(r)}};function LK(e,t){if(t?.size)return Promise.allSettled(Array.from(t,r=>r(e)))}function vM(e,t){let r=[e[0]],n=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];ic(a)?r[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>n.add(l)),r[s]+=typeof a=="string"?a:Gs(a));let c=e[++o];ic(r[s])?r[++s]=c:r[s]+=c}return{spans:r,cols:Array.from(n)}}function W(e,...t){let{spans:r,cols:n}=vM(e,t);return new oc(r,n)}function SM(e){let t=re(e);return W`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var df=e=>({value:e,toString:()=>Gs(e)});function Vy(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function U5(e,t){let r=t.filter(i=>i!=null).map(re),n=r.map((i,o)=>o?` ${e} `:"");return r.length===1?n.push(""):r.length>1&&(n[0]="(",n.push(")")),W(n,...r).annotate({op:e,children:r,visit:Vy})}var bi=(...e)=>U5("AND",e.flat()),hf=(...e)=>U5("OR",e.flat()),kK=e=>t=>W`(${e} ${re(t)})`.annotate({op:e,a:t,visit:Vy}),IM=kK("NOT"),P5=e=>t=>W`(${re(t)} ${e})`.annotate({op:e,a:t,visit:Vy}),pf=P5("IS NULL"),sc=P5("IS NOT NULL"),Nl=e=>(t,r)=>W`(${re(t)} ${e} ${re(r)})`.annotate({op:e,a:t,b:r,visit:Vy}),TM=Nl("="),mf=Nl("<>"),ac=Nl("<"),jy=Nl(">"),cc=Nl("<="),AM=Nl(">="),MM=Nl("IS DISTINCT FROM"),lh=Nl("IS NOT DISTINCT FROM");function $5(e,t,r,n){t=re(t);let i=e.startsWith("NOT ")?"NOT ":"";return(r?n?W`${i}(${r[0]} <= ${t} AND ${t} < ${r[1]})`:W`(${t} ${e} ${r[0]} AND ${r[1]})`:W``).annotate({op:e,visit:Vy,field:t,range:r})}var Br=(e,t,r)=>$5("BETWEEN",e,t,r),EM=(e,t,r)=>$5("NOT BETWEEN",e,t,r);function yf(e,t){return Array.from({length:e},()=>t)}function fn(e,t){return(...r)=>{let n=r.map(re),i=t?`::${t}`:"";return(n.length?W([`${e}(`,...yf(n.length-1,", "),`)${i}`],...n):W`${e}()${i}`).annotate({func:e,args:n})}}var DM=fn("REGEXP_MATCHES"),BM=fn("CONTAINS"),OM=fn("PREFIX"),NM=fn("SUFFIX"),CK=fn("LOWER"),UK=fn("UPPER"),PK=fn("LENGTH"),$K=fn("ISNAN"),zK=fn("ISFINITE"),VK=fn("ISINF");var qy=class e extends oc{constructor(t,r,n,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?W`${r} OVER "${i}"`:W`${r} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=W`${r} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}n&&(c=W`(${c})::${n}`);let{_expr:u,_deps:f}=c;super(u,f),this.window=t,this.func=r,this.type=n,this.name=i,this.group=o,this.order=s,this.frame=a}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:r,func:n,type:i,group:o,order:s,frame:a}=this;return new e(r,n,i,t,o,s,a)}partitionby(...t){let r=t.flat().filter(u=>u).map(re),n=W(["PARTITION BY ",yf(r.length-1,", "),""],...r),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,n,c,l)}orderby(...t){let r=t.flat().filter(u=>u).map(re),n=W(["ORDER BY ",yf(r.length-1,", "),""],...r),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,n,l)}rows(t){let r=z5("ROWS",t),{window:n,func:i,type:o,name:s,group:a,order:c}=this;return new e(n,i,o,s,a,c,r)}range(t){let r=z5("RANGE",t),{window:n,func:i,type:o,name:s,group:a,order:c}=this;return new e(n,i,o,s,a,c,r)}};function z5(e,t){if(ic(t)){let r=W`${t}`;return r.toString=()=>`${e} ${V5(t.value)}`,r}return`${e} ${V5(t)}`}function V5(e){let[t,r]=e,n=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=r===0?"CURRENT ROW":Number.isFinite(r)?`${Math.abs(r)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${n} AND ${i}`}function Zo(e,t){return(...r)=>{let n=fn(e)(...r);return new qy(e,n,t)}}var FM=Zo("ROW_NUMBER","INTEGER"),RM=Zo("RANK","INTEGER"),LM=Zo("DENSE_RANK","INTEGER"),kM=Zo("PERCENT_RANK"),CM=Zo("CUME_DIST"),UM=Zo("NTILE"),PM=Zo("LAG"),$M=Zo("LEAD"),zM=Zo("FIRST_VALUE"),VM=Zo("LAST_VALUE"),jM=Zo("NTH_VALUE");function ae(e,...t){return W(e,...t).annotate({aggregate:!0})}var qM=class e extends oc{constructor(t,r,n,i,o){r=(r||[]).map(re);let{strings:s,exprs:a}=jK(t,r,n,i,o),{spans:c,cols:l}=vM(s,a);super(c,l),this.aggregate=t,this.args=r,this.type=n,this.isDistinct=i,this.filter=o}get basis(){return this.column}get label(){let{aggregate:t,args:r,isDistinct:n}=this,i=n?"DISTINCT"+(r.length?" ":""):"",o=r.length?`(${i}${r.map(qK).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:r,type:n,filter:i}=this;return new e(t,r,n,!0,i)}where(t){let{aggregate:r,args:n,type:i,isDistinct:o}=this;return new e(r,n,i,o,t)}window(){let{aggregate:t,args:r,type:n,isDistinct:i}=this,o=new e(t,r,null,i);return new qy(t,o,n)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t){return this.window().rows(t)}range(t){return this.window().range(t)}};function jK(e,t,r,n,i){let o=`)${r?`::${r}`:""}`,s=[`${e}(${n?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...yf(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function qK(e){let t=Gs(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function pe(e,t){return(...r)=>new qM(e,r,t)}var Vn=pe("COUNT","INTEGER"),Yy=pe("AVG"),YK=pe("AVG"),YM=pe("MAD"),ho=pe("MAX"),po=pe("MIN"),Li=pe("SUM","DOUBLE"),WM=pe("PRODUCT"),GM=pe("MEDIAN"),XM=pe("QUANTILE"),HM=pe("MODE"),ZM=pe("VARIANCE"),Wy=pe("STDDEV"),KM=pe("SKEWNESS"),QM=pe("KURTOSIS"),JM=pe("ENTROPY"),tE=pe("VAR_POP"),eE=pe("STDDEV_POP"),rE=pe("CORR"),nE=pe("COVAR_SAMP"),iE=pe("COVAR_POP"),oE=pe("REGR_INTERCEPT"),sE=pe("REGR_SLOPE"),aE=pe("REGR_COUNT"),WK=pe("REGR_R2"),cE=pe("REGR_SYY"),lE=pe("REGR_SXX"),GK=pe("REGR_SXY"),uE=pe("REGR_AVGX"),XK=pe("REGR_AVGY"),fE=pe("FIRST"),dE=pe("LAST"),uh=pe("ARG_MIN"),fh=pe("ARG_MAX"),hE=pe("STRING_AGG"),pE=pe("ARRAY_AGG");function Gy(e,t){let r=re(e),n=W`CAST(${r} AS ${t})`;return Object.defineProperty(n,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(n,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),n}var dh=e=>Gy(e,"DOUBLE"),mE=e=>Gy(e,"INTEGER");var yE=e=>W`epoch_ms(${re(e)})`,gE=e=>{let t=re(e);return W`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},bE=e=>{let t=re(e);return W`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},xE=e=>{let t=re(e);return W`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Xy=fn("ST_AsGeoJSON"),j5=fn("ST_X"),q5=fn("ST_Y"),Hy=fn("ST_CENTROID"),_E=e=>j5(Hy(e)),wE=e=>q5(Hy(e));var bt=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 gf("UNION",t.flat())}static unionAll(...t){return new gf("UNION ALL",t.flat())}static intersect(...t){return new gf("INTERSECT",t.flat())}static except(...t){return new gf("EXCEPT",t.flat())}static describe(t){let r=t.clone(),{clone:n,toString:i}=r;return Object.assign(r,{describe:!0,clone:()=>e.describe(n.call(r)),toString:()=>`DESCRIBE ${i.call(r)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:r}=this;if(t.length===0)return r.with;{let n=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,n.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])}),r.with=r.with.concat(n),this}}select(...t){let{query:r}=this;if(t.length===0)return r.select;{let n=[];for(let o of t.flat())if(o!=null)if(typeof o=="string")n.push({as:o,expr:re(o)});else if(o instanceof gi)n.push({as:o.column,expr:o});else if(Array.isArray(o))n.push({as:o[0],expr:o[1]});else for(let s in o)n.push({as:C1(s),expr:re(o[s])});let i=new Set(n.map(o=>o.as));return r.select=r.select.filter(o=>!i.has(o.as)).concat(n.filter(o=>o.expr)),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:r}=this;if(t.length===0)return r.from;{let n=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")n.push({as:i,from:ff(i)});else if(i instanceof gi)n.push({as:i.table,from:i});else if(Zy(i)||k1(i))n.push({from:i});else if(Array.isArray(i))n.push({as:C1(i[0]),from:ff(i[1])});else for(let o in i)n.push({as:C1(o),from:ff(i[o])})}),r.from=r.from.concat(n),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,r){let{query:n}=this;if(arguments.length===0)return n.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:r}:{rows:Math.round(t),method:r}),n.sample=i,this}}where(...t){let{query:r}=this;return t.length===0?r.where:(r.where=r.where.concat(t.flat().filter(n=>n)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:r}=this;return t.length===0?r.groupby:(r.groupby=r.groupby.concat(t.flat().filter(n=>n).map(re)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:r}=this;return t.length===0?r.having:(r.having=r.having.concat(t.flat().filter(n=>n)),this)}window(...t){let{query:r}=this;if(t.length===0)return r.window;{let n=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)n.push({as:C1(o),expr:i[o]})}),r.window=r.window.concat(n),this}}qualify(...t){let{query:r}=this;return t.length===0?r.qualify:(r.qualify=r.qualify.concat(t.flat().filter(n=>n)),this)}orderby(...t){let{query:r}=this;return t.length===0?r.orderby:(r.orderby=r.orderby.concat(t.flat().filter(n=>n).map(re)),this)}limit(t){let{query:r}=this;return arguments.length===0?r.limit:(r.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:r}=this;return arguments.length===0?r.offset:(r.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:r}=this,i=(r?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(Zy(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{with:t,select:r,distinct:n,from:i,sample:o,where:s,groupby:a,having:c,window:l,qualify:u,orderby:f,limit:d,offset:h}=this.query,p=[];if(t.length){let y=t.map(({as:g,query:b})=>`"${g}" AS (${b})`);p.push(`WITH ${y.join(", ")}`)}let m=r.map(({as:y,expr:g})=>k5(g,y)&&!g.table?`${g}`:`${g} AS "${y}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${m.join(", ")}`),i.length){let y=i.map(({as:g,from:b})=>{let x=Zy(b)?`(${b})`:`${b}`;return!g||g===b.table?x:`${x} AS "${g}"`});p.push(`FROM ${y.join(", ")}`)}if(s.length){let y=s.map(String).filter(g=>g).join(" AND ");y&&p.push(`WHERE ${y}`)}if(o){let{rows:y,perc:g,method:b,seed:x}=o,_=y?`${y} ROWS`:`${g} PERCENT`,v=b?` (${b}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${_}${v}`)}if(a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let y=c.map(String).filter(g=>g).join(" AND ");y&&p.push(`HAVING ${y}`)}if(l.length){let y=l.map(({as:g,expr:b})=>`"${g}" AS (${b})`);p.push(`WINDOW ${y.join(", ")}`)}if(u.length){let y=u.map(String).filter(g=>g).join(" AND ");y&&p.push(`QUALIFY ${y}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(d)&&p.push(`LIMIT ${d}`),Number.isFinite(h)&&p.push(`OFFSET ${h}`),p.join(" ")}},gf=class e{constructor(t,r){this.op=t,this.queries=r.map(n=>n.clone()),this.query={orderby:[]},this.cteFor=null}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:r}=this;return t.length===0?r.orderby:(r.orderby=r.orderby.concat(t.flat().filter(n=>n).map(re)),this)}limit(t){let{query:r}=this;return arguments.length===0?r.limit:(r.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:r}=this;return arguments.length===0?r.offset:(r.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:r}=this;return r&&t.forEach(n=>n.cteFor=r),t}toString(){let{op:t,queries:r,query:{orderby:n,limit:i,offset:o}}=this,s=[r.join(` ${t} `)];return n.length&&s.push(`ORDER BY ${n.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function Zy(e){return e instanceof bt||e instanceof gf}function vE(e){return Zy(e)&&e.describe}function C1(e){return HK(e)?e.slice(1,-1):e}function HK(e){return e[0]==='"'&&e[e.length-1]==='"'}var U1=e=>e;function Y5(){return{apply:U1,invert:U1,sqlApply:re,sqlInvert:U1}}function ZK({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>W`LN(${re(t)})`,sqlInvert:t=>W`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>W`LOG(${re(t)})`,sqlInvert:t=>W`POW(10, ${t})`};{let t=+e;return{apply:r=>Math.log(r)/Math.log(t),invert:r=>Math.pow(t,r),sqlApply:r=>W`LN(${re(r)}) / LN(${t})`,sqlInvert:r=>W`POW(${t}, ${r})`}}}function KK({constant:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.log1p(Math.abs(r)),invert:r=>Math.sign(r)*Math.exp(Math.abs(r)-t),sqlApply:r=>(r=re(r),W`SIGN(${r}) * LN(${t} + ABS(${r}))`),sqlInvert:r=>W`SIGN(${r}) * (EXP(ABS(${r})) - ${t})`}}function QK(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=re(e),W`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>W`SIGN(${e}) * (${e}) ** 2`}}function JK({exponent:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.pow(Math.abs(r),t),invert:r=>Math.sign(r)*Math.pow(Math.abs(r),1/t),sqlApply:r=>(r=re(r),W`SIGN(${r}) * POW(ABS(${r}), ${t})`),sqlInvert:r=>W`SIGN(${r}) * POW(ABS(${r}), 1/${t})`}}function W5(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:yE(re(e)),sqlInvert:U1}}var tQ={identity:Y5,linear:Y5,log:ZK,symlog:KK,sqrt:QK,pow:JK,time:W5,utc:W5};function Ky(e){let t=tQ[e.type];return t?{...e,...t(e)}:null}function Fl(e,t,{replace:r=!1,temp:n=!0,view:i=!1}={}){return"CREATE"+(r?" OR REPLACE ":" ")+(n?"TEMP ":"")+(i?"VIEW":"TABLE")+(r?" ":" IF NOT EXISTS ")+e+" AS "+t}function SE(e){return`INSTALL ${e}; LOAD ${e}`}function G5(e,{columns:t=Object.keys(e?.[0]||{})}={}){let r=[];if(Array.isArray(t)?(r=t,t=r.reduce((i,o)=>(i[o]=o,i),{})):t&&(r=Object.keys(t)),!r.length)throw new Error("Can not create table from empty column set.");let n=[];for(let i of e){let o=r.map(s=>`${Gs(i[s])} AS "${t[s]}"`);n.push(`(SELECT ${o.join(", ")})`)}return n.join(" UNION ALL ")}function P1(e,t,r,n={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=n,f=eQ({...i,...u}),d=`${e}('${r}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Fl(t,p,{view:a,temp:c,replace:l})}function TE(e,t,r){return P1("read_csv",e,t,r,{auto_detect:!0,sample_size:-1})}function AE(e,t,r){return P1("read_json",e,t,r,{auto_detect:!0,json_format:"auto"})}function ME(e,t,r){return P1("read_parquet",e,t,r)}function EE(e,t,r={}){let{options:n,...i}=r;if(n){let o=Array.isArray(n)?n.join(", "):typeof n=="string"?n:Object.entries(n).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(i,{open_options:o.toUpperCase()})}return P1("st_read",e,t,i)}function DE(e,t,r={}){let{select:n=["*"],...i}=r,o=G5(t),s=n.length===1&&n[0]==="*"?o:`SELECT ${n} FROM ${o}`;return Fl(e,s,i)}function eQ(e){return Object.entries(e).map(([t,r])=>`${t}=${IE(r)}`).join(", ")}function IE(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=>IE(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,r])=>`'${t}': ${IE(r)}`).join(", ")+"}";default:return e}}function H5(e){let t=2166136261;for(let r=0,n=e.length;r<n;++r){let i=e.charCodeAt(r),o=i&65280;o&&(t=X5(t^o>>8)),t=X5(t^i&255)}return rQ(t)}function X5(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function rQ(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var Z5={from:NaN};function FE(e){if(!e.filterIndexable)return Z5;let t=e.query(),r=BE(t);if(typeof r!="string"||!t.groupby)return Z5;let n=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s={};for(let a of t.select()){let{as:c,expr:{aggregate:l,args:u}}=a,f=l?.toUpperCase?.();switch(f){case"COUNT":case"SUM":i.push({[c]:ae`SUM("${c}")::DOUBLE`});break;case"AVG":i.push({[c]:iQ(s,c,u[0])});break;case"ARG_MAX":i.push({[c]:oQ(s,c,u)});break;case"ARG_MIN":i.push({[c]:sQ(s,c,u)});break;case"VARIANCE":case"VAR_SAMP":s[c]=null,i.push({[c]:$1(s,u[0],r)});break;case"VAR_POP":s[c]=null,i.push({[c]:$1(s,u[0],r,!1)});break;case"STDDEV":case"STDDEV_SAMP":s[c]=null,i.push({[c]:ae`SQRT(${$1(s,u[0],r)})`});break;case"STDDEV_POP":s[c]=null,i.push({[c]:ae`SQRT(${$1(s,u[0],r,!1)})`});break;case"COVAR_SAMP":s[c]=null,i.push({[c]:z1(s,u,r)});break;case"COVAR_POP":s[c]=null,i.push({[c]:z1(s,u,r,!1)});break;case"CORR":s[c]=null,i.push({[c]:K5(s,u,r)});break;case"REGR_COUNT":s[c]=null,i.push({[c]:ae`${hh(s,u)}::DOUBLE`});break;case"REGR_AVGX":s[c]=null,i.push({[c]:tU(s,u)});break;case"REGR_AVGY":s[c]=null,i.push({[c]:eU(s,u)});break;case"REGR_SYY":s[c]=null,i.push({[c]:NE(s,0,u,r)});break;case"REGR_SXX":s[c]=null,i.push({[c]:NE(s,1,u,r)});break;case"REGR_SXY":s[c]=null,i.push({[c]:z1(s,u,r,null)});break;case"REGR_SLOPE":s[c]=null,i.push({[c]:rU(s,u,r)});break;case"REGR_INTERCEPT":s[c]=null,i.push({[c]:aQ(s,u,r)});break;case"REGR_R2":s[c]=null,i.push({[c]:ae`(${K5(s,u,r)}) ** 2`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":i.push({[c]:ae`${f}("${c}")`});break;default:if(n.has(c))o.push(c);else return null}}return{from:r,dims:o,aggr:i,aux:s}}function Ko(e,...t){let r=t.length?"_"+t.map(nQ).join("_"):"";return`__${e}${r}__`}function nQ(e){return`${e}`.replaceAll('"',"").replaceAll(" ","_")}function BE(e){let t=e.subqueries;if(e.select){let n=e.from();if(!n.length)return;if(t.length===0)return n[0].from.table}let r=BE(t[0]);for(let n=1;n<t.length;++n){let i=BE(t[n]);if(i!==void 0&&i!==r)return NaN}return r}function Q5(e,t){let r=Ko("count",t);return e[r]=ae`COUNT(${t})`,ae`SUM(${r})`.annotate({name:r})}function iQ(e,t,r){let n=Q5(e,r);return ae`(SUM("${t}" * ${n.name}) / ${n})`}function Qy(e,t){return W`(SELECT AVG(${e}) FROM "${t}")`}function oQ(e,t,[,r]){let n=Ko("max",r);return e[n]=ae`MAX(${r})`,ae`ARG_MAX("${t}", ${n})`}function sQ(e,t,[,r]){let n=Ko("min",r);return e[n]=ae`MIN(${r})`,ae`ARG_MIN("${t}", ${n})`}function $1(e,t,r,n=!0){let i=Q5(e,t),o=Ko("rssq",t),s=Ko("rsum",t),a=W`${t} - ${Qy(t,r)}`;return e[o]=ae`SUM((${a}) ** 2)`,e[s]=ae`SUM(${a})`,ae`(SUM(${o}) - (SUM(${s}) ** 2 / ${i})) / (${i}${n?" - 1":""})`}function z1(e,t,r,n=!0){let i=hh(e,t),o=J5(e,t,r),s=Jy(e,1,t,r),a=Jy(e,0,t,r),c=n===null?"":n?` / (${i} - 1)`:` / ${i}`;return ae`(${o} - ${s} * ${a} / ${i})${c}`}function K5(e,t,r){let n=hh(e,t),i=J5(e,t,r),o=OE(e,1,t,r),s=OE(e,0,t,r),a=Jy(e,1,t,r),c=Jy(e,0,t,r),l=ae`(${o} - (${a} ** 2) / ${n})`,u=ae`(${s} - (${c} ** 2) / ${n})`;return ae`(${i} - ${a} * ${c} / ${n}) / SQRT(${l} * ${u})`}function hh(e,[t,r]){let n=Ko("count",t,r);return e[n]=ae`REGR_COUNT(${t}, ${r})`,ae`SUM(${n})`.annotate({name:n})}function Jy(e,t,r,n){let i=r[t],o=r[1-t],s=Ko("rs",i);return e[s]=ae`SUM(${i} - ${Qy(i,n)}) FILTER (${o} IS NOT NULL)`,ae`SUM(${s})`}function OE(e,t,r,n){let i=r[t],o=r[1-t],s=Ko("rss",i);return e[s]=ae`SUM((${i} - ${Qy(i,n)}) ** 2) FILTER (${o} IS NOT NULL)`,ae`SUM(${s})`}function J5(e,t,r){let[n,i]=t,o=Ko("sxy",n,i);return e[o]=ae`SUM((${i} - ${Qy(i,r)}) * (${n} - ${Qy(n,r)}))`,ae`SUM(${o})`}function tU(e,t){let[r,n]=t,i=hh(e,t),o=Ko("avg",n,r);return e[o]=ae`REGR_AVGX(${r}, ${n})`,ae`(SUM(${o} * ${i.name}) / ${i})`}function eU(e,t){let[r,n]=t,i=hh(e,t),o=Ko("avg",r,n);return e[o]=ae`REGR_AVGY(${r}, ${n})`,ae`(SUM(${o} * ${i.name}) / ${i})`}function NE(e,t,r,n){let i=hh(e,r),o=Jy(e,t,r,n),s=OE(e,t,r,n);return ae`(${s} - (${o} ** 2 / ${i}))`}function rU(e,t,r){let n=z1(e,t,r,null),i=NE(e,1,t,r);return ae`(${n}) / ${i}`}function aQ(e,t,r){let n=tU(e,t),i=eU(e,t),o=rU(e,t,r);return ae`${i} - (${o}) * ${n}`}var V1=class{constructor(t,{selection:r,temp:n=!0}){this.mc=t,this.selection=r,this.temp=n,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.active=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t?.result)),this.indices=null)}index(t,r){if(this.clients!==t){let u=Array.from(t,FE).filter(d=>d),f=u[0]?.from;this.enabled=u.length&&u.every(d=>d.from===f),this.clients=t,this.active=null,this.clear()}if(!this.enabled)return!1;r=r||this.selection.active;let{source:n}=r;if(n&&n===this.active?.source)return!0;if(this.clear(),!n)return!1;let i=this.active=cQ(r);if(!i)return!1;let o=this.mc.logger();o.warn("DATA CUBE INDEX CONSTRUCTION");let s=this.selection.remove(n),a=this.indices=new Map,{mc:c,temp:l}=this;for(let u of t){if(s.skip(u,r)){a.set(u,null);continue}let f=FE(u);if(!f)continue;let d=u.query(s.predicate(u)).select({...i.columns,...f.aux}).groupby(Object.keys(i.columns)),[h]=d.subqueries;if(h){let x=Object.values(i.columns).flatMap(_=>_.columns);fQ(h,x)}let p=d.orderby();d.query.orderby=[];let m=d.toString(),g=`cube_index_${(H5(m)>>>0).toString(16)}`,b=c.exec(Fl(g,m,{temp:l}));b.catch(x=>o.error(x)),a.set(u,{table:g,result:b,order:p,...f})}return!0}async update(){let{clients:t,selection:r,active:n}=this,i=n.predicate(r.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,r){let{mc:n,indices:i,selection:o}=this;if(!i.has(t))return r=o.predicate(t),n.updateClient(t,t.query(r));let s=this.indices.get(t);if(!s)return;let{table:a,dims:c,aggr:l,order:u=[]}=s,f=bt.select(c,l).from(a).groupby(c).where(r).orderby(u);return n.updateClient(t,f)}};function cQ(e){let{source:t,meta:r}=e,n=e.predicate?.columns;if(!r||!n)return null;let{type:i,scales:o,bin:s,pixelSize:a=1}=r,c;if(i==="interval"&&o){let l=o.map(u=>uQ(u,a,s));if(l.some(u=>u==null))return null;l.length===1?(c=u=>u?Br("active0",u.range.map(l[0])):[],n={active0:l[0](e.predicate.field)}):(c=u=>u?bi(u.children.map(({range:f},d)=>Br(`active${d}`,f.map(l[d])))):[],n=Object.fromEntries(e.predicate.children.map((u,f)=>[`active${f}`,l[f](u.field)])))}else if(i==="point")c=l=>l,n=Object.fromEntries(n.map(l=>[`${l}`,re(l)]));else return null;return{source:t,columns:n,predicate:c}}var lQ={ceil:"CEIL",round:"ROUND"};function uQ(e,t,r){let{type:n,domain:i,range:o,apply:s,sqlApply:a}=Ky(e);if(!s)return;let c=lQ[`${r}`.toLowerCase()]||"FLOOR",l=s(Math.min(...i)),u=s(Math.max(...i)),f=n==="identity"?1:Math.abs(o[1]-o[0])/(u-l),d=f/t===1?"":`${f/t}::DOUBLE * `,h=l===0?"":` - ${l}::DOUBLE`;return p=>W`${c}(${d}(${a(p)}${h}))::INTEGER`}function fQ(e,t){let r=new Set,n=i=>{r.has(i)||(r.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(n))};n(e)}var j1=class{constructor(){this._callbacks=new Map}addEventListener(t,r){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new RE}),this._callbacks.get(t).callbacks.add(r)}removeEventListener(t,r){let n=this._callbacks.get(t);n&&n.callbacks.delete(r)}willEmit(t,r){return r}emitQueueFilter(t,r){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,r){let n=this._callbacks.get(t)||{};if(n.pending)n.queue.enqueue(r,this.emitQueueFilter(t,r));else{let i=this.willEmit(t,r),{callbacks:o,queue:s}=n;if(o?.size){let a=Array.from(o,c=>c(i));n.pending=Promise.allSettled(a).then(()=>{n.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},RE=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,r){let n={value:t};if(r&&this.next){let i=this;for(;i.next;)r(i.next.value)?i=i.next:i.next=i.next.next;i.next=n}else this.next=n}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function tg(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?dQ(e,t):!0}function dQ(e,t){if(e.length!==t.length)return!0;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}function xi(e){return e instanceof Rl}var Rl=class e extends j1{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(r=>xi(r))){let r=new e,n=()=>{r.update(t.map(i=>xi(i)?i.value:i))};return n(),t.forEach(i=>xi(i)?i.addEventListener("value",n):0),r}return new e(t)}get value(){return this._value}update(t,{force:r}={}){return tg(this._value,t)||r?this.emit("value",t):this.cancel("value"),this}willEmit(t,r){return t==="value"&&(this._value=r),r}};function ki(e){return e instanceof lc}var lc=class e extends Rl{static intersect({cross:t=!1}={}){return new e(new bf({cross:t}))}static union({cross:t=!1}={}){return new e(new bf({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new bf({cross:t,single:!0}))}static crossfilter(){return new e(new bf({cross:!0}))}constructor(t=new bf){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 r=this.clone();return r._value=r._resolved=r._resolver.resolve(this._resolved,{source:t}),r._value.active={source:t},r}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(r=>r.source===t)?.value}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,super.update(this._resolved)}willEmit(t,r){return t==="value"?(this._value=r,this.value):r}emitQueueFilter(t,r){return t==="value"?this._resolver.queueFilter(r):null}skip(t,r){return this._resolver.skip(t,r)}predicate(t,r=!1){let{clauses:n}=this,i=r?null:n.active;return this._resolver.predicate(n,i,t)}},bf=class{constructor({union:t,cross:r,single:n}={}){this.union=!!t,this.cross=!!r,this.single=!!n}resolve(t,r,n=!1){let{source:i,predicate:o}=r,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&n&&s.forEach(c=>c.source?.reset?.()),o&&a.push(r),a}skip(t,r){return this.cross&&r?.clients?.has(t)}predicate(t,r,n){let{union:i}=this;if(this.skip(n,r))return;let o=t.filter(s=>!this.skip(n,s)).map(s=>s.predicate);return i&&o.length>1?hf(o):o}queueFilter(t){if(this.cross){let r=t.active?.source;return n=>n.active?.source!==r}return null}};var q1=class{constructor(t,r,n=!0){this.mc=t,this.selection=r,this.clients=new Set,this.indexer=null,this.index(n);let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>{this.indexer?.index(this.clients,s)}};r.addEventListener("value",i),r.addEventListener("activate",o)}finalize(){let{value:t,activate:r}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",r)}index(t){let{selection:r}=this,{resolver:n}=r;this.indexer=t&&(n.single||!n.union)?new V1(this.mc,{...t,selection:r}):null}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:r,clients:n,selection:i}=this;return r?.index(n)?r.update():hQ(t,n,i)}};function hQ(e,t,r){return Promise.all(Array.from(t).map(n=>{let i=r.predicate(n);if(i!=null)return e.updateClient(n,n.query(i))}))}function Y1(){let e,t,r=new Promise((n,i)=>{e=n,t=i});return Object.assign(r,{fulfill:n=>(e(n),r),reject:n=>(t(n),r)})}function pQ(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function nU(e,t,r){let n=[],i=0;function o(){let s=mQ(n,t);n=[],i=0;for(let a of s)gQ(a,e,r),_Q(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||pQ(()=>o()),n.push({entry:s,priority:a,index:n.length})):e(s,a)}}}function mQ(e,t){let r=[],n=new Map;for(let i of e){let{entry:{request:o}}=i,s=yQ(o.query,t);if(!n.has(s)){let a=[];r.push(a),n.set(s,a)}n.get(s).push(i)}return r}function yQ(e,t){let r=`${e}`;if(e instanceof bt&&!t.get(r)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return r;let n=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),n.$groupby(i.map(s=>s instanceof gi&&o[s.column]||s))}return`${n}`}else return r}function gQ(e,t,r){if(bQ(e))t({request:{type:"arrow",cache:!1,record:!1,query:e.query=xQ(e,r)},result:e.result=Y1()});else for(let{entry:n,priority:i}of e)t(n,i)}function bQ(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let r=1;r<e.length;++r)if(t!==`${e[r].entry.request.query}`)return!0}return!1}function xQ(e,t){let r=e.maps=[],n=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];r.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;n.has(f)||n.set(f,[`col${n.size}`,u]);let[d]=n.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 gi&&s[a.column]||a))}return i.$select(Array.from(n.values()))}async function _Q(e,t){let{maps:r,query:n,result:i}=e;if(!r)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=vE(n);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=r[c],d=s&&f?vQ(o,f):f?wQ(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function wQ(e,t){let r={};for(let[n,i]of t)r[i]=e.getChild(n);return new e.constructor(r)}function vQ(e,t){let r=new Map(t),n=[];for(let i of e)r.has(i.column_name)&&n.push({...i,column_name:r.get(i.column_name)});return n}var SQ=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,iU=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function oU({max:e=1e3,ttl:t=3*60*60*1e3}={}){let r=new Map;function n(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of r){let{last:l}=c;l<s&&(o=a,s=l),i>l&&r.delete(a)}o&&r.delete(o)}return{get(i){let o=r.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return r.set(i,{last:performance.now(),value:o}),r.size>e&&SQ(n),o},clear(){r=new Map}}}function sU(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(r=>!r.head)},insert(r,n){let i=t[n];if(!i)throw new Error(`Invalid queue priority rank: ${n}`);let o={item:r,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(r){for(let n of t){let{head:i,tail:o}=n;for(let s=null,a=i;a;s=a,a=a.next)r(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));n.head=i,n.tail=o}},next(){for(let r of t){let{head:n}=r;if(n!==null)return r.head=n.next,r.tail===n&&(r.tail=null),n.item}}}}var Xs={High:0,Normal:1,Low:2},W1=class{constructor(){this.queue=sU(3),this.db=null,this.clientCache=null,this._logger=null,this._logQueries=!1,this.recorders=[],this.pending=null,this._consolidate=null}next(){if(this.pending||this.queue.isEmpty())return;let{request:t,result:r}=this.queue.next();this.pending=this.submit(t,r),this.pending.finally(()=>{this.pending=null,this.next()})}enqueue(t,r=Xs.Normal){this.queue.insert(t,r),this.next()}recordQuery(t){this.recorders.length&&t&&this.recorders.forEach(r=>r.add(t))}async submit(t,r){try{let{query:n,type:i,cache:o=!1,record:s=!0,options:a}=t,c=n?`${n}`:null;if(s&&this.recordQuery(c),o){let f=this.clientCache.get(c);if(f){this._logger.debug("Cache"),r.fulfill(f);return}}let l=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:c,...a});let u=await this.db.query({type:i,sql:c,...a});o&&this.clientCache.set(c,u),this._logger.debug(`Request: ${(performance.now()-l).toFixed(1)}`),r.fulfill(u)}catch(n){r.reject(n)}}cache(t){return t!==void 0?this.clientCache=t===!0?oU():t||iU():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=nU(this.enqueue.bind(this),this.clientCache,this.recordQuery.bind(this)):!t&&this._consolidate&&(this._consolidate=null)}request(t,r=Xs.Normal){let n=Y1(),i={request:t,result:n};return this._consolidate?this._consolidate.add(i,r):this.enqueue(i,r),n}cancel(t){let r=new Set(t);this.queue.remove(({result:n})=>r.has(n))}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0))}record(){let t=[],r={add(n){t.push(n)},reset(){t=[]},snapshot(){return t.slice()},stop(){return this.recorders=this.recorders.filter(n=>n!==r),t}};return this.recorders.push(r),r}};function LE(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}function kE(e){return typeof e?.getChild=="function"}function CE(e){if(J.isTimestamp(e))return t=>t==null?t:new Date(t);if(J.isInt(e)&&e.bitWidth>=64)return t=>t==null?t:Number(t);if(J.isDecimal(e)){let t=1/Math.pow(10,e.scale);return r=>r==null?r:cU(r,t)}return t=>t}function UE(e){let{type:t}=e;if(J.isTimestamp(t)){let r=e.length,n=new Array(r);for(let i=0;i<r;++i){let o=e.get(i);n[i]=o==null?null:new Date(o)}return n}if(J.isInt(t)&&t.bitWidth>=64){let r=e.length,n=e.nullCount?new Array(r):new Float64Array(r);for(let i=0;i<r;++i){let o=e.get(i);n[i]=o==null?null:Number(o)}return n}if(J.isDecimal(t)){let r=1/Math.pow(10,t.scale),n=e.length,i=e.nullCount?new Array(n):new Float64Array(n);for(let o=0;o<n;++o){let s=e.get(o);i[o]=s==null?null:cU(s,r)}return i}return e.nullCount?Array.from(e):e.toArray()}var aU=Array.from({length:8},(e,t)=>Math.pow(2,t*32));function cU(e,t){let r=e.length,n=0;if(e.signed&&(e[r-1]|0)<0){for(let i=0;i<r;++i)n+=~e[i]*aU[i];n=-(n+1)}else for(let i=0;i<r;++i)n+=e[i]*aU[i];return n*t}var IQ="count",TQ="nulls",AQ="max",MQ="min",EQ="distinct";var DQ={[IQ]:Vn,[EQ]:e=>Vn(e).distinct(),[AQ]:ho,[MQ]:po,[TQ]:e=>Vn().where(pf(e))};function BQ(e,t,r){return bt.from(e).select(Array.from(r,n=>[n,DQ[n](t)]))}async function lU(e,t){return t.length===1&&`${t[0].column}`=="*"?NQ(e,t[0].table):(await Promise.all(t.map(r=>OQ(e,r)))).filter(r=>r)}async function OQ(e,{table:t,column:r,stats:n}){let i=bt.from({source:t}).select({column:r}).groupby(r.aggregate?W`ALL`:[]),[o]=Array.from(await e.query(bt.describe(i))),s={table:t,column:`${r}`,sqlType:o.column_type,type:LE(o.column_type),nullable:o.null==="YES"};if(!(n?.length||n?.size))return s;let a=await e.query(BQ(t,r,n),{persist:!0});for(let c=0;c<a.numCols;++c){let{name:l}=a.schema.fields[c],u=a.getChildAt(c),f=CE(u.type);s[l]=f(u.get(0))}return s}async function NQ(e,t){let r=await e.query(`DESCRIBE ${ff(t)}`);return Array.from(r).map(n=>({table:t,column:n.column_name,sqlType:n.column_type,type:LE(n.column_type),nullable:n.null==="YES"}))}function uU(){return{debug(){},info(){},log(){},warn(){},error(){}}}var G1;function mo(e){return e?G1=e:G1==null&&(G1=new eg),G1}var eg=class{constructor(t=L1(),r={}){let{logger:n=console,manager:i=new W1}=r;this.manager=i,this.logger(n),this.configure(r),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||uU(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:r=!0,indexes:n=!0}={}){this.manager.cache(t),this.manager.consolidate(r),this.indexes=n}clear({clients:t=!0,cache:r=!0}={}){this.manager.clear(),t&&(this.clients?.forEach(n=>this.disconnect(n)),this.filterGroups?.forEach(n=>n.finalize()),this.clients=new Set,this.filterGroups=new Map),r&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:r=Xs.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
- `):t,this.manager.request({type:"exec",query:t},r)}query(t,{type:r="arrow",cache:n=!0,priority:i=Xs.Normal,...o}={}){return this.manager.request({type:r,query:t,cache:n,options:o},i)}prefetch(t,r={}){return this.query(t,{...r,cache:!0,priority:Xs.Low})}createBundle(t,r,n=Xs.Low){let i={name:t,queries:r};return this.manager.request({type:"create-bundle",options:i},n)}loadBundle(t,r=Xs.High){let n={name:t};return this.manager.request({type:"load-bundle",options:n},r)}updateClient(t,r,n=Xs.Normal){return t.queryPending(),this.query(r,{priority:n}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,r){return this.filterGroups.get(t.filterBy)?.reset(),r?this.updateClient(t,r):t.update()}async connect(t){let{clients:r,filterGroups:n,indexes:i}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let o=t.fields();o?.length&&t.fieldInfo(await lU(this,o));let s=t.filterBy;if(s)if(n.has(s))n.get(s).add(t);else{let a=new q1(this,s,i);n.set(s,a.add(t))}t.requestQuery()}disconnect(t){let{clients:r,filterGroups:n}=this;r.has(t)&&(r.delete(t),n.get(t.filterBy)?.remove(t),t.coordinator=null)}};function rg(e,t,{source:r,clients:n=void 0}){let i=t!==void 0?lh(e,df(t)):null;return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function ng(e,t,{source:r,clients:n=void 0}){let i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>lh(e[l],df(c)));return a.length>1?bi(a):a[0]});i=o.length>1?hf(o):o[0]}return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function xf(e,t,{source:r,clients:n,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?Br(e,t):null;return{meta:{type:"interval",scales:[o],bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}function PE(e,t,{source:r,clients:n,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?bi(e.map((l,u)=>Br(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}var FQ={contains:BM,prefix:OM,suffix:NM,regexp:DM};function $E(e,t,{source:r,clients:n=void 0,method:i="contains"}){let o=FQ[i],s=t?o(e,df(t)):null;return{meta:{type:"match",method:i},source:r,clients:n,value:t,predicate:s}}function fU(e="http://localhost:3000/"){return{async query(t){let r=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?r:t.type==="arrow"?uf(r):(await r).json()}}}var WE={};Tr(WE,{compareArrayLike:()=>YE,joinUint8Arrays:()=>Ci,memcpy:()=>ph,rebaseValueOffsets:()=>tw,toArrayBufferView:()=>ne,toArrayBufferViewAsyncIterator:()=>ts,toArrayBufferViewIterator:()=>Hs,toBigInt64Array:()=>$Q,toBigUint64Array:()=>jQ,toFloat32Array:()=>qQ,toFloat32ArrayAsyncIterator:()=>sJ,toFloat32ArrayIterator:()=>QQ,toFloat64Array:()=>YQ,toFloat64ArrayAsyncIterator:()=>aJ,toFloat64ArrayIterator:()=>JQ,toInt16Array:()=>PQ,toInt16ArrayAsyncIterator:()=>rJ,toInt16ArrayIterator:()=>XQ,toInt32Array:()=>_f,toInt32ArrayAsyncIterator:()=>nJ,toInt32ArrayIterator:()=>HQ,toInt8Array:()=>UQ,toInt8ArrayAsyncIterator:()=>eJ,toInt8ArrayIterator:()=>GQ,toUint16Array:()=>zQ,toUint16ArrayAsyncIterator:()=>iJ,toUint16ArrayIterator:()=>ZQ,toUint32Array:()=>VQ,toUint32ArrayAsyncIterator:()=>oJ,toUint32ArrayIterator:()=>KQ,toUint8Array:()=>Ht,toUint8ArrayAsyncIterator:()=>qE,toUint8ArrayIterator:()=>jE,toUint8ClampedArray:()=>WQ,toUint8ClampedArrayAsyncIterator:()=>cJ,toUint8ClampedArrayIterator:()=>tJ});var RQ=new TextDecoder("utf-8"),ig=e=>RQ.decode(e),LQ=new TextEncoder,Ll=e=>LQ.encode(e);var kQ=e=>typeof e=="number",dU=e=>typeof e=="boolean",jr=e=>typeof e=="function",jn=e=>e!=null&&Object(e)===e,Qo=e=>jn(e)&&jr(e.then);var Jo=e=>jn(e)&&jr(e[Symbol.iterator]),yo=e=>jn(e)&&jr(e[Symbol.asyncIterator]),X1=e=>jn(e)&&jn(e.schema);var H1=e=>jn(e)&&"done"in e&&"value"in e;var Z1=e=>jn(e)&&jr(e.stat)&&kQ(e.fd);var K1=e=>jn(e)&&og(e.body),Q1=e=>"_getDOMStream"in e&&"_getNodeStream"in e,hU=e=>jn(e)&&jr(e.abort)&&jr(e.getWriter)&&!Q1(e),og=e=>jn(e)&&jr(e.cancel)&&jr(e.getReader)&&!Q1(e),pU=e=>jn(e)&&jr(e.end)&&jr(e.write)&&dU(e.writable)&&!Q1(e),J1=e=>jn(e)&&jr(e.read)&&jr(e.pipe)&&dU(e.readable)&&!Q1(e),mU=e=>jn(e)&&jr(e.clear)&&jr(e.bytes)&&jr(e.position)&&jr(e.setPosition)&&jr(e.capacity)&&jr(e.getBufferIdentifier)&&jr(e.createLong);var VE=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function CQ(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function ph(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function Ci(e,t){let r=CQ(e),n=r.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=r.length;++c<u;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?ph(s,o,a):s=o;break}ph(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function ne(e,t){let r=H1(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Ll(r)),r instanceof ArrayBuffer?new e(r):r instanceof VE?new e(r):mU(r)?ne(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var UQ=e=>ne(Int8Array,e),PQ=e=>ne(Int16Array,e),_f=e=>ne(Int32Array,e),$Q=e=>ne(BigInt64Array,e),Ht=e=>ne(Uint8Array,e),zQ=e=>ne(Uint16Array,e),VQ=e=>ne(Uint32Array,e),jQ=e=>ne(BigUint64Array,e),qQ=e=>ne(Float32Array,e),YQ=e=>ne(Float64Array,e),WQ=e=>ne(Uint8ClampedArray,e),zE=e=>(e.next(),e);function*Hs(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof VE?r(t):Jo(t)?t:r(t);return yield*zE(function*(i){let o=null;do o=i.next(yield ne(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var GQ=e=>Hs(Int8Array,e),XQ=e=>Hs(Int16Array,e),HQ=e=>Hs(Int32Array,e),jE=e=>Hs(Uint8Array,e),ZQ=e=>Hs(Uint16Array,e),KQ=e=>Hs(Uint32Array,e),QQ=e=>Hs(Float32Array,e),JQ=e=>Hs(Float64Array,e),tJ=e=>Hs(Uint8ClampedArray,e);function ts(e,t){return Ve(this,arguments,function*(){if(Qo(t))return yield H(yield H(yield*to(fr(ts(e,yield H(t))))));let n=function(s){return Ve(this,arguments,function*(){yield yield H(yield H(s))})},i=function(s){return Ve(this,arguments,function*(){yield H(yield*to(fr(zE(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 VE?n(t):Jo(t)?i(t):yo(t)?t:n(t);return yield H(yield*to(fr(zE(function(s){return Ve(this,arguments,function*(){let a=null;do a=yield H(s.next(yield yield H(ne(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield H(new e)})}var eJ=e=>ts(Int8Array,e),rJ=e=>ts(Int16Array,e),nJ=e=>ts(Int32Array,e),qE=e=>ts(Uint8Array,e),iJ=e=>ts(Uint16Array,e),oJ=e=>ts(Uint32Array,e),sJ=e=>ts(Float32Array,e),aJ=e=>ts(Float64Array,e),cJ=e=>ts(Uint8ClampedArray,e);function tw(e,t,r){if(e!==0){r=r.slice(0,t);for(let n=-1,i=r.length;++n<i;)r[n]+=e}return r.subarray(0,t)}function YE(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var dn={fromIterable(e){return ew(lJ(e))},fromAsyncIterable(e){return ew(uJ(e))},fromDOMStream(e){return ew(fJ(e))},fromNodeStream(e){return ew(dJ(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')}},ew=e=>(e.next(),e);function*lJ(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?Ci(n,s)[0]:([i,n,a]=Ci(n,s),i)}({cmd:o,size:s}=yield null);let l=jE(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(r=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function uJ(e){return Ve(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Ci(i,a)[0]:([o,i,c]=Ci(i,a),o)}({cmd:s,size:a}=yield yield H(null));let u=qE(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.next()):yield H(u.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&typeof u.throw=="function"&&(yield H(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield H(u.return(new Uint8Array(0))))}return yield H(null)})}function fJ(e){return Ve(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Ci(i,a)[0]:([o,i,c]=Ci(i,a),o)}({cmd:s,size:a}=yield yield H(null));let u=new XE(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.read()):yield H(u.read(a-c)),!r&&o.byteLength>0&&(i.push(Ht(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&(yield H(u.cancel(f)))}finally{n===!1?yield H(u.cancel()):e.locked&&u.releaseLock()}return yield H(null)})}var XE=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 P(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return P(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Ht(r)),r})}},GE=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function dJ(e){return Ve(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Ci(l,a)[0]:([u,l,c]=Ci(l,a),u)}if({cmd:s,size:a}=yield yield H(null),e.isTTY)return yield yield H(new Uint8Array(0)),yield H(null);try{r[0]=GE(e,"end"),r[1]=GE(e,"error");do{if(r[2]=GE(e,"readable"),[n,o]=yield H(Promise.race(r.map(h=>h[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=Ht(e.read(a-c)),u.byteLength<a-c&&(u=Ht(e.read()))):u=Ht(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield H(f()));while(a<c)}while(!i)}finally{yield H(d(r,n==="error"?o:null))}return yield H(null);function d(h,p){return u=l=null,new Promise((m,y)=>{for(let[g,b]of h)e.off(g,b);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var er;(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"})(er||(er={}));var qe;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(qe||(qe={}));var He;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(He||(He={}));var hn;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(hn||(hn={}));var Tt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Tt||(Tt={}));var qn;(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"})(qn||(qn={}));var be;(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"})(be||(be={}));var N;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(N||(N={}));var go;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(go||(go={}));var hD={};Tr(hD,{clampIndex:()=>ntt,clampRange:()=>lg,createElementComparator:()=>Ul});var HE={};Tr(HE,{valueToString:()=>es});function es(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=>es(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var KE={};Tr(KE,{BN:()=>ag,bigNumToBigInt:()=>bU,bigNumToString:()=>gh,isArrowBigNumSymbol:()=>yU});var yU=Symbol.for("isArrowBigNum");function rs(e,...t){return t.length===0?Object.setPrototypeOf(ne(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}rs.prototype[yU]=!0;rs.prototype.toJSON=function(){return`"${gh(this)}"`};rs.prototype.valueOf=function(){return gU(this)};rs.prototype.toString=function(){return gh(this)};rs.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return gU(this);case"string":return gh(this);case"default":return bU(this)}return gh(this)};function mh(...e){return rs.apply(this,e)}function yh(...e){return rs.apply(this,e)}function sg(...e){return rs.apply(this,e)}Object.setPrototypeOf(mh.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(yh.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(sg.prototype,Object.create(Uint32Array.prototype));Object.assign(mh.prototype,rs.prototype,{constructor:mh,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(yh.prototype,rs.prototype,{constructor:yh,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(sg.prototype,rs.prototype,{constructor:sg,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function gU(e){let{buffer:t,byteOffset:r,length:n,signed:i}=e,o=new BigUint64Array(t,r,n),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 gh=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return ZE(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ZE(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${ZE(t)}`},bU=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:gh(e);function ZE(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var ag=class e{static new(t,r){switch(r){case!0:return new mh(t);case!1:return new yh(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new mh(t)}return t.byteLength===16?new sg(t):new yh(t)}static signed(t){return new mh(t)}static unsigned(t){return new yh(t)}static decimal(t){return new sg(t)}constructor(t,r){return e.new(t,r)}};function _i(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 xU,_U,wU,vU,SU,IU,TU,AU,MU,EU,DU,BU,OU,NU,FU,RU,LU,kU,CU,UU,ht=class e{static isNull(t){return t?.typeId===N.Null}static isInt(t){return t?.typeId===N.Int}static isFloat(t){return t?.typeId===N.Float}static isBinary(t){return t?.typeId===N.Binary}static isUtf8(t){return t?.typeId===N.Utf8}static isBool(t){return t?.typeId===N.Bool}static isDecimal(t){return t?.typeId===N.Decimal}static isDate(t){return t?.typeId===N.Date}static isTime(t){return t?.typeId===N.Time}static isTimestamp(t){return t?.typeId===N.Timestamp}static isInterval(t){return t?.typeId===N.Interval}static isDuration(t){return t?.typeId===N.Duration}static isList(t){return t?.typeId===N.List}static isStruct(t){return t?.typeId===N.Struct}static isUnion(t){return t?.typeId===N.Union}static isFixedSizeBinary(t){return t?.typeId===N.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===N.FixedSizeList}static isMap(t){return t?.typeId===N.Map}static isDictionary(t){return t?.typeId===N.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===qe.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===qe.Sparse}get typeId(){return N.NONE}};xU=Symbol.toStringTag;ht[xU]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(ht.prototype);var Yn=class extends ht{toString(){return"Null"}get typeId(){return N.Null}};_U=Symbol.toStringTag;Yn[_U]=(e=>e[Symbol.toStringTag]="Null")(Yn.prototype);var xr=class extends ht{constructor(t,r){super(),this.isSigned=t,this.bitWidth=r}get typeId(){return N.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};wU=Symbol.toStringTag;xr[wU]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(xr.prototype);var rw=class extends xr{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},nw=class extends xr{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Zs=class extends xr{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},iw=class extends xr{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},ow=class extends xr{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},sw=class extends xr{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},aw=class extends xr{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},cw=class extends xr{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(rw.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(nw.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Zs.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(iw.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(ow.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(sw.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(aw.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(cw.prototype,"ArrayType",{value:BigUint64Array});var wi=class extends ht{constructor(t){super(),this.precision=t}get typeId(){return N.Float}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}`}};vU=Symbol.toStringTag;wi[vU]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(wi.prototype);var lw=class extends wi{constructor(){super(He.HALF)}},uw=class extends wi{constructor(){super(He.SINGLE)}},fw=class extends wi{constructor(){super(He.DOUBLE)}};Object.defineProperty(lw.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(uw.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(fw.prototype,"ArrayType",{value:Float64Array});var uc=class extends ht{constructor(){super()}get typeId(){return N.Binary}toString(){return"Binary"}};SU=Symbol.toStringTag;uc[SU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(uc.prototype);var fc=class extends ht{constructor(){super()}get typeId(){return N.Utf8}toString(){return"Utf8"}};IU=Symbol.toStringTag;fc[IU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(fc.prototype);var dc=class extends ht{constructor(){super()}get typeId(){return N.Bool}toString(){return"Bool"}};TU=Symbol.toStringTag;dc[TU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(dc.prototype);var hc=class extends ht{constructor(t,r,n=128){super(),this.scale=t,this.precision=r,this.bitWidth=n}get typeId(){return N.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};AU=Symbol.toStringTag;hc[AU]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(hc.prototype);var pc=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return N.Date}toString(){return`Date${(this.unit+1)*32}<${hn[this.unit]}>`}};MU=Symbol.toStringTag;pc[MU]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(pc.prototype);var ns=class extends ht{constructor(t,r){super(),this.unit=t,this.bitWidth=r}get typeId(){return N.Time}toString(){return`Time${this.bitWidth}<${Tt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};EU=Symbol.toStringTag;ns[EU]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(ns.prototype);var mc=class extends ht{constructor(t,r){super(),this.unit=t,this.timezone=r}get typeId(){return N.Timestamp}toString(){return`Timestamp<${Tt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};DU=Symbol.toStringTag;mc[DU]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(mc.prototype);var yc=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return N.Interval}toString(){return`Interval<${qn[this.unit]}>`}};BU=Symbol.toStringTag;yc[BU]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(yc.prototype);var gc=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return N.Duration}toString(){return`Duration<${Tt[this.unit]}>`}};OU=Symbol.toStringTag;gc[OU]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(gc.prototype);var is=class extends ht{constructor(t){super(),this.children=[t]}get typeId(){return N.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};NU=Symbol.toStringTag;is[NU]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(is.prototype);var Ye=class extends ht{constructor(t){super(),this.children=t}get typeId(){return N.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};FU=Symbol.toStringTag;Ye[FU]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Ye.prototype);var os=class extends ht{constructor(t,r,n){super(),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return N.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};RU=Symbol.toStringTag;os[RU]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(os.prototype);var bc=class extends ht{constructor(t){super(),this.byteWidth=t}get typeId(){return N.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};LU=Symbol.toStringTag;bc[LU]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(bc.prototype);var ss=class extends ht{constructor(t,r){super(),this.listSize=t,this.children=[r]}get typeId(){return N.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};kU=Symbol.toStringTag;ss[kU]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(ss.prototype);var as=class extends ht{constructor(t,r=!1){var n,i,o;if(super(),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return N.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};CU=Symbol.toStringTag;as[CU]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(as.prototype);var hJ=(e=>()=>++e)(-1),Ui=class extends ht{constructor(t,r,n,i){super(),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?hJ():_i(n)}get typeId(){return N.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};UU=Symbol.toStringTag;Ui[UU]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Ui.prototype);function Pi(e){let t=e;switch(e.typeId){case N.Decimal:return e.bitWidth/32;case N.Timestamp:return 2;case N.Date:return 1+t.unit;case N.Interval:return 1+t.unit;case N.FixedSizeList:return t.listSize;case N.FixedSizeBinary:return t.byteWidth;default:return 1}}var mt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return pJ(this,t,r)}getVisitFnByTypeId(t,r=!0){return bh(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function pJ(e,t,r=!0){return typeof t=="number"?bh(e,t,r):typeof t=="string"&&t in N?bh(e,N[t],r):t&&t instanceof ht?bh(e,PU(t),r):t?.type&&t.type instanceof ht?bh(e,PU(t.type),r):bh(e,N.NONE,r)}function bh(e,t,r=!0){let n=null;switch(t){case N.Null:n=e.visitNull;break;case N.Bool:n=e.visitBool;break;case N.Int:n=e.visitInt;break;case N.Int8:n=e.visitInt8||e.visitInt;break;case N.Int16:n=e.visitInt16||e.visitInt;break;case N.Int32:n=e.visitInt32||e.visitInt;break;case N.Int64:n=e.visitInt64||e.visitInt;break;case N.Uint8:n=e.visitUint8||e.visitInt;break;case N.Uint16:n=e.visitUint16||e.visitInt;break;case N.Uint32:n=e.visitUint32||e.visitInt;break;case N.Uint64:n=e.visitUint64||e.visitInt;break;case N.Float:n=e.visitFloat;break;case N.Float16:n=e.visitFloat16||e.visitFloat;break;case N.Float32:n=e.visitFloat32||e.visitFloat;break;case N.Float64:n=e.visitFloat64||e.visitFloat;break;case N.Utf8:n=e.visitUtf8;break;case N.Binary:n=e.visitBinary;break;case N.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case N.Date:n=e.visitDate;break;case N.DateDay:n=e.visitDateDay||e.visitDate;break;case N.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case N.Timestamp:n=e.visitTimestamp;break;case N.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case N.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case N.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case N.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case N.Time:n=e.visitTime;break;case N.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case N.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case N.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case N.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case N.Decimal:n=e.visitDecimal;break;case N.List:n=e.visitList;break;case N.Struct:n=e.visitStruct;break;case N.Union:n=e.visitUnion;break;case N.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case N.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case N.Dictionary:n=e.visitDictionary;break;case N.Interval:n=e.visitInterval;break;case N.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case N.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case N.Duration:n=e.visitDuration;break;case N.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case N.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case N.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case N.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case N.FixedSizeList:n=e.visitFixedSizeList;break;case N.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${N[t]}'`)}function PU(e){switch(e.typeId){case N.Null:return N.Null;case N.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?N.Int8:N.Uint8;case 16:return r?N.Int16:N.Uint16;case 32:return r?N.Int32:N.Uint32;case 64:return r?N.Int64:N.Uint64}return N.Int}case N.Float:switch(e.precision){case He.HALF:return N.Float16;case He.SINGLE:return N.Float32;case He.DOUBLE:return N.Float64}return N.Float;case N.Binary:return N.Binary;case N.Utf8:return N.Utf8;case N.Bool:return N.Bool;case N.Decimal:return N.Decimal;case N.Time:switch(e.unit){case Tt.SECOND:return N.TimeSecond;case Tt.MILLISECOND:return N.TimeMillisecond;case Tt.MICROSECOND:return N.TimeMicrosecond;case Tt.NANOSECOND:return N.TimeNanosecond}return N.Time;case N.Timestamp:switch(e.unit){case Tt.SECOND:return N.TimestampSecond;case Tt.MILLISECOND:return N.TimestampMillisecond;case Tt.MICROSECOND:return N.TimestampMicrosecond;case Tt.NANOSECOND:return N.TimestampNanosecond}return N.Timestamp;case N.Date:switch(e.unit){case hn.DAY:return N.DateDay;case hn.MILLISECOND:return N.DateMillisecond}return N.Date;case N.Interval:switch(e.unit){case qn.DAY_TIME:return N.IntervalDayTime;case qn.YEAR_MONTH:return N.IntervalYearMonth}return N.Interval;case N.Duration:switch(e.unit){case Tt.SECOND:return N.DurationSecond;case Tt.MILLISECOND:return N.DurationMillisecond;case Tt.MICROSECOND:return N.DurationMicrosecond;case Tt.NANOSECOND:return N.DurationNanosecond}return N.Duration;case N.Map:return N.Map;case N.List:return N.List;case N.Struct:return N.Struct;case N.Union:switch(e.mode){case qe.Dense:return N.DenseUnion;case qe.Sparse:return N.SparseUnion}return N.Union;case N.FixedSizeBinary:return N.FixedSizeBinary;case N.FixedSizeList:return N.FixedSizeList;case N.Dictionary:return N.Dictionary}throw new Error(`Unrecognized type '${N[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 QE={};Tr(QE,{float64ToUint16:()=>cg,uint16ToFloat64:()=>dw});var $U=new Float64Array(1),xh=new Uint32Array($U.buffer);function dw(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function cg(e){if(e!==e)return 32256;$U[0]=e;let t=(xh[1]&2147483648)>>16&65535,r=xh[1]&2146435072,n=0;return r>=1089470464?xh[0]>0?r=31744:(r=(r&2080374784)>>16,n=(xh[1]&1048575)>>10):r<=1056964608?(n=1048576+(xh[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(xh[1]&1048575)+512>>10),t|r|n&65535}var kt=class extends mt{};function qt(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var mJ=(e,t,r)=>{e[t]=Math.trunc(r/864e5)},JE=(e,t,r)=>{e[t]=Math.trunc(r%4294967296),e[t+1]=Math.trunc(r/4294967296)},yJ=(e,t,r)=>{e[t]=Math.trunc(r*1e3%4294967296),e[t+1]=Math.trunc(r*1e3/4294967296)},gJ=(e,t,r)=>{e[t]=Math.trunc(r*1e6%4294967296),e[t+1]=Math.trunc(r*1e6/4294967296)},zU=(e,t,r,n)=>{if(r+1<t.length){let{[r]:i,[r+1]:o}=t;e.set(n.subarray(0,o-i),i)}},bJ=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},xc=({values:e},t,r)=>{e[t]=r},tD=({values:e},t,r)=>{e[t]=r},VU=({values:e},t,r)=>{e[t]=cg(r)},xJ=(e,t,r)=>{switch(e.type.precision){case He.HALF:return VU(e,t,r);case He.SINGLE:case He.DOUBLE:return tD(e,t,r)}},hw=({values:e},t,r)=>{mJ(e,t,r.valueOf())},pw=({values:e},t,r)=>{JE(e,t*2,r.valueOf())},eD=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},_J=({values:e,valueOffsets:t},r,n)=>zU(e,t,r,n),wJ=({values:e,valueOffsets:t},r,n)=>{zU(e,t,r,Ll(n))},rD=(e,t,r)=>{e.type.unit===hn.DAY?hw(e,t,r):pw(e,t,r)},mw=({values:e},t,r)=>JE(e,t*2,r/1e3),yw=({values:e},t,r)=>JE(e,t*2,r),gw=({values:e},t,r)=>yJ(e,t*2,r),bw=({values:e},t,r)=>gJ(e,t*2,r),nD=(e,t,r)=>{switch(e.type.unit){case Tt.SECOND:return mw(e,t,r);case Tt.MILLISECOND:return yw(e,t,r);case Tt.MICROSECOND:return gw(e,t,r);case Tt.NANOSECOND:return bw(e,t,r)}},xw=({values:e},t,r)=>{e[t]=r},_w=({values:e},t,r)=>{e[t]=r},ww=({values:e},t,r)=>{e[t]=r},vw=({values:e},t,r)=>{e[t]=r},iD=(e,t,r)=>{switch(e.type.unit){case Tt.SECOND:return xw(e,t,r);case Tt.MILLISECOND:return _w(e,t,r);case Tt.MICROSECOND:return ww(e,t,r);case Tt.NANOSECOND:return vw(e,t,r)}},oD=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},vJ=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=pn.getVisitFn(n);if(Array.isArray(r))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r.get(++s))},SJ=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=pn.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},IJ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),TJ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),AJ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),MJ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),EJ=(e,t,r)=>{let n=e.type.children.map(o=>pn.getVisitFn(o.type)),i=r instanceof Map?AJ(t,r):r instanceof fe?TJ(t,r):Array.isArray(r)?IJ(t,r):MJ(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},DJ=(e,t,r)=>{e.type.mode===qe.Dense?jU(e,t,r):qU(e,t,r)},jU=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];pn.visit(i,e.valueOffsets[t],r)},qU=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];pn.visit(i,t,r)},BJ=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},sD=(e,t,r)=>{e.type.unit===qn.DAY_TIME?Sw(e,t,r):Iw(e,t,r)},Sw=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},Iw=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},Tw=({values:e},t,r)=>{e[t]=r},Aw=({values:e},t,r)=>{e[t]=r},Mw=({values:e},t,r)=>{e[t]=r},Ew=({values:e},t,r)=>{e[t]=r},aD=(e,t,r)=>{switch(e.type.unit){case Tt.SECOND:return Tw(e,t,r);case Tt.MILLISECOND:return Aw(e,t,r);case Tt.MICROSECOND:return Mw(e,t,r);case Tt.NANOSECOND:return Ew(e,t,r)}},OJ=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=pn.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};kt.prototype.visitBool=qt(bJ);kt.prototype.visitInt=qt(xc);kt.prototype.visitInt8=qt(xc);kt.prototype.visitInt16=qt(xc);kt.prototype.visitInt32=qt(xc);kt.prototype.visitInt64=qt(xc);kt.prototype.visitUint8=qt(xc);kt.prototype.visitUint16=qt(xc);kt.prototype.visitUint32=qt(xc);kt.prototype.visitUint64=qt(xc);kt.prototype.visitFloat=qt(xJ);kt.prototype.visitFloat16=qt(VU);kt.prototype.visitFloat32=qt(tD);kt.prototype.visitFloat64=qt(tD);kt.prototype.visitUtf8=qt(wJ);kt.prototype.visitBinary=qt(_J);kt.prototype.visitFixedSizeBinary=qt(eD);kt.prototype.visitDate=qt(rD);kt.prototype.visitDateDay=qt(hw);kt.prototype.visitDateMillisecond=qt(pw);kt.prototype.visitTimestamp=qt(nD);kt.prototype.visitTimestampSecond=qt(mw);kt.prototype.visitTimestampMillisecond=qt(yw);kt.prototype.visitTimestampMicrosecond=qt(gw);kt.prototype.visitTimestampNanosecond=qt(bw);kt.prototype.visitTime=qt(iD);kt.prototype.visitTimeSecond=qt(xw);kt.prototype.visitTimeMillisecond=qt(_w);kt.prototype.visitTimeMicrosecond=qt(ww);kt.prototype.visitTimeNanosecond=qt(vw);kt.prototype.visitDecimal=qt(oD);kt.prototype.visitList=qt(vJ);kt.prototype.visitStruct=qt(EJ);kt.prototype.visitUnion=qt(DJ);kt.prototype.visitDenseUnion=qt(jU);kt.prototype.visitSparseUnion=qt(qU);kt.prototype.visitDictionary=qt(BJ);kt.prototype.visitInterval=qt(sD);kt.prototype.visitIntervalDayTime=qt(Sw);kt.prototype.visitIntervalYearMonth=qt(Iw);kt.prototype.visitDuration=qt(aD);kt.prototype.visitDurationSecond=qt(Tw);kt.prototype.visitDurationMillisecond=qt(Aw);kt.prototype.visitDurationMicrosecond=qt(Mw);kt.prototype.visitDurationNanosecond=qt(Ew);kt.prototype.visitFixedSizeList=qt(OJ);kt.prototype.visitMap=qt(SJ);var pn=new kt;var cs=Symbol.for("parent"),_h=Symbol.for("rowIndex"),kl=class{constructor(t,r){return this[cs]=t,this[_h]=r,new Proxy(this,new lD)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[_h],r=this[cs],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=Or.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${es(t)}: ${es(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new cD(this[cs],this[_h])}},cD=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Or.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(kl.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[cs]:{writable:!0,enumerable:!1,configurable:!1,value:null},[_h]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var lD=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[cs].type.children.map(r=>r.name)}has(t,r){return t[cs].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[cs].type.children.findIndex(n=>n.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[cs].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=Or.visit(t[cs].children[n],t[_h]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[cs].type.children.findIndex(o=>o.name===r);return i!==-1?(pn.visit(t[cs].children[i],t[_h],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}};var Dt=class extends mt{};function $t(e){return(t,r)=>t.getValid(r)?e(t,r):null}var NJ=(e,t)=>864e5*e[t],uD=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),FJ=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,RJ=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,YU=e=>new Date(e),LJ=(e,t)=>YU(NJ(e,t)),kJ=(e,t)=>YU(uD(e,t)),CJ=(e,t)=>null,WU=(e,t,r)=>{if(r+1>=t.length)return null;let n=t[r],i=t[r+1];return e.subarray(n,i)},UJ=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},GU=({values:e},t)=>LJ(e,t),XU=({values:e},t)=>kJ(e,t*2),Cl=({stride:e,values:t},r)=>t[e*r],PJ=({stride:e,values:t},r)=>dw(t[e*r]),HU=({values:e},t)=>e[t],$J=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),zJ=({values:e,valueOffsets:t},r)=>WU(e,t,r),VJ=({values:e,valueOffsets:t},r)=>{let n=WU(e,t,r);return n!==null?ig(n):null},jJ=({values:e},t)=>e[t],qJ=({type:e,values:t},r)=>e.precision!==He.HALF?t[r]:dw(t[r]),YJ=(e,t)=>e.type.unit===hn.DAY?GU(e,t):XU(e,t),ZU=({values:e},t)=>1e3*uD(e,t*2),KU=({values:e},t)=>uD(e,t*2),QU=({values:e},t)=>FJ(e,t*2),JU=({values:e},t)=>RJ(e,t*2),WJ=(e,t)=>{switch(e.type.unit){case Tt.SECOND:return ZU(e,t);case Tt.MILLISECOND:return KU(e,t);case Tt.MICROSECOND:return QU(e,t);case Tt.NANOSECOND:return JU(e,t)}},tP=({values:e},t)=>e[t],eP=({values:e},t)=>e[t],rP=({values:e},t)=>e[t],nP=({values:e},t)=>e[t],GJ=(e,t)=>{switch(e.type.unit){case Tt.SECOND:return tP(e,t);case Tt.MILLISECOND:return eP(e,t);case Tt.MICROSECOND:return rP(e,t);case Tt.NANOSECOND:return nP(e,t)}},XJ=({values:e,stride:t},r)=>ag.decimal(e.subarray(t*r,t*(r+1))),HJ=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,{[t*n]:o,[t*n+1]:s}=r,c=i[0].slice(o,s-o);return new fe([c])},ZJ=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Ks(s.slice(i,o-i))},KJ=(e,t)=>new kl(e,t),QJ=(e,t)=>e.type.mode===qe.Dense?iP(e,t):oP(e,t),iP=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Or.visit(n,e.valueOffsets[t])},oP=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Or.visit(n,t)},JJ=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},ttt=(e,t)=>e.type.unit===qn.DAY_TIME?sP(e,t):aP(e,t),sP=({values:e},t)=>e.subarray(2*t,2*(t+1)),aP=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},cP=({values:e},t)=>e[t],lP=({values:e},t)=>e[t],uP=({values:e},t)=>e[t],fP=({values:e},t)=>e[t],ett=(e,t)=>{switch(e.type.unit){case Tt.SECOND:return cP(e,t);case Tt.MILLISECOND:return lP(e,t);case Tt.MICROSECOND:return uP(e,t);case Tt.NANOSECOND:return fP(e,t)}},rtt=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new fe([o])};Dt.prototype.visitNull=$t(CJ);Dt.prototype.visitBool=$t(UJ);Dt.prototype.visitInt=$t(jJ);Dt.prototype.visitInt8=$t(Cl);Dt.prototype.visitInt16=$t(Cl);Dt.prototype.visitInt32=$t(Cl);Dt.prototype.visitInt64=$t(HU);Dt.prototype.visitUint8=$t(Cl);Dt.prototype.visitUint16=$t(Cl);Dt.prototype.visitUint32=$t(Cl);Dt.prototype.visitUint64=$t(HU);Dt.prototype.visitFloat=$t(qJ);Dt.prototype.visitFloat16=$t(PJ);Dt.prototype.visitFloat32=$t(Cl);Dt.prototype.visitFloat64=$t(Cl);Dt.prototype.visitUtf8=$t(VJ);Dt.prototype.visitBinary=$t(zJ);Dt.prototype.visitFixedSizeBinary=$t($J);Dt.prototype.visitDate=$t(YJ);Dt.prototype.visitDateDay=$t(GU);Dt.prototype.visitDateMillisecond=$t(XU);Dt.prototype.visitTimestamp=$t(WJ);Dt.prototype.visitTimestampSecond=$t(ZU);Dt.prototype.visitTimestampMillisecond=$t(KU);Dt.prototype.visitTimestampMicrosecond=$t(QU);Dt.prototype.visitTimestampNanosecond=$t(JU);Dt.prototype.visitTime=$t(GJ);Dt.prototype.visitTimeSecond=$t(tP);Dt.prototype.visitTimeMillisecond=$t(eP);Dt.prototype.visitTimeMicrosecond=$t(rP);Dt.prototype.visitTimeNanosecond=$t(nP);Dt.prototype.visitDecimal=$t(XJ);Dt.prototype.visitList=$t(HJ);Dt.prototype.visitStruct=$t(KJ);Dt.prototype.visitUnion=$t(QJ);Dt.prototype.visitDenseUnion=$t(iP);Dt.prototype.visitSparseUnion=$t(oP);Dt.prototype.visitDictionary=$t(JJ);Dt.prototype.visitInterval=$t(ttt);Dt.prototype.visitIntervalDayTime=$t(sP);Dt.prototype.visitIntervalYearMonth=$t(aP);Dt.prototype.visitDuration=$t(ett);Dt.prototype.visitDurationSecond=$t(cP);Dt.prototype.visitDurationMillisecond=$t(lP);Dt.prototype.visitDurationMicrosecond=$t(uP);Dt.prototype.visitDurationNanosecond=$t(fP);Dt.prototype.visitFixedSizeList=$t(rtt);Dt.prototype.visitMap=$t(ZJ);var Or=new Dt;var bo=Symbol.for("keys"),wh=Symbol.for("vals"),Ks=class{constructor(t){return this[bo]=new fe([t.children[0]]).memoize(),this[wh]=t.children[1],new Proxy(this,new dD)}[Symbol.iterator](){return new fD(this[bo],this[wh])}get size(){return this[bo].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[bo],r=this[wh],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=Or.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${es(t)}: ${es(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},fD=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Or.visit(this.vals,t)]})}},dD=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[bo].toArray().map(String)}has(t,r){return t[bo].includes(r)}getOwnPropertyDescriptor(t,r){if(t[bo].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[bo].indexOf(r);if(n!==-1){let i=Or.visit(Reflect.get(t,wh),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[bo].indexOf(r);return i!==-1?(pn.visit(Reflect.get(t,wh),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Ks.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[bo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[wh]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function ntt(e,t,r){let n=e.length,i=t>-1?t:n+t%n;return r?r(e,i):i}var dP;function lg(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(dP=o,o=s,s=dP),s>i&&(s=i),n?n(e,o,s):[o,s]}var hP=e=>e!==e;function Ul(e){if(typeof e!=="object"||e===null)return hP(e)?hP:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?YE(e,r):!1:e instanceof Map?ott(e):Array.isArray(e)?itt(e):e instanceof fe?stt(e):att(e,!0)}function itt(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Ul(e[r]);return Dw(t)}function ott(e){let t=-1,r=[];for(let n of e.values())r[++t]=Ul(n);return Dw(r)}function stt(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Ul(e.get(r));return Dw(t)}function att(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Ul(e[r[i]]);return Dw(n,r)}function Dw(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return ctt(e,r);case Map:return pP(e,r,r.keys());case Ks:case kl:case Object:case void 0:return pP(e,r,t||Object.keys(r))}return r instanceof fe?ltt(e,r):!1}}function ctt(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function ltt(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function pP(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=n.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var pD={};Tr(pD,{BitIterator:()=>wf,getBit:()=>mP,getBool:()=>Ow,packBools:()=>Sf,popcnt_array:()=>yP,popcnt_bit_range:()=>ug,popcnt_uint32:()=>Bw,setBool:()=>utt,truncateBitmap:()=>vf});function Ow(e,t,r,n){return(r&1<<n)!==0}function mP(e,t,r,n){return(r&1<<n)>>n}function utt(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function vf(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):Sf(new wf(r,e,t,null,Ow)).subarray(0,n)),i}return r}function Sf(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var wf=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ug(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new wf(e,t,r-t,e,mP))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return ug(e,t,i)+ug(e,n,r)+yP(e,i>>3,n-i>>3)}function yP(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=Bw(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=Bw(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=Bw(o.getUint8(i)),i+=1;return n}function Bw(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 ftt=-1,Be=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 ht.isSparseUnion(t)?this.children.some(r=>r.nullable):ht.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(ht.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=ftt&&(r=this.nullBitmap)&&(this._nullCount=t=this.length-ug(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Pi(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:r}=this;if(ht.isUnion(r)){let n=r,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===qe.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(ht.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===qe.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(vf(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];n=(f&l)!==0,r?o[u]=f|l:o[u]=f&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,r,n,i,o,s,this.dictionary)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===N.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(vf(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[go.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;return(o=s[go.TYPE])&&(s[go.TYPE]=o.subarray(t,t+r)),(o=s[go.OFFSET])&&(s[go.OFFSET]=o.subarray(t,t+r+1))||(o=s[go.DATA])&&(s[go.DATA]=i===6?o:o.subarray(n*t,n*(t+r))),s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};Be.prototype.children=Object.freeze([]);var mD=class e extends mt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new Be(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.data),o=Ht(t.nullBitmap),s=_f(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Be(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.data),o=Ht(t.nullBitmap),s=_f(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Be(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length/Pi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length/Pi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length/Pi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length/Pi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length/Pi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=Ht(t.nullBitmap),s=_f(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Be(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Ht(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=ne(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(ht.isSparseUnion(r))return new Be(r,n,s,a,[void 0,void 0,void 0,o],i);let c=_f(t.valueOffsets);return new Be(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.indices.ArrayType,t.data),{["dictionary"]:s=new fe([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Be(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length/Pi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=Ht(t.nullBitmap),o=ne(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=Ht(t.nullBitmap),{["length"]:s=i.length/Pi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Be(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=Ht(t.nullBitmap),s=_f(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Be(r,n,a,c,[s,void 0,o],[i])}},dtt=new mD;function Zt(e){return dtt.visit(e)}var fg=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Nw(e){return e.reduce((t,r)=>t+r.nullCount,0)}function Fw(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function Rw(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let u=Math.max(0,r-c),f=Math.min(n-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function yD(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function dg(e,t){return e.getValid(t)}function Pl(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return yD(n,this._offsets,r,t)}}function Lw(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=yD(o,this._offsets,n,r);return t=void 0,s}}function kw(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let f=n[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):yD(o,this._offsets,i,r);return t=void 0,s}}var Bt=class extends mt{};function htt(e,t){return t===null&&e.length>0?0:-1}function ptt(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new wf(r,e.offset+(t||0),e.length,r,Ow)){if(!i)return n;++n}return-1}function Kt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case N.Union:break;case N.Dictionary:break;default:return ptt(e,r)}let n=Or.getVisitFn(e),i=Ul(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function gP(e,t,r){let n=Or.getVisitFn(e),i=Ul(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}Bt.prototype.visitNull=htt;Bt.prototype.visitBool=Kt;Bt.prototype.visitInt=Kt;Bt.prototype.visitInt8=Kt;Bt.prototype.visitInt16=Kt;Bt.prototype.visitInt32=Kt;Bt.prototype.visitInt64=Kt;Bt.prototype.visitUint8=Kt;Bt.prototype.visitUint16=Kt;Bt.prototype.visitUint32=Kt;Bt.prototype.visitUint64=Kt;Bt.prototype.visitFloat=Kt;Bt.prototype.visitFloat16=Kt;Bt.prototype.visitFloat32=Kt;Bt.prototype.visitFloat64=Kt;Bt.prototype.visitUtf8=Kt;Bt.prototype.visitBinary=Kt;Bt.prototype.visitFixedSizeBinary=Kt;Bt.prototype.visitDate=Kt;Bt.prototype.visitDateDay=Kt;Bt.prototype.visitDateMillisecond=Kt;Bt.prototype.visitTimestamp=Kt;Bt.prototype.visitTimestampSecond=Kt;Bt.prototype.visitTimestampMillisecond=Kt;Bt.prototype.visitTimestampMicrosecond=Kt;Bt.prototype.visitTimestampNanosecond=Kt;Bt.prototype.visitTime=Kt;Bt.prototype.visitTimeSecond=Kt;Bt.prototype.visitTimeMillisecond=Kt;Bt.prototype.visitTimeMicrosecond=Kt;Bt.prototype.visitTimeNanosecond=Kt;Bt.prototype.visitDecimal=Kt;Bt.prototype.visitList=Kt;Bt.prototype.visitStruct=Kt;Bt.prototype.visitUnion=Kt;Bt.prototype.visitDenseUnion=gP;Bt.prototype.visitSparseUnion=gP;Bt.prototype.visitDictionary=Kt;Bt.prototype.visitInterval=Kt;Bt.prototype.visitIntervalDayTime=Kt;Bt.prototype.visitIntervalYearMonth=Kt;Bt.prototype.visitDuration=Kt;Bt.prototype.visitDurationSecond=Kt;Bt.prototype.visitDurationMillisecond=Kt;Bt.prototype.visitDurationMicrosecond=Kt;Bt.prototype.visitDurationNanosecond=Kt;Bt.prototype.visitFixedSizeList=Kt;Bt.prototype.visitMap=Kt;var If=new Bt;var Ot=class extends mt{};function zt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===N.Timestamp||t instanceof xr&&t.bitWidth!==64||t instanceof ns&&t.bitWidth!==64||t instanceof wi&&t.precision!==He.HALF))return new fg(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new fg(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new gD(s)})}var gD=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}};Ot.prototype.visitNull=zt;Ot.prototype.visitBool=zt;Ot.prototype.visitInt=zt;Ot.prototype.visitInt8=zt;Ot.prototype.visitInt16=zt;Ot.prototype.visitInt32=zt;Ot.prototype.visitInt64=zt;Ot.prototype.visitUint8=zt;Ot.prototype.visitUint16=zt;Ot.prototype.visitUint32=zt;Ot.prototype.visitUint64=zt;Ot.prototype.visitFloat=zt;Ot.prototype.visitFloat16=zt;Ot.prototype.visitFloat32=zt;Ot.prototype.visitFloat64=zt;Ot.prototype.visitUtf8=zt;Ot.prototype.visitBinary=zt;Ot.prototype.visitFixedSizeBinary=zt;Ot.prototype.visitDate=zt;Ot.prototype.visitDateDay=zt;Ot.prototype.visitDateMillisecond=zt;Ot.prototype.visitTimestamp=zt;Ot.prototype.visitTimestampSecond=zt;Ot.prototype.visitTimestampMillisecond=zt;Ot.prototype.visitTimestampMicrosecond=zt;Ot.prototype.visitTimestampNanosecond=zt;Ot.prototype.visitTime=zt;Ot.prototype.visitTimeSecond=zt;Ot.prototype.visitTimeMillisecond=zt;Ot.prototype.visitTimeMicrosecond=zt;Ot.prototype.visitTimeNanosecond=zt;Ot.prototype.visitDecimal=zt;Ot.prototype.visitList=zt;Ot.prototype.visitStruct=zt;Ot.prototype.visitUnion=zt;Ot.prototype.visitDenseUnion=zt;Ot.prototype.visitSparseUnion=zt;Ot.prototype.visitDictionary=zt;Ot.prototype.visitInterval=zt;Ot.prototype.visitIntervalDayTime=zt;Ot.prototype.visitIntervalYearMonth=zt;Ot.prototype.visitDuration=zt;Ot.prototype.visitDurationSecond=zt;Ot.prototype.visitDurationMillisecond=zt;Ot.prototype.visitDurationMicrosecond=zt;Ot.prototype.visitDurationNanosecond=zt;Ot.prototype.visitFixedSizeList=zt;Ot.prototype.visitMap=zt;var vh=new Ot;var mtt=(e,t)=>e+t,Qs=class extends mt{visitNull(t,r){return 0}visitInt(t,r){return t.type.bitWidth/8}visitFloat(t,r){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,r){return 1/8}visitDecimal(t,r){return t.type.bitWidth/8}visitDate(t,r){return(t.type.unit+1)*4}visitTime(t,r){return t.type.bitWidth/8}visitTimestamp(t,r){return t.type.unit===Tt.SECOND?4:8}visitInterval(t,r){return(t.type.unit+1)*4}visitDuration(t,r){return 8}visitStruct(t,r){return t.children.reduce((n,i)=>n+$i.visit(i,r),0)}visitFixedSizeBinary(t,r){return t.type.byteWidth}visitMap(t,r){return 8+t.children.reduce((n,i)=>n+$i.visit(i,r),0)}visitDictionary(t,r){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[r]))||0)}},ytt=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),gtt=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),btt=({valueOffsets:e,stride:t,children:r},n)=>{let i=r[0],{[n*t]:o}=e,{[n*t+1]:s}=e,a=$i.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},xtt=({stride:e,children:t},r)=>{let n=t[0],i=n.slice(r*e,e),o=$i.getVisitFn(n.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},_tt=(e,t)=>e.type.mode===qe.Dense?bP(e,t):xP(e,t),bP=({type:e,children:t,typeIds:r,valueOffsets:n},i)=>{let o=e.typeIdToChildIndex[r[i]];return 8+$i.visit(t[o],n[i])},xP=({children:e},t)=>4+$i.visitMany(e,e.map(()=>t)).reduce(mtt,0);Qs.prototype.visitUtf8=ytt;Qs.prototype.visitBinary=gtt;Qs.prototype.visitList=btt;Qs.prototype.visitFixedSizeList=xtt;Qs.prototype.visitUnion=_tt;Qs.prototype.visitDenseUnion=bP;Qs.prototype.visitSparseUnion=xP;var $i=new Qs;var _P,wP={},vP={},fe=class e{constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof Be)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=wP[s.typeId],f=o[0];this.isValid=d=>dg(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,vP[s.typeId]),this._offsets=Fw(o);break}this.data=o,this.type=s,this.stride=Pi(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullCount(){return Nw(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${N[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}getByteLength(t){return 0}[Symbol.iterator](){return vh.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(lg(this,t,r,({data:n,_offsets:i},o,s)=>Rw(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case N.Int:case N.Float:case N.Decimal:case N.Time:case N.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return ht.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(ht.isDictionary(this.type)){let t=new Cw(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new Cw(this)}unmemoize(){if(ht.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};_P=Symbol.toStringTag;fe[_P]=(e=>{e.type=ht.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(N).map(r=>N[r]).filter(r=>typeof r=="number"&&r!==N.NONE);for(let r of t){let n=Or.getVisitFnByTypeId(r),i=pn.getVisitFnByTypeId(r),o=If.getVisitFnByTypeId(r),s=$i.getVisitFnByTypeId(r);wP[r]={get:n,set:i,indexOf:o,byteLength:s},vP[r]=Object.create(e,{isValid:{value:Pl(dg)},get:{value:Pl(Or.getVisitFnByTypeId(r))},set:{value:Lw(pn.getVisitFnByTypeId(r))},indexOf:{value:kw(If.getVisitFnByTypeId(r))},getByteLength:{value:Pl($i.getVisitFnByTypeId(r))}})}return"Vector"})(fe.prototype);var Cw=class e extends fe{constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new fe(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function SP(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
12
- switch (x) {${r.map(n=>`
13
- case ${wtt(n)}:`).join("")}
14
- return false;
15
- }`),e.length!==r.length&&(t=`if (x !== x) return false;
16
- ${t}`),new Function("x",`${t}
17
- return true;`)}function wtt(e){return typeof e!="bigint"?es(e):`${es(e)}n`}var bD=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,vtt=(e,t=0)=>e.length>=t?e.subarray(0,t):ph(new e.constructor(t),e,0),$l=class{constructor(t,r=1){this.buffer=t,this.stride=r,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/r))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?bD(n*1,this.BYTES_PER_ELEMENT):bD(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=bD(t*this.stride,this.BYTES_PER_ELEMENT);let r=vtt(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=ph(new this.ArrayType(t),this.buffer)}};$l.prototype.offset=0;var _c=class extends $l{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},Sh=class extends _c{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Ih=class extends _c{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var Ze=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Pi(t),this._nulls=new Sh,r&&r.length>0&&(this._isValid=SP(r))}toVector(){return new fe([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(n=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Zt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Ze.prototype.length=1;Ze.prototype.stride=1;Ze.prototype.children=null;Ze.prototype.finished=!1;Ze.prototype.nullValues=null;Ze.prototype._isValid=()=>!0;var Nr=class extends Ze{constructor(t){super(t),this._values=new _c(new this.ArrayType(0),this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Js=class extends Ze{constructor(t){super(t),this._pendingLength=0,this._offsets=new Ih}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Ks?r[bo].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var Tf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}};var qr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}};var zl;(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"})(zl||(zl={}));var Vl;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Vl||(Vl={}));var hg;(function(e){e[e.DenseArray=0]="DenseArray"})(hg||(hg={}));var ls=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}};var ta=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ls).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):hg.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,hg.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var pg=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var mg=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var yg;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(yg||(yg={}));var jl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):yg.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,yg.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}};var ea=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}};var us;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(us||(us={}));var ql=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):us.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,us.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}};var Yl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}};var Wl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}};var gg;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(gg||(gg={}));var Gl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):gg.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,gg.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}};var bg;(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"})(bg||(bg={}));var Xl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):bg.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,bg.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}};var xg=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var Hl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}};var _g=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var wg=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var wc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):us.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,us.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}};var vc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):us.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,us.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}};var vg;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(vg||(vg={}));var fs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):vg.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,vg.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}};var Sg=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var We;(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"})(We||(We={}));var En=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):We.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new ta).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new qr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,We.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var vi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vl.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new qr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Vl.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var zi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):zl.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new vi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Tf).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new Tf).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new qr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,zl.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var Ae=class e{constructor(t=[],r,n,i=er.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=xD(t)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=Uw(Uw(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Uw(Uw(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=xD(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};Ae.prototype.fields=null;Ae.prototype.metadata=null;Ae.prototype.dictionaries=null;var oe=class e{static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};oe.prototype.type=null;oe.prototype.name=null;oe.prototype.nullable=null;oe.prototype.metadata=null;function Uw(e,t){return new Map([...e||new Map,...t||new Map])}function xD(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(ht.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&&xD(o.children,t)}return t}var Stt=Po,Itt=Mr,Sc=class{static decode(t){t=new Itt(Ht(t));let r=zi.getRootAsFooter(t),n=Ae.decode(r.schema(),new Map,r.version());return new _D(n,r)}static encode(t){let r=new Stt,n=Ae.encode(r,t.schema);zi.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Ic.encode(r,s);let i=r.endVector();zi.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Ic.encode(r,s);let o=r.endVector();return zi.startFooter(r),zi.addSchema(r,n),zi.addVersion(r,er.V5),zi.addRecordBatches(r,i),zi.addDictionaries(r,o),zi.finishFooterBuffer(r,zi.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=er.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var _D=class extends Sc{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Ic.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Ic.decode(r)}return null}},Ic=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return Tf.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=_i(n),this.bodyLength=_i(r)}};var Ge=Object.freeze({done:!0,value:void 0}),Ig=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Af=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Pw=class extends Af{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return P(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(Ge);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return dn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return dn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return P(this,void 0,void 0,function*(){return yield this.abort(t),Ge})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),Ge})}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(Ge)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var ra=class extends Pw{write(t){if((t=Ht(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ig(this.toUint8Array(!0)):this.toUint8Array(!1).then(ig)}toUint8Array(t=!1){return t?Ci(this._values)[0]:P(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=fr(this),u;u=yield l.next(),r=u.done,!r;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return Ci(s,a)[0]})}},na=class{constructor(t){t&&(this.source=new wD(dn.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)}},xo=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof ra?this.source=new Tc(dn.fromAsyncIterable(t)):J1(t)?this.source=new Tc(dn.fromNodeStream(t)):og(t)?this.source=new Tc(dn.fromDOMStream(t)):K1(t)?this.source=new Tc(dn.fromDOMStream(t.body)):Jo(t)?this.source=new Tc(dn.fromIterable(t)):Qo(t)?this.source=new Tc(dn.fromAsyncIterable(t)):yo(t)&&(this.source=new Tc(dn.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)}},wD=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Ge)}return(t){return Object.create(this.source.return&&this.source.return(t)||Ge)}},Tc=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return P(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,r="read"){return P(this,void 0,void 0,function*(){return yield this.source.next({cmd:r,size:t})})}throw(t){return P(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||Ge;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return P(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||Ge;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Tg=class extends na{constructor(t,r){super(),this.position=0,this.buffer=Ht(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Zl=class extends xo{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=P(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return P(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return P(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 P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return P(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var SD={};Tr(SD,{BaseInt64:()=>Ag,Int128:()=>Mg,Int64:()=>Ac,Uint64:()=>ar});function Th(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Ah=8,vD=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ag=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Th(this.buffer[1])} ${Th(this.buffer[0])}`}},ar=class e extends Ag{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=Ah<n-o?Ah:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([vD[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Ac=class e extends Ag{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=Ah<i-s?Ah:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([vD[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Mg=class e{constructor(t){this.buffer=t}high(){return new Ac(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ac(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new ar(new Uint32Array([this.buffer[3],0])),n=new ar(new Uint32Array([this.buffer[2],0])),i=new ar(new Uint32Array([this.buffer[1],0])),o=new ar(new Uint32Array([this.buffer[0],0])),s=new ar(new Uint32Array([t.buffer[3],0])),a=new ar(new Uint32Array([t.buffer[2],0])),c=new ar(new Uint32Array([t.buffer[1],0])),l=new ar(new Uint32Array([t.buffer[0],0])),u=ar.multiply(o,l);this.buffer[0]=u.low();let f=new ar(new Uint32Array([u.high(),0]));return u=ar.multiply(i,l),f.plus(u),u=ar.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 ar(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(ar.multiply(n,l)).plus(ar.multiply(i,c)).plus(ar.multiply(o,a)),this.buffer[3]+=ar.multiply(r,l).plus(ar.multiply(n,c)).plus(ar.multiply(i,a)).plus(ar.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Th(this.buffer[3])} ${Th(this.buffer[2])} ${Th(this.buffer[1])} ${Th(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=Ah<i-s?Ah:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([vD[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}};var Eg=class extends mt{constructor(t,r,n,i,o=er.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof oe?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Zt({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<er.V5&&this.readNullBitmap(t,n),t.mode===qe.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Zt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}},$w=class extends Eg{constructor(t,r,n,i,o){super(new Uint8Array(0),r,n,i,o),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Sf(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return ne(Uint8Array,ne(Int32Array,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return ne(Uint8Array,ne(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;return ht.isTimestamp(t)?ne(Uint8Array,Ac.convertArray(n[r])):(ht.isInt(t)||ht.isTime(t))&&t.bitWidth===64||ht.isDuration(t)?ne(Uint8Array,Ac.convertArray(n[r])):ht.isDate(t)&&t.unit===hn.MILLISECOND?ne(Uint8Array,Ac.convertArray(n[r])):ht.isDecimal(t)?ne(Uint8Array,Mg.convertArray(n[r])):ht.isBinary(t)||ht.isFixedSizeBinary(t)?Ttt(n[r]):ht.isBool(t)?Sf(n[r]):ht.isUtf8(t)?Ll(n[r].join("")):ne(Uint8Array,ne(t.ArrayType,n[r].map(i=>+i)))}};function Ttt(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var Mh=class extends Js{constructor(t){super(t),this._values=new $l(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Ht(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var zw=class extends Ze{constructor(t){super(t),this._values=new Sh}setValue(t,r){this._values.set(t,+r)}};var Mf=class extends Nr{};Mf.prototype._setValue=rD;var Dg=class extends Mf{};Dg.prototype._setValue=hw;var Bg=class extends Mf{};Bg.prototype._setValue=pw;var Og=class extends Nr{};Og.prototype._setValue=oD;var Vw=class extends Ze{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new Ui(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ef({type:this.type.indices,nullValues:r}),this.dictionary=Ef({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var Ng=class extends Nr{};Ng.prototype._setValue=eD;var jw=class extends Ze{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=r.length;++o<s;)n.set(i+o,r[o])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new ss(this.type.listSize,new oe(r,t.type,!0)),n}};var Df=class extends Nr{setValue(t,r){this._values.set(t,r)}},qw=class extends Df{setValue(t,r){super.setValue(t,cg(r))}},Yw=class extends Df{},Ww=class extends Df{};var Bf=class extends Nr{};Bf.prototype._setValue=sD;var Fg=class extends Bf{};Fg.prototype._setValue=Sw;var Rg=class extends Bf{};Rg.prototype._setValue=Iw;var Mc=class extends Nr{};Mc.prototype._setValue=aD;var Lg=class extends Mc{};Lg.prototype._setValue=Tw;var kg=class extends Mc{};kg.prototype._setValue=Aw;var Cg=class extends Mc{};Cg.prototype._setValue=Mw;var Ug=class extends Mc{};Ug.prototype._setValue=Ew;var _o=class extends Nr{setValue(t,r){this._values.set(t,r)}},Gw=class extends _o{},Xw=class extends _o{},Hw=class extends _o{},Zw=class extends _o{},Kw=class extends _o{},Qw=class extends _o{},Jw=class extends _o{},tv=class extends _o{};var ev=class extends Js{constructor(t){super(t),this._offsets=new Ih}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new is(new oe(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var rv=class extends Js{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new as(new oe(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var nv=class extends Ze{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var iv=class extends Ze{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Ye([...this.type.children,new oe(r,t.type,!0)]),n}};var Ec=class extends Nr{};Ec.prototype._setValue=nD;var Pg=class extends Ec{};Pg.prototype._setValue=mw;var $g=class extends Ec{};$g.prototype._setValue=yw;var zg=class extends Ec{};zg.prototype._setValue=gw;var Vg=class extends Ec{};Vg.prototype._setValue=bw;var Dc=class extends Nr{};Dc.prototype._setValue=iD;var jg=class extends Dc{};jg.prototype._setValue=xw;var qg=class extends Dc{};qg.prototype._setValue=_w;var Yg=class extends Dc{};Yg.prototype._setValue=ww;var Wg=class extends Dc{};Wg.prototype._setValue=vw;var Eh=class extends Ze{constructor(t){super(t),this._typeIds=new _c(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new oe(r,t.type)];return this.type=new os(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},ov=class extends Eh{},sv=class extends Eh{constructor(t){super(t),this._offsets=new _c(new Int32Array(0))}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r)}};var Gg=class extends Js{constructor(t){super(t),this._values=new $l(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Ll(r))}_flushPending(t,r){}};Gg.prototype._flushPending=Mh.prototype._flushPending;var ID=class extends mt{visitNull(){return nv}visitBool(){return zw}visitInt(){return _o}visitInt8(){return Gw}visitInt16(){return Xw}visitInt32(){return Hw}visitInt64(){return Zw}visitUint8(){return Kw}visitUint16(){return Qw}visitUint32(){return Jw}visitUint64(){return tv}visitFloat(){return Df}visitFloat16(){return qw}visitFloat32(){return Yw}visitFloat64(){return Ww}visitUtf8(){return Gg}visitBinary(){return Mh}visitFixedSizeBinary(){return Ng}visitDate(){return Mf}visitDateDay(){return Dg}visitDateMillisecond(){return Bg}visitTimestamp(){return Ec}visitTimestampSecond(){return Pg}visitTimestampMillisecond(){return $g}visitTimestampMicrosecond(){return zg}visitTimestampNanosecond(){return Vg}visitTime(){return Dc}visitTimeSecond(){return jg}visitTimeMillisecond(){return qg}visitTimeMicrosecond(){return Yg}visitTimeNanosecond(){return Wg}visitDecimal(){return Og}visitList(){return ev}visitStruct(){return iv}visitUnion(){return Eh}visitDenseUnion(){return sv}visitSparseUnion(){return ov}visitDictionary(){return Vw}visitInterval(){return Bf}visitIntervalDayTime(){return Fg}visitIntervalYearMonth(){return Rg}visitDuration(){return Mc}visitDurationSecond(){return Lg}visitDurationMillisecond(){return kg}visitDurationMicrosecond(){return Cg}visistDurationNanosecond(){return Ug}visitFixedSizeList(){return jw}visitMap(){return rv}},IP=new ID;var Nt=class extends mt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function Wn(e,t){return t instanceof e.constructor}function Xg(e,t){return e===t||Wn(e,t)}function Bc(e,t){return e===t||Wn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function av(e,t){return e===t||Wn(e,t)&&e.precision===t.precision}function Att(e,t){return e===t||Wn(e,t)&&e.byteWidth===t.byteWidth}function TD(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function Hg(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Zg(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Mtt(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&ia.compareManyFields(e.children,t.children)}function Ett(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&ia.compareManyFields(e.children,t.children)}function AD(e,t){return e===t||Wn(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&ia.compareManyFields(e.children,t.children)}function Dtt(e,t){return e===t||Wn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&ia.visit(e.indices,t.indices)&&ia.visit(e.dictionary,t.dictionary)}function MD(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function Kg(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function Btt(e,t){return e===t||Wn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&ia.compareManyFields(e.children,t.children)}function Ott(e,t){return e===t||Wn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&ia.compareManyFields(e.children,t.children)}Nt.prototype.visitNull=Xg;Nt.prototype.visitBool=Xg;Nt.prototype.visitInt=Bc;Nt.prototype.visitInt8=Bc;Nt.prototype.visitInt16=Bc;Nt.prototype.visitInt32=Bc;Nt.prototype.visitInt64=Bc;Nt.prototype.visitUint8=Bc;Nt.prototype.visitUint16=Bc;Nt.prototype.visitUint32=Bc;Nt.prototype.visitUint64=Bc;Nt.prototype.visitFloat=av;Nt.prototype.visitFloat16=av;Nt.prototype.visitFloat32=av;Nt.prototype.visitFloat64=av;Nt.prototype.visitUtf8=Xg;Nt.prototype.visitBinary=Xg;Nt.prototype.visitFixedSizeBinary=Att;Nt.prototype.visitDate=TD;Nt.prototype.visitDateDay=TD;Nt.prototype.visitDateMillisecond=TD;Nt.prototype.visitTimestamp=Hg;Nt.prototype.visitTimestampSecond=Hg;Nt.prototype.visitTimestampMillisecond=Hg;Nt.prototype.visitTimestampMicrosecond=Hg;Nt.prototype.visitTimestampNanosecond=Hg;Nt.prototype.visitTime=Zg;Nt.prototype.visitTimeSecond=Zg;Nt.prototype.visitTimeMillisecond=Zg;Nt.prototype.visitTimeMicrosecond=Zg;Nt.prototype.visitTimeNanosecond=Zg;Nt.prototype.visitDecimal=Xg;Nt.prototype.visitList=Mtt;Nt.prototype.visitStruct=Ett;Nt.prototype.visitUnion=AD;Nt.prototype.visitDenseUnion=AD;Nt.prototype.visitSparseUnion=AD;Nt.prototype.visitDictionary=Dtt;Nt.prototype.visitInterval=MD;Nt.prototype.visitIntervalDayTime=MD;Nt.prototype.visitIntervalYearMonth=MD;Nt.prototype.visitDuration=Kg;Nt.prototype.visitDurationSecond=Kg;Nt.prototype.visitDurationMillisecond=Kg;Nt.prototype.visitDurationMicrosecond=Kg;Nt.prototype.visitDurationNanosecond=Kg;Nt.prototype.visitFixedSizeList=Btt;Nt.prototype.visitMap=Ott;var ia=new Nt;function Of(e,t){return ia.compareSchemas(e,t)}function TP(e,t){return ia.compareFields(e,t)}function AP(e,t){return ia.visit(e,t)}function Ef(e){let t=e.type,r=new(IP.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(Ef(Object.assign(Object.assign({},l),{type:c})))}}return r}function cv(e,t){return Ntt(e,t.map(r=>r.data.concat()))}function Ntt(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=Ftt(r,s,u,t,i),s>0&&(n[o++]=Zt({type:new Ye(r),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(r),n.map(f=>new pr(e,f))]}function Ftt(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],u=l?.length;if(u>=t)u===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Zt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var MP,Gn=class e{constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new Ae([]),this._offsets=[0],this;let i,o;t[0]instanceof Ae&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof pr)return[c];if(c instanceof e)return c.batches;if(c instanceof Be){if(c.type instanceof Ye)return[new pr(new Ae(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 fe([c[h]])),f=new Ae(l.map((h,p)=>new oe(String(h),u[p].type))),[,d]=cv(f,u);return d.length===0?[new pr(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new Ae([]),!(i instanceof Ae))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof pr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Of(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Fw(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Nw(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?vh.visit(new fe(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
18
- ${this.toArray().join(`,
19
- `)}
20
- ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new pr(r,i)))}slice(t,r){let n=this.schema;[t,r]=lg({length:this.numRows},t,r);let i=Rw(this.data,this._offsets,t,r);return new e(n,i.map(o=>new pr(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Zt({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new fe(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new fe([Zt({type:new Yn,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=cv(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=r.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...cv(o,s))}};MP=Symbol.toStringTag;Gn[MP]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Pl(dg),e.get=Pl(Or.getVisitFn(N.Struct)),e.set=Lw(pn.getVisitFn(N.Struct)),e.indexOf=kw(If.getVisitFn(N.Struct)),e.getByteLength=Pl($i.getVisitFn(N.Struct)),"Table"))(Gn.prototype);var DP,pr=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Ae))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Zt({nullCount:0,type:new Ye(this.schema.fields),children:this.schema.fields.map(r=>Zt({type:r.type,nullCount:0}))})]=t,!(this.data instanceof Be))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=EP(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,u)=>(c.children[u]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[u]=oe.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new Ae(n),a=Zt({type:new Ye(n),length:o,children:i,nullCount:0});[this.schema,this.data]=EP(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=BP(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 Or.visit(this.data,t)}set(t,r){return pn.visit(this.data,t,r)}indexOf(t,r){return If.visit(this.data,t,r)}getByteLength(t){return $i.visit(this.data,t)}[Symbol.iterator](){return vh.visit(new fe([this.data]))}toArray(){return[...this]}concat(...t){return new Gn(this.schema,[this,...t])}slice(t,r){let[n]=new fe([this.data]).slice(t,r).data;return new e(this.schema,n)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new fe([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new fe([Zt({type:new Yn,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new Ae(o,new Map(this.schema.metadata)),i=Zt({type:new Ye(o),children:s})}return new e(n,i)}select(t){let r=this.schema.select(t),n=new Ye(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Zt({type:n,length:this.numRows,children:i}))}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Zt({type:new Ye(r.fields),length:this.numRows,children:n});return new e(r,i)}};DP=Symbol.toStringTag;pr[DP]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(pr.prototype);function EP(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Zt({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Zt({type:new Ye(i),length:r,children:o})]}function BP(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])BP(a.children,l?.children,r);if(ht.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var Nf=class extends pr{constructor(t){let r=t.fields.map(i=>Zt({type:i.type})),n=Zt({type:new Ye(t.fields),nullCount:0,children:r});super(t,n)}};var Qg;(function(e){e[e.BUFFER=0]="BUFFER"})(Qg||(Qg={}));var Jg;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Jg||(Jg={}));var lv=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Jg.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Qg.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,Jg.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,Qg.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}};var Dh=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Bh=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Vi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Bh).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Dh).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new lv).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Oc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Vi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var Oh;(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"})(Oh||(Oh={}));var ds=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):zl.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Oh.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new qr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,zl.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Oh.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var ED=class extends mt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return _g.startNull(r),_g.endNull(r)}visitInt(t,r){return ls.startInt(r),ls.addBitWidth(r,t.bitWidth),ls.addIsSigned(r,t.isSigned),ls.endInt(r)}visitFloat(t,r){return Gl.startFloatingPoint(r),Gl.addPrecision(r,t.precision),Gl.endFloatingPoint(r)}visitBinary(t,r){return pg.startBinary(r),pg.endBinary(r)}visitBool(t,r){return mg.startBool(r),mg.endBool(r)}visitUtf8(t,r){return Sg.startUtf8(r),Sg.endUtf8(r)}visitDecimal(t,r){return ea.startDecimal(r),ea.addScale(r,t.scale),ea.addPrecision(r,t.precision),ea.addBitWidth(r,t.bitWidth),ea.endDecimal(r)}visitDate(t,r){return jl.startDate(r),jl.addUnit(r,t.unit),jl.endDate(r)}visitTime(t,r){return wc.startTime(r),wc.addUnit(r,t.unit),wc.addBitWidth(r,t.bitWidth),wc.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return vc.startTimestamp(r),vc.addUnit(r,t.unit),n!==void 0&&vc.addTimezone(r,n),vc.endTimestamp(r)}visitInterval(t,r){return Xl.startInterval(r),Xl.addUnit(r,t.unit),Xl.endInterval(r)}visitDuration(t,r){return ql.startDuration(r),ql.addUnit(r,t.unit),ql.endDuration(r)}visitList(t,r){return xg.startList(r),xg.endList(r)}visitStruct(t,r){return wg.startStruct_(r),wg.endStruct_(r)}visitUnion(t,r){fs.startTypeIdsVector(r,t.typeIds.length);let n=fs.createTypeIdsVector(r,t.typeIds);return fs.startUnion(r),fs.addMode(r,t.mode),fs.addTypeIds(r,n),fs.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return ta.startDictionaryEncoding(r),ta.addId(r,BigInt(t.id)),ta.addIsOrdered(r,t.isOrdered),n!==void 0&&ta.addIndexType(r,n),ta.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return Yl.startFixedSizeBinary(r),Yl.addByteWidth(r,t.byteWidth),Yl.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Wl.startFixedSizeList(r),Wl.addListSize(r,t.listSize),Wl.endFixedSizeList(r)}visitMap(t,r){return Hl.startMap(r),Hl.addKeysSorted(r,t.keysSorted),Hl.endMap(r)}},uv=new ED;function RP(e,t=new Map){return new Ae(Ltt(e,t),fv(e.metadata),t)}function DD(e){return new mn(e.count,kP(e.columns),CP(e.columns))}function LP(e){return new Ii(DD(e.data),e.id,e.isDelta)}function Ltt(e,t){return(e.fields||[]).filter(Boolean).map(r=>oe.fromJSON(r,t))}function OP(e,t){return(e.children||[]).filter(Boolean).map(r=>oe.fromJSON(r,t))}function kP(e){return(e||[]).reduce((t,r)=>[...t,new wo(r.count,ktt(r.VALIDITY)),...kP(r.children)],[])}function CP(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new Si(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Si(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Si(t.length,i.OFFSET.length)),i.DATA&&t.push(new Si(t.length,i.DATA.length)),t=CP(i.children,t)}return t}function ktt(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function UP(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=FP(e,OP(e,t)),i=new oe(e.name,s,e.nullable,fv(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?NP(n):new Zs,a=new Ui(t.get(r),n,r,o.isOrdered),i=new oe(e.name,a,e.nullable,fv(e.metadata))):(n=(n=o.indexType)?NP(n):new Zs,t.set(r,s=FP(e,OP(e,t))),a=new Ui(s,n,r,o.isOrdered),i=new oe(e.name,a,e.nullable,fv(e.metadata))),i||null}function fv(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function NP(e){return new xr(e.isSigned,e.bitWidth)}function FP(e,t){let r=e.type.name;switch(r){case"NONE":return new Yn;case"null":return new Yn;case"binary":return new uc;case"utf8":return new fc;case"bool":return new dc;case"list":return new is((t||[])[0]);case"struct":return new Ye(t||[]);case"struct_":return new Ye(t||[])}switch(r){case"int":{let n=e.type;return new xr(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new wi(He[n.precision])}case"decimal":{let n=e.type;return new hc(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new pc(hn[n.unit])}case"time":{let n=e.type;return new ns(Tt[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new mc(Tt[n.unit],n.timezone)}case"interval":{let n=e.type;return new yc(qn[n.unit])}case"duration":{let n=e.type;return new gc(Tt[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new os(qe[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new bc(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new ss(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new as((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var Ctt=Po,Utt=Mr,Ti=class e{static fromJSON(t,r){let n=new e(0,er.V5,r);return n._createHeader=Ptt(t,r),n}static decode(t){t=new Utt(Ht(t));let r=ds.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=$tt(r,o),s}static encode(t){let r=new Ctt,n=-1;return t.isSchema()?n=Ae.encode(r,t.header()):t.isRecordBatch()?n=mn.encode(r,t.header()):t.isDictionaryBatch()&&(n=Ii.encode(r,t.header())),ds.startMessage(r),ds.addVersion(r,er.V5),ds.addHeader(r,n),ds.addHeaderType(r,t.headerType),ds.addBodyLength(r,BigInt(t.bodyLength)),ds.finishMessageBuffer(r,ds.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof Ae)return new e(0,er.V5,be.Schema,t);if(t instanceof mn)return new e(r,er.V5,be.RecordBatch,t);if(t instanceof Ii)return new e(r,er.V5,be.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===be.Schema}isRecordBatch(){return this.headerType===be.RecordBatch}isDictionaryBatch(){return this.headerType===be.DictionaryBatch}constructor(t,r,n,i){this._version=r,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=_i(t)}},mn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=_i(t)}},Ii=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=_i(r)}},Si=class{constructor(t,r){this.offset=_i(t),this.length=_i(r)}},wo=class{constructor(t,r){this.length=_i(t),this.nullCount=_i(r)}};function Ptt(e,t){return()=>{switch(t){case be.Schema:return Ae.fromJSON(e);case be.RecordBatch:return mn.fromJSON(e);case be.DictionaryBatch:return Ii.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${be[t]}, type: ${t} }`)}}function $tt(e,t){return()=>{switch(t){case be.Schema:return Ae.decode(e.header(new vi),new Map,e.version());case be.RecordBatch:return mn.decode(e.header(new Vi),e.version());case be.DictionaryBatch:return Ii.decode(e.header(new Oc),e.version())}throw new Error(`Unrecognized Message type: { name: ${be[t]}, type: ${t} }`)}}oe.encode=Ktt;oe.decode=Htt;oe.fromJSON=UP;Ae.encode=Ztt;Ae.decode=ztt;Ae.fromJSON=RP;mn.encode=Qtt;mn.decode=Vtt;mn.fromJSON=DD;Ii.encode=Jtt;Ii.decode=jtt;Ii.fromJSON=LP;wo.encode=tet;wo.decode=Ytt;Si.encode=eet;Si.decode=qtt;function ztt(e,t=new Map,r=er.V5){let n=Xtt(e,t);return new Ae(n,dv(e),t,r)}function Vtt(e,t=er.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new mn(e.length(),Wtt(e),Gtt(e,t))}function jtt(e,t=er.V5){return new Ii(mn.decode(e.data(),t),e.id(),e.isDelta())}function qtt(e){return new Si(e.offset(),e.length())}function Ytt(e){return new wo(e.length(),e.nullCount())}function Wtt(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=wo.decode(r));return t}function Gtt(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<er.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Si.decode(n));return r}function Xtt(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=oe.decode(n,t));return r}function PP(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=oe.decode(n,t));return r}function Htt(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=zP(e,PP(e,t)),n=new oe(e.name(),i,e.nullable(),dv(e))):t.has(r=_i(a.id()))?(o=(o=a.indexType())?$P(o):new Zs,s=new Ui(t.get(r),o,r,a.isOrdered()),n=new oe(e.name(),s,e.nullable(),dv(e))):(o=(o=a.indexType())?$P(o):new Zs,t.set(r,i=zP(e,PP(e,t))),s=new Ui(i,o,r,a.isOrdered()),n=new oe(e.name(),s,e.nullable(),dv(e))),n||null}function dv(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function $P(e){return new xr(e.isSigned(),e.bitWidth())}function zP(e,t){let r=e.typeType();switch(r){case We.NONE:return new Yn;case We.Null:return new Yn;case We.Binary:return new uc;case We.Utf8:return new fc;case We.Bool:return new dc;case We.List:return new is((t||[])[0]);case We.Struct_:return new Ye(t||[])}switch(r){case We.Int:{let n=e.type(new ls);return new xr(n.isSigned(),n.bitWidth())}case We.FloatingPoint:{let n=e.type(new Gl);return new wi(n.precision())}case We.Decimal:{let n=e.type(new ea);return new hc(n.scale(),n.precision(),n.bitWidth())}case We.Date:{let n=e.type(new jl);return new pc(n.unit())}case We.Time:{let n=e.type(new wc);return new ns(n.unit(),n.bitWidth())}case We.Timestamp:{let n=e.type(new vc);return new mc(n.unit(),n.timezone())}case We.Interval:{let n=e.type(new Xl);return new yc(n.unit())}case We.Duration:{let n=e.type(new ql);return new gc(n.unit())}case We.Union:{let n=e.type(new fs);return new os(n.mode(),n.typeIdsArray()||[],t||[])}case We.FixedSizeBinary:{let n=e.type(new Yl);return new bc(n.byteWidth())}case We.FixedSizeList:{let n=e.type(new Wl);return new ss(n.listSize(),(t||[])[0])}case We.Map:{let n=e.type(new Hl);return new as((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${We[r]}" (${r})`)}function Ztt(e,t){let r=t.fields.map(o=>oe.encode(e,o));vi.startFieldsVector(e,r.length);let n=vi.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?vi.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return qr.startKeyValue(e),qr.addKey(e,a),qr.addValue(e,c),qr.endKeyValue(e)})):-1;return vi.startSchema(e),vi.addFields(e,n),vi.addEndianness(e,ret?Vl.Little:Vl.Big),i!==-1&&vi.addCustomMetadata(e,i),vi.endSchema(e)}function Ktt(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;ht.isDictionary(o)?(s=o.dictionary.typeId,i=uv.visit(o,e),n=uv.visit(o.dictionary,e)):n=uv.visit(o,e);let a=(o.children||[]).map(u=>oe.encode(e,u)),c=En.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?En.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return qr.startKeyValue(e),qr.addKey(e,d),qr.addValue(e,h),qr.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),En.startField(e),En.addType(e,n),En.addTypeType(e,s),En.addChildren(e,c),En.addNullable(e,!!t.nullable),r!==-1&&En.addName(e,r),i!==-1&&En.addDictionary(e,i),l!==-1&&En.addCustomMetadata(e,l),En.endField(e)}function Qtt(e,t){let r=t.nodes||[],n=t.buffers||[];Vi.startNodesVector(e,r.length);for(let s of r.slice().reverse())wo.encode(e,s);let i=e.endVector();Vi.startBuffersVector(e,n.length);for(let s of n.slice().reverse())Si.encode(e,s);let o=e.endVector();return Vi.startRecordBatch(e),Vi.addLength(e,BigInt(t.length)),Vi.addNodes(e,i),Vi.addBuffers(e,o),Vi.endRecordBatch(e)}function Jtt(e,t){let r=mn.encode(e,t.data);return Oc.startDictionaryBatch(e),Oc.addId(e,BigInt(t.id)),Oc.addIsDelta(e,t.isDelta),Oc.addData(e,r),Oc.endDictionaryBatch(e)}function tet(e,t){return Bh.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function eet(e,t){return Dh.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var ret=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var OD=e=>`Expected ${be[e]} Message in stream, but was null or length 0.`,ND=e=>`Header pointer of flatbuffer-encoded ${be[e]} Message is null or length 0.`,VP=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,jP=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Nh=class{constructor(t){this.source=t instanceof na?t:new na(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Ge:t.value===-1&&(t=this.readMetadataLength()).done?Ge:(t=this.readMetadata(t.value)).done?Ge:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(OD(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=Ht(this.source.read(t));if(r.byteLength<t)throw new Error(jP(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=be.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(ND(r));return i}readMetadataLength(){let t=this.source.read(hv),r=t&&new Mr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return Ge;if(r.byteLength<t)throw new Error(VP(t,r.byteLength));return{done:!1,value:Ti.decode(r)}}},t0=class{constructor(t,r){this.source=t instanceof xo?t:Z1(t)?new Zl(t,r):new xo(t)}[Symbol.asyncIterator](){return this}next(){return P(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Ge:t.value===-1&&(t=yield this.readMetadataLength()).done?Ge:(t=yield this.readMetadata(t.value)).done?Ge:t})}throw(t){return P(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return P(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return P(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(OD(t));return r.value})}readMessageBody(t){return P(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=Ht(yield this.source.read(t));if(r.byteLength<t)throw new Error(jP(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(t=!1){return P(this,void 0,void 0,function*(){let r=be.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(ND(r));return i})}readMetadataLength(){return P(this,void 0,void 0,function*(){let t=yield this.source.read(hv),r=t&&new Mr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return P(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return Ge;if(r.byteLength<t)throw new Error(VP(t,r.byteLength));return{done:!1,value:Ti.decode(r)}})}},e0=class extends Nh{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ig?t:new Ig(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Ti.fromJSON(t.schema,be.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Ti.fromJSON(r,be.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Ti.fromJSON(r,be.RecordBatch)}}return this._body=[],Ge}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(OD(t));return r.value}readSchema(){let t=be.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(ND(t));return n}},hv=4,BD="ARROW1",Fh=new Uint8Array(BD.length);for(let e=0;e<BD.length;e+=1)Fh[e]=BD.codePointAt(e);function pv(e,t=0){for(let r=-1,n=Fh.length;++r<n;)if(Fh[r]!==e[t+r])return!1;return!0}var Rh=Fh.length,FD=Rh+hv,qP=Rh*2+hv;var yn=class e extends Af{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Qo(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return dn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return dn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:X1(t)?iet(t):Z1(t)?aet(t):Qo(t)?P(this,void 0,void 0,function*(){return yield e.from(yield t)}):K1(t)||og(t)||J1(t)||yo(t)?set(new xo(t)):oet(new na(t))}static readAll(t){return t instanceof e?t.isSync()?YP(t):WP(t):X1(t)||ArrayBuffer.isView(t)||Jo(t)||H1(t)?YP(t):WP(t)}},oa=class extends yn{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ve(this,arguments,function*(){yield H(yield*to(fr(this[Symbol.iterator]())))})}},Kl=class extends yn{constructor(t){super(t),this._impl=t}readAll(){var t,r,n,i;return P(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=fr(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Ql=class extends oa{constructor(t){super(t),this._impl=t}},r0=class extends Kl{constructor(t){super(t),this._impl=t}},mv=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let n=this._loadVectors(t,r,this.schema.fields),i=Zt({type:new Ye(this.schema.fields),length:t.length,children:n});return new pr(this.schema,i)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n);if(i||!a){let c=s.dictionaries.get(n),l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new fe(l)):new fe(l)).memoize()}return a.memoize()}_loadVectors(t,r,n){return new Eg(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Lh=class extends mv{constructor(t,r){super(r),this._reader=X1(t)?new e0(this._handle=t):new Nh(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=GP(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):Ge}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Ge}next(){if(this.closed)return Ge;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Nf(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},kh=class extends mv{constructor(t,r){super(r),this._reader=new t0(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return P(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 P(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=GP(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Ge})}return(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Ge})}next(){return P(this,void 0,void 0,function*(){if(this.closed)return Ge;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Nf(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},yv=class extends Lh{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Tg?t:new Tg(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(be.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(be.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-FD,n=t.readInt32(r),i=t.readAt(r-n,n);return Sc.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},RD=class extends kh{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Zl?t:new Zl(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return P(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){var r;return P(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(be.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 r;return P(this,void 0,void 0,function*(){let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(be.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 P(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-FD,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return Sc.decode(i)})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},LD=class extends Lh{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new $w(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function GP(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*YP(e){let t=yn.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function WP(e){return Ve(this,arguments,function*(){let r=yield H(yn.from(e));try{if(!(yield H(r.open({autoDestroy:!1}))).closed)do yield yield H(r);while(!(yield H(r.reset().open())).closed)}finally{yield H(r.cancel())}})}function iet(e){return new oa(new LD(e))}function oet(e){let t=e.peek(Rh+7&-8);return t&&t.byteLength>=4?pv(t)?new Ql(new yv(e.read())):new oa(new Lh(e)):new oa(new Lh(function*(){}()))}function set(e){return P(this,void 0,void 0,function*(){let t=yield e.peek(Rh+7&-8);return t&&t.byteLength>=4?pv(t)?new Ql(new yv(yield e.read())):new Kl(new kh(e)):new Kl(new kh(function(){return Ve(this,arguments,function*(){})}()))})}function aet(e){return P(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Zl(e,t);return t>=qP&&pv(yield r.readAt(0,Rh+7&-8))?new r0(new RD(r)):new Kl(new kh(r))})}var mr=class e extends mt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof pr?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof fe)return this.visitMany(t.data),this;let{type:r}=t;if(!ht.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(ht.isUnion(r))this.nodes.push(new wo(n,0));else{let{nullCount:i}=t;ht.isNull(r)||hs.call(this,i<=0?new Uint8Array(0):vf(t.offset,n,t.nullBitmap)),this.nodes.push(new wo(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function hs(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Si(this._byteLength,t)),this._byteLength+=t,this}function cet(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(hs.call(this,i),r.mode===qe.Sparse)return kD.call(this,e);if(r.mode===qe.Dense){if(e.offset<=0)return hs.call(this,o),kD.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);hs.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=r.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(n,h))}))}}return this}function uet(e){let t;return e.nullCount>=e.length?hs.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?hs.call(this,vf(e.offset,e.length,t)):hs.call(this,Sf(e.values))}function Nc(e){return hs.call(this,e.values.subarray(0,e.length*e.stride))}function XP(e){let{length:t,values:r,valueOffsets:n}=e,{[0]:i,[t]:o}=n,s=Math.min(o-i,r.byteLength-i);return hs.call(this,tw(-i,t+1,n)),hs.call(this,r.subarray(i,i+s)),this}function CD(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return hs.call(this,tw(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function kD(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}mr.prototype.visitBool=uet;mr.prototype.visitInt=Nc;mr.prototype.visitFloat=Nc;mr.prototype.visitUtf8=XP;mr.prototype.visitBinary=XP;mr.prototype.visitFixedSizeBinary=Nc;mr.prototype.visitDate=Nc;mr.prototype.visitTimestamp=Nc;mr.prototype.visitTime=Nc;mr.prototype.visitDecimal=Nc;mr.prototype.visitList=CD;mr.prototype.visitStruct=kD;mr.prototype.visitUnion=cet;mr.prototype.visitInterval=Nc;mr.prototype.visitDuration=Nc;mr.prototype.visitFixedSizeList=CD;mr.prototype.visitMap=CD;var Ff=class extends Af{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new ra,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,jn(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 Qo(t)?t.then(r=>this.writeAll(r)):yo(t)?PD(this,t):UD(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof ra?this._sink=t:(this._sink=new ra,t&&hU(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&pU(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,(!r||!Of(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Gn&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof pr&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Of(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof pr?t instanceof Nf||this._writeRecordBatch(t):t instanceof Gn?this.writeAll(t.batches):Jo(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Ti.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===be.RecordBatch?this._recordBatchBlocks.push(new Ic(a,t.bodyLength,this._position)):t.headerType===be.DictionaryBatch&&this._dictionaryBlocks.push(new Ic(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=Ht(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Ti.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Fh)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=mr.assemble(t),s=new mn(t.numRows,n,i),a=Ti.from(s,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,r,n=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=mr.assemble(new fe([t])),c=new mn(t.length,o,s),l=new Ii(c,r,n),u=Ti.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,n,i;for(let o=-1,s=t.length;++o<s;)(r=t[o])&&(n=r.byteLength)>0&&(this._write(r),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[r,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(r)||0;if(i===0||(n=n?.slice(i)).length>0)for(let o of n.data)this._writeDictionaryBatch(o,r,i>0),i+=o.length}return this}},Rf=class e extends Ff{static writeAll(t,r){let n=new e(r);return Qo(t)?t.then(i=>n.writeAll(i)):yo(t)?PD(n,t):UD(n,t)}},Lf=class e extends Ff{static writeAll(t){let r=new e;return Qo(t)?t.then(n=>r.writeAll(n)):yo(t)?PD(r,t):UD(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let r=Sc.encode(new Sc(t,er.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function UD(e,t){let r=t;t instanceof Gn&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function PD(e,t){var r,n,i,o,s,a,c;return P(this,void 0,void 0,function*(){try{for(r=!0,n=fr(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function HP(e,t){if(yo(e))return det(e,t);if(Jo(e))return fet(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function fet(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ht(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function det(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return P(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return P(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return P(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return P(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ht(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function QP(e){return new $D(e)}var $D=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=h_(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ef(o),this._getSize=i!=="bytes"?ZP:KP;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?ZP:KP}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},ZP=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},KP=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function gv(e,t){let r=new ra,n=null,i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield r.close()})},start(a){return P(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return P(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return P(this,void 0,void 0,function*(){return yield(yield yn.from(r)).open(t)})}function s(a,c){return P(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 bv(e,t){let r=new this(e),n=new xo(r),i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return P(this,void 0,void 0,function*(){yield o(s)})},start(s){return P(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return P(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function xv(e,t="stream"){return(t==="stream"?Rf:Lf).writeAll(e).toUint8Array(!0)}var yet=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},KE),SD),pD),QE),WE),hD),HE),{compareSchemas:Of,compareFields:TP,compareTypes:AP});dn.toDOMStream=HP;Ze.throughDOM=QP;yn.throughDOM=gv;Ql.throughDOM=gv;oa.throughDOM=gv;Ff.throughDOM=bv;Lf.throughDOM=bv;Rf.throughDOM=bv;var get=Object.create,t7=Object.defineProperty,bet=Object.getOwnPropertyDescriptor,xet=Object.getOwnPropertyNames,_et=Object.getPrototypeOf,wet=Object.prototype.hasOwnProperty,vet=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Iet=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xet(t))!wet.call(e,i)&&i!==r&&t7(e,i,{get:()=>t[i],enumerable:!(n=bet(t,i))||n.enumerable});return e},Tet=(e,t,r)=>(r=e!=null?get(_et(e)):{},Iet(t||!e||!e.__esModule?t7(r,"default",{value:e,enumerable:!0}):r,e)),Aet=vet((e,t)=>{t.exports=Worker}),Met=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(Met||{}),Eet=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(Eet||{}),Det=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(Det||{}),Bet=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(Bet||{}),Oet=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(Oet||{}),Net=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(Net||{}),e7=class{log(e){}},r7=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var Fet=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(Fet||{}),Ret=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),r=yn.from(t);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new Gn(r)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let r=new n7(this._bindings,this._conn,t),n=await yn.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new Let(this._bindings,this._conn,t)}async insertArrowTable(e,t){let r=xv(e,"stream");await this.insertArrowFromIPCStream(r,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},n7=class{constructor(e,t,r){this.db=e,this.conn=t,this.header=r,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},Let=class{constructor(e,t,r){this.bindings=e,this.connectionId=t,this.statementId=r}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),r=yn.from(t);return console.assert(r.isSync()),console.assert(r.isFile()),new Gn(r)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new n7(this.bindings,this.connectionId,t),n=await yn.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},ket=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(ket||{}),Cet=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(Cet||{}),xe=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((r,n)=>{this.promiseResolver=r,this.promiseRejecter=n})}};function _v(e){switch(e.typeId){case N.Binary:return{sqlType:"binary"};case N.Bool:return{sqlType:"bool"};case N.Date:return{sqlType:"date"};case N.DateDay:return{sqlType:"date32[d]"};case N.DateMillisecond:return{sqlType:"date64[ms]"};case N.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case N.Float:return{sqlType:"float"};case N.Float16:return{sqlType:"float16"};case N.Float32:return{sqlType:"float32"};case N.Float64:return{sqlType:"float64"};case N.Int:return{sqlType:"int32"};case N.Int16:return{sqlType:"int16"};case N.Int32:return{sqlType:"int32"};case N.Int64:return{sqlType:"int64"};case N.Uint16:return{sqlType:"uint16"};case N.Uint32:return{sqlType:"uint32"};case N.Uint64:return{sqlType:"uint64"};case N.Uint8:return{sqlType:"uint8"};case N.IntervalDayTime:return{sqlType:"interval[dt]"};case N.IntervalYearMonth:return{sqlType:"interval[m]"};case N.List:return{sqlType:"list",valueType:_v(e.valueType)};case N.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case N.Null:return{sqlType:"null"};case N.Utf8:return{sqlType:"utf8"};case N.Struct:return{sqlType:"struct",fields:e.children.map(t=>WD(t.name,t.type))};case N.Map:{let t=e;return{sqlType:"map",keyType:_v(t.keyType),valueType:_v(t.valueType)}}case N.Time:return{sqlType:"time[s]"};case N.TimeMicrosecond:return{sqlType:"time[us]"};case N.TimeMillisecond:return{sqlType:"time[ms]"};case N.TimeNanosecond:return{sqlType:"time[ns]"};case N.TimeSecond:return{sqlType:"time[s]"};case N.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case N.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case N.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case N.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case N.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function WD(e,t){let r=_v(t);return r.name=e,r}var Uet=new TextEncoder,i7=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,r)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let r=this._nextMessageId++;return this._pendingRequests.set(r,e),this._worker.postMessage({messageId:r,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let r=e.data;switch(r.type){case"LOG":{this._logger.log(r.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(r.data);return}}let n=this._pendingRequests.get(r.requestId);if(!n){console.warn("unassociated response: [".concat(r.requestId,", ").concat(r.type.toString(),"]"));return}if(this._pendingRequests.delete(r.requestId),r.type=="ERROR"){let i=new Error(r.data.message);i.name=r.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=r.data.stack),n.promiseRejecter(i);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(r.type=="OK"){n.promiseResolver(r.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],r.type=="OK"){n.promiseResolver(r.data);return}break;case"GLOB_FILE_INFOS":if(r.type=="FILE_INFOS"){n.promiseResolver(r.data);return}break;case"GET_VERSION":if(r.type=="VERSION_STRING"){n.promiseResolver(r.data);return}break;case"GET_FEATURE_FLAGS":if(r.type=="FEATURE_FLAGS"){n.promiseResolver(r.data);return}break;case"GET_TABLE_NAMES":if(r.type=="TABLE_NAMES"){n.promiseResolver(r.data);return}break;case"TOKENIZE":if(r.type=="SCRIPT_TOKENS"){n.promiseResolver(r.data);return}break;case"COPY_FILE_TO_BUFFER":if(r.type=="FILE_BUFFER"){n.promiseResolver(r.data);return}break;case"EXPORT_FILE_STATISTICS":if(r.type=="FILE_STATISTICS"){n.promiseResolver(r.data);return}break;case"CONNECT":if(r.type=="CONNECTION_INFO"){n.promiseResolver(r.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(r.type=="QUERY_RESULT"){n.promiseResolver(r.data);return}break;case"SEND_PREPARED":if(r.type=="QUERY_RESULT_HEADER"){n.promiseResolver(r.data);return}break;case"START_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"POLL_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],r.type=="SUCCESS"){n.promiseResolver(r.data);return}break;case"FETCH_QUERY_RESULTS":if(r.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(r.data);return}break;case"CREATE_PREPARED":if(r.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(r.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(r.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new xe("RESET",null);return await this.postTask(e)}async ping(){let e=new xe("PING",null);await this.postTask(e)}async dropFile(e){let t=new xe("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new xe("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new xe("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,r=n=>{}){this._onInstantiationProgress.push(r);let n=new xe("INSTANTIATE",[e,t]);return await this.postTask(n)}async getVersion(){let e=new xe("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new xe("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new xe("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new xe("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new xe("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new Ret(this,e)}async disconnect(e){let t=new xe("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let r=new xe("RUN_QUERY",[e,t]);return await this.postTask(r)}async startPendingQuery(e,t){let r=new xe("START_PENDING_QUERY",[e,t]);return await this.postTask(r)}async pollPendingQuery(e){let t=new xe("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new xe("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new xe("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let r=new xe("GET_TABLE_NAMES",[e,t]);return await this.postTask(r)}async createPrepared(e,t){let r=new xe("CREATE_PREPARED",[e,t]);return await this.postTask(r)}async closePrepared(e,t){let r=new xe("CLOSE_PREPARED",[e,t]);await this.postTask(r)}async runPrepared(e,t,r){let n=new xe("RUN_PREPARED",[e,t,r]);return await this.postTask(n)}async sendPrepared(e,t,r){let n=new xe("SEND_PREPARED",[e,t,r]);return await this.postTask(n)}async globFiles(e){let t=new xe("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let r=Uet.encode(t);await this.registerFileBuffer(e,r)}async registerFileURL(e,t,r,n){t===void 0&&(t=e);let i=new xe("REGISTER_FILE_URL",[e,t,r,n]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new xe("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let r=new xe("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(r,[t.buffer])}async registerFileHandle(e,t,r,n){let i=new xe("REGISTER_FILE_HANDLE",[e,t,r,n]);await this.postTask(i,[])}async collectFileStatistics(e,t){let r=new xe("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(r,[])}async exportFileStatistics(e){let t=new xe("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new xe("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let r=new xe("COPY_FILE_TO_PATH",[e,t]);await this.postTask(r)}async insertArrowFromIPCStream(e,t,r){if(t.length==0)return;let n=new xe("INSERT_ARROW_FROM_IPC_STREAM",[e,t,r]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(WD(o,s))}r.columnsFlat=i,delete r.columns}let n=new xe("IMPORT_CSV_FROM_PATH",[e,t,r]);await this.postTask(n)}async insertJSONFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(WD(o,s))}r.columnsFlat=i,delete r.columns}let n=new xe("IMPORT_JSON_FROM_PATH",[e,t,r]);await this.postTask(n)}};var Pet=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),$et=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),zet=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Vet=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),GD={name:"@duckdb/duckdb-wasm",version:"1.28.1-dev99.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^14.0.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.18.0","@typescript-eslint/parser":"^6.18.0",esbuild:"^0.19.10",eslint:"^8.56.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.10.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.2",puppeteer:"^21.7.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.7",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},jet=GD.name,qet=GD.version,XD=GD.version.split("."),bBt=XD[0],xBt=XD[1],_Bt=XD[2],Yet=()=>typeof navigator>"u";function o7(){let e="https://cdn.jsdelivr.net/npm/".concat(jet,"@").concat(qet,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var zD=null,VD=null,jD=null,qD=null,YD=null;async function Wet(){return zD==null&&(zD=typeof BigInt64Array<"u"),VD==null&&(VD=await $et()),jD==null&&(jD=await Vet()),qD==null&&(qD=await zet()),YD==null&&(YD=await Pet()),{bigInt64Array:zD,crossOriginIsolated:Yet()||globalThis.crossOriginIsolated||!1,wasmExceptions:VD,wasmSIMD:qD,wasmThreads:jD,wasmBulkMemory:YD}}async function s7(e){let t=await Wet();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var wBt=Tet(Aet());function Get(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var vBt=Get(),Xet=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(Xet||{});function a7(e={}){let{duckdb:t,connection:r,...n}=e,i=t,o=r,s;function a(){return s||(s=(i?Promise.resolve(i):Zet(n).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,p=await(await l()).query(d);return f==="exec"?void 0:f==="arrow"?p:p.toArray()}}}async function Zet({log:e=!1}={}){let t=o7(),r=await s7(t),n=URL.createObjectURL(new Blob([`importScripts("${r.mainWorker}");`],{type:"text/javascript"})),i=new Worker(n),o=e?new r7:new e7,s=new i7(o,i);return await s.instantiate(r.mainModule,r.pthreadWorker),URL.revokeObjectURL(n),s}function HD(){let e=new Set,t,r=new Promise(n=>t=n);return{pending(n){e.add(n)},ready(n){return e.delete(n),e.size===0},resolve(){r=new Promise(n=>{t(),t=n})},get promise(){return r}}}var kk={};Tr(kk,{Fixed:()=>sa,Param:()=>Rl,Query:()=>bt,Selection:()=>lc,agg:()=>ae,align:()=>wF,and:()=>bi,area:()=>s8,areaX:()=>a8,areaY:()=>c8,argmax:()=>fh,argmin:()=>uh,arrayAgg:()=>pE,arrow:()=>ek,aspectRatio:()=>vF,avg:()=>Yy,axis:()=>SF,axisFx:()=>sk,axisFy:()=>ak,axisX:()=>ik,axisY:()=>ok,barX:()=>d8,barY:()=>h8,bin:()=>gA,cast:()=>Gy,castDouble:()=>dh,castInteger:()=>mE,cell:()=>p8,cellX:()=>m8,cellY:()=>y8,centroid:()=>Hy,centroidX:()=>_E,centroidY:()=>wE,circle:()=>S8,colorBase:()=>u4,colorClamp:()=>QL,colorConstant:()=>d4,colorDomain:()=>ZL,colorExponent:()=>f4,colorInterpolate:()=>r4,colorLabel:()=>o4,colorLegend:()=>Fk,colorN:()=>JL,colorNice:()=>t4,colorPercent:()=>s4,colorPivot:()=>n4,colorRange:()=>KL,colorReverse:()=>a4,colorScale:()=>HL,colorScheme:()=>e4,colorSymmetric:()=>i4,colorTickFormat:()=>l4,colorZero:()=>c4,column:()=>Ol,contour:()=>z8,coordinator:()=>mo,corr:()=>rE,count:()=>Vn,covarPop:()=>iE,covariance:()=>nE,create:()=>Fl,cume_dist:()=>CM,dateDay:()=>xE,dateMonth:()=>gE,dateMonthDay:()=>bE,delaunayLink:()=>Q8,delaunayMesh:()=>J8,denseLine:()=>$8,dense_rank:()=>LM,density:()=>P8,densityX:()=>C8,densityY:()=>U8,dot:()=>_8,dotX:()=>w8,dotY:()=>v8,entropy:()=>JM,eq:()=>TM,errorbarX:()=>X8,errorbarY:()=>H8,facetGrid:()=>HR,facetLabel:()=>ZR,facetMargin:()=>qR,facetMarginBottom:()=>WR,facetMarginLeft:()=>GR,facetMarginRight:()=>XR,facetMarginTop:()=>YR,first:()=>fE,first_value:()=>zM,frame:()=>nk,from:()=>DX,fxAlign:()=>nL,fxAriaDescription:()=>wL,fxAriaLabel:()=>_L,fxAxis:()=>aL,fxDomain:()=>KR,fxFontVariant:()=>xL,fxGrid:()=>pL,fxInset:()=>JR,fxInsetLeft:()=>tL,fxInsetRight:()=>eL,fxLabel:()=>yL,fxLabelAnchor:()=>gL,fxLabelOffset:()=>bL,fxLine:()=>mL,fxPadding:()=>iL,fxPaddingInner:()=>oL,fxPaddingOuter:()=>sL,fxRange:()=>QR,fxReverse:()=>vL,fxRound:()=>rL,fxTickFormat:()=>dL,fxTickPadding:()=>fL,fxTickRotate:()=>hL,fxTickSize:()=>lL,fxTickSpacing:()=>uL,fxTicks:()=>cL,fyAlign:()=>DL,fyAriaDescription:()=>GL,fyAriaLabel:()=>WL,fyAxis:()=>FL,fyDomain:()=>SL,fyFontVariant:()=>YL,fyGrid:()=>$L,fyInset:()=>TL,fyInsetBottom:()=>ML,fyInsetTop:()=>AL,fyLabel:()=>VL,fyLabelAnchor:()=>jL,fyLabelOffset:()=>qL,fyLine:()=>zL,fyPadding:()=>BL,fyPaddingInner:()=>OL,fyPaddingOuter:()=>NL,fyRange:()=>IL,fyReverse:()=>XL,fyRound:()=>EL,fyTickFormat:()=>UL,fyTickPadding:()=>CL,fyTickRotate:()=>PL,fyTickSize:()=>LL,fyTickSpacing:()=>kL,fyTicks:()=>RL,geo:()=>dk,geojson:()=>Xy,graticule:()=>pk,grid:()=>TF,gridFx:()=>uk,gridFy:()=>fk,gridX:()=>ck,gridY:()=>lk,gt:()=>jy,gte:()=>AM,hconcat:()=>vX,heatmap:()=>V8,height:()=>yF,hexagon:()=>I8,hexbin:()=>Y8,hexgrid:()=>W8,highlight:()=>mk,hspace:()=>TX,hull:()=>tk,image:()=>k8,inset:()=>IF,intervalX:()=>Sk,intervalXY:()=>Tk,intervalY:()=>Ik,isBetween:()=>Br,isDistinct:()=>MM,isNotBetween:()=>EM,isNotDistinct:()=>lh,isNotNull:()=>sc,isNull:()=>pf,kurtosis:()=>QM,label:()=>AF,lag:()=>PM,last:()=>dE,last_value:()=>VM,lead:()=>$M,lengthBase:()=>W4,lengthClamp:()=>V4,lengthConstant:()=>X4,lengthDomain:()=>$4,lengthExponent:()=>G4,lengthNice:()=>j4,lengthPercent:()=>q4,lengthRange:()=>z4,lengthScale:()=>P4,lengthZero:()=>Y4,line:()=>l8,lineX:()=>u8,lineY:()=>f8,link:()=>rk,literal:()=>df,loadCSV:()=>TE,loadExtension:()=>SE,loadJSON:()=>AE,loadObjects:()=>DE,loadParquet:()=>ME,loadSpatial:()=>EE,lt:()=>ac,lte:()=>cc,mad:()=>YM,margin:()=>dF,marginBottom:()=>_F,marginLeft:()=>gF,marginRight:()=>bF,marginTop:()=>xF,margins:()=>fF,max:()=>ho,median:()=>GM,menu:()=>yX,min:()=>po,mode:()=>HM,name:()=>lF,nearest:()=>_k,nearestX:()=>wk,nearestY:()=>vk,neq:()=>mf,not:()=>IM,nth_value:()=>jM,ntile:()=>UM,opacityBase:()=>S4,opacityClamp:()=>y4,opacityConstant:()=>T4,opacityDomain:()=>p4,opacityExponent:()=>I4,opacityLabel:()=>b4,opacityLegend:()=>Rk,opacityNice:()=>g4,opacityPercent:()=>x4,opacityRange:()=>m4,opacityReverse:()=>_4,opacityScale:()=>h4,opacityTickFormat:()=>v4,opacityZero:()=>w4,or:()=>hf,padding:()=>MF,pan:()=>Ak,panX:()=>Mk,panY:()=>Ek,panZoom:()=>Dk,panZoomX:()=>Bk,panZoomY:()=>Ok,percent_rank:()=>kM,plot:()=>FX,product:()=>WM,projectionClip:()=>o8,projectionDomain:()=>J4,projectionInset:()=>t8,projectionInsetBottom:()=>i8,projectionInsetLeft:()=>e8,projectionInsetRight:()=>r8,projectionInsetTop:()=>n8,projectionParallels:()=>Z4,projectionPrecision:()=>K4,projectionRotate:()=>Q4,projectionType:()=>H4,quantile:()=>XM,rBase:()=>k4,rClamp:()=>N4,rConstant:()=>U4,rDomain:()=>B4,rExponent:()=>C4,rNice:()=>F4,rPercent:()=>R4,rRange:()=>O4,rScale:()=>D4,rZero:()=>L4,rank:()=>RM,raster:()=>j8,rasterTile:()=>q8,rect:()=>g8,rectX:()=>b8,rectY:()=>x8,regressionY:()=>G8,row_number:()=>FM,ruleX:()=>E8,ruleY:()=>D8,search:()=>gX,skewness:()=>KM,slider:()=>bX,sphere:()=>hk,spike:()=>L8,sql:()=>W,stddev:()=>Wy,stddevPop:()=>eE,stringAgg:()=>hE,style:()=>pF,sum:()=>Li,symbolDomain:()=>M4,symbolLegend:()=>Lk,symbolRange:()=>E4,symbolScale:()=>A4,table:()=>xX,text:()=>T8,textX:()=>A8,textY:()=>M8,tickX:()=>B8,tickY:()=>O8,toggle:()=>kd,toggleColor:()=>xk,toggleX:()=>yk,toggleY:()=>gk,toggleZ:()=>bk,varPop:()=>tE,variance:()=>ZM,vconcat:()=>wX,vector:()=>N8,vectorX:()=>F8,vectorY:()=>R8,voronoi:()=>Z8,voronoiMesh:()=>K8,vspace:()=>IX,width:()=>mF,xAlign:()=>CF,xAriaDescription:()=>rR,xAriaLabel:()=>eR,xAxis:()=>zF,xBase:()=>sR,xClamp:()=>LF,xConstant:()=>cR,xDomain:()=>DF,xExponent:()=>aR,xFontVariant:()=>tR,xGrid:()=>XF,xInset:()=>NF,xInsetLeft:()=>FF,xInsetRight:()=>RF,xLabel:()=>ZF,xLabelAnchor:()=>KF,xLabelArrow:()=>QF,xLabelOffset:()=>JF,xLine:()=>HF,xNice:()=>OF,xPadding:()=>UF,xPaddingInner:()=>PF,xPaddingOuter:()=>$F,xPercent:()=>nR,xRange:()=>BF,xReverse:()=>iR,xRound:()=>kF,xScale:()=>EF,xTickFormat:()=>WF,xTickPadding:()=>YF,xTickRotate:()=>GF,xTickSize:()=>jF,xTickSpacing:()=>qF,xTicks:()=>VF,xZero:()=>oR,xyDomain:()=>hF,yAlign:()=>bR,yAriaDescription:()=>CR,yAriaLabel:()=>kR,yAxis:()=>vR,yBase:()=>zR,yClamp:()=>yR,yConstant:()=>jR,yDomain:()=>uR,yExponent:()=>VR,yFontVariant:()=>LR,yGrid:()=>DR,yInset:()=>hR,yInsetBottom:()=>mR,yInsetTop:()=>pR,yLabel:()=>OR,yLabelAnchor:()=>NR,yLabelArrow:()=>FR,yLabelOffset:()=>RR,yLine:()=>BR,yNice:()=>dR,yPadding:()=>xR,yPaddingInner:()=>_R,yPaddingOuter:()=>wR,yPercent:()=>UR,yRange:()=>fR,yReverse:()=>PR,yRound:()=>gR,yScale:()=>lR,yTickFormat:()=>MR,yTickPadding:()=>AR,yTickRotate:()=>ER,yTickSize:()=>IR,yTickSpacing:()=>TR,yTicks:()=>SR,yZero:()=>$R});var sa=Symbol("Fixed"),gn=Symbol("Transient"),n0=Symbol("Transform");var Y6={};Tr(Y6,{Area:()=>Ad,Arrow:()=>mx,BarX:()=>yx,BarY:()=>gx,Cell:()=>Md,Contour:()=>Dx,Density:()=>Nx,Dot:()=>Ed,Frame:()=>ax,Geo:()=>Fx,Hexgrid:()=>Rx,Image:()=>Lx,Line:()=>Dd,Link:()=>hx,Mark:()=>Ft,Raster:()=>Tx,Rect:()=>Od,RuleX:()=>rx,RuleY:()=>nx,Text:()=>Sd,TickX:()=>wx,TickY:()=>vx,Tip:()=>cx,Vector:()=>Td,area:()=>dx,areaX:()=>ku,areaY:()=>ml,arrow:()=>rW,auto:()=>hW,autoSpec:()=>g6,axisFx:()=>ST,axisFy:()=>vT,axisX:()=>ox,axisY:()=>ix,barX:()=>ka,barY:()=>Ca,bin:()=>pl,binX:()=>Ra,binY:()=>La,bollinger:()=>$u,bollingerX:()=>xW,bollingerY:()=>_W,boxX:()=>wW,boxY:()=>vW,cell:()=>Cu,cellX:()=>iW,cellY:()=>oW,centroid:()=>bG,circle:()=>cW,cluster:()=>gG,column:()=>nn,contour:()=>OW,crosshair:()=>RW,crosshairX:()=>LW,crosshairY:()=>kW,delaunayLink:()=>PW,delaunayMesh:()=>$W,density:()=>YW,differenceY:()=>XW,dodgeX:()=>NG,dodgeY:()=>FG,dot:()=>Lo,dotX:()=>sW,dotY:()=>aW,filter:()=>mj,find:()=>Ij,formatIsoDate:()=>PN,formatMonth:()=>Tq,formatWeekday:()=>Aq,frame:()=>em,geo:()=>GT,geoCentroid:()=>xG,graticule:()=>ZW,gridFx:()=>MT,gridFy:()=>TT,gridX:()=>AT,gridY:()=>IT,group:()=>Xb,groupX:()=>Tu,groupY:()=>Au,groupZ:()=>Gb,hexagon:()=>lW,hexbin:()=>KW,hexgrid:()=>QW,hull:()=>zW,identity:()=>K,image:()=>tG,indexOf:()=>nr,initializer:()=>Je,interpolateNearest:()=>Mx,interpolateNone:()=>WT,interpolatorBarycentric:()=>Ax,interpolatorRandomWalk:()=>Ex,legend:()=>IY,line:()=>Bd,lineX:()=>Uu,lineY:()=>Pu,linearRegressionX:()=>nG,linearRegressionY:()=>iG,link:()=>CT,map:()=>Mi,mapX:()=>pm,mapY:()=>mm,marks:()=>$r,normalize:()=>rA,normalizeX:()=>CG,normalizeY:()=>UG,plot:()=>ux,pointer:()=>Ou,pointerX:()=>Nu,pointerY:()=>dl,raster:()=>MW,rect:()=>xx,rectX:()=>fm,rectY:()=>dm,reverse:()=>yj,ruleX:()=>Ki,ruleY:()=>Qi,scale:()=>Du,select:()=>$G,selectFirst:()=>Px,selectLast:()=>$x,selectMaxX:()=>sA,selectMaxY:()=>aA,selectMinX:()=>iA,selectMinY:()=>oA,shiftX:()=>PG,shuffle:()=>gj,sort:()=>zI,sphere:()=>HW,spike:()=>iY,stackX:()=>p6,stackX1:()=>GY,stackX2:()=>XY,stackY:()=>m6,stackY1:()=>HY,stackY2:()=>ZY,text:()=>Fa,textX:()=>mT,textY:()=>yT,tickX:()=>jT,tickY:()=>qT,tip:()=>BT,transform:()=>on,tree:()=>C6,treeLink:()=>QT,treeNode:()=>kx,valueof:()=>At,vector:()=>n6,vectorX:()=>xT,vectorY:()=>_T,voronoi:()=>VW,voronoiMesh:()=>jW,window:()=>ym,windowX:()=>pW,windowY:()=>mW});function Yt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Xn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Fc(e){let t,r,n;e.length!==2?(t=Yt,r=(a,c)=>Yt(e(a),c),n=(a,c)=>e(a)-c):(t=e===Yt||e===Xn?e:Ket,r=e,n=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&n(a[f-1],c)>-n(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function Ket(){return 0}function i0(e){return e===null?NaN:+e}function*c7(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}var l7=Fc(Yt),u7=l7.right,Qet=l7.left,Jet=Fc(i0).center,Rc=u7;var o0=f7(d7),ZD=f7(trt);function f7(e){return function(t,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!r&&!n)return t;let a=r&&e(r),c=n&&e(n),l=i.slice();return a&&c?(Ch(a,l,i,o,s),Ch(a,i,l,o,s),Ch(a,l,i,o,s),Uh(c,i,l,o,s),Uh(c,l,i,o,s),Uh(c,i,l,o,s)):a?(Ch(a,i,l,o,s),Ch(a,l,i,o,s),Ch(a,i,l,o,s)):c&&(Uh(c,i,l,o,s),Uh(c,l,i,o,s),Uh(c,i,l,o,s)),t}}function Ch(e,t,r,n,i){for(let o=0,s=n*i;o<s;)e(t,r,o,o+=n,1)}function Uh(e,t,r,n,i){for(let o=0,s=n*i;o<n;++o)e(t,r,o,o+s,n)}function trt(e){let t=d7(e);return(r,n,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(r,n,i+0,o+0,s),t(r,n,i+1,o+1,s),t(r,n,i+2,o+2,s),t(r,n,i+3,o+3,s)}}function d7(e){let t=Math.floor(e);if(t===e)return ert(e);let r=e-t,n=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+r*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/n,l-=o[Math.max(s,d-u)]}}function ert(e){let t=2*e+1;return(r,n,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*n[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=n[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=n[Math.min(o,l+c)],r[l]=a/t,a-=n[Math.max(i,l-c)]}}function aa(e,t){let r=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&++r;else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(i=+i)>=i&&++r}return r}function rrt(e){return e.length|0}function nrt(e){return!(e>0)}function irt(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function ort(e){return t=>e(...t)}function wv(...e){let t=typeof e[e.length-1]=="function"&&ort(e.pop());e=e.map(irt);let r=e.map(rrt),n=e.length-1,i=new Array(n+1).fill(0),o=[];if(n<0||r.some(nrt))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=n;for(;++i[s]===r[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function vv(e,t){var r=0,n=0;return Float64Array.from(e,t===void 0?i=>r+=+i||0:i=>r+=+t(i,n++,e)||0)}function Jl(e,t){let r=0,n,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(n=a-i,i+=n/++r,o+=n*(a-i))}if(r>1)return o/(r-1)}function vo(e,t){let r=Jl(e,t);return r&&Math.sqrt(r)}function Oe(e,t){let r,n;if(t===void 0)for(let i of e)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)))}return[r,n]}var bn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let r=this._partials,n=0;for(let i=0;i<this._n&&i<32;i++){let o=r[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(r[n++]=a),t=s}return r[n]=t,this._n=n+1,this}valueOf(){let t=this._partials,r=this._n,n,i,o,s=0;if(r>0){for(s=t[--r];r>0&&(n=s,i=t[--r],s=n+i,o=i-(s-n),!o););r>0&&(o<0&&t[r-1]<0||o>0&&t[r-1]>0)&&(i=o*2,n=s+i,i==n-s&&(s=n))}return s}};var Hn=class extends Map{constructor(t,r=m7){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(KD(this,t))}has(t){return super.has(KD(this,t))}set(t,r){return super.set(h7(this,t),r)}delete(t){return super.delete(p7(this,t))}},Zn=class extends Set{constructor(t,r=m7){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let n of t)this.add(n)}has(t){return super.has(KD(this,t))}add(t){return super.add(h7(this,t))}delete(t){return super.delete(p7(this,t))}};function KD({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function h7({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function p7({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function m7(e){return e!==null&&typeof e=="object"?e.valueOf():e}function s0(e){return e}function Zr(e,...t){return JD(e,s0,s0,t)}function ps(e,t,...r){return JD(e,s0,t,r)}function QD(e,t,...r){return JD(e,Array.from,t,r)}function JD(e,t,r,n){return function i(o,s){if(s>=n.length)return r(o);let a=new Hn,c=n[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function t3(e,t){return Array.from(t,r=>e[r])}function Lc(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){let n=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),n.sort((i,o)=>{for(let s of t){let a=kf(s[i],s[o]);if(a)return a}})):(r=e.map(r),n.sort((i,o)=>kf(r[i],r[o]))),t3(e,n)}return e.sort(a0(r))}function a0(e=Yt){if(e===Yt)return kf;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function kf(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Ph(e,t,r){return(t.length!==2?Lc(ps(e,t,r),([n,i],[o,s])=>Yt(i,s)||Yt(n,o)):Lc(Zr(e,r),([n,i],[o,s])=>t(i,s)||Yt(n,o))).map(([n])=>n)}var srt=Math.sqrt(50),art=Math.sqrt(10),crt=Math.sqrt(2);function Sv(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=srt?10:o>=art?5:o>=crt?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=r&&r<2?Sv(e,t,r*2):[a,c,l]}function xn(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[i,o,s]=n?Sv(t,e,r):Sv(e,t,r);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(n)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function kc(e,t,r){return t=+t,e=+e,r=+r,Sv(e,t,r)[2]}function $h(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?kc(t,e,r):kc(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function zh(e,t,r){let n;for(;;){let i=kc(e,t,r);if(i===n||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),n=i}}function tu(e){return Math.max(1,Math.ceil(Math.log(aa(e))/Math.LN2)+1)}function me(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}function Iv(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);return n}function Ne(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function Tv(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);return n}function Av(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?kf:a0(i);n>r;){if(n-r>600){let c=n-r+1,l=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(r,Math.floor(t-l*f/c+d)),p=Math.min(n,Math.floor(t+(c-l)*f/c+d));Av(e,t,h,p,i)}let o=e[t],s=r,a=n;for(c0(e,r,t),i(e[n],o)>0&&c0(e,r,n);s<a;){for(c0(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[r],o)===0?c0(e,r,a):(++a,c0(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}return e}function c0(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Cf(e,t=Yt){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Yt(s,i)>0:Yt(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)>0:t(i,i)===0)&&(r=i,n=!0);return r}function Kn(e,t,r){if(e=Float64Array.from(c7(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Ne(e);if(t>=1)return me(e);var n,i=(n-1)*t,o=Math.floor(i),s=me(Av(e,o).subarray(0,o+1)),a=Ne(e.subarray(o+1));return s+(a-s)*(i-o)}}function e3(e,t,r=i0){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),s=+r(e[o],o,e),a=+r(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function Mv(e,t,r){let n=aa(e),i=Kn(e,.75)-Kn(e,.25);return n&&i?Math.ceil((r-t)/(2*i*Math.pow(n,-1/3))):1}function l0(e,t,r){let n=aa(e),i=vo(e);return n&&i?Math.ceil((r-t)*Math.cbrt(n)/(3.49*i)):1}function Cc(e,t){let r=0,n=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++r,n+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++r,n+=o)}if(r)return n/r}function ms(e,t){return Kn(e,.5,t)}function*urt(e){for(let t of e)yield*t}function Vh(e){return Array.from(urt(e))}function jh(e,t){let r=new Hn;if(t===void 0)for(let o of e)o!=null&&o>=o&&r.set(o,(r.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&r.set(s,(r.get(s)||0)+1)}let n,i=0;for(let[o,s]of r)s>i&&(i=s,n=o);return n}function Ev(e,t=frt){let r=[],n,i=!1;for(let o of e)i&&r.push(t(n,o)),n=o,i=!0;return r}function frt(e,t){return[e,t]}function _r(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n<i;)o[n]=e+n*r;return o}function u0(e,t=Yt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let r=Array.from(e),n=new Float64Array(r.length);t.length!==2&&(r=r.map(t),t=Yt);let i=(a,c)=>t(r[a],r[c]),o,s;return e=Uint32Array.from(r,(a,c)=>c),e.sort(t===Yt?(a,c)=>kf(r[a],r[c]):a0(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),n[a]=s):n[a]=NaN}),n}function Dv(e,t=Yt){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Yt(s,i)<0:Yt(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)<0:t(i,i)===0)&&(r=i,n=!0);return r}function _n(e,t){let r=0;if(t===void 0)for(let n of e)(n=+n)&&(r+=n);else{let n=-1;for(let i of e)(i=+t(i,++n,e))&&(r+=i)}return r}function eu(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function y7(e){return e}var r3=1,n3=2,i3=3,Bv=4,g7=1e-6;function drt(e){return"translate("+e+",0)"}function hrt(e){return"translate(0,"+e+")"}function prt(e){return t=>+e(t)}function mrt(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function yrt(){return!this.__axis}function grt(e,t){var r=[],n=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===r3||e===Bv?-1:1,u=e===Bv||e===n3?"x":"y",f=e===r3||e===i3?drt:hrt;function d(h){var p=n??(t.ticks?t.ticks.apply(t,r):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,r):y7),y=Math.max(o,0)+a,g=t.range(),b=+g[0]+c,x=+g[g.length-1]+c,_=(t.bandwidth?mrt:prt)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),I=v.selectAll(".tick").data(p,t).order(),E=I.exit(),T=I.enter().append("g").attr("class","tick"),B=I.select("line"),A=I.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(T),B=B.merge(T.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),A=A.merge(T.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===r3?"0em":e===i3?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),I=I.transition(h),B=B.transition(h),A=A.transition(h),E=E.transition(h).attr("opacity",g7).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),T.attr("opacity",g7).attr("transform",function(O){var L=this.parentNode.__axis;return f((L&&isFinite(L=L(O))?L:_(O))+c)})),E.remove(),w.attr("d",e===Bv||e===n3?s?"M"+l*s+","+b+"H"+c+"V"+x+"H"+l*s:"M"+c+","+b+"V"+x:s?"M"+b+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+b+","+c+"H"+x),I.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),B.attr(u+"2",l*o),A.attr(u,l*y).text(m),v.filter(yrt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===n3?"start":e===Bv?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(r=h==null?[]:Array.from(h),d):r.slice()},d.tickValues=function(h){return arguments.length?(n=h==null?null:Array.from(h),d):n&&n.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function o3(e){return grt(i3,e)}var brt={value:()=>{}};function x7(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new Ov(r)}function Ov(e){this._=e}function xrt(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}Ov.prototype=x7.prototype={constructor:Ov,on:function(e,t){var r=this._,n=xrt(e+"",r),i,o=-1,s=n.length;if(arguments.length<2){for(;++o<s;)if((i=(e=n[o]).type)&&(i=_rt(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=n[o]).type)r[i]=b7(r[i],e.name,t);else if(t==null)for(i in r)r[i]=b7(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Ov(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,o;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],n=0,i=o.length;n<i;++n)o[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,o=n.length;i<o;++i)n[i].value.apply(t,r)}};function _rt(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function b7(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=brt,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Uf=x7;var Nv="http://www.w3.org/1999/xhtml",So={svg:"http://www.w3.org/2000/svg",xhtml:Nv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Uc(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),So.hasOwnProperty(t)?{space:So[t],local:e}:e}function wrt(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Nv&&t.documentElement.namespaceURI===Nv?t.createElement(e):t.createElementNS(r,e)}}function vrt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pc(e){var t=Uc(e);return(t.local?vrt:wrt)(t)}function Srt(){}function Pf(e){return e==null?Srt:function(){return this.querySelector(e)}}function _7(e){typeof e!="function"&&(e=Pf(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new yr(n,this._parents)}function s3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Irt(){return[]}function f0(e){return e==null?Irt:function(){return this.querySelectorAll(e)}}function Trt(e){return function(){return s3(e.apply(this,arguments))}}function w7(e){typeof e=="function"?e=Trt(e):e=f0(e);for(var t=this._groups,r=t.length,n=[],i=[],o=0;o<r;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(n.push(e.call(c,c.__data__,l,s)),i.push(c));return new yr(n,i)}function d0(e){return function(){return this.matches(e)}}function Fv(e){return function(t){return t.matches(e)}}var Art=Array.prototype.find;function Mrt(e){return function(){return Art.call(this.children,e)}}function Ert(){return this.firstElementChild}function v7(e){return this.select(e==null?Ert:Mrt(typeof e=="function"?e:Fv(e)))}var Drt=Array.prototype.filter;function Brt(){return Array.from(this.children)}function Ort(e){return function(){return Drt.call(this.children,e)}}function S7(e){return this.selectAll(e==null?Brt:Ort(typeof e=="function"?e:Fv(e)))}function I7(e){typeof e!="function"&&(e=d0(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new yr(n,this._parents)}function Rv(e){return new Array(e.length)}function T7(){return new yr(this._enter||this._groups.map(Rv),this._parents)}function h0(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}h0.prototype={constructor:h0,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 A7(e){return function(){return e}}function Nrt(e,t,r,n,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],n[s]=a):r[s]=new h0(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function Frt(e,t,r,n,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(n[a]=c,c.__data__=o[a],l.delete(h)):r[a]=new h0(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function Rrt(e){return e.__data__}function M7(e,t){if(!arguments.length)return Array.from(this,Rrt);var r=t?Frt:Nrt,n=this._parents,i=this._groups;typeof e!="function"&&(e=A7(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=n[l],f=i[l],d=f.length,h=Lrt(e.call(u,u&&u.__data__,l,n)),p=h.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(d);r(u,f,m,y,g,h,t);for(var b=0,x=0,_,v;b<p;++b)if(_=m[b]){for(b>=x&&(x=b+1);!(v=y[x])&&++x<p;);_._next=v||null}}return s=new yr(s,n),s._enter=a,s._exit=c,s}function Lrt(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function E7(){return new yr(this._exit||this._groups.map(Rv),this._parents)}function D7(e,t,r){var n=this.enter(),i=this,o=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?o.remove():r(o),n&&i?n.merge(i).order():i}function B7(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,o=n.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=r[c],u=n[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=r[c];return new yr(a,this._parents)}function O7(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],i=n.length-1,o=n[i],s;--i>=0;)(s=n[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function N7(e){e||(e=krt);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),o=0;o<n;++o){for(var s=r[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new yr(i,this._parents).order()}function krt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function F7(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function R7(){return Array.from(this)}function L7(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length;i<o;++i){var s=n[i];if(s)return s}return null}function k7(){let e=0;for(let t of this)++e;return e}function C7(){return!this.node()}function U7(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i=t[r],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function Crt(e){return function(){this.removeAttribute(e)}}function Urt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Prt(e,t){return function(){this.setAttribute(e,t)}}function $rt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zrt(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Vrt(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function P7(e,t){var r=Uc(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?Urt:Crt:typeof t=="function"?r.local?Vrt:zrt:r.local?$rt:Prt)(r,t))}function Lv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function jrt(e){return function(){this.style.removeProperty(e)}}function qrt(e,t,r){return function(){this.style.setProperty(e,t,r)}}function Yrt(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function $7(e,t,r){return arguments.length>1?this.each((t==null?jrt:typeof t=="function"?Yrt:qrt)(e,t,r??"")):ru(this.node(),e)}function ru(e,t){return e.style.getPropertyValue(t)||Lv(e).getComputedStyle(e,null).getPropertyValue(t)}function Wrt(e){return function(){delete this[e]}}function Grt(e,t){return function(){this[e]=t}}function Xrt(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function z7(e,t){return arguments.length>1?this.each((t==null?Wrt:typeof t=="function"?Xrt:Grt)(e,t)):this.node()[e]}function V7(e){return e.trim().split(/^|\s+/)}function a3(e){return e.classList||new j7(e)}function j7(e){this._node=e,this._names=V7(e.getAttribute("class")||"")}j7.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 q7(e,t){for(var r=a3(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function Y7(e,t){for(var r=a3(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function Hrt(e){return function(){q7(this,e)}}function Zrt(e){return function(){Y7(this,e)}}function Krt(e,t){return function(){(t.apply(this,arguments)?q7:Y7)(this,e)}}function W7(e,t){var r=V7(e+"");if(arguments.length<2){for(var n=a3(this.node()),i=-1,o=r.length;++i<o;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?Krt:t?Hrt:Zrt)(r,t))}function Qrt(){this.textContent=""}function Jrt(e){return function(){this.textContent=e}}function tnt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function G7(e){return arguments.length?this.each(e==null?Qrt:(typeof e=="function"?tnt:Jrt)(e)):this.node().textContent}function ent(){this.innerHTML=""}function rnt(e){return function(){this.innerHTML=e}}function nnt(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function X7(e){return arguments.length?this.each(e==null?ent:(typeof e=="function"?nnt:rnt)(e)):this.node().innerHTML}function int(){this.nextSibling&&this.parentNode.appendChild(this)}function H7(){return this.each(int)}function ont(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Z7(){return this.each(ont)}function K7(e){var t=typeof e=="function"?e:Pc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function snt(){return null}function Q7(e,t){var r=typeof e=="function"?e:Pc(e),n=t==null?snt:typeof t=="function"?t:Pf(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function ant(){var e=this.parentNode;e&&e.removeChild(this)}function J7(){return this.each(ant)}function cnt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lnt(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function t9(e){return this.select(e?lnt:cnt)}function e9(e){return arguments.length?this.property("__data__",e):this.node().__data__}function unt(e){return function(t){e.call(this,t,this.__data__)}}function fnt(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function dnt(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,o;r<i;++r)o=t[r],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++n]=o;++n?t.length=n:delete this.__on}}}function hnt(e,t,r){return function(){var n=this.__on,i,o=unt(t);if(n){for(var s=0,a=n.length;s<a;++s)if((i=n[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=r),i.value=t;return}}this.addEventListener(e.type,o,r),i={type:e.type,name:e.name,value:t,listener:o,options:r},n?n.push(i):this.__on=[i]}}function r9(e,t,r){var n=fnt(e+""),i,o=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=n[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?hnt:dnt,i=0;i<o;++i)this.each(a(n[i],t,r));return this}function n9(e,t,r){var n=Lv(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function pnt(e,t){return function(){return n9(this,e,t)}}function mnt(e,t){return function(){return n9(this,e,t.apply(this,arguments))}}function i9(e,t){return this.each((typeof t=="function"?mnt:pnt)(e,t))}function*o9(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length,s;i<o;++i)(s=n[i])&&(yield s)}var c3=[null];function yr(e,t){this._groups=e,this._parents=t}function s9(){return new yr([[document.documentElement]],c3)}function ynt(){return this}yr.prototype=s9.prototype={constructor:yr,select:_7,selectAll:w7,selectChild:v7,selectChildren:S7,filter:I7,data:M7,enter:T7,exit:E7,join:D7,merge:B7,selection:ynt,order:O7,sort:N7,call:F7,nodes:R7,node:L7,size:k7,empty:C7,each:U7,attr:P7,style:$7,property:z7,classed:W7,text:G7,html:X7,raise:H7,lower:Z7,append:K7,insert:Q7,remove:J7,clone:t9,datum:e9,on:r9,dispatch:i9,[Symbol.iterator]:o9};var $c=s9;function ce(e){return typeof e=="string"?new yr([[document.querySelector(e)]],[document.documentElement]):new yr([[e]],c3)}function a9(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Dn(e,t){if(e=a9(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var kv={capture:!0,passive:!1};function Cv(e){e.preventDefault(),e.stopImmediatePropagation()}function p0(e){var t=e.document.documentElement,r=ce(e).on("dragstart.drag",Cv,kv);"onselectstart"in t?r.on("selectstart.drag",Cv,kv):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function m0(e,t){var r=e.document.documentElement,n=ce(e).on("dragstart.drag",null);t&&(n.on("click.drag",Cv,kv),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function zc(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function nu(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function la(){}var iu=.7,Vf=1/iu,qh="\\s*([+-]?\\d+)\\s*",y0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ca="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gnt=/^#([0-9a-f]{3,8})$/,bnt=new RegExp(`^rgb\\(${qh},${qh},${qh}\\)$`),xnt=new RegExp(`^rgb\\(${ca},${ca},${ca}\\)$`),_nt=new RegExp(`^rgba\\(${qh},${qh},${qh},${y0}\\)$`),wnt=new RegExp(`^rgba\\(${ca},${ca},${ca},${y0}\\)$`),vnt=new RegExp(`^hsl\\(${y0},${ca},${ca}\\)$`),Snt=new RegExp(`^hsla\\(${y0},${ca},${ca},${y0}\\)$`),c9={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};zc(la,ji,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:l9,formatHex:l9,formatHex8:Int,formatHsl:Tnt,formatRgb:u9,toString:u9});function l9(){return this.rgb().formatHex()}function Int(){return this.rgb().formatHex8()}function Tnt(){return y9(this).formatHsl()}function u9(){return this.rgb().formatRgb()}function ji(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=gnt.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?f9(t):r===3?new Fr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Uv(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Uv(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=bnt.exec(e))?new Fr(t[1],t[2],t[3],1):(t=xnt.exec(e))?new Fr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=_nt.exec(e))?Uv(t[1],t[2],t[3],t[4]):(t=wnt.exec(e))?Uv(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=vnt.exec(e))?p9(t[1],t[2]/100,t[3]/100,1):(t=Snt.exec(e))?p9(t[1],t[2]/100,t[3]/100,t[4]):c9.hasOwnProperty(e)?f9(c9[e]):e==="transparent"?new Fr(NaN,NaN,NaN,0):null}function f9(e){return new Fr(e>>16&255,e>>8&255,e&255,1)}function Uv(e,t,r,n){return n<=0&&(e=t=r=NaN),new Fr(e,t,r,n)}function g0(e){return e instanceof la||(e=ji(e)),e?(e=e.rgb(),new Fr(e.r,e.g,e.b,e.opacity)):new Fr}function Yr(e,t,r,n){return arguments.length===1?g0(e):new Fr(e,t,r,n??1)}function Fr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}zc(Fr,Yr,nu(la,{brighter(e){return e=e==null?Vf:Math.pow(Vf,e),new Fr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?iu:Math.pow(iu,e),new Fr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Fr(zf(this.r),zf(this.g),zf(this.b),$v(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:d9,formatHex:d9,formatHex8:Ant,formatRgb:h9,toString:h9}));function d9(){return`#${$f(this.r)}${$f(this.g)}${$f(this.b)}`}function Ant(){return`#${$f(this.r)}${$f(this.g)}${$f(this.b)}${$f((isNaN(this.opacity)?1:this.opacity)*255)}`}function h9(){let e=$v(this.opacity);return`${e===1?"rgb(":"rgba("}${zf(this.r)}, ${zf(this.g)}, ${zf(this.b)}${e===1?")":`, ${e})`}`}function $v(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $f(e){return e=zf(e),(e<16?"0":"")+e.toString(16)}function p9(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new ys(e,t,r,n)}function y9(e){if(e instanceof ys)return new ys(e.h,e.s,e.l,e.opacity);if(e instanceof la||(e=ji(e)),!e)return new ys;if(e instanceof ys)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(r-n)/a+(r<n)*6:r===o?s=(n-t)/a+2:s=(t-r)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new ys(s,a,c,e.opacity)}function b0(e,t,r,n){return arguments.length===1?y9(e):new ys(e,t,r,n??1)}function ys(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}zc(ys,b0,nu(la,{brighter(e){return e=e==null?Vf:Math.pow(Vf,e),new ys(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?iu:Math.pow(iu,e),new ys(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Fr(l3(e>=240?e-240:e+120,i,n),l3(e,i,n),l3(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new ys(m9(this.h),Pv(this.s),Pv(this.l),$v(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=$v(this.opacity);return`${e===1?"hsl(":"hsla("}${m9(this.h)}, ${Pv(this.s)*100}%, ${Pv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function m9(e){return e=(e||0)%360,e<0?e+360:e}function Pv(e){return Math.max(0,Math.min(1,e||0))}function l3(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var zv=Math.PI/180,Vv=180/Math.PI;var jv=18,g9=.96422,b9=1,x9=.82521,_9=4/29,Yh=6/29,w9=3*Yh*Yh,Mnt=Yh*Yh*Yh;function v9(e){if(e instanceof ua)return new ua(e.l,e.a,e.b,e.opacity);if(e instanceof Vc)return S9(e);e instanceof Fr||(e=g0(e));var t=h3(e.r),r=h3(e.g),n=h3(e.b),i=u3((.2225045*t+.7168786*r+.0606169*n)/b9),o,s;return t===r&&r===n?o=s=i:(o=u3((.4360747*t+.3850649*r+.1430804*n)/g9),s=u3((.0139322*t+.0971045*r+.7141733*n)/x9)),new ua(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Wh(e,t,r,n){return arguments.length===1?v9(e):new ua(e,t,r,n??1)}function ua(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}zc(ua,Wh,nu(la,{brighter(e){return new ua(this.l+jv*(e??1),this.a,this.b,this.opacity)},darker(e){return new ua(this.l-jv*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=g9*f3(t),e=b9*f3(e),r=x9*f3(r),new Fr(d3(3.1338561*t-1.6168667*e-.4906146*r),d3(-.9787684*t+1.9161415*e+.033454*r),d3(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function u3(e){return e>Mnt?Math.pow(e,1/3):e/w9+_9}function f3(e){return e>Yh?e*e*e:w9*(e-_9)}function d3(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function h3(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ent(e){if(e instanceof Vc)return new Vc(e.h,e.c,e.l,e.opacity);if(e instanceof ua||(e=v9(e)),e.a===0&&e.b===0)return new Vc(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Vv;return new Vc(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function x0(e,t,r,n){return arguments.length===1?Ent(e):new Vc(e,t,r,n??1)}function Vc(e,t,r,n){this.h=+e,this.c=+t,this.l=+r,this.opacity=+n}function S9(e){if(isNaN(e.h))return new ua(e.l,0,0,e.opacity);var t=e.h*zv;return new ua(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}zc(Vc,x0,nu(la,{brighter(e){return new Vc(this.h,this.c,this.l+jv*(e??1),this.opacity)},darker(e){return new Vc(this.h,this.c,this.l-jv*(e??1),this.opacity)},rgb(){return S9(this).rgb()}}));var M9=-.14861,p3=1.78277,m3=-.29227,qv=-.90649,_0=1.97294,I9=_0*qv,T9=_0*p3,A9=p3*m3-qv*M9;function Dnt(e){if(e instanceof jf)return new jf(e.h,e.s,e.l,e.opacity);e instanceof Fr||(e=g0(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(A9*n+I9*t-T9*r)/(A9+I9-T9),o=n-i,s=(_0*(r-i)-m3*o)/qv,a=Math.sqrt(s*s+o*o)/(_0*i*(1-i)),c=a?Math.atan2(s,o)*Vv-120:NaN;return new jf(c<0?c+360:c,a,i,e.opacity)}function Qn(e,t,r,n){return arguments.length===1?Dnt(e):new jf(e,t,r,n??1)}function jf(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}zc(jf,Qn,nu(la,{brighter(e){return e=e==null?Vf:Math.pow(Vf,e),new jf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?iu:Math.pow(iu,e),new jf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*zv,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),n=Math.cos(e),i=Math.sin(e);return new Fr(255*(t+r*(M9*n+p3*i)),255*(t+r*(m3*n+qv*i)),255*(t+r*(_0*n)),this.opacity)}}));function y3(e,t,r,n,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*r+(1+3*e+3*o-3*s)*n+s*i)/6}function E9(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],s=n>0?e[n-1]:2*i-o,a=n<t-1?e[n+2]:2*o-i;return y3((r-n/t)*t,s,i,o,a)}}function D9(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],o=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return y3((r-n/t)*t,i,o,s,a)}}var Gh=e=>()=>e;function B9(e,t){return function(r){return e+r*t}}function Bnt(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Xh(e,t){var r=t-e;return r?B9(e,r>180||r<-180?r-360*Math.round(r/360):r):Gh(isNaN(e)?t:e)}function O9(e){return(e=+e)==1?rr:function(t,r){return r-t?Bnt(t,r,e):Gh(isNaN(t)?r:t)}}function rr(e,t){var r=t-e;return r?B9(e,r):Gh(isNaN(e)?t:e)}var Io=function e(t){var r=O9(t);function n(i,o){var s=r((i=Yr(i)).r,(o=Yr(o)).r),a=r(i.g,o.g),c=r(i.b,o.b),l=rr(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return n.gamma=e,n}(1);function N9(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),s,a;for(s=0;s<r;++s)a=Yr(t[s]),n[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return n=e(n),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=n(c),a.g=i(c),a.b=o(c),a+""}}}var g3=N9(E9),Ont=N9(D9);function F9(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function R9(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function L9(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)i[s]=qi(e[s],t[s]);for(;s<r;++s)o[s]=t[s];return function(a){for(s=0;s<n;++s)o[s]=i[s](a);return o}}function k9(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Ke(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function C9(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=qi(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var x3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,b3=new RegExp(x3.source,"g");function Nnt(e){return function(){return e}}function Fnt(e){return function(t){return e(t)+""}}function w0(e,t){var r=x3.lastIndex=b3.lastIndex=0,n,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(n=x3.exec(e))&&(i=b3.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Ke(n,i)})),r=b3.lastIndex;return r<t.length&&(o=t.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?Fnt(c[0].x):Nnt(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 qi(e,t){var r=typeof t,n;return t==null||r==="boolean"?Gh(t):(r==="number"?Ke:r==="string"?(n=ji(t))?(t=n,Io):w0:t instanceof ji?Io:t instanceof Date?k9:R9(t)?F9:Array.isArray(t)?L9:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?C9:Ke)(e,t)}function qf(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var U9=180/Math.PI,Yv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _3(e,t,r,n,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*r+t*n)&&(r-=e*c,n-=t*c),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,c/=a),e*n<t*r&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*U9,skewX:Math.atan(c)*U9,scaleX:s,scaleY:a}}var Wv;function P9(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Yv:_3(t.a,t.b,t.c,t.d,t.e,t.f)}function $9(e){return e==null?Yv:(Wv||(Wv=document.createElementNS("http://www.w3.org/2000/svg","g")),Wv.setAttribute("transform",e),(e=Wv.transform.baseVal.consolidate())?(e=e.matrix,_3(e.a,e.b,e.c,e.d,e.e,e.f)):Yv)}function z9(e,t,r,n){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,r);p.push({i:m-4,x:Ke(l,f)},{i:m-2,x:Ke(u,d)})}else(f||d)&&h.push("translate("+f+t+d+r)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:Ke(l,u)})):u&&f.push(i(f)+"rotate("+u+n)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:Ke(l,u)}):u&&f.push(i(f)+"skewX("+u+n)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:Ke(l,f)},{i:m-2,x:Ke(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,y;++p<m;)f[(y=d[p]).i]=y.x(h);return f.join("")}}}var w3=z9(P9,"px, ","px)","deg)"),v3=z9($9,", ",")",")");var Rnt=1e-12;function V9(e){return((e=Math.exp(e))+1/e)/2}function Lnt(e){return((e=Math.exp(e))-1/e)/2}function knt(e){return((e=Math.exp(2*e))-1)/(e+1)}var S3=function e(t,r,n){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,y,g;if(m<Rnt)g=Math.log(d/l)/t,y=function(I){return[a+I*h,c+I*p,l*Math.exp(t*I*g)]};else{var b=Math.sqrt(m),x=(d*d-l*l+n*m)/(2*l*r*b),_=(d*d-l*l-n*m)/(2*d*r*b),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);g=(w-v)/t,y=function(I){var E=I*g,T=V9(v),B=l/(r*b)*(T*knt(t*E+v)-Lnt(v));return[a+B*h,c+B*p,l*T/V9(t*E+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function j9(e){return function(t,r){var n=e((t=b0(t)).h,(r=b0(r)).h),i=rr(t.s,r.s),o=rr(t.l,r.l),s=rr(t.opacity,r.opacity);return function(a){return t.h=n(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var I3=j9(Xh),Cnt=j9(rr);function Gv(e,t){var r=rr((e=Wh(e)).l,(t=Wh(t)).l),n=rr(e.a,t.a),i=rr(e.b,t.b),o=rr(e.opacity,t.opacity);return function(s){return e.l=r(s),e.a=n(s),e.b=i(s),e.opacity=o(s),e+""}}function q9(e){return function(t,r){var n=e((t=x0(t)).h,(r=x0(r)).h),i=rr(t.c,r.c),o=rr(t.l,r.l),s=rr(t.opacity,r.opacity);return function(a){return t.h=n(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var T3=q9(Xh),Unt=q9(rr);function Y9(e){return function t(r){r=+r;function n(i,o){var s=e((i=Qn(i)).h,(o=Qn(o)).h),a=rr(i.s,o.s),c=rr(i.l,o.l),l=rr(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,r)),i.opacity=l(u),i+""}}return n.gamma=t,n}(1)}var Pnt=Y9(Xh),Hh=Y9(rr);function fa(e,t){t===void 0&&(t=e,e=qi);for(var r=0,n=t.length-1,i=t[0],o=new Array(n<0?0:n);r<n;)o[r]=e(i,i=t[++r]);return function(s){var a=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return o[a](s-a)}}function Bn(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e(n/(t-1));return r}var Zh=0,S0=0,v0=0,G9=1e3,Xv,I0,Hv=0,Yf=0,Zv=0,T0=typeof performance=="object"&&performance.now?performance:Date,X9=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function M0(){return Yf||(X9($nt),Yf=T0.now()+Zv)}function $nt(){Yf=0}function A0(){this._call=this._time=this._next=null}A0.prototype=Kv.prototype={constructor:A0,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?M0():+r)+(t==null?0:+t),!this._next&&I0!==this&&(I0?I0._next=this:Xv=this,I0=this),this._call=e,this._time=r,A3()},stop:function(){this._call&&(this._call=null,this._time=1/0,A3())}};function Kv(e,t,r){var n=new A0;return n.restart(e,t,r),n}function H9(){M0(),++Zh;for(var e=Xv,t;e;)(t=Yf-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Zh}function W9(){Yf=(Hv=T0.now())+Zv,Zh=S0=0;try{H9()}finally{Zh=0,Vnt(),Yf=0}}function znt(){var e=T0.now(),t=e-Hv;t>G9&&(Zv-=t,Hv=e)}function Vnt(){for(var e,t=Xv,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Xv=r);I0=e,A3(n)}function A3(e){if(!Zh){S0&&(S0=clearTimeout(S0));var t=e-Yf;t>24?(e<1/0&&(S0=setTimeout(W9,e-T0.now()-Zv)),v0&&(v0=clearInterval(v0))):(v0||(Hv=T0.now(),v0=setInterval(znt,G9)),Zh=1,X9(W9))}}function Qv(e,t,r){var n=new A0;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var jnt=Uf("start","end","cancel","interrupt"),qnt=[],Q9=0,Z9=1,t2=2,Jv=3,K9=4,e2=5,E0=6;function ou(e,t,r,n,i,o){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;Ynt(e,r,{name:t,index:n,group:i,on:jnt,tween:qnt,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Q9})}function D0(e,t){var r=Wr(e,t);if(r.state>Q9)throw new Error("too late; already scheduled");return r}function wn(e,t){var r=Wr(e,t);if(r.state>Jv)throw new Error("too late; already running");return r}function Wr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Ynt(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=Kv(o,0,r.time);function o(l){r.state=Z9,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var u,f,d,h;if(r.state!==Z9)return c();for(u in n)if(h=n[u],h.name===r.name){if(h.state===Jv)return Qv(s);h.state===K9?(h.state=E0,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[u]):+u<t&&(h.state=E0,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[u])}if(Qv(function(){r.state===Jv&&(r.state=K9,r.timer.restart(a,r.delay,r.time),a(l))}),r.state=t2,r.on.call("start",e,e.__data__,r.index,r.group),r.state===t2){for(r.state=Jv,i=new Array(d=r.tween.length),u=0,f=-1;u<d;++u)(h=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=e2,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);r.state===e2&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=E0,r.timer.stop(),delete n[t];for(var l in n)return;delete e.__transition}}function da(e,t){var r=e.__transition,n,i,o=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((n=r[s]).name!==t){o=!1;continue}i=n.state>t2&&n.state<e2,n.state=E0,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[s]}o&&delete e.__transition}}function J9(e){return this.each(function(){da(this,e)})}function Wnt(e,t){var r,n;return function(){var i=wn(this,e),o=i.tween;if(o!==r){n=r=o;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}i.tween=n}}function Gnt(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var o=wn(this,e),s=o.tween;if(s!==n){i=(n=s).slice();for(var a={name:t,value:r},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function t$(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=Wr(this.node(),r).tween,i=0,o=n.length,s;i<o;++i)if((s=n[i]).name===e)return s.value;return null}return this.each((t==null?Wnt:Gnt)(r,e,t))}function Kh(e,t,r){var n=e._id;return e.each(function(){var i=wn(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return Wr(i,n).value[t]}}function r2(e,t){var r;return(typeof t=="number"?Ke:t instanceof ji?Io:(r=ji(t))?(t=r,Io):w0)(e,t)}function Xnt(e){return function(){this.removeAttribute(e)}}function Hnt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Znt(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===n?o:o=t(n=s,r)}}function Knt(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===n?o:o=t(n=s,r)}}function Qnt(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function Jnt(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function e$(e,t){var r=Uc(e),n=r==="transform"?v3:r2;return this.attrTween(e,typeof t=="function"?(r.local?Jnt:Qnt)(r,n,Kh(this,"attr."+e,t)):t==null?(r.local?Hnt:Xnt)(r):(r.local?Knt:Znt)(r,n,t))}function tit(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function eit(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function rit(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&eit(e,o)),r}return i._value=t,i}function nit(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&tit(e,o)),r}return i._value=t,i}function r$(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=Uc(e);return this.tween(r,(n.local?rit:nit)(n,t))}function iit(e,t){return function(){D0(this,e).delay=+t.apply(this,arguments)}}function oit(e,t){return t=+t,function(){D0(this,e).delay=t}}function n$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iit:oit)(t,e)):Wr(this.node(),t).delay}function sit(e,t){return function(){wn(this,e).duration=+t.apply(this,arguments)}}function ait(e,t){return t=+t,function(){wn(this,e).duration=t}}function i$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sit:ait)(t,e)):Wr(this.node(),t).duration}function cit(e,t){if(typeof t!="function")throw new Error;return function(){wn(this,e).ease=t}}function o$(e){var t=this._id;return arguments.length?this.each(cit(t,e)):Wr(this.node(),t).ease}function lit(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;wn(this,e).ease=r}}function s$(e){if(typeof e!="function")throw new Error;return this.each(lit(this._id,e))}function a$(e){typeof e!="function"&&(e=d0(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Jn(n,this._parents,this._name,this._id)}function c$(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,o=Math.min(n,i),s=new Array(n),a=0;a<o;++a)for(var c=t[a],l=r[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<n;++a)s[a]=t[a];return new Jn(s,this._parents,this._name,this._id)}function uit(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function fit(e,t,r){var n,i,o=uit(t)?D0:wn;return function(){var s=o(this,e),a=s.on;a!==n&&(i=(n=a).copy()).on(t,r),s.on=i}}function l$(e,t){var r=this._id;return arguments.length<2?Wr(this.node(),r).on.on(e):this.each(fit(r,e,t))}function dit(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function u$(){return this.on("end.remove",dit(this._id))}function f$(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Pf(e));for(var n=this._groups,i=n.length,o=new Array(i),s=0;s<i;++s)for(var a=n[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,ou(l[d],t,r,d,l,Wr(u,r)));return new Jn(o,this._parents,t,r)}function d$(e){var t=this._name,r=this._id;typeof e!="function"&&(e=f0(e));for(var n=this._groups,i=n.length,o=[],s=[],a=0;a<i;++a)for(var c=n[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=Wr(u,r),m=0,y=d.length;m<y;++m)(h=d[m])&&ou(h,t,r,m,d,p);o.push(d),s.push(u)}return new Jn(o,s,t,r)}var hit=$c.prototype.constructor;function h$(){return new hit(this._groups,this._parents)}function pit(e,t){var r,n,i;return function(){var o=ru(this,e),s=(this.style.removeProperty(e),ru(this,e));return o===s?null:o===r&&s===n?i:i=t(r=o,n=s)}}function p$(e){return function(){this.style.removeProperty(e)}}function mit(e,t,r){var n,i=r+"",o;return function(){var s=ru(this,e);return s===i?null:s===n?o:o=t(n=s,r)}}function yit(e,t,r){var n,i,o;return function(){var s=ru(this,e),a=r(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),ru(this,e))),s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a))}}function git(e,t){var r,n,i,o="style."+t,s="end."+o,a;return function(){var c=wn(this,e),l=c.on,u=c.value[o]==null?a||(a=p$(t)):void 0;(l!==r||i!==u)&&(n=(r=l).copy()).on(s,i=u),c.on=n}}function m$(e,t,r){var n=(e+="")=="transform"?w3:r2;return t==null?this.styleTween(e,pit(e,n)).on("end.style."+e,p$(e)):typeof t=="function"?this.styleTween(e,yit(e,n,Kh(this,"style."+e,t))).each(git(this._id,e)):this.styleTween(e,mit(e,n,t),r).on("end.style."+e,null)}function bit(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function xit(e,t,r){var n,i;function o(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&bit(e,s,r)),n}return o._value=t,o}function y$(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,xit(e,t,r??""))}function _it(e){return function(){this.textContent=e}}function wit(e){return function(){var t=e(this);this.textContent=t??""}}function g$(e){return this.tween("text",typeof e=="function"?wit(Kh(this,"text",e)):_it(e==null?"":e+""))}function vit(e){return function(t){this.textContent=e.call(this,t)}}function Sit(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&vit(i)),t}return n._value=e,n}function b$(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,Sit(e))}function x$(){for(var e=this._name,t=this._id,r=n2(),n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=Wr(c,t);ou(c,e,r,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Jn(n,this._parents,e,r)}function _$(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};r.each(function(){var l=wn(this,n),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var Iit=0;function Jn(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function w$(e){return $c().transition(e)}function n2(){return++Iit}var jc=$c.prototype;Jn.prototype=w$.prototype={constructor:Jn,select:f$,selectAll:d$,selectChild:jc.selectChild,selectChildren:jc.selectChildren,filter:a$,merge:c$,selection:h$,transition:x$,call:jc.call,nodes:jc.nodes,node:jc.node,size:jc.size,empty:jc.empty,each:jc.each,on:l$,attr:e$,attrTween:r$,style:m$,styleTween:y$,text:g$,textTween:b$,remove:u$,tween:t$,delay:n$,duration:i$,ease:o$,easeVarying:s$,end:_$,[Symbol.iterator]:jc[Symbol.iterator]};function i2(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Tit={time:null,delay:0,duration:250,ease:i2};function Ait(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function v$(e){var t,r;e instanceof Jn?(t=e._id,e=e._name):(t=n2(),(r=Tit).time=M0(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&ou(c,e,t,l,s,r||Ait(c,t));return new Jn(n,this._parents,e,t)}$c.prototype.interrupt=J9;$c.prototype.transition=v$;var o2=e=>()=>e;function M3(e,{sourceEvent:t,target:r,selection:n,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function S$(e){e.stopImmediatePropagation()}function s2(e){e.preventDefault(),e.stopImmediatePropagation()}var I$={name:"drag"},E3={name:"space"},Qh={name:"handle"},Jh={name:"center"},{abs:T$,max:On,min:Nn}=Math;function A$(e){return[+e[0],+e[1]]}function B3(e){return[A$(e[0]),A$(e[1])]}var a2={name:"x",handles:["w","e"].map(B0),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]]}},c2={name:"y",handles:["n","s"].map(B0),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]]}},Mit={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(B0),input:function(e){return e==null?null:B3(e)},output:function(e){return e}},qc={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"},M$={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},E$={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Eit={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Dit={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function B0(e){return{type:e}}function Bit(e){return!e.ctrlKey&&!e.button}function Oit(){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 Nit(){return navigator.maxTouchPoints||"ontouchstart"in this}function D3(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function Fit(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function O3(){return R3(a2)}function N3(){return R3(c2)}function F3(){return R3(Mit)}function R3(e){var t=Oit,r=Bit,n=Nit,i=!0,o=Uf("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([B0("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",qc.overlay).merge(g).each(function(){var x=D3(this).extent;ce(this).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1])}),y.selectAll(".selection").data([B0("selection")]).enter().append("rect").attr("class","selection").attr("cursor",qc.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var b=y.selectAll(".handle").data(e.handles,function(x){return x.type});b.exit().remove(),b.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return qc[x.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(n).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,b){y.tween?y.on("start.brush",function(x){u(this,arguments).beforestart().start(x)}).on("interrupt.brush end.brush",function(x){u(this,arguments).end(x)}).tween("brush",function(){var x=this,_=x.__brush,v=u(x,arguments),w=_.selection,I=e.input(typeof g=="function"?g.apply(this,arguments):g,_.extent),E=qi(w,I);function T(B){_.selection=B===1&&I===null?null:E(B),l.call(x),v.brush()}return w!==null&&I!==null?T:T(1)}):y.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof g=="function"?g.apply(x,_):g,v.extent),I=u(x,_).beforestart();da(x),v.selection=w===null?null:w,l.call(x),I.start(b).brush(b).end(b)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=ce(this),g=D3(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,b){var x=y.__brush.emitter;return x&&(!b||!x.clean)?x:new f(y,g,b)}function f(y,g,b){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=b}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,b){var x=ce(this.that).datum();o.call(y,this.that,new M3(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function d(y){if(a&&!y.touches||!r.apply(this,arguments))return;var g=this,b=y.target.__data__.type,x=(i&&y.metaKey?b="overlay":b)==="selection"?I$:i&&y.altKey?Jh:Qh,_=e===c2?null:Eit[b],v=e===a2?null:Dit[b],w=D3(g),I=w.extent,E=w.selection,T=I[0][0],B,A,O=I[0][1],L,S,M=I[1][0],D,C,U=I[1][1],k,$,z=0,V=0,Q,st=_&&v&&i&&y.shiftKey,ct,ut,X=Array.from(y.touches||[y],nt=>{let Ee=nt.identifier;return nt=Dn(nt,g),nt.point0=nt.slice(),nt.identifier=Ee,nt});da(g);var lt=u(g,arguments,!0).beforestart();if(b==="overlay"){E&&(Q=!0);let nt=[X[0],X[1]||X[0]];w.selection=E=[[B=e===c2?T:Nn(nt[0][0],nt[1][0]),L=e===a2?O:Nn(nt[0][1],nt[1][1])],[D=e===c2?M:On(nt[0][0],nt[1][0]),k=e===a2?U:On(nt[0][1],nt[1][1])]],X.length>1&&Jt(y)}else B=E[0][0],L=E[0][1],D=E[1][0],k=E[1][1];A=B,S=L,C=D,$=k;var q=ce(g).attr("pointer-events","none"),tt=q.selectAll(".overlay").attr("cursor",qc[b]);if(y.touches)lt.moved=j,lt.ended=gt;else{var at=ce(y.view).on("mousemove.brush",j,!0).on("mouseup.brush",gt,!0);i&&at.on("keydown.brush",he,!0).on("keyup.brush",ye,!0),p0(y.view)}l.call(g),lt.start(y,x.name);function j(nt){for(let Ee of nt.changedTouches||[nt])for(let Ei of X)Ei.identifier===Ee.identifier&&(Ei.cur=Dn(Ee,g));if(st&&!ct&&!ut&&X.length===1){let Ee=X[0];T$(Ee.cur[0]-Ee[0])>T$(Ee.cur[1]-Ee[1])?ut=!0:ct=!0}for(let Ee of X)Ee.cur&&(Ee[0]=Ee.cur[0],Ee[1]=Ee.cur[1]);Q=!0,s2(nt),Jt(nt)}function Jt(nt){let Ee=X[0],Ei=Ee.point0;var Ts;switch(z=Ee[0]-Ei[0],V=Ee[1]-Ei[1],x){case E3:case I$:{_&&(z=On(T-B,Nn(M-D,z)),A=B+z,C=D+z),v&&(V=On(O-L,Nn(U-k,V)),S=L+V,$=k+V);break}case Qh:{X[1]?(_&&(A=On(T,Nn(M,X[0][0])),C=On(T,Nn(M,X[1][0])),_=1),v&&(S=On(O,Nn(U,X[0][1])),$=On(O,Nn(U,X[1][1])),v=1)):(_<0?(z=On(T-B,Nn(M-B,z)),A=B+z,C=D):_>0&&(z=On(T-D,Nn(M-D,z)),A=B,C=D+z),v<0?(V=On(O-L,Nn(U-L,V)),S=L+V,$=k):v>0&&(V=On(O-k,Nn(U-k,V)),S=L,$=k+V));break}case Jh:{_&&(A=On(T,Nn(M,B-z*_)),C=On(T,Nn(M,D+z*_))),v&&(S=On(O,Nn(U,L-V*v)),$=On(O,Nn(U,k+V*v)));break}}C<A&&(_*=-1,Ts=B,B=D,D=Ts,Ts=A,A=C,C=Ts,b in M$&&tt.attr("cursor",qc[b=M$[b]])),$<S&&(v*=-1,Ts=L,L=k,k=Ts,Ts=S,S=$,$=Ts,b in E$&&tt.attr("cursor",qc[b=E$[b]])),w.selection&&(E=w.selection),ct&&(A=E[0][0],C=E[1][0]),ut&&(S=E[0][1],$=E[1][1]),(E[0][0]!==A||E[0][1]!==S||E[1][0]!==C||E[1][1]!==$)&&(w.selection=[[A,S],[C,$]],l.call(g),lt.brush(nt,x.name))}function gt(nt){if(S$(nt),nt.touches){if(nt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else m0(nt.view,Q),at.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),tt.attr("cursor",qc.overlay),w.selection&&(E=w.selection),Fit(E)&&(w.selection=null,l.call(g)),lt.end(nt,x.name)}function he(nt){switch(nt.keyCode){case 16:{st=_&&v;break}case 18:{x===Qh&&(_&&(D=C-z*_,B=A+z*_),v&&(k=$-V*v,L=S+V*v),x=Jh,Jt(nt));break}case 32:{(x===Qh||x===Jh)&&(_<0?D=C-z:_>0&&(B=A-z),v<0?k=$-V:v>0&&(L=S-V),x=E3,tt.attr("cursor",qc.selection),Jt(nt));break}default:return}s2(nt)}function ye(nt){switch(nt.keyCode){case 16:{st&&(ct=ut=st=!1,Jt(nt));break}case 18:{x===Jh&&(_<0?D=C:_>0&&(B=A),v<0?k=$:v>0&&(L=S),x=Qh,Jt(nt));break}case 32:{x===E3&&(nt.altKey?(_&&(D=C-z*_,B=A+z*_),v&&(k=$-V*v,L=S+V*v),x=Jh):(_<0?D=C:_>0&&(B=A),v<0?k=$:v>0&&(L=S),x=Qh),tt.attr("cursor",qc[b]),Jt(nt));break}default:return}s2(nt)}}function h(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=B3(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:o2(B3(y)),c):t},c.filter=function(y){return arguments.length?(r=typeof y=="function"?y:o2(!!y),c):r},c.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:o2(!!y),c):n},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var L3=Math.PI,k3=2*L3,Wf=1e-6,Rit=k3-Wf;function D$(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function Lit(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return D$;let r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;i<o;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}var su=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?D$:Lit(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,o,s){this._append`C${+t},${+r},${+n},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,r,n,i,o){if(t=+t,r=+r,n=+n,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=n-t,l=i-r,u=s-t,f=a-r,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Wf)if(!(Math.abs(f*c-l*u)>Wf)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-s,p=i-a,m=c*c+l*l,y=h*h+p*p,g=Math.sqrt(m),b=Math.sqrt(d),x=o*Math.tan((L3-Math.acos((m+d-y)/(2*g*b)))/2),_=x/b,v=x/g;Math.abs(_-1)>Wf&&this._append`L${t+_*u},${r+_*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=r+v*l}`}}arc(t,r,n,i,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),c=n*Math.sin(i),l=t+a,u=r+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Wf||Math.abs(this._y1-u)>Wf)&&this._append`L${l},${u}`,n&&(d<0&&(d=d%k3+k3),d>Rit?this._append`A${n},${n},0,1,${f},${t-a},${r-c}A${n},${n},0,1,${f},${this._x1=l},${this._y1=u}`:d>Wf&&this._append`A${n},${n},0,${+(d>=L3)},${f},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};function B$(){return new su}B$.prototype=su.prototype;function ti(e=3){return new su(+e)}var kit=Array.prototype,l2=kit.slice;function O$(e,t){return e-t}function N$(e){for(var t=0,r=e.length,n=e[r-1][1]*e[0][0]-e[r-1][0]*e[0][1];++t<r;)n+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return n}var ha=e=>()=>e;function F$(e,t){for(var r=-1,n=t.length,i;++r<n;)if(i=Cit(e,t[r]))return i;return 0}function Cit(e,t){for(var r=t[0],n=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(Uit(c,f,t))return 0;u>n!=h>n&&r<(d-l)*(n-u)/(h-u)+l&&(i=-i)}return i}function Uit(e,t,r){var n;return Pit(e,t,r)&&$it(e[n=+(e[0]===t[0])],r[n],t[n])}function Pit(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function $it(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function R$(){}var Yc=[[],[[[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 au(){var e=1,t=1,r=tu,n=c;function i(l){var u=r(l);if(Array.isArray(u))u=u.slice().sort(O$);else{let f=Oe(l,zit);for(u=xn(...zh(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){n(p,l,f),N$(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(F$((g=d[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,y,g,b,x;for(p=m=-1,g=Gf(l[0],u),Yc[g<<1].forEach(_);++p<e-1;)y=g,g=Gf(l[p+1],u),Yc[y|g<<1].forEach(_);for(Yc[g<<0].forEach(_);++m<t-1;){for(p=-1,g=Gf(l[m*e+e],u),b=Gf(l[m*e],u),Yc[g<<1|b<<2].forEach(_);++p<e-1;)y=g,g=Gf(l[m*e+e+p+1],u),x=b,b=Gf(l[m*e+p+1],u),Yc[y|g<<1|b<<2|x<<3].forEach(_);Yc[g|b<<3].forEach(_)}for(p=-1,b=l[m*e]>=u,Yc[b<<2].forEach(_);++p<e-1;)x=b,b=Gf(l[m*e+p+1],u),Yc[b<<2|x<<3].forEach(_);Yc[b<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+m],I=[v[1][0]+p,v[1][1]+m],E=a(w),T=a(I),B,A;(B=h[E])?(A=d[T])?(delete h[B.end],delete d[A.start],B===A?(B.ring.push(I),f(B.ring)):d[B.start]=h[A.end]={start:B.start,end:A.end,ring:B.ring.concat(A.ring)}):(delete h[B.end],B.ring.push(I),h[B.end=T]=B):(B=d[T])?(A=h[E])?(delete d[B.start],delete h[A.end],B===A?(B.ring.push(I),f(B.ring)):d[A.start]=h[B.end]={start:A.start,end:B.end,ring:A.ring.concat(B.ring)}):(delete d[B.start],B.ring.unshift(w),d[B.start=E]=B):d[E]=h[T]={start:E,end:T,ring:[w,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,y=p|0,g=C3(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=L$(h,C3(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=L$(p,C3(u[(y-1)*e+m]),g,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(r=typeof l=="function"?l:Array.isArray(l)?ha(l2.call(l)):ha(l),i):r},i.smooth=function(l){return arguments.length?(n=l?c:R$,i):n===c},i}function zit(e){return isFinite(e)?e:NaN}function Gf(e,t){return e==null?!1:+e>=t}function C3(e){return e==null||isNaN(e=+e)?-1/0:e}function L$(e,t,r,n){let i=n-t,o=r-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function Vit(e){return e[0]}function jit(e){return e[1]}function qit(){return 1}function U3(){var e=Vit,t=jit,r=qit,n=960,i=500,o=20,s=2,a=o*3,c=n+a*2>>s,l=i+a*2>>s,u=ha(20);function f(b){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let L of b){var w=(e(L,++v,b)+a)*_,I=(t(L,v,b)+a)*_,E=+r(L,v,b);if(E&&w>=0&&w<c&&I>=0&&I<l){var T=Math.floor(w),B=Math.floor(I),A=w-T-.5,O=I-B-.5;x[T+B*c]+=(1-A)*(1-O)*E,x[T+1+B*c]+=A*(1-O)*E,x[T+1+(B+1)*c]+=A*O*E,x[T+(B+1)*c]+=(1-A)*O*E}}return o0({data:x,width:c,height:l},o*_),x}function d(b){var x=f(b),_=u(x),v=Math.pow(2,2*s);return Array.isArray(_)||(_=xn(Number.MIN_VALUE,me(x)/v,_)),au().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,I)=>(w.value=+_[I],h(w)))}d.contours=function(b){var x=f(b),_=au().size([c,l]),v=Math.pow(2,2*s),w=I=>{I=+I;var E=h(_.contour(x,I*v));return E.value=I,E};return Object.defineProperty(w,"max",{get:()=>me(x)/v}),w};function h(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(m)}function m(b){b.forEach(y)}function y(b){b[0]=b[0]*Math.pow(2,s)-a,b[1]=b[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=n+a*2>>s,l=i+a*2>>s,d}return d.x=function(b){return arguments.length?(e=typeof b=="function"?b:ha(+b),d):e},d.y=function(b){return arguments.length?(t=typeof b=="function"?b:ha(+b),d):t},d.weight=function(b){return arguments.length?(r=typeof b=="function"?b:ha(+b),d):r},d.size=function(b){if(!arguments.length)return[n,i];var x=+b[0],_=+b[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return n=x,i=_,g()},d.cellSize=function(b){if(!arguments.length)return 1<<s;if(!((b=+b)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(b)/Math.LN2),g()},d.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?ha(l2.call(b)):ha(b),d):u},d.bandwidth=function(b){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((b=+b)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*b*b+1)-1)/2,g()},d}var _e=11102230246251565e-32,Rr=134217729,O0=(3+8*_e)*_e;function Xf(e,t,r,n,i){let o,s,a,c,l=t[0],u=n[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=n[++d]);let h=0;if(f<e&&d<r)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=n[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<r;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<r;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function N0(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function G(e){return new Float64Array(e)}var Yit=(3+16*_e)*_e,Wit=(2+12*_e)*_e,Git=(9+64*_e)*_e*_e,tp=G(4),k$=G(8),C$=G(12),U$=G(16),ei=G(4);function Xit(e,t,r,n,i,o,s){let a,c,l,u,f,d,h,p,m,y,g,b,x,_,v,w,I,E,T=e-i,B=r-i,A=t-o,O=n-o;_=T*O,d=Rr*T,h=d-(d-T),p=T-h,d=Rr*O,m=d-(d-O),y=O-m,v=p*y-(_-h*m-p*m-h*y),w=A*B,d=Rr*A,h=d-(d-A),p=A-h,d=Rr*B,m=d-(d-B),y=B-m,I=p*y-(w-h*m-p*m-h*y),g=v-I,f=v-g,tp[0]=v-(g+f)+(f-I),b=_+g,f=b-_,x=_-(b-f)+(g-f),g=x-w,f=x-g,tp[1]=x-(g+f)+(f-w),E=b+g,f=E-b,tp[2]=b-(E-f)+(g-f),tp[3]=E;let L=N0(4,tp),S=Wit*s;if(L>=S||-L>=S||(f=e-T,a=e-(T+f)+(f-i),f=r-B,l=r-(B+f)+(f-i),f=t-A,c=t-(A+f)+(f-o),f=n-O,u=n-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=Git*s+O0*Math.abs(L),L+=T*u+O*a-(A*l+B*c),L>=S||-L>=S))return L;_=a*O,d=Rr*a,h=d-(d-a),p=a-h,d=Rr*O,m=d-(d-O),y=O-m,v=p*y-(_-h*m-p*m-h*y),w=c*B,d=Rr*c,h=d-(d-c),p=c-h,d=Rr*B,m=d-(d-B),y=B-m,I=p*y-(w-h*m-p*m-h*y),g=v-I,f=v-g,ei[0]=v-(g+f)+(f-I),b=_+g,f=b-_,x=_-(b-f)+(g-f),g=x-w,f=x-g,ei[1]=x-(g+f)+(f-w),E=b+g,f=E-b,ei[2]=b-(E-f)+(g-f),ei[3]=E;let M=Xf(4,tp,4,ei,k$);_=T*u,d=Rr*T,h=d-(d-T),p=T-h,d=Rr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=A*l,d=Rr*A,h=d-(d-A),p=A-h,d=Rr*l,m=d-(d-l),y=l-m,I=p*y-(w-h*m-p*m-h*y),g=v-I,f=v-g,ei[0]=v-(g+f)+(f-I),b=_+g,f=b-_,x=_-(b-f)+(g-f),g=x-w,f=x-g,ei[1]=x-(g+f)+(f-w),E=b+g,f=E-b,ei[2]=b-(E-f)+(g-f),ei[3]=E;let D=Xf(M,k$,4,ei,C$);_=a*u,d=Rr*a,h=d-(d-a),p=a-h,d=Rr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=c*l,d=Rr*c,h=d-(d-c),p=c-h,d=Rr*l,m=d-(d-l),y=l-m,I=p*y-(w-h*m-p*m-h*y),g=v-I,f=v-g,ei[0]=v-(g+f)+(f-I),b=_+g,f=b-_,x=_-(b-f)+(g-f),g=x-w,f=x-g,ei[1]=x-(g+f)+(f-w),E=b+g,f=E-b,ei[2]=b-(E-f)+(g-f),ei[3]=E;let C=Xf(D,C$,4,ei,U$);return U$[C-1]}function ep(e,t,r,n,i,o){let s=(t-o)*(r-i),a=(e-i)*(n-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=Yit*l?c:-Xit(e,t,r,n,i,o,l)}var Qkt=(7+56*_e)*_e,Jkt=(3+28*_e)*_e,tCt=(26+288*_e)*_e*_e,eCt=G(4),rCt=G(4),nCt=G(4),iCt=G(4),oCt=G(4),sCt=G(4),aCt=G(4),cCt=G(4),lCt=G(4),uCt=G(8),fCt=G(8),dCt=G(8),hCt=G(4),pCt=G(8),mCt=G(8),yCt=G(8),gCt=G(12),bCt=G(192),xCt=G(192);var vCt=(10+96*_e)*_e,SCt=(4+48*_e)*_e,ICt=(44+576*_e)*_e*_e,TCt=G(4),ACt=G(4),MCt=G(4),ECt=G(4),DCt=G(4),BCt=G(4),OCt=G(4),NCt=G(4),FCt=G(8),RCt=G(8),LCt=G(8),kCt=G(8),CCt=G(8),UCt=G(8),PCt=G(8),$Ct=G(8),zCt=G(8),VCt=G(4),jCt=G(4),qCt=G(4),YCt=G(8),WCt=G(16),GCt=G(16),XCt=G(16),HCt=G(32),ZCt=G(32),KCt=G(48),QCt=G(64),JCt=G(1152),t5t=G(1152);var i5t=(16+224*_e)*_e,o5t=(5+72*_e)*_e,s5t=(71+1408*_e)*_e*_e,a5t=G(4),c5t=G(4),l5t=G(4),u5t=G(4),f5t=G(4),d5t=G(4),h5t=G(4),p5t=G(4),m5t=G(4),y5t=G(4),g5t=G(24),b5t=G(24),x5t=G(24),_5t=G(24),w5t=G(24),v5t=G(24),S5t=G(24),I5t=G(24),T5t=G(24),A5t=G(24),M5t=G(1152),E5t=G(1152),D5t=G(1152),B5t=G(1152),O5t=G(1152),N5t=G(2304),F5t=G(2304),R5t=G(3456),L5t=G(5760),k5t=G(8),C5t=G(8),U5t=G(8),P5t=G(16),$5t=G(24),z5t=G(48),V5t=G(48),j5t=G(96),q5t=G(192),Y5t=G(384),W5t=G(384),G5t=G(384),X5t=G(768);var H5t=G(96),Z5t=G(96),K5t=G(96),Q5t=G(1152);var $$=Math.pow(2,-52),u2=new Uint32Array(512),np=class e{static from(t,r=tot,n=eot){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=r(a),o[2*s+1]=n(a)}return new e(o)}constructor(t){let r=t.length>>1;if(r>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let n=Math.max(2*r-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){let{coords:t,_hullPrev:r,_hullNext:n,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let T=0;T<s;T++){let B=t[2*T],A=t[2*T+1];B<a&&(a=B),A<c&&(c=A),B>l&&(l=B),A>u&&(u=A),this._ids[T]=T}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let T=0,B=1/0;T<s;T++){let A=P3(f,d,t[2*T],t[2*T+1]);A<B&&(h=T,B=A)}let y=t[2*h],g=t[2*h+1];for(let T=0,B=1/0;T<s;T++){if(T===h)continue;let A=P3(y,g,t[2*T],t[2*T+1]);A<B&&A>0&&(p=T,B=A)}let b=t[2*p],x=t[2*p+1],_=1/0;for(let T=0;T<s;T++){if(T===h||T===p)continue;let B=Qit(y,g,b,x,t[2*T],t[2*T+1]);B<_&&(m=T,_=B)}let v=t[2*m],w=t[2*m+1];if(_===1/0){for(let A=0;A<s;A++)this._dists[A]=t[2*A]-t[0]||t[2*A+1]-t[1];rp(this._ids,this._dists,0,s-1);let T=new Uint32Array(s),B=0;for(let A=0,O=-1/0;A<s;A++){let L=this._ids[A],S=this._dists[L];S>O&&(T[B++]=L,O=S)}this.hull=T.subarray(0,B),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(ep(y,g,b,x,v,w)<0){let T=p,B=b,A=x;p=m,b=v,x=w,m=T,v=B,w=A}let I=Jit(y,g,b,x,v,w);this._cx=I.x,this._cy=I.y;for(let T=0;T<s;T++)this._dists[T]=P3(t[2*T],t[2*T+1],I.x,I.y);rp(this._ids,this._dists,0,s-1),this._hullStart=h;let E=3;n[h]=r[m]=p,n[p]=r[h]=m,n[m]=r[p]=h,i[h]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=h,o[this._hashKey(b,x)]=p,o[this._hashKey(v,w)]=m,this.trianglesLen=0,this._addTriangle(h,p,m,-1,-1,-1);for(let T=0,B,A;T<this._ids.length;T++){let O=this._ids[T],L=t[2*O],S=t[2*O+1];if(T>0&&Math.abs(L-B)<=$$&&Math.abs(S-A)<=$$||(B=L,A=S,O===h||O===p||O===m))continue;let M=0;for(let $=0,z=this._hashKey(L,S);$<this._hashSize&&(M=o[(z+$)%this._hashSize],!(M!==-1&&M!==n[M]));$++);M=r[M];let D=M,C;for(;C=n[D],ep(L,S,t[2*D],t[2*D+1],t[2*C],t[2*C+1])>=0;)if(D=C,D===M){D=-1;break}if(D===-1)continue;let U=this._addTriangle(D,O,n[D],-1,-1,i[D]);i[O]=this._legalize(U+2),i[D]=U,E++;let k=n[D];for(;C=n[k],ep(L,S,t[2*k],t[2*k+1],t[2*C],t[2*C+1])<0;)U=this._addTriangle(k,O,C,i[O],-1,i[k]),i[O]=this._legalize(U+2),n[k]=k,E--,k=C;if(D===M)for(;C=r[D],ep(L,S,t[2*C],t[2*C+1],t[2*D],t[2*D+1])<0;)U=this._addTriangle(C,O,D,-1,i[D],i[C]),this._legalize(U+2),i[C]=U,n[D]=D,E--,D=C;this._hullStart=r[O]=D,n[D]=r[k]=O,n[O]=k,o[this._hashKey(L,S)]=O,o[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(E);for(let T=0,B=this._hullStart;T<E;T++)this.hull[T]=B,B=n[B];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(Zit(t-this._cx,r-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:r,_halfedges:n,coords:i}=this,o=0,s=0;for(;;){let a=n[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=u2[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=r[s],h=r[t],p=r[u],m=r[f];if(Kit(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){r[t]=m,r[a]=d;let g=n[f];if(g===-1){let x=this._hullStart;do{if(this._hullTri[x]===f){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,g),this._link(a,n[s]),this._link(s,f);let b=l+(a+1)%3;o<u2.length&&(u2[o++]=b)}else{if(o===0)break;t=u2[--o]}}return s}_link(t,r){this._halfedges[t]=r,r!==-1&&(this._halfedges[r]=t)}_addTriangle(t,r,n,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=r,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function Zit(e,t){let r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function P3(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}function Kit(e,t,r,n,i,o,s,a){let c=e-s,l=t-a,u=r-s,f=n-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,y=d*d+h*h;return c*(f*y-m*h)-l*(u*y-m*d)+p*(u*h-f*d)<0}function Qit(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function Jit(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function rp(e,t,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){let o=e[i],s=t[o],a=i-1;for(;a>=r&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=r+n>>1,o=r+1,s=n;F0(e,i,o),t[e[r]]>t[e[n]]&&F0(e,r,n),t[e[o]]>t[e[n]]&&F0(e,o,n),t[e[r]]>t[e[o]]&&F0(e,r,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;F0(e,o,s)}e[r+1]=e[s],e[s]=a,n-o+1>=s-r?(rp(e,t,o,n),rp(e,t,r,s-1)):(rp(e,t,r,s-1),rp(e,t,o,n))}}function F0(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function tot(e){return e[0]}function eot(e){return e[1]}var To=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,r){this._+=`L${this._x1=+t},${this._y1=+r}`}arc(t,r,n){t=+t,r=+r,n=+n;let i=t+n,o=r;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),n&&(this._+=`A${n},${n},0,1,1,${t-n},${r}A${n},${n},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,r,n,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${+n}v${+i}h${-n}Z`}value(){return this._||null}};var cu=class{constructor(){this._=[]}moveTo(t,r){this._.push([t,r])}closePath(){this._.push(this._[0].slice())}lineTo(t,r){this._.push([t,r])}value(){return this._.length?this._:null}};var R0=class{constructor(t,[r,n,i,o]=[0,0,960,500]){if(!((i=+i)>=(r=+r))||!((o=+o)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=r,this.ymax=o,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:r,triangles:n},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let m=0,y=0,g=n.length,b,x;m<g;m+=3,y+=2){let _=n[m]*2,v=n[m+1]*2,w=n[m+2]*2,I=t[_],E=t[_+1],T=t[v],B=t[v+1],A=t[w],O=t[w+1],L=T-I,S=B-E,M=A-I,D=O-E,C=(L*D-S*M)*2;if(Math.abs(C)<1e-9){if(o===void 0){o=s=0;for(let k of r)o+=t[k*2],s+=t[k*2+1];o/=r.length,s/=r.length}let U=1e9*Math.sign((o-I)*D-(s-E)*M);b=(I+A)/2-U*D,x=(E+O)/2+U*M}else{let U=1/C,k=L*L+S*S,$=M*M+D*D;b=I+(D*k-S*$)*U,x=E+(L*$-M*k)*U}a[y]=b,a[y+1]=x}let c=r[r.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<r.length;++m)c=r[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let r=t==null?t=new To:void 0,{delaunay:{halfedges:n,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],y=s[h+1],g=s[p],b=s[p+1];this._renderSegment(m,y,g,b,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return r&&r.value()}renderBounds(t){let r=t==null?t=new To:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),r&&r.value()}renderCell(t,r){let n=r==null?r=new To:void 0,i=this._clip(t);if(i===null||!i.length)return;r.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&r.lineTo(i[s],i[s+1]);return r.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let r=0,n=t.length/2;r<n;++r){let i=this.cellPolygon(r);i&&(i.index=r,yield i)}}cellPolygon(t){let r=new cu;return this.renderCell(t,r),r.value()}_renderSegment(t,r,n,i,o){let s,a=this._regioncode(t,r),c=this._regioncode(n,i);a===0&&c===0?(o.moveTo(t,r),o.lineTo(n,i)):(s=this._clipSegment(t,r,n,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,r,n){return r=+r,r!==r||(n=+n,n!==n)?!1:this.delaunay._step(t,r,n)===t}*neighbors(t){let r=this._clip(t);if(r)for(let n of this.delaunay.neighbors(t)){let i=this._clip(n);if(i){t:for(let o=0,s=r.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(r[o]===i[a]&&r[o+1]===i[a+1]&&r[(o+2)%s]===i[(a+c-2)%c]&&r[(o+3)%s]===i[(a+c-1)%c]){yield n;break t}}}}_cell(t){let{circumcenters:r,delaunay:{inedges:n,halfedges:i,triangles:o}}=this,s=n[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(r[l*2],r[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let r=this._cell(t);if(r===null)return null;let{vectors:n}=this,i=t*4;return this._simplify(n[i]||n[i+1]?this._clipInfinite(t,r,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(t,r))}_clipFinite(t,r){let n=r.length,i=null,o,s,a=r[n-2],c=r[n-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<n;h+=2)if(o=a,s=c,a=r[h],c=r[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,b,m,y]=p,f=d,d=this._edgecode(m,y),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,y):i=[m,y]}f=d,d=this._edgecode(g,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(g,b):i=[g,b]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,r,n,i,o,s){let a=o<s;for(a&&([t,r,n,i,o,s]=[n,i,t,r,s,o]);;){if(o===0&&s===0)return a?[n,i,t,r]:[t,r,n,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(n-t)*(this.ymax-r)/(i-r),l=this.ymax):u&4?(c=t+(n-t)*(this.ymin-r)/(i-r),l=this.ymin):u&2?(l=r+(i-r)*(this.xmax-t)/(n-t),c=this.xmax):(l=r+(i-r)*(this.xmin-t)/(n-t),c=this.xmin),o?(t=c,r=l,o=this._regioncode(t,r)):(n=c,i=l,s=this._regioncode(n,i))}}_clipInfinite(t,r,n,i,o,s){let a=Array.from(r),c;if((c=this._project(a[0],a[1],n,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,r,n,i,o){for(;r!==n;){let s,a;switch(r){case 5:r=4;continue;case 4:r=6,s=this.xmax,a=this.ymin;break;case 6:r=2;continue;case 2:r=10,s=this.xmax,a=this.ymax;break;case 10:r=8;continue;case 8:r=9,s=this.xmin,a=this.ymax;break;case 9:r=1;continue;case 1:r=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,r,n,i){let o=1/0,s,a,c;if(i<0){if(r<=this.ymin)return null;(s=(this.ymin-r)/i)<o&&(c=this.ymin,a=t+(o=s)*n)}else if(i>0){if(r>=this.ymax)return null;(s=(this.ymax-r)/i)<o&&(c=this.ymax,a=t+(o=s)*n)}if(n>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/n)<o&&(a=this.xmax,c=r+(o=s)*i)}else if(n<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/n)<o&&(a=this.xmin,c=r+(o=s)*i)}return[a,c]}_edgecode(t,r){return(t===this.xmin?1:t===this.xmax?2:0)|(r===this.ymin?4:r===this.ymax?8:0)}_regioncode(t,r){return(t<this.xmin?1:t>this.xmax?2:0)|(r<this.ymin?4:r>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let r=0;r<t.length;r+=2){let n=(r+2)%t.length,i=(r+4)%t.length;(t[r]===t[n]&&t[n]===t[i]||t[r+1]===t[n+1]&&t[n+1]===t[i+1])&&(t.splice(n,2),r-=2)}t.length||(t=null)}return t}};var rot=2*Math.PI,ip=Math.pow;function not(e){return e[0]}function iot(e){return e[1]}function oot(e){let{triangles:t,coords:r}=e;for(let n=0;n<t.length;n+=3){let i=2*t[n],o=2*t[n+1],s=2*t[n+2];if((r[s]-r[i])*(r[o+1]-r[i+1])-(r[o]-r[i])*(r[s+1]-r[i+1])>1e-10)return!1}return!0}function sot(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}var Ao=class e{static from(t,r=not,n=iot,i){return new e("length"in t?aot(t,r,n,i):Float64Array.from(cot(t,r,n,i)))}constructor(t){this._delaunator=new np(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,r=this.points;if(t.hull&&t.hull.length>2&&oot(t)){this.collinear=Int32Array.from({length:r.length/2},(d,h)=>h).sort((d,h)=>r[2*d]-r[2*h]||r[2*d+1]-r[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[r[2*c],r[2*c+1],r[2*l],r[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=r.length/2;d<h;++d){let p=sot(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new np(r)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=n.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(n[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new R0(this,t)}*neighbors(t){let{inedges:r,hull:n,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=r[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=n[(i[t]+1)%n.length];f!==u&&(yield f);return}}while(l!==c)}find(t,r,n=0){if(t=+t,t!==t||(r=+r,r!==r))return-1;let i=n,o;for(;(o=this._step(n,t,r))>=0&&o!==n&&o!==i;)n=o;return o}_step(t,r,n){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=ip(r-l[t*2],2)+ip(n-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=ip(r-l[p*2],2)+ip(n-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&ip(r-l[h*2],2)+ip(n-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let r=t==null?t=new To:void 0,{points:n,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(n[l],n[l+1]),t.lineTo(n[u],n[u+1])}return this.renderHull(t),r&&r.value()}renderPoints(t,r){r===void 0&&(!t||typeof t.moveTo!="function")&&(r=t,t=null),r=r==null?2:+r;let n=t==null?t=new To:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+r,c),t.arc(a,c,r,0,rot)}return n&&n.value()}renderHull(t){let r=t==null?t=new To:void 0,{hull:n,points:i}=this,o=n[0]*2,s=n.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*n[a];t.lineTo(i[c],i[c+1])}return t.closePath(),r&&r.value()}hullPolygon(){let t=new cu;return this.renderHull(t),t.value()}renderTriangle(t,r){let n=r==null?r=new To:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return r.moveTo(i[s],i[s+1]),r.lineTo(i[a],i[a+1]),r.lineTo(i[c],i[c+1]),r.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:t}=this;for(let r=0,n=t.length/3;r<n;++r)yield this.trianglePolygon(r)}trianglePolygon(t){let r=new cu;return this.renderTriangle(t,r),r.value()}};function aot(e,t,r,n){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(n,a,s,e),o[s*2+1]=r.call(n,a,s,e)}return o}function*cot(e,t,r,n){let i=0;for(let o of e)yield t.call(n,o,i,e),yield r.call(n,o,i,e),++i}function z$(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Hf(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function pa(e){return e=Hf(Math.abs(e)),e?e[1]:NaN}function V$(e,t){return function(r,n){for(var i=r.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>n&&(a=Math.max(1,n-c)),o.push(r.substring(i-=a,i+a)),!((c+=a+1)>n));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function j$(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var lot=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ma(e){if(!(t=lot.exec(e)))throw new Error("invalid format: "+e);var t;return new f2({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]})}ma.prototype=f2.prototype;function f2(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+""}f2.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 q$(e){t:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break t;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var $3;function Y$(e,t){var r=Hf(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-($3=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Hf(e,Math.max(0,t+o-1))[0]}function z3(e,t){var r=Hf(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var V3={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:z$,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)=>z3(e*100,t),r:z3,s:Y$,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function j3(e){return e}var W$=Array.prototype.map,G$=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function X$(e){var t=e.grouping===void 0||e.thousands===void 0?j3:V$(W$.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?j3:j$(W$.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=ma(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,b=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(b=!0,v="g"):V3[v]||(x===void 0&&(x=12),_=!0,v="g"),(y||d==="0"&&h==="=")&&(y=!0,d="0",h="=");var w=m==="$"?r:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",I=m==="$"?n:/[%p]/.test(v)?s:"",E=V3[v],T=/[defgprs%]/.test(v);x=x===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function B(A){var O=w,L=I,S,M,D;if(v==="c")L=E(A)+L,A="";else{A=+A;var C=A<0||1/A<0;if(A=isNaN(A)?c:E(Math.abs(A),x),_&&(A=q$(A)),C&&+A==0&&p!=="+"&&(C=!1),O=(C?p==="("?p:a:p==="-"||p==="("?"":p)+O,L=(v==="s"?G$[8+$3/3]:"")+L+(C&&p==="("?")":""),T){for(S=-1,M=A.length;++S<M;)if(D=A.charCodeAt(S),48>D||D>57){L=(D===46?i+A.slice(S+1):A.slice(S))+L,A=A.slice(0,S);break}}}b&&!y&&(A=t(A,1/0));var U=O.length+A.length+L.length,k=U<g?new Array(g-U+1).join(d):"";switch(b&&y&&(A=t(k+A,k.length?g-L.length:1/0),k=""),h){case"<":A=O+A+L+k;break;case"=":A=O+k+A+L;break;case"^":A=k.slice(0,U=k.length>>1)+O+A+L+k.slice(U);break;default:A=k+O+A+L;break}return o(A)}return B.toString=function(){return f+""},B}function u(f,d){var h=l((f=ma(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(pa(d)/3)))*3,m=Math.pow(10,-p),y=G$[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var d2,Mo,h2;q3({thousands:",",grouping:[3],currency:["$",""]});function q3(e){return d2=X$(e),Mo=d2.format,h2=d2.formatPrefix,d2}function Y3(e){return Math.max(0,-pa(Math.abs(e)))}function W3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(pa(t)/3)))*3-pa(Math.abs(e)))}function G3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,pa(t)-pa(e))+1}var ot=1e-6,Zf=1e-12,Wt=Math.PI,Ce=Wt/2,X3=Wt/4,Kr=Wt*2,gr=180/Wt,le=Wt/180,te=Math.abs,Eo=Math.atan,Lr=Math.atan2,rt=Math.cos,L0=Math.ceil,p2=Math.exp;var m2=Math.hypot,Kf=Math.log,y2=Math.pow,et=Math.sin,Fn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ue=Math.sqrt,op=Math.tan;function g2(e){return e>1?0:e<-1?Wt:Math.acos(e)}function Qe(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function kr(){}function b2(e,t){e&&Z$.hasOwnProperty(e.type)&&Z$[e.type](e,t)}var H$={Feature:function(e,t){b2(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)b2(r[n].geometry,t)}},Z$={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)e=r[n],t.point(e[0],e[1],e[2])},LineString:function(e,t){H3(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)H3(r[n],t,0)},Polygon:function(e,t){K$(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)K$(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)b2(r[n],t)}};function H3(e,t,r){var n=-1,i=e.length-r,o;for(t.lineStart();++n<i;)o=e[n],t.point(o[0],o[1],o[2]);t.lineEnd()}function K$(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)H3(e[r],t,1);t.polygonEnd()}function Yi(e,t){e&&H$.hasOwnProperty(e.type)?H$[e.type](e,t):b2(e,t)}function k0(e){return[Lr(e[1],e[0]),Qe(e[2])]}function ya(e){var t=e[0],r=e[1],n=rt(r);return[n*rt(t),n*et(t),et(r)]}function C0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function sp(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 x2(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function U0(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function P0(e){var t=Ue(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var $0,_2,w2,v2,S2,I2,T2,A2,Z3,K3,Q3,tz,ez,ri,ni,ii,gs={sphere:kr,point:J3,lineStart:Q$,lineEnd:J$,polygonStart:function(){gs.lineStart=dot,gs.lineEnd=hot},polygonEnd:function(){gs.lineStart=Q$,gs.lineEnd=J$}};function J3(e,t){e*=le,t*=le;var r=rt(t);z0(r*rt(e),r*et(e),et(t))}function z0(e,t,r){++$0,w2+=(e-w2)/$0,v2+=(t-v2)/$0,S2+=(r-S2)/$0}function Q$(){gs.point=uot}function uot(e,t){e*=le,t*=le;var r=rt(t);ri=r*rt(e),ni=r*et(e),ii=et(t),gs.point=fot,z0(ri,ni,ii)}function fot(e,t){e*=le,t*=le;var r=rt(t),n=r*rt(e),i=r*et(e),o=et(t),s=Lr(Ue((s=ni*o-ii*i)*s+(s=ii*n-ri*o)*s+(s=ri*i-ni*n)*s),ri*n+ni*i+ii*o);_2+=s,I2+=s*(ri+(ri=n)),T2+=s*(ni+(ni=i)),A2+=s*(ii+(ii=o)),z0(ri,ni,ii)}function J$(){gs.point=J3}function dot(){gs.point=pot}function hot(){rz(tz,ez),gs.point=J3}function pot(e,t){tz=e,ez=t,e*=le,t*=le,gs.point=rz;var r=rt(t);ri=r*rt(e),ni=r*et(e),ii=et(t),z0(ri,ni,ii)}function rz(e,t){e*=le,t*=le;var r=rt(t),n=r*rt(e),i=r*et(e),o=et(t),s=ni*o-ii*i,a=ii*n-ri*o,c=ri*i-ni*n,l=m2(s,a,c),u=Qe(l),f=l&&-u/l;Z3.add(f*s),K3.add(f*a),Q3.add(f*c),_2+=u,I2+=u*(ri+(ri=n)),T2+=u*(ni+(ni=i)),A2+=u*(ii+(ii=o)),z0(ri,ni,ii)}function tB(e){$0=_2=w2=v2=S2=I2=T2=A2=0,Z3=new bn,K3=new bn,Q3=new bn,Yi(e,gs);var t=+Z3,r=+K3,n=+Q3,i=m2(t,r,n);return i<Zf&&(t=I2,r=T2,n=A2,_2<ot&&(t=w2,r=v2,n=S2),i=m2(t,r,n),i<Zf)?[NaN,NaN]:[Lr(r,t)*gr,Qe(n/i)*gr]}function V0(e,t){function r(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(r.invert=function(n,i){return n=t.invert(n,i),n&&e.invert(n[0],n[1])}),r}function eB(e,t){return te(e)>Wt&&(e-=Math.round(e/Kr)*Kr),[e,t]}eB.invert=eB;function rB(e,t,r){return(e%=Kr)?t||r?V0(iz(e),oz(t,r)):iz(e):t||r?oz(t,r):eB}function nz(e){return function(t,r){return t+=e,te(t)>Wt&&(t-=Math.round(t/Kr)*Kr),[t,r]}}function iz(e){var t=nz(e);return t.invert=nz(-e),t}function oz(e,t){var r=rt(e),n=et(e),i=rt(t),o=et(t);function s(a,c){var l=rt(c),u=rt(a)*l,f=et(a)*l,d=et(c),h=d*r+u*n;return[Lr(f*i-h*o,u*r-d*n),Qe(h*i+f*o)]}return s.invert=function(a,c){var l=rt(c),u=rt(a)*l,f=et(a)*l,d=et(c),h=d*i-f*o;return[Lr(f*i+d*o,u*r+h*n),Qe(h*r-u*n)]},s}function sz(e){e=rB(e[0]*le,e[1]*le,e.length>2?e[2]*le:0);function t(r){return r=e(r[0]*le,r[1]*le),r[0]*=gr,r[1]*=gr,r}return t.invert=function(r){return r=e.invert(r[0]*le,r[1]*le),r[0]*=gr,r[1]*=gr,r},t}function cz(e,t,r,n,i,o){if(r){var s=rt(t),a=et(t),c=n*r;i==null?(i=t+n*Kr,o=t-c/2):(i=az(s,i),o=az(s,o),(n>0?i<o:i>o)&&(i+=n*Kr));for(var l,u=i;n>0?u>o:u<o;u-=c)l=k0([s,-a*rt(u),-a*et(u)]),e.point(l[0],l[1])}}function az(e,t){t=ya(t),t[0]-=e,P0(t);var r=g2(-t[1]);return((-t[2]<0?-r:r)+Kr-ot)%Kr}function M2(){var e=[],t;return{point:function(r,n,i){t.push([r,n,i])},lineStart:function(){e.push(t=[])},lineEnd:kr,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function ap(e,t){return te(e[0]-t[0])<ot&&te(e[1]-t[1])<ot}function E2(e,t,r,n){this.x=e,this.z=t,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function D2(e,t,r,n,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],b;if(ap(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*ot}o.push(b=new E2(y,p,null,!0)),s.push(b.o=new E2(y,null,b,!1)),o.push(b=new E2(g,p,null,!1)),s.push(b.o=new E2(g,null,b,!0))}}),!!o.length){for(s.sort(t),lz(o),lz(s),a=0,c=s.length;a<c;++a)s[a].e=r=!r;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function lz(e){if(t=e.length){for(var t,r=0,n=e[0],i;++r<t;)n.n=i=e[r],i.p=n,n=i;n.n=i=e[0],i.p=n}}function nB(e){return te(e[0])<=Wt?e[0]:Fn(e[0])*((te(e[0])+Wt)%Kr-Wt)}function uz(e,t){var r=nB(t),n=t[1],i=et(n),o=[et(r),-rt(r),0],s=0,a=0,c=new bn;i===1?n=Ce+ot:i===-1&&(n=-Ce-ot);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=nB(h),m=h[1]/2+X3,y=et(m),g=rt(m),b=0;b<d;++b,p=_,y=w,g=I,h=x){var x=f[b],_=nB(x),v=x[1]/2+X3,w=et(v),I=rt(v),E=_-p,T=E>=0?1:-1,B=T*E,A=B>Wt,O=y*w;if(c.add(Lr(O*T*et(B),g*I+O*rt(B))),s+=A?E+T*Kr:E,A^p>=r^_>=r){var L=sp(ya(h),ya(x));P0(L);var S=sp(o,L);P0(S);var M=(A^E>=0?-1:1)*Qe(S[2]);(n>M||n===M&&(L[0]||L[1]))&&(a+=A^E>=0?1:-1)}}return(s<-ot||s<ot&&c<-Zf)^a&1}function B2(e,t,r,n){return function(i){var o=t(i),s=M2(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:y,polygonStart:function(){d.point=g,d.lineStart=b,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=y,u=Vh(u);var _=uz(l,n);u.length?(c||(i.polygonStart(),c=!0),D2(u,yot,_,r,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function m(){d.point=p,o.lineStart()}function y(){d.point=h,o.lineEnd()}function g(_,v){f.push([_,v]),a.point(_,v)}function b(){a.lineStart(),f=[]}function x(){g(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,I=v.length,E,T,B;if(f.pop(),l.push(f),f=null,!!I){if(_&1){if(T=v[0],(E=T.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<E;++w)i.point((B=T[w])[0],B[1]);i.lineEnd()}return}I>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(mot))}}return d}}function mot(e){return e.length>1}function yot(e,t){return((e=e.x)[0]<0?e[1]-Ce-ot:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-ot:Ce-t[1])}var iB=B2(function(){return!0},got,xot,[-Wt,-Ce]);function got(e){var t=NaN,r=NaN,n=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Wt:-Wt,c=te(o-t);te(c-Wt)<ot?(e.point(t,r=(r+s)/2>0?Ce:-Ce),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),e.point(o,r),i=0):n!==a&&c>=Wt&&(te(t-n)<ot&&(t-=n*ot),te(o-a)<ot&&(o-=a*ot),r=bot(t,r,o,s),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),i=0),e.point(t=o,r=s),n=a},lineEnd:function(){e.lineEnd(),t=r=NaN},clean:function(){return 2-i}}}function bot(e,t,r,n){var i,o,s=et(e-r);return te(s)>ot?Eo((et(t)*(o=rt(n))*et(r)-et(n)*(i=rt(t))*et(e))/(i*o*s)):(t+n)/2}function xot(e,t,r,n){var i;if(e==null)i=r*Ce,n.point(-Wt,i),n.point(0,i),n.point(Wt,i),n.point(Wt,0),n.point(Wt,-i),n.point(0,-i),n.point(-Wt,-i),n.point(-Wt,0),n.point(-Wt,i);else if(te(e[0]-t[0])>ot){var o=e[0]<t[0]?Wt:-Wt;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function fz(e){var t=rt(e),r=6*le,n=t>0,i=te(t)>ot;function o(u,f,d,h){cz(h,e,r,d,u,f)}function s(u,f){return rt(u)*rt(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(y,g){var b=[y,g],x,_=s(y,g),v=n?_?0:l(y,g):_?l(y+(y<0?Wt:-Wt),g):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,b),(!x||ap(f,x)||ap(b,x))&&(b[2]=1)),_!==h)m=0,_?(u.lineStart(),x=c(b,f),u.point(x[0],x[1])):(x=c(f,b),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&n^_){var w;!(v&d)&&(w=c(b,f,!0))&&(m=0,n?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!ap(f,b))&&u.point(b[0],b[1]),f=b,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=ya(u),p=ya(f),m=[1,0,0],y=sp(h,p),g=C0(y,y),b=y[0],x=g-b*b;if(!x)return!d&&u;var _=t*g/x,v=-t*b/x,w=sp(m,y),I=U0(m,_),E=U0(y,v);x2(I,E);var T=w,B=C0(I,T),A=C0(T,T),O=B*B-A*(C0(I,I)-1);if(!(O<0)){var L=Ue(O),S=U0(T,(-B-L)/A);if(x2(S,I),S=k0(S),!d)return S;var M=u[0],D=f[0],C=u[1],U=f[1],k;D<M&&(k=M,M=D,D=k);var $=D-M,z=te($-Wt)<ot,V=z||$<ot;if(!z&&U<C&&(k=C,C=U,U=k),V?z?C+U>0^S[1]<(te(S[0]-M)<ot?C:U):C<=S[1]&&S[1]<=U:$>Wt^(M<=S[0]&&S[0]<=D)){var Q=U0(T,(-B+L)/A);return x2(Q,I),[S,k0(Q)]}}}function l(u,f){var d=n?e:Wt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return B2(s,a,o,n?[0,-e]:[-Wt,e-Wt])}function dz(e,t,r,n,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=r-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=n-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var j0=1e9,O2=-j0;function cp(e,t,r,n){function i(l,u){return e<=l&&l<=r&&t<=u&&u<=n}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:r,h>1?n:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return te(l[0]-e)<ot?u>0?0:3:te(l[0]-r)<ot?u>0?2:1:te(l[1]-t)<ot?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=M2(),d,h,p,m,y,g,b,x,_,v,w,I={point:E,lineStart:O,lineEnd:L,polygonStart:B,polygonEnd:A};function E(M,D){i(M,D)&&u.point(M,D)}function T(){for(var M=0,D=0,C=h.length;D<C;++D)for(var U=h[D],k=1,$=U.length,z=U[0],V,Q,st=z[0],ct=z[1];k<$;++k)V=st,Q=ct,z=U[k],st=z[0],ct=z[1],Q<=n?ct>n&&(st-V)*(n-Q)>(ct-Q)*(e-V)&&++M:ct<=n&&(st-V)*(n-Q)<(ct-Q)*(e-V)&&--M;return M}function B(){u=f,d=[],h=[],w=!0}function A(){var M=T(),D=w&&M,C=(d=Vh(d)).length;(D||C)&&(l.polygonStart(),D&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),C&&D2(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){I.point=S,h&&h.push(p=[]),v=!0,_=!1,b=x=NaN}function L(){d&&(S(m,y),g&&_&&f.rejoin(),d.push(f.result())),I.point=E,_&&u.lineEnd()}function S(M,D){var C=i(M,D);if(h&&p.push([M,D]),v)m=M,y=D,g=C,v=!1,C&&(u.lineStart(),u.point(M,D));else if(C&&_)u.point(M,D);else{var U=[b=Math.max(O2,Math.min(j0,b)),x=Math.max(O2,Math.min(j0,x))],k=[M=Math.max(O2,Math.min(j0,M)),D=Math.max(O2,Math.min(j0,D))];dz(U,k,e,t,r,n)?(_||(u.lineStart(),u.point(U[0],U[1])),u.point(k[0],k[1]),C||u.lineEnd(),w=!1):C&&(u.lineStart(),u.point(M,D),w=!1)}b=M,x=D,_=C}return I}}function hz(e,t,r){var n=_r(e,t-ot,r).concat(t);return function(i){return n.map(function(o){return[i,o]})}}function pz(e,t,r){var n=_r(e,t-ot,r).concat(t);return function(i){return n.map(function(o){return[o,i]})}}function oB(){var e,t,r,n,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:b()}}function b(){return _r(L0(n/u)*u,r,u).map(p).concat(_r(L0(a/f)*f,s,f).map(m)).concat(_r(L0(t/c)*c,e,c).filter(function(x){return te(x%u)>ot}).map(d)).concat(_r(L0(o/l)*l,i,l).filter(function(x){return te(x%f)>ot}).map(h))}return g.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},g.outline=function(){return{type:"Polygon",coordinates:[p(n).concat(m(s).slice(1),p(r).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(x){return arguments.length?g.extentMajor(x).extentMinor(x):g.extentMinor()},g.extentMajor=function(x){return arguments.length?(n=+x[0][0],r=+x[1][0],a=+x[0][1],s=+x[1][1],n>r&&(x=n,n=r,r=x),a>s&&(x=a,a=s,s=x),g.precision(y)):[[n,a],[r,s]]},g.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],o=+x[0][1],i=+x[1][1],t>e&&(x=t,t=e,e=x),o>i&&(x=o,o=i,i=x),g.precision(y)):[[t,o],[e,i]]},g.step=function(x){return arguments.length?g.stepMajor(x).stepMinor(x):g.stepMinor()},g.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],g):[u,f]},g.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],g):[c,l]},g.precision=function(x){return arguments.length?(y=+x,d=hz(o,i,90),h=pz(t,e,y),p=hz(a,s,90),m=pz(n,r,y),g):y},g.extentMajor([[-180,-90+ot],[180,90-ot]]).extentMinor([[-180,-80-ot],[180,80+ot]])}function sB(){return oB()()}var q0=e=>e;var aB=new bn,cB=new bn,mz,yz,lB,uB,lu={point:kr,lineStart:kr,lineEnd:kr,polygonStart:function(){lu.lineStart=_ot,lu.lineEnd=vot},polygonEnd:function(){lu.lineStart=lu.lineEnd=lu.point=kr,aB.add(te(cB)),cB=new bn},result:function(){var e=aB/2;return aB=new bn,e}};function _ot(){lu.point=wot}function wot(e,t){lu.point=gz,mz=lB=e,yz=uB=t}function gz(e,t){cB.add(uB*e-lB*t),lB=e,uB=t}function vot(){gz(mz,yz)}var fB=lu;var lp=1/0,N2=lp,Y0=-lp,F2=Y0,Sot={point:Iot,lineStart:kr,lineEnd:kr,polygonStart:kr,polygonEnd:kr,result:function(){var e=[[lp,N2],[Y0,F2]];return Y0=F2=-(N2=lp=1/0),e}};function Iot(e,t){e<lp&&(lp=e),e>Y0&&(Y0=e),t<N2&&(N2=t),t>F2&&(F2=t)}var up=Sot;var dB=0,hB=0,W0=0,R2=0,L2=0,fp=0,pB=0,mB=0,G0=0,_z,wz,ga,ba,bs={point:Qf,lineStart:bz,lineEnd:xz,polygonStart:function(){bs.lineStart=Mot,bs.lineEnd=Eot},polygonEnd:function(){bs.point=Qf,bs.lineStart=bz,bs.lineEnd=xz},result:function(){var e=G0?[pB/G0,mB/G0]:fp?[R2/fp,L2/fp]:W0?[dB/W0,hB/W0]:[NaN,NaN];return dB=hB=W0=R2=L2=fp=pB=mB=G0=0,e}};function Qf(e,t){dB+=e,hB+=t,++W0}function bz(){bs.point=Tot}function Tot(e,t){bs.point=Aot,Qf(ga=e,ba=t)}function Aot(e,t){var r=e-ga,n=t-ba,i=Ue(r*r+n*n);R2+=i*(ga+e)/2,L2+=i*(ba+t)/2,fp+=i,Qf(ga=e,ba=t)}function xz(){bs.point=Qf}function Mot(){bs.point=Dot}function Eot(){vz(_z,wz)}function Dot(e,t){bs.point=vz,Qf(_z=ga=e,wz=ba=t)}function vz(e,t){var r=e-ga,n=t-ba,i=Ue(r*r+n*n);R2+=i*(ga+e)/2,L2+=i*(ba+t)/2,fp+=i,i=ba*e-ga*t,pB+=i*(ga+e),mB+=i*(ba+t),G0+=i*3,Qf(ga=e,ba=t)}var yB=bs;function k2(e){this._context=e}k2.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,Kr);break}}},result:kr};var bB=new bn,gB,Sz,Iz,X0,H0,C2={point:kr,lineStart:function(){C2.point=Bot},lineEnd:function(){gB&&Tz(Sz,Iz),C2.point=kr},polygonStart:function(){gB=!0},polygonEnd:function(){gB=null},result:function(){var e=+bB;return bB=new bn,e}};function Bot(e,t){C2.point=Tz,Sz=X0=e,Iz=H0=t}function Tz(e,t){X0-=e,H0-=t,bB.add(Ue(X0*X0+H0*H0)),X0=e,H0=t}var xB=C2;var Az,U2,Mz,Ez,dp=class{constructor(t){this._append=t==null?Dz:Oot(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==Mz||this._append!==U2){let n=this._radius,i=this._;this._="",this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`,Mz=n,U2=this._append,Ez=this._,this._=i}this._+=Ez;break}}}result(){let t=this._;return this._="",t.length?t:null}};function Dz(e){let t=1;this._+=e[0];for(let r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function Oot(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Dz;if(t!==Az){let r=10**t;Az=t,U2=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*r)/r+i[o]}}return U2}function vn(e,t){let r=3,n=4.5,i,o;function s(a){return a&&(typeof n=="function"&&o.pointRadius(+n.apply(this,arguments)),Yi(a,i(o))),o.result()}return s.area=function(a){return Yi(a,i(fB)),fB.result()},s.measure=function(a){return Yi(a,i(xB)),xB.result()},s.bounds=function(a){return Yi(a,i(up)),up.result()},s.centroid=function(a){return Yi(a,i(yB)),yB.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,q0):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new dp(r)):new k2(t=a),typeof n!="function"&&o.pointRadius(n),s):t},s.pointRadius=function(a){return arguments.length?(n=typeof a=="function"?a:(o.pointRadius(+a),+a),s):n},s.digits=function(a){if(!arguments.length)return r;if(a==null)r=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);r=c}return t===null&&(o=new dp(r)),s},s.projection(e).digits(r).context(t)}function Jf(e){return{stream:hp(e)}}function hp(e){return function(t){var r=new _B;for(var n in e)r[n]=e[n];return r.stream=t,r}}function _B(){}_B.prototype={constructor:_B,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 wB(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),Yi(r,e.stream(up)),t(up.result()),n!=null&&e.clipExtent(n),e}function Z0(e,t,r){return wB(e,function(n){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(n[1][0]-n[0][0]),o/(n[1][1]-n[0][1])),a=+t[0][0]+(i-s*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(o-s*(n[1][1]+n[0][1]))/2;e.scale(150*s).translate([a,c])},r)}function P2(e,t,r){return Z0(e,[[0,0],t],r)}function $2(e,t,r){return wB(e,function(n){var i=+t,o=i/(n[1][0]-n[0][0]),s=(i-o*(n[1][0]+n[0][0]))/2,a=-o*n[0][1];e.scale(150*o).translate([s,a])},r)}function z2(e,t,r){return wB(e,function(n){var i=+t,o=i/(n[1][1]-n[0][1]),s=-o*n[0][0],a=(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([s,a])},r)}var Bz=16,Not=rt(30*le);function vB(e,t){return+t?Rot(e,t):Fot(e)}function Fot(e){return hp({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function Rot(e,t){function r(n,i,o,s,a,c,l,u,f,d,h,p,m,y){var g=l-n,b=u-i,x=g*g+b*b;if(x>4*t&&m--){var _=s+d,v=a+h,w=c+p,I=Ue(_*_+v*v+w*w),E=Qe(w/=I),T=te(te(w)-1)<ot||te(o-f)<ot?(o+f)/2:Lr(v,_),B=e(T,E),A=B[0],O=B[1],L=A-n,S=O-i,M=b*L-g*S;(M*M/x>t||te((g*L+b*S)/x-.5)>.3||s*d+a*h+c*p<Not)&&(r(n,i,o,s,a,c,A,O,T,_/=I,v/=I,w,m,y),y.point(A,O),r(A,O,T,_,v,w,l,u,f,d,h,p,m,y))}}return function(n){var i,o,s,a,c,l,u,f,d,h,p,m,y={point:g,lineStart:b,lineEnd:_,polygonStart:function(){n.polygonStart(),y.lineStart=v},polygonEnd:function(){n.polygonEnd(),y.lineStart=b}};function g(E,T){E=e(E,T),n.point(E[0],E[1])}function b(){f=NaN,y.point=x,n.lineStart()}function x(E,T){var B=ya([E,T]),A=e(E,T);r(f,d,u,h,p,m,f=A[0],d=A[1],u=E,h=B[0],p=B[1],m=B[2],Bz,n),n.point(f,d)}function _(){y.point=g,n.lineEnd()}function v(){b(),y.point=w,y.lineEnd=I}function w(E,T){x(i=E,T),o=f,s=d,a=h,c=p,l=m,y.point=x}function I(){r(f,d,u,h,p,m,o,s,i,a,c,l,Bz,n),y.lineEnd=_,_()}return y}}var Lot=hp({point:function(e,t){this.stream.point(e*le,t*le)}});function kot(e){return hp({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function Cot(e,t,r,n,i){function o(s,a){return s*=n,a*=i,[t+e*s,r-e*a]}return o.invert=function(s,a){return[(s-t)/e*n,(r-a)/e*i]},o}function Oz(e,t,r,n,i,o){if(!o)return Cot(e,t,r,n,i);var s=rt(o),a=et(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*r-s*t)/e,h=(a*t+s*r)/e;function p(m,y){return m*=n,y*=i,[c*m-l*y+t,r-l*m-c*y]}return p.invert=function(m,y){return[n*(u*m-f*y+d),i*(h-f*m-u*y)]},p}function Sn(e){return SB(function(){return e})()}function SB(e){var t,r=150,n=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=iB,y=null,g,b,x,_=q0,v=.5,w,I,E,T,B;function A(M){return E(M[0]*le,M[1]*le)}function O(M){return M=E.invert(M[0],M[1]),M&&[M[0]*gr,M[1]*gr]}A.stream=function(M){return T&&B===M?T:T=Lot(kot(u)(m(w(_(B=M)))))},A.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},A.postclip=function(M){return arguments.length?(_=M,y=g=b=x=null,S()):_},A.clipAngle=function(M){return arguments.length?(m=+M?fz(p=M*le):(p=null,iB),S()):p*gr},A.clipExtent=function(M){return arguments.length?(_=M==null?(y=g=b=x=null,q0):cp(y=+M[0][0],g=+M[0][1],b=+M[1][0],x=+M[1][1]),S()):y==null?null:[[y,g],[b,x]]},A.scale=function(M){return arguments.length?(r=+M,L()):r},A.translate=function(M){return arguments.length?(n=+M[0],i=+M[1],L()):[n,i]},A.center=function(M){return arguments.length?(o=M[0]%360*le,s=M[1]%360*le,L()):[o*gr,s*gr]},A.rotate=function(M){return arguments.length?(a=M[0]%360*le,c=M[1]%360*le,l=M.length>2?M[2]%360*le:0,L()):[a*gr,c*gr,l*gr]},A.angle=function(M){return arguments.length?(f=M%360*le,L()):f*gr},A.reflectX=function(M){return arguments.length?(d=M?-1:1,L()):d<0},A.reflectY=function(M){return arguments.length?(h=M?-1:1,L()):h<0},A.precision=function(M){return arguments.length?(w=vB(I,v=M*M),S()):Ue(v)},A.fitExtent=function(M,D){return Z0(A,M,D)},A.fitSize=function(M,D){return P2(A,M,D)},A.fitWidth=function(M,D){return $2(A,M,D)},A.fitHeight=function(M,D){return z2(A,M,D)};function L(){var M=Oz(r,0,0,d,h,f).apply(null,t(o,s)),D=Oz(r,n-M[0],i-M[1],d,h,f);return u=rB(a,c,l),I=V0(t,D),E=V0(u,I),w=vB(I,v),S()}function S(){return T=B=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&O,L()}}function pp(e){var t=0,r=Wt/3,n=SB(e),i=n(t,r);return i.parallels=function(o){return arguments.length?n(t=o[0]*le,r=o[1]*le):[t*gr,r*gr]},i}function Nz(e){var t=rt(e);function r(n,i){return[n*t,et(i)/t]}return r.invert=function(n,i){return[n/t,Qe(i*t)]},r}function Fz(e,t){var r=et(e),n=(r+et(t))/2;if(te(n)<ot)return Nz(e);var i=1+r*(2*n-r),o=Ue(i)/n;function s(a,c){var l=Ue(i-2*n*et(c))/n;return[l*et(a*=n),o-l*rt(a)]}return s.invert=function(a,c){var l=o-c,u=Lr(a,te(l))*Fn(l);return l*n<0&&(u-=Wt*Fn(a)*Fn(l)),[u/n,Qe((i-(a*a+l*l)*n*n)/(2*n))]},s}function uu(){return pp(Fz).scale(155.424).center([0,33.6442])}function K0(){return uu().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Uot(e){var t=e.length;return{point:function(r,n){for(var i=-1;++i<t;)e[i].point(r,n)},sphere:function(){for(var r=-1;++r<t;)e[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)e[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)e[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)e[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)e[r].polygonEnd()}}}function IB(){var e,t,r=K0(),n,i=uu().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=uu().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,n.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=r.scale(),p=r.translate(),m=(d[0]-p[0])/h,y=(d[1]-p[1])/h;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:r).invert(d)},u.stream=function(d){return e&&t===d?e:e=Uot([r.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(r.precision(d),i.precision(d),s.precision(d),f()):r.precision()},u.scale=function(d){return arguments.length?(r.scale(d),i.scale(d*.35),s.scale(d),u.translate(r.translate())):r.scale()},u.translate=function(d){if(!arguments.length)return r.translate();var h=r.scale(),p=+d[0],m=+d[1];return n=r.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+ot,m+.12*h+ot],[p-.214*h-ot,m+.234*h-ot]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+ot,m+.166*h+ot],[p-.115*h-ot,m+.234*h-ot]]).stream(l),f()},u.fitExtent=function(d,h){return Z0(u,d,h)},u.fitSize=function(d,h){return P2(u,d,h)},u.fitWidth=function(d,h){return $2(u,d,h)},u.fitHeight=function(d,h){return z2(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function V2(e){return function(t,r){var n=rt(t),i=rt(r),o=e(n*i);return o===1/0?[2,0]:[o*i*et(t),o*et(r)]}}function xa(e){return function(t,r){var n=Ue(t*t+r*r),i=e(n),o=et(i),s=rt(i);return[Lr(t*o,n*s),Qe(n&&r*o/n)]}}var TB=V2(function(e){return Ue(2/(1+e))});TB.invert=xa(function(e){return 2*Qe(e/2)});function AB(){return Sn(TB).scale(124.75).clipAngle(180-.001)}var MB=V2(function(e){return(e=g2(e))&&e/et(e)});MB.invert=xa(function(e){return e});function EB(){return Sn(MB).scale(79.4188).clipAngle(180-.001)}function mp(e,t){return[e,Kf(op((Ce+t)/2))]}mp.invert=function(e,t){return[e,2*Eo(p2(t))-Ce]};function DB(){return BB(mp).scale(961/Kr)}function BB(e){var t=Sn(e),r=t.center,n=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(n(f),u()):n()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(r(f),u()):r()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Wt*n(),d=t(sz(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===mp?[[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 j2(e){return op((Ce+e)/2)}function Rz(e,t){var r=rt(e),n=e===t?et(e):Kf(r/rt(t))/Kf(j2(t)/j2(e)),i=r*y2(j2(e),n)/n;if(!n)return mp;function o(s,a){i>0?a<-Ce+ot&&(a=-Ce+ot):a>Ce-ot&&(a=Ce-ot);var c=i/y2(j2(a),n);return[c*et(n*s),i-c*rt(n*s)]}return o.invert=function(s,a){var c=i-a,l=Fn(n)*Ue(s*s+c*c),u=Lr(s,te(c))*Fn(c);return c*n<0&&(u-=Wt*Fn(s)*Fn(c)),[u/n,2*Eo(y2(i/l,1/n))-Ce]},o}function OB(){return pp(Rz).scale(109.5).parallels([30,30])}function yp(e,t){return[e,t]}yp.invert=yp;function NB(){return Sn(yp).scale(152.63)}function Lz(e,t){var r=rt(e),n=e===t?et(e):(r-rt(t))/(t-e),i=r/n+e;if(te(n)<ot)return yp;function o(s,a){var c=i-a,l=n*s;return[c*et(l),i-c*rt(l)]}return o.invert=function(s,a){var c=i-a,l=Lr(s,te(c))*Fn(c);return c*n<0&&(l-=Wt*Fn(s)*Fn(c)),[l/n,i-Fn(n)*Ue(s*s+c*c)]},o}function FB(){return pp(Lz).scale(131.154).center([0,13.9389])}var Q0=1.340264,J0=-.081106,tb=893e-6,eb=.003796,q2=Ue(3)/2,Pot=12;function RB(e,t){var r=Qe(q2*et(t)),n=r*r,i=n*n*n;return[e*rt(r)/(q2*(Q0+3*J0*n+i*(7*tb+9*eb*n))),r*(Q0+J0*n+i*(tb+eb*n))]}RB.invert=function(e,t){for(var r=t,n=r*r,i=n*n*n,o=0,s,a,c;o<Pot&&(a=r*(Q0+J0*n+i*(tb+eb*n))-t,c=Q0+3*J0*n+i*(7*tb+9*eb*n),r-=s=a/c,n=r*r,i=n*n*n,!(te(s)<Zf));++o);return[q2*e*(Q0+3*J0*n+i*(7*tb+9*eb*n))/rt(r),Qe(et(r)/q2)]};function LB(){return Sn(RB).scale(177.158)}function kB(e,t){var r=rt(t),n=rt(e)*r;return[r*et(e)/n,et(t)/n]}kB.invert=xa(Eo);function CB(){return Sn(kB).scale(144.049).clipAngle(60)}function UB(e,t){return[rt(t)*et(e),et(t)]}UB.invert=xa(Qe);function PB(){return Sn(UB).scale(249.5).clipAngle(90+ot)}function $B(e,t){var r=rt(t),n=1+rt(e)*r;return[r*et(e)/n,et(t)/n]}$B.invert=xa(function(e){return 2*Eo(e)});function zB(){return Sn($B).scale(250).clipAngle(142)}function VB(e,t){return[Kf(op((Ce+t)/2)),-e]}VB.invert=function(e,t){return[-t,2*Eo(p2(e))-Ce]};function jB(){var e=BB(VB),t=e.center,r=e.rotate;return e.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},e.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function $ot(e,t){return e.parent===t.parent?1:2}function zot(e){return e.reduce(Vot,0)/e.length}function Vot(e,t){return e+t.x}function jot(e){return 1+e.reduce(qot,0)}function qot(e,t){return Math.max(e,t.y)}function Yot(e){for(var t;t=e.children;)e=t[0];return e}function Wot(e){for(var t;t=e.children;)e=t[t.length-1];return e}function Y2(){var e=$ot,t=1,r=1,n=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=zot(h),d.y=jot(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=Yot(o),l=Wot(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(n?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*r}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*r})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(n=!1,t=+o[0],r=+o[1],i):n?null:[t,r]},i.nodeSize=function(o){return arguments.length?(n=!0,t=+o[0],r=+o[1],i):n?[t,r]:null},i}function Got(e){var t=0,r=e.children,n=r&&r.length;if(!n)t=1;else for(;--n>=0;)t+=r[n].value;e.value=t}function kz(){return this.eachAfter(Got)}function Cz(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}function Uz(e,t){for(var r=this,n=[r],i,o,s=-1;r=n.pop();)if(e.call(t,r,++s,this),i=r.children)for(o=i.length-1;o>=0;--o)n.push(i[o]);return this}function Pz(e,t){for(var r=this,n=[r],i=[],o,s,a,c=-1;r=n.pop();)if(i.push(r),o=r.children)for(s=0,a=o.length;s<a;++s)n.push(o[s]);for(;r=i.pop();)e.call(t,r,++c,this);return this}function $z(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}function zz(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,n=t.children,i=n&&n.length;--i>=0;)r+=n[i].value;t.value=r})}function Vz(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function jz(e){for(var t=this,r=Xot(t,e),n=[t];t!==r;)t=t.parent,n.push(t);for(var i=n.length;e!==r;)n.splice(i,0,e),e=e.parent;return n}function Xot(e,t){if(e===t)return e;var r=e.ancestors(),n=t.ancestors(),i=null;for(e=r.pop(),t=n.pop();e===t;)i=e,e=r.pop(),t=n.pop();return i}function qz(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Yz(){return Array.from(this)}function Wz(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function Gz(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}function*Xz(){var e=this,t,r=[e],n,i,o;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,n=e.children)for(i=0,o=n.length;i<o;++i)r.push(n[i]);while(r.length)}function qB(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Kot)):t===void 0&&(t=Zot);for(var r=new fu(e),n,i=[r],o,s,a,c;n=i.pop();)if((s=t(n.data))&&(c=(s=Array.from(s)).length))for(n.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new fu(s[a])),o.parent=n,o.depth=n.depth+1;return r.eachBefore(YB)}function Hot(){return qB(this).eachBefore(Qot)}function Zot(e){return e.children}function Kot(e){return Array.isArray(e)?e[1]:null}function Qot(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function YB(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function fu(e){this.data=e,this.depth=this.height=0,this.parent=null}fu.prototype=qB.prototype={constructor:fu,count:kz,each:Cz,eachAfter:Pz,eachBefore:Uz,find:$z,sum:zz,sort:Vz,path:jz,ancestors:qz,descendants:Yz,leaves:Wz,links:Gz,copy:Hot,[Symbol.iterator]:Xz};function W2(e){return e==null?null:Jot(e)}function Jot(e){if(typeof e!="function")throw new Error;return e}var tst={depth:-1},Hz={},WB={};function est(e){return e.id}function rst(e){return e.parentId}function G2(){var e=est,t=rst,r;function n(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,y=new Map;if(r!=null){let g=o.map((_,v)=>nst(r(_,v,i))),b=g.map(Zz),x=new Set(g).add("");for(let _ of b)x.has(_)||(x.add(_),g.push(_),b.push(Zz(_)),o.push(WB));s=(_,v)=>g[v],a=(_,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new fu(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,y.set(m,y.has(m)?Hz:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=y.get(p),!d)throw new Error("missing: "+p);if(d===Hz)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(r!=null){for(;f.data===WB&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===WB);--g)h.data=null}if(f.parent=tst,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(YB),f.parent=null,c>0)throw new Error("cycle");return f}return n.id=function(i){return arguments.length?(e=W2(i),n):e},n.parentId=function(i){return arguments.length?(t=W2(i),n):t},n.path=function(i){return arguments.length?(r=W2(i),n):r},n}function nst(e){e=`${e}`;let t=e.length;return GB(e,t-1)&&!GB(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Zz(e){let t=e.length;if(t<2)return"";for(;--t>1&&!GB(e,t););return e.slice(0,t)}function GB(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}function ist(e,t){return e.parent===t.parent?1:2}function XB(e){var t=e.children;return t?t[0]:e.t}function HB(e){var t=e.children;return t?t[t.length-1]:e.t}function ost(e,t,r){var n=r/(t.i-e.i);t.c-=n,t.s+=r,e.c+=n,t.z+=r,t.m+=r}function sst(e){for(var t=0,r=0,n=e.children,i=n.length,o;--i>=0;)o=n[i],o.z+=t,o.m+=t,t+=o.s+(r+=o.c)}function ast(e,t,r){return e.a.parent===t.parent?e.a:r}function X2(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}X2.prototype=Object.create(fu.prototype);function cst(e){for(var t=new X2(e,0),r,n=[t],i,o,s,a;r=n.pop();)if(o=r._.children)for(r.children=new Array(a=o.length),s=a-1;s>=0;--s)n.push(i=r.children[s]=new X2(o[s],s)),i.parent=r;return(t.parent=new X2(null,0)).children=[t],t}function td(){var e=ist,t=1,r=1,n=null;function i(l){var u=cst(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),n)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(b){b.x<f.x&&(f=b),b.x>d.x&&(d=b),b.depth>h.depth&&(h=b)});var p=f===d?1:e(f,d)/2,m=p-f.x,y=t/(d.x+p+m),g=r/(h.depth||1);l.eachBefore(function(b){b.x=(b.x+m)*y,b.y=b.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){sst(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],y=d.m,g=h.m,b=p.m,x=m.m,_;p=HB(p),d=XB(d),p&&d;)m=XB(m),h=HB(h),h.a=l,_=p.z+b-d.z-y+e(p._,d._),_>0&&(ost(ast(p,l,f),l,_),y+=_,g+=_),b+=p.m,y+=d.m,x+=m.m,g+=h.m;p&&!HB(h)&&(h.t=p,h.m+=b-g),d&&!XB(m)&&(m.t=d,m.m+=y-x,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*r}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(n=!1,t=+l[0],r=+l[1],i):n?null:[t,r]},i.nodeSize=function(l){return arguments.length?(n=!0,t=+l[0],r=+l[1],i):n?[t,r]:null},i}var Kz=23283064365386963e-26;function ed(e=Math.random()){let t=(0<=e&&e<1?e/Kz:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,Kz*(t>>>0))}function Cr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function rb(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 nb=Symbol("implicit");function rd(){var e=new Hn,t=[],r=[],n=nb;function i(o){let s=e.get(o);if(s===void 0){if(n!==nb)return n;e.set(o,s=t.push(o)-1)}return r[s%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Hn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(r=Array.from(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return rd(t,r).unknown(n)},Cr.apply(i,arguments),i}function du(){var e=rd().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<n,p=h?i:n,m=h?n:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var y=_r(d).map(function(g){return p+o*g});return r(h?y.reverse():y)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([n,i]=d,n=+n,i=+i,f()):[n,i]},e.rangeRound=function(d){return[n,i]=d,n=+n,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return du(t(),[n,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Cr.apply(f(),arguments)}function Qz(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return Qz(t())},e}function ZB(){return Qz(du.apply(null,arguments).paddingInner(1))}function KB(e){return function(){return e}}function gp(e){return+e}var Jz=[0,1];function Ai(e){return e}function QB(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:KB(isNaN(t)?NaN:.5)}function lst(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function ust(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i<n?(n=QB(i,n),o=r(s,o)):(n=QB(n,i),o=r(o,s)),function(a){return o(n(a))}}function fst(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)i[s]=QB(e[s],e[s+1]),o[s]=r(t[s],t[s+1]);return function(a){var c=Rc(e,a,1,n)-1;return o[c](i[c](a))}}function _a(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function nd(){var e=Jz,t=Jz,r=qi,n,i,o,s=Ai,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Ai&&(s=lst(e[0],e[d-1])),a=d>2?fst:ust,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(n),t,r)))(n(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(n),Ke)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,gp),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=qf,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Ai,u()):s!==Ai},f.interpolate=function(d){return arguments.length?(r=d,u()):r},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return n=d,i=h,u()}}function ib(){return nd()(Ai,Ai)}function JB(e,t,r,n){var i=$h(e,t,r),o;switch(n=ma(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=W3(i,s))&&(n.precision=o),h2(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=G3(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=Y3(i))&&(n.precision=o-(n.type==="%")*2);break}}return Mo(n)}function Wc(e){var t=e.domain;return e.ticks=function(r){var n=t();return xn(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return JB(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,s=n[i],a=n[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=kc(s,a,r),l===c)return n[i]=s,n[o]=a,t(n);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function Gc(){var e=ib();return e.copy=function(){return _a(e,Gc())},Cr.apply(e,arguments),Wc(e)}function ob(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,gp),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ob(e).unknown(t)},e=arguments.length?Array.from(e,gp):[0,1],Wc(r)}function sb(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],s;return o<i&&(s=r,r=n,n=s,s=i,i=o,o=s),e[r]=t.floor(i),e[n]=t.ceil(o),e}function tV(e){return Math.log(e)}function eV(e){return Math.exp(e)}function dst(e){return-Math.log(-e)}function hst(e){return-Math.exp(-e)}function pst(e){return isFinite(e)?+("1e"+e):e<0?0:e}function mst(e){return e===10?pst:e===Math.E?Math.exp:t=>Math.pow(e,t)}function yst(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 rV(e){return(t,r)=>-e(-t,r)}function tO(e){let t=e(tV,eV),r=t.domain,n=10,i,o;function s(){return i=yst(n),o=mst(n),r()[0]<0?(i=rV(i),o=rV(o),e(dst,hst)):e(tV,eV),t}return t.base=function(a){return arguments.length?(n=+a,s()):n},t.domain=function(a){return arguments.length?(r(a),s()):r()},t.ticks=a=>{let c=r(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,y=a==null?10:+a,g=[];if(!(n%1)&&h-d<y){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<n;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}}else for(;d<=h;++d)for(p=n-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=xn(l,u,y))}else g=xn(d,h,Math.min(h-d,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=ma(c)).precision==null&&(c.trim=!0),c=Mo(c)),a===1/0)return c;let l=Math.max(1,n*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*n<n-.5&&(f*=n),f<=l?c(u):""}},t.nice=()=>r(sb(r(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function ab(){let e=tO(nd()).domain([1,10]);return e.copy=()=>_a(e,ab()).base(e.base()),Cr.apply(e,arguments),e}function nV(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function iV(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function eO(e){var t=1,r=e(nV(t),iV(t));return r.constant=function(n){return arguments.length?e(nV(t=+n),iV(t)):t},Wc(r)}function cb(){var e=eO(nd());return e.copy=function(){return _a(e,cb()).constant(e.constant())},Cr.apply(e,arguments)}function oV(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function gst(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function bst(e){return e<0?-e*e:e*e}function rO(e){var t=e(Ai,Ai),r=1;function n(){return r===1?e(Ai,Ai):r===.5?e(gst,bst):e(oV(r),oV(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},Wc(t)}function lb(){var e=rO(nd());return e.copy=function(){return _a(e,lb()).exponent(e.exponent())},Cr.apply(e,arguments),e}function ub(){var e=[],t=[],r=[],n;function i(){var s=0,a=Math.max(1,t.length);for(r=new Array(a-1);++s<a;)r[s-1]=e3(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?n:t[Rc(r,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?r[a-1]:e[0],a<r.length?r[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Yt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(n=s,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return ub().domain(e).range(t).unknown(n)},Cr.apply(o,arguments)}function fb(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[Rc(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return fb().domain(e).range(t).unknown(r)},Cr.apply(i,arguments)}var nO=new Date,iO=new Date;function ze(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>ze(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),r&&(i.count=(o,s)=>(nO.setTime(+o),iO.setTime(+s),e(nO),e(iO),Math.floor(r(nO,iO))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?s=>n(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var db=ze(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);db.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ze(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):db);var cVt=db.range;var Qr=ze(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),sV=Qr.range;var Xc=ze(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),xst=Xc.range,Hc=ze(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),_st=Hc.range;var Zc=ze(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()),wst=Zc.range,Kc=ze(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),vst=Kc.range;var Do=ze(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),Sst=Do.range,sd=ze(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),Ist=sd.range,ad=ze(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),Tst=ad.range;function cd(e){return ze(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Wi=cd(0),hu=cd(1),H2=cd(2),Z2=cd(3),va=cd(4),K2=cd(5),Q2=cd(6),cV=Wi.range,Ast=hu.range,Mst=H2.range,Est=Z2.range,Dst=va.range,Bst=K2.range,Ost=Q2.range;function ld(e){return ze(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var Gi=ld(0),pu=ld(1),J2=ld(2),tS=ld(3),Sa=ld(4),eS=ld(5),rS=ld(6),lV=Gi.range,Nst=pu.range,Fst=J2.range,Rst=tS.range,Lst=Sa.range,kst=eS.range,Cst=rS.range;var Qc=ze(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()),Ust=Qc.range,Jc=ze(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()),Pst=Jc.range;var Rn=ze(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());Rn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ze(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var $st=Rn.range,Ln=ze(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());Ln.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ze(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var zst=Ln.range;function fV(e,t,r,n,i,o){let s=[[Qr,1,1e3],[Qr,5,5*1e3],[Qr,15,15*1e3],[Qr,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=Fc(([,,y])=>y).right(s,d);if(h===s.length)return e.every($h(l/31536e6,u/31536e6,f));if(h===0)return db.every(Math.max($h(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[oO,pb]=fV(Ln,Jc,Gi,ad,Kc,Hc),[sO,aO]=fV(Rn,Qc,Wi,Do,Zc,Xc);function cO(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 lO(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 mb(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function uO(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=yb(i),u=gb(i),f=yb(o),d=gb(o),h=yb(s),p=gb(s),m=yb(a),y=gb(a),g=yb(c),b=gb(c),x={a:C,A:U,b:k,B:$,c:null,d:gV,e:gV,f:fat,g:wat,G:Sat,H:cat,I:lat,j:uat,L:vV,m:dat,M:hat,p:z,q:V,Q:_V,s:wV,S:pat,u:mat,U:yat,V:gat,w:bat,W:xat,x:null,X:null,y:_at,Y:vat,Z:Iat,"%":xV},_={a:Q,A:st,b:ct,B:ut,c:null,d:bV,e:bV,f:Eat,g:Uat,G:$at,H:Tat,I:Aat,j:Mat,L:IV,m:Dat,M:Bat,p:X,q:lt,Q:_V,s:wV,S:Oat,u:Nat,U:Fat,V:Rat,w:Lat,W:kat,x:null,X:null,y:Cat,Y:Pat,Z:zat,"%":xV},v={a:B,A,b:O,B:L,c:S,d:mV,e:mV,f:iat,g:pV,G:hV,H:yV,I:yV,j:tat,L:nat,m:Jst,M:eat,p:T,q:Qst,Q:sat,s:aat,S:rat,u:Gst,U:Xst,V:Hst,w:Wst,W:Zst,x:M,X:D,y:pV,Y:hV,Z:Kst,"%":oat};x.x=w(r,x),x.X=w(n,x),x.c=w(t,x),_.x=w(r,_),_.X=w(n,_),_.c=w(t,_);function w(q,tt){return function(at){var j=[],Jt=-1,gt=0,he=q.length,ye,nt,Ee;for(at instanceof Date||(at=new Date(+at));++Jt<he;)q.charCodeAt(Jt)===37&&(j.push(q.slice(gt,Jt)),(nt=dV[ye=q.charAt(++Jt)])!=null?ye=q.charAt(++Jt):nt=ye==="e"?" ":"0",(Ee=tt[ye])&&(ye=Ee(at,nt)),j.push(ye),gt=Jt+1);return j.push(q.slice(gt,Jt)),j.join("")}}function I(q,tt){return function(at){var j=mb(1900,void 0,1),Jt=E(j,q,at+="",0),gt,he;if(Jt!=at.length)return null;if("Q"in j)return new Date(j.Q);if("s"in j)return new Date(j.s*1e3+("L"in j?j.L:0));if(tt&&!("Z"in j)&&(j.Z=0),"p"in j&&(j.H=j.H%12+j.p*12),j.m===void 0&&(j.m="q"in j?j.q:0),"V"in j){if(j.V<1||j.V>53)return null;"w"in j||(j.w=1),"Z"in j?(gt=lO(mb(j.y,0,1)),he=gt.getUTCDay(),gt=he>4||he===0?pu.ceil(gt):pu(gt),gt=sd.offset(gt,(j.V-1)*7),j.y=gt.getUTCFullYear(),j.m=gt.getUTCMonth(),j.d=gt.getUTCDate()+(j.w+6)%7):(gt=cO(mb(j.y,0,1)),he=gt.getDay(),gt=he>4||he===0?hu.ceil(gt):hu(gt),gt=Do.offset(gt,(j.V-1)*7),j.y=gt.getFullYear(),j.m=gt.getMonth(),j.d=gt.getDate()+(j.w+6)%7)}else("W"in j||"U"in j)&&("w"in j||(j.w="u"in j?j.u%7:"W"in j?1:0),he="Z"in j?lO(mb(j.y,0,1)).getUTCDay():cO(mb(j.y,0,1)).getDay(),j.m=0,j.d="W"in j?(j.w+6)%7+j.W*7-(he+5)%7:j.w+j.U*7-(he+6)%7);return"Z"in j?(j.H+=j.Z/100|0,j.M+=j.Z%100,lO(j)):cO(j)}}function E(q,tt,at,j){for(var Jt=0,gt=tt.length,he=at.length,ye,nt;Jt<gt;){if(j>=he)return-1;if(ye=tt.charCodeAt(Jt++),ye===37){if(ye=tt.charAt(Jt++),nt=v[ye in dV?tt.charAt(Jt++):ye],!nt||(j=nt(q,at,j))<0)return-1}else if(ye!=at.charCodeAt(j++))return-1}return j}function T(q,tt,at){var j=l.exec(tt.slice(at));return j?(q.p=u.get(j[0].toLowerCase()),at+j[0].length):-1}function B(q,tt,at){var j=h.exec(tt.slice(at));return j?(q.w=p.get(j[0].toLowerCase()),at+j[0].length):-1}function A(q,tt,at){var j=f.exec(tt.slice(at));return j?(q.w=d.get(j[0].toLowerCase()),at+j[0].length):-1}function O(q,tt,at){var j=g.exec(tt.slice(at));return j?(q.m=b.get(j[0].toLowerCase()),at+j[0].length):-1}function L(q,tt,at){var j=m.exec(tt.slice(at));return j?(q.m=y.get(j[0].toLowerCase()),at+j[0].length):-1}function S(q,tt,at){return E(q,t,tt,at)}function M(q,tt,at){return E(q,r,tt,at)}function D(q,tt,at){return E(q,n,tt,at)}function C(q){return s[q.getDay()]}function U(q){return o[q.getDay()]}function k(q){return c[q.getMonth()]}function $(q){return a[q.getMonth()]}function z(q){return i[+(q.getHours()>=12)]}function V(q){return 1+~~(q.getMonth()/3)}function Q(q){return s[q.getUTCDay()]}function st(q){return o[q.getUTCDay()]}function ct(q){return c[q.getUTCMonth()]}function ut(q){return a[q.getUTCMonth()]}function X(q){return i[+(q.getUTCHours()>=12)]}function lt(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var tt=w(q+="",x);return tt.toString=function(){return q},tt},parse:function(q){var tt=I(q+="",!1);return tt.toString=function(){return q},tt},utcFormat:function(q){var tt=w(q+="",_);return tt.toString=function(){return q},tt},utcParse:function(q){var tt=I(q+="",!0);return tt.toString=function(){return q},tt}}}var dV={"-":"",_:" ",0:"0"},Jr=/^\s*\d+/,jst=/^%/,qst=/[\\^$*+?|[\]().{}]/g;function ve(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o<r?new Array(r-o+1).join(t)+i:i)}function Yst(e){return e.replace(qst,"\\$&")}function yb(e){return new RegExp("^(?:"+e.map(Yst).join("|")+")","i")}function gb(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Wst(e,t,r){var n=Jr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Gst(e,t,r){var n=Jr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Xst(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Hst(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Zst(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function hV(e,t,r){var n=Jr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function pV(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Kst(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Qst(e,t,r){var n=Jr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Jst(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function mV(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function tat(e,t,r){var n=Jr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function yV(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function eat(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rat(e,t,r){var n=Jr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nat(e,t,r){var n=Jr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function iat(e,t,r){var n=Jr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function oat(e,t,r){var n=jst.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function sat(e,t,r){var n=Jr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function aat(e,t,r){var n=Jr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function gV(e,t){return ve(e.getDate(),t,2)}function cat(e,t){return ve(e.getHours(),t,2)}function lat(e,t){return ve(e.getHours()%12||12,t,2)}function uat(e,t){return ve(1+Do.count(Rn(e),e),t,3)}function vV(e,t){return ve(e.getMilliseconds(),t,3)}function fat(e,t){return vV(e,t)+"000"}function dat(e,t){return ve(e.getMonth()+1,t,2)}function hat(e,t){return ve(e.getMinutes(),t,2)}function pat(e,t){return ve(e.getSeconds(),t,2)}function mat(e){var t=e.getDay();return t===0?7:t}function yat(e,t){return ve(Wi.count(Rn(e)-1,e),t,2)}function SV(e){var t=e.getDay();return t>=4||t===0?va(e):va.ceil(e)}function gat(e,t){return e=SV(e),ve(va.count(Rn(e),e)+(Rn(e).getDay()===4),t,2)}function bat(e){return e.getDay()}function xat(e,t){return ve(hu.count(Rn(e)-1,e),t,2)}function _at(e,t){return ve(e.getFullYear()%100,t,2)}function wat(e,t){return e=SV(e),ve(e.getFullYear()%100,t,2)}function vat(e,t){return ve(e.getFullYear()%1e4,t,4)}function Sat(e,t){var r=e.getDay();return e=r>=4||r===0?va(e):va.ceil(e),ve(e.getFullYear()%1e4,t,4)}function Iat(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ve(t/60|0,"0",2)+ve(t%60,"0",2)}function bV(e,t){return ve(e.getUTCDate(),t,2)}function Tat(e,t){return ve(e.getUTCHours(),t,2)}function Aat(e,t){return ve(e.getUTCHours()%12||12,t,2)}function Mat(e,t){return ve(1+sd.count(Ln(e),e),t,3)}function IV(e,t){return ve(e.getUTCMilliseconds(),t,3)}function Eat(e,t){return IV(e,t)+"000"}function Dat(e,t){return ve(e.getUTCMonth()+1,t,2)}function Bat(e,t){return ve(e.getUTCMinutes(),t,2)}function Oat(e,t){return ve(e.getUTCSeconds(),t,2)}function Nat(e){var t=e.getUTCDay();return t===0?7:t}function Fat(e,t){return ve(Gi.count(Ln(e)-1,e),t,2)}function TV(e){var t=e.getUTCDay();return t>=4||t===0?Sa(e):Sa.ceil(e)}function Rat(e,t){return e=TV(e),ve(Sa.count(Ln(e),e)+(Ln(e).getUTCDay()===4),t,2)}function Lat(e){return e.getUTCDay()}function kat(e,t){return ve(pu.count(Ln(e)-1,e),t,2)}function Cat(e,t){return ve(e.getUTCFullYear()%100,t,2)}function Uat(e,t){return e=TV(e),ve(e.getUTCFullYear()%100,t,2)}function Pat(e,t){return ve(e.getUTCFullYear()%1e4,t,4)}function $at(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Sa(e):Sa.ceil(e),ve(e.getUTCFullYear()%1e4,t,4)}function zat(){return"+0000"}function xV(){return"%"}function _V(e){return+e}function wV(e){return Math.floor(+e/1e3)}var bp,xp,AV,Ia,MV;fO({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 fO(e){return bp=uO(e),xp=bp.format,AV=bp.parse,Ia=bp.utcFormat,MV=bp.utcParse,bp}function Vat(e){return new Date(e)}function jat(e){return e instanceof Date?+e:+new Date(+e)}function nS(e,t,r,n,i,o,s,a,c,l){var u=ib(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),b=l("%b %d"),x=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?m:o(w)<w?y:n(w)<w?i(w)<w?g:b:r(w)<w?x:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,jat)):d().map(Vat)},u.ticks=function(w){var I=d();return e(I[0],I[I.length-1],w??10)},u.tickFormat=function(w,I){return I==null?v:l(I)},u.nice=function(w){var I=d();return(!w||typeof w.range!="function")&&(w=t(I[0],I[I.length-1],w??10)),w?d(sb(I,w)):u},u.copy=function(){return _a(u,nS(e,t,r,n,i,o,s,a,c,l))},u}function iS(){return Cr.apply(nS(sO,aO,Rn,Qc,Wi,Do,Zc,Xc,Qr,xp).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function oS(){return Cr.apply(nS(oO,pb,Ln,Jc,Gi,sd,Kc,Hc,Qr,Ia).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function bb(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function sS(){var e=0,t=.5,r=1,n=1,i,o,s,a,c,l=Ai,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(n*m<n*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,r]=m,i=u(e=+e),o=u(t=+t),s=u(r=+r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h):[e,t,r]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(y){var g,b,x;return arguments.length?([g,b,x]=y,l=fa(m,[g,b,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(qi),h.rangeRound=p(qf),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h}}function xb(){var e=Wc(sS()(Ai));return e.copy=function(){return bb(e,xb())},rb.apply(e,arguments)}function aS(){var e=tO(sS()).domain([.1,1,10]);return e.copy=function(){return bb(e,aS()).base(e.base())},rb.apply(e,arguments)}function cS(){var e=eO(sS());return e.copy=function(){return bb(e,cS()).constant(e.constant())},rb.apply(e,arguments)}function lS(){var e=rO(sS());return e.copy=function(){return bb(e,lS()).exponent(e.exponent())},rb.apply(e,arguments)}function Z(e){for(var t=e.length/6|0,r=new Array(t),n=0;n<t;)r[n]="#"+e.slice(n*6,++n*6);return r}var dO=Z("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var hO=Z("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var pO=Z("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var mO=Z("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var yO=Z("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var gO=Z("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var bO=Z("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var xO=Z("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var _O=Z("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var wO=Z("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var vO=Z("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var xt=e=>g3(e[e.length-1]);var uS=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Z),fS=xt(uS);var dS=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Z),hS=xt(dS);var pS=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Z),mS=xt(pS);var yS=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Z),gS=xt(yS);var _b=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Z),_p=xt(_b);var bS=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Z),xS=xt(bS);var wb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Z),wp=xt(wb);var _S=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Z),wS=xt(_S);var vS=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Z),SS=xt(vS);var IS=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Z),TS=xt(IS);var AS=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Z),MS=xt(AS);var ES=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Z),DS=xt(ES);var BS=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Z),OS=xt(BS);var NS=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Z),FS=xt(NS);var RS=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Z),LS=xt(RS);var kS=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Z),CS=xt(kS);var US=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Z),PS=xt(US);var $S=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Z),zS=xt($S);var VS=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Z),jS=xt(VS);var qS=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Z),YS=xt(qS);var WS=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Z),GS=xt(WS);var XS=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Z),HS=xt(XS);var ZS=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Z),KS=xt(ZS);var QS=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Z),JS=xt(QS);var tI=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Z),eI=xt(tI);var rI=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Z),nI=xt(rI);var iI=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Z),oI=xt(iI);function sI(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 aI=Hh(Qn(300,.5,0),Qn(-240,.5,1));var lI=Hh(Qn(-100,.75,.35),Qn(80,1.5,.8)),uI=Hh(Qn(260,.75,.35),Qn(80,1.5,.8)),cI=Qn();function fI(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return cI.h=360*e-100,cI.s=1.5-1.5*t,cI.l=.8-.9*t,cI+""}var dI=Yr(),qat=Math.PI/3,Yat=Math.PI*2/3;function hI(e){var t;return e=(.5-e)*Math.PI,dI.r=255*(t=Math.sin(e))*t,dI.g=255*(t=Math.sin(e+qat))*t,dI.b=255*(t=Math.sin(e+Yat))*t,dI+""}function pI(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 mI(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var yI=mI(Z("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),gI=mI(Z("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),bI=mI(Z("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),xI=mI(Z("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ur(e){return function(){return e}}var SO=Math.cos;var vp=Math.min,vb=Math.sin,Se=Math.sqrt,IO=1e-12,ud=Math.PI,FWt=ud/2,Sp=2*ud;function _I(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new su(t)}var CWt=Array.prototype.slice;function wI(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function EV(e){this._context=e}EV.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 tl(e){return new EV(e)}function vI(e){return e[0]}function SI(e){return e[1]}function Sb(e,t){var r=Ur(!0),n=null,i=tl,o=null,s=_I(a);e=typeof e=="function"?e:e===void 0?vI:Ur(e),t=typeof t=="function"?t:t===void 0?SI:Ur(t);function a(c){var l,u=(c=wI(c)).length,f,d=!1,h;for(n==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&r(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ur(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ur(+c),a):t},a.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Ur(!!c),a):r},a.curve=function(c){return arguments.length?(i=c,n!=null&&(o=i(n)),a):i},a.context=function(c){return arguments.length?(c==null?n=o=null:o=i(n=c),a):n},a}function Ip(e,t,r){var n=null,i=Ur(!0),o=null,s=tl,a=null,c=_I(l);e=typeof e=="function"?e:e===void 0?vI:Ur(+e),t=typeof t=="function"?t:t===void 0?Ur(0):Ur(+t),r=typeof r=="function"?r:r===void 0?SI:Ur(+r);function l(f){var d,h,p,m=(f=wI(f)).length,y,g=!1,b,x=new Array(m),_=new Array(m);for(o==null&&(a=s(b=c())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===g)if(g=!g)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(x[p],_[p]);a.lineEnd(),a.areaEnd()}g&&(x[d]=+e(y,d,f),_[d]=+t(y,d,f),a.point(n?+n(y,d,f):x[d],r?+r(y,d,f):_[d]))}if(b)return a=null,b+""||null}function u(){return Sb().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ur(+f),n=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ur(+f),l):e},l.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ur(+f),l):n},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ur(+f),r=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ur(+f),l):t},l.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ur(+f),l):r},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(r)},l.lineX1=function(){return u().x(n).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ur(!!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 II=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};function TO(e){return new II(e,!0)}function AO(e){return new II(e,!1)}var Wat=Se(3),Ib={draw(e,t){let r=Se(t+vp(t/28,.75))*.59436,n=r/2,i=n*Wat;e.moveTo(0,r),e.lineTo(0,-r),e.moveTo(-i,-n),e.lineTo(i,n),e.moveTo(-i,n),e.lineTo(i,-n)}};var el={draw(e,t){let r=Se(t/ud);e.moveTo(r,0),e.arc(0,0,r,0,Sp)}};var Tb={draw(e,t){let r=Se(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}};var DV=Se(1/3),Gat=DV*2,Ab={draw(e,t){let r=Se(t/Gat),n=r*DV;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var Mb={draw(e,t){let r=Se(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var Eb={draw(e,t){let r=Se(t-vp(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var Db={draw(e,t){let r=Se(t),n=-r/2;e.rect(n,n,r,r)}};var Bb={draw(e,t){let r=Se(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var Xat=.8908130915292852,BV=vb(ud/10)/vb(7*ud/10),Hat=vb(Sp/10)*BV,Zat=-SO(Sp/10)*BV,Ob={draw(e,t){let r=Se(t*Xat),n=Hat*r,i=Zat*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){let s=Sp*o/5,a=SO(s),c=vb(s);e.lineTo(c*r,-a*r),e.lineTo(a*n-c*i,c*n+a*i)}e.closePath()}};var MO=Se(3),Nb={draw(e,t){let r=-Se(t/(MO*3));e.moveTo(0,r*2),e.lineTo(-MO*r,-r),e.lineTo(MO*r,-r),e.closePath()}};var Kat=Se(3),Fb={draw(e,t){let r=Se(t)*.6824,n=r/2,i=r*Kat/2;e.moveTo(0,-r),e.lineTo(i,n),e.lineTo(-i,n),e.closePath()}};var Bo=-.5,Oo=Se(3)/2,EO=1/Se(12),Qat=(EO/2+1)*3,Rb={draw(e,t){let r=Se(t/Qat),n=r/2,i=r*EO,o=n,s=r*EO+r,a=-o,c=s;e.moveTo(n,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Bo*n-Oo*i,Oo*n+Bo*i),e.lineTo(Bo*o-Oo*s,Oo*o+Bo*s),e.lineTo(Bo*a-Oo*c,Oo*a+Bo*c),e.lineTo(Bo*n+Oo*i,Bo*i-Oo*n),e.lineTo(Bo*o+Oo*s,Bo*s-Oo*o),e.lineTo(Bo*a+Oo*c,Bo*c-Oo*a),e.closePath()}};var Tp={draw(e,t){let r=Se(t-vp(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var TI=[el,Tb,Ab,Db,Ob,Nb,Rb],DO=[el,Eb,Tp,Fb,Ib,Bb,Mb];function No(){}function Ap(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Lb(e){this._context=e}Lb.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:Ap(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:Ap(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function BO(e){return new Lb(e)}function OV(e){this._context=e}OV.prototype={areaStart:No,areaEnd:No,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:Ap(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function OO(e){return new OV(e)}function NV(e){this._context=e}NV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ap(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function NO(e){return new NV(e)}function FV(e,t){this._basis=new Lb(e),this._beta=t}FV.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],i=t[0],o=e[r]-n,s=t[r]-i,a=-1,c;++a<=r;)c=a/r,this._basis.point(this._beta*e[a]+(1-this._beta)*(n+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var FO=function e(t){function r(n){return t===1?new Lb(n):new FV(n,t)}return r.beta=function(n){return e(+n)},r}(.85);function Mp(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function AI(e,t){this._context=e,this._k=(1-t)/6}AI.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:Mp(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:Mp(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 RO=function e(t){function r(n){return new AI(n,t)}return r.tension=function(n){return e(+n)},r}(0);function MI(e,t){this._context=e,this._k=(1-t)/6}MI.prototype={areaStart:No,areaEnd:No,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:Mp(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 LO=function e(t){function r(n){return new MI(n,t)}return r.tension=function(n){return e(+n)},r}(0);function EI(e,t){this._context=e,this._k=(1-t)/6}EI.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:Mp(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 kO=function e(t){function r(n){return new EI(n,t)}return r.tension=function(n){return e(+n)},r}(0);function kb(e,t,r){var n=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>IO){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>IO){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-r*e._l12_2a)/u}e._context.bezierCurveTo(n,i,o,s,e._x2,e._y2)}function RV(e,t){this._context=e,this._alpha=t}RV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:kb(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 CO=function e(t){function r(n){return t?new RV(n,t):new AI(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function LV(e,t){this._context=e,this._alpha=t}LV.prototype={areaStart:No,areaEnd:No,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:kb(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 UO=function e(t){function r(n){return t?new LV(n,t):new MI(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function kV(e,t){this._context=e,this._alpha=t}kV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:kb(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 PO=function e(t){function r(n){return t?new kV(n,t):new EI(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function CV(e){this._context=e}CV.prototype={areaStart:No,areaEnd:No,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 $O(e){return new CV(e)}function UV(e){return e<0?-1:1}function PV(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),a=(o*i+s*n)/(n+i);return(UV(o)+UV(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function $V(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function zO(e,t,r){var n=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-n)/3;e._context.bezierCurveTo(n+a,i+a*t,o-a,s-a*r,o,s)}function DI(e){this._context=e}DI.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:zO(this,this._t0,$V(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,zO(this,$V(this,r=PV(this,e,t)),r);break;default:zO(this,this._t0,r=PV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function zV(e){this._context=new VV(e)}(zV.prototype=Object.create(DI.prototype)).point=function(e,t){DI.prototype.point.call(this,t,e)};function VV(e){this._context=e}VV.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function VO(e){return new DI(e)}function jO(e){return new zV(e)}function qV(e){this._context=e}qV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=jV(e),i=jV(t),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(n[0][o],i[0][o],n[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function jV(e){var t,r=e.length-1,n,i=new Array(r),o=new Array(r),s=new Array(r);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/o[t-1],o[t]-=n,s[t]-=n*s[t-1];for(i[r-1]=s[r-1]/o[r-1],t=r-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function qO(e){return new qV(e)}function BI(e,t){this._context=e,this._t=t}BI.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function YO(e){return new BI(e,.5)}function WO(e){return new BI(e,0)}function GO(e){return new BI(e,1)}var Cb=e=>()=>e;function XO(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function Xi(e,t,r){this.k=e,this.x=t,this.y=r}Xi.prototype={constructor:Xi,scale:function(e){return e===1?this:new Xi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xi(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 Ub=new Xi(1,0,0);HO.prototype=Xi.prototype;function HO(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ub;return e.__zoom}function OI(e){e.stopImmediatePropagation()}function Ep(e){e.preventDefault(),e.stopImmediatePropagation()}function Jat(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tct(){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 YV(){return this.__zoom||Ub}function ect(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function rct(){return navigator.maxTouchPoints||"ontouchstart"in this}function nct(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],o=e.invertY(t[0][1])-r[0][1],s=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function ZO(){var e=Jat,t=tct,r=nct,n=ect,i=rct,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=S3,l=Uf("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(S){S.property("__zoom",YV).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",B).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,M,D,C){var U=S.selection?S.selection():S;U.property("__zoom",YV),S!==U?v(S,M,D,C):U.interrupt().each(function(){w(this,arguments).event(C).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},g.scaleBy=function(S,M,D,C){g.scaleTo(S,function(){var U=this.__zoom.k,k=typeof M=="function"?M.apply(this,arguments):M;return U*k},D,C)},g.scaleTo=function(S,M,D,C){g.transform(S,function(){var U=t.apply(this,arguments),k=this.__zoom,$=D==null?_(U):typeof D=="function"?D.apply(this,arguments):D,z=k.invert($),V=typeof M=="function"?M.apply(this,arguments):M;return r(x(b(k,V),$,z),U,s)},D,C)},g.translateBy=function(S,M,D,C){g.transform(S,function(){return r(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),s)},null,C)},g.translateTo=function(S,M,D,C,U){g.transform(S,function(){var k=t.apply(this,arguments),$=this.__zoom,z=C==null?_(k):typeof C=="function"?C.apply(this,arguments):C;return r(Ub.translate(z[0],z[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof D=="function"?-D.apply(this,arguments):-D),k,s)},C,U)};function b(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new Xi(M,S.x,S.y)}function x(S,M,D){var C=M[0]-D[0]*S.k,U=M[1]-D[1]*S.k;return C===S.x&&U===S.y?S:new Xi(S.k,C,U)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,D,C){S.on("start.zoom",function(){w(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(C).end()}).tween("zoom",function(){var U=this,k=arguments,$=w(U,k).event(C),z=t.apply(U,k),V=D==null?_(z):typeof D=="function"?D.apply(U,k):D,Q=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),st=U.__zoom,ct=typeof M=="function"?M.apply(U,k):M,ut=c(st.invert(V).concat(Q/st.k),ct.invert(V).concat(Q/ct.k));return function(X){if(X===1)X=ct;else{var lt=ut(X),q=Q/lt[2];X=new Xi(q,V[0]-lt[0]*q,V[1]-lt[1]*q)}$.zoom(null,X)}})}function w(S,M,D){return!D&&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=ce(this.that).datum();l.call(S,this.that,new XO(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function E(S,...M){if(!e.apply(this,arguments))return;var D=w(this,M).event(S),C=this.__zoom,U=Math.max(o[0],Math.min(o[1],C.k*Math.pow(2,n.apply(this,arguments)))),k=Dn(S);if(D.wheel)(D.mouse[0][0]!==k[0]||D.mouse[0][1]!==k[1])&&(D.mouse[1]=C.invert(D.mouse[0]=k)),clearTimeout(D.wheel);else{if(C.k===U)return;D.mouse=[k,C.invert(k)],da(this),D.start()}Ep(S),D.wheel=setTimeout($,p),D.zoom("mouse",r(x(b(C,U),D.mouse[0],D.mouse[1]),D.extent,s));function $(){D.wheel=null,D.end()}}function T(S,...M){if(d||!e.apply(this,arguments))return;var D=S.currentTarget,C=w(this,M,!0).event(S),U=ce(S.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Q,!0),k=Dn(S,D),$=S.clientX,z=S.clientY;p0(S.view),OI(S),C.mouse=[k,this.__zoom.invert(k)],da(this),C.start();function V(st){if(Ep(st),!C.moved){var ct=st.clientX-$,ut=st.clientY-z;C.moved=ct*ct+ut*ut>m}C.event(st).zoom("mouse",r(x(C.that.__zoom,C.mouse[0]=Dn(st,D),C.mouse[1]),C.extent,s))}function Q(st){U.on("mousemove.zoom mouseup.zoom",null),m0(st.view,C.moved),Ep(st),C.event(st).end()}}function B(S,...M){if(e.apply(this,arguments)){var D=this.__zoom,C=Dn(S.changedTouches?S.changedTouches[0]:S,this),U=D.invert(C),k=D.k*(S.shiftKey?.5:2),$=r(x(b(D,k),C,U),t.apply(this,M),s);Ep(S),a>0?ce(this).transition().duration(a).call(v,$,C,S):ce(this).call(g.transform,$,C,S)}}function A(S,...M){if(e.apply(this,arguments)){var D=S.touches,C=D.length,U=w(this,M,S.changedTouches.length===C).event(S),k,$,z,V;for(OI(S),$=0;$<C;++$)z=D[$],V=Dn(z,this),V=[V,this.__zoom.invert(V),z.identifier],U.touch0?!U.touch1&&U.touch0[2]!==V[2]&&(U.touch1=V,U.taps=0):(U.touch0=V,k=!0,U.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(U.taps<2&&(f=V[0],u=setTimeout(function(){u=null},h)),da(this),U.start())}}function O(S,...M){if(this.__zooming){var D=w(this,M).event(S),C=S.changedTouches,U=C.length,k,$,z,V;for(Ep(S),k=0;k<U;++k)$=C[k],z=Dn($,this),D.touch0&&D.touch0[2]===$.identifier?D.touch0[0]=z:D.touch1&&D.touch1[2]===$.identifier&&(D.touch1[0]=z);if($=D.that.__zoom,D.touch1){var Q=D.touch0[0],st=D.touch0[1],ct=D.touch1[0],ut=D.touch1[1],X=(X=ct[0]-Q[0])*X+(X=ct[1]-Q[1])*X,lt=(lt=ut[0]-st[0])*lt+(lt=ut[1]-st[1])*lt;$=b($,Math.sqrt(X/lt)),z=[(Q[0]+ct[0])/2,(Q[1]+ct[1])/2],V=[(st[0]+ut[0])/2,(st[1]+ut[1])/2]}else if(D.touch0)z=D.touch0[0],V=D.touch0[1];else return;D.zoom("touch",r(x($,z,V),D.extent,s))}}function L(S,...M){if(this.__zooming){var D=w(this,M).event(S),C=S.changedTouches,U=C.length,k,$;for(OI(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),k=0;k<U;++k)$=C[k],D.touch0&&D.touch0[2]===$.identifier?delete D.touch0:D.touch1&&D.touch1[2]===$.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&($=Dn($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<y)){var z=ce(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(n=typeof S=="function"?S:Cb(+S),g):n},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Cb(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Cb(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Cb([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(r=S,g):r},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function wr(e){return e!=null&&!Number.isNaN(e)}function tn(e,t){return+wr(t)-+wr(e)||Yt(e,t)}function fd(e,t){return+wr(t)-+wr(e)||Xn(e,t)}function Pb(e){return e!=null&&`${e}`!=""}function Dp(e){return isFinite(e)?e:NaN}function oi(e){return e>0&&isFinite(e)?e:NaN}function mu(e){return e<0&&isFinite(e)?e:NaN}function Bp(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let r=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${ict(e.getUTCFullYear(),4)}-${rl(e.getUTCMonth()+1,2)}-${rl(e.getUTCDate(),2)}${r||n||i||o?`T${rl(r,2)}:${rl(n,2)}${i||o?`:${rl(i,2)}${o?`.${rl(o,3)}`:""}`:""}Z`:""}`}function ict(e){return e<0?`-${rl(-e,6)}`:e>9999?`+${rl(e,6)}`:rl(e,4)}function rl(e,t){return`${e}`.padStart(t,"0")}var oct=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function $b(e,t){return oct.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function nl(e){if(e==null)return;let t=e[0],r=e[e.length-1];return Xn(t,r)}var Np=1e3,gu=Np*60,bu=gu*60,Aa=bu*24,Ta=Aa*7,dd=Aa*30,yu=Aa*365,KO=[["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",Np],["5 seconds",5*Np],["15 seconds",15*Np],["30 seconds",30*Np],["minute",gu],["5 minutes",5*gu],["15 minutes",15*gu],["30 minutes",30*gu],["hour",bu],["3 hours",3*bu],["6 hours",6*bu],["12 hours",12*bu],["day",Aa],["2 days",2*Aa],["week",Ta],["2 weeks",2*Ta],["month",dd],["3 months",3*dd],["6 months",6*dd],["year",yu],["2 years",2*yu],["5 years",5*yu],["10 years",10*yu],["20 years",20*yu],["50 years",50*yu],["100 years",100*yu]],QO=new Map([["second",Np],["minute",gu],["hour",bu],["day",Aa],["monday",Ta],["tuesday",Ta],["wednesday",Ta],["thursday",Ta],["friday",Ta],["saturday",Ta],["sunday",Ta],["week",Ta],["month",dd],["year",yu]]),GV=new Map([["second",Qr],["minute",Xc],["hour",Zc],["day",Do],["monday",hu],["tuesday",H2],["wednesday",Z2],["thursday",va],["friday",K2],["saturday",Q2],["sunday",Wi],["week",Wi],["month",Qc],["year",Rn]]),JO=new Map([["second",Qr],["minute",Hc],["hour",Kc],["day",ad],["monday",pu],["tuesday",J2],["wednesday",tS],["thursday",Sa],["friday",eS],["saturday",rS],["sunday",Gi],["week",Gi],["month",Jc],["year",Ln]]),Fp=Symbol("intervalDuration"),FI=Symbol("intervalType");for(let[e,t]of GV)t[Fp]=QO.get(e),t[FI]="time";for(let[e,t]of JO)t[Fp]=QO.get(e),t[FI]="utc";var zb=[["year",Ln,"utc"],["month",Jc,"utc"],["day",ad,"utc",6*dd],["hour",Kc,"utc",3*Aa],["minute",Hc,"utc",6*bu],["second",Qr,"utc",30*gu]],NI=[["year",Rn,"time"],["month",Qc,"time"],["day",Do,"time",6*dd],["hour",Zc,"time",3*Aa],["minute",Xc,"time",6*bu],["second",Qr,"time",30*gu]],sct=[zb[0],NI[0],zb[1],NI[1],zb[2],NI[2],...zb.slice(3)];function RI(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let r=1,n=/^(?:(\d+)\s+)/.exec(t);switch(n&&(t=t.slice(n[0].length),r=+n[1]),t){case"quarter":t="month",r*=3;break;case"half":t="month",r*=6;break}let i=JO.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(r>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,r]}function tN(e){return XV(RI(e),"time")}function Vb(e){return XV(RI(e),"utc")}function XV([e,t],r){let n=(r==="time"?GV:JO).get(e);return t>1&&(n=n.every(t),n[Fp]=QO.get(e)*t,n[FI]=r),n}function eN(e,t){if(!(t>1))return;let r=e[Fp];if(!KO.some(([,i])=>i===r)||r%Aa===0&&Aa<r&&r<dd)return;let[n]=KO[Fc(([,i])=>Math.log(i)).center(KO,Math.log(r*t))];return(e[FI]==="time"?tN:Vb)(n)}function WV(e,t,r){let n=t==="time"?xp:Ia;if(r==null)return n(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=act(r);switch(e){case"millisecond":return Op(n(".%L"),n(":%M:%S"),i);case"second":return Op(n(":%S"),n("%-I:%M"),i);case"minute":return Op(n("%-I:%M"),n("%p"),i);case"hour":return Op(n("%-I %p"),n("%b %-d"),i);case"day":return Op(n("%-d"),n("%b"),i);case"month":return Op(n("%b"),n("%Y"),i);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function act(e){return e==="left"||e==="right"?(t,r)=>`
11
+ ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new Pe(n,i)))}slice(t,n){let r=this.schema;[t,n]=Qh({length:this.numRows},t,n);let i=ib(this.data,this._offsets,t,n);return new e(r,i.map(o=>new Pe(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Ft({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Gt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new Gt([Ft({type:new tr,length:this.numRows})]));let o=r.fields.slice(),s=o[t].clone({type:n.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,n],[r,i]=kb(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=n.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...kb(o,s))}};mk=Symbol.toStringTag;nr[mk]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Za(Jh),e.get=Za(Xe.getVisitFn(R.Struct)),e.set=ob(An.getVisitFn(R.Struct)),e.indexOf=sb(Il.getVisitFn(R.Struct)),e.getByteLength=Za(qr.getVisitFn(R.Struct)),"Table"))(nr.prototype);var gk,Pe=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Ft({nullCount:0,type:new _e(this.schema.fields),children:this.schema.fields.map(n=>Ft({type:n.type,nullCount:0}))})]=t,!(this.data instanceof le))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=yk(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=zt.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new se(r),a=Ft({type:new _e(r),length:o,children:i,nullCount:0});[this.schema,this.data]=yk(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=xk(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Xe.visit(this.data,t)}set(t,n){return An.visit(this.data,t,n)}indexOf(t,n){return Il.visit(this.data,t,n)}getByteLength(t){return qr.visit(this.data,t)}[Symbol.iterator](){return hf.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new nr(this.schema,[this,...t])}slice(t,n){let[r]=new Gt([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Gt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new Gt([Ft({type:new tr,length:this.numRows})]));let o=r.fields.slice(),s=i.children.slice(),a=o[t].clone({type:n.type});[o[t],s[t]]=[a,n.data[0]],r=new se(o,new Map(this.schema.metadata)),i=Ft({type:new _e(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new _e(n.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(n,Ft({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(o=>this.data.children[o]).filter(Boolean),i=Ft({type:new _e(n.fields),length:this.numRows,children:r});return new e(n,i)}};gk=Symbol.toStringTag;Pe[gk]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Pe.prototype);function yk(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;let i=[...e.fields],o=[...t],s=(n+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==n)&&(i[a]=c.clone({nullable:!0}),o[a]=(r=l?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:Ft({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Ft({type:new _e(i),length:n,children:o})]}function xk(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])xk(a.children,l?.children,n);if(lt.isDictionary(a)){let{id:l}=a;if(!n.has(l))c?.dictionary&&n.set(l,c.dictionary);else if(n.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}var Ll=class extends Pe{constructor(t){let n=t.fields.map(i=>Ft({type:i.type})),r=Ft({type:new _e(t.fields),nullCount:0,children:n});super(t,r)}};var Up;(function(e){e[e.BUFFER=0]="BUFFER"})(Up||(Up={}));var zp;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(zp||(zp={}));var Cb=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):zp.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Up.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,zp.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Up.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}};var _f=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var vf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Wr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new vf).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new _f).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new Cb).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}};var Xs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Wr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var Sf;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Sf||(Sf={}));var Ji=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ja.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Sf.NONE}header(t){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,Ja.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,Sf.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,o,s){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var TT=class extends dt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return cp.startNull(n),cp.endNull(n)}visitInt(t,n){return Qi.startInt(n),Qi.addBitWidth(n,t.bitWidth),Qi.addIsSigned(n,t.isSigned),Qi.endInt(n)}visitFloat(t,n){return oc.startFloatingPoint(n),oc.addPrecision(n,t.precision),oc.endFloatingPoint(n)}visitBinary(t,n){return np.startBinary(n),np.endBinary(n)}visitBool(t,n){return rp.startBool(n),rp.endBool(n)}visitUtf8(t,n){return fp.startUtf8(n),fp.endUtf8(n)}visitDecimal(t,n){return Ao.startDecimal(n),Ao.addScale(n,t.scale),Ao.addPrecision(n,t.precision),Ao.addBitWidth(n,t.bitWidth),Ao.endDecimal(n)}visitDate(t,n){return ec.startDate(n),ec.addUnit(n,t.unit),ec.endDate(n)}visitTime(t,n){return Ps.startTime(n),Ps.addUnit(n,t.unit),Ps.addBitWidth(n,t.bitWidth),Ps.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return $s.startTimestamp(n),$s.addUnit(n,t.unit),r!==void 0&&$s.addTimezone(n,r),$s.endTimestamp(n)}visitInterval(t,n){return sc.startInterval(n),sc.addUnit(n,t.unit),sc.endInterval(n)}visitDuration(t,n){return nc.startDuration(n),nc.addUnit(n,t.unit),nc.endDuration(n)}visitList(t,n){return ap.startList(n),ap.endList(n)}visitStruct(t,n){return lp.startStruct_(n),lp.endStruct_(n)}visitUnion(t,n){Ki.startTypeIdsVector(n,t.typeIds.length);let r=Ki.createTypeIdsVector(n,t.typeIds);return Ki.startUnion(n),Ki.addMode(n,t.mode),Ki.addTypeIds(n,r),Ki.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return Eo.startDictionaryEncoding(n),Eo.addId(n,BigInt(t.id)),Eo.addIsOrdered(n,t.isOrdered),r!==void 0&&Eo.addIndexType(n,r),Eo.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return rc.startFixedSizeBinary(n),rc.addByteWidth(n,t.byteWidth),rc.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return ic.startFixedSizeList(n),ic.addListSize(n,t.listSize),ic.endFixedSizeList(n)}visitMap(t,n){return ac.startMap(n),ac.addKeysSorted(n,t.keysSorted),ac.endMap(n)}},Bb=new TT;function vk(e,t=new Map){return new se(ZW(e,t),Pb(e.metadata),t)}function ET(e){return new Mn(e.count,Ik(e.columns),Tk(e.columns))}function Sk(e){return new Mr(ET(e.data),e.id,e.isDelta)}function ZW(e,t){return(e.fields||[]).filter(Boolean).map(n=>zt.fromJSON(n,t))}function bk(e,t){return(e.children||[]).filter(Boolean).map(n=>zt.fromJSON(n,t))}function Ik(e){return(e||[]).reduce((t,n)=>[...t,new bi(n.count,KW(n.VALIDITY)),...Ik(n.children)],[])}function Tk(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new Ar(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Ar(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Ar(t.length,i.OFFSET.length)),i.DATA&&t.push(new Ar(t.length,i.DATA.length)),t=Tk(i.children,t)}return t}function KW(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function Ek(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=_k(e,bk(e,t)),i=new zt(e.name,s,e.nullable,Pb(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?wk(r):new _o,a=new jr(t.get(n),r,n,o.isOrdered),i=new zt(e.name,a,e.nullable,Pb(e.metadata))):(r=(r=o.indexType)?wk(r):new _o,t.set(n,s=_k(e,bk(e,t))),a=new jr(s,r,n,o.isOrdered),i=new zt(e.name,a,e.nullable,Pb(e.metadata))),i||null}function Pb(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function wk(e){return new Ve(e.isSigned,e.bitWidth)}function _k(e,t){let n=e.type.name;switch(n){case"NONE":return new tr;case"null":return new tr;case"binary":return new As;case"utf8":return new Ms;case"bool":return new Os;case"list":return new qi((t||[])[0]);case"struct":return new _e(t||[]);case"struct_":return new _e(t||[])}switch(n){case"int":{let r=e.type;return new Ve(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new Tr(Ie[r.precision])}case"decimal":{let r=e.type;return new Ns(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Ds(En[r.unit])}case"time":{let r=e.type;return new Vi(yt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Rs(yt[r.unit],r.timezone)}case"interval":{let r=e.type;return new Ls(Jn[r.unit])}case"duration":{let r=e.type;return new Fs(yt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Yi(we[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new ks(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Gi(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Wi((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var JW=El,tX=Yr,Or=class e{static fromJSON(t,n){let r=new e(0,Me.V5,n);return r._createHeader=eX(t,n),r}static decode(t){t=new tX(Lt(t));let n=Ji.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=nX(n,o),s}static encode(t){let n=new JW,r=-1;return t.isSchema()?r=se.encode(n,t.header()):t.isRecordBatch()?r=Mn.encode(n,t.header()):t.isDictionaryBatch()&&(r=Mr.encode(n,t.header())),Ji.startMessage(n),Ji.addVersion(n,Me.V5),Ji.addHeader(n,r),Ji.addHeaderType(n,t.headerType),Ji.addBodyLength(n,BigInt(t.bodyLength)),Ji.finishMessageBuffer(n,Ji.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof se)return new e(0,Me.V5,Kt.Schema,t);if(t instanceof Mn)return new e(n,Me.V5,Kt.RecordBatch,t);if(t instanceof Mr)return new e(n,Me.V5,Kt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Kt.Schema}isRecordBatch(){return this.headerType===Kt.RecordBatch}isDictionaryBatch(){return this.headerType===Kt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Ir(t)}},Mn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=Ir(t)}},Mr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=Ir(n)}},Ar=class{constructor(t,n){this.offset=Ir(t),this.length=Ir(n)}},bi=class{constructor(t,n){this.length=Ir(t),this.nullCount=Ir(n)}};function eX(e,t){return()=>{switch(t){case Kt.Schema:return se.fromJSON(e);case Kt.RecordBatch:return Mn.fromJSON(e);case Kt.DictionaryBatch:return Mr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Kt[t]}, type: ${t} }`)}}function nX(e,t){return()=>{switch(t){case Kt.Schema:return se.decode(e.header(new Er),new Map,e.version());case Kt.RecordBatch:return Mn.decode(e.header(new Wr),e.version());case Kt.DictionaryBatch:return Mr.decode(e.header(new Xs),e.version())}throw new Error(`Unrecognized Message type: { name: ${Kt[t]}, type: ${t} }`)}}zt.encode=hX;zt.decode=fX;zt.fromJSON=Ek;se.encode=dX;se.decode=rX;se.fromJSON=vk;Mn.encode=pX;Mn.decode=iX;Mn.fromJSON=ET;Mr.encode=mX;Mr.decode=oX;Mr.fromJSON=Sk;bi.encode=yX;bi.decode=aX;Ar.encode=gX;Ar.decode=sX;function rX(e,t=new Map,n=Me.V5){let r=uX(e,t);return new se(r,$b(e),t,n)}function iX(e,t=Me.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Mn(e.length(),cX(e),lX(e,t))}function oX(e,t=Me.V5){return new Mr(Mn.decode(e.data(),t),e.id(),e.isDelta())}function sX(e){return new Ar(e.offset(),e.length())}function aX(e){return new bi(e.length(),e.nullCount())}function cX(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=bi.decode(n));return t}function lX(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Me.V4&&(r.bb_pos+=8*(i+1)),n[++o]=Ar.decode(r));return n}function uX(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=zt.decode(r,t));return n}function Ak(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=zt.decode(r,t));return n}function fX(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=Ok(e,Ak(e,t)),r=new zt(e.name(),i,e.nullable(),$b(e))):t.has(n=Ir(a.id()))?(o=(o=a.indexType())?Mk(o):new _o,s=new jr(t.get(n),o,n,a.isOrdered()),r=new zt(e.name(),s,e.nullable(),$b(e))):(o=(o=a.indexType())?Mk(o):new _o,t.set(n,i=Ok(e,Ak(e,t))),s=new jr(i,o,n,a.isOrdered()),r=new zt(e.name(),s,e.nullable(),$b(e))),r||null}function $b(e){let t=new Map;if(e)for(let n,r,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Mk(e){return new Ve(e.isSigned(),e.bitWidth())}function Ok(e,t){let n=e.typeType();switch(n){case ve.NONE:return new tr;case ve.Null:return new tr;case ve.Binary:return new As;case ve.Utf8:return new Ms;case ve.Bool:return new Os;case ve.List:return new qi((t||[])[0]);case ve.Struct_:return new _e(t||[])}switch(n){case ve.Int:{let r=e.type(new Qi);return new Ve(r.isSigned(),r.bitWidth())}case ve.FloatingPoint:{let r=e.type(new oc);return new Tr(r.precision())}case ve.Decimal:{let r=e.type(new Ao);return new Ns(r.scale(),r.precision(),r.bitWidth())}case ve.Date:{let r=e.type(new ec);return new Ds(r.unit())}case ve.Time:{let r=e.type(new Ps);return new Vi(r.unit(),r.bitWidth())}case ve.Timestamp:{let r=e.type(new $s);return new Rs(r.unit(),r.timezone())}case ve.Interval:{let r=e.type(new sc);return new Ls(r.unit())}case ve.Duration:{let r=e.type(new nc);return new Fs(r.unit())}case ve.Union:{let r=e.type(new Ki);return new Yi(r.mode(),r.typeIdsArray()||[],t||[])}case ve.FixedSizeBinary:{let r=e.type(new rc);return new ks(r.byteWidth())}case ve.FixedSizeList:{let r=e.type(new ic);return new Gi(r.listSize(),(t||[])[0])}case ve.Map:{let r=e.type(new ac);return new Wi((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ve[n]}" (${n})`)}function dX(e,t){let n=t.fields.map(o=>zt.encode(e,o));Er.startFieldsVector(e,n.length);let r=Er.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?Er.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return an.startKeyValue(e),an.addKey(e,a),an.addValue(e,c),an.endKeyValue(e)})):-1;return Er.startSchema(e),Er.addFields(e,r),Er.addEndianness(e,xX?tc.Little:tc.Big),i!==-1&&Er.addCustomMetadata(e,i),Er.endSchema(e)}function hX(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;lt.isDictionary(o)?(s=o.dictionary.typeId,i=Bb.visit(o,e),r=Bb.visit(o.dictionary,e)):r=Bb.visit(o,e);let a=(o.children||[]).map(u=>zt.encode(e,u)),c=Un.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Un.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return an.startKeyValue(e),an.addKey(e,d),an.addValue(e,h),an.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Un.startField(e),Un.addType(e,r),Un.addTypeType(e,s),Un.addChildren(e,c),Un.addNullable(e,!!t.nullable),n!==-1&&Un.addName(e,n),i!==-1&&Un.addDictionary(e,i),l!==-1&&Un.addCustomMetadata(e,l),Un.endField(e)}function pX(e,t){let n=t.nodes||[],r=t.buffers||[];Wr.startNodesVector(e,n.length);for(let s of n.slice().reverse())bi.encode(e,s);let i=e.endVector();Wr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())Ar.encode(e,s);let o=e.endVector();return Wr.startRecordBatch(e),Wr.addLength(e,BigInt(t.length)),Wr.addNodes(e,i),Wr.addBuffers(e,o),Wr.endRecordBatch(e)}function mX(e,t){let n=Mn.encode(e,t.data);return Xs.startDictionaryBatch(e),Xs.addId(e,BigInt(t.id)),Xs.addIsDelta(e,t.isDelta),Xs.addData(e,n),Xs.endDictionaryBatch(e)}function yX(e,t){return vf.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function gX(e,t){return _f.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var xX=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var MT=e=>`Expected ${Kt[e]} Message in stream, but was null or length 0.`,OT=e=>`Header pointer of flatbuffer-encoded ${Kt[e]} Message is null or length 0.`,Nk=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Dk=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,If=class{constructor(t){this.source=t instanceof Oo?t:new Oo(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Se:t.value===-1&&(t=this.readMetadataLength()).done?Se:(t=this.readMetadata(t.value)).done?Se:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(MT(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Lt(this.source.read(t));if(n.byteLength<t)throw new Error(Dk(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Kt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(OT(n));return i}readMetadataLength(){let t=this.source.read(Ub),n=t&&new Yr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return Se;if(n.byteLength<t)throw new Error(Nk(t,n.byteLength));return{done:!1,value:Or.decode(n)}}},jp=class{constructor(t,n){this.source=t instanceof gi?t:wx(t)?new cc(t,n):new gi(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Se:t.value===-1&&(t=yield this.readMetadataLength()).done?Se:(t=yield this.readMetadata(t.value)).done?Se:t})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Z(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Z(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(MT(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Lt(yield this.source.read(t));if(n.byteLength<t)throw new Error(Dk(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Z(this,void 0,void 0,function*(){let n=Kt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(OT(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(Ub),n=t&&new Yr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Z(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return Se;if(n.byteLength<t)throw new Error(Nk(t,n.byteLength));return{done:!1,value:Or.decode(n)}})}},Vp=class extends If{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof dp?t:new dp(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Or.fromJSON(t.schema,Kt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:Or.fromJSON(n,Kt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:Or.fromJSON(n,Kt.RecordBatch)}}return this._body=[],Se}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...n(o.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(MT(t));return n.value}readSchema(){let t=Kt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(OT(t));return r}},Ub=4,AT="ARROW1",Tf=new Uint8Array(AT.length);for(let e=0;e<AT.length;e+=1)Tf[e]=AT.codePointAt(e);function zb(e,t=0){for(let n=-1,r=Tf.length;++n<r;)if(Tf[n]!==e[t+n])return!1;return!0}var Ef=Tf.length,NT=Ef+Ub,Rk=Ef*2+Ub;var On=class e extends Al{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let n=this._impl.open(t);return Pi(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Tn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Tn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:xx(t)?wX(t):wx(t)?SX(t):Pi(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):_x(t)||Gh(t)||Sx(t)||hi(t)?vX(new gi(t)):_X(new Oo(t))}static readAll(t){return t instanceof e?t.isSync()?Lk(t):Fk(t):xx(t)||ArrayBuffer.isView(t)||$i(t)||bx(t)?Lk(t):Fk(t)}},Do=class extends On{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ur(this,arguments,function*(){yield Bt(yield*rf(Bi(this[Symbol.iterator]())))})}},lc=class extends On{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Z(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=Bi(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},uc=class extends Do{constructor(t){super(t),this._impl=t}},qp=class extends lc{constructor(t){super(t),this._impl=t}},jb=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){let r=this._loadVectors(t,n,this.schema.fields),i=Ft({type:new _e(this.schema.fields),length:t.length,children:r});return new Pe(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new Gt(l)):new Gt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new yp(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},Af=class extends jb{constructor(t,n){super(n),this._reader=xx(t)?new Vp(this._handle=t):new If(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=kk(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Se}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Se}next(){if(this.closed)return Se;let t,{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ll(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Mf=class extends jb{constructor(t,n){super(n),this._reader=new jp(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Z(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Z(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=kk(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Se})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Se})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return Se;let t,{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ll(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Vb=class extends Af{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof hp?t:new hp(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Kt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Kt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-NT,r=t.readInt32(n),i=t.readAt(n-r,r);return Us.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}},DT=class extends Mf{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){let r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof cc?t:new cc(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Z(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Z(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Kt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return Z(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Kt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Z(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-NT,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Us.decode(i)})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},RT=class extends Af{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new hb(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function kk(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*Lk(e){let t=On.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Fk(e){return Ur(this,arguments,function*(){let n=yield Bt(On.from(e));try{if(!(yield Bt(n.open({autoDestroy:!1}))).closed)do yield yield Bt(n);while(!(yield Bt(n.reset().open())).closed)}finally{yield Bt(n.cancel())}})}function wX(e){return new Do(new RT(e))}function _X(e){let t=e.peek(Ef+7&-8);return t&&t.byteLength>=4?zb(t)?new uc(new Vb(e.read())):new Do(new Af(e)):new Do(new Af(function*(){}()))}function vX(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(Ef+7&-8);return t&&t.byteLength>=4?zb(t)?new uc(new Vb(yield e.read())):new lc(new Mf(e)):new lc(new Mf(function(){return Ur(this,arguments,function*(){})}()))})}function SX(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new cc(e,t);return t>=Rk&&zb(yield n.readAt(0,Ef+7&-8))?new qp(new DT(n)):new lc(new Mf(n))})}var $e=class e extends dt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof Pe?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Gt)return this.visitMany(t.data),this;let{type:n}=t;if(!lt.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(lt.isUnion(n))this.nodes.push(new bi(r,0));else{let{nullCount:i}=t;lt.isNull(n)||to.call(this,i<=0?new Uint8Array(0):vl(t.offset,r,t.nullBitmap)),this.nodes.push(new bi(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function to(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Ar(this._byteLength,t)),this._byteLength+=t,this}function IX(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(to.call(this,i),n.mode===we.Sparse)return LT.call(this,e);if(n.mode===we.Dense){if(e.offset<=0)return to.call(this,o),LT.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);to.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(r,h))}))}}return this}function TX(e){let t;return e.nullCount>=e.length?to.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?to.call(this,vl(e.offset,e.length,t)):to.call(this,Sl(e.values))}function Hs(e){return to.call(this,e.values.subarray(0,e.length*e.stride))}function Ck(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return to.call(this,Ix(-i,t+1,r)),to.call(this,n.subarray(i,i+s)),this}function FT(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return to.call(this,Ix(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function LT(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}$e.prototype.visitBool=TX;$e.prototype.visitInt=Hs;$e.prototype.visitFloat=Hs;$e.prototype.visitUtf8=Ck;$e.prototype.visitBinary=Ck;$e.prototype.visitFixedSizeBinary=Hs;$e.prototype.visitDate=Hs;$e.prototype.visitTimestamp=Hs;$e.prototype.visitTime=Hs;$e.prototype.visitDecimal=Hs;$e.prototype.visitList=FT;$e.prototype.visitStruct=LT;$e.prototype.visitUnion=IX;$e.prototype.visitInterval=Hs;$e.prototype.visitDuration=Hs;$e.prototype.visitFixedSizeList=FT;$e.prototype.visitMap=FT;var Fl=class extends Al{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Mo,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Kn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Pi(t)?t.then(n=>this.writeAll(n)):hi(t)?CT(this,t):kT(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,n=null){return t===this._sink||t instanceof Mo?this._sink=t:(this._sink=new Mo,t&&eF(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&nF(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!n||!Rl(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof nr&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Pe&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Rl(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Pe?t instanceof Ll||this._writeRecordBatch(t):t instanceof nr?this.writeAll(t.batches):$i(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=Or.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Kt.RecordBatch?this._recordBatchBlocks.push(new zs(a,t.bodyLength,this._position)):t.headerType===Kt.DictionaryBatch&&this._dictionaryBlocks.push(new zs(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let n=Lt(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(Or.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Tf)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=$e.assemble(t),s=new Mn(t.numRows,r,i),a=Or.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){this._dictionaryDeltaOffsets.set(n,t.length+(this._dictionaryDeltaOffsets.get(n)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=$e.assemble(new Gt([t])),c=new Mn(t.length,o,s),l=new Mr(c,n,r),u=Or.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o<s;)(n=t[o])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[n,r]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(n)||0;if(i===0||(r=r?.slice(i)).length>0)for(let o of r.data)this._writeDictionaryBatch(o,n,i>0),i+=o.length}return this}},kl=class e extends Fl{static writeAll(t,n){let r=new e(n);return Pi(t)?t.then(i=>r.writeAll(i)):hi(t)?CT(r,t):kT(r,t)}},Cl=class e extends Fl{static writeAll(t){let n=new e;return Pi(t)?t.then(r=>n.writeAll(r)):hi(t)?CT(n,t):kT(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=Us.encode(new Us(t,Me.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function kT(e,t){let n=t;t instanceof nr&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function CT(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=Bi(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function Bk(e,t){if(hi(e))return AX(e,t);if($i(e))return EX(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function EX(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,n||(n=e[Symbol.iterator]()))},pull(s){n?o(s,n):s.close()},cancel(){(n?.return&&n.return()||!0)&&(n=null)}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Lt(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function AX(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Z(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Z(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Z(this,void 0,void 0,function*(){(n?.return&&(yield n.return())||!0)&&(n=null)})}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){return Z(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Lt(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function Uk(e){return new BT(e)}var BT=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=JL(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ol(o),this._getSize=i!=="bytes"?Pk:$k;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?Pk:$k}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let n=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-n}_maybeFlush(t,n){n!=null&&(this._bufferedSize>=n.desiredSize&&++this._numChunks&&this._enqueue(n,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(n,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(n,null)))}_enqueue(t,n){this._bufferedSize=0,this._controller=null,n==null?t.close():t.enqueue(n)}},Pk=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},$k=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function qb(e,t){let n=new Mo,r=null,i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield n.close()})},start(a){return Z(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return Z(this,void 0,void 0,function*(){r?yield s(a,r):a.close()})}});return{writable:new WritableStream(n,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Z(this,void 0,void 0,function*(){return yield(yield On.from(n)).open(t)})}function s(a,c){return Z(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Yb(e,t){let n=new this(e),r=new gi(n),i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Z(this,void 0,void 0,function*(){yield o(s)})},start(s){return Z(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Z(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Gb(e,t="stream"){return(t==="stream"?kl:Cl).writeAll(e).toUint8Array(!0)}var DX=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},XI),wT),fT),HI),VI),uT),GI),{compareSchemas:Rl,compareFields:hk,compareTypes:pk});Tn.toDOMStream=Bk;Te.throughDOM=Uk;On.throughDOM=qb;uc.throughDOM=qb;Do.throughDOM=qb;Fl.throughDOM=Yb;Cl.throughDOM=Yb;kl.throughDOM=Yb;var RX=Object.create,jk=Object.defineProperty,LX=Object.getOwnPropertyDescriptor,FX=Object.getOwnPropertyNames,kX=Object.getPrototypeOf,CX=Object.prototype.hasOwnProperty,BX=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),PX=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FX(t))!CX.call(e,i)&&i!==n&&jk(e,i,{get:()=>t[i],enumerable:!(r=LX(t,i))||r.enumerable});return e},$X=(e,t,n)=>(n=e!=null?RX(kX(e)):{},PX(t||!e||!e.__esModule?jk(n,"default",{value:e,enumerable:!0}):n,e)),UX=BX((e,t)=>{t.exports=Worker}),zX=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(zX||{}),jX=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(jX||{}),VX=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(VX||{}),qX=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(qX||{}),YX=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(YX||{}),GX=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(GX||{}),Vk=class{log(e){}},qk=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var WX=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(WX||{}),XX=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=On.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new nr(n)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let n=new Yk(this._bindings,this._conn,t),r=await On.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new HX(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=Gb(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},Yk=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},HX=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=On.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new nr(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new Yk(this.bindings,this.connectionId,t),r=await On.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},QX=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(QX||{}),ZX=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(ZX||{}),Jt=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function Wb(e){switch(e.typeId){case R.Binary:return{sqlType:"binary"};case R.Bool:return{sqlType:"bool"};case R.Date:return{sqlType:"date"};case R.DateDay:return{sqlType:"date32[d]"};case R.DateMillisecond:return{sqlType:"date64[ms]"};case R.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case R.Float:return{sqlType:"float"};case R.Float16:return{sqlType:"float16"};case R.Float32:return{sqlType:"float32"};case R.Float64:return{sqlType:"float64"};case R.Int:return{sqlType:"int32"};case R.Int16:return{sqlType:"int16"};case R.Int32:return{sqlType:"int32"};case R.Int64:return{sqlType:"int64"};case R.Uint16:return{sqlType:"uint16"};case R.Uint32:return{sqlType:"uint32"};case R.Uint64:return{sqlType:"uint64"};case R.Uint8:return{sqlType:"uint8"};case R.IntervalDayTime:return{sqlType:"interval[dt]"};case R.IntervalYearMonth:return{sqlType:"interval[m]"};case R.List:return{sqlType:"list",valueType:Wb(e.valueType)};case R.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case R.Null:return{sqlType:"null"};case R.Utf8:return{sqlType:"utf8"};case R.Struct:return{sqlType:"struct",fields:e.children.map(t=>VT(t.name,t.type))};case R.Map:{let t=e;return{sqlType:"map",keyType:Wb(t.keyType),valueType:Wb(t.valueType)}}case R.Time:return{sqlType:"time[s]"};case R.TimeMicrosecond:return{sqlType:"time[us]"};case R.TimeMillisecond:return{sqlType:"time[ms]"};case R.TimeNanosecond:return{sqlType:"time[ns]"};case R.TimeSecond:return{sqlType:"time[s]"};case R.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case R.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case R.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case R.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case R.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function VT(e,t){let n=Wb(t);return n.name=e,n}var KX=new TextEncoder,Gk=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new Jt("RESET",null);return await this.postTask(e)}async ping(){let e=new Jt("PING",null);await this.postTask(e)}async dropFile(e){let t=new Jt("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Jt("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Jt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Jt("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Jt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Jt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Jt("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Jt("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Jt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new XX(this,e)}async disconnect(e){let t=new Jt("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Jt("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t){let n=new Jt("START_PENDING_QUERY",[e,t]);return await this.postTask(n)}async pollPendingQuery(e){let t=new Jt("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Jt("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Jt("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Jt("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Jt("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Jt("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Jt("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Jt("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Jt("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=KX.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Jt("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new Jt("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let n=new Jt("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Jt("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async collectFileStatistics(e,t){let n=new Jt("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Jt("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Jt("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Jt("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Jt("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(VT(o,s))}n.columnsFlat=i,delete n.columns}let r=new Jt("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(VT(o,s))}n.columnsFlat=i,delete n.columns}let r=new Jt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var JX=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),tH=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),eH=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),nH=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),qT={name:"@duckdb/duckdb-wasm",version:"1.28.1-dev99.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^14.0.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.18.0","@typescript-eslint/parser":"^6.18.0",esbuild:"^0.19.10",eslint:"^8.56.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.10.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.2",puppeteer:"^21.7.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.7",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},rH=qT.name,iH=qT.version,YT=qT.version.split("."),ivt=YT[0],ovt=YT[1],svt=YT[2],oH=()=>typeof navigator>"u";function Wk(){let e="https://cdn.jsdelivr.net/npm/".concat(rH,"@").concat(iH,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var PT=null,$T=null,UT=null,zT=null,jT=null;async function sH(){return PT==null&&(PT=typeof BigInt64Array<"u"),$T==null&&($T=await tH()),UT==null&&(UT=await nH()),zT==null&&(zT=await eH()),jT==null&&(jT=await JX()),{bigInt64Array:PT,crossOriginIsolated:oH()||globalThis.crossOriginIsolated||!1,wasmExceptions:$T,wasmSIMD:zT,wasmThreads:UT,wasmBulkMemory:jT}}async function Xk(e){let t=await sH();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var avt=$X(UX());function aH(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var cvt=aH(),cH=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(cH||{});function uH(e,t){return new Promise((n,r)=>{e.useUnsafe(async(i,o)=>{try{let s=await i.runQuery(o,t);n(s)}catch(s){r(s)}})})}function Hk(e={}){let{duckdb:t,connection:n,...r}=e,i=t,o=n,s;function a(){return s||(s=(i?Promise.resolve(i):fH(r).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,h=await l(),p=await uH(h,d);return f==="exec"?void 0:f==="arrow"?ja(p):ja(p).toArray()}}}async function fH({log:e=!1}={}){let t=Wk(),n=await Xk(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new qk:new Vk,s=new Gk(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function Bl(e,t,{source:n,clients:r=n?new Set([n]):void 0}){let i=t!==void 0?Ku(e,hl(t)):null;return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function Pl(e,t,{source:n,clients:r=n?new Set([n]):void 0}){let i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Ku(e[l],hl(c)));return a.length>1?vr(a):a[0]});i=o.length>1?pl(o):o[0]}return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function $l(e,t,{source:n,clients:r=n?new Set([n]):void 0,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?We(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}function GT(e,t,{source:n,clients:r=n?new Set([n]):void 0,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?vr(e.map((l,u)=>We(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}var dH={contains:RS,prefix:LS,suffix:FS,regexp:DS};function WT(e,t,{source:n,clients:r=void 0,method:i="contains"}){let o=dH[i],s=t?o(e,hl(t)):null;return{meta:{type:"match",method:i},source:n,clients:r,value:t,predicate:s}}function XT(e){return typeof e?.getChild=="function"}function HT(){let e=new Set,t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}function Nr(e){return XT(e)?hH(e):pH(e)}function hH(e){let{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function pH(e){let t=e.length;if(typeof e[0]=="object"){let n=t?Object.keys(e[0]):[],r={};return n.length>0&&n.forEach(i=>{r[i]=e.map(o=>o[i])}),{numRows:t,columns:r}}else return{numRows:t,values:e}}var GR={};kr(GR,{Fixed:()=>Ro,Param:()=>Ga,Query:()=>pt,Selection:()=>bo,agg:()=>Vt,align:()=>N4,and:()=>vr,area:()=>y8,areaX:()=>g8,areaY:()=>x8,argmax:()=>tf,argmin:()=>Ju,arrayAgg:()=>yI,arrow:()=>fR,aspectRatio:()=>D4,avg:()=>kh,axis:()=>R4,axisFx:()=>yR,axisFy:()=>gR,axisX:()=>pR,axisY:()=>mR,barX:()=>v8,barY:()=>S8,bin:()=>Q2,cast:()=>Bh,castDouble:()=>ef,castInteger:()=>gI,cell:()=>I8,cellX:()=>T8,cellY:()=>E8,centroid:()=>$h,centroidX:()=>SI,centroidY:()=>II,circle:()=>L8,colorBase:()=>bD,colorClamp:()=>aD,colorConstant:()=>_D,colorDomain:()=>oD,colorExponent:()=>wD,colorInterpolate:()=>fD,colorLabel:()=>pD,colorLegend:()=>VR,colorN:()=>cD,colorNice:()=>lD,colorPercent:()=>mD,colorPivot:()=>dD,colorRange:()=>sD,colorReverse:()=>yD,colorScale:()=>iD,colorScheme:()=>uD,colorSymmetric:()=>hD,colorTickFormat:()=>xD,colorZero:()=>gD,column:()=>Va,contour:()=>Z8,coordinator:()=>di,corr:()=>iI,count:()=>Zn,covarPop:()=>sI,covariance:()=>oI,create:()=>Ya,cume_dist:()=>$S,dateDay:()=>vI,dateMonth:()=>wI,dateMonthDay:()=>_I,delaunayLink:()=>cR,delaunayMesh:()=>lR,denseLine:()=>Q8,dense_rank:()=>BS,density:()=>H8,densityX:()=>W8,densityY:()=>X8,dot:()=>N8,dotX:()=>D8,dotY:()=>R8,entropy:()=>eI,eq:()=>AS,errorbarX:()=>iR,errorbarY:()=>oR,facetGrid:()=>iN,facetLabel:()=>oN,facetMargin:()=>JO,facetMarginBottom:()=>eN,facetMarginLeft:()=>nN,facetMarginRight:()=>rN,facetMarginTop:()=>tN,first:()=>hI,first_value:()=>VS,frame:()=>hR,from:()=>BV,fxAlign:()=>dN,fxAriaDescription:()=>NN,fxAriaLabel:()=>ON,fxAxis:()=>yN,fxDomain:()=>sN,fxFontVariant:()=>MN,fxGrid:()=>SN,fxInset:()=>cN,fxInsetLeft:()=>lN,fxInsetRight:()=>uN,fxLabel:()=>TN,fxLabelAnchor:()=>EN,fxLabelOffset:()=>AN,fxLine:()=>IN,fxPadding:()=>hN,fxPaddingInner:()=>pN,fxPaddingOuter:()=>mN,fxRange:()=>aN,fxReverse:()=>DN,fxRound:()=>fN,fxTickFormat:()=>_N,fxTickPadding:()=>wN,fxTickRotate:()=>vN,fxTickSize:()=>xN,fxTickSpacing:()=>bN,fxTicks:()=>gN,fyAlign:()=>PN,fyAriaDescription:()=>nD,fyAriaLabel:()=>eD,fyAxis:()=>jN,fyDomain:()=>RN,fyFontVariant:()=>tD,fyGrid:()=>HN,fyInset:()=>FN,fyInsetBottom:()=>CN,fyInsetTop:()=>kN,fyLabel:()=>ZN,fyLabelAnchor:()=>KN,fyLabelOffset:()=>JN,fyLine:()=>QN,fyPadding:()=>$N,fyPaddingInner:()=>UN,fyPaddingOuter:()=>zN,fyRange:()=>LN,fyReverse:()=>rD,fyRound:()=>BN,fyTickFormat:()=>WN,fyTickPadding:()=>GN,fyTickRotate:()=>XN,fyTickSize:()=>qN,fyTickSpacing:()=>YN,fyTicks:()=>VN,geo:()=>vR,geojson:()=>Ph,graticule:()=>IR,grid:()=>F4,gridFx:()=>wR,gridFy:()=>_R,gridX:()=>xR,gridY:()=>bR,gt:()=>Lh,gte:()=>MS,hconcat:()=>NV,heatmap:()=>K8,height:()=>T4,hexagon:()=>F8,hexbin:()=>eR,hexgrid:()=>nR,highlight:()=>TR,hspace:()=>LV,hull:()=>uR,image:()=>G8,inset:()=>L4,intervalX:()=>LR,intervalXY:()=>kR,intervalY:()=>FR,isBetween:()=>We,isDistinct:()=>OS,isNotBetween:()=>NS,isNotDistinct:()=>Ku,isNotNull:()=>Is,isNull:()=>ml,kurtosis:()=>tI,label:()=>k4,lag:()=>zS,last:()=>pI,last_value:()=>qS,lead:()=>jS,lengthBase:()=>n8,lengthClamp:()=>KD,lengthConstant:()=>i8,lengthDomain:()=>QD,lengthExponent:()=>r8,lengthNice:()=>JD,lengthPercent:()=>t8,lengthRange:()=>ZD,lengthScale:()=>HD,lengthZero:()=>e8,line:()=>b8,lineX:()=>w8,lineY:()=>_8,link:()=>dR,literal:()=>hl,loadCSV:()=>MI,loadExtension:()=>EI,loadJSON:()=>OI,loadObjects:()=>RI,loadParquet:()=>NI,loadSpatial:()=>DI,lt:()=>Ts,lte:()=>Es,mad:()=>WS,margin:()=>_4,marginBottom:()=>O4,marginLeft:()=>E4,marginRight:()=>A4,marginTop:()=>M4,margins:()=>w4,max:()=>ui,median:()=>HS,menu:()=>IV,min:()=>fi,mode:()=>ZS,name:()=>x4,nearest:()=>NR,nearestX:()=>DR,nearestY:()=>RR,neq:()=>yl,not:()=>ES,nth_value:()=>YS,ntile:()=>US,opacityBase:()=>RD,opacityClamp:()=>TD,opacityConstant:()=>FD,opacityDomain:()=>SD,opacityExponent:()=>LD,opacityLabel:()=>AD,opacityLegend:()=>qR,opacityNice:()=>ED,opacityPercent:()=>MD,opacityRange:()=>ID,opacityReverse:()=>OD,opacityScale:()=>vD,opacityTickFormat:()=>DD,opacityZero:()=>ND,or:()=>pl,padding:()=>C4,pan:()=>CR,panX:()=>BR,panY:()=>PR,panZoom:()=>$R,panZoomX:()=>UR,panZoomY:()=>zR,percent_rank:()=>PS,plot:()=>zV,product:()=>XS,projectionClip:()=>m8,projectionDomain:()=>l8,projectionInset:()=>u8,projectionInsetBottom:()=>p8,projectionInsetLeft:()=>f8,projectionInsetRight:()=>d8,projectionInsetTop:()=>h8,projectionParallels:()=>s8,projectionPrecision:()=>a8,projectionRotate:()=>c8,projectionType:()=>o8,quantile:()=>QS,rBase:()=>GD,rClamp:()=>zD,rConstant:()=>XD,rDomain:()=>$D,rExponent:()=>WD,rLabel:()=>VD,rNice:()=>jD,rPercent:()=>qD,rRange:()=>UD,rScale:()=>PD,rZero:()=>YD,rank:()=>CS,raster:()=>J8,rasterTile:()=>tR,rect:()=>A8,rectX:()=>M8,rectY:()=>O8,regressionY:()=>rR,row_number:()=>kS,ruleX:()=>P8,ruleY:()=>$8,search:()=>TV,skewness:()=>JS,slider:()=>EV,sphere:()=>SR,spike:()=>Y8,sql:()=>q,stddev:()=>Ch,stddevPop:()=>rI,stringAgg:()=>mI,style:()=>S4,sum:()=>Pr,symbolDomain:()=>CD,symbolLegend:()=>YR,symbolRange:()=>BD,symbolScale:()=>kD,table:()=>AV,text:()=>k8,textX:()=>C8,textY:()=>B8,tickX:()=>U8,tickY:()=>z8,toggle:()=>ju,toggleColor:()=>OR,toggleX:()=>ER,toggleY:()=>AR,toggleZ:()=>MR,varPop:()=>nI,variance:()=>KS,vconcat:()=>OV,vector:()=>j8,vectorX:()=>V8,vectorY:()=>q8,voronoi:()=>sR,voronoiMesh:()=>aR,vspace:()=>RV,width:()=>I4,xAlign:()=>G4,xAriaDescription:()=>fO,xAriaLabel:()=>uO,xAxis:()=>Q4,xBase:()=>mO,xClamp:()=>q4,xConstant:()=>gO,xDomain:()=>P4,xExponent:()=>yO,xFontVariant:()=>lO,xGrid:()=>rO,xInset:()=>z4,xInsetLeft:()=>j4,xInsetRight:()=>V4,xLabel:()=>oO,xLabelAnchor:()=>sO,xLabelArrow:()=>aO,xLabelOffset:()=>cO,xLine:()=>iO,xNice:()=>U4,xPadding:()=>W4,xPaddingInner:()=>X4,xPaddingOuter:()=>H4,xPercent:()=>dO,xRange:()=>$4,xReverse:()=>hO,xRound:()=>Y4,xScale:()=>B4,xTickFormat:()=>eO,xTickPadding:()=>tO,xTickRotate:()=>nO,xTickSize:()=>K4,xTickSpacing:()=>J4,xTicks:()=>Z4,xZero:()=>pO,xyDomain:()=>v4,yAlign:()=>AO,yAriaDescription:()=>GO,yAriaLabel:()=>YO,yAxis:()=>DO,yBase:()=>QO,yClamp:()=>TO,yConstant:()=>KO,yDomain:()=>bO,yExponent:()=>ZO,yFontVariant:()=>qO,yGrid:()=>PO,yInset:()=>vO,yInsetBottom:()=>IO,yInsetTop:()=>SO,yLabel:()=>UO,yLabelAnchor:()=>zO,yLabelArrow:()=>jO,yLabelOffset:()=>VO,yLine:()=>$O,yNice:()=>_O,yPadding:()=>MO,yPaddingInner:()=>OO,yPaddingOuter:()=>NO,yPercent:()=>WO,yRange:()=>wO,yReverse:()=>XO,yRound:()=>EO,yScale:()=>xO,yTickFormat:()=>CO,yTickPadding:()=>kO,yTickRotate:()=>BO,yTickSize:()=>LO,yTickSpacing:()=>FO,yTicks:()=>RO,yZero:()=>HO});var Ro=Symbol("Fixed"),Nn=Symbol("Transient"),Yp=Symbol("Transform");var t4={};kr(t4,{Area:()=>Du,Arrow:()=>a0,BarX:()=>Ru,BarY:()=>Lu,Cell:()=>Fu,Contour:()=>x0,Density:()=>_0,Dot:()=>ku,Frame:()=>t0,Geo:()=>v0,Hexgrid:()=>S0,Image:()=>I0,Line:()=>Cu,Link:()=>o0,Mark:()=>xt,Raster:()=>p0,Rect:()=>Nu,RuleX:()=>Yy,RuleY:()=>Gy,Text:()=>Au,TickX:()=>u0,TickY:()=>f0,Tip:()=>e0,Vector:()=>Ou,WaffleX:()=>E0,WaffleY:()=>A0,area:()=>i0,areaX:()=>Kc,areaY:()=>La,arrow:()=>WU,auto:()=>iz,autoSpec:()=>T6,axisFx:()=>Wv,axisFy:()=>Gv,axisX:()=>Xy,axisY:()=>Wy,barX:()=>fs,barY:()=>ds,bin:()=>Ra,binX:()=>ls,binY:()=>us,bollinger:()=>nl,bollingerX:()=>uz,bollingerY:()=>fz,boxX:()=>dz,boxY:()=>hz,cell:()=>Jc,cellX:()=>HU,cellY:()=>QU,centroid:()=>w2,circle:()=>JU,cluster:()=>fj,column:()=>wn,contour:()=>vz,crosshair:()=>Tz,crosshairX:()=>Ez,crosshairY:()=>Az,delaunayLink:()=>Nz,delaunayMesh:()=>Dz,density:()=>Cz,differenceX:()=>$z,differenceY:()=>Uz,dodgeX:()=>Dj,dodgeY:()=>Rj,dot:()=>Li,dotX:()=>ZU,dotY:()=>KU,filter:()=>o9,find:()=>p9,formatIsoDate:()=>Q3,formatMonth:()=>b$,formatNumber:()=>H3,formatWeekday:()=>w$,frame:()=>Qd,geo:()=>_2,geoCentroid:()=>jz,graticule:()=>qz,gridFx:()=>Zv,gridFy:()=>Hv,gridX:()=>Qv,gridY:()=>Xv,group:()=>By,groupX:()=>Bc,groupY:()=>Pc,groupZ:()=>Cy,hexagon:()=>tz,hexbin:()=>Yz,hexgrid:()=>Gz,hull:()=>Rz,identity:()=>X,image:()=>Xz,indexOf:()=>ye,initializer:()=>xe,interpolateNearest:()=>y0,interpolateNone:()=>b2,interpolatorBarycentric:()=>m0,interpolatorRandomWalk:()=>g0,legend:()=>mU,line:()=>Bu,lineX:()=>tl,lineY:()=>el,linearRegressionX:()=>Zz,linearRegressionY:()=>Kz,link:()=>u2,map:()=>Lr,mapX:()=>nh,mapY:()=>rh,marks:()=>on,normalize:()=>N2,normalizeX:()=>Cj,normalizeY:()=>Bj,numberInterval:()=>h3,plot:()=>Zd,pointer:()=>qc,pointerX:()=>Yc,pointerY:()=>Na,raster:()=>xz,rect:()=>Jy,rectX:()=>Xd,rectY:()=>Hd,reverse:()=>s9,ruleX:()=>ii,ruleY:()=>oi,scale:()=>$c,select:()=>zj,selectFirst:()=>N0,selectLast:()=>D0,selectMaxX:()=>F2,selectMaxY:()=>k2,selectMinX:()=>R2,selectMinY:()=>L2,shiftX:()=>Pj,shiftY:()=>$j,shuffle:()=>a9,sort:()=>pv,sphere:()=>Vz,spike:()=>H$,stackX:()=>p6,stackX1:()=>_U,stackX2:()=>vU,stackY:()=>m6,stackY1:()=>SU,stackY2:()=>IU,text:()=>cs,textX:()=>$v,textY:()=>Uv,tickX:()=>y2,tickY:()=>g2,timeInterval:()=>Ny,tip:()=>i2,transform:()=>rn,tree:()=>Y6,treeLink:()=>E2,treeNode:()=>T0,utcInterval:()=>gu,valueof:()=>gt,vector:()=>f6,vectorX:()=>Vv,vectorY:()=>qv,voronoi:()=>Lz,voronoiMesh:()=>Fz,waffleX:()=>gj,waffleY:()=>xj,window:()=>ih,windowX:()=>oz,windowY:()=>sz});function Nt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function rr(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function eo(e){let t,n,r;e.length!==2?(t=Nt,n=(a,c)=>Nt(e(a),c),r=(a,c)=>e(a)-c):(t=e===Nt||e===rr?e:mH,n=e,r=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function mH(){return 0}function Gp(e){return e===null?NaN:+e}function*Qk(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Zk=eo(Nt),Kk=Zk.right,yH=Zk.left,gH=eo(Gp).center,Qs=Kk;var Wp=Jk(t5),QT=Jk(xH);function Jk(e){return function(t,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;let a=n&&e(n),c=r&&e(r),l=i.slice();return a&&c?(Of(a,l,i,o,s),Of(a,i,l,o,s),Of(a,l,i,o,s),Nf(c,i,l,o,s),Nf(c,l,i,o,s),Nf(c,i,l,o,s)):a?(Of(a,i,l,o,s),Of(a,l,i,o,s),Of(a,i,l,o,s)):c&&(Nf(c,i,l,o,s),Nf(c,l,i,o,s),Nf(c,i,l,o,s)),t}}function Of(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Nf(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function xH(e){let t=t5(e);return(n,r,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(n,r,i+0,o+0,s),t(n,r,i+1,o+1,s),t(n,r,i+2,o+2,s),t(n,r,i+3,o+3,s)}}function t5(e){let t=Math.floor(e);if(t===e)return bH(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+n*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/r,l-=o[Math.max(s,d-u)]}}function bH(e){let t=2*e+1;return(n,r,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*r[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=r[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=r[Math.min(o,l+c)],n[l]=a/t,a-=r[Math.max(i,l-c)]}}function Lo(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function wH(e){return e.length|0}function _H(e){return!(e>0)}function vH(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function SH(e){return t=>e(...t)}function Xb(...e){let t=typeof e[e.length-1]=="function"&&SH(e.pop());e=e.map(vH);let n=e.map(wH),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(_H))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function Hb(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function fc(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function wi(e,t){let n=fc(e,t);return n&&Math.sqrt(n)}function ne(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var Dn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,r=0;for(let i=0;i<this._n&&i<32;i++){let o=n[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){let t=this._partials,n=this._n,r,i,o,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}};var ir=class extends Map{constructor(t,n=r5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(ZT(this,t))}has(t){return super.has(ZT(this,t))}set(t,n){return super.set(e5(this,t),n)}delete(t){return super.delete(n5(this,t))}},or=class extends Set{constructor(t,n=r5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let r of t)this.add(r)}has(t){return super.has(ZT(this,t))}add(t){return super.add(e5(this,t))}delete(t){return super.delete(n5(this,t))}};function ZT({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function e5({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function n5({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function r5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Xp(e){return e}function Rn(e,...t){return JT(e,Xp,Xp,t)}function no(e,t,...n){return JT(e,Xp,t,n)}function KT(e,t,...n){return JT(e,Array.from,t,n)}function JT(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new ir,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function tE(e,t){return Array.from(t,n=>e[n])}function Zs(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=Ul(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Ul(n[i],n[o]))),tE(e,r)}return e.sort(Hp(n))}function Hp(e=Nt){if(e===Nt)return Ul;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Ul(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Df(e,t,n){return(t.length!==2?Zs(no(e,t,n),([r,i],[o,s])=>Nt(i,s)||Nt(r,o)):Zs(Rn(e,n),([r,i],[o,s])=>t(i,s)||Nt(r,o))).map(([r])=>r)}var IH=Math.sqrt(50),TH=Math.sqrt(10),EH=Math.sqrt(2);function Qb(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=IH?10:o>=TH?5:o>=EH?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=n&&n<2?Qb(e,t,n*2):[a,c,l]}function Ln(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,o,s]=r?Qb(t,e,n):Qb(e,t,n);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function Ks(e,t,n){return t=+t,e=+e,n=+n,Qb(e,t,n)[2]}function Rf(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Ks(t,e,n):Ks(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Lf(e,t,n){let r;for(;;){let i=Ks(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function dc(e){return Math.max(1,Math.ceil(Math.log(Lo(e))/Math.LN2)+1)}function Qt(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function Zb(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);return r}function ue(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Kb(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);return r}function Jb(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Ul:Hp(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/c+d)),p=Math.min(r,Math.floor(t+(c-l)*f/c+d));Jb(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Qp(e,n,t),i(e[r],o)>0&&Qp(e,n,r);s<a;){for(Qp(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Qp(e,n,a):(++a,Qp(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Qp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function zl(e,t=Nt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Nt(s,i)>0:Nt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function sr(e,t,n){if(e=Float64Array.from(Qk(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ue(e);if(t>=1)return Qt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Qt(Jb(e,o).subarray(0,o+1)),a=ue(e.subarray(o+1));return s+(a-s)*(i-o)}}function eE(e,t,n=Gp){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function t1(e,t,n){let r=Lo(e),i=sr(e,.75)-sr(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Zp(e,t,n){let r=Lo(e),i=wi(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Js(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function ro(e,t){return sr(e,.5,t)}function*MH(e){for(let t of e)yield*t}function Ff(e){return Array.from(MH(e))}function kf(e,t){let n=new ir;if(t===void 0)for(let o of e)o!=null&&o>=o&&n.set(o,(n.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,i=0;for(let[o,s]of n)s>i&&(i=s,r=o);return r}function e1(e,t=OH){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function OH(e,t){return[e,t]}function qe(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function Kp(e,t=Nt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=Nt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Nt?(a,c)=>Ul(n[a],n[c]):Hp(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),r[a]=s):r[a]=NaN}),r}function n1(e,t=Nt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Nt(s,i)<0:Nt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function Fn(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function hc(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function i5(e){return e}var nE=1,rE=2,iE=3,r1=4,o5=1e-6;function NH(e){return"translate("+e+",0)"}function DH(e){return"translate(0,"+e+")"}function RH(e){return t=>+e(t)}function LH(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function FH(){return!this.__axis}function kH(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===nE||e===r1?-1:1,u=e===r1||e===rE?"x":"y",f=e===nE||e===iE?NH:DH;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):i5),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,w=(t.bandwidth?LH:RH)(t.copy(),c),v=h.selection?h.selection():h,_=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),A=T.exit(),E=T.enter().append("g").attr("class","tick"),O=T.select("line"),I=T.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),O=O.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),I=I.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===nE?"0em":e===iE?"0.71em":"0.32em")),h!==v&&(_=_.transition(h),T=T.transition(h),O=O.transition(h),I=I.transition(h),A=A.transition(h).attr("opacity",o5).attr("transform",function(D){return isFinite(D=w(D))?f(D+c):this.getAttribute("transform")}),E.attr("opacity",o5).attr("transform",function(D){var k=this.parentNode.__axis;return f((k&&isFinite(k=k(D))?k:w(D))+c)})),A.remove(),_.attr("d",e===r1||e===rE?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),T.attr("opacity",1).attr("transform",function(D){return f(w(D)+c)}),O.attr(u+"2",l*o),I.attr(u,l*y).text(m),v.filter(FH).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===rE?"start":e===r1?"end":"middle"),v.each(function(){this.__axis=w})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(n=h==null?[]:Array.from(h),d):n.slice()},d.tickValues=function(h){return arguments.length?(r=h==null?null:Array.from(h),d):r&&r.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function oE(e){return kH(iE,e)}var CH={value:()=>{}};function a5(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new i1(n)}function i1(e){this._=e}function BH(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}i1.prototype=a5.prototype={constructor:i1,on:function(e,t){var n=this._,r=BH(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=PH(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=s5(n[i],e.name,t);else if(t==null)for(i in n)n[i]=s5(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new i1(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function PH(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function s5(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=CH,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var jl=a5;var o1="http://www.w3.org/1999/xhtml",ar={svg:"http://www.w3.org/2000/svg",xhtml:o1,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ta(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ar.hasOwnProperty(t)?{space:ar[t],local:e}:e}function $H(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===o1&&t.documentElement.namespaceURI===o1?t.createElement(e):t.createElementNS(n,e)}}function UH(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ea(e){var t=ta(e);return(t.local?UH:$H)(t)}function zH(){}function Vl(e){return e==null?zH:function(){return this.querySelector(e)}}function c5(e){typeof e!="function"&&(e=Vl(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Ue(r,this._parents)}function sE(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function jH(){return[]}function Jp(e){return e==null?jH:function(){return this.querySelectorAll(e)}}function VH(e){return function(){return sE(e.apply(this,arguments))}}function l5(e){typeof e=="function"?e=VH(e):e=Jp(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),i.push(c));return new Ue(r,i)}function tm(e){return function(){return this.matches(e)}}function s1(e){return function(t){return t.matches(e)}}var qH=Array.prototype.find;function YH(e){return function(){return qH.call(this.children,e)}}function GH(){return this.firstElementChild}function u5(e){return this.select(e==null?GH:YH(typeof e=="function"?e:s1(e)))}var WH=Array.prototype.filter;function XH(){return Array.from(this.children)}function HH(e){return function(){return WH.call(this.children,e)}}function f5(e){return this.selectAll(e==null?XH:HH(typeof e=="function"?e:s1(e)))}function d5(e){typeof e!="function"&&(e=tm(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Ue(r,this._parents)}function a1(e){return new Array(e.length)}function h5(){return new Ue(this._enter||this._groups.map(a1),this._parents)}function em(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}em.prototype={constructor:em,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function p5(e){return function(){return e}}function QH(e,t,n,r,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new em(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function ZH(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new em(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function KH(e){return e.__data__}function m5(e,t){if(!arguments.length)return Array.from(this,KH);var n=t?ZH:QH,r=this._parents,i=this._groups;typeof e!="function"&&(e=p5(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],d=f.length,h=JH(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(d);n(u,f,m,y,g,h,t);for(var x=0,b=0,w,v;x<p;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(v=y[b])&&++b<p;);w._next=v||null}}return s=new Ue(s,r),s._enter=a,s._exit=c,s}function JH(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function y5(){return new Ue(this._exit||this._groups.map(a1),this._parents)}function g5(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function x5(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new Ue(a,this._parents)}function b5(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function w5(e){e||(e=tQ);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Ue(i,this._parents).order()}function tQ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function _5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function v5(){return Array.from(this)}function S5(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function I5(){let e=0;for(let t of this)++e;return e}function T5(){return!this.node()}function E5(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function eQ(e){return function(){this.removeAttribute(e)}}function nQ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rQ(e,t){return function(){this.setAttribute(e,t)}}function iQ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function oQ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sQ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function A5(e,t){var n=ta(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?nQ:eQ:typeof t=="function"?n.local?sQ:oQ:n.local?iQ:rQ)(n,t))}function c1(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function aQ(e){return function(){this.style.removeProperty(e)}}function cQ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function lQ(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function M5(e,t,n){return arguments.length>1?this.each((t==null?aQ:typeof t=="function"?lQ:cQ)(e,t,n??"")):pc(this.node(),e)}function pc(e,t){return e.style.getPropertyValue(t)||c1(e).getComputedStyle(e,null).getPropertyValue(t)}function uQ(e){return function(){delete this[e]}}function fQ(e,t){return function(){this[e]=t}}function dQ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function O5(e,t){return arguments.length>1?this.each((t==null?uQ:typeof t=="function"?dQ:fQ)(e,t)):this.node()[e]}function N5(e){return e.trim().split(/^|\s+/)}function aE(e){return e.classList||new D5(e)}function D5(e){this._node=e,this._names=N5(e.getAttribute("class")||"")}D5.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function R5(e,t){for(var n=aE(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function L5(e,t){for(var n=aE(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function hQ(e){return function(){R5(this,e)}}function pQ(e){return function(){L5(this,e)}}function mQ(e,t){return function(){(t.apply(this,arguments)?R5:L5)(this,e)}}function F5(e,t){var n=N5(e+"");if(arguments.length<2){for(var r=aE(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?mQ:t?hQ:pQ)(n,t))}function yQ(){this.textContent=""}function gQ(e){return function(){this.textContent=e}}function xQ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function k5(e){return arguments.length?this.each(e==null?yQ:(typeof e=="function"?xQ:gQ)(e)):this.node().textContent}function bQ(){this.innerHTML=""}function wQ(e){return function(){this.innerHTML=e}}function _Q(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function C5(e){return arguments.length?this.each(e==null?bQ:(typeof e=="function"?_Q:wQ)(e)):this.node().innerHTML}function vQ(){this.nextSibling&&this.parentNode.appendChild(this)}function B5(){return this.each(vQ)}function SQ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function P5(){return this.each(SQ)}function $5(e){var t=typeof e=="function"?e:ea(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function IQ(){return null}function U5(e,t){var n=typeof e=="function"?e:ea(e),r=t==null?IQ:typeof t=="function"?t:Vl(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function TQ(){var e=this.parentNode;e&&e.removeChild(this)}function z5(){return this.each(TQ)}function EQ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function AQ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function j5(e){return this.select(e?AQ:EQ)}function V5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function MQ(e){return function(t){e.call(this,t,this.__data__)}}function OQ(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function NQ(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function DQ(e,t,n){return function(){var r=this.__on,i,o=MQ(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function q5(e,t,n){var r=OQ(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?DQ:NQ,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function Y5(e,t,n){var r=c1(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function RQ(e,t){return function(){return Y5(this,e,t)}}function LQ(e,t){return function(){return Y5(this,e,t.apply(this,arguments))}}function G5(e,t){return this.each((typeof t=="function"?LQ:RQ)(e,t))}function*W5(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var cE=[null];function Ue(e,t){this._groups=e,this._parents=t}function X5(){return new Ue([[document.documentElement]],cE)}function FQ(){return this}Ue.prototype=X5.prototype={constructor:Ue,select:c5,selectAll:l5,selectChild:u5,selectChildren:f5,filter:d5,data:m5,enter:h5,exit:y5,join:g5,merge:x5,selection:FQ,order:b5,sort:w5,call:_5,nodes:v5,node:S5,size:I5,empty:T5,each:E5,attr:A5,style:M5,property:O5,classed:F5,text:k5,html:C5,raise:B5,lower:P5,append:$5,insert:U5,remove:z5,clone:j5,datum:V5,on:q5,dispatch:G5,[Symbol.iterator]:W5};var na=X5;function jt(e){return typeof e=="string"?new Ue([[document.querySelector(e)]],[document.documentElement]):new Ue([[e]],cE)}function H5(e){let t;for(;t=e.sourceEvent;)e=t;return e}function zn(e,t){if(e=H5(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var l1={capture:!0,passive:!1};function u1(e){e.preventDefault(),e.stopImmediatePropagation()}function nm(e){var t=e.document.documentElement,n=jt(e).on("dragstart.drag",u1,l1);"onselectstart"in t?n.on("selectstart.drag",u1,l1):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function rm(e,t){var n=e.document.documentElement,r=jt(e).on("dragstart.drag",null);t&&(r.on("click.drag",u1,l1),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function ra(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mc(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ko(){}var yc=.7,Gl=1/yc,Cf="\\s*([+-]?\\d+)\\s*",im="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Fo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kQ=/^#([0-9a-f]{3,8})$/,CQ=new RegExp(`^rgb\\(${Cf},${Cf},${Cf}\\)$`),BQ=new RegExp(`^rgb\\(${Fo},${Fo},${Fo}\\)$`),PQ=new RegExp(`^rgba\\(${Cf},${Cf},${Cf},${im}\\)$`),$Q=new RegExp(`^rgba\\(${Fo},${Fo},${Fo},${im}\\)$`),UQ=new RegExp(`^hsl\\(${im},${Fo},${Fo}\\)$`),zQ=new RegExp(`^hsla\\(${im},${Fo},${Fo},${im}\\)$`),Q5={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ra(ko,Xr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Z5,formatHex:Z5,formatHex8:jQ,formatHsl:VQ,formatRgb:K5,toString:K5});function Z5(){return this.rgb().formatHex()}function jQ(){return this.rgb().formatHex8()}function VQ(){return iC(this).formatHsl()}function K5(){return this.rgb().formatRgb()}function Xr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kQ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?J5(t):n===3?new Qe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?f1(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?f1(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=CQ.exec(e))?new Qe(t[1],t[2],t[3],1):(t=BQ.exec(e))?new Qe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=PQ.exec(e))?f1(t[1],t[2],t[3],t[4]):(t=$Q.exec(e))?f1(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=UQ.exec(e))?nC(t[1],t[2]/100,t[3]/100,1):(t=zQ.exec(e))?nC(t[1],t[2]/100,t[3]/100,t[4]):Q5.hasOwnProperty(e)?J5(Q5[e]):e==="transparent"?new Qe(NaN,NaN,NaN,0):null}function J5(e){return new Qe(e>>16&255,e>>8&255,e&255,1)}function f1(e,t,n,r){return r<=0&&(e=t=n=NaN),new Qe(e,t,n,r)}function om(e){return e instanceof ko||(e=Xr(e)),e?(e=e.rgb(),new Qe(e.r,e.g,e.b,e.opacity)):new Qe}function cn(e,t,n,r){return arguments.length===1?om(e):new Qe(e,t,n,r??1)}function Qe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ra(Qe,cn,mc(ko,{brighter(e){return e=e==null?Gl:Math.pow(Gl,e),new Qe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yc:Math.pow(yc,e),new Qe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qe(Yl(this.r),Yl(this.g),Yl(this.b),h1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tC,formatHex:tC,formatHex8:qQ,formatRgb:eC,toString:eC}));function tC(){return`#${ql(this.r)}${ql(this.g)}${ql(this.b)}`}function qQ(){return`#${ql(this.r)}${ql(this.g)}${ql(this.b)}${ql((isNaN(this.opacity)?1:this.opacity)*255)}`}function eC(){let e=h1(this.opacity);return`${e===1?"rgb(":"rgba("}${Yl(this.r)}, ${Yl(this.g)}, ${Yl(this.b)}${e===1?")":`, ${e})`}`}function h1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Yl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ql(e){return e=Yl(e),(e<16?"0":"")+e.toString(16)}function nC(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new io(e,t,n,r)}function iC(e){if(e instanceof io)return new io(e.h,e.s,e.l,e.opacity);if(e instanceof ko||(e=Xr(e)),!e)return new io;if(e instanceof io)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new io(s,a,c,e.opacity)}function sm(e,t,n,r){return arguments.length===1?iC(e):new io(e,t,n,r??1)}function io(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ra(io,sm,mc(ko,{brighter(e){return e=e==null?Gl:Math.pow(Gl,e),new io(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yc:Math.pow(yc,e),new io(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Qe(lE(e>=240?e-240:e+120,i,r),lE(e,i,r),lE(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new io(rC(this.h),d1(this.s),d1(this.l),h1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=h1(this.opacity);return`${e===1?"hsl(":"hsla("}${rC(this.h)}, ${d1(this.s)*100}%, ${d1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rC(e){return e=(e||0)%360,e<0?e+360:e}function d1(e){return Math.max(0,Math.min(1,e||0))}function lE(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var p1=Math.PI/180,m1=180/Math.PI;var y1=18,oC=.96422,sC=1,aC=.82521,cC=4/29,Bf=6/29,lC=3*Bf*Bf,YQ=Bf*Bf*Bf;function uC(e){if(e instanceof Co)return new Co(e.l,e.a,e.b,e.opacity);if(e instanceof ia)return fC(e);e instanceof Qe||(e=om(e));var t=hE(e.r),n=hE(e.g),r=hE(e.b),i=uE((.2225045*t+.7168786*n+.0606169*r)/sC),o,s;return t===n&&n===r?o=s=i:(o=uE((.4360747*t+.3850649*n+.1430804*r)/oC),s=uE((.0139322*t+.0971045*n+.7141733*r)/aC)),new Co(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Pf(e,t,n,r){return arguments.length===1?uC(e):new Co(e,t,n,r??1)}function Co(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}ra(Co,Pf,mc(ko,{brighter(e){return new Co(this.l+y1*(e??1),this.a,this.b,this.opacity)},darker(e){return new Co(this.l-y1*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=oC*fE(t),e=sC*fE(e),n=aC*fE(n),new Qe(dE(3.1338561*t-1.6168667*e-.4906146*n),dE(-.9787684*t+1.9161415*e+.033454*n),dE(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function uE(e){return e>YQ?Math.pow(e,1/3):e/lC+cC}function fE(e){return e>Bf?e*e*e:lC*(e-cC)}function dE(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function hE(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function GQ(e){if(e instanceof ia)return new ia(e.h,e.c,e.l,e.opacity);if(e instanceof Co||(e=uC(e)),e.a===0&&e.b===0)return new ia(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*m1;return new ia(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function am(e,t,n,r){return arguments.length===1?GQ(e):new ia(e,t,n,r??1)}function ia(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function fC(e){if(isNaN(e.h))return new Co(e.l,0,0,e.opacity);var t=e.h*p1;return new Co(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}ra(ia,am,mc(ko,{brighter(e){return new ia(this.h,this.c,this.l+y1*(e??1),this.opacity)},darker(e){return new ia(this.h,this.c,this.l-y1*(e??1),this.opacity)},rgb(){return fC(this).rgb()}}));var mC=-.14861,pE=1.78277,mE=-.29227,g1=-.90649,cm=1.97294,dC=cm*g1,hC=cm*pE,pC=pE*mE-g1*mC;function WQ(e){if(e instanceof Wl)return new Wl(e.h,e.s,e.l,e.opacity);e instanceof Qe||(e=om(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(pC*r+dC*t-hC*n)/(pC+dC-hC),o=r-i,s=(cm*(n-i)-mE*o)/g1,a=Math.sqrt(s*s+o*o)/(cm*i*(1-i)),c=a?Math.atan2(s,o)*m1-120:NaN;return new Wl(c<0?c+360:c,a,i,e.opacity)}function cr(e,t,n,r){return arguments.length===1?WQ(e):new Wl(e,t,n,r??1)}function Wl(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ra(Wl,cr,mc(ko,{brighter(e){return e=e==null?Gl:Math.pow(Gl,e),new Wl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yc:Math.pow(yc,e),new Wl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*p1,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Qe(255*(t+n*(mC*r+pE*i)),255*(t+n*(mE*r+g1*i)),255*(t+n*(cm*r)),this.opacity)}}));function yE(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}function yC(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r<t-1?e[r+2]:2*o-i;return yE((n-r/t)*t,s,i,o,a)}}function gC(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],o=e[r%t],s=e[(r+1)%t],a=e[(r+2)%t];return yE((n-r/t)*t,i,o,s,a)}}var $f=e=>()=>e;function xC(e,t){return function(n){return e+n*t}}function XQ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Uf(e,t){var n=t-e;return n?xC(e,n>180||n<-180?n-360*Math.round(n/360):n):$f(isNaN(e)?t:e)}function bC(e){return(e=+e)==1?Oe:function(t,n){return n-t?XQ(t,n,e):$f(isNaN(t)?n:t)}}function Oe(e,t){var n=t-e;return n?xC(e,n):$f(isNaN(e)?t:e)}var _i=function e(t){var n=bC(t);function r(i,o){var s=n((i=cn(i)).r,(o=cn(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Oe(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=e,r}(1);function wC(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),o=new Array(n),s,a;for(s=0;s<n;++s)a=cn(t[s]),r[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return r=e(r),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=r(c),a.g=i(c),a.b=o(c),a+""}}}var gE=wC(yC),HQ=wC(gC);function _C(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function vC(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function SC(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Hr(e[s],t[s]);for(;s<n;++s)o[s]=t[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function IC(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ee(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function TC(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Hr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var bE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xE=new RegExp(bE.source,"g");function QQ(e){return function(){return e}}function ZQ(e){return function(t){return e(t)+""}}function lm(e,t){var n=bE.lastIndex=xE.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=bE.exec(e))&&(i=xE.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Ee(r,i)})),n=xE.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?ZQ(c[0].x):QQ(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function Hr(e,t){var n=typeof t,r;return t==null||n==="boolean"?$f(t):(n==="number"?Ee:n==="string"?(r=Xr(t))?(t=r,_i):lm:t instanceof Xr?_i:t instanceof Date?IC:vC(t)?_C:Array.isArray(t)?SC:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?TC:Ee)(e,t)}function Xl(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var EC=180/Math.PI,x1={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wE(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*EC,skewX:Math.atan(c)*EC,scaleX:s,scaleY:a}}var b1;function AC(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?x1:wE(t.a,t.b,t.c,t.d,t.e,t.f)}function MC(e){return e==null?x1:(b1||(b1=document.createElementNS("http://www.w3.org/2000/svg","g")),b1.setAttribute("transform",e),(e=b1.transform.baseVal.consolidate())?(e=e.matrix,wE(e.a,e.b,e.c,e.d,e.e,e.f)):x1)}function OC(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,n);p.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Ee(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Ee(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,y;++p<m;)f[(y=d[p]).i]=y.x(h);return f.join("")}}}var _E=OC(AC,"px, ","px)","deg)"),vE=OC(MC,", ",")",")");var KQ=1e-12;function NC(e){return((e=Math.exp(e))+1/e)/2}function JQ(e){return((e=Math.exp(e))-1/e)/2}function tZ(e){return((e=Math.exp(2*e))-1)/(e+1)}var SE=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,y,g;if(m<KQ)g=Math.log(d/l)/t,y=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*g)]};else{var x=Math.sqrt(m),b=(d*d-l*l+r*m)/(2*l*n*x),w=(d*d-l*l-r*m)/(2*d*n*x),v=Math.log(Math.sqrt(b*b+1)-b),_=Math.log(Math.sqrt(w*w+1)-w);g=(_-v)/t,y=function(T){var A=T*g,E=NC(v),O=l/(n*x)*(E*tZ(t*A+v)-JQ(v));return[a+O*h,c+O*p,l*E/NC(t*A+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function DC(e){return function(t,n){var r=e((t=sm(t)).h,(n=sm(n)).h),i=Oe(t.s,n.s),o=Oe(t.l,n.l),s=Oe(t.opacity,n.opacity);return function(a){return t.h=r(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var IE=DC(Uf),eZ=DC(Oe);function w1(e,t){var n=Oe((e=Pf(e)).l,(t=Pf(t)).l),r=Oe(e.a,t.a),i=Oe(e.b,t.b),o=Oe(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=r(s),e.b=i(s),e.opacity=o(s),e+""}}function RC(e){return function(t,n){var r=e((t=am(t)).h,(n=am(n)).h),i=Oe(t.c,n.c),o=Oe(t.l,n.l),s=Oe(t.opacity,n.opacity);return function(a){return t.h=r(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var TE=RC(Uf),nZ=RC(Oe);function LC(e){return function t(n){n=+n;function r(i,o){var s=e((i=cr(i)).h,(o=cr(o)).h),a=Oe(i.s,o.s),c=Oe(i.l,o.l),l=Oe(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,n)),i.opacity=l(u),i+""}}return r.gamma=t,r}(1)}var rZ=LC(Uf),zf=LC(Oe);function Bo(e,t){t===void 0&&(t=e,e=Hr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function jn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var jf=0,fm=0,um=0,kC=1e3,_1,dm,v1=0,Hl=0,S1=0,hm=typeof performance=="object"&&performance.now?performance:Date,CC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mm(){return Hl||(CC(iZ),Hl=hm.now()+S1)}function iZ(){Hl=0}function pm(){this._call=this._time=this._next=null}pm.prototype=I1.prototype={constructor:pm,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?mm():+n)+(t==null?0:+t),!this._next&&dm!==this&&(dm?dm._next=this:_1=this,dm=this),this._call=e,this._time=n,EE()},stop:function(){this._call&&(this._call=null,this._time=1/0,EE())}};function I1(e,t,n){var r=new pm;return r.restart(e,t,n),r}function BC(){mm(),++jf;for(var e=_1,t;e;)(t=Hl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jf}function FC(){Hl=(v1=hm.now())+S1,jf=fm=0;try{BC()}finally{jf=0,sZ(),Hl=0}}function oZ(){var e=hm.now(),t=e-v1;t>kC&&(S1-=t,v1=e)}function sZ(){for(var e,t=_1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:_1=n);dm=e,EE(r)}function EE(e){if(!jf){fm&&(fm=clearTimeout(fm));var t=e-Hl;t>24?(e<1/0&&(fm=setTimeout(FC,e-hm.now()-S1)),um&&(um=clearInterval(um))):(um||(v1=hm.now(),um=setInterval(oZ,kC)),jf=1,CC(FC))}}function T1(e,t,n){var r=new pm;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var aZ=jl("start","end","cancel","interrupt"),cZ=[],UC=0,PC=1,A1=2,E1=3,$C=4,M1=5,ym=6;function gc(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;lZ(e,n,{name:t,index:r,group:i,on:aZ,tween:cZ,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:UC})}function gm(e,t){var n=ln(e,t);if(n.state>UC)throw new Error("too late; already scheduled");return n}function kn(e,t){var n=ln(e,t);if(n.state>E1)throw new Error("too late; already running");return n}function ln(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function lZ(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=I1(o,0,n.time);function o(l){n.state=PC,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==PC)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===E1)return T1(s);h.state===$C?(h.state=ym,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=ym,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(T1(function(){n.state===E1&&(n.state=$C,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=A1,n.on.call("start",e,e.__data__,n.index,n.group),n.state===A1){for(n.state=E1,i=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=M1,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===M1&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ym,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Po(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>A1&&r.state<M1,r.state=ym,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function zC(e){return this.each(function(){Po(this,e)})}function uZ(e,t){var n,r;return function(){var i=kn(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function fZ(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=kn(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function jC(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ln(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?uZ:fZ)(n,e,t))}function Vf(e,t,n){var r=e._id;return e.each(function(){var i=kn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ln(i,r).value[t]}}function O1(e,t){var n;return(typeof t=="number"?Ee:t instanceof Xr?_i:(n=Xr(t))?(t=n,_i):lm)(e,t)}function dZ(e){return function(){this.removeAttribute(e)}}function hZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pZ(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function mZ(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function yZ(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function gZ(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function VC(e,t){var n=ta(e),r=n==="transform"?vE:O1;return this.attrTween(e,typeof t=="function"?(n.local?gZ:yZ)(n,r,Vf(this,"attr."+e,t)):t==null?(n.local?hZ:dZ)(n):(n.local?mZ:pZ)(n,r,t))}function xZ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function bZ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function wZ(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&bZ(e,o)),n}return i._value=t,i}function _Z(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&xZ(e,o)),n}return i._value=t,i}function qC(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=ta(e);return this.tween(n,(r.local?wZ:_Z)(r,t))}function vZ(e,t){return function(){gm(this,e).delay=+t.apply(this,arguments)}}function SZ(e,t){return t=+t,function(){gm(this,e).delay=t}}function YC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vZ:SZ)(t,e)):ln(this.node(),t).delay}function IZ(e,t){return function(){kn(this,e).duration=+t.apply(this,arguments)}}function TZ(e,t){return t=+t,function(){kn(this,e).duration=t}}function GC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?IZ:TZ)(t,e)):ln(this.node(),t).duration}function EZ(e,t){if(typeof t!="function")throw new Error;return function(){kn(this,e).ease=t}}function WC(e){var t=this._id;return arguments.length?this.each(EZ(t,e)):ln(this.node(),t).ease}function AZ(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;kn(this,e).ease=n}}function XC(e){if(typeof e!="function")throw new Error;return this.each(AZ(this._id,e))}function HC(e){typeof e!="function"&&(e=tm(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new lr(r,this._parents,this._name,this._id)}function QC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<r;++a)s[a]=t[a];return new lr(s,this._parents,this._name,this._id)}function MZ(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function OZ(e,t,n){var r,i,o=MZ(t)?gm:kn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function ZC(e,t){var n=this._id;return arguments.length<2?ln(this.node(),n).on.on(e):this.each(OZ(n,e,t))}function NZ(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function KC(){return this.on("end.remove",NZ(this._id))}function JC(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vl(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,gc(l[d],t,n,d,l,ln(u,n)));return new lr(o,this._parents,t,n)}function tB(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jp(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=ln(u,n),m=0,y=d.length;m<y;++m)(h=d[m])&&gc(h,t,n,m,d,p);o.push(d),s.push(u)}return new lr(o,s,t,n)}var DZ=na.prototype.constructor;function eB(){return new DZ(this._groups,this._parents)}function RZ(e,t){var n,r,i;return function(){var o=pc(this,e),s=(this.style.removeProperty(e),pc(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function nB(e){return function(){this.style.removeProperty(e)}}function LZ(e,t,n){var r,i=n+"",o;return function(){var s=pc(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function FZ(e,t,n){var r,i,o;return function(){var s=pc(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),pc(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function kZ(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=kn(this,e),l=c.on,u=c.value[o]==null?a||(a=nB(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function rB(e,t,n){var r=(e+="")=="transform"?_E:O1;return t==null?this.styleTween(e,RZ(e,r)).on("end.style."+e,nB(e)):typeof t=="function"?this.styleTween(e,FZ(e,r,Vf(this,"style."+e,t))).each(kZ(this._id,e)):this.styleTween(e,LZ(e,r,t),n).on("end.style."+e,null)}function CZ(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function BZ(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&CZ(e,s,n)),r}return o._value=t,o}function iB(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,BZ(e,t,n??""))}function PZ(e){return function(){this.textContent=e}}function $Z(e){return function(){var t=e(this);this.textContent=t??""}}function oB(e){return this.tween("text",typeof e=="function"?$Z(Vf(this,"text",e)):PZ(e==null?"":e+""))}function UZ(e){return function(t){this.textContent=e.call(this,t)}}function zZ(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&UZ(i)),t}return r._value=e,r}function sB(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,zZ(e))}function aB(){for(var e=this._name,t=this._id,n=N1(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ln(c,t);gc(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new lr(r,this._parents,e,n)}function cB(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=kn(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var jZ=0;function lr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function lB(e){return na().transition(e)}function N1(){return++jZ}var oa=na.prototype;lr.prototype=lB.prototype={constructor:lr,select:JC,selectAll:tB,selectChild:oa.selectChild,selectChildren:oa.selectChildren,filter:HC,merge:QC,selection:eB,transition:aB,call:oa.call,nodes:oa.nodes,node:oa.node,size:oa.size,empty:oa.empty,each:oa.each,on:ZC,attr:VC,attrTween:qC,style:rB,styleTween:iB,text:oB,textTween:sB,remove:KC,tween:jC,delay:YC,duration:GC,ease:WC,easeVarying:XC,end:cB,[Symbol.iterator]:oa[Symbol.iterator]};function D1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var VZ={time:null,delay:0,duration:250,ease:D1};function qZ(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function uB(e){var t,n;e instanceof lr?(t=e._id,e=e._name):(t=N1(),(n=VZ).time=mm(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&gc(c,e,t,l,s,n||qZ(c,t));return new lr(r,this._parents,e,t)}na.prototype.interrupt=zC;na.prototype.transition=uB;var R1=e=>()=>e;function AE(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function fB(e){e.stopImmediatePropagation()}function L1(e){e.preventDefault(),e.stopImmediatePropagation()}var dB={name:"drag"},ME={name:"space"},qf={name:"handle"},Yf={name:"center"},{abs:hB,max:Vn,min:qn}=Math;function pB(e){return[+e[0],+e[1]]}function NE(e){return[pB(e[0]),pB(e[1])]}var F1={name:"x",handles:["w","e"].map(xm),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},k1={name:"y",handles:["n","s"].map(xm),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},YZ={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(xm),input:function(e){return e==null?null:NE(e)},output:function(e){return e}},sa={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},mB={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},yB={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},GZ={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},WZ={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function xm(e){return{type:e}}function XZ(e){return!e.ctrlKey&&!e.button}function HZ(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function QZ(){return navigator.maxTouchPoints||"ontouchstart"in this}function OE(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ZZ(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function DE(){return FE(F1)}function RE(){return FE(k1)}function LE(){return FE(YZ)}function FE(e){var t=HZ,n=XZ,r=QZ,i=!0,o=jl("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([xm("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",sa.overlay).merge(g).each(function(){var b=OE(this).extent;jt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),y.selectAll(".selection").data([xm("selection")]).enter().append("rect").attr("class","selection").attr("cursor",sa.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=y.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return sa[b.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,x){y.tween?y.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,v=u(b,arguments),_=w.selection,T=e.input(typeof g=="function"?g.apply(this,arguments):g,w.extent),A=Hr(_,T);function E(O){w.selection=O===1&&T===null?null:A(O),l.call(b),v.brush()}return _!==null&&T!==null?E:E(1)}):y.each(function(){var b=this,w=arguments,v=b.__brush,_=e.input(typeof g=="function"?g.apply(b,w):g,v.extent),T=u(b,w).beforestart();Po(b),v.selection=_===null?null:_,l.call(b),T.start(x).brush(x).end(x)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=jt(this),g=OE(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,x){var b=y.__brush.emitter;return b&&(!x||!b.clean)?b:new f(y,g,x)}function f(y,g,x){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,x){var b=jt(this.that).datum();o.call(y,this.that,new AE(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(y){if(a&&!y.touches||!n.apply(this,arguments))return;var g=this,x=y.target.__data__.type,b=(i&&y.metaKey?x="overlay":x)==="selection"?dB:i&&y.altKey?Yf:qf,w=e===k1?null:GZ[x],v=e===F1?null:WZ[x],_=OE(g),T=_.extent,A=_.selection,E=T[0][0],O,I,D=T[0][1],k,S,M=T[1][0],N,L,B=T[1][1],C,P,$=0,U=0,H,nt=w&&v&&i&&y.shiftKey,ot,at,G=Array.from(y.touches||[y],tt=>{let ce=tt.identifier;return tt=zn(tt,g),tt.point0=tt.slice(),tt.identifier=ce,tt});Po(g);var st=u(g,arguments,!0).beforestart();if(x==="overlay"){A&&(H=!0);let tt=[G[0],G[1]||G[0]];_.selection=A=[[O=e===k1?E:qn(tt[0][0],tt[1][0]),k=e===F1?D:qn(tt[0][1],tt[1][1])],[N=e===k1?M:Vn(tt[0][0],tt[1][0]),C=e===F1?B:Vn(tt[0][1],tt[1][1])]],G.length>1&&Ct(y)}else O=A[0][0],k=A[0][1],N=A[1][0],C=A[1][1];I=O,S=k,L=N,P=C;var V=jt(g).attr("pointer-events","none"),Q=V.selectAll(".overlay").attr("cursor",sa[x]);if(y.touches)st.moved=z,st.ended=ht;else{var rt=jt(y.view).on("mousemove.brush",z,!0).on("mouseup.brush",ht,!0);i&&rt.on("keydown.brush",Xt,!0).on("keyup.brush",Zt,!0),nm(y.view)}l.call(g),st.start(y,b.name);function z(tt){for(let ce of tt.changedTouches||[tt])for(let Fr of G)Fr.identifier===ce.identifier&&(Fr.cur=zn(ce,g));if(nt&&!ot&&!at&&G.length===1){let ce=G[0];hB(ce.cur[0]-ce[0])>hB(ce.cur[1]-ce[1])?at=!0:ot=!0}for(let ce of G)ce.cur&&(ce[0]=ce.cur[0],ce[1]=ce.cur[1]);H=!0,L1(tt),Ct(tt)}function Ct(tt){let ce=G[0],Fr=ce.point0;var ho;switch($=ce[0]-Fr[0],U=ce[1]-Fr[1],b){case ME:case dB:{w&&($=Vn(E-O,qn(M-N,$)),I=O+$,L=N+$),v&&(U=Vn(D-k,qn(B-C,U)),S=k+U,P=C+U);break}case qf:{G[1]?(w&&(I=Vn(E,qn(M,G[0][0])),L=Vn(E,qn(M,G[1][0])),w=1),v&&(S=Vn(D,qn(B,G[0][1])),P=Vn(D,qn(B,G[1][1])),v=1)):(w<0?($=Vn(E-O,qn(M-O,$)),I=O+$,L=N):w>0&&($=Vn(E-N,qn(M-N,$)),I=O,L=N+$),v<0?(U=Vn(D-k,qn(B-k,U)),S=k+U,P=C):v>0&&(U=Vn(D-C,qn(B-C,U)),S=k,P=C+U));break}case Yf:{w&&(I=Vn(E,qn(M,O-$*w)),L=Vn(E,qn(M,N+$*w))),v&&(S=Vn(D,qn(B,k-U*v)),P=Vn(D,qn(B,C+U*v)));break}}L<I&&(w*=-1,ho=O,O=N,N=ho,ho=I,I=L,L=ho,x in mB&&Q.attr("cursor",sa[x=mB[x]])),P<S&&(v*=-1,ho=k,k=C,C=ho,ho=S,S=P,P=ho,x in yB&&Q.attr("cursor",sa[x=yB[x]])),_.selection&&(A=_.selection),ot&&(I=A[0][0],L=A[1][0]),at&&(S=A[0][1],P=A[1][1]),(A[0][0]!==I||A[0][1]!==S||A[1][0]!==L||A[1][1]!==P)&&(_.selection=[[I,S],[L,P]],l.call(g),st.brush(tt,b.name))}function ht(tt){if(fB(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else rm(tt.view,H),rt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);V.attr("pointer-events","all"),Q.attr("cursor",sa.overlay),_.selection&&(A=_.selection),ZZ(A)&&(_.selection=null,l.call(g)),st.end(tt,b.name)}function Xt(tt){switch(tt.keyCode){case 16:{nt=w&&v;break}case 18:{b===qf&&(w&&(N=L-$*w,O=I+$*w),v&&(C=P-U*v,k=S+U*v),b=Yf,Ct(tt));break}case 32:{(b===qf||b===Yf)&&(w<0?N=L-$:w>0&&(O=I-$),v<0?C=P-U:v>0&&(k=S-U),b=ME,Q.attr("cursor",sa.selection),Ct(tt));break}default:return}L1(tt)}function Zt(tt){switch(tt.keyCode){case 16:{nt&&(ot=at=nt=!1,Ct(tt));break}case 18:{b===Yf&&(w<0?N=L:w>0&&(O=I),v<0?C=P:v>0&&(k=S),b=qf,Ct(tt));break}case 32:{b===ME&&(tt.altKey?(w&&(N=L-$*w,O=I+$*w),v&&(C=P-U*v,k=S+U*v),b=Yf):(w<0?N=L:w>0&&(O=I),v<0?C=P:v>0&&(k=S),b=qf),Q.attr("cursor",sa[x]),Ct(tt));break}default:return}L1(tt)}}function h(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=NE(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:R1(NE(y)),c):t},c.filter=function(y){return arguments.length?(n=typeof y=="function"?y:R1(!!y),c):n},c.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:R1(!!y),c):r},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var kE=Math.PI,CE=2*kE,Ql=1e-6,KZ=CE-Ql;function gB(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function JZ(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return gB;let n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}var xc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?gB:JZ(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>Ql)if(!(Math.abs(f*c-l*u)>Ql)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,y=h*h+p*p,g=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((kE-Math.acos((m+d-y)/(2*g*x)))/2),w=b/x,v=b/g;Math.abs(w-1)>Ql&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=n+v*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Ql||Math.abs(this._y1-u)>Ql)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%CE+CE),d>KZ?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>Ql&&this._append`A${r},${r},0,${+(d>=kE)},${f},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function xB(){return new xc}xB.prototype=xc.prototype;function ur(e=3){return new xc(+e)}var tK=Array.prototype,C1=tK.slice;function bB(e,t){return e-t}function wB(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}var $o=e=>()=>e;function _B(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=eK(e,t[n]))return i;return 0}function eK(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(nK(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function nK(e,t,n){var r;return rK(e,t,n)&&iK(e[r=+(e[0]===t[0])],n[r],t[r])}function rK(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function iK(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function vB(){}var aa=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function bc(){var e=1,t=1,n=dc,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(bB);else{let f=ne(l,oK);for(u=Ln(...Lf(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){r(p,l,f),wB(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(_B((g=d[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,y,g,x,b;for(p=m=-1,g=Zl(l[0],u),aa[g<<1].forEach(w);++p<e-1;)y=g,g=Zl(l[p+1],u),aa[y|g<<1].forEach(w);for(aa[g<<0].forEach(w);++m<t-1;){for(p=-1,g=Zl(l[m*e+e],u),x=Zl(l[m*e],u),aa[g<<1|x<<2].forEach(w);++p<e-1;)y=g,g=Zl(l[m*e+e+p+1],u),b=x,x=Zl(l[m*e+p+1],u),aa[y|g<<1|x<<2|b<<3].forEach(w);aa[g|x<<3].forEach(w)}for(p=-1,x=l[m*e]>=u,aa[x<<2].forEach(w);++p<e-1;)b=x,x=Zl(l[m*e+p+1],u),aa[x<<2|b<<3].forEach(w);aa[x<<3].forEach(w);function w(v){var _=[v[0][0]+p,v[0][1]+m],T=[v[1][0]+p,v[1][1]+m],A=a(_),E=a(T),O,I;(O=h[A])?(I=d[E])?(delete h[O.end],delete d[I.start],O===I?(O.ring.push(T),f(O.ring)):d[O.start]=h[I.end]={start:O.start,end:I.end,ring:O.ring.concat(I.ring)}):(delete h[O.end],O.ring.push(T),h[O.end=E]=O):(O=d[E])?(I=h[A])?(delete d[O.start],delete h[I.end],O===I?(O.ring.push(T),f(O.ring)):d[I.start]=h[O.end]={start:I.start,end:O.end,ring:I.ring.concat(O.ring)}):(delete d[O.start],O.ring.unshift(_),d[O.start=A]=O):d[A]=h[E]={start:A,end:E,ring:[_,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],m=h|0,y=p|0,g=BE(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=SB(h,BE(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=SB(p,BE(u[(y-1)*e+m]),g,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?$o(C1.call(l)):$o(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:vB,i):r===c},i}function oK(e){return isFinite(e)?e:NaN}function Zl(e,t){return e==null?!1:+e>=t}function BE(e){return e==null||isNaN(e=+e)?-1/0:e}function SB(e,t,n,r){let i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function sK(e){return e[0]}function aK(e){return e[1]}function cK(){return 1}function PE(){var e=sK,t=aK,n=cK,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=$o(20);function f(x){var b=new Float32Array(c*l),w=Math.pow(2,-s),v=-1;for(let k of x){var _=(e(k,++v,x)+a)*w,T=(t(k,v,x)+a)*w,A=+n(k,v,x);if(A&&_>=0&&_<c&&T>=0&&T<l){var E=Math.floor(_),O=Math.floor(T),I=_-E-.5,D=T-O-.5;b[E+O*c]+=(1-I)*(1-D)*A,b[E+1+O*c]+=I*(1-D)*A,b[E+1+(O+1)*c]+=I*D*A,b[E+(O+1)*c]+=(1-I)*D*A}}return Wp({data:b,width:c,height:l},o*w),b}function d(x){var b=f(x),w=u(b),v=Math.pow(2,2*s);return Array.isArray(w)||(w=Ln(Number.MIN_VALUE,Qt(b)/v,w)),bc().size([c,l]).thresholds(w.map(_=>_*v))(b).map((_,T)=>(_.value=+w[T],h(_)))}d.contours=function(x){var b=f(x),w=bc().size([c,l]),v=Math.pow(2,2*s),_=T=>{T=+T;var A=h(w.contour(b,T*v));return A.value=T,A};return Object.defineProperty(_,"max",{get:()=>Qt(b)/v}),_};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(y)}function y(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(x){return arguments.length?(e=typeof x=="function"?x:$o(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:$o(+x),d):t},d.weight=function(x){return arguments.length?(n=typeof x=="function"?x:$o(+x),d):n},d.size=function(x){if(!arguments.length)return[r,i];var b=+x[0],w=+x[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,i=w,g()},d.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),g()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?$o(C1.call(x)):$o(x),d):u},d.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,g()},d}var te=11102230246251565e-32,Ze=134217729,bm=(3+8*te)*te;function Kl(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++d]);let h=0;if(f<e&&d<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function wm(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function Y(e){return new Float64Array(e)}var lK=(3+16*te)*te,uK=(2+12*te)*te,fK=(9+64*te)*te*te,Gf=Y(4),IB=Y(8),TB=Y(12),EB=Y(16),fr=Y(4);function dK(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,y,g,x,b,w,v,_,T,A,E=e-i,O=n-i,I=t-o,D=r-o;w=E*D,d=Ze*E,h=d-(d-E),p=E-h,d=Ze*D,m=d-(d-D),y=D-m,v=p*y-(w-h*m-p*m-h*y),_=I*O,d=Ze*I,h=d-(d-I),p=I-h,d=Ze*O,m=d-(d-O),y=O-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,Gf[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,Gf[1]=b-(g+f)+(f-_),A=x+g,f=A-x,Gf[2]=x-(A-f)+(g-f),Gf[3]=A;let k=wm(4,Gf),S=uK*s;if(k>=S||-k>=S||(f=e-E,a=e-(E+f)+(f-i),f=n-O,l=n-(O+f)+(f-i),f=t-I,c=t-(I+f)+(f-o),f=r-D,u=r-(D+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=fK*s+bm*Math.abs(k),k+=E*u+D*a-(I*l+O*c),k>=S||-k>=S))return k;w=a*D,d=Ze*a,h=d-(d-a),p=a-h,d=Ze*D,m=d-(d-D),y=D-m,v=p*y-(w-h*m-p*m-h*y),_=c*O,d=Ze*c,h=d-(d-c),p=c-h,d=Ze*O,m=d-(d-O),y=O-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,fr[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,fr[1]=b-(g+f)+(f-_),A=x+g,f=A-x,fr[2]=x-(A-f)+(g-f),fr[3]=A;let M=Kl(4,Gf,4,fr,IB);w=E*u,d=Ze*E,h=d-(d-E),p=E-h,d=Ze*u,m=d-(d-u),y=u-m,v=p*y-(w-h*m-p*m-h*y),_=I*l,d=Ze*I,h=d-(d-I),p=I-h,d=Ze*l,m=d-(d-l),y=l-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,fr[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,fr[1]=b-(g+f)+(f-_),A=x+g,f=A-x,fr[2]=x-(A-f)+(g-f),fr[3]=A;let N=Kl(M,IB,4,fr,TB);w=a*u,d=Ze*a,h=d-(d-a),p=a-h,d=Ze*u,m=d-(d-u),y=u-m,v=p*y-(w-h*m-p*m-h*y),_=c*l,d=Ze*c,h=d-(d-c),p=c-h,d=Ze*l,m=d-(d-l),y=l-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,fr[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,fr[1]=b-(g+f)+(f-_),A=x+g,f=A-x,fr[2]=x-(A-f)+(g-f),fr[3]=A;let L=Kl(N,TB,4,fr,EB);return EB[L-1]}function Wf(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=lK*l?c:-dK(e,t,n,r,i,o,l)}var X6t=(7+56*te)*te,H6t=(3+28*te)*te,Q6t=(26+288*te)*te*te,Z6t=Y(4),K6t=Y(4),J6t=Y(4),t4t=Y(4),e4t=Y(4),n4t=Y(4),r4t=Y(4),i4t=Y(4),o4t=Y(4),s4t=Y(8),a4t=Y(8),c4t=Y(8),l4t=Y(4),u4t=Y(8),f4t=Y(8),d4t=Y(8),h4t=Y(12),p4t=Y(192),m4t=Y(192);var x4t=(10+96*te)*te,b4t=(4+48*te)*te,w4t=(44+576*te)*te*te,_4t=Y(4),v4t=Y(4),S4t=Y(4),I4t=Y(4),T4t=Y(4),E4t=Y(4),A4t=Y(4),M4t=Y(4),O4t=Y(8),N4t=Y(8),D4t=Y(8),R4t=Y(8),L4t=Y(8),F4t=Y(8),k4t=Y(8),C4t=Y(8),B4t=Y(8),P4t=Y(4),$4t=Y(4),U4t=Y(4),z4t=Y(8),j4t=Y(16),V4t=Y(16),q4t=Y(16),Y4t=Y(32),G4t=Y(32),W4t=Y(48),X4t=Y(64),H4t=Y(1152),Q4t=Y(1152);var tOt=(16+224*te)*te,eOt=(5+72*te)*te,nOt=(71+1408*te)*te*te,rOt=Y(4),iOt=Y(4),oOt=Y(4),sOt=Y(4),aOt=Y(4),cOt=Y(4),lOt=Y(4),uOt=Y(4),fOt=Y(4),dOt=Y(4),hOt=Y(24),pOt=Y(24),mOt=Y(24),yOt=Y(24),gOt=Y(24),xOt=Y(24),bOt=Y(24),wOt=Y(24),_Ot=Y(24),vOt=Y(24),SOt=Y(1152),IOt=Y(1152),TOt=Y(1152),EOt=Y(1152),AOt=Y(1152),MOt=Y(2304),OOt=Y(2304),NOt=Y(3456),DOt=Y(5760),ROt=Y(8),LOt=Y(8),FOt=Y(8),kOt=Y(16),COt=Y(24),BOt=Y(48),POt=Y(48),$Ot=Y(96),UOt=Y(192),zOt=Y(384),jOt=Y(384),VOt=Y(384),qOt=Y(768);var YOt=Y(96),GOt=Y(96),WOt=Y(96),XOt=Y(1152);var MB=Math.pow(2,-52),B1=new Uint32Array(512),Hf=class e{static from(t,n=xK,r=bK){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let E=0;E<s;E++){let O=t[2*E],I=t[2*E+1];O<a&&(a=O),I<c&&(c=I),O>l&&(l=O),I>u&&(u=I),this._ids[E]=E}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let E=0,O=1/0;E<s;E++){let I=$E(f,d,t[2*E],t[2*E+1]);I<O&&(h=E,O=I)}let y=t[2*h],g=t[2*h+1];for(let E=0,O=1/0;E<s;E++){if(E===h)continue;let I=$E(y,g,t[2*E],t[2*E+1]);I<O&&I>0&&(p=E,O=I)}let x=t[2*p],b=t[2*p+1],w=1/0;for(let E=0;E<s;E++){if(E===h||E===p)continue;let O=yK(y,g,x,b,t[2*E],t[2*E+1]);O<w&&(m=E,w=O)}let v=t[2*m],_=t[2*m+1];if(w===1/0){for(let I=0;I<s;I++)this._dists[I]=t[2*I]-t[0]||t[2*I+1]-t[1];Xf(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),O=0;for(let I=0,D=-1/0;I<s;I++){let k=this._ids[I],S=this._dists[k];S>D&&(E[O++]=k,D=S)}this.hull=E.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Wf(y,g,x,b,v,_)<0){let E=p,O=x,I=b;p=m,x=v,b=_,m=E,v=O,_=I}let T=gK(y,g,x,b,v,_);this._cx=T.x,this._cy=T.y;for(let E=0;E<s;E++)this._dists[E]=$E(t[2*E],t[2*E+1],T.x,T.y);Xf(this._ids,this._dists,0,s-1),this._hullStart=h;let A=3;r[h]=n[m]=p,r[p]=n[h]=m,r[m]=n[p]=h,i[h]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=h,o[this._hashKey(x,b)]=p,o[this._hashKey(v,_)]=m,this.trianglesLen=0,this._addTriangle(h,p,m,-1,-1,-1);for(let E=0,O,I;E<this._ids.length;E++){let D=this._ids[E],k=t[2*D],S=t[2*D+1];if(E>0&&Math.abs(k-O)<=MB&&Math.abs(S-I)<=MB||(O=k,I=S,D===h||D===p||D===m))continue;let M=0;for(let P=0,$=this._hashKey(k,S);P<this._hashSize&&(M=o[($+P)%this._hashSize],!(M!==-1&&M!==r[M]));P++);M=n[M];let N=M,L;for(;L=r[N],Wf(k,S,t[2*N],t[2*N+1],t[2*L],t[2*L+1])>=0;)if(N=L,N===M){N=-1;break}if(N===-1)continue;let B=this._addTriangle(N,D,r[N],-1,-1,i[N]);i[D]=this._legalize(B+2),i[N]=B,A++;let C=r[N];for(;L=r[C],Wf(k,S,t[2*C],t[2*C+1],t[2*L],t[2*L+1])<0;)B=this._addTriangle(C,D,L,i[D],-1,i[C]),i[D]=this._legalize(B+2),r[C]=C,A--,C=L;if(N===M)for(;L=n[N],Wf(k,S,t[2*L],t[2*L+1],t[2*N],t[2*N+1])<0;)B=this._addTriangle(L,D,N,-1,i[N],i[L]),this._legalize(B+2),i[L]=B,r[N]=N,A--,N=L;this._hullStart=n[D]=N,r[N]=n[C]=D,r[D]=C,o[this._hashKey(k,S)]=D,o[this._hashKey(t[2*N],t[2*N+1])]=N}this.hull=new Uint32Array(A);for(let E=0,O=this._hullStart;E<A;E++)this.hull[E]=O,O=r[O];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(pK(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:r,coords:i}=this,o=0,s=0;for(;;){let a=r[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=B1[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],m=n[f];if(mK(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=d;let g=r[f];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,g),this._link(a,r[s]),this._link(s,f);let x=l+(a+1)%3;o<B1.length&&(B1[o++]=x)}else{if(o===0)break;t=B1[--o]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function pK(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function $E(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function mK(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,y=d*d+h*h;return c*(f*y-m*h)-l*(u*y-m*d)+p*(u*h-f*d)<0}function yK(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function gK(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function Xf(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;_m(e,i,o),t[e[n]]>t[e[r]]&&_m(e,n,r),t[e[o]]>t[e[r]]&&_m(e,o,r),t[e[n]]>t[e[o]]&&_m(e,n,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;_m(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Xf(e,t,o,r),Xf(e,t,n,s-1)):(Xf(e,t,n,s-1),Xf(e,t,o,r))}}function _m(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function xK(e){return e[0]}function bK(e){return e[1]}var vi=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var wc=class{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}};var vm=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,y=0,g=r.length,x,b;m<g;m+=3,y+=2){let w=r[m]*2,v=r[m+1]*2,_=r[m+2]*2,T=t[w],A=t[w+1],E=t[v],O=t[v+1],I=t[_],D=t[_+1],k=E-T,S=O-A,M=I-T,N=D-A,L=(k*N-S*M)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let C of n)o+=t[C*2],s+=t[C*2+1];o/=n.length,s/=n.length}let B=1e9*Math.sign((o-T)*N-(s-A)*M);x=(T+I)/2-B*N,b=(A+D)/2+B*M}else{let B=1/L,C=k*k+S*S,P=M*M+N*N;x=T+(N*C-S*P)*B,b=A+(k*P-M*C)*B}a[y]=x,a[y+1]=b}let c=n[n.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new vi:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],y=s[h+1],g=s[p],x=s[p+1];this._renderSegment(m,y,g,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new vi:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new vi:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new wc;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,x,m,y]=p,f=d,d=this._edgecode(m,y),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,y):i=[m,y]}f=d,d=this._edgecode(g,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(g,x):i=[g,x]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var wK=2*Math.PI,Qf=Math.pow;function _K(e){return e[0]}function vK(e){return e[1]}function SK(e){let{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){let i=2*t[r],o=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function IK(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var Si=class e{static from(t,n=_K,r=vK,i){return new e("length"in t?TK(t,n,r,i):Float64Array.from(EK(t,n,r,i)))}constructor(t){this._delaunator=new Hf(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&SK(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=IK(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Hf(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new vm(this,t)}*neighbors(t){let{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=r[(i[t]+1)%r.length];f!==u&&(yield f);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;let i=r,o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=Qf(n-l[t*2],2)+Qf(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=Qf(n-l[p*2],2)+Qf(r-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&Qf(n-l[h*2],2)+Qf(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new vi:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new vi:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,wK)}return r&&r.value()}renderHull(t){let n=t==null?t=new vi:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new wc;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new vi:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new wc;return this.renderTriangle(t,n),n.value()}};function TK(e,t,n,r){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(r,a,s,e),o[s*2+1]=n.call(r,a,s,e)}return o}function*EK(e,t,n,r){let i=0;for(let o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}function OB(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Jl(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Uo(e){return e=Jl(Math.abs(e)),e?e[1]:NaN}function NB(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function DB(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var AK=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zo(e){if(!(t=AK.exec(e)))throw new Error("invalid format: "+e);var t;return new P1({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}zo.prototype=P1.prototype;function P1(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}P1.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function RB(e){t:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var UE;function LB(e,t){var n=Jl(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(UE=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Jl(e,Math.max(0,t+o-1))[0]}function zE(e,t){var n=Jl(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}var jE={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:OB,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>zE(e*100,t),r:zE,s:LB,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function VE(e){return e}var FB=Array.prototype.map,kB=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function CB(e){var t=e.grouping===void 0||e.thousands===void 0?VE:NB(FB.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?VE:DB(FB.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"\u2212":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(f){f=zo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,x=f.comma,b=f.precision,w=f.trim,v=f.type;v==="n"?(x=!0,v="g"):jE[v]||(b===void 0&&(b=12),w=!0,v="g"),(y||d==="0"&&h==="=")&&(y=!0,d="0",h="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=m==="$"?r:/[%p]/.test(v)?s:"",A=jE[v],E=/[defgprs%]/.test(v);b=b===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function O(I){var D=_,k=T,S,M,N;if(v==="c")k=A(I)+k,I="";else{I=+I;var L=I<0||1/I<0;if(I=isNaN(I)?c:A(Math.abs(I),b),w&&(I=RB(I)),L&&+I==0&&p!=="+"&&(L=!1),D=(L?p==="("?p:a:p==="-"||p==="("?"":p)+D,k=(v==="s"?kB[8+UE/3]:"")+k+(L&&p==="("?")":""),E){for(S=-1,M=I.length;++S<M;)if(N=I.charCodeAt(S),48>N||N>57){k=(N===46?i+I.slice(S+1):I.slice(S))+k,I=I.slice(0,S);break}}}x&&!y&&(I=t(I,1/0));var B=D.length+I.length+k.length,C=B<g?new Array(g-B+1).join(d):"";switch(x&&y&&(I=t(C+I,C.length?g-k.length:1/0),C=""),h){case"<":I=D+I+k+C;break;case"=":I=D+C+I+k;break;case"^":I=C.slice(0,B=C.length>>1)+D+I+k+C.slice(B);break;default:I=C+D+I+k;break}return o(I)}return O.toString=function(){return f+""},O}function u(f,d){var h=l((f=zo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Uo(d)/3)))*3,m=Math.pow(10,-p),y=kB[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var $1,Ii,U1;qE({thousands:",",grouping:[3],currency:["$",""]});function qE(e){return $1=CB(e),Ii=$1.format,U1=$1.formatPrefix,$1}function YE(e){return Math.max(0,-Uo(Math.abs(e)))}function GE(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Uo(t)/3)))*3-Uo(Math.abs(e)))}function WE(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Uo(t)-Uo(e))+1}var et=1e-6,tu=1e-12,Dt=Math.PI,pe=Dt/2,XE=Dt/4,pn=Dt*2,ze=180/Dt,qt=Dt/180,Pt=Math.abs,Ti=Math.atan,Ke=Math.atan2,J=Math.cos,Sm=Math.ceil,z1=Math.exp;var j1=Math.hypot,eu=Math.log,V1=Math.pow,K=Math.sin,Yn=Math.sign||function(e){return e>0?1:e<0?-1:0},me=Math.sqrt,Zf=Math.tan;function q1(e){return e>1?0:e<-1?Dt:Math.acos(e)}function Ae(e){return e>1?pe:e<-1?-pe:Math.asin(e)}function Je(){}function Y1(e,t){e&&PB.hasOwnProperty(e.type)&&PB[e.type](e,t)}var BB={Feature:function(e,t){Y1(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Y1(n[r].geometry,t)}},PB={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){HE(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)HE(n[r],t,0)},Polygon:function(e,t){$B(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)$B(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Y1(n[r],t)}};function HE(e,t,n){var r=-1,i=e.length-n,o;for(t.lineStart();++r<i;)o=e[r],t.point(o[0],o[1],o[2]);t.lineEnd()}function $B(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)HE(e[n],t,1);t.polygonEnd()}function Qr(e,t){e&&BB.hasOwnProperty(e.type)?BB[e.type](e,t):Y1(e,t)}function Im(e){return[Ke(e[1],e[0]),Ae(e[2])]}function jo(e){var t=e[0],n=e[1],r=J(n);return[r*J(t),r*K(t),K(n)]}function Tm(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Kf(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function G1(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Em(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Am(e){var t=me(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Mm,W1,X1,H1,Q1,Z1,K1,J1,QE,ZE,KE,jB,VB,dr,hr,pr,oo={sphere:Je,point:JE,lineStart:UB,lineEnd:zB,polygonStart:function(){oo.lineStart=NK,oo.lineEnd=DK},polygonEnd:function(){oo.lineStart=UB,oo.lineEnd=zB}};function JE(e,t){e*=qt,t*=qt;var n=J(t);Om(n*J(e),n*K(e),K(t))}function Om(e,t,n){++Mm,X1+=(e-X1)/Mm,H1+=(t-H1)/Mm,Q1+=(n-Q1)/Mm}function UB(){oo.point=MK}function MK(e,t){e*=qt,t*=qt;var n=J(t);dr=n*J(e),hr=n*K(e),pr=K(t),oo.point=OK,Om(dr,hr,pr)}function OK(e,t){e*=qt,t*=qt;var n=J(t),r=n*J(e),i=n*K(e),o=K(t),s=Ke(me((s=hr*o-pr*i)*s+(s=pr*r-dr*o)*s+(s=dr*i-hr*r)*s),dr*r+hr*i+pr*o);W1+=s,Z1+=s*(dr+(dr=r)),K1+=s*(hr+(hr=i)),J1+=s*(pr+(pr=o)),Om(dr,hr,pr)}function zB(){oo.point=JE}function NK(){oo.point=RK}function DK(){qB(jB,VB),oo.point=JE}function RK(e,t){jB=e,VB=t,e*=qt,t*=qt,oo.point=qB;var n=J(t);dr=n*J(e),hr=n*K(e),pr=K(t),Om(dr,hr,pr)}function qB(e,t){e*=qt,t*=qt;var n=J(t),r=n*J(e),i=n*K(e),o=K(t),s=hr*o-pr*i,a=pr*r-dr*o,c=dr*i-hr*r,l=j1(s,a,c),u=Ae(l),f=l&&-u/l;QE.add(f*s),ZE.add(f*a),KE.add(f*c),W1+=u,Z1+=u*(dr+(dr=r)),K1+=u*(hr+(hr=i)),J1+=u*(pr+(pr=o)),Om(dr,hr,pr)}function tA(e){Mm=W1=X1=H1=Q1=Z1=K1=J1=0,QE=new Dn,ZE=new Dn,KE=new Dn,Qr(e,oo);var t=+QE,n=+ZE,r=+KE,i=j1(t,n,r);return i<tu&&(t=Z1,n=K1,r=J1,W1<et&&(t=X1,n=H1,r=Q1),i=j1(t,n,r),i<tu)?[NaN,NaN]:[Ke(n,t)*ze,Ae(r/i)*ze]}function Nm(e,t){function n(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,i){return r=t.invert(r,i),r&&e.invert(r[0],r[1])}),n}function eA(e,t){return Pt(e)>Dt&&(e-=Math.round(e/pn)*pn),[e,t]}eA.invert=eA;function nA(e,t,n){return(e%=pn)?t||n?Nm(GB(e),WB(t,n)):GB(e):t||n?WB(t,n):eA}function YB(e){return function(t,n){return t+=e,Pt(t)>Dt&&(t-=Math.round(t/pn)*pn),[t,n]}}function GB(e){var t=YB(e);return t.invert=YB(-e),t}function WB(e,t){var n=J(e),r=K(e),i=J(t),o=K(t);function s(a,c){var l=J(c),u=J(a)*l,f=K(a)*l,d=K(c),h=d*n+u*r;return[Ke(f*i-h*o,u*n-d*r),Ae(h*i+f*o)]}return s.invert=function(a,c){var l=J(c),u=J(a)*l,f=K(a)*l,d=K(c),h=d*i-f*o;return[Ke(f*i+d*o,u*n+h*r),Ae(h*n-u*r)]},s}function XB(e){e=nA(e[0]*qt,e[1]*qt,e.length>2?e[2]*qt:0);function t(n){return n=e(n[0]*qt,n[1]*qt),n[0]*=ze,n[1]*=ze,n}return t.invert=function(n){return n=e.invert(n[0]*qt,n[1]*qt),n[0]*=ze,n[1]*=ze,n},t}function QB(e,t,n,r,i,o){if(n){var s=J(t),a=K(t),c=r*n;i==null?(i=t+r*pn,o=t-c/2):(i=HB(s,i),o=HB(s,o),(r>0?i<o:i>o)&&(i+=r*pn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Im([s,-a*J(u),-a*K(u)]),e.point(l[0],l[1])}}function HB(e,t){t=jo(t),t[0]-=e,Am(t);var n=q1(-t[1]);return((-t[2]<0?-n:n)+pn-et)%pn}function tw(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Je,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Jf(e,t){return Pt(e[0]-t[0])<et&&Pt(e[1]-t[1])<et}function ew(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function nw(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],x;if(Jf(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*et}o.push(x=new ew(y,p,null,!0)),s.push(x.o=new ew(y,null,x,!1)),o.push(x=new ew(g,p,null,!1)),s.push(x.o=new ew(g,null,x,!0))}}),!!o.length){for(s.sort(t),ZB(o),ZB(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function ZB(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function rA(e){return Pt(e[0])<=Dt?e[0]:Yn(e[0])*((Pt(e[0])+Dt)%pn-Dt)}function KB(e,t){var n=rA(t),r=t[1],i=K(r),o=[K(n),-J(n),0],s=0,a=0,c=new Dn;i===1?r=pe+et:i===-1&&(r=-pe-et);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=rA(h),m=h[1]/2+XE,y=K(m),g=J(m),x=0;x<d;++x,p=w,y=_,g=T,h=b){var b=f[x],w=rA(b),v=b[1]/2+XE,_=K(v),T=J(v),A=w-p,E=A>=0?1:-1,O=E*A,I=O>Dt,D=y*_;if(c.add(Ke(D*E*K(O),g*T+D*J(O))),s+=I?A+E*pn:A,I^p>=n^w>=n){var k=Kf(jo(h),jo(b));Am(k);var S=Kf(o,k);Am(S);var M=(I^A>=0?-1:1)*Ae(S[2]);(r>M||r===M&&(k[0]||k[1]))&&(a+=I^A>=0?1:-1)}}return(s<-et||s<et&&c<-tu)^a&1}function rw(e,t,n,r){return function(i){var o=t(i),s=tw(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:y,polygonStart:function(){d.point=g,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=y,u=Ff(u);var w=KB(l,r);u.length?(c||(i.polygonStart(),c=!0),nw(u,FK,w,n,i)):w&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(w,v){e(w,v)&&i.point(w,v)}function p(w,v){o.point(w,v)}function m(){d.point=p,o.lineStart()}function y(){d.point=h,o.lineEnd()}function g(w,v){f.push([w,v]),a.point(w,v)}function x(){a.lineStart(),f=[]}function b(){g(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),v=s.result(),_,T=v.length,A,E,O;if(f.pop(),l.push(f),f=null,!!T){if(w&1){if(E=v[0],(A=E.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),_=0;_<A;++_)i.point((O=E[_])[0],O[1]);i.lineEnd()}return}T>1&&w&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(LK))}}return d}}function LK(e){return e.length>1}function FK(e,t){return((e=e.x)[0]<0?e[1]-pe-et:pe-e[1])-((t=t.x)[0]<0?t[1]-pe-et:pe-t[1])}var iA=rw(function(){return!0},kK,BK,[-Dt,-pe]);function kK(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Dt:-Dt,c=Pt(o-t);Pt(c-Dt)<et?(e.point(t,n=(n+s)/2>0?pe:-pe),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Dt&&(Pt(t-r)<et&&(t-=r*et),Pt(o-a)<et&&(o-=a*et),n=CK(t,n,o,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),i=0),e.point(t=o,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function CK(e,t,n,r){var i,o,s=K(e-n);return Pt(s)>et?Ti((K(t)*(o=J(r))*K(n)-K(r)*(i=J(t))*K(e))/(i*o*s)):(t+r)/2}function BK(e,t,n,r){var i;if(e==null)i=n*pe,r.point(-Dt,i),r.point(0,i),r.point(Dt,i),r.point(Dt,0),r.point(Dt,-i),r.point(0,-i),r.point(-Dt,-i),r.point(-Dt,0),r.point(-Dt,i);else if(Pt(e[0]-t[0])>et){var o=e[0]<t[0]?Dt:-Dt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function JB(e){var t=J(e),n=6*qt,r=t>0,i=Pt(t)>et;function o(u,f,d,h){QB(h,e,n,d,u,f)}function s(u,f){return J(u)*J(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(y,g){var x=[y,g],b,w=s(y,g),v=r?w?0:l(y,g):w?l(y+(y<0?Dt:-Dt),g):0;if(!f&&(p=h=w)&&u.lineStart(),w!==h&&(b=c(f,x),(!b||Jf(f,b)||Jf(x,b))&&(x[2]=1)),w!==h)m=0,w?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&r^w){var _;!(v&d)&&(_=c(x,f,!0))&&(m=0,r?(u.lineStart(),u.point(_[0][0],_[0][1]),u.point(_[1][0],_[1][1]),u.lineEnd()):(u.point(_[1][0],_[1][1]),u.lineEnd(),u.lineStart(),u.point(_[0][0],_[0][1],3)))}w&&(!f||!Jf(f,x))&&u.point(x[0],x[1]),f=x,h=w,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=jo(u),p=jo(f),m=[1,0,0],y=Kf(h,p),g=Tm(y,y),x=y[0],b=g-x*x;if(!b)return!d&&u;var w=t*g/b,v=-t*x/b,_=Kf(m,y),T=Em(m,w),A=Em(y,v);G1(T,A);var E=_,O=Tm(T,E),I=Tm(E,E),D=O*O-I*(Tm(T,T)-1);if(!(D<0)){var k=me(D),S=Em(E,(-O-k)/I);if(G1(S,T),S=Im(S),!d)return S;var M=u[0],N=f[0],L=u[1],B=f[1],C;N<M&&(C=M,M=N,N=C);var P=N-M,$=Pt(P-Dt)<et,U=$||P<et;if(!$&&B<L&&(C=L,L=B,B=C),U?$?L+B>0^S[1]<(Pt(S[0]-M)<et?L:B):L<=S[1]&&S[1]<=B:P>Dt^(M<=S[0]&&S[0]<=N)){var H=Em(E,(-O+k)/I);return G1(H,T),[S,Im(H)]}}}function l(u,f){var d=r?e:Dt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return rw(s,a,o,r?[0,-e]:[-Dt,e-Dt])}function t7(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=n-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Dm=1e9,iw=-Dm;function td(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return Pt(l[0]-e)<et?u>0?0:3:Pt(l[0]-n)<et?u>0?2:1:Pt(l[1]-t)<et?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=tw(),d,h,p,m,y,g,x,b,w,v,_,T={point:A,lineStart:D,lineEnd:k,polygonStart:O,polygonEnd:I};function A(M,N){i(M,N)&&u.point(M,N)}function E(){for(var M=0,N=0,L=h.length;N<L;++N)for(var B=h[N],C=1,P=B.length,$=B[0],U,H,nt=$[0],ot=$[1];C<P;++C)U=nt,H=ot,$=B[C],nt=$[0],ot=$[1],H<=r?ot>r&&(nt-U)*(r-H)>(ot-H)*(e-U)&&++M:ot<=r&&(nt-U)*(r-H)<(ot-H)*(e-U)&&--M;return M}function O(){u=f,d=[],h=[],_=!0}function I(){var M=E(),N=_&&M,L=(d=Ff(d)).length;(N||L)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&nw(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function D(){T.point=S,h&&h.push(p=[]),v=!0,w=!1,x=b=NaN}function k(){d&&(S(m,y),g&&w&&f.rejoin(),d.push(f.result())),T.point=A,w&&u.lineEnd()}function S(M,N){var L=i(M,N);if(h&&p.push([M,N]),v)m=M,y=N,g=L,v=!1,L&&(u.lineStart(),u.point(M,N));else if(L&&w)u.point(M,N);else{var B=[x=Math.max(iw,Math.min(Dm,x)),b=Math.max(iw,Math.min(Dm,b))],C=[M=Math.max(iw,Math.min(Dm,M)),N=Math.max(iw,Math.min(Dm,N))];t7(B,C,e,t,n,r)?(w||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),L||u.lineEnd(),_=!1):L&&(u.lineStart(),u.point(M,N),_=!1)}x=M,b=N,w=L}return T}}function e7(e,t,n){var r=qe(e,t-et,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function n7(e,t,n){var r=qe(e,t-et,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function oA(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:x()}}function x(){return qe(Sm(r/u)*u,n,u).map(p).concat(qe(Sm(a/f)*f,s,f).map(m)).concat(qe(Sm(t/c)*c,e,c).filter(function(b){return Pt(b%u)>et}).map(d)).concat(qe(Sm(o/l)*l,i,l).filter(function(b){return Pt(b%f)>et}).map(h))}return g.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(b){return arguments.length?g.extentMajor(b).extentMinor(b):g.extentMinor()},g.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),g.precision(y)):[[r,a],[n,s]]},g.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),g.precision(y)):[[t,o],[e,i]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],g):[u,f]},g.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],g):[c,l]},g.precision=function(b){return arguments.length?(y=+b,d=e7(o,i,90),h=n7(t,e,y),p=e7(a,s,90),m=n7(r,n,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function sA(){return oA()()}var Rm=e=>e;var aA=new Dn,cA=new Dn,r7,i7,lA,uA,_c={point:Je,lineStart:Je,lineEnd:Je,polygonStart:function(){_c.lineStart=PK,_c.lineEnd=UK},polygonEnd:function(){_c.lineStart=_c.lineEnd=_c.point=Je,aA.add(Pt(cA)),cA=new Dn},result:function(){var e=aA/2;return aA=new Dn,e}};function PK(){_c.point=$K}function $K(e,t){_c.point=o7,r7=lA=e,i7=uA=t}function o7(e,t){cA.add(uA*e-lA*t),lA=e,uA=t}function UK(){o7(r7,i7)}var fA=_c;var ed=1/0,ow=ed,Lm=-ed,sw=Lm,zK={point:jK,lineStart:Je,lineEnd:Je,polygonStart:Je,polygonEnd:Je,result:function(){var e=[[ed,ow],[Lm,sw]];return Lm=sw=-(ow=ed=1/0),e}};function jK(e,t){e<ed&&(ed=e),e>Lm&&(Lm=e),t<ow&&(ow=t),t>sw&&(sw=t)}var nd=zK;var dA=0,hA=0,Fm=0,aw=0,cw=0,rd=0,pA=0,mA=0,km=0,c7,l7,Vo,qo,so={point:nu,lineStart:s7,lineEnd:a7,polygonStart:function(){so.lineStart=YK,so.lineEnd=GK},polygonEnd:function(){so.point=nu,so.lineStart=s7,so.lineEnd=a7},result:function(){var e=km?[pA/km,mA/km]:rd?[aw/rd,cw/rd]:Fm?[dA/Fm,hA/Fm]:[NaN,NaN];return dA=hA=Fm=aw=cw=rd=pA=mA=km=0,e}};function nu(e,t){dA+=e,hA+=t,++Fm}function s7(){so.point=VK}function VK(e,t){so.point=qK,nu(Vo=e,qo=t)}function qK(e,t){var n=e-Vo,r=t-qo,i=me(n*n+r*r);aw+=i*(Vo+e)/2,cw+=i*(qo+t)/2,rd+=i,nu(Vo=e,qo=t)}function a7(){so.point=nu}function YK(){so.point=WK}function GK(){u7(c7,l7)}function WK(e,t){so.point=u7,nu(c7=Vo=e,l7=qo=t)}function u7(e,t){var n=e-Vo,r=t-qo,i=me(n*n+r*r);aw+=i*(Vo+e)/2,cw+=i*(qo+t)/2,rd+=i,i=qo*e-Vo*t,pA+=i*(Vo+e),mA+=i*(qo+t),km+=i*3,nu(Vo=e,qo=t)}var yA=so;function lw(e){this._context=e}lw.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,pn);break}}},result:Je};var xA=new Dn,gA,f7,d7,Cm,Bm,uw={point:Je,lineStart:function(){uw.point=XK},lineEnd:function(){gA&&h7(f7,d7),uw.point=Je},polygonStart:function(){gA=!0},polygonEnd:function(){gA=null},result:function(){var e=+xA;return xA=new Dn,e}};function XK(e,t){uw.point=h7,f7=Cm=e,d7=Bm=t}function h7(e,t){Cm-=e,Bm-=t,xA.add(me(Cm*Cm+Bm*Bm)),Cm=e,Bm=t}var bA=uw;var p7,fw,m7,y7,id=class{constructor(t){this._append=t==null?g7:HK(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==m7||this._append!==fw){let r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,m7=r,fw=this._append,y7=this._,this._=i}this._+=y7;break}}}result(){let t=this._;return this._="",t.length?t:null}};function g7(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function HK(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return g7;if(t!==p7){let n=10**t;p7=t,fw=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*n)/n+i[o]}}return fw}function mn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Qr(a,i(o))),o.result()}return s.area=function(a){return Qr(a,i(fA)),fA.result()},s.measure=function(a){return Qr(a,i(bA)),bA.result()},s.bounds=function(a){return Qr(a,i(nd)),nd.result()},s.centroid=function(a){return Qr(a,i(yA)),yA.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Rm):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new id(n)):new lw(t=a),typeof r!="function"&&o.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(o.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);n=c}return t===null&&(o=new id(n)),s},s.projection(e).digits(n).context(t)}function ru(e){return{stream:od(e)}}function od(e){return function(t){var n=new wA;for(var r in e)n[r]=e[r];return n.stream=t,n}}function wA(){}wA.prototype={constructor:wA,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function _A(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Qr(n,e.stream(nd)),t(nd.result()),r!=null&&e.clipExtent(r),e}function Pm(e,t,n){return _A(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,c])},n)}function dw(e,t,n){return Pm(e,[[0,0],t],n)}function hw(e,t,n){return _A(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function pw(e,t,n){return _A(e,function(r){var i=+t,o=i/(r[1][1]-r[0][1]),s=-o*r[0][0],a=(i-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var x7=16,QK=J(30*qt);function vA(e,t){return+t?KK(e,t):ZK(e)}function ZK(e){return od({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function KK(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,y){var g=l-r,x=u-i,b=g*g+x*x;if(b>4*t&&m--){var w=s+d,v=a+h,_=c+p,T=me(w*w+v*v+_*_),A=Ae(_/=T),E=Pt(Pt(_)-1)<et||Pt(o-f)<et?(o+f)/2:Ke(v,w),O=e(E,A),I=O[0],D=O[1],k=I-r,S=D-i,M=x*k-g*S;(M*M/b>t||Pt((g*k+x*S)/b-.5)>.3||s*d+a*h+c*p<QK)&&(n(r,i,o,s,a,c,I,D,E,w/=T,v/=T,_,m,y),y.point(I,D),n(I,D,E,w,v,_,l,u,f,d,h,p,m,y))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,y={point:g,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),y.lineStart=v},polygonEnd:function(){r.polygonEnd(),y.lineStart=x}};function g(A,E){A=e(A,E),r.point(A[0],A[1])}function x(){f=NaN,y.point=b,r.lineStart()}function b(A,E){var O=jo([A,E]),I=e(A,E);n(f,d,u,h,p,m,f=I[0],d=I[1],u=A,h=O[0],p=O[1],m=O[2],x7,r),r.point(f,d)}function w(){y.point=g,r.lineEnd()}function v(){x(),y.point=_,y.lineEnd=T}function _(A,E){b(i=A,E),o=f,s=d,a=h,c=p,l=m,y.point=b}function T(){n(f,d,u,h,p,m,o,s,i,a,c,l,x7,r),y.lineEnd=w,w()}return y}}var JK=od({point:function(e,t){this.stream.point(e*qt,t*qt)}});function tJ(e){return od({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function eJ(e,t,n,r,i){function o(s,a){return s*=r,a*=i,[t+e*s,n-e*a]}return o.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*i]},o}function b7(e,t,n,r,i,o){if(!o)return eJ(e,t,n,r,i);var s=J(o),a=K(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function p(m,y){return m*=r,y*=i,[c*m-l*y+t,n-l*m-c*y]}return p.invert=function(m,y){return[r*(u*m-f*y+d),i*(h-f*m-u*y)]},p}function Cn(e){return SA(function(){return e})()}function SA(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=iA,y=null,g,x,b,w=Rm,v=.5,_,T,A,E,O;function I(M){return A(M[0]*qt,M[1]*qt)}function D(M){return M=A.invert(M[0],M[1]),M&&[M[0]*ze,M[1]*ze]}I.stream=function(M){return E&&O===M?E:E=JK(tJ(u)(m(_(w(O=M)))))},I.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},I.postclip=function(M){return arguments.length?(w=M,y=g=x=b=null,S()):w},I.clipAngle=function(M){return arguments.length?(m=+M?JB(p=M*qt):(p=null,iA),S()):p*ze},I.clipExtent=function(M){return arguments.length?(w=M==null?(y=g=x=b=null,Rm):td(y=+M[0][0],g=+M[0][1],x=+M[1][0],b=+M[1][1]),S()):y==null?null:[[y,g],[x,b]]},I.scale=function(M){return arguments.length?(n=+M,k()):n},I.translate=function(M){return arguments.length?(r=+M[0],i=+M[1],k()):[r,i]},I.center=function(M){return arguments.length?(o=M[0]%360*qt,s=M[1]%360*qt,k()):[o*ze,s*ze]},I.rotate=function(M){return arguments.length?(a=M[0]%360*qt,c=M[1]%360*qt,l=M.length>2?M[2]%360*qt:0,k()):[a*ze,c*ze,l*ze]},I.angle=function(M){return arguments.length?(f=M%360*qt,k()):f*ze},I.reflectX=function(M){return arguments.length?(d=M?-1:1,k()):d<0},I.reflectY=function(M){return arguments.length?(h=M?-1:1,k()):h<0},I.precision=function(M){return arguments.length?(_=vA(T,v=M*M),S()):me(v)},I.fitExtent=function(M,N){return Pm(I,M,N)},I.fitSize=function(M,N){return dw(I,M,N)},I.fitWidth=function(M,N){return hw(I,M,N)},I.fitHeight=function(M,N){return pw(I,M,N)};function k(){var M=b7(n,0,0,d,h,f).apply(null,t(o,s)),N=b7(n,r-M[0],i-M[1],d,h,f);return u=nA(a,c,l),T=Nm(t,N),A=Nm(u,T),_=vA(T,v),S()}function S(){return E=O=null,I}return function(){return t=e.apply(this,arguments),I.invert=t.invert&&D,k()}}function sd(e){var t=0,n=Dt/3,r=SA(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*qt,n=o[1]*qt):[t*ze,n*ze]},i}function w7(e){var t=J(e);function n(r,i){return[r*t,K(i)/t]}return n.invert=function(r,i){return[r/t,Ae(i*t)]},n}function _7(e,t){var n=K(e),r=(n+K(t))/2;if(Pt(r)<et)return w7(e);var i=1+n*(2*r-n),o=me(i)/r;function s(a,c){var l=me(i-2*r*K(c))/r;return[l*K(a*=r),o-l*J(a)]}return s.invert=function(a,c){var l=o-c,u=Ke(a,Pt(l))*Yn(l);return l*r<0&&(u-=Dt*Yn(a)*Yn(l)),[u/r,Ae((i-(a*a+l*l)*r*r)/(2*r))]},s}function vc(){return sd(_7).scale(155.424).center([0,33.6442])}function $m(){return vc().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function nJ(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i<t;)e[i].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function IA(){var e,t,n=$m(),r,i=vc().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=vc().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),m=(d[0]-p[0])/h,y=(d[1]-p[1])/h;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=nJ([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],m=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+et,m+.12*h+et],[p-.214*h-et,m+.234*h-et]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+et,m+.166*h+et],[p-.115*h-et,m+.234*h-et]]).stream(l),f()},u.fitExtent=function(d,h){return Pm(u,d,h)},u.fitSize=function(d,h){return dw(u,d,h)},u.fitWidth=function(d,h){return hw(u,d,h)},u.fitHeight=function(d,h){return pw(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function mw(e){return function(t,n){var r=J(t),i=J(n),o=e(r*i);return o===1/0?[2,0]:[o*i*K(t),o*K(n)]}}function Yo(e){return function(t,n){var r=me(t*t+n*n),i=e(r),o=K(i),s=J(i);return[Ke(t*o,r*s),Ae(r&&n*o/r)]}}var TA=mw(function(e){return me(2/(1+e))});TA.invert=Yo(function(e){return 2*Ae(e/2)});function EA(){return Cn(TA).scale(124.75).clipAngle(180-.001)}var AA=mw(function(e){return(e=q1(e))&&e/K(e)});AA.invert=Yo(function(e){return e});function MA(){return Cn(AA).scale(79.4188).clipAngle(180-.001)}function ad(e,t){return[e,eu(Zf((pe+t)/2))]}ad.invert=function(e,t){return[e,2*Ti(z1(t))-pe]};function OA(){return NA(ad).scale(961/pn)}function NA(e){var t=Cn(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Dt*r(),d=t(XB(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===ad?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function yw(e){return Zf((pe+e)/2)}function v7(e,t){var n=J(e),r=e===t?K(e):eu(n/J(t))/eu(yw(t)/yw(e)),i=n*V1(yw(e),r)/r;if(!r)return ad;function o(s,a){i>0?a<-pe+et&&(a=-pe+et):a>pe-et&&(a=pe-et);var c=i/V1(yw(a),r);return[c*K(r*s),i-c*J(r*s)]}return o.invert=function(s,a){var c=i-a,l=Yn(r)*me(s*s+c*c),u=Ke(s,Pt(c))*Yn(c);return c*r<0&&(u-=Dt*Yn(s)*Yn(c)),[u/r,2*Ti(V1(i/l,1/r))-pe]},o}function DA(){return sd(v7).scale(109.5).parallels([30,30])}function cd(e,t){return[e,t]}cd.invert=cd;function RA(){return Cn(cd).scale(152.63)}function S7(e,t){var n=J(e),r=e===t?K(e):(n-J(t))/(t-e),i=n/r+e;if(Pt(r)<et)return cd;function o(s,a){var c=i-a,l=r*s;return[c*K(l),i-c*J(l)]}return o.invert=function(s,a){var c=i-a,l=Ke(s,Pt(c))*Yn(c);return c*r<0&&(l-=Dt*Yn(s)*Yn(c)),[l/r,i-Yn(r)*me(s*s+c*c)]},o}function LA(){return sd(S7).scale(131.154).center([0,13.9389])}var Um=1.340264,zm=-.081106,jm=893e-6,Vm=.003796,gw=me(3)/2,rJ=12;function FA(e,t){var n=Ae(gw*K(t)),r=n*n,i=r*r*r;return[e*J(n)/(gw*(Um+3*zm*r+i*(7*jm+9*Vm*r))),n*(Um+zm*r+i*(jm+Vm*r))]}FA.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<rJ&&(a=n*(Um+zm*r+i*(jm+Vm*r))-t,c=Um+3*zm*r+i*(7*jm+9*Vm*r),n-=s=a/c,r=n*n,i=r*r*r,!(Pt(s)<tu));++o);return[gw*e*(Um+3*zm*r+i*(7*jm+9*Vm*r))/J(n),Ae(K(n)/gw)]};function kA(){return Cn(FA).scale(177.158)}function CA(e,t){var n=J(t),r=J(e)*n;return[n*K(e)/r,K(t)/r]}CA.invert=Yo(Ti);function BA(){return Cn(CA).scale(144.049).clipAngle(60)}function PA(e,t){return[J(t)*K(e),K(t)]}PA.invert=Yo(Ae);function $A(){return Cn(PA).scale(249.5).clipAngle(90+et)}function UA(e,t){var n=J(t),r=1+J(e)*n;return[n*K(e)/r,K(t)/r]}UA.invert=Yo(function(e){return 2*Ti(e)});function zA(){return Cn(UA).scale(250).clipAngle(142)}function jA(e,t){return[eu(Zf((pe+t)/2)),-e]}jA.invert=function(e,t){return[-t,2*Ti(z1(e))-pe]};function VA(){var e=NA(jA),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function iJ(e,t){return e.parent===t.parent?1:2}function oJ(e){return e.reduce(sJ,0)/e.length}function sJ(e,t){return e+t.x}function aJ(e){return 1+e.reduce(cJ,0)}function cJ(e,t){return Math.max(e,t.y)}function lJ(e){for(var t;t=e.children;)e=t[0];return e}function uJ(e){for(var t;t=e.children;)e=t[t.length-1];return e}function xw(){var e=iJ,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=oJ(h),d.y=aJ(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=lJ(o),l=uJ(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function fJ(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function I7(){return this.eachAfter(fJ)}function T7(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E7(e,t){for(var n=this,r=[n],i,o,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function A7(e,t){for(var n=this,r=[n],i=[],o,s,a,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(s=0,a=o.length;s<a;++s)r.push(o[s]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function M7(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function O7(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function N7(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function D7(e){for(var t=this,n=dJ(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function dJ(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function R7(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function L7(){return Array.from(this)}function F7(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function k7(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*C7(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i<o;++i)n.push(r[i]);while(n.length)}function qA(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=mJ)):t===void 0&&(t=pJ);for(var n=new Sc(e),r,i=[n],o,s,a,c;r=i.pop();)if((s=t(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Sc(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(YA)}function hJ(){return qA(this).eachBefore(yJ)}function pJ(e){return e.children}function mJ(e){return Array.isArray(e)?e[1]:null}function yJ(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function YA(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Sc(e){this.data=e,this.depth=this.height=0,this.parent=null}Sc.prototype=qA.prototype={constructor:Sc,count:I7,each:T7,eachAfter:A7,eachBefore:E7,find:M7,sum:O7,sort:N7,path:D7,ancestors:R7,descendants:L7,leaves:F7,links:k7,copy:hJ,[Symbol.iterator]:C7};function bw(e){return e==null?null:gJ(e)}function gJ(e){if(typeof e!="function")throw new Error;return e}var xJ={depth:-1},B7={},GA={};function bJ(e){return e.id}function wJ(e){return e.parentId}function ww(){var e=bJ,t=wJ,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,y=new Map;if(n!=null){let g=o.map((w,v)=>_J(n(w,v,i))),x=g.map(P7),b=new Set(g).add("");for(let w of x)b.has(w)||(b.add(w),g.push(w),x.push(P7(w)),o.push(GA));s=(w,v)=>g[v],a=(w,v)=>x[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Sc(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,y.set(m,y.has(m)?B7:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=y.get(p),!d)throw new Error("missing: "+p);if(d===B7)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===GA&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===GA);--g)h.data=null}if(f.parent=xJ,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(YA),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=bw(i),r):e},r.parentId=function(i){return arguments.length?(t=bw(i),r):t},r.path=function(i){return arguments.length?(n=bw(i),r):n},r}function _J(e){e=`${e}`;let t=e.length;return WA(e,t-1)&&!WA(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function P7(e){let t=e.length;if(t<2)return"";for(;--t>1&&!WA(e,t););return e.slice(0,t)}function WA(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function vJ(e,t){return e.parent===t.parent?1:2}function XA(e){var t=e.children;return t?t[0]:e.t}function HA(e){var t=e.children;return t?t[t.length-1]:e.t}function SJ(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function IJ(e){for(var t=0,n=0,r=e.children,i=r.length,o;--i>=0;)o=r[i],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function TJ(e,t,n){return e.a.parent===t.parent?e.a:n}function _w(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}_w.prototype=Object.create(Sc.prototype);function EJ(e){for(var t=new _w(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new _w(o[s],s)),i.parent=n;return(t.parent=new _w(null,0)).children=[t],t}function iu(){var e=vJ,t=1,n=1,r=null;function i(l){var u=EJ(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>d.x&&(d=x),x.depth>h.depth&&(h=x)});var p=f===d?1:e(f,d)/2,m=p-f.x,y=t/(d.x+p+m),g=n/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*y,x.y=x.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){IJ(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],y=d.m,g=h.m,x=p.m,b=m.m,w;p=HA(p),d=XA(d),p&&d;)m=XA(m),h=HA(h),h.a=l,w=p.z+x-d.z-y+e(p._,d._),w>0&&(SJ(TJ(p,l,f),l,w),y+=w,g+=w),x+=p.m,y+=d.m,b+=m.m,g+=h.m;p&&!HA(h)&&(h.t=p,h.m+=x-g),d&&!XA(m)&&(m.t=d,m.m+=y-b,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}var $7=23283064365386963e-26;function ou(e=Math.random()){let t=(0<=e&&e<1?e/$7:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,$7*(t>>>0))}function tn(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function qm(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}var Ym=Symbol("implicit");function su(){var e=new ir,t=[],n=[],r=Ym;function i(o){let s=e.get(o);if(s===void 0){if(r!==Ym)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new ir;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return su(t,n).unknown(r)},tn.apply(i,arguments),i}function Ic(){var e=su().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,m=h?r:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var y=qe(d).map(function(g){return p+o*g});return n(h?y.reverse():y)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Ic(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},tn.apply(f(),arguments)}function U7(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return U7(t())},e}function QA(){return U7(Ic.apply(null,arguments).paddingInner(1))}function ZA(e){return function(){return e}}function ld(e){return+e}var z7=[0,1];function Dr(e){return e}function KA(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:ZA(isNaN(t)?NaN:.5)}function AJ(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function MJ(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=KA(i,r),o=n(s,o)):(r=KA(r,i),o=n(o,s)),function(a){return o(r(a))}}function OJ(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=KA(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Qs(e,a,1,r)-1;return o[c](i[c](a))}}function Go(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function au(){var e=z7,t=z7,n=Hr,r,i,o,s=Dr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Dr&&(s=AJ(e[0],e[d-1])),a=d>2?OJ:MJ,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),Ee)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,ld),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Xl,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Dr,u()):s!==Dr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Gm(){return au()(Dr,Dr)}function JA(e,t,n,r){var i=Rf(e,t,n),o;switch(r=zo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=GE(i,s))&&(r.precision=o),U1(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=WE(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=YE(i))&&(r.precision=o-(r.type==="%")*2);break}}return Ii(r)}function ca(e){var t=e.domain;return e.ticks=function(n){var r=t();return Ln(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return JA(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Ks(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function la(){var e=Gm();return e.copy=function(){return Go(e,la())},tn.apply(e,arguments),ca(e)}function Wm(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,ld),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Wm(e).unknown(t)},e=arguments.length?Array.from(e,ld):[0,1],ca(n)}function Xm(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function j7(e){return Math.log(e)}function V7(e){return Math.exp(e)}function NJ(e){return-Math.log(-e)}function DJ(e){return-Math.exp(-e)}function RJ(e){return isFinite(e)?+("1e"+e):e<0?0:e}function LJ(e){return e===10?RJ:e===Math.E?Math.exp:t=>Math.pow(e,t)}function FJ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function q7(e){return(t,n)=>-e(-t,n)}function tM(e){let t=e(j7,V7),n=t.domain,r=10,i,o;function s(){return i=FJ(r),o=LJ(r),n()[0]<0?(i=q7(i),o=q7(o),e(NJ,DJ)):e(j7,V7),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,y=a==null?10:+a,g=[];if(!(r%1)&&h-d<y){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=Ln(l,u,y))}else g=Ln(d,h,Math.min(h-d,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=zo(c)).precision==null&&(c.trim=!0),c=Ii(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(Xm(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Hm(){let e=tM(au()).domain([1,10]);return e.copy=()=>Go(e,Hm()).base(e.base()),tn.apply(e,arguments),e}function Y7(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function G7(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function eM(e){var t=1,n=e(Y7(t),G7(t));return n.constant=function(r){return arguments.length?e(Y7(t=+r),G7(t)):t},ca(n)}function Qm(){var e=eM(au());return e.copy=function(){return Go(e,Qm()).constant(e.constant())},tn.apply(e,arguments)}function W7(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function kJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function CJ(e){return e<0?-e*e:e*e}function nM(e){var t=e(Dr,Dr),n=1;function r(){return n===1?e(Dr,Dr):n===.5?e(kJ,CJ):e(W7(n),W7(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},ca(t)}function Zm(){var e=nM(au());return e.copy=function(){return Go(e,Zm()).exponent(e.exponent())},tn.apply(e,arguments),e}function Km(){var e=[],t=[],n=[],r;function i(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s<a;)n[s-1]=eE(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[Qs(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Nt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return Km().domain(e).range(t).unknown(r)},tn.apply(o,arguments)}function Jm(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Qs(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return Jm().domain(e).range(t).unknown(n)},tn.apply(i,arguments)}var rM=new Date,iM=new Date;function ge(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>ge(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(rM.setTime(+o),iM.setTime(+s),e(rM),e(iM),Math.floor(n(rM,iM))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var ty=ge(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ty.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ge(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):ty);var ikt=ty.range;var yn=ge(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),X7=yn.range;var ua=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),BJ=ua.range,fa=ge(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),PJ=fa.range;var da=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),$J=da.range,ha=ge(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),UJ=ha.range;var Ei=ge(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),zJ=Ei.range,uu=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),jJ=uu.range,fu=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),VJ=fu.range;function du(e){return ge(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Zr=du(0),Tc=du(1),vw=du(2),Sw=du(3),Xo=du(4),Iw=du(5),Tw=du(6),Q7=Zr.range,qJ=Tc.range,YJ=vw.range,GJ=Sw.range,WJ=Xo.range,XJ=Iw.range,HJ=Tw.range;function hu(e){return ge(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var Kr=hu(0),Ec=hu(1),Ew=hu(2),Aw=hu(3),Ho=hu(4),Mw=hu(5),Ow=hu(6),Z7=Kr.range,QJ=Ec.range,ZJ=Ew.range,KJ=Aw.range,JJ=Ho.range,ttt=Mw.range,ett=Ow.range;var pa=ge(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),ntt=pa.range,ma=ge(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),rtt=ma.range;var Gn=ge(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Gn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var itt=Gn.range,Wn=ge(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Wn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var ott=Wn.range;function J7(e,t,n,r,i,o){let s=[[yn,1,1e3],[yn,5,5*1e3],[yn,15,15*1e3],[yn,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=eo(([,,y])=>y).right(s,d);if(h===s.length)return e.every(Rf(l/31536e6,u/31536e6,f));if(h===0)return ty.every(Math.max(Rf(l,u,f),1));let[p,m]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(m)}return[a,c]}var[oM,ny]=J7(Wn,ma,Kr,fu,ha,fa),[sM,aM]=J7(Gn,pa,Zr,Ei,da,ua);function cM(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function lM(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function ry(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function uM(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=iy(i),u=oy(i),f=iy(o),d=oy(o),h=iy(s),p=oy(s),m=iy(a),y=oy(a),g=iy(c),x=oy(c),b={a:L,A:B,b:C,B:P,c:null,d:oP,e:oP,f:Ott,g:$tt,G:ztt,H:Ett,I:Att,j:Mtt,L:uP,m:Ntt,M:Dtt,p:$,q:U,Q:cP,s:lP,S:Rtt,u:Ltt,U:Ftt,V:ktt,w:Ctt,W:Btt,x:null,X:null,y:Ptt,Y:Utt,Z:jtt,"%":aP},w={a:H,A:nt,b:ot,B:at,c:null,d:sP,e:sP,f:Gtt,g:net,G:iet,H:Vtt,I:qtt,j:Ytt,L:dP,m:Wtt,M:Xtt,p:G,q:st,Q:cP,s:lP,S:Htt,u:Qtt,U:Ztt,V:Ktt,w:Jtt,W:tet,x:null,X:null,y:eet,Y:ret,Z:oet,"%":aP},v={a:O,A:I,b:D,B:k,c:S,d:rP,e:rP,f:vtt,g:nP,G:eP,H:iP,I:iP,j:xtt,L:_tt,m:gtt,M:btt,p:E,q:ytt,Q:Itt,s:Ttt,S:wtt,u:ftt,U:dtt,V:htt,w:utt,W:ptt,x:M,X:N,y:nP,Y:eP,Z:mtt,"%":Stt};b.x=_(n,b),b.X=_(r,b),b.c=_(t,b),w.x=_(n,w),w.X=_(r,w),w.c=_(t,w);function _(V,Q){return function(rt){var z=[],Ct=-1,ht=0,Xt=V.length,Zt,tt,ce;for(rt instanceof Date||(rt=new Date(+rt));++Ct<Xt;)V.charCodeAt(Ct)===37&&(z.push(V.slice(ht,Ct)),(tt=tP[Zt=V.charAt(++Ct)])!=null?Zt=V.charAt(++Ct):tt=Zt==="e"?" ":"0",(ce=Q[Zt])&&(Zt=ce(rt,tt)),z.push(Zt),ht=Ct+1);return z.push(V.slice(ht,Ct)),z.join("")}}function T(V,Q){return function(rt){var z=ry(1900,void 0,1),Ct=A(z,V,rt+="",0),ht,Xt;if(Ct!=rt.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(Q&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(ht=lM(ry(z.y,0,1)),Xt=ht.getUTCDay(),ht=Xt>4||Xt===0?Ec.ceil(ht):Ec(ht),ht=uu.offset(ht,(z.V-1)*7),z.y=ht.getUTCFullYear(),z.m=ht.getUTCMonth(),z.d=ht.getUTCDate()+(z.w+6)%7):(ht=cM(ry(z.y,0,1)),Xt=ht.getDay(),ht=Xt>4||Xt===0?Tc.ceil(ht):Tc(ht),ht=Ei.offset(ht,(z.V-1)*7),z.y=ht.getFullYear(),z.m=ht.getMonth(),z.d=ht.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Xt="Z"in z?lM(ry(z.y,0,1)).getUTCDay():cM(ry(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Xt+5)%7:z.w+z.U*7-(Xt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,lM(z)):cM(z)}}function A(V,Q,rt,z){for(var Ct=0,ht=Q.length,Xt=rt.length,Zt,tt;Ct<ht;){if(z>=Xt)return-1;if(Zt=Q.charCodeAt(Ct++),Zt===37){if(Zt=Q.charAt(Ct++),tt=v[Zt in tP?Q.charAt(Ct++):Zt],!tt||(z=tt(V,rt,z))<0)return-1}else if(Zt!=rt.charCodeAt(z++))return-1}return z}function E(V,Q,rt){var z=l.exec(Q.slice(rt));return z?(V.p=u.get(z[0].toLowerCase()),rt+z[0].length):-1}function O(V,Q,rt){var z=h.exec(Q.slice(rt));return z?(V.w=p.get(z[0].toLowerCase()),rt+z[0].length):-1}function I(V,Q,rt){var z=f.exec(Q.slice(rt));return z?(V.w=d.get(z[0].toLowerCase()),rt+z[0].length):-1}function D(V,Q,rt){var z=g.exec(Q.slice(rt));return z?(V.m=x.get(z[0].toLowerCase()),rt+z[0].length):-1}function k(V,Q,rt){var z=m.exec(Q.slice(rt));return z?(V.m=y.get(z[0].toLowerCase()),rt+z[0].length):-1}function S(V,Q,rt){return A(V,t,Q,rt)}function M(V,Q,rt){return A(V,n,Q,rt)}function N(V,Q,rt){return A(V,r,Q,rt)}function L(V){return s[V.getDay()]}function B(V){return o[V.getDay()]}function C(V){return c[V.getMonth()]}function P(V){return a[V.getMonth()]}function $(V){return i[+(V.getHours()>=12)]}function U(V){return 1+~~(V.getMonth()/3)}function H(V){return s[V.getUTCDay()]}function nt(V){return o[V.getUTCDay()]}function ot(V){return c[V.getUTCMonth()]}function at(V){return a[V.getUTCMonth()]}function G(V){return i[+(V.getUTCHours()>=12)]}function st(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var Q=_(V+="",b);return Q.toString=function(){return V},Q},parse:function(V){var Q=T(V+="",!1);return Q.toString=function(){return V},Q},utcFormat:function(V){var Q=_(V+="",w);return Q.toString=function(){return V},Q},utcParse:function(V){var Q=T(V+="",!0);return Q.toString=function(){return V},Q}}}var tP={"-":"",_:" ",0:"0"},gn=/^\s*\d+/,att=/^%/,ctt=/[\\^$*+?|[\]().{}]/g;function re(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function ltt(e){return e.replace(ctt,"\\$&")}function iy(e){return new RegExp("^(?:"+e.map(ltt).join("|")+")","i")}function oy(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function utt(e,t,n){var r=gn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function ftt(e,t,n){var r=gn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function dtt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function htt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function ptt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function eP(e,t,n){var r=gn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function nP(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function mtt(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function ytt(e,t,n){var r=gn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function gtt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function rP(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function xtt(e,t,n){var r=gn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function iP(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function btt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function wtt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function _tt(e,t,n){var r=gn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function vtt(e,t,n){var r=gn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Stt(e,t,n){var r=att.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Itt(e,t,n){var r=gn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Ttt(e,t,n){var r=gn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function oP(e,t){return re(e.getDate(),t,2)}function Ett(e,t){return re(e.getHours(),t,2)}function Att(e,t){return re(e.getHours()%12||12,t,2)}function Mtt(e,t){return re(1+Ei.count(Gn(e),e),t,3)}function uP(e,t){return re(e.getMilliseconds(),t,3)}function Ott(e,t){return uP(e,t)+"000"}function Ntt(e,t){return re(e.getMonth()+1,t,2)}function Dtt(e,t){return re(e.getMinutes(),t,2)}function Rtt(e,t){return re(e.getSeconds(),t,2)}function Ltt(e){var t=e.getDay();return t===0?7:t}function Ftt(e,t){return re(Zr.count(Gn(e)-1,e),t,2)}function fP(e){var t=e.getDay();return t>=4||t===0?Xo(e):Xo.ceil(e)}function ktt(e,t){return e=fP(e),re(Xo.count(Gn(e),e)+(Gn(e).getDay()===4),t,2)}function Ctt(e){return e.getDay()}function Btt(e,t){return re(Tc.count(Gn(e)-1,e),t,2)}function Ptt(e,t){return re(e.getFullYear()%100,t,2)}function $tt(e,t){return e=fP(e),re(e.getFullYear()%100,t,2)}function Utt(e,t){return re(e.getFullYear()%1e4,t,4)}function ztt(e,t){var n=e.getDay();return e=n>=4||n===0?Xo(e):Xo.ceil(e),re(e.getFullYear()%1e4,t,4)}function jtt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+re(t/60|0,"0",2)+re(t%60,"0",2)}function sP(e,t){return re(e.getUTCDate(),t,2)}function Vtt(e,t){return re(e.getUTCHours(),t,2)}function qtt(e,t){return re(e.getUTCHours()%12||12,t,2)}function Ytt(e,t){return re(1+uu.count(Wn(e),e),t,3)}function dP(e,t){return re(e.getUTCMilliseconds(),t,3)}function Gtt(e,t){return dP(e,t)+"000"}function Wtt(e,t){return re(e.getUTCMonth()+1,t,2)}function Xtt(e,t){return re(e.getUTCMinutes(),t,2)}function Htt(e,t){return re(e.getUTCSeconds(),t,2)}function Qtt(e){var t=e.getUTCDay();return t===0?7:t}function Ztt(e,t){return re(Kr.count(Wn(e)-1,e),t,2)}function hP(e){var t=e.getUTCDay();return t>=4||t===0?Ho(e):Ho.ceil(e)}function Ktt(e,t){return e=hP(e),re(Ho.count(Wn(e),e)+(Wn(e).getUTCDay()===4),t,2)}function Jtt(e){return e.getUTCDay()}function tet(e,t){return re(Ec.count(Wn(e)-1,e),t,2)}function eet(e,t){return re(e.getUTCFullYear()%100,t,2)}function net(e,t){return e=hP(e),re(e.getUTCFullYear()%100,t,2)}function ret(e,t){return re(e.getUTCFullYear()%1e4,t,4)}function iet(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Ho(e):Ho.ceil(e),re(e.getUTCFullYear()%1e4,t,4)}function oet(){return"+0000"}function aP(){return"%"}function cP(e){return+e}function lP(e){return Math.floor(+e/1e3)}var ud,fd,pP,Qo,mP;fM({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function fM(e){return ud=uM(e),fd=ud.format,pP=ud.parse,Qo=ud.utcFormat,mP=ud.utcParse,ud}function set(e){return new Date(e)}function aet(e){return e instanceof Date?+e:+new Date(+e)}function Nw(e,t,n,r,i,o,s,a,c,l){var u=Gm(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),x=l("%b %d"),b=l("%B"),w=l("%Y");function v(_){return(c(_)<_?h:a(_)<_?p:s(_)<_?m:o(_)<_?y:r(_)<_?i(_)<_?g:x:n(_)<_?b:w)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?d(Array.from(_,aet)):d().map(set)},u.ticks=function(_){var T=d();return e(T[0],T[T.length-1],_??10)},u.tickFormat=function(_,T){return T==null?v:l(T)},u.nice=function(_){var T=d();return(!_||typeof _.range!="function")&&(_=t(T[0],T[T.length-1],_??10)),_?d(Xm(T,_)):u},u.copy=function(){return Go(u,Nw(e,t,n,r,i,o,s,a,c,l))},u}function Dw(){return tn.apply(Nw(sM,aM,Gn,pa,Zr,Ei,da,ua,yn,fd).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Rw(){return tn.apply(Nw(oM,ny,Wn,ma,Kr,uu,ha,fa,yn,Qo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function sy(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Lw(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=Dr,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(y){var g,x,b;return arguments.length?([g,x,b]=y,l=Bo(m,[g,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(Hr),h.rangeRound=p(Xl),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function ay(){var e=ca(Lw()(Dr));return e.copy=function(){return sy(e,ay())},qm.apply(e,arguments)}function Fw(){var e=tM(Lw()).domain([.1,1,10]);return e.copy=function(){return sy(e,Fw()).base(e.base())},qm.apply(e,arguments)}function kw(){var e=eM(Lw());return e.copy=function(){return sy(e,kw()).constant(e.constant())},qm.apply(e,arguments)}function Cw(){var e=nM(Lw());return e.copy=function(){return sy(e,Cw()).exponent(e.exponent())},qm.apply(e,arguments)}function W(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}var dM=W("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var hM=W("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var pM=W("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var mM=W("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var yM=W("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var gM=W("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var xM=W("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var bM=W("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var wM=W("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var _M=W("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var vM=W("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var mt=e=>gE(e[e.length-1]);var Bw=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),Pw=mt(Bw);var $w=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Uw=mt($w);var zw=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),jw=mt(zw);var Vw=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),qw=mt(Vw);var cy=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),dd=mt(cy);var Yw=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),Gw=mt(Yw);var ly=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),hd=mt(ly);var Ww=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),Xw=mt(Ww);var Hw=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Qw=mt(Hw);var Zw=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),Kw=mt(Zw);var Jw=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),t_=mt(Jw);var e_=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),n_=mt(e_);var r_=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),i_=mt(r_);var o_=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),s_=mt(o_);var a_=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),c_=mt(a_);var l_=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),u_=mt(l_);var f_=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),d_=mt(f_);var h_=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),p_=mt(h_);var m_=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),y_=mt(m_);var g_=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),x_=mt(g_);var b_=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),w_=mt(b_);var __=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),v_=mt(__);var S_=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),I_=mt(S_);var T_=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),E_=mt(T_);var A_=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),M_=mt(A_);var O_=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),N_=mt(O_);var D_=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),R_=mt(D_);function L_(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var F_=zf(cr(300,.5,0),cr(-240,.5,1));var C_=zf(cr(-100,.75,.35),cr(80,1.5,.8)),B_=zf(cr(260,.75,.35),cr(80,1.5,.8)),k_=cr();function P_(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return k_.h=360*e-100,k_.s=1.5-1.5*t,k_.l=.8-.9*t,k_+""}var $_=cn(),cet=Math.PI/3,uet=Math.PI*2/3;function U_(e){var t;return e=(.5-e)*Math.PI,$_.r=255*(t=Math.sin(e))*t,$_.g=255*(t=Math.sin(e+cet))*t,$_.b=255*(t=Math.sin(e+uet))*t,$_+""}function z_(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function j_(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var V_=j_(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),q_=j_(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Y_=j_(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),G_=j_(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function en(e){return function(){return e}}var SM=Math.cos;var pd=Math.min,uy=Math.sin,ie=Math.sqrt,IM=1e-12,pu=Math.PI,O7t=pu/2,md=2*pu;function W_(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new xc(t)}var L7t=Array.prototype.slice;function X_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yP(e){this._context=e}yP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ya(e){return new yP(e)}function H_(e){return e[0]}function Q_(e){return e[1]}function fy(e,t){var n=en(!0),r=null,i=ya,o=null,s=W_(a);e=typeof e=="function"?e:e===void 0?H_:en(e),t=typeof t=="function"?t:t===void 0?Q_:en(t);function a(c){var l,u=(c=X_(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:en(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:en(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:en(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function yd(e,t,n){var r=null,i=en(!0),o=null,s=ya,a=null,c=W_(l);e=typeof e=="function"?e:e===void 0?H_:en(+e),t=typeof t=="function"?t:t===void 0?en(0):en(+t),n=typeof n=="function"?n:n===void 0?Q_:en(+n);function l(f){var d,h,p,m=(f=X_(f)).length,y,g=!1,x,b=new Array(m),w=new Array(m);for(o==null&&(a=s(x=c())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===g)if(g=!g)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(b[p],w[p]);a.lineEnd(),a.areaEnd()}g&&(b[d]=+e(y,d,f),w[d]=+t(y,d,f),a.point(r?+r(y,d,f):b[d],n?+n(y,d,f):w[d]))}if(x)return a=null,x+""||null}function u(){return fy().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:en(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:en(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:en(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:en(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:en(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:en(+f),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:en(!!f),l):i},l.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),l):s},l.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),l):o},l}var Z_=class{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}};function TM(e){return new Z_(e,!0)}function EM(e){return new Z_(e,!1)}var fet=ie(3),dy={draw(e,t){let n=ie(t+pd(t/28,.75))*.59436,r=n/2,i=r*fet;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}};var ga={draw(e,t){let n=ie(t/pu);e.moveTo(n,0),e.arc(0,0,n,0,md)}};var hy={draw(e,t){let n=ie(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var gP=ie(1/3),det=gP*2,py={draw(e,t){let n=ie(t/det),r=n*gP;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var my={draw(e,t){let n=ie(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var yy={draw(e,t){let n=ie(t-pd(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var gy={draw(e,t){let n=ie(t),r=-n/2;e.rect(r,r,n,n)}};var xy={draw(e,t){let n=ie(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var het=.8908130915292852,xP=uy(pu/10)/uy(7*pu/10),pet=uy(md/10)*xP,met=-SM(md/10)*xP,by={draw(e,t){let n=ie(t*het),r=pet*n,i=met*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=md*o/5,a=SM(s),c=uy(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var AM=ie(3),wy={draw(e,t){let n=-ie(t/(AM*3));e.moveTo(0,n*2),e.lineTo(-AM*n,-n),e.lineTo(AM*n,-n),e.closePath()}};var yet=ie(3),_y={draw(e,t){let n=ie(t)*.6824,r=n/2,i=n*yet/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var Ai=-.5,Mi=ie(3)/2,MM=1/ie(12),get=(MM/2+1)*3,vy={draw(e,t){let n=ie(t/get),r=n/2,i=n*MM,o=r,s=n*MM+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Ai*r-Mi*i,Mi*r+Ai*i),e.lineTo(Ai*o-Mi*s,Mi*o+Ai*s),e.lineTo(Ai*a-Mi*c,Mi*a+Ai*c),e.lineTo(Ai*r+Mi*i,Ai*i-Mi*r),e.lineTo(Ai*o+Mi*s,Ai*s-Mi*o),e.lineTo(Ai*a+Mi*c,Ai*c-Mi*a),e.closePath()}};var gd={draw(e,t){let n=ie(t-pd(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var K_=[ga,hy,py,gy,by,wy,vy],OM=[ga,yy,gd,_y,dy,xy,my];function Oi(){}function xd(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Sy(e){this._context=e}Sy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:xd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:xd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function NM(e){return new Sy(e)}function bP(e){this._context=e}bP.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:xd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function DM(e){return new bP(e)}function wP(e){this._context=e}wP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:xd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function RM(e){return new wP(e)}function _P(e,t){this._basis=new Sy(e),this._beta=t}_P.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],o=e[n]-r,s=t[n]-i,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var LM=function e(t){function n(r){return t===1?new Sy(r):new _P(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function bd(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function J_(e,t){this._context=e,this._k=(1-t)/6}J_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:bd(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:bd(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var FM=function e(t){function n(r){return new J_(r,t)}return n.tension=function(r){return e(+r)},n}(0);function tv(e,t){this._context=e,this._k=(1-t)/6}tv.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:bd(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var kM=function e(t){function n(r){return new tv(r,t)}return n.tension=function(r){return e(+r)},n}(0);function ev(e,t){this._context=e,this._k=(1-t)/6}ev.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:bd(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var CM=function e(t){function n(r){return new ev(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Iy(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>IM){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>IM){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function vP(e,t){this._context=e,this._alpha=t}vP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Iy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var BM=function e(t){function n(r){return t?new vP(r,t):new J_(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function SP(e,t){this._context=e,this._alpha=t}SP.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Iy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var PM=function e(t){function n(r){return t?new SP(r,t):new tv(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function IP(e,t){this._context=e,this._alpha=t}IP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Iy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var $M=function e(t){function n(r){return t?new IP(r,t):new ev(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function TP(e){this._context=e}TP.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function UM(e){return new TP(e)}function EP(e){return e<0?-1:1}function AP(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(EP(o)+EP(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function MP(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function zM(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function nv(e){this._context=e}nv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:zM(this,this._t0,MP(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,zM(this,MP(this,n=AP(this,e,t)),n);break;default:zM(this,this._t0,n=AP(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function OP(e){this._context=new NP(e)}(OP.prototype=Object.create(nv.prototype)).point=function(e,t){nv.prototype.point.call(this,t,e)};function NP(e){this._context=e}NP.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function jM(e){return new nv(e)}function VM(e){return new OP(e)}function RP(e){this._context=e}RP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=DP(e),i=DP(t),o=0,s=1;s<n;++o,++s)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function DP(e){var t,n=e.length-1,r,i=new Array(n),o=new Array(n),s=new Array(n);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,o[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/o[t-1],o[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/o[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function qM(e){return new RP(e)}function rv(e,t){this._context=e,this._t=t}rv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function YM(e){return new rv(e,.5)}function GM(e){return new rv(e,0)}function WM(e){return new rv(e,1)}var Ty=e=>()=>e;function XM(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Jr(e,t,n){this.k=e,this.x=t,this.y=n}Jr.prototype={constructor:Jr,scale:function(e){return e===1?this:new Jr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Jr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ey=new Jr(1,0,0);HM.prototype=Jr.prototype;function HM(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ey;return e.__zoom}function iv(e){e.stopImmediatePropagation()}function wd(e){e.preventDefault(),e.stopImmediatePropagation()}function xet(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bet(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function LP(){return this.__zoom||Ey}function wet(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _et(){return navigator.maxTouchPoints||"ontouchstart"in this}function vet(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function QM(){var e=xet,t=bet,n=vet,r=wet,i=_et,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=SE,l=jl("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(S){S.property("__zoom",LP).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",O).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,M,N,L){var B=S.selection?S.selection():S;B.property("__zoom",LP),S!==B?v(S,M,N,L):B.interrupt().each(function(){_(this,arguments).event(L).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},g.scaleBy=function(S,M,N,L){g.scaleTo(S,function(){var B=this.__zoom.k,C=typeof M=="function"?M.apply(this,arguments):M;return B*C},N,L)},g.scaleTo=function(S,M,N,L){g.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?w(B):typeof N=="function"?N.apply(this,arguments):N,$=C.invert(P),U=typeof M=="function"?M.apply(this,arguments):M;return n(b(x(C,U),P,$),B,s)},N,L)},g.translateBy=function(S,M,N,L){g.transform(S,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,L)},g.translateTo=function(S,M,N,L,B){g.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,$=L==null?w(C):typeof L=="function"?L.apply(this,arguments):L;return n(Ey.translate($[0],$[1]).scale(P.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},L,B)};function x(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new Jr(M,S.x,S.y)}function b(S,M,N){var L=M[0]-N[0]*S.k,B=M[1]-N[1]*S.k;return L===S.x&&B===S.y?S:new Jr(S.k,L,B)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,N,L){S.on("start.zoom",function(){_(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(L).end()}).tween("zoom",function(){var B=this,C=arguments,P=_(B,C).event(L),$=t.apply(B,C),U=N==null?w($):typeof N=="function"?N.apply(B,C):N,H=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),nt=B.__zoom,ot=typeof M=="function"?M.apply(B,C):M,at=c(nt.invert(U).concat(H/nt.k),ot.invert(U).concat(H/ot.k));return function(G){if(G===1)G=ot;else{var st=at(G),V=H/st[2];G=new Jr(V,U[0]-st[0]*V,U[1]-st[1]*V)}P.zoom(null,G)}})}function _(S,M,N){return!N&&S.__zooming||new T(S,M)}function T(S,M){this.that=S,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,M),this.taps=0}T.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,M){return this.mouse&&S!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var M=jt(this.that).datum();l.call(S,this.that,new XM(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function A(S,...M){if(!e.apply(this,arguments))return;var N=_(this,M).event(S),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),C=zn(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=L.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(L.k===B)return;N.mouse=[C,L.invert(C)],Po(this),N.start()}wd(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(b(x(L,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function E(S,...M){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,L=_(this,M,!0).event(S),B=jt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",H,!0),C=zn(S,N),P=S.clientX,$=S.clientY;nm(S.view),iv(S),L.mouse=[C,this.__zoom.invert(C)],Po(this),L.start();function U(nt){if(wd(nt),!L.moved){var ot=nt.clientX-P,at=nt.clientY-$;L.moved=ot*ot+at*at>m}L.event(nt).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=zn(nt,N),L.mouse[1]),L.extent,s))}function H(nt){B.on("mousemove.zoom mouseup.zoom",null),rm(nt.view,L.moved),wd(nt),L.event(nt).end()}}function O(S,...M){if(e.apply(this,arguments)){var N=this.__zoom,L=zn(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(L),C=N.k*(S.shiftKey?.5:2),P=n(b(x(N,C),L,B),t.apply(this,M),s);wd(S),a>0?jt(this).transition().duration(a).call(v,P,L,S):jt(this).call(g.transform,P,L,S)}}function I(S,...M){if(e.apply(this,arguments)){var N=S.touches,L=N.length,B=_(this,M,S.changedTouches.length===L).event(S),C,P,$,U;for(iv(S),P=0;P<L;++P)$=N[P],U=zn($,this),U=[U,this.__zoom.invert(U),$.identifier],B.touch0?!B.touch1&&B.touch0[2]!==U[2]&&(B.touch1=U,B.taps=0):(B.touch0=U,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),Po(this),B.start())}}function D(S,...M){if(this.__zooming){var N=_(this,M).event(S),L=S.changedTouches,B=L.length,C,P,$,U;for(wd(S),C=0;C<B;++C)P=L[C],$=zn(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=$:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=$);if(P=N.that.__zoom,N.touch1){var H=N.touch0[0],nt=N.touch0[1],ot=N.touch1[0],at=N.touch1[1],G=(G=ot[0]-H[0])*G+(G=ot[1]-H[1])*G,st=(st=at[0]-nt[0])*st+(st=at[1]-nt[1])*st;P=x(P,Math.sqrt(G/st)),$=[(H[0]+ot[0])/2,(H[1]+ot[1])/2],U=[(nt[0]+at[0])/2,(nt[1]+at[1])/2]}else if(N.touch0)$=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(b(P,$,U),N.extent,s))}}function k(S,...M){if(this.__zooming){var N=_(this,M).event(S),L=S.changedTouches,B=L.length,C,P;for(iv(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=L[C],N.touch0&&N.touch0[2]===P.identifier?delete N.touch0:N.touch1&&N.touch1[2]===P.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(P=zn(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<y)){var $=jt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Ty(+S),g):r},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Ty(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Ty(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Ty([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(n=S,g):n},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function Ne(e){return e!=null&&!Number.isNaN(e)}function xn(e,t){return+Ne(t)-+Ne(e)||Nt(e,t)}function mu(e,t){return+Ne(t)-+Ne(e)||rr(e,t)}function Ay(e){return e!=null&&`${e}`!=""}function _d(e){return isFinite(e)?e:NaN}function mr(e){return e>0&&isFinite(e)?e:NaN}function Ac(e){return e<0&&isFinite(e)?e:NaN}function vd(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${Iet(e.getUTCFullYear(),4)}-${xa(e.getUTCMonth()+1,2)}-${xa(e.getUTCDate(),2)}${n||r||i||o?`T${xa(n,2)}:${xa(r,2)}${i||o?`:${xa(i,2)}${o?`.${xa(o,3)}`:""}`:""}Z`:""}`}function Iet(e){return e<0?`-${xa(-e,6)}`:e>9999?`+${xa(e,6)}`:xa(e,4)}function xa(e,t){return`${e}`.padStart(t,"0")}var Tet=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function My(e,t){return Tet.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function ba(e){if(e==null)return;let t=e[0],n=e[e.length-1];return rr(t,n)}var Id=1e3,Oc=Id*60,Nc=Oc*60,Ko=Nc*24,Zo=Ko*7,yu=Ko*30,Mc=Ko*365,ZM=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",Id],["5 seconds",5*Id],["15 seconds",15*Id],["30 seconds",30*Id],["minute",Oc],["5 minutes",5*Oc],["15 minutes",15*Oc],["30 minutes",30*Oc],["hour",Nc],["3 hours",3*Nc],["6 hours",6*Nc],["12 hours",12*Nc],["day",Ko],["2 days",2*Ko],["week",Zo],["2 weeks",2*Zo],["month",yu],["3 months",3*yu],["6 months",6*yu],["year",Mc],["2 years",2*Mc],["5 years",5*Mc],["10 years",10*Mc],["20 years",20*Mc],["50 years",50*Mc],["100 years",100*Mc]],KM=new Map([["second",Id],["minute",Oc],["hour",Nc],["day",Ko],["monday",Zo],["tuesday",Zo],["wednesday",Zo],["thursday",Zo],["friday",Zo],["saturday",Zo],["sunday",Zo],["week",Zo],["month",yu],["year",Mc]]),kP=new Map([["second",yn],["minute",ua],["hour",da],["day",Ei],["monday",Tc],["tuesday",vw],["wednesday",Sw],["thursday",Xo],["friday",Iw],["saturday",Tw],["sunday",Zr],["week",Zr],["month",pa],["year",Gn]]),JM=new Map([["second",yn],["minute",fa],["hour",ha],["day",fu],["monday",Ec],["tuesday",Ew],["wednesday",Aw],["thursday",Ho],["friday",Mw],["saturday",Ow],["sunday",Kr],["week",Kr],["month",ma],["year",Wn]]),Td=Symbol("intervalDuration"),sv=Symbol("intervalType");for(let[e,t]of kP)t[Td]=KM.get(e),t[sv]="time";for(let[e,t]of JM)t[Td]=KM.get(e),t[sv]="utc";var Oy=[["year",Wn,"utc"],["month",ma,"utc"],["day",fu,"utc",6*yu],["hour",ha,"utc",3*Ko],["minute",fa,"utc",6*Nc],["second",yn,"utc",30*Oc]],ov=[["year",Gn,"time"],["month",pa,"time"],["day",Ei,"time",6*yu],["hour",da,"time",3*Ko],["minute",ua,"time",6*Nc],["second",yn,"time",30*Oc]],Eet=[Oy[0],ov[0],Oy[1],ov[1],Oy[2],ov[2],...Oy.slice(3)];function av(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(t);switch(r&&(t=t.slice(r[0].length),n=+r[1]),t){case"quarter":t="month",n*=3;break;case"half":t="month",n*=6;break}let i=JM.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,n]}function Ny(e){return CP(av(e),"time")}function gu(e){return CP(av(e),"utc")}function CP([e,t],n){let r=(n==="time"?kP:JM).get(e);return t>1&&(r=r.every(t),r[Td]=KM.get(e)*t,r[sv]=n),r}function t3(e,t){if(!(t>1))return;let n=e[Td];if(!ZM.some(([,i])=>i===n)||n%Ko===0&&Ko<n&&n<yu)return;let[r]=ZM[eo(([,i])=>Math.log(i)).center(ZM,Math.log(n*t))];return(e[sv]==="time"?Ny:gu)(r)}function FP(e,t,n){let r=t==="time"?fd:Qo;if(n==null)return r(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=Aet(n);switch(e){case"millisecond":return Sd(r(".%L"),r(":%M:%S"),i);case"second":return Sd(r(":%S"),r("%-I:%M"),i);case"minute":return Sd(r("%-I:%M"),r("%p"),i);case"hour":return Sd(r("%-I %p"),r("%b %-d"),i);case"day":return Sd(r("%-d"),r("%b"),i);case"month":return Sd(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function Aet(e){return e==="left"||e==="right"?(t,n)=>`
21
12
  ${t}
22
- ${r}`:e==="top"?(t,r)=>`${r}
23
- ${t}`:(t,r)=>`${t}
24
- ${r}`}function cct(e){return e==="time"?NI:e==="utc"?zb:sct}function HV(e,t,r){let n=me(Ev(t,(i,o)=>Math.abs(o-i)));if(n<1e3)return WV("millisecond","utc",r);for(let[i,o,s,a]of cct(e)){if(n>a||i==="hour"&&!n)break;if(t.every(c=>o.floor(c)>=c))return WV(i,s,r)}}function Op(e,t,r){return(n,i,o)=>{let s=e(n,i),a=t(n,i),c=i-nl(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:r(s,a)}}var hd=Object.getPrototypeOf(Uint8Array),lct=Object.prototype.toString,rN=Symbol("reindex");function At(e,t,r){let n=typeof t;return n==="string"?ZV(e,nN(t),r):n==="function"?ZV(e,t,r):n==="number"||t instanceof Date||n==="boolean"?de(e,en(t),r):typeof t?.transform=="function"?KV(t.transform(e),r):uct(KV(t,r),e?.[rN])}function uct(e,t){return t?qb(e,t):e}function ZV(e,t,r){return de(e,r?.prototype instanceof hd?fct(t):t,r)}function KV(e,t){return t===void 0?Sr(e):e instanceof t?e:t.prototype instanceof hd&&!(e instanceof hd)?t.from(e,iN):t.from(e)}function fct(e){return(t,r)=>iN(e(t,r))}var xu=[null],nN=e=>t=>t[e],nr={transform:si},K={transform:e=>e};var jb=()=>1,QV=()=>!0,vr=e=>e==null?e:`${e}`,Gt=e=>e==null?e:+e;var pd=e=>e?e[0]:void 0,_u=e=>e?e[1]:void 0,JV=e=>e?e[2]:void 0,en=e=>()=>e;function Rp(e){let t=+`${e}`.slice(1)/100;return(r,n)=>Kn(r,t,n)}function Pr(e){return e instanceof hd?e:de(e,iN,Float64Array)}function iN(e){return e==null?NaN:Number(e)}function tj(e){return de(e,oN)}function oN(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?$b(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function cr(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Su(e)?[void 0,e]:[e,void 0]}function Me(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function sN(e,t,r){if(e!=null)return Gr(e,t,r)}function Gr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Sr(e){return e==null||e instanceof Array||e instanceof hd?e:Array.from(e)}function de(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function wu(e,t=Array){return e instanceof t?e.slice():t.from(e)}function aN({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function cN({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Lp(e){return aN(e)||cN(e)||e.interval!==void 0}function rn(e){return e?.toString===lct}function Ma(e){return rn(e)&&(e.type!==void 0||e.domain!==void 0)}function Hi(e){return rn(e)&&typeof e.transform!="function"}function Ea(e){return Hi(e)&&e.value===void 0&&e.channel===void 0}function lN(e,t,r,n=K){return t===void 0&&r===void 0?(t=0,r=e===void 0?n:e):t===void 0?t=e===void 0?0:e:r===void 0&&(r=e===void 0?0:e),[t,r]}function br(e,t){return e===void 0&&t===void 0?[pd,_u]:[e,t]}function kn({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=cr(t)),e===void 0&&([e]=cr(r)),e}function si(e){let t=e.length,r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=n;return r}function qb(e,t){return de(t,r=>e[r],e.constructor)}function kp(e){return e.length===1?(t,r)=>e(qb(r,t)):e}function il(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function ol(e){return e!==null&&typeof e=="object"?e.valueOf():e}function LI(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 nn(e){let t;return[{transform:()=>t,label:Tn(e)},r=>t=r]}function In(e){return e==null?[e]:nn(e)}function Tn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Cp(e,t){return{transform(r){let n=e.transform(r),i=t.transform(r);return lr(n)||lr(i)?de(n,(o,s)=>new Date((+n[s]+ +i[s])/2)):de(n,(o,s)=>(+n[s]+ +i[s])/2,Float64Array)},label:e.label}}function md(e,t){let r=uN(t?.interval,t?.type);return r?de(e,r):e}function uN(e,t){let r=Up(e,t);return r&&(n=>wr(n)?r.floor(n):n)}function Up(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let r=Math.abs(e);return e<0?{floor:n=>Math.floor(n*r)/r,offset:n=>(n*r+1)/r,range:(n,i)=>_r(Math.ceil(n*r),i*r).map(o=>o/r)}:{floor:n=>Math.floor(n/r)*r,offset:n=>n+r,range:(n,i)=>_r(Math.ceil(n/r),i/r).map(o=>o*r)}}if(typeof e=="string")return(t==="time"?tN:Vb)(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 Da(e,t){if(e=Up(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function ej(e,t){if(e=Da(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function rj(e){return vu(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function vu(e){return typeof e?.range=="function"}function Fo(e){return e===void 0||Hi(e)?e:{value:e}}function nj(e){return e==null?null:{transform:t=>At(t,e,Float64Array),label:Tn(e)}}function ij(e){if(!ai(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function ai(e){return e&&typeof e[Symbol.iterator]=="function"}function kI(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function ir(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function lr(e){for(let t of e)if(t!=null)return t instanceof Date}function oj(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&$b(t)}function sj(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function sl(e){for(let t of e)if(t!=null)return typeof t=="number"}function CI(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var dct=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 Su(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)||dct.has(e))}function aj(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Ie(e){return e==null||al(e)}function al(e){return/^\s*none\s*$/i.test(e)}function cj(e){return/^\s*round\s*$/i.test(e)}function UI(e,t){return sN(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Ba(e="middle"){return UI(e,"frameAnchor")}function lj(e={},...t){let r=e;for(let n of t)for(let i in n)if(r[i]===void 0){let o=n[i];r===e?r={...r,[i]:o}:r[i]=o}return r}function hct(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,r=>{let{name:n}=r;if(n==null)throw new Error("missing name");let i=`${n}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[n,r]}))}function Yb(e){return ai(e)?hct(e):e}function PI(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Gr(e,"clip",["frame","sphere"])),e}var Ro=Symbol("position"),Zi=Symbol("color"),yd=Symbol("radius"),gd=Symbol("length"),bd=Symbol("opacity"),Pp=Symbol("symbol"),uj=Symbol("projection"),Re=new Map([["x",Ro],["y",Ro],["fx",Ro],["fy",Ro],["r",yd],["color",Zi],["opacity",bd],["symbol",Pp],["length",gd],["projection",uj]]);function fj(e){return e===Ro||e===uj}function dj(e){return e===Ro||e===yd||e===gd||e===bd}var fN=Math.sqrt(3),dN=2/fN,pct={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*dN,i=n/2;e.moveTo(0,n),e.lineTo(r,i),e.lineTo(r,-i),e.lineTo(0,-n),e.lineTo(-r,-i),e.lineTo(-r,i),e.closePath()}},hN=new Map([["asterisk",Ib],["circle",el],["cross",Tb],["diamond",Ab],["diamond2",Mb],["hexagon",pct],["plus",Eb],["square",Db],["square2",Bb],["star",Ob],["times",Tp],["triangle",Nb],["triangle2",Fb],["wye",Rb]]);function pN(e){return e&&typeof e.draw=="function"}function hj(e){return pN(e)?!0:typeof e!="string"?!1:hN.has(e.toLowerCase())}function $p(e){if(e==null||pN(e))return e;let t=hN.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function pj(e){if(e==null||pN(e))return[void 0,e];if(typeof e=="string"){let t=hN.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function on({filter:e,sort:t,reverse:r,transform:n,initializer:i,...o}={},s){if(n===void 0&&(e!=null&&(n=gN(e)),t!=null&&!Ea(t)&&(n=mN(n,xN(t))),r&&(n=mN(n,bN))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Ea(t))&&{sort:t},transform:mN(n,s)}}function Je({filter:e,sort:t,reverse:r,initializer:n,...i}={},o){return n===void 0&&(e!=null&&(n=gN(e)),t!=null&&!Ea(t)&&(n=yN(n,xN(t))),r&&(n=yN(n,bN))),{...i,...(t===null||Ea(t))&&{sort:t},initializer:yN(n,o)}}function mN(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i){return{data:r,facets:n}=e.call(this,r,n,i),t.call(this,Sr(r),n,i)}}function yN(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i,...o){let s,a,c,l,u,f;return{data:a=r,facets:c=n,channels:s}=e.call(this,r,n,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function $I(e,t){return(e.initializer!=null?Je:on)(e,t)}function mj(e,t){return $I(t,gN(e))}function gN(e){return(t,r)=>{let n=At(t,e);return{data:t,facets:r.map(i=>i.filter(o=>n[o]))}}}function yj({sort:e,...t}={}){return{...$I(t,bN),sort:Ea(e)?e:null}}function bN(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function gj({seed:e,sort:t,...r}={}){return{...$I(r,bj(e==null?Math.random:ed(e))),sort:Ea(t)?t:null}}function zI(e,{sort:t,...r}={}){return{...(Hi(e)&&e.channel!==void 0?Je:$I)(r,xN(e)),sort:Ea(t)?t:null}}function xN(e){return(typeof e=="function"&&e.length!==1?mct:bj)(e)}function mct(e){return(t,r)=>{let n=(i,o)=>e(t[i],t[o]);return{data:t,facets:r.map(i=>i.slice().sort(n))}}}function bj(e){let t,r;({channel:t,value:e,order:r}={...Fo(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?fd:tn),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=tn;break;case"descending":r=fd;break;default:throw new Error(`invalid order: ${r}`)}return(i,o,s)=>{let a;if(t===void 0)a=At(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>r(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Gb(e,t){return VI(null,null,e,t)}function Tu(e={y:"count"},t={}){let{x:r=K}=t;if(r==null)throw new Error("missing channel: x");return VI(r,null,e,t)}function Au(e={x:"count"},t={}){let{y:r=K}=t;if(r==null)throw new Error("missing channel: y");return VI(null,r,e,t)}function Xb(e={fill:"count"},t={}){let{x:r,y:n}=t;if([r,n]=br(r,n),r==null)throw new Error("missing channel: x");if(n==null)throw new Error("missing channel: y");return VI(r,n,e,t)}function VI(e,t,{data:r=YI,filter:n,sort:i,reverse:o,...s}={},a={}){s=wN(s,a),r=Sj(r,K),i=i==null?void 0:wj("sort",i,a),n=n==null?void 0:vj("filter",n,a);let[c,l]=In(e),[u,f]=In(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:b,...x}=a,[_,v]=In(d),[w]=cr(h),[I]=cr(p),[E,T]=In(w),[B,A]=In(I);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:E||h},..."stroke"in a&&{stroke:B||p},...on(x,(O,L,S)=>{let M=md(At(O,e),S?.x),D=md(At(O,t),S?.y),C=At(O,d),U=At(O,w),k=At(O,I),$=Hb(s,{z:C,fill:U,stroke:k}),z=[],V=[],Q=M&&l([]),st=D&&f([]),ct=C&&v([]),ut=U&&T([]),X=k&&A([]),lt=0;for(let q of s)q.initialize(O);i&&i.initialize(O),n&&n.initialize(O);for(let q of L){let tt=[];for(let at of s)at.scope("facet",q);i&&i.scope("facet",q),n&&n.scope("facet",q);for(let[at,j]of Iu(q,$))for(let[Jt,gt]of Iu(j,D))for(let[he,ye]of Iu(gt,M)){let nt={data:O};if(M&&(nt.x=he),D&&(nt.y=Jt),$&&(nt.z=at),!(n&&!n.reduce(ye,nt))){tt.push(lt++),V.push(r.reduceIndex(ye,O,nt)),M&&Q.push(he),D&&st.push(Jt),C&&ct.push($===C?at:C[ye[0]]),U&&ut.push($===U?at:U[ye[0]]),k&&X.push($===k?at:k[ye[0]]);for(let Ee of s)Ee.reduce(ye,nt);i&&i.reduce(ye,nt)}}z.push(tt)}return vN(z,i,o),{data:V,facets:z}}),...!Oa(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!Oa(s,"y")&&(u?{y:u}:{y1:g,y2:b}),...Object.fromEntries(s.map(({name:O,output:L})=>[O,L]))}}function Oa(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function _N(e,t,r=jI){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",wct]),t.href!=null&&e.href===void 0&&n.push(["href",WI]),n.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?yct(i):r(i,o,t))}function jI(e,t,r,n=qI){let i;rn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=n(e,t,r),[s,a]=nn(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 yct(e){return{name:e,initialize(){},scope(){},reduce(){}}}function qI(e,t,r,n=zp){let i=LI(e,r),o=n(t,i),s,a;return{label:Tn(o===Wb?null:i,o.label),initialize(c){s=i===void 0?c:At(c,i),o.scope==="data"&&(a=o.reduceIndex(si(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 Iu(e,t){return t?Zr(e,r=>t[r]):[[,e]]}function zp(e,t,r=gct){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&rn(e))return xct(e);if(typeof e=="function")return _ct(e);if(/^p\d{2}$/i.test(e))return cl(Rp(e));switch(`${e}`.toLowerCase()){case"first":return WI;case"last":return vct;case"identity":return YI;case"count":return Wb;case"distinct":return Sct;case"sum":return t==null?Wb:Ict;case"proportion":return _j(t,"data");case"proportion-facet":return _j(t,"facet");case"deviation":return cl(vo);case"min":return cl(Ne);case"min-index":return cl(Tv);case"max":return cl(me);case"max-index":return cl(Iv);case"mean":return xj(Cc);case"median":return xj(ms);case"variance":return cl(Jl);case"mode":return cl(jh)}return r(e)}function gct(e){throw new Error(`invalid reduce: ${e}`)}function wN(e,t){return _N(e,t,wj)}function wj(e,t,r){return jI(e,t,r,vj)}function vj(e,t,r){return qI(e,t,r,Sj)}function Sj(e,t){return zp(e,t,bct)}function bct(e){switch(`${e}`.toLowerCase()){case"x":return Tct;case"y":return Act;case"z":return SN}throw new Error(`invalid group reduce: ${e}`)}function Hb(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(i=>i.name===r))return n}}function vN(e,t,r){if(t){let n=t.output.transform(),i=(o,s)=>tn(n[o],n[s]);e.forEach(o=>o.sort(i))}r&&e.forEach(n=>n.reverse())}function xct(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function _ct(e){return{reduceIndex(t,r,n){return e(qb(r,t),n)}}}function cl(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function xj(e){return{reduceIndex(t,r){let n=e(t,i=>r[i]);return lr(r)?new Date(n):n}}}var YI={reduceIndex(e,t){return qb(t,e)}},WI={reduceIndex(e,t){return t[e[0]]}},wct={reduceIndex(e,t){let n=Lc(ps(e,o=>o.length,o=>t[o]),_u),i=n.slice(-5).reverse();if(i.length<n.length){let o=n.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,_n(o,_u)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
25
- `)}},vct={reduceIndex(e,t){return t[e[e.length-1]]}},Wb={label:"Frequency",reduceIndex(e){return e.length}},Sct={label:"Distinct",reduceIndex(e,t){let r=new Zn;for(let n of e)r.add(t[n]);return r.size}},Ict=cl(_n);function _j(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,i=1)=>r.length/i}:{scope:t,reduceIndex:(r,n,i=1)=>_n(r,o=>n[o])/i}}var Tct={reduceIndex(e,t,{x:r}){return r}},Act={reduceIndex(e,t,{y:r}){return r}},SN={reduceIndex(e,t,{z:r}){return r}};function Ij(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,r,{data:n}){return r[t.find(i=>e(n[i],i,n))]}}}function Vp(e,{scale:t,type:r,value:n,filter:i,hint:o,label:s=Tn(n)},a){return o===void 0&&typeof n?.transform=="function"&&(o=n.hint),TN(a,{scale:t,type:r,value:At(e,n),label:s,filter:i,hint:o})}function GI(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Vp(t,n,r)]))}function jp(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[n,s==null?o:de(o,s)]}));return r.channels=e,r}function TN(e,t){let{scale:r,value:n}=t;if(r===!0||r==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=r!==!0&&CI(n,Su)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&CI(n,aj)?null:"opacity";break;case"symbol":r!==!0&&CI(n,hj)?(t.scale=null,t.value=de(n,$p)):t.scale="symbol";break;default:t.scale=Re.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!Re.has(r))throw new Error(`unknown scale: ${r}`);return t}function Aj(e,t,r,n,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!Re.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=Fo(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?Ej:Mj:Dct(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?Ect(t,n[l]):Mct(r,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[b=0,x=1/0]=ai(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let _=Array.from(new Zn(g));return d&&(_=_.reverse()),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_};else{let _=u==="data"?e:u==="height"?Tj(r,"y1","y2"):u==="width"?Tj(r,"x1","x2"):IN(r,u,u==="y"?"y2":u==="x"?"x2":void 0),v=zp(h===!0?"max":h,_);y.domain=()=>{let w=QD(si(g),I=>v.reduceIndex(I,_),I=>g[I]);return f&&w.sort(f),d&&w.reverse(),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w.map(pd)}}}}function Mct(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function Ect(e,t){let r=e.original;if(r===e)return t;let n=t.value,i=t.value=[];for(let o=0;o<r.length;++o){let s=n[r[o][0]];for(let a of e[o])i[a]=s}return t}function Tj(e,t,r){let n=IN(e,t),i=IN(e,r);return de(i,(o,s)=>Math.abs(o-n[s]),Float64Array)}function IN(e,t,r){let n=e[t];if(!n&&r!==void 0&&(n=e[r]),n)return n.value;throw new Error(`missing channel: ${t}`)}function Dct(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return Mj;case"descending":return Ej}throw new Error(`invalid order: ${e}`)}function Mj([e,t],[r,n]){return tn(t,n)||tn(e,r)}function Ej([e,t],[r,n]){return fd(t,n)||tn(e,r)}function Zb(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}function Mu(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:PI(r)}}function pt(e,{document:t}){return ce(Pc(e).call(t.documentElement))}var AN=0,MN;function Dj(){let e=AN;return AN=0,MN=void 0,e}function Cn(e){e!==MN&&(MN=e,console.warn(e),++AN)}var Oj=Math.PI,ll=2*Oj,Bj=.618;function Nj({projection:e,inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(rn(e)){let v;if({type:e,domain:c,inset:v,insetTop:r=v!==void 0?v:r,insetRight:n=v!==void 0?v:n,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=Fj(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,y=u-d-h-o-n,g=f-p-m-r-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=Bct(l,d,p,u-h,f-m);let b=d+o,x=p+r,_;if(c!=null){let[[v,w],[I,E]]=vn(e).bounds(c),T=Math.min(y/(I-v),g/(E-w));T>0?(b-=(T*(v+I)-y)/2,x-=(T*(w+E)-g)/2,_=Jf({point(B,A){this.stream.point(B*T+b,A*T+x)}})):Cn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=b===0&&x===0?Rj():Jf({point(v,w){this.stream.point(v+b,w+x)}}),{stream:v=>e.stream(_.stream(l(v)))}}function Fj(e){switch(`${e}`.toLowerCase()){case"albers-usa":return xs(IB,.7463,.4673);case"albers":return XI(K0,.7463,.4673);case"azimuthal-equal-area":return xs(AB,4,4);case"azimuthal-equidistant":return xs(EB,ll,ll);case"conic-conformal":return XI(OB,ll,ll);case"conic-equal-area":return XI(uu,6.1702,2.9781);case"conic-equidistant":return XI(FB,7.312,3.6282);case"equal-earth":return xs(LB,5.4133,2.6347);case"equirectangular":return xs(NB,ll,Oj);case"gnomonic":return xs(CB,3.4641,3.4641);case"identity":return{type:Rj};case"reflect-y":return{type:Oct};case"mercator":return xs(DB,ll,ll);case"orthographic":return xs(PB,2,2);case"stereographic":return xs(zB,2,2);case"transverse-mercator":return xs(jB,ll,ll);default:throw new Error(`unknown projection type: ${e}`)}}function Bct(e,t,r,n,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return cp(t,r,n,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function xs(e,t,r){return{type:({width:n,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),c.scale(Math.min(n/t,i/r)),c.translate([n/2,i/2]),c},aspectRatio:r/t}}function XI(e,t,r){let{type:n,aspectRatio:i}=xs(e,t,r);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=n(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var Rj=en({stream:e=>e}),Oct=en(Jf({point(e,t){this.stream.point(e,-t)}}));function EN(e,t,r,n){let i=r[e],o=r[t],s=i.length,a=r[e]=new Float64Array(s).fill(NaN),c=r[t]=new Float64Array(s).fill(NaN),l,u=n.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function Lj({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(rn(e)&&(e=e.type),e!=null)}function kj(e){if(typeof e?.stream=="function")return Bj;if(rn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=Fj(e);if(t)return t}return Bj}}function Eu(e,t,{projection:r}){let{x:n,y:i}=e,o={};return n&&(o.x=n),i&&(o.y=i),o=jp(o,t),r&&n?.scale==="x"&&i?.scale==="y"&&EN("x","y",o,r),n&&(o.x=Pr(o.x)),i&&(o.y=Pr(o.y)),o}function Cj(e){let t=[],r=[],n={scale:"x",value:t},i={scale:"y",value:r},o={point(s,a){t.push(s),r.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)Yi(s,o);return[n,i]}var Vj=new Map([["accent",hO],["category10",dO],["dark2",pO],["observable10",mO],["paired",yO],["pastel1",gO],["pastel2",bO],["set1",xO],["set2",_O],["set3",wO],["tableau10",vO]]);function jj(e){return e!=null&&Vj.has(`${e}`.toLowerCase())}var Uj=new Map([...Vj,["brbg",ul(uS,fS)],["prgn",ul(dS,hS)],["piyg",ul(pS,mS)],["puor",ul(yS,gS)],["rdbu",ul(_b,_p)],["rdgy",ul(bS,xS)],["rdylbu",ul(wb,wp)],["rdylgn",ul(_S,wS)],["spectral",ul(vS,SS)],["burd",Pj(_b,_p)],["buylrd",Pj(wb,wp)],["blues",sn(XS,HS)],["greens",sn(ZS,KS)],["greys",sn(QS,JS)],["oranges",sn(iI,oI)],["purples",sn(tI,eI)],["reds",sn(rI,nI)],["turbo",fl(pI)],["viridis",fl(yI)],["magma",fl(gI)],["inferno",fl(bI)],["plasma",fl(xI)],["cividis",fl(sI)],["cubehelix",fl(aI)],["warm",fl(lI)],["cool",fl(uI)],["bugn",sn(IS,TS)],["bupu",sn(AS,MS)],["gnbu",sn(ES,DS)],["orrd",sn(BS,OS)],["pubu",sn(RS,LS)],["pubugn",sn(NS,FS)],["purd",sn(kS,CS)],["rdpu",sn(US,PS)],["ylgn",sn(VS,jS)],["ylgnbu",sn($S,zS)],["ylorbr",sn(qS,YS)],["ylorrd",sn(WS,GS)],["rainbow",$j(fI)],["sinebow",$j(hI)]]);function sn(e,t){return({length:r})=>r===1?[e[3][1]]:r===2?[e[3][1],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>9?Bn(t,r):e[r])}function ul(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?Bn(t,r):e[r])}function Pj(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?Bn(n=>t(1-n),r):e[r].slice().reverse())}function fl(e){return({length:t})=>Bn(e,Math.max(2,Math.floor(t)))}function $j(e){return({length:t})=>Bn(e,Math.floor(t)+1).slice(0,-1)}function DN(e){let t=`${e}`.toLowerCase();if(!Uj.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return Uj.get(t)}function Kb(e,t){let r=DN(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function qj(e,t="greys"){let r=new Set,[n,i]=Kb(t,2);for(let o of e)if(o!=null)if(o===!0)r.add(i);else if(o===!1)r.add(n);else return;return[...r]}var zj=new Map([["brbg",fS],["prgn",hS],["piyg",mS],["puor",gS],["rdbu",_p],["rdgy",xS],["rdylbu",wp],["rdylgn",wS],["spectral",SS],["burd",e=>_p(1-e)],["buylrd",e=>wp(1-e)],["blues",HS],["greens",KS],["greys",JS],["purples",eI],["reds",nI],["oranges",oI],["turbo",pI],["viridis",yI],["magma",gI],["inferno",bI],["plasma",xI],["cividis",sI],["cubehelix",aI],["warm",lI],["cool",uI],["bugn",TS],["bupu",MS],["gnbu",DS],["orrd",OS],["pubugn",FS],["pubu",LS],["purd",CS],["rdpu",PS],["ylgnbu",zS],["ylgn",jS],["ylorbr",YS],["ylorrd",GS],["rainbow",fI],["sinebow",hI]]);function qp(e){let t=`${e}`.toLowerCase();if(!zj.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return zj.get(t)}var Nct=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function Yj(e){return e!=null&&Nct.has(`${e}`.toLowerCase())}var ON=e=>t=>e(1-t),BN=[0,1],Wj=new Map([["number",Ke],["rgb",Io],["hsl",I3],["hcl",T3],["lab",Gv]]);function NN(e){let t=`${e}`.toLowerCase();if(!Wj.has(t))throw new Error(`unknown interpolator: ${t}`);return Wj.get(t)}function Wp(e,t,r,{type:n,nice:i,clamp:o,zero:s,domain:a=tq(e,r),unknown:c,round:l,scheme:u,interval:f,range:d=Re.get(e)===yd?kct(r,a):Re.get(e)===gd?Cct(r,a):Re.get(e)===bd?BN:void 0,interpolate:h=Re.get(e)===Zi?u==null&&d!==void 0?Io:qp(u!==void 0?u:n==="cyclical"?"rainbow":"turbo"):l?qf:Ke,reverse:p}){if(f=Da(f,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof h!="function"&&(h=NN(h)),p=!!p,d!==void 0){let m=(a=Sr(a)).length,y=(d=Sr(d)).length;if(m!==y){if(h.length===1)throw new Error("invalid piecewise interpolator");h=fa(h,d),d=void 0}}if(h.length===1?(p&&(h=ON(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=BN)),t.interpolate((d===BN?en:Qb)(h))):t.interpolate(h),s){let[m,y]=Oe(a);(m>0||y<0)&&(a=wu(a),nl(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=eu(a)),t.domain(a).unknown(c),i&&(t.nice(Fct(i,n)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:n,domain:a,range:d,scale:t,interpolate:h,interval:f}}function Fct(e,t){return e===!0?void 0:typeof e=="number"?e:ej(e,t)}function Gj(e,t,r){return Wp(e,Gc(),t,r)}function Xj(e,t,r){return FN(e,t,{...r,exponent:.5})}function FN(e,t,{exponent:r=1,...n}){return Wp(e,lb().exponent(r),t,{...n,type:"pow"})}function Hj(e,t,{base:r=10,domain:n=Uct(t),...i}){return Wp(e,ab().base(r),t,{...i,domain:n})}function Zj(e,t,{constant:r=1,...n}){return Wp(e,cb().constant(r),t,n)}function Kj(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:i=n,scheme:o="rdylbu",domain:s=Pct(t),unknown:a,interpolate:c,reverse:l}){return r===void 0&&(r=c!==void 0?Bn(c,i):Re.get(e)===Zi?Kb(o,i):void 0),s.length>0&&(s=ub(s,r===void 0?{length:i}:r).quantiles()),HI(e,t,{domain:s,range:r,reverse:l,unknown:a})}function Qj(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:i="rdylbu",domain:o=tq(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=Oe(o),f;return r===void 0?(f=xn(l,u,n),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),n=f.length+1,r=a!==void 0?Bn(a,n):Re.get(e)===Zi?Kb(i,n):void 0):(f=Bn(Ke(l,u),n+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),nl(Sr(o))<0&&f.reverse(),HI(e,t,{domain:f,range:r,reverse:c,unknown:s})}function HI(e,t,{domain:r=[0],unknown:n,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Bn(o,r.length+1):Re.get(e)===Zi?Kb(i,r.length+1):void 0,reverse:a}){r=Sr(r);let c=nl(r);if(!isNaN(c)&&!Rct(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=eu(s)),{type:"threshold",scale:fb(c<0?eu(r):r,s===void 0?[]:s).unknown(n),domain:r,range:s}}function Rct(e,t){for(let r=1,n=e.length,i=e[0];r<n;++r){let o=Xn(i,i=e[r]);if(o!==0&&o!==t)return!1}return!0}function Jj(e){return{type:"identity",scale:dj(Re.get(e))?ob():t=>t}}function Yp(e,t=Dp){return e.length?[Ne(e,({value:r})=>r===void 0?r:Ne(r,t)),me(e,({value:r})=>r===void 0?r:me(r,t))]:[0,1]}function tq(e,t){let r=Re.get(e);return(r===yd||r===bd||r===gd?Lct:Yp)(t)}function Lct(e){return[0,e.length?me(e,({value:t})=>t===void 0?t:me(t,Dp)):1]}function kct(e,t){let r=e.find(({radius:s})=>s!==void 0);if(r!==void 0)return[0,r.radius];let n=Kn(e,.5,({value:s})=>s===void 0?NaN:Kn(s,.25,oi)),i=t.map(s=>3*Math.sqrt(s/n)),o=30/me(i);return o<1?i.map(s=>s*o):i}function Cct(e,t){let r=ms(e,({value:o})=>o===void 0?NaN:ms(o,Math.abs)),n=t.map(o=>12*o/r),i=60/me(n);return i<1?n.map(o=>o*i):n}function Uct(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Yp(e,oi);if(r<0)return Yp(e,mu)}return[1,10]}function Pct(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function Qb(e){return(t,r)=>n=>e(t+n*(r-t))}function ZI(e,t,r,n,{type:i,nice:o,clamp:s,domain:a=Yp(n),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=Re.get(e)===Zi?u==null&&f!==void 0?Io:qp(u!==void 0?u:"rdbu"):Ke,reverse:p}){l=+l,a=Sr(a);let[m,y]=a;if(a.length>2&&Cn(`Warning: the diverging ${e} scale domain contains extra elements.`),Xn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=NN(h)),f!==void 0&&(h=h.length===1?Qb(h)(...f):fa(h,f)),p&&(h=ON(h)),d){let g=r.apply(l),b=g-r.apply(m),x=r.apply(y)-g;b<x?m=r.invert(g-x):b>x&&(y=r.invert(g+b))}return t.domain([m,l,y]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:h,scale:t}}function eq(e,t,r){return ZI(e,xb(),$ct,t,r)}function rq(e,t,r){return RN(e,t,{...r,exponent:.5})}function RN(e,t,{exponent:r=1,...n}){return ZI(e,lS().exponent(r=+r),jct(r),t,{...n,type:"diverging-pow"})}function nq(e,t,{base:r=10,pivot:n=1,domain:i=Yp(t,n<0?mu:oi),...o}){return ZI(e,aS().base(r=+r),zct,t,{domain:i,pivot:n,...o})}function iq(e,t,{constant:r=1,...n}){return ZI(e,cS().constant(r=+r),qct(r),t,n)}var $ct={apply(e){return e},invert(e){return e}},zct={apply:Math.log,invert:Math.exp},Vct={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function jct(e){return e===.5?Vct:{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 qct(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 oq(e,t,r,n){return Wp(e,t,r,n)}function sq(e,t,r){return oq(e,iS(),t,r)}function aq(e,t,r){return oq(e,oS(),t,r)}var Gp=Symbol("ordinal");function lq(e,t,r,{type:n,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Da(i,n),o===void 0&&(o=pq(r,i,e)),(n==="categorical"||n===Gp)&&(n="ordinal"),a&&(o=eu(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:n,domain:o,range:s,scale:t,hint:c,interval:i}}function uq(e,t,{type:r,interval:n,domain:i,range:o,scheme:s,unknown:a,...c}){n=Da(n,r),i===void 0&&(i=pq(t,n,e));let l;if(Re.get(e)===Pp)l=Yct(t),o=o===void 0?Wct(l):de(o,$p);else if(Re.get(e)===Zi&&(o===void 0&&(r==="ordinal"||r===Gp)&&(o=qj(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=r==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=qp(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Bn(p=>u(f+d*p),h)}else o=DN(s);if(a===nb)throw new Error(`implicit unknown on ${e} scale is not supported`);return lq(e,rd().unknown(a),t,{...c,type:r,domain:i,range:o,hint:l})}function fq(e,t,{align:r=.5,padding:n=.5,...i}){return hq(ZB().align(r).padding(n),t,i,e)}function dq(e,t,{align:r=.5,padding:n=.1,paddingInner:i=n,paddingOuter:o=e==="fx"||e==="fy"?0:n,...s}){return hq(du().align(r).paddingInner(i).paddingOuter(o),t,s,e)}function hq(e,t,r,n){let{round:i}=r;return i!==void 0&&e.round(i=!!i),e=lq(n,e,t,r),e.round=i,e}function pq(e,t,r){let n=new Zn;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)n.add(s)}if(t!==void 0){let[i,o]=Oe(n).map(t.floor,t);return t.range(i,t.offset(o))}if(n.size>1e4&&Re.get(r)===Ro)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Lc(n,tn)}function cq(e,t){let r;for(let{hint:n}of e){let i=n?.[t];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}function Yct(e){return{fill:cq(e,"fill"),stroke:cq(e,"stroke")}}function Wct(e){return Ie(e.fill)?DO:TI}function Jb(e,{label:t,inset:r=0,insetTop:n=r,insetRight:i=r,insetBottom:o=r,insetLeft:s=r,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let y={};for(let[g,b]of e){let x=m[g],_=vq(g,b,{round:Re.get(g)===Ro?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=g==="fx"||g==="fy"?p:t,percent:w,transform:I,inset:E,insetTop:T=E!==void 0?E:g==="y"?n:0,insetRight:B=E!==void 0?E:g==="x"?i:0,insetBottom:A=E!==void 0?E:g==="y"?o:0,insetLeft:O=E!==void 0?E:g==="x"?s:0}=x||{};if(I==null)I=void 0;else if(typeof I!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?Gct(b,_):v,_.transform=I,g==="x"||g==="fx"?(_.insetLeft=+O,_.insetRight=+B):(g==="y"||g==="fy")&&(_.insetTop=+T,_.insetBottom=+A),y[g]=_}}return y}function kN(e){let t={},r={scales:t};for(let[n,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[n]=Iq(i),r[n]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return r}function xq(e,t){let{x:r,y:n,fx:i,fy:o}=e,s=i||o?JI(t):t;i&&mq(i,s),o&&yq(o,s);let a=i||o?CN(e,t):t;r&&mq(r,a),n&&yq(n,a)}function Gct(e=[],t){let r;for(let{label:n}of e)if(n!==void 0){if(r===void 0)r=n;else if(r!==n)return}if(r!==void 0)return!Na(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function QI(e){return Math.sign(nl(e.domain()))*Math.sign(nl(e.range()))}function JI(e){let{marginTop:t,marginRight:r,marginBottom:n,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(r,c),marginBottom:Math.max(n,l),marginLeft:Math.max(i,u),width:o,height:s}}function CN({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=JI(r);return{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+n+o:c,facet:{width:a,height:c}}}function mq(e,t){if(e.range===void 0){let{insetLeft:r,insetRight:n}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+r,c=i-s-n;e.range=[a,Math.max(a,c)],Na(e)||(e.range=wq(e)),e.scale.range(e.range)}_q(e)}function yq(e,t){if(e.range===void 0){let{insetTop:r,insetBottom:n}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+r,c=i-s-n;e.range=[Math.max(a,c),a],Na(e)?e.range.reverse():e.range=wq(e),e.scale.range(e.range)}_q(e)}function _q(e){e.round===void 0&&Zct(e)&&Xct(e)<=30&&e.scale.round(!0)}function Xct({scale:e}){let t=e.domain().length,[r,n]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(n-r)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function wq(e){let t=e.scale.domain().length+UN(e);if(!(t>2))return e.range;let[r,n]=e.range;return Array.from({length:t},(i,o)=>r+o/(t-1)*(n-r))}function tT(e,t,r){return vq(e,r===void 0?void 0:[{hint:r}],{...t})}function vq(e,t=[],r={}){let n=Hct(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&Na({type:n})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(lr)?Cn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Xp(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Xp(n)}".`):i.some(oj)?Cn(`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 "${Xp(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Xp(n)}".`):i.some(sj)&&Cn(`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 "${Xp(n)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Xp(n)}".`)}switch(r.type=n,n){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":r=KI(t,r,Pr);break;case"identity":switch(Re.get(e)){case Ro:r=KI(t,r,Pr);break;case Pp:r=KI(t,r,Kct);break}break;case"utc":case"time":r=KI(t,r,tj);break}switch(n){case"diverging":return eq(e,t,r);case"diverging-sqrt":return rq(e,t,r);case"diverging-pow":return RN(e,t,r);case"diverging-log":return nq(e,t,r);case"diverging-symlog":return iq(e,t,r);case"categorical":case"ordinal":case Gp:return uq(e,t,r);case"cyclical":case"sequential":case"linear":return Gj(e,t,r);case"sqrt":return Xj(e,t,r);case"threshold":return HI(e,t,r);case"quantile":return Kj(e,t,r);case"quantize":return Qj(e,t,r);case"pow":return FN(e,t,r);case"log":return Hj(e,t,r);case"symlog":return Zj(e,t,r);case"utc":return aq(e,t,r);case"time":return sq(e,t,r);case"point":return fq(e,t,r);case"band":return dq(e,t,r);case"identity":return Jj(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Xp(e){return typeof e=="symbol"?e.description:e}function gq(e){return typeof e=="string"?`${e}`.toLowerCase():e}var bq={toString:()=>"projection"};function Hct(e,t,{type:r,domain:n,range:i,scheme:o,pivot:s,projection:a}){if(r=gq(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(r=bq);for(let l of t){let u=gq(l.type);if(u!==void 0){if(r===void 0)r=u;else if(r!==u)throw new Error(`scale incompatible with channel: ${r} !== ${u}`)}}if(r===bq)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=Re.get(e);if(c===yd)return"sqrt";if(c===bd||c===gd)return"linear";if(c===Pp)return"ordinal";if((n||i||[]).length>2)return LN(c);if(n!==void 0){if(ir(n))return LN(c);if(lr(n))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(ir))return LN(c);if(l.some(lr))return"utc"}if(c===Zi){if(s!=null||Yj(o))return"diverging";if(jj(o))return"categorical"}return"linear"}function LN(e){switch(e){case Ro:return"point";case Zi:return Gp;default:return"ordinal"}}function Na({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Gp}function UN({type:e}){return e==="threshold"}function Zct({type:e}){return e==="point"||e==="band"}function ci(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,i=t.length;n<i;++n)if(e(t[n])-r)return!1;return!0}function KI(e,{domain:t,...r},n){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=n(i.value));return{domain:t===void 0?t:n(t),...r}}function Kct(e){return de(e,$p)}function Du(e={}){let t;for(let r in e)if(Re.has(r)&&Ma(e[r])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Iq(tT(r,e[r]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function Sq(e){return t=>{if(!Re.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Iq({scale:e,type:t,domain:r,range:n,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:wu(r),...n!==void 0&&{range:wu(n)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function eT(e){let t,r;return(...n)=>((r?.length!==n.length||r.some((i,o)=>i!==n[o]))&&(r=n,t=e(...n)),t)}var Qct=eT(e=>new Intl.NumberFormat(e)),Jct=eT((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),tlt=eT((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function elt(e="en-US"){let t=Qct(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function Tq(e="en-US",t="short"){let r=Jct(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2e3,+n)))?r.format(n):void 0}function Aq(e="en-US",t="short"){let r=tlt(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2001,0,+n)))?r.format(n):void 0}function PN(e){return Bp(e,"Invalid Date")}function rlt(e="en-US"){let t=elt(e);return r=>(r instanceof Date?PN:typeof r=="number"?t:vr)(r)}var _s=rlt();var ur=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,nlt=0;function rT(){return`plot-clip-${++nlt}`}function nT(e,{title:t,href:r,ariaLabel:n,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:b,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:I},{ariaLabel:E,fill:T="currentColor",fillOpacity:B,stroke:A="none",strokeOpacity:O,strokeWidth:L,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:D,paintOrder:C}){T===null&&(a=null,c=null),A===null&&(l=null,f=null),Ie(T)?!Ie(A)&&(!Ie(a)||I?.fill)&&(A="none"):Ie(A)&&(!Ie(l)||I?.stroke)&&(T="none");let[U,k]=cr(a,T),[$,z]=Me(c,B),[V,Q]=cr(l,A),[st,ct]=Me(f,O),[ut,X]=Me(g);al(Q)||(u===void 0&&(u=L),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!cj(d)&&(p=D),!al(k)&&_===void 0&&(_=C));let[lt,q]=Me(u);return T!==null&&(e.fill=Fe(k,"currentColor"),e.fillOpacity=tx(z,1)),A!==null&&(e.stroke=Fe(Q,"none"),e.strokeWidth=tx(q,1),e.strokeOpacity=tx(ct,1),e.strokeLinejoin=Fe(d,"miter"),e.strokeLinecap=Fe(h,"butt"),e.strokeMiterlimit=tx(p,4),e.strokeDasharray=Fe(m,"none"),e.strokeDashoffset=Fe(y,"0")),e.target=vr(s),e.ariaLabel=vr(E),e.ariaDescription=vr(i),e.ariaHidden=vr(o),e.opacity=tx(X,1),e.mixBlendMode=Fe(b,"normal"),e.imageFilter=Fe(x,"none"),e.paintOrder=Fe(_,"normal"),e.pointerEvents=Fe(v,"auto"),e.shapeRendering=Fe(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:U,scale:"auto",optional:!0},fillOpacity:{value:$,scale:"auto",optional:!0},stroke:{value:V,scale:"auto",optional:!0},strokeOpacity:{value:st,scale:"auto",optional:!0},strokeWidth:{value:lt,optional:!0},opacity:{value:ut,scale:"auto",optional:!0}}}function ilt(e,t){t&&e.filter(r=>Pb(t[r])).append("title").call(slt,t)}function olt(e,t){t&&e.filter(([r])=>Pb(t[r])).append("title").call(alt,t)}function slt(e,t){t&&e.text(r=>_s(t[r]))}function alt(e,t){t&&e.text(([r])=>_s(t[r]))}function ge(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&yt(e,"aria-label",d=>n[d]),o&&yt(e,"fill",d=>o[d]),s&&yt(e,"fill-opacity",d=>s[d]),a&&yt(e,"stroke",d=>a[d]),c&&yt(e,"stroke-opacity",d=>c[d]),l&&yt(e,"stroke-width",d=>l[d]),u&&yt(e,"opacity",d=>u[d]),f&&Mq(e,d=>f[d],t),r||ilt(e,i)}function xd(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&yt(e,"aria-label",([d])=>n[d]),o&&yt(e,"fill",([d])=>o[d]),s&&yt(e,"fill-opacity",([d])=>s[d]),a&&yt(e,"stroke",([d])=>a[d]),c&&yt(e,"stroke-opacity",([d])=>c[d]),l&&yt(e,"stroke-width",([d])=>l[d]),u&&yt(e,"opacity",([d])=>u[d]),f&&Mq(e,([d])=>f[d],t),r||olt(e,i)}function clt({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,r,n,i,o,s,a,c].filter(u=>u!==void 0)}function ex(e,t,r){let n=Zr(e,i=>t[i]);return r===void 0&&n.size>1+e.length>>1&&Cn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),n.values()}function*iT(e,t,r,n){let{z:i}=r,{z:o}=n,s=clt(n,r),a=[...t,...s];for(let c of o?ex(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!wr(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>ol(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(ol(s[d][f])!==l[d]){yield u,l=s.map(p=>ol(p[f])),u=[f];continue t}}u&&(yield u)}}function llt(e,t,r,n){let i,{clip:o=n.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=r,d=rT();i=`url(#${d})`,e=pt("svg:g",n).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}=n;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=rT();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",vn(s)({type:"Sphere"}));break}}yt(e,"aria-label",t.ariaLabel),yt(e,"aria-description",t.ariaDescription),yt(e,"aria-hidden",t.ariaHidden),yt(e,"clip-path",i)}function Qt(e,t,r,n){llt(e,t,r,n),yt(e,"fill",t.fill),yt(e,"fill-opacity",t.fillOpacity),yt(e,"stroke",t.stroke),yt(e,"stroke-width",t.strokeWidth),yt(e,"stroke-opacity",t.strokeOpacity),yt(e,"stroke-linejoin",t.strokeLinejoin),yt(e,"stroke-linecap",t.strokeLinecap),yt(e,"stroke-miterlimit",t.strokeMiterlimit),yt(e,"stroke-dasharray",t.strokeDasharray),yt(e,"stroke-dashoffset",t.strokeDashoffset),yt(e,"shape-rendering",t.shapeRendering),yt(e,"filter",t.imageFilter),yt(e,"paint-order",t.paintOrder);let{pointerEvents:i=n.pointerSticky===!1?"none":void 0}=t;yt(e,"pointer-events",i)}function Xt(e,t){ult(e,"mix-blend-mode",t.mixBlendMode),yt(e,"opacity",t.opacity)}function Mq(e,t,r){e.each(function(n){let i=t(n);if(i!=null){let o=this.ownerDocument.createElementNS(So.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(So.xlink,"href",i),r!=null&&o.setAttribute("target",r),this.parentNode.insertBefore(o,this).appendChild(this)}})}function yt(e,t,r){r!=null&&e.attr(t,r)}function ult(e,t,r){r!=null&&e.style(t,r)}function Pt(e,t,{x:r,y:n},i=ur,o=ur){i+=t.dx,o+=t.dy,r?.bandwidth&&(i+=r.bandwidth()/2),n?.bandwidth&&(o+=n.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function Fe(e,t){if((e=vr(e))!==t)return e}function tx(e,t){if((e=Gt(e))!==t)return e}var flt=/^-?([_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 Hp(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!flt.test(e))throw new Error(`invalid class name: ${e}`);return e}function Zp(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let r of e)Object.assign(r.style,t)}function an({frameAnchor:e},{width:t,height:r,marginTop:n,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?n:/^bottom/.test(e)?r-o:(n+r-o)/2]}function Dq(e,t,r={}){let n=.5-ur,i=.5+ur,o=.5+ur,s=.5-ur;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:b}of t)m>n&&(n=m),y>i&&(i=y),g>o&&(o=g),b>s&&(s=b);let{margin:a,marginTop:c=a!==void 0?a:n,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=r;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=dlt(e,r,{width:d,marginTopDefault:n,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-n+u-o)}=r;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:b=m!==void 0?m:u,marginLeft:x=m!==void 0?m:f}=r.facet??{};y=+y,g=+g,b=+b,x=+x,p.facet={marginTop:y,marginRight:g,marginBottom:b,marginLeft:x}}return p}function dlt({x:e,y:t,fy:r,fx:n},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=r?r.scale.domain().length:1,d=kj(i);if(d){let p=n?n.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let h=t?Na(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=Eq("y",t)/(Eq("x",e)*o),m=n?n.scale.bandwidth():1,y=r?r.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||r)*Math.max(1,Math.min(60,h*f))*20+!!n*30+60}function Eq(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:r,domain:n}=t,i;switch(r){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return n.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${r}`)}let[o,s]=Oe(n);return Math.abs(i(s)-i(o))}function Oq(e,t){let{fx:r,fy:n}=Jb(e,t),i=r?.scale.domain(),o=n?.scale.domain();return i&&o?wv(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 Nq(e,{x:t,y:r}){return t&&=qN(t),r&&=qN(r),e.filter(t&&r?n=>t.has(n.x)&&r.has(n.y):t?n=>t.has(n.x):n=>r.has(n.y)).sort(t&&r?(n,i)=>t.get(n.x)-t.get(i.x)||r.get(n.y)-r.get(i.y):t?(n,i)=>t.get(n.x)-t.get(i.x):(n,i)=>r.get(n.y)-r.get(i.y))}function sT(e,{fx:t,fy:r}){let n=si(e),i=t?.value,o=r?.value;return t&&r?ps(n,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?ps(n,s=>(s.fx=i[s[0]],s),s=>i[s]):ps(n,s=>(s.fy=o[s[0]],s),s=>o[s])}function Fq(e,t,{marginTop:r,marginLeft:n}){return e&&t?({x:i,y:o})=>`translate(${e(i)-n},${t(o)-r})`:e?({x:i})=>`translate(${e(i)-n},0)`:({y:i})=>`translate(0,${t(i)-r})`}function Rq(e){let t=[],r=new Uint32Array(_n(e,n=>n.length));for(let n of e){let i=0;for(let o of e)n!==o&&(r.set(o,i),i+=o.length);t.push(r.slice(0,i))}return t}var hlt=new Map([["top",$N],["right",jN],["bottom",zN],["left",VN],["top-left",oT($N,VN)],["top-right",oT($N,jN)],["bottom-left",oT(zN,VN)],["bottom-right",oT(zN,jN)],["top-empty",mlt],["right-empty",blt],["bottom-empty",ylt],["left-empty",glt],["empty",xlt]]);function Lq(e){if(e==null)return null;let t=hlt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var Bq=new WeakMap;function qN(e){let t=Bq.get(e);return t||Bq.set(e,t=new Hn(de(e,(r,n)=>[r,n]))),t}function Bu(e,t){return qN(e).get(t)}function plt(e,t,r){return t=ol(t),r=ol(r),e.find(n=>Object.is(ol(n.x),t)&&Object.is(ol(n.y),r))}function aT(e,t,r){return plt(e,t,r)?.empty}function $N(e,{y:t},{y:r}){return t?Bu(t,r)===0:!0}function zN(e,{y:t},{y:r}){return t?Bu(t,r)===t.length-1:!0}function VN(e,{x:t},{x:r}){return t?Bu(t,r)===0:!0}function jN(e,{x:t},{x:r}){return t?Bu(t,r)===t.length-1:!0}function mlt(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Bu(t,n);if(o>0)return aT(e,r,t[o-1])}function ylt(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Bu(t,n);if(o<t.length-1)return aT(e,r,t[o+1])}function glt(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Bu(t,r);if(o>0)return aT(e,t[o-1],n)}function blt(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Bu(t,r);if(o<t.length-1)return aT(e,t[o+1],n)}function xlt(e,t,{empty:r}){return r}function oT(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function cT(e,{channels:{fx:t,fy:r},groups:n}){return t&&r?e.map(({x:i,y:o})=>n.get(i)?.get(o)??[]):t?e.map(({x:i})=>n.get(i)??[]):e.map(({y:i})=>n.get(i)??[])}var Ft=class{constructor(t,r={},n={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:y=d,clip:g=i?.clip,channels:b,tip:x,render:_}=n;if(this.data=t,this.sort=Ea(l)?l:null,this.initializer=Je(n).initializer,this.transform=this.initializer?n.transform:on(n).transform,o===null||o===!1?this.facet=null:(this.facet=Gr(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===xu&&typeof a=="string"?[a]:a,this.fy=t===xu&&typeof c=="string"?[c]:c),this.facetAnchor=Lq(s),r=Yb(r),b!==void 0&&(r={..._lt(b),...r}),i!==void 0&&(r={...nT(this,n,i),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([v,w])=>{if(Hi(w.value)){let{value:I,label:E=w.label,scale:T=w.scale}=w.value;w={...w,label:E,scale:T,value:I}}if(t===xu&&typeof w.value=="string"){let{value:I}=w;w={...w,value:[I]}}return[v,w]}).filter(([v,{value:w,optional:I}])=>{if(w!=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=+y,this.clip=PI(g),this.tip=wlt(x),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:w}=r[v];if(!(w!=="x"&&w!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=Kp(_,this.render))}initialize(t,r,n){let i=Sr(this.data);t===void 0&&i!=null&&(t=[si(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,n),i=Sr(i)),t!==void 0&&(t.original=o);let s=GI(this.channels,i);return this.sort!=null&&Aj(i,t,s,r,this.sort),{data:i,facets:t,channels:s}}filter(t,r,n){for(let i in r){let{filter:o=wr}=r[i];if(o!==null){let s=n[i];t=t.filter(a=>o(s[a]))}}return t}project(t,r,n){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&EN(i,o,r,n.projection)}}scale(t,r,n){let i=jp(t,r);return n.projection&&this.project(t,i,n),i}};function $r(...e){return e.plot=Ft.prototype.plot,e}function Kp(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(r,n,i,o,s,a){return e.call(this,r,n,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function _lt(e){return Object.fromEntries(Object.entries(Yb(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:Fo(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function wlt(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Gr(e,"tip",["x","y","xy"]):e}function ws(e,t){return e?.tip===!0?{...e,tip:t}:rn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var kq=new WeakMap;function YN(e,t,{x:r,y:n,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(r??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(n??=null,a={...a,py:{value:o,scale:"y"}}),{x:r,y:n,channels:a,...l,render:Kp(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),b=kq.get(y);b||kq.set(y,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(Q)-1,{x:_,y:v,fx:w,fy:I}=f,E=w?w(u.fx)-h.marginLeft:0,T=I?I(u.fy)-h.marginTop:0;_?.bandwidth&&(E+=_.bandwidth()/2),v?.bandwidth&&(T+=v.bandwidth()/2);let B=u.fi!=null,A;if(B){let X=b.facetStates;X||(b.facetStates=X=new Map),A=X.get(this),A||X.set(this,A=new Map)}let[O,L]=an(this,h),{px:S,py:M}=d,D=S?X=>S[X]:WN(d,O),C=M?X=>M[X]:GN(d,L),U,k,$,z;function V(X,lt){if(B)if(z&&(z=cancelAnimationFrame(z)),X==null)A.delete(u.fi);else{A.set(u.fi,lt),z=requestAnimationFrame(()=>{z=null;for(let[q,tt]of A)if(tt<lt||tt===lt&&q<u.fi){X=null;break}Q(X)});return}Q(X)}function Q(X){if(U===X&&$===b.sticky)return;U=X,$=p.pointerSticky=b.sticky;let lt=U==null?[]:[U];B&&(lt.fx=u.fx,lt.fy=u.fy,lt.fi=u.fi);let q=m(lt,f,d,h,p);if(k){if(B){let tt=k.parentNode,at=k.getAttribute("transform"),j=q.getAttribute("transform");at?q.setAttribute("transform",at):q.removeAttribute("transform"),j?tt.setAttribute("transform",j):tt.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}k.replaceWith(q)}return b.roots[x]=k=q,U==null&&A?.size>1||p.dispatchValue(U==null?null:g[U]),q}function st(X){if(b.sticky||X.pointerType==="mouse"&&X.buttons===1)return;let[lt,q]=Dn(X);lt-=E,q-=T;let tt=lt<h.marginLeft||lt>h.width-h.marginRight?1:e,at=q<h.marginTop||q>h.height-h.marginBottom?1:t,j=null,Jt=s*s;for(let gt of u){let he=tt*(D(gt)-lt),ye=at*(C(gt)-q),nt=he*he+ye*ye;nt<=Jt&&(j=gt,Jt=nt)}if(j!=null&&(e!==1||t!==1)){let gt=D(j)-lt,he=C(j)-q;Jt=gt*gt+he*he}V(j,Jt)}function ct(X){X.pointerType==="mouse"&&U!=null&&(b.sticky&&b.roots.some(lt=>lt?.contains(X.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(lt=>lt(null))):(b.sticky=!0,Q(U)),X.stopImmediatePropagation()))}function ut(X){X.pointerType==="mouse"&&(b.sticky||V(null))}return y.addEventListener("pointerenter",st),y.addEventListener("pointermove",st),y.addEventListener("pointerdown",ct),y.addEventListener("pointerleave",ut),Q(null)},c)}}function Ou(e){return YN(1,1,e)}function Nu(e){return YN(1,.01,e)}function dl(e){return YN(.01,1,e)}function WN({x1:e,x2:t,x:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function GN({y1:e,y2:t,y:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function lT(e){return Na(e)&&e.interval===void 0?void 0:"tabular-nums"}function Cq(e,t){let{label:r=e.label,tickSize:n=6,width:i=240,height:o=44+n,marginTop:s=18,marginRight:a=0,marginBottom:c=16+n,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=lT(e),round:p=!0,opacity:m,className:y}=t,g=Mu(t);y=Hp(y),m=Me(m)[1],d===null&&(d=()=>null);let b=pt("svg",g).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${y}-ramp) {
13
+ ${n}`:e==="top"?(t,n)=>`${n}
14
+ ${t}`:(t,n)=>`${t}
15
+ ${n}`}function Met(e){return e==="time"?ov:e==="utc"?Oy:Eet}function BP(e,t,n){let r=Qt(e1(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return FP("millisecond","utc",n);for(let[i,o,s,a]of Met(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return FP(i,s,n)}}function Sd(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-ba(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var Dy=Object.getPrototypeOf(Uint8Array),Oet=Object.prototype.toString;function Rr(e){return e instanceof Array||e instanceof Dy}function $P(e){return e instanceof Dy&&!Net(e)}function UP(e){return e?.prototype instanceof Dy&&!Det(e)}function Net(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function Det(e){return e===BigInt64Array||e===BigUint64Array}var n3=Symbol("reindex");function gt(e,t,n){let r=typeof t;return r==="string"?KP(e)?r3(e.getChild(t),n):PP(e,i3(t),n):r==="function"?PP(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Wt(e,Ce(t),n):typeof t?.transform=="function"?e3(t.transform(e),n):Ret(e3(t,n),e?.[n3])}function Ret(e,t){return e!=null&&t?Ly(e,t):e}function PP(e,t,n){return Wt(e,UP(n)?(r,i)=>o3(t(r,i)):t,n)}function e3(e,t){return t===void 0?ti(e):JP(e)?r3(e,t):e instanceof t?e:t.from(e,UP(t)&&!$P(e)?o3:void 0)}function r3(e,t){return e==null?e:(t===void 0||t===Array)&&ket(e.type)?s3(e.toArray()):e3(e.toArray(),t)}var Dc=[null],i3=e=>t=>{let n=t[e];return n===void 0&&t.type==="Feature"?t.properties?.[e]:n},ye={transform:yr},X={transform:e=>e};var Ry=()=>1,zP=()=>!0,Ye=e=>e==null?e:`${e}`,ee=e=>e==null?e:+e;var xu=e=>e?e[0]:void 0,Rc=e=>e?e[1]:void 0,jP=e=>e?e[2]:void 0,Ce=e=>()=>e;function Ed(e){let t=+`${e}`.slice(1)/100;return(n,r)=>sr(n,t,r)}function nn(e){return $P(e)?e:Wt(e,o3,Float64Array)}function o3(e){return e==null?NaN:Number(e)}function s3(e){return Wt(e,a3)}function a3(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?My(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function Fe(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Cc(e)?[void 0,e]:[e,void 0]}function ae(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function c3(e,t,n){if(e!=null)return un(e,t,n)}function un(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function wa(e){return KP(e)?e:ti(e)}function ti(e){if(e==null||Rr(e))return e;if(JP(e))return r3(e);switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[e]}return Array.from(e)}function Wt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Lc(e,t=Array){return e instanceof t?e.slice():t.from(e)}function l3({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function u3({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function _a(e){return l3(e)||u3(e)||e.interval!==void 0}function bn(e){return e?.toString===Oet}function Jo(e){return bn(e)&&(e.type!==void 0||e.domain!==void 0)}function ei(e){return bn(e)&&typeof e.transform!="function"}function ts(e){return ei(e)&&e.value===void 0&&e.channel===void 0}function f3(e,t,n,r=X){return t===void 0&&n===void 0?(t=0,n=e===void 0?r:e):t===void 0?t=e===void 0?0:e:n===void 0&&(n=e===void 0?0:e),[t,n]}function je(e,t){return e===void 0&&t===void 0?[xu,Rc]:[e,t]}function Xn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Fe(t)),e===void 0&&([e]=Fe(n)),e}function Fc(e){return Rr(e)?e.length:e?.numRows}function yr(e){let t=Fc(e),n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Ly(e,t){return Rr(e)?Wt(t,n=>e[n],e.constructor):Wt(t,n=>e.at(n))}function Ad(e){return e.length===1?(t,n)=>e(Ly(n,t)):e}function va(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Ni(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cv(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function wn(e){let t;return[{transform:()=>t,label:Pn(e)},n=>t=n]}function Bn(e){return e==null?[e]:wn(e)}function Pn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Md(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return ke(r)||ke(i)?Wt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Wt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function bu(e,t){let n=d3(t?.interval,t?.type);return n?Wt(e,n):e}function d3(e,t){let n=Od(e,t);return n&&(r=>Ne(r)?n.floor(r):r)}function Od(e,t){if(e!=null){if(typeof e=="number")return h3(e);if(typeof e=="string")return(t==="time"?Ny:gu)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function h3(e){e=+e,0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let t=Math.abs(e);return e<0?{floor:n=>Math.floor(n*t)/t,offset:(n,r=1)=>(n*t+Math.floor(r))/t,range:(n,r)=>qe(Math.ceil(n*t),r*t).map(i=>i/t)}:{floor:n=>Math.floor(n/t)*t,offset:(n,r=1)=>n+t*Math.floor(r),range:(n,r)=>qe(Math.ceil(n/t),r/t).map(i=>i*t)}}function es(e,t){if(e=Od(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function VP(e,t){if(e=es(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function qP(e){return kc(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function kc(e){return typeof e?.range=="function"}function Di(e){return e===void 0||ei(e)?e:{value:e}}function YP(e){return e==null?null:{transform:t=>gt(t,e,Float64Array),label:Pn(e)}}function GP(e){if(!gr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function gr(e){return e&&typeof e[Symbol.iterator]=="function"}function lv(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function De(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function ke(e){for(let t of e)if(t!=null)return t instanceof Date}function WP(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&My(t)}function XP(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Sa(e){for(let t of e)if(t!=null)return typeof t=="number"}function uv(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var Let=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function Cc(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||Let.has(e))}function HP(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function oe(e){return e==null||Ia(e)}function Ia(e){return/^\s*none\s*$/i.test(e)}function QP(e){return/^\s*round\s*$/i.test(e)}function fv(e,t){return c3(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function ns(e="middle"){return fv(e,"frameAnchor")}function ZP(e={},...t){let n=e;for(let r of t)for(let i in r)if(n[i]===void 0){let o=r[i];n===e?n={...n,[i]:o}:n[i]=o}return n}function Fet(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[r,n]}))}function Fy(e){return gr(e)?Fet(e):e}function dv(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=un(e,"clip",["frame","sphere"])),e}function KP(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function JP(e){return e&&typeof e.toArray=="function"&&e.type}function ket(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Ri=Symbol("position"),ni=Symbol("color"),wu=Symbol("radius"),_u=Symbol("length"),vu=Symbol("opacity"),Nd=Symbol("symbol"),t9=Symbol("projection"),he=new Map([["x",Ri],["y",Ri],["fx",Ri],["fy",Ri],["r",wu],["color",ni],["opacity",vu],["symbol",Nd],["length",_u],["projection",t9]]);function e9(e){return e===Ri||e===t9}function n9(e){return e===Ri||e===wu||e===_u||e===vu}var p3=Math.sqrt(3),m3=2/p3,Cet={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*m3,i=r/2;e.moveTo(0,r),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(0,-r),e.lineTo(-n,-i),e.lineTo(-n,i),e.closePath()}},y3=new Map([["asterisk",dy],["circle",ga],["cross",hy],["diamond",py],["diamond2",my],["hexagon",Cet],["plus",yy],["square",gy],["square2",xy],["star",by],["times",gd],["triangle",wy],["triangle2",_y],["wye",vy]]);function g3(e){return e&&typeof e.draw=="function"}function r9(e){return g3(e)?!0:typeof e!="string"?!1:y3.has(e.toLowerCase())}function Dd(e){if(e==null||g3(e))return e;let t=y3.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function i9(e){if(e==null||g3(e))return[void 0,e];if(typeof e=="string"){let t=y3.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function rn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=w3(e)),t!=null&&!ts(t)&&(r=x3(r,v3(t))),n&&(r=x3(r,_3))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||ts(t))&&{sort:t},transform:x3(r,s)}}function xe({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=w3(e)),t!=null&&!ts(t)&&(r=b3(r,v3(t))),n&&(r=b3(r,_3))),{...i,...(t===null||ts(t))&&{sort:t},initializer:b3(r,o)}}function x3(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,wa(n),r,i)}}function b3(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...o){let s,a,c,l,u,f;return{data:a=n,facets:c=r,channels:s}=e.call(this,n,r,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function hv(e,t){return(e.initializer!=null?xe:rn)(e,t)}function o9(e,t){return hv(t,w3(e))}function w3(e){return(t,n)=>{let r=gt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function s9({sort:e,...t}={}){return{...hv(t,_3),sort:ts(e)?e:null}}function _3(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function a9({seed:e,sort:t,...n}={}){return{...hv(n,c9(e==null?Math.random:ou(e))),sort:ts(t)?t:null}}function pv(e,{sort:t,...n}={}){return{...(ei(e)&&e.channel!==void 0?xe:hv)(n,v3(e)),sort:ts(t)?t:null}}function v3(e){return(typeof e=="function"&&e.length!==1?Bet:c9)(e)}function Bet(e){return(t,n)=>{let r=Rr(t)?(i,o)=>e(t[i],t[o]):(i,o)=>e(t.get(i),t.get(o));return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function c9(e){let t,n;({channel:t,value:e,order:n}={...Di(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?mu:xn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=xn;break;case"descending":n=mu;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=gt(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>n(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Cy(e,t){return mv(null,null,e,t)}function Bc(e={y:"count"},t={}){let{x:n=X}=t;if(n==null)throw new Error("missing channel: x");return mv(n,null,e,t)}function Pc(e={x:"count"},t={}){let{y:n=X}=t;if(n==null)throw new Error("missing channel: y");return mv(null,n,e,t)}function By(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=je(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return mv(n,r,e,t)}function mv(e,t,{data:n=xv,filter:r,sort:i,reverse:o,...s}={},a={}){s=I3(s,a),n=h9(n,X),i=i==null?void 0:f9("sort",i,a),r=r==null?void 0:d9("filter",r,a);let[c,l]=Bn(e),[u,f]=Bn(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[w,v]=Bn(d),[_]=Fe(h),[T]=Fe(p),[A,E]=Bn(_),[O,I]=Bn(T);return{..."z"in a&&{z:w||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:O||p},...rn(b,(D,k,S)=>{let M=bu(gt(D,e),S?.x),N=bu(gt(D,t),S?.y),L=gt(D,d),B=gt(D,_),C=gt(D,T),P=Py(s,{z:L,fill:B,stroke:C}),$=[],U=[],H=M&&l([]),nt=N&&f([]),ot=L&&v([]),at=B&&E([]),G=C&&I([]),st=0;for(let V of s)V.initialize(D);i&&i.initialize(D),r&&r.initialize(D);for(let V of k){let Q=[];for(let rt of s)rt.scope("facet",V);i&&i.scope("facet",V),r&&r.scope("facet",V);for(let[rt,z]of rs(V,P))for(let[Ct,ht]of rs(z,N))for(let[Xt,Zt]of rs(ht,M)){let tt={data:D};if(M&&(tt.x=Xt),N&&(tt.y=Ct),P&&(tt.z=rt),!(r&&!r.reduce(Zt,tt))){Q.push(st++),U.push(n.reduceIndex(Zt,D,tt)),M&&H.push(Xt),N&&nt.push(Ct),L&&ot.push(P===L?rt:L[Zt[0]]),B&&at.push(P===B?rt:B[Zt[0]]),C&&G.push(P===C?rt:C[Zt[0]]);for(let ce of s)ce.reduce(Zt,tt);i&&i.reduce(Zt,tt)}}$.push(Q)}return T3($,i,o),{data:U,facets:$}}),...!is(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!is(s,"y")&&(u?{y:u}:{y1:g,y2:x}),...Object.fromEntries(s.map(({name:D,output:k})=>[D,k]))}}function is(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function S3(e,t,n=yv){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",Vet]),t.href!=null&&e.href===void 0&&r.push(["href",bv]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?Pet(i):n(i,o,t))}function yv(e,t,n,r=gv){let i;bn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=wn(o.label),c;return{name:e,output:i===void 0?s:{value:s,scale:i},initialize(l){o.initialize(l),c=a([])},scope(l,u){o.scope(l,u)},reduce(l,u){c.push(o.reduce(l,u))}}}function Pet(e){return{name:e,initialize(){},scope(){},reduce(){}}}function gv(e,t,n,r=Rd){let i=cv(e,n),o=r(t,i),s,a;return{label:Pn(o===ky?null:i,o.label),initialize(c){s=i===void 0?c:gt(c,i),o.scope==="data"&&(a=o.reduceIndex(yr(c),s))},scope(c,l){o.scope===c&&(a=o.reduceIndex(l,s))},reduce(c,l){return o.scope==null?o.reduceIndex(c,s,l):o.reduceIndex(c,s,a,l)}}}function rs(e,t){return t?Rn(e,n=>t[n]):[[,e]]}function Rd(e,t,n=$et){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&bn(e))return zet(e);if(typeof e=="function")return jet(e);if(/^p\d{2}$/i.test(e))return Ta(Ed(e));switch(`${e}`.toLowerCase()){case"first":return bv;case"last":return qet;case"identity":return xv;case"count":return ky;case"distinct":return Yet;case"sum":return t==null?ky:Get;case"proportion":return u9(t,"data");case"proportion-facet":return u9(t,"facet");case"deviation":return Ta(wi);case"min":return Ta(ue);case"min-index":return Ta(Kb);case"max":return Ta(Qt);case"max-index":return Ta(Zb);case"mean":return l9(Js);case"median":return l9(ro);case"variance":return Ta(fc);case"mode":return Ta(kf)}return n(e)}function $et(e){throw new Error(`invalid reduce: ${e}`)}function I3(e,t){return S3(e,t,f9)}function f9(e,t,n){return yv(e,t,n,d9)}function d9(e,t,n){return gv(e,t,n,h9)}function h9(e,t){return Rd(e,t,Uet)}function Uet(e){switch(`${e}`.toLowerCase()){case"x":return Wet;case"y":return Xet;case"z":return E3}throw new Error(`invalid group reduce: ${e}`)}function Py(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function T3(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>xn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function zet(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function jet(e){return{reduceIndex(t,n,r){return e(Ly(n,t),r)}}}function Ta(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function l9(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return ke(n)?new Date(r):r}}}var xv={reduceIndex(e,t){return Ly(t,e)}},bv={reduceIndex(e,t){return t[e[0]]}},Vet={reduceIndex(e,t){let r=Zs(no(e,o=>o.length,o=>t[o]),Rc),i=r.slice(-5).reverse();if(i.length<r.length){let o=r.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,Fn(o,Rc)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},qet={reduceIndex(e,t){return t[e[e.length-1]]}},ky={label:"Frequency",reduceIndex(e){return e.length}},Yet={label:"Distinct",reduceIndex(e,t){let n=new or;for(let r of e)n.add(t[r]);return n.size}},Get=Ta(Fn);function u9(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>Fn(n,o=>r[o])/i}}var Wet={reduceIndex(e,t,{x:n}){return n}},Xet={reduceIndex(e,t,{y:n}){return n}},E3={reduceIndex(e,t,{z:n}){return n}};function p9(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(Rr(r)?i=>e(r[i],i,r):i=>e(r.get(i),i,r))]}}}function Ld(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Pn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),M3(a,{scale:t,type:n,value:gt(e,r),label:s,filter:i,hint:o})}function wv(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Ld(t,r,n)]))}function Fd(e,t){let n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[r,s==null?o:Wt(o,s)]}));return n.channels=e,n}function M3(e,t){let{scale:n,value:r}=t;if(n===!0||n==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=n!==!0&&uv(r,Cc)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&uv(r,HP)?null:"opacity",t.defaultScale="opacity";break;case"symbol":n!==!0&&uv(r,r9)?(t.scale=null,t.value=Wt(r,Dd)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=he.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!he.has(n))throw new Error(`unknown scale: ${n}`);return t}function y9(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!he.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=Di(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?x9:g9:Zet(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?Qet(t,r[l]):Het(n,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=gr(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let w=Array.from(new or(g));return d&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=u==="data"?e:u==="height"?m9(n,"y1","y2"):u==="width"?m9(n,"x1","x2"):A3(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Rd(h===!0?"max":h,w);y.domain=()=>{let _=KT(yr(g),T=>v.reduceIndex(T,w),T=>g[T]);return f&&_.sort(f),d&&_.reverse(),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_.map(xu)}}}}function Het(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function Qet(e,t){let n=e.original;if(n===e)return t;let r=t.value,i=t.value=[];for(let o=0;o<n.length;++o){let s=r[n[o][0]];for(let a of e[o])i[a]=s}return t}function m9(e,t,n){let r=A3(e,t),i=A3(e,n);return Wt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function A3(e,t,n){let r=e[t];if(!r&&n!==void 0&&(r=e[n]),r)return r.value;throw new Error(`missing channel: ${t}`)}function Zet(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return g9;case"descending":return x9}throw new Error(`invalid order: ${e}`)}function g9([e,t],[n,r]){return xn(t,r)||xn(e,n)}function x9([e,t],[n,r]){return mu(t,r)||xn(e,n)}function $y(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}var S9=new Map([["accent",hM],["category10",dM],["dark2",pM],["observable10",mM],["paired",yM],["pastel1",gM],["pastel2",xM],["set1",bM],["set2",wM],["set3",_M],["tableau10",vM]]);function I9(e){return e!=null&&S9.has(`${e}`.toLowerCase())}var b9=new Map([...S9,["brbg",Ea(Bw,Pw)],["prgn",Ea($w,Uw)],["piyg",Ea(zw,jw)],["puor",Ea(Vw,qw)],["rdbu",Ea(cy,dd)],["rdgy",Ea(Yw,Gw)],["rdylbu",Ea(ly,hd)],["rdylgn",Ea(Ww,Xw)],["spectral",Ea(Hw,Qw)],["burd",w9(cy,dd)],["buylrd",w9(ly,hd)],["blues",_n(__,v_)],["greens",_n(S_,I_)],["greys",_n(T_,E_)],["oranges",_n(D_,R_)],["purples",_n(A_,M_)],["reds",_n(O_,N_)],["turbo",Aa(z_)],["viridis",Aa(V_)],["magma",Aa(q_)],["inferno",Aa(Y_)],["plasma",Aa(G_)],["cividis",Aa(L_)],["cubehelix",Aa(F_)],["warm",Aa(C_)],["cool",Aa(B_)],["bugn",_n(Zw,Kw)],["bupu",_n(Jw,t_)],["gnbu",_n(e_,n_)],["orrd",_n(r_,i_)],["pubu",_n(a_,c_)],["pubugn",_n(o_,s_)],["purd",_n(l_,u_)],["rdpu",_n(f_,d_)],["ylgn",_n(m_,y_)],["ylgnbu",_n(h_,p_)],["ylorbr",_n(g_,x_)],["ylorrd",_n(b_,w_)],["rainbow",_9(P_)],["sinebow",_9(U_)]]);function _n(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?jn(t,n):e[n])}function Ea(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?jn(t,n):e[n])}function w9(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?jn(r=>t(1-r),n):e[n].slice().reverse())}function Aa(e){return({length:t})=>jn(e,Math.max(2,Math.floor(t)))}function _9(e){return({length:t})=>jn(e,Math.floor(t)+1).slice(0,-1)}function O3(e){let t=`${e}`.toLowerCase();if(!b9.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return b9.get(t)}function Uy(e,t){let n=O3(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function T9(e,t="greys"){let n=new Set,[r,i]=Uy(t,2);for(let o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}var v9=new Map([["brbg",Pw],["prgn",Uw],["piyg",jw],["puor",qw],["rdbu",dd],["rdgy",Gw],["rdylbu",hd],["rdylgn",Xw],["spectral",Qw],["burd",e=>dd(1-e)],["buylrd",e=>hd(1-e)],["blues",v_],["greens",I_],["greys",E_],["purples",M_],["reds",N_],["oranges",R_],["turbo",z_],["viridis",V_],["magma",q_],["inferno",Y_],["plasma",G_],["cividis",L_],["cubehelix",F_],["warm",C_],["cool",B_],["bugn",Kw],["bupu",t_],["gnbu",n_],["orrd",i_],["pubugn",s_],["pubu",c_],["purd",u_],["rdpu",d_],["ylgnbu",p_],["ylgn",y_],["ylorbr",x_],["ylorrd",w_],["rainbow",P_],["sinebow",U_]]);function kd(e){let t=`${e}`.toLowerCase();if(!v9.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return v9.get(t)}var Ket=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function E9(e){return e!=null&&Ket.has(`${e}`.toLowerCase())}var D3=e=>t=>e(1-t),N3=[0,1],A9=new Map([["number",Ee],["rgb",_i],["hsl",IE],["hcl",TE],["lab",w1]]);function R3(e){let t=`${e}`.toLowerCase();if(!A9.has(t))throw new Error(`unknown interpolator: ${t}`);return A9.get(t)}function Bd(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=k9(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=he.get(e)===wu?nnt(n,a):he.get(e)===_u?rnt(n,a):he.get(e)===vu?N3:void 0,interpolate:h=he.get(e)===ni?u==null&&d!==void 0?_i:kd(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Xl:Ee,reverse:p}){if(f=es(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=R3(h)),p=!!p,d!==void 0){let m=(a=ti(a)).length,y=(d=ti(d)).length;if(m!==y){if(h.length===1)throw new Error("invalid piecewise interpolator");h=Bo(h,d),d=void 0}}if(h.length===1?(p&&(h=D3(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=N3)),t.interpolate((d===N3?Ce:zy)(h))):t.interpolate(h),s){let[m,y]=ne(a);(m>0||y<0)&&(a=Lc(a),(ba(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return p&&(a=hc(a)),t.domain(a).unknown(c),i&&(t.nice(Jet(i,r)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:r,domain:a,range:d,scale:t,interpolate:h,interval:f}}function Jet(e,t){return e===!0?void 0:typeof e=="number"?e:VP(e,t)}function M9(e,t,n){return Bd(e,la(),t,n)}function O9(e,t,n){return L3(e,t,{...n,exponent:.5})}function L3(e,t,{exponent:n=1,...r}){return Bd(e,Zm().exponent(n),t,{...r,type:"pow"})}function N9(e,t,{base:n=10,domain:r=int(t),...i}){return Bd(e,Hm().base(n),t,{...i,domain:r})}function D9(e,t,{constant:n=1,...r}){return Bd(e,Qm().constant(n),t,r)}function R9(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=ont(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?jn(c,i):he.get(e)===ni?Uy(o,i):void 0),s.length>0&&(s=Km(s,n===void 0?{length:i}:n).quantiles()),_v(e,t,{domain:s,range:n,reverse:l,unknown:a})}function L9(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=k9(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ne(o),f;return n===void 0?(f=Ln(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?jn(a,r):he.get(e)===ni?Uy(i,r):void 0):(f=jn(Ee(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),ba(ti(o))<0&&f.reverse(),_v(e,t,{domain:f,range:n,reverse:c,unknown:s})}function _v(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?jn(o,n.length+1):he.get(e)===ni?Uy(i,n.length+1):void 0,reverse:a}){n=ti(n);let c=ba(n);if(!isNaN(c)&&!tnt(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=hc(s)),{type:"threshold",scale:Jm(c<0?hc(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function tnt(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=rr(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function F9(e){return{type:"identity",scale:n9(he.get(e))?Wm():t=>t}}function Cd(e,t=_d){return e.length?[ue(e,({value:n})=>n===void 0?n:ue(n,t)),Qt(e,({value:n})=>n===void 0?n:Qt(n,t))]:[0,1]}function k9(e,t){let n=he.get(e);return(n===wu||n===vu||n===_u?ent:Cd)(t)}function ent(e){return[0,e.length?Qt(e,({value:t})=>t===void 0?t:Qt(t,_d)):1]}function nnt(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=sr(e,.5,({value:s})=>s===void 0?NaN:sr(s,.25,mr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Qt(i);return o<1?i.map(s=>s*o):i}function rnt(e,t){let n=ro(e,({value:o})=>o===void 0?NaN:ro(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Qt(r);return i<1?r.map(o=>o*i):r}function int(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Cd(e,mr);if(n<0)return Cd(e,Ac)}return[1,10]}function ont(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function zy(e){return(t,n)=>r=>e(t+r*(n-t))}var F3=0,k3;function C9(){let e=F3;return F3=0,k3=void 0,e}function Hn(e){e!==k3&&(k3=e,console.warn(e),++F3)}function vv(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Cd(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=he.get(e)===ni?u==null&&f!==void 0?_i:kd(u!==void 0?u:"rdbu"):Ee,reverse:p}){l=+l,a=ti(a);let[m,y]=a;if(a.length>2&&Hn(`Warning: the diverging ${e} scale domain contains extra elements.`),rr(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=R3(h)),f!==void 0&&(h=h.length===1?zy(h)(...f):Bo(h,f)),p&&(h=D3(h)),d){let g=n.apply(l),x=g-n.apply(m),b=n.apply(y)-g;x<b?m=n.invert(g-b):x>b&&(y=n.invert(g+x))}return t.domain([m,l,y]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:h,scale:t}}function B9(e,t,n){return vv(e,ay(),snt,t,n)}function P9(e,t,n){return C3(e,t,{...n,exponent:.5})}function C3(e,t,{exponent:n=1,...r}){return vv(e,Cw().exponent(n=+n),lnt(n),t,{...r,type:"diverging-pow"})}function $9(e,t,{base:n=10,pivot:r=1,domain:i=Cd(t,r<0?Ac:mr),...o}){return vv(e,Fw().base(n=+n),ant,t,{domain:i,pivot:r,...o})}function U9(e,t,{constant:n=1,...r}){return vv(e,kw().constant(n=+n),unt(n),t,r)}var snt={apply(e){return e},invert(e){return e}},ant={apply:Math.log,invert:Math.exp},cnt={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function lnt(e){return e===.5?cnt:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function unt(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function z9(e,t,n,r){return Bd(e,t,n,r)}function j9(e,t,n){return z9(e,Dw(),t,n)}function V9(e,t,n){return z9(e,Rw(),t,n)}var Pd=Symbol("ordinal");function Y9(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=es(i,r),o===void 0&&(o=Q9(n,i,e)),(r==="categorical"||r===Pd)&&(r="ordinal"),a&&(o=hc(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:r,domain:o,range:s,scale:t,hint:c,interval:i}}function G9(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=es(r,n),i===void 0&&(i=Q9(t,r,e));let l;if(he.get(e)===Nd)l=fnt(t),o=o===void 0?dnt(l):Wt(o,Dd);else if(he.get(e)===ni&&(o===void 0&&(n==="ordinal"||n===Pd)&&(o=T9(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=kd(s),f=o[0],d=o[1]-o[0];o=({length:h})=>jn(p=>u(f+d*p),h)}else o=O3(s);if(a===Ym)throw new Error(`implicit unknown on ${e} scale is not supported`);return Y9(e,su().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function W9(e,t,{align:n=.5,padding:r=.5,...i}){return H9(QA().align(n).padding(r),t,i,e)}function X9(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return H9(Ic().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function H9(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=Y9(r,e,t,n),e.round=i,e}function Q9(e,t,n){let r=new or;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)r.add(s)}if(t!==void 0){let[i,o]=ne(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&he.get(n)===Ri)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return Zs(r,xn)}function q9(e,t){let n;for(let{hint:r}of e){let i=r?.[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function fnt(e){return{fill:q9(e,"fill"),stroke:q9(e,"stroke")}}function dnt(e){return oe(e.fill)?OM:K_}function jy(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let y={};for(let[g,x]of e){let b=m[g],w=i$(g,x,{round:he.get(g)===Ri?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(w){let{label:v=g==="fx"||g==="fy"?p:t,percent:_,transform:T,inset:A,insetTop:E=A!==void 0?A:g==="y"?r:0,insetRight:O=A!==void 0?A:g==="x"?i:0,insetBottom:I=A!==void 0?A:g==="y"?o:0,insetLeft:D=A!==void 0?A:g==="x"?s:0}=b||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");w.percent=!!_,w.label=v===void 0?hnt(x,w):v,w.transform=T,g==="x"||g==="fx"?(w.insetLeft=+D,w.insetRight=+O):(g==="y"||g==="fy")&&(w.insetTop=+E,w.insetBottom=+I),y[g]=w}}return y}function P3(e){let t={},n={scales:t};for(let[r,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[r]=s$(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function e$(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?Tv(t):t;i&&Z9(i,s),o&&K9(o,s);let a=i||o?$3(e,t):t;n&&Z9(n,a),r&&K9(r,a)}function hnt(e=[],t){let n;for(let{label:r}of e)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!os(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Iv(e){return Math.sign(ba(e.domain()))*Math.sign(ba(e.range()))}function Tv(e){let{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,l),marginLeft:Math.max(i,u),width:o,height:s}}function $3({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Tv(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+r+o:c,facet:{width:a,height:c}}}function Z9(e,t){if(e.range===void 0){let{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+n,c=i-s-r;e.range=[a,Math.max(a,c)],os(e)||(e.range=r$(e)),e.scale.range(e.range)}n$(e)}function K9(e,t){if(e.range===void 0){let{insetTop:n,insetBottom:r}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+n,c=i-s-r;e.range=[Math.max(a,c),a],os(e)?e.range.reverse():e.range=r$(e),e.scale.range(e.range)}n$(e)}function n$(e){e.round===void 0&&ynt(e)&&pnt(e)<=30&&e.scale.round(!0)}function pnt({scale:e}){let t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(r-n)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function r$(e){let t=e.scale.domain().length+U3(e);if(!(t>2))return e.range;let[n,r]=e.range;return Array.from({length:t},(i,o)=>n+o/(t-1)*(r-n))}function Ev(e,t,n){return i$(e,n===void 0?void 0:[{hint:n}],{...t})}function i$(e,t=[],n={}){let r=mnt(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&os({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(ke)?Hn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${$d(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${$d(r)}".`):i.some(WP)?Hn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${$d(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${$d(r)}".`):i.some(XP)&&Hn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${$d(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${$d(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=Sv(t,n,nn);break;case"identity":switch(he.get(e)){case Ri:n=Sv(t,n,nn);break;case Nd:n=Sv(t,n,gnt);break}break;case"utc":case"time":n=Sv(t,n,s3);break}switch(r){case"diverging":return B9(e,t,n);case"diverging-sqrt":return P9(e,t,n);case"diverging-pow":return C3(e,t,n);case"diverging-log":return $9(e,t,n);case"diverging-symlog":return U9(e,t,n);case"categorical":case"ordinal":case Pd:return G9(e,t,n);case"cyclical":case"sequential":case"linear":return M9(e,t,n);case"sqrt":return O9(e,t,n);case"threshold":return _v(e,t,n);case"quantile":return R9(e,t,n);case"quantize":return L9(e,t,n);case"pow":return L3(e,t,n);case"log":return N9(e,t,n);case"symlog":return D9(e,t,n);case"utc":return V9(e,t,n);case"time":return j9(e,t,n);case"point":return W9(e,t,n);case"band":return X9(e,t,n);case"identity":return F9(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function $d(e){return typeof e=="symbol"?e.description:e}function J9(e){return typeof e=="string"?`${e}`.toLowerCase():e}var t$={toString:()=>"projection"};function mnt(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=J9(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=t$);for(let l of t){let u=J9(l.type);if(u!==void 0){if(n===void 0)n=u;else if(n!==u)throw new Error(`scale incompatible with channel: ${n} !== ${u}`)}}if(n===t$)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=he.get(e);if(c===wu)return"sqrt";if(c===vu||c===_u)return"linear";if(c===Nd)return"ordinal";if((r||i||[]).length>2)return B3(c);if(r!==void 0){if(De(r))return B3(c);if(ke(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(De))return B3(c);if(l.some(ke))return"utc"}if(c===ni){if(s!=null||E9(o))return"diverging";if(I9(o))return"categorical"}return"linear"}function B3(e){switch(e){case Ri:return"point";case ni:return Pd;default:return"ordinal"}}function os({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Pd}function U3({type:e}){return e==="threshold"}function ynt({type:e}){return e==="point"||e==="band"}function ri(e){if(e===void 0)return!0;let t=e.domain(),n=e(t[0]);for(let r=1,i=t.length;r<i;++r)if(e(t[r])-n)return!1;return!0}function Sv(e,{domain:t,...n},r){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=r(i.value));return{domain:t===void 0?t:r(t),...n}}function gnt(e){return Wt(e,Dd)}function $c(e={}){let t;for(let n in e)if(he.has(n)&&Jo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=s$(Ev(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function o$(e){return t=>{if(!he.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function s$({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:Lc(n),...r!==void 0&&{range:Lc(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function c$(e,t){let{fx:n,fy:r}=jy(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?Xb(i,o).map(([s,a],c)=>({x:s,y:a,i:c})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function l$(e,{x:t,y:n}){return t&&=Y3(t),n&&=Y3(n),e.filter(t&&n?r=>t.has(r.x)&&n.has(r.y):t?r=>t.has(r.x):r=>n.has(r.y)).sort(t&&n?(r,i)=>t.get(r.x)-t.get(i.x)||n.get(r.y)-n.get(i.y):t?(r,i)=>t.get(r.x)-t.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function Mv(e,{fx:t,fy:n}){let r=yr(e),i=t?.value,o=n?.value;return t&&n?no(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?no(r,s=>(s.fx=i[s[0]],s),s=>i[s]):no(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function u$(e,t,{marginTop:n,marginLeft:r}){return e&&t?({x:i,y:o})=>`translate(${e(i)-r},${t(o)-n})`:e?({x:i})=>`translate(${e(i)-r},0)`:({y:i})=>`translate(0,${t(i)-n})`}function f$(e){let t=[],n=new Uint32Array(Fn(e,r=>r.length));for(let r of e){let i=0;for(let o of e)r!==o&&(n.set(o,i),i+=o.length);t.push(n.slice(0,i))}return t}var xnt=new Map([["top",z3],["right",q3],["bottom",j3],["left",V3],["top-left",Av(z3,V3)],["top-right",Av(z3,q3)],["bottom-left",Av(j3,V3)],["bottom-right",Av(j3,q3)],["top-empty",wnt],["right-empty",Snt],["bottom-empty",_nt],["left-empty",vnt],["empty",Int]]);function d$(e){if(e==null)return null;let t=xnt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var a$=new WeakMap;function Y3(e){let t=a$.get(e);return t||a$.set(e,t=new ir(Wt(e,(n,r)=>[n,r]))),t}function Uc(e,t){return Y3(e).get(t)}function bnt(e,t,n){return t=Ni(t),n=Ni(n),e.find(r=>Object.is(Ni(r.x),t)&&Object.is(Ni(r.y),n))}function Ov(e,t,n){return bnt(e,t,n)?.empty}function z3(e,{y:t},{y:n}){return t?Uc(t,n)===0:!0}function j3(e,{y:t},{y:n}){return t?Uc(t,n)===t.length-1:!0}function V3(e,{x:t},{x:n}){return t?Uc(t,n)===0:!0}function q3(e,{x:t},{x:n}){return t?Uc(t,n)===t.length-1:!0}function wnt(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,r);if(o>0)return Ov(e,n,t[o-1])}function _nt(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,r);if(o<t.length-1)return Ov(e,n,t[o+1])}function vnt(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,n);if(o>0)return Ov(e,t[o-1],r)}function Snt(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,n);if(o<t.length-1)return Ov(e,t[o+1],r)}function Int(e,t,{empty:n}){return n}function Av(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function Nv(e,{channels:{fx:t,fy:n},groups:r}){return t&&n?e.map(({x:i,y:o})=>r.get(i)?.get(o)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}var h$=Math.PI,Ma=2*h$,G3=.618;function p$({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(bn(e)){let v;if({type:e,domain:c,inset:v,insetTop:n=v!==void 0?v:n,insetRight:r=v!==void 0?v:r,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=W3(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,y=u-d-h-o-r,g=f-p-m-n-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=Tnt(l,d,p,u-h,f-m);let x=d+o,b=p+n,w;if(c!=null){let[[v,_],[T,A]]=mn(e).bounds(c),E=Math.min(y/(T-v),g/(A-_));E>0?(x-=(E*(v+T)-y)/2,b-=(E*(_+A)-g)/2,w=ru({point(O,I){this.stream.point(O*E+x,I*E+b)}})):Hn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?m$():ru({point(v,_){this.stream.point(v+x,_+b)}}),{stream:v=>e.stream(w.stream(l(v)))}}function W3(e){switch(`${e}`.toLowerCase()){case"albers-usa":return ao(IA,.7463,.4673);case"albers":return Dv($m,.7463,.4673);case"azimuthal-equal-area":return ao(EA,4,4);case"azimuthal-equidistant":return ao(MA,Ma,Ma);case"conic-conformal":return Dv(DA,Ma,Ma);case"conic-equal-area":return Dv(vc,6.1702,2.9781);case"conic-equidistant":return Dv(LA,7.312,3.6282);case"equal-earth":return ao(kA,5.4133,2.6347);case"equirectangular":return ao(RA,Ma,h$);case"gnomonic":return ao(BA,3.4641,3.4641);case"identity":return{type:m$};case"reflect-y":return{type:Ent};case"mercator":return ao(OA,Ma,Ma);case"orthographic":return ao($A,2,2);case"stereographic":return ao(zA,2,2);case"transverse-mercator":return ao(VA,Ma,Ma);default:throw new Error(`unknown projection type: ${e}`)}}function Tnt(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return td(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function ao(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),r!=null&&(c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2])),c},aspectRatio:n/t}}function Dv(e,t,n){let{type:r,aspectRatio:i}=ao(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var m$=Ce({stream:e=>e}),Ent=Ce(ru({point(e,t){this.stream.point(e,-t)}}));function X3(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function y$({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(bn(e)&&(e=e.type),e!=null)}function g$(e){if(typeof e?.stream=="function")return G3;if(bn(e)){let t,n;if({domain:t,type:e,...n}=e,t!=null&&e!=null){let r=typeof e=="string"?W3(e).type:e,[[i,o],[s,a]]=mn(r({...n,width:100,height:100})).bounds(t),c=(a-o)/(s-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:G3}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=W3(e);if(t)return t}return G3}}function ss(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Fd(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&X3("x","y",o,n),r&&(o.x=nn(o.x)),i&&(o.y=nn(o.y)),o}function x$(e){let t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},o={point(s,a){t.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)Qr(s,o);return[r,i]}function zc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:dv(n)}}function ct(e,{document:t}){return jt(ea(e).call(t.documentElement))}var Rv=Symbol("unset");function jc(e){return(e.length===1?Ant:Mnt)(e)}function Ant(e){let t,n=Rv;return r=>(Object.is(n,r)||(n=r,t=e(r)),t)}function Mnt(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>!Object.is(i,r[o])))&&(n=r,t=e(...r)),t)}var Ont=jc(e=>new Intl.NumberFormat(e)),Nnt=jc((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),Dnt=jc((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function H3(e="en-US"){let t=Ont(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function b$(e="en-US",t="short"){let n=Nnt(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function w$(e="en-US",t="short"){let n=Dnt(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function Q3(e){return vd(e,"Invalid Date")}function Rnt(e="en-US"){let t=H3(e);return n=>(n instanceof Date?Q3:typeof n=="number"?t:Ye)(n)}var as=Rnt();var Be=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Lnt=0,Fnt=0;function Z3(){return`plot-clip-${++Lnt}`}function _$(){return`plot-pattern-${++Fnt}`}function Lv(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:v,shapeRendering:_,channels:T},{ariaLabel:A,fill:E="currentColor",fillOpacity:O,stroke:I="none",strokeOpacity:D,strokeWidth:k,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:N,paintOrder:L}){E===null&&(a=null,c=null),I===null&&(l=null,f=null),oe(E)?!oe(I)&&(!oe(a)||T?.fill)&&(I="none"):oe(I)&&(!oe(l)||T?.stroke)&&(E="none");let[B,C]=Fe(a,E),[P,$]=ae(c,O),[U,H]=Fe(l,I),[nt,ot]=ae(f,D),[at,G]=ae(g);Ia(H)||(u===void 0&&(u=k),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!QP(d)&&(p=N),!Ia(C)&&w===void 0&&(w=L));let[st,V]=ae(u);return E!==null&&(e.fill=be(C,"currentColor"),e.fillOpacity=Vy($,1)),I!==null&&(e.stroke=be(H,"none"),e.strokeWidth=Vy(V,1),e.strokeOpacity=Vy(ot,1),e.strokeLinejoin=be(d,"miter"),e.strokeLinecap=be(h,"butt"),e.strokeMiterlimit=Vy(p,4),e.strokeDasharray=be(m,"none"),e.strokeDashoffset=be(y,"0")),e.target=Ye(s),e.ariaLabel=Ye(A),e.ariaDescription=Ye(i),e.ariaHidden=Ye(o),e.opacity=Vy(G,1),e.mixBlendMode=be(x,"normal"),e.imageFilter=be(b,"none"),e.paintOrder=be(w,"normal"),e.pointerEvents=be(v,"auto"),e.shapeRendering=be(_,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:nt,scale:"auto",optional:!0},strokeWidth:{value:st,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function knt(e,t){t&&e.filter(n=>Ay(t[n])).append("title").call(Bnt,t)}function Cnt(e,t){t&&e.filter(([n])=>Ay(t[n])).append("title").call(Pnt,t)}function Bnt(e,t){t&&e.text(n=>as(t[n]))}function Pnt(e,t){t&&e.text(([n])=>as(t[n]))}function Yt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",d=>r[d]),o&&ft(e,"fill",d=>o[d]),s&&ft(e,"fill-opacity",d=>s[d]),a&&ft(e,"stroke",d=>a[d]),c&&ft(e,"stroke-opacity",d=>c[d]),l&&ft(e,"stroke-width",d=>l[d]),u&&ft(e,"opacity",d=>u[d]),f&&S$(e,d=>f[d],t),n||knt(e,i)}function Su(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&S$(e,([d])=>f[d],t),n||Cnt(e,i)}function $nt({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,n,r,i,o,s,a,c].filter(u=>u!==void 0)}function qy(e,t,n){let r=Rn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Hn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*Fv(e,t,n,r){let{z:i}=n,{z:o}=r,s=$nt(r,n),a=[...t,...s];for(let c of o?qy(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ne(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Ni(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Ni(s[d][f])!==l[d]){yield u,l=s.map(p=>Ni(p[f])),u=[f];continue t}}u&&(yield u)}}function Unt(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{e=ct("svg:g",r).each(function(){this.appendChild(e.node()),e.node=()=>this}),i=znt(r,n);break}case"sphere":{i=jnt(r);break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function v$(e){let t=new WeakMap;return(n,r)=>{let i=t.get(n);if(!i){let o=Z3();jt(n.ownerSVGElement).append("clipPath").attr("id",o).call(e,n,r),t.set(n,i=`url(#${o})`)}return i}}var znt=v$((e,t,n)=>{let{width:r,height:i,marginLeft:o,marginRight:s,marginTop:a,marginBottom:c}=n;e.append("rect").attr("x",o).attr("y",a).attr("width",r-s-o).attr("height",i-a-c)}),jnt=v$((e,t)=>{let{projection:n}=t;if(!n)throw new Error('the "sphere" clip option requires a projection');e.append("path").attr("d",mn(n)({type:"Sphere"}))});function Rt(e,t,n,r){Unt(e,t,n,r),ft(e,"class",t.className),ft(e,"fill",t.fill),ft(e,"fill-opacity",t.fillOpacity),ft(e,"stroke",t.stroke),ft(e,"stroke-width",t.strokeWidth),ft(e,"stroke-opacity",t.strokeOpacity),ft(e,"stroke-linejoin",t.strokeLinejoin),ft(e,"stroke-linecap",t.strokeLinecap),ft(e,"stroke-miterlimit",t.strokeMiterlimit),ft(e,"stroke-dasharray",t.strokeDasharray),ft(e,"stroke-dashoffset",t.strokeDashoffset),ft(e,"shape-rendering",t.shapeRendering),ft(e,"filter",t.imageFilter),ft(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ft(e,"pointer-events",i)}function It(e,t){Vnt(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function S$(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ar.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ar.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ft(e,t,n){n!=null&&e.attr(t,n)}function Vnt(e,t,n){n!=null&&e.style(t,n)}function Et(e,t,{x:n,y:r},i=Be,o=Be){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function be(e,t){if((e=Ye(e))!==t)return e}function Vy(e,t){if((e=ee(e))!==t)return e}var qnt=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Vc(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!qnt.test(e))throw new Error(`invalid class name: ${e}`);return e}function Ud(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let n of e)Object.assign(n.style,t)}function vn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}var xt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:y=d,className:g,clip:x=i?.clip,channels:b,tip:w,render:v}=r;if(this.data=t,this.sort=ts(l)?l:null,this.initializer=xe(r).initializer,this.transform=this.initializer?r.transform:rn(r).transform,o===null||o===!1?this.facet=null:(this.facet=un(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Dc&&typeof a=="string"?[a]:a,this.fy=t===Dc&&typeof c=="string"?[c]:c),this.facetAnchor=d$(s),n=Fy(n),b!==void 0&&(n={...Ynt(b),...n}),i!==void 0&&(n={...Lv(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([_,T])=>{if(ei(T.value)){let{value:A,label:E=T.label,scale:O=T.scale}=T.value;T={...T,label:E,scale:O,value:A}}if(t===Dc&&typeof T.value=="string"){let{value:A}=T;T={...T,value:[A]}}return[_,T]}).filter(([_,{value:T,optional:A}])=>{if(T!=null)return!0;if(A)return!1;throw new Error(`missing channel value: ${_}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=dv(x),this.tip=Gnt(w),this.className=g?Vc(g):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let _ in this.channels){let{scale:T}=n[_];if(!(T!=="x"&&T!=="y"))throw new Error("super-faceting cannot use x or y")}}v!=null&&(this.render=Oa(v,this.render))}initialize(t,n,r){let i=wa(this.data);t===void 0&&i!=null&&(t=[yr(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=wa(i)),t!==void 0&&(t.original=o);let s=wv(this.channels,i);return this.sort!=null&&y9(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ne}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&X3(i,o,n,r.projection)}}scale(t,n,r){let i=Fd(t,n);return r.projection&&this.project(t,i,r),i}};function on(...e){return e.plot=xt.prototype.plot,e}function Oa(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function Ynt(e){return Object.fromEntries(Object.entries(Fy(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:Di(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function Gnt(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?un(e,"tip",["x","y","xy"]):e}function co(e,t){return e?.tip===!0?{...e,tip:t}:bn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function T$(e,t,n={}){let r=.5-Be,i=.5+Be,o=.5+Be,s=.5-Be;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:x}of t)m>r&&(r=m),y>i&&(i=y),g>o&&(o=g),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=Wnt(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=n.facet??{};y=+y,g=+g,x=+x,b=+b,p.facet={marginTop:y,marginRight:g,marginBottom:x,marginLeft:b}}return p}function Wnt({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n&&n.scale.domain().length||1,d=g$(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let h=t?os(t)?t.scale.domain().length||1:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=I$("y",t)/(I$("x",e)*o),m=r?r.scale.bandwidth():1,y=n?n.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function I$(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:n,domain:r}=t,i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${n}`)}let[o,s]=ne(r);return Math.abs(i(s)-i(o))}var E$=new WeakMap;function K3(e,t,{x:n,y:r,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(r??=null,a={...a,py:{value:o,scale:"y"}}),{x:n,y:r,channels:a,...l,render:Oa(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),x=E$.get(y);x||E$.set(y,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(H)-1,{x:w,y:v,fx:_,fy:T}=f,A=_?_(u.fx)-h.marginLeft:0,E=T?T(u.fy)-h.marginTop:0;w?.bandwidth&&(A+=w.bandwidth()/2),v?.bandwidth&&(E+=v.bandwidth()/2);let O=u.fi!=null,I;if(O){let G=x.facetStates;G||(x.facetStates=G=new Map),I=G.get(this),I||G.set(this,I=new Map)}let[D,k]=vn(this,h),{px:S,py:M}=d,N=S?G=>S[G]:J3(d,D),L=M?G=>M[G]:t6(d,k),B,C,P,$;function U(G,st){if(O)if($&&($=cancelAnimationFrame($)),G==null)I.delete(u.fi);else{I.set(u.fi,st),$=requestAnimationFrame(()=>{$=null;for(let[V,Q]of I)if(Q<st||Q===st&&V<u.fi){G=null;break}H(G)});return}H(G)}function H(G){if(B===G&&P===x.sticky)return;B=G,P=p.pointerSticky=x.sticky;let st=B==null?[]:[B];O&&(st.fx=u.fx,st.fy=u.fy,st.fi=u.fi);let V=m(st,f,d,h,p);if(C){if(O){let Q=C.parentNode,rt=C.getAttribute("transform"),z=V.getAttribute("transform");rt?V.setAttribute("transform",rt):V.removeAttribute("transform"),z?Q.setAttribute("transform",z):Q.removeAttribute("transform"),V.removeAttribute("aria-label"),V.removeAttribute("aria-description"),V.removeAttribute("aria-hidden")}C.replaceWith(V)}if(x.roots[b]=C=V,!(B==null&&I?.size>1)){let Q=B==null?null:Rr(g)?g[B]:g.get(B);p.dispatchValue(Q)}return V}function nt(G){if(x.sticky||G.pointerType==="mouse"&&G.buttons===1)return;let[st,V]=zn(G);st-=A,V-=E;let Q=st<h.marginLeft||st>h.width-h.marginRight?1:e,rt=V<h.marginTop||V>h.height-h.marginBottom?1:t,z=null,Ct=s*s;for(let ht of u){let Xt=Q*(N(ht)-st),Zt=rt*(L(ht)-V),tt=Xt*Xt+Zt*Zt;tt<=Ct&&(z=ht,Ct=tt)}if(z!=null&&(e!==1||t!==1)){let ht=N(z)-st,Xt=L(z)-V;Ct=ht*ht+Xt*Xt}U(z,Ct)}function ot(G){G.pointerType==="mouse"&&B!=null&&(x.sticky&&x.roots.some(st=>st?.contains(G.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(st=>st(null))):(x.sticky=!0,H(B)),G.stopImmediatePropagation()))}function at(G){G.pointerType==="mouse"&&(x.sticky||U(null))}return y.addEventListener("pointerenter",nt),y.addEventListener("pointermove",nt),y.addEventListener("pointerdown",ot),y.addEventListener("pointerleave",at),H(null)},c)}}function qc(e){return K3(1,1,e)}function Yc(e){return K3(1,.01,e)}function Na(e){return K3(.01,1,e)}function J3({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function t6({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function kv(e){return os(e)&&e.interval===void 0?void 0:"tabular-nums"}function A$(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=kv(e),round:p=!0,opacity:m,className:y}=t,g=zc(t);y=Vc(y),m=ae(m)[1],d===null&&(d=()=>null);let x=ct("svg",g).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(D=>D.append("style").text(`:where(.${y}-ramp) {
26
17
  display: block;
27
18
  height: auto;
28
19
  height: intrinsic;
@@ -31,9 +22,9 @@ ${r}`}function cct(e){return e==="time"?NI:e==="utc"?zb:sct}function HV(e,t,r){l
31
22
  }
32
23
  :where(.${y}-ramp text) {
33
24
  white-space: pre;
34
- }`)).call(Zp,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,L)=>O.rangeRound(L):(O,L)=>O.range(L),{type:w,domain:I,range:E,interpolate:T,scale:B,pivot:A}=e;if(T){let O=E===void 0?T:fa(T.length===1?Qb(T):T,E);_=v(B.copy(),Bn(Ke(l,i-a),Math.min(I.length+(A!==void 0),E===void 0?1/0:E.length)));let L=256,S=g.document.createElement("canvas");S.width=L,S.height=1;let M=S.getContext("2d");for(let D=0,C=L-1;D<L;++D)M.fillStyle=O(D/C),M.fillRect(D,0,1,1);b.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(w==="threshold"){let O=I,L=d===void 0?S=>S:typeof d=="string"?Mo(d):d;_=v(Gc().domain([-1,E.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,M)=>_(M-1)).attr("y",s).attr("width",(S,M)=>_(M)-_(M-1)).attr("height",o-s-c).attr("fill",S=>S),f=de(O,(S,M)=>M),d=S=>L(O[S],S)}else _=v(du().domain(I),[l,i-a]),b.append("g").attr("fill-opacity",m).selectAll().data(I).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",B),x=()=>{};return b.append("g").attr("transform",`translate(0,${o-c})`).call(o3(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(n).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Fe(h,"normal")).call(x).call(O=>O.select(".domain").remove()),r!==void 0&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(r),b.node()}var Qp=Math.PI/180;function vs(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:i=t}={}){e.markerStart=XN(r),e.markerMid=XN(n),e.markerEnd=XN(i)}function XN(e){if(e==null||e===!1)return null;if(e===!0)return Pq;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return Uq("auto");case"arrow-reverse":return Uq("auto-start-reverse");case"dot":return vlt;case"circle":case"circle-fill":return Pq;case"circle-stroke":return Slt;case"tick":return HN("auto");case"tick-x":return HN(90);case"tick-y":return HN(0)}throw new Error(`invalid marker: ${e}`)}function Uq(e){return(t,r)=>pt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(n=>n.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function vlt(e,t){return pt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(r=>r.append("circle").attr("r",2.5)).node()}function Pq(e,t){return pt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function Slt(e,t){return pt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function HN(e){return(t,r)=>pt("svg:marker",r).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(n=>n.append("path").attr("d","M0,-3v6")).node()}var Ilt=0;function hl(e,t,{stroke:r},n){return zq(e,t,r&&(i=>r[i]),n)}function $q(e,t,{stroke:r},n){return zq(e,t,r&&(([i])=>r[i]),n)}function zq(e,{markerStart:t,markerMid:r,markerEnd:n,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-${++Ilt}`;p.setAttribute("id",m),d.set(f,h=`url(#${m})`)}return h}}t&&e.attr("marker-start",c(t)),r&&e.attr("marker-mid",c(r)),n&&e.attr("marker-end",c(n))}function _d({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=Vq(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function wd({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=Vq(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function Vq(e,t,r){return e===void 0&&t===void 0&&r===void 0?ur?[1,0]:[.5,.5]:[t,r]}function jq(e,{interval:t}){return e={...Fo(e)},e.interval=Up(e.interval===void 0?t:e.interval),e}function uT(e,t,r,n){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=r,{value:a,interval:c}=jq(i,r);if(a==null||c==null&&!n)return r;let l=Tn(i);if(c==null){let h,p={transform:m=>h||(h=At(m,a)),label:l};return{...r,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&n)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=de(At(u=h,a),p=>c.floor(p))}return t({...r,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function qq(e,t,r){let{[e]:n}=r,{value:i,interval:o}=jq(n,r);return i==null||o==null?r:t({...r,[e]:{label:Tn(n),transform:s=>{let a=de(At(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(lr(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 ZN(e={}){return uT("x",_d,e,!0)}function KN(e={}){return uT("y",wd,e,!0)}function fT(e={}){return uT("x",_d,e)}function dT(e={}){return uT("y",wd,e)}function hT(e={}){return qq("x",_d,e)}function pT(e={}){return qq("y",wd,e)}var Yq={ariaLabel:"rule",fill:null,stroke:"currentColor"},rx=class extends Ft{constructor(t,r={}){let{x:n,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=r;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},ws(r,"x"),Yq),this.insetTop=Gt(a),this.insetBottom=Gt(c),vs(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y1:l,y2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:b}=this;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{x:c&&s},ur,0).call(x=>x.selectAll().data(t).enter().append("line").call(Xt,this).attr("x1",c?_=>c[_]:(m+f-p)/2).attr("x2",c?_=>c[_]:(m+f-p)/2).attr("y1",l&&!ci(a)?_=>l[_]+g:h+g).attr("y2",u&&!ci(a)?a.bandwidth?_=>u[_]+a.bandwidth()-b:_=>u[_]-b:d-y-b).call(ge,this,n).call(hl,this,n,o)).node()}},nx=class extends Ft{constructor(t,r={}){let{x1:n,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=r;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},ws(r,"y"),Yq),this.insetRight=Gt(a),this.insetLeft=Gt(c),vs(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{y:c,x1:l,x2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:b}=this;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{y:c&&a},0,ur).call(x=>x.selectAll().data(t).enter().append("line").call(Xt,this).attr("x1",l&&!ci(s)?_=>l[_]+g:m+g).attr("x2",u&&!ci(s)?s.bandwidth?_=>u[_]+s.bandwidth()-b:_=>u[_]-b:f-p-b).attr("y1",c?_=>c[_]:(h+d-y)/2).attr("y2",c?_=>c[_]:(h+d-y)/2).call(ge,this,n).call(hl,this,n,o)).node()}};function Ki(e,t){let{x:r=K,y:n,y1:i,y2:o,...s}=dT(t);return[i,o]=Wq(n,i,o),new rx(e,{...s,x:r,y1:i,y2:o})}function Qi(e,t){let{y:r=K,x:n,x1:i,x2:o,...s}=fT(t);return[i,o]=Wq(n,i,o),new nx(e,{...s,y:r,x1:i,x2:o})}function Wq(e,t,r){if(e==null){if(t===void 0){if(r!==void 0)return[0,r]}else if(r===void 0)return[0,t]}else{if(t===void 0)return r===void 0?[0,e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}function Fu(e,...t){let r=t.length;for(let n=0,i=!0;n<r;++n)typeof t[n]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(n,2,e[n]+t[n]+e[n+1]),t.splice(n,1),--n,--r);return n=>{let i=e[0];for(let o=0;o<r;++o)i+=t[o](n)+e[o+1];return i}}var Tlt={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},Kq="\xAD",Sd=class extends Ft{constructor(t,r={}){let{x:n,y:i,text:o=ai(t)&&kI(t)?K:nr,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:y,fontWeight:g,rotate:b}=r,[x,_]=Me(b,0),[v,w]=Dlt(p);if(super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:nj(x),optional:!0},text:{value:o,filter:Pb,optional:!0}},r,Tlt),this.rotate=_,this.textAnchor=Fe(a,"middle"),this.lineAnchor=Gr(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=JN(f),this.monospace=!!d,this.fontFamily=vr(h),this.fontSize=w,this.fontStyle=vr(m),this.fontVariant=vr(y),this.fontWeight=vr(g),this.frameAnchor=Ba(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=e6(this),this.clipLine=r6(this)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=n,{rotate:p}=this,[m,y]=an(this,i);return pt("svg:g",o).call(Qt,this,i,o).call(t6,this,f,i).call(Pt,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(Xt,this).call(Alt,this,f,d).attr("transform",Fu`translate(${c?b=>c[b]:m},${l?b=>l[b]:y})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(yt,"font-size",h&&(b=>h[b])).call(ge,this,n)).node()}};function JN(e){return e==null?null:Gr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function Alt(e,t,r,n){if(!r)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(_s(r[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(So.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!n&&u[0]!==r[l]){let h=this.ownerDocument.createElementNS(So.svg,"title");h.textContent=r[l],this.appendChild(h)}})}function Fa(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=br(t,r)),new Sd(e,{...n,x:t,y:r})}function mT(e,{x:t=K,...r}={}){return new Sd(e,pT({...r,x:t}))}function yT(e,{y:t=K,...r}={}){return new Sd(e,hT({...r,y:t}))}function t6(e,t,r){yt(e,"text-anchor",t.textAnchor),yt(e,"font-family",t.fontFamily),yt(e,"font-size",t.fontSize),yt(e,"font-style",t.fontStyle),yt(e,"font-variant",t.fontVariant===void 0?Mlt(r):t.fontVariant),yt(e,"font-weight",t.fontWeight)}function Mlt(e){return e&&(sl(e)||lr(e))?"tabular-nums":void 0}var Elt=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function Dlt(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),Elt.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function Blt(e,t,r){let n=[],i,o=0;for(let[s,a,c]of Olt(e)){if(i===void 0&&(i=s),o>i&&r(e,i,a)>t&&(n.push(e.slice(i,o)+(e[o-1]===Kq?"-":"")),i=s),c){n.push(e.slice(i,a)),i=void 0;continue}o=a}return n}function*Olt(e){let t=0,r=0,n=e.length;for(;r<n;){let i=1;switch(e[r]){case Kq:case"-":++r,yield[t,r,!1],t=r;break;case" ":for(yield[t,r,!1];e[++r]===" ";);t=r;break;case"\r":e[r+1]===`
25
+ }`)).call(Ud,u),b=D=>D.selectAll(".tick line").attr("y1",s+c-o),w,v=p?(D,k)=>D.rangeRound(k):(D,k)=>D.range(k),{type:_,domain:T,range:A,interpolate:E,scale:O,pivot:I}=e;if(E){let D=A===void 0?E:Bo(E.length===1?zy(E):E,A);w=v(O.copy(),jn(Ee(l,i-a),Math.min(T.length+(I!==void 0),A===void 0?1/0:A.length)));let k=256,S=g.document.createElement("canvas");S.width=k,S.height=1;let M=S.getContext("2d");for(let N=0,L=k-1;N<k;++N)M.fillStyle=D(N/L),M.fillRect(N,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(_==="threshold"){let D=T,k=d===void 0?S=>S:typeof d=="string"?Ii(d):d;w=v(la().domain([-1,A.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(A).enter().append("rect").attr("x",(S,M)=>w(M-1)).attr("y",s).attr("width",(S,M)=>w(M)-w(M-1)).attr("height",o-s-c).attr("fill",S=>S),f=Wt(D,(S,M)=>M),d=S=>k(D[S],S)}else w=v(Ic().domain(T),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(T).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",O),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(oE(w).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",be(h,"normal")).call(b).call(D=>D.select(".domain").remove()),n!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),x.node()}var zd=Math.PI/180;function lo(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=e6(n),e.markerMid=e6(r),e.markerEnd=e6(i)}function e6(e){if(e==null||e===!1)return null;if(e===!0)return O$;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return M$("auto");case"arrow-reverse":return M$("auto-start-reverse");case"dot":return Xnt;case"circle":case"circle-fill":return O$;case"circle-stroke":return Hnt;case"tick":return n6("auto");case"tick-x":return n6(90);case"tick-y":return n6(0)}throw new Error(`invalid marker: ${e}`)}function M$(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function Xnt(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function O$(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function Hnt(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function n6(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var Qnt=0;function Da(e,t,{stroke:n},r){return R$(e,t,n&&(i=>n[i]),null,r)}function N$(e,t,{stroke:n,z:r},i){return R$(e,t,n&&(([o])=>n[o]),r,i)}var r6=1,D$=2;function Znt(e,t){let n=new Uint8Array(t.length),r=e.data().filter(o=>o.length>1),i=r.length;for(let o=0,s=Rv;o<i;++o){let a=r[o];if(a.length>1){let c=a[0];s!==(s=Ni(t[c]))&&(n[c]|=r6)}}for(let o=i-1,s=Rv;o>=0;--o){let a=r[o];if(a.length>1){let c=a[0];s!==(s=Ni(t[c]))&&(n[c]|=D$)}}return([o])=>n[o]}function R$(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s,a){if(!t&&!n&&!r)return;let c=new Map,l=s&&Znt(e,s);function u(f,d,h){return function(p){if(h&&!h(p))return;let m=o(p),y=c.get(d);y||c.set(d,y=new Map);let g=y.get(m);if(!g){let x=this.parentNode.insertBefore(d(m,a),this),b=`plot-marker-${++Qnt}`;x.setAttribute("id",b),y.set(m,g=`url(#${b})`)}this.setAttribute(f,g)}}t&&e.each(u("marker-start",t,l&&(f=>l(f)&r6))),n&&l&&e.each(u("marker-start",n,f=>!(l(f)&r6))),n&&e.each(u("marker-mid",n)),r&&e.each(u("marker-end",r,l&&(f=>l(f)&D$)))}function Iu({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=L$(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Tu({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=L$(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function L$(e,t,n){return e===void 0&&t===void 0&&n===void 0?Be?[1,0]:[.5,.5]:[t,n]}function F$(e,{interval:t}){return e={...Di(e)},e.interval=Od(e.interval===void 0?t:e.interval),e}function Cv(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=F$(i,n);if(a==null||c==null&&!r)return n;let l=Pn(i);if(c==null){let h,p={transform:m=>h||(h=gt(m,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Wt(gt(u=h,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function k$(e,t,n){let{[e]:r}=n,{value:i,interval:o}=F$(r,n);return i==null||o==null?n:t({...n,[e]:{label:Pn(r),transform:s=>{let a=Wt(gt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(ke(a)?(l,u)=>l==null||isNaN(l=+l)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((l+u)/2):(l,u)=>l==null||(u=c[u],u==null)?NaN:(+l+ +u)/2)}}})}function i6(e={}){return Cv("x",Iu,e,!0)}function o6(e={}){return Cv("y",Tu,e,!0)}function jd(e={}){return Cv("x",Iu,e)}function Vd(e={}){return Cv("y",Tu,e)}function Bv(e={}){return k$("x",Iu,e)}function Pv(e={}){return k$("y",Tu,e)}var C$={ariaLabel:"rule",fill:null,stroke:"currentColor"},Yy=class extends xt{constructor(t,n={}){let{x:r,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},co(n,"x"),C$),this.insetTop=ee(a),this.insetBottom=ee(c),lo(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:x}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s},Be,0).call(b=>b.selectAll().data(t).enter().append("line").call(It,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!ri(a)?w=>l[w]+g:h+g).attr("y2",u&&!ri(a)?a.bandwidth?w=>u[w]+a.bandwidth()-x:w=>u[w]-x:d-y-x).call(Yt,this,r).call(Da,this,r,o)).node()}},Gy=class extends xt{constructor(t,n={}){let{x1:r,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},co(n,"y"),C$),this.insetRight=ee(a),this.insetLeft=ee(c),lo(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:x}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{y:c&&a},0,Be).call(b=>b.selectAll().data(t).enter().append("line").call(It,this).attr("x1",l&&!ri(s)?w=>l[w]+g:m+g).attr("x2",u&&!ri(s)?s.bandwidth?w=>u[w]+s.bandwidth()-x:w=>u[w]-x:f-p-x).attr("y1",c?w=>c[w]:(h+d-y)/2).attr("y2",c?w=>c[w]:(h+d-y)/2).call(Yt,this,r).call(Da,this,r,o)).node()}};function ii(e,t){let{x:n=X,y:r,y1:i,y2:o,...s}=Vd(t);return[i,o]=B$(r,i,o),new Yy(e,{...s,x:n,y1:i,y2:o})}function oi(e,t){let{y:n=X,x:r,x1:i,x2:o,...s}=jd(t);return[i,o]=B$(r,i,o),new Gy(e,{...s,y:n,x1:i,x2:o})}function B$(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function uo(e,...t){let n=t.length;for(let r=0,i=!0;r<n;++r)typeof t[r]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(r,2,e[r]+t[r]+e[r+1]),t.splice(r,1),--r,--n);return r=>{let i=e[0];for(let o=0;o<n;++o)i+=t[o](r)+e[o+1];return i}}var Knt={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},j$="\xAD",Au=class extends xt{constructor(t,n={}){let{x:r,y:i,text:o=gr(t)&&lv(t)?X:ye,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:y,fontWeight:g,rotate:x}=n,[b,w]=ae(x,0),[v,_]=nrt(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:YP(b),optional:!0},text:{value:o,filter:Ay,optional:!0}},n,Knt),this.rotate=w,this.textAnchor=be(a,"middle"),this.lineAnchor=un(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=a6(f),this.monospace=!!d,this.fontFamily=Ye(h),this.fontSize=_,this.fontStyle=Ye(m),this.fontVariant=Ye(y),this.fontWeight=Ye(g),this.frameAnchor=ns(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=l6(this),this.clipLine=u6(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[m,y]=vn(this,i);return ct("svg:g",o).call(Rt,this,i,o).call(c6,this,f,i).call(Et,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(It,this).call(Jnt,this,f,d).attr("transform",uo`translate(${c?x=>c[x]:m},${l?x=>l[x]:y})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(x=>h[x])).call(Yt,this,r)).node()}};function a6(e){return e==null?null:un(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function Jnt(e,t,n,r){if(!n)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(as(n[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(ar.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(ar.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function cs(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new Au(e,{...r,x:t,y:n})}function $v(e,{x:t=X,...n}={}){return new Au(e,Pv({...n,x:t}))}function Uv(e,{y:t=X,...n}={}){return new Au(e,Bv({...n,y:t}))}function c6(e,t,n){ft(e,"text-anchor",t.textAnchor),ft(e,"font-family",t.fontFamily),ft(e,"font-size",t.fontSize),ft(e,"font-style",t.fontStyle),ft(e,"font-variant",t.fontVariant===void 0?trt(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function trt(e){return e&&(Sa(e)||ke(e))?"tabular-nums":void 0}var ert=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function nrt(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),ert.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function rrt(e,t,n){let r=[],i,o=0;for(let[s,a,c]of irt(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===j$?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*irt(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case j$:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
35
26
  `&&++i;case`
36
- `:yield[t,r,!0],r+=i,t=r;break;default:++r;break}}yield[t,r,!0]}var Gq={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 gT(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Jp(e,i))n+=Gq[e[i]]??(Jq(e,i)?120:Gq.e);return n}function bT(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Jp(e,i))n+=Jq(e,i)?126:63;return n}function e6({monospace:e,lineWidth:t,textOverflow:r}){if(r!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let n=e?bT:gT,i=t*100;return o=>Blt(o,i,n)}function r6({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return o=>o;let n=e?bT:gT,i=t*100;switch(r){case"clip-start":return o=>Hq(o,i,n,"");case"clip-end":return o=>Xq(o,i,n,"");case"ellipsis-start":return o=>Hq(o,i,n,vd);case"ellipsis-middle":return o=>Nlt(o,i,n,vd);case"ellipsis-end":return o=>Xq(o,i,n,vd)}}var vd="\u2026";function Id(e,t,r,n){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Jp(e,s);let l=r(e,s,a);if(o+l>t){for(o+=n;o>t&&s>0;)a=s,s=i.pop(),o-=r(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function Xq(e,t,r,n){e=e.trim();let i=r(n),[o]=Id(e,t,r,i);return o<0?e:e.slice(0,o).trimEnd()+n}function Nlt(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n)/2,[s,a]=Id(e,t/2,r,o),[c]=Id(e,i-t/2-a+o,r,-o);return c<0?n:e.slice(0,s).trimEnd()+n+e.slice(Jp(e,c)).trimStart()}function Hq(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n),[s]=Id(e,i-t+o,r,-o);return s<0?n:n+e.slice(Jp(e,s)).trimStart()}var QN=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,Zq=/\p{Extended_Pictographic}/uy;function Jp(e,t){return t+=Flt(e,t)?2:1,Llt(e,t)&&(t=QN.lastIndex),Rlt(e,t)?Jp(e,t+1):t}function Qq(e,t){return e.charCodeAt(t)<128}function Flt(e,t){let r=e.charCodeAt(t);if(r>=55296&&r<56320){let n=e.charCodeAt(t+1);return n>=56320&&n<57344}return!1}function Rlt(e,t){return e.charCodeAt(t)===8205}function Llt(e,t){return Qq(e,t)?!1:(QN.lastIndex=t,QN.test(e))}function Jq(e,t){return Qq(e,t)?!1:(Zq.lastIndex=t,Zq.test(e))}var tY={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},eY=3.5,klt=eY*5,rY={draw(e,t,r){let n=t*r/klt;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},nY={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},Clt=new Map([["arrow",rY],["spike",nY]]);function Ult(e){return e&&typeof e.draw=="function"}function Plt(e){if(Ult(e))return e;let t=Clt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Td=class extends Ft{constructor(t,r={}){let{x:n,y:i,r:o=eY,length:s,rotate:a,shape:c=rY,anchor:l="middle",frameAnchor:u}=r,[f,d]=Me(s,12),[h,p]=Me(a,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},r,tY),this.r=+o,this.length=d,this.rotate=p,this.shape=Plt(c),this.anchor=Gr(l,"anchor",["start","middle","end"]),this.frameAnchor=Ba(u)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,length:u,rotate:f}=n,{length:d,rotate:h,anchor:p,shape:m,r:y}=this,[g,b]=an(this,i);return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Xt,this).attr("transform",Fu`translate(${c?_=>c[_]:g},${l?_=>l[_]:b})${f?_=>` rotate(${f[_]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?_=>` translate(0,${u[_]})`:` translate(0,${d})`:u?_=>` translate(0,${u[_]/2})`:` translate(0,${d/2})`}`).attr("d",u?_=>{let v=ti();return m.draw(v,u[_],y),v}:(()=>{let _=ti();return m.draw(_,d,y),_})()).call(ge,this,n)).node()}};function n6(e,t={}){let{x:r,y:n,...i}=t;return t.frameAnchor===void 0&&([r,n]=br(r,n)),new Td(e,{...i,x:r,y:n})}function xT(e,t={}){let{x:r=K,...n}=t;return new Td(e,{...n,x:r})}function _T(e,t={}){let{y:r=K,...n}=t;return new Td(e,{...n,y:r})}function iY(e,t={}){let{shape:r=nY,stroke:n=tY.stroke,strokeWidth:i=1,fill:o=n,fillOpacity:s=.3,anchor:a="start",...c}=t;return n6(e,{...c,shape:r,stroke:n,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function Ru(e,t){return arguments.length<2&&!ai(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function wT({anchor:e}={},t){return e===void 0?t[0]:Gr(e,"anchor",t)}function oY(e){return wT(e,["left","right"])}function sY(e){return wT(e,["right","left"])}function aY(e){return wT(e,["bottom","top"])}function cY(e){return wT(e,["top","bottom"])}function ix(){let[e,t]=Ru(...arguments);return lY("y",oY(t),e,t)}function vT(){let[e,t]=Ru(...arguments);return lY("fy",sY(t),e,t)}function ox(){let[e,t]=Ru(...arguments);return uY("x",aY(t),e,t)}function ST(){let[e,t]=Ru(...arguments);return uY("fx",cY(t),e,t)}function lY(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:b,marginTop:x=b===void 0?20:b,marginRight:_=b===void 0?t==="right"?40:0:b,marginBottom:v=b===void 0?20:b,marginLeft:w=b===void 0?t==="left"?40:0:b,label:I,labelAnchor:E,labelArrow:T,labelOffset:B,...A}){return p=Gt(p),m=Gt(m),y=Gt(y),E!==void 0&&(E=Gr(E,"labelAnchor",["center","top","bottom"])),T=bY(T),$r(p&&!Ie(o)?$lt(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...A}):null,Ie(c)?null:Vlt(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...A}),!Ie(c)&&I!==null?Fa([],pY({fill:c,fillOpacity:l,...A},function(O,L,S,M,D){let C=M[e],{marginTop:U,marginRight:k,marginBottom:$,marginLeft:z}=e==="y"&&D.inset||D,V=E??(C.bandwidth?"center":"top"),Q=B??(t==="right"?k:z)-3;return V==="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=V,this.frameAnchor=`${V}-${t}`,this.rotate=0),this.dy=V==="top"?3-U:V==="bottom"?$-3:0,this.dx=t==="right"?Q:-Q,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[gY(e,C,{anchor:t,label:I,labelAnchor:V,labelArrow:T})]}}}})):null)}function uY(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:b,marginTop:x=b===void 0?t==="top"?30:0:b,marginRight:_=b===void 0?20:b,marginBottom:v=b===void 0?t==="bottom"?30:0:b,marginLeft:w=b===void 0?20:b,label:I,labelAnchor:E,labelArrow:T,labelOffset:B,...A}){return p=Gt(p),m=Gt(m),y=Gt(y),E!==void 0&&(E=Gr(E,"labelAnchor",["center","left","right"])),T=bY(T),$r(p&&!Ie(o)?zlt(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...A}):null,Ie(c)?null:jlt(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...A}),!Ie(c)&&I!==null?Fa([],pY({fill:c,fillOpacity:l,...A},function(O,L,S,M,D){let C=M[e],{marginTop:U,marginRight:k,marginBottom:$,marginLeft:z}=e==="x"&&D.inset||D,V=E??(C.bandwidth?"center":"right"),Q=B??(t==="top"?U:$)-3;return V==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${V}`,this.textAnchor=V==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-Q:Q,this.dx=V==="right"?k-3:V==="left"?3-z:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[gY(e,C,{anchor:t,label:I,labelAnchor:V,labelArrow:T})]}}}})):null)}function $lt(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return tm(_T,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-ur+ +u:+d+ur-f,anchor:"start",length:c,shape:t==="left"?Glt:Xlt})}function zlt(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return tm(xT,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-ur-f:+d+ur+ +u,anchor:"start",length:c,shape:t==="bottom"?Ylt:Wlt})}function Vlt(e,t,r,{facetAnchor:n=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*Qp):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y=e==="y"?void 0:null,...g}){return tm(yT,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(b,x,_,v,w){f===void 0&&(this.fontVariant=yY(b)),c===void 0&&(w.text=mY(b,x,_,v,t))})}function jlt(e,t,r,{facetAnchor:n=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*Qp):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:y=e==="x"?void 0:null,...g}){return tm(mT,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(b,x,_,v,w){f===void 0&&(this.fontVariant=yY(b)),c===void 0&&(w.text=mY(b,x,_,v,t))})}function IT(){let[e,t]=Ru(...arguments);return fY("y",oY(t),e,t)}function TT(){let[e,t]=Ru(...arguments);return fY("fy",sY(t),e,t)}function AT(){let[e,t]=Ru(...arguments);return dY("x",aY(t),e,t)}function MT(){let[e,t]=Ru(...arguments);return dY("fx",cY(t),e,t)}function fY(e,t,r,{y:n=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return tm(Qi,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:n,x1:o,x2:s,...hY(a)})}function dY(e,t,r,{x:n=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return tm(Ki,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:n,y1:o,y2:s,...hY(a)})}function hY({color:e="currentColor",opacity:t=.1,stroke:r=e,strokeOpacity:n=t,strokeWidth:i=1,...o}){return{stroke:r,strokeOpacity:n,strokeWidth:i,...o}}function pY({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=cr(e),[,t]=Me(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function tm(e,t,r,n,i,o){let s;function a(u,f,d,h,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=h;if(!g)throw new Error(`missing scale: ${t}`);let b=g.domain(),{interval:x,ticks:_,tickFormat:v,tickSpacing:w=t==="x"?80:35}=i;if(typeof _=="string"&&xY(g)&&(x=_,_=void 0),_===void 0&&(_=Da(x,g.type)??qlt(g,w)),u==null){if(ai(_))u=Sr(_);else if(vu(_))u=i6(_,...Oe(b));else if(g.interval){let E=g.interval;if(g.ticks){let[T,B]=Oe(b),A=(B-T)/E[Fp];E=eN(E,A/_)??E,u=i6(E,T,B)}else{u=b;let T=u.length;E=eN(E,T/_)??E,E!==g.interval&&(u=i6(E,...Oe(u)))}if(E===g.interval){let T=Math.round(u.length/_);T>1&&(u=u.filter((B,A)=>A%T===0))}}else g.ticks?u=g.ticks(_):u=b;if(!g.ticks&&u.length&&u!==b){let E=new Zn(b);u=u.filter(T=>E.has(T)),u.length||Cn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[si(u)]:s[t]={scale:t,value:K}}o?.call(this,g,u,_,v,s);let I=Object.fromEntries(Object.entries(s).map(([E,T])=>[E,{...T,value:At(u,T.value)}]));return y&&(f=m.filterFacets(u,I)),{data:u,facets:f,channels:I}}let c=Je(i).initializer,l=e(r,Je({...i,initializer:a},c));return r==null?(s=l.channels,l.channels={}):s={},n!==void 0&&Object.assign(l,n),l.clip===void 0&&(l.clip=!1),l}function qlt(e,t){let[r,n]=Oe(e.range());return(n-r)/t}function mY(e,t,r,n,i){return{value:sx(e,t,r,n,i)}}function sx(e,t,r,n,i){return typeof n=="function"?n:n===void 0&&t&&lr(t)?HV(e.type,t,i)??_s:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):n===void 0?_s:typeof n=="string"?(lr(e.domain())?Ia:Mo)(n):en(n)}function i6(e,t,r){return e.range(t,e.offset(e.floor(r)))}var Ylt={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},Wlt={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},Glt={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},Xlt={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function yY(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function gY(e,t,{anchor:r,label:n=t.label,labelAnchor:i,labelArrow:o}={}){if(!(n==null||n.inferred&&xY(t)&&/^(date|time|year)$/i.test(n))){if(n=String(n),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(n)),!o)return n;if(o===!0){let s=QI(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${n}`;case"right":return`${n} \u2192`;case"up":return r==="right"?`${n} \u2191`:`\u2191 ${n}`;case"down":return r==="right"?`${n} \u2193`:`\u2193 ${n}`}return n}}function bY(e="auto"){return Ie(e)?!1:typeof e=="boolean"?e:Gr(e,"labelArrow",["auto","up","right","down","left"])}function xY(e){return lr(e.domain())}function _Y(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function wY(e,{opacity:t,...r}={}){if(!Na(e)&&!UN(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return SY(e,r,(n,i,o,s)=>n.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",Me(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function vY(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:r=1,stroke:n=e.hint?.stroke!==void 0?e.hint.stroke:Ie(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=cr(t),[f,d]=cr(n),h=_Y(c,l),p=_Y(c,f),m=s*s*Math.PI;return r=Me(r)[1],i=Me(i)[1],o=Me(o)[1],SY(e,a,(y,g,b,x)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",b).attr("height",x).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",r).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=ti();return e.scale(_).draw(v,m),v}))}function SY(e,t={},r){let{columns:n,tickFormat:i,fontVariant:o=lT(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=Mu(t);u=Hp(u),i=sx(e.scale,e.domain,void 0,i);let p=pt("div",h).attr("class",`${u}-swatches ${u}-swatches-${n!=null?"columns":"wrap"}`),m;return n!=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 P$={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"\u2018":31,"\u2019":31,"\u201C":47,"\u201D":47,"\u2026":82};function zv(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qd(e,i))r+=P$[e[i]]??(q$(e,i)?120:P$.e);return r}function jv(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qd(e,i))r+=q$(e,i)?126:63;return r}function l6({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?jv:zv,i=t*100;return o=>rrt(o,i,r)}function u6({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?jv:zv,i=t*100;switch(n){case"clip-start":return o=>U$(o,i,r,"");case"clip-end":return o=>$$(o,i,r,"");case"ellipsis-start":return o=>U$(o,i,r,Eu);case"ellipsis-middle":return o=>ort(o,i,r,Eu);case"ellipsis-end":return o=>$$(o,i,r,Eu)}}var Eu="\u2026";function Mu(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=qd(e,s);let l=n(e,s,a);if(o+l>t){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function $$(e,t,n,r){e=e.trim();let i=n(r),[o]=Mu(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function ort(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Mu(e,t/2,n,o),[c]=Mu(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(qd(e,c)).trimStart()}function U$(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Mu(e,i-t+o,n,-o);return s<0?r:r+e.slice(qd(e,s)).trimStart()}var s6=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,z$=/\p{Extended_Pictographic}/uy;function qd(e,t){return t+=srt(e,t)?2:1,crt(e,t)&&(t=s6.lastIndex),art(e,t)?qd(e,t+1):t}function V$(e,t){return e.charCodeAt(t)<128}function srt(e,t){let n=e.charCodeAt(t);if(n>=55296&&n<56320){let r=e.charCodeAt(t+1);return r>=56320&&r<57344}return!1}function art(e,t){return e.charCodeAt(t)===8205}function crt(e,t){return V$(e,t)?!1:(s6.lastIndex=t,s6.test(e))}function q$(e,t){return V$(e,t)?!1:(z$.lastIndex=t,z$.test(e))}var Y$={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},G$=3.5,lrt=G$*5,W$={draw(e,t,n){let r=t*n/lrt;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},X$={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},urt=new Map([["arrow",W$],["spike",X$]]);function frt(e){return e&&typeof e.draw=="function"}function drt(e){if(frt(e))return e;let t=urt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Ou=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o=G$,length:s,rotate:a,shape:c=W$,anchor:l="middle",frameAnchor:u}=n,[f,d]=ae(s,12),[h,p]=ae(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,Y$),this.r=+o,this.length=d,this.rotate=p,this.shape=drt(c),this.anchor=un(l,"anchor",["start","middle","end"]),this.frameAnchor=ns(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:m,r:y}=this,[g,x]=vn(this,i);return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(It,this).attr("transform",uo`translate(${c?w=>c[w]:g},${l?w=>l[w]:x})${f?w=>` rotate(${f[w]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${d})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${d/2})`}`).attr("d",u?w=>{let v=ur();return m.draw(v,u[w],y),v}:(()=>{let w=ur();return m.draw(w,d,y),w})()).call(Yt,this,r)).node()}};function f6(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=je(n,r)),new Ou(e,{...i,x:n,y:r})}function Vv(e,t={}){let{x:n=X,...r}=t;return new Ou(e,{...r,x:n})}function qv(e,t={}){let{y:n=X,...r}=t;return new Ou(e,{...r,y:n})}function H$(e,t={}){let{shape:n=X$,stroke:r=Y$.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return f6(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function Gc(e,t){return arguments.length<2&&!gr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function Yv({anchor:e}={},t){return e===void 0?t[0]:un(e,"anchor",t)}function Q$(e){return Yv(e,["left","right"])}function Z$(e){return Yv(e,["right","left"])}function K$(e){return Yv(e,["bottom","top"])}function J$(e){return Yv(e,["top","bottom"])}function Wy(){let[e,t]=Gc(...arguments);return tU("y",Q$(t),e,t)}function Gv(){let[e,t]=Gc(...arguments);return tU("fy",Z$(t),e,t)}function Xy(){let[e,t]=Gc(...arguments);return eU("x",K$(t),e,t)}function Wv(){let[e,t]=Gc(...arguments);return eU("fx",J$(t),e,t)}function tU(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?t==="right"?40:0:x,marginBottom:v=x===void 0?20:x,marginLeft:_=x===void 0?t==="left"?40:0:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:O,...I}){return p=ee(p),m=ee(m),y=ee(y),A!==void 0&&(A=un(A,"labelAnchor",["center","top","bottom"])),E=lU(E),on(p&&!oe(o)?hrt(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...I}):null,oe(c)?null:mrt(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:b,marginRight:w,marginBottom:v,marginLeft:_,...I}),!oe(c)&&T!==null?cs([],oU({fill:c,fillOpacity:l,...I},function(D,k,S,M,N){let L=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="y"&&N.inset||N,U=A??(L.bandwidth?"center":"top"),H=O??(t==="right"?C:$)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-B:U==="bottom"?P-3:0,this.dx=t==="right"?H:-H,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[cU(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:E})]}}}})):null)}function eU(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:v=x===void 0?t==="bottom"?30:0:x,marginLeft:_=x===void 0?20:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:O,...I}){return p=ee(p),m=ee(m),y=ee(y),A!==void 0&&(A=un(A,"labelAnchor",["center","left","right"])),E=lU(E),on(p&&!oe(o)?prt(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...I}):null,oe(c)?null:yrt(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:b,marginRight:w,marginBottom:v,marginLeft:_,...I}),!oe(c)&&T!==null?cs([],oU({fill:c,fillOpacity:l,...I},function(D,k,S,M,N){let L=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="x"&&N.inset||N,U=A??(L.bandwidth?"center":"right"),H=O??(t==="top"?B:P)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-H:H,this.dx=U==="right"?C-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[cU(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:E})]}}}})):null)}function hrt(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Yd(qv,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Be+ +u:+d+Be-f,anchor:"start",length:c,shape:t==="left"?wrt:_rt})}function prt(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Yd(Vv,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Be-f:+d+Be+ +u,anchor:"start",length:c,shape:t==="bottom"?xrt:brt})}function mrt(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*zd):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y=e==="y"?void 0:null,...g}){return Yd(Uv,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,w,v,_){f===void 0&&(this.fontVariant=aU(x)),c===void 0&&(_.text=sU(x,b,w,v,t))})}function yrt(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*zd):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:y=e==="x"?void 0:null,...g}){return Yd($v,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,w,v,_){f===void 0&&(this.fontVariant=aU(x)),c===void 0&&(_.text=sU(x,b,w,v,t))})}function Xv(){let[e,t]=Gc(...arguments);return nU("y",Q$(t),e,t)}function Hv(){let[e,t]=Gc(...arguments);return nU("fy",Z$(t),e,t)}function Qv(){let[e,t]=Gc(...arguments);return rU("x",K$(t),e,t)}function Zv(){let[e,t]=Gc(...arguments);return rU("fx",J$(t),e,t)}function nU(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return Yd(oi,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:r,x1:o,x2:s,...iU(a)})}function rU(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return Yd(ii,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:r,y1:o,y2:s,...iU(a)})}function iU({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function oU({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=Fe(e),[,t]=ae(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Yd(e,t,n,r,i,o){let s;function a(u,f,d,h,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=h;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:b,ticks:w,tickFormat:v,tickSpacing:_=t==="x"?80:35}=i;if(typeof w=="string"&&uU(g)&&(b=w,w=void 0),w===void 0&&(w=es(b,g.type)??grt(g,_)),u==null){if(gr(w))u=ti(w);else if(kc(w))u=d6(w,...ne(x));else if(g.interval){let A=g.interval;if(g.ticks){let[E,O]=ne(x),I=(O-E)/A[Td];A=t3(A,I/w)??A,u=d6(A,E,O)}else{u=x;let E=u.length;A=t3(A,E/w)??A,A!==g.interval&&(u=d6(A,...ne(u)))}if(A===g.interval){let E=Math.round(u.length/w);E>1&&(u=u.filter((O,I)=>I%E===0))}}else g.ticks?u=g.ticks(w):u=x;if(!g.ticks&&u.length&&u!==x){let A=new or(x);u=u.filter(E=>A.has(E)),u.length||Hn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[yr(u)]:s[t]={scale:t,value:X}}o?.call(this,g,u,w,v,s);let T=Object.fromEntries(Object.entries(s).map(([A,E])=>[A,{...E,value:gt(u,E.value)}]));return y&&(f=m.filterFacets(u,T)),{data:u,facets:f,channels:T}}let c=xe(i).initializer,l=e(n,xe({...i,initializer:a},c));return n==null?(s=l.channels,l.channels={}):s={},r!==void 0&&Object.assign(l,r),l.clip===void 0&&(l.clip=!1),l}function grt(e,t){let[n,r]=ne(e.range());return(r-n)/t}function sU(e,t,n,r,i){return{value:Hy(e,t,n,r,i)}}function Hy(e,t,n,r,i){return typeof r=="function"&&!(e.type==="log"&&e.tickFormat)?r:r===void 0&&t&&ke(t)?BP(e.type,t,i)??as:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?as:typeof r=="string"?(ke(e.domain())?Qo:Ii)(r):Ce(r)}function d6(e,t,n){return e.range(t,e.offset(e.floor(n)))}var xrt={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},brt={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},wrt={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},_rt={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function aU(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function cU(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&uU(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){let s=Iv(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${r}`;case"right":return`${r} \u2192`;case"up":return n==="right"?`${r} \u2191`:`\u2191 ${r}`;case"down":return n==="right"?`${r} \u2193`:`\u2193 ${r}`}return r}}function lU(e="auto"){return oe(e)?!1:typeof e=="boolean"?e:un(e,"labelArrow",["auto","up","right","down","left"])}function uU(e){return ke(e.domain())}function fU(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function dU(e,{opacity:t,...n}={}){if(!os(e)&&!U3(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return pU(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ae(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function hU(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:oe(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Fe(t),[f,d]=Fe(r),h=fU(c,l),p=fU(c,f),m=s*s*Math.PI;return n=ae(n)[1],i=ae(i)[1],o=ae(o)[1],pU(e,a,(y,g,x,b)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?w=>h.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let v=ur();return e.scale(w).draw(v,m),v}))}function pU(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=kv(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=zc(t);u=Vc(u),i=Hy(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
37
28
  display: flex;
38
29
  align-items: center;
39
30
  break-inside: avoid;
@@ -46,7 +37,7 @@ ${r}`}function cct(e){return e==="time"?NI:e==="utc"?zb:sct}function HV(e,t,r){l
46
37
  white-space: nowrap;
47
38
  overflow: hidden;
48
39
  text-overflow: ellipsis;
49
- }`,p.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(r,e,a,c).call(y=>y.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(m=`:where(.${u}-swatches-wrap) {
40
+ }`,p.style("columns",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,c).call(y=>y.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(m=`:where(.${u}-swatches-wrap) {
50
41
  display: flex;
51
42
  align-items: center;
52
43
  min-height: 33px;
@@ -56,7 +47,7 @@ ${r}`}function cct(e){return e==="time"?NI:e==="utc"?zb:sct}function HV(e,t,r){l
56
47
  display: inline-flex;
57
48
  align-items: center;
58
49
  margin-right: 1em;
59
- }`,p.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(r,e,a,c).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),p.call(y=>y.insert("style","*").text(`:where(.${u}-swatches) {
50
+ }`,p.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(n,e,a,c).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),p.call(y=>y.insert("style","*").text(`:where(.${u}-swatches) {
60
51
  font-family: system-ui, sans-serif;
61
52
  font-size: 10px;
62
53
  margin-bottom: 0.5em;
@@ -65,7 +56,7 @@ ${r}`}function cct(e){return e==="time"?NI:e==="utc"?zb:sct}function HV(e,t,r){l
65
56
  margin-right: 0.5em;
66
57
  overflow: visible;
67
58
  }
68
- ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",Fe(o,"normal")).call(Zp,f).node()}var ET=new Map([["symbol",vY],["color",AY],["opacity",Hlt]]);function IY(e={}){for(let[t,r]of ET){let n=e[t];if(Ma(n)){let i=Mu(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Ma(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return r(tT(t,n,o),o6(i,n,e),s=>Ma(e[s])?tT(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function TY(e,t,r={}){return(n,i)=>{if(!ET.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return ET.get(n)(e[n],o6(t,r[n],i),o=>e[o])}}function o6({className:e,...t},{label:r,ticks:n,tickFormat:i}={},o){return lj(o,{className:e,...t},{label:r,ticks:n,tickFormat:i})}function AY(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return wY(e,r);case"ramp":return Cq(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function Hlt({type:e,interpolate:t,...r},{legend:n=!0,color:i=Yr(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(n===!0&&(n="ramp"),`${n}`.toLowerCase()!=="ramp")throw new Error(`${n} opacity legends are not supported`);return AY({type:e,...r,interpolate:Zlt(i)},{legend:n,...o})}function Zlt(e){let{r:t,g:r,b:n}=Yr(e)||Yr(0,0,0);return i=>`rgba(${t},${r},${n},${i})`}function MY(e,t,r){let n=[];for(let[i,o]of ET){let s=r[i];if(s?.legend&&i in e){let a=o(e[i],o6(t,e[i],s),c=>e[c]);a!=null&&n.push(a)}}return n}var Klt={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Qlt={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},ax=class extends Ft{constructor(t={}){let{anchor:r=null,inset:n=0,insetTop:i=n,insetRight:o=n,insetBottom:s=n,insetLeft:a=n,rx:c,ry:l}=t;super(xu,void 0,t,r==null?Klt:Qlt),this.anchor=sN(r,"anchor",["top","right","bottom","left"]),this.insetTop=Gt(i),this.insetRight=Gt(o),this.insetBottom=Gt(s),this.insetLeft=Gt(a),this.rx=Gt(c),this.ry=Gt(l)}render(t,r,n,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:y,rx:g,ry:b}=this,x=l+y,_=u-a-p,v=s+h,w=f-c-m;return pt(d?"svg:line":"svg:rect",o).datum(0).call(Qt,this,i,o).call(Xt,this).call(ge,this,n).call(Pt,this,{}).call(d==="left"?I=>I.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",w):d==="right"?I=>I.attr("x1",_).attr("x2",_).attr("y1",v).attr("y2",w):d==="top"?I=>I.attr("x1",x).attr("x2",_).attr("y1",v).attr("y2",v):d==="bottom"?I=>I.attr("x1",x).attr("x2",_).attr("y1",w).attr("y2",w):I=>I.attr("x",x).attr("y",v).attr("width",_-x).attr("height",w-v).attr("rx",g).attr("ry",b)).node()}};function em(e){return new ax(e)}var s6={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Jlt=new Set(["geometry","href","src","ariaLabel","scales"]),cx=class extends Ft{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&ai(t)&&kI(t)&&(r={...r,title:K});let{x:n,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:b=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:I=8,title:E,pointerSize:T=12,pathFilter:B="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:o!=null&&s!=null?null:n,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:E,optional:!0}},r,s6),this.anchor=UI(l,"anchor"),this.preferredAnchor=UI(u,"preferredAnchor"),this.frameAnchor=Ba(x),this.textAnchor=Fe(v,"middle"),this.textPadding=+I,this.pointerSize=+T,this.pathFilter=vr(B),this.lineHeight=+g,this.lineWidth=+b,this.textOverflow=JN(w),this.monospace=!!f,this.fontFamily=vr(d),this.fontSize=Gt(h),this.fontStyle=vr(p),this.fontVariant=vr(m),this.fontWeight=vr(y);for(let A in s6)A in this.channels&&(this[A]=s6[A]);this.splitLines=e6(this),this.clipLine=r6(this),this.format={..._}}render(t,r,n,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=r,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:b,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:I,x2:E,y2:T,x:B=w??E,y:A=I??T}=n,O=l?l(t.fx)-v:0,L=u?u(t.fy)-_:0,[S,M]=an(this,i),D=WN(n,S),C=GN(n,M),U=p?bT:gT,k=U(vd),$,z;"title"in n?($=n.channels,z=iut):($=nut.call(this,n,r),z=out);let V=pt("svg:g",o).call(Qt,this,i,o).call(t6,this).call(Pt,this,{x:B&&a,y:A&&c}).call(ct=>ct.selectAll().data(t).enter().append("g").attr("transform",ut=>`translate(${Math.round(D(ut))},${Math.round(C(ut))})`).call(Xt,this).call(ut=>ut.append("path").attr("filter",x)).call(ut=>ut.append("text").each(function(X){let lt=ce(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=z.call(s,X,t,$,r,n);if(typeof q=="string")for(let tt of s.splitLines(q))Q(lt,{value:s.clipLine(tt)});else{let tt=new Set;for(let at of q){let{label:j=""}=at;j&&tt.has(j)||(tt.add(j),Q(lt,at))}}})));function Q(ct,{label:ut,value:X,color:lt,opacity:q}){ut??="",X??="";let tt=lt!=null||q!=null,at,j=y*100,[Jt]=Id(ut,j,U,k);if(Jt>=0)ut=ut.slice(0,Jt).trimEnd()+vd,at=X.trim(),X="";else{(ut||!X&&!tt)&&(X=" "+X);let[he]=Id(X,j-U(ut),U,k);he>=0&&(at=X.trim(),X=X.slice(0,he).trimEnd()+vd)}let gt=ct.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");ut&&gt.append("tspan").attr("font-weight","bold").text(ut),X&&gt.append(()=>d.createTextNode(X)),tt&&gt.append("tspan").text(" \u25A0").attr("fill",lt).attr("fill-opacity",q).style("user-select","none"),at&&gt.append("title").text(at)}function st(){let{width:ct,height:ut}=i.facet??i;V.selectChildren().each(function(X){let{x:lt,width:q,height:tt}=this.getBBox();q=Math.round(q),tt=Math.round(tt);let at=h;if(at===void 0){let gt=D(X)+O,he=C(X)+L,ye=gt+q+b+g*2<ct,nt=gt-q-b-g*2>0,Ee=he+tt+b+g*2<ut,Ei=he-tt-b-g*2>0;at=ye&&nt?Ee&&Ei?s.preferredAnchor:Ei?"bottom":"top":Ee&&Ei?ye?"left":"right":(ye||nt)&&(Ee||Ei)?`${Ei?"bottom":"top"}-${ye?"left":"right"}`:s.preferredAnchor}let j=this.firstChild,Jt=this.lastChild;if(j.setAttribute("d",rut(at,b,g,q,tt)),lt)for(let gt of Jt.childNodes)gt.setAttribute("x",-lt);Jt.setAttribute("y",`${+tut(at,Jt.childNodes.length,m).toFixed(6)}em`),Jt.setAttribute("transform",`translate(${eut(at,b,g,q,tt)})`)}),V.attr("visibility",null)}return t.length&&(V.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(st):typeof requestAnimationFrame<"u"&&requestAnimationFrame(st)),V.node()}};function BT(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=br(t,r)),new cx(e,{...n,x:t,y:r})}function tut(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function eut(e,t,r,n,i){switch(e){case"middle":return[-n/2,i/2];case"top-left":return[r,t+r];case"top":return[-n/2,t/2+r];case"top-right":return[-n-r,t+r];case"right":return[-t/2-n-r,i/2];case"bottom-left":return[r,-t-r];case"bottom":return[-n/2,-t/2-r];case"bottom-right":return[-n-r,-t-r];case"left":return[r+t/2,i/2]}}function rut(e,t,r,n,i){let o=n+r*2,s=i+r*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function nut({channels:e},t){let r={},n=this.format;n=EY(n,e,"x"),n=EY(n,e,"y"),this.format=n;for(let i in n){let o=n[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")r[i]=!0;else{let s=Zb(e,i);s&&(r[i]=s)}}for(let i in e){if(i in r||i in n||Jlt.has(i))continue;let o=Zb(e,i);o&&(r[i]=o)}this.facet&&(t.fx&&!("fx"in n)&&(r.fx=!0),t.fy&&!("fy"in n)&&(r.fy=!0));for(let i in r){let o=this.format[i];if(typeof o=="string"){let s=r[i]?.value??t[i]?.domain()??[];this.format[i]=(lr(s)?Ia:Mo)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?sx(s,s.domain()):_s}}return r}function EY(e,t,r){if(!(r in e))return e;let n=`${r}1`,i=`${r}2`;if((n in e||!(n in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[r];return o.splice(o.findIndex(([a])=>a===r)+1,0,[n,s],[i,s]),Object.fromEntries(o)}function iut(e,t,{title:r}){return _s(r.value[e],e)}function*out(e,t,r,n,i){for(let o in r){if(o==="fx"||o==="fy"){yield{label:DT(n,r,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in r||o==="y1"&&"y2"in r)continue;let s=r[o];if(o==="x2"&&"x1"in r)yield{label:BY(n,r,"x"),value:DY(this.format.x2,r.x1,s,e)};else if(o==="y2"&&"y1"in r)yield{label:BY(n,r,"y"),value:DY(this.format.y2,r.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!wr(a)&&c==null)continue;yield{label:DT(n,r,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function DY(e,t,r,n){return r.hint?.length?`${e(r.value[n]-t.value[n],n)}`:`${e(t.value[n],n)}\u2013${e(r.value[n],n)}`}function BY(e,t,r){let n=DT(e,t,`${r}1`,r),i=DT(e,t,`${r}2`,r);return n===i?n:`${n}\u2013${i}`}function DT(e,t,r,n=r){let i=t[r],o=e[i?.scale??r];return String(o?.label??i?.label??n)}function ux(e={}){let{facet:t,style:r,title:n,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Hp(e.className),l=e.marks===void 0?[]:NY(e.marks);l.push(...dut(l));let u=uut(t,e),f=new Map;for(let k of l){let $=FY(k,u,e);$&&f.set(k,$)}let d=new Map;u&&lx(d,[u],e),lx(d,f,e);let h=NY(hut(l,d,e));for(let k of h){let $=FY(k,u,e);$&&f.set(k,$)}l.unshift(...h);let p=Oq(d,e);if(p!==void 0){let k=u?cT(p,u):void 0;for(let z of l){if(z.facet===null||z.facet==="super")continue;let V=f.get(z);V!==void 0&&(V.facetsIndex=z.fx!=null||z.fy!=null?cT(p,V):k)}let $=new Set;for(let{facetsIndex:z}of f.values())z?.forEach((V,Q)=>{V?.length>0&&$.add(Q)});p.forEach(0<$.size&&$.size<p.length?(z,V)=>z.empty=!$.has(V):z=>z.empty=!1);for(let z of l)if(z.facet==="exclude"){let V=f.get(z);V!==void 0&&(V.facetsIndex=Rq(V.facetsIndex))}}for(let k of Re.keys())Ma(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:z}=f.get(k)??{},{data:V,facets:Q,channels:st}=k.initialize($,z,e);l6(st,e),m.set(k,{data:V,facets:Q,channels:st})}let y=Jb(lx(d,m,e),e),g=Dq(y,l,e);xq(y,g);let b=kN(y),{fx:x,fy:_}=b,v=x||_?CN(y,g):g,w=x||_?_ut(b,g):g,I=Mu(e),E=I.document,T=Pc("svg").call(E.documentElement),B=T;I.ownerSVGElement=T,I.className=c,I.projection=Nj(e,v),I.filterFacets=(k,$)=>cT(p,{channels:$,groups:sT(k,$)}),I.getMarkState=k=>{let $=m.get(k),z=f.get(k);return{...$,channels:{...$.channels,...z?.channels}}},I.dispatchValue=k=>{B.value!==k&&(B.value=k,B.dispatchEvent(new Event("input",{bubbles:!0})))};let A=new Set;for(let[k,$]of m)if(k.initializer!=null){let z=k.facet==="super"?w:v,V=k.initializer($.data,$.facets,$.channels,b,z,I);if(V.data!==void 0&&($.data=V.data),V.facets!==void 0&&($.facets=V.facets),V.channels!==void 0){let{fx:Q,fy:st,...ct}=V.channels;lut(ct),Object.assign($.channels,ct);for(let ut of Object.values(ct)){let{scale:X}=ut;X!=null&&!fj(Re.get(X))&&(kY(ut,e),A.add(X))}(Q!=null||st!=null)&&f.set(k,!0)}}if(A.size){let k=new Map;lx(k,m,e,Q=>A.has(Q)),lx(d,m,e,Q=>A.has(Q));let $=xut(Jb(k,e),y),{scales:z,...V}=kN($);Object.assign(y,$),Object.assign(b,V),Object.assign(b.scales,z)}let O,L;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=Nq(p,O),L=Fq(x,_,g));for(let[k,$]of m)$.values=k.scale($.channels,b,I);let{width:S,height:M}=g;ce(T).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",be(o,"normal")).call(Ud,f).node()}var Kv=new Map([["symbol",hU],["color",gU],["opacity",vrt]]);function mU(e={}){for(let[t,n]of Kv){let r=e[t];if(Jo(r)){let i=zc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Jo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(Ev(t,r,o),h6(i,r,e),s=>Jo(e[s])?Ev(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function yU(e,t,n={}){return(r,i)=>{if(!Kv.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return Kv.get(r)(e[r],h6(t,n[r],i),o=>e[o])}}function h6({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return ZP(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function gU(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return dU(e,n);case"ramp":return A$(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function vrt({type:e,interpolate:t,...n},{legend:r=!0,color:i=cn(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return gU({type:e,...n,interpolate:Srt(i)},{legend:r,...o})}function Srt(e){let{r:t,g:n,b:r}=cn(e)||cn(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function xU(e,t,n){let r=[];for(let[i,o]of Kv){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],h6(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}function Wc(e={}){return l3(e)?e:{...e,x:X}}function Xc(e={}){return u3(e)?e:{...e,y:X}}function Jv(e,t){if(t.length===1)return{data:e,facets:t};let n=Fc(e),r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Lc(e);let o=e[n3]=new Uint32Array(n+i);t=t.map(a=>Lc(a,Uint32Array));let s=n;r.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];r[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,r[u]=1}return{data:e,facets:t}}function p6(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Wd(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:Md(c,l)}}function _U(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Wd(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function vU(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Wd(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function m6(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Wd(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:Md(c,l)}}function SU(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Wd(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function IU(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Wd(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Hc({x:e,x1:t,x2:n,...r}={}){return r=co(r,"y"),t===void 0&&n===void 0?p6({x:e,...r}):([t,n]=f3(e,t,n),{...r,x1:t,x2:n})}function Qc({y:e,y1:t,y2:n,...r}={}){return r=co(r,"x"),t===void 0&&n===void 0?m6({y:e,...r}):([t,n]=f3(e,t,n),{...r,y1:t,y2:n})}function Gd(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var Irt={length:!0};function Wd(e,t=Ry,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=Xn(a),[l,u]=Bn(e),[f,d]=wn(t),[h,p]=wn(t);return f.hint=h.hint=Irt,i=Trt(i),o=Mrt(o,i,r),[rn(a,(m,y,g)=>{({data:m,facets:y}=Jv(m,y));let x=e==null?void 0:u(bu(gt(m,e),g?.[n])),b=gt(m,t,Float64Array),w=gt(m,c),v=o&&o(m,x,b,w),_=Fc(m),T=d(new Float64Array(_)),A=p(new Float64Array(_)),E=[];for(let O of y){let I=x?Array.from(Rn(O,D=>x[D]).values()):[O];if(v)for(let D of I)D.sort(v);for(let D of I){let k=0,S=0;s&&D.reverse();for(let M of D){let N=b[M];N<0?k=A[M]=(T[M]=k)+N:N>0?S=A[M]=(T[M]=S)+N:A[M]=T[M]=S}}E.push(I)}return i&&i(E,T,A,w),{data:m,facets:y}}),l,f,h]}function Trt(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Ert;case"center":case"silhouette":return Art;case"wiggle":return EU}throw new Error(`unknown offset: ${e}`)}}function TU(e,t){let n=0,r=0;for(let i of e){let o=t[i];o<n&&(n=o),o>r&&(r=o)}return[n,r]}function Ert(e,t,n){for(let r of e)for(let i of r){let[o,s]=TU(i,n);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),n[a]=c*(n[a]-o)}}}function Art(e,t,n){for(let r of e){for(let i of r){let[o,s]=TU(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}AU(r,t,n)}MU(e,t,n)}function EU(e,t,n,r){for(let i of e){let o=new ir,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...Hb(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=Fn(l);d&&(s-=Fn(l,(h,p)=>(u[p]/2+f[p])*h)/d)}AU(i,t,n)}MU(e,t,n)}function AU(e,t,n){let r=ue(e,i=>ue(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function MU(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ue(a,c=>t[c])+Qt(a,c=>n[c]))/2),s=ue(o);for(let a=0;a<r;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,n[l]+=c}}function Mrt(e,t,n){if(e===void 0&&t===EU)return bU(xn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?mu:xn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return Ort(i);case"z":return Nrt(i);case"sum":return Drt(i);case"appearance":return Rrt(i);case"inside-out":return bU(i)}return wU(i3(e))}if(typeof e=="function")return(e.length===1?wU:Lrt)(e);if(Rr(e))return Frt(e);throw new Error(`invalid order: ${e}`)}}function Ort(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function Nrt(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function Drt(e){return t2(e,(t,n,r,i)=>Df(yr(t),o=>Fn(o,s=>r[s]),o=>i[o]))}function Rrt(e){return t2(e,(t,n,r,i)=>Df(yr(t),o=>n[zl(o,s=>r[s])],o=>i[o]))}function bU(e){return t2(e,(t,n,r,i)=>{let o=yr(t),s=Df(o,f=>n[zl(f,d=>r[d])],f=>i[f]),a=no(o,f=>Fn(f,d=>r[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function wU(e){return t=>{let n=gt(t,e);return(r,i)=>xn(n[r],n[i])}}function Lrt(e){return t=>Rr(t)?(n,r)=>e(t[n],t[r]):(n,r)=>e(t.get(n),t.get(r))}function Frt(e){return t2(xn,()=>e)}function t2(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new ir(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var krt={ariaLabel:"rect"},Nu=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,krt),Qy(this,n),Zy(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:x}=o,{insetTop:b,insetRight:w,insetBottom:v,insetLeft:_}=this,{rx:T,ry:A,rx1y1:E,rx1y2:O,rx2y1:I,rx2y2:D}=this;(c||u)&&!x&&ri(s)&&(c=u=null),(l||f)&&!x&&ri(a)&&(l=f=null);let k=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{},0,0).call(M=>M.selectAll().data(t).enter().call(E||O||I||D?N=>N.append("path").call(It,this).call(Ky,c&&u?L=>c[L]+(u[L]<c[L]?-w:_):c?L=>c[L]+_:m+_,l&&f?L=>l[L]+(f[L]<l[L]?-v:b):l?L=>l[L]+b:d+b,c&&u?L=>u[L]-(u[L]<c[L]?-_:w):c?L=>c[L]+k-w:y-h-w,l&&f?L=>f[L]-(f[L]<l[L]?-b:v):l?L=>l[L]+S-v:g-p-v,this).call(Yt,this,r):N=>N.append("rect").call(It,this).attr("x",c?u?L=>Math.min(c[L],u[L])+_:L=>c[L]+_:m+_).attr("y",l?f?L=>Math.min(l[L],f[L])+b:L=>l[L]+b:d+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+k-_-w):k-_-w:y-h-m-w-_).attr("height",l?f?L=>Math.max(0,Math.abs(l[L]-f[L])+S-b-v):S-b-v:g-d-p-b-v).call(ft,"rx",T).call(ft,"ry",A).call(Yt,this,r))).node()}};function Qy(e,{inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={}){e.insetTop=ee(n),e.insetRight=ee(r),e.insetBottom=ee(i),e.insetLeft=ee(o)}function Zy(e,{r:t,rx:n,ry:r,rx1:i=t,ry1:o=t,rx2:s=t,ry2:a=t,rx1y1:c=i!==void 0?+i:o!==void 0?+o:0,rx1y2:l=i!==void 0?+i:a!==void 0?+a:0,rx2y1:u=s!==void 0?+s:o!==void 0?+o:0,rx2y2:f=s!==void 0?+s:a!==void 0?+a:0}={}){c||l||u||f?(e.rx1y1=c,e.rx1y2=l,e.rx2y1=u,e.rx2y2=f):(e.rx=be(n,"auto"),e.ry=be(r,"auto"))}function Ky(e,t,n,r,i,o){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:l}=o;typeof t!="function"&&(t=Ce(t)),typeof n!="function"&&(n=Ce(n)),typeof r!="function"&&(r=Ce(r)),typeof i!="function"&&(i=Ce(i));let u=Math.max(Math.abs(s+c),Math.abs(a+l)),f=Math.max(Math.abs(s+a),Math.abs(c+l));e.attr("d",d=>{let h=t(d),p=n(d),m=r(d),y=i(d),g=h>m,x=p>y,b=g?m:h,w=g?h:m,v=x?y:p,_=x?p:y,T=Math.min(1,(w-b)/u,(_-v)/f),A=T*(g?x?l:c:x?a:s),E=T*(g?x?a:s:x?l:c),O=T*(g?x?s:a:x?c:l),I=T*(g?x?c:l:x?s:a);return`M${b},${v+n2(A,I)}A${A},${A} 0 0 ${A<0?0:1} ${b+e2(A,I)},${v}H${w-e2(E,O)}A${E},${E} 0 0 ${E<0?0:1} ${w},${v+n2(E,O)}V${_-n2(O,E)}A${O},${O} 0 0 ${O<0?0:1} ${w-e2(O,E)},${_}H${b+e2(I,A)}A${I},${I} 0 0 ${I<0?0:1} ${b},${_-n2(I,A)}Z`})}function e2(e,t){return t<0?e:Math.abs(e)}function n2(e,t){return t<0?Math.abs(e):e}function Jy(e,t){return new Nu(e,i6(o6(t)))}function Xd(e,t={}){return _a(t)||(t={...t,y:ye,x2:X,interval:1}),new Nu(e,Hc(o6(Wc(t))))}function Hd(e,t={}){return _a(t)||(t={...t,x:ye,y2:X,interval:1}),new Nu(e,Qc(i6(Xc(t))))}var Crt={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Brt={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},t0=class extends xt{constructor(t={}){let{anchor:n=null}=t;super(Dc,void 0,t,n==null?Crt:Brt),this.anchor=c3(n,"anchor",["top","right","bottom","left"]),Qy(this,t),n||Zy(this,t)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:y}=this,{rx:g,ry:x,rx1y1:b,rx1y2:w,rx2y1:v,rx2y2:_}=this,T=l+y,A=u-a-p,E=s+h,O=f-c-m;return ct(d?"svg:line":b||w||v||_?"svg:path":"svg:rect",o).datum(0).call(Rt,this,i,o).call(It,this).call(Yt,this,r).call(Et,this,{}).call(d==="left"?I=>I.attr("x1",T).attr("x2",T).attr("y1",E).attr("y2",O):d==="right"?I=>I.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",O):d==="top"?I=>I.attr("x1",T).attr("x2",A).attr("y1",E).attr("y2",E):d==="bottom"?I=>I.attr("x1",T).attr("x2",A).attr("y1",O).attr("y2",O):b||w||v||_?I=>I.call(Ky,T,E,A,O,this):I=>I.attr("x",T).attr("y",E).attr("width",A-T).attr("height",O-E).attr("rx",g).attr("ry",x)).node()}};function Qd(e){return new t0(e)}var y6={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Prt=new Set(["geometry","href","src","ariaLabel","scales"]),e0=class extends xt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&gr(t)&&lv(t)&&(n={...n,title:X});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:v="start",textOverflow:_,textPadding:T=8,title:A,pointerSize:E=12,pathFilter:O="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:A,optional:!0}},n,y6),this.anchor=fv(l,"anchor"),this.preferredAnchor=fv(u,"preferredAnchor"),this.frameAnchor=ns(b),this.textAnchor=be(v,"middle"),this.textPadding=+T,this.pointerSize=+E,this.pathFilter=Ye(O),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=a6(_),this.monospace=!!f,this.fontFamily=Ye(d),this.fontSize=ee(h),this.fontStyle=Ye(p),this.fontVariant=Ye(m),this.fontWeight=Ye(y);for(let I in y6)I in this.channels&&(this[I]=y6[I]);this.splitLines=l6(this),this.clipLine=u6(this),this.format=typeof w=="string"||typeof w=="function"?{title:w}:{...w}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:v}=i,{x1:_,y1:T,x2:A,y2:E,x:O=_??A,y:I=T??E}=r,D=l?l(t.fx)-v:0,k=u?u(t.fy)-w:0,[S,M]=vn(this,i),N=J3(r,S),L=t6(r,M),B=p?jv:zv,C=B(Eu),P,$;"title"in r?(P=OU.call(this,{title:r.channels.title},n),$=jrt):(P=OU.call(this,r.channels,n),$=Vrt);let U=ct("svg:g",o).call(Rt,this,i,o).call(c6,this).call(Et,this,{x:O&&a,y:I&&c}).call(ot=>ot.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(N(at))},${Math.round(L(at))})`).call(It,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(G){let st=jt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let V=$.call(s,G,t,P,n,r);if(typeof V=="string")for(let Q of s.splitLines(V))H(st,{value:s.clipLine(Q)});else{let Q=new Set;for(let rt of V){let{label:z=""}=rt;z&&Q.has(z)||(Q.add(z),H(st,rt))}}})));function H(ot,{label:at,value:G,color:st,opacity:V}){at??="",G??="";let Q=st!=null||V!=null,rt,z=y*100,[Ct]=Mu(at,z,B,C);if(Ct>=0)at=at.slice(0,Ct).trimEnd()+Eu,rt=G.trim(),G="";else{(at||!G&&!Q)&&(G=" "+G);let[Xt]=Mu(G,z-B(at),B,C);Xt>=0&&(rt=G.trim(),G=G.slice(0,Xt).trimEnd()+Eu)}let ht=ot.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&ht.append("tspan").attr("font-weight","bold").text(at),G&&ht.append(()=>d.createTextNode(G)),Q&&ht.append("tspan").text(" \u25A0").attr("fill",st).attr("fill-opacity",V).style("user-select","none"),rt&&ht.append("title").text(rt)}function nt(){let{width:ot,height:at}=i.facet??i;U.selectChildren().each(function(G){let{x:st,width:V,height:Q}=this.getBBox();V=Math.round(V),Q=Math.round(Q);let rt=h;if(rt===void 0){let ht=N(G)+D,Xt=L(G)+k,Zt=ht+V+x+g*2<ot,tt=ht-V-x-g*2>0,ce=Xt+Q+x+g*2<at,Fr=Xt-Q-x-g*2>0;rt=Zt&&tt?ce&&Fr?s.preferredAnchor:Fr?"bottom":"top":ce&&Fr?Zt?"left":"right":(Zt||tt)&&(ce||Fr)?`${Fr?"bottom":"top"}-${Zt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Ct=this.lastChild;if(z.setAttribute("d",zrt(rt,x,g,V,Q)),st)for(let ht of Ct.childNodes)ht.setAttribute("x",-st);Ct.setAttribute("y",`${+$rt(rt,Ct.childNodes.length,m).toFixed(6)}em`),Ct.setAttribute("transform",`translate(${Urt(rt,x,g,V,Q)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(nt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(nt)),U.node()}};function i2(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new e0(e,{...r,x:t,y:n})}function $rt(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function Urt(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function zrt(e,t,n,r,i){let o=r+n*2,s=i+n*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function OU(e,t){let n={},r=this.format;r=NU(r,e,"x"),r=NU(r,e,"y"),this.format=r;for(let i in r){let o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{let s=$y(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||Prt.has(i)||(i==="x"||i==="y")&&e.geometry)continue;let o=$y(e,i);if(o){if(o.scale==null&&o.defaultScale==="color")continue;n[i]=o}}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(ke(s)?Qo:Ii)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Hy(s,s.domain()):as}}return n}function NU(e,t,n){if(!(n in e))return e;let r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function jrt(e,t,{title:n}){return this.format.title(n.value[e],e)}function*Vrt(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:r2(r,n,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;let s=n[o];if(o==="x2"&&"x1"in n)yield{label:RU(r,n,"x"),value:DU(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:RU(r,n,"y"),value:DU(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ne(a)&&c==null)continue;yield{label:r2(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function DU(e,t,n,r){return n.hint?.length?`${e(n.value[r]-t.value[r],r)}`:`${e(t.value[r],r)}\u2013${e(n.value[r],r)}`}function RU(e,t,n){let r=r2(e,t,`${n}1`,n),i=r2(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function r2(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Zd(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Vc(e.className),l=e.marks===void 0?[]:FU(e.marks);l.push(...Hrt(l));let u=Wrt(t,e),f=new Map;for(let C of l){let P=kU(C,u,e);P&&f.set(C,P)}let d=new Map;u&&n0(d,[u],e),n0(d,f,e);let h=FU(Qrt(l,d,e));for(let C of h){let P=kU(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=c$(d,e);if(p!==void 0){let C=u?Nv(p,u):void 0;for(let $ of l){if($.facet===null||$.facet==="super")continue;let U=f.get($);U!==void 0&&(U.facetsIndex=$.fx!=null||$.fy!=null?Nv(p,U):C)}let P=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,H)=>{U?.length>0&&P.add(H)});p.forEach(0<P.size&&P.size<p.length?($,U)=>$.empty=!P.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=f$(U.facetsIndex))}}for(let C of he.keys())Jo(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let m=new Map;for(let C of l){if(m.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:$}=f.get(C)??{},{data:U,facets:H,channels:nt}=C.initialize(P,$,e);b6(nt,e),m.set(C,{data:U,facets:H,channels:nt})}let y=jy(n0(d,m,e),e),g=T$(y,l,e);e$(y,g);let x=P3(y),{fx:b,fy:w}=x,v=b||w?$3(y,g):g,_=b||w?rit(x,g):g,T=zc(e),A=T.document,E=ea("svg").call(A.documentElement),O=E;T.ownerSVGElement=E,T.className=c,T.projection=p$(e,v),T.filterFacets=(C,P)=>Nv(p,{channels:P,groups:Mv(C,P)}),T.getMarkState=C=>{let P=m.get(C),$=f.get(C);return{...P,channels:{...P.channels,...$?.channels}}},T.dispatchValue=C=>{O.value!==C&&(O.value=C,O.dispatchEvent(new Event("input",{bubbles:!0})))};let I=new Set;for(let[C,P]of m)if(C.initializer!=null){let $=C.facet==="super"?_:v,U=C.initializer(P.data,P.facets,P.channels,x,$,T);if(U.data!==void 0&&(P.data=U.data),U.facets!==void 0&&(P.facets=U.facets),U.channels!==void 0){let{fx:H,fy:nt,...ot}=U.channels;Grt(ot),Object.assign(P.channels,ot);for(let at of Object.values(ot)){let{scale:G}=at;G!=null&&!e9(he.get(G))&&(PU(at,e),I.add(G))}(H!=null||nt!=null)&&f.set(C,!0)}}if(I.size){let C=new Map;n0(C,m,e,H=>I.has(H)),n0(d,m,e,H=>I.has(H));let P=nit(jy(C,e),y),{scales:$,...U}=P3(P);Object.assign(y,P),Object.assign(x,U),Object.assign(x.scales,$)}let D,k;p!==void 0&&(D={x:b?.domain(),y:w?.domain()},p=l$(p,D),k=u$(b,w,g));for(let[C,P]of m)P.values=C.scale(P.channels,x,T);let{width:S,height:M}=g;jt(E).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",M).attr("viewBox",`0 0 ${S} ${M}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
69
60
  --plot-background: white;
70
61
  display: block;
71
62
  height: auto;
@@ -75,4 +66,4 @@ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
75
66
  :where(.${c} text),
76
67
  :where(.${c} tspan) {
77
68
  white-space: pre;
78
- }`)).call(Zp,r);for(let k of l){let{channels:$,values:z,facets:V}=m.get(k);if(p===void 0||k.facet==="super"){let Q=null;if(V&&(Q=V[0],Q=k.filter(Q,$,z),Q.length===0))continue;let st=k.render(Q,b,z,w,I);if(st==null)continue;T.appendChild(st)}else{let Q;for(let st of p){if(!(k.facetAnchor?.(p,O,st)??!st.empty))continue;let ct=null;if(V){let X=f.has(k);if(ct=V[X?st.i:0],ct=k.filter(ct,$,z),ct.length===0)continue;!X&&ct===V[0]&&(ct=il(ct)),ct.fx=st.x,ct.fy=st.y,ct.fi=st.i}let ut=k.render(ct,b,z,v,I);if(ut!=null){(Q??=ce(T).append("g")).append(()=>ut).datum(st);for(let X of["aria-label","aria-description","aria-hidden","transform"])ut.hasAttribute(X)&&(Q.attr(X,ut.getAttribute(X)),ut.removeAttribute(X))}}Q?.selectChildren().attr("transform",L)}}let D=MY(y,I,e),{figure:C=n!=null||i!=null||o!=null||D.length>0}=e;C&&(B=E.createElement("figure"),B.className=`${c}-figure`,B.style.maxWidth="initial",n!=null&&B.append(OY(E,n,"h2")),i!=null&&B.append(OY(E,i,"h3")),B.append(...D,T),o!=null&&B.append(sut(E,o))),B.scale=Sq(b.scales),B.legend=TY(y,I,e);let U=Dj();return U>0&&ce(T).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(`${U.toLocaleString("en-US")} warning${U===1?"":"s"}. Please check the console.`),B}function OY(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function sut(e,t){let r=e.createElement("figcaption");return r.append(t),r}function aut({marks:e=[],...t}={}){return ux({...t,marks:[...e,this]})}Ft.prototype.plot=aut;function NY(e){return e.flat(1/0).filter(t=>t!=null).map(cut)}function cut(e){return typeof e.render=="function"?e:new c6(e)}var c6=class extends Ft{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function l6(e,t){for(let r in e)kY(e[r],t);return e}function kY(e,t){let{scale:r,transform:n=!0}=e;if(r==null||!n)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:uN(s,i)}=t[r]??{};a!=null&&(e.value=de(e.value,a),e.transform=!1)}function lut(e){for(let t in e)TN(t,e[t])}function lx(e,t,r,n=QV){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&n(a))if(a==="projection"){if(!Lj(r)){let c=r.x?.domain===void 0,l=r.y?.domain===void 0;if(c||l){let[u,f]=Cj(s);c&&a6(e,"x",u),l&&a6(e,"y",f)}}}else a6(e,a,s)}return e}function a6(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function uut(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let i=Sr(e.data);if(i==null)throw new Error("missing facet data");let o={};r!=null&&(o.fx=Vp(i,{value:r,scale:"fx"})),n!=null&&(o.fy=Vp(i,{value:n,scale:"fy"})),l6(o,t);let s=sT(i,o);return{channels:o,groups:s,data:e.data}}function FY(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:i}=e;if(n!=null||i!=null){let c=Sr(e.data??n??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return n!=null&&(l.fx=Vp(c,{value:n,scale:"fx"})),i!=null&&(l.fy=Vp(c,{value:i,scale:"fy"})),l6(l,r),{channels:l,groups:sT(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)&&Sr(e.data)?.length===a.length&&Cn(`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 fut(e,t={}){return Je({...t,x:null,y:null},(r,n,i,o,s,a)=>a.getMarkState(e))}function dut(e){let t=[];for(let r of e){let n=r.tip;if(n){n===!0?n={}:typeof n=="string"&&(n={pointer:n});let{pointer:i,preferredAnchor:o}=n;i=/^x$/i.test(i)?Nu:/^y$/i.test(i)?dl:Ou,n=i(fut(r,n)),n.title=null,o===void 0&&(n.preferredAnchor=i===dl?"left":"bottom");let s=BT(r.data,n);s.facet=r.facet,s.facetAnchor=r.facetAnchor,t.push(s)}}return t}function hut(e,t,r){let{projection:n,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:b=g===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=r;(n||!Ma(i)&&!RY("x",e))&&(h=p=null),(n||!Ma(o)&&!RY("y",e))&&(m=y=null),t.has("fx")||(g=b=null),t.has("fy")||(x=_=null),h===void 0&&(h=!FT(e,"x")),m===void 0&&(m=!FT(e,"y")),g===void 0&&(g=!FT(e,"fx")),x===void 0&&(x=!FT(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),g===!0&&(g=h==="top"||h===null?"bottom":"top"),x===!0&&(x=m==="right"||m===null?"left":"right");let v=[];return NT(v,_,TT,a),OT(v,x,vT,"right","left",u,a),NT(v,b,MT,s),OT(v,g,ST,"top","bottom",u,s),NT(v,y,IT,o),OT(v,m,ix,"left","right",r,o),NT(v,p,AT,i),OT(v,h,ox,"bottom","top",r,i),v}function OT(e,t,r,n,i,o,s){if(!t)return;let a=put(t);s=mut(a?n:t,o,s);let{line:c}=s;(r===ix||r===ox)&&c&&!al(c)&&e.push(em(yut(s))),e.push(r(s)),a&&e.push(r({...s,anchor:i,label:null}))}function NT(e,t,r,n){!t||al(t)||e.push(r(gut(t,n)))}function put(e){return/^\s*both\s*$/i.test(e)}function mut(e,t,{line:r=t.line,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:r,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function yut(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function gut(e,{stroke:t=Su(e)?e:void 0,ticks:r=but(e)?e:void 0,tickSpacing:n,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:i,ariaDescription:o}}function but(e){switch(typeof e){case"number":return!0;case"string":return!Su(e)}return ai(e)||typeof e?.range=="function"}function FT(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function RY(e,t){for(let r of t)for(let n in r.channels){let{scale:i}=r.channels[n];if(i===e||i==="projection")return!0}return!1}function xut(e,t){for(let r in e){let n=e[r],i=t[r];n.label===void 0&&i&&(n.label=i.label)}return e}function _ut({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=JI(r),l=e&&LY(e),u=t&&LY(t);return{marginTop:t?u[0]:n,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:a,height:c}}function LY(e){let t=e.domain(),r=e(t[0]),n=e(t[t.length-1]);return n<r&&([r,n]=[n,r]),[r,n+e.bandwidth()]}var wut=new Map([["basis",BO],["basis-closed",OO],["basis-open",NO],["bundle",FO],["bump-x",TO],["bump-y",AO],["cardinal",RO],["cardinal-closed",LO],["cardinal-open",kO],["catmull-rom",CO],["catmull-rom-closed",UO],["catmull-rom-open",PO],["linear",tl],["linear-closed",$O],["monotone-x",VO],["monotone-y",jO],["natural",qO],["step",YO],["step-after",GO],["step-before",WO]]);function fx(e=tl,t){if(typeof e=="function")return e;let r=wut.get(`${e}`.toLowerCase());if(!r)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in r)return r.beta(t);if("tension"in r)return r.tension(t);if("alpha"in r)return r.alpha(t)}return r}function RT(e=Lu,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Lu:fx(e,t)}function Lu(e){return tl(e)}function Ra(e={y:"count"},t={}){[e,t]=f6(e,t);let{x:r,y:n}=t;return u6(LT(r,t,K),null,null,n,e,_d(t))}function La(e={x:"count"},t={}){[e,t]=f6(e,t);let{x:r,y:n}=t;return u6(null,LT(n,t,K),r,null,e,wd(t))}function pl(e={fill:"count"},t={}){[e,t]=f6(e,t);let{x:r,y:n}=vut(t);return u6(r,n,null,null,e,_d(wd(t)))}function PY(e,t,r={}){if(r?.interval==null)return r;let{reduce:n=WI}=r,i={filter:null};return r[t]!=null&&(i[t]=n),r[`${t}1`]!=null&&(i[`${t}1`]=n),r[`${t}2`]!=null&&(i[`${t}2`]=n),e(i,r)}function rm(e={}){return PY(Ra,"y",ws(e,"x"))}function nm(e={}){return PY(La,"x",ws(e,"y"))}function u6(e,t,r,n,{data:i=YI,filter:o=Wb,sort:s,reverse:a,...c}={},l={}){e=CY(e),t=CY(t),c=Sut(c,l),i=VY(i,K),s=s==null?void 0:$Y("sort",s,l),o=o==null?void 0:zY("filter",o,l),r!=null&&Oa(c,"x","x1","x2")&&(r=null),n!=null&&Oa(c,"y","y1","y2")&&(n=null);let[u,f]=In(e),[d,h]=In(e),[p,m]=In(t),[y,g]=In(t),[b,x]=r!=null?[r,"x"]:n!=null?[n,"y"]:[],[_,v]=In(b),{x:w,y:I,z:E,fill:T,stroke:B,x1:A,x2:O,y1:L,y2:S,domain:M,cumulative:D,thresholds:C,interval:U,...k}=l,[$,z]=In(E),[V]=cr(T),[Q]=cr(B),[st,ct]=In(V),[ut,X]=In(Q);return{..."z"in l&&{z:$||E},..."fill"in l&&{fill:st||T},..."stroke"in l&&{stroke:ut||B},...on(k,(lt,q,tt)=>{let at=md(At(lt,b),tt?.[x]),j=At(lt,E),Jt=At(lt,V),gt=At(lt,Q),he=Hb(c,{z:j,fill:Jt,stroke:gt}),ye=[],nt=[],Ee=at&&v([]),Ei=j&&z([]),Ts=Jt&&ct([]),RX=gt&&X([]),Ck=e&&f([]),LX=e&&h([]),Uk=t&&m([]),kX=t&&g([]),CX=Aut(e,t,lt),UX=0;for(let Cd of c)Cd.initialize(lt);s&&s.initialize(lt),o&&o.initialize(lt);for(let Cd of q){let Pk=[];for(let Ud of c)Ud.scope("facet",Cd);s&&s.scope("facet",Cd),o&&o.scope("facet",Cd);for(let[Ud,PX]of Iu(Cd,he))for(let[$X,d_]of Iu(PX,at))for(let[As,Va]of CX(d_))if(he&&(Va.z=Ud),!(o&&!o.reduce(As,Va))){Pk.push(UX++),nt.push(i.reduceIndex(As,lt,Va)),at&&Ee.push($X),j&&Ei.push(he===j?Ud:j[(As.length>0?As:d_)[0]]),Jt&&Ts.push(he===Jt?Ud:Jt[(As.length>0?As:d_)[0]]),gt&&RX.push(he===gt?Ud:gt[(As.length>0?As:d_)[0]]),Ck&&(Ck.push(Va.x1),LX.push(Va.x2)),Uk&&(Uk.push(Va.y1),kX.push(Va.y2));for(let zX of c)zX.reduce(As,Va);s&&s.reduce(As,Va)}ye.push(Pk)}return vN(ye,s,a),{data:nt,facets:ye}}),...!Oa(c,"x")&&(u?{x1:u,x2:d,x:Cp(u,d)}:{x:w,x1:A,x2:O}),...!Oa(c,"y")&&(p?{y1:p,y2:y,y:Cp(p,y)}:{y:I,y1:L,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:lt,output:q})=>[lt,q]))}}function f6({cumulative:e,domain:t,thresholds:r,interval:n,...i},o){return[i,{cumulative:e,domain:t,thresholds:r,interval:n,...o}]}function LT(e,{cumulative:t,domain:r,thresholds:n,interval:i},o){return e={...Fo(e)},e.domain===void 0&&(e.domain=r),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=n),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=d6(e.thresholds,e.interval),e}function vut(e){let{x:t,y:r}=e;return t=LT(t,e),r=LT(r,e),[t.value,r.value]=br(t.value,r.value),{x:t,y:r}}function CY(e){if(e==null)return;let{value:t,cumulative:r,domain:n=Oe,thresholds:i}=e,o=s=>{let a=At(s,t),c;if(lr(a)||Tut(i)){a=de(a,oN,Float64Array);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!vu(i)?i(a,u,f):i;typeof d=="number"&&(d=pb(u,f,d)),vu(d)&&(n===Oe&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Pr(a);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!vu(i)?i(a,u,f):i;if(typeof d=="number")if(n===Oe){let h=kc(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)/h}else d=[u];else d=[u]}else d=xn(u,f,d);else vu(d)&&(n===Oe&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(r<0?Eut:r>0?Mut:h6)(l,c,a),l};return o.label=Tn(t),o}function d6(e,t,r=UY){if(e===void 0)return t===void 0?r:Da(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return Mv;case"scott":return l0;case"sturges":return tu;case"auto":return UY}return Vb(e)}return e}function Sut(e,t){return _N(e,t,$Y)}function $Y(e,t,r){return jI(e,t,r,zY)}function zY(e,t,r){return qI(e,t,r,VY)}function VY(e,t){return zp(e,t,Iut)}function Iut(e){switch(`${e}`.toLowerCase()){case"x":return Dut;case"x1":return Out;case"x2":return Nut;case"y":return But;case"y1":return Fut;case"y2":return Rut;case"z":return SN}throw new Error(`invalid bin reduce: ${e}`)}function UY(e,t,r){return Math.min(200,l0(e,t,r))}function Tut(e){return rj(e)||ai(e)&&lr(e)}function Aut(e,t,r){let n=e?.(r),i=t?.(r);return n&&i?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:r,x1:c,y1:d,x2:l,y2:h}]}}:n?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries())yield[s[a],{data:r,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:r,y1:c,y2:l}]}}function h6(e,t,r){return t=Pr(t),n=>{let i=e.map(()=>[]);for(let o of n)i[Rc(t,r[o])-1]?.push(o);return i}}function Mut(e,t,r){let n=h6(e,t,r);return i=>{let o=n(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function Eut(e,t,r){let n=h6(e,t,r);return i=>{let o=n(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function jY(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var Dut={reduceIndex(e,t,{x1:r,x2:n}){return jY(r,n)}},But={reduceIndex(e,t,{y1:r,y2:n}){return jY(r,n)}},Out={reduceIndex(e,t,{x1:r}){return r}},Nut={reduceIndex(e,t,{x2:r}){return r}},Fut={reduceIndex(e,t,{y1:r}){return r}},Rut={reduceIndex(e,t,{y2:r}){return r}};function im(e={}){return aN(e)?e:{...e,x:K}}function om(e={}){return cN(e)?e:{...e,y:K}}function qY(e,t){if(t.length===1)return{data:e,facets:t};let r=e.length,n=new Uint8Array(r),i=0;for(let a of t)for(let c of a)n[c]&&++i,n[c]=1;if(i===0)return{data:e,facets:t};e=wu(e);let o=e[rN]=new Uint32Array(r+i);t=t.map(a=>wu(a,Uint32Array));let s=r;n.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];n[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,n[u]=1}return{data:e,facets:t}}function p6(e={},t={}){arguments.length===1&&([e,t]=cm(e));let{y1:r,y:n=r,x:i,...o}=t,[s,a,c,l]=lm(n,i,"y","x",e,o);return{...s,y1:r,y:a,x1:c,x2:l,x:Cp(c,l)}}function GY(e={},t={}){arguments.length===1&&([e,t]=cm(e));let{y1:r,y:n=r,x:i}=t,[o,s,a]=lm(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function XY(e={},t={}){arguments.length===1&&([e,t]=cm(e));let{y1:r,y:n=r,x:i}=t,[o,s,,a]=lm(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function m6(e={},t={}){arguments.length===1&&([e,t]=cm(e));let{x1:r,x:n=r,y:i,...o}=t,[s,a,c,l]=lm(n,i,"x","y",e,o);return{...s,x1:r,x:a,y1:c,y2:l,y:Cp(c,l)}}function HY(e={},t={}){arguments.length===1&&([e,t]=cm(e));let{x1:r,x:n=r,y:i}=t,[o,s,a]=lm(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function ZY(e={},t={}){arguments.length===1&&([e,t]=cm(e));let{x1:r,x:n=r,y:i}=t,[o,s,,a]=lm(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function sm({x:e,x1:t,x2:r,...n}={}){return n=ws(n,"y"),t===void 0&&r===void 0?p6({x:e,...n}):([t,r]=lN(e,t,r),{...n,x1:t,x2:r})}function am({y:e,y1:t,y2:r,...n}={}){return n=ws(n,"x"),t===void 0&&r===void 0?m6({y:e,...n}):([t,r]=lN(e,t,r),{...n,y1:t,y2:r})}function cm(e){let{offset:t,order:r,reverse:n,...i}=e;return[{offset:t,order:r,reverse:n},i]}var Lut={length:!0};function lm(e,t=jb,r,n,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${n}`);let c=kn(a),[l,u]=In(e),[f,d]=nn(t),[h,p]=nn(t);return f.hint=h.hint=Lut,i=kut(i),o=Put(o,i,n),[on(a,(m,y,g)=>{({data:m,facets:y}=qY(m,y));let b=e==null?void 0:u(md(At(m,e),g?.[r])),x=At(m,t,Float64Array),_=At(m,c),v=o&&o(m,b,x,_),w=m.length,I=d(new Float64Array(w)),E=p(new Float64Array(w)),T=[];for(let B of y){let A=b?Array.from(Zr(B,O=>b[O]).values()):[B];if(v)for(let O of A)O.sort(v);for(let O of A){let L=0,S=0;s&&O.reverse();for(let M of O){let D=x[M];D<0?L=E[M]=(I[M]=L)+D:D>0?S=E[M]=(I[M]=S)+D:E[M]=I[M]=S}}T.push(A)}return i&&i(T,I,E,_),{data:m,facets:y}}),l,f,h]}function kut(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Cut;case"center":case"silhouette":return Uut;case"wiggle":return QY}throw new Error(`unknown offset: ${e}`)}}function KY(e,t){let r=0,n=0;for(let i of e){let o=t[i];o<r&&(r=o),o>n&&(n=o)}return[r,n]}function Cut(e,t,r){for(let n of e)for(let i of n){let[o,s]=KY(i,r);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),r[a]=c*(r[a]-o)}}}function Uut(e,t,r){for(let n of e){for(let i of n){let[o,s]=KY(i,r);for(let a of i){let c=(s+o)/2;t[a]-=c,r[a]-=c}}JY(n,t,r)}tW(e,t,r)}function QY(e,t,r,n){for(let i of e){let o=new Hn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(r[h]-t[h])),u=a.map(h=>{c=n?n[h]:++c;let p=r[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...vv(u)];for(let h of a)t[h]+=s,r[h]+=s;let d=_n(l);d&&(s-=_n(l,(h,p)=>(u[p]/2+f[p])*h)/d)}JY(i,t,r)}tW(e,t,r)}function JY(e,t,r){let n=Ne(e,i=>Ne(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=n,r[o]-=n}function tW(e,t,r){let n=e.length;if(n===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(Ne(a,c=>t[c])+me(a,c=>r[c]))/2),s=Ne(o);for(let a=0;a<n;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,r[l]+=c}}function Put(e,t,r){if(e===void 0&&t===QY)return YY(tn);if(e!=null){if(typeof e=="string"){let n=e.startsWith("-"),i=n?fd:tn;switch((n?e.slice(1):e).toLowerCase()){case"value":case r:return $ut(i);case"z":return zut(i);case"sum":return Vut(i);case"appearance":return jut(i);case"inside-out":return YY(i)}return WY(nN(e))}if(typeof e=="function")return(e.length===1?WY:qut)(e);if(Array.isArray(e))return Yut(e);throw new Error(`invalid order: ${e}`)}}function $ut(e){return(t,r,n)=>(i,o)=>e(n[i],n[o])}function zut(e){return(t,r,n,i)=>(o,s)=>e(i[o],i[s])}function Vut(e){return kT(e,(t,r,n,i)=>Ph(si(t),o=>_n(o,s=>n[s]),o=>i[o]))}function jut(e){return kT(e,(t,r,n,i)=>Ph(si(t),o=>r[Cf(o,s=>n[s])],o=>i[o]))}function YY(e){return kT(e,(t,r,n,i)=>{let o=si(t),s=Ph(o,f=>r[Cf(f,d=>n[d])],f=>i[f]),a=ps(o,f=>_n(f,d=>n[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function WY(e){return t=>{let r=At(t,e);return(n,i)=>tn(r[n],r[i])}}function qut(e){return t=>(r,n)=>e(t[r],t[n])}function Yut(e){return kT(tn,()=>e)}function kT(e,t){return(r,n,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Hn(t(r,n,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var Wut={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Ad=class extends Ft{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:kn(r),optional:!0}},r,Wut),this.z=a,this.curve=fx(c,l)}filter(t){return t}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r,0,0).call(u=>u.selectAll().data(iT(t,[s,a,c,l],this,n)).enter().append("path").call(Xt,this).call(xd,this,n).attr("d",Ip().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 dx(e,t){return t===void 0?ml(e,{x:pd,y:_u}):new Ad(e,t)}function ku(e,t){let{y:r=nr,...n}=nm(t);return new Ad(e,sm(im({...n,y1:r,y2:void 0})))}function ml(e,t){let{x:r=nr,...n}=rm(t);return new Ad(e,am(om({...n,x1:r,x2:void 0})))}var Gut={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},hx=class extends Ft{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,curve:a,tension:c}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Gut),this.curve=RT(a,c),vs(this,r)}project(t,r,n){this.curve!==Lu&&super.project(t,r,n)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n,{curve:u}=this;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r).call(f=>f.selectAll().data(t).enter().append("path").call(Xt,this).attr("d",u===Lu&&o.projection?Xut(o.projection,s,a,c,l):d=>{let h=ti(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(ge,this,n).call(hl,this,n,o)).node()}};function Xut(e,t,r,n,i){let o=vn(e);return t=Pr(t),r=Pr(r),n=Pr(n),i=Pr(i),s=>o({type:"LineString",coordinates:[[t[s],r[s]],[n[s],i[s]]]})}function CT(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=px(t,r,n),[o,s]=px(i,o,s),new hx(e,{...a,x1:r,x2:n,y1:o,y2:s})}function px(e,t,r){if(e===void 0){if(t===void 0){if(r!==void 0)return[r]}else if(r===void 0)return[t]}else{if(t===void 0)return r===void 0?[e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}var Hut={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},mx=class extends Ft{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Hut),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=Zut(h)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=n,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:y}=this,g=u?_=>u[_]:en(f===void 0?1:f),b=h*Qp/2,x=p/1.5;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r).call(_=>_.selectAll().data(t).enter().append("path").call(Xt,this).attr("d",v=>{let w=s[v],I=a[v],E=c[v],T=l[v],B=Math.hypot(E-w,T-I);if(B<=m+y)return null;let A=Math.atan2(T-I,E-w),O=Math.min(x*g(v),B/3),L=this.sweep(w,I,E,T)*d*Qp,S=Math.hypot(B/Math.tan(L),B)/2;if(m||y)if(S<1e5){let st=Math.sign(L),[ct,ut]=Kut([w,I],[E,T],S,st);if(m&&([w,I]=eW([ct,ut,S],[w,I,m],-st*Math.sign(m))),y){let[X,lt]=eW([ct,ut,S],[E,T,y],st*Math.sign(y));A+=Math.atan2(lt-ut,X-ct)-Math.atan2(T-ut,E-ct),E=X,T=lt}}else{let st=E-w,ct=T-I,ut=Math.hypot(st,ct);m&&(w+=st/ut*m,I+=ct/ut*m),y&&(E-=st/ut*y,T-=ct/ut*y)}let M=A+L,D=M+b,C=M-b,U=E-O*Math.cos(D),k=T-O*Math.sin(D),$=E-O*Math.cos(C),z=T-O*Math.sin(C),V=S<1e5?`A${S},${S} 0,0,${L>0?1:0} `:"L",Q=O?`M${U},${k}L${E},${T}L${$},${z}`:"";return`M${w},${I}${V}${E},${T}${Q}`}).call(ge,this,n)).node()}};function Zut(e=1){if(typeof e=="number")return en(Math.sign(e));if(typeof e=="function")return(t,r,n,i)=>Math.sign(e(t,r,n,i));switch(Gr(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,r,n)=>Yt(t,n);case"-x":return(t,r,n)=>Xn(t,n);case"+y":return(t,r,n,i)=>Yt(r,i);case"-y":return(t,r,n,i)=>Xn(r,i)}}function Kut([e,t],[r,n],i,o){let s=r-e,a=n-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+r)/2-a*l,(t+n)/2+s*l]}function eW([e,t,r],[n,i,o],s){let a=n-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+r*r)/(2*l),f=s*Math.sqrt(r*r-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function rW(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=px(t,r,n),[o,s]=px(i,o,s),new mx(e,{...a,x1:r,x2:n,y1:o,y2:s})}var um=class extends Ft{constructor(t,r,n={},i){super(t,r,n,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=n;this.insetTop=Gt(s),this.insetRight=Gt(a),this.insetBottom=Gt(c),this.insetLeft=Gt(l),this.rx=Fe(u,"auto"),this.ry=Fe(f,"auto")}render(t,r,n,i,o){let{rx:s,ry:a}=this;return pt("svg:g",o).call(Qt,this,i,o).call(this._transform,this,r).call(c=>c.selectAll().data(t).enter().append("rect").call(Xt,this).attr("x",this._x(r,n,i)).attr("width",this._width(r,n,i)).attr("y",this._y(r,n,i)).attr("height",this._height(r,n,i)).call(yt,"rx",s).call(yt,"ry",a).call(ge,this,n)).node()}_x(t,{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r?o=>r[o]+i:n+i}_y(t,{y:r},{marginTop:n}){let{insetTop:i}=this;return r?o=>r[o]+i:n+i}_width({x:t},{x:r},{marginRight:n,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}_height({y:t},{y:r},{marginTop:n,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}},nW={ariaLabel:"bar"},yx=class extends um{constructor(t,r={}){let{x1:n,x2:i,y:o}=r;super(t,{x1:{value:n,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},r,nW)}_transform(t,r,{x:n}){t.call(Pt,r,{x:n},0,0)}_x({x:t},{x1:r,x2:n},{marginLeft:i}){let{insetLeft:o}=this;return ci(t)?i+o:s=>Math.min(r[s],n[s])+o}_width({x:t},{x1:r,x2:n},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return ci(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}},gx=class extends um{constructor(t,r={}){let{x:n,y1:i,y2:o}=r;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},r,nW)}_transform(t,r,{y:n}){t.call(Pt,r,{y:n},0,0)}_y({y:t},{y1:r,y2:n},{marginTop:i}){let{insetTop:o}=this;return ci(t)?i+o:s=>Math.min(r[s],n[s])+o}_height({y:t},{y1:r,y2:n},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return ci(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}};function ka(e,t={}){return Lp(t)||(t={...t,y:nr,x2:K}),new yx(e,sm(fT(im(t))))}function Ca(e,t={}){return Lp(t)||(t={...t,x:nr,y2:K}),new gx(e,am(dT(om(t))))}var Qut={ariaLabel:"cell"},Md=class extends um{constructor(t,{x:r,y:n,...i}={}){super(t,{x:{value:r,scale:"x",type:"band",optional:!0},y:{value:n,scale:"y",type:"band",optional:!0}},i,Qut)}_transform(t,r){t.call(Pt,r,{},0,0)}};function Cu(e,{x:t,y:r,...n}={}){return[t,r]=br(t,r),new Md(e,{...n,x:t,y:r})}function iW(e,{x:t=nr,fill:r,stroke:n,...i}={}){return r===void 0&&cr(n)[0]===void 0&&(r=K),new Md(e,{...i,x:t,fill:r,stroke:n})}function oW(e,{y:t=nr,fill:r,stroke:n,...i}={}){return r===void 0&&cr(n)[0]===void 0&&(r=K),new Md(e,{...i,y:t,fill:r,stroke:n})}var Jut={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function bx(e){return e.sort===void 0&&e.reverse===void 0?zI({channel:"-r"},e):e}var Ed=class extends Ft{constructor(t,r={}){let{x:n,y:i,r:o,rotate:s,symbol:a=el,frameAnchor:c}=r,[l,u]=Me(s,0),[f,d]=pj(a),[h,p]=Me(o,f==null?3:4.5);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:oi,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},bx(r),Jut),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Ba(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:b}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,r:u,rotate:f,symbol:d}=n,{r:h,rotate:p,symbol:m}=this,[y,g]=an(this,i),b=m===el,x=u?void 0:h*h*Math.PI;return mu(h)&&(t=[]),pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(b?"circle":"path").call(Xt,this).call(b?v=>{v.attr("cx",c?w=>c[w]:y).attr("cy",l?w=>l[w]:g).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",Fu`translate(${c?w=>c[w]:y},${l?w=>l[w]:g})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let I=ti();return d[w].draw(I,u[w]*u[w]*Math.PI),I}:u?w=>{let I=ti();return m.draw(I,u[w]*u[w]*Math.PI),I}:d?w=>{let I=ti();return d[w].draw(I,x),I}:(()=>{let w=ti();return m.draw(w,x),w})())}).call(ge,this,n)).node()}};function Lo(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=br(t,r)),new Ed(e,{...n,x:t,y:r})}function sW(e,{x:t=K,...r}={}){return new Ed(e,pT({...r,x:t}))}function aW(e,{y:t=K,...r}={}){return new Ed(e,hT({...r,y:t}))}function cW(e,t){return Lo(e,{...t,symbol:"circle"})}function lW(e,t){return Lo(e,{...t,symbol:"hexagon"})}var tft={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Dd=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:kn(r),optional:!0}},r,tft),this.z=o,this.curve=RT(s,a),vs(this,r)}filter(t){return t}project(t,r,n){this.curve!==Lu&&super.project(t,r,n)}render(t,r,n,i,o){let{x:s,y:a}=n,{curve:c}=this;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r).call(l=>l.selectAll().data(iT(t,[s,a],this,n)).enter().append("path").call(Xt,this).call(xd,this,n).call($q,this,n,o).attr("d",c===Lu&&o.projection?eft(o.projection,s,a):Sb().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function eft(e,t,r){let n=vn(e);return t=Pr(t),r=Pr(r),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],r[a]]);return n({type:"MultiLineString",coordinates:s})}}function Bd(e,{x:t,y:r,...n}={}){return[t,r]=br(t,r),new Dd(e,{...n,x:t,y:r})}function Uu(e,{x:t=K,y:r=nr,...n}={}){return new Dd(e,nm({...n,x:t,y:r}))}function Pu(e,{x:t=nr,y:r=K,...n}={}){return new Dd(e,rm({...n,x:t,y:r}))}var rft={ariaLabel:"rect"},Od=class extends Ft{constructor(t,r={}){let{x1:n,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}=r;super(t,{x1:{value:n,scale:"x",type:n!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,rft),this.insetTop=Gt(c),this.insetRight=Gt(l),this.insetBottom=Gt(u),this.insetLeft=Gt(f),this.rx=Fe(d,"auto"),this.ry=Fe(h,"auto")}render(t,r,n,i,o){let{x:s,y:a}=r,{x1:c,y1:l,x2:u,y2:f}=n,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:b}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:I,ry:E}=this,T=(s?.bandwidth?s.bandwidth():0)-w-_,B=(a?.bandwidth?a.bandwidth():0)-x-v;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{},0,0).call(A=>A.selectAll().data(t).enter().append("rect").call(Xt,this).attr("x",c&&(b||!ci(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:m+w).attr("y",l&&(b||!ci(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(b||!ci(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+T):T:y-h-m-_-w).attr("height",l&&(b||!ci(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+B):B:g-d-p-x-v).call(yt,"rx",I).call(yt,"ry",E).call(ge,this,n)).node()}};function xx(e,t){return new Od(e,ZN(KN(t)))}function fm(e,t={}){return Lp(t)||(t={...t,y:nr,x2:K,interval:1}),new Od(e,sm(KN(im(t))))}function dm(e,t={}){return Lp(t)||(t={...t,x:nr,y2:K,interval:1}),new Od(e,am(ZN(om(t))))}function g6(e,t){t=nft(t);let{x:r,y:n,color:i,size:o}=t,s=UT(e,r),a=UT(e,n),c=UT(e,i),l=UT(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:y,reduce:g,zero:b,...x},color:{value:_,color:v,reduce:w},size:{value:I,reduce:E},mark:T}=t;if(h===void 0&&(h=g==null&&d==null&&I==null&&y!=null?"count":null),g===void 0&&(g=h==null&&y==null&&I==null&&d!=null?"count":null),E===void 0&&I==null&&w==null&&h==null&&g==null&&(d==null||ir(s))&&(y==null||ir(a))&&(E="count"),p===void 0&&(p=PT(h)?!0:void 0),b===void 0&&(b=PT(g)?!0:void 0),d==null&&y==null)throw new Error("must specify x or y");if(h!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&d==null)throw new Error("reducing y requires x");T===void 0&&(T=I!=null||E!=null?"dot":PT(h)||PT(g)||w!=null?"bar":d!=null&&y!=null?ir(s)||ir(a)||h==null&&g==null&&!_x(s)&&!_x(a)?"dot":"line":d!=null||y!=null?"rule":null);let B,A,O;switch(T){case"dot":O=Lo,A="stroke";break;case"line":O=s&&a||h!=null||g!=null?b||g!=null||s&&_x(s)?Pu:p||h!=null||a&&_x(a)?Uu:Bd:s?Uu:Pu,A="stroke",fW(c)&&(B=null);break;case"area":O=!(b||g!=null)&&(p||h!=null||a&&_x(a))?ku:ml,A="fill",fW(c)&&(B=null);break;case"rule":O=s?Ki:Qi,A="stroke";break;case"bar":O=h!=null?ir(a)?uW(h)&&s&&ir(s)?Cu:ka:fm:g!=null?ir(s)?uW(g)&&a&&ir(a)?Cu:Ca:dm:w!=null||E!=null?s&&ir(s)&&a&&ir(a)?Cu:s&&ir(s)?Ca:a&&ir(a)?ka:xx:s&&sl(s)&&!(a&&sl(a))?ka:a&&sl(a)&&!(s&&sl(s))?Ca:Cu,A="fill";break;default:throw new Error(`invalid mark: ${T}`)}let L={fx:u,fy:f,x:s??void 0,y:a??void 0,[A]:c??v,z:B,r:l??void 0,tip:!0},S,M={[A]:w??void 0,r:E??void 0};if(h!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(M.y=g,S=ir(s)?Tu:Ra):h!=null?(M.x=h,S=ir(a)?Au:La):(w!=null||E!=null)&&(s&&a?S=ir(s)&&ir(a)?Xb:ir(s)?La:ir(a)?Ra:pl:s?S=ir(s)?Tu:Ra:a&&(S=ir(a)?Au:La)),(S===pl||S===Ra)&&(L.x={value:s,...m}),(S===pl||S===La)&&(L.y={value:a,...x}),p===void 0&&(p=s&&!(S===pl||S===Ra)&&(O===ka||O===ku||O===fm||O===Qi)),b===void 0&&(b=a&&!(S===pl||S===La)&&(O===Ca||O===ml||O===dm||O===Ki)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!b,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:I??null,reduce:E??null},mark:T,markImpl:dW[O],markOptions:L,transformImpl:dW[S],transformOptions:M,colorMode:A}}function hW(e,t){let r=g6(e,t),{fx:n,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=r,u=y6[r.markImpl],f=y6[r.transformImpl],d=n!=null||i!=null?em({strokeOpacity:.1}):null,h=[o?Ki([0]):null,s?Qi([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?$r(d,h,p):$r(d,p,h)}function _x(e){let t,r;for(let n of e){if(n==null)continue;if(t===void 0){t=n;continue}let i=Math.sign(Yt(t,n));if(i){if(r!==void 0&&i!==r)return!1;t=n,r=i}}return!0}function nft({x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}={}){return Hi(e)||(e=hm(e)),Hi(t)||(t=hm(t)),Hi(r)||(r=Su(r)?{color:r}:hm(r)),Hi(n)||(n=hm(n)),Hi(i)&&({value:i}=hm(i)),Hi(o)&&({value:o}=hm(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}}function UT(e,t){let r=At(e,t.value);return r&&(r.label=Tn(t.value)),r}function hm(e){return ift(e)?{reduce:e}:{value:e}}function PT(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function uW(e){return/^(?:first|last|mode)$/i.test(e)}function ift(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&rn(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 fW(e){return e?new Zn(e).size>e.length>>1:!1}var y6={dot:Lo,line:Bd,lineX:Uu,lineY:Pu,areaX:ku,areaY:ml,ruleX:Ki,ruleY:Qi,barX:ka,barY:Ca,rect:xx,rectX:fm,rectY:dm,cell:Cu,bin:pl,binX:Ra,binY:La,group:Xb,groupX:Tu,groupY:Au},dW=Object.fromEntries(Object.entries(y6).map(([e,t])=>[t,e]));function pm(e,t={}){let{x:r,x1:n,x2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,x:r=K});let o={};return r!=null&&(o.x=e),n!=null&&(o.x1=e),i!=null&&(o.x2=e),Mi(o,t)}function mm(e,t={}){let{y:r,y1:n,y2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,y:r=K});let o={};return r!=null&&(o.y=e),n!=null&&(o.y1=e),i!=null&&(o.y2=e),Mi(o,t)}function Mi(e={},t={}){let r=kn(t),n=Object.entries(e).map(([i,o])=>{let s=LI(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=nn(s);return{key:i,input:s,output:a,setOutput:c,map:oft(o)}});return{...on(t,(i,o)=>{let s=At(i,r),a=n.map(({input:l})=>At(i,l)),c=n.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?Zr(l,f=>s[f]).values():[l])n.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(n.map(({key:i,output:o})=>[i,o]))}}function oft(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&rn(e))return sft(e);if(typeof e=="function")return b6(kp(e));switch(`${e}`.toLowerCase()){case"cumsum":return cft;case"rank":return b6((t,r)=>u0(t,n=>r[n]));case"quantile":return b6((t,r)=>aft(t,n=>r[n]))}throw new Error(`invalid map: ${e}`)}function sft(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function aft(e,t){let r=aa(e,t)-1;return u0(e,t).map(n=>n/r)}function b6(e){return{mapIndex(t,r,n){let i=e(t,r);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)n[t[o]]=i[o]}}}var cft={mapIndex(e,t,r){let n=0;for(let i of e)r[i]=n+=t[i]}};function pW(e={},t){return arguments.length===1&&(t=e),pm(ym(e),t)}function mW(e={},t){return arguments.length===1&&(t=e),mm(ym(e),t)}function ym(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:r,shift:n,anchor:i,strict:o}=e;if(i===void 0&&n!==void 0&&(i=uft(n),Cn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return fft(r)(t,lft(i,t),o)}function lft(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 uft(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function fft(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return $T(Rp(e));switch(e.toLowerCase()){case"deviation":return $T(vo);case"max":return zT((t,r)=>me(t,n=>r[n]));case"mean":return dft;case"median":return $T(ms);case"min":return zT((t,r)=>Ne(t,n=>r[n]));case"mode":return zT((t,r)=>jh(t,n=>r[n]));case"sum":return yW;case"variance":return $T(Jl);case"difference":return mft;case"ratio":return yft;case"first":return gft;case"last":return bft}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return zT(kp(e))}function $T(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+r]]=c===0?e(il(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-r;c<0;++c)s[i[c+r]]=e(il(i,0,c+t),a);for(let c=0,l=i.length-r;c<l;++c)s[i[c+r]]=e(il(i,c,c+t),a)}}}function zT(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=wr(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=wr(o[i[c+t-1]]),a===t&&(s[i[c+r]]=e(il(i,c,c+t),o)),a-=wr(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-r;a<0;++a)s[i[a+r]]=e(il(i,0,a+t),o);for(let a=0,c=i.length-r;a<c;++a)s[i[a+r]]=e(il(i,a,a+t),o)}}}function yW(e,t,r){return r?{mapIndex(n,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[n[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=n.length-e+1;c<l;++c){let u=i[n[c]],f=i[n[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[n[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(n,i,o){let s=0,a=n.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[n[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[n[c+e-1]]||0,o[n[c+t]]=s,s-=+i[n[c]]||0}}}function dft(e,t,r){if(r){let n=yW(e,t,r);return{mapIndex(i,o,s){n.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(n,i,o){let s=0,a=0,c=n.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[n[l+e-1]],d=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[n[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function hft(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(wr(o))return o}}function pft(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(wr(o))return o}}function gW(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(o!==null&&!isNaN(o=+o))return o}}function bW(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function mft(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=bW(i,n,s,e)-gW(i,n,s,e)}}}function yft(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=bW(i,n,s,e)/gW(i,n,s,e)}}}function gft(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=hft(i,n,s,e)}}}function bft(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s+e-1]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=pft(i,n,s,e)}}}var yl={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function xW(e,{x:t=K,y:r,k:n=yl.k,color:i=yl.color,opacity:o=yl.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return $r(Ie(s)?null:ku(e,Mi({x1:$u({k:-n,...f}),x2:$u({k:n,...f})},{x1:t,x2:t,y:r,fill:s,fillOpacity:a,...f})),Ie(c)?null:Uu(e,Mi({x:$u(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function _W(e,{x:t,y:r=K,k:n=yl.k,color:i=yl.color,opacity:o=yl.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return $r(Ie(s)?null:ml(e,Mi({y1:$u({k:-n,...f}),y2:$u({k:n,...f})},{x:t,y1:r,y2:r,fill:s,fillOpacity:a,...f})),Ie(c)?null:Pu(e,Mi({y:$u(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function $u({n:e=yl.n,k:t=0,strict:r=yl.strict,anchor:n=yl.anchor}={}){return ym({k:e,reduce:i=>Cc(i)+t*(vo(i)||0),strict:r,anchor:n})}var xft={ariaLabel:"tick",fill:null,stroke:"currentColor"},VT=class extends Ft{constructor(t,r,n){super(t,r,n,xft),vs(this,n)}render(t,r,n,i,o){return pt("svg:g",o).call(Qt,this,i,o).call(this._transform,this,r).call(s=>s.selectAll().data(t).enter().append("line").call(Xt,this).attr("x1",this._x1(r,n,i)).attr("x2",this._x2(r,n,i)).attr("y1",this._y1(r,n,i)).attr("y2",this._y2(r,n,i)).call(ge,this,n).call(hl,this,n,o)).node()}},wx=class extends VT{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},r),this.insetTop=Gt(s),this.insetBottom=Gt(a)}_transform(t,r,{x:n}){t.call(Pt,r,{x:n},ur,0)}_x1(t,{x:r}){return n=>r[n]}_x2(t,{x:r}){return n=>r[n]}_y1({y:t},{y:r},{marginTop:n}){let{insetTop:i}=this;return r&&t?o=>r[o]+i:n+i}_y2({y:t},{y:r},{height:n,marginBottom:i}){let{insetBottom:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}},vx=class extends VT{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=r;super(t,{y:{value:i,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},r),this.insetRight=Gt(s),this.insetLeft=Gt(a)}_transform(t,r,{y:n}){t.call(Pt,r,{y:n},0,ur)}_x1({x:t},{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r&&t?o=>r[o]+i:n+i}_x2({x:t},{x:r},{width:n,marginRight:i}){let{insetRight:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}_y1(t,{y:r}){return n=>r[n]}_y2(t,{y:r}){return n=>r[n]}};function jT(e,{x:t=K,...r}={}){return new wx(e,{...r,x:t})}function qT(e,{y:t=K,...r}={}){return new vx(e,{...r,y:t})}function wW(e,{x:t=K,y:r=null,fill:n="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=r!=null?Au:Gb;return $r(Qi(e,u({x1:x6,x2:_6},{x:t,y:r,stroke:o,strokeOpacity:s,...l})),ka(e,u({x1:"p25",x2:"p75"},{x:t,y:r,fill:n,fillOpacity:i,...l})),jT(e,u({x:"p50"},{x:t,y:r,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),Lo(e,Mi({x:SW},{x:t,y:r,z:r,stroke:o,strokeOpacity:s,...l})))}function vW(e,{y:t=K,x:r=null,fill:n="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=r!=null?Tu:Gb;return $r(Ki(e,u({y1:x6,y2:_6},{x:r,y:t,stroke:o,strokeOpacity:s,...l})),Ca(e,u({y1:"p25",y2:"p75"},{x:r,y:t,fill:n,fillOpacity:i,...l})),qT(e,u({y:"p50"},{x:r,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),Lo(e,Mi({y:SW},{x:r,y:t,z:r,stroke:o,strokeOpacity:s,...l})))}function SW(e){let t=x6(e),r=_6(e);return e.map(n=>n<t||n>r?n:NaN)}function x6(e){let t=IW(e)*2.5-TW(e)*1.5;return Ne(e,r=>r>=t?r:NaN)}function _6(e){let t=TW(e)*2.5-IW(e)*1.5;return me(e,r=>r<=t?r:NaN)}function IW(e){return Kn(e,.25)}function TW(e){return Kn(e,.75)}var _ft={ariaLabel:"raster",stroke:null,pixelSize:1};function gm(e,t){let r=+e;if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}function AW(e,t){let r=Math.floor(e);if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}var Ix=class extends Ft{constructor(t,r,n={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=n;if(o!=null&&(o=AW(o,"width")),s!=null&&(s=AW(s,"height")),l!=null&&(l=gm(l,"x1")),u!=null&&(u=gm(u,"y1")),f!=null&&(f=gm(f,"x2")),d!=null&&(d=gm(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=Eft(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=Dft(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...r},n,i),this.width=o,this.height=s,this.pixelSize=gm(h,"pixelSize"),this.blur=gm(p,"blur"),this.interpolate=a==null||c==null?null:wft(m)}},Tx=class extends Ix{constructor(t,r={}){let{imageRendering:n}=r;if(t==null){let{fill:i,fillOpacity:o}=r;Me(o)[0]!==void 0&&(r=YT("fillOpacity",r)),cr(i)[0]!==void 0&&(r=YT("fill",r))}super(t,void 0,r,_ft),this.imageRendering=Fe(n,"auto")}scale(t,{color:r,...n},i){return super.scale(t,n,i)}render(t,r,n,i,o){let s=r[n.channels.fill?.scale]??(M=>M),{x:a,y:c}=n,{document:l}=o,[u,f,d,h]=EW(n,i,o),p=d-u,m=h-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:b=Math.round(Math.abs(m)/y)}=this,x=g*b,{fill:_,fillOpacity:v}=n,w=0;if(this.interpolate){let M=g/p,D=b/m,C=de(a,k=>(k-u)*M,Float64Array),U=de(c,k=>(k-f)*D,Float64Array);_&&(_=this.interpolate(t,g,b,C,U,_)),v&&(v=this.interpolate(t,g,b,C,U,v))}else this.data==null&&t&&(w=t.fi*x);let I=l.createElement("canvas");I.width=g,I.height=b;let E=I.getContext("2d"),T=E.createImageData(g,b),B=T.data,{r:A,g:O,b:L}=Yr(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<x;++M){let D=M<<2;if(_){let C=s(_[M+w]);if(C==null){B[D+3]=0;continue}({r:A,g:O,b:L}=Yr(C))}v&&(S=v[M+w]*255),B[D+0]=A,B[D+1]=O,B[D+2]=L,B[D+3]=S}return this.blur>0&&ZD(T,this.blur),E.putImageData(T,0,0),pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r).call(M=>M.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(yt,"image-rendering",this.imageRendering).call(Xt,this).attr("xlink:href",I.toDataURL())).node()}};function w6(e,t,r){arguments.length<3&&(r=t,t=null);let{x:n,y:i,[e]:o,...s}=r;return n===void 0&&i===void 0&&ij(t)&&(n=pd,i=_u,o===void 0&&(o=JV)),[t,{...s,x:n,y:i,[e]:o}]}function MW(){let[e,t]=w6("fill",...arguments);return new Tx(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:K})}function EW({x1:e,y1:t,x2:r,y2:n},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,r&&o==null?r[0]:s-l,n&&o==null?n[0]:a-u]}function v6({x1:e,y1:t,x2:r,y2:n},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),r&&(a.x2=r),n&&(a.y2=n),EW(jp(a,i),o,s)}function YT(e,t={}){let{[e]:r}=t;if(typeof r!="function")throw new Error(`invalid ${e}: not a function`);return Je({...t,[e]:void 0},function(n,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=v6(o,s,a,c),m=h-f,y=p-d,{pixelSize:g}=this,{width:b=Math.round(Math.abs(m)/g),height:x=Math.round(Math.abs(y)/g)}=t,_=new Array(b*x*(i?i.length:1)),v=m/b,w=y/x,I=0;for(let E of i??[void 0])for(let T=.5;T<x;++T)for(let B=.5;B<b;++B,++I)_[I]=r(l.invert(f+B*v),u.invert(d+T*w),E);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function wft(e){if(typeof e=="function")return e;if(e==null)return WT;switch(`${e}`.toLowerCase()){case"none":return WT;case"nearest":return Mx;case"barycentric":return Ax();case"random-walk":return Ex()}throw new Error(`invalid interpolate: ${e}`)}function WT(e,t,r,n,i,o){let s=new Array(t*r);for(let a of e)n[a]<0||n[a]>=t||i[a]<0||i[a]>=r||(s[Math.floor(i[a])*t+Math.floor(n[a])]=o[a]);return s}function Ax({random:e=ed(42)}={}){return(t,r,n,i,o,s)=>{let{points:a,triangles:c,hull:l}=Ao.from(t,h=>i[h],h=>o[h]),u=new s.constructor(r*n).fill(NaN),f=new Uint8Array(r*n),d=Mft(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],y=c[h+2],g=a[2*p],b=a[2*m],x=a[2*y],_=a[2*p+1],v=a[2*m+1],w=a[2*y+1],I=Math.min(g,b,x),E=Math.max(g,b,x),T=Math.min(_,v,w),B=Math.max(_,v,w),A=(v-w)*(g-x)+(_-w)*(x-b);if(!A)continue;let O=s[t[p]],L=s[t[m]],S=s[t[y]];for(let M=Math.floor(I);M<E;++M)for(let D=Math.floor(T);D<B;++D){if(M<0||M>=r||D<0||D>=n)continue;let C=M+.5,U=D+.5,k=((v-w)*(C-x)+(U-w)*(x-b))/A;if(k<0)continue;let $=((w-_)*(C-x)+(U-w)*(g-x))/A;if($<0)continue;let z=1-k-$;if(z<0)continue;let V=M+r*D;u[V]=d(O,k,L,$,S,z,M,D),f[V]=1}}return vft(u,f,i,o,s,r,n,l,t,d),u}}function vft(e,t,r,n,i,o,s,a,c,l){r=Float64Array.from(a,h=>r[c[h]]),n=Float64Array.from(a,h=>n[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=r.length,f=Array.from({length:u},(h,p)=>Ift(p,r,n)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let y=m+o*h;if(!t[y]){let g=m+.5;for(let b=0;b<u;++b){let x=(u+d+(b%2?(b+1)/2:-b/2))%u;if(f[x](g,p)){let _=Sft(r.at(x-1),n.at(x-1),r[x],n[x],g,p);e[y]=l(i.at(x-1),_,i[x],1-_,i[x],0,m,h),d=x;break}}}}}}function Sft(e,t,r,n,i,o){let s=r-e,a=n-t,c=s*(r-i)+a*(n-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function Sx(e,t,r,n){return e*n-r*t}function Ift(e,t,r){let n=t.length,i=t.at(e-2),o=r.at(e-2),s=t.at(e-1),a=r.at(e-1),c=t[e],l=r[e],u=t.at(e+1-n),f=r.at(e+1-n),d=s-c,h=a-l,p=i-s,m=o-a,y=c-u,g=l-f,b=Math.hypot(d,h),x=Math.hypot(p,m),_=Math.hypot(y,g);return(v,w)=>{let I=v-s,E=w-a,T=v-c,B=w-l;return Sx(I,E,T,B)>-1e-6&&Sx(I,E,d,h)*x-Sx(I,E,p,m)*b>-1e-6&&Sx(T,B,y,g)*b-Sx(T,B,d,h)*_<=0}}function Mx(e,t,r,n,i,o){let s=new o.constructor(t*r),a=Ao.from(e,u=>n[u],u=>i[u]),c,l;for(let u=.5,f=0;u<r;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function Ex({random:e=ed(42),minDistance:t=.5,maxSteps:r=2}={}){return(n,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Ao.from(n,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let y=.5;y<i;++y,++m){let g=y,b=p;h=d=u.find(g,b,d),y===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[n[h]]-g,a[n[h]]-b))>t&&_<r;){let v=e(y,p,_)*2*Math.PI;g+=Math.cos(v)*x,b+=Math.sin(v)*x,h=u.find(g,b,h),++_}l[m]=c[n[h]]}}return l}}function Tft(e,t,r,n,i,o){return t*e+n*r+o*i}function Aft(e){return(t,r,n,i,o,s,a,c)=>{let l=e(a,c);return l<r?t:l<r+i?n:o}}function Mft(e,t){return sl(e)||lr(e)?Tft:Aft(t)}function Eft(e,t,r){return{transform(n){let i=n.length,o=new Float64Array(i),s=(t-e)/r,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%r*s+a;return o}}}function Dft(e,t,r,n){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/n,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/r)%n*a+c;return s}}}var DW={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Dx=class extends Ix{constructor(t,{smooth:r=!0,value:n,...i}={}){let o=nT({},i,DW);if(n===void 0){for(let a in o)if(o[a].value!=null){if(n!==void 0)throw new Error("ambiguous contour value");n=i[a],i[a]="value"}}if(n!=null){let a={transform:c=>c.map(l=>l.value),label:Tn(n)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(n==null)throw new Error("missing contour value");i=YT("value",{value:n,...i}),n=null}else{let{interpolate:a}=i;n===void 0&&(n=K),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:n,optional:!0}},Bft(i),DW);let s={geometry:{value:K}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!r}filter(t,{x:r,y:n,value:i,...o},s){return super.filter(t,o,s)}render(t,r,n,i,o){let{geometry:s}=n,a=vn();return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r).call(c=>{c.selectAll().data(t).enter().append("path").call(Xt,this).attr("d",l=>a(s[l])).call(ge,this,n)}).node()}};function Bft({thresholds:e,interval:t,...r}){return e=d6(e,t,tu),Je(r,function(n,i,o,s,a,c){let[l,u,f,d]=v6(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:y=Math.round(Math.abs(h)/m),height:g=Math.round(Math.abs(p)/m)}=this,b=y/h,x=g/p,_=o.value.value,v=[];if(this.interpolate){let{x:B,y:A}=Eu(o,s,c),O=de(B,D=>(D-l)*b,Float64Array),L=de(A,D=>(D-u)*x,Float64Array),S=[o.x,o.y,o.value],M=[O,L,_];for(let D of i){let C=this.filter(D,S,M);v.push(this.interpolate(C,y,g,O,L,_))}}else if(i){let B=y*g,A=i.length;for(let O=0;O<A;++O)v.push(_.slice(O*B,O*B+B))}else v.push(_);if(this.blur>0)for(let B of v)o0({data:B,width:y,height:g},this.blur);let w=Oft(e,_,...Nft(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:I}=au().size([y,g]).smooth(this.smooth),E=[],T=[];for(let B of v)T.push(_r(E.length,E.push(...de(w,A=>I(B,A)))));for(let{coordinates:B}of E)for(let A of B)for(let O of A)for(let L of O)L[0]=L[0]/b+l,L[1]=L[1]/x+u;return{data:E,facets:T,channels:GI(this.contourChannels,E)}})}function Oft(e,t,r,n){if(typeof e?.range=="function")return e.range(e.floor(r),n);if(typeof e=="function"&&(e=e(t,r,n)),typeof e!="number")return Sr(e);let i=xn(...zh(r,n,e),e);for(;i[i.length-1]>=n;)i.pop();for(;i[1]<r;)i.shift();return i}function OW(){return new Dx(...w6("value",...arguments))}function Nft(e){return[Ne(e,t=>Ne(t,BW)),me(e,t=>me(t,BW))]}function BW(e){return isFinite(e)?e:NaN}function RW(e,t){return S6(Ou,e,t)}function LW(e,t={}){return S6(Nu,e,t)}function kW(e,t={}){return S6(dl,e,t)}function S6(e,t,r={}){let{x:n,y:i,maxRadius:o}=r,s=e({px:n,py:i,maxRadius:o}),a=[];n!=null&&a.push(Ki(t,NW("x",{...s,inset:-6},r))),i!=null&&a.push(Qi(t,NW("y",{...s,inset:-6},r))),n!=null&&a.push(Fa(t,FW("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},r))),i!=null&&a.push(Fa(t,FW("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},r)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return $r(...a)}function CW(e,{channels:t,...r},{facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...r,facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:Fft(e,u)}}function Fft(e,t){return t==null?t:function(r,n,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,r,n,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function NW(e,t,r){let{color:n="currentColor",opacity:i=.2,ruleStroke:o=n,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=r;return{...CW(e,t,r),stroke:o,strokeOpacity:s,strokeWidth:a}}function FW(e,t,r){let{color:n="currentColor",textFill:i=n,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=r;return{...CW(e,t,Rft(e,r)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function Rft(e,t){return Je(t,(r,n,i)=>({channels:{text:{value:Zb(i,e)?.value}}}))}var Lft={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},kft={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},Cft={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},Uft={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Pft={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},I6=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},r,Lft),this.curve=fx(s,a),vs(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,{curve:f}=this,[d,h]=an(this,i),p=c?b=>c[b]:en(d),m=l?b=>l[b]:en(h),y=this;function g(b){let x=-1,_=[],v={};for(let S in n)v[S]=[];let w=[],I=[],E=[],T=[];function B(S,M){S=b[S],M=b[M],_.push(++x),w[x]=p(S),E[x]=m(S),I[x]=p(M),T[x]=m(M);for(let D in n)v[D].push(n[D][M])}let{halfedges:A,hull:O,triangles:L}=Ao.from(b,p,m);for(let S=0;S<A.length;++S){let M=A[S];M>S&&B(L[S],L[M])}for(let S=0;S<O.length;++S)B(O[S],O[(S+1)%O.length]);ce(this).selectAll().data(_).enter().append("path").call(Xt,y).attr("d",S=>{let M=ti(),D=f(M);return D.lineStart(),D.point(w[S],E[S]),D.point(I[S],T[S]),D.lineEnd(),M}).call(ge,y,v).call(hl,y,v,o)}return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(Zr(t,x=>u[x]).values()).enter().append("g").each(g):b=>b.datum(t).each(g)).node()}},Bx=class extends Ft{constructor(t,r={},n,i=({z:o})=>o){let{x:o,y:s}=r;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(r),optional:!0}},r,n)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,[f,d]=an(this,i),h=c?g=>c[g]:en(f),p=l?g=>l[g]:en(d),m=this;function y(g){let b=Ao.from(g,h,p);ce(this).append("path").datum(g[0]).call(Xt,m).attr("d",m._render(b,i)).call(ge,m,n)}return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Zr(t,b=>u[b]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},T6=class extends Bx{constructor(t,r={}){super(t,r,kft),this.fill="none"}_render(t){return t.render()}},A6=class extends Bx{constructor(t,r={}){super(t,r,Cft,kn)}_render(t){return t.renderHull()}},M6=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},r,Uft)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,[f,d]=an(this,i),h=c?g=>c[g]:en(f),p=l?g=>l[g]:en(d),m=this;function y(g){let b=Ao.from(g,h,p),x=UW(b,i);ce(this).selectAll().data(g).enter().append("path").call(Xt,m).attr("d",(_,v)=>x.renderCell(v)).call(ge,m,n)}return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Zr(t,b=>u[b]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},E6=class extends Bx{constructor(t,r){super(t,r,Pft),this.fill="none"}_render(t,r){return UW(t,r).render()}};function UW(e,t){let{width:r,height:n,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,r-o,n-s])}function Ox(e,t,{x:r,y:n,...i}={}){return[r,n]=br(r,n),new e(t,{...i,x:r,y:n})}function PW(e,t){return Ox(I6,e,t)}function $W(e,t){return Ox(T6,e,t)}function zW(e,t){return Ox(A6,e,t)}function VW(e,t){return Ox(M6,e,t)}function jW(e,t){return Ox(E6,e,t)}var $ft={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Nx=class extends Ft{constructor(t,{x:r,y:n,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=qW(s)&&(s="currentColor",!0),u=qW(a)&&(a="currentColor",!0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},z:{value:kn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Vft({...c,fill:s,stroke:a},l,u),$ft),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,r,n,i,o){let{contours:s}=n,a=vn();return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Xt,this).call(ge,this,n).attr("d",l=>a(s[l]))).node()}};function YW(e,{x:t,y:r,...n}={}){return[t,r]=br(t,r),new Nx(e,{...n,x:t,y:r})}var zft=new Set(["x","y","z","weight"]);function Vft(e,t,r){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Pr(o):+o,Je(e,function(s,a,c,l,u,f){let d=c.weight?Pr(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,y]=an(this,u),{width:g,height:b}=u,{x,y:_}=Eu(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([L])=>!zft.has(L)).map(([L,S])=>[L,{...S,value:[]}])),w=t&&[],I=r&&[],E=U3().x(x?L=>x[L]:m).y(_?L=>_[L]:y).weight(d?L=>d[L]:1).size([g,b]).bandwidth(i),T=[];for(let L of a){let S=[];T.push(S);for(let M of h?ex(L,h,p):[L]){let D=E.contours(M);S.push([M,D])}}let B=o;if(!(B instanceof hd)){let L=0;for(let S of T)for(let[,M]of S){let D=M.max;D>L&&(L=D)}B=Float64Array.from({length:o-1},(S,M)=>L*100*(M+1)/o)}let A=[],O=[];for(let L of T){let S=[];A.push(S);for(let[M,D]of L)for(let C of B){S.push(O.length),O.push(D(C/100)),w&&w.push(C),I&&I.push(C);for(let U in v)v[U].value.push(c[U].value[M[0]])}}return w&&w.push(0),I&&I.push(0),{data:s,facets:A,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...I&&{stroke:{value:I,scale:"color"}},contours:{value:O}}}})}function qW(e){return/^density$/i.test(e)}function XW(e,{x1:t,x2:r,y1:n,y2:i,x:o=t===void 0&&r===void 0?nr:void 0,y:s=n===void 0&&i===void 0?K: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=cr(h)[0],clip:y,tip:g,render:b,...x}={}){return[t,r]=WW(o,t,r),[n,i]=WW(s,n,i),t===r&&n===i&&(n=zu(0)),{tip:g}=ws({tip:g},"x"),$r(Ie(c)?null:Object.assign(dx(e,{x1:t,x2:r,y1:n,y2:i,z:m,fill:c,fillOpacity:f,render:Kp(b,GW(!0)),clip:y,...x}),{ariaLabel:"positive difference"}),Ie(l)?null:Object.assign(dx(e,{x1:t,x2:r,y1:n,y2:i,z:m,fill:l,fillOpacity:d,render:Kp(b,GW(!1)),clip:y,...x}),{ariaLabel:"negative difference"}),Bd(e,{x:r,y:i,z:m,stroke:h,strokeOpacity:p,tip:g,clip:!0,...x}))}function WW(e,t,r){return t===void 0&&r===void 0?t=r=zu(e):t===void 0?(r=zu(r),t=e===void 0?r:zu(e)):r===void 0?(t=zu(t),r=e===void 0?t:zu(e)):(t=zu(t),r=zu(r)),[t,r]}function zu(e){let t,{value:r,label:n=Tn(r)}=Fo(e);return{transform:i=>t||(t=At(i,r)),label:n}}function GW(e){return(t,r,n,i,o,s)=>{let{x1:a,x2:c}=n,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===QI(r.y)<0?u:f).fill(l);let d=s(t,r,{...n,x2:a,y2:f},i,o),h=s(t,r,{...n,x1:c,y1:u},i,o),p=d.querySelector("g")??d,m=h.querySelector("g")??h;for(let y=0;p.firstChild;y+=2){let g=rT(),b=pt("svg:clipPath",o).attr("id",g).node();b.appendChild(p.firstChild),m.childNodes[y].setAttribute("clip-path",`url(#${g})`),m.insertBefore(b,m.childNodes[y])}return h}}var jft={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Fx=class extends Ft{constructor(t,r={}){let[n,i]=Me(r.r,3);super(t,{geometry:{value:r.geometry,scale:"projection"},r:{value:n,scale:"r",filter:oi,optional:!0}},bx(r),jft),this.r=i}render(t,r,n,i,o){let{geometry:s,r:a}=n,c=vn(o.projection??qft(r)),{r:l}=this;return mu(l)?t=[]:l!==void 0&&c.pointRadius(l),pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r).call(u=>{u.selectAll().data(t).enter().append("path").call(Xt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(ge,this,n)}).node()}};function qft({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,Jf({point(r,n){this.stream.point(e(r),t(n))}})}function GT(e,{geometry:t=K,...r}={}){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 Fx(e,{geometry:t,...r})}function HW({strokeWidth:e=1.5,...t}={}){return GT({type:"Sphere"},{strokeWidth:e,...t})}function ZW({strokeOpacity:e=.1,...t}={}){return GT(sB(),{strokeOpacity:e,...t})}var bm=.5,xm=0;function KW(e={fill:"count"},{binWidth:t,...r}={}){let{z:n}=r;return t=t===void 0?20:Gt(t),e=wN(e,r),Oa(e,"fill")&&(r.channels={...r.channels,fill:{value:[]}}),r.symbol===void 0&&(r.symbol="hexagon"),r.r===void 0&&!Oa(e,"r")&&(r.r=t/2),Je(r,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=Eu(s,a,l)),d=d?d.value:At(i,n),h=h?.value,p=p?.value,m=m?.value;let y=Hb(e,{z:d,fill:h,stroke:p,symbol:m}),g=d&&[],b=h&&[],x=p&&[],_=m&&[],v=[],w=[],I=[],E=-1;for(let O of e)O.initialize(i);for(let O of o){let L=[];for(let S of e)S.scope("facet",O);for(let[S,M]of Iu(O,y))for(let{index:D,extent:C}of Yft(i,M,u,f,t)){L.push(++E),w.push(C.x),I.push(C.y),d&&g.push(y===d?S:d[D[0]]),h&&b.push(y===h?S:h[D[0]]),p&&x.push(y===p?S:p[D[0]]),m&&_.push(y===m?S:m[D[0]]);for(let U of e)U.reduce(D,C)}v.push(L)}let T=s.x.scale,B=s.y.scale,A={x:{value:w,source:a[T]?{value:de(w,a[T].invert),scale:T}:null},y:{value:I,source:a[B]?{value:de(I,a[B].invert),scale:B}:null},...d&&{z:{value:g}},...h&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...m&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:L})=>[O,{scale:"auto",label:L.label,radius:O==="r"?t/2:void 0,value:L.transform()}]))};return{data:i,facets:v,channels:A}})}function Yft(e,t,r,n,i){let o=i*(1.5/fN),s=new Map;for(let a of t){let c=r[a],l=n[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-xm)/o),f=Math.round(c=(c-bm)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),b=c-y,x=l-g;m*m+d*d>b*b+x*x&&(f=y+(u&1?1:-1)/2,u=g)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+bm,y:u*o+xm}},s.set(h,p)),p.index.push(a)}return s.values()}var Wft={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function QW(e){return new Rx(e)}var Rx=class extends Ft{constructor({binWidth:t=20,clip:r=!0,...n}={}){super(xu,void 0,{clip:r,...n},Wft),this.binWidth=Gt(t)}render(t,r,n,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-bm,p=f-c-bm,m=a-xm,y=d-l-xm,g=s/2,b=g*dN,x=b/2,_=g*2,v=b*1.5,w=Math.floor(h/_),I=Math.ceil(p/_),E=Math.floor((m+x)/v),T=Math.ceil((y-x)/v)+1,B=`m0,${Vu(-b)}l${Vu(g)},${Vu(x)}v${Vu(b)}l${Vu(-g)},${Vu(x)}`,A=B;for(let O=E;O<T;++O)for(let L=w;L<I;++L)A+=`M${Vu(L*_+(O&1)*g)},${Vu(O*v)}${B}`;return pt("svg:g",o).datum(0).call(Qt,this,i,o).call(Pt,this,{},ur+bm,ur+xm).call(O=>O.append("path").call(Xt,this).call(ge,this,n).attr("d",A)).node()}};function Vu(e){return Math.round(e*1e3)/1e3}var Gft={ariaLabel:"image",fill:null,stroke:null};function Xft(e){return/^\.*\//.test(e)}function Hft(e){return/^(blob|data|file|http|https):/i.test(e)}function Zft(e){return typeof e=="string"&&(Xft(e)||Hft(e))?[void 0,e]:[e,void 0]}var Lx=class extends Ft{constructor(t,r={}){let{x:n,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=r;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=Zft(l),[y,g]=Me(o),[b,x]=Me(s,g!==void 0?g*2:void 0),[_,v]=Me(a,g!==void 0?g*2:void 0),[w,I]=Me(c,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:oi,optional:!0},width:{value:b,filter:oi,optional:!0},height:{value:_,filter:oi,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},bx(r),Gft),this.src=m,this.width=x,this.rotate=I,this.height=v,this.r=g,this.preserveAspectRatio=Fe(u,"xMidYMid"),this.crossOrigin=vr(f),this.frameAnchor=Ba(d),this.imageRendering=Fe(h,"auto")}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=n,{r:m,width:y,height:g,rotate:b}=this,[x,_]=an(this,i);return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Xt,this).attr("x",JW(c,u,d,x,y,m)).attr("y",JW(l,f,d,_,g,m)).attr("width",u?w=>u[w]:y!==void 0?y:d?w=>d[w]*2:m*2).attr("height",f?w=>f[w]:g!==void 0?g:d?w=>d[w]*2:m*2).attr("transform",h?w=>`rotate(${h[w]})`:b?`rotate(${b})`:null).attr("transform-origin",h||b?Fu`${c?w=>c[w]:x}px ${l?w=>l[w]:_}px`:null).call(yt,"href",p?w=>p[w]:this.src).call(yt,"preserveAspectRatio",this.preserveAspectRatio).call(yt,"crossorigin",this.crossOrigin).call(yt,"image-rendering",this.imageRendering).call(yt,"clip-path",d?w=>`circle(${d[w]}px)`:m!==void 0?`circle(${m}px)`:null).call(ge,this,n)).node()}};function JW(e,t,r,n,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>n-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?n-i/2:r&&e?s=>e[s]-r[s]:r?s=>n-r[s]:e?s=>e[s]-o:n-o}function tG(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=br(t,r)),new Lx(e,{...n,x:t,y:r})}function Kft(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-_m(t)-_m(r)+_m(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Qft(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function Qft(e,t,r){var n=e===0||e===1?0:Math.exp(_m(t+r)-_m(t)-_m(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*eG(e,t,r)/t:1-n*eG(1-e,r,t)/r}function eG(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function _m(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function rG(e,t){var r=Kft(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var Jft={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},XT=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o,ci:s=.95,precision:a=4}=r;if(super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:kn(r),optional:!0}},r,Jft),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,r,n,i,o){let{x:s,y:a,z:c}=n,{ci:l}=this;return pt("svg:g",o).call(Qt,this,i,o).call(Pt,this,r).call(u=>u.selectAll().data(c?ex(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Xt,this).call(xd,this,{...n,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!al(this.fill)?d=>d.select(tdt).attr("stroke","none").call(Xt,this).call(xd,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function tdt(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(So.svg,"path"),this)}var D6=class extends XT{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=Oe(t,u=>n[u]),c=HT(t,n,r),l=oG(t,n,r,(1-i)/2,c);return Ip().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(_r(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=Oe(t,a=>n[a]),s=HT(t,n,r);return`M${s(i)},${i}L${s(o)},${o}`}},B6=class extends XT{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=Oe(t,u=>r[u]),c=HT(t,r,n),l=oG(t,r,n,(1-i)/2,c);return Ip().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(_r(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=Oe(t,a=>r[a]),s=HT(t,r,n);return`M${i},${s(i)}L${o},${s(o)}`}};function nG(e,{y:t=nr,x:r=K,stroke:n,fill:i=Ie(n)?"currentColor":n,...o}={}){return new D6(e,nm({...o,x:r,y:t,fill:i,stroke:n}))}function iG(e,{x:t=nr,y:r=K,stroke:n,fill:i=Ie(n)?"currentColor":n,...o}={}){return new B6(e,rm({...o,x:t,y:r,fill:i,stroke:n}))}function HT(e,t,r){let n=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=r[u];n+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-n*i)/(a*s-n*n),l=(i-c*n)/a;return u=>c*u+l}function oG(e,t,r,n,i){let o=_n(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(r[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=rG(n,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function kx({path:e=K,delimiter:t,frameAnchor:r,treeLayout:n=td,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=JT(s),i=cG(i),a!=null&&(a=N6(a)),r===void 0&&(r=s.frameAnchor);let l=lG(t),u=yG(c,N6),[f,d]=nn(),[h,p]=nn();return{x:f,y:h,frameAnchor:r,...on(c,(m,y)=>{let g=l(At(m,e)),b=d([]),x=p([]),_=-1,v=[],w=[],I=G2().path(T=>g[T]),E=n();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??jb);for(let T of u)T[KT]=T[pG]([]);for(let T of y){let B=[],A=I(T.filter(O=>g[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&A.sort(i),E(A);for(let O of A.descendants())if(!(a!=null&&!a(O))){B.push(++_),v[_]=O.data,s.position(O,_,b,x);for(let L of u)L[KT][_]=L[mG](O)}w.push(B)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function QT({path:e=K,delimiter:t,curve:r="bump-x",stroke:n="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=td,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=JT(l),a=cG(a),u!=null&&(u=aG(u)),f={curve:r,stroke:n,strokeWidth:i,strokeOpacity:o,...f};let d=lG(t),h=yG(f,aG),[p,m]=nn(),[y,g]=nn(),[b,x]=nn(),[_,v]=nn();return{x1:p,x2:y,y1:b,y2:_,...on(f,(w,I)=>{let E=d(At(w,e)),T=m([]),B=g([]),A=x([]),O=v([]),L=-1,S=[],M=[],D=G2().path(U=>E[U]),C=s();C.nodeSize&&C.nodeSize([1,1]),C.separation&&c!==void 0&&C.separation(c??jb);for(let U of h)U[KT]=U[pG]([]);for(let U of I){let k=[],$=D(U.filter(z=>E[z]!=null)).each(z=>z.data=w[z.data]);a!=null&&$.sort(a),C($);for(let{source:z,target:V}of $.links())if(!(u!=null&&!u(V,z))){k.push(++L),S[L]=V.data,l.position(z,L,T,A),l.position(V,L,B,O);for(let Q of h)Q[KT][L]=Q[mG](V,z)}M.push(k)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function JT(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return edt;case"right":return rdt}throw new Error(`invalid tree anchor: ${e}`)}var edt={frameAnchor:"left",dx:6,position({x:e,y:t},r,n,i){n[r]=t,i[r]=-e}},rdt={frameAnchor:"right",dx:-6,position({x:e,y:t},r,n,i){n[r]=-t,i[r]=-e}};function cG(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?sG(N6(e)):sG(ndt(e))}function sG(e){return(t,r)=>tn(e(t),e(r))}function ndt(e){return t=>t.data?.[e]}function lG(e="/"){if(e=`${e}`,e==="/")return r=>r;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return r=>r.map(n=>idt(n,t))}var O6=92,uG=47;function idt(e,t){if(t===O6)throw new Error("delimiter cannot be backslash");let r=!1;for(let n=0,i=e.length;n<i;++n){switch(e.charCodeAt(n)){case O6:if(!r){r=!0;continue}break;case t:r?(e=e.slice(0,n-1)+e.slice(n),--n,--i):e=e.slice(0,n)+"/"+e.slice(n+1);break;case uG:r?(e=e.slice(0,n)+"\\\\"+e.slice(n),n+=2,i+=2):(e=e.slice(0,n)+"\\"+e.slice(n),++n,++i);break}r=!1}return e}function odt(e){let t=!1;for(let r=0,n=e.length;r<n;++r){switch(e.charCodeAt(r)){case O6:if(!t){t=!0;continue}case uG:t&&(e=e.slice(0,r-1)+e.slice(r),--r,--n);break}t=!1}return e}function fG(e){return rn(e)&&typeof e.node=="function"}function sdt(e){return rn(e)&&typeof e.link=="function"}function N6(e){if(fG(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return R6;case"node:path":return F6;case"node:internal":return dG;case"node:external":return hG;case"node:depth":return L6;case"node:height":return k6}throw new Error(`invalid node value: ${e}`)}}function aG(e){if(fG(e))return e.node;if(sdt(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return ZT(R6);case"parent:path":return ZT(F6);case"parent:depth":return ZT(L6);case"parent:height":return ZT(k6);case"node:name":return R6;case"node:path":return F6;case"node:internal":return dG;case"node:external":return hG;case"node:depth":return L6;case"node:height":return k6}throw new Error(`invalid link value: ${e}`)}}function F6(e){return e.id}function R6(e){return adt(e.id)}function L6(e){return e.depth}function k6(e){return e.height}function dG(e){return!!e.children}function hG(e){return!e.children}function ZT(e){return(t,r)=>r==null?void 0:e(r)}function adt(e){let t=e.length;for(;--t>0&&!cdt(e,t););return odt(e.slice(t+1))}function cdt(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}var pG=2,mG=3,KT=4;function yG(e,t){let r=[];for(let n in e){let i=e[n],o=t(i);o!==void 0&&r.push([n,...nn(i),o])}return r}function C6(e,{fill:t,stroke:r,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=Ie(f)&&Ie(d),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:b,textAnchor:x,treeLayout:_=td,textLayout:v=_===td||_===Y2?"mirrored":"normal",tip:w,...I}={}){if(g===void 0&&(g=JT(I.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Gr(v,"textLayout",["mirrored","normal"]);function E(T){return Fa(e,kx({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:b,title:y,...T,...I}))}return $r(CT(e,QT({treeLayout:_,markerStart:f,markerEnd:d,stroke:r!==void 0?r:t===void 0?"node:internal":t,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...I})),h?Lo(e,kx({treeLayout:_,fill:t===void 0?"node:internal":t,title:y,tip:w,...I})):null,p!=null?v==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:E():null)}function gG(e,t){return C6(e,{...t,treeLayout:Y2})}function bG({geometry:e=K,...t}={}){return Je({...t,x:null,y:null},(r,n,i,o,s,{projection:a})=>{let c=At(r,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=vn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:r,facets:n,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function xG({geometry:e=K,...t}={}){let r;return{...t,x:{transform:n=>Float64Array.from(r=At(At(n,e),tB),([i])=>i)},y:{transform:()=>Float64Array.from(r,([,n])=>n)}}}var BG=XX(DG(),1);var ydt=({marginLeft:e})=>[1,e],gdt=({width:e,marginRight:t})=>[-1,e-t],bdt=({width:e,marginLeft:t,marginRight:r})=>[0,(t+e-r)/2],xdt=({marginTop:e})=>[1,e],_dt=({height:e,marginBottom:t})=>[-1,e-t],wdt=({height:e,marginTop:t,marginBottom:r})=>[0,(t+e-r)/2];function OG(e){return typeof e=="string"?{anchor:e}:e}function NG(e={},t={}){arguments.length===1&&([e,t]=RG(e));let{anchor:r="left",padding:n=1,r:i=t.r}=OG(e);switch(`${r}`.toLowerCase()){case"left":r=ydt;break;case"right":r=gdt;break;case"middle":r=bdt;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return LG("x","y",r,Gt(n),i,t)}function FG(e={},t={}){arguments.length===1&&([e,t]=RG(e));let{anchor:r="bottom",padding:n=1,r:i=t.r}=OG(e);switch(`${r}`.toLowerCase()){case"top":r=xdt;break;case"bottom":r=_dt;break;case"middle":r=wdt;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return LG("y","x",r,Gt(n),i,t)}function RG(e){let{anchor:t,padding:r,...n}=e,{r:i}=n;return[{anchor:t,padding:r,r:i},n]}function LG(e,t,r,n,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Yb(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 Je(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}=Eu(c,l,f));let p=h?void 0:i!==void 0?Gt(i):this.r!==void 0?this.r:3;h&&(h=At(h.value,l[h.scale]||K,Float64Array));let[m,y]=r(u),g=m?Sdt:vdt,b=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,BG.default)();_=_.filter(h?I=>Dp(d[I])&&oi(h[I]):I=>Dp(d[I]));let w=new Float64Array(2*_.length+2);for(let I of _){let E=x(I),T=m?E+n:0,B=d[I]-E,A=d[I]+E,O=2;v.queryInterval(B-n,A+n,([,,S])=>{let M=b[S]-T,D=d[I]-d[S],C=n+(h?h[I]+h[S]:2*p),U=Math.sqrt(C*C-D*D);w[O++]=M-U,w[O++]=M+U});let L=w.slice(0,O);m&&(L=L.filter(S=>S>=0));t:for(let S of L.sort(g)){for(let M=0;M<O;M+=2)if(w[M]+1e-6<S&&S<w[M+1]-1e-6)continue t;b[I]=S+T;break}v.insert([B,A,I])}}m||(m=1);for(let _ of a)for(let v of _)b[v]=b[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:b,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function vdt(e,t){return Math.abs(e)-Math.abs(t)}function Sdt(e,t){return e-t}function CG(e,t){return arguments.length===1&&({basis:e,...t}=e),pm(rA(e),t)}function UG(e,t){return arguments.length===1&&({basis:e,...t}=e),mm(rA(e),t)}function rA(e){if(e===void 0)return kG;if(typeof e=="function")return nA(kp(e));if(/^p\d{2}$/i.test(e))return Im(Rp(e));switch(`${e}`.toLowerCase()){case"deviation":return Adt;case"first":return kG;case"last":return Tdt;case"max":return Mdt;case"mean":return Edt;case"median":return Ddt;case"min":return Bdt;case"sum":return Odt;case"extent":return Idt}throw new Error(`invalid basis: ${e}`)}function nA(e){return{mapIndex(t,r,n){let i=+e(t,r);for(let o of t)n[o]=r[o]===null?NaN:r[o]/i}}}function Im(e){return nA((t,r)=>e(t,n=>r[n]))}var Idt={mapIndex(e,t,r){let[n,i]=Oe(e,s=>t[s]),o=i-n;for(let s of e)r[s]=t[s]===null?NaN:(t[s]-n)/o}},kG=nA((e,t)=>{for(let r=0;r<e.length;++r){let n=t[e[r]];if(wr(n))return n}}),Tdt=nA((e,t)=>{for(let r=e.length-1;r>=0;--r){let n=t[e[r]];if(wr(n))return n}}),Adt={mapIndex(e,t,r){let n=Cc(e,o=>t[o]),i=vo(e,o=>t[o]);for(let o of e)r[o]=t[o]===null?NaN:i?(t[o]-n)/i:0}},Mdt=Im(me),Edt=Im(Cc),Ddt=Im(ms),Bdt=Im(Ne),Odt=Im(_n);function PG(e,t){return Ndt("x",e,t)}function Ndt(e,t,r={}){let n,i=1;if(typeof t=="number")i=t,n=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=RI(t.replace(/^[+-]/,"")),i*=l}t=Up(t),n=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Mi({[o]:l=>l.map(u=>n(u,i)),[s]:l=>l},r),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=Oe(l);return l.domain=i<0?[u,n(f,i)]:[n(u,i),f],l},a}function $G(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return Px(t);case"last":return $x(t)}if(typeof e=="function")return ju(null,e,t);let r,n;for(r in e){if(n!==void 0)throw new Error("ambiguous selector; multiple inputs");n=Fdt(e[r])}if(n===void 0)throw new Error(`invalid selector: ${e}`);return ju(r,n,t)}function Fdt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return j6;case"max":return q6}throw new Error(`unknown selector: ${e}`)}function Px(e){return ju(null,Rdt,e)}function $x(e){return ju(null,Ldt,e)}function iA(e){return ju("x",j6,e)}function oA(e){return ju("y",j6,e)}function sA(e){return ju("x",q6,e)}function aA(e){return ju("y",q6,e)}function*Rdt(e){yield e[0]}function*Ldt(e){yield e[e.length-1]}function*j6(e,t){yield Dv(e,r=>t[r])}function*q6(e,t){yield Cf(e,r=>t[r])}function ju(e,t,r){if(e!=null){if(r[e]==null)throw new Error(`missing channel: ${e}`);e=r[e]}let n=kn(r);return on(r,(i,o)=>{let s=At(i,n),a=At(i,e),c=[];for(let l of o){let u=[];for(let f of s?Zr(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 kdt=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function Cdt(e,t,r){for(let n=0;n<t.length;++n){let i=t[n];n===t.length-1?e[i]=r:e=e[i]||(e[i]={})}}function zG(e,t,r){for(let n in e){let i=kdt.get(n);if(i==null)throw new Error(`Unrecognized plot attribute: ${n}`);let o=e[n];typeof o=="symbol"?r.push(n):o!==void 0&&Cdt(t,i.split("."),o)}}var Udt=new Set(["frame","hexgrid","sphere","graticule"]),Pdt=new Map([["first",Px],["last",$x],["maxX",sA],["maxY",aA],["minX",iA],["minY",oA],["nearest",Ou],["nearestX",Nu],["nearestXY",dl]]);async function jG(e){let t={marks:[]},r=[],{attributes:n,marks:i}=e;zG(n,t,r);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...d}=u,h=Pdt.get(f)?.(d)??d,p=Udt.has(c)?[h]:[l,h];t.marks.push(Y6[c](...p)),o.push(a.index)}zdt(t,e);let s=ux(t);Vdt(s,o),$dt(e,s,n,r);for(let a of e.interactors)await a.init(s);return s}function $dt(e,t,r,n){n.forEach(i=>{let o=r[i];if(o===sa){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,r[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function zdt(e,t){let{marks:r}=t;cA("x",e,r),cA("y",e,r),cA("fx",e,r),cA("fy",e,r)}function cA(e,t,r){let n=t[e]||{};if(n.axis===null||n.label!==void 0)return;let i=r.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=jdt(r[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")){n.percent&&(c=`${c} (%)`);let l=(e==="x"?1:-1)*(n.reverse?-1:1);e==="x"||n.labelAnchor==="center"?c=e==="x"==l<0?`\u2190 ${c}`:`${c} \u2192`:c=`${l<0?"\u2191 ":"\u2193 "}${c}`}t[e]={...n,label:c}}}function Vdt(e,t){let r=e.querySelectorAll('g[aria-label="facet"]');if(r.length)for(let n of r)VG(n,t);else VG(e,t)}function VG(e,t){let r=-1;for(let n of e.children){let i=n.getAttribute("aria-label")||"";n.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||n.setAttribute("data-index",t[++r])}}function jdt(e,t){if(!e)return;let{columns:r}=e,n=r[t]??r[t+"1"]??r[t+"2"];if(n){for(let i of n)if(i!=null)return i instanceof Date?"date":typeof i}}var qdt={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},zx=class{constructor(t){this.attributes={...qdt},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=HD()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:r}=this.margins();return this.getAttribute("width")-t-r}innerHeight(t=400){let{top:r,bottom:n}=this.margins(),i=this.getAttribute("height");return i==null&&t!=null&&(i=t,this.setAttribute("height",i,{silent:!0})),i-r-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await jG(this),r=this.legends.flatMap(({legend:n,include:i})=>{let o=n.init(t);return i?o:[]});this.element.replaceChildren(t,...r),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,r,n){return tg(this.attributes[t],r)?(r===void 0?delete this.attributes[t]:this.attributes[t]=r,n?.silent||this.listeners?.get(t)?.forEach(i=>i(t,r)),!0):!1}addAttributeListener(t,r){let n=this.listeners||(this.listeners=new Map);return n.has(t)||n.set(t,new Set),n.get(t).add(r),this}removeAttributeListener(t,r){return this.listeners?.get(t)?.delete(r)}addParams(t,r){let{params:n}=this;for(let i of r)n.has(i)?n.get(i).push(t):(n.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(n.get(i).map(o=>o.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,r=!0){t.setPlot(this),this.legends.push({legend:t,include:r})}};function lA(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||ji(e)!==null)}var Ydt=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function qG(e){return Ydt.has(e)}var Wdt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function YG(e){return Wdt.has(`${e}`.toLowerCase())}function Ss(e){return kE(e)?Gdt(e):Xdt(e)}function Gdt(e){let{numRows:t,numCols:r,schema:{fields:n}}=e,i={};for(let o=0;o<r;++o){let s=n[o].name;i[s]?console.warn(`Redundant column name "${s}". Skipping...`):i[s]=UE(e.getChildAt(o))}return{numRows:t,columns:i}}function Xdt(e){let t=e.length;if(typeof e[0]=="object"){let r=t?Object.keys(e[0]):[],n={};return r.length>0&&r.forEach(i=>{n[i]=e.map(o=>o[i])}),{numRows:t,columns:n}}else return{numRows:t,values:e}}var WG=e=>e==="stroke"||e==="fill",Hdt=e=>/opacity$/i.test(e),Zdt=e=>e==="symbol",Kdt=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),W6=(e,t)=>({channel:e,field:t,as:t instanceof gi?t.column:e}),G6=(e,t)=>({channel:e,value:t}),uA=e=>Array.isArray(e),Xr=class extends li{constructor(t,r,n,i={}){super(r?.options?.filterBy),this.type=t,this.reqs=i,this.source=r,uA(this.source)&&(this.data=Ss(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[n0]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")qG(l)||WG(l)&&lA(u)||Zdt(l)&&YG(u)?o.push(G6(l,u)):o.push(W6(l,Ol(u)));else if(ic(u))if(Array.isArray(u.columns))o.push(W6(l,u)),a.add(u);else{let d=G6(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&Kdt(l,u)?o.push(W6(l,u)):u!==void 0&&o.push(G6(l,u))};for(let l in n)c(l,n[l])}setPlot(t,r){this.plot=t,this.index=r,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||uA(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(r=>r.channel===t)}channelField(t,{exact:r=!1}={}){let n=r?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return n?.field?n:null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:r,reqs:n}=this,i=new Map;for(let{channel:o,field:s}of r){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)),n[o]?.forEach(u=>l.add(u))}return Array.from(i,([o,s])=>({table:t,column:o,stats:s}))}fieldInfo(t){let r=Object.fromEntries(t.map(n=>[n.column,n]));for(let n of this.channels){let{field:i}=n;i&&Object.assign(n,r[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){if(this.hasOwnData())return null;let{channels:r,source:{table:n}}=this;return Vx(r,n).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Ss(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:r,detail:n,channels:i}=this;return X6(t,n,i,r)}};function Un(e,t){let r=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:WG(e.channel)?{value:r,scale:"color"}:Hdt(e.channel)?{value:r,scale:"opacity"}:r}function Vx(e,t,r=[]){let n=bt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!r.includes(a)){if(a==="orderby")n.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}n.select({[l]:c})}}}return o&&n.groupby(Array.from(i)),n}function X6(e,t,r,n,i={}){let{numRows:o,values:s,columns:a}=n??{},c={};for(let f of r){let d=t.has(f.channel)?c:i;d[f.channel]=Un(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(n?{length:o}:null),options:i}]}function Fd(e,t){let{plot:r}=e,n=r.getAttribute(`${t}Scale`);if(!n){let{type:o}=e.channelField(t);n=o==="date"?"time":"linear"}let i={type:n};switch(n){case"log":i.base=r.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=r.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=r.getAttribute(`${t}Constant`)??1;break}return Ky(i)}function Ji(e,t,r,n,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=Fd(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=n.map(b=>c(b)),h=l(o),p=a==="time"||a==="utc"?h:o,m=d===f?0:(r-i)/(d-f),y=m!==1?` * ${m}::DOUBLE`:"";return[u?W`(${d} - ${h}::DOUBLE)${y}`:W`(${h}::DOUBLE - ${f})${y}`,p]}var H6={x:["min","max"]},Z6={y:["min","max"]},fA={...H6,...Z6};function GG(e,t,r,n,i){let{plot:o}=e,s=o.getAttribute(n),a=o.getAttribute(i);if(Array.isArray(s)&&!s[gn])return s;{let{column:c,min:l,max:u}=e.channelField(r),f=K6(t,c)||(a?Gc().domain([l,u]).nice().domain():[l,u]);return s!==sa&&(f[gn]=!0),o.setAttribute(n,f,{silent:!0}),f}}function Ua(e,t){return GG(e,t,"x","xDomain","xNice")}function Pa(e,t){return GG(e,t,"y","yDomain","yNice")}function K6(e,t){if(!e)return;let r,n,i=(o,s)=>{if(o==="BETWEEN"&&`${s.field}`===t){let{range:a}=s;a&&(r==null||a[0]<r)&&(r=a[0]),a&&(n==null||a[1]>n)&&(n=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),r!=null&&n!=null&&r!==n?[r,n]:void 0}var jx=class extends Xr{constructor(t,r,n){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["min","max"]}:void 0;super(t,r,n,o),this.dim=i}query(t=[]){let{plot:r,dim:n,source:i}=this,{optimize:o=!0}=i.options||{},s=super.query(t);if(!n)return s;let a=n==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,min:d,max:h}=this.channelField(n);if(o&&(f==="date"||f==="number")&&c){let m=n==="x"?r.innerWidth():r.innerHeight(),[y,g]=K6(t,l)||[d,h],[b]=Ji(this,n,m,[y,g],1,u),x=s.select().map(_=>_.as).filter(_=>_!==u&&_!==c);return Qdt(s,b,u,c,x)}else return s.orderby(l)}};function Qdt(e,t,r,n,i=[]){let o=W`FLOOR(${t})::INTEGER`,s=a=>bt.from(e).select(a).groupby(o,i);return bt.union(s([{[r]:po(r),[n]:uh(n,r)},...i]),s([{[r]:ho(r),[n]:fh(n,r)},...i]),s([{[r]:uh(r,n),[n]:po(n)},...i]),s([{[r]:fh(r,n),[n]:ho(n)},...i])).orderby(i,r)}function XG(e,t=[]){return new t.constructor(e)}function HG(e,t,r){let n=XG(e,r),i=r.length;for(let o=0;o<i;++o)n[t[o]]=r[o];return n}function ZG(e,t,r,n,i,o,s){let a=r.length,c=e*t,l=i.map(h=>n[h]),u={},f=[],d=new Int32Array(a);if(o?.length){let h=o.map(m=>n[m]),p={};for(let m=0;m<a;++m){let y=h.map(g=>g[m]);d[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let h=r.map(y=>y%e),p=r.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[d[y]].push(y);i.forEach((y,g)=>{let b=l[g];u[y]=f.map((x,_)=>s(m[_],e,t,h,p,b))})}else i.forEach((h,p)=>{let m=l[p],y=u[h]=f.map(()=>XG(c,m));for(let g=0;g<a;++g)y[d[g]][r[g]]=m[g]});return{numRows:f.length,columns:u}}function qx(e){let t=1/0,r=-1/0;return e.forEach(n=>{let i=n.length;for(let o=0;o<i;++o){let s=n[o];s<t&&(t=s),s>r&&(r=s)}}),Number.isFinite(t)&&Number.isFinite(r)?[t,r]:[0,1]}function KG(e){let t=new Zn;return e.forEach(r=>{let n=r.length;for(let i=0;i<n;++i)t.add(r[i])}),Array.from(t).sort(Yt)}function Ir(e,t){return xi(e)?(e.addEventListener("value",t),e.value):e}function Yx(e,t=!1){let r=new Float64Array(5),n=new Float64Array(4);Jdt(r,n,e);let i=Float64Array.of(0,n[1]-r[1]*n[0],n[2]-r[2]*n[0],n[3]-r[3]*n[0],-r[4]*n[0]),o=1+r[1]+r[2]+r[3]+r[4],s=(n[0]+n[1]+n[2]+n[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:r,b_causal:n,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function Jdt(e,t,r){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/r),s=Math.exp(-1.723/r),a=.6318/r,c=1.997/r,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=r*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function QG(e,t,r,[n,i]){let o=new Float64Array(Math.max(n,i)),s=new Float64Array(Math.max(n,i)),a=new Float64Array(5),c=new Float64Array(r.length);for(let l=0,u=0;l<i;++l,u+=n){let f=c.subarray(u);dA(e,r.subarray(u),n,1,o,s,a,f)}for(let l=0;l<n;++l){let u=c.subarray(l);dA(t,u,i,n,o,s,a,u)}return c}function dA(e,t,r,n=1,i=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(5),a=i,c=tht){let l=n*2,u=n*3,f=n*4,d=n*r,h,p;for(c(i,t,r,n,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<r;++p,h+=n)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-n]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,r,-n,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-n*5;p<r;++p,h-=n)o[p]=e.b_anticausal[1]*t[h+n]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<r;++p,h+=n)a[h]=i[p]+o[r-p-1];else for(p=0,h=0;p<r;++p,h+=n)a[h]=Math.max(0,i[p]+o[r-p-1]);return a}function tht(e,t,r,n,i,o,s,a,c,l,u,f=.5){let d=Math.abs(n)*r,h=n<0?d+n:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=h+n*m,p>=0&&p<d&&(e[y]+=l[y-m]*t[p]);let g=t[h],b=Math.ceil(u*10);for(m=0;m<b;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var gl="density",Is=class extends Xr{constructor(t,r,n){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=n,f=eht(u);super(t,r,u,fA),this.densityMap=f,this.bandwidth=Ir(i,d=>(this.bandwidth=d,this.grids?this.convolve().update():null)),this.interpolate=Ir(o,d=>(this.interpolate=d,this.requestUpdate())),this.pixelSize=Ir(s,d=>(this.pixelSize=d,this.requestUpdate())),this.pad=Ir(a,d=>(this.pad=d,this.requestUpdate())),this.width=Ir(c,d=>(this.width=d,this.requestUpdate())),this.height=Ir(l,d=>(this.height=d,this.requestUpdate()))}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",n),t.addAttributeListener("yDomain",n),super.setPlot(t,r)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[gn]&&!r[gn]}query(t=[]){let{interpolate:r,pad:n,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=Ua(this,t),[l,u]=this.extentY=Pa(this,t),[f,d]=this.bins=this.binDimensions(),[h,p]=Ji(this,"x",f,[a,c],n),[m,y]=Ji(this,"y",d,[l,u],n),g=n?[Br(p,[+a,+c]),Br(y,[+l,+u])]:[cc(+a,p),ac(p,+c),cc(+l,y),ac(y,+u)],b=bt.from(s.table).where(t.concat(g)),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:I,channel:E,field:T}=w;T.aggregate?(_[E]=T,o[E]=!0):E==="weight"?_[gl]=Li(T):E!=="x"&&E!=="y"&&(b.select({[I]:T}),x.push(I))}let v=this.aggr=Object.keys(_);if(_.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push(gl),_.density=Vn()),r==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!_.density)throw new Error("Linear binning not applicable to custom aggregates.");return iht(b,h,m,_[gl],f,x)}else return nht(b,h,m,_,f,x)}binDimensions(){let{plot:t,pixelSize:r,width:n,height:i}=this;return[n??Math.round(t.innerWidth()/r),i??Math.round(t.innerHeight()/r)]}queryResult(t){let[r,n]=this.bins,i=rht(this.interpolate),{columns:o}=Ss(t);return this.grids0=ZG(r,n,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:r,bins:n,grids0:i,plot:o}=this;if(this.grids=i,r>0){let s=t.length===1?t[0]:t.includes(gl)?gl:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=n,d=a.some(m=>m.some(y=>y<0)),h=Yx(r*(u-1)/c,d),p=Yx(r*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>QG(h,p,m,n))}}}return this}};function eht(e){let t={};for(let r in e)e[r]==="density"&&(delete e[r],t[r]=!0);return t}function rht(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return Mx;case"barycentric":return Ax();case"random-walk":return Ex()}throw new Error(`invalid interpolate: ${e}`)}function nht(e,t,r,n,i,o){return e.select({index:W`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function iht(e,t,r,n,i,o){let s=n?.column?`* ${n.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:r,i:d,w:h}),c=a(W`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(W`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(W`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(W`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return bt.from(bt.unionAll(c,l,u,f)).select({index:"i",density:Li("w")},o).groupby("index",o).having(mf("density",0))}var Wx=class extends Is{constructor(t,r){let{thresholds:n=10,...i}=r;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=Ir(n,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:r,grids:n,thresholds:i,plot:o}=this,{numRows:s,columns:a}=n,c=i,l;if(Array.isArray(c))l=c;else{let[,A]=qx(a.density);l=Array.from({length:c-1},(O,L)=>A*(L+1)/c)}(r.fill||r.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[d,h]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(h-d)/u,g=(m-p)/f,b=+d,x=+p,_=A=>b+A*y,v=A=>x+A*g,w=au().size(t),I=this.contourData=Array(s*l.length),{density:E,...T}=a,B=Object.entries(T);for(let A=0,O=0;A<s;++A){let L=E[A],S=B.reduce((M,[D,C])=>(M[D]=C[A],M),{});for(let M=0;M<l.length;++M,++O)I[O]=Object.assign(oht(w.contour(L,l[M]),_,v),S)}return this}plotSpecs(){let{type:t,channels:r,densityMap:n,contourData:i}=this,o={};for(let s of r){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=Un(s))}for(let s in n)n[s]&&(o[s]=Un({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function oht(e,t,r){function n(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=r(s[1])}return e.coordinates.forEach(n),e}function Gx(e){return Array.from({length:e},(t,r)=>r)}function hA(e,t){let r=t.reduce((i,o,s)=>(i[o]=s,i),{}),n=Gx(e.length);return n.sort((i,o)=>r[e[i]]-r[e[o]]),n}function pA(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.setAttribute("width",e),r.setAttribute("height",t),r}throw new Error("Can not create a canvas instance.")}function JG(e=1){let t=255*e|0;return(r,n,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<n;++a,s+=4)r[s+3]=t}}function tX(e){let{apply:t}=e;return(r,n,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*n;c<n;++c,a+=4)r[a+3]=255*t(o[c+l])|0}}function eX(e={}){let{r:t=0,g:r=0,b:n=0,opacity:i=1}=typeof e=="string"?Yr(e):e,o=new Uint8ClampedArray([t,r,n,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function rX(e){let{domain:t,range:r}=e,n=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=r.length;for(let a=0;a<=o;++a){let c=r[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?Yr(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,n[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=n[u[h+p]];a[d+0]=i[m+0],a[d+1]=i[m+1],a[d+2]=i[m+2],a[d+3]=i[m+3]}else{let f=n[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function nX(e,t,r){let{interpolate:n}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=n(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?Yr(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*r(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var qu=class extends Is{constructor(t,r){super("image",t,r),this.image=null}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=lht(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=Q6(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?hA(m,this.plot.getAttribute("colorDomain")):Gx(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,b)=>(d?.(l.data,n,i,m[y[b]]),u?.(l.data,n,i,p[y[b]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}},Xx=class extends qu{constructor(t,r){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...r})}};function Q6(e){let{aggr:t,densityMap:r,groupby:n,plot:i}=e,o=t.includes(gl),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(n.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=r.fill||t.includes("fill")?"grid":n.includes(a?.as)?"group":lA(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=r.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?gl:null),d=c?.as??(u==="grid"?gl:null),h=l!=="grid"&&l!=="group"?eX(l):aht(e,f),p=u!=="grid"?JG(u):sht(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function sht(e,t){let{plot:r,grids:n}=e,i=r.getAttribute("opacityDomain"),o=i===sa,s=i?.[gn],a=!o&&!s&&i||qx(n.columns[t]);(o||s||!i)&&(o||(a[gn]=!0),r.setAttribute("opacityDomain",a));let c=Du({opacity:{type:r.getAttribute("opacityScale"),domain:a,clamp:r.getAttribute("opacityClamp"),nice:r.getAttribute("opacityNice"),reverse:r.getAttribute("opacityReverse"),zero:r.getAttribute("opacityZero"),base:r.getAttribute("opacityBase"),exponent:r.getAttribute("opacityExponent"),constant:r.getAttribute("opacityConstant")}});return tX(c)}function aht(e,t){let{plot:r,grids:n}=e,i=n.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=r.getAttribute("colorDomain"),c=a===sa,l=a?.[gn],u=!c&&!l&&a||(o?i.slice().sort(Yt):s?KG(i):qx(i));(c||l||!a)&&(c||(u[gn]=!0),r.setAttribute("colorDomain",u));let f=Du({color:{type:r.getAttribute("colorScale"),domain:u,range:r.getAttribute("colorRange"),clamp:r.getAttribute("colorClamp"),n:r.getAttribute("colorN"),nice:r.getAttribute("colorNice"),reverse:r.getAttribute("colorReverse"),scheme:r.getAttribute("colorScheme"),interpolate:r.getAttribute("colorInterpolate"),pivot:r.getAttribute("colorPivot"),symmetric:r.getAttribute("colorSymmetric"),zero:r.getAttribute("colorZero"),base:r.getAttribute("colorBase"),exponent:r.getAttribute("colorExponent"),constant:r.getAttribute("colorConstant")}});if(s)return rX(f);{let d=Du({x:{type:cht(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return nX(1024,f,d.apply)}}function cht(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function lht(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=pA(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}var Hx=class extends qu{constructor(t,r){let{normalize:n=!0,...i}=r;super(t,i),this.normalize=Ir(n,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:r,normalize:n,source:i,pad:o}=this,[s,a]=this.bins=this.binDimensions(),[c]=Ji(this,"x",s,Ua(this,t),o),[l]=Ji(this,"y",a,Pa(this,t),o),u=bt.from(i.table).where(uht(this,t));this.aggr=["density"];let f=this.groupby=[],d=[];for(let h of r)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 fht(u,c,l,d,s,a,f,n)}};function uht(e,t){if(Array.isArray(t)&&!t.length)return t;let{column:r}=e.channelField("x"),{column:n}=e.channelField("y"),i=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==r&&a!==n},o=s=>s.op==="AND"?bi(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function fht(e,t,r,n,i,o,s=[],a=!0){e.select({x:W`FLOOR(${t})::INTEGER`,y:W`FLOOR(${r})::INTEGER`});let c=s.concat(n),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=bt.from(e).select(c,{x0:"x",y0:"y",dx:W`(lead(x) OVER sw - x)`,dy:W`(lead(y) OVER sw - y)`}).window({sw:W`${l}ORDER BY x ASC`}).qualify(bi(W`(x0 < ${i} OR x0 + dx < ${i})`,W`(y0 < ${o} OR y0 + dy < ${o})`,W`(x0 > 0 OR x0 + dx > 0)`,W`(y0 > 0 OR y0 + dy > 0)`)),f=bt.select({x:W`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=bt.select({i:W`UNNEST(range((${f})))::INTEGER`}),h=bt.unionAll(bt.select(c,{x:W`x0 + i`,y:W`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(W`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),bt.select(c,{x:W`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:W`y0 + SIGN(dy) * i`}).from("pairs","indices").where(W`ABS(dy) > ABS(dx) AND i < ABS(dy)`),bt.select(c,{x:"x0",y:"y0"}).from("pairs").where(pf("dx"))),p=["x"].concat(c).join(", "),m=bt.from("raster").select(c,"x","y",a?{w:W`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(bi(Br("x",[0,i],!0),Br("y",[0,o],!0)));return bt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:W`x + y * ${i}::INTEGER`,density:a?Li("w"):Vn()}).groupby("index",s)}var Tm=class extends Xr{constructor(t,r,n){let{bins:i=1024,bandwidth:o=20,...s}=n,a=t.endsWith("X")?"y":"x";super(t,r,s,a==="x"?H6:Z6),this.dim=a,this.bins=Ir(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=Ir(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",r=this.plot.getAttribute(t);return r&&!r[gn]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:r,channels:n,dim:i,source:{table:o}}=this,s=this.extent=(i==="x"?Ua:Pa)(this,t),[a,c]=Ji(this,i,r,s),l=Vx(n,o,[i]).where(t.concat(Br(c,s))),u=this.channelField("weight")?"weight":null;return dht(l,a,u)}queryResult(t){let{columns:{index:r,density:n}}=Ss(t);return this.grid=HG(this.bins,r,n),this.convolve()}convolve(){let{bins:t,bandwidth:r,dim:n,grid:i,plot:o,extent:[s,a]}=this,c=i.some(x=>x<0),l=n==="x"?o.innerWidth():o.innerHeight(),u=Yx(r*(t-1)/l,c),f=dA(u,i,t),d=n==="x"?"y":"x",h=this.channelField(n).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),b=new Float64Array(t);for(let x=0;x<t;++x)g[x]=p+x*m,b[x]=f[x]*y;return this.data={numRows:t,columns:{[h]:g,[d]:b}},this}plotSpecs(){let{type:t,data:{numRows:r,columns:n},channels:i,dim:o}=this,s=o==="x"?{y:n.y}:{x:n.x};for(let a of i)s[a.channel]=Un(a,n);return[{type:t,data:{length:r},options:s}]}};function dht(e,t,r){let n=r?`* ${r}`:"",i=e.clone().select({p:t,i:W`FLOOR(p)::INTEGER`,w:W`(FLOOR(p) + 1 - p)${n}`}),o=e.clone().select({p:t,i:W`FLOOR(p)::INTEGER + 1`,w:W`(p - FLOOR(p))${n}`});return bt.from(bt.unionAll(i,o)).select({index:"i",density:Li("w")}).groupby("index").having(jy("density",0))}var Zx=class extends Is{constructor(t,r){let{type:n="dot",...i}=r;super(n,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:r,extentX:n,extentY:i}=this,[o,s]=t,a=Fd(this,"x"),c=Fd(this,"y"),[l,u]=n.map(y=>a.apply(y)),[f,d]=i.map(y=>c.apply(y)),h=(u-l)/(o-r),p=(d-f)/(s-r),m=r?0:.5;return this.data=hht(this.grids,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:r,densityMap:n,data:{numRows:i,columns:o}}=this,s={};for(let a of r){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:Un(a,o)}for(let a in n)n[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function hht(e,t,r,n,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=u*f,h=d*e.numRows,p=new Float64Array(h),m=new Float64Array(h),y=new Float64Array(h),g={x:p,y:m,density:y},{density:b,...x}=e.columns;for(let v in x)g[v]=new x[v].constructor(h);let _=0;for(let v=0;v<e.numRows;++v){for(let I in x)g[I].fill(x[I][v],_,_+d);let w=b[v];for(let I=0,E=0;E<f;++E)for(let T=0;T<u;++T,++_,++I)p[_]=s(r+(T+c)*i),m[_]=a(n+(E+c)*o),y[_]=w[I]*l}return{numRows:h,columns:g}}function pht(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-Am(t)-Am(r)+Am(t+r);s<10;s++){if(h===0||h===1)return h;if(d=mht(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function mht(e,t,r){var n=e===0||e===1?0:Math.exp(Am(t+r)-Am(t)-Am(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+r+2)?n*iX(e,t,r)/t:1-n*iX(1-e,r,t)/r}function iX(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function Am(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function oX(e,t){var r=pht(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}function sX(e){let t=-Math.log((1-e)*(1+e)),r;return t<6.25?(t-=3.125,r=-364441206401782e-35,r=-16850591381820166e-35+r*t,r=128584807152564e-32+r*t,r=11157877678025181e-33+r*t,r=-1333171662854621e-31+r*t,r=20972767875968562e-33+r*t,r=6637638134358324e-30+r*t,r=-4054566272975207e-29+r*t,r=-8151934197605472e-29+r*t,r=26335093153082323e-28+r*t,r=-12975133253453532e-27+r*t,r=-5415412054294628e-26+r*t,r=10512122733215323e-25+r*t,r=-4112633980346984e-24+r*t,r=-29070369957882005e-24+r*t,r=42347877827932404e-23+r*t,r=-13654692000834679e-22+r*t,r=-13882523362786469e-21+r*t,r=.00018673420803405714+r*t,r=-.000740702534166267+r*t,r=-.006033670871430149+r*t,r=.24015818242558962+r*t,r=1.6536545626831027+r*t):t<16?(t=Math.sqrt(t)-3.25,r=22137376921775787e-25,r=9075656193888539e-23+r*t,r=-27517406297064545e-23+r*t,r=18239629214389228e-24+r*t,r=15027403968909828e-22+r*t,r=-4013867526981546e-21+r*t,r=29234449089955446e-22+r*t,r=12475304481671779e-21+r*t,r=-47318229009055734e-21+r*t,r=6828485145957318e-20+r*t,r=24031110387097894e-21+r*t,r=-.0003550375203628475+r*t,r=.0009532893797373805+r*t,r=-.0016882755560235047+r*t,r=.002491442096107851+r*t,r=-.003751208507569241+r*t,r=.005370914553590064+r*t,r=1.0052589676941592+r*t,r=3.0838856104922208+r*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,r=-27109920616438573e-27,r=-2555641816996525e-25+r*t,r=15076572693500548e-25+r*t,r=-3789465440126737e-24+r*t,r=761570120807834e-23+r*t,r=-1496002662714924e-23+r*t,r=2914795345090108e-23+r*t,r=-6771199775845234e-23+r*t,r=22900482228026655e-23+r*t,r=-99298272942317e-20+r*t,r=4526062597223154e-21+r*t,r=-1968177810553167e-20+r*t,r=7599527703001776e-20+r*t,r=-.00021503011930044477+r*t,r=-.00013871931833623122+r*t,r=1.0103004648645344+r*t,r=4.849906401408584+r*t):r=1/0,r*e}var Mm=class extends Xr{constructor(t,r,n){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=n;super(t,r,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=Ir(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:r,field:n,source:{table:i}}=this,o=r.concat([{field:Yy(n),as:"__avg__"},{field:Vn(n),as:"__n__"},{field:Wy(n),as:"__sd__"}]);return Vx(o,i).where(t)}queryResult(t){return this.data=Ss(t),this}plotSpecs(){let{type:t,dim:r,detail:n,data:i,ci:o,channels:s}=this,a=Math.SQRT2*sX(o),{columns:{__avg__:c,__sd__:l,__n__:u}}=i,f={[`${r}1`]:c.map((d,h)=>d-a*l[h]/Math.sqrt(u[h])),[`${r}2`]:c.map((d,h)=>d+a*l[h]/Math.sqrt(u[h]))};return X6(t,n,s,i,f)}};var yht="geom",Kx=class extends Xr{constructor(t,r={},n){!uA(t)&&!r?.geometry&&(r.geometry=Xy(yht)),super("geo",t,r,n)}queryResult(t){super.queryResult(t);let r=this.channelField("geometry")?.as;if(r){let{columns:n}=this.data;typeof n[r][0]=="string"&&(n[r]=n[r].map(i=>JSON.parse(i)))}return this}};var Qx=class extends Xr{constructor(t,r){let{type:n="hexagon",binWidth:i=20,...o}=r;super(n,t,{r:i/2,clip:!0,...o},fA),this.binWidth=Ir(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[gn]&&!r[gn]}query(t=[]){if(this.hasOwnData())return null;let{plot:r,binWidth:n,channels:i,source:o}=this,[s,a]=Ua(this,t),[c,l]=Pa(this,t),u=.5-r.getAttribute("marginLeft"),f=0-r.getAttribute("marginTop"),d=`${n}::DOUBLE`,h=`${n*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${r.innerWidth()/(a-s)}::DOUBLE`,m=`${r.innerHeight()/(l-c)}::DOUBLE`,y,g,b=new Set,x={},_;for(let T of i)T.channel==="orderby"?_=T.value:T.channel==="x"?y=T:T.channel==="y"?g=T:Object.hasOwn(T,"field")&&(x[T.as]=T.field,T.field.aggregate&&T.field.columns.forEach(B=>b.add(B)));let v=bt.select({[y.as]:W`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[g.as]:W`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${m}`,...x}).groupby("x","y");_&&v.orderby(_);let w=`${p} * (${y.field} - ${s}::DOUBLE)`,I=`${m} * (${l}::DOUBLE - ${g.field})`,E=bt.select({py:W`(${I} - ${f}) / ${h}`,pj:W`ROUND(py)::INTEGER`,px:W`(${w} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:W`ROUND(px)::INTEGER`,tt:W`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:W`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:W`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(b)).from(o.table).where(sc(y.field),sc(g.field),t);return v.from(E)}};var Jx=class extends Is{constructor(t,r){let{origin:n=[0,0],dim:i="xy",...o}=r;super("image",t,o),this.image=null,this.origin=n,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:r,pad:n,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=Ji(this,"x",f,[a,c],n),[m,y]=Ji(this,"y",d,[l,u],n),g=n?[Br(p,[+a,+c]),Br(y,[+l,+u])]:[cc(+a,p),ac(p,+c),cc(+l,y),ac(y,+u)],b=bt.from(s.table).where(g),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:I,channel:E,field:T}=w;T.aggregate?(_[E]=T,o[E]=!0):E==="weight"?_.density=Li(T):E!=="x"&&E!=="y"&&(b.select({[I]:T}),x.push(I))}let v=this.aggr=Object.keys(_);if(_.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push("density"),_.density=Vn()),r==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!_.density)throw new Error("Linear binning not applicable to custom aggregates.");return wht(b,h,m,_.density,f,x)}else return _ht(b,h,m,_,f,x)}async requestTiles(){let t=mo();this.prefetch&&t.cancel(this.prefetch);let{pad:r,tileX:n,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=Ua(this,this._filter),[f,d]=Pa(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-r)/h),y=Math.floor((f-s)*(c-r)/p),g=(A,O)=>[[o+A*h,o+(A+1)*h],[s+O*p,s+(O+1)*p]],b=Math.floor((l-o)/h),x=n?aX((u-o)/h):b,_=Math.floor((f-s)/p),v=i?aX((d-s)/p):_,w=[];for(let A=b;A<=x;++A)for(let O=_;O<=v;++O)w.push([A,O]);let I=w.map(([A,O])=>t.query(this.tileQuery(g(A,O)))),E=[];if(n)for(let A=_;A<=v;++A)E.push([x+1,A]),E.push([b-1,A]);if(i){let A=n?b-1:b,O=n?x+1:x;for(let L=A;L<=O;++L)E.push([L,v+1]),E.push([L,_-1])}this.prefetch=E.map(([A,O])=>t.prefetch(this.tileQuery(g(A,O))));let T=await Promise.all(I),B=ght(a,c,m,y,w,T);this.grids0={numRows:B.length,columns:{density:[B]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=xht(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=Q6(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?hA(m,this.plot.getAttribute("colorDomain")):Gx(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,b)=>(d?.(l.data,n,i,m[y[b]]),u?.(l.data,n,i,p[y[b]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}};function ght(e,t,r,n,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-r,d=u*t-n;bht(e,t,s,a,f,d)}),s}function bht(e,t,r,n,i,o){let s=n.numRows;if(s===0)return;let a=n.getChild("index").toArray(),c=n.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(r[f+d*e]=c[l])}}function xht(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=pA(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}function _ht(e,t,r,n,i,o){return e.select({index:W`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function wht(e,t,r,n,i,o){let s=n.column?`* ${n.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:r,i:d,w:h}),c=a(W`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(W`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(W`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(W`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return bt.from(bt.unionAll(c,l,u,f)).select({index:"i",density:Li("w")},o).groupby("index",o).having(mf("density",0))}function aX(e){let t=Math.floor(e);return t===e?t-1:t}var t_=class extends Xr{constructor(t,r){let{ci:n=.95,precision:i=4,...o}=r;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=Ir(n,a=>(this.ci=a,s())),this.precision=Ir(i,a=>(this.precision=a,s()))}query(t=[]){let r=this.channelField("x").as,n=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return bt.from(super.query(t)).select({intercept:oE(n,r),slope:sE(n,r),n:aE(n,r),ssy:cE(n,r),ssx:lE(n,r),xm:uE(n,r),x0:dh(po(r).where(sc(n))),x1:dh(ho(r).where(sc(n)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Ss(t),this.lineData=vht(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:r,precision:n,plot:i}=this,o=i.innerWidth();return this.areaData=t?Sht(r,t,n,o):null,this}plotSpecs(){let{lineData:t,areaData:r,channels:n,ci:i}=this,o=t.columns,s=i?r.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of n)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=Un(l,s);break;case"stroke":a.stroke=Un(l,o),c.fill=Un(l,s);break;case"strokeOpacity":a.strokeOpacity=Un(l,o);break;case"fillOpacity":c.fillOpacity=Un(l,s);break;default:a[l.channel]=Un(l,o),c[l.channel]=Un(l,s);break}return[...i?[{type:"areaY",data:{length:r.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function J6(e,t){if(e.concat)return e.concat(t);let r=new e.constructor(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function vht(e){let{x0:t,x1:r,xm:n,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(h,p)=>i[p]+h*o[p],f=J6(t,r),d=J6(t.map(u),r.map(u));for(let h in l)l[h]=J6(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function Sht(e,t,r,n){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:d,...h}=e.columns,p=Object.keys(h),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=r*(s[y]-o[y])/n,b=oX((1-t)/2,u[y]-2)*Math.sqrt(d[y]/(u[y]-2));_r(o[y],s[y]-g/2,g).concat(s[y]).forEach(x=>{let _=c[y]+x*l[y],v=b*Math.sqrt(1/u[y]+(x-a[y])**2/f[y]);m.x.push(x),m.y1.push(_-v),m.y2.push(_+v),p.forEach(w=>m[w].push(h[w][y]))})}return{numRows:m.x.length,columns:m}}function cX(e){let t=e.toLowerCase(),r=e.length,n="";for(let i=0;i<r;++i)n+=(e[i]!==t[i]?"-":"")+t[i];return n}function Em(e){let t={};for(let r in e)t[cX(r)]=e[r];return t}function Iht(e){let{channels:t}=e,r=new Set,n=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")n=!0;else if(a)if(a.aggregate)i=!0;else{if(r.has(c))continue;r.add(c)}}return!n&&i&&r.size&&e.channels.push({channel:"orderby",value:Array.from(r)}),e}var e_=class{constructor(t,{selection:r,channels:n={}}){this.mark=Iht(t),this.selection=r;let i=Object.entries(Em(n));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",Om(()=>this.update()))}init(t){this.svg=t;let r=this.values=[],n=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${n}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];r.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:r,channels:n,values:i,mark:o,selection:s}=this;if(!t)return;let a=await Tht(o,s);for(let c=0;c<r.length;++c){let l=r[c],u=i[c],f=l.__data__,d=a(Array.isArray(f)?f[0]:f);for(let h=0;h<n.length;++h){let[p,m]=n[h];l.setAttribute(p,d?u[h]:m)}}}};async function Tht(e,t){let r=t?.predicate(e);if(!r||r.length===0)return()=>!0;let n=e.filterBy?.predicate(e,!0),i={__:bi(r)},o=e.query(n);(o.queries||[o]).forEach(c=>{c.groupby().length?c.select(i):c.$select(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.get(c):c=>s[c].__:()=>!1}function tF(e){let t=e.on,r=!0;function n(i){r=!1,i(),r=!0}return e.reset=(...i)=>{n(()=>e.clear(...i))},e.moveSilent=(...i)=>{n(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>r&&o(...s)}return t(...i)},e}function lX(){return tF(F3())}function uX(){return tF(O3())}function fX(){return tF(N3())}function r_(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 $a(e,t){let r=e.channelField(t)?.field;return r?.basis||r}function n_(e,t,r=1){return t.invert(r*Math.floor(e/r))}function mA(){let e=this,t=e.getScreenCTM,r;e.getScreenCTM=()=>e.isConnected?r=t.call(e):r}var Yu=class{constructor(t,{channel:r,selection:n,field:i=void 0,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=r,this.pixelSize=o||1,this.selection=n,this.peers=s,this.field=i||$a(t,r),this.style=a&&Em(a),this.brush=r==="y"?fX():uX(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let r;t&&(r=t.map(n=>n_(n,this.scale,this.pixelSize)).sort((n,i)=>n-i)),r_(r,this.value)||(this.value=r,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(r)))}clause(t){let{mark:r,pixelSize:n,field:i,scale:o}=this;return xf(i,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scale:o,pixelSize:n})}init(t,r){let{brush:n,channel:i,style:o}=this;this.scale=t.scale(i);let s=t.scale("x").range,a=t.scale("y").range;n.extent([[Ne(s),Ne(a)],[me(s),me(a)]]);let c=this.value?.map(this.scale.apply).sort(Yt),l=ce(t).selectAll('g[aria-label="facet"]');if(r=l.size()?l:ce(r??t),this.g=r.append("g").attr("class",`interval-${i}`).each(mA).call(n).call(n.moveSilent,c),o){let u=this.g.selectAll("rect.selection");for(let f in o)u.attr(f,o[f])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var i_=class{constructor(t,{selection:r,xfield:n,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=r,this.peers=s,this.xfield=n||$a(t,"x"),this.yfield=i||$a(t,"y"),this.style=a&&Em(a),this.brush=lX(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:r,pixelSize:n,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>n_(u,i,n)).sort(Yt),a=[c[1],l[1]].map(u=>n_(u,o,n)).sort(Yt)}(!r_(s,r?.[0])||!r_(a,r?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:r,pixelSize:n,xfield:i,yfield:o,xscale:s,yscale:a}=this;return PE([i,o],t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scales:[s,a],pixelSize:n})}init(t){let{brush:r,style:n}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;r.extent([[Ne(s),Ne(a)],[me(s),me(a)]]);let c=ce(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:ce(t);if(this.g=l.append("g").attr("class","interval-xy").each(mA).call(r),n){let u=this.g.selectAll("rect.selection");for(let f in n)u.attr(f,n[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort(Yt),[d,h]=this.value[1].map(o.apply).sort(Yt);this.g.call(r.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var Rd=class{constructor(t,{selection:r,pointer:n,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=r,this.clients=new Set().add(t),this.pointer=n,this.channels=i||(n==="x"?["x"]:n==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>$a(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:r,fields:n}=this;return ng(n,t&&[t],{source:this,clients:r})}init(t){let r=this,{mark:n,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=n,c=i.map(b=>n.channelField(b).as),l=!ki(o),u=ce(t).selectAll('g[aria-label="facet"]'),f=u.size()?u:ce(t),d=t.scale("x").apply,h=t.scale("y").apply,p=Array.from(a[n.channelField("x").as],d),m=Array.from(a[n.channelField("y").as],h),y=this.pointer==="y"?.01:1,g=this.pointer==="x"?.01:1;f.on("pointerenter pointerdown pointermove",function(b){let[x,_]=Dn(b,this),v=Aht(p,m,x,_,y,g,s);if(v!==this.valueIndex){this.valueIndex=v;let w=v<0?void 0:c.map(I=>a[I][v]);l?v>-1&&o.update(w.length>1?w:w[0]):o.update(r.clause(w))}}),!l&&(f.on("pointerleave",()=>{o.update(r.clause(void 0))}),t.addEventListener("pointerenter",b=>{if(!b.buttons){let x=this.channels.map(()=>0);o.activate(this.clause(x))}}))}};function Aht(e,t,r,n,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-r),f=o*(t[l]-n),d=u*u+f*f;d<=a&&(a=d,c=l)}return c}var dX=(e,t)=>e-t,o_=class{constructor(t,{x:r=new lc,y:n=new lc,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=r,this.ysel=n,this.xfield=i||$a(t,"x"),this.yfield=o||$a(t,"y"),this.zoom=eF(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let r=Mht(t,this.xscale);this.xsel.update(this.clause(r,this.xfield,this.xscale))}if(this.pany){let r=Eht(t,this.yscale);this.ysel.update(this.clause(r,this.yfield,this.yscale))}}clause(t,r,n){return xf(r,t,{source:this,clients:this.mark.plot.markSet,scale:n})}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:r,pany:n,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(dX),c=this.yscale.range.slice().sort(dX),l=eF(r,[-1/0,1/0],a),u=eF(n,[-1/0,1/0],c),f=ZO().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 Xi(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(ce(i).call(f),r||n){let d=!1;i.addEventListener("pointerenter",h=>{if(!d&&(d=!0,!h.buttons)){if(r){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(n){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>d=!1)}}};function eF(e,t,r){return e?Array.isArray(e)?e:t:r}function Mht(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function Eht(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var Ld=class{constructor(t,{selection:r,channels:n,peers:i=!0}){this.value=null,this.mark=t,this.selection=r,this.peers=i;let o=this.fields=[],s=this.as=[];n.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:r,mark:n}=this;return ng(r,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n)})}init(t,r,n){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;n??=l=>o.map(u=>{let f=l.__data__;return a[u][Array.isArray(f)?f[0]:f]}),r??=`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(r));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(Dht(c,f)){let h=n(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>rF(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!rF(u[0],h)?d=null:d=[h]}this.value=d,Bht(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function Dht(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function Bht(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((r,n)=>rF(r,t[n]))}function rF(e,t){let r=e.length;if(t.length!==r)return!0;for(let n=0;n<r;++n)if(e[n]!==t[n])return!0;return!1}var pX=":scope > div, :scope > span",yA="swatch",hX="ramp",Dm=class{constructor(t,r){let{as:n,field:i,...o}=r;this.channel=t,this.options={label:null,...o},this.type=null,this.handler=null,this.selection=n,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let r=Oht(this,t);return this.element.replaceChildren(r),this.element}update(){if(!this.legend)return;let{selection:t,handler:r}=this,{single:n,value:i}=t,o=n?i:t.valueFor(r),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(pX);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function Oht(e,t){let{channel:r,options:n,selection:i}=e,o=t.scale(r),s=o.type==="ordinal"?yA:hX,a=s===yA?n:n.label?{tickSize:2,...n}:{tickSize:2,marginTop:1,height:29,...n},c=t.legend(r,a);e.legend=c;let l=!!i;if(l&&s===hX){let u=a.width??240,f=Lht(o,u);f?c.scale=function(d){return d==="x"?{range:[0,u]}:d==="y"?{range:[-10,0]}:d===r?f:void 0}:l=!1}if(l){let u=Nht(e,s);s===yA?(u.init(c,pX,f=>[f.__data__]),e.update()):u.init(c,c.querySelector("g:last-of-type"))}return c}function Nht(e,t){let{channel:r,handler:n,selection:i}=e;if(n)return n;let o=Fht(e);return t===yA?(e.handler=new Ld(o,{selection:i,channels:[r],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new Yu(o,{selection:i,channel:r,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function Fht(e){let{channel:t,plot:r}=e,n=e.field??Rht(r.marks,t)??"value";if(n){let i={field:n};return{plot:r,channelField:o=>t===o?i:void 0}}}function Rht(e,t){let r=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(r==null)return null;for(let n=e.length-1;n>-1;--n)for(let i of r){let o=e[n].channelField(i,{exact:!0});if(o)return o.field}return null}function Lht(e,t){let{apply:r,invert:n,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return Du({x:{...o,type:a,range:[0,t]}})}var kht=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function gA(e,t={steps:25}){let r=(n,i)=>kht.has(`${n.type}-${i}`)?{[`${i}1`]:nF(n,i,e,t),[`${i}2`]:nF(n,i,e,{...t,offset:1})}:{[i]:nF(n,i,e,t)};return r[n0]=!0,r}function nF(e,t,r,n){return{column:r,label:r,get stats(){return{column:r,stats:["min","max"]}},get columns(){return[r]},get basis(){return r},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=Fd(e,t),{min:a,max:c}=e.channelField(t),l=Cht(i(a),i(c),n),u=o(r),f=l.min===0?u:`(${u} - ${l.min})`,d=`${(l.max-l.min)/l.steps}::DOUBLE`,h=n.offset?`${n.offset} + `:"",p=`${l.min} + ${d} * (${h}FLOOR(${f} / ${d}))`;return`${s(p)}`}}}function Cht(e,t,r){let{steps:n=25,minstep:i=0,nice:o=!0}=r;if(o!==!1){let s=t-e,a=n,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,y=f.length;m<y;++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,n=Math.round((t-e)/u)}return{min:e,max:t,steps:n}}var Uht=e=>e&&typeof e=="object"&&!Array.isArray(e);var s_=class extends li{constructor({element:t,filterBy:r,from:n,column:i,label:o=i,format:s=f=>f,options:a,value:c,field:l=i,as:u}={}){super(r),this.from=n,this.column=i,this.format=s,this.field=l;let f=this.selection=u;this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let d=document.createElement("label");if(d.innerText=o||i,this.element.appendChild(d),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(h=>Uht(h)?h:{value:h}),this.selectedValue(c??""),this.update()),f){let h=!ki(f);c!=null&&(!h||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),h&&this.selection.addEventListener("value",p=>{p!==this.select.value&&this.selectedValue(p)})}}selectedValue(t){if(arguments.length===0){let r=this.select.selectedIndex;return this.data[r].value}else{let r=this.data?.findIndex(n=>n.value===t);r>=0?this.select.selectedIndex=r:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:r,field:n}=this;if(ki(r)){t===""&&(t=void 0);let i=rg(n,t,{source:this});r.update(i)}else xi(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?bt.from(r).select({value:n}).distinct().where(t).orderby(n):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:r,select:n,selection:i}=this;n.replaceChildren();for(let{value:o,label:s}of t){let a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??r(o),this.select.appendChild(a)}if(i){let o=ki(i)?i.valueFor(this):i.value;this.selectedValue(o??"")}return this}};var Pht=0;var a_=class extends li{constructor({element:t,filterBy:r,from:n,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(r),this.id="search_"+ ++Pht,this.type=s,this.from=n,this.column=i,this.selection=c,this.field=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),o){let l=document.createElement("label");l.setAttribute("for",this.id),l.innerText=o,this.element.appendChild(l)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ki(this.selection)||this.selection.addEventListener("value",l=>{l!==this.searchbox.value&&(this.searchbox.value=l)}))}reset(){this.searchbox.value=""}publish(t){let{selection:r,field:n,type:i}=this;if(ki(r)){let o=$E(n,t,{source:this,method:i});r.update(o)}else xi(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?bt.from(r).select({list:n}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),r=`${this.id}_list`;t.setAttribute("id",r);for(let n of this.data){let i=document.createElement("option");i.setAttribute("value",n.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",r),this}};var $ht=0;var c_=class extends li{constructor({element:t,filterBy:r,as:n,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=n?.value,select:f="point",field:d=c,width:h}={}){if(super(r),this.id="slider_"+ ++$ht,this.from=a,this.column=c||"value",this.selection=n,this.selectionType=f,this.field=d,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),l){let p=document.createElement("label");p.setAttribute("for",this.id),p.innerText=l,this.element.appendChild(p)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),h!=null&&(this.slider.style.width=`${+h}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:p}=this.slider;this.curval.innerText=p,this.selection&&this.publish(+p)}),this.selection&&!ki(this.selection)&&this.selection.addEventListener("value",p=>{p!==+this.slider.value&&(this.slider.value=p,this.curval.innerText=p)})}query(t=[]){let{from:r,column:n}=this;return!r||this.min!=null&&this.max!=null?null:bt.select({min:po(n),max:ho(n)}).from(r).where(t)}queryResult(t){let{min:r,max:n}=Array.from(t)[0];return this.min==null&&(this.min=r,this.slider.setAttribute("min",`${r}`)),this.max==null&&(this.max=n,this.slider.setAttribute("max",`${n}`)),this.step==null&&(this.step=(n-r)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(t){let{field:r,selectionType:n,selection:i}=this;if(ki(i))if(n==="interval"){let o=[this.min??0,t];i.update(xf(r,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step}))}else i.update(rg(r,t,{source:this}));else xi(this.selection)&&i.update(t)}};var oF=mX(e=>{let t=bA(e);return r=>r==null?"":typeof r=="number"?t(r):r instanceof Date?sF(r):`${r}`}),bA=mX(e=>t=>t===0?"0":t.toLocaleString(e)),rue=oF(),nue=bA();function sF(e){return Bp(e,"Invalid Date")}function mX(e){let t=null,r;return(n="en")=>n===t?r:r=e(t=n)}var zht=-1;var l_=class extends li{constructor({element:t,filterBy:r,from:n,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(r),this.id=`table-${++zht}`,this.from=n,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),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:m,scrollTop:y,clientHeight:g}=d.target,b=y<f;f=y,!(b||h||p)&&m-y<2*g&&(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 r=this.query(this.filterBy?.predicate(this));this.requestQuery(r),mo().prefetch(r.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Ol(this.from,t))}fieldInfo(t){this.schema=t;let r=this.head;r.innerHTML="";let n=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),n.appendChild(o)}return r.appendChild(n),this.formats=Vht(this.format,t),this.style.innerText=Yht(this.id,jht(this.align,t),qht(this.widths,t)),this}query(t=[]){let{from:r,limit:n,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return bt.from(r).select(o.map(c=>c.column)).where(t).orderby(s?a?SM(s):s:[]).limit(n).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:r,data:n,schema:i,limit:o}=this,s=i.length,a=0;for(let c of n){++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?"":r[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,r){r===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=r,this.sortDesc=!1);let n=t.currentTarget,i=this.sortHeader;i===n&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=n,n.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Vht(e={},t,r){return t.map(({column:n,type:i})=>{if(n in e)return e[n];switch(i){case"number":return bA(r);case"date":return sF;default:return oF(r)}})}function jht(e={},t){return t.map(({column:r,type:n})=>r in e?e[r]:n==="number"?"right":"left")}function qht(e={},t){return t.map(({column:r})=>e[r])}function Yht(e,t,r){let n=[];return t.forEach((i,o)=>{let s=+r[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";n.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),n.join(" ")}function u_(e,...t){let r=e?.context?.coordinator??mo();for(let n of t)r.connect(n)}function xA(e,t,r){let n=new t(r);return u_(e,n),n.element}function yX(e){return xA(this,s_,e)}function gX(e){return xA(this,a_,e)}function bX(e){return xA(this,c_,e)}function xX(e){return xA(this,l_,e)}function _X({direction:e="vertical",wrap:t=!1},r){let n=document.createElement("div");return n.style.display="flex",n.style.flexDirection=e==="vertical"?"column":"row",n.style.flexWrap=t?t===!0?"wrap":t:"nowrap",n.style.justifyContent="flex-start",n.style.alignItems="flex-start",r.forEach(i=>n.appendChild(i)),Object.assign(n,{value:{element:n}}),n}function wX(...e){return _X({direction:"vertical"},e.flat())}function vX(...e){return _X({direction:"horizontal"},e.flat())}function SX({dim:e="width",size:t=10}){let r=document.createElement("span");return r.style.display="inline-block",r.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(r,{value:{element:r}})}function IX(e){return SX({dim:"height",size:e})}function TX(e){return SX({dim:"width",size:e})}var EX={};Tr(EX,{align:()=>wF,aspectRatio:()=>vF,axis:()=>SF,colorBase:()=>u4,colorClamp:()=>QL,colorConstant:()=>d4,colorDomain:()=>ZL,colorExponent:()=>f4,colorInterpolate:()=>r4,colorLabel:()=>o4,colorN:()=>JL,colorNice:()=>t4,colorPercent:()=>s4,colorPivot:()=>n4,colorRange:()=>KL,colorReverse:()=>a4,colorScale:()=>HL,colorScheme:()=>e4,colorSymmetric:()=>i4,colorTickFormat:()=>l4,colorZero:()=>c4,facetGrid:()=>HR,facetLabel:()=>ZR,facetMargin:()=>qR,facetMarginBottom:()=>WR,facetMarginLeft:()=>GR,facetMarginRight:()=>XR,facetMarginTop:()=>YR,fxAlign:()=>nL,fxAriaDescription:()=>wL,fxAriaLabel:()=>_L,fxAxis:()=>aL,fxDomain:()=>KR,fxFontVariant:()=>xL,fxGrid:()=>pL,fxInset:()=>JR,fxInsetLeft:()=>tL,fxInsetRight:()=>eL,fxLabel:()=>yL,fxLabelAnchor:()=>gL,fxLabelOffset:()=>bL,fxLine:()=>mL,fxPadding:()=>iL,fxPaddingInner:()=>oL,fxPaddingOuter:()=>sL,fxRange:()=>QR,fxReverse:()=>vL,fxRound:()=>rL,fxTickFormat:()=>dL,fxTickPadding:()=>fL,fxTickRotate:()=>hL,fxTickSize:()=>lL,fxTickSpacing:()=>uL,fxTicks:()=>cL,fyAlign:()=>DL,fyAriaDescription:()=>GL,fyAriaLabel:()=>WL,fyAxis:()=>FL,fyDomain:()=>SL,fyFontVariant:()=>YL,fyGrid:()=>$L,fyInset:()=>TL,fyInsetBottom:()=>ML,fyInsetTop:()=>AL,fyLabel:()=>VL,fyLabelAnchor:()=>jL,fyLabelOffset:()=>qL,fyLine:()=>zL,fyPadding:()=>BL,fyPaddingInner:()=>OL,fyPaddingOuter:()=>NL,fyRange:()=>IL,fyReverse:()=>XL,fyRound:()=>EL,fyTickFormat:()=>UL,fyTickPadding:()=>CL,fyTickRotate:()=>PL,fyTickSize:()=>LL,fyTickSpacing:()=>kL,fyTicks:()=>RL,grid:()=>TF,height:()=>yF,inset:()=>IF,label:()=>AF,lengthBase:()=>W4,lengthClamp:()=>V4,lengthConstant:()=>X4,lengthDomain:()=>$4,lengthExponent:()=>G4,lengthNice:()=>j4,lengthPercent:()=>q4,lengthRange:()=>z4,lengthScale:()=>P4,lengthZero:()=>Y4,margin:()=>dF,marginBottom:()=>_F,marginLeft:()=>gF,marginRight:()=>bF,marginTop:()=>xF,margins:()=>fF,name:()=>lF,opacityBase:()=>S4,opacityClamp:()=>y4,opacityConstant:()=>T4,opacityDomain:()=>p4,opacityExponent:()=>I4,opacityLabel:()=>b4,opacityNice:()=>g4,opacityPercent:()=>x4,opacityRange:()=>m4,opacityReverse:()=>_4,opacityScale:()=>h4,opacityTickFormat:()=>v4,opacityZero:()=>w4,padding:()=>MF,projectionClip:()=>o8,projectionDomain:()=>J4,projectionInset:()=>t8,projectionInsetBottom:()=>i8,projectionInsetLeft:()=>e8,projectionInsetRight:()=>r8,projectionInsetTop:()=>n8,projectionParallels:()=>Z4,projectionPrecision:()=>K4,projectionRotate:()=>Q4,projectionType:()=>H4,rBase:()=>k4,rClamp:()=>N4,rConstant:()=>U4,rDomain:()=>B4,rExponent:()=>C4,rNice:()=>F4,rPercent:()=>R4,rRange:()=>O4,rScale:()=>D4,rZero:()=>L4,style:()=>pF,symbolDomain:()=>M4,symbolRange:()=>E4,symbolScale:()=>A4,width:()=>mF,xAlign:()=>CF,xAriaDescription:()=>rR,xAriaLabel:()=>eR,xAxis:()=>zF,xBase:()=>sR,xClamp:()=>LF,xConstant:()=>cR,xDomain:()=>DF,xExponent:()=>aR,xFontVariant:()=>tR,xGrid:()=>XF,xInset:()=>NF,xInsetLeft:()=>FF,xInsetRight:()=>RF,xLabel:()=>ZF,xLabelAnchor:()=>KF,xLabelArrow:()=>QF,xLabelOffset:()=>JF,xLine:()=>HF,xNice:()=>OF,xPadding:()=>UF,xPaddingInner:()=>PF,xPaddingOuter:()=>$F,xPercent:()=>nR,xRange:()=>BF,xReverse:()=>iR,xRound:()=>kF,xScale:()=>EF,xTickFormat:()=>WF,xTickPadding:()=>YF,xTickRotate:()=>GF,xTickSize:()=>jF,xTickSpacing:()=>qF,xTicks:()=>VF,xZero:()=>oR,xyDomain:()=>hF,yAlign:()=>bR,yAriaDescription:()=>CR,yAriaLabel:()=>kR,yAxis:()=>vR,yBase:()=>zR,yClamp:()=>yR,yConstant:()=>jR,yDomain:()=>uR,yExponent:()=>VR,yFontVariant:()=>LR,yGrid:()=>DR,yInset:()=>hR,yInsetBottom:()=>mR,yInsetTop:()=>pR,yLabel:()=>OR,yLabelAnchor:()=>NR,yLabelArrow:()=>FR,yLabelOffset:()=>RR,yLine:()=>BR,yNice:()=>dR,yPadding:()=>xR,yPaddingInner:()=>_R,yPaddingOuter:()=>wR,yPercent:()=>UR,yRange:()=>fR,yReverse:()=>PR,yRound:()=>gR,yScale:()=>lR,yTickFormat:()=>MR,yTickPadding:()=>AR,yTickRotate:()=>ER,yTickSize:()=>IR,yTickSpacing:()=>TR,yTicks:()=>SR,yZero:()=>$R});var f_=class extends Map{request(t,r){if(this.has(t))r(this.get(t));else{let n=this.waiting||(this.waiting=new Map),i=n.get(t)||[];n.set(t,i.concat(r))}}set(t,r){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:n}=this;return n?.has(t)&&(n.get(t).forEach(i=>i(r)),n.delete(t)),super.set(t,r)}clear(){return this.waiting?.clear(),super.clear()}},aF=new f_;function cF(e,t,r){(e?.context?.namedPlots??aF).request(t,r)}function AX(e,t,r){(e?.context?.namedPlots??aF).set(t,r)}function lF(e){return t=>AX(this,e,t)}function MX(e,t,r){xi(r)?(r.addEventListener("value",n=>{e.setAttribute(t,n),e.update()}),r.value!==void 0&&e.setAttribute(t,r.value)):e.setAttribute(t,r)}function Wht(e,t){return r=>{MX(r,e,t)}}function uF(e){return t=>{for(let[r,n]of Object.entries(e))MX(t,r,n)}}function fF(e){let{top:t,bottom:r,left:n,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),r!==void 0&&(o.marginBottom=r),n!==void 0&&(o.marginLeft=n),i!==void 0&&(o.marginRight=i),uF(o)}function dF(e){return uF({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function hF(e){return uF({xDomain:e,yDomain:e})}var F=e=>t=>Wht(e,t),pF=F("style"),mF=F("width"),yF=F("height"),gF=F("marginLeft"),bF=F("marginRight"),xF=F("marginTop"),_F=F("marginBottom"),wF=F("align"),vF=F("aspectRatio"),SF=F("axis"),IF=F("inset"),TF=F("grid"),AF=F("label"),MF=F("padding"),EF=F("xScale"),DF=F("xDomain"),BF=F("xRange"),OF=F("xNice"),NF=F("xInset"),FF=F("xInsetLeft"),RF=F("xInsetRight"),LF=F("xClamp"),kF=F("xRound"),CF=F("xAlign"),UF=F("xPadding"),PF=F("xPaddingInner"),$F=F("xPaddingOuter"),zF=F("xAxis"),VF=F("xTicks"),jF=F("xTickSize"),qF=F("xTickSpacing"),YF=F("xTickPadding"),WF=F("xTickFormat"),GF=F("xTickRotate"),XF=F("xGrid"),HF=F("xLine"),ZF=F("xLabel"),KF=F("xLabelAnchor"),QF=F("xLabelArrow"),JF=F("xLabelOffset"),tR=F("xFontVariant"),eR=F("xAriaLabel"),rR=F("xAriaDescription"),nR=F("xPercent"),iR=F("xReverse"),oR=F("xZero"),sR=F("xBase"),aR=F("xExponent"),cR=F("xConstant"),lR=F("yScale"),uR=F("yDomain"),fR=F("yRange"),dR=F("yNice"),hR=F("yInset"),pR=F("yInsetTop"),mR=F("yInsetBottom"),yR=F("yClamp"),gR=F("yRound"),bR=F("yAlign"),xR=F("yPadding"),_R=F("yPaddingInner"),wR=F("yPaddingOuter"),vR=F("yAxis"),SR=F("yTicks"),IR=F("yTickSize"),TR=F("yTickSpacing"),AR=F("yTickPadding"),MR=F("yTickFormat"),ER=F("yTickRotate"),DR=F("yGrid"),BR=F("yLine"),OR=F("yLabel"),NR=F("yLabelAnchor"),FR=F("yLabelArrow"),RR=F("yLabelOffset"),LR=F("yFontVariant"),kR=F("yAriaLabel"),CR=F("yAriaDescription"),UR=F("yPercent"),PR=F("yReverse"),$R=F("yZero"),zR=F("yBase"),VR=F("yExponent"),jR=F("yConstant"),qR=F("facetMargin"),YR=F("facetMarginTop"),WR=F("facetMarginBottom"),GR=F("facetMarginLeft"),XR=F("facetMarginRight"),HR=F("facetGrid"),ZR=F("facetLabel"),KR=F("fxDomain"),QR=F("fxRange"),JR=F("fxInset"),tL=F("fxInsetLeft"),eL=F("fxInsetRight"),rL=F("fxRound"),nL=F("fxAlign"),iL=F("fxPadding"),oL=F("fxPaddingInner"),sL=F("fxPaddingOuter"),aL=F("fxAxis"),cL=F("fxTicks"),lL=F("fxTickSize"),uL=F("fxTickSpacing"),fL=F("fxTickPadding"),dL=F("fxTickFormat"),hL=F("fxTickRotate"),pL=F("fxGrid"),mL=F("fxLine"),yL=F("fxLabel"),gL=F("fxLabelAnchor"),bL=F("fxLabelOffset"),xL=F("fxFontVariant"),_L=F("fxAriaLabel"),wL=F("fxAriaDescription"),vL=F("fxReverse"),SL=F("fyDomain"),IL=F("fyRange"),TL=F("fyInset"),AL=F("fyInsetTop"),ML=F("fyInsetBottom"),EL=F("fyRound"),DL=F("fyAlign"),BL=F("fyPadding"),OL=F("fyPaddingInner"),NL=F("fyPaddingOuter"),FL=F("fyAxis"),RL=F("fyTicks"),LL=F("fyTickSize"),kL=F("fyTickSpacing"),CL=F("fyTickPadding"),UL=F("fyTickFormat"),PL=F("fyTickRotate"),$L=F("fyGrid"),zL=F("fyLine"),VL=F("fyLabel"),jL=F("fyLabelAnchor"),qL=F("fyLabelOffset"),YL=F("fyFontVariant"),WL=F("fyAriaLabel"),GL=F("fyAriaDescription"),XL=F("fyReverse"),HL=F("colorScale"),ZL=F("colorDomain"),KL=F("colorRange"),QL=F("colorClamp"),JL=F("colorN"),t4=F("colorNice"),e4=F("colorScheme"),r4=F("colorInterpolate"),n4=F("colorPivot"),i4=F("colorSymmetric"),o4=F("colorLabel"),s4=F("colorPercent"),a4=F("colorReverse"),c4=F("colorZero"),l4=F("colorTickFormat"),u4=F("colorBase"),f4=F("colorExponent"),d4=F("colorConstant"),h4=F("opacityScale"),p4=F("opacityDomain"),m4=F("opacityRange"),y4=F("opacityClamp"),g4=F("opacityNice"),b4=F("opacityLabel"),x4=F("opacityPercent"),_4=F("opacityReverse"),w4=F("opacityZero"),v4=F("opacityTickFormat"),S4=F("opacityBase"),I4=F("opacityExponent"),T4=F("opacityConstant"),A4=F("symbolScale"),M4=F("symbolDomain"),E4=F("symbolRange"),D4=F("rScale"),B4=F("rDomain"),O4=F("rRange"),N4=F("rClamp"),F4=F("rNice"),R4=F("rPercent"),L4=F("rZero"),k4=F("rBase"),C4=F("rExponent"),U4=F("rConstant"),P4=F("lengthScale"),$4=F("lengthDomain"),z4=F("lengthRange"),V4=F("lengthClamp"),j4=F("lengthNice"),q4=F("lengthPercent"),Y4=F("lengthZero"),W4=F("lengthBase"),G4=F("lengthExponent"),X4=F("lengthConstant"),H4=F("projectionType"),Z4=F("projectionParallels"),K4=F("projectionPrecision"),Q4=F("projectionRotate"),J4=F("projectionDomain"),t8=F("projectionInset"),e8=F("projectionInsetLeft"),r8=F("projectionInsetRight"),n8=F("projectionInsetTop"),i8=F("projectionInsetBottom"),o8=F("projectionClip");function DX(e,t){return{table:e,options:t}}var BX={};Tr(BX,{area:()=>s8,areaX:()=>a8,areaY:()=>c8,arrow:()=>ek,axisFx:()=>sk,axisFy:()=>ak,axisX:()=>ik,axisY:()=>ok,barX:()=>d8,barY:()=>h8,cell:()=>p8,cellX:()=>m8,cellY:()=>y8,circle:()=>S8,contour:()=>z8,delaunayLink:()=>Q8,delaunayMesh:()=>J8,denseLine:()=>$8,density:()=>P8,densityX:()=>C8,densityY:()=>U8,dot:()=>_8,dotX:()=>w8,dotY:()=>v8,errorbarX:()=>X8,errorbarY:()=>H8,frame:()=>nk,geo:()=>dk,graticule:()=>pk,gridFx:()=>uk,gridFy:()=>fk,gridX:()=>ck,gridY:()=>lk,heatmap:()=>V8,hexagon:()=>I8,hexbin:()=>Y8,hexgrid:()=>W8,hull:()=>tk,image:()=>k8,line:()=>l8,lineX:()=>u8,lineY:()=>f8,link:()=>rk,raster:()=>j8,rasterTile:()=>q8,rect:()=>g8,rectX:()=>b8,rectY:()=>x8,regressionY:()=>G8,ruleX:()=>E8,ruleY:()=>D8,sphere:()=>hk,spike:()=>L8,text:()=>T8,textX:()=>A8,textY:()=>M8,tickX:()=>B8,tickY:()=>O8,vector:()=>N8,vectorX:()=>F8,vectorY:()=>R8,voronoi:()=>Z8,voronoiMesh:()=>K8});var Ght=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function Ct(e,t,r={}){arguments.length===2&&!Array.isArray(t)&&(r=t,t=Ght.has(e)?null:[{}]);let n=e.startsWith("area")||e.startsWith("line")?jx:Xr;return _A(n,e,t,r)}function _A(e,t,r,n){return i=>{i.addMark(new e(t,r,n))}}function za(e,t,r){return n=>{n.addMark(new e(t,r))}}var s8=(...e)=>Ct("area",...e),a8=(...e)=>Ct("areaX",...e),c8=(...e)=>Ct("areaY",...e),l8=(...e)=>Ct("line",...e),u8=(...e)=>Ct("lineX",...e),f8=(...e)=>Ct("lineY",...e),d8=(...e)=>Ct("barX",...e),h8=(...e)=>Ct("barY",...e),p8=(...e)=>Ct("cell",...e),m8=(...e)=>Ct("cellX",...e),y8=(...e)=>Ct("cellY",...e),g8=(...e)=>Ct("rect",...e),b8=(...e)=>Ct("rectX",...e),x8=(...e)=>Ct("rectY",...e),_8=(...e)=>Ct("dot",...e),w8=(...e)=>Ct("dotX",...e),v8=(...e)=>Ct("dotY",...e),S8=(...e)=>Ct("circle",...e),I8=(...e)=>Ct("hexagon",...e),T8=(...e)=>Ct("text",...e),A8=(...e)=>Ct("textX",...e),M8=(...e)=>Ct("textY",...e),E8=(...e)=>Ct("ruleX",...e),D8=(...e)=>Ct("ruleY",...e),B8=(...e)=>Ct("tickX",...e),O8=(...e)=>Ct("tickY",...e),N8=(...e)=>Ct("vector",...e),F8=(...e)=>Ct("vectoX",...e),R8=(...e)=>Ct("vectorY",...e),L8=(...e)=>Ct("spike",...e),k8=(...e)=>Ct("image",...e),C8=(...e)=>_A(Tm,"areaX",...e),U8=(...e)=>_A(Tm,"areaY",...e),P8=(...e)=>za(Zx,...e),$8=(...e)=>za(Hx,...e),z8=(...e)=>za(Wx,...e),V8=(...e)=>za(Xx,...e),j8=(...e)=>za(qu,...e),q8=(...e)=>za(Jx,...e),Y8=(...e)=>za(Qx,...e),W8=(...e)=>Ct("hexgrid",...e),G8=(...e)=>za(t_,...e),X8=(...e)=>_A(Mm,"ruleY",...e),H8=(...e)=>za(Mm,"ruleX",...e),Z8=(...e)=>Ct("voronoi",...e),K8=(...e)=>Ct("voronoiMesh",...e),Q8=(...e)=>Ct("delaunayLink",...e),J8=(...e)=>Ct("delaunayMesh",...e),tk=(...e)=>Ct("hull",...e),ek=(...e)=>Ct("arrow",...e),rk=(...e)=>Ct("link",...e),nk=(...e)=>Ct("frame",...e),ik=(...e)=>Ct("axisX",...e),ok=(...e)=>Ct("axisY",...e),sk=(...e)=>Ct("axisFx",...e),ak=(...e)=>Ct("axisFy",...e),ck=(...e)=>Ct("gridX",...e),lk=(...e)=>Ct("gridY",...e),uk=(...e)=>Ct("gridFx",...e),fk=(...e)=>Ct("gridFy",...e),dk=(...e)=>za(Kx,...e),hk=(...e)=>Ct("sphere",...e),pk=(...e)=>Ct("graticule",...e);var OX={};Tr(OX,{highlight:()=>mk,intervalX:()=>Sk,intervalXY:()=>Tk,intervalY:()=>Ik,nearest:()=>_k,nearestX:()=>wk,nearestY:()=>vk,pan:()=>Ak,panX:()=>Mk,panY:()=>Ek,panZoom:()=>Dk,panZoomX:()=>Bk,panZoomY:()=>Ok,toggle:()=>kd,toggleColor:()=>xk,toggleX:()=>yk,toggleY:()=>gk,toggleZ:()=>bk});function bl(e,t){return r=>{let n=r.marks[r.marks.length-1];r.addInteractor(new e(n,t))}}function mk({by:e,...t}){return bl(e_,{selection:e,channels:t})}function kd({as:e,...t}){return bl(Ld,{...t,selection:e})}function yk(e){return kd({...e,channels:["x"]})}function gk(e){return kd({...e,channels:["y"]})}function bk(e){return kd({...e,channels:["z"]})}function xk(e){return kd({...e,channels:["color"]})}function _k({as:e,...t}){return bl(Rd,{...t,selection:e,pointer:"xy"})}function wk({as:e,...t}){return bl(Rd,{...t,selection:e,pointer:"x"})}function vk({as:e,...t}){return bl(Rd,{...t,selection:e,pointer:"y"})}function Sk({as:e,...t}){return bl(Yu,{...t,selection:e,channel:"x"})}function Ik({as:e,...t}){return bl(Yu,{...t,selection:e,channel:"y"})}function Tk({as:e,...t}){return bl(i_,{...t,selection:e})}function Bm(e){return bl(o_,e)}function Ak(e={}){return Bm({...e,zoom:!1})}function Mk(e={}){return Bm({...e,zoom:!1,pany:!1})}function Ek(e={}){return Bm({...e,zoom:!1,panx:!1})}function Dk(e={}){return Bm(e)}function Bk(e={}){return Bm({...e,pany:!1})}function Ok(e={}){return Bm({...e,panx:!1})}var NX={};Tr(NX,{colorLegend:()=>Fk,opacityLegend:()=>Rk,symbolLegend:()=>Lk});function Nk(e,t={}){if(t.for){let{for:r,...n}=t,i=new Dm(e,n),o=typeof r,s=a=>a.addLegend(i,!1);return o==="string"?cF(this,r,s):r.value&&s(r.value),i.element}else return r=>r.addLegend(new Dm(e,t))}function Fk(e){return Nk.call(this,"color",e)}function Rk(e){return Nk.call(this,"opacity",e)}function Lk(e){return Nk.call(this,"symbol",e)}function FX(...e){let t=new zx;return e.flat().forEach(r=>r(t)),u_(this,...t.marks),t.update(),t.element}function Xht({coordinator:e=mo(),namedPlots:t=new f_,extensions:r=null,...n}={}){return{...kk,...r,context:{coordinator:e,namedPlots:t,...n}}}export{eg as Coordinator,sa as Fixed,li as MosaicClient,Rl as Param,bt as Query,lc as Selection,ae as agg,wF as align,bi as and,s8 as area,a8 as areaX,c8 as areaY,fh as argmax,uh as argmin,pE as arrayAgg,ek as arrow,vF as aspectRatio,EX as attributeDirectives,Yy as avg,SF as axis,sk as axisFx,ak as axisFy,ik as axisX,ok as axisY,d8 as barX,h8 as barY,gA as bin,Gy as cast,dh as castDouble,mE as castInteger,p8 as cell,m8 as cellX,y8 as cellY,Hy as centroid,_E as centroidX,wE as centroidY,S8 as circle,u4 as colorBase,QL as colorClamp,d4 as colorConstant,ZL as colorDomain,f4 as colorExponent,r4 as colorInterpolate,o4 as colorLabel,Fk as colorLegend,JL as colorN,t4 as colorNice,s4 as colorPercent,n4 as colorPivot,KL as colorRange,a4 as colorReverse,HL as colorScale,e4 as colorScheme,i4 as colorSymmetric,l4 as colorTickFormat,c4 as colorZero,Ol as column,u_ as connect,z8 as contour,mo as coordinator,rE as corr,Vn as count,iE as covarPop,nE as covariance,Fl as create,Xht as createAPIContext,CM as cume_dist,xE as dateDay,gE as dateMonth,bE as dateMonthDay,Q8 as delaunayLink,J8 as delaunayMesh,$8 as denseLine,LM as dense_rank,P8 as density,C8 as densityX,U8 as densityY,_8 as dot,w8 as dotX,v8 as dotY,JM as entropy,TM as eq,X8 as errorbarX,H8 as errorbarY,HR as facetGrid,ZR as facetLabel,qR as facetMargin,WR as facetMarginBottom,GR as facetMarginLeft,XR as facetMarginRight,YR as facetMarginTop,fE as first,zM as first_value,nk as frame,DX as from,nL as fxAlign,wL as fxAriaDescription,_L as fxAriaLabel,aL as fxAxis,KR as fxDomain,xL as fxFontVariant,pL as fxGrid,JR as fxInset,tL as fxInsetLeft,eL as fxInsetRight,yL as fxLabel,gL as fxLabelAnchor,bL as fxLabelOffset,mL as fxLine,iL as fxPadding,oL as fxPaddingInner,sL as fxPaddingOuter,QR as fxRange,vL as fxReverse,rL as fxRound,dL as fxTickFormat,fL as fxTickPadding,hL as fxTickRotate,lL as fxTickSize,uL as fxTickSpacing,cL as fxTicks,DL as fyAlign,GL as fyAriaDescription,WL as fyAriaLabel,FL as fyAxis,SL as fyDomain,YL as fyFontVariant,$L as fyGrid,TL as fyInset,ML as fyInsetBottom,AL as fyInsetTop,VL as fyLabel,jL as fyLabelAnchor,qL as fyLabelOffset,zL as fyLine,BL as fyPadding,OL as fyPaddingInner,NL as fyPaddingOuter,IL as fyRange,XL as fyReverse,EL as fyRound,UL as fyTickFormat,CL as fyTickPadding,PL as fyTickRotate,LL as fyTickSize,kL as fyTickSpacing,RL as fyTicks,dk as geo,Xy as geojson,pk as graticule,TF as grid,uk as gridFx,fk as gridFy,ck as gridX,lk as gridY,jy as gt,AM as gte,vX as hconcat,V8 as heatmap,yF as height,I8 as hexagon,Y8 as hexbin,W8 as hexgrid,mk as highlight,TX as hspace,tk as hull,k8 as image,IF as inset,OX as interactorDirectives,Sk as intervalX,Tk as intervalXY,Ik as intervalY,Br as isBetween,MM as isDistinct,EM as isNotBetween,lh as isNotDistinct,sc as isNotNull,pf as isNull,QM as kurtosis,AF as label,PM as lag,dE as last,VM as last_value,$M as lead,NX as legendDirectives,W4 as lengthBase,V4 as lengthClamp,X4 as lengthConstant,$4 as lengthDomain,G4 as lengthExponent,j4 as lengthNice,q4 as lengthPercent,z4 as lengthRange,P4 as lengthScale,Y4 as lengthZero,l8 as line,u8 as lineX,f8 as lineY,rk as link,df as literal,TE as loadCSV,SE as loadExtension,AE as loadJSON,DE as loadObjects,ME as loadParquet,EE as loadSpatial,ac as lt,cc as lte,YM as mad,dF as margin,_F as marginBottom,gF as marginLeft,bF as marginRight,xF as marginTop,fF as margins,BX as markDirectives,ho as max,GM as median,yX as menu,po as min,HM as mode,lF as name,aF as namedPlots,_k as nearest,wk as nearestX,vk as nearestY,mf as neq,IM as not,jM as nth_value,UM as ntile,S4 as opacityBase,y4 as opacityClamp,T4 as opacityConstant,p4 as opacityDomain,I4 as opacityExponent,b4 as opacityLabel,Rk as opacityLegend,g4 as opacityNice,x4 as opacityPercent,m4 as opacityRange,_4 as opacityReverse,h4 as opacityScale,v4 as opacityTickFormat,w4 as opacityZero,hf as or,MF as padding,Ak as pan,Mk as panX,Ek as panY,Dk as panZoom,Bk as panZoomX,Ok as panZoomY,kM as percent_rank,FX as plot,WM as product,o8 as projectionClip,J4 as projectionDomain,t8 as projectionInset,i8 as projectionInsetBottom,e8 as projectionInsetLeft,r8 as projectionInsetRight,n8 as projectionInsetTop,Z4 as projectionParallels,K4 as projectionPrecision,Q4 as projectionRotate,H4 as projectionType,XM as quantile,k4 as rBase,N4 as rClamp,U4 as rConstant,B4 as rDomain,C4 as rExponent,F4 as rNice,R4 as rPercent,O4 as rRange,D4 as rScale,L4 as rZero,RM as rank,j8 as raster,q8 as rasterTile,g8 as rect,b8 as rectX,x8 as rectY,G8 as regressionY,cF as requestNamedPlot,fU as restConnector,FM as row_number,E8 as ruleX,D8 as ruleY,gX as search,KM as skewness,bX as slider,L1 as socketConnector,hk as sphere,L8 as spike,W as sql,Wy as stddev,eE as stddevPop,hE as stringAgg,pF as style,Li as sum,M4 as symbolDomain,Lk as symbolLegend,E4 as symbolRange,A4 as symbolScale,xX as table,T8 as text,A8 as textX,M8 as textY,B8 as tickX,O8 as tickY,kd as toggle,xk as toggleColor,yk as toggleX,gk as toggleY,bk as toggleZ,tE as varPop,ZM as variance,wX as vconcat,N8 as vector,F8 as vectorX,R8 as vectorY,Z8 as voronoi,K8 as voronoiMesh,IX as vspace,a7 as wasmConnector,mF as width,CF as xAlign,rR as xAriaDescription,eR as xAriaLabel,zF as xAxis,sR as xBase,LF as xClamp,cR as xConstant,DF as xDomain,aR as xExponent,tR as xFontVariant,XF as xGrid,NF as xInset,FF as xInsetLeft,RF as xInsetRight,ZF as xLabel,KF as xLabelAnchor,QF as xLabelArrow,JF as xLabelOffset,HF as xLine,OF as xNice,UF as xPadding,PF as xPaddingInner,$F as xPaddingOuter,nR as xPercent,BF as xRange,iR as xReverse,kF as xRound,EF as xScale,WF as xTickFormat,YF as xTickPadding,GF as xTickRotate,jF as xTickSize,qF as xTickSpacing,VF as xTicks,oR as xZero,hF as xyDomain,bR as yAlign,CR as yAriaDescription,kR as yAriaLabel,vR as yAxis,zR as yBase,yR as yClamp,jR as yConstant,uR as yDomain,VR as yExponent,LR as yFontVariant,DR as yGrid,hR as yInset,mR as yInsetBottom,pR as yInsetTop,OR as yLabel,NR as yLabelAnchor,FR as yLabelArrow,RR as yLabelOffset,BR as yLine,dR as yNice,xR as yPadding,_R as yPaddingInner,wR as yPaddingOuter,UR as yPercent,fR as yRange,PR as yReverse,gR as yRound,lR as yScale,MR as yTickFormat,AR as yTickPadding,ER as yTickRotate,IR as yTickSize,TR as yTickSpacing,SR as yTicks,$R as yZero};
69
+ }`)).call(Ud,n);for(let C of l){let{channels:P,values:$,facets:U}=m.get(C);if(p===void 0||C.facet==="super"){let H=null;if(U&&(H=U[0],H=C.filter(H,P,$),H.length===0))continue;let nt=C.render(H,x,$,_,T);if(nt==null)continue;E.appendChild(nt)}else{let H;for(let nt of p){if(!(C.facetAnchor?.(p,D,nt)??!nt.empty))continue;let ot=null;if(U){let G=f.has(C);if(ot=U[G?nt.i:0],ot=C.filter(ot,P,$),ot.length===0)continue;!G&&ot===U[0]&&(ot=va(ot)),ot.fx=nt.x,ot.fy=nt.y,ot.fi=nt.i}let at=C.render(ot,x,$,v,T);if(at!=null){(H??=jt(E).append("g")).append(()=>at).datum(nt);for(let G of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(G)&&(H.attr(G,at.getAttribute(G)),at.removeAttribute(G))}}H?.selectChildren().attr("transform",k)}}let N=xU(y,T,e),{figure:L=r!=null||i!=null||o!=null||N.length>0}=e;L&&(O=A.createElement("figure"),O.className=`${c}-figure`,O.style.maxWidth="initial",r!=null&&O.append(LU(A,r,"h2")),i!=null&&O.append(LU(A,i,"h3")),O.append(...N,E),o!=null&&O.append(qrt(A,o)),"value"in E&&(O.value=E.value,delete E.value)),O.scale=o$(x.scales),O.legend=yU(y,T,e);let B=C9();return B>0&&jt(E).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${B.toLocaleString("en-US")} warning${B===1?"":"s"}. Please check the console.`),O}function LU(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function qrt(e,t){let n=e.createElement("figcaption");return n.append(t),n}function FU(e){return e.flat(1/0).filter(t=>t!=null).map(Yrt)}function Yrt(e){return typeof e.render=="function"?e:new x6(e)}var x6=class extends xt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function b6(e,t){for(let n in e)PU(e[n],t);return e}function PU(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c==null?NaN:c*100:d3(s,i)}=t[n]??{};a!=null&&(e.value=Wt(e.value,a),e.transform=!1)}function Grt(e){for(let t in e)M3(t,e[t])}function n0(e,t,n,r=zP){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!y$(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=x$(s);c&&g6(e,"x",u),l&&g6(e,"y",f)}}}else g6(e,a,s)}return e}function g6(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function Wrt(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=wa(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Ld(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Ld(i,{value:r,scale:"fy"})),b6(o,t);let s=Mv(i,o);return{channels:o,groups:s,data:e.data}}function kU(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=wa(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=Ld(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Ld(c,{value:i,scale:"fy"})),b6(l,n),{channels:l,groups:Mv(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&Fc(wa(e.data))===Fc(a)&&Hn(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function Xrt(e,t={}){return xe({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function Hrt(e){let t=[];for(let n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?Yc:/^y$/i.test(i)?Na:qc,r=i(Xrt(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Na?"left":"bottom");let s=i2(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function Qrt(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:x=g===null?null:d}=s,fy:{axis:b=f,grid:w=b===null?null:d}=a}=n;(r||!Jo(i)&&!CU("x",e))&&(h=p=null),(r||!Jo(o)&&!CU("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=w=null),h===void 0&&(h=!a2(e,"x")),m===void 0&&(m=!a2(e,"y")),g===void 0&&(g=!a2(e,"fx")),b===void 0&&(b=!a2(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),g===!0&&(g=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let v=[];return s2(v,w,Hv,a),o2(v,b,Gv,"right","left",u,a),s2(v,x,Zv,s),o2(v,g,Wv,"top","bottom",u,s),s2(v,y,Xv,o),o2(v,m,Wy,"left","right",n,o),s2(v,p,Qv,i),o2(v,h,Xy,"bottom","top",n,i),v}function o2(e,t,n,r,i,o,s){if(!t)return;let a=Zrt(t);s=Krt(a?r:t,o,s);let{line:c}=s;(n===Wy||n===Xy)&&c&&!Ia(c)&&e.push(Qd(Jrt(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function s2(e,t,n,r){!t||Ia(t)||e.push(n(tit(t,r)))}function Zrt(e){return/^\s*both\s*$/i.test(e)}function Krt(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function Jrt(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function tit(e,{stroke:t=Cc(e)?e:void 0,ticks:n=eit(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function eit(e){switch(typeof e){case"number":return!0;case"string":return!Cc(e)}return gr(e)||typeof e?.range=="function"}function a2(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function CU(e,t){for(let n of t)for(let r in n.channels){let{scale:i}=n.channels[r];if(i===e||i==="projection")return!0}return!1}function nit(e,t){for(let n in e){let r=e[n],i=t[n];r.label===void 0&&i&&(r.label=i.label)}return e}function rit({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Tv(n),l=e&&BU(e),u=t&&BU(t);return{marginTop:t?u[0]:r,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function BU(e){let t=e.domain();if(t.length===0)return[0,e.bandwidth()];let n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var iit=new Map([["basis",NM],["basis-closed",DM],["basis-open",RM],["bundle",LM],["bump-x",TM],["bump-y",EM],["cardinal",FM],["cardinal-closed",kM],["cardinal-open",CM],["catmull-rom",BM],["catmull-rom-closed",PM],["catmull-rom-open",$M],["linear",ya],["linear-closed",UM],["monotone-x",jM],["monotone-y",VM],["natural",qM],["step",YM],["step-after",WM],["step-before",GM]]);function r0(e=ya,t){if(typeof e=="function")return e;let n=iit.get(`${e}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in n)return n.beta(t);if("tension"in n)return n.tension(t);if("alpha"in n)return n.alpha(t)}return n}function c2(e=Zc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Zc:r0(e,t)}function Zc(e){return ya(e)}function ls(e={y:"count"},t={}){[e,t]=_6(e,t);let{x:n,y:r}=t;return w6(l2(n,t,X),null,null,r,e,Iu(t))}function us(e={x:"count"},t={}){[e,t]=_6(e,t);let{x:n,y:r}=t;return w6(null,l2(r,t,X),n,null,e,Tu(t))}function Ra(e={fill:"count"},t={}){[e,t]=_6(e,t);let{x:n,y:r}=oit(t);return w6(n,r,null,null,e,Iu(Tu(t)))}function zU(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=bv}=n,i={filter:null};return n[t]!=null&&(i[t]=r),n[`${t}1`]!=null&&(i[`${t}1`]=r),n[`${t}2`]!=null&&(i[`${t}2`]=r),e(i,n)}function Kd(e={}){return zU(ls,"y",co(e,"x"))}function Jd(e={}){return zU(us,"x",co(e,"y"))}function w6(e,t,n,r,{data:i=xv,filter:o=ky,sort:s,reverse:a,...c}={},l={}){e=$U(e),t=$U(t),c=sit(c,l),i=qU(i,X),s=s==null?void 0:jU("sort",s,l),o=o==null?void 0:VU("filter",o,l),n!=null&&is(c,"x","x1","x2")&&(n=null),r!=null&&is(c,"y","y1","y2")&&(r=null);let[u,f]=Bn(e),[d,h]=Bn(e),[p,m]=Bn(t),[y,g]=Bn(t),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,v]=Bn(x),{x:_,y:T,z:A,fill:E,stroke:O,x1:I,x2:D,y1:k,y2:S,domain:M,cumulative:N,thresholds:L,interval:B,...C}=l,[P,$]=Bn(A),[U]=Fe(E),[H]=Fe(O),[nt,ot]=Bn(U),[at,G]=Bn(H);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:nt||E},..."stroke"in l&&{stroke:at||O},...rn(C,(st,V,Q)=>{let rt=bu(gt(st,x),Q?.[b]),z=gt(st,A),Ct=gt(st,U),ht=gt(st,H),Xt=Py(c,{z,fill:Ct,stroke:ht}),Zt=[],tt=[],ce=rt&&v([]),Fr=z&&$([]),ho=Ct&&ot([]),jV=ht&&G([]),WR=e&&f([]),VV=e&&h([]),XR=t&&m([]),qV=t&&g([]),YV=lit(e,t,st),GV=0;for(let Vu of c)Vu.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let Vu of V){let HR=[];for(let qu of c)qu.scope("facet",Vu);s&&s.scope("facet",Vu),o&&o.scope("facet",Vu);for(let[qu,WV]of rs(Vu,Xt))for(let[XV,ag]of rs(WV,rt))for(let[po,gs]of YV(ag))if(Xt&&(gs.z=qu),!(o&&!o.reduce(po,gs))){HR.push(GV++),tt.push(i.reduceIndex(po,st,gs)),rt&&ce.push(XV),z&&Fr.push(Xt===z?qu:z[(po.length>0?po:ag)[0]]),Ct&&ho.push(Xt===Ct?qu:Ct[(po.length>0?po:ag)[0]]),ht&&jV.push(Xt===ht?qu:ht[(po.length>0?po:ag)[0]]),WR&&(WR.push(gs.x1),VV.push(gs.x2)),XR&&(XR.push(gs.y1),qV.push(gs.y2));for(let HV of c)HV.reduce(po,gs);s&&s.reduce(po,gs)}Zt.push(HR)}return T3(Zt,s,a),{data:tt,facets:Zt}}),...!is(c,"x")&&(u?{x1:u,x2:d,x:Md(u,d)}:{x:_,x1:I,x2:D}),...!is(c,"y")&&(p?{y1:p,y2:y,y:Md(p,y)}:{y:T,y1:k,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:st,output:V})=>[st,V]))}}function _6({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function l2(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...Di(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=v6(e.thresholds,e.interval),e}function oit(e){let{x:t,y:n}=e;return t=l2(t,e),n=l2(n,e),[t.value,n.value]=je(t.value,n.value),{x:t,y:n}}function $U(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ne,thresholds:i}=e,o=s=>{let a=gt(s,t),c;if(ke(a)||cit(i)){a=Wt(a,a3,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!kc(i)?i(a,u,f):i;typeof d=="number"&&(d=ny(u,f,d)),kc(d)&&(r===ne&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=nn(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!kc(i)?i(a,u,f):i;if(typeof d=="number")if(r===ne){let h=Ks(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)/h}else d=[u];else d=[u]}else d=Ln(u,f,d);else kc(d)&&(r===ne&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?fit:n>0?uit:S6)(l,c,a),l};return o.label=Pn(t),o}function v6(e,t,n=UU){if(e===void 0)return t===void 0?n:es(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return t1;case"scott":return Zp;case"sturges":return dc;case"auto":return UU}return gu(e)}return e}function sit(e,t){return S3(e,t,jU)}function jU(e,t,n){return yv(e,t,n,VU)}function VU(e,t,n){return gv(e,t,n,qU)}function qU(e,t){return Rd(e,t,ait)}function ait(e){switch(`${e}`.toLowerCase()){case"x":return dit;case"x1":return pit;case"x2":return mit;case"y":return hit;case"y1":return yit;case"y2":return git;case"z":return E3}throw new Error(`invalid bin reduce: ${e}`)}function UU(e,t,n){return Math.min(200,Zp(e,t,n))}function cit(e){return qP(e)||gr(e)&&ke(e)}function lit(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:n,x1:c,y1:d,x2:l,y2:h}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function S6(e,t,n){return t=nn(t),r=>{let i=e.map(()=>[]);for(let o of r)i[Qs(t,n[o])-1]?.push(o);return i}}function uit(e,t,n){let r=S6(e,t,n);return i=>{let o=r(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function fit(e,t,n){let r=S6(e,t,n);return i=>{let o=r(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function YU(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var dit={reduceIndex(e,t,{x1:n,x2:r}){return YU(n,r)}},hit={reduceIndex(e,t,{y1:n,y2:r}){return YU(n,r)}},pit={reduceIndex(e,t,{x1:n}){return n}},mit={reduceIndex(e,t,{x2:n}){return n}},yit={reduceIndex(e,t,{y1:n}){return n}},git={reduceIndex(e,t,{y2:n}){return n}};var xit={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Du=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:Xn(n),optional:!0}},n,xit),this.z=a,this.curve=r0(c,l)}filter(t){return t}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n,0,0).call(u=>u.selectAll().data(Fv(t,[s,a,c,l],this,r)).enter().append("path").call(It,this).call(Su,this,r).attr("d",yd().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function i0(e,t){return t===void 0?La(e,{x:xu,y:Rc}):new Du(e,t)}function Kc(e,t){let{y:n=ye,...r}=Jd(t);return new Du(e,Hc(Wc({...r,y1:n,y2:void 0})))}function La(e,t){let{x:n=ye,...r}=Kd(t);return new Du(e,Qc(Xc({...r,x1:n,x2:void 0})))}var bit={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},o0=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,curve:a,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,bit),this.curve=c2(a,c),lo(this,n)}project(t,n,r){this.curve!==Zc&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(It,this).attr("d",u===Zc&&o.projection?wit(o.projection,s,a,c,l):d=>{let h=ur(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Yt,this,r).call(Da,this,r,o)).node()}};function wit(e,t,n,r,i){let o=mn(e);return t=nn(t),n=nn(n),r=nn(r),i=nn(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function u2(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=s0(t,n,r),[o,s]=s0(i,o,s),new o0(e,{...a,x1:n,x2:r,y1:o,y2:s})}function s0(e,t,n){if(e===void 0){if(t===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[t]}else{if(t===void 0)return n===void 0?[e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}var _it={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},a0=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,_it),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=vit(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:y}=this,g=u?w=>u[w]:Ce(f===void 0?1:f),x=h*zd/2,b=p/1.5;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(It,this).attr("d",v=>{let _=s[v],T=a[v],A=c[v],E=l[v],O=Math.hypot(A-_,E-T);if(O<=m+y)return null;let I=Math.atan2(E-T,A-_),D=Math.min(b*g(v),O/3),k=this.sweep(_,T,A,E)*d*zd,S=Math.hypot(O/Math.tan(k),O)/2;if(m||y)if(S<1e5){let nt=Math.sign(k),[ot,at]=Sit([_,T],[A,E],S,nt);if(m&&([_,T]=GU([ot,at,S],[_,T,m],-nt*Math.sign(m))),y){let[G,st]=GU([ot,at,S],[A,E,y],nt*Math.sign(y));I+=Math.atan2(st-at,G-ot)-Math.atan2(E-at,A-ot),A=G,E=st}}else{let nt=A-_,ot=E-T,at=Math.hypot(nt,ot);m&&(_+=nt/at*m,T+=ot/at*m),y&&(A-=nt/at*y,E-=ot/at*y)}let M=I+k,N=M+x,L=M-x,B=A-D*Math.cos(N),C=E-D*Math.sin(N),P=A-D*Math.cos(L),$=E-D*Math.sin(L),U=S<1e5?`A${S},${S} 0,0,${k>0?1:0} `:"L",H=D?`M${B},${C}L${A},${E}L${P},${$}`:"";return`M${_},${T}${U}${A},${E}${H}`}).call(Yt,this,r)).node()}};function vit(e=1){if(typeof e=="number")return Ce(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(un(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Nt(t,r);case"-x":return(t,n,r)=>rr(t,r);case"+y":return(t,n,r,i)=>Nt(n,i);case"-y":return(t,n,r,i)=>rr(n,i)}}function Sit([e,t],[n,r],i,o){let s=n-e,a=r-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+n)/2-a*l,(t+r)/2+s*l]}function GU([e,t,n],[r,i,o],s){let a=r-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+n*n)/(2*l),f=s*Math.sqrt(n*n-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function WU(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=s0(t,n,r),[o,s]=s0(i,o,s),new a0(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Iit={ariaLabel:"bar"},th=class extends xt{constructor(t,n,r={},i=Iit){super(t,n,r,i),Qy(this,r),Zy(this,r)}render(t,n,r,i,o){let{rx:s,ry:a,rx1y1:c,rx1y2:l,rx2y1:u,rx2y2:f}=this,d=this._x(n,r,i),h=this._y(n,r,i),p=this._width(n,r,i),m=this._height(n,r,i);return ct("svg:g",o).call(Rt,this,i,o).call(this._transform,this,n).call(y=>y.selectAll().data(t).enter().call(c||l||u||f?g=>g.append("path").call(It,this).call(Ky,d,h,XU(d,p),XU(h,m),this).call(Yt,this,r):g=>g.append("rect").call(It,this).attr("x",d).attr("width",p).attr("y",h).attr("height",m).call(ft,"rx",s).call(ft,"ry",a).call(Yt,this,r))).node()}_x(t,{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){let{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}};function XU(e,t){return typeof e=="function"&&typeof t=="function"?n=>e(n)+t(n):typeof e=="function"?n=>e(n)+t:typeof t=="function"?n=>e+t(n):e+t}var Ru=class extends th{constructor(t,n={},r){let{x1:i,x2:o,y:s}=n;super(t,{x1:{value:i,scale:"x"},x2:{value:o,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},n,r)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return ri(t)?i+o:s=>Math.min(n[s],r[s])+o}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return ri(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Lu=class extends th{constructor(t,n={},r){let{x:i,y1:o,y2:s}=n;super(t,{y1:{value:o,scale:"y"},y2:{value:s,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},n,r)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return ri(t)?i+o:s=>Math.min(n[s],r[s])+o}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return ri(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function fs(e,t={}){return _a(t)||(t={...t,y:ye,x2:X}),new Ru(e,Hc(jd(Wc(t))))}function ds(e,t={}){return _a(t)||(t={...t,x:ye,y2:X}),new Lu(e,Qc(Vd(Xc(t))))}var Tit={ariaLabel:"cell"},Fu=class extends th{constructor(t,{x:n,y:r,...i}={}){super(t,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,Tit)}_transform(t,n){t.call(Et,n,{},0,0)}};function Jc(e,{x:t,y:n,...r}={}){return[t,n]=je(t,n),new Fu(e,{...r,x:t,y:n})}function HU(e,{x:t=ye,fill:n,stroke:r,...i}={}){return n===void 0&&Fe(r)[0]===void 0&&(n=X),new Fu(e,{...i,x:t,fill:n,stroke:r})}function QU(e,{y:t=ye,fill:n,stroke:r,...i}={}){return n===void 0&&Fe(r)[0]===void 0&&(n=X),new Fu(e,{...i,y:t,fill:n,stroke:r})}var Eit={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function c0(e){return e.sort===void 0&&e.reverse===void 0?pv({channel:"-r"},e):e}var ku=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=ga,frameAnchor:c}=n,[l,u]=ae(s,0),[f,d]=i9(a),[h,p]=ae(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:mr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},c0(n),Eit),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=ns(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:x}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:m}=this,[y,g]=vn(this,i),x=m===ga,b=u?void 0:h*h*Math.PI;return Ac(h)&&(t=[]),ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(x?"circle":"path").call(It,this).call(x?v=>{v.attr("cx",c?_=>c[_]:y).attr("cy",l?_=>l[_]:g).attr("r",u?_=>u[_]:h)}:v=>{v.attr("transform",uo`translate(${c?_=>c[_]:y},${l?_=>l[_]:g})${f?_=>` rotate(${f[_]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?_=>{let T=ur();return d[_].draw(T,u[_]*u[_]*Math.PI),T}:u?_=>{let T=ur();return m.draw(T,u[_]*u[_]*Math.PI),T}:d?_=>{let T=ur();return d[_].draw(T,b),T}:(()=>{let _=ur();return m.draw(_,b),_})())}).call(Yt,this,r)).node()}};function Li(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new ku(e,{...r,x:t,y:n})}function ZU(e,{x:t=X,...n}={}){return new ku(e,Pv({...n,x:t}))}function KU(e,{y:t=X,...n}={}){return new ku(e,Bv({...n,y:t}))}function JU(e,t){return Li(e,{...t,symbol:"circle"})}function tz(e,t){return Li(e,{...t,symbol:"hexagon"})}var Ait={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Cu=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Xn(n),optional:!0}},n,Ait),this.z=o,this.curve=c2(s,a),lo(this,n)}filter(t){return t}project(t,n,r){this.curve!==Zc&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(l=>l.selectAll().data(Fv(t,[s,a],this,r)).enter().append("path").call(It,this).call(Su,this,r).call(N$,this,r,o).attr("d",c===Zc&&o.projection?Mit(o.projection,s,a):fy().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function Mit(e,t,n){let r=mn(e);return t=nn(t),n=nn(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function Bu(e,{x:t,y:n,...r}={}){return[t,n]=je(t,n),new Cu(e,{...r,x:t,y:n})}function tl(e,{x:t=X,y:n=ye,...r}={}){return new Cu(e,Jd({...r,x:t,y:n}))}function el(e,{x:t=ye,y:n=X,...r}={}){return new Cu(e,Kd({...r,x:t,y:n}))}function T6(e,t){t=Oit(t);let{x:n,y:r,color:i,size:o}=t,s=f2(e,n),a=f2(e,r),c=f2(e,i),l=f2(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:y,reduce:g,zero:x,...b},color:{value:w,color:v,reduce:_},size:{value:T,reduce:A},mark:E}=t;if(h===void 0&&(h=g==null&&d==null&&T==null&&y!=null?"count":null),g===void 0&&(g=h==null&&y==null&&T==null&&d!=null?"count":null),A===void 0&&T==null&&_==null&&h==null&&g==null&&(d==null||De(s))&&(y==null||De(a))&&(A="count"),p===void 0&&(p=d2(h)?!0:void 0),x===void 0&&(x=d2(g)?!0:void 0),d==null&&y==null)throw new Error("must specify x or y");if(h!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&d==null)throw new Error("reducing y requires x");E===void 0&&(E=T!=null||A!=null?"dot":d2(h)||d2(g)||_!=null?"bar":d!=null&&y!=null?De(s)||De(a)||h==null&&g==null&&!l0(s)&&!l0(a)?"dot":"line":d!=null||y!=null?"rule":null);let O,I,D;switch(E){case"dot":D=Li,I="stroke";break;case"line":D=s&&a||h!=null||g!=null?x||g!=null||s&&l0(s)?el:p||h!=null||a&&l0(a)?tl:Bu:s?tl:el,I="stroke",nz(c)&&(O=null);break;case"area":D=!(x||g!=null)&&(p||h!=null||a&&l0(a))?Kc:La,I="fill",nz(c)&&(O=null);break;case"rule":D=s?ii:oi,I="stroke";break;case"bar":D=h!=null?De(a)?ez(h)&&s&&De(s)?Jc:fs:Xd:g!=null?De(s)?ez(g)&&a&&De(a)?Jc:ds:Hd:_!=null||A!=null?s&&De(s)&&a&&De(a)?Jc:s&&De(s)?ds:a&&De(a)?fs:Jy:s&&Sa(s)&&!(a&&Sa(a))?fs:a&&Sa(a)&&!(s&&Sa(s))?ds:Jc,I="fill";break;default:throw new Error(`invalid mark: ${E}`)}let k={fx:u,fy:f,x:s??void 0,y:a??void 0,[I]:c??v,z:O,r:l??void 0,tip:!0},S,M={[I]:_??void 0,r:A??void 0};if(h!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(M.y=g,S=De(s)?Bc:ls):h!=null?(M.x=h,S=De(a)?Pc:us):(_!=null||A!=null)&&(s&&a?S=De(s)&&De(a)?By:De(s)?us:De(a)?ls:Ra:s?S=De(s)?Bc:ls:a&&(S=De(a)?Pc:us)),(S===Ra||S===ls)&&(k.x={value:s,...m}),(S===Ra||S===us)&&(k.y={value:a,...b}),p===void 0&&(p=s&&!(S===Ra||S===ls)&&(D===fs||D===Kc||D===Xd||D===oi)),x===void 0&&(x=a&&!(S===Ra||S===us)&&(D===ds||D===La||D===Hd||D===ii)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!x,...b},color:{value:w??null,reduce:_??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:A??null},mark:E,markImpl:rz[D],markOptions:k,transformImpl:rz[S],transformOptions:M,colorMode:I}}function iz(e,t){let n=T6(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=I6[n.markImpl],f=I6[n.transformImpl],d=r!=null||i!=null?Qd({strokeOpacity:.1}):null,h=[o?ii([0]):null,s?oi([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?on(d,h,p):on(d,p,h)}function l0(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Nt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function Oit({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return ei(e)||(e=eh(e)),ei(t)||(t=eh(t)),ei(n)||(n=Cc(n)?{color:n}:eh(n)),ei(r)||(r=eh(r)),ei(i)&&({value:i}=eh(i)),ei(o)&&({value:o}=eh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function f2(e,t){let n=gt(e,t.value);return n&&(n.label=Pn(t.value)),n}function eh(e){return Nit(e)?{reduce:e}:{value:e}}function d2(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function ez(e){return/^(?:first|last|mode)$/i.test(e)}function Nit(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&bn(e)||/^p\d{2}$/i.test(e))return!0;switch(`${e}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}function nz(e){return e?new or(e).size>e.length>>1:!1}var I6={dot:Li,line:Bu,lineX:tl,lineY:el,areaX:Kc,areaY:La,ruleX:ii,ruleY:oi,barX:fs,barY:ds,rect:Jy,rectX:Xd,rectY:Hd,cell:Jc,bin:Ra,binX:ls,binY:us,group:By,groupX:Bc,groupY:Pc},rz=Object.fromEntries(Object.entries(I6).map(([e,t])=>[t,e]));function nh(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=X});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),Lr(o,t)}function rh(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=X});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),Lr(o,t)}function Lr(e={},t={}){let n=Xn(t),r=Object.entries(e).map(([i,o])=>{let s=cv(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=wn(s);return{key:i,input:s,output:a,setOutput:c,map:Dit(o)}});return{...rn(t,(i,o)=>{let s=gt(i,n),a=r.map(({input:l})=>gt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?Rn(l,f=>s[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function Dit(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&bn(e))return Rit(e);if(typeof e=="function")return E6(Ad(e));switch(`${e}`.toLowerCase()){case"cumsum":return Fit;case"rank":return E6((t,n)=>Kp(t,r=>n[r]));case"quantile":return E6((t,n)=>Lit(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function Rit(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Lit(e,t){let n=Lo(e,t)-1;return Kp(e,t).map(r=>r/n)}function E6(e){return{mapIndex(t,n,r){let i=e(t,n);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)r[t[o]]=i[o]}}}var Fit={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function oz(e={},t){return arguments.length===1&&(t=e),nh(ih(e),t)}function sz(e={},t){return arguments.length===1&&(t=e),rh(ih(e),t)}function ih(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:n,shift:r,anchor:i,strict:o}=e;if(i===void 0&&r!==void 0&&(i=Cit(r),Hn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return Bit(n)(t,kit(i,t),o)}function kit(e="middle",t){switch(`${e}`.toLowerCase()){case"middle":return t-1>>1;case"start":return 0;case"end":return t-1}throw new Error(`invalid anchor: ${e}`)}function Cit(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function Bit(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return h2(Ed(e));switch(e.toLowerCase()){case"deviation":return h2(wi);case"max":return p2((t,n)=>Qt(t,r=>n[r]));case"mean":return Pit;case"median":return h2(ro);case"min":return p2((t,n)=>ue(t,r=>n[r]));case"mode":return p2((t,n)=>kf(t,r=>n[r]));case"sum":return az;case"variance":return h2(fc);case"difference":return zit;case"ratio":return jit;case"first":return Vit;case"last":return qit}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return p2(Ad(e))}function h2(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+n]]=c===0?e(va(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-n;c<0;++c)s[i[c+n]]=e(va(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(va(i,c,c+t),a)}}}function p2(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ne(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ne(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(va(i,c,c+t),o)),a-=Ne(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(va(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(va(i,a,a+t),o)}}}function az(e,t,n){return n?{mapIndex(r,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[r[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=r.length-e+1;c<l;++c){let u=i[r[c]],f=i[r[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[r[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(r,i,o){let s=0,a=r.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[r[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[r[c+e-1]]||0,o[r[c+t]]=s,s-=+i[r[c]]||0}}}function Pit(e,t,n){if(n){let r=az(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],d=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function $it(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ne(o))return o}}function Uit(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ne(o))return o}}function cz(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(o!==null&&!isNaN(o=+o))return o}}function lz(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function zit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=lz(i,r,s,e)-cz(i,r,s,e)}}}function jit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=lz(i,r,s,e)/cz(i,r,s,e)}}}function Vit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=$it(i,r,s,e)}}}function qit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s+e-1]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=Uit(i,r,s,e)}}}var Fa={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function uz(e,{x:t=X,y:n,k:r=Fa.k,color:i=Fa.color,opacity:o=Fa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return on(oe(s)?null:Kc(e,Lr({x1:nl({k:-r,...f}),x2:nl({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),oe(c)?null:tl(e,Lr({x:nl(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function fz(e,{x:t,y:n=X,k:r=Fa.k,color:i=Fa.color,opacity:o=Fa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return on(oe(s)?null:La(e,Lr({y1:nl({k:-r,...f}),y2:nl({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),oe(c)?null:el(e,Lr({y:nl(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function nl({n:e=Fa.n,k:t=0,strict:n=Fa.strict,anchor:r=Fa.anchor}={}){return ih({k:e,reduce:i=>Js(i)+t*(wi(i)||0),strict:n,anchor:r})}var Yit={ariaLabel:"tick",fill:null,stroke:"currentColor"},m2=class extends xt{constructor(t,n,r){super(t,n,r,Yit),lo(this,r)}render(t,n,r,i,o){return ct("svg:g",o).call(Rt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(It,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Yt,this,r).call(Da,this,r,o)).node()}},u0=class extends m2{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=ee(s),this.insetBottom=ee(a)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},Be,0)}_x1(t,{x:n}){return r=>n[r]}_x2(t,{x:n}){return r=>n[r]}_y1({y:t},{y:n},{marginTop:r}){let{insetTop:i}=this;return n&&t?o=>n[o]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){let{insetBottom:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}},f0=class extends m2{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=ee(s),this.insetLeft=ee(a)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,Be)}_x1({x:t},{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n&&t?o=>n[o]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){let{insetRight:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}};function y2(e,{x:t=X,...n}={}){return new u0(e,{...n,x:t})}function g2(e,{y:t=X,...n}={}){return new f0(e,{...n,y:t})}function dz(e,{x:t=X,y:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=n!=null?Pc:Cy;return on(oi(e,f({x1:A6,x2:M6},{x:t,y:n,stroke:s,strokeOpacity:a,...u})),fs(e,f({x1:"p25",x2:"p75"},{x:t,y:n,fill:i,fillOpacity:o,...u})),y2(e,f({x:"p50"},{x:t,y:n,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),Li(e,Lr({x:pz},{x:t,y:n,z:n,r,stroke:s,strokeOpacity:a,...u})))}function hz(e,{y:t=X,x:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=n!=null?Bc:Cy;return on(ii(e,f({y1:A6,y2:M6},{x:n,y:t,stroke:s,strokeOpacity:a,...u})),ds(e,f({y1:"p25",y2:"p75"},{x:n,y:t,fill:i,fillOpacity:o,...u})),g2(e,f({y:"p50"},{x:n,y:t,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),Li(e,Lr({y:pz},{x:n,y:t,z:n,r,stroke:s,strokeOpacity:a,...u})))}function pz(e){let t=A6(e),n=M6(e);return e.map(r=>r<t||r>n?r:NaN)}function A6(e){let t=mz(e)*2.5-yz(e)*1.5;return ue(e,n=>n>=t?n:NaN)}function M6(e){let t=yz(e)*2.5-mz(e)*1.5;return Qt(e,n=>n<=t?n:NaN)}function mz(e){return sr(e,.25)}function yz(e){return sr(e,.75)}var Git={ariaLabel:"raster",stroke:null,pixelSize:1};function oh(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function gz(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var h0=class extends xt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=gz(o,"width")),s!=null&&(s=gz(s,"height")),l!=null&&(l=oh(l,"x1")),u!=null&&(u=oh(u,"y1")),f!=null&&(f=oh(f,"x2")),d!=null&&(d=oh(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=tot(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=eot(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=oh(h,"pixelSize"),this.blur=oh(p,"blur"),this.interpolate=a==null||c==null?null:Wit(m)}},p0=class extends h0{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ae(o)[0]!==void 0&&(n=x2("fillOpacity",n)),Fe(i)[0]!==void 0&&(n=x2("fill",n))}super(t,void 0,n,Git),this.imageRendering=be(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,o){let s=n[r.channels.fill?.scale]??(M=>M),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=bz(r,i,o),p=d-u,m=h-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:x=Math.round(Math.abs(m)/y)}=this,b=g*x,{fill:w,fillOpacity:v}=r,_=0;if(this.interpolate){let M=g/p,N=x/m,L=Wt(a,C=>(C-u)*M,Float64Array),B=Wt(c,C=>(C-f)*N,Float64Array);w&&(w=this.interpolate(t,g,x,L,B,w)),v&&(v=this.interpolate(t,g,x,L,B,v))}else this.data==null&&t&&(_=t.fi*b);let T=l.createElement("canvas");T.width=g,T.height=x;let A=T.getContext("2d"),E=A.createImageData(g,x),O=E.data,{r:I,g:D,b:k}=cn(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<b;++M){let N=M<<2;if(w){let L=s(w[M+_]);if(L==null){O[N+3]=0;continue}({r:I,g:D,b:k}=cn(L))}v&&(S=v[M+_]*255),O[N+0]=I,O[N+1]=D,O[N+2]=k,O[N+3]=S}return this.blur>0&&QT(E,this.blur),A.putImageData(E,0,0),ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(M=>M.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(It,this).attr("xlink:href",T.toDataURL())).node()}};function O6(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:o,...s}=n;return r===void 0&&i===void 0&&GP(t)&&(r=xu,i=Rc,o===void 0&&(o=jP)),[t,{...s,x:r,y:i,[e]:o}]}function xz(){let[e,t]=O6("fill",...arguments);return new p0(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:X})}function bz({x1:e,y1:t,x2:n,y2:r},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,n&&o==null?n[0]:s-l,r&&o==null?r[0]:a-u]}function N6({x1:e,y1:t,x2:n,y2:r},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),bz(Fd(a,i),o,s)}function x2(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return xe({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=N6(o,s,a,c),m=h-f,y=p-d,{pixelSize:g}=this,{width:x=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(y)/g)}=t,w=new Array(x*b*(i?i.length:1)),v=m/x,_=y/b,T=0;for(let A of i??[void 0])for(let E=.5;E<b;++E)for(let O=.5;O<x;++O,++T)w[T]=n(l.invert(f+O*v),u.invert(d+E*_),A);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function Wit(e){if(typeof e=="function")return e;if(e==null)return b2;switch(`${e}`.toLowerCase()){case"none":return b2;case"nearest":return y0;case"barycentric":return m0();case"random-walk":return g0()}throw new Error(`invalid interpolate: ${e}`)}function b2(e,t,n,r,i,o){let s=new Array(t*n);for(let a of e)r[a]<0||r[a]>=t||i[a]<0||i[a]>=n||(s[Math.floor(i[a])*t+Math.floor(r[a])]=o[a]);return s}function m0({random:e=ou(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=Si.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=Jit(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],y=c[h+2],g=a[2*p],x=a[2*m],b=a[2*y],w=a[2*p+1],v=a[2*m+1],_=a[2*y+1],T=Math.min(g,x,b),A=Math.max(g,x,b),E=Math.min(w,v,_),O=Math.max(w,v,_),I=(v-_)*(g-b)+(w-_)*(b-x);if(!I)continue;let D=s[t[p]],k=s[t[m]],S=s[t[y]];for(let M=Math.floor(T);M<A;++M)for(let N=Math.floor(E);N<O;++N){if(M<0||M>=n||N<0||N>=r)continue;let L=M+.5,B=N+.5,C=Math.sign(I),P=(v-_)*(L-b)+(B-_)*(b-x);if(P*C<0)continue;let $=(_-w)*(L-b)+(B-_)*(g-b);if($*C<0)continue;let U=I-(P+$);if(U*C<0)continue;let H=M+n*N;u[H]=d(D,P/I,k,$/I,S,U/I,M,N),f[H]=1}}return Xit(u,f,i,o,s,n,r,l,t,d),u}}function Xit(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,h=>n[c[h]]),r=Float64Array.from(a,h=>r[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=n.length,f=Array.from({length:u},(h,p)=>Qit(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let y=m+o*h;if(!t[y]){let g=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](g,p)){let w=Hit(n.at(b-1),r.at(b-1),n[b],r[b],g,p);e[y]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function Hit(e,t,n,r,i,o){let s=n-e,a=r-t,c=s*(n-i)+a*(r-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function d0(e,t,n,r){return e*r-n*t}function Qit(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,m=o-a,y=c-u,g=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(y,g);return(v,_)=>{let T=v-s,A=_-a,E=v-c,O=_-l;return d0(T,A,E,O)>-1e-6&&d0(T,A,d,h)*b-d0(T,A,p,m)*x>-1e-6&&d0(E,O,y,g)*x-d0(E,O,d,h)*w<=0}}function y0(e,t,n,r,i,o){let s=new o.constructor(t*n),a=Si.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function g0({random:e=ou(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Si.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let y=.5;y<i;++y,++m){let g=y,x=p;h=d=u.find(g,x,d),y===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-g,a[r[h]]-x))>t&&w<n;){let v=e(y,p,w)*2*Math.PI;g+=Math.cos(v)*b,x+=Math.sin(v)*b,h=u.find(g,x,h),++w}l[m]=c[r[h]]}}return l}}function Zit(e,t,n,r,i,o){return t*e+r*n+o*i}function Kit(e){return(t,n,r,i,o,s,a,c)=>{let l=e(a,c);return l<n?t:l<n+i?r:o}}function Jit(e,t){return Sa(e)||ke(e)?Zit:Kit(t)}function tot(e,t,n){return{transform(r){let i=r.length,o=new Float64Array(i),s=(t-e)/n,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%n*s+a;return o}}}function eot(e,t,n,r){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/r,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/n)%r*a+c;return s}}}var wz={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},x0=class extends h0{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=Lv({},i,wz);if(r===void 0){for(let a in o)if(o[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=i[a],i[a]="value"}}if(r!=null){let a={transform:c=>c.map(l=>l.value),label:Pn(r)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=x2("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=X),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},not(i),wz);let s={geometry:{value:X}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...o},s){return super.filter(t,o,s)}render(t,n,r,i,o){let{geometry:s}=r,a=mn();return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(It,this).attr("d",l=>a(s[l])).call(Yt,this,r)}).node()}};function not({thresholds:e,interval:t,...n}){return e=v6(e,t,dc),xe(n,function(r,i,o,s,a,c){let[l,u,f,d]=N6(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:y=Math.round(Math.abs(h)/m),height:g=Math.round(Math.abs(p)/m)}=this,x=y/h,b=g/p,w=o.value.value,v=[];if(this.interpolate){let{x:O,y:I}=ss(o,s,c),D=Wt(O,N=>(N-l)*x,Float64Array),k=Wt(I,N=>(N-u)*b,Float64Array),S=[o.x,o.y,o.value],M=[D,k,w];for(let N of i){let L=this.filter(N,S,M);v.push(this.interpolate(L,y,g,D,k,w))}}else if(i){let O=y*g,I=i.length;for(let D=0;D<I;++D)v.push(w.slice(D*O,D*O+O))}else v.push(w);if(this.blur>0)for(let O of v)Wp({data:O,width:y,height:g},this.blur);let _=rot(e,w,...iot(v));if(_===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=bc().size([y,g]).smooth(this.smooth),A=[],E=[];for(let O of v)E.push(qe(A.length,A.push(...Wt(_,I=>T(O,I)))));for(let{coordinates:O}of A)for(let I of O)for(let D of I)for(let k of D)k[0]=k[0]/x+l,k[1]=k[1]/b+u;return{data:A,facets:E,channels:wv(this.contourChannels,A)}})}function rot(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return ti(e);let i=Ln(...Lf(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function vz(){return new x0(...O6("value",...arguments))}function iot(e){return[ue(e,t=>ue(t,_z)),Qt(e,t=>Qt(t,_z))]}function _z(e){return isFinite(e)?e:NaN}function Tz(e,t){return D6(qc,e,t)}function Ez(e,t={}){return D6(Yc,e,t)}function Az(e,t={}){return D6(Na,e,t)}function D6(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(ii(t,Sz("x",{...s,inset:-6},n))),i!=null&&a.push(oi(t,Sz("y",{...s,inset:-6},n))),r!=null&&a.push(cs(t,Iz("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(cs(t,Iz("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return on(...a)}function Mz(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:oot(e,u)}}function oot(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function Sz(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...Mz(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function Iz(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...Mz(e,t,sot(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function sot(e,t){return xe(t,(n,r,i)=>({channels:{text:{value:$y(i,e)?.value}}}))}var aot={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},cot={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},lot={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},uot={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},fot={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},R6=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,aot),this.curve=r0(s,a),lo(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=vn(this,i),p=c?x=>c[x]:Ce(d),m=l?x=>l[x]:Ce(h),y=this;function g(x){let b=-1,w=[],v={};for(let S in r)v[S]=[];let _=[],T=[],A=[],E=[];function O(S,M){S=x[S],M=x[M],w.push(++b),_[b]=p(S),A[b]=m(S),T[b]=p(M),E[b]=m(M);for(let N in r)v[N].push(r[N][M])}let{halfedges:I,hull:D,triangles:k}=Si.from(x,p,m);for(let S=0;S<I.length;++S){let M=I[S];M>S&&O(k[S],k[M])}for(let S=0;S<D.length;++S)O(D[S],D[(S+1)%D.length]);jt(this).selectAll().data(w).enter().append("path").call(It,y).attr("d",S=>{let M=ur(),N=f(M);return N.lineStart(),N.point(_[S],A[S]),N.point(T[S],E[S]),N.lineEnd(),M}).call(Yt,y,v).call(Da,y,v,o)}return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(Rn(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},b0=class extends xt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=vn(this,i),h=c?g=>c[g]:Ce(f),p=l?g=>l[g]:Ce(d),m=this;function y(g){let x=Si.from(g,h,p);jt(this).append("path").datum(g[0]).call(It,m).attr("d",m._render(x,i)).call(Yt,m,r)}return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Rn(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},L6=class extends b0{constructor(t,n={}){super(t,n,cot),this.fill="none"}_render(t){return t.render()}},F6=class extends b0{constructor(t,n={}){super(t,n,lot,Xn)}_render(t){return t.renderHull()}},k6=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},xe(n,function(s,a,c,l,u,f){let{x:d,y:h,z:p}=c;({x:d,y:h}=ss(c,l,f)),p=p?.value;let m=new Array((d??h).length).fill(null),[y,g]=vn(this,u),x=d?w=>d[w]:Ce(y),b=h?w=>h[w]:Ce(g);for(let w of a){d&&(w=w.filter(v=>Ne(x(v)))),h&&(w=w.filter(v=>Ne(b(v))));for(let[,v]of rs(w,p)){let _=Si.from(v,x,b),T=Oz(_,u);for(let A=0,E=v.length;A<E;++A)m[v[A]]=T.renderCell(A)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),uot)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,cells:u}=r;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(f=>{f.selectAll().data(t).enter().append("path").call(It,this).attr("d",d=>u[d]).call(Yt,this,r)}).node()}},C6=class extends b0{constructor(t,n){super(t,n,fot),this.fill="none"}_render(t,n){return Oz(t,n).render()}};function Oz(e,t){let{width:n,height:r,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,n-o,r-s])}function w0(e,t,{x:n,y:r,...i}={}){return[n,r]=je(n,r),new e(t,{...i,x:n,y:r})}function Nz(e,t){return w0(R6,e,t)}function Dz(e,t){return w0(L6,e,t)}function Rz(e,t){return w0(F6,e,t)}function Lz(e,{x:t,y:n,initializer:r,...i}={}){return w0(k6,e,{...rn({...i,x:t,y:n},Jv),initializer:r})}function Fz(e,t){return w0(C6,e,t)}var dot={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},_0=class extends xt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=kz(s)&&(s="currentColor",!0),u=kz(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Xn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},pot({...c,fill:s,stroke:a},l,u),dot),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){let{contours:s}=r,a=mn();return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(It,this).call(Yt,this,r).attr("d",l=>a(s[l]))).node()}};function Cz(e,{x:t,y:n,...r}={}){return[t,n]=je(t,n),new _0(e,{...r,x:t,y:n})}var hot=new Set(["x","y","z","weight"]);function pot(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?nn(o):+o,xe(e,function(s,a,c,l,u,f){let d=c.weight?nn(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,y]=vn(this,u),{width:g,height:x}=u,{x:b,y:w}=ss(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([k])=>!hot.has(k)).map(([k,S])=>[k,{...S,value:[]}])),_=t&&[],T=n&&[],A=PE().x(b?k=>b[k]:m).y(w?k=>w[k]:y).weight(d?k=>d[k]:1).size([g,x]).bandwidth(i),E=[];for(let k of a){let S=[];E.push(S);for(let M of h?qy(k,h,p):[k]){let N=A.contours(M);S.push([M,N])}}let O=o;if(!(O instanceof Dy)){let k=0;for(let S of E)for(let[,M]of S){let N=M.max;N>k&&(k=N)}O=Float64Array.from({length:o-1},(S,M)=>k*100*(M+1)/o)}let I=[],D=[];for(let k of E){let S=[];I.push(S);for(let[M,N]of k)for(let L of O){S.push(D.length),D.push(N(L/100)),_&&_.push(L),T&&T.push(L);for(let B in v)v[B].value.push(c[B].value[M[0]])}}return _&&_.push(0),T&&T.push(0),{data:s,facets:I,channels:{...v,..._&&{fill:{value:_,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:D}}}})}function kz(e){return/^density$/i.test(e)}function $z(e,t){return zz("x",e,t)}function Uz(e,t){return zz("y",e,t)}function zz(e,t,{x1:n,x2:r,y1:i,y2:o,x:s=n===void 0&&r===void 0?e==="y"?ye:X:void 0,y:a=i===void 0&&o===void 0?e==="x"?ye:X:void 0,fill:c,positiveFill:l="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:d=f,negativeFillOpacity:h=f,stroke:p,strokeOpacity:m,z:y=Fe(p)[0],clip:g,tip:x,render:b,...w}={}){return[n,r]=Bz(s,n,r),[i,o]=Bz(a,i,o),n===r&&i===o&&(e==="y"?i=ka(0):n=ka(0)),{tip:x}=co({tip:x},e==="y"?"x":"y"),on(oe(l)?null:Object.assign(i0(t,{x1:n,x2:r,y1:i,y2:o,z:y,fill:l,fillOpacity:d,render:Oa(b,Pz(e,!0)),clip:g,...w}),{ariaLabel:"positive difference"}),oe(u)?null:Object.assign(i0(t,{x1:n,x2:r,y1:i,y2:o,z:y,fill:u,fillOpacity:h,render:Oa(b,Pz(e,!1)),clip:g,...w}),{ariaLabel:"negative difference"}),Bu(t,{x:r,y:o,z:y,stroke:p,strokeOpacity:m,tip:x,clip:!0,...w}))}function Bz(e,t,n){return t===void 0&&n===void 0?t=n=ka(e):t===void 0?(n=ka(n),t=e===void 0?n:ka(e)):n===void 0?(t=ka(t),n=e===void 0?t:ka(e)):(t=ka(t),n=ka(n)),[t,n]}function ka(e){let t,{value:n,label:r=Pn(n)}=Di(e);return{transform:i=>t||(t=gt(i,n)),label:r}}function Pz(e,t){let n=e==="x"?"y":"x",r=`${n}1`,i=`${n}2`,o=`${e}1`,s=`${e}2`;return(a,c,l,u,f,d)=>{let{[r]:h,[i]:p}=l,m=new Float32Array(h.length),y=new Float32Array(p.length),g=u[e==="y"?"height":"width"];(t===Iv(c[e])<0?m:y).fill(g);let x=d(a,c,{...l,[i]:h,[s]:y},u,f),b=d(a,c,{...l,[r]:p,[o]:m},u,f),w=x.querySelector("g")??x,v=b.querySelector("g")??b;for(let _=0;w.firstChild;_+=2){let T=Z3(),A=ct("svg:clipPath",f).attr("id",T).node();A.appendChild(w.firstChild),v.childNodes[_].setAttribute("clip-path",`url(#${T})`),v.insertBefore(A,v.childNodes[_])}return b}}function w2({geometry:e=X,...t}={}){let n=jc(r=>gt(r,e));return xe({...t,x:null,y:null,geometry:{transform:n}},(r,i,o,s,a,{projection:c})=>{let l=n(r),u=l.length,f=new Float64Array(u),d=new Float64Array(u),h=mn(c);for(let p=0;p<u;++p)[f[p],d[p]]=h.centroid(l[p]);return{data:r,facets:i,channels:{x:{value:f,scale:c==null?"x":null,source:null},y:{value:d,scale:c==null?"y":null,source:null}}}})}function jz({geometry:e=X,...t}={}){let n=jc(i=>gt(i,e)),r=jc(i=>gt(n(i),tA));return{...t,x:{transform:i=>Float64Array.from(r(i),([o])=>o)},y:{transform:i=>Float64Array.from(r(i),([,o])=>o)},geometry:{transform:n}}}var mot={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},v0=class extends xt{constructor(t,n={}){let[r,i]=ae(n.r,3);super(t,{x:{value:n.tip?n.x:null,scale:"x",optional:!0},y:{value:n.tip?n.y:null,scale:"y",optional:!0},r:{value:r,scale:"r",filter:mr,optional:!0},geometry:{value:n.geometry,scale:"projection"}},c0(n),mot),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=mn(o.projection??yot(n)),{r:l}=this;return Ac(l)?t=[]:l!==void 0&&c.pointRadius(l),ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(It,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Yt,this,r)}).node()}};function yot({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,ru({point(n,r){this.stream.point(e(n),t(r))}})}function _2(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=w2(t):t.geometry===void 0&&(t={...t,geometry:X}),new v0(e,t)}function Vz({strokeWidth:e=1.5,...t}={}){return _2({type:"Sphere"},{strokeWidth:e,...t})}function qz({strokeOpacity:e=.1,...t}={}){return _2(sA(),{strokeOpacity:e,...t})}var sh=.5,ah=0;function Yz(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:ee(t),e=I3(e,n),is(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!is(e,"r")&&(n.r=t/2),xe(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=ss(s,a,l)),d=d?d.value:gt(i,r),h=h?.value,p=p?.value,m=m?.value;let y=Py(e,{z:d,fill:h,stroke:p,symbol:m}),g=d&&[],x=h&&[],b=p&&[],w=m&&[],v=[],_=[],T=[],A=-1;for(let D of e)D.initialize(i);for(let D of o){let k=[];for(let S of e)S.scope("facet",D);for(let[S,M]of rs(D,y))for(let{index:N,extent:L}of got(i,M,u,f,t)){k.push(++A),_.push(L.x),T.push(L.y),d&&g.push(y===d?S:d[N[0]]),h&&x.push(y===h?S:h[N[0]]),p&&b.push(y===p?S:p[N[0]]),m&&w.push(y===m?S:m[N[0]]);for(let B of e)B.reduce(N,L)}v.push(k)}let E=s.x.scale,O=s.y.scale,I={x:{value:_,source:a[E]?{value:Wt(_,a[E].invert),scale:E}:null},y:{value:T,source:a[O]?{value:Wt(T,a[O].invert),scale:O}:null},...d&&{z:{value:g}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:D,output:k})=>[D,{scale:"auto",label:k.label,radius:D==="r"?t/2:void 0,value:k.transform()}]))};return{data:i,facets:v,channels:I}})}function got(e,t,n,r,i){let o=i*(1.5/p3),s=new Map;for(let a of t){let c=n[a],l=r[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-ah)/o),f=Math.round(c=(c-sh)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),x=c-y,b=l-g;m*m+d*d>x*x+b*b&&(f=y+(u&1?1:-1)/2,u=g)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+sh,y:u*o+ah}},s.set(h,p)),p.index.push(a)}return s.values()}var xot={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function Gz(e){return new S0(e)}var S0=class extends xt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Dc,void 0,{clip:n,...r},xot),this.binWidth=ee(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-sh,p=f-c-sh,m=a-ah,y=d-l-ah,g=s/2,x=g*m3,b=x/2,w=g*2,v=x*1.5,_=Math.floor(h/w),T=Math.ceil(p/w),A=Math.floor((m+b)/v),E=Math.ceil((y-b)/v)+1,O=`m0,${rl(-x)}l${rl(g)},${rl(b)}v${rl(x)}l${rl(-g)},${rl(b)}`,I=O;for(let D=A;D<E;++D)for(let k=_;k<T;++k)I+=`M${rl(k*w+(D&1)*g)},${rl(D*v)}${O}`;return ct("svg:g",o).datum(0).call(Rt,this,i,o).call(Et,this,{},Be+sh,Be+ah).call(D=>D.append("path").call(It,this).call(Yt,this,r).attr("d",I)).node()}};function rl(e){return Math.round(e*1e3)/1e3}var bot={ariaLabel:"image",fill:null,stroke:null};function wot(e){return/^\.*\//.test(e)}function _ot(e){return/^(blob|data|file|http|https):/i.test(e)}function vot(e){return typeof e=="string"&&(wot(e)||_ot(e))?[void 0,e]:[e,void 0]}var I0=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=vot(l),[y,g]=ae(o),[x,b]=ae(s,g!==void 0?g*2:void 0),[w,v]=ae(a,g!==void 0?g*2:void 0),[_,T]=ae(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:mr,optional:!0},width:{value:x,filter:mr,optional:!0},height:{value:w,filter:mr,optional:!0},rotate:{value:_,optional:!0},src:{value:p,optional:!0}},c0(n),bot),this.src=m,this.width=b,this.rotate=T,this.height=v,this.r=g,this.preserveAspectRatio=be(u,"xMidYMid"),this.crossOrigin=Ye(f),this.frameAnchor=ns(d),this.imageRendering=be(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:m,width:y,height:g,rotate:x}=this,[b,w]=vn(this,i);return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(It,this).attr("x",Wz(c,u,d,b,y,m)).attr("y",Wz(l,f,d,w,g,m)).attr("width",u?_=>u[_]:y!==void 0?y:d?_=>d[_]*2:m*2).attr("height",f?_=>f[_]:g!==void 0?g:d?_=>d[_]*2:m*2).attr("transform",h?_=>`rotate(${h[_]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?uo`${c?_=>c[_]:b}px ${l?_=>l[_]:w}px`:null).call(ft,"href",p?_=>p[_]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?_=>`circle(${d[_]}px)`:m!==void 0?`circle(${m}px)`:null).call(Yt,this,r)).node()}};function Wz(e,t,n,r,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>r-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?r-i/2:n&&e?s=>e[s]-n[s]:n?s=>r-n[s]:e?s=>e[s]-o:r-o}function Xz(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new I0(e,{...r,x:t,y:n})}function Sot(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(n*y*(1-e),1/n)),g=-ch(t)-ch(n)+ch(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Iot(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Iot(e,t,n){var r=e===0||e===1?0:Math.exp(ch(t+n)-ch(t)-ch(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*Hz(e,t,n)/t:1-r*Hz(1-e,n,t)/n}function Hz(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function ch(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function Qz(e,t){var n=Sot(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Tot={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},v2=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Xn(n),optional:!0}},n,Tot),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){let{x:s,y:a,z:c}=r,{ci:l}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(u=>u.selectAll().data(c?qy(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(It,this).call(Su,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Ia(this.fill)?d=>d.select(Eot).attr("stroke","none").call(It,this).call(Su,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function Eot(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ar.svg,"path"),this)}var B6=class extends v2{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ne(t,u=>r[u]),c=S2(t,r,n),l=Jz(t,r,n,(1-i)/2,c);return yd().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(qe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ne(t,a=>r[a]),s=S2(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},P6=class extends v2{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ne(t,u=>n[u]),c=S2(t,n,r),l=Jz(t,n,r,(1-i)/2,c);return yd().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(qe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ne(t,a=>n[a]),s=S2(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function Zz(e,{y:t=ye,x:n=X,stroke:r,fill:i=oe(r)?"currentColor":r,...o}={}){return new B6(e,Jd({...o,x:n,y:t,fill:i,stroke:r}))}function Kz(e,{x:t=ye,y:n=X,stroke:r,fill:i=oe(r)?"currentColor":r,...o}={}){return new P6(e,Kd({...o,x:t,y:n,fill:i,stroke:r}))}function S2(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=n[u];r+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function Jz(e,t,n,r,i){let o=Fn(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(n[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=Qz(r,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function T0({path:e=X,delimiter:t,frameAnchor:n,treeLayout:r=iu,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=A2(s),i=nj(i),a!=null&&(a=U6(a)),n===void 0&&(n=s.frameAnchor);let l=rj(t),u=uj(c,U6),[f,d]=wn(),[h,p]=wn();return{x:f,y:h,frameAnchor:n,...rn(c,(m,y)=>{let g=l(gt(m,e)),x=d([]),b=p([]),w=-1,v=[],_=[],T=ww().path(O=>g[O]),A=Rr(m)?O=>O.data=m[O.data]:O=>O.data=m.get(O.data),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??Ry);for(let O of u)O[T2]=O[cj]([]);for(let O of y){let I=[],D=T(O.filter(k=>g[k]!=null)).each(A);i!=null&&D.sort(i),E(D);for(let k of D.descendants())if(!(a!=null&&!a(k))){I.push(++w),v[w]=k.data,s.position(k,w,x,b);for(let S of u)S[T2][w]=S[lj](k)}_.push(I)}return{data:v,facets:_}}),...Object.fromEntries(u)}}function E2({path:e=X,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=iu,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=A2(l),a=nj(a),u!=null&&(u=ej(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=rj(t),h=uj(f,ej),[p,m]=wn(),[y,g]=wn(),[x,b]=wn(),[w,v]=wn();return{x1:p,x2:y,y1:x,y2:w,...rn(f,(_,T)=>{let A=d(gt(_,e)),E=m([]),O=g([]),I=b([]),D=v([]),k=-1,S=[],M=[],N=ww().path(B=>A[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Ry);for(let B of h)B[T2]=B[cj]([]);for(let B of T){let C=[],P=N(B.filter($=>A[$]!=null)).each($=>$.data=_[$.data]);a!=null&&P.sort(a),L(P);for(let{source:$,target:U}of P.links())if(!(u!=null&&!u(U,$))){C.push(++k),S[k]=U.data,l.position($,k,E,I),l.position(U,k,O,D);for(let H of h)H[T2][k]=H[lj](U,$)}M.push(C)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function A2(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Aot;case"right":return Mot}throw new Error(`invalid tree anchor: ${e}`)}var Aot={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},Mot={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function nj(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?tj(U6(e)):tj(Oot(e))}function tj(e){return(t,n)=>xn(e(t),e(n))}function Oot(e){return t=>t.data?.[e]}function rj(e="/"){if(e=`${e}`,e==="/")return n=>n;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return n=>n.map(r=>Not(r,t))}var $6=92,ij=47;function Not(e,t){if(t===$6)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;r<i;++r){switch(e.charCodeAt(r)){case $6:if(!n){n=!0;continue}break;case t:n?(e=e.slice(0,r-1)+e.slice(r),--r,--i):e=e.slice(0,r)+"/"+e.slice(r+1);break;case ij:n?(e=e.slice(0,r)+"\\\\"+e.slice(r),r+=2,i+=2):(e=e.slice(0,r)+"\\"+e.slice(r),++r,++i);break}n=!1}return e}function Dot(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case $6:if(!t){t=!0;continue}case ij:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function oj(e){return bn(e)&&typeof e.node=="function"}function Rot(e){return bn(e)&&typeof e.link=="function"}function U6(e){if(oj(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return j6;case"node:path":return z6;case"node:internal":return sj;case"node:external":return aj;case"node:depth":return V6;case"node:height":return q6}throw new Error(`invalid node value: ${e}`)}}function ej(e){if(oj(e))return e.node;if(Rot(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return I2(j6);case"parent:path":return I2(z6);case"parent:depth":return I2(V6);case"parent:height":return I2(q6);case"node:name":return j6;case"node:path":return z6;case"node:internal":return sj;case"node:external":return aj;case"node:depth":return V6;case"node:height":return q6}throw new Error(`invalid link value: ${e}`)}}function z6(e){return e.id}function j6(e){return Lot(e.id)}function V6(e){return e.depth}function q6(e){return e.height}function sj(e){return!!e.children}function aj(e){return!e.children}function I2(e){return(t,n)=>n==null?void 0:e(n)}function Lot(e){let t=e.length;for(;--t>0&&!Fot(e,t););return Dot(e.slice(t+1))}function Fot(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var cj=2,lj=3,T2=4;function uj(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...wn(i),o])}return n}function Y6(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=oe(f)&&oe(d),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:x,textAnchor:b,treeLayout:w=iu,textLayout:v=w===iu||w===xw?"mirrored":"normal",tip:_,...T}={}){if(g===void 0&&(g=A2(T.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");v=un(v,"textLayout",["mirrored","normal"]);function A(E){return cs(e,T0({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...E,...T}))}return on(u2(e,E2({treeLayout:w,markerStart:f,markerEnd:d,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?Li(e,T0({treeLayout:w,fill:t===void 0?"node:internal":t,title:y,tip:_,...T})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:A():null)}function fj(e,t){return Y6(e,{...t,treeLayout:xw})}var hj={ariaLabel:"waffle"},E0=class extends Ru{constructor(t,{unit:n=1,gap:r=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:Oa(o,pj("x"))},hj),this.unit=Math.max(0,n),this.gap=+r,this.round=mj(i),this.multiple=yj(s)}},A0=class extends Lu{constructor(t,{unit:n=1,gap:r=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:Oa(o,pj("y"))},hj),this.unit=Math.max(0,n),this.gap=+r,this.round=mj(i),this.multiple=yj(s)}};function pj(e){return function(t,n,r,i,o){let{unit:s,gap:a,rx:c,ry:l,round:u}=this,{document:f}=o,d=r.channels[`${e}1`].value,h=r.channels[`${e}2`].value,p=this[e==="y"?"_width":"_height"](n,r,i),m=this[e==="y"?"_x":"_y"](n,r,i),y=s*kot(n.scales[e]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(p/y)))}=this,x=Math.min(p/g,y*g),b=y*g,w=e==="y"?([I,D])=>[I*x,-D*b]:([I,D])=>[D*b,I*x],v=(p-g*x)/2,_=typeof m=="function"?I=>m(I)+v:m+v,T=n[e](0),A=_$(),E=f.createElementNS(ar.svg,"pattern");E.setAttribute("width",e==="y"?x:b),E.setAttribute("height",e==="y"?b:x),E.setAttribute("patternUnits","userSpaceOnUse");let O=E.appendChild(f.createElementNS(ar.svg,"rect"));return O.setAttribute("x",a/2),O.setAttribute("y",a/2),O.setAttribute("width",(e==="y"?x:b)-a),O.setAttribute("height",(e==="y"?b:x)-a),c!=null&&O.setAttribute("rx",c),l!=null&&O.setAttribute("ry",l),ct("svg:g",o).call(Rt,this,i,o).call(this._transform,this,n).call(I=>I.selectAll().data(t).enter().append(()=>E.cloneNode(!0)).attr("id",D=>`${A}-${D}`).select("rect").call(It,this).call(Yt,this,r)).call(I=>I.selectAll().data(t).enter().append("path").attr("transform",e==="y"?uo`translate(${_},${T})`:uo`translate(${T},${_})`).attr("d",D=>`M${G6(u(d[D]/s),u(h[D]/s),g).map(w).join("L")}Z`).attr("fill",D=>`url(#${A}-${D})`).attr("stroke",this.stroke==null?null:D=>`url(#${A}-${D})`)).node()}}function G6(e,t,n){if(e<0||t<0){let r=Math.ceil(-Math.min(e,t)/n);return G6(e+r*n,t+r*n,n).map(([i,o])=>[i,o-r])}return t<e?G6(t,e,n):[[0,Math.ceil(e/n)],[Math.floor(e%n),Math.ceil(e/n)],[Math.floor(e%n),Math.floor(e/n)+e%1],[Math.ceil(e%n),Math.floor(e/n)+e%1],...e%n>n-1?[]:[[Math.ceil(e%n),Math.floor(e/n)],[n,Math.floor(e/n)]],[n,Math.floor(t/n)],[Math.ceil(t%n),Math.floor(t/n)],[Math.ceil(t%n),Math.floor(t/n)+t%1],[Math.floor(t%n),Math.floor(t/n)+t%1],...t%n<1?[]:[[Math.floor(t%n),Math.ceil(t/n)],[0,Math.ceil(t/n)]]]}function mj(e){if(e===void 0||e===!1)return Number;if(e===!0)return Math.round;if(typeof e!="function")throw new Error(`invalid round: ${e}`);return e}function yj(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function kot({domain:e,range:t}){return dj(t)/dj(e)}function dj(e){let[t,n]=ne(e);return n-t}function gj(e,t={}){return _a(t)||(t={...t,y:ye,x2:X}),new E0(e,Hc(jd(Wc(t))))}function xj(e,t={}){return _a(t)||(t={...t,x:ye,y2:X}),new A0(e,Qc(Vd(Xc(t))))}var Oj=nq(Mj(),1);var Vot=({marginLeft:e})=>[1,e],qot=({width:e,marginRight:t})=>[-1,e-t],Yot=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],Got=({marginTop:e})=>[1,e],Wot=({height:e,marginBottom:t})=>[-1,e-t],Xot=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function Nj(e){return typeof e=="string"?{anchor:e}:e}function Dj(e={},t={}){arguments.length===1&&([e,t]=Lj(e));let{anchor:n="left",padding:r=1,r:i=t.r}=Nj(e);switch(`${n}`.toLowerCase()){case"left":n=Vot;break;case"right":n=qot;break;case"middle":n=Yot;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Fj("x","y",n,ee(r),i,t)}function Rj(e={},t={}){arguments.length===1&&([e,t]=Lj(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=Nj(e);switch(`${n}`.toLowerCase()){case"top":n=Got;break;case"bottom":n=Wot;break;case"middle":n=Xot;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Fj("y","x",n,ee(r),i,t)}function Lj(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function Fj(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Fy(s),s?.r===void 0&&(o={...o,channels:{...s,r:{value:i,scale:"r"}}}),a===void 0&&c===void 0&&(o.sort={channel:"-r"})}return xe(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=ss(c,l,f));let p=h?void 0:i!==void 0?ee(i):this.r!==void 0?this.r:3;h&&(h=gt(h.value,l[h.scale]||X,Float64Array));let[m,y]=n(u),g=m?Qot:Hot,x=new Float64Array(d.length),b=h?w=>h[w]:()=>p;for(let w of a){let v=(0,Oj.default)();w=w.filter(h?T=>_d(d[T])&&mr(h[T]):T=>_d(d[T]));let _=new Float64Array(2*w.length+2);for(let T of w){let A=b(T),E=m?A+r:0,O=d[T]-A,I=d[T]+A,D=2;v.queryInterval(O-r,I+r,([,,S])=>{let M=x[S]-E,N=d[T]-d[S],L=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(L*L-N*N);_[D++]=M-B,_[D++]=M+B});let k=_.slice(0,D);m&&(k=k.filter(S=>S>=0));t:for(let S of k.sort(g)){for(let M=0;M<D;M+=2)if(_[M]+1e-6<S&&S<_[M+1]-1e-6)continue t;x[T]=S+E;break}v.insert([O,I,T])}}m||(m=1);for(let w of a)for(let v of w)x[v]=x[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function Hot(e,t){return Math.abs(e)-Math.abs(t)}function Qot(e,t){return e-t}function Cj(e,t){return arguments.length===1&&({basis:e,...t}=e),nh(N2(e),t)}function Bj(e,t){return arguments.length===1&&({basis:e,...t}=e),rh(N2(e),t)}function N2(e){if(e===void 0)return kj;if(typeof e=="function")return D2(Ad(e));if(/^p\d{2}$/i.test(e))return dh(Ed(e));switch(`${e}`.toLowerCase()){case"deviation":return Jot;case"first":return kj;case"last":return Kot;case"max":return tst;case"mean":return est;case"median":return nst;case"min":return rst;case"sum":return ist;case"extent":return Zot}throw new Error(`invalid basis: ${e}`)}function D2(e){return{mapIndex(t,n,r){let i=+e(t,n);for(let o of t)r[o]=n[o]===null?NaN:n[o]/i}}}function dh(e){return D2((t,n)=>e(t,r=>n[r]))}var Zot={mapIndex(e,t,n){let[r,i]=ne(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},kj=D2((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ne(r))return r}}),Kot=D2((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ne(r))return r}}),Jot={mapIndex(e,t,n){let r=Js(e,o=>t[o]),i=wi(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},tst=dh(Qt),est=dh(Js),nst=dh(ro),rst=dh(ue),ist=dh(Fn);function Pj(e,t){return Uj("x",e,t)}function $j(e,t){return Uj("y",e,t)}function Uj(e,t,n={}){let r,i=1;if(typeof t=="number")i=t,r=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=av(t.replace(/^[+-]/,"")),i*=l}t=Od(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Lr({[o]:l=>l.map(u=>r(u,i)),[s]:l=>l},n),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ne(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function zj(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return N0(t);case"last":return D0(t)}if(typeof e=="function")return il(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=ost(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return il(n,r,t)}function ost(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return K6;case"max":return J6}throw new Error(`unknown selector: ${e}`)}function N0(e){return il(null,sst,e)}function D0(e){return il(null,ast,e)}function R2(e){return il("x",K6,e)}function L2(e){return il("y",K6,e)}function F2(e){return il("x",J6,e)}function k2(e){return il("y",J6,e)}function*sst(e){yield e[0]}function*ast(e){yield e[e.length-1]}function*K6(e,t){yield n1(e,n=>t[n])}function*J6(e,t){yield zl(e,n=>t[n])}function il(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=Xn(n);return rn(n,(i,o)=>{let s=gt(i,r),a=gt(i,e),c=[];for(let l of o){let u=[];for(let f of s?Rn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}xt.prototype.plot=function({marks:e=[],...t}={}){return Zd({...t,marks:[...e,this]})};var cst=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function lst(e,t,n){for(let r=0;r<t.length;++r){let i=t[r];r===t.length-1?e[i]=n:e=e[i]||(e[i]={})}}function jj(e,t,n){for(let r in e){let i=cst.get(r);if(i==null)throw new Error(`Unrecognized plot attribute: ${r}`);let o=e[r];typeof o=="symbol"?n.push(r):o!==void 0&&lst(t,i.split("."),o)}}var ust=new Set(["frame","hexgrid","sphere","graticule"]),fst=new Map([["first",N0],["last",D0],["maxX",F2],["maxY",k2],["minX",R2],["minY",L2],["nearest",qc],["nearestX",Yc],["nearestXY",Na]]);async function qj(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;jj(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...d}=u,h=fst.get(f)?.(d)??d,p=ust.has(c)?[h]:[l,h];t.marks.push(t4[c](...p)),o.push(a.index)}hst(t,e);let s=Zd(t);pst(s,o),dst(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function dst(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===Ro){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function hst(e,t){let{marks:n}=t;C2("x",e,n),C2("y",e,n),C2("fx",e,n),C2("fy",e,n)}function C2(e,t,n){let r=t[e]||{};if(r.axis===null||r.label!==void 0)return;let i=n.map(l=>l.channelField(e)?.field);if(i.every(l=>l==null))return;let o,s,a;for(let l=0;l<i.length;++l){let{column:u,label:f}=i[l]||{};u===void 0&&f===void 0||(o===void 0&&s===void 0?(o=u,s=f,a=mst(n[l].data,e)||"number"):s!==f?s=void 0:o!==u&&(o=void 0))}let c=s||o;if(c!==void 0){if((a==="number"||a==="date")&&(e==="x"||e==="y")){r.percent&&(c=`${c} (%)`);let l=(e==="x"?1:-1)*(r.reverse?-1:1);e==="x"||r.labelAnchor==="center"?c=e==="x"==l<0?`\u2190 ${c}`:`${c} \u2192`:c=`${l<0?"\u2191 ":"\u2193 "}${c}`}t[e]={...r,label:c}}}function pst(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)Vj(r,t);else Vj(e,t)}function Vj(e,t){let n=-1;for(let r of e.children){let i=r.getAttribute("aria-label")||"";r.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||r.setAttribute("data-index",t[++n])}}function mst(e,t){if(!e)return;let{columns:n}=e,r=n[t]??n[t+"1"]??n[t+"2"];if(r){for(let i of r)if(i!=null)return i instanceof Date?"date":typeof i}}var yst={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},R0=class{constructor(t){this.attributes={...yst},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=HT()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:n}=this.margins();return this.getAttribute("width")-t-n}innerHeight(t=400){let{top:n,bottom:r}=this.margins(),i=this.getAttribute("height");return i==null&&(i=gst(this,n,r)||t,this.setAttribute("height",i,{silent:!0})),i-n-r}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await qj(this),n=this.legends.flatMap(({legend:r,include:i})=>{let o=r.init(t);return i?o:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return qh(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.initialize()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function gst(e,t,n){let r=e.getAttribute("aspectRatio");if(r==null)return;let i=e.getAttribute("xDomain"),o=e.getAttribute("yDomain");if(!i||!o)return;let s=Math.abs(i[1]-i[0]);return Math.abs(o[1]-o[0])*e.innerWidth()/(r*s)+t+n}function B2(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Xr(e)!==null)}var xst=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function Yj(e){return xst.has(e)}var bst=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function Gj(e){return bst.has(`${e}`.toLowerCase())}var Wj=e=>e==="stroke"||e==="fill",wst=e=>/opacity$/i.test(e),_st=e=>e==="symbol",vst=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),e4=(e,t)=>({channel:e,field:t,as:t instanceof _r?t.column:e}),n4=(e,t)=>({channel:e,value:t}),P2=e=>Array.isArray(e),fn=class extends xr{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,P2(this.source)&&(this.data=Nr(this.source));let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Yp]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")Yj(l)||Wj(l)&&B2(u)||_st(l)&&Gj(u)?o.push(n4(l,u)):o.push(e4(l,Va(u)));else if(vs(u))if(Array.isArray(u.columns))o.push(e4(l,u)),a.add(u);else{let d=n4(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&vst(l,u)?o.push(e4(l,u)):u!==void 0&&o.push(n4(l,u))};for(let l in r)c(l,r[l])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||P2(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(n=>n.channel===t)}channelField(t,{exact:n=!1}={}){let r=n?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return r?.field?r:null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=i.get(c)??i.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}return Array.from(i,([o,s])=>({table:t,column:o,stats:s}))}fieldInfo(t){let n=Object.fromEntries(t.map(r=>[r.column,r]));for(let r of this.channels){let{field:i}=r;i&&Object.assign(r,n[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return L0(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Nr(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this;return r4(t,r,i,n)}};function Qn(e,t){let n=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:Wj(e.channel)?{value:n,scale:"color"}:wst(e.channel)?{value:n,scale:"opacity"}:n}function L0(e,t,n=[]){let r=pt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}r.select({[l]:c})}}}return o&&r.groupby(Array.from(i)),r}function r4(e,t,n,r,i={}){let{numRows:o,values:s,columns:a}=r??{},c={};for(let f of n){let d=t.has(f.channel)?c:i;d[f.channel]=Qn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(r?{length:o}:null),options:i}]}function $u(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{type:o}=e.channelField(t);r=o==="date"?"time":"linear"}let i={type:r};switch(r){case"log":i.base=n.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=n.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=n.getAttribute(`${t}Constant`)??1;break}return zh(i)}function si(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=$u(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=r.map(x=>c(x)),h=l(o),p=a==="time"||a==="utc"?h:o,m=d===f?0:(n-i)/(d-f),y=m!==1?` * ${m}::DOUBLE`:"";return[u?q`(${d} - ${h}::DOUBLE)${y}`:q`(${h}::DOUBLE - ${f})${y}`,p]}var i4={x:["min","max"]},o4={y:["min","max"]},$2={...i4,...o4};function Xj(e,t,n,r,i){let{plot:o}=e,s=o.getAttribute(r),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Nn])return s;{let{column:c,min:l,max:u}=e.channelField(n),f=s4(t,c)||(a?la().domain([l,u]).nice().domain():[l,u]);return s!==Ro&&(f[Nn]=!0),o.setAttribute(r,f,{silent:!0}),f}}function hs(e,t){return Xj(e,t,"x","xDomain","xNice")}function ps(e,t){return Xj(e,t,"y","yDomain","yNice")}function s4(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&`${s.field}`===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var F0=class extends fn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["min","max"]}:void 0;super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i}=this,{optimize:o=!0}=i.options||{},s=super.query(t);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,min:d,max:h}=this.channelField(r);if(o&&(f==="date"||f==="number")&&c){let m=r==="x"?n.innerWidth():n.innerHeight(),[y,g]=s4(t,l)||[d,h],[x]=si(this,r,m,[y,g],1,u),b=s.select().map(w=>w.as).filter(w=>w!==u&&w!==c);return Sst(s,x,u,c,b)}else return s.orderby(l)}};function Sst(e,t,n,r,i=[]){let o=q`FLOOR(${t})::INTEGER`,s=a=>pt.from(e).select(a).groupby(o,i);return pt.union(s([{[n]:fi(n),[r]:Ju(r,n)},...i]),s([{[n]:ui(n),[r]:tf(r,n)},...i]),s([{[n]:Ju(n,r),[r]:fi(r)},...i]),s([{[n]:tf(n,r),[r]:ui(r)},...i])).orderby(i,n)}function Hj(e,t=[]){return new t.constructor(e)}function Qj(e,t,n){let r=Hj(e,n),i=n.length;for(let o=0;o<i;++o)r[t[o]]=n[o];return r}function Zj(e,t,n,r,i,o,s){let a=n.length,c=e*t,l=i.map(h=>r[h]),u={},f=[],d=new Int32Array(a);if(o?.length){let h=o.map(m=>r[m]),p={};for(let m=0;m<a;++m){let y=h.map(g=>g[m]);d[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let h=n.map(y=>y%e),p=n.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[d[y]].push(y);i.forEach((y,g)=>{let x=l[g];u[y]=f.map((b,w)=>s(m[w],e,t,h,p,x))})}else i.forEach((h,p)=>{let m=l[p],y=u[h]=f.map(()=>Hj(c,m));for(let g=0;g<a;++g)y[d[g]][n[g]]=m[g]});return{numRows:f.length,columns:u}}function k0(e){let t=1/0,n=-1/0;return e.forEach(r=>{let i=r.length;for(let o=0;o<i;++o){let s=r[o];s<t&&(t=s),s>n&&(n=s)}}),Number.isFinite(t)&&Number.isFinite(n)?[t,n]:[0,1]}function Kj(e){let t=new or;return e.forEach(n=>{let r=n.length;for(let i=0;i<r;++i)t.add(n[i])}),Array.from(t).sort(Nt)}function Ge(e,t){return Sr(e)?(e.addEventListener("value",t),e.value):e}function C0(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Ist(n,r,e);let i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function Ist(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function Jj(e,t,n,[r,i]){let o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),c=new Float64Array(n.length);for(let l=0,u=0;l<i;++l,u+=r){let f=c.subarray(u);U2(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);U2(t,u,i,r,o,s,a,u)}return c}function U2(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Tst){let l=r*2,u=r*3,f=r*4,d=r*n,h,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<n;++p,h+=r)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-r]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-r*5;p<n;++p,h-=r)o[p]=e.b_anticausal[1]*t[h+r]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<n;++p,h+=r)a[h]=i[p]+o[n-p-1];else for(p=0,h=0;p<n;++p,h+=r)a[h]=Math.max(0,i[p]+o[n-p-1]);return a}function Tst(e,t,n,r,i,o,s,a,c,l,u,f=.5){let d=Math.abs(r)*n,h=r<0?d+r:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=h+r*m,p>=0&&p<d&&(e[y]+=l[y-m]*t[p]);let g=t[h],x=Math.ceil(u*10);for(m=0;m<x;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var Ca="density",fo=class extends fn{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=Est(u);super(t,n,u,$2),this.densityMap=f,this.bandwidth=Ge(i,d=>(this.bandwidth=d,this.grids?this.convolve().update():null)),this.interpolate=Ge(o,d=>(this.interpolate=d,this.requestUpdate())),this.pixelSize=Ge(s,d=>(this.pixelSize=d,this.requestUpdate())),this.pad=Ge(a,d=>(this.pad=d,this.requestUpdate())),this.width=Ge(c,d=>(this.width=d,this.requestUpdate())),this.height=Ge(l,d=>(this.height=d,this.requestUpdate()))}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",r),t.addAttributeListener("yDomain",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Nn]&&!n[Nn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=hs(this,t),[l,u]=this.extentY=ps(this,t),[f,d]=this.bins=this.binDimensions(),[h,p]=si(this,"x",f,[a,c],r),[m,y]=si(this,"y",d,[l,u],r),g=r?[We(p,[+a,+c]),We(y,[+l,+u])]:[Es(+a,p),Ts(p,+c),Es(+l,y),Ts(y,+u)],x=pt.from(s.table).where(t.concat(g)),b=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:T,channel:A,field:E}=_;E.aggregate?(w[A]=E,o[A]=!0):A==="weight"?w[Ca]=Pr(E):A!=="x"&&A!=="y"&&(x.select({[T]:E}),b.push(T))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push(Ca),w.density=Zn()),n==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return Ost(x,h,m,w[Ca],f,b)}else return Mst(x,h,m,w,f,b)}binDimensions(){let{plot:t,pixelSize:n,width:r,height:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins,i=Ast(this.interpolate),{columns:o}=Nr(t);return this.grids0=Zj(n,r,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids0:i,plot:o}=this;if(this.grids=i,n>0){let s=t.length===1?t[0]:t.includes(Ca)?Ca:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=r,d=a.some(m=>m.some(y=>y<0)),h=C0(n*(u-1)/c,d),p=C0(n*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>Jj(h,p,m,r))}}}return this}};function Est(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function Ast(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return y0;case"barycentric":return m0();case"random-walk":return g0()}throw new Error(`invalid interpolate: ${e}`)}function Mst(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Ost(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return pt.from(pt.unionAll(c,l,u,f)).select({index:"i",density:Pr("w")},o).groupby("index",o).having(yl("density",0))}var B0=class extends fo{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=Ge(r,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,grids:r,thresholds:i,plot:o}=this,{numRows:s,columns:a}=r,c=i,l;if(Array.isArray(c))l=c;else{let[,I]=k0(a.density);l=Array.from({length:c-1},(D,k)=>I*(k+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[d,h]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(h-d)/u,g=(m-p)/f,x=+d,b=+p,w=I=>x+I*y,v=I=>b+I*g,_=bc().size(t),T=this.contourData=Array(s*l.length),{density:A,...E}=a,O=Object.entries(E);for(let I=0,D=0;I<s;++I){let k=A[I],S=O.reduce((M,[N,L])=>(M[N]=L[I],M),{});for(let M=0;M<l.length;++M,++D)T[D]=Object.assign(Nst(_.contour(k,l[M]),w,v),S)}return this}plotSpecs(){let{type:t,channels:n,densityMap:r,contourData:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=Qn(s))}for(let s in r)r[s]&&(o[s]=Qn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function Nst(e,t,n){function r(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=n(s[1])}return e.coordinates.forEach(r),e}function P0(e){return Array.from({length:e},(t,n)=>n)}function z2(e,t){let n=t.reduce((i,o,s)=>(i[o]=s,i),{}),r=P0(e.length);return r.sort((i,o)=>n[e[i]]-n[e[o]]),r}function j2(e,t){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",e),n.setAttribute("height",t),n}throw new Error("Can not create a canvas instance.")}function tV(e=1){let t=255*e|0;return(n,r,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<r;++a,s+=4)n[s+3]=t}}function eV(e){let{apply:t}=e;return(n,r,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*r;c<r;++c,a+=4)n[a+3]=255*t(o[c+l])|0}}function nV(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?cn(e):e,o=new Uint8ClampedArray([t,n,r,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function rV(e){let{domain:t,range:n}=e,r=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=n.length;for(let a=0;a<=o;++a){let c=n[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?cn(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,r[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=r[u[h+p]];a[d+0]=i[m+0],a[d+1]=i[m+1],a[d+2]=i[m+2],a[d+3]=i[m+3]}else{let f=r[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function iV(e,t,n){let{interpolate:r}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=r(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?cn(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*n(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var ol=class extends fo{constructor(t,n){super("image",t,n),this.image=null}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=Fst(this,r,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=a4(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?z2(m,this.plot.getAttribute("colorDomain")):P0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,r,i,m[y[x]]),u?.(l.data,r,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}},$0=class extends ol{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function a4(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(Ca),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=n.fill||t.includes("fill")?"grid":r.includes(a?.as)?"group":B2(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?Ca:null),d=c?.as??(u==="grid"?Ca:null),h=l!=="grid"&&l!=="group"?nV(l):Rst(e,f),p=u!=="grid"?tV(u):Dst(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Dst(e,t){let{plot:n,grids:r}=e,i=n.getAttribute("opacityDomain"),o=i===Ro,s=i?.[Nn],a=!o&&!s&&i||k0(r.columns[t]);(o||s||!i)&&(o||(a[Nn]=!0),n.setAttribute("opacityDomain",a));let c=$c({opacity:{type:n.getAttribute("opacityScale"),domain:a,clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return eV(c)}function Rst(e,t){let{plot:n,grids:r}=e,i=r.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=n.getAttribute("colorDomain"),c=a===Ro,l=a?.[Nn],u=!c&&!l&&a||(o?i.slice().sort(Nt):s?Kj(i):k0(i));(c||l||!a)&&(c||(u[Nn]=!0),n.setAttribute("colorDomain",u));let f=$c({color:{type:n.getAttribute("colorScale"),domain:u,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(s)return rV(f);{let d=$c({x:{type:Lst(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return iV(1024,f,d.apply)}}function Lst(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Fst(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=j2(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}var U0=class extends ol{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),this.normalize=Ge(r,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:n,normalize:r,source:i,pad:o}=this,[s,a]=this.bins=this.binDimensions(),[c]=si(this,"x",s,hs(this,t),o),[l]=si(this,"y",a,ps(this,t),o),u=pt.from(i.table).where(kst(this,t));this.aggr=["density"];let f=this.groupby=[],d=[];for(let h of n)if(Object.hasOwn(h,"field")){let{channel:p,field:m}=h;p==="z"?(u.select({[p]:m}),d.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return Cst(u,c,l,d,s,a,f,r)}};function kst(e,t){if(Array.isArray(t)&&!t.length)return t;let{column:n}=e.channelField("x"),{column:r}=e.channelField("y"),i=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==n&&a!==r},o=s=>s.op==="AND"?vr(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function Cst(e,t,n,r,i,o,s=[],a=!0){e.select({x:q`FLOOR(${t})::INTEGER`,y:q`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=pt.from(e).select(c,{x0:"x",y0:"y",dx:q`(lead(x) OVER sw - x)`,dy:q`(lead(y) OVER sw - y)`}).window({sw:q`${l}ORDER BY x ASC`}).qualify(vr(q`(x0 < ${i} OR x0 + dx < ${i})`,q`(y0 < ${o} OR y0 + dy < ${o})`,q`(x0 > 0 OR x0 + dx > 0)`,q`(y0 > 0 OR y0 + dy > 0)`)),f=pt.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=pt.select({i:q`UNNEST(range((${f})))::INTEGER`}),h=pt.unionAll(pt.select(c,{x:q`x0 + i`,y:q`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(q`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),pt.select(c,{x:q`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:q`y0 + SIGN(dy) * i`}).from("pairs","indices").where(q`ABS(dy) > ABS(dx) AND i < ABS(dy)`),pt.select(c,{x:"x0",y:"y0"}).from("pairs").where(ml("dx"))),p=["x"].concat(c).join(", "),m=pt.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(vr(We("x",[0,i],!0),We("y",[0,o],!0)));return pt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,density:a?Pr("w"):Zn()}).groupby("index",s)}var hh=class extends fn{constructor(t,n,r){let{bins:i=1024,bandwidth:o=20,...s}=r,a=t.endsWith("X")?"y":"x";super(t,n,s,a==="x"?i4:o4),this.dim=a,this.bins=Ge(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=Ge(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[Nn]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,s=this.extent=(i==="x"?hs:ps)(this,t),[a,c]=si(this,i,n,s),l=L0(r,o,[i]).where(t.concat(We(c,s))),u=this.channelField("weight")?"weight":null;return Bst(l,a,u)}queryResult(t){let{columns:{index:n,density:r}}=Nr(t);return this.grid=Qj(this.bins,n,r),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=C0(n*(t-1)/l,c),f=U2(u,i,t),d=r==="x"?"y":"x",h=this.channelField(r).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),x=new Float64Array(t);for(let b=0;b<t;++b)g[b]=p+b*m,x[b]=f[b]*y;return this.data={numRows:t,columns:{[h]:g,[d]:x}},this}plotSpecs(){let{type:t,data:{numRows:n,columns:r},channels:i,dim:o}=this,s=o==="x"?{y:r.y}:{x:r.x};for(let a of i)s[a.channel]=Qn(a,r);return[{type:t,data:{length:n},options:s}]}};function Bst(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER`,w:q`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER + 1`,w:q`(p - FLOOR(p))${r}`});return pt.from(pt.unionAll(i,o)).select({index:"i",density:Pr("w")}).groupby("index").having(Lh("density",0))}var z0=class extends fo{constructor(t,n){let{type:r="dot",...i}=n;super(r,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:n,extentX:r,extentY:i}=this,[o,s]=t,a=$u(this,"x"),c=$u(this,"y"),[l,u]=r.map(y=>a.apply(y)),[f,d]=i.map(y=>c.apply(y)),h=(u-l)/(o-n),p=(d-f)/(s-n),m=n?0:.5;return this.data=Pst(this.grids,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:{numRows:i,columns:o}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:Qn(a,o)}for(let a in r)r[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function Pst(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=u*f,h=d*e.numRows,p=new Float64Array(h),m=new Float64Array(h),y=new Float64Array(h),g={x:p,y:m,density:y},{density:x,...b}=e.columns;for(let v in b)g[v]=new b[v].constructor(h);let w=0;for(let v=0;v<e.numRows;++v){for(let T in b)g[T].fill(b[T][v],w,w+d);let _=x[v];for(let T=0,A=0;A<f;++A)for(let E=0;E<u;++E,++w,++T)p[w]=s(n+(E+c)*i),m[w]=a(r+(A+c)*o),y[w]=_[T]*l}return{numRows:h,columns:g}}function $st(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(n*y*(1-e),1/n)),g=-ph(t)-ph(n)+ph(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Ust(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Ust(e,t,n){var r=e===0||e===1?0:Math.exp(ph(t+n)-ph(t)-ph(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+n+2)?r*oV(e,t,n)/t:1-r*oV(1-e,n,t)/n}function oV(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function ph(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function sV(e,t){var n=$st(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}function aV(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}var mh=class extends fn{constructor(t,n,r){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=r;super(t,n,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=Ge(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:n,field:r,source:{table:i}}=this,o=n.concat([{field:kh(r),as:"__avg__"},{field:Zn(r),as:"__n__"},{field:Ch(r),as:"__sd__"}]);return L0(o,i).where(t)}queryResult(t){return this.data=Nr(t),this}plotSpecs(){let{type:t,dim:n,detail:r,data:i,ci:o,channels:s}=this,a=Math.SQRT2*aV(o),{columns:{__avg__:c,__sd__:l,__n__:u}}=i,f={[`${n}1`]:c.map((d,h)=>d-a*l[h]/Math.sqrt(u[h])),[`${n}2`]:c.map((d,h)=>d+a*l[h]/Math.sqrt(u[h]))};return r4(t,r,s,i,f)}};var zst="geom",j0=class extends fn{constructor(t,n={},r){!P2(t)&&!n?.geometry&&(n.geometry=Ph(zst)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(i=>JSON.parse(i)))}return this}};var V0=class extends fn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},$2),this.binWidth=Ge(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Nn]&&!n[Nn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,s,a,c=new Set,l={};for(let w of i)if(w.channel!=="orderby"){if(w.channel==="x")s=w;else if(w.channel==="y")a=w;else if(Object.hasOwn(w,"field")){let{as:v,field:_}=w;l[v]=_,_.aggregate||c.add(v)}}let[u,f]=hs(this,t),[d,h]=ps(this,t),p=.5-n.getAttribute("marginLeft"),m=0-n.getAttribute("marginTop"),y=`${r}::DOUBLE`,g=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,x=`${n.innerWidth()/(f-u)}::DOUBLE`,b=`${n.innerHeight()/(h-d)}::DOUBLE`;return pt.select({[s.as]:q`${u}::DOUBLE + ((_x + 0.5 * (_y & 1)) * ${y} + ${p})::DOUBLE / ${x}`,[a.as]:q`${h}::DOUBLE - (_y * ${g} + ${m})::DOUBLE / ${b}`,...l}).groupby("_x","_y",...c).from(pt.select({_py:q`(${b} * (${h}::DOUBLE - ${a.field}) - ${m}) / ${g}`,_pj:q`ROUND(_py)::INTEGER`,_px:q`(${x} * (${s.field} - ${u}::DOUBLE) - ${p}) / ${y} - 0.5 * (_pj & 1)`,_pi:q`ROUND(_px)::INTEGER`,_tt:q`ABS(_py-_pj) * 3 > 1 AND (_px-_pi)**2 + (_py-_pj)**2 > (_px - _pi - 0.5 * CASE WHEN _px < _pi THEN -1 ELSE 1 END)**2 + (_py - _pj - CASE WHEN _py < _pj THEN -1 ELSE 1 END)**2`,_x:q`CASE WHEN _tt THEN (_pi + (CASE WHEN _px < _pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN _pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE _pi END`,_y:q`CASE WHEN _tt THEN (_pj + CASE WHEN _py < _pj THEN -1 ELSE 1 END)::INTEGER ELSE _pj END`},"*").from(o.table).where(Is(s.field),Is(a.field),t))}};var q0=class extends fo{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.image=null,this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=si(this,"x",f,[a,c],r),[m,y]=si(this,"y",d,[l,u],r),g=r?[We(p,[+a,+c]),We(y,[+l,+u])]:[Es(+a,p),Ts(p,+c),Es(+l,y),Ts(y,+u)],x=pt.from(s.table).where(g),b=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:T,channel:A,field:E}=_;E.aggregate?(w[A]=E,o[A]=!0):A==="weight"?w.density=Pr(E):A!=="x"&&A!=="y"&&(x.select({[T]:E}),b.push(T))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push("density"),w.density=Zn()),n==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return Gst(x,h,m,w.density,f,b)}else return Yst(x,h,m,w,f,b)}async requestTiles(){let t=di();this.prefetch&&t.cancel(this.prefetch);let{pad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=hs(this,this._filter),[f,d]=ps(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),y=Math.floor((f-s)*(c-n)/p),g=(I,D)=>[[o+I*h,o+(I+1)*h],[s+D*p,s+(D+1)*p]],x=Math.floor((l-o)/h),b=r?cV((u-o)/h):x,w=Math.floor((f-s)/p),v=i?cV((d-s)/p):w,_=[];for(let I=x;I<=b;++I)for(let D=w;D<=v;++D)_.push([I,D]);let T=_.map(([I,D])=>t.query(this.tileQuery(g(I,D)))),A=[];if(r)for(let I=w;I<=v;++I)A.push([b+1,I]),A.push([x-1,I]);if(i){let I=r?x-1:x,D=r?b+1:b;for(let k=I;k<=D;++k)A.push([k,v+1]),A.push([k,w-1])}this.prefetch=A.map(([I,D])=>t.prefetch(this.tileQuery(g(I,D))));let E=await Promise.all(T),O=jst(a,c,m,y,_,E);this.grids0={numRows:O.length,columns:{density:[O]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=qst(this,r,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=a4(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?z2(m,this.plot.getAttribute("colorDomain")):P0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,r,i,m[y[x]]),u?.(l.data,r,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}};function jst(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,d=u*t-r;Vst(e,t,s,a,f,d)}),s}function Vst(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function qst(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=j2(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function Yst(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Gst(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return pt.from(pt.unionAll(c,l,u,f)).select({index:"i",density:Pr("w")},o).groupby("index",o).having(yl("density",0))}function cV(e){let t=Math.floor(e);return t===e?t-1:t}var Y0=class extends fn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=Ge(r,a=>(this.ci=a,s())),this.precision=Ge(i,a=>(this.precision=a,s()))}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return pt.from(super.query(t)).select({intercept:aI(r,n),slope:cI(r,n),n:lI(r,n),ssy:uI(r,n),ssx:fI(r,n),xm:dI(r,n),x0:ef(fi(n).where(Is(r))),x1:ef(ui(n).where(Is(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Nr(t),this.lineData=Wst(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?Xst(n,t,r,o):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o=t.columns,s=i?n.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of r)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=Qn(l,s);break;case"stroke":a.stroke=Qn(l,o),c.fill=Qn(l,s);break;case"strokeOpacity":a.strokeOpacity=Qn(l,o);break;case"fillOpacity":c.fillOpacity=Qn(l,s);break;default:a[l.channel]=Qn(l,o),c[l.channel]=Qn(l,s);break}return[...i?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function c4(e,t){if(e.concat)return e.concat(t);let n=new e.constructor(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function Wst(e){let{x0:t=[],x1:n=[],xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(h,p)=>i[p]+h*o[p],f=c4(t,n),d=c4(t.map(u),n.map(u));for(let h in l)l[h]=c4(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function Xst(e,t,n,r){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:d,...h}=e.columns,p=Object.keys(h),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=n*(s[y]-o[y])/r,x=sV((1-t)/2,u[y]-2)*Math.sqrt(d[y]/(u[y]-2));qe(o[y],s[y]-g/2,g).concat(s[y]).forEach(b=>{let w=c[y]+b*l[y],v=x*Math.sqrt(1/u[y]+(b-a[y])**2/f[y]);m.x.push(b),m.y1.push(w-v),m.y2.push(w+v),p.forEach(_=>m[_].push(h[_][y]))})}return{numRows:m.x.length,columns:m}}function lV(e){let t=e.toLowerCase(),n=e.length,r="";for(let i=0;i<n;++i)r+=(e[i]!==t[i]?"-":"")+t[i];return r}function yh(e){let t={};for(let n in e)t[lV(n)]=e[n];return t}function Hst(e){let{channels:t}=e,n=new Set,r=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")r=!0;else if(a)if(a.aggregate)i=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&i&&n.size&&e.channels.push({channel:"orderby",value:Array.from(n)}),e}var G0=class{constructor(t,{selection:n,channels:r={}}){this.mark=Hst(t),this.selection=n;let i=Object.entries(yh(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",bh(()=>this.update()))}init(t){this.svg=t;let n=this.values=[],r=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${r}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];n.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:n,channels:r,values:i,mark:o,selection:s}=this;if(!t)return;let a=await Qst(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=l.__data__,d=a(Array.isArray(f)?f[0]:f);for(let h=0;h<r.length;++h){let[p,m]=r[h];l.setAttribute(p,d?u[h]:m)}}}};async function Qst(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:vr(n)},o=e.query(r);(o.queries||[o]).forEach(c=>{c.groupby().length?c.select(i):c.$select(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function l4(e){let t=e.on,n=!0;function r(i){n=!1,i(),n=!0}return e.reset=(...i)=>{r(()=>e.clear(...i))},e.moveSilent=(...i)=>{r(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>n&&o(...s)}return t(...i)},e}function uV(){return l4(LE())}function fV(){return l4(DE())}function dV(){return l4(RE())}function W0(e,t){return e===t||e&&t&&Math.abs(e[0]-t[0])<1e-12&&Math.abs(e[1]-t[1])<1e-12||!1}function ms(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function X0(e,t,n=1){return t.invert(n*Math.floor(e/n))}function V2(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var sl=class{constructor(t,{channel:n,selection:r,field:i=void 0,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||ms(t,n),this.style=a&&yh(a),this.brush=n==="y"?dV():fV(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let n;t&&(n=t.map(r=>X0(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),W0(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return $l(i,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:o,pixelSize:r})}init(t,n){let{brush:r,channel:i,style:o}=this;this.scale=t.scale(i);let s=t.scale("x").range,a=t.scale("y").range;r.extent([[ue(s),ue(a)],[Qt(s),Qt(a)]]);let c=this.value?.map(this.scale.apply).sort(Nt),l=jt(t).selectAll('g[aria-label="facet"]');if(n=l.size()?l:jt(n??t),this.g=n.append("g").attr("class",`interval-${i}`).each(V2).call(r).call(r.moveSilent,c),o){let u=this.g.selectAll("rect.selection");for(let f in o)u.attr(f,o[f])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var H0=class{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=n,this.peers=s,this.xfield=r||ms(t,"x"),this.yfield=i||ms(t,"y"),this.style=a&&yh(a),this.brush=uV(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:n,pixelSize:r,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>X0(u,i,r)).sort(Nt),a=[c[1],l[1]].map(u=>X0(u,o,r)).sort(Nt)}(!W0(s,n?.[0])||!W0(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return GT([i,o],t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ue(s),ue(a)],[Qt(s),Qt(a)]]);let c=jt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:jt(t);if(this.g=l.append("g").attr("class","interval-xy").each(V2).call(n),r){let u=this.g.selectAll("rect.selection");for(let f in r)u.attr(f,r[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort(Nt),[d,h]=this.value[1].map(o.apply).sort(Nt);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var Uu=class{constructor(t,{selection:n,pointer:r,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.pointer=r,this.channels=i||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>ms(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:n,fields:r}=this,i={source:this,clients:n};return r.length>1?Pl(r,t&&[t],i):Bl(r[0],t?.[0],i)}init(t){let n=this,{mark:r,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=r,c=i.map(x=>r.channelField(x).as),l=!$r(o),u=jt(t).selectAll('g[aria-label="facet"]'),f=u.size()?u:jt(t),d=t.scale("x").apply,h=t.scale("y").apply,p=Array.from(a[r.channelField("x").as],d),m=Array.from(a[r.channelField("y").as],h),y=this.pointer==="y"?.01:1,g=this.pointer==="x"?.01:1;f.on("pointerenter pointerdown pointermove",function(x){let[b,w]=zn(x,this),v=Zst(p,m,b,w,y,g,s);if(v!==this.valueIndex){this.valueIndex=v;let _=v<0?void 0:c.map(T=>a[T][v]);o.update(l?!_||_.length>1?_:_[0]:n.clause(_))}}),!l&&(f.on("pointerleave",()=>{o.update(n.clause(void 0))}),t.addEventListener("pointerenter",x=>{if(!x.buttons){let b=this.channels.map(()=>0);o.activate(this.clause(b))}}))}};function Zst(e,t,n,r,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-n),f=o*(t[l]-r),d=u*u+f*f;d<=a&&(a=d,c=l)}return c}var hV=(e,t)=>e-t,Q0=class{constructor(t,{x:n=new bo,y:r=new bo,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||ms(t,"x"),this.yfield=o||ms(t,"y"),this.zoom=u4(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let n=Kst(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=Jst(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return $l(n,t,{source:this,clients:this.mark.plot.markSet,scale:r})}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(hV),c=this.yscale.range.slice().sort(hV),l=u4(n,[-1/0,1/0],a),u=u4(r,[-1/0,1/0],c),f=QM().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new Jr(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(jt(i).call(f),n||r){let d=!1;i.addEventListener("pointerenter",h=>{if(!d&&(d=!0,!h.buttons)){if(n){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(r){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>d=!1)}}};function u4(e,t,n){return e?Array.isArray(e)?e:t:n}function Kst(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function Jst(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var zu=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i;let o=this.fields=[],s=this.as=[];r.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:n,mark:r}=this;return Pl(n,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}init(t,n,r){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;r??=l=>o.map(u=>{let f=l.__data__;return a[u][Array.isArray(f)?f[0]:f]}),n??=`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(tat(c,f)){let h=r(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>f4(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!f4(u[0],h)?d=null:d=[h]}this.value=d,eat(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function tat(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function eat(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>f4(n,t[r]))}function f4(e,t){let n=e.length;if(t.length!==n)return!0;for(let r=0;r<n;++r)if(e[r]!==t[r])return!0;return!1}var mV=":scope > div, :scope > span",q2="swatch",pV="ramp",gh=class{constructor(t,n){let{as:r,field:i,...o}=n;this.channel=t,this.options=o,this.type=null,this.handler=null,this.selection=r,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let n=nat(this,t);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;let{selection:t,handler:n}=this,{single:r,value:i}=t,o=r?i:t.valueFor(n),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(mV);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function nat(e,t){let{channel:n,plot:r,selection:i}=e,o=t.scale(n),s=o.type==="ordinal"?q2:pV,a={label:r.getAttribute(`${n}Label`)??null,...e.options},c=s===q2?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},l=t.legend(n,c);e.legend=l;let u=!!i;if(u&&s===pV){let f=c.width??240,d=sat(o,f);d?l.scale=function(h){return h==="x"?{range:[0,f]}:h==="y"?{range:[-10,0]}:h===n?d:void 0}:u=!1}if(u){let f=rat(e,s);s===q2?(f.init(l,mV,d=>[d.__data__]),e.update()):f.init(l,l.querySelector("g:last-of-type"))}return l}function rat(e,t){let{channel:n,handler:r,selection:i}=e;if(r)return r;let o=iat(e);return t===q2?(e.handler=new zu(o,{selection:i,channels:[n],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new sl(o,{selection:i,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function iat(e){let{channel:t,plot:n}=e,r=e.field??oat(n.marks,t)??"value";if(r){let i={field:r};return{plot:n,channelField:o=>t===o?i:void 0}}}function oat(e,t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)for(let i of n){let o=e[r].channelField(i,{exact:!0});if(o)return o.field}return null}function sat(e,t){let{apply:n,invert:r,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return $c({x:{...o,type:a,range:[0,t]}})}function Y2(e,t,n=0,r=Math.LN10){let i,o=Math.ceil(Math.log(t)/r),s=Math.max(n,Math.pow(10,Math.round(Math.log(e)/r)-o));for(;Math.ceil(e/s)>t;)s*=10;let a=[5,2];for(let c=0,l=a.length;c<l;++c)i=s/a[c],i>=n&&e/i<=t&&(s=i);return s}function yV(e,t,n){let{step:r,steps:i,minstep:o=0,nice:s=!0}=n;if(s!==!1){let a=t-e,c=Math.LN10;r=r||Y2(a,i||25,o,c);let l=Math.log(r),u=l>=0?0:~~(-l/c)+1,f=Math.pow(10,-u-1);l=Math.floor(e/r+f)*r,e=e<l?l-r:l,t=Math.ceil(t/r)*r,i=Math.round((t-e)/r)}return{min:e,max:t,steps:i}}var wV="year",gV="month",xV="day",G2="hour",W2="minute",X2="second",aat="millisecond",K0=1e3,J0=K0*60,tg=J0*60,H2=tg*24,cat=H2*7,bV=H2*30,_V=H2*365,Z0=[[X2,1,K0],[X2,5,5*K0],[X2,15,15*K0],[X2,30,30*K0],[W2,1,J0],[W2,5,5*J0],[W2,15,15*J0],[W2,30,30*J0],[G2,1,tg],[G2,3,3*tg],[G2,6,6*tg],[G2,12,12*tg],[xV,1,H2],[xV,7,cat],[gV,1,bV],[gV,3,3*bV],[wV,1,_V]];function vV(e,t,n){let r=t-e,i=r/n,o=eo(s=>s[2]).right(Z0,i);return o===Z0.length?{interval:wV,step:Y2(r/_V,n)}:o?(o=Z0[i/Z0[o-1][2]<Z0[o][2]/i?o-1:o],{interval:o[0],step:o[1]}):{interval:aat,step:Y2(r,n,1)}}var lat=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function uat(e,t){return lat.has(`${e.type}-${t}`)}function Q2(e,t={}){let n=(r,i)=>uat(r,i)?{[`${i}1`]:d4(r,i,e,t),[`${i}2`]:d4(r,i,e,{...t,offset:1})}:{[i]:d4(r,i,e,t)};return n[Yp]=!0,n}function d4(e,t,n,r){return{column:n,label:n,get columns(){return[n]},get basis(){return n},get stats(){return{column:n,stats:["min","max"]}},toString(){let{type:i,min:o,max:s}=e.channelField(t),{interval:a,steps:c,offset:l=0}=r,u=a??(i==="date"||fat(e,t)?"date":"number");if(u==="number"){let{apply:f,sqlApply:d,sqlInvert:h}=$u(e,t),p=yV(f(o),f(s),r),m=d(n),y=p.min===0?m:`(${m} - ${p.min})`,g=`${(p.max-p.min)/p.steps}::DOUBLE`,x=l?`${l} + `:"",b=`${p.min} + ${g} * (${x}FLOOR(${y} / ${g}))`;return`${h(b)}`}else{let{interval:f,step:d=1}=u==="date"?vV(o,s,c||40):r,h=l?` + INTERVAL ${l*d} ${f}`:"";return`(${bI(n,f,d)}${h})`}}}}function fat(e,t){let n=e.plot.getAttribute(`${t}Scale`);return n==="utc"||n==="time"}var dat=e=>e&&typeof e=="object"&&!Array.isArray(e);var eg=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=f=>f,options:a,value:c,field:l=i,as:u}={}){super(n),this.from=r,this.column=i,this.format=s,this.field=l;let f=this.selection=u;this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let d=document.createElement("label");if(d.innerText=o||i,this.element.appendChild(d),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(h=>dat(h)?h:{value:h}),this.selectedValue(c??""),this.update()),f){let h=!$r(f);c!=null&&(!h||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),h&&this.selection.addEventListener("value",p=>{p!==this.select.value&&this.selectedValue(p)})}}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,field:r}=this;if($r(n)){t===""&&(t=void 0);let i=Bl(r,t,{source:this});n.update(i)}else Sr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?pt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r,selection:i}=this;r.replaceChildren();for(let{value:o,label:s}of t){let a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??n(o),this.select.appendChild(a)}if(i){let o=$r(i)?i.valueFor(this):i.value;this.selectedValue(o??"")}return this}};var hat=0;var ng=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(n),this.id="search_"+ ++hat,this.type=s,this.from=r,this.column=i,this.selection=c,this.field=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),o){let l=document.createElement("label");l.setAttribute("for",this.id),l.innerText=o,this.element.appendChild(l)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),$r(this.selection)||this.selection.addEventListener("value",l=>{l!==this.searchbox.value&&(this.searchbox.value=l)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,field:r,type:i}=this;if($r(n)){let o=WT(r,t,{source:this,method:i});n.update(o)}else Sr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?pt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(let r of this.data){let i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}};var pat=0;var rg=class extends xr{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,select:f="point",field:d=c,width:h}={}){if(super(n),this.id="slider_"+ ++pat,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=f,this.field=d,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),l){let p=document.createElement("label");p.setAttribute("for",this.id),p.innerText=l,this.element.appendChild(p)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),h!=null&&(this.slider.style.width=`${+h}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:p}=this.slider;this.curval.innerText=p,this.selection&&this.publish(+p)}),this.selection&&!$r(this.selection)&&this.selection.addEventListener("value",p=>{p!==+this.slider.value&&(this.slider.value=p,this.curval.innerText=p)})}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:pt.select({min:fi(r),max:ui(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&(this.min=n,this.slider.setAttribute("min",`${n}`)),this.max==null&&(this.max=r,this.slider.setAttribute("max",`${r}`)),this.step==null&&(this.step=(r-n)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(t){let{field:n,selectionType:r,selection:i}=this;if($r(i))if(r==="interval"){let o=[this.min??0,t];i.update($l(n,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step}))}else i.update(Bl(n,t,{source:this}));else Sr(this.selection)&&i.update(t)}};var p4=SV(e=>{let t=Z2(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?m4(n):`${n}`}),Z2=SV(e=>t=>t===0?"0":t.toLocaleString(e)),Fte=p4(),kte=Z2();function m4(e){return vd(e,"Invalid Date")}function SV(e){let t=null,n;return(r="en")=>r===t?n:n=e(t=r)}var mat=-1;var ig=class extends xr{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100,as:f}={}){super(n),this.id=`table-${++mat}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.selection=f,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let d=-1;this.element.addEventListener("scroll",h=>{let{pending:p,loaded:m}=this,{scrollHeight:y,scrollTop:g,clientHeight:x}=h.target,b=g<d;d=g,!(b||p||m)&&y-g<2*x&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",h=>{let p=yat(h.target);p>-1&&p!==this.currentRow&&(this.currentRow=p,this.selection.update(this.clause([p])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}clause(t=[]){let{data:n,limit:r,schema:i}=this,o=i.map(a=>a.column),s=t.map(a=>{let{columns:c}=n[~~(a/r)];return o.map(l=>c[l][a%r])});return Pl(o,s,{source:this})}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),di().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Va(this.from,t))}fieldInfo(t){this.schema=t;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),r.appendChild(o)}return n.appendChild(r),this.formats=gat(this.format,t),this.style.innerText=wat(this.id,xat(this.align,t),bat(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return pt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?TS(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Nr(t)),this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=r.length-1,c=o*a,{numRows:l,columns:u}=r[a],f=i.map(d=>u[d.column]);for(let d=0;d<l;++d){let h=document.createElement("tr");Object.assign(h,{__row__:c+d});for(let p=0;p<s;++p){let m=f[p][d],y=document.createElement("td");y.innerText=m==null?"":n[p](m),h.appendChild(y)}t.appendChild(h)}return l<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function yat(e){let t=e.parentElement;return Object.hasOwn(t,"__row__")?+t.__row__:-1}function gat(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return Z2(n);case"date":return m4;default:return p4(n)}})}function xat(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function bat(e={},t){return t.map(({column:n})=>e[n])}function wat(e,t,n){let r=[];return t.forEach((i,o)=>{let s=+n[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),r.join(" ")}function og(e,...t){let n=e?.context?.coordinator??di();for(let r of t)n.connect(r)}function K2(e,t,n){let r=new t(n);return og(e,r),r.element}function IV(e){return K2(this,eg,e)}function TV(e){return K2(this,ng,e)}function EV(e){return K2(this,rg,e)}function AV(e){return K2(this,ig,e)}function MV({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),Object.assign(r,{value:{element:r}}),r}function OV(...e){return MV({direction:"vertical"},e.flat())}function NV(...e){return MV({direction:"horizontal"},e.flat())}function DV({dim:e="width",size:t=10}){let n=document.createElement("span");return n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(n,{value:{element:n}})}function RV(e){return DV({dim:"height",size:e})}function LV(e){return DV({dim:"width",size:e})}var CV={};kr(CV,{align:()=>N4,aspectRatio:()=>D4,axis:()=>R4,colorBase:()=>bD,colorClamp:()=>aD,colorConstant:()=>_D,colorDomain:()=>oD,colorExponent:()=>wD,colorInterpolate:()=>fD,colorLabel:()=>pD,colorN:()=>cD,colorNice:()=>lD,colorPercent:()=>mD,colorPivot:()=>dD,colorRange:()=>sD,colorReverse:()=>yD,colorScale:()=>iD,colorScheme:()=>uD,colorSymmetric:()=>hD,colorTickFormat:()=>xD,colorZero:()=>gD,facetGrid:()=>iN,facetLabel:()=>oN,facetMargin:()=>JO,facetMarginBottom:()=>eN,facetMarginLeft:()=>nN,facetMarginRight:()=>rN,facetMarginTop:()=>tN,fxAlign:()=>dN,fxAriaDescription:()=>NN,fxAriaLabel:()=>ON,fxAxis:()=>yN,fxDomain:()=>sN,fxFontVariant:()=>MN,fxGrid:()=>SN,fxInset:()=>cN,fxInsetLeft:()=>lN,fxInsetRight:()=>uN,fxLabel:()=>TN,fxLabelAnchor:()=>EN,fxLabelOffset:()=>AN,fxLine:()=>IN,fxPadding:()=>hN,fxPaddingInner:()=>pN,fxPaddingOuter:()=>mN,fxRange:()=>aN,fxReverse:()=>DN,fxRound:()=>fN,fxTickFormat:()=>_N,fxTickPadding:()=>wN,fxTickRotate:()=>vN,fxTickSize:()=>xN,fxTickSpacing:()=>bN,fxTicks:()=>gN,fyAlign:()=>PN,fyAriaDescription:()=>nD,fyAriaLabel:()=>eD,fyAxis:()=>jN,fyDomain:()=>RN,fyFontVariant:()=>tD,fyGrid:()=>HN,fyInset:()=>FN,fyInsetBottom:()=>CN,fyInsetTop:()=>kN,fyLabel:()=>ZN,fyLabelAnchor:()=>KN,fyLabelOffset:()=>JN,fyLine:()=>QN,fyPadding:()=>$N,fyPaddingInner:()=>UN,fyPaddingOuter:()=>zN,fyRange:()=>LN,fyReverse:()=>rD,fyRound:()=>BN,fyTickFormat:()=>WN,fyTickPadding:()=>GN,fyTickRotate:()=>XN,fyTickSize:()=>qN,fyTickSpacing:()=>YN,fyTicks:()=>VN,grid:()=>F4,height:()=>T4,inset:()=>L4,label:()=>k4,lengthBase:()=>n8,lengthClamp:()=>KD,lengthConstant:()=>i8,lengthDomain:()=>QD,lengthExponent:()=>r8,lengthNice:()=>JD,lengthPercent:()=>t8,lengthRange:()=>ZD,lengthScale:()=>HD,lengthZero:()=>e8,margin:()=>_4,marginBottom:()=>O4,marginLeft:()=>E4,marginRight:()=>A4,marginTop:()=>M4,margins:()=>w4,name:()=>x4,opacityBase:()=>RD,opacityClamp:()=>TD,opacityConstant:()=>FD,opacityDomain:()=>SD,opacityExponent:()=>LD,opacityLabel:()=>AD,opacityNice:()=>ED,opacityPercent:()=>MD,opacityRange:()=>ID,opacityReverse:()=>OD,opacityScale:()=>vD,opacityTickFormat:()=>DD,opacityZero:()=>ND,padding:()=>C4,projectionClip:()=>m8,projectionDomain:()=>l8,projectionInset:()=>u8,projectionInsetBottom:()=>p8,projectionInsetLeft:()=>f8,projectionInsetRight:()=>d8,projectionInsetTop:()=>h8,projectionParallels:()=>s8,projectionPrecision:()=>a8,projectionRotate:()=>c8,projectionType:()=>o8,rBase:()=>GD,rClamp:()=>zD,rConstant:()=>XD,rDomain:()=>$D,rExponent:()=>WD,rLabel:()=>VD,rNice:()=>jD,rPercent:()=>qD,rRange:()=>UD,rScale:()=>PD,rZero:()=>YD,style:()=>S4,symbolDomain:()=>CD,symbolRange:()=>BD,symbolScale:()=>kD,width:()=>I4,xAlign:()=>G4,xAriaDescription:()=>fO,xAriaLabel:()=>uO,xAxis:()=>Q4,xBase:()=>mO,xClamp:()=>q4,xConstant:()=>gO,xDomain:()=>P4,xExponent:()=>yO,xFontVariant:()=>lO,xGrid:()=>rO,xInset:()=>z4,xInsetLeft:()=>j4,xInsetRight:()=>V4,xLabel:()=>oO,xLabelAnchor:()=>sO,xLabelArrow:()=>aO,xLabelOffset:()=>cO,xLine:()=>iO,xNice:()=>U4,xPadding:()=>W4,xPaddingInner:()=>X4,xPaddingOuter:()=>H4,xPercent:()=>dO,xRange:()=>$4,xReverse:()=>hO,xRound:()=>Y4,xScale:()=>B4,xTickFormat:()=>eO,xTickPadding:()=>tO,xTickRotate:()=>nO,xTickSize:()=>K4,xTickSpacing:()=>J4,xTicks:()=>Z4,xZero:()=>pO,xyDomain:()=>v4,yAlign:()=>AO,yAriaDescription:()=>GO,yAriaLabel:()=>YO,yAxis:()=>DO,yBase:()=>QO,yClamp:()=>TO,yConstant:()=>KO,yDomain:()=>bO,yExponent:()=>ZO,yFontVariant:()=>qO,yGrid:()=>PO,yInset:()=>vO,yInsetBottom:()=>IO,yInsetTop:()=>SO,yLabel:()=>UO,yLabelAnchor:()=>zO,yLabelArrow:()=>jO,yLabelOffset:()=>VO,yLine:()=>$O,yNice:()=>_O,yPadding:()=>MO,yPaddingInner:()=>OO,yPaddingOuter:()=>NO,yPercent:()=>WO,yRange:()=>wO,yReverse:()=>XO,yRound:()=>EO,yScale:()=>xO,yTickFormat:()=>CO,yTickPadding:()=>kO,yTickRotate:()=>BO,yTickSize:()=>LO,yTickSpacing:()=>FO,yTicks:()=>RO,yZero:()=>HO});var sg=class extends Map{request(t,n){if(this.has(t))n(this.get(t));else{let r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}clear(){return this.waiting?.clear(),super.clear()}},y4=new sg;function g4(e,t,n){(e?.context?.namedPlots??y4).request(t,n)}function FV(e,t,n){(e?.context?.namedPlots??y4).set(t,n)}function x4(e){return t=>FV(this,e,t)}function kV(e,t,n){Sr(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function _at(e,t){return n=>{kV(n,e,t)}}function b4(e){return t=>{for(let[n,r]of Object.entries(e))kV(t,n,r)}}function w4(e){let{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),b4(o)}function _4(e){return b4({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function v4(e){return b4({xDomain:e,yDomain:e})}var F=e=>t=>_at(e,t),S4=F("style"),I4=F("width"),T4=F("height"),E4=F("marginLeft"),A4=F("marginRight"),M4=F("marginTop"),O4=F("marginBottom"),N4=F("align"),D4=F("aspectRatio"),R4=F("axis"),L4=F("inset"),F4=F("grid"),k4=F("label"),C4=F("padding"),B4=F("xScale"),P4=F("xDomain"),$4=F("xRange"),U4=F("xNice"),z4=F("xInset"),j4=F("xInsetLeft"),V4=F("xInsetRight"),q4=F("xClamp"),Y4=F("xRound"),G4=F("xAlign"),W4=F("xPadding"),X4=F("xPaddingInner"),H4=F("xPaddingOuter"),Q4=F("xAxis"),Z4=F("xTicks"),K4=F("xTickSize"),J4=F("xTickSpacing"),tO=F("xTickPadding"),eO=F("xTickFormat"),nO=F("xTickRotate"),rO=F("xGrid"),iO=F("xLine"),oO=F("xLabel"),sO=F("xLabelAnchor"),aO=F("xLabelArrow"),cO=F("xLabelOffset"),lO=F("xFontVariant"),uO=F("xAriaLabel"),fO=F("xAriaDescription"),dO=F("xPercent"),hO=F("xReverse"),pO=F("xZero"),mO=F("xBase"),yO=F("xExponent"),gO=F("xConstant"),xO=F("yScale"),bO=F("yDomain"),wO=F("yRange"),_O=F("yNice"),vO=F("yInset"),SO=F("yInsetTop"),IO=F("yInsetBottom"),TO=F("yClamp"),EO=F("yRound"),AO=F("yAlign"),MO=F("yPadding"),OO=F("yPaddingInner"),NO=F("yPaddingOuter"),DO=F("yAxis"),RO=F("yTicks"),LO=F("yTickSize"),FO=F("yTickSpacing"),kO=F("yTickPadding"),CO=F("yTickFormat"),BO=F("yTickRotate"),PO=F("yGrid"),$O=F("yLine"),UO=F("yLabel"),zO=F("yLabelAnchor"),jO=F("yLabelArrow"),VO=F("yLabelOffset"),qO=F("yFontVariant"),YO=F("yAriaLabel"),GO=F("yAriaDescription"),WO=F("yPercent"),XO=F("yReverse"),HO=F("yZero"),QO=F("yBase"),ZO=F("yExponent"),KO=F("yConstant"),JO=F("facetMargin"),tN=F("facetMarginTop"),eN=F("facetMarginBottom"),nN=F("facetMarginLeft"),rN=F("facetMarginRight"),iN=F("facetGrid"),oN=F("facetLabel"),sN=F("fxDomain"),aN=F("fxRange"),cN=F("fxInset"),lN=F("fxInsetLeft"),uN=F("fxInsetRight"),fN=F("fxRound"),dN=F("fxAlign"),hN=F("fxPadding"),pN=F("fxPaddingInner"),mN=F("fxPaddingOuter"),yN=F("fxAxis"),gN=F("fxTicks"),xN=F("fxTickSize"),bN=F("fxTickSpacing"),wN=F("fxTickPadding"),_N=F("fxTickFormat"),vN=F("fxTickRotate"),SN=F("fxGrid"),IN=F("fxLine"),TN=F("fxLabel"),EN=F("fxLabelAnchor"),AN=F("fxLabelOffset"),MN=F("fxFontVariant"),ON=F("fxAriaLabel"),NN=F("fxAriaDescription"),DN=F("fxReverse"),RN=F("fyDomain"),LN=F("fyRange"),FN=F("fyInset"),kN=F("fyInsetTop"),CN=F("fyInsetBottom"),BN=F("fyRound"),PN=F("fyAlign"),$N=F("fyPadding"),UN=F("fyPaddingInner"),zN=F("fyPaddingOuter"),jN=F("fyAxis"),VN=F("fyTicks"),qN=F("fyTickSize"),YN=F("fyTickSpacing"),GN=F("fyTickPadding"),WN=F("fyTickFormat"),XN=F("fyTickRotate"),HN=F("fyGrid"),QN=F("fyLine"),ZN=F("fyLabel"),KN=F("fyLabelAnchor"),JN=F("fyLabelOffset"),tD=F("fyFontVariant"),eD=F("fyAriaLabel"),nD=F("fyAriaDescription"),rD=F("fyReverse"),iD=F("colorScale"),oD=F("colorDomain"),sD=F("colorRange"),aD=F("colorClamp"),cD=F("colorN"),lD=F("colorNice"),uD=F("colorScheme"),fD=F("colorInterpolate"),dD=F("colorPivot"),hD=F("colorSymmetric"),pD=F("colorLabel"),mD=F("colorPercent"),yD=F("colorReverse"),gD=F("colorZero"),xD=F("colorTickFormat"),bD=F("colorBase"),wD=F("colorExponent"),_D=F("colorConstant"),vD=F("opacityScale"),SD=F("opacityDomain"),ID=F("opacityRange"),TD=F("opacityClamp"),ED=F("opacityNice"),AD=F("opacityLabel"),MD=F("opacityPercent"),OD=F("opacityReverse"),ND=F("opacityZero"),DD=F("opacityTickFormat"),RD=F("opacityBase"),LD=F("opacityExponent"),FD=F("opacityConstant"),kD=F("symbolScale"),CD=F("symbolDomain"),BD=F("symbolRange"),PD=F("rScale"),$D=F("rDomain"),UD=F("rRange"),zD=F("rClamp"),jD=F("rNice"),VD=F("rLabel"),qD=F("rPercent"),YD=F("rZero"),GD=F("rBase"),WD=F("rExponent"),XD=F("rConstant"),HD=F("lengthScale"),QD=F("lengthDomain"),ZD=F("lengthRange"),KD=F("lengthClamp"),JD=F("lengthNice"),t8=F("lengthPercent"),e8=F("lengthZero"),n8=F("lengthBase"),r8=F("lengthExponent"),i8=F("lengthConstant"),o8=F("projectionType"),s8=F("projectionParallels"),a8=F("projectionPrecision"),c8=F("projectionRotate"),l8=F("projectionDomain"),u8=F("projectionInset"),f8=F("projectionInsetLeft"),d8=F("projectionInsetRight"),h8=F("projectionInsetTop"),p8=F("projectionInsetBottom"),m8=F("projectionClip");function BV(e,t){return{table:e,options:t}}var PV={};kr(PV,{area:()=>y8,areaX:()=>g8,areaY:()=>x8,arrow:()=>fR,axisFx:()=>yR,axisFy:()=>gR,axisX:()=>pR,axisY:()=>mR,barX:()=>v8,barY:()=>S8,cell:()=>I8,cellX:()=>T8,cellY:()=>E8,circle:()=>L8,contour:()=>Z8,delaunayLink:()=>cR,delaunayMesh:()=>lR,denseLine:()=>Q8,density:()=>H8,densityX:()=>W8,densityY:()=>X8,dot:()=>N8,dotX:()=>D8,dotY:()=>R8,errorbarX:()=>iR,errorbarY:()=>oR,frame:()=>hR,geo:()=>vR,graticule:()=>IR,gridFx:()=>wR,gridFy:()=>_R,gridX:()=>xR,gridY:()=>bR,heatmap:()=>K8,hexagon:()=>F8,hexbin:()=>eR,hexgrid:()=>nR,hull:()=>uR,image:()=>G8,line:()=>b8,lineX:()=>w8,lineY:()=>_8,link:()=>dR,raster:()=>J8,rasterTile:()=>tR,rect:()=>A8,rectX:()=>M8,rectY:()=>O8,regressionY:()=>rR,ruleX:()=>P8,ruleY:()=>$8,sphere:()=>SR,spike:()=>Y8,text:()=>k8,textX:()=>C8,textY:()=>B8,tickX:()=>U8,tickY:()=>z8,vector:()=>j8,vectorX:()=>V8,vectorY:()=>q8,voronoi:()=>sR,voronoiMesh:()=>aR});var vat=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function Tt(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=vat.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?F0:fn;return J2(r,e,t,n)}function J2(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function ys(e,t,n){return r=>{r.addMark(new e(t,n))}}var y8=(...e)=>Tt("area",...e),g8=(...e)=>Tt("areaX",...e),x8=(...e)=>Tt("areaY",...e),b8=(...e)=>Tt("line",...e),w8=(...e)=>Tt("lineX",...e),_8=(...e)=>Tt("lineY",...e),v8=(...e)=>Tt("barX",...e),S8=(...e)=>Tt("barY",...e),I8=(...e)=>Tt("cell",...e),T8=(...e)=>Tt("cellX",...e),E8=(...e)=>Tt("cellY",...e),A8=(...e)=>Tt("rect",...e),M8=(...e)=>Tt("rectX",...e),O8=(...e)=>Tt("rectY",...e),N8=(...e)=>Tt("dot",...e),D8=(...e)=>Tt("dotX",...e),R8=(...e)=>Tt("dotY",...e),L8=(...e)=>Tt("circle",...e),F8=(...e)=>Tt("hexagon",...e),k8=(...e)=>Tt("text",...e),C8=(...e)=>Tt("textX",...e),B8=(...e)=>Tt("textY",...e),P8=(...e)=>Tt("ruleX",...e),$8=(...e)=>Tt("ruleY",...e),U8=(...e)=>Tt("tickX",...e),z8=(...e)=>Tt("tickY",...e),j8=(...e)=>Tt("vector",...e),V8=(...e)=>Tt("vectoX",...e),q8=(...e)=>Tt("vectorY",...e),Y8=(...e)=>Tt("spike",...e),G8=(...e)=>Tt("image",...e),W8=(...e)=>J2(hh,"areaX",...e),X8=(...e)=>J2(hh,"areaY",...e),H8=(...e)=>ys(z0,...e),Q8=(...e)=>ys(U0,...e),Z8=(...e)=>ys(B0,...e),K8=(...e)=>ys($0,...e),J8=(...e)=>ys(ol,...e),tR=(...e)=>ys(q0,...e),eR=(...e)=>ys(V0,...e),nR=(...e)=>Tt("hexgrid",...e),rR=(...e)=>ys(Y0,...e),iR=(...e)=>J2(mh,"ruleY",...e),oR=(...e)=>ys(mh,"ruleX",...e),sR=(...e)=>Tt("voronoi",...e),aR=(...e)=>Tt("voronoiMesh",...e),cR=(...e)=>Tt("delaunayLink",...e),lR=(...e)=>Tt("delaunayMesh",...e),uR=(...e)=>Tt("hull",...e),fR=(...e)=>Tt("arrow",...e),dR=(...e)=>Tt("link",...e),hR=(...e)=>Tt("frame",...e),pR=(...e)=>Tt("axisX",...e),mR=(...e)=>Tt("axisY",...e),yR=(...e)=>Tt("axisFx",...e),gR=(...e)=>Tt("axisFy",...e),xR=(...e)=>Tt("gridX",...e),bR=(...e)=>Tt("gridY",...e),wR=(...e)=>Tt("gridFx",...e),_R=(...e)=>Tt("gridFy",...e),vR=(...e)=>ys(j0,...e),SR=(...e)=>Tt("sphere",...e),IR=(...e)=>Tt("graticule",...e);var $V={};kr($V,{highlight:()=>TR,intervalX:()=>LR,intervalXY:()=>kR,intervalY:()=>FR,nearest:()=>NR,nearestX:()=>DR,nearestY:()=>RR,pan:()=>CR,panX:()=>BR,panY:()=>PR,panZoom:()=>$R,panZoomX:()=>UR,panZoomY:()=>zR,toggle:()=>ju,toggleColor:()=>OR,toggleX:()=>ER,toggleY:()=>AR,toggleZ:()=>MR});function Ba(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function TR({by:e,...t}){return Ba(G0,{selection:e,channels:t})}function ju({as:e,...t}){return Ba(zu,{...t,selection:e})}function ER(e){return ju({...e,channels:["x"]})}function AR(e){return ju({...e,channels:["y"]})}function MR(e){return ju({...e,channels:["z"]})}function OR(e){return ju({...e,channels:["color"]})}function NR({as:e,...t}){return Ba(Uu,{...t,selection:e,pointer:"xy"})}function DR({as:e,...t}){return Ba(Uu,{...t,selection:e,pointer:"x"})}function RR({as:e,...t}){return Ba(Uu,{...t,selection:e,pointer:"y"})}function LR({as:e,...t}){return Ba(sl,{...t,selection:e,channel:"x"})}function FR({as:e,...t}){return Ba(sl,{...t,selection:e,channel:"y"})}function kR({as:e,...t}){return Ba(H0,{...t,selection:e})}function xh(e){return Ba(Q0,e)}function CR(e={}){return xh({...e,zoom:!1})}function BR(e={}){return xh({...e,zoom:!1,pany:!1})}function PR(e={}){return xh({...e,zoom:!1,panx:!1})}function $R(e={}){return xh(e)}function UR(e={}){return xh({...e,pany:!1})}function zR(e={}){return xh({...e,panx:!1})}var UV={};kr(UV,{colorLegend:()=>VR,opacityLegend:()=>qR,symbolLegend:()=>YR});function jR(e,t={}){if(t.for){let{for:n,...r}=t,i=new gh(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?g4(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new gh(e,t))}function VR(e){return jR.call(this,"color",e)}function qR(e){return jR.call(this,"opacity",e)}function YR(e){return jR.call(this,"symbol",e)}function zV(...e){let t=new R0;return e.flat().forEach(n=>n(t)),og(this,...t.marks),t.update(),t.element}function Sat({coordinator:e=di(),namedPlots:t=new sg,extensions:n=null,...r}={}){return{...GR,...n,context:{coordinator:e,namedPlots:t,...r}}}export{Vh as Coordinator,Ro as Fixed,xr as MosaicClient,Ga as Param,pt as Query,bo as Selection,Vt as agg,N4 as align,vr as and,y8 as area,g8 as areaX,x8 as areaY,tf as argmax,Ju as argmin,yI as arrayAgg,fR as arrow,D4 as aspectRatio,CV as attributeDirectives,kh as avg,R4 as axis,yR as axisFx,gR as axisFy,pR as axisX,mR as axisY,v8 as barX,S8 as barY,Q2 as bin,Bh as cast,ef as castDouble,gI as castInteger,I8 as cell,T8 as cellX,E8 as cellY,$h as centroid,SI as centroidX,II as centroidY,L8 as circle,bD as colorBase,aD as colorClamp,_D as colorConstant,oD as colorDomain,wD as colorExponent,fD as colorInterpolate,pD as colorLabel,VR as colorLegend,cD as colorN,lD as colorNice,mD as colorPercent,dD as colorPivot,sD as colorRange,yD as colorReverse,iD as colorScale,uD as colorScheme,hD as colorSymmetric,xD as colorTickFormat,gD as colorZero,Va as column,og as connect,Z8 as contour,di as coordinator,iI as corr,Zn as count,sI as covarPop,oI as covariance,Ya as create,Sat as createAPIContext,$S as cume_dist,vI as dateDay,wI as dateMonth,_I as dateMonthDay,cR as delaunayLink,lR as delaunayMesh,Q8 as denseLine,BS as dense_rank,H8 as density,W8 as densityX,X8 as densityY,N8 as dot,D8 as dotX,R8 as dotY,eI as entropy,AS as eq,iR as errorbarX,oR as errorbarY,iN as facetGrid,oN as facetLabel,JO as facetMargin,eN as facetMarginBottom,nN as facetMarginLeft,rN as facetMarginRight,tN as facetMarginTop,hI as first,VS as first_value,hR as frame,BV as from,dN as fxAlign,NN as fxAriaDescription,ON as fxAriaLabel,yN as fxAxis,sN as fxDomain,MN as fxFontVariant,SN as fxGrid,cN as fxInset,lN as fxInsetLeft,uN as fxInsetRight,TN as fxLabel,EN as fxLabelAnchor,AN as fxLabelOffset,IN as fxLine,hN as fxPadding,pN as fxPaddingInner,mN as fxPaddingOuter,aN as fxRange,DN as fxReverse,fN as fxRound,_N as fxTickFormat,wN as fxTickPadding,vN as fxTickRotate,xN as fxTickSize,bN as fxTickSpacing,gN as fxTicks,PN as fyAlign,nD as fyAriaDescription,eD as fyAriaLabel,jN as fyAxis,RN as fyDomain,tD as fyFontVariant,HN as fyGrid,FN as fyInset,CN as fyInsetBottom,kN as fyInsetTop,ZN as fyLabel,KN as fyLabelAnchor,JN as fyLabelOffset,QN as fyLine,$N as fyPadding,UN as fyPaddingInner,zN as fyPaddingOuter,LN as fyRange,rD as fyReverse,BN as fyRound,WN as fyTickFormat,GN as fyTickPadding,XN as fyTickRotate,qN as fyTickSize,YN as fyTickSpacing,VN as fyTicks,vR as geo,Ph as geojson,IR as graticule,F4 as grid,wR as gridFx,_R as gridFy,xR as gridX,bR as gridY,Lh as gt,MS as gte,NV as hconcat,K8 as heatmap,T4 as height,F8 as hexagon,eR as hexbin,nR as hexgrid,TR as highlight,LV as hspace,uR as hull,G8 as image,L4 as inset,$V as interactorDirectives,LR as intervalX,kR as intervalXY,FR as intervalY,We as isBetween,OS as isDistinct,NS as isNotBetween,Ku as isNotDistinct,Is as isNotNull,ml as isNull,tI as kurtosis,k4 as label,zS as lag,pI as last,qS as last_value,jS as lead,UV as legendDirectives,n8 as lengthBase,KD as lengthClamp,i8 as lengthConstant,QD as lengthDomain,r8 as lengthExponent,JD as lengthNice,t8 as lengthPercent,ZD as lengthRange,HD as lengthScale,e8 as lengthZero,b8 as line,w8 as lineX,_8 as lineY,dR as link,hl as literal,MI as loadCSV,EI as loadExtension,OI as loadJSON,RI as loadObjects,NI as loadParquet,DI as loadSpatial,Ts as lt,Es as lte,WS as mad,_4 as margin,O4 as marginBottom,E4 as marginLeft,A4 as marginRight,M4 as marginTop,w4 as margins,PV as markDirectives,ui as max,HS as median,IV as menu,fi as min,ZS as mode,x4 as name,y4 as namedPlots,NR as nearest,DR as nearestX,RR as nearestY,yl as neq,ES as not,YS as nth_value,US as ntile,RD as opacityBase,TD as opacityClamp,FD as opacityConstant,SD as opacityDomain,LD as opacityExponent,AD as opacityLabel,qR as opacityLegend,ED as opacityNice,MD as opacityPercent,ID as opacityRange,OD as opacityReverse,vD as opacityScale,DD as opacityTickFormat,ND as opacityZero,pl as or,C4 as padding,CR as pan,BR as panX,PR as panY,$R as panZoom,UR as panZoomX,zR as panZoomY,PS as percent_rank,zV as plot,XS as product,m8 as projectionClip,l8 as projectionDomain,u8 as projectionInset,p8 as projectionInsetBottom,f8 as projectionInsetLeft,d8 as projectionInsetRight,h8 as projectionInsetTop,s8 as projectionParallels,a8 as projectionPrecision,c8 as projectionRotate,o8 as projectionType,QS as quantile,GD as rBase,zD as rClamp,XD as rConstant,$D as rDomain,WD as rExponent,VD as rLabel,jD as rNice,qD as rPercent,UD as rRange,PD as rScale,YD as rZero,CS as rank,J8 as raster,tR as rasterTile,A8 as rect,M8 as rectX,O8 as rectY,rR as regressionY,g4 as requestNamedPlot,ZL as restConnector,kS as row_number,P8 as ruleX,$8 as ruleY,TV as search,JS as skewness,EV as slider,rx as socketConnector,SR as sphere,Y8 as spike,q as sql,Ch as stddev,rI as stddevPop,mI as stringAgg,S4 as style,Pr as sum,CD as symbolDomain,YR as symbolLegend,BD as symbolRange,kD as symbolScale,AV as table,k8 as text,C8 as textX,B8 as textY,U8 as tickX,z8 as tickY,ju as toggle,OR as toggleColor,ER as toggleX,AR as toggleY,MR as toggleZ,nI as varPop,KS as variance,OV as vconcat,j8 as vector,V8 as vectorX,q8 as vectorY,sR as voronoi,aR as voronoiMesh,RV as vspace,Hk as wasmConnector,I4 as width,G4 as xAlign,fO as xAriaDescription,uO as xAriaLabel,Q4 as xAxis,mO as xBase,q4 as xClamp,gO as xConstant,P4 as xDomain,yO as xExponent,lO as xFontVariant,rO as xGrid,z4 as xInset,j4 as xInsetLeft,V4 as xInsetRight,oO as xLabel,sO as xLabelAnchor,aO as xLabelArrow,cO as xLabelOffset,iO as xLine,U4 as xNice,W4 as xPadding,X4 as xPaddingInner,H4 as xPaddingOuter,dO as xPercent,$4 as xRange,hO as xReverse,Y4 as xRound,B4 as xScale,eO as xTickFormat,tO as xTickPadding,nO as xTickRotate,K4 as xTickSize,J4 as xTickSpacing,Z4 as xTicks,pO as xZero,v4 as xyDomain,AO as yAlign,GO as yAriaDescription,YO as yAriaLabel,DO as yAxis,QO as yBase,TO as yClamp,KO as yConstant,bO as yDomain,ZO as yExponent,qO as yFontVariant,PO as yGrid,vO as yInset,IO as yInsetBottom,SO as yInsetTop,UO as yLabel,zO as yLabelAnchor,jO as yLabelArrow,VO as yLabelOffset,$O as yLine,_O as yNice,MO as yPadding,OO as yPaddingInner,NO as yPaddingOuter,WO as yPercent,wO as yRange,XO as yReverse,EO as yRound,xO as yScale,CO as yTickFormat,kO as yTickPadding,BO as yTickRotate,LO as yTickSize,FO as yTickSpacing,RO as yTicks,HO as yZero};