@uwdata/vgplot 0.4.0 → 0.5.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.
Files changed (65) hide show
  1. package/README.md +4 -2
  2. package/dist/vgplot.js +5643 -5842
  3. package/dist/vgplot.min.js +14 -35
  4. package/package.json +8 -10
  5. package/src/api.js +292 -0
  6. package/src/connect.js +14 -0
  7. package/src/context.js +20 -0
  8. package/src/index.js +14 -303
  9. package/src/inputs.js +24 -0
  10. package/src/{directives → plot}/attributes.js +14 -5
  11. package/src/{directives → plot}/interactors.js +8 -6
  12. package/src/{directives → plot}/legends.js +14 -6
  13. package/src/{directives → plot}/marks.js +16 -13
  14. package/src/plot/named-plots.js +49 -0
  15. package/src/plot/plot.js +9 -0
  16. package/src/directives/plot.js +0 -39
  17. package/src/interactors/Highlight.js +0 -101
  18. package/src/interactors/Interval1D.js +0 -90
  19. package/src/interactors/Interval2D.js +0 -102
  20. package/src/interactors/Nearest.js +0 -66
  21. package/src/interactors/PanZoom.js +0 -121
  22. package/src/interactors/Toggle.js +0 -111
  23. package/src/interactors/util/brush.js +0 -45
  24. package/src/interactors/util/close-to.js +0 -9
  25. package/src/interactors/util/get-field.js +0 -4
  26. package/src/interactors/util/invert.js +0 -3
  27. package/src/interactors/util/patchScreenCTM.js +0 -13
  28. package/src/interactors/util/sanitize-styles.js +0 -9
  29. package/src/interactors/util/to-kebab-case.js +0 -9
  30. package/src/layout/index.js +0 -2
  31. package/src/legend.js +0 -64
  32. package/src/marks/ConnectedMark.js +0 -63
  33. package/src/marks/ContourMark.js +0 -89
  34. package/src/marks/DenseLineMark.js +0 -146
  35. package/src/marks/Density1DMark.js +0 -104
  36. package/src/marks/Density2DMark.js +0 -69
  37. package/src/marks/Grid2DMark.js +0 -191
  38. package/src/marks/HexbinMark.js +0 -88
  39. package/src/marks/Mark.js +0 -195
  40. package/src/marks/RasterMark.js +0 -122
  41. package/src/marks/RasterTileMark.js +0 -332
  42. package/src/marks/RegressionMark.js +0 -117
  43. package/src/marks/util/bin-field.js +0 -17
  44. package/src/marks/util/density.js +0 -226
  45. package/src/marks/util/extent.js +0 -56
  46. package/src/marks/util/grid.js +0 -57
  47. package/src/marks/util/handle-param.js +0 -14
  48. package/src/marks/util/is-arrow-table.js +0 -3
  49. package/src/marks/util/is-color.js +0 -18
  50. package/src/marks/util/is-constant-option.js +0 -40
  51. package/src/marks/util/is-symbol.js +0 -20
  52. package/src/marks/util/raster.js +0 -44
  53. package/src/marks/util/stats.js +0 -133
  54. package/src/marks/util/to-data-array.js +0 -58
  55. package/src/plot-attributes.js +0 -211
  56. package/src/plot-renderer.js +0 -161
  57. package/src/plot.js +0 -136
  58. package/src/spec/parse-data.js +0 -69
  59. package/src/spec/parse-spec.js +0 -422
  60. package/src/spec/to-module.js +0 -465
  61. package/src/spec/util.js +0 -43
  62. package/src/symbols.js +0 -3
  63. package/src/transforms/bin.js +0 -81
  64. package/src/transforms/index.js +0 -3
  65. /package/src/{directives → plot}/data.js +0 -0
@@ -1,29 +1,30 @@
1
- var r9=Object.create;var qw=Object.defineProperty;var i9=Object.getOwnPropertyDescriptor;var o9=Object.getOwnPropertyNames;var s9=Object.getPrototypeOf,a9=Object.prototype.hasOwnProperty;var GA=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_i=(e,t)=>{for(var n in t)qw(e,n,{get:t[n],enumerable:!0})},c9=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of o9(t))!a9.call(e,i)&&i!==n&&qw(e,i,{get:()=>t[i],enumerable:!(r=i9(t,i))||r.enumerable});return e};var l9=(e,t,n)=>(n=e!=null?r9(s9(e)):{},c9(t||!e||!e.__esModule?qw(n,"default",{value:e,enumerable:!0}):n,e));var VL=GA((JPt,qL)=>{"use strict";function FJ(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 DJ(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 LJ(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 CJ(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 BJ(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 ty(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)}qL.exports={ge:function(e,t,n,r,i){return ty(e,t,n,r,i,FJ)},gt:function(e,t,n,r,i){return ty(e,t,n,r,i,DJ)},lt:function(e,t,n,r,i){return ty(e,t,n,r,i,LJ)},le:function(e,t,n,r,i){return ty(e,t,n,r,i,CJ)},eq:function(e,t,n,r,i){return ty(e,t,n,r,i,BJ)}}});var KL=GA((t$t,ZL)=>{"use strict";var uw=VL(),rd=0,Pl=1,lw=2;ZL.exports=$J;function lA(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 ey=lA.prototype;function aA(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 WL(e,t){var n=id(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 YL(e,t){var n=e.intervals([]);n.push(t),WL(e,n)}function GL(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?rd:(n.splice(r,1),WL(e,n),Pl)}ey.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};ey.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)?YL(this,e):this.left.insert(e):this.left=id([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?YL(this,e):this.right.insert(e):this.right=id([e]);else{var n=uw.ge(this.leftPoints,e,uA),r=uw.ge(this.rightPoints,e,fA);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};ey.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return rd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return GL(this,e);var r=this.left.remove(e);return r===lw?(this.left=null,this.count-=1,Pl):(r===Pl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return rd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return GL(this,e);var r=this.right.remove(e);return r===lw?(this.right=null,this.count-=1,Pl):(r===Pl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?lw:rd;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}aA(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?aA(this,this.left):aA(this,this.right);return Pl}for(var a=uw.ge(this.leftPoints,e,uA);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=uw.ge(this.rightPoints,e,fA);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Pl}return rd}};function XL(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 HL(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 QL(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}ey.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return XL(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return HL(this.rightPoints,e,t)}else return QL(this.leftPoints,t)};ey.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?XL(this.leftPoints,t,n):e>this.mid?HL(this.rightPoints,e,n):QL(this.leftPoints,n)};function PJ(e,t){return e-t}function uA(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function fA(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function id(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(PJ);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(uA),l.sort(fA),new lA(r,id(i),id(o),c,l)}function cA(e){this.root=e}var od=cA.prototype;od.insert=function(e){this.root?this.root.insert(e):this.root=new lA(e[0],null,null,[e],[e])};od.remove=function(e){if(this.root){var t=this.root.remove(e);return t===lw&&(this.root=null),t!==rd}return!1};od.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};od.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(od,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(od,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function $J(e){return!e||e.length===0?new cA(null):new cA(id(e))}});function XA(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 Q(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 WA(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 Rt(e){return this instanceof Rt?(this.v=e,this):new Rt(e)}function Tr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,y){o.push([d,h,p,y])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Rt?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 zl(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:Rt(e[i](s)),done:!1}:o?o(s):s}:o}}function wi(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 WA=="function"?WA(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 Hw={};_i(Hw,{compareArrayLike:()=>Xw,joinUint8Arrays:()=>Ar,memcpy:()=>jl,rebaseValueOffsets:()=>wd,toArrayBufferView:()=>Ct,toArrayBufferViewAsyncIterator:()=>Si,toArrayBufferViewIterator:()=>Zi,toBigInt64Array:()=>y9,toBigUint64Array:()=>x9,toFloat32Array:()=>_9,toFloat32ArrayAsyncIterator:()=>C9,toFloat32ArrayIterator:()=>M9,toFloat64Array:()=>w9,toFloat64ArrayAsyncIterator:()=>B9,toFloat64ArrayIterator:()=>N9,toInt16Array:()=>m9,toInt16ArrayAsyncIterator:()=>k9,toInt16ArrayIterator:()=>I9,toInt32Array:()=>bc,toInt32ArrayAsyncIterator:()=>F9,toInt32ArrayIterator:()=>T9,toInt8Array:()=>p9,toInt8ArrayAsyncIterator:()=>O9,toInt8ArrayIterator:()=>S9,toUint16Array:()=>g9,toUint16ArrayAsyncIterator:()=>D9,toUint16ArrayIterator:()=>E9,toUint32Array:()=>b9,toUint32ArrayAsyncIterator:()=>L9,toUint32ArrayIterator:()=>A9,toUint8Array:()=>Et,toUint8ArrayAsyncIterator:()=>Ww,toUint8ArrayIterator:()=>Gw,toUint8ClampedArray:()=>v9,toUint8ClampedArrayAsyncIterator:()=>P9,toUint8ClampedArrayIterator:()=>R9});var u9=new TextDecoder("utf-8"),xd=e=>u9.decode(e),f9=new TextEncoder,ea=e=>f9.encode(e);var d9=e=>typeof e=="number",HA=e=>typeof e=="boolean",Je=e=>typeof e=="function",Vn=e=>e!=null&&Object(e)===e,Er=e=>Vn(e)&&Je(e.then);var vi=e=>Vn(e)&&Je(e[Symbol.iterator]),Hr=e=>Vn(e)&&Je(e[Symbol.asyncIterator]),py=e=>Vn(e)&&Vn(e.schema);var my=e=>Vn(e)&&"done"in e&&"value"in e;var yy=e=>Vn(e)&&Je(e.stat)&&d9(e.fd);var gy=e=>Vn(e)&&_d(e.body),by=e=>"_getDOMStream"in e&&"_getNodeStream"in e,QA=e=>Vn(e)&&Je(e.abort)&&Je(e.getWriter)&&!by(e),_d=e=>Vn(e)&&Je(e.cancel)&&Je(e.getReader)&&!by(e),ZA=e=>Vn(e)&&Je(e.end)&&Je(e.write)&&HA(e.writable)&&!by(e),xy=e=>Vn(e)&&Je(e.read)&&Je(e.pipe)&&HA(e.readable)&&!by(e),KA=e=>Vn(e)&&Je(e.clear)&&Je(e.bytes)&&Je(e.position)&&Je(e.setPosition)&&Je(e.capacity)&&Je(e.getBufferIdentifier)&&Je(e.createLong);var Yw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function h9(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 jl(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 Ar(e,t){let n=h9(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?jl(s,o,a):s=o;break}jl(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Ct(e,t){let n=my(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=ea(n)),n instanceof ArrayBuffer?new e(n):n instanceof Yw?new e(n):KA(n)?Ct(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 p9=e=>Ct(Int8Array,e),m9=e=>Ct(Int16Array,e),bc=e=>Ct(Int32Array,e),y9=e=>Ct(BigInt64Array,e),Et=e=>Ct(Uint8Array,e),g9=e=>Ct(Uint16Array,e),b9=e=>Ct(Uint32Array,e),x9=e=>Ct(BigUint64Array,e),_9=e=>Ct(Float32Array,e),w9=e=>Ct(Float64Array,e),v9=e=>Ct(Uint8ClampedArray,e),Vw=e=>(e.next(),e);function*Zi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Yw?n(t):vi(t)?t:n(t);return yield*Vw(function*(i){let o=null;do o=i.next(yield Ct(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var S9=e=>Zi(Int8Array,e),I9=e=>Zi(Int16Array,e),T9=e=>Zi(Int32Array,e),Gw=e=>Zi(Uint8Array,e),E9=e=>Zi(Uint16Array,e),A9=e=>Zi(Uint32Array,e),M9=e=>Zi(Float32Array,e),N9=e=>Zi(Float64Array,e),R9=e=>Zi(Uint8ClampedArray,e);function Si(e,t){return Tr(this,arguments,function*(){if(Er(t))return yield Rt(yield Rt(yield*zl(wi(Si(e,yield Rt(t))))));let r=function(s){return Tr(this,arguments,function*(){yield yield Rt(yield Rt(s))})},i=function(s){return Tr(this,arguments,function*(){yield Rt(yield*zl(wi(Vw(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 Yw?r(t):vi(t)?i(t):Hr(t)?t:r(t);return yield Rt(yield*zl(wi(Vw(function(s){return Tr(this,arguments,function*(){let a=null;do a=yield Rt(s.next(yield yield Rt(Ct(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Rt(new e)})}var O9=e=>Si(Int8Array,e),k9=e=>Si(Int16Array,e),F9=e=>Si(Int32Array,e),Ww=e=>Si(Uint8Array,e),D9=e=>Si(Uint16Array,e),L9=e=>Si(Uint32Array,e),C9=e=>Si(Float32Array,e),B9=e=>Si(Float64Array,e),P9=e=>Si(Uint8ClampedArray,e);function wd(e,t,n){if(e!==0){n=n.slice(0,t+1);for(let r=-1;++r<=t;)n[r]+=e}return n}function Xw(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 wn={fromIterable(e){return _y($9(e))},fromAsyncIterable(e){return _y(U9(e))},fromDOMStream(e){return _y(z9(e))},fromNodeStream(e){return _y(j9(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')}},_y=e=>(e.next(),e);function*$9(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Ar(r,s)[0]:([i,r,a]=Ar(r,s),i)}({cmd:o,size:s}=yield null);let l=Gw(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 U9(e){return Tr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Ar(i,a)[0]:([o,i,c]=Ar(i,a),o)}({cmd:s,size:a}=yield yield Rt(null));let u=Ww(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Rt(u.next()):yield Rt(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Rt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Rt(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Rt(u.return(new Uint8Array(0))))}return yield Rt(null)})}function z9(e){return Tr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Ar(i,a)[0]:([o,i,c]=Ar(i,a),o)}({cmd:s,size:a}=yield yield Rt(null));let u=new Zw(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Rt(u.read()):yield Rt(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Et(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Rt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Rt(u.cancel(f)))}finally{r===!1?yield Rt(u.cancel()):e.locked&&u.releaseLock()}return yield Rt(null)})}var Zw=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Q(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Q(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Et(n)),n})}},Qw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function j9(e){return Tr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Ar(l,a)[0]:([u,l,c]=Ar(l,a),u)}if({cmd:s,size:a}=yield yield Rt(null),e.isTTY)return yield yield Rt(new Uint8Array(0)),yield Rt(null);try{n[0]=Qw(e,"end"),n[1]=Qw(e,"error");do{if(n[2]=Qw(e,"readable"),[r,o]=yield Rt(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="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 Rt(f()));while(a<c)}while(!i)}finally{yield Rt(d(n,r==="error"?o:null))}return yield Rt(null);function d(h,p){return u=l=null,new Promise((y,g)=>{for(let[m,b]of h)e.off(m,b);try{let m=e.destroy;m&&m.call(e,p),p=void 0}catch(m){p=m||p}finally{p!=null?g(p):y()}})}})}var on;(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"})(on||(on={}));var Ee;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Ee||(Ee={}));var ge;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(ge||(ge={}));var vn;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(vn||(vn={}));var $t;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})($t||($t={}));var Yn;(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"})(Yn||(Yn={}));var Zt;(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"})(Zt||(Zt={}));var k;(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.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"})(k||(k={}));var Qr;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Qr||(Qr={}));var pv={};_i(pv,{clampIndex:()=>kU,clampRange:()=>Td,createElementComparator:()=>ia});function Ki(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=>Ki(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var Jw={};_i(Jw,{BN:()=>Sd,bigNumToBigInt:()=>eM,bigNumToString:()=>Yl,isArrowBigNumSymbol:()=>JA});var JA=Symbol.for("isArrowBigNum");function Ii(e,...t){return t.length===0?Object.setPrototypeOf(Ct(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ii.prototype[JA]=!0;Ii.prototype.toJSON=function(){return`"${Yl(this)}"`};Ii.prototype.valueOf=function(){return tM(this)};Ii.prototype.toString=function(){return Yl(this)};Ii.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return tM(this);case"string":return Yl(this);case"default":return eM(this)}return Yl(this)};function ql(...e){return Ii.apply(this,e)}function Vl(...e){return Ii.apply(this,e)}function vd(...e){return Ii.apply(this,e)}Object.setPrototypeOf(ql.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Vl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(vd.prototype,Object.create(Uint32Array.prototype));Object.assign(ql.prototype,Ii.prototype,{constructor:ql,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Vl.prototype,Ii.prototype,{constructor:Vl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(vd.prototype,Ii.prototype,{constructor:vd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function tM(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 Yl=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Kw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Kw(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`-${Kw(t)}`},eM=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Yl(e);function Kw(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 Sd=class e{static new(t,n){switch(n){case!0:return new ql(t);case!1:return new Vl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new ql(t)}return t.byteLength===16?new vd(t):new Vl(t)}static signed(t){return new ql(t)}static unsigned(t){return new Vl(t)}static decimal(t){return new vd(t)}constructor(t,n){return e.new(t,n)}};function cr(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 nM,rM,iM,oM,sM,aM,cM,lM,uM,fM,dM,hM,pM,mM,yM,gM,bM,xM,_M,ht=class e{static isNull(t){return t?.typeId===k.Null}static isInt(t){return t?.typeId===k.Int}static isFloat(t){return t?.typeId===k.Float}static isBinary(t){return t?.typeId===k.Binary}static isUtf8(t){return t?.typeId===k.Utf8}static isBool(t){return t?.typeId===k.Bool}static isDecimal(t){return t?.typeId===k.Decimal}static isDate(t){return t?.typeId===k.Date}static isTime(t){return t?.typeId===k.Time}static isTimestamp(t){return t?.typeId===k.Timestamp}static isInterval(t){return t?.typeId===k.Interval}static isList(t){return t?.typeId===k.List}static isStruct(t){return t?.typeId===k.Struct}static isUnion(t){return t?.typeId===k.Union}static isFixedSizeBinary(t){return t?.typeId===k.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===k.FixedSizeList}static isMap(t){return t?.typeId===k.Map}static isDictionary(t){return t?.typeId===k.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===Ee.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===Ee.Sparse}get typeId(){return k.NONE}};nM=Symbol.toStringTag;ht[nM]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(ht.prototype);var Gn=class extends ht{toString(){return"Null"}get typeId(){return k.Null}};rM=Symbol.toStringTag;Gn[rM]=(e=>e[Symbol.toStringTag]="Null")(Gn.prototype);var Be=class extends ht{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return k.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}`}};iM=Symbol.toStringTag;Be[iM]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Be.prototype);var wy=class extends Be{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},vy=class extends Be{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ji=class extends Be{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Sy=class extends Be{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Iy=class extends Be{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Ty=class extends Be{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ey=class extends Be{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ay=class extends Be{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(wy.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(vy.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ji.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Sy.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Iy.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Ty.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ey.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ay.prototype,"ArrayType",{value:BigUint64Array});var lr=class extends ht{constructor(t){super(),this.precision=t}get typeId(){return k.Float}get ArrayType(){switch(this.precision){case ge.HALF:return Uint16Array;case ge.SINGLE:return Float32Array;case ge.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};oM=Symbol.toStringTag;lr[oM]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(lr.prototype);var My=class extends lr{constructor(){super(ge.HALF)}},Ny=class extends lr{constructor(){super(ge.SINGLE)}},Ry=class extends lr{constructor(){super(ge.DOUBLE)}};Object.defineProperty(My.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ny.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Ry.prototype,"ArrayType",{value:Float64Array});var Zo=class extends ht{constructor(){super()}get typeId(){return k.Binary}toString(){return"Binary"}};sM=Symbol.toStringTag;Zo[sM]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Zo.prototype);var Ko=class extends ht{constructor(){super()}get typeId(){return k.Utf8}toString(){return"Utf8"}};aM=Symbol.toStringTag;Ko[aM]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ko.prototype);var Jo=class extends ht{constructor(){super()}get typeId(){return k.Bool}toString(){return"Bool"}};cM=Symbol.toStringTag;Jo[cM]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Jo.prototype);var ts=class extends ht{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return k.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};lM=Symbol.toStringTag;ts[lM]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(ts.prototype);var es=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return k.Date}toString(){return`Date${(this.unit+1)*32}<${vn[this.unit]}>`}};uM=Symbol.toStringTag;es[uM]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(es.prototype);var Ti=class extends ht{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return k.Time}toString(){return`Time${this.bitWidth}<${$t[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};fM=Symbol.toStringTag;Ti[fM]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Ti.prototype);var ns=class extends ht{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return k.Timestamp}toString(){return`Timestamp<${$t[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};dM=Symbol.toStringTag;ns[dM]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(ns.prototype);var rs=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return k.Interval}toString(){return`Interval<${Yn[this.unit]}>`}};hM=Symbol.toStringTag;rs[hM]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(rs.prototype);var Ei=class extends ht{constructor(t){super(),this.children=[t]}get typeId(){return k.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}};pM=Symbol.toStringTag;Ei[pM]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ei.prototype);var me=class extends ht{constructor(t){super(),this.children=t}get typeId(){return k.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};mM=Symbol.toStringTag;me[mM]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(me.prototype);var Ai=class extends ht{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 k.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};yM=Symbol.toStringTag;Ai[yM]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ai.prototype);var is=class extends ht{constructor(t){super(),this.byteWidth=t}get typeId(){return k.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};gM=Symbol.toStringTag;is[gM]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(is.prototype);var Mi=class extends ht{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return k.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}>`}};bM=Symbol.toStringTag;Mi[bM]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Mi.prototype);var Ni=class extends ht{constructor(t,n=!1){super(),this.children=[t],this.keysSorted=n}get typeId(){return k.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(", ")}}>`}};xM=Symbol.toStringTag;Ni[xM]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ni.prototype);var q9=(e=>()=>++e)(-1),Mr=class extends ht{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?q9():cr(r)}get typeId(){return k.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}>`}};_M=Symbol.toStringTag;Mr[_M]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Mr.prototype);function Nr(e){let t=e;switch(e.typeId){case k.Decimal:return e.bitWidth/32;case k.Timestamp:return 2;case k.Date:return 1+t.unit;case k.Interval:return 1+t.unit;case k.FixedSizeList:return t.listSize;case k.FixedSizeBinary:return t.byteWidth;default:return 1}}var gt=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 V9(this,t,n)}getVisitFnByTypeId(t,n=!0){return Gl(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}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function V9(e,t,n=!0){return typeof t=="number"?Gl(e,t,n):typeof t=="string"&&t in k?Gl(e,k[t],n):t&&t instanceof ht?Gl(e,wM(t),n):t?.type&&t.type instanceof ht?Gl(e,wM(t.type),n):Gl(e,k.NONE,n)}function Gl(e,t,n=!0){let r=null;switch(t){case k.Null:r=e.visitNull;break;case k.Bool:r=e.visitBool;break;case k.Int:r=e.visitInt;break;case k.Int8:r=e.visitInt8||e.visitInt;break;case k.Int16:r=e.visitInt16||e.visitInt;break;case k.Int32:r=e.visitInt32||e.visitInt;break;case k.Int64:r=e.visitInt64||e.visitInt;break;case k.Uint8:r=e.visitUint8||e.visitInt;break;case k.Uint16:r=e.visitUint16||e.visitInt;break;case k.Uint32:r=e.visitUint32||e.visitInt;break;case k.Uint64:r=e.visitUint64||e.visitInt;break;case k.Float:r=e.visitFloat;break;case k.Float16:r=e.visitFloat16||e.visitFloat;break;case k.Float32:r=e.visitFloat32||e.visitFloat;break;case k.Float64:r=e.visitFloat64||e.visitFloat;break;case k.Utf8:r=e.visitUtf8;break;case k.Binary:r=e.visitBinary;break;case k.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case k.Date:r=e.visitDate;break;case k.DateDay:r=e.visitDateDay||e.visitDate;break;case k.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case k.Timestamp:r=e.visitTimestamp;break;case k.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case k.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case k.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case k.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case k.Time:r=e.visitTime;break;case k.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case k.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case k.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case k.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case k.Decimal:r=e.visitDecimal;break;case k.List:r=e.visitList;break;case k.Struct:r=e.visitStruct;break;case k.Union:r=e.visitUnion;break;case k.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case k.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case k.Dictionary:r=e.visitDictionary;break;case k.Interval:r=e.visitInterval;break;case k.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case k.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case k.FixedSizeList:r=e.visitFixedSizeList;break;case k.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${k[t]}'`)}function wM(e){switch(e.typeId){case k.Null:return k.Null;case k.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?k.Int8:k.Uint8;case 16:return n?k.Int16:k.Uint16;case 32:return n?k.Int32:k.Uint32;case 64:return n?k.Int64:k.Uint64}return k.Int}case k.Float:switch(e.precision){case ge.HALF:return k.Float16;case ge.SINGLE:return k.Float32;case ge.DOUBLE:return k.Float64}return k.Float;case k.Binary:return k.Binary;case k.Utf8:return k.Utf8;case k.Bool:return k.Bool;case k.Decimal:return k.Decimal;case k.Time:switch(e.unit){case $t.SECOND:return k.TimeSecond;case $t.MILLISECOND:return k.TimeMillisecond;case $t.MICROSECOND:return k.TimeMicrosecond;case $t.NANOSECOND:return k.TimeNanosecond}return k.Time;case k.Timestamp:switch(e.unit){case $t.SECOND:return k.TimestampSecond;case $t.MILLISECOND:return k.TimestampMillisecond;case $t.MICROSECOND:return k.TimestampMicrosecond;case $t.NANOSECOND:return k.TimestampNanosecond}return k.Timestamp;case k.Date:switch(e.unit){case vn.DAY:return k.DateDay;case vn.MILLISECOND:return k.DateMillisecond}return k.Date;case k.Interval:switch(e.unit){case Yn.DAY_TIME:return k.IntervalDayTime;case Yn.YEAR_MONTH:return k.IntervalYearMonth}return k.Interval;case k.Map:return k.Map;case k.List:return k.List;case k.Struct:return k.Struct;case k.Union:switch(e.mode){case Ee.Dense:return k.DenseUnion;case Ee.Sparse:return k.SparseUnion}return k.Union;case k.FixedSizeBinary:return k.FixedSizeBinary;case k.FixedSizeList:return k.FixedSizeList;case k.Dictionary:return k.Dictionary}throw new Error(`Unrecognized type '${k[e.typeId]}'`)}gt.prototype.visitInt8=null;gt.prototype.visitInt16=null;gt.prototype.visitInt32=null;gt.prototype.visitInt64=null;gt.prototype.visitUint8=null;gt.prototype.visitUint16=null;gt.prototype.visitUint32=null;gt.prototype.visitUint64=null;gt.prototype.visitFloat16=null;gt.prototype.visitFloat32=null;gt.prototype.visitFloat64=null;gt.prototype.visitDateDay=null;gt.prototype.visitDateMillisecond=null;gt.prototype.visitTimestampSecond=null;gt.prototype.visitTimestampMillisecond=null;gt.prototype.visitTimestampMicrosecond=null;gt.prototype.visitTimestampNanosecond=null;gt.prototype.visitTimeSecond=null;gt.prototype.visitTimeMillisecond=null;gt.prototype.visitTimeMicrosecond=null;gt.prototype.visitTimeNanosecond=null;gt.prototype.visitDenseUnion=null;gt.prototype.visitSparseUnion=null;gt.prototype.visitIntervalDayTime=null;gt.prototype.visitIntervalYearMonth=null;var tv={};_i(tv,{float64ToUint16:()=>Id,uint16ToFloat64:()=>Oy});var vM=new Float64Array(1),Wl=new Uint32Array(vM.buffer);function Oy(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 Id(e){if(e!==e)return 32256;vM[0]=e;let t=(Wl[1]&2147483648)>>16&65535,n=Wl[1]&2146435072,r=0;return n>=1089470464?Wl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Wl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Wl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Wl[1]&1048575)+512>>10),t|n|r&65535}var At=class extends gt{};function Lt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Y9=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},ev=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},G9=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},W9=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},SM=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},X9=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},os=({values:e},t,n)=>{e[t]=n},nv=({values:e},t,n)=>{e[t]=n},IM=({values:e},t,n)=>{e[t]=Id(n)},H9=(e,t,n)=>{switch(e.type.precision){case ge.HALF:return IM(e,t,n);case ge.SINGLE:case ge.DOUBLE:return nv(e,t,n)}},ky=({values:e},t,n)=>{Y9(e,t,n.valueOf())},Fy=({values:e},t,n)=>{ev(e,t*2,n.valueOf())},rv=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Q9=({values:e,valueOffsets:t},n,r)=>SM(e,t,n,r),Z9=({values:e,valueOffsets:t},n,r)=>{SM(e,t,n,ea(r))},iv=(e,t,n)=>{e.type.unit===vn.DAY?ky(e,t,n):Fy(e,t,n)},Dy=({values:e},t,n)=>ev(e,t*2,n/1e3),Ly=({values:e},t,n)=>ev(e,t*2,n),Cy=({values:e},t,n)=>G9(e,t*2,n),By=({values:e},t,n)=>W9(e,t*2,n),ov=(e,t,n)=>{switch(e.type.unit){case $t.SECOND:return Dy(e,t,n);case $t.MILLISECOND:return Ly(e,t,n);case $t.MICROSECOND:return Cy(e,t,n);case $t.NANOSECOND:return By(e,t,n)}},Py=({values:e},t,n)=>{e[t]=n},$y=({values:e},t,n)=>{e[t]=n},Uy=({values:e},t,n)=>{e[t]=n},zy=({values:e},t,n)=>{e[t]=n},sv=(e,t,n)=>{switch(e.type.unit){case $t.SECOND:return Py(e,t,n);case $t.MILLISECOND:return $y(e,t,n);case $t.MICROSECOND:return Uy(e,t,n);case $t.NANOSECOND:return zy(e,t,n)}},av=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},K9=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=Sn.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))},J9=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=Sn.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},tU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),eU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),nU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),rU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),iU=(e,t,n)=>{let r=e.type.children.map(o=>Sn.getVisitFn(o.type)),i=n instanceof Map?nU(t,n):n instanceof qt?eU(t,n):Array.isArray(n)?tU(t,n):rU(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},oU=(e,t,n)=>{e.type.mode===Ee.Dense?TM(e,t,n):EM(e,t,n)},TM=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Sn.visit(i,e.valueOffsets[t],n)},EM=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Sn.visit(i,t,n)},sU=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},cv=(e,t,n)=>{e.type.unit===Yn.DAY_TIME?jy(e,t,n):qy(e,t,n)},jy=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},qy=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},aU=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=Sn.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))};At.prototype.visitBool=Lt(X9);At.prototype.visitInt=Lt(os);At.prototype.visitInt8=Lt(os);At.prototype.visitInt16=Lt(os);At.prototype.visitInt32=Lt(os);At.prototype.visitInt64=Lt(os);At.prototype.visitUint8=Lt(os);At.prototype.visitUint16=Lt(os);At.prototype.visitUint32=Lt(os);At.prototype.visitUint64=Lt(os);At.prototype.visitFloat=Lt(H9);At.prototype.visitFloat16=Lt(IM);At.prototype.visitFloat32=Lt(nv);At.prototype.visitFloat64=Lt(nv);At.prototype.visitUtf8=Lt(Z9);At.prototype.visitBinary=Lt(Q9);At.prototype.visitFixedSizeBinary=Lt(rv);At.prototype.visitDate=Lt(iv);At.prototype.visitDateDay=Lt(ky);At.prototype.visitDateMillisecond=Lt(Fy);At.prototype.visitTimestamp=Lt(ov);At.prototype.visitTimestampSecond=Lt(Dy);At.prototype.visitTimestampMillisecond=Lt(Ly);At.prototype.visitTimestampMicrosecond=Lt(Cy);At.prototype.visitTimestampNanosecond=Lt(By);At.prototype.visitTime=Lt(sv);At.prototype.visitTimeSecond=Lt(Py);At.prototype.visitTimeMillisecond=Lt($y);At.prototype.visitTimeMicrosecond=Lt(Uy);At.prototype.visitTimeNanosecond=Lt(zy);At.prototype.visitDecimal=Lt(av);At.prototype.visitList=Lt(K9);At.prototype.visitStruct=Lt(iU);At.prototype.visitUnion=Lt(oU);At.prototype.visitDenseUnion=Lt(TM);At.prototype.visitSparseUnion=Lt(EM);At.prototype.visitDictionary=Lt(sU);At.prototype.visitInterval=Lt(cv);At.prototype.visitIntervalDayTime=Lt(jy);At.prototype.visitIntervalYearMonth=Lt(qy);At.prototype.visitFixedSizeList=Lt(aU);At.prototype.visitMap=Lt(J9);var Sn=new At;var Ri=Symbol.for("parent"),Xl=Symbol.for("rowIndex"),na=class{constructor(t,n){return this[Ri]=t,this[Xl]=n,new Proxy(this,new uv)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Xl],n=this[Ri],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=qe.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Ki(t)}: ${Ki(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new lv(this[Ri],this[Xl])}},lv=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,qe.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(na.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ri]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var uv=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ri].type.children.map(n=>n.name)}has(t,n){return t[Ri].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Ri].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[Ri].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=qe.visit(t[Ri].children[r],t[Xl]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Ri].type.children.findIndex(o=>o.name===n);return i!==-1?(Sn.visit(t[Ri].children[i],t[Xl],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var _t=class extends gt{};function Ft(e){return(t,n)=>t.getValid(n)?e(t,n):null}var cU=(e,t)=>864e5*e[t],fv=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),lU=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,uU=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,AM=e=>new Date(e),fU=(e,t)=>AM(cU(e,t)),dU=(e,t)=>AM(fv(e,t)),hU=(e,t)=>null,MM=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},pU=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},NM=({values:e},t)=>fU(e,t),RM=({values:e},t)=>dU(e,t*2),ra=({stride:e,values:t},n)=>t[e*n],mU=({stride:e,values:t},n)=>Oy(t[e*n]),OM=({values:e},t)=>e[t],yU=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),gU=({values:e,valueOffsets:t},n)=>MM(e,t,n),bU=({values:e,valueOffsets:t},n)=>{let r=MM(e,t,n);return r!==null?xd(r):null},xU=({values:e},t)=>e[t],_U=({type:e,values:t},n)=>e.precision!==ge.HALF?t[n]:Oy(t[n]),wU=(e,t)=>e.type.unit===vn.DAY?NM(e,t):RM(e,t),kM=({values:e},t)=>1e3*fv(e,t*2),FM=({values:e},t)=>fv(e,t*2),DM=({values:e},t)=>lU(e,t*2),LM=({values:e},t)=>uU(e,t*2),vU=(e,t)=>{switch(e.type.unit){case $t.SECOND:return kM(e,t);case $t.MILLISECOND:return FM(e,t);case $t.MICROSECOND:return DM(e,t);case $t.NANOSECOND:return LM(e,t)}},CM=({values:e},t)=>e[t],BM=({values:e},t)=>e[t],PM=({values:e},t)=>e[t],$M=({values:e},t)=>e[t],SU=(e,t)=>{switch(e.type.unit){case $t.SECOND:return CM(e,t);case $t.MILLISECOND:return BM(e,t);case $t.MICROSECOND:return PM(e,t);case $t.NANOSECOND:return $M(e,t)}},IU=({values:e,stride:t},n)=>Sd.decimal(e.subarray(t*n,t*(n+1))),TU=(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 qt([c])},EU=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new to(s.slice(i,o-i))},AU=(e,t)=>new na(e,t),MU=(e,t)=>e.type.mode===Ee.Dense?UM(e,t):zM(e,t),UM=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,e.valueOffsets[t])},zM=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,t)},NU=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},RU=(e,t)=>e.type.unit===Yn.DAY_TIME?jM(e,t):qM(e,t),jM=({values:e},t)=>e.subarray(2*t,2*(t+1)),qM=({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},OU=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new qt([o])};_t.prototype.visitNull=Ft(hU);_t.prototype.visitBool=Ft(pU);_t.prototype.visitInt=Ft(xU);_t.prototype.visitInt8=Ft(ra);_t.prototype.visitInt16=Ft(ra);_t.prototype.visitInt32=Ft(ra);_t.prototype.visitInt64=Ft(OM);_t.prototype.visitUint8=Ft(ra);_t.prototype.visitUint16=Ft(ra);_t.prototype.visitUint32=Ft(ra);_t.prototype.visitUint64=Ft(OM);_t.prototype.visitFloat=Ft(_U);_t.prototype.visitFloat16=Ft(mU);_t.prototype.visitFloat32=Ft(ra);_t.prototype.visitFloat64=Ft(ra);_t.prototype.visitUtf8=Ft(bU);_t.prototype.visitBinary=Ft(gU);_t.prototype.visitFixedSizeBinary=Ft(yU);_t.prototype.visitDate=Ft(wU);_t.prototype.visitDateDay=Ft(NM);_t.prototype.visitDateMillisecond=Ft(RM);_t.prototype.visitTimestamp=Ft(vU);_t.prototype.visitTimestampSecond=Ft(kM);_t.prototype.visitTimestampMillisecond=Ft(FM);_t.prototype.visitTimestampMicrosecond=Ft(DM);_t.prototype.visitTimestampNanosecond=Ft(LM);_t.prototype.visitTime=Ft(SU);_t.prototype.visitTimeSecond=Ft(CM);_t.prototype.visitTimeMillisecond=Ft(BM);_t.prototype.visitTimeMicrosecond=Ft(PM);_t.prototype.visitTimeNanosecond=Ft($M);_t.prototype.visitDecimal=Ft(IU);_t.prototype.visitList=Ft(TU);_t.prototype.visitStruct=Ft(AU);_t.prototype.visitUnion=Ft(MU);_t.prototype.visitDenseUnion=Ft(UM);_t.prototype.visitSparseUnion=Ft(zM);_t.prototype.visitDictionary=Ft(NU);_t.prototype.visitInterval=Ft(RU);_t.prototype.visitIntervalDayTime=Ft(jM);_t.prototype.visitIntervalYearMonth=Ft(qM);_t.prototype.visitFixedSizeList=Ft(OU);_t.prototype.visitMap=Ft(EU);var qe=new _t;var Zr=Symbol.for("keys"),Hl=Symbol.for("vals"),to=class{constructor(t){return this[Zr]=new qt([t.children[0]]).memoize(),this[Hl]=t.children[1],new Proxy(this,new hv)}[Symbol.iterator](){return new dv(this[Zr],this[Hl])}get size(){return this[Zr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Zr],n=this[Hl],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=qe.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Ki(t)}: ${Ki(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},dv=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),qe.visit(this.vals,t)]})}},hv=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Zr].toArray().map(String)}has(t,n){return t[Zr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Zr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Zr].indexOf(n);if(r!==-1){let i=qe.visit(Reflect.get(t,Hl),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Zr].indexOf(n);return i!==-1?(Sn.visit(Reflect.get(t,Hl),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(to.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Zr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Hl]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function kU(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var VM;function Td(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&&(VM=o,o=s,s=VM),s>i&&(s=i),r?r(e,o,s):[o,s]}var YM=e=>e!==e;function ia(e){if(typeof e!=="object"||e===null)return YM(e)?YM: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?Xw(e,n):!1:e instanceof Map?DU(e):Array.isArray(e)?FU(e):e instanceof qt?LU(e):CU(e,!0)}function FU(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ia(e[n]);return Vy(t)}function DU(e){let t=-1,n=[];for(let r of e.values())n[++t]=ia(r);return Vy(n)}function LU(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ia(e.get(n));return Vy(t)}function CU(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]=ia(e[n[i]]);return Vy(r,n)}function Vy(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return BU(e,n);case Map:return GM(e,n,n.keys());case to:case na:case Object:case void 0:return GM(e,n,t||Object.keys(n))}return n instanceof qt?PU(e,n):!1}}function BU(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 PU(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 GM(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 mv={};_i(mv,{BitIterator:()=>xc,getBit:()=>WM,getBool:()=>Gy,packBools:()=>_c,popcnt_array:()=>XM,popcnt_bit_range:()=>Ed,popcnt_uint32:()=>Yy,setBool:()=>$U,truncateBitmap:()=>Ql});function Gy(e,t,n,r){return(n&1<<r)!==0}function WM(e,t,n,r){return(n&1<<r)>>r}function $U(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ql(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):_c(new xc(n,e,t,null,Gy)).subarray(0,r)),i}return n}function _c(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 xc=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 Ed(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new xc(e,t,n-t,e,WM))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Ed(e,t,i)+Ed(e,r,n)+XM(e,i>>3,r-i>>3)}function XM(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+=Yy(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=Yy(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=Yy(o.getUint8(i)),i+=1;return r}function Yy(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 UU=-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 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(){let t=this._nullCount,n;return t<=UU&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Ed(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=Nr(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))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}getValid(t){if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,n){if(!this.nullable)return n;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){let{nullBitmap:c}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:c,_nullCount:0})}let{nullBitmap:r,offset:i}=this,o=i+t>>3,s=(i+t)%8,a=r[o]>>s&1;return n?a===0&&(r[o]|=1<<s,this._nullCount=this.nullCount+1):a===1&&(r[o]&=~(1<<s),this._nullCount=this.nullCount-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===k.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(Ql(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Qr.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[Qr.TYPE])&&(s[Qr.TYPE]=o.subarray(t,t+n)),(o=s[Qr.OFFSET])&&(s[Qr.OFFSET]=o.subarray(t,t+n+1))||(o=s[Qr.DATA])&&(s[Qr.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 yv=class e extends gt{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,0)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(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=Et(t.nullBitmap),o=Ct(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=Et(t.nullBitmap),o=Ct(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=Et(t.data),o=Et(t.nullBitmap),s=bc(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=Et(t.data),o=Et(t.nullBitmap),s=bc(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=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(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=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(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=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(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=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(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=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(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=Et(t.nullBitmap),s=bc(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=Et(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=Et(t.nullBitmap),s=Ct(n.ArrayType,t.typeIds),{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;if(ht.isSparseUnion(n))return new le(n,r,a,c,[void 0,void 0,o,s],i);let l=bc(t.valueOffsets);return new le(n,r,a,c,[l,void 0,o,s],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.indices.ArrayType,t.data),{["dictionary"]:s=new qt([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=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(n),["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=Et(t.nullBitmap),{["length"]:s=i.length/Nr(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=Et(t.nullBitmap),s=bc(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])}};function Ot(e){return new yv().visit(e)}var Ad=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 Wy(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Xy(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Hy(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 gv(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 Md(e,t){return e.getValid(t)}function oa(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return gv(r,this._offsets,n,t)}}function Qy(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=gv(o,this._offsets,r,n);return t=void 0,s}}function Zy(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):gv(o,this._offsets,i,n);return t=void 0,s}}var wt=class extends gt{};function zU(e,t){return t===null&&e.length>0?0:-1}function jU(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new xc(n,e.offset+(t||0),e.length,n,Gy)){if(!i)return r;++r}return-1}function Bt(e,t,n){if(t===void 0)return-1;if(t===null)return jU(e,n);let r=qe.getVisitFn(e),i=ia(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function HM(e,t,n){let r=qe.getVisitFn(e),i=ia(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}wt.prototype.visitNull=zU;wt.prototype.visitBool=Bt;wt.prototype.visitInt=Bt;wt.prototype.visitInt8=Bt;wt.prototype.visitInt16=Bt;wt.prototype.visitInt32=Bt;wt.prototype.visitInt64=Bt;wt.prototype.visitUint8=Bt;wt.prototype.visitUint16=Bt;wt.prototype.visitUint32=Bt;wt.prototype.visitUint64=Bt;wt.prototype.visitFloat=Bt;wt.prototype.visitFloat16=Bt;wt.prototype.visitFloat32=Bt;wt.prototype.visitFloat64=Bt;wt.prototype.visitUtf8=Bt;wt.prototype.visitBinary=Bt;wt.prototype.visitFixedSizeBinary=Bt;wt.prototype.visitDate=Bt;wt.prototype.visitDateDay=Bt;wt.prototype.visitDateMillisecond=Bt;wt.prototype.visitTimestamp=Bt;wt.prototype.visitTimestampSecond=Bt;wt.prototype.visitTimestampMillisecond=Bt;wt.prototype.visitTimestampMicrosecond=Bt;wt.prototype.visitTimestampNanosecond=Bt;wt.prototype.visitTime=Bt;wt.prototype.visitTimeSecond=Bt;wt.prototype.visitTimeMillisecond=Bt;wt.prototype.visitTimeMicrosecond=Bt;wt.prototype.visitTimeNanosecond=Bt;wt.prototype.visitDecimal=Bt;wt.prototype.visitList=Bt;wt.prototype.visitStruct=Bt;wt.prototype.visitUnion=Bt;wt.prototype.visitDenseUnion=HM;wt.prototype.visitSparseUnion=HM;wt.prototype.visitDictionary=Bt;wt.prototype.visitInterval=Bt;wt.prototype.visitIntervalDayTime=Bt;wt.prototype.visitIntervalYearMonth=Bt;wt.prototype.visitFixedSizeList=Bt;wt.prototype.visitMap=Bt;var wc=new wt;var vt=class extends gt{};function Dt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===k.Timestamp||t instanceof Be&&t.bitWidth!==64||t instanceof Ti&&t.bitWidth!==64||t instanceof lr&&t.precision!==ge.HALF))return new Ad(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Ad(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new bv(s)})}var bv=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}};vt.prototype.visitNull=Dt;vt.prototype.visitBool=Dt;vt.prototype.visitInt=Dt;vt.prototype.visitInt8=Dt;vt.prototype.visitInt16=Dt;vt.prototype.visitInt32=Dt;vt.prototype.visitInt64=Dt;vt.prototype.visitUint8=Dt;vt.prototype.visitUint16=Dt;vt.prototype.visitUint32=Dt;vt.prototype.visitUint64=Dt;vt.prototype.visitFloat=Dt;vt.prototype.visitFloat16=Dt;vt.prototype.visitFloat32=Dt;vt.prototype.visitFloat64=Dt;vt.prototype.visitUtf8=Dt;vt.prototype.visitBinary=Dt;vt.prototype.visitFixedSizeBinary=Dt;vt.prototype.visitDate=Dt;vt.prototype.visitDateDay=Dt;vt.prototype.visitDateMillisecond=Dt;vt.prototype.visitTimestamp=Dt;vt.prototype.visitTimestampSecond=Dt;vt.prototype.visitTimestampMillisecond=Dt;vt.prototype.visitTimestampMicrosecond=Dt;vt.prototype.visitTimestampNanosecond=Dt;vt.prototype.visitTime=Dt;vt.prototype.visitTimeSecond=Dt;vt.prototype.visitTimeMillisecond=Dt;vt.prototype.visitTimeMicrosecond=Dt;vt.prototype.visitTimeNanosecond=Dt;vt.prototype.visitDecimal=Dt;vt.prototype.visitList=Dt;vt.prototype.visitStruct=Dt;vt.prototype.visitUnion=Dt;vt.prototype.visitDenseUnion=Dt;vt.prototype.visitSparseUnion=Dt;vt.prototype.visitDictionary=Dt;vt.prototype.visitInterval=Dt;vt.prototype.visitIntervalDayTime=Dt;vt.prototype.visitIntervalYearMonth=Dt;vt.prototype.visitFixedSizeList=Dt;vt.prototype.visitMap=Dt;var Zl=new vt;var qU=(e,t)=>e+t,eo=class extends gt{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===$t.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitStruct(t,n){return t.children.reduce((r,i)=>r+Rr.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Rr.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)}},VU=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),YU=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),GU=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Rr.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},WU=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Rr.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},XU=(e,t)=>e.type.mode===Ee.Dense?QM(e,t):ZM(e,t),QM=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Rr.visit(t[o],r[i])},ZM=({children:e},t)=>4+Rr.visitMany(e,e.map(()=>t)).reduce(qU,0);eo.prototype.visitUtf8=VU;eo.prototype.visitBinary=YU;eo.prototype.visitList=GU;eo.prototype.visitFixedSizeList=WU;eo.prototype.visitUnion=XU;eo.prototype.visitDenseUnion=QM;eo.prototype.visitSparseUnion=ZM;var Rr=new eo;var KM,JM={},t3={},qt=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}=JM[s.typeId],f=o[0];this.isValid=d=>Md(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,t3[s.typeId]),this._offsets=Xy(o);break}this.data=o,this.type=s,this.stride=Nr(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._byteLength===-1&&(this._byteLength=this.data.reduce((t,n)=>t+n.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=Wy(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${k[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)>0}getByteLength(t){return 0}[Symbol.iterator](){return Zl.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(Td(this,t,n,({data:r,_offsets:i},o,s)=>Hy(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case k.Int:case k.Float:case k.Decimal:case k.Time:case k.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 ht.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(ht.isDictionary(this.type)){let t=new Ky(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Ky(this)}unmemoize(){if(ht.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}};KM=Symbol.toStringTag;qt[KM]=(e=>{e.type=ht.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._nullCount=-1,e._byteLength=-1,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(k).map(n=>k[n]).filter(n=>typeof n=="number"&&n!==k.NONE);for(let n of t){let r=qe.getVisitFnByTypeId(n),i=Sn.getVisitFnByTypeId(n),o=wc.getVisitFnByTypeId(n),s=Rr.getVisitFnByTypeId(n);JM[n]={get:r,set:i,indexOf:o,byteLength:s},t3[n]=Object.create(e,{isValid:{value:oa(Md)},get:{value:oa(qe.getVisitFnByTypeId(n))},set:{value:Qy(Sn.getVisitFnByTypeId(n))},indexOf:{value:Zy(wc.getVisitFnByTypeId(n))},getByteLength:{value:oa(Rr.getVisitFnByTypeId(n))}})}return"Vector"})(qt.prototype);var Ky=class e extends qt{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 qt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function e3(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
1
+ var K9=Object.create;var gw=Object.defineProperty;var J9=Object.getOwnPropertyDescriptor;var tU=Object.getOwnPropertyNames;var eU=Object.getPrototypeOf,nU=Object.prototype.hasOwnProperty;var Z4=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_r=(e,t)=>{for(var n in t)gw(e,n,{get:t[n],enumerable:!0})},rU=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tU(t))!nU.call(e,i)&&i!==n&&gw(e,i,{get:()=>t[i],enumerable:!(r=J9(t,i))||r.enumerable});return e};var iU=(e,t,n)=>(n=e!=null?K9(eU(e)):{},rU(t||!e||!e.__esModule?gw(n,"default",{value:e,enumerable:!0}):n,e));var LP=Z4((F7t,FP)=>{"use strict";function xJ(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 _J(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 wJ(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 vJ(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 SJ(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function ay(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}FP.exports={ge:function(e,t,n,r,i){return ay(e,t,n,r,i,xJ)},gt:function(e,t,n,r,i){return ay(e,t,n,r,i,_J)},lt:function(e,t,n,r,i){return ay(e,t,n,r,i,wJ)},le:function(e,t,n,r,i){return ay(e,t,n,r,i,vJ)},eq:function(e,t,n,r,i){return ay(e,t,n,r,i,SJ)}}});var jP=Z4((L7t,qP)=>{"use strict";var tw=LP(),id=0,Ul=1,J_=2;qP.exports=TJ;function EM(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 cy=EM.prototype;function IM(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 PP(e,t){var n=od(t);e.mid=n.mid,e.left=n.left,e.right=n.right,e.leftPoints=n.leftPoints,e.rightPoints=n.rightPoints,e.count=n.count}function CP(e,t){var n=e.intervals([]);n.push(t),PP(e,n)}function BP(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?id:(n.splice(r,1),PP(e,n),Ul)}cy.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};cy.insert=function(e){var t=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(t+1)?CP(this,e):this.left.insert(e):this.left=od([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?CP(this,e):this.right.insert(e):this.right=od([e]);else{var n=tw.ge(this.leftPoints,e,MM),r=tw.ge(this.rightPoints,e,AM);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};cy.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return id;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return BP(this,e);var r=this.left.remove(e);return r===J_?(this.left=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return id;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return BP(this,e);var r=this.right.remove(e);return r===J_?(this.right=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?J_:id;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}IM(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?IM(this,this.left):IM(this,this.right);return Ul}for(var a=tw.ge(this.leftPoints,e,MM);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=tw.ge(this.rightPoints,e,AM);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Ul}return id}};function UP(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 $P(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 zP(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}cy.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return UP(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return $P(this.rightPoints,e,t)}else return zP(this.leftPoints,t)};cy.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?UP(this.leftPoints,t,n):e>this.mid?$P(this.rightPoints,e,n):zP(this.leftPoints,n)};function IJ(e,t){return e-t}function MM(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function AM(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function od(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(IJ);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(MM),l.sort(AM),new EM(r,od(i),od(o),c,l)}function TM(e){this.root=e}var sd=TM.prototype;sd.insert=function(e){this.root?this.root.insert(e):this.root=new EM(e[0],null,null,[e],[e])};sd.remove=function(e){if(this.root){var t=this.root.remove(e);return t===J_&&(this.root=null),t!==id}return!1};sd.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};sd.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(sd,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(sd,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function TJ(e){return!e||e.length===0?new TM(null):new TM(od(e))}});var Q4={};function xd(e,t=!1){let n,r,i=Q4;function o(l){n=e(l).then(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=Q4,a(u)}),i=l}return t?c:a}var cr=class{constructor(t){this._filterBy=t,this._requestUpdate=xd(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function J4(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 K4(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 Ct(e){return this instanceof Ct?(this.v=e,this):new Ct(e)}function wr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,y){o.push([d,h,p,y])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Ct?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 jl(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:Ct(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 K4=="function"?K4(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 Sw={};_r(Sw,{compareArrayLike:()=>vw,joinUint8Arrays:()=>Sr,memcpy:()=>Vl,rebaseValueOffsets:()=>Uy,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>_i,toArrayBufferViewIterator:()=>Xi,toBigInt64Array:()=>fU,toBigUint64Array:()=>pU,toFloat32Array:()=>mU,toFloat32ArrayAsyncIterator:()=>OU,toFloat32ArrayIterator:()=>SU,toFloat64Array:()=>yU,toFloat64ArrayAsyncIterator:()=>DU,toFloat64ArrayIterator:()=>IU,toInt16Array:()=>uU,toInt16ArrayAsyncIterator:()=>MU,toInt16ArrayIterator:()=>xU,toInt32Array:()=>gc,toInt32ArrayAsyncIterator:()=>AU,toInt32ArrayIterator:()=>_U,toInt8Array:()=>lU,toInt8ArrayAsyncIterator:()=>EU,toInt8ArrayIterator:()=>bU,toUint16Array:()=>dU,toUint16ArrayAsyncIterator:()=>NU,toUint16ArrayIterator:()=>wU,toUint32Array:()=>hU,toUint32ArrayAsyncIterator:()=>RU,toUint32ArrayIterator:()=>vU,toUint8Array:()=>Ot,toUint8ArrayAsyncIterator:()=>ww,toUint8ArrayIterator:()=>_w,toUint8ClampedArray:()=>gU,toUint8ClampedArrayAsyncIterator:()=>kU,toUint8ClampedArrayIterator:()=>TU});var oU=new TextDecoder("utf-8"),_d=e=>oU.decode(e),sU=new TextEncoder,ra=e=>sU.encode(e);var aU=e=>typeof e=="number",tR=e=>typeof e=="boolean",tn=e=>typeof e=="function",jn=e=>e!=null&&Object(e)===e,vr=e=>jn(e)&&tn(e.then);var xi=e=>jn(e)&&tn(e[Symbol.iterator]),Yr=e=>jn(e)&&tn(e[Symbol.asyncIterator]),ky=e=>jn(e)&&jn(e.schema);var Fy=e=>jn(e)&&"done"in e&&"value"in e;var Ly=e=>jn(e)&&tn(e.stat)&&aU(e.fd);var Cy=e=>jn(e)&&wd(e.body),By=e=>"_getDOMStream"in e&&"_getNodeStream"in e,eR=e=>jn(e)&&tn(e.abort)&&tn(e.getWriter)&&!By(e),wd=e=>jn(e)&&tn(e.cancel)&&tn(e.getReader)&&!By(e),nR=e=>jn(e)&&tn(e.end)&&tn(e.write)&&tR(e.writable)&&!By(e),Py=e=>jn(e)&&tn(e.read)&&tn(e.pipe)&&tR(e.readable)&&!By(e),rR=e=>jn(e)&&tn(e.clear)&&tn(e.bytes)&&tn(e.position)&&tn(e.setPosition)&&tn(e.capacity)&&tn(e.getBufferIdentifier)&&tn(e.createLong);var xw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function cU(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 Vl(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 Sr(e,t){let n=cU(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?Vl(s,o,a):s=o;break}Vl(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Pt(e,t){let n=Fy(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=ra(n)),n instanceof ArrayBuffer?new e(n):n instanceof xw?new e(n):rR(n)?Pt(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var lU=e=>Pt(Int8Array,e),uU=e=>Pt(Int16Array,e),gc=e=>Pt(Int32Array,e),fU=e=>Pt(BigInt64Array,e),Ot=e=>Pt(Uint8Array,e),dU=e=>Pt(Uint16Array,e),hU=e=>Pt(Uint32Array,e),pU=e=>Pt(BigUint64Array,e),mU=e=>Pt(Float32Array,e),yU=e=>Pt(Float64Array,e),gU=e=>Pt(Uint8ClampedArray,e),bw=e=>(e.next(),e);function*Xi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof xw?n(t):xi(t)?t:n(t);return yield*bw(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var bU=e=>Xi(Int8Array,e),xU=e=>Xi(Int16Array,e),_U=e=>Xi(Int32Array,e),_w=e=>Xi(Uint8Array,e),wU=e=>Xi(Uint16Array,e),vU=e=>Xi(Uint32Array,e),SU=e=>Xi(Float32Array,e),IU=e=>Xi(Float64Array,e),TU=e=>Xi(Uint8ClampedArray,e);function _i(e,t){return wr(this,arguments,function*(){if(vr(t))return yield Ct(yield Ct(yield*jl(bi(_i(e,yield Ct(t))))));let r=function(s){return wr(this,arguments,function*(){yield yield Ct(yield Ct(s))})},i=function(s){return wr(this,arguments,function*(){yield Ct(yield*jl(bi(bw(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 xw?r(t):xi(t)?i(t):Yr(t)?t:r(t);return yield Ct(yield*jl(bi(bw(function(s){return wr(this,arguments,function*(){let a=null;do a=yield Ct(s.next(yield yield Ct(Pt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ct(new e)})}var EU=e=>_i(Int8Array,e),MU=e=>_i(Int16Array,e),AU=e=>_i(Int32Array,e),ww=e=>_i(Uint8Array,e),NU=e=>_i(Uint16Array,e),RU=e=>_i(Uint32Array,e),OU=e=>_i(Float32Array,e),DU=e=>_i(Float64Array,e),kU=e=>_i(Uint8ClampedArray,e);function Uy(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 vw(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 xn={fromIterable(e){return $y(FU(e))},fromAsyncIterable(e){return $y(LU(e))},fromDOMStream(e){return $y(CU(e))},fromNodeStream(e){return $y(BU(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')}},$y=e=>(e.next(),e);function*FU(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Sr(r,s)[0]:([i,r,a]=Sr(r,s),i)}({cmd:o,size:s}=yield null);let l=_w(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 LU(e){return wr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Sr(i,a)[0]:([o,i,c]=Sr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=ww(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ct(u.next()):yield Ct(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ct(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ct(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ct(u.return(new Uint8Array(0))))}return yield Ct(null)})}function CU(e){return wr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Sr(i,a)[0]:([o,i,c]=Sr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=new Tw(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ct(u.read()):yield Ct(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Ot(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ct(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ct(u.cancel(f)))}finally{r===!1?yield Ct(u.cancel()):e.locked&&u.releaseLock()}return yield Ct(null)})}var Tw=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=Ot(n)),n})}},Iw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function BU(e){return wr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Sr(l,a)[0]:([u,l,c]=Sr(l,a),u)}if({cmd:s,size:a}=yield yield Ct(null),e.isTTY)return yield yield Ct(new Uint8Array(0)),yield Ct(null);try{n[0]=Iw(e,"end"),n[1]=Iw(e,"error");do{if(n[2]=Iw(e,"readable"),[r,o]=yield Ct(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Ot(e.read(a-c)),u.byteLength<a-c&&(u=Ot(e.read()))):u=Ot(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ct(f()));while(a<c)}while(!i)}finally{yield Ct(d(n,r==="error"?o:null))}return yield Ct(null);function d(h,p){return u=l=null,new Promise((y,b)=>{for(let[m,g]of h)e.off(m,g);try{let m=e.destroy;m&&m.call(e,p),p=void 0}catch(m){p=m||p}finally{p!=null?b(p):y()}})}})}var Ie;(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"})(Ie||(Ie={}));var me;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(me||(me={}));var xe;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(xe||(xe={}));var _n;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(_n||(_n={}));var pt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(pt||(pt={}));var Vn;(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"})(Vn||(Vn={}));var Qt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Qt||(Qt={}));var D;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(D||(D={}));var Gr;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Gr||(Gr={}));var Vw={};_r(Vw,{clampIndex:()=>A$,clampRange:()=>Td,createElementComparator:()=>sa});var Ew={};_r(Ew,{valueToString:()=>wi});function wi(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=>wi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var Aw={};_r(Aw,{BN:()=>Sd,bigNumToBigInt:()=>sR,bigNumToString:()=>Wl,isArrowBigNumSymbol:()=>iR});var iR=Symbol.for("isArrowBigNum");function vi(e,...t){return t.length===0?Object.setPrototypeOf(Pt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}vi.prototype[iR]=!0;vi.prototype.toJSON=function(){return`"${Wl(this)}"`};vi.prototype.valueOf=function(){return oR(this)};vi.prototype.toString=function(){return Wl(this)};vi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return oR(this);case"string":return Wl(this);case"default":return sR(this)}return Wl(this)};function Yl(...e){return vi.apply(this,e)}function Gl(...e){return vi.apply(this,e)}function vd(...e){return vi.apply(this,e)}Object.setPrototypeOf(Yl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Gl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(vd.prototype,Object.create(Uint32Array.prototype));Object.assign(Yl.prototype,vi.prototype,{constructor:Yl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Gl.prototype,vi.prototype,{constructor:Gl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(vd.prototype,vi.prototype,{constructor:vd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function oR(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 Wl=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Mw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Mw(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`-${Mw(t)}`},sR=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Wl(e);function Mw(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 Sd=class e{static new(t,n){switch(n){case!0:return new Yl(t);case!1:return new Gl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Yl(t)}return t.byteLength===16?new vd(t):new Gl(t)}static signed(t){return new Yl(t)}static unsigned(t){return new Gl(t)}static decimal(t){return new vd(t)}constructor(t,n){return e.new(t,n)}};function lr(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 aR,cR,lR,uR,fR,dR,hR,pR,mR,yR,gR,bR,xR,_R,wR,vR,SR,IR,TR,ER,at=class e{static isNull(t){return t?.typeId===D.Null}static isInt(t){return t?.typeId===D.Int}static isFloat(t){return t?.typeId===D.Float}static isBinary(t){return t?.typeId===D.Binary}static isUtf8(t){return t?.typeId===D.Utf8}static isBool(t){return t?.typeId===D.Bool}static isDecimal(t){return t?.typeId===D.Decimal}static isDate(t){return t?.typeId===D.Date}static isTime(t){return t?.typeId===D.Time}static isTimestamp(t){return t?.typeId===D.Timestamp}static isInterval(t){return t?.typeId===D.Interval}static isDuration(t){return t?.typeId===D.Duration}static isList(t){return t?.typeId===D.List}static isStruct(t){return t?.typeId===D.Struct}static isUnion(t){return t?.typeId===D.Union}static isFixedSizeBinary(t){return t?.typeId===D.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===D.FixedSizeList}static isMap(t){return t?.typeId===D.Map}static isDictionary(t){return t?.typeId===D.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===me.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===me.Sparse}get typeId(){return D.NONE}};aR=Symbol.toStringTag;at[aR]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(at.prototype);var Yn=class extends at{toString(){return"Null"}get typeId(){return D.Null}};cR=Symbol.toStringTag;Yn[cR]=(e=>e[Symbol.toStringTag]="Null")(Yn.prototype);var Pe=class extends at{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return D.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}`}};lR=Symbol.toStringTag;Pe[lR]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Pe.prototype);var zy=class extends Pe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},qy=class extends Pe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Hi=class extends Pe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},jy=class extends Pe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Vy=class extends Pe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Yy=class extends Pe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Gy=class extends Pe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Wy=class extends Pe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(zy.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(qy.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Hi.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(jy.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Vy.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Yy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Gy.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Wy.prototype,"ArrayType",{value:BigUint64Array});var ur=class extends at{constructor(t){super(),this.precision=t}get typeId(){return D.Float}get ArrayType(){switch(this.precision){case xe.HALF:return Uint16Array;case xe.SINGLE:return Float32Array;case xe.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};uR=Symbol.toStringTag;ur[uR]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(ur.prototype);var Xy=class extends ur{constructor(){super(xe.HALF)}},Hy=class extends ur{constructor(){super(xe.SINGLE)}},Zy=class extends ur{constructor(){super(xe.DOUBLE)}};Object.defineProperty(Xy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Hy.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Zy.prototype,"ArrayType",{value:Float64Array});var Yo=class extends at{constructor(){super()}get typeId(){return D.Binary}toString(){return"Binary"}};fR=Symbol.toStringTag;Yo[fR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Yo.prototype);var Go=class extends at{constructor(){super()}get typeId(){return D.Utf8}toString(){return"Utf8"}};dR=Symbol.toStringTag;Go[dR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Go.prototype);var Wo=class extends at{constructor(){super()}get typeId(){return D.Bool}toString(){return"Bool"}};hR=Symbol.toStringTag;Wo[hR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Wo.prototype);var Xo=class extends at{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return D.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};pR=Symbol.toStringTag;Xo[pR]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Xo.prototype);var Ho=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Date}toString(){return`Date${(this.unit+1)*32}<${_n[this.unit]}>`}};mR=Symbol.toStringTag;Ho[mR]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Ho.prototype);var Si=class extends at{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return D.Time}toString(){return`Time${this.bitWidth}<${pt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};yR=Symbol.toStringTag;Si[yR]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Si.prototype);var Zo=class extends at{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return D.Timestamp}toString(){return`Timestamp<${pt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};gR=Symbol.toStringTag;Zo[gR]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Zo.prototype);var Qo=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Interval}toString(){return`Interval<${Vn[this.unit]}>`}};bR=Symbol.toStringTag;Qo[bR]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Qo.prototype);var Ko=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Duration}toString(){return`Duration<${pt[this.unit]}>`}};xR=Symbol.toStringTag;Ko[xR]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Ko.prototype);var Ii=class extends at{constructor(t){super(),this.children=[t]}get typeId(){return D.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}};_R=Symbol.toStringTag;Ii[_R]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ii.prototype);var ye=class extends at{constructor(t){super(),this.children=t}get typeId(){return D.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};wR=Symbol.toStringTag;ye[wR]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(ye.prototype);var Ti=class extends at{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 D.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};vR=Symbol.toStringTag;Ti[vR]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ti.prototype);var Jo=class extends at{constructor(t){super(),this.byteWidth=t}get typeId(){return D.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};SR=Symbol.toStringTag;Jo[SR]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Jo.prototype);var Ei=class extends at{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return D.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}>`}};IR=Symbol.toStringTag;Ei[IR]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Ei.prototype);var Mi=class extends at{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 D.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(", ")}}>`}};TR=Symbol.toStringTag;Mi[TR]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Mi.prototype);var PU=(e=>()=>++e)(-1),Ir=class extends at{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?PU():lr(r)}get typeId(){return D.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}>`}};ER=Symbol.toStringTag;Ir[ER]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Ir.prototype);function Tr(e){let t=e;switch(e.typeId){case D.Decimal:return e.bitWidth/32;case D.Timestamp:return 2;case D.Date:return 1+t.unit;case D.Interval:return 1+t.unit;case D.FixedSizeList:return t.listSize;case D.FixedSizeBinary:return t.byteWidth;default:return 1}}var ut=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 UU(this,t,n)}getVisitFnByTypeId(t,n=!0){return Xl(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 UU(e,t,n=!0){return typeof t=="number"?Xl(e,t,n):typeof t=="string"&&t in D?Xl(e,D[t],n):t&&t instanceof at?Xl(e,MR(t),n):t?.type&&t.type instanceof at?Xl(e,MR(t.type),n):Xl(e,D.NONE,n)}function Xl(e,t,n=!0){let r=null;switch(t){case D.Null:r=e.visitNull;break;case D.Bool:r=e.visitBool;break;case D.Int:r=e.visitInt;break;case D.Int8:r=e.visitInt8||e.visitInt;break;case D.Int16:r=e.visitInt16||e.visitInt;break;case D.Int32:r=e.visitInt32||e.visitInt;break;case D.Int64:r=e.visitInt64||e.visitInt;break;case D.Uint8:r=e.visitUint8||e.visitInt;break;case D.Uint16:r=e.visitUint16||e.visitInt;break;case D.Uint32:r=e.visitUint32||e.visitInt;break;case D.Uint64:r=e.visitUint64||e.visitInt;break;case D.Float:r=e.visitFloat;break;case D.Float16:r=e.visitFloat16||e.visitFloat;break;case D.Float32:r=e.visitFloat32||e.visitFloat;break;case D.Float64:r=e.visitFloat64||e.visitFloat;break;case D.Utf8:r=e.visitUtf8;break;case D.Binary:r=e.visitBinary;break;case D.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case D.Date:r=e.visitDate;break;case D.DateDay:r=e.visitDateDay||e.visitDate;break;case D.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case D.Timestamp:r=e.visitTimestamp;break;case D.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case D.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case D.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case D.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case D.Time:r=e.visitTime;break;case D.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case D.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case D.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case D.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case D.Decimal:r=e.visitDecimal;break;case D.List:r=e.visitList;break;case D.Struct:r=e.visitStruct;break;case D.Union:r=e.visitUnion;break;case D.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case D.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case D.Dictionary:r=e.visitDictionary;break;case D.Interval:r=e.visitInterval;break;case D.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case D.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case D.Duration:r=e.visitDuration;break;case D.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case D.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case D.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case D.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case D.FixedSizeList:r=e.visitFixedSizeList;break;case D.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${D[t]}'`)}function MR(e){switch(e.typeId){case D.Null:return D.Null;case D.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?D.Int8:D.Uint8;case 16:return n?D.Int16:D.Uint16;case 32:return n?D.Int32:D.Uint32;case 64:return n?D.Int64:D.Uint64}return D.Int}case D.Float:switch(e.precision){case xe.HALF:return D.Float16;case xe.SINGLE:return D.Float32;case xe.DOUBLE:return D.Float64}return D.Float;case D.Binary:return D.Binary;case D.Utf8:return D.Utf8;case D.Bool:return D.Bool;case D.Decimal:return D.Decimal;case D.Time:switch(e.unit){case pt.SECOND:return D.TimeSecond;case pt.MILLISECOND:return D.TimeMillisecond;case pt.MICROSECOND:return D.TimeMicrosecond;case pt.NANOSECOND:return D.TimeNanosecond}return D.Time;case D.Timestamp:switch(e.unit){case pt.SECOND:return D.TimestampSecond;case pt.MILLISECOND:return D.TimestampMillisecond;case pt.MICROSECOND:return D.TimestampMicrosecond;case pt.NANOSECOND:return D.TimestampNanosecond}return D.Timestamp;case D.Date:switch(e.unit){case _n.DAY:return D.DateDay;case _n.MILLISECOND:return D.DateMillisecond}return D.Date;case D.Interval:switch(e.unit){case Vn.DAY_TIME:return D.IntervalDayTime;case Vn.YEAR_MONTH:return D.IntervalYearMonth}return D.Interval;case D.Duration:switch(e.unit){case pt.SECOND:return D.DurationSecond;case pt.MILLISECOND:return D.DurationMillisecond;case pt.MICROSECOND:return D.DurationMicrosecond;case pt.NANOSECOND:return D.DurationNanosecond}return D.Duration;case D.Map:return D.Map;case D.List:return D.List;case D.Struct:return D.Struct;case D.Union:switch(e.mode){case me.Dense:return D.DenseUnion;case me.Sparse:return D.SparseUnion}return D.Union;case D.FixedSizeBinary:return D.FixedSizeBinary;case D.FixedSizeList:return D.FixedSizeList;case D.Dictionary:return D.Dictionary}throw new Error(`Unrecognized type '${D[e.typeId]}'`)}ut.prototype.visitInt8=null;ut.prototype.visitInt16=null;ut.prototype.visitInt32=null;ut.prototype.visitInt64=null;ut.prototype.visitUint8=null;ut.prototype.visitUint16=null;ut.prototype.visitUint32=null;ut.prototype.visitUint64=null;ut.prototype.visitFloat16=null;ut.prototype.visitFloat32=null;ut.prototype.visitFloat64=null;ut.prototype.visitDateDay=null;ut.prototype.visitDateMillisecond=null;ut.prototype.visitTimestampSecond=null;ut.prototype.visitTimestampMillisecond=null;ut.prototype.visitTimestampMicrosecond=null;ut.prototype.visitTimestampNanosecond=null;ut.prototype.visitTimeSecond=null;ut.prototype.visitTimeMillisecond=null;ut.prototype.visitTimeMicrosecond=null;ut.prototype.visitTimeNanosecond=null;ut.prototype.visitDenseUnion=null;ut.prototype.visitSparseUnion=null;ut.prototype.visitIntervalDayTime=null;ut.prototype.visitIntervalYearMonth=null;ut.prototype.visitDuration=null;ut.prototype.visitDurationSecond=null;ut.prototype.visitDurationMillisecond=null;ut.prototype.visitDurationMicrosecond=null;ut.prototype.visitDurationNanosecond=null;var Nw={};_r(Nw,{float64ToUint16:()=>Id,uint16ToFloat64:()=>Qy});var AR=new Float64Array(1),Hl=new Uint32Array(AR.buffer);function Qy(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 Id(e){if(e!==e)return 32256;AR[0]=e;let t=(Hl[1]&2147483648)>>16&65535,n=Hl[1]&2146435072,r=0;return n>=1089470464?Hl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Hl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Hl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Hl[1]&1048575)+512>>10),t|n|r&65535}var vt=class extends ut{};function Mt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var $U=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},Rw=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},zU=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},qU=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},NR=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},jU=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},ts=({values:e},t,n)=>{e[t]=n},Ow=({values:e},t,n)=>{e[t]=n},RR=({values:e},t,n)=>{e[t]=Id(n)},VU=(e,t,n)=>{switch(e.type.precision){case xe.HALF:return RR(e,t,n);case xe.SINGLE:case xe.DOUBLE:return Ow(e,t,n)}},Ky=({values:e},t,n)=>{$U(e,t,n.valueOf())},Jy=({values:e},t,n)=>{Rw(e,t*2,n.valueOf())},Dw=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},YU=({values:e,valueOffsets:t},n,r)=>NR(e,t,n,r),GU=({values:e,valueOffsets:t},n,r)=>{NR(e,t,n,ra(r))},kw=(e,t,n)=>{e.type.unit===_n.DAY?Ky(e,t,n):Jy(e,t,n)},tg=({values:e},t,n)=>Rw(e,t*2,n/1e3),eg=({values:e},t,n)=>Rw(e,t*2,n),ng=({values:e},t,n)=>zU(e,t*2,n),rg=({values:e},t,n)=>qU(e,t*2,n),Fw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return tg(e,t,n);case pt.MILLISECOND:return eg(e,t,n);case pt.MICROSECOND:return ng(e,t,n);case pt.NANOSECOND:return rg(e,t,n)}},ig=({values:e},t,n)=>{e[t]=n},og=({values:e},t,n)=>{e[t]=n},sg=({values:e},t,n)=>{e[t]=n},ag=({values:e},t,n)=>{e[t]=n},Lw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return ig(e,t,n);case pt.MILLISECOND:return og(e,t,n);case pt.MICROSECOND:return sg(e,t,n);case pt.NANOSECOND:return ag(e,t,n)}},Cw=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},WU=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=wn.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n.get(++s))},XU=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=wn.getVisitFn(r),{[t]:s,[t+1]:a}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let l of c)if(o(r,s,l),++s>=a)break},HU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),ZU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),QU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),KU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),JU=(e,t,n)=>{let r=e.type.children.map(o=>wn.getVisitFn(o.type)),i=n instanceof Map?QU(t,n):n instanceof jt?ZU(t,n):Array.isArray(n)?HU(t,n):KU(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},t$=(e,t,n)=>{e.type.mode===me.Dense?OR(e,t,n):DR(e,t,n)},OR=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,e.valueOffsets[t],n)},DR=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,t,n)},e$=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Bw=(e,t,n)=>{e.type.unit===Vn.DAY_TIME?cg(e,t,n):lg(e,t,n)},cg=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},lg=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},ug=({values:e},t,n)=>{e[t]=n},fg=({values:e},t,n)=>{e[t]=n},dg=({values:e},t,n)=>{e[t]=n},hg=({values:e},t,n)=>{e[t]=n},Pw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return ug(e,t,n);case pt.MILLISECOND:return fg(e,t,n);case pt.MICROSECOND:return dg(e,t,n);case pt.NANOSECOND:return hg(e,t,n)}},n$=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=wn.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s<r;)o(i,a+s,n[s]);else for(let s=-1,a=t*r;++s<r;)o(i,a+s,n.get(s))};vt.prototype.visitBool=Mt(jU);vt.prototype.visitInt=Mt(ts);vt.prototype.visitInt8=Mt(ts);vt.prototype.visitInt16=Mt(ts);vt.prototype.visitInt32=Mt(ts);vt.prototype.visitInt64=Mt(ts);vt.prototype.visitUint8=Mt(ts);vt.prototype.visitUint16=Mt(ts);vt.prototype.visitUint32=Mt(ts);vt.prototype.visitUint64=Mt(ts);vt.prototype.visitFloat=Mt(VU);vt.prototype.visitFloat16=Mt(RR);vt.prototype.visitFloat32=Mt(Ow);vt.prototype.visitFloat64=Mt(Ow);vt.prototype.visitUtf8=Mt(GU);vt.prototype.visitBinary=Mt(YU);vt.prototype.visitFixedSizeBinary=Mt(Dw);vt.prototype.visitDate=Mt(kw);vt.prototype.visitDateDay=Mt(Ky);vt.prototype.visitDateMillisecond=Mt(Jy);vt.prototype.visitTimestamp=Mt(Fw);vt.prototype.visitTimestampSecond=Mt(tg);vt.prototype.visitTimestampMillisecond=Mt(eg);vt.prototype.visitTimestampMicrosecond=Mt(ng);vt.prototype.visitTimestampNanosecond=Mt(rg);vt.prototype.visitTime=Mt(Lw);vt.prototype.visitTimeSecond=Mt(ig);vt.prototype.visitTimeMillisecond=Mt(og);vt.prototype.visitTimeMicrosecond=Mt(sg);vt.prototype.visitTimeNanosecond=Mt(ag);vt.prototype.visitDecimal=Mt(Cw);vt.prototype.visitList=Mt(WU);vt.prototype.visitStruct=Mt(JU);vt.prototype.visitUnion=Mt(t$);vt.prototype.visitDenseUnion=Mt(OR);vt.prototype.visitSparseUnion=Mt(DR);vt.prototype.visitDictionary=Mt(e$);vt.prototype.visitInterval=Mt(Bw);vt.prototype.visitIntervalDayTime=Mt(cg);vt.prototype.visitIntervalYearMonth=Mt(lg);vt.prototype.visitDuration=Mt(Pw);vt.prototype.visitDurationSecond=Mt(ug);vt.prototype.visitDurationMillisecond=Mt(fg);vt.prototype.visitDurationMicrosecond=Mt(dg);vt.prototype.visitDurationNanosecond=Mt(hg);vt.prototype.visitFixedSizeList=Mt(n$);vt.prototype.visitMap=Mt(XU);var wn=new vt;var Ai=Symbol.for("parent"),Zl=Symbol.for("rowIndex"),ia=class{constructor(t,n){return this[Ai]=t,this[Zl]=n,new Proxy(this,new $w)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Zl],n=this[Ai],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=je.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${wi(t)}: ${wi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Uw(this[Ai],this[Zl])}},Uw=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,je.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(ia.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ai]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Zl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var $w=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ai].type.children.map(n=>n.name)}has(t,n){return t[Ai].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Ai].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[Ai].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=je.visit(t[Ai].children[r],t[Zl]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Ai].type.children.findIndex(o=>o.name===n);return i!==-1?(wn.visit(t[Ai].children[i],t[Zl],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var gt=class extends ut{};function Tt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var r$=(e,t)=>864e5*e[t],zw=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),i$=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,o$=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,kR=e=>new Date(e),s$=(e,t)=>kR(r$(e,t)),a$=(e,t)=>kR(zw(e,t)),c$=(e,t)=>null,FR=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},l$=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},LR=({values:e},t)=>s$(e,t),CR=({values:e},t)=>a$(e,t*2),oa=({stride:e,values:t},n)=>t[e*n],u$=({stride:e,values:t},n)=>Qy(t[e*n]),BR=({values:e},t)=>e[t],f$=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),d$=({values:e,valueOffsets:t},n)=>FR(e,t,n),h$=({values:e,valueOffsets:t},n)=>{let r=FR(e,t,n);return r!==null?_d(r):null},p$=({values:e},t)=>e[t],m$=({type:e,values:t},n)=>e.precision!==xe.HALF?t[n]:Qy(t[n]),y$=(e,t)=>e.type.unit===_n.DAY?LR(e,t):CR(e,t),PR=({values:e},t)=>1e3*zw(e,t*2),UR=({values:e},t)=>zw(e,t*2),$R=({values:e},t)=>i$(e,t*2),zR=({values:e},t)=>o$(e,t*2),g$=(e,t)=>{switch(e.type.unit){case pt.SECOND:return PR(e,t);case pt.MILLISECOND:return UR(e,t);case pt.MICROSECOND:return $R(e,t);case pt.NANOSECOND:return zR(e,t)}},qR=({values:e},t)=>e[t],jR=({values:e},t)=>e[t],VR=({values:e},t)=>e[t],YR=({values:e},t)=>e[t],b$=(e,t)=>{switch(e.type.unit){case pt.SECOND:return qR(e,t);case pt.MILLISECOND:return jR(e,t);case pt.MICROSECOND:return VR(e,t);case pt.NANOSECOND:return YR(e,t)}},x$=({values:e,stride:t},n)=>Sd.decimal(e.subarray(t*n,t*(n+1))),_$=(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 jt([c])},w$=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new Zi(s.slice(i,o-i))},v$=(e,t)=>new ia(e,t),S$=(e,t)=>e.type.mode===me.Dense?GR(e,t):WR(e,t),GR=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,e.valueOffsets[t])},WR=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,t)},I$=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},T$=(e,t)=>e.type.unit===Vn.DAY_TIME?XR(e,t):HR(e,t),XR=({values:e},t)=>e.subarray(2*t,2*(t+1)),HR=({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},ZR=({values:e},t)=>e[t],QR=({values:e},t)=>e[t],KR=({values:e},t)=>e[t],JR=({values:e},t)=>e[t],E$=(e,t)=>{switch(e.type.unit){case pt.SECOND:return ZR(e,t);case pt.MILLISECOND:return QR(e,t);case pt.MICROSECOND:return KR(e,t);case pt.NANOSECOND:return JR(e,t)}},M$=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new jt([o])};gt.prototype.visitNull=Tt(c$);gt.prototype.visitBool=Tt(l$);gt.prototype.visitInt=Tt(p$);gt.prototype.visitInt8=Tt(oa);gt.prototype.visitInt16=Tt(oa);gt.prototype.visitInt32=Tt(oa);gt.prototype.visitInt64=Tt(BR);gt.prototype.visitUint8=Tt(oa);gt.prototype.visitUint16=Tt(oa);gt.prototype.visitUint32=Tt(oa);gt.prototype.visitUint64=Tt(BR);gt.prototype.visitFloat=Tt(m$);gt.prototype.visitFloat16=Tt(u$);gt.prototype.visitFloat32=Tt(oa);gt.prototype.visitFloat64=Tt(oa);gt.prototype.visitUtf8=Tt(h$);gt.prototype.visitBinary=Tt(d$);gt.prototype.visitFixedSizeBinary=Tt(f$);gt.prototype.visitDate=Tt(y$);gt.prototype.visitDateDay=Tt(LR);gt.prototype.visitDateMillisecond=Tt(CR);gt.prototype.visitTimestamp=Tt(g$);gt.prototype.visitTimestampSecond=Tt(PR);gt.prototype.visitTimestampMillisecond=Tt(UR);gt.prototype.visitTimestampMicrosecond=Tt($R);gt.prototype.visitTimestampNanosecond=Tt(zR);gt.prototype.visitTime=Tt(b$);gt.prototype.visitTimeSecond=Tt(qR);gt.prototype.visitTimeMillisecond=Tt(jR);gt.prototype.visitTimeMicrosecond=Tt(VR);gt.prototype.visitTimeNanosecond=Tt(YR);gt.prototype.visitDecimal=Tt(x$);gt.prototype.visitList=Tt(_$);gt.prototype.visitStruct=Tt(v$);gt.prototype.visitUnion=Tt(S$);gt.prototype.visitDenseUnion=Tt(GR);gt.prototype.visitSparseUnion=Tt(WR);gt.prototype.visitDictionary=Tt(I$);gt.prototype.visitInterval=Tt(T$);gt.prototype.visitIntervalDayTime=Tt(XR);gt.prototype.visitIntervalYearMonth=Tt(HR);gt.prototype.visitDuration=Tt(E$);gt.prototype.visitDurationSecond=Tt(ZR);gt.prototype.visitDurationMillisecond=Tt(QR);gt.prototype.visitDurationMicrosecond=Tt(KR);gt.prototype.visitDurationNanosecond=Tt(JR);gt.prototype.visitFixedSizeList=Tt(M$);gt.prototype.visitMap=Tt(w$);var je=new gt;var Wr=Symbol.for("keys"),Ql=Symbol.for("vals"),Zi=class{constructor(t){return this[Wr]=new jt([t.children[0]]).memoize(),this[Ql]=t.children[1],new Proxy(this,new jw)}[Symbol.iterator](){return new qw(this[Wr],this[Ql])}get size(){return this[Wr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Wr],n=this[Ql],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=je.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${wi(t)}: ${wi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},qw=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),je.visit(this.vals,t)]})}},jw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Wr].toArray().map(String)}has(t,n){return t[Wr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Wr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Wr].indexOf(n);if(r!==-1){let i=je.visit(Reflect.get(t,Ql),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Wr].indexOf(n);return i!==-1?(wn.visit(Reflect.get(t,Ql),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(Zi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Wr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ql]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function A$(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var tO;function Td(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&&(tO=o,o=s,s=tO),s>i&&(s=i),r?r(e,o,s):[o,s]}var eO=e=>e!==e;function sa(e){if(typeof e!=="object"||e===null)return eO(e)?eO: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?vw(e,n):!1:e instanceof Map?R$(e):Array.isArray(e)?N$(e):e instanceof jt?O$(e):D$(e,!0)}function N$(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=sa(e[n]);return pg(t)}function R$(e){let t=-1,n=[];for(let r of e.values())n[++t]=sa(r);return pg(n)}function O$(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=sa(e.get(n));return pg(t)}function D$(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]=sa(e[n[i]]);return pg(r,n)}function pg(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return k$(e,n);case Map:return nO(e,n,n.keys());case Zi:case ia:case Object:case void 0:return nO(e,n,t||Object.keys(n))}return n instanceof jt?F$(e,n):!1}}function k$(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 F$(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 nO(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 Yw={};_r(Yw,{BitIterator:()=>bc,getBit:()=>rO,getBool:()=>yg,packBools:()=>_c,popcnt_array:()=>iO,popcnt_bit_range:()=>Ed,popcnt_uint32:()=>mg,setBool:()=>L$,truncateBitmap:()=>xc});function yg(e,t,n,r){return(n&1<<r)!==0}function rO(e,t,n,r){return(n&1<<r)>>r}function L$(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function xc(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):_c(new bc(n,e,t,null,yg)).subarray(0,r)),i}return n}function _c(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 bc=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 Ed(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new bc(e,t,n-t,e,rO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Ed(e,t,i)+Ed(e,r,n)+iO(e,i>>3,r-i>>3)}function iO(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+=mg(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=mg(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=mg(o.getUint8(i)),i+=1;return r}function mg(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 C$=-1,se=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 at.isSparseUnion(t)?this.children.some(n=>n.nullable):at.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(at.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=C$&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Ed(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=Tr(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(at.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===me.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(at.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===me.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(xc(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===D.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(xc(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Gr.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[Gr.TYPE])&&(s[Gr.TYPE]=o.subarray(t,t+n)),(o=s[Gr.OFFSET])&&(s[Gr.OFFSET]=o.subarray(t,t+n+1))||(o=s[Gr.DATA])&&(s[Gr.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};se.prototype.children=Object.freeze([]);var Gw=class e extends ut{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new se(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ot(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Pt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(at.isSparseUnion(n))return new se(n,r,s,a,[void 0,void 0,void 0,o],i);let c=gc(t.valueOffsets);return new se(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new jt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(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=Ot(t.nullBitmap),{["length"]:s=i.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(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=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}},B$=new Gw;function Dt(e){return B$.visit(e)}var Md=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 gg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function bg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function xg(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 Ww(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 Ad(e,t){return e.getValid(t)}function aa(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return Ww(r,this._offsets,n,t)}}function _g(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=Ww(o,this._offsets,r,n);return t=void 0,s}}function wg(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):Ww(o,this._offsets,i,n);return t=void 0,s}}var bt=class extends ut{};function P$(e,t){return t===null&&e.length>0?0:-1}function U$(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new bc(n,e.offset+(t||0),e.length,n,yg)){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 D.Union:break;case D.Dictionary:break;default:return U$(e,n)}let r=je.getVisitFn(e),i=sa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function oO(e,t,n){let r=je.getVisitFn(e),i=sa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}bt.prototype.visitNull=P$;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=oO;bt.prototype.visitSparseUnion=oO;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 wc=new bt;var xt=class extends ut{};function Et(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===D.Timestamp||t instanceof Pe&&t.bitWidth!==64||t instanceof Si&&t.bitWidth!==64||t instanceof ur&&t.precision!==xe.HALF))return new Md(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Md(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new Xw(s)})}var Xw=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};xt.prototype.visitNull=Et;xt.prototype.visitBool=Et;xt.prototype.visitInt=Et;xt.prototype.visitInt8=Et;xt.prototype.visitInt16=Et;xt.prototype.visitInt32=Et;xt.prototype.visitInt64=Et;xt.prototype.visitUint8=Et;xt.prototype.visitUint16=Et;xt.prototype.visitUint32=Et;xt.prototype.visitUint64=Et;xt.prototype.visitFloat=Et;xt.prototype.visitFloat16=Et;xt.prototype.visitFloat32=Et;xt.prototype.visitFloat64=Et;xt.prototype.visitUtf8=Et;xt.prototype.visitBinary=Et;xt.prototype.visitFixedSizeBinary=Et;xt.prototype.visitDate=Et;xt.prototype.visitDateDay=Et;xt.prototype.visitDateMillisecond=Et;xt.prototype.visitTimestamp=Et;xt.prototype.visitTimestampSecond=Et;xt.prototype.visitTimestampMillisecond=Et;xt.prototype.visitTimestampMicrosecond=Et;xt.prototype.visitTimestampNanosecond=Et;xt.prototype.visitTime=Et;xt.prototype.visitTimeSecond=Et;xt.prototype.visitTimeMillisecond=Et;xt.prototype.visitTimeMicrosecond=Et;xt.prototype.visitTimeNanosecond=Et;xt.prototype.visitDecimal=Et;xt.prototype.visitList=Et;xt.prototype.visitStruct=Et;xt.prototype.visitUnion=Et;xt.prototype.visitDenseUnion=Et;xt.prototype.visitSparseUnion=Et;xt.prototype.visitDictionary=Et;xt.prototype.visitInterval=Et;xt.prototype.visitIntervalDayTime=Et;xt.prototype.visitIntervalYearMonth=Et;xt.prototype.visitDuration=Et;xt.prototype.visitDurationSecond=Et;xt.prototype.visitDurationMillisecond=Et;xt.prototype.visitDurationMicrosecond=Et;xt.prototype.visitDurationNanosecond=Et;xt.prototype.visitFixedSizeList=Et;xt.prototype.visitMap=Et;var Kl=new xt;var $$=(e,t)=>e+t,Qi=class extends ut{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===pt.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+Er.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Er.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)}},z$=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),q$=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),j$=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Er.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},V$=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Er.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},Y$=(e,t)=>e.type.mode===me.Dense?sO(e,t):aO(e,t),sO=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Er.visit(t[o],r[i])},aO=({children:e},t)=>4+Er.visitMany(e,e.map(()=>t)).reduce($$,0);Qi.prototype.visitUtf8=z$;Qi.prototype.visitBinary=q$;Qi.prototype.visitList=j$;Qi.prototype.visitFixedSizeList=V$;Qi.prototype.visitUnion=Y$;Qi.prototype.visitDenseUnion=sO;Qi.prototype.visitSparseUnion=aO;var Er=new Qi;var cO,lO={},uO={},jt=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 se)))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}=lO[s.typeId],f=o[0];this.isValid=d=>Ad(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,uO[s.typeId]),this._offsets=bg(o);break}this.data=o,this.type=s,this.stride=Tr(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 gg(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${D[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return Kl.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(Td(this,t,n,({data:r,_offsets:i},o,s)=>xg(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case D.Int:case D.Float:case D.Decimal:case D.Time:case D.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 at.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(at.isDictionary(this.type)){let t=new vg(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new vg(this)}unmemoize(){if(at.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}};cO=Symbol.toStringTag;jt[cO]=(e=>{e.type=at.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(D).map(n=>D[n]).filter(n=>typeof n=="number"&&n!==D.NONE);for(let n of t){let r=je.getVisitFnByTypeId(n),i=wn.getVisitFnByTypeId(n),o=wc.getVisitFnByTypeId(n),s=Er.getVisitFnByTypeId(n);lO[n]={get:r,set:i,indexOf:o,byteLength:s},uO[n]=Object.create(e,{isValid:{value:aa(Ad)},get:{value:aa(je.getVisitFnByTypeId(n))},set:{value:_g(wn.getVisitFnByTypeId(n))},indexOf:{value:wg(wc.getVisitFnByTypeId(n))},getByteLength:{value:aa(Er.getVisitFnByTypeId(n))}})}return"Vector"})(jt.prototype);var vg=class e extends jt{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 jt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function fO(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
2
2
  switch (x) {${n.map(r=>`
3
- case ${HU(r)}:`).join("")}
3
+ case ${G$(r)}:`).join("")}
4
4
  return false;
5
5
  }`),e.length!==n.length&&(t=`if (x !== x) return false;
6
6
  ${t}`),new Function("x",`${t}
7
- return true;`)}function HU(e){return typeof e!="bigint"?Ki(e):`${Ki(e)}n`}var xv=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,QU=(e,t=0)=>e.length>=t?e.subarray(0,t):jl(new e.constructor(t),e,0),sa=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?xv(r*1,this.BYTES_PER_ELEMENT):xv(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=xv(t*this.stride,this.BYTES_PER_ELEMENT);let n=QU(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=jl(new this.ArrayType(t),this.buffer)}};sa.prototype.offset=0;var ss=class extends sa{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}},Kl=class extends ss{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()}},Jl=class extends ss{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 be=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=Nr(t),this._nulls=new Kl,n&&n.length>0&&(this._isValid=e3(n))}toVector(){return new qt([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(),Ot({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}};be.prototype.length=1;be.prototype.stride=1;be.prototype.children=null;be.prototype.finished=!1;be.prototype.nullValues=null;be.prototype._isValid=()=>!0;var sn=class extends be{constructor(t){super(t),this._values=new ss(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},no=class extends be{constructor(t){super(t),this._pendingLength=0,this._offsets=new Jl}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof to?n[Zr].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var vc=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 ro=new Int32Array(2),Jy=new Float32Array(ro.buffer),tg=new Float64Array(ro.buffer),tu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Nd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Nd||(Nd={}));var Or=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 ro[0]=this.readInt32(t),Jy[0]}readFloat64(t){return ro[tu?0:1]=this.readInt32(t),ro[tu?1:0]=this.readInt32(t+4),tg[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){Jy[0]=n,this.writeInt32(t,ro[0])}writeFloat64(t,n){tg[0]=n,this.writeInt32(t,ro[tu?0:1]),this.writeInt32(t+4,ro[tu?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===Nd.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 Sc=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=Or.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=Or.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 tn=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 aa;(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"})(aa||(aa={}));var ca;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ca||(ca={}));var Rd;(function(e){e[e.DenseArray=0]="DenseArray"})(Rd||(Rd={}));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 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 io=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 ki).__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):Rd.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,Rd.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Od=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 kd=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 Fd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Fd||(Fd={}));var la=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):Fd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Fd.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var oo=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 ua;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ua||(ua={}));var fa=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 da=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 Dd;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Dd||(Dd={}));var ha=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):Dd.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Dd.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Ld;(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"})(Ld||(Ld={}));var pa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):Ld.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Ld.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Cd=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 ma=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 Bd=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 Pd=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 as=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):ua.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,ua.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 cs=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):ua.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,ua.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 $d;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})($d||($d={}));var Fi=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):$d.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,$d.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 Ud=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 xe;(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"})(xe||(xe={}));var Dn=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):xe.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 io).__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 tn).__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,xe.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 ur=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):ca.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Dn).__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 tn).__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,ca.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 kr=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):aa.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new ur).__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 vc).__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 vc).__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 tn).__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,aa.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 re=class e{constructor(t=[],n,r){this.fields=t||[],this.metadata=n||new Map,r||(r=_v(t)),this.dictionaries=r}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=ng(ng(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:ng(ng(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=_v(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var Pt=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)}};Pt.prototype.type=null;Pt.prototype.name=null;Pt.prototype.nullable=null;Pt.prototype.metadata=null;function ng(e,t){return new Map([...e||new Map,...t||new Map])}function _v(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].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&&_v(o.children,t)}return t}var ZU=Sc,KU=Or,ls=class{static decode(t){t=new KU(Et(t));let n=kr.getRootAsFooter(t),r=re.decode(n.schema());return new wv(r,n)}static encode(t){let n=new ZU,r=re.encode(n,t.schema);kr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())us.encode(n,s);let i=n.endVector();kr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())us.encode(n,s);let o=n.endVector();return kr.startFooter(n),kr.addSchema(n,r),kr.addVersion(n,on.V4),kr.addRecordBatches(n,i),kr.addDictionaries(n,o),kr.finishFooterBuffer(n,kr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=on.V4,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 wv=class extends ls{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 us.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return us.decode(n)}return null}},us=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 vc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=cr(r),this.bodyLength=cr(n)}};var ye=Object.freeze({done:!0,value:void 0}),zd=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ic=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())}},rg=class extends Ic{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Q(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(ye);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return wn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return wn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Q(this,void 0,void 0,function*(){return yield this.abort(t),ye})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),ye})}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(ye)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var so=class extends rg{write(t){if((t=Et(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?xd(this.toUint8Array(!0)):this.toUint8Array(!1).then(xd)}toUint8Array(t=!1){return t?Ar(this._values)[0]:Q(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=wi(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 Ar(s,a)[0]})}},ao=class{constructor(t){t&&(this.source=new vv(wn.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Jr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof so?this.source=new fs(wn.fromAsyncIterable(t)):xy(t)?this.source=new fs(wn.fromNodeStream(t)):_d(t)?this.source=new fs(wn.fromDOMStream(t)):gy(t)?this.source=new fs(wn.fromDOMStream(t.body)):vi(t)?this.source=new fs(wn.fromIterable(t)):Er(t)?this.source=new fs(wn.fromAsyncIterable(t)):Hr(t)&&(this.source=new fs(wn.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)}},vv=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)||ye)}return(t){return Object.create(this.source.return&&this.source.return(t)||ye)}},fs=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Q(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return Q(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return Q(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||ye;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Q(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||ye;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var jd=class extends ao{constructor(t,n){super(),this.position=0,this.buffer=Et(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}}},ya=class extends Jr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Q(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Q(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Q(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle: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 Q(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 Q(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Iv={};_i(Iv,{BaseInt64:()=>qd,Int128:()=>Vd,Int64:()=>ds,Uint64:()=>Ae});function eu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var nu=8,Sv=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],qd=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`${eu(this.buffer[1])} ${eu(this.buffer[0])}`}},Ae=class e extends qd{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=nu<r-o?nu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([Sv[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)}},ds=class e extends qd{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=nu<i-s?nu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([Sv[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)}},Vd=class e{constructor(t){this.buffer=t}high(){return new ds(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ds(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 Ae(new Uint32Array([this.buffer[3],0])),r=new Ae(new Uint32Array([this.buffer[2],0])),i=new Ae(new Uint32Array([this.buffer[1],0])),o=new Ae(new Uint32Array([this.buffer[0],0])),s=new Ae(new Uint32Array([t.buffer[3],0])),a=new Ae(new Uint32Array([t.buffer[2],0])),c=new Ae(new Uint32Array([t.buffer[1],0])),l=new Ae(new Uint32Array([t.buffer[0],0])),u=Ae.multiply(o,l);this.buffer[0]=u.low();let f=new Ae(new Uint32Array([u.high(),0]));return u=Ae.multiply(i,l),f.plus(u),u=Ae.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 Ae(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ae.multiply(r,l)).plus(Ae.multiply(i,c)).plus(Ae.multiply(o,a)),this.buffer[3]+=Ae.multiply(n,l).plus(Ae.multiply(r,c)).plus(Ae.multiply(i,a)).plus(Ae.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`${eu(this.buffer[3])} ${eu(this.buffer[2])} ${eu(this.buffer[1])} ${eu(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=nu<i-s?nu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([Sv[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 Yd=class extends gt{constructor(t,n,r,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i}visit(t){return super.visit(t instanceof Pt?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Ot({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({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 Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===Ee.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({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)}},ig=class extends Yd{constructor(t,n,r,i){super(new Uint8Array(0),n,r,i),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):_c(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Ct(Uint8Array,Ct(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Ct(Uint8Array,Ct(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return ht.isTimestamp(t)?Ct(Uint8Array,ds.convertArray(r[n])):(ht.isInt(t)||ht.isTime(t))&&t.bitWidth===64?Ct(Uint8Array,ds.convertArray(r[n])):ht.isDate(t)&&t.unit===vn.MILLISECOND?Ct(Uint8Array,ds.convertArray(r[n])):ht.isDecimal(t)?Ct(Uint8Array,Vd.convertArray(r[n])):ht.isBinary(t)||ht.isFixedSizeBinary(t)?JU(r[n]):ht.isBool(t)?_c(r[n]):ht.isUtf8(t)?ea(r[n].join("")):Ct(Uint8Array,Ct(t.ArrayType,r[n].map(i=>+i)))}};function JU(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 ru=class extends no{constructor(t){super(t),this._values=new sa(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,Et(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 og=class extends be{constructor(t){super(t),this._values=new Kl}setValue(t,n){this._values.set(t,+n)}};var Tc=class extends sn{};Tc.prototype._setValue=iv;var Gd=class extends Tc{};Gd.prototype._setValue=ky;var Wd=class extends Tc{};Wd.prototype._setValue=Fy;var Xd=class extends sn{};Xd.prototype._setValue=av;var sg=class extends be{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Mr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ec({type:this.type.indices,nullValues:n}),this.dictionary=Ec({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 Hd=class extends sn{};Hd.prototype._setValue=rv;var ag=class extends be{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 Mi(this.type.listSize,new Pt(n,t.type,!0)),r}};var Ac=class extends sn{setValue(t,n){this._values.set(t,n)}},cg=class extends Ac{setValue(t,n){super.setValue(t,Id(n))}},lg=class extends Ac{},ug=class extends Ac{};var Mc=class extends sn{};Mc.prototype._setValue=cv;var Qd=class extends Mc{};Qd.prototype._setValue=jy;var Zd=class extends Mc{};Zd.prototype._setValue=qy;var ti=class extends sn{setValue(t,n){this._values.set(t,n)}},fg=class extends ti{},dg=class extends ti{},hg=class extends ti{},pg=class extends ti{},mg=class extends ti{},yg=class extends ti{},gg=class extends ti{},bg=class extends ti{};var xg=class extends no{constructor(t){super(t),this._offsets=new Jl}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 Ei(new Pt(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 _g=class extends no{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 Ni(new Pt(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 wg=class extends be{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var vg=class extends be{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 me([...this.type.children,new Pt(n,t.type,!0)]),r}};var hs=class extends sn{};hs.prototype._setValue=ov;var Kd=class extends hs{};Kd.prototype._setValue=Dy;var Jd=class extends hs{};Jd.prototype._setValue=Ly;var th=class extends hs{};th.prototype._setValue=Cy;var eh=class extends hs{};eh.prototype._setValue=By;var ps=class extends sn{};ps.prototype._setValue=sv;var nh=class extends ps{};nh.prototype._setValue=Py;var rh=class extends ps{};rh.prototype._setValue=$y;var ih=class extends ps{};ih.prototype._setValue=Uy;var oh=class extends ps{};oh.prototype._setValue=zy;var iu=class extends be{constructor(t){super(t),this._typeIds=new ss(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.setValid(t,this.isValid(n))&&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 Pt(n,t.type)];return this.type=new Ai(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.")}},Sg=class extends iu{},Ig=class extends iu{constructor(t){super(t),this._offsets=new ss(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 sh=class extends no{constructor(t){super(t),this._values=new sa(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,ea(n))}_flushPending(t,n){}};sh.prototype._flushPending=ru.prototype._flushPending;var Tv=class extends gt{visitNull(){return wg}visitBool(){return og}visitInt(){return ti}visitInt8(){return fg}visitInt16(){return dg}visitInt32(){return hg}visitInt64(){return pg}visitUint8(){return mg}visitUint16(){return yg}visitUint32(){return gg}visitUint64(){return bg}visitFloat(){return Ac}visitFloat16(){return cg}visitFloat32(){return lg}visitFloat64(){return ug}visitUtf8(){return sh}visitBinary(){return ru}visitFixedSizeBinary(){return Hd}visitDate(){return Tc}visitDateDay(){return Gd}visitDateMillisecond(){return Wd}visitTimestamp(){return hs}visitTimestampSecond(){return Kd}visitTimestampMillisecond(){return Jd}visitTimestampMicrosecond(){return th}visitTimestampNanosecond(){return eh}visitTime(){return ps}visitTimeSecond(){return nh}visitTimeMillisecond(){return rh}visitTimeMicrosecond(){return ih}visitTimeNanosecond(){return oh}visitDecimal(){return Xd}visitList(){return xg}visitStruct(){return vg}visitUnion(){return iu}visitDenseUnion(){return Ig}visitSparseUnion(){return Sg}visitDictionary(){return sg}visitInterval(){return Mc}visitIntervalDayTime(){return Qd}visitIntervalYearMonth(){return Zd}visitFixedSizeList(){return ag}visitMap(){return _g}},n3=new Tv;var St=class extends gt{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 fr(e,t){return t instanceof e.constructor}function ah(e,t){return e===t||fr(e,t)}function ms(e,t){return e===t||fr(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Tg(e,t){return e===t||fr(e,t)&&e.precision===t.precision}function tz(e,t){return e===t||fr(e,t)&&e.byteWidth===t.byteWidth}function Ev(e,t){return e===t||fr(e,t)&&e.unit===t.unit}function ch(e,t){return e===t||fr(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function lh(e,t){return e===t||fr(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function ez(e,t){return e===t||fr(e,t)&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}function nz(e,t){return e===t||fr(e,t)&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}function Av(e,t){return e===t||fr(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&co.compareManyFields(e.children,t.children)}function rz(e,t){return e===t||fr(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&co.visit(e.indices,t.indices)&&co.visit(e.dictionary,t.dictionary)}function Mv(e,t){return e===t||fr(e,t)&&e.unit===t.unit}function iz(e,t){return e===t||fr(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}function oz(e,t){return e===t||fr(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}St.prototype.visitNull=ah;St.prototype.visitBool=ah;St.prototype.visitInt=ms;St.prototype.visitInt8=ms;St.prototype.visitInt16=ms;St.prototype.visitInt32=ms;St.prototype.visitInt64=ms;St.prototype.visitUint8=ms;St.prototype.visitUint16=ms;St.prototype.visitUint32=ms;St.prototype.visitUint64=ms;St.prototype.visitFloat=Tg;St.prototype.visitFloat16=Tg;St.prototype.visitFloat32=Tg;St.prototype.visitFloat64=Tg;St.prototype.visitUtf8=ah;St.prototype.visitBinary=ah;St.prototype.visitFixedSizeBinary=tz;St.prototype.visitDate=Ev;St.prototype.visitDateDay=Ev;St.prototype.visitDateMillisecond=Ev;St.prototype.visitTimestamp=ch;St.prototype.visitTimestampSecond=ch;St.prototype.visitTimestampMillisecond=ch;St.prototype.visitTimestampMicrosecond=ch;St.prototype.visitTimestampNanosecond=ch;St.prototype.visitTime=lh;St.prototype.visitTimeSecond=lh;St.prototype.visitTimeMillisecond=lh;St.prototype.visitTimeMicrosecond=lh;St.prototype.visitTimeNanosecond=lh;St.prototype.visitDecimal=ah;St.prototype.visitList=ez;St.prototype.visitStruct=nz;St.prototype.visitUnion=Av;St.prototype.visitDenseUnion=Av;St.prototype.visitSparseUnion=Av;St.prototype.visitDictionary=rz;St.prototype.visitInterval=Mv;St.prototype.visitIntervalDayTime=Mv;St.prototype.visitIntervalYearMonth=Mv;St.prototype.visitFixedSizeList=iz;St.prototype.visitMap=oz;var co=new St;function Nc(e,t){return co.compareSchemas(e,t)}function r3(e,t){return co.compareFields(e,t)}function i3(e,t){return co.visit(e,t)}function Ec(e){let t=e.type,n=new(n3.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(Ec(Object.assign(Object.assign({},l),{type:c})))}}return n}function Eg(e,t){return sz(e,t.map(n=>n.data.concat()))}function sz(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=az(n,s,u,t,i),s>0&&(r[o++]=Ot({type:new me(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new ke(e,f))]}function az(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:Ot({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var o3,an=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new re([]),this._offsets=[0],this;let i,o;t[0]instanceof re&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof ke)return[c];if(c instanceof e)return c.batches;if(c instanceof le){if(c.type instanceof me)return[new ke(new re(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 qt([c[h]])),f=new re(l.map((h,p)=>new Pt(String(h),u[p].type))),[,d]=Eg(f,u);return d.length===0?[new ke(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new re([]),!(i instanceof re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof ke))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Nc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Xy(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=Wy(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?Zl.visit(new qt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
7
+ return true;`)}function G$(e){return typeof e!="bigint"?wi(e):`${wi(e)}n`}var Hw=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,W$=(e,t=0)=>e.length>=t?e.subarray(0,t):Vl(new e.constructor(t),e,0),ca=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?Hw(r*1,this.BYTES_PER_ELEMENT):Hw(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Hw(t*this.stride,this.BYTES_PER_ELEMENT);let n=W$(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Vl(new this.ArrayType(t),this.buffer)}};ca.prototype.offset=0;var es=class extends ca{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}},Jl=class extends es{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()}},tu=class extends es{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 _e=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=Tr(t),this._nulls=new Jl,n&&n.length>0&&(this._isValid=fO(n))}toVector(){return new jt([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(),Dt({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}};_e.prototype.length=1;_e.prototype.stride=1;_e.prototype.children=null;_e.prototype.finished=!1;_e.prototype.nullValues=null;_e.prototype._isValid=()=>!0;var Ve=class extends _e{constructor(t){super(t),this._values=new es(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},Ki=class extends _e{constructor(t){super(t),this._pendingLength=0,this._offsets=new tu}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof Zi?n[Wr].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 vc=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 Ji=new Int32Array(2),Sg=new Float32Array(Ji.buffer),Ig=new Float64Array(Ji.buffer),eu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Nd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Nd||(Nd={}));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 Ji[0]=this.readInt32(t),Sg[0]}readFloat64(t){return Ji[eu?0:1]=this.readInt32(t),Ji[eu?1:0]=this.readInt32(t+4),Ig[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){Sg[0]=n,this.writeInt32(t,Ji[0])}writeFloat64(t,n){Ig[0]=n,this.writeInt32(t,Ji[eu?0:1]),this.writeInt32(t+4,Ji[eu?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===Nd.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 Sc=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=Mr.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=Mr.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 en=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 la;(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"})(la||(la={}));var ua;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ua||(ua={}));var Rd;(function(e){e[e.DenseArray=0]="DenseArray"})(Rd||(Rd={}));var Ri=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 to=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 Ri).__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):Rd.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,Rd.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Od=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 Dd=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 kd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(kd||(kd={}));var fa=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):kd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,kd.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(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 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 Oi;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Oi||(Oi={}));var da=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):Oi.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Oi.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var ha=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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 pa=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 Fd;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Fd||(Fd={}));var ma=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):Fd.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Fd.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Ld;(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"})(Ld||(Ld={}));var ya=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):Ld.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Ld.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Cd=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 ga=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 Bd=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 Pd=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 ns=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):Oi.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,Oi.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 rs=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):Oi.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,Oi.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 Ud;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Ud||(Ud={}));var Di=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):Ud.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,Ud.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 $d=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 ge;(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"})(ge||(ge={}));var kn=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):ge.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 to).__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 en).__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,ge.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var fr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ua.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new kn).__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 en).__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,ua.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 Ar=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):la.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new fr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new vc).__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 vc).__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 en).__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,la.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 re=class e{constructor(t=[],n,r,i=Ie.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=Zw(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=Eg(Eg(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:Eg(Eg(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=Zw(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var Ut=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};Ut.prototype.type=null;Ut.prototype.name=null;Ut.prototype.nullable=null;Ut.prototype.metadata=null;function Eg(e,t){return new Map([...e||new Map,...t||new Map])}function Zw(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(at.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&&Zw(o.children,t)}return t}var X$=Sc,H$=Mr,is=class{static decode(t){t=new H$(Ot(t));let n=Ar.getRootAsFooter(t),r=re.decode(n.schema(),new Map,n.version());return new Qw(r,n)}static encode(t){let n=new X$,r=re.encode(n,t.schema);Ar.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())os.encode(n,s);let i=n.endVector();Ar.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())os.encode(n,s);let o=n.endVector();return Ar.startFooter(n),Ar.addSchema(n,r),Ar.addVersion(n,Ie.V5),Ar.addRecordBatches(n,i),Ar.addDictionaries(n,o),Ar.finishFooterBuffer(n,Ar.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Ie.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 Qw=class extends is{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 os.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return os.decode(n)}return null}},os=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 vc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=lr(r),this.bodyLength=lr(n)}};var be=Object.freeze({done:!0,value:void 0}),zd=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ic=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())}},Mg=class extends Ic{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(be);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return xn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return xn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),be})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),be})}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(be)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var no=class extends Mg{write(t){if((t=Ot(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?_d(this.toUint8Array(!0)):this.toUint8Array(!1).then(_d)}toUint8Array(t=!1){return t?Sr(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 Sr(s,a)[0]})}},ro=class{constructor(t){t&&(this.source=new Kw(xn.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)}},Hr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof no?this.source=new ss(xn.fromAsyncIterable(t)):Py(t)?this.source=new ss(xn.fromNodeStream(t)):wd(t)?this.source=new ss(xn.fromDOMStream(t)):Cy(t)?this.source=new ss(xn.fromDOMStream(t.body)):xi(t)?this.source=new ss(xn.fromIterable(t)):vr(t)?this.source=new ss(xn.fromAsyncIterable(t)):Yr(t)&&(this.source=new ss(xn.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)}},Kw=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)||be)}return(t){return Object.create(this.source.return&&this.source.return(t)||be)}},ss=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))||be;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))||be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var qd=class extends ro{constructor(t,n){super(),this.position=0,this.buffer=Ot(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}}},ba=class extends Hr{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 tv={};_r(tv,{BaseInt64:()=>jd,Int128:()=>Vd,Int64:()=>as,Uint64:()=>Ne});function nu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var ru=8,Jw=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],jd=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`${nu(this.buffer[1])} ${nu(this.buffer[0])}`}},Ne=class e extends jd{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=ru<r-o?ru:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([Jw[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)}},as=class e extends jd{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=ru<i-s?ru:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([Jw[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)}},Vd=class e{constructor(t){this.buffer=t}high(){return new as(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new as(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 Ne(new Uint32Array([this.buffer[3],0])),r=new Ne(new Uint32Array([this.buffer[2],0])),i=new Ne(new Uint32Array([this.buffer[1],0])),o=new Ne(new Uint32Array([this.buffer[0],0])),s=new Ne(new Uint32Array([t.buffer[3],0])),a=new Ne(new Uint32Array([t.buffer[2],0])),c=new Ne(new Uint32Array([t.buffer[1],0])),l=new Ne(new Uint32Array([t.buffer[0],0])),u=Ne.multiply(o,l);this.buffer[0]=u.low();let f=new Ne(new Uint32Array([u.high(),0]));return u=Ne.multiply(i,l),f.plus(u),u=Ne.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 Ne(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ne.multiply(r,l)).plus(Ne.multiply(i,c)).plus(Ne.multiply(o,a)),this.buffer[3]+=Ne.multiply(n,l).plus(Ne.multiply(r,c)).plus(Ne.multiply(i,a)).plus(Ne.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`${nu(this.buffer[3])} ${nu(this.buffer[2])} ${nu(this.buffer[1])} ${nu(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=ru<i-s?ru:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([Jw[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 Yd=class extends ut{constructor(t,n,r,i,o=Ie.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof Ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Dt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({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 Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({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<Ie.V5&&this.readNullBitmap(t,r),t.mode===me.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({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)}},Ag=class extends Yd{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):_c(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return at.isTimestamp(t)?Pt(Uint8Array,as.convertArray(r[n])):(at.isInt(t)||at.isTime(t))&&t.bitWidth===64||at.isDuration(t)?Pt(Uint8Array,as.convertArray(r[n])):at.isDate(t)&&t.unit===_n.MILLISECOND?Pt(Uint8Array,as.convertArray(r[n])):at.isDecimal(t)?Pt(Uint8Array,Vd.convertArray(r[n])):at.isBinary(t)||at.isFixedSizeBinary(t)?Z$(r[n]):at.isBool(t)?_c(r[n]):at.isUtf8(t)?ra(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Z$(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 iu=class extends Ki{constructor(t){super(t),this._values=new ca(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,Ot(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 Ng=class extends _e{constructor(t){super(t),this._values=new Jl}setValue(t,n){this._values.set(t,+n)}};var Tc=class extends Ve{};Tc.prototype._setValue=kw;var Gd=class extends Tc{};Gd.prototype._setValue=Ky;var Wd=class extends Tc{};Wd.prototype._setValue=Jy;var Xd=class extends Ve{};Xd.prototype._setValue=Cw;var Rg=class extends _e{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Ir(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ec({type:this.type.indices,nullValues:n}),this.dictionary=Ec({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 Hd=class extends Ve{};Hd.prototype._setValue=Dw;var Og=class extends _e{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 Ei(this.type.listSize,new Ut(n,t.type,!0)),r}};var Mc=class extends Ve{setValue(t,n){this._values.set(t,n)}},Dg=class extends Mc{setValue(t,n){super.setValue(t,Id(n))}},kg=class extends Mc{},Fg=class extends Mc{};var Ac=class extends Ve{};Ac.prototype._setValue=Bw;var Zd=class extends Ac{};Zd.prototype._setValue=cg;var Qd=class extends Ac{};Qd.prototype._setValue=lg;var cs=class extends Ve{};cs.prototype._setValue=Pw;var Kd=class extends cs{};Kd.prototype._setValue=ug;var Jd=class extends cs{};Jd.prototype._setValue=fg;var th=class extends cs{};th.prototype._setValue=dg;var eh=class extends cs{};eh.prototype._setValue=hg;var Zr=class extends Ve{setValue(t,n){this._values.set(t,n)}},Lg=class extends Zr{},Cg=class extends Zr{},Bg=class extends Zr{},Pg=class extends Zr{},Ug=class extends Zr{},$g=class extends Zr{},zg=class extends Zr{},qg=class extends Zr{};var jg=class extends Ki{constructor(t){super(t),this._offsets=new tu}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 Ii(new Ut(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var Vg=class extends Ki{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 Mi(new Ut(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var Yg=class extends _e{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var Gg=class extends _e{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 ye([...this.type.children,new Ut(n,t.type,!0)]),r}};var ls=class extends Ve{};ls.prototype._setValue=Fw;var nh=class extends ls{};nh.prototype._setValue=tg;var rh=class extends ls{};rh.prototype._setValue=eg;var ih=class extends ls{};ih.prototype._setValue=ng;var oh=class extends ls{};oh.prototype._setValue=rg;var us=class extends Ve{};us.prototype._setValue=Lw;var sh=class extends us{};sh.prototype._setValue=ig;var ah=class extends us{};ah.prototype._setValue=og;var ch=class extends us{};ch.prototype._setValue=sg;var lh=class extends us{};lh.prototype._setValue=ag;var ou=class extends _e{constructor(t){super(t),this._typeIds=new es(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 Ut(n,t.type)];return this.type=new Ti(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.")}},Wg=class extends ou{},Xg=class extends ou{constructor(t){super(t),this._offsets=new es(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 uh=class extends Ki{constructor(t){super(t),this._values=new ca(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,ra(n))}_flushPending(t,n){}};uh.prototype._flushPending=iu.prototype._flushPending;var ev=class extends ut{visitNull(){return Yg}visitBool(){return Ng}visitInt(){return Zr}visitInt8(){return Lg}visitInt16(){return Cg}visitInt32(){return Bg}visitInt64(){return Pg}visitUint8(){return Ug}visitUint16(){return $g}visitUint32(){return zg}visitUint64(){return qg}visitFloat(){return Mc}visitFloat16(){return Dg}visitFloat32(){return kg}visitFloat64(){return Fg}visitUtf8(){return uh}visitBinary(){return iu}visitFixedSizeBinary(){return Hd}visitDate(){return Tc}visitDateDay(){return Gd}visitDateMillisecond(){return Wd}visitTimestamp(){return ls}visitTimestampSecond(){return nh}visitTimestampMillisecond(){return rh}visitTimestampMicrosecond(){return ih}visitTimestampNanosecond(){return oh}visitTime(){return us}visitTimeSecond(){return sh}visitTimeMillisecond(){return ah}visitTimeMicrosecond(){return ch}visitTimeNanosecond(){return lh}visitDecimal(){return Xd}visitList(){return jg}visitStruct(){return Gg}visitUnion(){return ou}visitDenseUnion(){return Xg}visitSparseUnion(){return Wg}visitDictionary(){return Rg}visitInterval(){return Ac}visitIntervalDayTime(){return Zd}visitIntervalYearMonth(){return Qd}visitDuration(){return cs}visitDurationSecond(){return Kd}visitDurationMillisecond(){return Jd}visitDurationMicrosecond(){return th}visistDurationNanosecond(){return eh}visitFixedSizeList(){return Og}visitMap(){return Vg}},dO=new ev;var _t=class extends ut{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function Gn(e,t){return t instanceof e.constructor}function fh(e,t){return e===t||Gn(e,t)}function fs(e,t){return e===t||Gn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Hg(e,t){return e===t||Gn(e,t)&&e.precision===t.precision}function Q$(e,t){return e===t||Gn(e,t)&&e.byteWidth===t.byteWidth}function nv(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function dh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function hh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function K$(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function J$(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function rv(e,t){return e===t||Gn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&io.compareManyFields(e.children,t.children)}function tz(e,t){return e===t||Gn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&io.visit(e.indices,t.indices)&&io.visit(e.dictionary,t.dictionary)}function iv(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function ph(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function ez(e,t){return e===t||Gn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function nz(e,t){return e===t||Gn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}_t.prototype.visitNull=fh;_t.prototype.visitBool=fh;_t.prototype.visitInt=fs;_t.prototype.visitInt8=fs;_t.prototype.visitInt16=fs;_t.prototype.visitInt32=fs;_t.prototype.visitInt64=fs;_t.prototype.visitUint8=fs;_t.prototype.visitUint16=fs;_t.prototype.visitUint32=fs;_t.prototype.visitUint64=fs;_t.prototype.visitFloat=Hg;_t.prototype.visitFloat16=Hg;_t.prototype.visitFloat32=Hg;_t.prototype.visitFloat64=Hg;_t.prototype.visitUtf8=fh;_t.prototype.visitBinary=fh;_t.prototype.visitFixedSizeBinary=Q$;_t.prototype.visitDate=nv;_t.prototype.visitDateDay=nv;_t.prototype.visitDateMillisecond=nv;_t.prototype.visitTimestamp=dh;_t.prototype.visitTimestampSecond=dh;_t.prototype.visitTimestampMillisecond=dh;_t.prototype.visitTimestampMicrosecond=dh;_t.prototype.visitTimestampNanosecond=dh;_t.prototype.visitTime=hh;_t.prototype.visitTimeSecond=hh;_t.prototype.visitTimeMillisecond=hh;_t.prototype.visitTimeMicrosecond=hh;_t.prototype.visitTimeNanosecond=hh;_t.prototype.visitDecimal=fh;_t.prototype.visitList=K$;_t.prototype.visitStruct=J$;_t.prototype.visitUnion=rv;_t.prototype.visitDenseUnion=rv;_t.prototype.visitSparseUnion=rv;_t.prototype.visitDictionary=tz;_t.prototype.visitInterval=iv;_t.prototype.visitIntervalDayTime=iv;_t.prototype.visitIntervalYearMonth=iv;_t.prototype.visitDuration=ph;_t.prototype.visitDurationSecond=ph;_t.prototype.visitDurationMillisecond=ph;_t.prototype.visitDurationMicrosecond=ph;_t.prototype.visitDurationNanosecond=ph;_t.prototype.visitFixedSizeList=ez;_t.prototype.visitMap=nz;var io=new _t;function Nc(e,t){return io.compareSchemas(e,t)}function hO(e,t){return io.compareFields(e,t)}function pO(e,t){return io.visit(e,t)}function Ec(e){let t=e.type,n=new(dO.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(Ec(Object.assign(Object.assign({},l),{type:c})))}}return n}function Zg(e,t){return rz(e,t.map(n=>n.data.concat()))}function rz(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=iz(n,s,u,t,i),s>0&&(r[o++]=Dt({type:new ye(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new ke(e,f))]}function iz(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:Dt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var mO,on=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new re([]),this._offsets=[0],this;let i,o;t[0]instanceof re&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof ke)return[c];if(c instanceof e)return c.batches;if(c instanceof se){if(c.type instanceof ye)return[new ke(new re(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 jt([c[h]])),f=new re(l.map((h,p)=>new Ut(String(h),u[p].type))),[,d]=Zg(f,u);return d.length===0?[new ke(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new re([]),!(i instanceof re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof ke))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Nc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??bg(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=gg(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?Kl.visit(new jt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
8
  ${this.toArray().join(`,
9
9
  `)}
10
- ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new ke(n,i)))}slice(t,n){let r=this.schema;[t,n]=Td({length:this.numRows},t,n);let i=Hy(this.data,this._offsets,t,n);return new e(r,i.map(o=>new ke(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Ot({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new qt(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 qt([Ot({type:new Gn,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]=Eg(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(...Eg(o,s))}};o3=Symbol.toStringTag;an[o3]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=oa(Md),e.get=oa(qe.getVisitFn(k.Struct)),e.set=Qy(Sn.getVisitFn(k.Struct)),e.indexOf=Zy(wc.getVisitFn(k.Struct)),e.getByteLength=oa(Rr.getVisitFn(k.Struct)),"Table"))(an.prototype);var a3,ke=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof re))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Ot({nullCount:0,type:new me(this.schema.fields),children:this.schema.fields.map(n=>Ot({type:n.type,nullCount:0}))})]=t,!(this.data instanceof le))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=s3(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]=Pt.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Ot({type:new me(r),length:o,children:i,nullCount:0});[this.schema,this.data]=s3(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=c3(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 qe.visit(this.data,t)}set(t,n){return Sn.visit(this.data,t,n)}indexOf(t,n){return wc.visit(this.data,t,n)}getByteLength(t){return Rr.visit(this.data,t)}[Symbol.iterator](){return Zl.visit(new qt([this.data]))}toArray(){return[...this]}concat(...t){return new an(this.schema,[this,...t])}slice(t,n){let[r]=new qt([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 qt([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 qt([Ot({type:new Gn,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 re(o,new Map(this.schema.metadata)),i=Ot({type:new me(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new me(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,Ot({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=Ot({type:new me(n.fields),length:this.numRows,children:r});return new e(n,i)}};a3=Symbol.toStringTag;ke[a3]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function s3(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:Ot({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Ot({type:new me(i),length:n,children:o})]}function c3(e,t,n=new Map){for(let r=-1,i=e.length;++r<i;){let s=e[r].type,a=t[r];if(ht.isDictionary(s)){if(!n.has(s.id))a.dictionary&&n.set(s.id,a.dictionary);else if(n.get(s.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&c3(s.children,a.children,n)}return n}var Rc=class extends ke{constructor(t){let n=t.fields.map(i=>Ot({type:i.type})),r=Ot({type:new me(t.fields),nullCount:0,children:n});super(t,r)}};var uh;(function(e){e[e.BUFFER=0]="BUFFER"})(uh||(uh={}));var fh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(fh||(fh={}));var Ag=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):fh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):uh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,fh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,uh.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 ou=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 su=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 Fr=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 su).__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 ou).__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 Ag).__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 ys=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 Fr).__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 au;(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"})(au||(au={}));var Di=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):aa.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):au.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 tn).__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,aa.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,au.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 Nv=class extends gt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Bd.startNull(n),Bd.endNull(n)}visitInt(t,n){return ki.startInt(n),ki.addBitWidth(n,t.bitWidth),ki.addIsSigned(n,t.isSigned),ki.endInt(n)}visitFloat(t,n){return ha.startFloatingPoint(n),ha.addPrecision(n,t.precision),ha.endFloatingPoint(n)}visitBinary(t,n){return Od.startBinary(n),Od.endBinary(n)}visitBool(t,n){return kd.startBool(n),kd.endBool(n)}visitUtf8(t,n){return Ud.startUtf8(n),Ud.endUtf8(n)}visitDecimal(t,n){return oo.startDecimal(n),oo.addScale(n,t.scale),oo.addPrecision(n,t.precision),oo.addBitWidth(n,t.bitWidth),oo.endDecimal(n)}visitDate(t,n){return la.startDate(n),la.addUnit(n,t.unit),la.endDate(n)}visitTime(t,n){return as.startTime(n),as.addUnit(n,t.unit),as.addBitWidth(n,t.bitWidth),as.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return cs.startTimestamp(n),cs.addUnit(n,t.unit),r!==void 0&&cs.addTimezone(n,r),cs.endTimestamp(n)}visitInterval(t,n){return pa.startInterval(n),pa.addUnit(n,t.unit),pa.endInterval(n)}visitList(t,n){return Cd.startList(n),Cd.endList(n)}visitStruct(t,n){return Pd.startStruct_(n),Pd.endStruct_(n)}visitUnion(t,n){Fi.startTypeIdsVector(n,t.typeIds.length);let r=Fi.createTypeIdsVector(n,t.typeIds);return Fi.startUnion(n),Fi.addMode(n,t.mode),Fi.addTypeIds(n,r),Fi.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return io.startDictionaryEncoding(n),io.addId(n,BigInt(t.id)),io.addIsOrdered(n,t.isOrdered),r!==void 0&&io.addIndexType(n,r),io.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return fa.startFixedSizeBinary(n),fa.addByteWidth(n,t.byteWidth),fa.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return da.startFixedSizeList(n),da.addListSize(n,t.listSize),da.endFixedSizeList(n)}visitMap(t,n){return ma.startMap(n),ma.addKeysSorted(n,t.keysSorted),ma.endMap(n)}},Mg=new Nv;function d3(e,t=new Map){return new re(lz(e,t),Ng(e.customMetadata),t)}function Rv(e){return new In(e.count,p3(e.columns),m3(e.columns))}function h3(e){return new hr(Rv(e.data),e.id,e.isDelta)}function lz(e,t){return(e.fields||[]).filter(Boolean).map(n=>Pt.fromJSON(n,t))}function l3(e,t){return(e.children||[]).filter(Boolean).map(n=>Pt.fromJSON(n,t))}function p3(e){return(e||[]).reduce((t,n)=>[...t,new Li(n.count,uz(n.VALIDITY)),...p3(n.children)],[])}function m3(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new dr(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new dr(t.length,i.TYPE.length)),i.OFFSET&&t.push(new dr(t.length,i.OFFSET.length)),i.DATA&&t.push(new dr(t.length,i.DATA.length)),t=m3(i.children,t)}return t}function uz(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function y3(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=f3(e,l3(e,t)),i=new Pt(e.name,s,e.nullable,Ng(e.customMetadata))):t.has(n=o.id)?(r=(r=o.indexType)?u3(r):new Ji,a=new Mr(t.get(n),r,n,o.isOrdered),i=new Pt(e.name,a,e.nullable,Ng(e.customMetadata))):(r=(r=o.indexType)?u3(r):new Ji,t.set(n,s=f3(e,l3(e,t))),a=new Mr(s,r,n,o.isOrdered),i=new Pt(e.name,a,e.nullable,Ng(e.customMetadata))),i||null}function Ng(e){return new Map(Object.entries(e||{}))}function u3(e){return new Be(e.isSigned,e.bitWidth)}function f3(e,t){let n=e.type.name;switch(n){case"NONE":return new Gn;case"null":return new Gn;case"binary":return new Zo;case"utf8":return new Ko;case"bool":return new Jo;case"list":return new Ei((t||[])[0]);case"struct":return new me(t||[]);case"struct_":return new me(t||[])}switch(n){case"int":{let r=e.type;return new Be(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new lr(ge[r.precision])}case"decimal":{let r=e.type;return new ts(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new es(vn[r.unit])}case"time":{let r=e.type;return new Ti($t[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new ns($t[r.unit],r.timezone)}case"interval":{let r=e.type;return new rs(Yn[r.unit])}case"union":{let r=e.type;return new Ai(Ee[r.mode],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new is(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Mi(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Ni((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var fz=Sc,dz=Or,pr=class e{static fromJSON(t,n){let r=new e(0,on.V4,n);return r._createHeader=hz(t,n),r}static decode(t){t=new dz(Et(t));let n=Di.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=pz(n,o),s}static encode(t){let n=new fz,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=In.encode(n,t.header()):t.isDictionaryBatch()&&(r=hr.encode(n,t.header())),Di.startMessage(n),Di.addVersion(n,on.V4),Di.addHeader(n,r),Di.addHeaderType(n,t.headerType),Di.addBodyLength(n,BigInt(t.bodyLength)),Di.finishMessageBuffer(n,Di.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,on.V4,Zt.Schema,t);if(t instanceof In)return new e(n,on.V4,Zt.RecordBatch,t);if(t instanceof hr)return new e(n,on.V4,Zt.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===Zt.Schema}isRecordBatch(){return this.headerType===Zt.RecordBatch}isDictionaryBatch(){return this.headerType===Zt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=cr(t)}},In=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=cr(t)}},hr=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=cr(n)}},dr=class{constructor(t,n){this.offset=cr(t),this.length=cr(n)}},Li=class{constructor(t,n){this.length=cr(t),this.nullCount=cr(n)}};function hz(e,t){return()=>{switch(t){case Zt.Schema:return re.fromJSON(e);case Zt.RecordBatch:return In.fromJSON(e);case Zt.DictionaryBatch:return hr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Zt[t]}, type: ${t} }`)}}function pz(e,t){return()=>{switch(t){case Zt.Schema:return re.decode(e.header(new ur));case Zt.RecordBatch:return In.decode(e.header(new Fr),e.version());case Zt.DictionaryBatch:return hr.decode(e.header(new ys),e.version())}throw new Error(`Unrecognized Message type: { name: ${Zt[t]}, type: ${t} }`)}}Pt.encode=Tz;Pt.decode=Sz;Pt.fromJSON=y3;re.encode=Iz;re.decode=mz;re.fromJSON=d3;In.encode=Ez;In.decode=yz;In.fromJSON=Rv;hr.encode=Az;hr.decode=gz;hr.fromJSON=h3;Li.encode=Mz;Li.decode=xz;dr.encode=Nz;dr.decode=bz;function mz(e,t=new Map){let n=vz(e,t);return new re(n,Rg(e),t)}function yz(e,t=on.V4){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new In(e.length(),_z(e),wz(e,t))}function gz(e,t=on.V4){return new hr(In.decode(e.data(),t),e.id(),e.isDelta())}function bz(e){return new dr(e.offset(),e.length())}function xz(e){return new Li(e.length(),e.nullCount())}function _z(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Li.decode(n));return t}function wz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<on.V4&&(r.bb_pos+=8*(i+1)),n[++o]=dr.decode(r));return n}function vz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Pt.decode(r,t));return n}function g3(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Pt.decode(r,t));return n}function Sz(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=x3(e,g3(e,t)),r=new Pt(e.name(),i,e.nullable(),Rg(e))):t.has(n=cr(a.id()))?(o=(o=a.indexType())?b3(o):new Ji,s=new Mr(t.get(n),o,n,a.isOrdered()),r=new Pt(e.name(),s,e.nullable(),Rg(e))):(o=(o=a.indexType())?b3(o):new Ji,t.set(n,i=x3(e,g3(e,t))),s=new Mr(i,o,n,a.isOrdered()),r=new Pt(e.name(),s,e.nullable(),Rg(e))),r||null}function Rg(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 b3(e){return new Be(e.isSigned(),e.bitWidth())}function x3(e,t){let n=e.typeType();switch(n){case xe.NONE:return new Gn;case xe.Null:return new Gn;case xe.Binary:return new Zo;case xe.Utf8:return new Ko;case xe.Bool:return new Jo;case xe.List:return new Ei((t||[])[0]);case xe.Struct_:return new me(t||[])}switch(n){case xe.Int:{let r=e.type(new ki);return new Be(r.isSigned(),r.bitWidth())}case xe.FloatingPoint:{let r=e.type(new ha);return new lr(r.precision())}case xe.Decimal:{let r=e.type(new oo);return new ts(r.scale(),r.precision(),r.bitWidth())}case xe.Date:{let r=e.type(new la);return new es(r.unit())}case xe.Time:{let r=e.type(new as);return new Ti(r.unit(),r.bitWidth())}case xe.Timestamp:{let r=e.type(new cs);return new ns(r.unit(),r.timezone())}case xe.Interval:{let r=e.type(new pa);return new rs(r.unit())}case xe.Union:{let r=e.type(new Fi);return new Ai(r.mode(),r.typeIdsArray()||[],t||[])}case xe.FixedSizeBinary:{let r=e.type(new fa);return new is(r.byteWidth())}case xe.FixedSizeList:{let r=e.type(new da);return new Mi(r.listSize(),(t||[])[0])}case xe.Map:{let r=e.type(new ma);return new Ni((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${xe[n]}" (${n})`)}function Iz(e,t){let n=t.fields.map(o=>Pt.encode(e,o));ur.startFieldsVector(e,n.length);let r=ur.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?ur.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return tn.startKeyValue(e),tn.addKey(e,a),tn.addValue(e,c),tn.endKeyValue(e)})):-1;return ur.startSchema(e),ur.addFields(e,r),ur.addEndianness(e,Rz?ca.Little:ca.Big),i!==-1&&ur.addCustomMetadata(e,i),ur.endSchema(e)}function Tz(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;ht.isDictionary(o)?(s=o.dictionary.typeId,i=Mg.visit(o,e),r=Mg.visit(o.dictionary,e)):r=Mg.visit(o,e);let a=(o.children||[]).map(u=>Pt.encode(e,u)),c=Dn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Dn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return tn.startKeyValue(e),tn.addKey(e,d),tn.addValue(e,h),tn.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Dn.startField(e),Dn.addType(e,r),Dn.addTypeType(e,s),Dn.addChildren(e,c),Dn.addNullable(e,!!t.nullable),n!==-1&&Dn.addName(e,n),i!==-1&&Dn.addDictionary(e,i),l!==-1&&Dn.addCustomMetadata(e,l),Dn.endField(e)}function Ez(e,t){let n=t.nodes||[],r=t.buffers||[];Fr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Li.encode(e,s);let i=e.endVector();Fr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())dr.encode(e,s);let o=e.endVector();return Fr.startRecordBatch(e),Fr.addLength(e,BigInt(t.length)),Fr.addNodes(e,i),Fr.addBuffers(e,o),Fr.endRecordBatch(e)}function Az(e,t){let n=In.encode(e,t.data);return ys.startDictionaryBatch(e),ys.addId(e,BigInt(t.id)),ys.addIsDelta(e,t.isDelta),ys.addData(e,n),ys.endDictionaryBatch(e)}function Mz(e,t){return su.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Nz(e,t){return ou.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Rz=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var kv=e=>`Expected ${Zt[e]} Message in stream, but was null or length 0.`,Fv=e=>`Header pointer of flatbuffer-encoded ${Zt[e]} Message is null or length 0.`,_3=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,w3=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,cu=class{constructor(t){this.source=t instanceof ao?t:new ao(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ye:t.value===-1&&(t=this.readMetadataLength()).done?ye:(t=this.readMetadata(t.value)).done?ye: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(kv(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Et(this.source.read(t));if(n.byteLength<t)throw new Error(w3(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Zt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Fv(n));return i}readMetadataLength(){let t=this.source.read(Og),n=t&&new Or(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return ye;if(n.byteLength<t)throw new Error(_3(t,n.byteLength));return{done:!1,value:pr.decode(n)}}},dh=class{constructor(t,n){this.source=t instanceof Jr?t:yy(t)?new ya(t,n):new Jr(t)}[Symbol.asyncIterator](){return this}next(){return Q(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ye:t.value===-1&&(t=yield this.readMetadataLength()).done?ye:(t=yield this.readMetadata(t.value)).done?ye:t})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Q(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Q(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(kv(t));return n.value})}readMessageBody(t){return Q(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Et(yield this.source.read(t));if(n.byteLength<t)throw new Error(w3(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Q(this,void 0,void 0,function*(){let n=Zt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Fv(n));return i})}readMetadataLength(){return Q(this,void 0,void 0,function*(){let t=yield this.source.read(Og),n=t&&new Or(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Q(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return ye;if(n.byteLength<t)throw new Error(_3(t,n.byteLength));return{done:!1,value:pr.decode(n)}})}},hh=class extends cu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof zd?t:new zd(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:pr.fromJSON(t.schema,Zt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:pr.fromJSON(n,Zt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:pr.fromJSON(n,Zt.RecordBatch)}}return this._body=[],ye}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE&&[o.TYPE]||[],...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(kv(t));return n.value}readSchema(){let t=Zt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(Fv(t));return r}},Og=4,Ov="ARROW1",lu=new Uint8Array(Ov.length);for(let e=0;e<Ov.length;e+=1)lu[e]=Ov.codePointAt(e);function kg(e,t=0){for(let n=-1,r=lu.length;++n<r;)if(lu[n]!==e[t+n])return!1;return!0}var uu=lu.length,Dv=uu+Og,v3=uu*2+Og;var en=class e extends Ic{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 Er(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 wn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return wn.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:py(t)?kz(t):yy(t)?Lz(t):Er(t)?Q(this,void 0,void 0,function*(){return yield e.from(yield t)}):gy(t)||_d(t)||xy(t)||Hr(t)?Dz(new Jr(t)):Fz(new ao(t))}static readAll(t){return t instanceof e?t.isSync()?S3(t):I3(t):py(t)||ArrayBuffer.isView(t)||vi(t)||my(t)?S3(t):I3(t)}},lo=class extends en{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Tr(this,arguments,function*(){yield Rt(yield*zl(wi(this[Symbol.iterator]())))})}},ga=class extends en{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Q(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=wi(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]()}},ba=class extends lo{constructor(t){super(t),this._impl=t}},ph=class extends ga{constructor(t){super(t),this._impl=t}},Fg=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=Ot({type:new me(this.schema.fields),length:t.length,children:r});return new ke(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new qt(l)):new qt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Yd(n,t.nodes,t.buffers,this.dictionaries).visitMany(r)}},fu=class extends Fg{constructor(t,n){super(n),this._reader=py(t)?new hh(this._handle=t):new cu(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=T3(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):ye}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ye}next(){if(this.closed)return ye;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 Rc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},du=class extends Fg{constructor(t,n){super(n),this._reader=new dh(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Q(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Q(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=T3(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ye})}return(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ye})}next(){return Q(this,void 0,void 0,function*(){if(this.closed)return ye;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 Rc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Dg=class extends fu{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 jd?t:new jd(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(Zt.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(Zt.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-Dv,r=t.readInt32(n),i=t.readAt(n-r,r);return ls.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}},Lv=class extends du{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 ya?t:new ya(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Q(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Q(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(Zt.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 Q(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(Zt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Q(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-Dv,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return ls.decode(i)})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},Cv=class extends fu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new ig(n,t.nodes,t.buffers,this.dictionaries).visitMany(r)}};function T3(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*S3(e){let t=en.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function I3(e){return Tr(this,arguments,function*(){let n=yield Rt(en.from(e));try{if(!(yield Rt(n.open({autoDestroy:!1}))).closed)do yield yield Rt(n);while(!(yield Rt(n.reset().open())).closed)}finally{yield Rt(n.cancel())}})}function kz(e){return new lo(new Cv(e))}function Fz(e){let t=e.peek(uu+7&-8);return t&&t.byteLength>=4?kg(t)?new ba(new Dg(e.read())):new lo(new fu(e)):new lo(new fu(function*(){}()))}function Dz(e){return Q(this,void 0,void 0,function*(){let t=yield e.peek(uu+7&-8);return t&&t.byteLength>=4?kg(t)?new ba(new Dg(yield e.read())):new ga(new du(e)):new ga(new du(function(){return Tr(this,arguments,function*(){})}()))})}function Lz(e){return Q(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new ya(e,t);return t>=v3&&kg(yield n.readAt(0,uu+7&-8))?new ph(new Lv(n)):new ga(new du(n))})}var Pe=class e extends gt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof ke?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof qt)return this.visitMany(t.data),this;let{type:n}=t;if(!ht.isDictionary(n)){let{length:r,nullCount:i}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");ht.isNull(n)||Ci.call(this,i<=0?new Uint8Array(0):Ql(t.offset,r,t.nullBitmap)),this.nodes.push(new Li(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 Ci(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new dr(this._byteLength,t)),this._byteLength+=t,this}function Cz(e){let{type:t,length:n,typeIds:r,valueOffsets:i}=e;if(Ci.call(this,r),t.mode===Ee.Sparse)return Bv.call(this,e);if(t.mode===Ee.Dense){if(e.offset<=0)return Ci.call(this,i),Bv.call(this,e);{let o=r.reduce((u,f)=>Math.max(u,f),r[0]),s=new Int32Array(o+1),a=new Int32Array(o+1).fill(-1),c=new Int32Array(n),l=wd(-i[0],n,i);for(let u,f,d=-1;++d<n;)(f=a[u=r[d]])===-1&&(f=a[u]=l[u]),c[d]=l[d]-f,++s[u];Ci.call(this,c);for(let u,f=-1,d=t.children.length;++f<d;)if(u=e.children[f]){let h=t.typeIds[f],p=Math.min(n,s[h]);this.visit(u.slice(a[h],p))}}}return this}function Bz(e){let t;return e.nullCount>=e.length?Ci.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Ci.call(this,Ql(e.offset,e.length,t)):Ci.call(this,_c(e.values))}function xa(e){return Ci.call(this,e.values.subarray(0,e.length*e.stride))}function E3(e){let{length:t,values:n,valueOffsets:r}=e,i=r[0],o=r[t],s=Math.min(o-i,n.byteLength-i);return Ci.call(this,wd(-r[0],t,r)),Ci.call(this,n.subarray(i,i+s)),this}function Pv(e){let{length:t,valueOffsets:n}=e;return n&&Ci.call(this,wd(n[0],t,n)),this.visit(e.children[0])}function Bv(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Pe.prototype.visitBool=Bz;Pe.prototype.visitInt=xa;Pe.prototype.visitFloat=xa;Pe.prototype.visitUtf8=E3;Pe.prototype.visitBinary=E3;Pe.prototype.visitFixedSizeBinary=xa;Pe.prototype.visitDate=xa;Pe.prototype.visitTimestamp=xa;Pe.prototype.visitTime=xa;Pe.prototype.visitDecimal=xa;Pe.prototype.visitList=Pv;Pe.prototype.visitStruct=Bv;Pe.prototype.visitUnion=Cz;Pe.prototype.visitInterval=xa;Pe.prototype.visitFixedSizeList=Pv;Pe.prototype.visitMap=Pv;var Oc=class extends Ic{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 so,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Vn(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 Er(t)?t.then(n=>this.writeAll(n)):Hr(t)?Uv(this,t):$v(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 so?this._sink=t:(this._sink=new so,t&&QA(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ZA(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||!Nc(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 an&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof ke&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Nc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Rc||this._writeRecordBatch(t):t instanceof an?this.writeAll(t.batches):vi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=pr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Zt.RecordBatch?this._recordBatchBlocks.push(new us(a,t.bodyLength,this._position)):t.headerType===Zt.DictionaryBatch&&this._dictionaryBlocks.push(new us(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=Et(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(pr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(lu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Pe.assemble(t),s=new In(t.numRows,r,i),a=pr.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}=Pe.assemble(new qt([t])),c=new In(t.length,o,s),l=new hr(c,n,r),u=pr.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}},kc=class e extends Oc{static writeAll(t,n){let r=new e(n);return Er(t)?t.then(i=>r.writeAll(i)):Hr(t)?Uv(r,t):$v(r,t)}},Fc=class e extends Oc{static writeAll(t){let n=new e;return Er(t)?t.then(r=>n.writeAll(r)):Hr(t)?Uv(n,t):$v(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=ls.encode(new ls(t,on.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function $v(e,t){let n=t;t instanceof an&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function Uv(e,t){var n,r,i,o,s,a,c;return Q(this,void 0,void 0,function*(){try{for(n=!0,r=wi(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 A3(e,t){if(Hr(e))return $z(e,t);if(vi(e))return Pz(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Pz(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=Et(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 $z(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 Q(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Q(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Q(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 Q(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=Et(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 R3(e){return new zv(e)}var zv=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=XA(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ec(o),this._getSize=i!=="bytes"?M3:N3;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"?M3:N3}),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)}},M3=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},N3=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function Lg(e,t){let n=new so,r=null,i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield n.close()})},start(a){return Q(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return Q(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 Q(this,void 0,void 0,function*(){return yield(yield en.from(n)).open(t)})}function s(a,c){return Q(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Cg(e,t){let n=new this(e),r=new Jr(n),i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Q(this,void 0,void 0,function*(){yield o(s)})},start(s){return Q(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Q(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 Dc(e){let t=en.from(e);return Er(t)?t.then(n=>Dc(n)):t.isAsync()?t.readAll().then(n=>new an(n)):new an(t.readAll())}function Bg(e,t="stream"){return(t==="stream"?kc:Fc).writeAll(e).toUint8Array(!0)}var jz=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Jw),Iv),mv),tv),Hw),pv),{compareSchemas:Nc,compareFields:r3,compareTypes:i3});wn.toDOMStream=A3;be.throughDOM=R3;en.throughDOM=Lg;ba.throughDOM=Lg;lo.throughDOM=Lg;Oc.throughDOM=Cg;Fc.throughDOM=Cg;kc.throughDOM=Cg;function Pg(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(Dc(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var mr=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?`${k3(t)}.`:""}${r}`}else return t?k3(t):"NULL"}};function k3(e){return e.split(".").map(n=>`"${n}"`).join(".")}function F3(e,t){return e instanceof mr&&e.column===t}function Vt(e){return typeof e=="string"?Cc(e):e}function Lc(e){return typeof e=="string"?D3(e):e}function D3(e){return new mr(e)}function Cc(e,t){return arguments.length===1&&(t=e,e=null),new mr(e,t)}function uo(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var gs=e=>typeof e?.addEventListener=="function";function $g(e){return e instanceof _a}var _a=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>gs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>qz(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=>gs(t)&&!$g(t)?uo(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 qz(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function jv(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];gs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:uo(a));let c=e[++o];gs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=jv(e,t);return new _a(n,r)}function qv(e){let t=Vt(e);return q`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var ei=e=>({value:e,toString:()=>uo(e)});function mh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function L3(e,t){let n=t.filter(i=>i!=null).map(Vt),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:mh})}var yr=(...e)=>L3("AND",e.flat()),hu=(...e)=>L3("OR",e.flat()),Vz=e=>t=>q`(${e} ${Vt(t)})`.annotate({op:e,a:t,visit:mh}),C3=Vz("NOT"),B3=e=>t=>q`(${Vt(t)} ${e})`.annotate({op:e,a:t,visit:mh}),pu=B3("IS NULL"),wa=B3("IS NOT NULL"),va=e=>(t,n)=>q`(${Vt(t)} ${e} ${Vt(n)})`.annotate({op:e,a:t,b:n,visit:mh}),Sa=va("="),Ug=va("<>"),Ia=va("<"),mu=va(">"),Ta=va("<="),P3=va(">="),$3=va("IS DISTINCT FROM"),zg=va("IS NOT DISTINCT FROM");function U3(e,t,n,r){t=Vt(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:mh,field:t,range:n})}var Me=(e,t,n)=>U3("BETWEEN",e,t,n),z3=(e,t,n)=>U3("NOT BETWEEN",e,t,n);function Bc(e,t){return Array.from({length:e},()=>t)}function ni(e,t){return(...n)=>{let r=n.map(Vt),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...Bc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var Vv=ni("REGEXP_MATCHES"),Yv=ni("CONTAINS"),Gv=ni("PREFIX"),Wv=ni("SUFFIX"),Yz=ni("LOWER"),Gz=ni("UPPER"),Wz=ni("LENGTH"),Xz=ni("ISNAN"),Hz=ni("ISFINITE"),Qz=ni("ISINF");var yh=class e extends _a{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?q`${n} OVER "${i}"`:q`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=q`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:n,type:r,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map(Vt),r=q(["PARTITION BY ",Bc(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(Vt),r=q(["ORDER BY ",Bc(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=j3("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=j3("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 j3(e,t){if(gs(t)){let n=q`${t}`;return n.toString=()=>`${e} ${q3(t.value)}`,n}return`${e} ${q3(t)}`}function q3(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 Bi(e,t){return(...n)=>{let r=ni(e)(...n);return new yh(e,r,t)}}var jg=Bi("ROW_NUMBER","INTEGER"),qg=Bi("RANK","INTEGER"),Vg=Bi("DENSE_RANK","INTEGER"),Yg=Bi("PERCENT_RANK"),Gg=Bi("CUME_DIST"),Wg=Bi("NTILE"),Xg=Bi("LAG"),Hg=Bi("LEAD"),Qg=Bi("FIRST_VALUE"),Zg=Bi("LAST_VALUE"),Kg=Bi("NTH_VALUE");function V3(e,...t){return q(e,...t).annotate({aggregate:!0})}var Xv=class e extends _a{constructor(t,n,r,i,o){n=(n||[]).map(Vt);let{strings:s,exprs:a}=Zz(t,n,r,i,o),{spans:c,cols:l}=jv(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(Kz).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 yh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function Zz(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...Bc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Kz(e){let t=uo(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Ht(e,t){return(...n)=>new Xv(e,n,t)}var gr=Ht("COUNT","INTEGER"),Jg=Ht("AVG"),Jz=Ht("AVG"),Y3=Ht("MAD"),Dr=Ht("MAX"),Lr=Ht("MIN"),br=Ht("SUM","DOUBLE"),G3=Ht("PRODUCT"),t0=Ht("MEDIAN"),e0=Ht("QUANTILE"),n0=Ht("MODE"),W3=Ht("VARIANCE"),X3=Ht("STDDEV"),H3=Ht("SKEWNESS"),Q3=Ht("KURTOSIS"),Z3=Ht("ENTROPY"),K3=Ht("VAR_POP"),J3=Ht("STDDEV_POP"),t6=Ht("CORR"),e6=Ht("COVAR_POP"),Hv=Ht("REGR_INTERCEPT"),Qv=Ht("REGR_SLOPE"),Zv=Ht("REGR_COUNT"),tj=Ht("REGR_R2"),Kv=Ht("REGR_SYY"),Jv=Ht("REGR_SXX"),ej=Ht("REGR_SXY"),t2=Ht("REGR_AVGX"),nj=Ht("REGR_AVGY"),rj=Ht("FIRST"),n6=Ht("LAST"),gh=Ht("ARG_MIN"),bh=Ht("ARG_MAX"),r6=Ht("STRING_AGG"),i6=Ht("ARRAY_AGG");function r0(e,t){let n=Vt(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 xh=e=>r0(e,"DOUBLE"),o6=e=>r0(e,"INTEGER");var _h=e=>{let t=Vt(e);return q`(1000 * (epoch(${t}) - second(${t})) + millisecond(${t}))::DOUBLE`},i0=e=>{let t=Vt(e);return q`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},o0=e=>{let t=Vt(e);return q`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},s0=e=>{let t=Vt(e);return q`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};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 Pc("UNION",t.flat())}static unionAll(...t){return new Pc("UNION ALL",t.flat())}static intersect(...t){return new Pc("INTERSECT",t.flat())}static except(...t){return new Pc("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:Vt(i)});else if(i instanceof mr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:a0(o),expr:Vt(i[o])});return n.select=n.select.concat(r),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:Lc(i)});else if(i instanceof mr)r.push({as:i.table,from:i});else if(c0(i)||$g(i))r.push({from:i});else if(Array.isArray(i))r.push({as:a0(i[0]),from:Lc(i[1])});else for(let o in i)r.push({as:a0(o),from:Lc(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(Vt)),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:a0(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(Vt)),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(c0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:m,query:b})=>`"${m}" AS (${b})`);p.push(`WITH ${g.join(", ")}`)}let y=t.map(({as:g,expr:m})=>F3(m,g)&&!m.table?`${m}`:`${m} AS "${g}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${y.join(", ")}`),r.length){let g=r.map(({as:m,from:b})=>{let x=c0(b)?`(${b})`:`${b}`;return!m||m===b.table?x:`${x} AS "${m}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(m=>m).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:m,method:b,seed:x}=i,_=g?`${g} ROWS`:`${m} PERCENT`,v=b?` (${b}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${_}${v}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let g=a.map(String).filter(m=>m).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:m,expr:b})=>`"${m}" AS (${b})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(m=>m).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},Pc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Vt)),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 c0(e){return e instanceof pt||e instanceof Pc}function a0(e){return ij(e)?e.slice(1,-1):e}function ij(e){return e[0]==='"'&&e[e.length-1]==='"'}function fo(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 s6(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=>`${uo(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function n2(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=oj({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return fo(t,p,{view:a,temp:c,replace:l})}function l0(e,t,n){return n2("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function u0(e,t,n){return n2("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function f0(e,t,n){return n2("read_parquet",e,t,n)}function d0(e,t,n={}){let{select:r=["*"],...i}=n,o=s6(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return fo(e,s,i)}function oj(e){return Object.entries(e).map(([t,n])=>`${t}=${e2(n)}`).join(", ")}function e2(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=>e2(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${e2(n)}`).join(", ")+"}";default:return e}}function a6(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var sj="count",aj="nulls",cj="max",lj="min",uj="distinct";var fj={[sj]:gr,[uj]:e=>gr(e).distinct(),[cj]:Dr,[lj]:Lr,[aj]:e=>gr().where(pu(e))};function c6({table:e,column:t},n){return pt.from(e).select(n.map(r=>[r,fj[r](t)]))}var l6=()=>Object.create(null),h0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=l6()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=dj(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(c6(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await hj(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function dj(e,t){let n=await e.query(`DESCRIBE ${Lc(t)}`,{type:"json",cache:!1}),r=l6();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:a6(i.column_type),nullable:i.null==="YES"};return r}async function hj(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function f6(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=u6(t^o>>8)),t=u6(t^i&255)}return pj(t)}function u6(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function pj(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var p6=e=>e,p0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,h6),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=mj(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=h6(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let b=Object.values(i.columns).map(x=>x.columns[0]);bj(d,b)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(f6(p)>>>0).toString(16)}`,m=a.exec(fo(g,p,{temp:c}));s.set(l,{table:g,result:m,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=pt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function mj(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>yj(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Me("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?yr(l.children.map(({range:u},f)=>Me(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=p6,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function yj(e,t){let{type:n,domain:r,range:i}=e,o,s;switch(n){case"linear":o=p6,s=Vt;break;case"log":o=Math.log,s=a=>q`LN(${Vt(a)})`;break;case"symlog":o=a=>Math.sign(a)*Math.log1p(Math.abs(a)),s=a=>(a=Vt(a),q`SIGN(${a}) * LN(1 + ABS(${a}))`);break;case"sqrt":o=Math.sqrt,s=a=>q`SQRT(${Vt(a)})`;break;case"utc":case"time":o=a=>+a,s=a=>a instanceof Date?+a:_h(Vt(a));break}return o?gj(r,i,t,o,s):null}function gj(e,t,n,r,i){let o=r(Math.min(e[0],e[1])),s=r(Math.max(e[0],e[1])),a=Math.abs(r(t[1])-r(t[0]))/(s-o)/n,c=n===1?"":`${n}::INTEGER * `;return l=>q`${c}FLOOR(${a}::DOUBLE * (${i(l)} - ${o}::DOUBLE))::INTEGER`}var d6={from:NaN};function h6(e){if(!e.filterIndexable)return d6;let t=e.query(),n=r2(t);if(!n||!t.groupby)return d6;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:q`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:q`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:q`MAX("${a}")`});break;case"MIN":i.push({[a]:q`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:q`COUNT(*)`}:{},from:n}}function r2(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=r2(t[0]);for(let r=1;r<t.length;++r){let i=r2(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function bj(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 m0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new p0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():xj(t,r,i)}};function xj(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function y0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function m6(e,t,n){let r=[],i=0;function o(){let s=_j(r,t);r=[],i=0;for(let a of s)vj(a,e,n),Tj(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||requestAnimationFrame(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function _j(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=wj(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function wj(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 mr&&o[s.column]||s))}return`${r}`}else return n}function vj(e,t,n){if(Sj(e))t({request:{type:"arrow",cache:!1,record:!1,query:Ij(e,n)},result:e.result=y0()});else for(let{entry:r,priority:i}of e)t(r,i)}function Sj(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 Ij(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 mr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function Tj(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=Ej(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function Ej(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var Aj=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,y6=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function g6({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&&Aj(r),o},clear(){n=new Map}}}function b6(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var ho={High:0,Normal:1,Low:2};function x6(){let e=b6(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=ho.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:y=!1,record:g=!0,options:m}=f,b=h?`${h}`:null;if(g&&l(b),y){let v=n.get(b);if(v){r.debug("Cache"),d.fulfill(v);return}}let x=performance.now(),_=await t.query({type:p,sql:b,...m});y&&n.set(b,_),r.debug(`Request: ${(performance.now()-x).toFixed(1)}`),d.fulfill(_)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?g6():f||y6():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=m6(c,n,l):!f&&s&&(s=null)},request(f,d=ho.Normal){let h=y0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function _6(){return{debug(){},info(){},log(){},warn(){},error(){}}}var g0;function Tn(e){return e?g0=e:g0==null&&(g0=new wh),g0}var wh=class{constructor(t=Pg(),n={}){this.catalog=new h0(this),this.manager=n.manager||x6(),this.logger(n.logger||console),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||_6(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=ho.Normal}={}){return this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=ho.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:ho.Low})}createBundle(t,n,r=ho.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=ho.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=ho.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t);let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new m0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t))}};var w6={};function vh(e,t=!1){let n,r,i=w6;function o(l){n=e(l).then(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=w6,a(u)}),i=l}return t?c:a}var xr=class{constructor(t){this._filterBy=t,this._requestUpdate=vh(()=>this.requestQuery(),!0)}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return Tn().requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};var b0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new i2}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},i2=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 Sh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?Mj(e,t):!0}function Mj(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 _r(e){return e instanceof Pi}var Pi=class e extends b0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>_r(n))){let n=new e,r=()=>n.update(t.map(i=>_r(i)?i.value:i));return r(),t.forEach(i=>_r(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Sh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ri(e){return e instanceof wr}var wr=class e extends Pi{static intersect({cross:t=!1}={}){return new e(new $c({cross:t}))}static union({cross:t=!1}={}){return new e(new $c({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new $c({cross:t,single:!0}))}static crossfilter(){return new e(new $c({cross:!0}))}constructor(t=new $c){super([]),this._resolved=this._value,this._resolver=t}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},$c=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?hu(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function v6(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"?Dc(n):(await n).json()}}}var Nj=Object.create,S6=Object.defineProperty,Rj=Object.getOwnPropertyDescriptor,Oj=Object.getOwnPropertyNames,kj=Object.getPrototypeOf,Fj=Object.prototype.hasOwnProperty,Dj=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Lj=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oj(t))!Fj.call(e,i)&&i!==n&&S6(e,i,{get:()=>t[i],enumerable:!(r=Rj(t,i))||r.enumerable});return e},Cj=(e,t,n)=>(n=e!=null?Nj(kj(e)):{},Lj(t||!e||!e.__esModule?S6(n,"default",{value:e,enumerable:!0}):n,e)),Bj=Dj((e,t)=>{t.exports=Worker}),Pj=(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))(Pj||{}),$j=(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))($j||{}),Uj=(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))(Uj||{}),zj=(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))(zj||{}),jj=(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))(jj||{}),qj=(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))(qj||{}),I6=class{log(e){}},T6=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var Vj=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(Vj||{}),Yj=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=en.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new an(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 E6(this._bindings,this._conn,t),r=await en.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 Gj(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=Bg(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)}},E6=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}},Gj=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=en.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new an(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new E6(this.bindings,this.connectionId,t),r=await en.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},Wj=(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))(Wj||{}),Xj=(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))(Xj||{}),Kt=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 x0(e){switch(e.typeId){case k.Binary:return{sqlType:"binary"};case k.Bool:return{sqlType:"bool"};case k.Date:return{sqlType:"date"};case k.DateDay:return{sqlType:"date32[d]"};case k.DateMillisecond:return{sqlType:"date64[ms]"};case k.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case k.Float:return{sqlType:"float"};case k.Float16:return{sqlType:"float16"};case k.Float32:return{sqlType:"float32"};case k.Float64:return{sqlType:"float64"};case k.Int:return{sqlType:"int32"};case k.Int16:return{sqlType:"int16"};case k.Int32:return{sqlType:"int32"};case k.Int64:return{sqlType:"int64"};case k.Uint16:return{sqlType:"uint16"};case k.Uint32:return{sqlType:"uint32"};case k.Uint64:return{sqlType:"uint64"};case k.Uint8:return{sqlType:"uint8"};case k.IntervalDayTime:return{sqlType:"interval[dt]"};case k.IntervalYearMonth:return{sqlType:"interval[m]"};case k.List:return{sqlType:"list",valueType:x0(e.valueType)};case k.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case k.Null:return{sqlType:"null"};case k.Utf8:return{sqlType:"utf8"};case k.Struct:return{sqlType:"struct",fields:e.children.map(t=>u2(t.name,t.type))};case k.Map:{let t=e;return{sqlType:"map",keyType:x0(t.keyType),valueType:x0(t.valueType)}}case k.Time:return{sqlType:"time[s]"};case k.TimeMicrosecond:return{sqlType:"time[us]"};case k.TimeMillisecond:return{sqlType:"time[ms]"};case k.TimeNanosecond:return{sqlType:"time[ns]"};case k.TimeSecond:return{sqlType:"time[s]"};case k.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case k.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case k.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case k.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case k.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function u2(e,t){let n=x0(t);return n.name=e,n}var Hj=new TextEncoder,A6=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 Kt("RESET",null);return await this.postTask(e)}async ping(){let e=new Kt("PING",null);await this.postTask(e)}async dropFile(e){let t=new Kt("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Kt("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Kt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Kt("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Kt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Kt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Kt("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Kt("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Kt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new Yj(this,e)}async disconnect(e){let t=new Kt("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Kt("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t){let n=new Kt("START_PENDING_QUERY",[e,t]);return await this.postTask(n)}async pollPendingQuery(e){let t=new Kt("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Kt("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Kt("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Kt("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Kt("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Kt("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Kt("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Kt("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Kt("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=Hj.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Kt("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new Kt("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let n=new Kt("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Kt("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async collectFileStatistics(e,t){let n=new Kt("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Kt("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Kt("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Kt("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Kt("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(u2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("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(u2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var Qj=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])),Zj=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])),Kj=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])),Jj=()=>(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])),f2={name:"@duckdb/duckdb-wasm",version:"1.28.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":"^13.0.0"},devDependencies:{"@types/emscripten":"^1.39.8","@types/jasmine":"^4.3.1","@typescript-eslint/eslint-plugin":"^6.5.0","@typescript-eslint/parser":"^6.7.3",esbuild:"^0.19.5",eslint:"^8.50.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.1",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.9.0",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.0.2",puppeteer:"^21.1.1",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.2",typescript:"^5.2.2","wasm-feature-detect":"^1.5.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"}}},tq=f2.name,eq=f2.version,d2=f2.version.split("."),oht=d2[0],sht=d2[1],aht=d2[2],nq=()=>typeof navigator>"u";function M6(){let e="https://cdn.jsdelivr.net/npm/".concat(tq,"@").concat(eq,"/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 o2=null,s2=null,a2=null,c2=null,l2=null;async function rq(){return o2==null&&(o2=typeof BigInt64Array<"u"),s2==null&&(s2=await Zj()),a2==null&&(a2=await Jj()),c2==null&&(c2=await Kj()),l2==null&&(l2=await Qj()),{bigInt64Array:o2,crossOriginIsolated:nq()||globalThis.crossOriginIsolated||!1,wasmExceptions:s2,wasmSIMD:c2,wasmThreads:a2,wasmBulkMemory:l2}}async function N6(e){let t=await rq();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 cht=Cj(Bj());function iq(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var lht=iq(),oq=(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))(oq||{});async function R6(e){let t=await aq(e),n=await t.connect();return{db:t,con:n,query:async r=>{let{type:i,sql:o}=r,s=await n.query(o);return i==="exec"?void 0:i==="arrow"?s:Array.from(s)}}}async function aq({log:e=!1}={}){let t=M6(),n=await N6(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new T6:new I6,s=new A6(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function h2(){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 Ea(e,t){let n=new e(t);return Tn().connect(n),n.element}var cq=e=>e&&typeof e=="object"&&!Array.isArray(e),w0=e=>Ea(_0,e),_0=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>cq(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ri(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t?Sa(r,ei(t)):null}):_r(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}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var lq={contains:Yv,prefix:Gv,suffix:Wv,regexp:Vv},uq=0,S0=e=>Ea(v0,e),v0=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++uq,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ri(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ri(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?lq[i](r,ei(t)):null}):_r(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 fq=0,T0=e=>Ea(I0,e),I0=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,width:f}={}){if(super(n),this.id="slider_"+ ++fq,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ri(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:pt.select({min:Lr(r),max:Dr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:Sa(r,ei(t))}):_r(this.selection)&&n.update(t)}};function yu(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`${dq(e.getUTCFullYear(),4)}-${bs(e.getUTCMonth()+1,2)}-${bs(e.getUTCDate(),2)}${n||r||i||o?`T${bs(n,2)}:${bs(r,2)}${i||o?`:${bs(i,2)}${o?`.${bs(o,3)}`:""}`:""}Z`:""}`}function dq(e){return e<0?`-${bs(-e,6)}`:e>9999?`+${bs(e,6)}`:bs(e,4)}function bs(e,t){return`${e}`.padStart(t,"0")}var hq=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Uc(e,t){return hq.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var p2=y2(e=>{let t=E0(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?m2(n):`${n}`}),E0=y2(e=>t=>t===0?"0":t.toLocaleString(e)),Zht=p2(),Kht=E0();function m2(e){return yu(e,"Invalid Date")}function y2(e){let t=y2,n;return(r="en")=>r===t?n:n=e(t=r)}var pq=-1,M0=e=>Ea(A0,e),A0=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}={}){super(n),this.id=`table-${++pq}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:y,scrollTop:g,clientHeight:m}=d.target,b=g<f;f=g,!(b||h||p)&&y-g<2*m&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),Tn().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Cc(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=mq(this.format,t),this.style.innerText=bq(this.id,yq(this.align,t),gq(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?qv(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function mq(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return E0(n);case"date":return m2;default:return p2(n)}})}function yq(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function gq(e={},t){return t.map(({column:n})=>e[n])}function bq(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(" ")}var zc=Symbol("Fixed"),$i=Symbol("Transient"),N0=Symbol("Transform");var xq=["rectY-x","rectX-y","rect-x","rect-y"];function _q(e,t){return xq.includes(`${t}-${e}`)}function Ih(e,t={steps:25}){let n=(r,i)=>_q(i,r.type)?{[`${i}1`]:g2(r,e,t),[`${i}2`]:g2(r,e,{...t,offset:1})}:{[i]:g2(r,e,t)};return n[N0]=!0,n}function g2(e,t,n){return{column:t,label:t,get stats(){return["min","max"]},get columns(){return[t]},get basis(){return t},toString(){let{min:r,max:i}=e.stats[t],o=wq(r,i,n),s=Vt(t),a=o.min===0?s:`(${s} - ${o.min})`,c=`${(o.max-o.min)/o.steps}::DOUBLE`,l=n.offset?`${n.offset} + `:"";return`${o.min} + ${c} * (${l}FLOOR(${a} / ${c})::INTEGER)`}}}function wq(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let y=0,g=f.length;y<g;++y)d=u/f[y],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var xA={};_i(xA,{align:()=>N5,aspectRatio:()=>R5,attribute:()=>bA,attributes:()=>mw,axis:()=>O5,colorClamp:()=>JB,colorDomain:()=>ZB,colorInterpolate:()=>n7,colorLabel:()=>o7,colorNice:()=>t7,colorPivot:()=>r7,colorRange:()=>KB,colorReverse:()=>s7,colorScale:()=>QB,colorScheme:()=>e7,colorSymmetric:()=>i7,colorTickFormat:()=>c7,colorZero:()=>a7,facetGrid:()=>XC,facetLabel:()=>HC,facetMargin:()=>qC,facetMarginBottom:()=>YC,facetMarginLeft:()=>GC,facetMarginRight:()=>WC,facetMarginTop:()=>VC,fxAlign:()=>rB,fxAriaDescription:()=>wB,fxAriaLabel:()=>_B,fxAxis:()=>aB,fxDomain:()=>QC,fxFontVariant:()=>xB,fxGrid:()=>pB,fxInset:()=>JC,fxInsetLeft:()=>tB,fxInsetRight:()=>eB,fxLabel:()=>yB,fxLabelAnchor:()=>gB,fxLabelOffset:()=>bB,fxLine:()=>mB,fxNice:()=>KC,fxPadding:()=>iB,fxPaddingInner:()=>oB,fxPaddingOuter:()=>sB,fxRange:()=>ZC,fxReverse:()=>vB,fxRound:()=>nB,fxTickFormat:()=>dB,fxTickPadding:()=>fB,fxTickRotate:()=>hB,fxTickSize:()=>lB,fxTickSpacing:()=>uB,fxTicks:()=>cB,fyAlign:()=>RB,fyAriaDescription:()=>XB,fyAriaLabel:()=>WB,fyAxis:()=>DB,fyDomain:()=>SB,fyFontVariant:()=>GB,fyGrid:()=>zB,fyInset:()=>EB,fyInsetBottom:()=>MB,fyInsetTop:()=>AB,fyLabel:()=>qB,fyLabelAnchor:()=>VB,fyLabelOffset:()=>YB,fyLine:()=>jB,fyNice:()=>TB,fyPadding:()=>OB,fyPaddingInner:()=>kB,fyPaddingOuter:()=>FB,fyRange:()=>IB,fyReverse:()=>HB,fyRound:()=>NB,fyTickFormat:()=>$B,fyTickPadding:()=>PB,fyTickRotate:()=>UB,fyTickSize:()=>CB,fyTickSpacing:()=>BB,fyTicks:()=>LB,grid:()=>F5,height:()=>S5,inset:()=>k5,label:()=>D5,lengthClamp:()=>A7,lengthDomain:()=>T7,lengthNice:()=>M7,lengthRange:()=>E7,lengthScale:()=>I7,lengthZero:()=>N7,margin:()=>I5,marginBottom:()=>M5,marginLeft:()=>T5,marginRight:()=>E5,marginTop:()=>A5,margins:()=>x5,name:()=>g5,opacityClamp:()=>d7,opacityDomain:()=>u7,opacityLabel:()=>p7,opacityNice:()=>h7,opacityRange:()=>f7,opacityReverse:()=>m7,opacityScale:()=>l7,opacityTickFormat:()=>g7,opacityZero:()=>y7,padding:()=>L5,projectionClip:()=>U7,projectionDomain:()=>D7,projectionInset:()=>L7,projectionInsetBottom:()=>$7,projectionInsetLeft:()=>C7,projectionInsetRight:()=>B7,projectionInsetTop:()=>P7,projectionParallels:()=>O7,projectionPrecision:()=>k7,projectionRotate:()=>F7,projectionType:()=>R7,rClamp:()=>w7,rDomain:()=>x7,rNice:()=>v7,rRange:()=>_7,rScale:()=>b7,rZero:()=>S7,round:()=>C5,style:()=>w5,width:()=>v5,xAlign:()=>G5,xAriaDescription:()=>uC,xAriaLabel:()=>lC,xAxis:()=>Q5,xClamp:()=>V5,xDomain:()=>P5,xFontVariant:()=>cC,xGrid:()=>rC,xInset:()=>z5,xInsetLeft:()=>j5,xInsetRight:()=>q5,xLabel:()=>oC,xLabelAnchor:()=>sC,xLabelOffset:()=>aC,xLine:()=>iC,xNice:()=>U5,xPadding:()=>W5,xPaddingInner:()=>X5,xPaddingOuter:()=>H5,xRange:()=>$5,xReverse:()=>fC,xRound:()=>Y5,xScale:()=>B5,xTickFormat:()=>eC,xTickPadding:()=>tC,xTickRotate:()=>nC,xTickSize:()=>K5,xTickSpacing:()=>J5,xTicks:()=>Z5,xZero:()=>dC,xyDomain:()=>_5,yAlign:()=>vC,yAriaDescription:()=>UC,yAriaLabel:()=>$C,yAxis:()=>EC,yClamp:()=>_C,yDomain:()=>pC,yFontVariant:()=>PC,yGrid:()=>FC,yInset:()=>gC,yInsetBottom:()=>xC,yInsetTop:()=>bC,yLabel:()=>LC,yLabelAnchor:()=>CC,yLabelOffset:()=>BC,yLine:()=>DC,yNice:()=>yC,yPadding:()=>SC,yPaddingInner:()=>IC,yPaddingOuter:()=>TC,yRange:()=>mC,yReverse:()=>zC,yRound:()=>wC,yScale:()=>hC,yTickFormat:()=>OC,yTickPadding:()=>RC,yTickRotate:()=>kC,yTickSize:()=>MC,yTickSpacing:()=>NC,yTicks:()=>AC,yZero:()=>jC});var hw={};_i(hw,{Area:()=>kl,Arrow:()=>Lm,BarX:()=>Cm,BarY:()=>Bm,Cell:()=>Fl,Contour:()=>Gm,Density:()=>Hm,Dot:()=>Dl,Frame:()=>Am,Geo:()=>Qm,Hexgrid:()=>Zm,Image:()=>Km,Line:()=>Ll,Link:()=>Fm,Mark:()=>mt,Raster:()=>Ym,Rect:()=>Bl,RuleX:()=>vm,RuleY:()=>Sm,Text:()=>Nl,TickX:()=>zm,TickY:()=>jm,Tip:()=>Mm,Vector:()=>Ol,area:()=>km,areaX:()=>ac,areaY:()=>Js,arrow:()=>TD,auto:()=>CD,autoSpec:()=>BE,axisFx:()=>k_,axisFy:()=>O_,axisX:()=>Tm,axisY:()=>Im,barX:()=>Yo,barY:()=>Go,bin:()=>Ks,binX:()=>qo,binY:()=>Vo,bollinger:()=>fc,bollingerX:()=>jD,bollingerY:()=>qD,boxX:()=>VD,boxY:()=>YD,cell:()=>cc,cellX:()=>AD,cellY:()=>MD,centroid:()=>zL,circle:()=>OD,cluster:()=>UL,column:()=>yn,contour:()=>tL,crosshair:()=>rL,crosshairX:()=>iL,crosshairY:()=>oL,delaunayLink:()=>cL,delaunayMesh:()=>lL,density:()=>pL,differenceY:()=>gL,dodgeX:()=>e5,dodgeY:()=>n5,dot:()=>gi,dotX:()=>ND,dotY:()=>RD,filter:()=>Pk,find:()=>Wk,formatIsoDate:()=>GT,formatMonth:()=>Kk,formatWeekday:()=>Jk,frame:()=>Bf,geo:()=>nw,geoCentroid:()=>jL,graticule:()=>xL,gridFx:()=>C_,gridFy:()=>D_,gridX:()=>L_,gridY:()=>F_,group:()=>pm,groupX:()=>Ja,groupY:()=>tc,groupZ:()=>hm,hexagon:()=>kD,hexbin:()=>_L,hexgrid:()=>wL,hull:()=>uL,identity:()=>W,image:()=>SL,indexOf:()=>Ie,initializer:()=>ve,interpolateNearest:()=>VE,interpolateNone:()=>ew,interpolatorBarycentric:()=>qE,interpolatorRandomWalk:()=>YE,legend:()=>WF,line:()=>Cl,lineX:()=>lc,lineY:()=>uc,linearRegressionX:()=>EL,linearRegressionY:()=>AL,link:()=>G_,map:()=>Sr,mapX:()=>Qf,mapY:()=>Zf,marks:()=>Ke,normalize:()=>fw,normalizeX:()=>s5,normalizeY:()=>a5,plot:()=>Rm,pointer:()=>kf,pointerX:()=>Ff,pointerY:()=>Tl,raster:()=>QD,rect:()=>$m,rectX:()=>Wf,rectY:()=>Xf,reverse:()=>$k,ruleX:()=>Yr,ruleY:()=>Gr,scale:()=>zo,select:()=>l5,selectFirst:()=>dA,selectLast:()=>hA,selectMaxX:()=>d5,selectMaxY:()=>h5,selectMinX:()=>u5,selectMinY:()=>f5,shiftX:()=>c5,shuffle:()=>Uk,sort:()=>H1,sphere:()=>bL,spike:()=>AF,stackX:()=>DE,stackX1:()=>yD,stackX2:()=>gD,stackY:()=>LE,stackY1:()=>bD,stackY2:()=>xD,text:()=>jo,textX:()=>I_,textY:()=>T_,tickX:()=>K_,tickY:()=>J_,tip:()=>$_,transform:()=>gn,tree:()=>sA,treeLink:()=>aw,treeNode:()=>Jm,valueof:()=>dt,vector:()=>SE,vectorX:()=>M_,vectorY:()=>N_,voronoi:()=>fL,voronoiMesh:()=>dL,window:()=>Kf,windowX:()=>BD,windowY:()=>PD});function Gt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Wn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function xs(e){let t,n,r;e.length!==2?(t=Gt,n=(a,c)=>Gt(e(a),c),r=(a,c)=>e(a)-c):(t=e===Gt||e===Wn?e:vq,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 vq(){return 0}function Th(e){return e===null?NaN:+e}function*O6(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 k6=xs(Gt),F6=k6.right,Sq=k6.left,Iq=xs(Th).center,_s=F6;var Eh=D6(L6),b2=D6(Tq);function D6(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?(gu(a,l,i,o,s),gu(a,i,l,o,s),gu(a,l,i,o,s),bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)):a?(gu(a,i,l,o,s),gu(a,l,i,o,s),gu(a,i,l,o,s)):c&&(bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)),t}}function gu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function bu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function Tq(e){let t=L6(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 L6(e){let t=Math.floor(e);if(t===e)return Eq(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 Eq(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 po(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 Aq(e){return e.length|0}function Mq(e){return!(e>0)}function Nq(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function Rq(e){return t=>e(...t)}function R0(...e){let t=typeof e[e.length-1]=="function"&&Rq(e.pop());e=e.map(Nq);let n=e.map(Aq),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(Mq))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 O0(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 Aa(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function ii(e,t){let n=Aa(e,t);return n&&Math.sqrt(n)}function se(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 En=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 Xn=class extends Map{constructor(t,n=P6){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(x2(this,t))}has(t){return super.has(x2(this,t))}set(t,n){return super.set(C6(this,t),n)}delete(t){return super.delete(B6(this,t))}},Cr=class extends Set{constructor(t,n=P6){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(x2(this,t))}add(t){return super.add(C6(this,t))}delete(t){return super.delete(B6(this,t))}};function x2({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function C6({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function B6({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function P6(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Ah(e){return e}function cn(e,...t){return w2(e,Ah,Ah,t)}function Ui(e,t,...n){return w2(e,Ah,t,n)}function _2(e,t,...n){return w2(e,Array.from,t,n)}function w2(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Xn,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 v2(e,t){return Array.from(t,n=>e[n])}function mo(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=jc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>jc(n[i],n[o]))),v2(e,r)}return e.sort(Mh(n))}function Mh(e=Gt){if(e===Gt)return jc;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 jc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function xu(e,t,n){return(t.length!==2?mo(Ui(e,t,n),([r,i],[o,s])=>Gt(i,s)||Gt(r,o)):mo(cn(e,n),([r,i],[o,s])=>t(i,s)||Gt(r,o))).map(([r])=>r)}var Oq=Math.sqrt(50),kq=Math.sqrt(10),Fq=Math.sqrt(2);function k0(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>=Oq?10:o>=kq?5:o>=Fq?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?k0(e,t,n*2):[a,c,l]}function An(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?k0(t,e,n):k0(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 ws(e,t,n){return t=+t,e=+e,n=+n,k0(e,t,n)[2]}function _u(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?ws(t,e,n):ws(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function wu(e,t,n){let r;for(;;){let i=ws(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 Ma(e){return Math.max(1,Math.ceil(Math.log(po(e))/Math.LN2)+1)}function Ut(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 F0(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 ae(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 D0(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 L0(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?jc:Mh(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));L0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Nh(e,n,t),i(e[r],o)>0&&Nh(e,n,r);s<a;){for(Nh(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Nh(e,n,a):(++a,Nh(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Nh(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function qc(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)>0:Gt(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 Hn(e,t,n){if(e=Float64Array.from(O6(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ae(e);if(t>=1)return Ut(e);var r,i=(r-1)*t,o=Math.floor(i),s=Ut(L0(e,o).subarray(0,o+1)),a=ae(e.subarray(o+1));return s+(a-s)*(i-o)}}function S2(e,t,n=Th){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 C0(e,t,n){let r=po(e),i=Hn(e,.75)-Hn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Rh(e,t,n){let r=po(e),i=ii(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function vs(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 zi(e,t){return Hn(e,.5,t)}function*Lq(e){for(let t of e)yield*t}function vu(e){return Array.from(Lq(e))}function Su(e,t){let n=new Xn;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 B0(e,t=Cq){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function Cq(e,t){return[e,t]}function $e(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 Oh(e,t=Gt){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=Gt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Gt?(a,c)=>jc(n[a],n[c]):Mh(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 P0(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)<0:Gt(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 Mn(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 Na(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function $6(e){return e}var I2=1,T2=2,E2=3,$0=4,U6=1e-6;function Bq(e){return"translate("+e+",0)"}function Pq(e){return"translate(0,"+e+")"}function $q(e){return t=>+e(t)}function Uq(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function zq(){return!this.__axis}function jq(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===I2||e===$0?-1:1,u=e===$0||e===T2?"x":"y",f=e===I2||e===E2?Bq:Pq;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,n):$6),g=Math.max(o,0)+a,m=t.range(),b=+m[0]+c,x=+m[m.length-1]+c,_=(t.bandwidth?Uq:$q)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),M=T.exit(),R=T.enter().append("g").attr("class","tick"),I=T.select("line"),E=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(R),I=I.merge(R.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),E=E.merge(R.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===I2?"0em":e===E2?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),I=I.transition(h),E=E.transition(h),M=M.transition(h).attr("opacity",U6).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),R.attr("opacity",U6).attr("transform",function(O){var F=this.parentNode.__axis;return f((F&&isFinite(F=F(O))?F:_(O))+c)})),M.remove(),w.attr("d",e===$0||e===T2?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),T.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),I.attr(u+"2",l*o),E.attr(u,l*g).text(y),v.filter(zq).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===T2?"start":e===$0?"end":"middle"),v.each(function(){this.__axis=_})}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 A2(e){return jq(E2,e)}var qq={value:()=>{}};function j6(){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 U0(n)}function U0(e){this._=e}function Vq(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}})}U0.prototype=j6.prototype={constructor:U0,on:function(e,t){var n=this._,r=Vq(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=Yq(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]=z6(n[i],e.name,t);else if(t==null)for(i in n)n[i]=z6(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 U0(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 Yq(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function z6(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=qq,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vc=j6;var z0="http://www.w3.org/1999/xhtml",oi={svg:"http://www.w3.org/2000/svg",xhtml:z0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ss(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oi.hasOwnProperty(t)?{space:oi[t],local:e}:e}function Gq(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===z0&&t.documentElement.namespaceURI===z0?t.createElement(e):t.createElementNS(n,e)}}function Wq(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Is(e){var t=Ss(e);return(t.local?Wq:Gq)(t)}function Xq(){}function Yc(e){return e==null?Xq:function(){return this.querySelector(e)}}function q6(e){typeof e!="function"&&(e=Yc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Fe(r,this._parents)}function M2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Hq(){return[]}function kh(e){return e==null?Hq:function(){return this.querySelectorAll(e)}}function Qq(e){return function(){return M2(e.apply(this,arguments))}}function V6(e){typeof e=="function"?e=Qq(e):e=kh(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),i.push(c));return new Fe(r,i)}function Fh(e){return function(){return this.matches(e)}}function j0(e){return function(t){return t.matches(e)}}var Zq=Array.prototype.find;function Kq(e){return function(){return Zq.call(this.children,e)}}function Jq(){return this.firstElementChild}function Y6(e){return this.select(e==null?Jq:Kq(typeof e=="function"?e:j0(e)))}var tV=Array.prototype.filter;function eV(){return Array.from(this.children)}function nV(e){return function(){return tV.call(this.children,e)}}function G6(e){return this.selectAll(e==null?eV:nV(typeof e=="function"?e:j0(e)))}function W6(e){typeof e!="function"&&(e=Fh(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Fe(r,this._parents)}function q0(e){return new Array(e.length)}function X6(){return new Fe(this._enter||this._groups.map(q0),this._parents)}function Dh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Dh.prototype={constructor:Dh,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 H6(e){return function(){return e}}function rV(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 Dh(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function iV(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 Dh(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function oV(e){return e.__data__}function Q6(e,t){if(!arguments.length)return Array.from(this,oV);var n=t?iV:rV,r=this._parents,i=this._groups;typeof e!="function"&&(e=H6(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=sV(e.call(u,u&&u.__data__,l,r)),p=h.length,y=a[l]=new Array(p),g=s[l]=new Array(p),m=c[l]=new Array(d);n(u,f,y,g,m,h,t);for(var b=0,x=0,_,v;b<p;++b)if(_=y[b]){for(b>=x&&(x=b+1);!(v=g[x])&&++x<p;);_._next=v||null}}return s=new Fe(s,r),s._enter=a,s._exit=c,s}function sV(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Z6(){return new Fe(this._exit||this._groups.map(q0),this._parents)}function K6(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 J6(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new Fe(a,this._parents)}function tN(){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 eN(e){e||(e=aV);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Fe(i,this._parents).order()}function aV(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nN(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rN(){return Array.from(this)}function iN(){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 oN(){let e=0;for(let t of this)++e;return e}function sN(){return!this.node()}function aN(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 cV(e){return function(){this.removeAttribute(e)}}function lV(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uV(e,t){return function(){this.setAttribute(e,t)}}function fV(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function dV(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function hV(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 cN(e,t){var n=Ss(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?lV:cV:typeof t=="function"?n.local?hV:dV:n.local?fV:uV)(n,t))}function V0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pV(e){return function(){this.style.removeProperty(e)}}function mV(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function lN(e,t,n){return arguments.length>1?this.each((t==null?pV:typeof t=="function"?yV:mV)(e,t,n??"")):Ra(this.node(),e)}function Ra(e,t){return e.style.getPropertyValue(t)||V0(e).getComputedStyle(e,null).getPropertyValue(t)}function gV(e){return function(){delete this[e]}}function bV(e,t){return function(){this[e]=t}}function xV(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function uN(e,t){return arguments.length>1?this.each((t==null?gV:typeof t=="function"?xV:bV)(e,t)):this.node()[e]}function fN(e){return e.trim().split(/^|\s+/)}function N2(e){return e.classList||new dN(e)}function dN(e){this._node=e,this._names=fN(e.getAttribute("class")||"")}dN.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 hN(e,t){for(var n=N2(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function pN(e,t){for(var n=N2(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function _V(e){return function(){hN(this,e)}}function wV(e){return function(){pN(this,e)}}function vV(e,t){return function(){(t.apply(this,arguments)?hN:pN)(this,e)}}function mN(e,t){var n=fN(e+"");if(arguments.length<2){for(var r=N2(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?vV:t?_V:wV)(n,t))}function SV(){this.textContent=""}function IV(e){return function(){this.textContent=e}}function TV(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function yN(e){return arguments.length?this.each(e==null?SV:(typeof e=="function"?TV:IV)(e)):this.node().textContent}function EV(){this.innerHTML=""}function AV(e){return function(){this.innerHTML=e}}function MV(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gN(e){return arguments.length?this.each(e==null?EV:(typeof e=="function"?MV:AV)(e)):this.node().innerHTML}function NV(){this.nextSibling&&this.parentNode.appendChild(this)}function bN(){return this.each(NV)}function RV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xN(){return this.each(RV)}function _N(e){var t=typeof e=="function"?e:Is(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function OV(){return null}function wN(e,t){var n=typeof e=="function"?e:Is(e),r=t==null?OV:typeof t=="function"?t:Yc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function kV(){var e=this.parentNode;e&&e.removeChild(this)}function vN(){return this.each(kV)}function FV(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function DV(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function SN(e){return this.select(e?DV:FV)}function IN(e){return arguments.length?this.property("__data__",e):this.node().__data__}function LV(e){return function(t){e.call(this,t,this.__data__)}}function CV(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 BV(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 PV(e,t,n){return function(){var r=this.__on,i,o=LV(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 TN(e,t,n){var r=CV(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?PV:BV,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function EN(e,t,n){var r=V0(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 $V(e,t){return function(){return EN(this,e,t)}}function UV(e,t){return function(){return EN(this,e,t.apply(this,arguments))}}function AN(e,t){return this.each((typeof t=="function"?UV:$V)(e,t))}function*MN(){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 R2=[null];function Fe(e,t){this._groups=e,this._parents=t}function NN(){return new Fe([[document.documentElement]],R2)}function zV(){return this}Fe.prototype=NN.prototype={constructor:Fe,select:q6,selectAll:V6,selectChild:Y6,selectChildren:G6,filter:W6,data:Q6,enter:X6,exit:Z6,join:K6,merge:J6,selection:zV,order:tN,sort:eN,call:nN,nodes:rN,node:iN,size:oN,empty:sN,each:aN,attr:cN,style:lN,property:uN,classed:mN,text:yN,html:gN,raise:bN,lower:xN,append:_N,insert:wN,remove:vN,clone:SN,datum:IN,on:TN,dispatch:AN,[Symbol.iterator]:MN};var Ts=NN;function zt(e){return typeof e=="string"?new Fe([[document.querySelector(e)]],[document.documentElement]):new Fe([[e]],R2)}function RN(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ln(e,t){if(e=RN(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 Y0={capture:!0,passive:!1};function G0(e){e.preventDefault(),e.stopImmediatePropagation()}function Lh(e){var t=e.document.documentElement,n=zt(e).on("dragstart.drag",G0,Y0);"onselectstart"in t?n.on("selectstart.drag",G0,Y0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ch(e,t){var n=e.document.documentElement,r=zt(e).on("dragstart.drag",null);t&&(r.on("click.drag",G0,Y0),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 Es(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Oa(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function go(){}var ka=.7,Xc=1/ka,Iu="\\s*([+-]?\\d+)\\s*",Bh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jV=/^#([0-9a-f]{3,8})$/,qV=new RegExp(`^rgb\\(${Iu},${Iu},${Iu}\\)$`),VV=new RegExp(`^rgb\\(${yo},${yo},${yo}\\)$`),YV=new RegExp(`^rgba\\(${Iu},${Iu},${Iu},${Bh}\\)$`),GV=new RegExp(`^rgba\\(${yo},${yo},${yo},${Bh}\\)$`),WV=new RegExp(`^hsl\\(${Bh},${yo},${yo}\\)$`),XV=new RegExp(`^hsla\\(${Bh},${yo},${yo},${Bh}\\)$`),ON={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};Es(go,Br,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:kN,formatHex:kN,formatHex8:HV,formatHsl:QV,formatRgb:FN,toString:FN});function kN(){return this.rgb().formatHex()}function HV(){return this.rgb().formatHex8()}function QV(){return $N(this).formatHsl()}function FN(){return this.rgb().formatRgb()}function Br(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=jV.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?DN(t):n===3?new Ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?W0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?W0(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=qV.exec(e))?new Ve(t[1],t[2],t[3],1):(t=VV.exec(e))?new Ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=YV.exec(e))?W0(t[1],t[2],t[3],t[4]):(t=GV.exec(e))?W0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=WV.exec(e))?BN(t[1],t[2]/100,t[3]/100,1):(t=XV.exec(e))?BN(t[1],t[2]/100,t[3]/100,t[4]):ON.hasOwnProperty(e)?DN(ON[e]):e==="transparent"?new Ve(NaN,NaN,NaN,0):null}function DN(e){return new Ve(e>>16&255,e>>8&255,e&255,1)}function W0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ve(e,t,n,r)}function Ph(e){return e instanceof go||(e=Br(e)),e?(e=e.rgb(),new Ve(e.r,e.g,e.b,e.opacity)):new Ve}function ln(e,t,n,r){return arguments.length===1?Ph(e):new Ve(e,t,n,r??1)}function Ve(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Es(Ve,ln,Oa(go,{brighter(e){return e=e==null?Xc:Math.pow(Xc,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ve(Wc(this.r),Wc(this.g),Wc(this.b),H0(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:LN,formatHex:LN,formatHex8:ZV,formatRgb:CN,toString:CN}));function LN(){return`#${Gc(this.r)}${Gc(this.g)}${Gc(this.b)}`}function ZV(){return`#${Gc(this.r)}${Gc(this.g)}${Gc(this.b)}${Gc((isNaN(this.opacity)?1:this.opacity)*255)}`}function CN(){let e=H0(this.opacity);return`${e===1?"rgb(":"rgba("}${Wc(this.r)}, ${Wc(this.g)}, ${Wc(this.b)}${e===1?")":`, ${e})`}`}function H0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gc(e){return e=Wc(e),(e<16?"0":"")+e.toString(16)}function BN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ji(e,t,n,r)}function $N(e){if(e instanceof ji)return new ji(e.h,e.s,e.l,e.opacity);if(e instanceof go||(e=Br(e)),!e)return new ji;if(e instanceof ji)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 ji(s,a,c,e.opacity)}function $h(e,t,n,r){return arguments.length===1?$N(e):new ji(e,t,n,r??1)}function ji(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Es(ji,$h,Oa(go,{brighter(e){return e=e==null?Xc:Math.pow(Xc,e),new ji(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new ji(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 Ve(O2(e>=240?e-240:e+120,i,r),O2(e,i,r),O2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new ji(PN(this.h),X0(this.s),X0(this.l),H0(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=H0(this.opacity);return`${e===1?"hsl(":"hsla("}${PN(this.h)}, ${X0(this.s)*100}%, ${X0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function PN(e){return e=(e||0)%360,e<0?e+360:e}function X0(e){return Math.max(0,Math.min(1,e||0))}function O2(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 Q0=Math.PI/180,Z0=180/Math.PI;var K0=18,UN=.96422,zN=1,jN=.82521,qN=4/29,Tu=6/29,VN=3*Tu*Tu,KV=Tu*Tu*Tu;function YN(e){if(e instanceof bo)return new bo(e.l,e.a,e.b,e.opacity);if(e instanceof As)return GN(e);e instanceof Ve||(e=Ph(e));var t=L2(e.r),n=L2(e.g),r=L2(e.b),i=k2((.2225045*t+.7168786*n+.0606169*r)/zN),o,s;return t===n&&n===r?o=s=i:(o=k2((.4360747*t+.3850649*n+.1430804*r)/UN),s=k2((.0139322*t+.0971045*n+.7141733*r)/jN)),new bo(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Eu(e,t,n,r){return arguments.length===1?YN(e):new bo(e,t,n,r??1)}function bo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Es(bo,Eu,Oa(go,{brighter(e){return new bo(this.l+K0*(e??1),this.a,this.b,this.opacity)},darker(e){return new bo(this.l-K0*(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=UN*F2(t),e=zN*F2(e),n=jN*F2(n),new Ve(D2(3.1338561*t-1.6168667*e-.4906146*n),D2(-.9787684*t+1.9161415*e+.033454*n),D2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function k2(e){return e>KV?Math.pow(e,1/3):e/VN+qN}function F2(e){return e>Tu?e*e*e:VN*(e-qN)}function D2(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function L2(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function JV(e){if(e instanceof As)return new As(e.h,e.c,e.l,e.opacity);if(e instanceof bo||(e=YN(e)),e.a===0&&e.b===0)return new As(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Z0;return new As(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Uh(e,t,n,r){return arguments.length===1?JV(e):new As(e,t,n,r??1)}function As(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function GN(e){if(isNaN(e.h))return new bo(e.l,0,0,e.opacity);var t=e.h*Q0;return new bo(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Es(As,Uh,Oa(go,{brighter(e){return new As(this.h,this.c,this.l+K0*(e??1),this.opacity)},darker(e){return new As(this.h,this.c,this.l-K0*(e??1),this.opacity)},rgb(){return GN(this).rgb()}}));var QN=-.14861,C2=1.78277,B2=-.29227,J0=-.90649,zh=1.97294,WN=zh*J0,XN=zh*C2,HN=C2*B2-J0*QN;function tY(e){if(e instanceof Hc)return new Hc(e.h,e.s,e.l,e.opacity);e instanceof Ve||(e=Ph(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(HN*r+WN*t-XN*n)/(HN+WN-XN),o=r-i,s=(zh*(n-i)-B2*o)/J0,a=Math.sqrt(s*s+o*o)/(zh*i*(1-i)),c=a?Math.atan2(s,o)*Z0-120:NaN;return new Hc(c<0?c+360:c,a,i,e.opacity)}function Qn(e,t,n,r){return arguments.length===1?tY(e):new Hc(e,t,n,r??1)}function Hc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Es(Hc,Qn,Oa(go,{brighter(e){return e=e==null?Xc:Math.pow(Xc,e),new Hc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Hc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Q0,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ve(255*(t+n*(QN*r+C2*i)),255*(t+n*(B2*r+J0*i)),255*(t+n*(zh*r)),this.opacity)}}));function P2(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 ZN(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 P2((n-r/t)*t,s,i,o,a)}}function KN(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 P2((n-r/t)*t,i,o,s,a)}}var Au=e=>()=>e;function JN(e,t){return function(n){return e+n*t}}function eY(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 Mu(e,t){var n=t-e;return n?JN(e,n>180||n<-180?n-360*Math.round(n/360):n):Au(isNaN(e)?t:e)}function t4(e){return(e=+e)==1?Se:function(t,n){return n-t?eY(t,n,e):Au(isNaN(t)?n:t)}}function Se(e,t){var n=t-e;return n?JN(e,n):Au(isNaN(e)?t:e)}var si=function e(t){var n=t4(t);function r(i,o){var s=n((i=ln(i)).r,(o=ln(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Se(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 e4(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=ln(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 $2=e4(ZN),nY=e4(KN);function n4(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 r4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function i4(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]=Pr(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 o4(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function _e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function s4(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]=Pr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var z2=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,U2=new RegExp(z2.source,"g");function rY(e){return function(){return e}}function iY(e){return function(t){return e(t)+""}}function jh(e,t){var n=z2.lastIndex=U2.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=z2.exec(e))&&(i=U2.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:_e(r,i)})),n=U2.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?iY(c[0].x):rY(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 Pr(e,t){var n=typeof t,r;return t==null||n==="boolean"?Au(t):(n==="number"?_e:n==="string"?(r=Br(t))?(t=r,si):jh:t instanceof Br?si:t instanceof Date?o4:r4(t)?n4:Array.isArray(t)?i4:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?s4:_e)(e,t)}function Qc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var a4=180/Math.PI,tb={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function j2(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)*a4,skewX:Math.atan(c)*a4,scaleX:s,scaleY:a}}var eb;function c4(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?tb:j2(t.a,t.b,t.c,t.d,t.e,t.f)}function l4(e){return e==null?tb:(eb||(eb=document.createElementNS("http://www.w3.org/2000/svg","g")),eb.setAttribute("transform",e),(e=eb.transform.baseVal.consolidate())?(e=e.matrix,j2(e.a,e.b,e.c,e.d,e.e,e.f)):tb)}function u4(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 y=h.push("translate(",null,t,null,n);p.push({i:y-4,x:_e(l,f)},{i:y-2,x:_e(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:_e(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:_e(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push(i(h)+"scale(",null,",",null,")");p.push({i:y-4,x:_e(l,f)},{i:y-2,x:_e(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,y=d.length,g;++p<y;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var q2=u4(c4,"px, ","px)","deg)"),V2=u4(l4,", ",")",")");var oY=1e-12;function f4(e){return((e=Math.exp(e))+1/e)/2}function sY(e){return((e=Math.exp(e))-1/e)/2}function aY(e){return((e=Math.exp(2*e))-1)/(e+1)}var Y2=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,y=h*h+p*p,g,m;if(y<oY)m=Math.log(d/l)/t,g=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*m)]};else{var b=Math.sqrt(y),x=(d*d-l*l+r*y)/(2*l*n*b),_=(d*d-l*l-r*y)/(2*d*n*b),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);m=(w-v)/t,g=function(T){var M=T*m,R=f4(v),I=l/(n*b)*(R*aY(t*M+v)-sY(v));return[a+I*h,c+I*p,l*R/f4(t*M+v)]}}return g.duration=m*1e3*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function d4(e){return function(t,n){var r=e((t=$h(t)).h,(n=$h(n)).h),i=Se(t.s,n.s),o=Se(t.l,n.l),s=Se(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 G2=d4(Mu),cY=d4(Se);function nb(e,t){var n=Se((e=Eu(e)).l,(t=Eu(t)).l),r=Se(e.a,t.a),i=Se(e.b,t.b),o=Se(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 h4(e){return function(t,n){var r=e((t=Uh(t)).h,(n=Uh(n)).h),i=Se(t.c,n.c),o=Se(t.l,n.l),s=Se(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 W2=h4(Mu),lY=h4(Se);function p4(e){return function t(n){n=+n;function r(i,o){var s=e((i=Qn(i)).h,(o=Qn(o)).h),a=Se(i.s,o.s),c=Se(i.l,o.l),l=Se(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 uY=p4(Mu),Nu=p4(Se);function xo(e,t){t===void 0&&(t=e,e=Pr);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 Cn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Ru=0,Vh=0,qh=0,y4=1e3,rb,Yh,ib=0,Zc=0,ob=0,Gh=typeof performance=="object"&&performance.now?performance:Date,g4=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xh(){return Zc||(g4(fY),Zc=Gh.now()+ob)}function fY(){Zc=0}function Wh(){this._call=this._time=this._next=null}Wh.prototype=sb.prototype={constructor:Wh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xh():+n)+(t==null?0:+t),!this._next&&Yh!==this&&(Yh?Yh._next=this:rb=this,Yh=this),this._call=e,this._time=n,X2()},stop:function(){this._call&&(this._call=null,this._time=1/0,X2())}};function sb(e,t,n){var r=new Wh;return r.restart(e,t,n),r}function b4(){Xh(),++Ru;for(var e=rb,t;e;)(t=Zc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ru}function m4(){Zc=(ib=Gh.now())+ob,Ru=Vh=0;try{b4()}finally{Ru=0,hY(),Zc=0}}function dY(){var e=Gh.now(),t=e-ib;t>y4&&(ob-=t,ib=e)}function hY(){for(var e,t=rb,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:rb=n);Yh=e,X2(r)}function X2(e){if(!Ru){Vh&&(Vh=clearTimeout(Vh));var t=e-Zc;t>24?(e<1/0&&(Vh=setTimeout(m4,e-Gh.now()-ob)),qh&&(qh=clearInterval(qh))):(qh||(ib=Gh.now(),qh=setInterval(dY,y4)),Ru=1,g4(m4))}}function ab(e,t,n){var r=new Wh;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var pY=Vc("start","end","cancel","interrupt"),mY=[],w4=0,x4=1,lb=2,cb=3,_4=4,ub=5,Hh=6;function Fa(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;yY(e,n,{name:t,index:r,group:i,on:pY,tween:mY,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:w4})}function Qh(e,t){var n=nn(e,t);if(n.state>w4)throw new Error("too late; already scheduled");return n}function Nn(e,t){var n=nn(e,t);if(n.state>cb)throw new Error("too late; already running");return n}function nn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function yY(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=sb(o,0,n.time);function o(l){n.state=x4,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!==x4)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===cb)return ab(s);h.state===_4?(h.state=Hh,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Hh,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(ab(function(){n.state===cb&&(n.state=_4,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=lb,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lb){for(n.state=cb,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=ub,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===ub&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Hh,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function _o(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>lb&&r.state<ub,r.state=Hh,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function v4(e){return this.each(function(){_o(this,e)})}function gY(e,t){var n,r;return function(){var i=Nn(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 bY(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Nn(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 S4(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=nn(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?gY:bY)(n,e,t))}function Ou(e,t,n){var r=e._id;return e.each(function(){var i=Nn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return nn(i,r).value[t]}}function fb(e,t){var n;return(typeof t=="number"?_e:t instanceof Br?si:(n=Br(t))?(t=n,si):jh)(e,t)}function xY(e){return function(){this.removeAttribute(e)}}function _Y(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wY(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 vY(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 SY(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 IY(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 I4(e,t){var n=Ss(e),r=n==="transform"?V2:fb;return this.attrTween(e,typeof t=="function"?(n.local?IY:SY)(n,r,Ou(this,"attr."+e,t)):t==null?(n.local?_Y:xY)(n):(n.local?vY:wY)(n,r,t))}function TY(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function EY(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function AY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&EY(e,o)),n}return i._value=t,i}function MY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&TY(e,o)),n}return i._value=t,i}function T4(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=Ss(e);return this.tween(n,(r.local?AY:MY)(r,t))}function NY(e,t){return function(){Qh(this,e).delay=+t.apply(this,arguments)}}function RY(e,t){return t=+t,function(){Qh(this,e).delay=t}}function E4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NY:RY)(t,e)):nn(this.node(),t).delay}function OY(e,t){return function(){Nn(this,e).duration=+t.apply(this,arguments)}}function kY(e,t){return t=+t,function(){Nn(this,e).duration=t}}function A4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?OY:kY)(t,e)):nn(this.node(),t).duration}function FY(e,t){if(typeof t!="function")throw new Error;return function(){Nn(this,e).ease=t}}function M4(e){var t=this._id;return arguments.length?this.each(FY(t,e)):nn(this.node(),t).ease}function DY(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Nn(this,e).ease=n}}function N4(e){if(typeof e!="function")throw new Error;return this.each(DY(this._id,e))}function R4(e){typeof e!="function"&&(e=Fh(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 Zn(r,this._parents,this._name,this._id)}function O4(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 Zn(s,this._parents,this._name,this._id)}function LY(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 CY(e,t,n){var r,i,o=LY(t)?Qh:Nn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function k4(e,t){var n=this._id;return arguments.length<2?nn(this.node(),n).on.on(e):this.each(CY(n,e,t))}function BY(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function F4(){return this.on("end.remove",BY(this._id))}function D4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Yc(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,Fa(l[d],t,n,d,l,nn(u,n)));return new Zn(o,this._parents,t,n)}function L4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kh(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=nn(u,n),y=0,g=d.length;y<g;++y)(h=d[y])&&Fa(h,t,n,y,d,p);o.push(d),s.push(u)}return new Zn(o,s,t,n)}var PY=Ts.prototype.constructor;function C4(){return new PY(this._groups,this._parents)}function $Y(e,t){var n,r,i;return function(){var o=Ra(this,e),s=(this.style.removeProperty(e),Ra(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function B4(e){return function(){this.style.removeProperty(e)}}function UY(e,t,n){var r,i=n+"",o;return function(){var s=Ra(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function zY(e,t,n){var r,i,o;return function(){var s=Ra(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ra(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function jY(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Nn(this,e),l=c.on,u=c.value[o]==null?a||(a=B4(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function P4(e,t,n){var r=(e+="")=="transform"?q2:fb;return t==null?this.styleTween(e,$Y(e,r)).on("end.style."+e,B4(e)):typeof t=="function"?this.styleTween(e,zY(e,r,Ou(this,"style."+e,t))).each(jY(this._id,e)):this.styleTween(e,UY(e,r,t),n).on("end.style."+e,null)}function qY(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function VY(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&qY(e,s,n)),r}return o._value=t,o}function $4(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,VY(e,t,n??""))}function YY(e){return function(){this.textContent=e}}function GY(e){return function(){var t=e(this);this.textContent=t??""}}function U4(e){return this.tween("text",typeof e=="function"?GY(Ou(this,"text",e)):YY(e==null?"":e+""))}function WY(e){return function(t){this.textContent=e.call(this,t)}}function XY(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&WY(i)),t}return r._value=e,r}function z4(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,XY(e))}function j4(){for(var e=this._name,t=this._id,n=db(),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=nn(c,t);Fa(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Zn(r,this._parents,e,n)}function q4(){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=Nn(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 HY=0;function Zn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function V4(e){return Ts().transition(e)}function db(){return++HY}var Ms=Ts.prototype;Zn.prototype=V4.prototype={constructor:Zn,select:D4,selectAll:L4,selectChild:Ms.selectChild,selectChildren:Ms.selectChildren,filter:R4,merge:O4,selection:C4,transition:j4,call:Ms.call,nodes:Ms.nodes,node:Ms.node,size:Ms.size,empty:Ms.empty,each:Ms.each,on:k4,attr:I4,attrTween:T4,style:P4,styleTween:$4,text:U4,textTween:z4,remove:F4,tween:S4,delay:E4,duration:A4,ease:M4,easeVarying:N4,end:q4,[Symbol.iterator]:Ms[Symbol.iterator]};function hb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var QY={time:null,delay:0,duration:250,ease:hb};function ZY(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 Y4(e){var t,n;e instanceof Zn?(t=e._id,e=e._name):(t=db(),(n=QY).time=Xh(),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])&&Fa(c,e,t,l,s,n||ZY(c,t));return new Zn(r,this._parents,e,t)}Ts.prototype.interrupt=v4;Ts.prototype.transition=Y4;var pb=e=>()=>e;function H2(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 G4(e){e.stopImmediatePropagation()}function mb(e){e.preventDefault(),e.stopImmediatePropagation()}var W4={name:"drag"},Q2={name:"space"},ku={name:"handle"},Fu={name:"center"},{abs:X4,max:Bn,min:Pn}=Math;function H4(e){return[+e[0],+e[1]]}function K2(e){return[H4(e[0]),H4(e[1])]}var yb={name:"x",handles:["w","e"].map(Zh),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]]}},gb={name:"y",handles:["n","s"].map(Zh),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]]}},KY={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Zh),input:function(e){return e==null?null:K2(e)},output:function(e){return e}},Ns={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"},Q4={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Z4={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},JY={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},tG={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Zh(e){return{type:e}}function eG(e){return!e.ctrlKey&&!e.button}function nG(){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 rG(){return navigator.maxTouchPoints||"ontouchstart"in this}function Z2(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function iG(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function J2(){return nS(yb)}function tS(){return nS(gb)}function eS(){return nS(KY)}function nS(e){var t=nG,n=eG,r=rG,i=!0,o=Vc("start","brush","end"),s=6,a;function c(g){var m=g.property("__brush",y).selectAll(".overlay").data([Zh("overlay")]);m.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Ns.overlay).merge(m).each(function(){var x=Z2(this).extent;zt(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])}),g.selectAll(".selection").data([Zh("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Ns.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var b=g.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 Ns[x.type]}),g.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,m,b){g.tween?g.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,T=e.input(typeof m=="function"?m.apply(this,arguments):m,_.extent),M=Pr(w,T);function R(I){_.selection=I===1&&T===null?null:M(I),l.call(x),v.brush()}return w!==null&&T!==null?R:R(1)}):g.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof m=="function"?m.apply(x,_):m,v.extent),T=u(x,_).beforestart();_o(x),v.selection=w===null?null:w,l.call(x),T.start(b).brush(b).end(b)})},c.clear=function(g,m){c.move(g,null,m)};function l(){var g=zt(this),m=Z2(this).selection;m?(g.selectAll(".selection").style("display",null).attr("x",m[0][0]).attr("y",m[0][1]).attr("width",m[1][0]-m[0][0]).attr("height",m[1][1]-m[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?m[1][0]-s/2:m[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?m[1][1]-s/2:m[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?m[1][0]-m[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?m[1][1]-m[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,m,b){var x=g.__brush.emitter;return x&&(!b||!x.clean)?x:new f(g,m,b)}function f(g,m,b){this.that=g,this.args=m,this.state=g.__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(g,m){return this.starting?(this.starting=!1,this.emit("start",g,m)):this.emit("brush",g),this},brush:function(g,m){return this.emit("brush",g,m),this},end:function(g,m){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,m)),this},emit:function(g,m,b){var x=zt(this.that).datum();o.call(g,this.that,new H2(g,{sourceEvent:m,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var m=this,b=g.target.__data__.type,x=(i&&g.metaKey?b="overlay":b)==="selection"?W4:i&&g.altKey?Fu:ku,_=e===gb?null:JY[b],v=e===yb?null:tG[b],w=Z2(m),T=w.extent,M=w.selection,R=T[0][0],I,E,O=T[0][1],F,S,A=T[1][0],N,D,B=T[1][1],C,P,$=0,U=0,X,tt=_&&v&&i&&g.shiftKey,nt,st,Y=Array.from(g.touches||[g],et=>{let oe=et.identifier;return et=Ln(et,m),et.point0=et.slice(),et.identifier=oe,et});_o(m);var rt=u(m,arguments,!0).beforestart();if(b==="overlay"){M&&(X=!0);let et=[Y[0],Y[1]||Y[0]];w.selection=M=[[I=e===gb?R:Pn(et[0][0],et[1][0]),F=e===yb?O:Pn(et[0][1],et[1][1])],[N=e===gb?A:Bn(et[0][0],et[1][0]),C=e===yb?B:Bn(et[0][1],et[1][1])]],Y.length>1&&Nt(g)}else I=M[0][0],F=M[0][1],N=M[1][0],C=M[1][1];E=I,S=F,D=N,P=C;var j=zt(m).attr("pointer-events","none"),H=j.selectAll(".overlay").attr("cursor",Ns[b]);if(g.touches)rt.moved=z,rt.ended=lt;else{var ot=zt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",lt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Xt,!0),Lh(g.view)}l.call(m),rt.start(g,x.name);function z(et){for(let oe of et.changedTouches||[et])for(let Ir of Y)Ir.identifier===oe.identifier&&(Ir.cur=Ln(oe,m));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];X4(oe.cur[0]-oe[0])>X4(oe.cur[1]-oe[1])?st=!0:nt=!0}for(let oe of Y)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);X=!0,mb(et),Nt(et)}function Nt(et){let oe=Y[0],Ir=oe.point0;var Hi;switch($=oe[0]-Ir[0],U=oe[1]-Ir[1],x){case Q2:case W4:{_&&($=Bn(R-I,Pn(A-N,$)),E=I+$,D=N+$),v&&(U=Bn(O-F,Pn(B-C,U)),S=F+U,P=C+U);break}case ku:{Y[1]?(_&&(E=Bn(R,Pn(A,Y[0][0])),D=Bn(R,Pn(A,Y[1][0])),_=1),v&&(S=Bn(O,Pn(B,Y[0][1])),P=Bn(O,Pn(B,Y[1][1])),v=1)):(_<0?($=Bn(R-I,Pn(A-I,$)),E=I+$,D=N):_>0&&($=Bn(R-N,Pn(A-N,$)),E=I,D=N+$),v<0?(U=Bn(O-F,Pn(B-F,U)),S=F+U,P=C):v>0&&(U=Bn(O-C,Pn(B-C,U)),S=F,P=C+U));break}case Fu:{_&&(E=Bn(R,Pn(A,I-$*_)),D=Bn(R,Pn(A,N+$*_))),v&&(S=Bn(O,Pn(B,F-U*v)),P=Bn(O,Pn(B,C+U*v)));break}}D<E&&(_*=-1,Hi=I,I=N,N=Hi,Hi=E,E=D,D=Hi,b in Q4&&H.attr("cursor",Ns[b=Q4[b]])),P<S&&(v*=-1,Hi=F,F=C,C=Hi,Hi=S,S=P,P=Hi,b in Z4&&H.attr("cursor",Ns[b=Z4[b]])),w.selection&&(M=w.selection),nt&&(E=M[0][0],D=M[1][0]),st&&(S=M[0][1],P=M[1][1]),(M[0][0]!==E||M[0][1]!==S||M[1][0]!==D||M[1][1]!==P)&&(w.selection=[[E,S],[D,P]],l.call(m),rt.brush(et,x.name))}function lt(et){if(G4(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Ch(et.view,X),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);j.attr("pointer-events","all"),H.attr("cursor",Ns.overlay),w.selection&&(M=w.selection),iG(M)&&(w.selection=null,l.call(m)),rt.end(et,x.name)}function Wt(et){switch(et.keyCode){case 16:{tt=_&&v;break}case 18:{x===ku&&(_&&(N=D-$*_,I=E+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu,Nt(et));break}case 32:{(x===ku||x===Fu)&&(_<0?N=D-$:_>0&&(I=E-$),v<0?C=P-U:v>0&&(F=S-U),x=Q2,H.attr("cursor",Ns.selection),Nt(et));break}default:return}mb(et)}function Xt(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,Nt(et));break}case 18:{x===Fu&&(_<0?N=D:_>0&&(I=E),v<0?C=P:v>0&&(F=S),x=ku,Nt(et));break}case 32:{x===Q2&&(et.altKey?(_&&(N=D-$*_,I=E+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu):(_<0?N=D:_>0&&(I=E),v<0?C=P:v>0&&(F=S),x=ku),H.attr("cursor",Ns[b]),Nt(et));break}default:return}mb(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function y(){var g=this.__brush||{selection:null};return g.extent=K2(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:pb(K2(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:pb(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:pb(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var rS=Math.PI,iS=2*rS,Kc=1e-6,oG=iS-Kc;function K4(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function sG(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return K4;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 Da=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?K4:sG(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>Kc)if(!(Math.abs(f*c-l*u)>Kc)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,y=c*c+l*l,g=h*h+p*p,m=Math.sqrt(y),b=Math.sqrt(d),x=o*Math.tan((rS-Math.acos((y+d-g)/(2*m*b)))/2),_=x/b,v=x/m;Math.abs(_-1)>Kc&&this._append`L${t+_*u},${n+_*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)>Kc||Math.abs(this._y1-u)>Kc)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%iS+iS),d>oG?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>Kc&&this._append`A${r},${r},0,${+(d>=rS)},${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 J4(){return new Da}J4.prototype=Da.prototype;function Kn(e=3){return new Da(+e)}var aG=Array.prototype,bb=aG.slice;function tR(e,t){return e-t}function eR(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 wo=e=>()=>e;function nR(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=cG(e,t[n]))return i;return 0}function cG(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(lG(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function lG(e,t,n){var r;return uG(e,t,n)&&fG(e[r=+(e[0]===t[0])],n[r],t[r])}function uG(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function fG(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function rR(){}var Rs=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function La(){var e=1,t=1,n=Ma,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(tR);else{let f=se(l,dG);for(u=An(...wu(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),eR(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var y=0,g=d.length,m;y<g;++y)if(nR((m=d[y])[0],p)!==-1){m.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,y,g,m,b,x;for(p=y=-1,m=Jc(l[0],u),Rs[m<<1].forEach(_);++p<e-1;)g=m,m=Jc(l[p+1],u),Rs[g|m<<1].forEach(_);for(Rs[m<<0].forEach(_);++y<t-1;){for(p=-1,m=Jc(l[y*e+e],u),b=Jc(l[y*e],u),Rs[m<<1|b<<2].forEach(_);++p<e-1;)g=m,m=Jc(l[y*e+e+p+1],u),x=b,b=Jc(l[y*e+p+1],u),Rs[g|m<<1|b<<2|x<<3].forEach(_);Rs[m|b<<3].forEach(_)}for(p=-1,b=l[y*e]>=u,Rs[b<<2].forEach(_);++p<e-1;)x=b,b=Jc(l[y*e+p+1],u),Rs[b<<2|x<<3].forEach(_);Rs[b<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+y],T=[v[1][0]+p,v[1][1]+y],M=a(w),R=a(T),I,E;(I=h[M])?(E=d[R])?(delete h[I.end],delete d[E.start],I===E?(I.ring.push(T),f(I.ring)):d[I.start]=h[E.end]={start:I.start,end:E.end,ring:I.ring.concat(E.ring)}):(delete h[I.end],I.ring.push(T),h[I.end=R]=I):(I=d[R])?(E=h[M])?(delete d[I.start],delete h[E.end],I===E?(I.ring.push(T),f(I.ring)):d[E.start]=h[I.end]={start:E.start,end:I.end,ring:E.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(w),d[I.start=M]=I):d[M]=h[R]={start:M,end:R,ring:[w,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],y=h|0,g=p|0,m=oS(u[g*e+y]);h>0&&h<e&&y===h&&(d[0]=iR(h,oS(u[g*e+y-1]),m,f)),p>0&&p<t&&g===p&&(d[1]=iR(p,oS(u[(g-1)*e+y]),m,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)?wo(bb.call(l)):wo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:rR,i):r===c},i}function dG(e){return isFinite(e)?e:NaN}function Jc(e,t){return e==null?!1:+e>=t}function oS(e){return e==null||isNaN(e=+e)?-1/0:e}function iR(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 hG(e){return e[0]}function pG(e){return e[1]}function mG(){return 1}function sS(){var e=hG,t=pG,n=mG,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=wo(20);function f(b){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let F of b){var w=(e(F,++v,b)+a)*_,T=(t(F,v,b)+a)*_,M=+n(F,v,b);if(M&&w>=0&&w<c&&T>=0&&T<l){var R=Math.floor(w),I=Math.floor(T),E=w-R-.5,O=T-I-.5;x[R+I*c]+=(1-E)*(1-O)*M,x[R+1+I*c]+=E*(1-O)*M,x[R+1+(I+1)*c]+=E*O*M,x[R+(I+1)*c]+=(1-E)*O*M}}return Eh({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(_)||(_=An(Number.MIN_VALUE,Ut(x)/v,_)),La().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(b){var x=f(b),_=La().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var M=h(_.contour(x,T*v));return M.value=T,M};return Object.defineProperty(w,"max",{get:()=>Ut(x)/v}),w};function h(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(y)}function y(b){b.forEach(g)}function g(b){b[0]=b[0]*Math.pow(2,s)-a,b[1]=b[1]*Math.pow(2,s)-a}function m(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(b){return arguments.length?(e=typeof b=="function"?b:wo(+b),d):e},d.y=function(b){return arguments.length?(t=typeof b=="function"?b:wo(+b),d):t},d.weight=function(b){return arguments.length?(n=typeof b=="function"?b:wo(+b),d):n},d.size=function(b){if(!arguments.length)return[r,i];var x=+b[0],_=+b[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return r=x,i=_,m()},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),m()},d.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?wo(bb.call(b)):wo(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,m()},d}var Jt=11102230246251565e-32,Ye=134217729,Kh=(3+8*Jt)*Jt;function tl(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 Jh(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var yG=(3+16*Jt)*Jt,gG=(2+12*Jt)*Jt,bG=(9+64*Jt)*Jt*Jt,Du=V(4),oR=V(8),sR=V(12),aR=V(16),Jn=V(4);function xG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,y,g,m,b,x,_,v,w,T,M,R=e-i,I=n-i,E=t-o,O=r-o;_=R*O,d=Ye*R,h=d-(d-R),p=R-h,d=Ye*O,y=d-(d-O),g=O-y,v=p*g-(_-h*y-p*y-h*g),w=E*I,d=Ye*E,h=d-(d-E),p=E-h,d=Ye*I,y=d-(d-I),g=I-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Du[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Du[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Du[2]=b-(M-f)+(m-f),Du[3]=M;let F=Jh(4,Du),S=gG*s;if(F>=S||-F>=S||(f=e-R,a=e-(R+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-E,c=t-(E+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=bG*s+Kh*Math.abs(F),F+=R*u+O*a-(E*l+I*c),F>=S||-F>=S))return F;_=a*O,d=Ye*a,h=d-(d-a),p=a-h,d=Ye*O,y=d-(d-O),g=O-y,v=p*g-(_-h*y-p*y-h*g),w=c*I,d=Ye*c,h=d-(d-c),p=c-h,d=Ye*I,y=d-(d-I),g=I-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Jn[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Jn[2]=b-(M-f)+(m-f),Jn[3]=M;let A=tl(4,Du,4,Jn,oR);_=R*u,d=Ye*R,h=d-(d-R),p=R-h,d=Ye*u,y=d-(d-u),g=u-y,v=p*g-(_-h*y-p*y-h*g),w=E*l,d=Ye*E,h=d-(d-E),p=E-h,d=Ye*l,y=d-(d-l),g=l-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Jn[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Jn[2]=b-(M-f)+(m-f),Jn[3]=M;let N=tl(A,oR,4,Jn,sR);_=a*u,d=Ye*a,h=d-(d-a),p=a-h,d=Ye*u,y=d-(d-u),g=u-y,v=p*g-(_-h*y-p*y-h*g),w=c*l,d=Ye*c,h=d-(d-c),p=c-h,d=Ye*l,y=d-(d-l),g=l-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Jn[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Jn[2]=b-(M-f)+(m-f),Jn[3]=M;let D=tl(N,sR,4,Jn,aR);return aR[D-1]}function Lu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=yG*l?c:-xG(e,t,n,r,i,o,l)}var _wt=(7+56*Jt)*Jt,wwt=(3+28*Jt)*Jt,vwt=(26+288*Jt)*Jt*Jt,Swt=V(4),Iwt=V(4),Twt=V(4),Ewt=V(4),Awt=V(4),Mwt=V(4),Nwt=V(4),Rwt=V(4),Owt=V(4),kwt=V(8),Fwt=V(8),Dwt=V(8),Lwt=V(4),Cwt=V(8),Bwt=V(8),Pwt=V(8),$wt=V(12),Uwt=V(192),zwt=V(192);var Vwt=(10+96*Jt)*Jt,Ywt=(4+48*Jt)*Jt,Gwt=(44+576*Jt)*Jt*Jt,Wwt=V(4),Xwt=V(4),Hwt=V(4),Qwt=V(4),Zwt=V(4),Kwt=V(4),Jwt=V(4),tvt=V(4),evt=V(8),nvt=V(8),rvt=V(8),ivt=V(8),ovt=V(8),svt=V(8),avt=V(8),cvt=V(8),lvt=V(8),uvt=V(4),fvt=V(4),dvt=V(4),hvt=V(8),pvt=V(16),mvt=V(16),yvt=V(16),gvt=V(32),bvt=V(32),xvt=V(48),_vt=V(64),wvt=V(1152),vvt=V(1152);var Evt=(16+224*Jt)*Jt,Avt=(5+72*Jt)*Jt,Mvt=(71+1408*Jt)*Jt*Jt,Nvt=V(4),Rvt=V(4),Ovt=V(4),kvt=V(4),Fvt=V(4),Dvt=V(4),Lvt=V(4),Cvt=V(4),Bvt=V(4),Pvt=V(4),$vt=V(24),Uvt=V(24),zvt=V(24),jvt=V(24),qvt=V(24),Vvt=V(24),Yvt=V(24),Gvt=V(24),Wvt=V(24),Xvt=V(24),Hvt=V(1152),Qvt=V(1152),Zvt=V(1152),Kvt=V(1152),Jvt=V(1152),t2t=V(2304),e2t=V(2304),n2t=V(3456),r2t=V(5760),i2t=V(8),o2t=V(8),s2t=V(8),a2t=V(16),c2t=V(24),l2t=V(48),u2t=V(48),f2t=V(96),d2t=V(192),h2t=V(384),p2t=V(384),m2t=V(384),y2t=V(768);var g2t=V(96),b2t=V(96),x2t=V(96),_2t=V(1152);var lR=Math.pow(2,-52),xb=new Uint32Array(512),Bu=class e{static from(t,n=TG,r=EG){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).fill(-1),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 I=0;I<s;I++){let E=t[2*I],O=t[2*I+1];E<a&&(a=E),O<c&&(c=O),E>l&&(l=E),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,y,g;for(let I=0;I<s;I++){let E=aS(f,d,t[2*I],t[2*I+1]);E<h&&(p=I,h=E)}let m=t[2*p],b=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let E=aS(m,b,t[2*I],t[2*I+1]);E<h&&E>0&&(y=I,h=E)}let x=t[2*y],_=t[2*y+1],v=1/0;for(let I=0;I<s;I++){if(I===p||I===y)continue;let E=SG(m,b,x,_,t[2*I],t[2*I+1]);E<v&&(g=I,v=E)}let w=t[2*g],T=t[2*g+1];if(v===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];Cu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),E=0;for(let O=0,F=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>F&&(I[E++]=S,F=this._dists[S])}this.hull=I.subarray(0,E),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Lu(m,b,x,_,w,T)<0){let I=y,E=x,O=_;y=g,x=w,_=T,g=I,w=E,T=O}let M=IG(m,b,x,_,w,T);this._cx=M.x,this._cy=M.y;for(let I=0;I<s;I++)this._dists[I]=aS(t[2*I],t[2*I+1],M.x,M.y);Cu(this._ids,this._dists,0,s-1),this._hullStart=p;let R=3;r[p]=n[g]=y,r[y]=n[p]=g,r[g]=n[y]=p,i[p]=0,i[y]=1,i[g]=2,o.fill(-1),o[this._hashKey(m,b)]=p,o[this._hashKey(x,_)]=y,o[this._hashKey(w,T)]=g,this.trianglesLen=0,this._addTriangle(p,y,g,-1,-1,-1);for(let I=0,E,O;I<this._ids.length;I++){let F=this._ids[I],S=t[2*F],A=t[2*F+1];if(I>0&&Math.abs(S-E)<=lR&&Math.abs(A-O)<=lR||(E=S,O=A,F===p||F===y||F===g))continue;let N=0;for(let $=0,U=this._hashKey(S,A);$<this._hashSize&&(N=o[(U+$)%this._hashSize],!(N!==-1&&N!==r[N]));$++);N=n[N];let D=N,B;for(;B=r[D],Lu(S,A,t[2*D],t[2*D+1],t[2*B],t[2*B+1])>=0;)if(D=B,D===N){D=-1;break}if(D===-1)continue;let C=this._addTriangle(D,F,r[D],-1,-1,i[D]);i[F]=this._legalize(C+2),i[D]=C,R++;let P=r[D];for(;B=r[P],Lu(S,A,t[2*P],t[2*P+1],t[2*B],t[2*B+1])<0;)C=this._addTriangle(P,F,B,i[F],-1,i[P]),i[F]=this._legalize(C+2),r[P]=P,R--,P=B;if(D===N)for(;B=n[D],Lu(S,A,t[2*B],t[2*B+1],t[2*D],t[2*D+1])<0;)C=this._addTriangle(B,F,D,-1,i[D],i[B]),this._legalize(C+2),i[B]=C,r[D]=D,R--,D=B;this._hullStart=n[F]=D,r[D]=n[P]=F,r[F]=P,o[this._hashKey(S,A)]=F,o[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(R);for(let I=0,E=this._hullStart;I<R;I++)this.hull[I]=E,E=r[E];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(wG(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=xb[--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],y=n[f];if(vG(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*y],i[2*y+1])){n[t]=y,n[a]=d;let m=r[f];if(m===-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,m),this._link(a,r[s]),this._link(s,f);let b=l+(a+1)%3;o<xb.length&&(xb[o++]=b)}else{if(o===0)break;t=xb[--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 wG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function aS(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function vG(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,y=u*u+f*f,g=d*d+h*h;return c*(f*g-y*h)-l*(u*g-y*d)+p*(u*h-f*d)<0}function SG(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 IG(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 Cu(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;tp(e,i,o),t[e[n]]>t[e[r]]&&tp(e,n,r),t[e[o]]>t[e[r]]&&tp(e,o,r),t[e[n]]>t[e[o]]&&tp(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;tp(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Cu(e,t,o,r),Cu(e,t,n,s-1)):(Cu(e,t,n,s-1),Cu(e,t,o,r))}}function tp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function TG(e){return e[0]}function EG(e){return e[1]}var ai=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var Ca=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 ep=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 y=0,g=0,m=r.length,b,x;y<m;y+=3,g+=2){let _=r[y]*2,v=r[y+1]*2,w=r[y+2]*2,T=t[_],M=t[_+1],R=t[v],I=t[v+1],E=t[w],O=t[w+1],F=R-T,S=I-M,A=E-T,N=O-M,D=(F*N-S*A)*2;if(Math.abs(D)<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-M)*A);b=(T+E)/2-B*N,x=(M+O)/2+B*A}else{let B=1/D,C=F*F+S*S,P=A*A+N*N;b=T+(N*C-S*P)*B,x=M+(F*P-A*C)*B}a[g]=b,a[g+1]=x}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 y=0;y<n.length;++y)c=n[y],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new ai:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,y=s[h],g=s[h+1],m=s[p],b=s[p+1];this._renderSegment(y,g,m,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,y=this._project(d,h,a[p+2],a[p+3]);y&&this._renderSegment(d,h,y[0],y[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new ai:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new ai:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new Ca;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,y,g,m,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[y,g,m,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[m,b,y,g]=p,f=d,d=this._edgecode(y,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,g):i=[y,g]}f=d,d=this._edgecode(m,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,b):i=[m,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,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 AG=2*Math.PI,Pu=Math.pow;function MG(e){return e[0]}function NG(e){return e[1]}function RG(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 OG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ci=class e{static from(t,n=MG,r=NG,i){return new e("length"in t?kG(t,n,r,i):Float64Array.from(FG(t,n,r,i)))}constructor(t){this._delaunator=new Bu(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&&RG(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=OG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Bu(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 ep(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=Pu(n-l[t*2],2)+Pu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],y=Pu(n-l[p*2],2)+Pu(r-l[p*2+1],2);if(y<f&&(f=y,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&&Pu(n-l[h*2],2)+Pu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new ai:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new ai:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,AG)}return r&&r.value()}renderHull(t){let n=t==null?t=new ai:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new Ca;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new ai:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new Ca;return this.renderTriangle(t,n),n.value()}};function kG(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*FG(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 uR(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function el(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 vo(e){return e=el(Math.abs(e)),e?e[1]:NaN}function fR(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 dR(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var DG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function So(e){if(!(t=DG.exec(e)))throw new Error("invalid format: "+e);var t;return new _b({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]})}So.prototype=_b.prototype;function _b(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+""}_b.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 hR(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 cS;function pR(e,t){var n=el(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(cS=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")+el(e,Math.max(0,t+o-1))[0]}function lS(e,t){var n=el(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 uS={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:uR,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)=>lS(e*100,t),r:lS,s:pR,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function fS(e){return e}var mR=Array.prototype.map,yR=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function gR(e){var t=e.grouping===void 0||e.thousands===void 0?fS:fR(mR.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?fS:dR(mR.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=So(f);var d=f.fill,h=f.align,p=f.sign,y=f.symbol,g=f.zero,m=f.width,b=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(b=!0,v="g"):uS[v]||(x===void 0&&(x=12),_=!0,v="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var w=y==="$"?n:y==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=y==="$"?r:/[%p]/.test(v)?s:"",M=uS[v],R=/[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 I(E){var O=w,F=T,S,A,N;if(v==="c")F=M(E)+F,E="";else{E=+E;var D=E<0||1/E<0;if(E=isNaN(E)?c:M(Math.abs(E),x),_&&(E=hR(E)),D&&+E==0&&p!=="+"&&(D=!1),O=(D?p==="("?p:a:p==="-"||p==="("?"":p)+O,F=(v==="s"?yR[8+cS/3]:"")+F+(D&&p==="("?")":""),R){for(S=-1,A=E.length;++S<A;)if(N=E.charCodeAt(S),48>N||N>57){F=(N===46?i+E.slice(S+1):E.slice(S))+F,E=E.slice(0,S);break}}}b&&!g&&(E=t(E,1/0));var B=O.length+E.length+F.length,C=B<m?new Array(m-B+1).join(d):"";switch(b&&g&&(E=t(C+E,C.length?m-F.length:1/0),C=""),h){case"<":E=O+E+F+C;break;case"=":E=O+C+E+F;break;case"^":E=C.slice(0,B=C.length>>1)+O+E+F+C.slice(B);break;default:E=C+O+E+F;break}return o(E)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=So(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(vo(d)/3)))*3,y=Math.pow(10,-p),g=yR[8+p/3];return function(m){return h(y*m)+g}}return{format:l,formatPrefix:u}}var wb,li,vb;dS({thousands:",",grouping:[3],currency:["$",""]});function dS(e){return wb=gR(e),li=wb.format,vb=wb.formatPrefix,wb}function hS(e){return Math.max(0,-vo(Math.abs(e)))}function pS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(vo(t)/3)))*3-vo(Math.abs(e)))}function mS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,vo(t)-vo(e))+1}var J=1e-6,nl=1e-12,xt=Math.PI,de=xt/2,yS=xt/4,un=xt*2,De=180/xt,jt=xt/180,kt=Math.abs,ui=Math.atan,Ge=Math.atan2,K=Math.cos,np=Math.ceil,Sb=Math.exp;var Ib=Math.hypot,rl=Math.log,Tb=Math.pow,Z=Math.sin,$n=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,$u=Math.tan;function Eb(e){return e>1?0:e<-1?xt:Math.acos(e)}function we(e){return e>1?de:e<-1?-de:Math.asin(e)}function We(){}function Ab(e,t){e&&xR.hasOwnProperty(e.type)&&xR[e.type](e,t)}var bR={Feature:function(e,t){Ab(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Ab(n[r].geometry,t)}},xR={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){gS(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)gS(n[r],t,0)},Polygon:function(e,t){_R(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)_R(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Ab(n[r],t)}};function gS(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 _R(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)gS(e[n],t,1);t.polygonEnd()}function $r(e,t){e&&bR.hasOwnProperty(e.type)?bR[e.type](e,t):Ab(e,t)}function rp(e){return[Ge(e[1],e[0]),we(e[2])]}function Io(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Z(t),Z(n)]}function ip(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Uu(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 Mb(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function op(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function sp(e){var t=he(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var ap,Nb,Rb,Ob,kb,Fb,Db,Lb,bS,xS,_S,SR,IR,tr,er,nr,qi={sphere:We,point:wS,lineStart:wR,lineEnd:vR,polygonStart:function(){qi.lineStart=BG,qi.lineEnd=PG},polygonEnd:function(){qi.lineStart=wR,qi.lineEnd=vR}};function wS(e,t){e*=jt,t*=jt;var n=K(t);cp(n*K(e),n*Z(e),Z(t))}function cp(e,t,n){++ap,Rb+=(e-Rb)/ap,Ob+=(t-Ob)/ap,kb+=(n-kb)/ap}function wR(){qi.point=LG}function LG(e,t){e*=jt,t*=jt;var n=K(t);tr=n*K(e),er=n*Z(e),nr=Z(t),qi.point=CG,cp(tr,er,nr)}function CG(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Z(e),o=Z(t),s=Ge(he((s=er*o-nr*i)*s+(s=nr*r-tr*o)*s+(s=tr*i-er*r)*s),tr*r+er*i+nr*o);Nb+=s,Fb+=s*(tr+(tr=r)),Db+=s*(er+(er=i)),Lb+=s*(nr+(nr=o)),cp(tr,er,nr)}function vR(){qi.point=wS}function BG(){qi.point=$G}function PG(){TR(SR,IR),qi.point=wS}function $G(e,t){SR=e,IR=t,e*=jt,t*=jt,qi.point=TR;var n=K(t);tr=n*K(e),er=n*Z(e),nr=Z(t),cp(tr,er,nr)}function TR(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Z(e),o=Z(t),s=er*o-nr*i,a=nr*r-tr*o,c=tr*i-er*r,l=Ib(s,a,c),u=we(l),f=l&&-u/l;bS.add(f*s),xS.add(f*a),_S.add(f*c),Nb+=u,Fb+=u*(tr+(tr=r)),Db+=u*(er+(er=i)),Lb+=u*(nr+(nr=o)),cp(tr,er,nr)}function vS(e){ap=Nb=Rb=Ob=kb=Fb=Db=Lb=0,bS=new En,xS=new En,_S=new En,$r(e,qi);var t=+bS,n=+xS,r=+_S,i=Ib(t,n,r);return i<nl&&(t=Fb,n=Db,r=Lb,Nb<J&&(t=Rb,n=Ob,r=kb),i=Ib(t,n,r),i<nl)?[NaN,NaN]:[Ge(n,t)*De,we(r/i)*De]}function lp(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 SS(e,t){return kt(e)>xt&&(e-=Math.round(e/un)*un),[e,t]}SS.invert=SS;function IS(e,t,n){return(e%=un)?t||n?lp(AR(e),MR(t,n)):AR(e):t||n?MR(t,n):SS}function ER(e){return function(t,n){return t+=e,kt(t)>xt&&(t-=Math.round(t/un)*un),[t,n]}}function AR(e){var t=ER(e);return t.invert=ER(-e),t}function MR(e,t){var n=K(e),r=Z(e),i=K(t),o=Z(t);function s(a,c){var l=K(c),u=K(a)*l,f=Z(a)*l,d=Z(c),h=d*n+u*r;return[Ge(f*i-h*o,u*n-d*r),we(h*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Z(a)*l,d=Z(c),h=d*i-f*o;return[Ge(f*i+d*o,u*n+h*r),we(h*n-u*r)]},s}function NR(e){e=IS(e[0]*jt,e[1]*jt,e.length>2?e[2]*jt:0);function t(n){return n=e(n[0]*jt,n[1]*jt),n[0]*=De,n[1]*=De,n}return t.invert=function(n){return n=e.invert(n[0]*jt,n[1]*jt),n[0]*=De,n[1]*=De,n},t}function OR(e,t,n,r,i,o){if(n){var s=K(t),a=Z(t),c=r*n;i==null?(i=t+r*un,o=t-c/2):(i=RR(s,i),o=RR(s,o),(r>0?i<o:i>o)&&(i+=r*un));for(var l,u=i;r>0?u>o:u<o;u-=c)l=rp([s,-a*K(u),-a*Z(u)]),e.point(l[0],l[1])}}function RR(e,t){t=Io(t),t[0]-=e,sp(t);var n=Eb(-t[1]);return((-t[2]<0?-n:n)+un-J)%un}function Cb(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:We,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function zu(e,t){return kt(e[0]-t[0])<J&&kt(e[1]-t[1])<J}function Bb(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 Pb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((y=p.length-1)<=0)){var y,g=p[0],m=p[y],b;if(zu(g,m)){if(!g[2]&&!m[2]){for(i.lineStart(),a=0;a<y;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}m[0]+=2*J}o.push(b=new Bb(g,p,null,!0)),s.push(b.o=new Bb(g,null,b,!1)),o.push(b=new Bb(m,p,null,!1)),s.push(b.o=new Bb(m,null,b,!0))}}),!!o.length){for(s.sort(t),kR(o),kR(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 kR(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 TS(e){return kt(e[0])<=xt?e[0]:$n(e[0])*((kt(e[0])+xt)%un-xt)}function FR(e,t){var n=TS(t),r=t[1],i=Z(r),o=[Z(n),-K(n),0],s=0,a=0,c=new En;i===1?r=de+J:i===-1&&(r=-de-J);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=TS(h),y=h[1]/2+yS,g=Z(y),m=K(y),b=0;b<d;++b,p=_,g=w,m=T,h=x){var x=f[b],_=TS(x),v=x[1]/2+yS,w=Z(v),T=K(v),M=_-p,R=M>=0?1:-1,I=R*M,E=I>xt,O=g*w;if(c.add(Ge(O*R*Z(I),m*T+O*K(I))),s+=E?M+R*un:M,E^p>=n^_>=n){var F=Uu(Io(h),Io(x));sp(F);var S=Uu(o,F);sp(S);var A=(E^M>=0?-1:1)*we(S[2]);(r>A||r===A&&(F[0]||F[1]))&&(a+=E^M>=0?1:-1)}}return(s<-J||s<J&&c<-nl)^a&1}function $b(e,t,n,r){return function(i){var o=t(i),s=Cb(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:y,lineEnd:g,polygonStart:function(){d.point=m,d.lineStart=b,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=y,d.lineEnd=g,u=vu(u);var _=FR(l,r);u.length?(c||(i.polygonStart(),c=!0),Pb(u,zG,_,n,i)):_&&(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(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function y(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function m(_,v){f.push([_,v]),a.point(_,v)}function b(){a.lineStart(),f=[]}function x(){m(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,M,R,I;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(R=v[0],(M=R.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<M;++w)i.point((I=R[w])[0],I[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(UG))}}return d}}function UG(e){return e.length>1}function zG(e,t){return((e=e.x)[0]<0?e[1]-de-J:de-e[1])-((t=t.x)[0]<0?t[1]-de-J:de-t[1])}var ES=$b(function(){return!0},jG,VG,[-xt,-de]);function jG(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?xt:-xt,c=kt(o-t);kt(c-xt)<J?(e.point(t,n=(n+s)/2>0?de:-de),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=xt&&(kt(t-r)<J&&(t-=r*J),kt(o-a)<J&&(o-=a*J),n=qG(t,n,o,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),i=0),e.point(t=o,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function qG(e,t,n,r){var i,o,s=Z(e-n);return kt(s)>J?ui((Z(t)*(o=K(r))*Z(n)-Z(r)*(i=K(t))*Z(e))/(i*o*s)):(t+r)/2}function VG(e,t,n,r){var i;if(e==null)i=n*de,r.point(-xt,i),r.point(0,i),r.point(xt,i),r.point(xt,0),r.point(xt,-i),r.point(0,-i),r.point(-xt,-i),r.point(-xt,0),r.point(-xt,i);else if(kt(e[0]-t[0])>J){var o=e[0]<t[0]?xt:-xt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function DR(e){var t=K(e),n=6*jt,r=t>0,i=kt(t)>J;function o(u,f,d,h){OR(h,e,n,d,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,d,h,p,y;return{lineStart:function(){p=h=!1,y=1},point:function(g,m){var b=[g,m],x,_=s(g,m),v=r?_?0:l(g,m):_?l(g+(g<0?xt:-xt),m):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,b),(!x||zu(f,x)||zu(b,x))&&(b[2]=1)),_!==h)y=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&&r^_){var w;!(v&d)&&(w=c(b,f,!0))&&(y=0,r?(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||!zu(f,b))&&u.point(b[0],b[1]),f=b,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return y|(p&&h)<<1}}}function c(u,f,d){var h=Io(u),p=Io(f),y=[1,0,0],g=Uu(h,p),m=ip(g,g),b=g[0],x=m-b*b;if(!x)return!d&&u;var _=t*m/x,v=-t*b/x,w=Uu(y,g),T=op(y,_),M=op(g,v);Mb(T,M);var R=w,I=ip(T,R),E=ip(R,R),O=I*I-E*(ip(T,T)-1);if(!(O<0)){var F=he(O),S=op(R,(-I-F)/E);if(Mb(S,T),S=rp(S),!d)return S;var A=u[0],N=f[0],D=u[1],B=f[1],C;N<A&&(C=A,A=N,N=C);var P=N-A,$=kt(P-xt)<J,U=$||P<J;if(!$&&B<D&&(C=D,D=B,B=C),U?$?D+B>0^S[1]<(kt(S[0]-A)<J?D:B):D<=S[1]&&S[1]<=B:P>xt^(A<=S[0]&&S[0]<=N)){var X=op(R,(-I+F)/E);return Mb(X,T),[S,rp(X)]}}}function l(u,f){var d=r?e:xt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return $b(s,a,o,r?[0,-e]:[-xt,e-xt])}function LR(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 up=1e9,Ub=-up;function ju(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 kt(l[0]-e)<J?u>0?0:3:kt(l[0]-n)<J?u>0?2:1:kt(l[1]-t)<J?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=Cb(),d,h,p,y,g,m,b,x,_,v,w,T={point:M,lineStart:O,lineEnd:F,polygonStart:I,polygonEnd:E};function M(A,N){i(A,N)&&u.point(A,N)}function R(){for(var A=0,N=0,D=h.length;N<D;++N)for(var B=h[N],C=1,P=B.length,$=B[0],U,X,tt=$[0],nt=$[1];C<P;++C)U=tt,X=nt,$=B[C],tt=$[0],nt=$[1],X<=r?nt>r&&(tt-U)*(r-X)>(nt-X)*(e-U)&&++A:nt<=r&&(tt-U)*(r-X)<(nt-X)*(e-U)&&--A;return A}function I(){u=f,d=[],h=[],w=!0}function E(){var A=R(),N=w&&A,D=(d=vu(d)).length;(N||D)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),D&&Pb(d,a,A,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,b=x=NaN}function F(){d&&(S(y,g),m&&_&&f.rejoin(),d.push(f.result())),T.point=M,_&&u.lineEnd()}function S(A,N){var D=i(A,N);if(h&&p.push([A,N]),v)y=A,g=N,m=D,v=!1,D&&(u.lineStart(),u.point(A,N));else if(D&&_)u.point(A,N);else{var B=[b=Math.max(Ub,Math.min(up,b)),x=Math.max(Ub,Math.min(up,x))],C=[A=Math.max(Ub,Math.min(up,A)),N=Math.max(Ub,Math.min(up,N))];LR(B,C,e,t,n,r)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),D||u.lineEnd(),w=!1):D&&(u.lineStart(),u.point(A,N),w=!1)}b=A,x=N,_=D}return T}}function CR(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function BR(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function AS(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,y,g=2.5;function m(){return{type:"MultiLineString",coordinates:b()}}function b(){return $e(np(r/u)*u,n,u).map(p).concat($e(np(a/f)*f,s,f).map(y)).concat($e(np(t/c)*c,e,c).filter(function(x){return kt(x%u)>J}).map(d)).concat($e(np(o/l)*l,i,l).filter(function(x){return kt(x%f)>J}).map(h))}return m.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},m.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(y(s).slice(1),p(n).reverse().slice(1),y(a).reverse().slice(1))]}},m.extent=function(x){return arguments.length?m.extentMajor(x).extentMinor(x):m.extentMinor()},m.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),m.precision(g)):[[r,a],[n,s]]},m.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),m.precision(g)):[[t,o],[e,i]]},m.step=function(x){return arguments.length?m.stepMajor(x).stepMinor(x):m.stepMinor()},m.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],m):[u,f]},m.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],m):[c,l]},m.precision=function(x){return arguments.length?(g=+x,d=CR(o,i,90),h=BR(t,e,g),p=CR(a,s,90),y=BR(r,n,g),m):g},m.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function MS(){return AS()()}var fp=e=>e;var NS=new En,RS=new En,PR,$R,OS,kS,Ba={point:We,lineStart:We,lineEnd:We,polygonStart:function(){Ba.lineStart=YG,Ba.lineEnd=WG},polygonEnd:function(){Ba.lineStart=Ba.lineEnd=Ba.point=We,NS.add(kt(RS)),RS=new En},result:function(){var e=NS/2;return NS=new En,e}};function YG(){Ba.point=GG}function GG(e,t){Ba.point=UR,PR=OS=e,$R=kS=t}function UR(e,t){RS.add(kS*e-OS*t),OS=e,kS=t}function WG(){UR(PR,$R)}var FS=Ba;var qu=1/0,zb=qu,dp=-qu,jb=dp,XG={point:HG,lineStart:We,lineEnd:We,polygonStart:We,polygonEnd:We,result:function(){var e=[[qu,zb],[dp,jb]];return dp=jb=-(zb=qu=1/0),e}};function HG(e,t){e<qu&&(qu=e),e>dp&&(dp=e),t<zb&&(zb=t),t>jb&&(jb=t)}var Vu=XG;var DS=0,LS=0,hp=0,qb=0,Vb=0,Yu=0,CS=0,BS=0,pp=0,qR,VR,To,Eo,Vi={point:il,lineStart:zR,lineEnd:jR,polygonStart:function(){Vi.lineStart=KG,Vi.lineEnd=JG},polygonEnd:function(){Vi.point=il,Vi.lineStart=zR,Vi.lineEnd=jR},result:function(){var e=pp?[CS/pp,BS/pp]:Yu?[qb/Yu,Vb/Yu]:hp?[DS/hp,LS/hp]:[NaN,NaN];return DS=LS=hp=qb=Vb=Yu=CS=BS=pp=0,e}};function il(e,t){DS+=e,LS+=t,++hp}function zR(){Vi.point=QG}function QG(e,t){Vi.point=ZG,il(To=e,Eo=t)}function ZG(e,t){var n=e-To,r=t-Eo,i=he(n*n+r*r);qb+=i*(To+e)/2,Vb+=i*(Eo+t)/2,Yu+=i,il(To=e,Eo=t)}function jR(){Vi.point=il}function KG(){Vi.point=tW}function JG(){YR(qR,VR)}function tW(e,t){Vi.point=YR,il(qR=To=e,VR=Eo=t)}function YR(e,t){var n=e-To,r=t-Eo,i=he(n*n+r*r);qb+=i*(To+e)/2,Vb+=i*(Eo+t)/2,Yu+=i,i=Eo*e-To*t,CS+=i*(To+e),BS+=i*(Eo+t),pp+=i*3,il(To=e,Eo=t)}var PS=Vi;function Yb(e){this._context=e}Yb.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,un);break}}},result:We};var US=new En,$S,GR,WR,mp,yp,Gb={point:We,lineStart:function(){Gb.point=eW},lineEnd:function(){$S&&XR(GR,WR),Gb.point=We},polygonStart:function(){$S=!0},polygonEnd:function(){$S=null},result:function(){var e=+US;return US=new En,e}};function eW(e,t){Gb.point=XR,GR=mp=e,WR=yp=t}function XR(e,t){mp-=e,yp-=t,US.add(he(mp*mp+yp*yp)),mp=e,yp=t}var zS=Gb;var HR,Wb,QR,ZR,Gu=class{constructor(t){this._append=t==null?KR:nW(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!==QR||this._append!==Wb){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`,QR=r,Wb=this._append,ZR=this._,this._=i}this._+=ZR;break}}}result(){let t=this._;return this._="",t.length?t:null}};function KR(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function nW(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return KR;if(t!==HR){let n=10**t;HR=t,Wb=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 Wb}function Rn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),$r(a,i(o))),o.result()}return s.area=function(a){return $r(a,i(FS)),FS.result()},s.measure=function(a){return $r(a,i(zS)),zS.result()},s.bounds=function(a){return $r(a,i(Vu)),Vu.result()},s.centroid=function(a){return $r(a,i(PS)),PS.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,fp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Gu(n)):new Yb(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 Gu(n)),s},s.projection(e).digits(n).context(t)}function ol(e){return{stream:Wu(e)}}function Wu(e){return function(t){var n=new jS;for(var r in e)n[r]=e[r];return n.stream=t,n}}function jS(){}jS.prototype={constructor:jS,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 qS(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),$r(n,e.stream(Vu)),t(Vu.result()),r!=null&&e.clipExtent(r),e}function gp(e,t,n){return qS(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 Xb(e,t,n){return gp(e,[[0,0],t],n)}function Hb(e,t,n){return qS(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 Qb(e,t,n){return qS(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 JR=16,rW=K(30*jt);function VS(e,t){return+t?oW(e,t):iW(e)}function iW(e){return Wu({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function oW(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,y,g){var m=l-r,b=u-i,x=m*m+b*b;if(x>4*t&&y--){var _=s+d,v=a+h,w=c+p,T=he(_*_+v*v+w*w),M=we(w/=T),R=kt(kt(w)-1)<J||kt(o-f)<J?(o+f)/2:Ge(v,_),I=e(R,M),E=I[0],O=I[1],F=E-r,S=O-i,A=b*F-m*S;(A*A/x>t||kt((m*F+b*S)/x-.5)>.3||s*d+a*h+c*p<rW)&&(n(r,i,o,s,a,c,E,O,R,_/=T,v/=T,w,y,g),g.point(E,O),n(E,O,R,_,v,w,l,u,f,d,h,p,y,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,y,g={point:m,lineStart:b,lineEnd:_,polygonStart:function(){r.polygonStart(),g.lineStart=v},polygonEnd:function(){r.polygonEnd(),g.lineStart=b}};function m(M,R){M=e(M,R),r.point(M[0],M[1])}function b(){f=NaN,g.point=x,r.lineStart()}function x(M,R){var I=Io([M,R]),E=e(M,R);n(f,d,u,h,p,y,f=E[0],d=E[1],u=M,h=I[0],p=I[1],y=I[2],JR,r),r.point(f,d)}function _(){g.point=m,r.lineEnd()}function v(){b(),g.point=w,g.lineEnd=T}function w(M,R){x(i=M,R),o=f,s=d,a=h,c=p,l=y,g.point=x}function T(){n(f,d,u,h,p,y,o,s,i,a,c,l,JR,r),g.lineEnd=_,_()}return g}}var sW=Wu({point:function(e,t){this.stream.point(e*jt,t*jt)}});function aW(e){return Wu({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function cW(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 tO(e,t,n,r,i,o){if(!o)return cW(e,t,n,r,i);var s=K(o),a=Z(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(y,g){return y*=r,g*=i,[c*y-l*g+t,n-l*y-c*g]}return p.invert=function(y,g){return[r*(u*y-f*g+d),i*(h-f*y-u*g)]},p}function On(e){return YS(function(){return e})()}function YS(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,y=ES,g=null,m,b,x,_=fp,v=.5,w,T,M,R,I;function E(A){return M(A[0]*jt,A[1]*jt)}function O(A){return A=M.invert(A[0],A[1]),A&&[A[0]*De,A[1]*De]}E.stream=function(A){return R&&I===A?R:R=sW(aW(u)(y(w(_(I=A)))))},E.preclip=function(A){return arguments.length?(y=A,p=void 0,S()):y},E.postclip=function(A){return arguments.length?(_=A,g=m=b=x=null,S()):_},E.clipAngle=function(A){return arguments.length?(y=+A?DR(p=A*jt):(p=null,ES),S()):p*De},E.clipExtent=function(A){return arguments.length?(_=A==null?(g=m=b=x=null,fp):ju(g=+A[0][0],m=+A[0][1],b=+A[1][0],x=+A[1][1]),S()):g==null?null:[[g,m],[b,x]]},E.scale=function(A){return arguments.length?(n=+A,F()):n},E.translate=function(A){return arguments.length?(r=+A[0],i=+A[1],F()):[r,i]},E.center=function(A){return arguments.length?(o=A[0]%360*jt,s=A[1]%360*jt,F()):[o*De,s*De]},E.rotate=function(A){return arguments.length?(a=A[0]%360*jt,c=A[1]%360*jt,l=A.length>2?A[2]%360*jt:0,F()):[a*De,c*De,l*De]},E.angle=function(A){return arguments.length?(f=A%360*jt,F()):f*De},E.reflectX=function(A){return arguments.length?(d=A?-1:1,F()):d<0},E.reflectY=function(A){return arguments.length?(h=A?-1:1,F()):h<0},E.precision=function(A){return arguments.length?(w=VS(T,v=A*A),S()):he(v)},E.fitExtent=function(A,N){return gp(E,A,N)},E.fitSize=function(A,N){return Xb(E,A,N)},E.fitWidth=function(A,N){return Hb(E,A,N)},E.fitHeight=function(A,N){return Qb(E,A,N)};function F(){var A=tO(n,0,0,d,h,f).apply(null,t(o,s)),N=tO(n,r-A[0],i-A[1],d,h,f);return u=IS(a,c,l),T=lp(t,N),M=lp(u,T),w=VS(T,v),S()}function S(){return R=I=null,E}return function(){return t=e.apply(this,arguments),E.invert=t.invert&&O,F()}}function Xu(e){var t=0,n=xt/3,r=YS(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*jt,n=o[1]*jt):[t*De,n*De]},i}function eO(e){var t=K(e);function n(r,i){return[r*t,Z(i)/t]}return n.invert=function(r,i){return[r/t,we(i*t)]},n}function nO(e,t){var n=Z(e),r=(n+Z(t))/2;if(kt(r)<J)return eO(e);var i=1+n*(2*r-n),o=he(i)/r;function s(a,c){var l=he(i-2*r*Z(c))/r;return[l*Z(a*=r),o-l*K(a)]}return s.invert=function(a,c){var l=o-c,u=Ge(a,kt(l))*$n(l);return l*r<0&&(u-=xt*$n(a)*$n(l)),[u/r,we((i-(a*a+l*l)*r*r)/(2*r))]},s}function Pa(){return Xu(nO).scale(155.424).center([0,33.6442])}function bp(){return Pa().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function lW(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 GS(){var e,t,n=bp(),r,i=Pa().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Pa().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),y=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&y>=-.425&&y<-.214?i:g>=.166&&g<.234&&y>=-.214&&y<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=lW([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],y=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,y-.238*h],[p+.455*h,y+.238*h]]).stream(l),o=i.translate([p-.307*h,y+.201*h]).clipExtent([[p-.425*h+J,y+.12*h+J],[p-.214*h-J,y+.234*h-J]]).stream(l),a=s.translate([p-.205*h,y+.212*h]).clipExtent([[p-.214*h+J,y+.166*h+J],[p-.115*h-J,y+.234*h-J]]).stream(l),f()},u.fitExtent=function(d,h){return gp(u,d,h)},u.fitSize=function(d,h){return Xb(u,d,h)},u.fitWidth=function(d,h){return Hb(u,d,h)},u.fitHeight=function(d,h){return Qb(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function Zb(e){return function(t,n){var r=K(t),i=K(n),o=e(r*i);return o===1/0?[2,0]:[o*i*Z(t),o*Z(n)]}}function Ao(e){return function(t,n){var r=he(t*t+n*n),i=e(r),o=Z(i),s=K(i);return[Ge(t*o,r*s),we(r&&n*o/r)]}}var WS=Zb(function(e){return he(2/(1+e))});WS.invert=Ao(function(e){return 2*we(e/2)});function XS(){return On(WS).scale(124.75).clipAngle(180-.001)}var HS=Zb(function(e){return(e=Eb(e))&&e/Z(e)});HS.invert=Ao(function(e){return e});function QS(){return On(HS).scale(79.4188).clipAngle(180-.001)}function Hu(e,t){return[e,rl($u((de+t)/2))]}Hu.invert=function(e,t){return[e,2*ui(Sb(t))-de]};function ZS(){return KS(Hu).scale(961/un)}function KS(e){var t=On(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=xt*r(),d=t(NR(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Hu?[[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 Kb(e){return $u((de+e)/2)}function rO(e,t){var n=K(e),r=e===t?Z(e):rl(n/K(t))/rl(Kb(t)/Kb(e)),i=n*Tb(Kb(e),r)/r;if(!r)return Hu;function o(s,a){i>0?a<-de+J&&(a=-de+J):a>de-J&&(a=de-J);var c=i/Tb(Kb(a),r);return[c*Z(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=$n(r)*he(s*s+c*c),u=Ge(s,kt(c))*$n(c);return c*r<0&&(u-=xt*$n(s)*$n(c)),[u/r,2*ui(Tb(i/l,1/r))-de]},o}function JS(){return Xu(rO).scale(109.5).parallels([30,30])}function Qu(e,t){return[e,t]}Qu.invert=Qu;function tI(){return On(Qu).scale(152.63)}function iO(e,t){var n=K(e),r=e===t?Z(e):(n-K(t))/(t-e),i=n/r+e;if(kt(r)<J)return Qu;function o(s,a){var c=i-a,l=r*s;return[c*Z(l),i-c*K(l)]}return o.invert=function(s,a){var c=i-a,l=Ge(s,kt(c))*$n(c);return c*r<0&&(l-=xt*$n(s)*$n(c)),[l/r,i-$n(r)*he(s*s+c*c)]},o}function eI(){return Xu(iO).scale(131.154).center([0,13.9389])}var xp=1.340264,_p=-.081106,wp=893e-6,vp=.003796,Jb=he(3)/2,uW=12;function nI(e,t){var n=we(Jb*Z(t)),r=n*n,i=r*r*r;return[e*K(n)/(Jb*(xp+3*_p*r+i*(7*wp+9*vp*r))),n*(xp+_p*r+i*(wp+vp*r))]}nI.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<uW&&(a=n*(xp+_p*r+i*(wp+vp*r))-t,c=xp+3*_p*r+i*(7*wp+9*vp*r),n-=s=a/c,r=n*n,i=r*r*r,!(kt(s)<nl));++o);return[Jb*e*(xp+3*_p*r+i*(7*wp+9*vp*r))/K(n),we(Z(n)/Jb)]};function rI(){return On(nI).scale(177.158)}function iI(e,t){var n=K(t),r=K(e)*n;return[n*Z(e)/r,Z(t)/r]}iI.invert=Ao(ui);function oI(){return On(iI).scale(144.049).clipAngle(60)}function sI(e,t){return[K(t)*Z(e),Z(t)]}sI.invert=Ao(we);function aI(){return On(sI).scale(249.5).clipAngle(90+J)}function cI(e,t){var n=K(t),r=1+K(e)*n;return[n*Z(e)/r,Z(t)/r]}cI.invert=Ao(function(e){return 2*ui(e)});function lI(){return On(cI).scale(250).clipAngle(142)}function uI(e,t){return[rl($u((de+t)/2)),-e]}uI.invert=function(e,t){return[-t,2*ui(Sb(e))-de]};function fI(){var e=KS(uI),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 fW(e,t){return e.parent===t.parent?1:2}function dW(e){return e.reduce(hW,0)/e.length}function hW(e,t){return e+t.x}function pW(e){return 1+e.reduce(mW,0)}function mW(e,t){return Math.max(e,t.y)}function yW(e){for(var t;t=e.children;)e=t[0];return e}function gW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function tx(){var e=fW,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=dW(h),d.y=pW(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=yW(o),l=gW(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 bW(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 oO(){return this.eachAfter(bW)}function sO(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function aO(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 cO(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 lO(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function uO(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 fO(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function dO(e){for(var t=this,n=xW(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 xW(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 hO(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function pO(){return Array.from(this)}function mO(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function yO(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*gO(){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 dI(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=vW)):t===void 0&&(t=wW);for(var n=new $a(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 $a(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(hI)}function _W(){return dI(this).eachBefore(SW)}function wW(e){return e.children}function vW(e){return Array.isArray(e)?e[1]:null}function SW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function hI(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function $a(e){this.data=e,this.depth=this.height=0,this.parent=null}$a.prototype=dI.prototype={constructor:$a,count:oO,each:sO,eachAfter:cO,eachBefore:aO,find:lO,sum:uO,sort:fO,path:dO,ancestors:hO,descendants:pO,leaves:mO,links:yO,copy:_W,[Symbol.iterator]:gO};function ex(e){return e==null?null:IW(e)}function IW(e){if(typeof e!="function")throw new Error;return e}var TW={depth:-1},bO={},pI={};function EW(e){return e.id}function AW(e){return e.parentId}function nx(){var e=EW,t=AW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,y,g=new Map;if(n!=null){let m=o.map((_,v)=>MW(n(_,v,i))),b=m.map(xO),x=new Set(m).add("");for(let _ of b)x.has(_)||(x.add(_),m.push(_),b.push(xO(_)),o.push(pI));s=(_,v)=>m[v],a=(_,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new $a(l),(p=s(l,u,i))!=null&&(p+="")&&(y=h.id=p,g.set(y,g.has(y)?bO:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=g.get(p),!d)throw new Error("missing: "+p);if(d===bO)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===pI&&f.children.length===1;)f=f.children[0],--c;for(let m=o.length-1;m>=0&&(h=o[m],h.data===pI);--m)h.data=null}if(f.parent=TW,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(hI),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=ex(i),r):e},r.parentId=function(i){return arguments.length?(t=ex(i),r):t},r.path=function(i){return arguments.length?(n=ex(i),r):n},r}function MW(e){e=`${e}`;let t=e.length;return mI(e,t-1)&&!mI(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function xO(e){let t=e.length;if(t<2)return"";for(;--t>1&&!mI(e,t););return e.slice(0,t)}function mI(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function NW(e,t){return e.parent===t.parent?1:2}function yI(e){var t=e.children;return t?t[0]:e.t}function gI(e){var t=e.children;return t?t[t.length-1]:e.t}function RW(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 OW(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 kW(e,t,n){return e.a.parent===t.parent?e.a:n}function rx(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}rx.prototype=Object.create($a.prototype);function FW(e){for(var t=new rx(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 rx(o[s],s)),i.parent=n;return(t.parent=new rx(null,0)).children=[t],t}function sl(){var e=NW,t=1,n=1,r=null;function i(l){var u=FW(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(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,y=p-f.x,g=t/(d.x+p+y),m=n/(h.depth||1);l.eachBefore(function(b){b.x=(b.x+y)*g,b.y=b.depth*m})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){OW(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,y=d.parent.children[0],g=d.m,m=h.m,b=p.m,x=y.m,_;p=gI(p),d=yI(d),p&&d;)y=yI(y),h=gI(h),h.a=l,_=p.z+b-d.z-g+e(p._,d._),_>0&&(RW(kW(p,l,f),l,_),g+=_,m+=_),b+=p.m,g+=d.m,x+=y.m,m+=h.m;p&&!gI(h)&&(h.t=p,h.m+=b-m),d&&!yI(y)&&(y.t=d,y.m+=g-x,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 _O=23283064365386963e-26;function al(e=Math.random()){let t=(0<=e&&e<1?e/_O:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,_O*(t>>>0))}function Xe(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Sp(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 Ip=Symbol("implicit");function cl(){var e=new Xn,t=[],n=[],r=Ip;function i(o){let s=e.get(o);if(s===void 0){if(r!==Ip)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 Xn;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 cl(t,n).unknown(r)},Xe.apply(i,arguments),i}function Ua(){var e=cl().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,y=h?r:i;o=(y-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(y-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var g=$e(d).map(function(m){return p+o*m});return n(h?g.reverse():g)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Ua(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Xe.apply(f(),arguments)}function wO(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return wO(t())},e}function bI(){return wO(Ua.apply(null,arguments).paddingInner(1))}function xI(e){return function(){return e}}function Zu(e){return+e}var vO=[0,1];function vr(e){return e}function _I(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:xI(isNaN(t)?NaN:.5)}function DW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function LW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=_I(i,r),o=n(s,o)):(r=_I(r,i),o=n(o,s)),function(a){return o(r(a))}}function CW(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]=_I(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=_s(e,a,1,r)-1;return o[c](i[c](a))}}function Mo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ll(){var e=vO,t=vO,n=Pr,r,i,o,s=vr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==vr&&(s=DW(e[0],e[d-1])),a=d>2?CW:LW,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),_e)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Zu),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=Qc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:vr,u()):s!==vr},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 Tp(){return ll()(vr,vr)}function wI(e,t,n,r){var i=_u(e,t,n),o;switch(r=So(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=pS(i,s))&&(r.precision=o),vb(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=mS(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=hS(i))&&(r.precision=o-(r.type==="%")*2);break}}return li(r)}function Os(e){var t=e.domain;return e.ticks=function(n){var r=t();return An(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return wI(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=ws(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 ks(){var e=Tp();return e.copy=function(){return Mo(e,ks())},Xe.apply(e,arguments),Os(e)}function Ep(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,Zu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Ep(e).unknown(t)},e=arguments.length?Array.from(e,Zu):[0,1],Os(n)}function Ap(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 SO(e){return Math.log(e)}function IO(e){return Math.exp(e)}function BW(e){return-Math.log(-e)}function PW(e){return-Math.exp(-e)}function $W(e){return isFinite(e)?+("1e"+e):e<0?0:e}function UW(e){return e===10?$W:e===Math.E?Math.exp:t=>Math.pow(e,t)}function zW(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function TO(e){return(t,n)=>-e(-t,n)}function vI(e){let t=e(SO,IO),n=t.domain,r=10,i,o;function s(){return i=zW(r),o=UW(r),n()[0]<0?(i=TO(i),o=TO(o),e(BW,PW)):e(SO,IO),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,y,g=a==null?10:+a,m=[];if(!(r%1)&&h-d<g){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(y=d<0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(y=d>0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}m.length*2<g&&(m=An(l,u,g))}else m=An(d,h,Math.min(h-d,g)).map(o);return f?m.reverse():m},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=So(c)).precision==null&&(c.trim=!0),c=li(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(Ap(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Mp(){let e=vI(ll()).domain([1,10]);return e.copy=()=>Mo(e,Mp()).base(e.base()),Xe.apply(e,arguments),e}function EO(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function AO(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function SI(e){var t=1,n=e(EO(t),AO(t));return n.constant=function(r){return arguments.length?e(EO(t=+r),AO(t)):t},Os(n)}function Np(){var e=SI(ll());return e.copy=function(){return Mo(e,Np()).constant(e.constant())},Xe.apply(e,arguments)}function MO(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function jW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function qW(e){return e<0?-e*e:e*e}function II(e){var t=e(vr,vr),n=1;function r(){return n===1?e(vr,vr):n===.5?e(jW,qW):e(MO(n),MO(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Os(t)}function Rp(){var e=II(ll());return e.copy=function(){return Mo(e,Rp()).exponent(e.exponent())},Xe.apply(e,arguments),e}function Op(){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]=S2(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[_s(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(Gt),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 Op().domain(e).range(t).unknown(r)},Xe.apply(o,arguments)}function kp(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[_s(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 kp().domain(e).range(t).unknown(n)},Xe.apply(i,arguments)}var TI=new Date,EI=new Date;function pe(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=>pe(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)=>(TI.setTime(+o),EI.setTime(+s),e(TI),e(EI),Math.floor(n(TI,EI))),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 Fp=pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Fp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Fp);var RMt=Fp.range;var fn=pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),NO=fn.range;var Fs=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),VW=Fs.range,Ds=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),YW=Ds.range;var Ls=pe(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()),GW=Ls.range,Cs=pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),WW=Cs.range;var fi=pe(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),XW=fi.range,dl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),HW=dl.range,hl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),QW=hl.range;function pl(e){return pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Ur=pl(0),za=pl(1),ix=pl(2),ox=pl(3),Ro=pl(4),sx=pl(5),ax=pl(6),OO=Ur.range,ZW=za.range,KW=ix.range,JW=ox.range,tX=Ro.range,eX=sx.range,nX=ax.range;function ml(e){return pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var zr=ml(0),ja=ml(1),cx=ml(2),lx=ml(3),Oo=ml(4),ux=ml(5),fx=ml(6),kO=zr.range,rX=ja.range,iX=cx.range,oX=lx.range,sX=Oo.range,aX=ux.range,cX=fx.range;var Bs=pe(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()),lX=Bs.range,Ps=pe(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()),uX=Ps.range;var Un=pe(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());Un.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(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 fX=Un.range,zn=pe(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());zn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(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 dX=zn.range;function DO(e,t,n,r,i,o){let s=[[fn,1,1e3],[fn,5,5*1e3],[fn,15,15*1e3],[fn,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=xs(([,,g])=>g).right(s,d);if(h===s.length)return e.every(_u(l/31536e6,u/31536e6,f));if(h===0)return Fp.every(Math.max(_u(l,u,f),1));let[p,y]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(y)}return[a,c]}var[AI,Lp]=DO(zn,Ps,zr,hl,Cs,Ds),[MI,NI]=DO(Un,Bs,Ur,fi,Ls,Fs);function RI(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 OI(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 Cp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function kI(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=Bp(i),u=Pp(i),f=Bp(o),d=Pp(o),h=Bp(s),p=Pp(s),y=Bp(a),g=Pp(a),m=Bp(c),b=Pp(c),x={a:D,A:B,b:C,B:P,c:null,d:UO,e:UO,f:CX,g:GX,G:XX,H:FX,I:DX,j:LX,L:YO,m:BX,M:PX,p:$,q:U,Q:qO,s:VO,S:$X,u:UX,U:zX,V:jX,w:qX,W:VX,x:null,X:null,y:YX,Y:WX,Z:HX,"%":jO},_={a:X,A:tt,b:nt,B:st,c:null,d:zO,e:zO,f:JX,g:lH,G:fH,H:QX,I:ZX,j:KX,L:WO,m:tH,M:eH,p:Y,q:rt,Q:qO,s:VO,S:nH,u:rH,U:iH,V:oH,w:sH,W:aH,x:null,X:null,y:cH,Y:uH,Z:dH,"%":jO},v={a:I,A:E,b:O,B:F,c:S,d:PO,e:PO,f:NX,g:BO,G:CO,H:$O,I:$O,j:TX,L:MX,m:IX,M:EX,p:R,q:SX,Q:OX,s:kX,S:AX,u:bX,U:xX,V:_X,w:gX,W:wX,x:A,X:N,y:BO,Y:CO,Z:vX,"%":RX};x.x=w(n,x),x.X=w(r,x),x.c=w(t,x),_.x=w(n,_),_.X=w(r,_),_.c=w(t,_);function w(j,H){return function(ot){var z=[],Nt=-1,lt=0,Wt=j.length,Xt,et,oe;for(ot instanceof Date||(ot=new Date(+ot));++Nt<Wt;)j.charCodeAt(Nt)===37&&(z.push(j.slice(lt,Nt)),(et=LO[Xt=j.charAt(++Nt)])!=null?Xt=j.charAt(++Nt):et=Xt==="e"?" ":"0",(oe=H[Xt])&&(Xt=oe(ot,et)),z.push(Xt),lt=Nt+1);return z.push(j.slice(lt,Nt)),z.join("")}}function T(j,H){return function(ot){var z=Cp(1900,void 0,1),Nt=M(z,j,ot+="",0),lt,Wt;if(Nt!=ot.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(lt=OI(Cp(z.y,0,1)),Wt=lt.getUTCDay(),lt=Wt>4||Wt===0?ja.ceil(lt):ja(lt),lt=dl.offset(lt,(z.V-1)*7),z.y=lt.getUTCFullYear(),z.m=lt.getUTCMonth(),z.d=lt.getUTCDate()+(z.w+6)%7):(lt=RI(Cp(z.y,0,1)),Wt=lt.getDay(),lt=Wt>4||Wt===0?za.ceil(lt):za(lt),lt=fi.offset(lt,(z.V-1)*7),z.y=lt.getFullYear(),z.m=lt.getMonth(),z.d=lt.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),Wt="Z"in z?OI(Cp(z.y,0,1)).getUTCDay():RI(Cp(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Wt+5)%7:z.w+z.U*7-(Wt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,OI(z)):RI(z)}}function M(j,H,ot,z){for(var Nt=0,lt=H.length,Wt=ot.length,Xt,et;Nt<lt;){if(z>=Wt)return-1;if(Xt=H.charCodeAt(Nt++),Xt===37){if(Xt=H.charAt(Nt++),et=v[Xt in LO?H.charAt(Nt++):Xt],!et||(z=et(j,ot,z))<0)return-1}else if(Xt!=ot.charCodeAt(z++))return-1}return z}function R(j,H,ot){var z=l.exec(H.slice(ot));return z?(j.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function I(j,H,ot){var z=h.exec(H.slice(ot));return z?(j.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function E(j,H,ot){var z=f.exec(H.slice(ot));return z?(j.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(j,H,ot){var z=m.exec(H.slice(ot));return z?(j.m=b.get(z[0].toLowerCase()),ot+z[0].length):-1}function F(j,H,ot){var z=y.exec(H.slice(ot));return z?(j.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(j,H,ot){return M(j,t,H,ot)}function A(j,H,ot){return M(j,n,H,ot)}function N(j,H,ot){return M(j,r,H,ot)}function D(j){return s[j.getDay()]}function B(j){return o[j.getDay()]}function C(j){return c[j.getMonth()]}function P(j){return a[j.getMonth()]}function $(j){return i[+(j.getHours()>=12)]}function U(j){return 1+~~(j.getMonth()/3)}function X(j){return s[j.getUTCDay()]}function tt(j){return o[j.getUTCDay()]}function nt(j){return c[j.getUTCMonth()]}function st(j){return a[j.getUTCMonth()]}function Y(j){return i[+(j.getUTCHours()>=12)]}function rt(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var H=w(j+="",x);return H.toString=function(){return j},H},parse:function(j){var H=T(j+="",!1);return H.toString=function(){return j},H},utcFormat:function(j){var H=w(j+="",_);return H.toString=function(){return j},H},utcParse:function(j){var H=T(j+="",!0);return H.toString=function(){return j},H}}}var LO={"-":"",_:" ",0:"0"},dn=/^\s*\d+/,pX=/^%/,mX=/[\\^$*+?|[\]().{}]/g;function te(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 yX(e){return e.replace(mX,"\\$&")}function Bp(e){return new RegExp("^(?:"+e.map(yX).join("|")+")","i")}function Pp(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function gX(e,t,n){var r=dn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function bX(e,t,n){var r=dn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function xX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function _X(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function wX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function CO(e,t,n){var r=dn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function BO(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function vX(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 SX(e,t,n){var r=dn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function IX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function PO(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function TX(e,t,n){var r=dn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function $O(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function EX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function AX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function MX(e,t,n){var r=dn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function NX(e,t,n){var r=dn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function RX(e,t,n){var r=pX.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function OX(e,t,n){var r=dn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function kX(e,t,n){var r=dn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function UO(e,t){return te(e.getDate(),t,2)}function FX(e,t){return te(e.getHours(),t,2)}function DX(e,t){return te(e.getHours()%12||12,t,2)}function LX(e,t){return te(1+fi.count(Un(e),e),t,3)}function YO(e,t){return te(e.getMilliseconds(),t,3)}function CX(e,t){return YO(e,t)+"000"}function BX(e,t){return te(e.getMonth()+1,t,2)}function PX(e,t){return te(e.getMinutes(),t,2)}function $X(e,t){return te(e.getSeconds(),t,2)}function UX(e){var t=e.getDay();return t===0?7:t}function zX(e,t){return te(Ur.count(Un(e)-1,e),t,2)}function GO(e){var t=e.getDay();return t>=4||t===0?Ro(e):Ro.ceil(e)}function jX(e,t){return e=GO(e),te(Ro.count(Un(e),e)+(Un(e).getDay()===4),t,2)}function qX(e){return e.getDay()}function VX(e,t){return te(za.count(Un(e)-1,e),t,2)}function YX(e,t){return te(e.getFullYear()%100,t,2)}function GX(e,t){return e=GO(e),te(e.getFullYear()%100,t,2)}function WX(e,t){return te(e.getFullYear()%1e4,t,4)}function XX(e,t){var n=e.getDay();return e=n>=4||n===0?Ro(e):Ro.ceil(e),te(e.getFullYear()%1e4,t,4)}function HX(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function zO(e,t){return te(e.getUTCDate(),t,2)}function QX(e,t){return te(e.getUTCHours(),t,2)}function ZX(e,t){return te(e.getUTCHours()%12||12,t,2)}function KX(e,t){return te(1+dl.count(zn(e),e),t,3)}function WO(e,t){return te(e.getUTCMilliseconds(),t,3)}function JX(e,t){return WO(e,t)+"000"}function tH(e,t){return te(e.getUTCMonth()+1,t,2)}function eH(e,t){return te(e.getUTCMinutes(),t,2)}function nH(e,t){return te(e.getUTCSeconds(),t,2)}function rH(e){var t=e.getUTCDay();return t===0?7:t}function iH(e,t){return te(zr.count(zn(e)-1,e),t,2)}function XO(e){var t=e.getUTCDay();return t>=4||t===0?Oo(e):Oo.ceil(e)}function oH(e,t){return e=XO(e),te(Oo.count(zn(e),e)+(zn(e).getUTCDay()===4),t,2)}function sH(e){return e.getUTCDay()}function aH(e,t){return te(ja.count(zn(e)-1,e),t,2)}function cH(e,t){return te(e.getUTCFullYear()%100,t,2)}function lH(e,t){return e=XO(e),te(e.getUTCFullYear()%100,t,2)}function uH(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function fH(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Oo(e):Oo.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function dH(){return"+0000"}function jO(){return"%"}function qO(e){return+e}function VO(e){return Math.floor(+e/1e3)}var Ku,Ju,HO,ko,QO;FI({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 FI(e){return Ku=kI(e),Ju=Ku.format,HO=Ku.parse,ko=Ku.utcFormat,QO=Ku.utcParse,Ku}function hH(e){return new Date(e)}function pH(e){return e instanceof Date?+e:+new Date(+e)}function dx(e,t,n,r,i,o,s,a,c,l){var u=Tp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),y=l("%I:%M"),g=l("%I %p"),m=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?y:o(w)<w?g:r(w)<w?i(w)<w?m:b:n(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,pH)):d().map(hH)},u.ticks=function(w){var T=d();return e(T[0],T[T.length-1],w??10)},u.tickFormat=function(w,T){return T==null?v:l(T)},u.nice=function(w){var T=d();return(!w||typeof w.range!="function")&&(w=t(T[0],T[T.length-1],w??10)),w?d(Ap(T,w)):u},u.copy=function(){return Mo(u,dx(e,t,n,r,i,o,s,a,c,l))},u}function hx(){return Xe.apply(dx(MI,NI,Un,Bs,Ur,fi,Ls,Fs,fn,Ju).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function px(){return Xe.apply(dx(AI,Lp,zn,Ps,zr,dl,Cs,Ds,fn,ko).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function $p(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function mx(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=vr,u,f=!1,d;function h(y){return isNaN(y=+y)?d:(y=.5+((y=+u(y))-o)*(r*y<r*o?a:c),l(f?Math.max(0,Math.min(1,y)):y))}h.domain=function(y){return arguments.length?([e,t,n]=y,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(y){return arguments.length?(f=!!y,h):f},h.interpolator=function(y){return arguments.length?(l=y,h):l};function p(y){return function(g){var m,b,x;return arguments.length?([m,b,x]=g,l=xo(y,[m,b,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(Pr),h.rangeRound=p(Qc),h.unknown=function(y){return arguments.length?(d=y,h):d},function(y){return u=y,i=y(e),o=y(t),s=y(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function Up(){var e=Os(mx()(vr));return e.copy=function(){return $p(e,Up())},Sp.apply(e,arguments)}function yx(){var e=vI(mx()).domain([.1,1,10]);return e.copy=function(){return $p(e,yx()).base(e.base())},Sp.apply(e,arguments)}function gx(){var e=SI(mx());return e.copy=function(){return $p(e,gx()).constant(e.constant())},Sp.apply(e,arguments)}function bx(){var e=II(mx());return e.copy=function(){return $p(e,bx()).exponent(e.exponent())},Sp.apply(e,arguments)}function G(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 DI=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var LI=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var CI=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var BI=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var PI=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var $I=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var UI=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var zI=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var jI=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var qI=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ft=e=>$2(e[e.length-1]);var xx=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),_x=ft(xx);var wx=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),vx=ft(wx);var Sx=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),Ix=ft(Sx);var Tx=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),Ex=ft(Tx);var zp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),tf=ft(zp);var Ax=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),Mx=ft(Ax);var jp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),ef=ft(jp);var Nx=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),Rx=ft(Nx);var Ox=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),kx=ft(Ox);var Fx=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Dx=ft(Fx);var Lx=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),Cx=ft(Lx);var Bx=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),Px=ft(Bx);var $x=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Ux=ft($x);var zx=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),jx=ft(zx);var qx=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Vx=ft(qx);var Yx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),Gx=ft(Yx);var Wx=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),Xx=ft(Wx);var Hx=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),Qx=ft(Hx);var Zx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),Kx=ft(Zx);var Jx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),t1=ft(Jx);var e1=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),n1=ft(e1);var r1=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),i1=ft(r1);var o1=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),s1=ft(o1);var a1=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),c1=ft(a1);var l1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),u1=ft(l1);var f1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),d1=ft(f1);var h1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),p1=ft(h1);function m1(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 y1=Nu(Qn(300,.5,0),Qn(-240,.5,1));var b1=Nu(Qn(-100,.75,.35),Qn(80,1.5,.8)),x1=Nu(Qn(260,.75,.35),Qn(80,1.5,.8)),g1=Qn();function _1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return g1.h=360*e-100,g1.s=1.5-1.5*t,g1.l=.8-.9*t,g1+""}var w1=ln(),mH=Math.PI/3,yH=Math.PI*2/3;function v1(e){var t;return e=(.5-e)*Math.PI,w1.r=255*(t=Math.sin(e))*t,w1.g=255*(t=Math.sin(e+mH))*t,w1.b=255*(t=Math.sin(e+yH))*t,w1+""}function S1(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 I1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var T1=I1(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),E1=I1(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),A1=I1(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),M1=I1(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function He(e){return function(){return e}}var VI=Math.cos;var nf=Math.min,qp=Math.sin,ee=Math.sqrt,YI=1e-12,yl=Math.PI,K4t=yl/2,rf=2*yl;function N1(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 Da(t)}var nRt=Array.prototype.slice;function R1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ZO(e){this._context=e}ZO.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 $s(e){return new ZO(e)}function O1(e){return e[0]}function k1(e){return e[1]}function Vp(e,t){var n=He(!0),r=null,i=$s,o=null,s=N1(a);e=typeof e=="function"?e:e===void 0?O1:He(e),t=typeof t=="function"?t:t===void 0?k1:He(t);function a(c){var l,u=(c=R1(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:He(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:He(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:He(!!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 of(e,t,n){var r=null,i=He(!0),o=null,s=$s,a=null,c=N1(l);e=typeof e=="function"?e:e===void 0?O1:He(+e),t=typeof t=="function"?t:t===void 0?He(0):He(+t),n=typeof n=="function"?n:n===void 0?k1:He(+n);function l(f){var d,h,p,y=(f=R1(f)).length,g,m=!1,b,x=new Array(y),_=new Array(y);for(o==null&&(a=s(b=c())),d=0;d<=y;++d){if(!(d<y&&i(g=f[d],d,f))===m)if(m=!m)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()}m&&(x[d]=+e(g,d,f),_[d]=+t(g,d,f),a.point(r?+r(g,d,f):x[d],n?+n(g,d,f):_[d]))}if(b)return a=null,b+""||null}function u(){return Vp().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:He(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:He(+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:He(!!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 F1=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 GI(e){return new F1(e,!0)}function WI(e){return new F1(e,!1)}var gH=ee(3),Yp={draw(e,t){let n=ee(t+nf(t/28,.75))*.59436,r=n/2,i=r*gH;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 Us={draw(e,t){let n=ee(t/yl);e.moveTo(n,0),e.arc(0,0,n,0,rf)}};var Gp={draw(e,t){let n=ee(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 KO=ee(1/3),bH=KO*2,Wp={draw(e,t){let n=ee(t/bH),r=n*KO;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var Xp={draw(e,t){let n=ee(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var Hp={draw(e,t){let n=ee(t-nf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var Qp={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var Zp={draw(e,t){let n=ee(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var xH=.8908130915292852,JO=qp(yl/10)/qp(7*yl/10),_H=qp(rf/10)*JO,wH=-VI(rf/10)*JO,Kp={draw(e,t){let n=ee(t*xH),r=_H*n,i=wH*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=rf*o/5,a=VI(s),c=qp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var XI=ee(3),Jp={draw(e,t){let n=-ee(t/(XI*3));e.moveTo(0,n*2),e.lineTo(-XI*n,-n),e.lineTo(XI*n,-n),e.closePath()}};var vH=ee(3),tm={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*vH/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var di=-.5,hi=ee(3)/2,HI=1/ee(12),SH=(HI/2+1)*3,em={draw(e,t){let n=ee(t/SH),r=n/2,i=n*HI,o=r,s=n*HI+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(di*r-hi*i,hi*r+di*i),e.lineTo(di*o-hi*s,hi*o+di*s),e.lineTo(di*a-hi*c,hi*a+di*c),e.lineTo(di*r+hi*i,di*i-hi*r),e.lineTo(di*o+hi*s,di*s-hi*o),e.lineTo(di*a+hi*c,di*c-hi*a),e.closePath()}};var sf={draw(e,t){let n=ee(t-nf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var D1=[Us,Gp,Wp,Qp,Kp,Jp,em],QI=[Us,Hp,sf,tm,Yp,Zp,Xp];function pi(){}function af(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 nm(e){this._context=e}nm.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:af(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:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ZI(e){return new nm(e)}function tk(e){this._context=e}tk.prototype={areaStart:pi,areaEnd:pi,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:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function KI(e){return new tk(e)}function ek(e){this._context=e}ek.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:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function JI(e){return new ek(e)}function nk(e,t){this._basis=new nm(e),this._beta=t}nk.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 tT=function e(t){function n(r){return t===1?new nm(r):new nk(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function cf(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 L1(e,t){this._context=e,this._k=(1-t)/6}L1.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:cf(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:cf(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 eT=function e(t){function n(r){return new L1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function C1(e,t){this._context=e,this._k=(1-t)/6}C1.prototype={areaStart:pi,areaEnd:pi,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:cf(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 nT=function e(t){function n(r){return new C1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function B1(e,t){this._context=e,this._k=(1-t)/6}B1.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:cf(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 rT=function e(t){function n(r){return new B1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function rm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>YI){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>YI){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 rk(e,t){this._context=e,this._alpha=t}rk.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:rm(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 iT=function e(t){function n(r){return t?new rk(r,t):new L1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function ik(e,t){this._context=e,this._alpha=t}ik.prototype={areaStart:pi,areaEnd:pi,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:rm(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 oT=function e(t){function n(r){return t?new ik(r,t):new C1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function ok(e,t){this._context=e,this._alpha=t}ok.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:rm(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 sT=function e(t){function n(r){return t?new ok(r,t):new B1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function sk(e){this._context=e}sk.prototype={areaStart:pi,areaEnd:pi,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 aT(e){return new sk(e)}function ak(e){return e<0?-1:1}function ck(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(ak(o)+ak(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function lk(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function cT(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 P1(e){this._context=e}P1.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:cT(this,this._t0,lk(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,cT(this,lk(this,n=ck(this,e,t)),n);break;default:cT(this,this._t0,n=ck(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function uk(e){this._context=new fk(e)}(uk.prototype=Object.create(P1.prototype)).point=function(e,t){P1.prototype.point.call(this,t,e)};function fk(e){this._context=e}fk.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 lT(e){return new P1(e)}function uT(e){return new uk(e)}function hk(e){this._context=e}hk.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=dk(e),i=dk(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 dk(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 fT(e){return new hk(e)}function $1(e,t){this._context=e,this._t=t}$1.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 dT(e){return new $1(e,.5)}function hT(e){return new $1(e,0)}function pT(e){return new $1(e,1)}var im=e=>()=>e;function mT(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 om=new jr(1,0,0);yT.prototype=jr.prototype;function yT(e){for(;!e.__zoom;)if(!(e=e.parentNode))return om;return e.__zoom}function U1(e){e.stopImmediatePropagation()}function lf(e){e.preventDefault(),e.stopImmediatePropagation()}function IH(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function TH(){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 pk(){return this.__zoom||om}function EH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function AH(){return navigator.maxTouchPoints||"ontouchstart"in this}function MH(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 gT(){var e=IH,t=TH,n=MH,r=EH,i=AH,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Y2,l=Vc("start","zoom","end"),u,f,d,h=500,p=150,y=0,g=10;function m(S){S.property("__zoom",pk).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",E).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(S,A,N,D){var B=S.selection?S.selection():S;B.property("__zoom",pk),S!==B?v(S,A,N,D):B.interrupt().each(function(){w(this,arguments).event(D).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(S,A,N,D){m.scaleTo(S,function(){var B=this.__zoom.k,C=typeof A=="function"?A.apply(this,arguments):A;return B*C},N,D)},m.scaleTo=function(S,A,N,D){m.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?_(B):typeof N=="function"?N.apply(this,arguments):N,$=C.invert(P),U=typeof A=="function"?A.apply(this,arguments):A;return n(x(b(C,U),P,$),B,s)},N,D)},m.translateBy=function(S,A,N,D){m.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,D)},m.translateTo=function(S,A,N,D,B){m.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,$=D==null?_(C):typeof D=="function"?D.apply(this,arguments):D;return n(om.translate($[0],$[1]).scale(P.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},D,B)};function b(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new jr(A,S.x,S.y)}function x(S,A,N){var D=A[0]-N[0]*S.k,B=A[1]-N[1]*S.k;return D===S.x&&B===S.y?S:new jr(S.k,D,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,A,N,D){S.on("start.zoom",function(){w(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(D).end()}).tween("zoom",function(){var B=this,C=arguments,P=w(B,C).event(D),$=t.apply(B,C),U=N==null?_($):typeof N=="function"?N.apply(B,C):N,X=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),tt=B.__zoom,nt=typeof A=="function"?A.apply(B,C):A,st=c(tt.invert(U).concat(X/tt.k),nt.invert(U).concat(X/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=st(Y),j=X/rt[2];Y=new jr(j,U[0]-rt[0]*j,U[1]-rt[1]*j)}P.zoom(null,Y)}})}function w(S,A,N){return!N&&S.__zooming||new T(S,A)}function T(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),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,A){return this.mouse&&S!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var A=zt(this.that).datum();l.call(S,this.that,new mT(S,{sourceEvent:this.sourceEvent,target:m,type:S,transform:this.that.__zoom,dispatch:l}),A)}};function M(S,...A){if(!e.apply(this,arguments))return;var N=w(this,A).event(S),D=this.__zoom,B=Math.max(o[0],Math.min(o[1],D.k*Math.pow(2,r.apply(this,arguments)))),C=Ln(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=D.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(D.k===B)return;N.mouse=[C,D.invert(C)],_o(this),N.start()}lf(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(x(b(D,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function R(S,...A){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,D=w(this,A,!0).event(S),B=zt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",X,!0),C=Ln(S,N),P=S.clientX,$=S.clientY;Lh(S.view),U1(S),D.mouse=[C,this.__zoom.invert(C)],_o(this),D.start();function U(tt){if(lf(tt),!D.moved){var nt=tt.clientX-P,st=tt.clientY-$;D.moved=nt*nt+st*st>y}D.event(tt).zoom("mouse",n(x(D.that.__zoom,D.mouse[0]=Ln(tt,N),D.mouse[1]),D.extent,s))}function X(tt){B.on("mousemove.zoom mouseup.zoom",null),Ch(tt.view,D.moved),lf(tt),D.event(tt).end()}}function I(S,...A){if(e.apply(this,arguments)){var N=this.__zoom,D=Ln(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(D),C=N.k*(S.shiftKey?.5:2),P=n(x(b(N,C),D,B),t.apply(this,A),s);lf(S),a>0?zt(this).transition().duration(a).call(v,P,D,S):zt(this).call(m.transform,P,D,S)}}function E(S,...A){if(e.apply(this,arguments)){var N=S.touches,D=N.length,B=w(this,A,S.changedTouches.length===D).event(S),C,P,$,U;for(U1(S),P=0;P<D;++P)$=N[P],U=Ln($,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)),_o(this),B.start())}}function O(S,...A){if(this.__zooming){var N=w(this,A).event(S),D=S.changedTouches,B=D.length,C,P,$,U;for(lf(S),C=0;C<B;++C)P=D[C],$=Ln(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 X=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],st=N.touch1[1],Y=(Y=nt[0]-X[0])*Y+(Y=nt[1]-X[1])*Y,rt=(rt=st[0]-tt[0])*rt+(rt=st[1]-tt[1])*rt;P=b(P,Math.sqrt(Y/rt)),$=[(X[0]+nt[0])/2,(X[1]+nt[1])/2],U=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)$=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(x(P,$,U),N.extent,s))}}function F(S,...A){if(this.__zooming){var N=w(this,A).event(S),D=S.changedTouches,B=D.length,C,P;for(U1(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=D[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=Ln(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<g)){var $=zt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return m.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:im(+S),m):r},m.filter=function(S){return arguments.length?(e=typeof S=="function"?S:im(!!S),m):e},m.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:im(!!S),m):i},m.extent=function(S){return arguments.length?(t=typeof S=="function"?S:im([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),m):t},m.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],m):[o[0],o[1]]},m.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],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(S){return arguments.length?(n=S,m):n},m.duration=function(S){return arguments.length?(a=+S,m):a},m.interpolate=function(S){return arguments.length?(c=S,m):c},m.on=function(){var S=l.on.apply(l,arguments);return S===l?m:S},m.clickDistance=function(S){return arguments.length?(y=(S=+S)*S,m):Math.sqrt(y)},m.tapDistance=function(S){return arguments.length?(g=+S,m):g},m}function Ue(e){return e!=null&&!Number.isNaN(e)}function hn(e,t){return+Ue(t)-+Ue(e)||Gt(e,t)}function gl(e,t){return+Ue(t)-+Ue(e)||Wn(e,t)}function sm(e){return e!=null&&`${e}`!=""}function uf(e){return isFinite(e)?e:NaN}function rr(e){return e>0&&isFinite(e)?e:NaN}function qa(e){return e<0&&isFinite(e)?e:NaN}var df=1e3,Ya=df*60,Ga=Ya*60,Do=Ga*24,Fo=Do*7,bl=Do*30,Va=Do*365,bT=[["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",df],["5 seconds",5*df],["15 seconds",15*df],["30 seconds",30*df],["minute",Ya],["5 minutes",5*Ya],["15 minutes",15*Ya],["30 minutes",30*Ya],["hour",Ga],["3 hours",3*Ga],["6 hours",6*Ga],["12 hours",12*Ga],["day",Do],["2 days",2*Do],["week",Fo],["2 weeks",2*Fo],["month",bl],["3 months",3*bl],["6 months",6*bl],["year",Va],["2 years",2*Va],["5 years",5*Va],["10 years",10*Va],["20 years",20*Va],["50 years",50*Va],["100 years",100*Va]],xT=new Map([["second",df],["minute",Ya],["hour",Ga],["day",Do],["monday",Fo],["tuesday",Fo],["wednesday",Fo],["thursday",Fo],["friday",Fo],["saturday",Fo],["sunday",Fo],["week",Fo],["month",bl],["year",Va]]),yk=new Map([["second",fn],["minute",Fs],["hour",Ls],["day",fi],["monday",za],["tuesday",ix],["wednesday",ox],["thursday",Ro],["friday",sx],["saturday",ax],["sunday",Ur],["week",Ur],["month",Bs],["year",Un]]),_T=new Map([["second",fn],["minute",Ds],["hour",Cs],["day",hl],["monday",ja],["tuesday",cx],["wednesday",lx],["thursday",Oo],["friday",ux],["saturday",fx],["sunday",zr],["week",zr],["month",Ps],["year",zn]]),hf=Symbol("intervalDuration"),j1=Symbol("intervalType");for(let[e,t]of yk)t[hf]=xT.get(e),t[j1]="time";for(let[e,t]of _T)t[hf]=xT.get(e),t[j1]="utc";var am=[["year",zn,"utc"],["month",Ps,"utc"],["day",hl,"utc",6*bl],["hour",Cs,"utc",3*Do],["minute",Ds,"utc",6*Ga],["second",fn,"utc",30*Ya]],z1=[["year",Un,"time"],["month",Bs,"time"],["day",fi,"time",6*bl],["hour",Ls,"time",3*Do],["minute",Fs,"time",6*Ga],["second",fn,"time",30*Ya]],NH=[am[0],z1[0],am[1],z1[1],am[2],z1[2],...am.slice(3)];function q1(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=_T.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 wT(e){return gk(q1(e),"time")}function cm(e){return gk(q1(e),"utc")}function gk([e,t],n){let r=(n==="time"?yk:_T).get(e);return t>1&&(r=r.every(t),r[hf]=xT.get(e)*t,r[j1]=n),r}function vT(e,t){if(!(t>1))return;let n=e[hf];if(!bT.some(([,i])=>i===n)||n%Do===0&&Do<n&&n<bl)return;let[r]=bT[xs(([,i])=>Math.log(i)).center(bT,Math.log(n*t))];return(e[j1]==="time"?wT:cm)(r)}function mk(e,t,n){let r=t==="time"?Ju:ko;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=RH(n);switch(e){case"millisecond":return ff(r(".%L"),r(":%M:%S"),i);case"second":return ff(r(":%S"),r("%-I:%M"),i);case"minute":return ff(r("%-I:%M"),r("%p"),i);case"hour":return ff(r("%-I %p"),r("%b %-d"),i);case"day":return ff(r("%-d"),r("%b"),i);case"month":return ff(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function RH(e){return e==="left"||e==="right"?(t,n)=>`
10
+ ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new ke(n,i)))}slice(t,n){let r=this.schema;[t,n]=Td({length:this.numRows},t,n);let i=xg(this.data,this._offsets,t,n);return new e(r,i.map(o=>new ke(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Dt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new jt(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 jt([Dt({type:new Yn,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]=Zg(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(...Zg(o,s))}};mO=Symbol.toStringTag;on[mO]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=aa(Ad),e.get=aa(je.getVisitFn(D.Struct)),e.set=_g(wn.getVisitFn(D.Struct)),e.indexOf=wg(wc.getVisitFn(D.Struct)),e.getByteLength=aa(Er.getVisitFn(D.Struct)),"Table"))(on.prototype);var gO,ke=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof re))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dt({nullCount:0,type:new ye(this.schema.fields),children:this.schema.fields.map(n=>Dt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=yO(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=Ut.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Dt({type:new ye(r),length:o,children:i,nullCount:0});[this.schema,this.data]=yO(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=bO(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 je.visit(this.data,t)}set(t,n){return wn.visit(this.data,t,n)}indexOf(t,n){return wc.visit(this.data,t,n)}getByteLength(t){return Er.visit(this.data,t)}[Symbol.iterator](){return Kl.visit(new jt([this.data]))}toArray(){return[...this]}concat(...t){return new on(this.schema,[this,...t])}slice(t,n){let[r]=new jt([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 jt([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 jt([Dt({type:new Yn,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 re(o,new Map(this.schema.metadata)),i=Dt({type:new ye(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new ye(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,Dt({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=Dt({type:new ye(n.fields),length:this.numRows,children:r});return new e(n,i)}};gO=Symbol.toStringTag;ke[gO]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function yO(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:Dt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Dt({type:new ye(i),length:n,children:o})]}function bO(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)||[]])bO(a.children,l?.children,n);if(at.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 Rc=class extends ke{constructor(t){let n=t.fields.map(i=>Dt({type:i.type})),r=Dt({type:new ye(t.fields),nullCount:0,children:n});super(t,r)}};var mh;(function(e){e[e.BUFFER=0]="BUFFER"})(mh||(mh={}));var yh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(yh||(yh={}));var Qg=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):yh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):mh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,yh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,mh.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 su=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 au=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Nr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new au).__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 su).__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 Qg).__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 ds=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Nr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var cu;(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"})(cu||(cu={}));var ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):la.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):cu.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 en).__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,la.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,cu.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 ov=class extends ut{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Bd.startNull(n),Bd.endNull(n)}visitInt(t,n){return Ri.startInt(n),Ri.addBitWidth(n,t.bitWidth),Ri.addIsSigned(n,t.isSigned),Ri.endInt(n)}visitFloat(t,n){return ma.startFloatingPoint(n),ma.addPrecision(n,t.precision),ma.endFloatingPoint(n)}visitBinary(t,n){return Od.startBinary(n),Od.endBinary(n)}visitBool(t,n){return Dd.startBool(n),Dd.endBool(n)}visitUtf8(t,n){return $d.startUtf8(n),$d.endUtf8(n)}visitDecimal(t,n){return eo.startDecimal(n),eo.addScale(n,t.scale),eo.addPrecision(n,t.precision),eo.addBitWidth(n,t.bitWidth),eo.endDecimal(n)}visitDate(t,n){return fa.startDate(n),fa.addUnit(n,t.unit),fa.endDate(n)}visitTime(t,n){return ns.startTime(n),ns.addUnit(n,t.unit),ns.addBitWidth(n,t.bitWidth),ns.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return rs.startTimestamp(n),rs.addUnit(n,t.unit),r!==void 0&&rs.addTimezone(n,r),rs.endTimestamp(n)}visitInterval(t,n){return ya.startInterval(n),ya.addUnit(n,t.unit),ya.endInterval(n)}visitDuration(t,n){return da.startDuration(n),da.addUnit(n,t.unit),da.endDuration(n)}visitList(t,n){return Cd.startList(n),Cd.endList(n)}visitStruct(t,n){return Pd.startStruct_(n),Pd.endStruct_(n)}visitUnion(t,n){Di.startTypeIdsVector(n,t.typeIds.length);let r=Di.createTypeIdsVector(n,t.typeIds);return Di.startUnion(n),Di.addMode(n,t.mode),Di.addTypeIds(n,r),Di.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return to.startDictionaryEncoding(n),to.addId(n,BigInt(t.id)),to.addIsOrdered(n,t.isOrdered),r!==void 0&&to.addIndexType(n,r),to.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return ha.startFixedSizeBinary(n),ha.addByteWidth(n,t.byteWidth),ha.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return pa.startFixedSizeList(n),pa.addListSize(n,t.listSize),pa.endFixedSizeList(n)}visitMap(t,n){return ga.startMap(n),ga.addKeysSorted(n,t.keysSorted),ga.endMap(n)}},Kg=new ov;function vO(e,t=new Map){return new re(sz(e,t),Jg(e.metadata),t)}function sv(e){return new vn(e.count,IO(e.columns),TO(e.columns))}function SO(e){return new hr(sv(e.data),e.id,e.isDelta)}function sz(e,t){return(e.fields||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function xO(e,t){return(e.children||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function IO(e){return(e||[]).reduce((t,n)=>[...t,new Qr(n.count,az(n.VALIDITY)),...IO(n.children)],[])}function TO(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new dr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new dr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new dr(t.length,i.OFFSET.length)),i.DATA&&t.push(new dr(t.length,i.DATA.length)),t=TO(i.children,t)}return t}function az(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function EO(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=wO(e,xO(e,t)),i=new Ut(e.name,s,e.nullable,Jg(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?_O(r):new Hi,a=new Ir(t.get(n),r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,Jg(e.metadata))):(r=(r=o.indexType)?_O(r):new Hi,t.set(n,s=wO(e,xO(e,t))),a=new Ir(s,r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,Jg(e.metadata))),i||null}function Jg(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function _O(e){return new Pe(e.isSigned,e.bitWidth)}function wO(e,t){let n=e.type.name;switch(n){case"NONE":return new Yn;case"null":return new Yn;case"binary":return new Yo;case"utf8":return new Go;case"bool":return new Wo;case"list":return new Ii((t||[])[0]);case"struct":return new ye(t||[]);case"struct_":return new ye(t||[])}switch(n){case"int":{let r=e.type;return new Pe(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new ur(xe[r.precision])}case"decimal":{let r=e.type;return new Xo(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Ho(_n[r.unit])}case"time":{let r=e.type;return new Si(pt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Zo(pt[r.unit],r.timezone)}case"interval":{let r=e.type;return new Qo(Vn[r.unit])}case"duration":{let r=e.type;return new Ko(pt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Ti(me[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new Jo(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Ei(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Mi((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var cz=Sc,lz=Mr,pr=class e{static fromJSON(t,n){let r=new e(0,Ie.V5,n);return r._createHeader=uz(t,n),r}static decode(t){t=new lz(Ot(t));let n=ki.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=fz(n,o),s}static encode(t){let n=new cz,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=vn.encode(n,t.header()):t.isDictionaryBatch()&&(r=hr.encode(n,t.header())),ki.startMessage(n),ki.addVersion(n,Ie.V5),ki.addHeader(n,r),ki.addHeaderType(n,t.headerType),ki.addBodyLength(n,BigInt(t.bodyLength)),ki.finishMessageBuffer(n,ki.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,Ie.V5,Qt.Schema,t);if(t instanceof vn)return new e(n,Ie.V5,Qt.RecordBatch,t);if(t instanceof hr)return new e(n,Ie.V5,Qt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Qt.Schema}isRecordBatch(){return this.headerType===Qt.RecordBatch}isDictionaryBatch(){return this.headerType===Qt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=lr(t)}},vn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=lr(t)}},hr=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=lr(n)}},dr=class{constructor(t,n){this.offset=lr(t),this.length=lr(n)}},Qr=class{constructor(t,n){this.length=lr(t),this.nullCount=lr(n)}};function uz(e,t){return()=>{switch(t){case Qt.Schema:return re.fromJSON(e);case Qt.RecordBatch:return vn.fromJSON(e);case Qt.DictionaryBatch:return hr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}function fz(e,t){return()=>{switch(t){case Qt.Schema:return re.decode(e.header(new fr),new Map,e.version());case Qt.RecordBatch:return vn.decode(e.header(new Nr),e.version());case Qt.DictionaryBatch:return hr.decode(e.header(new ds),e.version())}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}Ut.encode=vz;Ut.decode=_z;Ut.fromJSON=EO;re.encode=wz;re.decode=dz;re.fromJSON=vO;vn.encode=Sz;vn.decode=hz;vn.fromJSON=sv;hr.encode=Iz;hr.decode=pz;hr.fromJSON=SO;Qr.encode=Tz;Qr.decode=yz;dr.encode=Ez;dr.decode=mz;function dz(e,t=new Map,n=Ie.V5){let r=xz(e,t);return new re(r,t0(e),t,n)}function hz(e,t=Ie.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new vn(e.length(),gz(e),bz(e,t))}function pz(e,t=Ie.V5){return new hr(vn.decode(e.data(),t),e.id(),e.isDelta())}function mz(e){return new dr(e.offset(),e.length())}function yz(e){return new Qr(e.length(),e.nullCount())}function gz(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Qr.decode(n));return t}function bz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Ie.V4&&(r.bb_pos+=8*(i+1)),n[++o]=dr.decode(r));return n}function xz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Ut.decode(r,t));return n}function MO(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Ut.decode(r,t));return n}function _z(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=NO(e,MO(e,t)),r=new Ut(e.name(),i,e.nullable(),t0(e))):t.has(n=lr(a.id()))?(o=(o=a.indexType())?AO(o):new Hi,s=new Ir(t.get(n),o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),t0(e))):(o=(o=a.indexType())?AO(o):new Hi,t.set(n,i=NO(e,MO(e,t))),s=new Ir(i,o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),t0(e))),r||null}function t0(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 AO(e){return new Pe(e.isSigned(),e.bitWidth())}function NO(e,t){let n=e.typeType();switch(n){case ge.NONE:return new Yn;case ge.Null:return new Yn;case ge.Binary:return new Yo;case ge.Utf8:return new Go;case ge.Bool:return new Wo;case ge.List:return new Ii((t||[])[0]);case ge.Struct_:return new ye(t||[])}switch(n){case ge.Int:{let r=e.type(new Ri);return new Pe(r.isSigned(),r.bitWidth())}case ge.FloatingPoint:{let r=e.type(new ma);return new ur(r.precision())}case ge.Decimal:{let r=e.type(new eo);return new Xo(r.scale(),r.precision(),r.bitWidth())}case ge.Date:{let r=e.type(new fa);return new Ho(r.unit())}case ge.Time:{let r=e.type(new ns);return new Si(r.unit(),r.bitWidth())}case ge.Timestamp:{let r=e.type(new rs);return new Zo(r.unit(),r.timezone())}case ge.Interval:{let r=e.type(new ya);return new Qo(r.unit())}case ge.Duration:{let r=e.type(new da);return new Ko(r.unit())}case ge.Union:{let r=e.type(new Di);return new Ti(r.mode(),r.typeIdsArray()||[],t||[])}case ge.FixedSizeBinary:{let r=e.type(new ha);return new Jo(r.byteWidth())}case ge.FixedSizeList:{let r=e.type(new pa);return new Ei(r.listSize(),(t||[])[0])}case ge.Map:{let r=e.type(new ga);return new Mi((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ge[n]}" (${n})`)}function wz(e,t){let n=t.fields.map(o=>Ut.encode(e,o));fr.startFieldsVector(e,n.length);let r=fr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?fr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return en.startKeyValue(e),en.addKey(e,a),en.addValue(e,c),en.endKeyValue(e)})):-1;return fr.startSchema(e),fr.addFields(e,r),fr.addEndianness(e,Mz?ua.Little:ua.Big),i!==-1&&fr.addCustomMetadata(e,i),fr.endSchema(e)}function vz(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;at.isDictionary(o)?(s=o.dictionary.typeId,i=Kg.visit(o,e),r=Kg.visit(o.dictionary,e)):r=Kg.visit(o,e);let a=(o.children||[]).map(u=>Ut.encode(e,u)),c=kn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?kn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return en.startKeyValue(e),en.addKey(e,d),en.addValue(e,h),en.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),kn.startField(e),kn.addType(e,r),kn.addTypeType(e,s),kn.addChildren(e,c),kn.addNullable(e,!!t.nullable),n!==-1&&kn.addName(e,n),i!==-1&&kn.addDictionary(e,i),l!==-1&&kn.addCustomMetadata(e,l),kn.endField(e)}function Sz(e,t){let n=t.nodes||[],r=t.buffers||[];Nr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Qr.encode(e,s);let i=e.endVector();Nr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())dr.encode(e,s);let o=e.endVector();return Nr.startRecordBatch(e),Nr.addLength(e,BigInt(t.length)),Nr.addNodes(e,i),Nr.addBuffers(e,o),Nr.endRecordBatch(e)}function Iz(e,t){let n=vn.encode(e,t.data);return ds.startDictionaryBatch(e),ds.addId(e,BigInt(t.id)),ds.addIsDelta(e,t.isDelta),ds.addData(e,n),ds.endDictionaryBatch(e)}function Tz(e,t){return au.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Ez(e,t){return su.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Mz=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var cv=e=>`Expected ${Qt[e]} Message in stream, but was null or length 0.`,lv=e=>`Header pointer of flatbuffer-encoded ${Qt[e]} Message is null or length 0.`,RO=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,OO=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,lu=class{constructor(t){this.source=t instanceof ro?t:new ro(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?be:t.value===-1&&(t=this.readMetadataLength()).done?be:(t=this.readMetadata(t.value)).done?be: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(cv(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Ot(this.source.read(t));if(n.byteLength<t)throw new Error(OO(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Qt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(lv(n));return i}readMetadataLength(){let t=this.source.read(e0),n=t&&new Mr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return be;if(n.byteLength<t)throw new Error(RO(t,n.byteLength));return{done:!1,value:pr.decode(n)}}},gh=class{constructor(t,n){this.source=t instanceof Hr?t:Ly(t)?new ba(t,n):new Hr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?be:t.value===-1&&(t=yield this.readMetadataLength()).done?be:(t=yield this.readMetadata(t.value)).done?be: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(cv(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Ot(yield this.source.read(t));if(n.byteLength<t)throw new Error(OO(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Z(this,void 0,void 0,function*(){let n=Qt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(lv(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(e0),n=t&&new Mr(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 be;if(n.byteLength<t)throw new Error(RO(t,n.byteLength));return{done:!1,value:pr.decode(n)}})}},bh=class extends lu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof zd?t:new zd(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:pr.fromJSON(t.schema,Qt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:pr.fromJSON(n,Qt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:pr.fromJSON(n,Qt.RecordBatch)}}return this._body=[],be}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(cv(t));return n.value}readSchema(){let t=Qt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(lv(t));return r}},e0=4,av="ARROW1",uu=new Uint8Array(av.length);for(let e=0;e<av.length;e+=1)uu[e]=av.codePointAt(e);function n0(e,t=0){for(let n=-1,r=uu.length;++n<r;)if(uu[n]!==e[t+n])return!1;return!0}var fu=uu.length,uv=fu+e0,DO=fu*2+e0;var nn=class e extends Ic{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 vr(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 xn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return xn.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:ky(t)?Nz(t):Ly(t)?Dz(t):vr(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):Cy(t)||wd(t)||Py(t)||Yr(t)?Oz(new Hr(t)):Rz(new ro(t))}static readAll(t){return t instanceof e?t.isSync()?kO(t):FO(t):ky(t)||ArrayBuffer.isView(t)||xi(t)||Fy(t)?kO(t):FO(t)}},oo=class extends nn{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return wr(this,arguments,function*(){yield Ct(yield*jl(bi(this[Symbol.iterator]())))})}},xa=class extends nn{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]()}},_a=class extends oo{constructor(t){super(t),this._impl=t}},xh=class extends xa{constructor(t){super(t),this._impl=t}},r0=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=Dt({type:new ye(this.schema.fields),length:t.length,children:r});return new ke(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new jt(l)):new jt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Yd(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},du=class extends r0{constructor(t,n){super(n),this._reader=ky(t)?new bh(this._handle=t):new lu(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=LO(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):be}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):be}next(){if(this.closed)return be;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 Rc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},hu=class extends r0{constructor(t,n){super(n),this._reader=new gh(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=LO(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):be})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):be})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return be;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 Rc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},i0=class extends du{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 qd?t:new qd(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-uv,r=t.readInt32(n),i=t.readAt(n-r,r);return is.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}},fv=class extends hu{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 ba?t:new ba(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Z(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Z(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return Z(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Z(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-uv,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return is.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})}},dv=class extends du{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Ag(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function LO(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*kO(e){let t=nn.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function FO(e){return wr(this,arguments,function*(){let n=yield Ct(nn.from(e));try{if(!(yield Ct(n.open({autoDestroy:!1}))).closed)do yield yield Ct(n);while(!(yield Ct(n.reset().open())).closed)}finally{yield Ct(n.cancel())}})}function Nz(e){return new oo(new dv(e))}function Rz(e){let t=e.peek(fu+7&-8);return t&&t.byteLength>=4?n0(t)?new _a(new i0(e.read())):new oo(new du(e)):new oo(new du(function*(){}()))}function Oz(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(fu+7&-8);return t&&t.byteLength>=4?n0(t)?new _a(new i0(yield e.read())):new xa(new hu(e)):new xa(new hu(function(){return wr(this,arguments,function*(){})}()))})}function Dz(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new ba(e,t);return t>=DO&&n0(yield n.readAt(0,fu+7&-8))?new xh(new fv(n)):new xa(new hu(n))})}var Fe=class e extends ut{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof ke?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof jt)return this.visitMany(t.data),this;let{type:n}=t;if(!at.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(at.isUnion(n))this.nodes.push(new Qr(r,0));else{let{nullCount:i}=t;at.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):xc(t.offset,r,t.nullBitmap)),this.nodes.push(new Qr(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Fi(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new dr(this._byteLength,t)),this._byteLength+=t,this}function kz(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===me.Sparse)return hv.call(this,e);if(n.mode===me.Dense){if(e.offset<=0)return Fi.call(this,o),hv.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Fi.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(r,h))}))}}return this}function Fz(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,xc(e.offset,e.length,t)):Fi.call(this,_c(e.values))}function hs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function CO(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return Fi.call(this,Uy(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function pv(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,Uy(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function hv(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Fe.prototype.visitBool=Fz;Fe.prototype.visitInt=hs;Fe.prototype.visitFloat=hs;Fe.prototype.visitUtf8=CO;Fe.prototype.visitBinary=CO;Fe.prototype.visitFixedSizeBinary=hs;Fe.prototype.visitDate=hs;Fe.prototype.visitTimestamp=hs;Fe.prototype.visitTime=hs;Fe.prototype.visitDecimal=hs;Fe.prototype.visitList=pv;Fe.prototype.visitStruct=hv;Fe.prototype.visitUnion=kz;Fe.prototype.visitInterval=hs;Fe.prototype.visitDuration=hs;Fe.prototype.visitFixedSizeList=pv;Fe.prototype.visitMap=pv;var Oc=class extends Ic{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 no,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 vr(t)?t.then(n=>this.writeAll(n)):Yr(t)?yv(this,t):mv(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 no?this._sink=t:(this._sink=new no,t&&eR(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&nR(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||!Nc(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 on&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof ke&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Nc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Rc||this._writeRecordBatch(t):t instanceof on?this.writeAll(t.batches):xi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=pr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Qt.RecordBatch?this._recordBatchBlocks.push(new os(a,t.bodyLength,this._position)):t.headerType===Qt.DictionaryBatch&&this._dictionaryBlocks.push(new os(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=Ot(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(pr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(uu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Fe.assemble(t),s=new vn(t.numRows,r,i),a=pr.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}=Fe.assemble(new jt([t])),c=new vn(t.length,o,s),l=new hr(c,n,r),u=pr.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}},Dc=class e extends Oc{static writeAll(t,n){let r=new e(n);return vr(t)?t.then(i=>r.writeAll(i)):Yr(t)?yv(r,t):mv(r,t)}},kc=class e extends Oc{static writeAll(t){let n=new e;return vr(t)?t.then(r=>n.writeAll(r)):Yr(t)?yv(n,t):mv(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=is.encode(new is(t,Ie.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function mv(e,t){let n=t;t instanceof on&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function yv(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 BO(e,t){if(Yr(e))return Cz(e,t);if(xi(e))return Lz(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Lz(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=Ot(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 Cz(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=Ot(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 $O(e){return new gv(e)}var gv=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=J4(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ec(o),this._getSize=i!=="bytes"?PO:UO;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"?PO:UO}),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)}},PO=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},UO=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function o0(e,t){let n=new no,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 nn.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 s0(e,t){let n=new this(e),r=new Hr(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 Fc(e){let t=nn.from(e);return vr(t)?t.then(n=>Fc(n)):t.isAsync()?t.readAll().then(n=>new on(n)):new on(t.readAll())}function a0(e,t="stream"){return(t==="stream"?Dc:kc).writeAll(e).toUint8Array(!0)}var Uz=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Aw),tv),Yw),Nw),Sw),Vw),Ew),{compareSchemas:Nc,compareFields:hO,compareTypes:pO});xn.toDOMStream=BO;_e.throughDOM=$O;nn.throughDOM=o0;_a.throughDOM=o0;oo.throughDOM=o0;Oc.throughDOM=s0;kc.throughDOM=s0;Dc.throughDOM=s0;function c0(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(Fc(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var mr=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?`${qO(t)}.`:""}${r}`}else return t?qO(t):"NULL"}};function qO(e){return e.split(".").map(n=>`"${n}"`).join(".")}function jO(e,t){return e instanceof mr&&e.column===t}function Vt(e){return typeof e=="string"?wa(e):e}function Lc(e){return typeof e=="string"?VO(e):e}function VO(e){return new mr(e)}function wa(e,t){return arguments.length===1&&(t=e,e=null),new mr(e,t)}function so(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var ps=e=>typeof e?.addEventListener=="function";function l0(e){return e instanceof va}var va=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>ps(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>$z(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=>ps(t)&&!l0(t)?so(t.value):t).join("")}addEventListener(t,n){let r=this.map||(this.map=new Map);(r.get(t)||(r.set(t,new Set),r.get(t))).add(n)}};function $z(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function bv(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];ps(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:so(a));let c=e[++o];ps(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function j(e,...t){let{spans:n,cols:r}=bv(e,t);return new va(n,r)}function xv(e){let t=Vt(e);return j`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Rr=e=>({value:e,toString:()=>so(e)});function _h(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function YO(e,t){let n=t.filter(i=>i!=null).map(Vt),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),j(r,...n).annotate({op:e,children:n,visit:_h})}var Wn=(...e)=>YO("AND",e.flat()),Cc=(...e)=>YO("OR",e.flat()),zz=e=>t=>j`(${e} ${Vt(t)})`.annotate({op:e,a:t,visit:_h}),_v=zz("NOT"),GO=e=>t=>j`(${Vt(t)} ${e})`.annotate({op:e,a:t,visit:_h}),Bc=GO("IS NULL"),ms=GO("IS NOT NULL"),Sa=e=>(t,n)=>j`(${Vt(t)} ${e} ${Vt(n)})`.annotate({op:e,a:t,b:n,visit:_h}),ys=Sa("="),wh=Sa("<>"),gs=Sa("<"),Pc=Sa(">"),bs=Sa("<="),wv=Sa(">="),vv=Sa("IS DISTINCT FROM"),vh=Sa("IS NOT DISTINCT FROM");function WO(e,t,n,r){t=Vt(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?j`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:j`(${t} ${e} ${n[0]} AND ${n[1]})`:j``).annotate({op:e,visit:_h,field:t,range:n})}var Te=(e,t,n)=>WO("BETWEEN",e,t,n),Sv=(e,t,n)=>WO("NOT BETWEEN",e,t,n);function Uc(e,t){return Array.from({length:e},()=>t)}function Sn(e,t){return(...n)=>{let r=n.map(Vt),i=t?`::${t}`:"";return(r.length?j([`${e}(`,...Uc(r.length-1,", "),`)${i}`],...r):j`${e}()${i}`).annotate({func:e,args:r})}}var Iv=Sn("REGEXP_MATCHES"),Tv=Sn("CONTAINS"),Ev=Sn("PREFIX"),Mv=Sn("SUFFIX"),qz=Sn("LOWER"),jz=Sn("UPPER"),Vz=Sn("LENGTH"),Yz=Sn("ISNAN"),Gz=Sn("ISFINITE"),Wz=Sn("ISINF");var Sh=class e extends va{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?j`${n} OVER "${i}"`:j`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=j`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=j`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:n,type:r,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map(Vt),r=j(["PARTITION BY ",Uc(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(Vt),r=j(["ORDER BY ",Uc(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=XO("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=XO("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 XO(e,t){if(ps(t)){let n=j`${t}`;return n.toString=()=>`${e} ${HO(t.value)}`,n}return`${e} ${HO(t)}`}function HO(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 Li(e,t){return(...n)=>{let r=Sn(e)(...n);return new Sh(e,r,t)}}var Av=Li("ROW_NUMBER","INTEGER"),Nv=Li("RANK","INTEGER"),Rv=Li("DENSE_RANK","INTEGER"),Ov=Li("PERCENT_RANK"),Dv=Li("CUME_DIST"),kv=Li("NTILE"),Fv=Li("LAG"),Lv=Li("LEAD"),Cv=Li("FIRST_VALUE"),Bv=Li("LAST_VALUE"),Pv=Li("NTH_VALUE");function $v(e,...t){return j(e,...t).annotate({aggregate:!0})}var Uv=class e extends va{constructor(t,n,r,i,o){n=(n||[]).map(Vt);let{strings:s,exprs:a}=Xz(t,n,r,i,o),{spans:c,cols:l}=bv(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(Hz).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 Sh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function Xz(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...Uc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Hz(e){let t=so(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Ht(e,t){return(...n)=>new Uv(e,n,t)}var Or=Ht("COUNT","INTEGER"),zv=Ht("AVG"),Zz=Ht("AVG"),qv=Ht("MAD"),Kr=Ht("MAX"),Jr=Ht("MIN"),Dr=Ht("SUM","DOUBLE"),jv=Ht("PRODUCT"),Vv=Ht("MEDIAN"),Yv=Ht("QUANTILE"),Gv=Ht("MODE"),Wv=Ht("VARIANCE"),Xv=Ht("STDDEV"),Hv=Ht("SKEWNESS"),Zv=Ht("KURTOSIS"),Qv=Ht("ENTROPY"),Kv=Ht("VAR_POP"),Jv=Ht("STDDEV_POP"),t2=Ht("CORR"),e2=Ht("COVAR_POP"),n2=Ht("REGR_INTERCEPT"),r2=Ht("REGR_SLOPE"),i2=Ht("REGR_COUNT"),Qz=Ht("REGR_R2"),o2=Ht("REGR_SYY"),s2=Ht("REGR_SXX"),Kz=Ht("REGR_SXY"),a2=Ht("REGR_AVGX"),Jz=Ht("REGR_AVGY"),tq=Ht("FIRST"),c2=Ht("LAST"),pu=Ht("ARG_MIN"),mu=Ht("ARG_MAX"),l2=Ht("STRING_AGG"),u2=Ht("ARRAY_AGG");function Ih(e,t){let n=Vt(e),r=j`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 yu=e=>Ih(e,"DOUBLE"),f2=e=>Ih(e,"INTEGER");var Th=e=>{let t=Vt(e);return j`(1000 * (epoch(${t}) - second(${t})) + millisecond(${t}))::DOUBLE`},d2=e=>{let t=Vt(e);return j`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},h2=e=>{let t=Vt(e);return j`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},p2=e=>{let t=Vt(e);return j`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Eh=Sn("ST_AsGeoJSON"),ZO=Sn("ST_X"),QO=Sn("ST_Y"),Mh=Sn("ST_CENTROID"),m2=e=>ZO(Mh(e)),y2=e=>QO(Mh(e));var yt=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 $c("UNION",t.flat())}static unionAll(...t){return new $c("UNION ALL",t.flat())}static intersect(...t){return new $c("INTERSECT",t.flat())}static except(...t){return new $c("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:Vt(i)});else if(i instanceof mr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:u0(o),expr:Vt(i[o])});return n.select=n.select.concat(r),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:Lc(i)});else if(i instanceof mr)r.push({as:i.table,from:i});else if(f0(i)||l0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:u0(i[0]),from:Lc(i[1])});else for(let o in i)r.push({as:u0(o),from:Lc(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(Vt)),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:u0(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(Vt)),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(f0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let b=h.map(({as:m,query:g})=>`"${m}" AS (${g})`);p.push(`WITH ${b.join(", ")}`)}let y=t.map(({as:b,expr:m})=>jO(m,b)&&!m.table?`${m}`:`${m} AS "${b}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${y.join(", ")}`),r.length){let b=r.map(({as:m,from:g})=>{let x=f0(g)?`(${g})`:`${g}`;return!m||m===g.table?x:`${x} AS "${m}"`});p.push(`FROM ${b.join(", ")}`)}if(o.length){let b=o.map(String).filter(m=>m).join(" AND ");b&&p.push(`WHERE ${b}`)}if(i){let{rows:b,perc:m,method:g,seed:x}=i,_=b?`${b} ROWS`:`${m} PERCENT`,v=g?` (${g}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${_}${v}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let b=a.map(String).filter(m=>m).join(" AND ");b&&p.push(`HAVING ${b}`)}if(c.length){let b=c.map(({as:m,expr:g})=>`"${m}" AS (${g})`);p.push(`WINDOW ${b.join(", ")}`)}if(l.length){let b=l.map(String).filter(m=>m).join(" AND ");b&&p.push(`QUALIFY ${b}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},$c=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Vt)),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 f0(e){return e instanceof yt||e instanceof $c}function u0(e){return eq(e)?e.slice(1,-1):e}function eq(e){return e[0]==='"'&&e[e.length-1]==='"'}function Ia(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 g2(e){return`INSTALL ${e}; LOAD ${e}`}function KO(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${so(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function d0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=nq({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Ia(t,p,{view:a,temp:c,replace:l})}function x2(e,t,n){return d0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function _2(e,t,n){return d0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function w2(e,t,n){return d0("read_parquet",e,t,n)}function v2(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");i.open_options=o.toUpperCase()}return d0("st_read",e,t,i)}function S2(e,t,n={}){let{select:r=["*"],...i}=n,o=KO(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return Ia(e,s,i)}function nq(e){return Object.entries(e).map(([t,n])=>`${t}=${b2(n)}`).join(", ")}function b2(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=>b2(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${b2(n)}`).join(", ")+"}";default:return e}}function JO(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var rq="count",iq="nulls",oq="max",sq="min",aq="distinct";var cq={[rq]:Or,[aq]:e=>Or(e).distinct(),[oq]:Kr,[sq]:Jr,[iq]:e=>Or().where(Bc(e))};function tD({table:e,column:t},n){return yt.from(e).select(n.map(r=>[r,cq[r](t)]))}var eD=()=>Object.create(null),h0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=eD()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=lq(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(tD(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await uq(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function lq(e,t){let n=await e.query(`DESCRIBE ${Lc(t)}`,{type:"json",cache:!1}),r=eD();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:JO(i.column_type),nullable:i.null==="YES"};return r}async function uq(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function rD(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=nD(t^o>>8)),t=nD(t^i&255)}return fq(t)}function nD(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function fq(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var sD=e=>e,p0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,oD),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=dq(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=oD(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let g=Object.values(i.columns).map(x=>x.columns[0]);mq(d,g)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),b=`cube_index_${(rD(p)>>>0).toString(16)}`,m=a.exec(Ia(b,p,{temp:c}));s.set(l,{table:b,result:m,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=yt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function dq(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>hq(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Te("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Wn(l.children.map(({range:u},f)=>Te(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=sD,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function hq(e,t){let{type:n,domain:r,range:i}=e,o,s;switch(n){case"linear":o=sD,s=Vt;break;case"log":o=Math.log,s=a=>j`LN(${Vt(a)})`;break;case"symlog":o=a=>Math.sign(a)*Math.log1p(Math.abs(a)),s=a=>(a=Vt(a),j`SIGN(${a}) * LN(1 + ABS(${a}))`);break;case"sqrt":o=Math.sqrt,s=a=>j`SQRT(${Vt(a)})`;break;case"utc":case"time":o=a=>+a,s=a=>a instanceof Date?+a:Th(Vt(a));break}return o?pq(r,i,t,o,s):null}function pq(e,t,n,r,i){let o=r(Math.min(e[0],e[1])),s=r(Math.max(e[0],e[1])),a=Math.abs(r(t[1])-r(t[0]))/(s-o)/n,c=n===1?"":`${n}::INTEGER * `;return l=>j`${c}FLOOR(${a}::DOUBLE * (${i(l)} - ${o}::DOUBLE))::INTEGER`}var iD={from:NaN};function oD(e){if(!e.filterIndexable)return iD;let t=e.query(),n=I2(t);if(!n||!t.groupby)return iD;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:j`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:j`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:j`MAX("${a}")`});break;case"MIN":i.push({[a]:j`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:j`COUNT(*)`}:{},from:n}}function I2(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=I2(t[0]);for(let r=1;r<t.length;++r){let i=I2(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function mq(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 m0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new p0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():yq(t,r,i)}};function yq(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function y0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function gq(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function aD(e,t,n){let r=[],i=0;function o(){let s=bq(r,t);r=[],i=0;for(let a of s)_q(a,e,n),Sq(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||gq(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function bq(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=xq(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function xq(e,t){let n=`${e}`;if(e instanceof yt&&!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 mr&&o[s.column]||s))}return`${r}`}else return n}function _q(e,t,n){if(wq(e))t({request:{type:"arrow",cache:!1,record:!1,query:vq(e,n)},result:e.result=y0()});else for(let{entry:r,priority:i}of e)t(r,i)}function wq(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 vq(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 mr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function Sq(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=Iq(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function Iq(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var Tq=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,cD=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function lD({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&&Tq(r),o},clear(){n=new Map}}}function uD(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var ao={High:0,Normal:1,Low:2};function fD(){let e=uD(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=ao.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:y=!1,record:b=!0,options:m}=f,g=h?`${h}`:null;if(b&&l(g),y){let v=n.get(g);if(v){r.debug("Cache"),d.fulfill(v);return}}let x=performance.now(),_=await t.query({type:p,sql:g,...m});y&&n.set(g,_),r.debug(`Request: ${(performance.now()-x).toFixed(1)}`),d.fulfill(_)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?lD():f||cD():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=aD(c,n,l):!f&&s&&(s=null)},request(f,d=ao.Normal){let h=y0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function dD(){return{debug(){},info(){},log(){},warn(){},error(){}}}var g0;function ti(e){return e?g0=e:g0==null&&(g0=new Ah),g0}var Ah=class{constructor(t=c0(),n={}){let{logger:r=console,manager:i=fD()}=n;this.catalog=new h0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||dD(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=ao.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
+ `):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=ao.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:ao.Low})}createBundle(t,n,r=ao.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=ao.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=ao.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new m0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var b0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new T2}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},T2=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 Nh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?Eq(e,t):!0}function Eq(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 yr(e){return e instanceof Ta}var Ta=class e extends b0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>yr(n))){let n=new e,r=()=>n.update(t.map(i=>yr(i)?i.value:i));return r(),t.forEach(i=>yr(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Nh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ei(e){return e instanceof xs}var xs=class e extends Ta{static intersect({cross:t=!1}={}){return new e(new zc({cross:t}))}static union({cross:t=!1}={}){return new e(new zc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new zc({cross:t,single:!0}))}static crossfilter(){return new e(new zc({cross:!0}))}constructor(t=new zc){super([]),this._resolved=this._value,this._resolver=t}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},zc=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?Cc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function hD(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"?Fc(n):(await n).json()}}}var Mq=Object.create,pD=Object.defineProperty,Aq=Object.getOwnPropertyDescriptor,Nq=Object.getOwnPropertyNames,Rq=Object.getPrototypeOf,Oq=Object.prototype.hasOwnProperty,Dq=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kq=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Nq(t))!Oq.call(e,i)&&i!==n&&pD(e,i,{get:()=>t[i],enumerable:!(r=Aq(t,i))||r.enumerable});return e},Fq=(e,t,n)=>(n=e!=null?Mq(Rq(e)):{},kq(t||!e||!e.__esModule?pD(n,"default",{value:e,enumerable:!0}):n,e)),Lq=Dq((e,t)=>{t.exports=Worker}),Cq=(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))(Cq||{}),Bq=(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))(Bq||{}),Pq=(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))(Pq||{}),Uq=(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))(Uq||{}),$q=(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))($q||{}),zq=(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))(zq||{}),mD=class{log(e){}},yD=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var qq=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(qq||{}),jq=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=nn.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new on(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 gD(this._bindings,this._conn,t),r=await nn.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 Vq(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=a0(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)}},gD=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}},Vq=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=nn.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new on(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new gD(this.bindings,this.connectionId,t),r=await nn.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},Yq=(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))(Yq||{}),Gq=(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))(Gq||{}),Kt=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 x0(e){switch(e.typeId){case D.Binary:return{sqlType:"binary"};case D.Bool:return{sqlType:"bool"};case D.Date:return{sqlType:"date"};case D.DateDay:return{sqlType:"date32[d]"};case D.DateMillisecond:return{sqlType:"date64[ms]"};case D.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case D.Float:return{sqlType:"float"};case D.Float16:return{sqlType:"float16"};case D.Float32:return{sqlType:"float32"};case D.Float64:return{sqlType:"float64"};case D.Int:return{sqlType:"int32"};case D.Int16:return{sqlType:"int16"};case D.Int32:return{sqlType:"int32"};case D.Int64:return{sqlType:"int64"};case D.Uint16:return{sqlType:"uint16"};case D.Uint32:return{sqlType:"uint32"};case D.Uint64:return{sqlType:"uint64"};case D.Uint8:return{sqlType:"uint8"};case D.IntervalDayTime:return{sqlType:"interval[dt]"};case D.IntervalYearMonth:return{sqlType:"interval[m]"};case D.List:return{sqlType:"list",valueType:x0(e.valueType)};case D.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case D.Null:return{sqlType:"null"};case D.Utf8:return{sqlType:"utf8"};case D.Struct:return{sqlType:"struct",fields:e.children.map(t=>O2(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:x0(t.keyType),valueType:x0(t.valueType)}}case D.Time:return{sqlType:"time[s]"};case D.TimeMicrosecond:return{sqlType:"time[us]"};case D.TimeMillisecond:return{sqlType:"time[ms]"};case D.TimeNanosecond:return{sqlType:"time[ns]"};case D.TimeSecond:return{sqlType:"time[s]"};case D.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case D.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case D.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case D.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case D.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function O2(e,t){let n=x0(t);return n.name=e,n}var Wq=new TextEncoder,bD=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 Kt("RESET",null);return await this.postTask(e)}async ping(){let e=new Kt("PING",null);await this.postTask(e)}async dropFile(e){let t=new Kt("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Kt("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Kt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Kt("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Kt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Kt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Kt("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Kt("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Kt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new jq(this,e)}async disconnect(e){let t=new Kt("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Kt("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t){let n=new Kt("START_PENDING_QUERY",[e,t]);return await this.postTask(n)}async pollPendingQuery(e){let t=new Kt("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Kt("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Kt("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Kt("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Kt("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Kt("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Kt("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Kt("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Kt("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=Wq.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Kt("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new Kt("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let n=new Kt("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Kt("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async collectFileStatistics(e,t){let n=new Kt("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Kt("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Kt("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Kt("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Kt("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(O2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("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(O2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var Xq=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])),Hq=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])),Zq=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])),Qq=()=>(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])),D2={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"}}},Kq=D2.name,Jq=D2.version,k2=D2.version.split("."),xdt=k2[0],_dt=k2[1],wdt=k2[2],tj=()=>typeof navigator>"u";function xD(){let e="https://cdn.jsdelivr.net/npm/".concat(Kq,"@").concat(Jq,"/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 E2=null,M2=null,A2=null,N2=null,R2=null;async function ej(){return E2==null&&(E2=typeof BigInt64Array<"u"),M2==null&&(M2=await Hq()),A2==null&&(A2=await Qq()),N2==null&&(N2=await Zq()),R2==null&&(R2=await Xq()),{bigInt64Array:E2,crossOriginIsolated:tj()||globalThis.crossOriginIsolated||!1,wasmExceptions:M2,wasmSIMD:N2,wasmThreads:A2,wasmBulkMemory:R2}}async function _D(e){let t=await ej();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 vdt=Fq(Lq());function nj(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var Sdt=nj(),rj=(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))(rj||{});function wD(e={}){let{duckdb:t,connection:n,...r}=e,i=t,o=n,s;function a(){return s||(s=(i?Promise.resolve(i):oj(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,p=await(await l()).query(d);return f==="exec"?void 0:f==="arrow"?p:Array.from(p)}}}async function oj({log:e=!1}={}){let t=xD(),n=await _D(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new yD:new mD,s=new bD(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function F2(){let e=new Set,t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}var G4={};_r(G4,{Fixed:()=>qc,Param:()=>Ta,Query:()=>yt,Selection:()=>xs,agg:()=>$v,align:()=>aA,and:()=>Wn,area:()=>wN,areaX:()=>vN,areaY:()=>SN,argmax:()=>mu,argmin:()=>pu,arrayAgg:()=>u2,arrow:()=>h4,aspectRatio:()=>cA,avg:()=>zv,axis:()=>lA,axisFx:()=>b4,axisFy:()=>x4,axisX:()=>y4,axisY:()=>g4,barX:()=>MN,barY:()=>AN,bin:()=>pw,cast:()=>Ih,castDouble:()=>yu,castInteger:()=>f2,cell:()=>NN,cellX:()=>RN,cellY:()=>ON,centroid:()=>Mh,centroidX:()=>m2,centroidY:()=>y2,circle:()=>PN,colorClamp:()=>O6,colorDomain:()=>N6,colorInterpolate:()=>L6,colorLabel:()=>P6,colorLegend:()=>j4,colorN:()=>D6,colorNice:()=>k6,colorPivot:()=>C6,colorRange:()=>R6,colorReverse:()=>U6,colorScale:()=>A6,colorScheme:()=>F6,colorSymmetric:()=>B6,colorTickFormat:()=>z6,colorZero:()=>$6,column:()=>wa,contour:()=>n4,coordinator:()=>ti,corr:()=>t2,count:()=>Or,covarPop:()=>e2,create:()=>Ia,cume_dist:()=>Dv,dateDay:()=>p2,dateMonth:()=>d2,dateMonthDay:()=>h2,delaunayLink:()=>u4,delaunayMesh:()=>f4,denseLine:()=>e4,dense_rank:()=>Rv,density:()=>t4,densityX:()=>KN,densityY:()=>JN,dot:()=>LN,dotX:()=>CN,dotY:()=>BN,entropy:()=>Qv,eq:()=>ys,facetGrid:()=>E3,facetLabel:()=>M3,facetMargin:()=>w3,facetMarginBottom:()=>S3,facetMarginLeft:()=>I3,facetMarginRight:()=>T3,facetMarginTop:()=>v3,first_value:()=>Cv,frame:()=>m4,from:()=>U9,fxAlign:()=>L3,fxAriaDescription:()=>J3,fxAriaLabel:()=>K3,fxAxis:()=>U3,fxDomain:()=>A3,fxFontVariant:()=>Q3,fxGrid:()=>G3,fxInset:()=>O3,fxInsetLeft:()=>D3,fxInsetRight:()=>k3,fxLabel:()=>X3,fxLabelAnchor:()=>H3,fxLabelOffset:()=>Z3,fxLine:()=>W3,fxNice:()=>R3,fxPadding:()=>C3,fxPaddingInner:()=>B3,fxPaddingOuter:()=>P3,fxRange:()=>N3,fxReverse:()=>t6,fxRound:()=>F3,fxTickFormat:()=>V3,fxTickPadding:()=>j3,fxTickRotate:()=>Y3,fxTickSize:()=>z3,fxTickSpacing:()=>q3,fxTicks:()=>$3,fyAlign:()=>c6,fyAriaDescription:()=>E6,fyAriaLabel:()=>T6,fyAxis:()=>d6,fyDomain:()=>e6,fyFontVariant:()=>I6,fyGrid:()=>x6,fyInset:()=>i6,fyInsetBottom:()=>s6,fyInsetTop:()=>o6,fyLabel:()=>w6,fyLabelAnchor:()=>v6,fyLabelOffset:()=>S6,fyLine:()=>_6,fyNice:()=>r6,fyPadding:()=>l6,fyPaddingInner:()=>u6,fyPaddingOuter:()=>f6,fyRange:()=>n6,fyReverse:()=>M6,fyRound:()=>a6,fyTickFormat:()=>g6,fyTickPadding:()=>y6,fyTickRotate:()=>b6,fyTickSize:()=>p6,fyTickSpacing:()=>m6,fyTicks:()=>h6,geo:()=>I4,geojson:()=>Eh,graticule:()=>E4,grid:()=>fA,gridFx:()=>v4,gridFy:()=>S4,gridX:()=>_4,gridY:()=>w4,gt:()=>Pc,gte:()=>wv,hconcat:()=>D9,height:()=>nA,hexagon:()=>UN,hexbin:()=>o4,hexgrid:()=>s4,highlight:()=>M4,hspace:()=>L9,hull:()=>d4,image:()=>QN,inset:()=>uA,intervalX:()=>k4,intervalXY:()=>L4,intervalY:()=>F4,isBetween:()=>Te,isDistinct:()=>vv,isNotBetween:()=>Sv,isNotDistinct:()=>vh,isNotNull:()=>ms,isNull:()=>Bc,kurtosis:()=>Zv,label:()=>dA,lag:()=>Fv,last:()=>c2,last_value:()=>Bv,lead:()=>Lv,lengthClamp:()=>sN,lengthDomain:()=>iN,lengthNice:()=>aN,lengthRange:()=>oN,lengthScale:()=>rN,lengthZero:()=>cN,line:()=>IN,lineX:()=>TN,lineY:()=>EN,link:()=>p4,literal:()=>Rr,loadCSV:()=>x2,loadExtension:()=>g2,loadJSON:()=>_2,loadObjects:()=>S2,loadParquet:()=>w2,loadSpatial:()=>v2,lt:()=>gs,lte:()=>bs,mad:()=>qv,margin:()=>KM,marginBottom:()=>sA,marginLeft:()=>rA,marginRight:()=>iA,marginTop:()=>oA,margins:()=>QM,max:()=>Kr,median:()=>Vv,menu:()=>E9,min:()=>Jr,mode:()=>Gv,name:()=>HM,nearestX:()=>O4,nearestY:()=>D4,neq:()=>wh,not:()=>_v,nth_value:()=>Pv,ntile:()=>kv,opacityClamp:()=>Y6,opacityDomain:()=>j6,opacityLabel:()=>W6,opacityLegend:()=>V4,opacityNice:()=>G6,opacityRange:()=>V6,opacityReverse:()=>X6,opacityScale:()=>q6,opacityTickFormat:()=>Z6,opacityZero:()=>H6,or:()=>Cc,padding:()=>hA,pan:()=>C4,panX:()=>B4,panY:()=>P4,panZoom:()=>U4,panZoomX:()=>$4,panZoomY:()=>z4,percent_rank:()=>Ov,plot:()=>j9,product:()=>jv,projectionClip:()=>xN,projectionDomain:()=>hN,projectionInset:()=>pN,projectionInsetBottom:()=>bN,projectionInsetLeft:()=>mN,projectionInsetRight:()=>yN,projectionInsetTop:()=>gN,projectionParallels:()=>uN,projectionPrecision:()=>fN,projectionRotate:()=>dN,projectionType:()=>lN,quantile:()=>Yv,rClamp:()=>tN,rDomain:()=>K6,rNice:()=>eN,rRange:()=>J6,rScale:()=>Q6,rZero:()=>nN,rank:()=>Nv,raster:()=>r4,rasterTile:()=>i4,rect:()=>DN,rectX:()=>kN,rectY:()=>FN,regressionY:()=>a4,round:()=>pA,row_number:()=>Av,ruleX:()=>jN,ruleY:()=>VN,search:()=>M9,skewness:()=>Hv,slider:()=>A9,sphere:()=>T4,spike:()=>ZN,sql:()=>j,stddev:()=>Xv,stddevPop:()=>Jv,stringAgg:()=>l2,style:()=>tA,sum:()=>Dr,symbolLegend:()=>Y4,table:()=>N9,text:()=>$N,textX:()=>zN,textY:()=>qN,tickX:()=>YN,tickY:()=>GN,toggle:()=>yd,toggleColor:()=>R4,toggleX:()=>A4,toggleY:()=>N4,varPop:()=>Kv,variance:()=>Wv,vconcat:()=>O9,vector:()=>WN,vectorX:()=>XN,vectorY:()=>HN,voronoi:()=>c4,voronoiMesh:()=>l4,vspace:()=>F9,width:()=>eA,xAlign:()=>IA,xAriaDescription:()=>qA,xAriaLabel:()=>zA,xAxis:()=>AA,xClamp:()=>vA,xDomain:()=>yA,xFontVariant:()=>$A,xGrid:()=>LA,xInset:()=>xA,xInsetLeft:()=>_A,xInsetRight:()=>wA,xLabel:()=>BA,xLabelAnchor:()=>PA,xLabelOffset:()=>UA,xLine:()=>CA,xNice:()=>bA,xPadding:()=>TA,xPaddingInner:()=>EA,xPaddingOuter:()=>MA,xRange:()=>gA,xReverse:()=>jA,xRound:()=>SA,xScale:()=>mA,xTickFormat:()=>kA,xTickPadding:()=>DA,xTickRotate:()=>FA,xTickSize:()=>RA,xTickSpacing:()=>OA,xTicks:()=>NA,xZero:()=>VA,xyDomain:()=>JM,yAlign:()=>t3,yAriaDescription:()=>b3,yAriaLabel:()=>g3,yAxis:()=>i3,yClamp:()=>KA,yDomain:()=>GA,yFontVariant:()=>y3,yGrid:()=>f3,yInset:()=>HA,yInsetBottom:()=>QA,yInsetTop:()=>ZA,yLabel:()=>h3,yLabelAnchor:()=>p3,yLabelOffset:()=>m3,yLine:()=>d3,yNice:()=>XA,yPadding:()=>e3,yPaddingInner:()=>n3,yPaddingOuter:()=>r3,yRange:()=>WA,yReverse:()=>x3,yRound:()=>JA,yScale:()=>YA,yTickFormat:()=>l3,yTickPadding:()=>c3,yTickRotate:()=>u3,yTickSize:()=>s3,yTickSpacing:()=>a3,yTicks:()=>o3,yZero:()=>_3});var qc=Symbol("Fixed"),ni=Symbol("Transient"),Rh=Symbol("Transform");var rw={};_r(rw,{Area:()=>kl,Arrow:()=>qm,BarX:()=>jm,BarY:()=>Vm,Cell:()=>Fl,Contour:()=>Jm,Density:()=>ny,Dot:()=>Ll,Frame:()=>Fm,Geo:()=>ry,Hexgrid:()=>iy,Image:()=>oy,Line:()=>Cl,Link:()=>$m,Mark:()=>wt,Raster:()=>Km,Rect:()=>Pl,RuleX:()=>Nm,RuleY:()=>Rm,Text:()=>Rl,TickX:()=>Xm,TickY:()=>Hm,Tip:()=>Lm,Vector:()=>Dl,area:()=>Um,areaX:()=>sc,areaY:()=>ea,arrow:()=>y7,auto:()=>M7,autoSpec:()=>tM,axisFx:()=>v_,axisFy:()=>w_,axisX:()=>Dm,axisY:()=>Om,barX:()=>$o,barY:()=>zo,bin:()=>ta,binX:()=>Po,binY:()=>Uo,bollinger:()=>uc,bollingerX:()=>k7,bollingerY:()=>F7,boxX:()=>L7,boxY:()=>C7,cell:()=>ac,cellX:()=>b7,cellY:()=>x7,centroid:()=>DP,circle:()=>v7,cluster:()=>OP,column:()=>pn,contour:()=>Y7,crosshair:()=>X7,crosshairX:()=>H7,crosshairY:()=>Z7,delaunayLink:()=>J7,delaunayMesh:()=>tP,density:()=>oP,differenceY:()=>cP,dodgeX:()=>GP,dodgeY:()=>WP,dot:()=>yi,dotX:()=>_7,dotY:()=>w7,filter:()=>N5,find:()=>P5,formatIsoDate:()=>lE,formatMonth:()=>j5,formatWeekday:()=>V5,frame:()=>Pf,geo:()=>G_,geoCentroid:()=>kP,graticule:()=>uP,gridFx:()=>E_,gridFy:()=>I_,gridX:()=>T_,gridY:()=>S_,group:()=>wm,groupX:()=>Ka,groupY:()=>Ja,groupZ:()=>_m,hexagon:()=>S7,hexbin:()=>fP,hexgrid:()=>dP,hull:()=>eP,identity:()=>W,image:()=>pP,indexOf:()=>Me,initializer:()=>Se,interpolateNearest:()=>aM,interpolateNone:()=>Y_,interpolatorBarycentric:()=>sM,interpolatorRandomWalk:()=>cM,legend:()=>PB,line:()=>Bl,lineX:()=>cc,lineY:()=>lc,linearRegressionX:()=>gP,linearRegressionY:()=>bP,link:()=>C_,map:()=>br,mapX:()=>Qf,mapY:()=>Kf,marks:()=>Je,normalize:()=>ew,normalizeX:()=>QP,normalizeY:()=>KP,plot:()=>Bm,pointer:()=>kf,pointerX:()=>Ff,pointerY:()=>El,raster:()=>z7,rect:()=>Gm,rectX:()=>Xf,rectY:()=>Hf,reverse:()=>R5,ruleX:()=>qr,ruleY:()=>jr,scale:()=>Co,select:()=>t9,selectFirst:()=>NM,selectLast:()=>RM,selectMaxX:()=>r9,selectMaxY:()=>i9,selectMinX:()=>e9,selectMinY:()=>n9,shiftX:()=>JP,shuffle:()=>O5,sort:()=>U1,sphere:()=>lP,spike:()=>bB,stackX:()=>QE,stackX1:()=>a7,stackX2:()=>c7,stackY:()=>KE,stackY1:()=>l7,stackY2:()=>u7,text:()=>Bo,textX:()=>p_,textY:()=>m_,tickX:()=>q_,tickY:()=>j_,tip:()=>N_,transform:()=>mn,tree:()=>SM,treeLink:()=>Q_,treeNode:()=>sy,valueof:()=>mt,vector:()=>$E,vectorX:()=>b_,vectorY:()=>x_,voronoi:()=>nP,voronoiMesh:()=>rP,window:()=>Jf,windowX:()=>A7,windowY:()=>N7});function Gt(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 _s(e){let t,n,r;e.length!==2?(t=Gt,n=(a,c)=>Gt(e(a),c),r=(a,c)=>e(a)-c):(t=e===Gt||e===Xn?e:sj,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 sj(){return 0}function Oh(e){return e===null?NaN:+e}function*vD(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 SD=_s(Gt),ID=SD.right,aj=SD.left,cj=_s(Oh).center,ws=ID;var Dh=TD(ED),L2=TD(lj);function TD(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?(gu(a,l,i,o,s),gu(a,i,l,o,s),gu(a,l,i,o,s),bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)):a?(gu(a,i,l,o,s),gu(a,l,i,o,s),gu(a,i,l,o,s)):c&&(bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)),t}}function gu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function bu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function lj(e){let t=ED(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 ED(e){let t=Math.floor(e);if(t===e)return uj(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 uj(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 co(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 fj(e){return e.length|0}function dj(e){return!(e>0)}function hj(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function pj(e){return t=>e(...t)}function _0(...e){let t=typeof e[e.length-1]=="function"&&pj(e.pop());e=e.map(hj);let n=e.map(fj),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(dj))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function w0(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function Ea(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function ri(e,t){let n=Ea(e,t);return n&&Math.sqrt(n)}function ae(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var In=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,r=0;for(let i=0;i<this._n&&i<32;i++){let o=n[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){let t=this._partials,n=this._n,r,i,o,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}};var Hn=class extends Map{constructor(t,n=ND){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(C2(this,t))}has(t){return super.has(C2(this,t))}set(t,n){return super.set(MD(this,t),n)}delete(t){return super.delete(AD(this,t))}},kr=class extends Set{constructor(t,n=ND){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(C2(this,t))}add(t){return super.add(MD(this,t))}delete(t){return super.delete(AD(this,t))}};function C2({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function MD({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function AD({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function ND(e){return e!==null&&typeof e=="object"?e.valueOf():e}function kh(e){return e}function sn(e,...t){return P2(e,kh,kh,t)}function Ci(e,t,...n){return P2(e,kh,t,n)}function B2(e,t,...n){return P2(e,Array.from,t,n)}function P2(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Hn,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 U2(e,t){return Array.from(t,n=>e[n])}function lo(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=jc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>jc(n[i],n[o]))),U2(e,r)}return e.sort(Fh(n))}function Fh(e=Gt){if(e===Gt)return jc;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 jc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function xu(e,t,n){return(t.length!==2?lo(Ci(e,t,n),([r,i],[o,s])=>Gt(i,s)||Gt(r,o)):lo(sn(e,n),([r,i],[o,s])=>t(i,s)||Gt(r,o))).map(([r])=>r)}var mj=Math.sqrt(50),yj=Math.sqrt(10),gj=Math.sqrt(2);function v0(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>=mj?10:o>=yj?5:o>=gj?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?v0(e,t,n*2):[a,c,l]}function Tn(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?v0(t,e,n):v0(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 vs(e,t,n){return t=+t,e=+e,n=+n,v0(e,t,n)[2]}function _u(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?vs(t,e,n):vs(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function wu(e,t,n){let r;for(;;){let i=vs(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 Ma(e){return Math.max(1,Math.ceil(Math.log(co(e))/Math.LN2)+1)}function $t(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 S0(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 ce(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 I0(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 T0(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?jc:Fh(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));T0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Lh(e,n,t),i(e[r],o)>0&&Lh(e,n,r);s<a;){for(Lh(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Lh(e,n,a):(++a,Lh(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Lh(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Vc(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)>0:Gt(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 Zn(e,t,n){if(e=Float64Array.from(vD(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ce(e);if(t>=1)return $t(e);var r,i=(r-1)*t,o=Math.floor(i),s=$t(T0(e,o).subarray(0,o+1)),a=ce(e.subarray(o+1));return s+(a-s)*(i-o)}}function $2(e,t,n=Oh){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 E0(e,t,n){let r=co(e),i=Zn(e,.75)-Zn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Ch(e,t,n){let r=co(e),i=ri(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Ss(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 Bi(e,t){return Zn(e,.5,t)}function*xj(e){for(let t of e)yield*t}function vu(e){return Array.from(xj(e))}function Su(e,t){let n=new Hn;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 M0(e,t=_j){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function _j(e,t){return[e,t]}function Ue(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function Bh(e,t=Gt){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=Gt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Gt?(a,c)=>jc(n[a],n[c]):Fh(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 A0(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)<0:Gt(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 En(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 Aa(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function RD(e){return e}var z2=1,q2=2,j2=3,N0=4,OD=1e-6;function wj(e){return"translate("+e+",0)"}function vj(e){return"translate(0,"+e+")"}function Sj(e){return t=>+e(t)}function Ij(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function Tj(){return!this.__axis}function Ej(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===z2||e===N0?-1:1,u=e===N0||e===q2?"x":"y",f=e===z2||e===j2?wj:vj;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,n):RD),b=Math.max(o,0)+a,m=t.range(),g=+m[0]+c,x=+m[m.length-1]+c,_=(t.bandwidth?Ij:Sj)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),A=T.exit(),R=T.enter().append("g").attr("class","tick"),I=T.select("line"),E=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(R),I=I.merge(R.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),E=E.merge(R.append("text").attr("fill","currentColor").attr(u,l*b).attr("dy",e===z2?"0em":e===j2?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),I=I.transition(h),E=E.transition(h),A=A.transition(h).attr("opacity",OD).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),R.attr("opacity",OD).attr("transform",function(O){var k=this.parentNode.__axis;return f((k&&isFinite(k=k(O))?k:_(O))+c)})),A.remove(),w.attr("d",e===N0||e===q2?s?"M"+l*s+","+g+"H"+c+"V"+x+"H"+l*s:"M"+c+","+g+"V"+x:s?"M"+g+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+g+","+c+"H"+x),T.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),I.attr(u+"2",l*o),E.attr(u,l*b).text(y),v.filter(Tj).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===q2?"start":e===N0?"end":"middle"),v.each(function(){this.__axis=_})}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 V2(e){return Ej(j2,e)}var Mj={value:()=>{}};function kD(){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 R0(n)}function R0(e){this._=e}function Aj(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}})}R0.prototype=kD.prototype={constructor:R0,on:function(e,t){var n=this._,r=Aj(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=Nj(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]=DD(n[i],e.name,t);else if(t==null)for(i in n)n[i]=DD(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 R0(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 Nj(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function DD(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Mj,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Yc=kD;var O0="http://www.w3.org/1999/xhtml",ii={svg:"http://www.w3.org/2000/svg",xhtml:O0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Is(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ii.hasOwnProperty(t)?{space:ii[t],local:e}:e}function Rj(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===O0&&t.documentElement.namespaceURI===O0?t.createElement(e):t.createElementNS(n,e)}}function Oj(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ts(e){var t=Is(e);return(t.local?Oj:Rj)(t)}function Dj(){}function Gc(e){return e==null?Dj:function(){return this.querySelector(e)}}function FD(e){typeof e!="function"&&(e=Gc(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 Le(r,this._parents)}function Y2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function kj(){return[]}function Ph(e){return e==null?kj:function(){return this.querySelectorAll(e)}}function Fj(e){return function(){return Y2(e.apply(this,arguments))}}function LD(e){typeof e=="function"?e=Fj(e):e=Ph(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 Le(r,i)}function Uh(e){return function(){return this.matches(e)}}function D0(e){return function(t){return t.matches(e)}}var Lj=Array.prototype.find;function Cj(e){return function(){return Lj.call(this.children,e)}}function Bj(){return this.firstElementChild}function CD(e){return this.select(e==null?Bj:Cj(typeof e=="function"?e:D0(e)))}var Pj=Array.prototype.filter;function Uj(){return Array.from(this.children)}function $j(e){return function(){return Pj.call(this.children,e)}}function BD(e){return this.selectAll(e==null?Uj:$j(typeof e=="function"?e:D0(e)))}function PD(e){typeof e!="function"&&(e=Uh(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 Le(r,this._parents)}function k0(e){return new Array(e.length)}function UD(){return new Le(this._enter||this._groups.map(k0),this._parents)}function $h(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$h.prototype={constructor:$h,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 $D(e){return function(){return e}}function zj(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 $h(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function qj(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 $h(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function jj(e){return e.__data__}function zD(e,t){if(!arguments.length)return Array.from(this,jj);var n=t?qj:zj,r=this._parents,i=this._groups;typeof e!="function"&&(e=$D(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=Vj(e.call(u,u&&u.__data__,l,r)),p=h.length,y=a[l]=new Array(p),b=s[l]=new Array(p),m=c[l]=new Array(d);n(u,f,y,b,m,h,t);for(var g=0,x=0,_,v;g<p;++g)if(_=y[g]){for(g>=x&&(x=g+1);!(v=b[x])&&++x<p;);_._next=v||null}}return s=new Le(s,r),s._enter=a,s._exit=c,s}function Vj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qD(){return new Le(this._exit||this._groups.map(k0),this._parents)}function jD(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 VD(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 Le(a,this._parents)}function YD(){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 GD(e){e||(e=Yj);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 Le(i,this._parents).order()}function Yj(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function WD(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XD(){return Array.from(this)}function HD(){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 ZD(){let e=0;for(let t of this)++e;return e}function QD(){return!this.node()}function KD(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 Gj(e){return function(){this.removeAttribute(e)}}function Wj(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xj(e,t){return function(){this.setAttribute(e,t)}}function Hj(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Zj(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Qj(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 JD(e,t){var n=Is(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?Wj:Gj:typeof t=="function"?n.local?Qj:Zj:n.local?Hj:Xj)(n,t))}function F0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Kj(e){return function(){this.style.removeProperty(e)}}function Jj(e,t,n){return function(){this.style.setProperty(e,t,n)}}function tV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function t8(e,t,n){return arguments.length>1?this.each((t==null?Kj:typeof t=="function"?tV:Jj)(e,t,n??"")):Na(this.node(),e)}function Na(e,t){return e.style.getPropertyValue(t)||F0(e).getComputedStyle(e,null).getPropertyValue(t)}function eV(e){return function(){delete this[e]}}function nV(e,t){return function(){this[e]=t}}function rV(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function e8(e,t){return arguments.length>1?this.each((t==null?eV:typeof t=="function"?rV:nV)(e,t)):this.node()[e]}function n8(e){return e.trim().split(/^|\s+/)}function G2(e){return e.classList||new r8(e)}function r8(e){this._node=e,this._names=n8(e.getAttribute("class")||"")}r8.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 i8(e,t){for(var n=G2(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function o8(e,t){for(var n=G2(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function iV(e){return function(){i8(this,e)}}function oV(e){return function(){o8(this,e)}}function sV(e,t){return function(){(t.apply(this,arguments)?i8:o8)(this,e)}}function s8(e,t){var n=n8(e+"");if(arguments.length<2){for(var r=G2(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?sV:t?iV:oV)(n,t))}function aV(){this.textContent=""}function cV(e){return function(){this.textContent=e}}function lV(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function a8(e){return arguments.length?this.each(e==null?aV:(typeof e=="function"?lV:cV)(e)):this.node().textContent}function uV(){this.innerHTML=""}function fV(e){return function(){this.innerHTML=e}}function dV(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function c8(e){return arguments.length?this.each(e==null?uV:(typeof e=="function"?dV:fV)(e)):this.node().innerHTML}function hV(){this.nextSibling&&this.parentNode.appendChild(this)}function l8(){return this.each(hV)}function pV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function u8(){return this.each(pV)}function f8(e){var t=typeof e=="function"?e:Ts(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function mV(){return null}function d8(e,t){var n=typeof e=="function"?e:Ts(e),r=t==null?mV:typeof t=="function"?t:Gc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function yV(){var e=this.parentNode;e&&e.removeChild(this)}function h8(){return this.each(yV)}function gV(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bV(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function p8(e){return this.select(e?bV:gV)}function m8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xV(e){return function(t){e.call(this,t,this.__data__)}}function _V(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 wV(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 vV(e,t,n){return function(){var r=this.__on,i,o=xV(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 y8(e,t,n){var r=_V(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?vV:wV,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function g8(e,t,n){var r=F0(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 SV(e,t){return function(){return g8(this,e,t)}}function IV(e,t){return function(){return g8(this,e,t.apply(this,arguments))}}function b8(e,t){return this.each((typeof t=="function"?IV:SV)(e,t))}function*x8(){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 W2=[null];function Le(e,t){this._groups=e,this._parents=t}function _8(){return new Le([[document.documentElement]],W2)}function TV(){return this}Le.prototype=_8.prototype={constructor:Le,select:FD,selectAll:LD,selectChild:CD,selectChildren:BD,filter:PD,data:zD,enter:UD,exit:qD,join:jD,merge:VD,selection:TV,order:YD,sort:GD,call:WD,nodes:XD,node:HD,size:ZD,empty:QD,each:KD,attr:JD,style:t8,property:e8,classed:s8,text:a8,html:c8,raise:l8,lower:u8,append:f8,insert:d8,remove:h8,clone:p8,datum:m8,on:y8,dispatch:b8,[Symbol.iterator]:x8};var Es=_8;function zt(e){return typeof e=="string"?new Le([[document.querySelector(e)]],[document.documentElement]):new Le([[e]],W2)}function w8(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fn(e,t){if(e=w8(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 L0={capture:!0,passive:!1};function C0(e){e.preventDefault(),e.stopImmediatePropagation()}function zh(e){var t=e.document.documentElement,n=zt(e).on("dragstart.drag",C0,L0);"onselectstart"in t?n.on("selectstart.drag",C0,L0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function qh(e,t){var n=e.document.documentElement,r=zt(e).on("dragstart.drag",null);t&&(r.on("click.drag",C0,L0),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 Ms(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ra(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function fo(){}var Oa=.7,Hc=1/Oa,Iu="\\s*([+-]?\\d+)\\s*",jh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",uo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",EV=/^#([0-9a-f]{3,8})$/,MV=new RegExp(`^rgb\\(${Iu},${Iu},${Iu}\\)$`),AV=new RegExp(`^rgb\\(${uo},${uo},${uo}\\)$`),NV=new RegExp(`^rgba\\(${Iu},${Iu},${Iu},${jh}\\)$`),RV=new RegExp(`^rgba\\(${uo},${uo},${uo},${jh}\\)$`),OV=new RegExp(`^hsl\\(${jh},${uo},${uo}\\)$`),DV=new RegExp(`^hsla\\(${jh},${uo},${uo},${jh}\\)$`),v8={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};Ms(fo,Fr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:S8,formatHex:S8,formatHex8:kV,formatHsl:FV,formatRgb:I8,toString:I8});function S8(){return this.rgb().formatHex()}function kV(){return this.rgb().formatHex8()}function FV(){return R8(this).formatHsl()}function I8(){return this.rgb().formatRgb()}function Fr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=EV.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?T8(t):n===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?B0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?B0(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=MV.exec(e))?new Ye(t[1],t[2],t[3],1):(t=AV.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=NV.exec(e))?B0(t[1],t[2],t[3],t[4]):(t=RV.exec(e))?B0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=OV.exec(e))?A8(t[1],t[2]/100,t[3]/100,1):(t=DV.exec(e))?A8(t[1],t[2]/100,t[3]/100,t[4]):v8.hasOwnProperty(e)?T8(v8[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function T8(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function B0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ye(e,t,n,r)}function Vh(e){return e instanceof fo||(e=Fr(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function an(e,t,n,r){return arguments.length===1?Vh(e):new Ye(e,t,n,r??1)}function Ye(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ms(Ye,an,Ra(fo,{brighter(e){return e=e==null?Hc:Math.pow(Hc,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Oa:Math.pow(Oa,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Xc(this.r),Xc(this.g),Xc(this.b),U0(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:E8,formatHex:E8,formatHex8:LV,formatRgb:M8,toString:M8}));function E8(){return`#${Wc(this.r)}${Wc(this.g)}${Wc(this.b)}`}function LV(){return`#${Wc(this.r)}${Wc(this.g)}${Wc(this.b)}${Wc((isNaN(this.opacity)?1:this.opacity)*255)}`}function M8(){let e=U0(this.opacity);return`${e===1?"rgb(":"rgba("}${Xc(this.r)}, ${Xc(this.g)}, ${Xc(this.b)}${e===1?")":`, ${e})`}`}function U0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Wc(e){return e=Xc(e),(e<16?"0":"")+e.toString(16)}function A8(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pi(e,t,n,r)}function R8(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof fo||(e=Fr(e)),!e)return new Pi;if(e instanceof Pi)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 Pi(s,a,c,e.opacity)}function Yh(e,t,n,r){return arguments.length===1?R8(e):new Pi(e,t,n,r??1)}function Pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ms(Pi,Yh,Ra(fo,{brighter(e){return e=e==null?Hc:Math.pow(Hc,e),new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oa:Math.pow(Oa,e),new Pi(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 Ye(X2(e>=240?e-240:e+120,i,r),X2(e,i,r),X2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(N8(this.h),P0(this.s),P0(this.l),U0(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=U0(this.opacity);return`${e===1?"hsl(":"hsla("}${N8(this.h)}, ${P0(this.s)*100}%, ${P0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function N8(e){return e=(e||0)%360,e<0?e+360:e}function P0(e){return Math.max(0,Math.min(1,e||0))}function X2(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 $0=Math.PI/180,z0=180/Math.PI;var q0=18,O8=.96422,D8=1,k8=.82521,F8=4/29,Tu=6/29,L8=3*Tu*Tu,CV=Tu*Tu*Tu;function C8(e){if(e instanceof ho)return new ho(e.l,e.a,e.b,e.opacity);if(e instanceof As)return B8(e);e instanceof Ye||(e=Vh(e));var t=K2(e.r),n=K2(e.g),r=K2(e.b),i=H2((.2225045*t+.7168786*n+.0606169*r)/D8),o,s;return t===n&&n===r?o=s=i:(o=H2((.4360747*t+.3850649*n+.1430804*r)/O8),s=H2((.0139322*t+.0971045*n+.7141733*r)/k8)),new ho(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Eu(e,t,n,r){return arguments.length===1?C8(e):new ho(e,t,n,r??1)}function ho(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Ms(ho,Eu,Ra(fo,{brighter(e){return new ho(this.l+q0*(e??1),this.a,this.b,this.opacity)},darker(e){return new ho(this.l-q0*(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=O8*Z2(t),e=D8*Z2(e),n=k8*Z2(n),new Ye(Q2(3.1338561*t-1.6168667*e-.4906146*n),Q2(-.9787684*t+1.9161415*e+.033454*n),Q2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function H2(e){return e>CV?Math.pow(e,1/3):e/L8+F8}function Z2(e){return e>Tu?e*e*e:L8*(e-F8)}function Q2(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function K2(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function BV(e){if(e instanceof As)return new As(e.h,e.c,e.l,e.opacity);if(e instanceof ho||(e=C8(e)),e.a===0&&e.b===0)return new As(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*z0;return new As(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Gh(e,t,n,r){return arguments.length===1?BV(e):new As(e,t,n,r??1)}function As(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function B8(e){if(isNaN(e.h))return new ho(e.l,0,0,e.opacity);var t=e.h*$0;return new ho(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ms(As,Gh,Ra(fo,{brighter(e){return new As(this.h,this.c,this.l+q0*(e??1),this.opacity)},darker(e){return new As(this.h,this.c,this.l-q0*(e??1),this.opacity)},rgb(){return B8(this).rgb()}}));var z8=-.14861,J2=1.78277,tS=-.29227,j0=-.90649,Wh=1.97294,P8=Wh*j0,U8=Wh*J2,$8=J2*tS-j0*z8;function PV(e){if(e instanceof Zc)return new Zc(e.h,e.s,e.l,e.opacity);e instanceof Ye||(e=Vh(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=($8*r+P8*t-U8*n)/($8+P8-U8),o=r-i,s=(Wh*(n-i)-tS*o)/j0,a=Math.sqrt(s*s+o*o)/(Wh*i*(1-i)),c=a?Math.atan2(s,o)*z0-120:NaN;return new Zc(c<0?c+360:c,a,i,e.opacity)}function Qn(e,t,n,r){return arguments.length===1?PV(e):new Zc(e,t,n,r??1)}function Zc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ms(Zc,Qn,Ra(fo,{brighter(e){return e=e==null?Hc:Math.pow(Hc,e),new Zc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oa:Math.pow(Oa,e),new Zc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*$0,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ye(255*(t+n*(z8*r+J2*i)),255*(t+n*(tS*r+j0*i)),255*(t+n*(Wh*r)),this.opacity)}}));function eS(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 q8(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 eS((n-r/t)*t,s,i,o,a)}}function j8(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 eS((n-r/t)*t,i,o,s,a)}}var Mu=e=>()=>e;function V8(e,t){return function(n){return e+n*t}}function UV(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 Au(e,t){var n=t-e;return n?V8(e,n>180||n<-180?n-360*Math.round(n/360):n):Mu(isNaN(e)?t:e)}function Y8(e){return(e=+e)==1?Ee:function(t,n){return n-t?UV(t,n,e):Mu(isNaN(t)?n:t)}}function Ee(e,t){var n=t-e;return n?V8(e,n):Mu(isNaN(e)?t:e)}var oi=function e(t){var n=Y8(t);function r(i,o){var s=n((i=an(i)).r,(o=an(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Ee(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 G8(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=an(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 nS=G8(q8),$V=G8(j8);function W8(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 X8(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function H8(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]=Lr(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 Z8(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function we(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Q8(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]=Lr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var iS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rS=new RegExp(iS.source,"g");function zV(e){return function(){return e}}function qV(e){return function(t){return e(t)+""}}function Xh(e,t){var n=iS.lastIndex=rS.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=iS.exec(e))&&(i=rS.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:we(r,i)})),n=rS.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?qV(c[0].x):zV(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 Lr(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mu(t):(n==="number"?we:n==="string"?(r=Fr(t))?(t=r,oi):Xh:t instanceof Fr?oi:t instanceof Date?Z8:X8(t)?W8:Array.isArray(t)?H8:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Q8:we)(e,t)}function Qc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var K8=180/Math.PI,V0={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oS(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)*K8,skewX:Math.atan(c)*K8,scaleX:s,scaleY:a}}var Y0;function J8(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?V0:oS(t.a,t.b,t.c,t.d,t.e,t.f)}function tk(e){return e==null?V0:(Y0||(Y0=document.createElementNS("http://www.w3.org/2000/svg","g")),Y0.setAttribute("transform",e),(e=Y0.transform.baseVal.consolidate())?(e=e.matrix,oS(e.a,e.b,e.c,e.d,e.e,e.f)):V0)}function ek(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 y=h.push("translate(",null,t,null,n);p.push({i:y-4,x:we(l,f)},{i:y-2,x:we(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:we(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:we(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push(i(h)+"scale(",null,",",null,")");p.push({i:y-4,x:we(l,f)},{i:y-2,x:we(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,y=d.length,b;++p<y;)f[(b=d[p]).i]=b.x(h);return f.join("")}}}var sS=ek(J8,"px, ","px)","deg)"),aS=ek(tk,", ",")",")");var jV=1e-12;function nk(e){return((e=Math.exp(e))+1/e)/2}function VV(e){return((e=Math.exp(e))-1/e)/2}function YV(e){return((e=Math.exp(2*e))-1)/(e+1)}var cS=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,y=h*h+p*p,b,m;if(y<jV)m=Math.log(d/l)/t,b=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*m)]};else{var g=Math.sqrt(y),x=(d*d-l*l+r*y)/(2*l*n*g),_=(d*d-l*l-r*y)/(2*d*n*g),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);m=(w-v)/t,b=function(T){var A=T*m,R=nk(v),I=l/(n*g)*(R*YV(t*A+v)-VV(v));return[a+I*h,c+I*p,l*R/nk(t*A+v)]}}return b.duration=m*1e3*t/Math.SQRT2,b}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 rk(e){return function(t,n){var r=e((t=Yh(t)).h,(n=Yh(n)).h),i=Ee(t.s,n.s),o=Ee(t.l,n.l),s=Ee(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 lS=rk(Au),GV=rk(Ee);function G0(e,t){var n=Ee((e=Eu(e)).l,(t=Eu(t)).l),r=Ee(e.a,t.a),i=Ee(e.b,t.b),o=Ee(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 ik(e){return function(t,n){var r=e((t=Gh(t)).h,(n=Gh(n)).h),i=Ee(t.c,n.c),o=Ee(t.l,n.l),s=Ee(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 uS=ik(Au),WV=ik(Ee);function ok(e){return function t(n){n=+n;function r(i,o){var s=e((i=Qn(i)).h,(o=Qn(o)).h),a=Ee(i.s,o.s),c=Ee(i.l,o.l),l=Ee(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 XV=ok(Au),Nu=ok(Ee);function po(e,t){t===void 0&&(t=e,e=Lr);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 Ln(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Ru=0,Zh=0,Hh=0,ak=1e3,W0,Qh,X0=0,Kc=0,H0=0,Kh=typeof performance=="object"&&performance.now?performance:Date,ck=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tp(){return Kc||(ck(HV),Kc=Kh.now()+H0)}function HV(){Kc=0}function Jh(){this._call=this._time=this._next=null}Jh.prototype=Z0.prototype={constructor:Jh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?tp():+n)+(t==null?0:+t),!this._next&&Qh!==this&&(Qh?Qh._next=this:W0=this,Qh=this),this._call=e,this._time=n,fS()},stop:function(){this._call&&(this._call=null,this._time=1/0,fS())}};function Z0(e,t,n){var r=new Jh;return r.restart(e,t,n),r}function lk(){tp(),++Ru;for(var e=W0,t;e;)(t=Kc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ru}function sk(){Kc=(X0=Kh.now())+H0,Ru=Zh=0;try{lk()}finally{Ru=0,QV(),Kc=0}}function ZV(){var e=Kh.now(),t=e-X0;t>ak&&(H0-=t,X0=e)}function QV(){for(var e,t=W0,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:W0=n);Qh=e,fS(r)}function fS(e){if(!Ru){Zh&&(Zh=clearTimeout(Zh));var t=e-Kc;t>24?(e<1/0&&(Zh=setTimeout(sk,e-Kh.now()-H0)),Hh&&(Hh=clearInterval(Hh))):(Hh||(X0=Kh.now(),Hh=setInterval(ZV,ak)),Ru=1,ck(sk))}}function Q0(e,t,n){var r=new Jh;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var KV=Yc("start","end","cancel","interrupt"),JV=[],dk=0,uk=1,J0=2,K0=3,fk=4,tb=5,ep=6;function Da(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;tY(e,n,{name:t,index:r,group:i,on:KV,tween:JV,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:dk})}function np(e,t){var n=rn(e,t);if(n.state>dk)throw new Error("too late; already scheduled");return n}function Mn(e,t){var n=rn(e,t);if(n.state>K0)throw new Error("too late; already running");return n}function rn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tY(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Z0(o,0,n.time);function o(l){n.state=uk,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!==uk)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===K0)return Q0(s);h.state===fk?(h.state=ep,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=ep,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Q0(function(){n.state===K0&&(n.state=fk,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=J0,n.on.call("start",e,e.__data__,n.index,n.group),n.state===J0){for(n.state=K0,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=tb,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===tb&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ep,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function mo(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>J0&&r.state<tb,r.state=ep,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function hk(e){return this.each(function(){mo(this,e)})}function eY(e,t){var n,r;return function(){var i=Mn(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 nY(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Mn(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 pk(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=rn(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?eY:nY)(n,e,t))}function Ou(e,t,n){var r=e._id;return e.each(function(){var i=Mn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return rn(i,r).value[t]}}function eb(e,t){var n;return(typeof t=="number"?we:t instanceof Fr?oi:(n=Fr(t))?(t=n,oi):Xh)(e,t)}function rY(e){return function(){this.removeAttribute(e)}}function iY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function oY(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 sY(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 aY(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 cY(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 mk(e,t){var n=Is(e),r=n==="transform"?aS:eb;return this.attrTween(e,typeof t=="function"?(n.local?cY:aY)(n,r,Ou(this,"attr."+e,t)):t==null?(n.local?iY:rY)(n):(n.local?sY:oY)(n,r,t))}function lY(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function uY(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&uY(e,o)),n}return i._value=t,i}function dY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&lY(e,o)),n}return i._value=t,i}function yk(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=Is(e);return this.tween(n,(r.local?fY:dY)(r,t))}function hY(e,t){return function(){np(this,e).delay=+t.apply(this,arguments)}}function pY(e,t){return t=+t,function(){np(this,e).delay=t}}function gk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hY:pY)(t,e)):rn(this.node(),t).delay}function mY(e,t){return function(){Mn(this,e).duration=+t.apply(this,arguments)}}function yY(e,t){return t=+t,function(){Mn(this,e).duration=t}}function bk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mY:yY)(t,e)):rn(this.node(),t).duration}function gY(e,t){if(typeof t!="function")throw new Error;return function(){Mn(this,e).ease=t}}function xk(e){var t=this._id;return arguments.length?this.each(gY(t,e)):rn(this.node(),t).ease}function bY(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Mn(this,e).ease=n}}function _k(e){if(typeof e!="function")throw new Error;return this.each(bY(this._id,e))}function wk(e){typeof e!="function"&&(e=Uh(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 Kn(r,this._parents,this._name,this._id)}function vk(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 Kn(s,this._parents,this._name,this._id)}function xY(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 _Y(e,t,n){var r,i,o=xY(t)?np:Mn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Sk(e,t){var n=this._id;return arguments.length<2?rn(this.node(),n).on.on(e):this.each(_Y(n,e,t))}function wY(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ik(){return this.on("end.remove",wY(this._id))}function Tk(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gc(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,Da(l[d],t,n,d,l,rn(u,n)));return new Kn(o,this._parents,t,n)}function Ek(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ph(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=rn(u,n),y=0,b=d.length;y<b;++y)(h=d[y])&&Da(h,t,n,y,d,p);o.push(d),s.push(u)}return new Kn(o,s,t,n)}var vY=Es.prototype.constructor;function Mk(){return new vY(this._groups,this._parents)}function SY(e,t){var n,r,i;return function(){var o=Na(this,e),s=(this.style.removeProperty(e),Na(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function Ak(e){return function(){this.style.removeProperty(e)}}function IY(e,t,n){var r,i=n+"",o;return function(){var s=Na(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function TY(e,t,n){var r,i,o;return function(){var s=Na(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Na(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function EY(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Mn(this,e),l=c.on,u=c.value[o]==null?a||(a=Ak(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function Nk(e,t,n){var r=(e+="")=="transform"?sS:eb;return t==null?this.styleTween(e,SY(e,r)).on("end.style."+e,Ak(e)):typeof t=="function"?this.styleTween(e,TY(e,r,Ou(this,"style."+e,t))).each(EY(this._id,e)):this.styleTween(e,IY(e,r,t),n).on("end.style."+e,null)}function MY(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function AY(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&MY(e,s,n)),r}return o._value=t,o}function Rk(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,AY(e,t,n??""))}function NY(e){return function(){this.textContent=e}}function RY(e){return function(){var t=e(this);this.textContent=t??""}}function Ok(e){return this.tween("text",typeof e=="function"?RY(Ou(this,"text",e)):NY(e==null?"":e+""))}function OY(e){return function(t){this.textContent=e.call(this,t)}}function DY(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&OY(i)),t}return r._value=e,r}function Dk(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,DY(e))}function kk(){for(var e=this._name,t=this._id,n=nb(),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=rn(c,t);Da(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Kn(r,this._parents,e,n)}function Fk(){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=Mn(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 kY=0;function Kn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Lk(e){return Es().transition(e)}function nb(){return++kY}var Ns=Es.prototype;Kn.prototype=Lk.prototype={constructor:Kn,select:Tk,selectAll:Ek,selectChild:Ns.selectChild,selectChildren:Ns.selectChildren,filter:wk,merge:vk,selection:Mk,transition:kk,call:Ns.call,nodes:Ns.nodes,node:Ns.node,size:Ns.size,empty:Ns.empty,each:Ns.each,on:Sk,attr:mk,attrTween:yk,style:Nk,styleTween:Rk,text:Ok,textTween:Dk,remove:Ik,tween:pk,delay:gk,duration:bk,ease:xk,easeVarying:_k,end:Fk,[Symbol.iterator]:Ns[Symbol.iterator]};function rb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var FY={time:null,delay:0,duration:250,ease:rb};function LY(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 Ck(e){var t,n;e instanceof Kn?(t=e._id,e=e._name):(t=nb(),(n=FY).time=tp(),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])&&Da(c,e,t,l,s,n||LY(c,t));return new Kn(r,this._parents,e,t)}Es.prototype.interrupt=hk;Es.prototype.transition=Ck;var ib=e=>()=>e;function dS(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 Bk(e){e.stopImmediatePropagation()}function ob(e){e.preventDefault(),e.stopImmediatePropagation()}var Pk={name:"drag"},hS={name:"space"},Du={name:"handle"},ku={name:"center"},{abs:Uk,max:Cn,min:Bn}=Math;function $k(e){return[+e[0],+e[1]]}function mS(e){return[$k(e[0]),$k(e[1])]}var sb={name:"x",handles:["w","e"].map(rp),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]]}},ab={name:"y",handles:["n","s"].map(rp),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]]}},CY={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(rp),input:function(e){return e==null?null:mS(e)},output:function(e){return e}},Rs={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"},zk={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},qk={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},BY={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},PY={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function rp(e){return{type:e}}function UY(e){return!e.ctrlKey&&!e.button}function $Y(){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 zY(){return navigator.maxTouchPoints||"ontouchstart"in this}function pS(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function qY(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function yS(){return xS(sb)}function gS(){return xS(ab)}function bS(){return xS(CY)}function xS(e){var t=$Y,n=UY,r=zY,i=!0,o=Yc("start","brush","end"),s=6,a;function c(b){var m=b.property("__brush",y).selectAll(".overlay").data([rp("overlay")]);m.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Rs.overlay).merge(m).each(function(){var x=pS(this).extent;zt(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])}),b.selectAll(".selection").data([rp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Rs.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var g=b.selectAll(".handle").data(e.handles,function(x){return x.type});g.exit().remove(),g.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return Rs[x.type]}),b.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(b,m,g){b.tween?b.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,T=e.input(typeof m=="function"?m.apply(this,arguments):m,_.extent),A=Lr(w,T);function R(I){_.selection=I===1&&T===null?null:A(I),l.call(x),v.brush()}return w!==null&&T!==null?R:R(1)}):b.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof m=="function"?m.apply(x,_):m,v.extent),T=u(x,_).beforestart();mo(x),v.selection=w===null?null:w,l.call(x),T.start(g).brush(g).end(g)})},c.clear=function(b,m){c.move(b,null,m)};function l(){var b=zt(this),m=pS(this).selection;m?(b.selectAll(".selection").style("display",null).attr("x",m[0][0]).attr("y",m[0][1]).attr("width",m[1][0]-m[0][0]).attr("height",m[1][1]-m[0][1]),b.selectAll(".handle").style("display",null).attr("x",function(g){return g.type[g.type.length-1]==="e"?m[1][0]-s/2:m[0][0]-s/2}).attr("y",function(g){return g.type[0]==="s"?m[1][1]-s/2:m[0][1]-s/2}).attr("width",function(g){return g.type==="n"||g.type==="s"?m[1][0]-m[0][0]+s:s}).attr("height",function(g){return g.type==="e"||g.type==="w"?m[1][1]-m[0][1]+s:s})):b.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(b,m,g){var x=b.__brush.emitter;return x&&(!g||!x.clean)?x:new f(b,m,g)}function f(b,m,g){this.that=b,this.args=m,this.state=b.__brush,this.active=0,this.clean=g}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(b,m){return this.starting?(this.starting=!1,this.emit("start",b,m)):this.emit("brush",b),this},brush:function(b,m){return this.emit("brush",b,m),this},end:function(b,m){return--this.active===0&&(delete this.state.emitter,this.emit("end",b,m)),this},emit:function(b,m,g){var x=zt(this.that).datum();o.call(b,this.that,new dS(b,{sourceEvent:m,target:c,selection:e.output(this.state.selection),mode:g,dispatch:o}),x)}};function d(b){if(a&&!b.touches||!n.apply(this,arguments))return;var m=this,g=b.target.__data__.type,x=(i&&b.metaKey?g="overlay":g)==="selection"?Pk:i&&b.altKey?ku:Du,_=e===ab?null:BY[g],v=e===sb?null:PY[g],w=pS(m),T=w.extent,A=w.selection,R=T[0][0],I,E,O=T[0][1],k,S,M=T[1][0],N,F,B=T[1][1],C,P,U=0,$=0,X,tt=_&&v&&i&&b.shiftKey,nt,st,Y=Array.from(b.touches||[b],et=>{let oe=et.identifier;return et=Fn(et,m),et.point0=et.slice(),et.identifier=oe,et});mo(m);var rt=u(m,arguments,!0).beforestart();if(g==="overlay"){A&&(X=!0);let et=[Y[0],Y[1]||Y[0]];w.selection=A=[[I=e===ab?R:Bn(et[0][0],et[1][0]),k=e===sb?O:Bn(et[0][1],et[1][1])],[N=e===ab?M:Cn(et[0][0],et[1][0]),C=e===sb?B:Cn(et[0][1],et[1][1])]],Y.length>1&&Lt(b)}else I=A[0][0],k=A[0][1],N=A[1][0],C=A[1][1];E=I,S=k,F=N,P=C;var q=zt(m).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Rs[g]);if(b.touches)rt.moved=z,rt.ended=dt;else{var ot=zt(b.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Xt,!0),zh(b.view)}l.call(m),rt.start(b,x.name);function z(et){for(let oe of et.changedTouches||[et])for(let xr of Y)xr.identifier===oe.identifier&&(xr.cur=Fn(oe,m));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];Uk(oe.cur[0]-oe[0])>Uk(oe.cur[1]-oe[1])?st=!0:nt=!0}for(let oe of Y)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);X=!0,ob(et),Lt(et)}function Lt(et){let oe=Y[0],xr=oe.point0;var Gi;switch(U=oe[0]-xr[0],$=oe[1]-xr[1],x){case hS:case Pk:{_&&(U=Cn(R-I,Bn(M-N,U)),E=I+U,F=N+U),v&&($=Cn(O-k,Bn(B-C,$)),S=k+$,P=C+$);break}case Du:{Y[1]?(_&&(E=Cn(R,Bn(M,Y[0][0])),F=Cn(R,Bn(M,Y[1][0])),_=1),v&&(S=Cn(O,Bn(B,Y[0][1])),P=Cn(O,Bn(B,Y[1][1])),v=1)):(_<0?(U=Cn(R-I,Bn(M-I,U)),E=I+U,F=N):_>0&&(U=Cn(R-N,Bn(M-N,U)),E=I,F=N+U),v<0?($=Cn(O-k,Bn(B-k,$)),S=k+$,P=C):v>0&&($=Cn(O-C,Bn(B-C,$)),S=k,P=C+$));break}case ku:{_&&(E=Cn(R,Bn(M,I-U*_)),F=Cn(R,Bn(M,N+U*_))),v&&(S=Cn(O,Bn(B,k-$*v)),P=Cn(O,Bn(B,C+$*v)));break}}F<E&&(_*=-1,Gi=I,I=N,N=Gi,Gi=E,E=F,F=Gi,g in zk&&H.attr("cursor",Rs[g=zk[g]])),P<S&&(v*=-1,Gi=k,k=C,C=Gi,Gi=S,S=P,P=Gi,g in qk&&H.attr("cursor",Rs[g=qk[g]])),w.selection&&(A=w.selection),nt&&(E=A[0][0],F=A[1][0]),st&&(S=A[0][1],P=A[1][1]),(A[0][0]!==E||A[0][1]!==S||A[1][0]!==F||A[1][1]!==P)&&(w.selection=[[E,S],[F,P]],l.call(m),rt.brush(et,x.name))}function dt(et){if(Bk(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else qh(et.view,X),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",Rs.overlay),w.selection&&(A=w.selection),qY(A)&&(w.selection=null,l.call(m)),rt.end(et,x.name)}function Wt(et){switch(et.keyCode){case 16:{tt=_&&v;break}case 18:{x===Du&&(_&&(N=F-U*_,I=E+U*_),v&&(C=P-$*v,k=S+$*v),x=ku,Lt(et));break}case 32:{(x===Du||x===ku)&&(_<0?N=F-U:_>0&&(I=E-U),v<0?C=P-$:v>0&&(k=S-$),x=hS,H.attr("cursor",Rs.selection),Lt(et));break}default:return}ob(et)}function Xt(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,Lt(et));break}case 18:{x===ku&&(_<0?N=F:_>0&&(I=E),v<0?C=P:v>0&&(k=S),x=Du,Lt(et));break}case 32:{x===hS&&(et.altKey?(_&&(N=F-U*_,I=E+U*_),v&&(C=P-$*v,k=S+$*v),x=ku):(_<0?N=F:_>0&&(I=E),v<0?C=P:v>0&&(k=S),x=Du),H.attr("cursor",Rs[g]),Lt(et));break}default:return}ob(et)}}function h(b){u(this,arguments).moved(b)}function p(b){u(this,arguments).ended(b)}function y(){var b=this.__brush||{selection:null};return b.extent=mS(t.apply(this,arguments)),b.dim=e,b}return c.extent=function(b){return arguments.length?(t=typeof b=="function"?b:ib(mS(b)),c):t},c.filter=function(b){return arguments.length?(n=typeof b=="function"?b:ib(!!b),c):n},c.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:ib(!!b),c):r},c.handleSize=function(b){return arguments.length?(s=+b,c):s},c.keyModifiers=function(b){return arguments.length?(i=!!b,c):i},c.on=function(){var b=o.on.apply(o,arguments);return b===o?c:b},c}var _S=Math.PI,wS=2*_S,Jc=1e-6,jY=wS-Jc;function jk(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function VY(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return jk;let n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}var ka=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?jk:VY(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>Jc)if(!(Math.abs(f*c-l*u)>Jc)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,y=c*c+l*l,b=h*h+p*p,m=Math.sqrt(y),g=Math.sqrt(d),x=o*Math.tan((_S-Math.acos((y+d-b)/(2*m*g)))/2),_=x/g,v=x/m;Math.abs(_-1)>Jc&&this._append`L${t+_*u},${n+_*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)>Jc||Math.abs(this._y1-u)>Jc)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%wS+wS),d>jY?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>Jc&&this._append`A${r},${r},0,${+(d>=_S)},${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 Vk(){return new ka}Vk.prototype=ka.prototype;function Jn(e=3){return new ka(+e)}var YY=Array.prototype,cb=YY.slice;function Yk(e,t){return e-t}function Gk(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 yo=e=>()=>e;function Wk(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=GY(e,t[n]))return i;return 0}function GY(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(WY(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function WY(e,t,n){var r;return XY(e,t,n)&&HY(e[r=+(e[0]===t[0])],n[r],t[r])}function XY(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function HY(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function Xk(){}var Os=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Fa(){var e=1,t=1,n=Ma,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(Yk);else{let f=ae(l,ZY);for(u=Tn(...wu(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),Gk(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var y=0,b=d.length,m;y<b;++y)if(Wk((m=d[y])[0],p)!==-1){m.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,y,b,m,g,x;for(p=y=-1,m=tl(l[0],u),Os[m<<1].forEach(_);++p<e-1;)b=m,m=tl(l[p+1],u),Os[b|m<<1].forEach(_);for(Os[m<<0].forEach(_);++y<t-1;){for(p=-1,m=tl(l[y*e+e],u),g=tl(l[y*e],u),Os[m<<1|g<<2].forEach(_);++p<e-1;)b=m,m=tl(l[y*e+e+p+1],u),x=g,g=tl(l[y*e+p+1],u),Os[b|m<<1|g<<2|x<<3].forEach(_);Os[m|g<<3].forEach(_)}for(p=-1,g=l[y*e]>=u,Os[g<<2].forEach(_);++p<e-1;)x=g,g=tl(l[y*e+p+1],u),Os[g<<2|x<<3].forEach(_);Os[g<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+y],T=[v[1][0]+p,v[1][1]+y],A=a(w),R=a(T),I,E;(I=h[A])?(E=d[R])?(delete h[I.end],delete d[E.start],I===E?(I.ring.push(T),f(I.ring)):d[I.start]=h[E.end]={start:I.start,end:E.end,ring:I.ring.concat(E.ring)}):(delete h[I.end],I.ring.push(T),h[I.end=R]=I):(I=d[R])?(E=h[A])?(delete d[I.start],delete h[E.end],I===E?(I.ring.push(T),f(I.ring)):d[E.start]=h[I.end]={start:E.start,end:I.end,ring:E.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(w),d[I.start=A]=I):d[A]=h[R]={start:A,end:R,ring:[w,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],y=h|0,b=p|0,m=vS(u[b*e+y]);h>0&&h<e&&y===h&&(d[0]=Hk(h,vS(u[b*e+y-1]),m,f)),p>0&&p<t&&b===p&&(d[1]=Hk(p,vS(u[(b-1)*e+y]),m,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)?yo(cb.call(l)):yo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:Xk,i):r===c},i}function ZY(e){return isFinite(e)?e:NaN}function tl(e,t){return e==null?!1:+e>=t}function vS(e){return e==null||isNaN(e=+e)?-1/0:e}function Hk(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 QY(e){return e[0]}function KY(e){return e[1]}function JY(){return 1}function SS(){var e=QY,t=KY,n=JY,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=yo(20);function f(g){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let k of g){var w=(e(k,++v,g)+a)*_,T=(t(k,v,g)+a)*_,A=+n(k,v,g);if(A&&w>=0&&w<c&&T>=0&&T<l){var R=Math.floor(w),I=Math.floor(T),E=w-R-.5,O=T-I-.5;x[R+I*c]+=(1-E)*(1-O)*A,x[R+1+I*c]+=E*(1-O)*A,x[R+1+(I+1)*c]+=E*O*A,x[R+(I+1)*c]+=(1-E)*O*A}}return Dh({data:x,width:c,height:l},o*_),x}function d(g){var x=f(g),_=u(x),v=Math.pow(2,2*s);return Array.isArray(_)||(_=Tn(Number.MIN_VALUE,$t(x)/v,_)),Fa().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(g){var x=f(g),_=Fa().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var A=h(_.contour(x,T*v));return A.value=T,A};return Object.defineProperty(w,"max",{get:()=>$t(x)/v}),w};function h(g){return g.coordinates.forEach(p),g}function p(g){g.forEach(y)}function y(g){g.forEach(b)}function b(g){g[0]=g[0]*Math.pow(2,s)-a,g[1]=g[1]*Math.pow(2,s)-a}function m(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(g){return arguments.length?(e=typeof g=="function"?g:yo(+g),d):e},d.y=function(g){return arguments.length?(t=typeof g=="function"?g:yo(+g),d):t},d.weight=function(g){return arguments.length?(n=typeof g=="function"?g:yo(+g),d):n},d.size=function(g){if(!arguments.length)return[r,i];var x=+g[0],_=+g[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return r=x,i=_,m()},d.cellSize=function(g){if(!arguments.length)return 1<<s;if(!((g=+g)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(g)/Math.LN2),m()},d.thresholds=function(g){return arguments.length?(u=typeof g=="function"?g:Array.isArray(g)?yo(cb.call(g)):yo(g),d):u},d.bandwidth=function(g){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((g=+g)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*g*g+1)-1)/2,m()},d}var Jt=11102230246251565e-32,Ge=134217729,ip=(3+8*Jt)*Jt;function el(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 op(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var tG=(3+16*Jt)*Jt,eG=(2+12*Jt)*Jt,nG=(9+64*Jt)*Jt*Jt,Fu=V(4),Zk=V(8),Qk=V(12),Kk=V(16),tr=V(4);function rG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,y,b,m,g,x,_,v,w,T,A,R=e-i,I=n-i,E=t-o,O=r-o;_=R*O,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*O,y=d-(d-O),b=O-y,v=p*b-(_-h*y-p*y-h*b),w=E*I,d=Ge*E,h=d-(d-E),p=E-h,d=Ge*I,y=d-(d-I),b=I-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,Fu[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,Fu[1]=x-(m+f)+(f-w),A=g+m,f=A-g,Fu[2]=g-(A-f)+(m-f),Fu[3]=A;let k=op(4,Fu),S=eG*s;if(k>=S||-k>=S||(f=e-R,a=e-(R+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-E,c=t-(E+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=nG*s+ip*Math.abs(k),k+=R*u+O*a-(E*l+I*c),k>=S||-k>=S))return k;_=a*O,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*O,y=d-(d-O),b=O-y,v=p*b-(_-h*y-p*y-h*b),w=c*I,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*I,y=d-(d-I),b=I-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,tr[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,tr[1]=x-(m+f)+(f-w),A=g+m,f=A-g,tr[2]=g-(A-f)+(m-f),tr[3]=A;let M=el(4,Fu,4,tr,Zk);_=R*u,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*u,y=d-(d-u),b=u-y,v=p*b-(_-h*y-p*y-h*b),w=E*l,d=Ge*E,h=d-(d-E),p=E-h,d=Ge*l,y=d-(d-l),b=l-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,tr[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,tr[1]=x-(m+f)+(f-w),A=g+m,f=A-g,tr[2]=g-(A-f)+(m-f),tr[3]=A;let N=el(M,Zk,4,tr,Qk);_=a*u,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*u,y=d-(d-u),b=u-y,v=p*b-(_-h*y-p*y-h*b),w=c*l,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*l,y=d-(d-l),b=l-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,tr[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,tr[1]=x-(m+f)+(f-w),A=g+m,f=A-g,tr[2]=g-(A-f)+(m-f),tr[3]=A;let F=el(N,Qk,4,tr,Kk);return Kk[F-1]}function Lu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=tG*l?c:-rG(e,t,n,r,i,o,l)}var Z1t=(7+56*Jt)*Jt,Q1t=(3+28*Jt)*Jt,K1t=(26+288*Jt)*Jt*Jt,J1t=V(4),t_t=V(4),e_t=V(4),n_t=V(4),r_t=V(4),i_t=V(4),o_t=V(4),s_t=V(4),a_t=V(4),c_t=V(8),l_t=V(8),u_t=V(8),f_t=V(4),d_t=V(8),h_t=V(8),p_t=V(8),m_t=V(12),y_t=V(192),g_t=V(192);var __t=(10+96*Jt)*Jt,w_t=(4+48*Jt)*Jt,v_t=(44+576*Jt)*Jt*Jt,S_t=V(4),I_t=V(4),T_t=V(4),E_t=V(4),M_t=V(4),A_t=V(4),N_t=V(4),R_t=V(4),O_t=V(8),D_t=V(8),k_t=V(8),F_t=V(8),L_t=V(8),C_t=V(8),B_t=V(8),P_t=V(8),U_t=V(8),$_t=V(4),z_t=V(4),q_t=V(4),j_t=V(8),V_t=V(16),Y_t=V(16),G_t=V(16),W_t=V(32),X_t=V(32),H_t=V(48),Z_t=V(64),Q_t=V(1152),K_t=V(1152);var nwt=(16+224*Jt)*Jt,rwt=(5+72*Jt)*Jt,iwt=(71+1408*Jt)*Jt*Jt,owt=V(4),swt=V(4),awt=V(4),cwt=V(4),lwt=V(4),uwt=V(4),fwt=V(4),dwt=V(4),hwt=V(4),pwt=V(4),mwt=V(24),ywt=V(24),gwt=V(24),bwt=V(24),xwt=V(24),_wt=V(24),wwt=V(24),vwt=V(24),Swt=V(24),Iwt=V(24),Twt=V(1152),Ewt=V(1152),Mwt=V(1152),Awt=V(1152),Nwt=V(1152),Rwt=V(2304),Owt=V(2304),Dwt=V(3456),kwt=V(5760),Fwt=V(8),Lwt=V(8),Cwt=V(8),Bwt=V(16),Pwt=V(24),Uwt=V(48),$wt=V(48),zwt=V(96),qwt=V(192),jwt=V(384),Vwt=V(384),Ywt=V(384),Gwt=V(768);var Wwt=V(96),Xwt=V(96),Hwt=V(96),Zwt=V(1152);var tF=Math.pow(2,-52),lb=new Uint32Array(512),Bu=class e{static from(t,n=lG,r=uG){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).fill(-1),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 I=0;I<s;I++){let E=t[2*I],O=t[2*I+1];E<a&&(a=E),O<c&&(c=O),E>l&&(l=E),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,y,b;for(let I=0;I<s;I++){let E=IS(f,d,t[2*I],t[2*I+1]);E<h&&(p=I,h=E)}let m=t[2*p],g=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let E=IS(m,g,t[2*I],t[2*I+1]);E<h&&E>0&&(y=I,h=E)}let x=t[2*y],_=t[2*y+1],v=1/0;for(let I=0;I<s;I++){if(I===p||I===y)continue;let E=aG(m,g,x,_,t[2*I],t[2*I+1]);E<v&&(b=I,v=E)}let w=t[2*b],T=t[2*b+1];if(v===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];Cu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),E=0;for(let O=0,k=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>k&&(I[E++]=S,k=this._dists[S])}this.hull=I.subarray(0,E),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Lu(m,g,x,_,w,T)<0){let I=y,E=x,O=_;y=b,x=w,_=T,b=I,w=E,T=O}let A=cG(m,g,x,_,w,T);this._cx=A.x,this._cy=A.y;for(let I=0;I<s;I++)this._dists[I]=IS(t[2*I],t[2*I+1],A.x,A.y);Cu(this._ids,this._dists,0,s-1),this._hullStart=p;let R=3;r[p]=n[b]=y,r[y]=n[p]=b,r[b]=n[y]=p,i[p]=0,i[y]=1,i[b]=2,o.fill(-1),o[this._hashKey(m,g)]=p,o[this._hashKey(x,_)]=y,o[this._hashKey(w,T)]=b,this.trianglesLen=0,this._addTriangle(p,y,b,-1,-1,-1);for(let I=0,E,O;I<this._ids.length;I++){let k=this._ids[I],S=t[2*k],M=t[2*k+1];if(I>0&&Math.abs(S-E)<=tF&&Math.abs(M-O)<=tF||(E=S,O=M,k===p||k===y||k===b))continue;let N=0;for(let U=0,$=this._hashKey(S,M);U<this._hashSize&&(N=o[($+U)%this._hashSize],!(N!==-1&&N!==r[N]));U++);N=n[N];let F=N,B;for(;B=r[F],Lu(S,M,t[2*F],t[2*F+1],t[2*B],t[2*B+1])>=0;)if(F=B,F===N){F=-1;break}if(F===-1)continue;let C=this._addTriangle(F,k,r[F],-1,-1,i[F]);i[k]=this._legalize(C+2),i[F]=C,R++;let P=r[F];for(;B=r[P],Lu(S,M,t[2*P],t[2*P+1],t[2*B],t[2*B+1])<0;)C=this._addTriangle(P,k,B,i[k],-1,i[P]),i[k]=this._legalize(C+2),r[P]=P,R--,P=B;if(F===N)for(;B=n[F],Lu(S,M,t[2*B],t[2*B+1],t[2*F],t[2*F+1])<0;)C=this._addTriangle(B,k,F,-1,i[F],i[B]),this._legalize(C+2),i[B]=C,r[F]=F,R--,F=B;this._hullStart=n[k]=F,r[F]=n[P]=k,r[k]=P,o[this._hashKey(S,M)]=k,o[this._hashKey(t[2*F],t[2*F+1])]=F}this.hull=new Uint32Array(R);for(let I=0,E=this._hullStart;I<R;I++)this.hull[I]=E,E=r[E];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(oG(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=lb[--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],y=n[f];if(sG(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*y],i[2*y+1])){n[t]=y,n[a]=d;let m=r[f];if(m===-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,m),this._link(a,r[s]),this._link(s,f);let g=l+(a+1)%3;o<lb.length&&(lb[o++]=g)}else{if(o===0)break;t=lb[--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 oG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function IS(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function sG(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,y=u*u+f*f,b=d*d+h*h;return c*(f*b-y*h)-l*(u*b-y*d)+p*(u*h-f*d)<0}function aG(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 cG(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 Cu(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;sp(e,i,o),t[e[n]]>t[e[r]]&&sp(e,n,r),t[e[o]]>t[e[r]]&&sp(e,o,r),t[e[n]]>t[e[o]]&&sp(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;sp(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Cu(e,t,o,r),Cu(e,t,n,s-1)):(Cu(e,t,n,s-1),Cu(e,t,o,r))}}function sp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function lG(e){return e[0]}function uG(e){return e[1]}var si=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 La=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 ap=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 y=0,b=0,m=r.length,g,x;y<m;y+=3,b+=2){let _=r[y]*2,v=r[y+1]*2,w=r[y+2]*2,T=t[_],A=t[_+1],R=t[v],I=t[v+1],E=t[w],O=t[w+1],k=R-T,S=I-A,M=E-T,N=O-A,F=(k*N-S*M)*2;if(Math.abs(F)<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);g=(T+E)/2-B*N,x=(A+O)/2+B*M}else{let B=1/F,C=k*k+S*S,P=M*M+N*N;g=T+(N*C-S*P)*B,x=A+(k*P-M*C)*B}a[b]=g,a[b+1]=x}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 y=0;y<n.length;++y)c=n[y],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 si: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,y=s[h],b=s[h+1],m=s[p],g=s[p+1];this._renderSegment(y,b,m,g,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,y=this._project(d,h,a[p+2],a[p+3]);y&&this._renderSegment(d,h,y[0],y[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new si: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 si: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 La;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,y,b,m,g;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[y,b,m,g]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[m,g,y,b]=p,f=d,d=this._edgecode(y,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,b):i=[y,b]}f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var fG=2*Math.PI,Pu=Math.pow;function dG(e){return e[0]}function hG(e){return e[1]}function pG(e){let{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){let i=2*t[r],o=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function mG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ai=class e{static from(t,n=dG,r=hG,i){return new e("length"in t?yG(t,n,r,i):Float64Array.from(gG(t,n,r,i)))}constructor(t){this._delaunator=new Bu(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&pG(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=mG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Bu(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 ap(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=Pu(n-l[t*2],2)+Pu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],y=Pu(n-l[p*2],2)+Pu(r-l[p*2+1],2);if(y<f&&(f=y,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&&Pu(n-l[h*2],2)+Pu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new si: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 si:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,fG)}return r&&r.value()}renderHull(t){let n=t==null?t=new si: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 La;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new si: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 La;return this.renderTriangle(t,n),n.value()}};function yG(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*gG(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 eF(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function nl(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 go(e){return e=nl(Math.abs(e)),e?e[1]:NaN}function nF(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 rF(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var bG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bo(e){if(!(t=bG.exec(e)))throw new Error("invalid format: "+e);var t;return new ub({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]})}bo.prototype=ub.prototype;function ub(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+""}ub.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 iF(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 TS;function oF(e,t){var n=nl(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(TS=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")+nl(e,Math.max(0,t+o-1))[0]}function ES(e,t){var n=nl(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 MS={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:eF,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)=>ES(e*100,t),r:ES,s:oF,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function AS(e){return e}var sF=Array.prototype.map,aF=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function cF(e){var t=e.grouping===void 0||e.thousands===void 0?AS:nF(sF.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?AS:rF(sF.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=bo(f);var d=f.fill,h=f.align,p=f.sign,y=f.symbol,b=f.zero,m=f.width,g=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(g=!0,v="g"):MS[v]||(x===void 0&&(x=12),_=!0,v="g"),(b||d==="0"&&h==="=")&&(b=!0,d="0",h="=");var w=y==="$"?n:y==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=y==="$"?r:/[%p]/.test(v)?s:"",A=MS[v],R=/[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 I(E){var O=w,k=T,S,M,N;if(v==="c")k=A(E)+k,E="";else{E=+E;var F=E<0||1/E<0;if(E=isNaN(E)?c:A(Math.abs(E),x),_&&(E=iF(E)),F&&+E==0&&p!=="+"&&(F=!1),O=(F?p==="("?p:a:p==="-"||p==="("?"":p)+O,k=(v==="s"?aF[8+TS/3]:"")+k+(F&&p==="("?")":""),R){for(S=-1,M=E.length;++S<M;)if(N=E.charCodeAt(S),48>N||N>57){k=(N===46?i+E.slice(S+1):E.slice(S))+k,E=E.slice(0,S);break}}}g&&!b&&(E=t(E,1/0));var B=O.length+E.length+k.length,C=B<m?new Array(m-B+1).join(d):"";switch(g&&b&&(E=t(C+E,C.length?m-k.length:1/0),C=""),h){case"<":E=O+E+k+C;break;case"=":E=O+C+E+k;break;case"^":E=C.slice(0,B=C.length>>1)+O+E+k+C.slice(B);break;default:E=C+O+E+k;break}return o(E)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=bo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(go(d)/3)))*3,y=Math.pow(10,-p),b=aF[8+p/3];return function(m){return h(y*m)+b}}return{format:l,formatPrefix:u}}var fb,ci,db;NS({thousands:",",grouping:[3],currency:["$",""]});function NS(e){return fb=cF(e),ci=fb.format,db=fb.formatPrefix,fb}function RS(e){return Math.max(0,-go(Math.abs(e)))}function OS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(go(t)/3)))*3-go(Math.abs(e)))}function DS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,go(t)-go(e))+1}var J=1e-6,rl=1e-12,At=Math.PI,de=At/2,kS=At/4,cn=At*2,Ce=180/At,qt=At/180,Bt=Math.abs,li=Math.atan,We=Math.atan2,K=Math.cos,cp=Math.ceil,hb=Math.exp;var pb=Math.hypot,il=Math.log,mb=Math.pow,Q=Math.sin,Pn=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,Uu=Math.tan;function yb(e){return e>1?0:e<-1?At:Math.acos(e)}function ve(e){return e>1?de:e<-1?-de:Math.asin(e)}function Xe(){}function gb(e,t){e&&uF.hasOwnProperty(e.type)&&uF[e.type](e,t)}var lF={Feature:function(e,t){gb(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)gb(n[r].geometry,t)}},uF={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){FS(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)FS(n[r],t,0)},Polygon:function(e,t){fF(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)fF(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)gb(n[r],t)}};function FS(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 fF(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)FS(e[n],t,1);t.polygonEnd()}function Cr(e,t){e&&lF.hasOwnProperty(e.type)?lF[e.type](e,t):gb(e,t)}function lp(e){return[We(e[1],e[0]),ve(e[2])]}function xo(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Q(t),Q(n)]}function up(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $u(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 bb(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function fp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function dp(e){var t=he(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var hp,xb,_b,wb,vb,Sb,Ib,Tb,LS,CS,BS,pF,mF,er,nr,rr,Ui={sphere:Xe,point:PS,lineStart:dF,lineEnd:hF,polygonStart:function(){Ui.lineStart=wG,Ui.lineEnd=vG},polygonEnd:function(){Ui.lineStart=dF,Ui.lineEnd=hF}};function PS(e,t){e*=qt,t*=qt;var n=K(t);pp(n*K(e),n*Q(e),Q(t))}function pp(e,t,n){++hp,_b+=(e-_b)/hp,wb+=(t-wb)/hp,vb+=(n-vb)/hp}function dF(){Ui.point=xG}function xG(e,t){e*=qt,t*=qt;var n=K(t);er=n*K(e),nr=n*Q(e),rr=Q(t),Ui.point=_G,pp(er,nr,rr)}function _G(e,t){e*=qt,t*=qt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=We(he((s=nr*o-rr*i)*s+(s=rr*r-er*o)*s+(s=er*i-nr*r)*s),er*r+nr*i+rr*o);xb+=s,Sb+=s*(er+(er=r)),Ib+=s*(nr+(nr=i)),Tb+=s*(rr+(rr=o)),pp(er,nr,rr)}function hF(){Ui.point=PS}function wG(){Ui.point=SG}function vG(){yF(pF,mF),Ui.point=PS}function SG(e,t){pF=e,mF=t,e*=qt,t*=qt,Ui.point=yF;var n=K(t);er=n*K(e),nr=n*Q(e),rr=Q(t),pp(er,nr,rr)}function yF(e,t){e*=qt,t*=qt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=nr*o-rr*i,a=rr*r-er*o,c=er*i-nr*r,l=pb(s,a,c),u=ve(l),f=l&&-u/l;LS.add(f*s),CS.add(f*a),BS.add(f*c),xb+=u,Sb+=u*(er+(er=r)),Ib+=u*(nr+(nr=i)),Tb+=u*(rr+(rr=o)),pp(er,nr,rr)}function US(e){hp=xb=_b=wb=vb=Sb=Ib=Tb=0,LS=new In,CS=new In,BS=new In,Cr(e,Ui);var t=+LS,n=+CS,r=+BS,i=pb(t,n,r);return i<rl&&(t=Sb,n=Ib,r=Tb,xb<J&&(t=_b,n=wb,r=vb),i=pb(t,n,r),i<rl)?[NaN,NaN]:[We(n,t)*Ce,ve(r/i)*Ce]}function mp(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 $S(e,t){return Bt(e)>At&&(e-=Math.round(e/cn)*cn),[e,t]}$S.invert=$S;function zS(e,t,n){return(e%=cn)?t||n?mp(bF(e),xF(t,n)):bF(e):t||n?xF(t,n):$S}function gF(e){return function(t,n){return t+=e,Bt(t)>At&&(t-=Math.round(t/cn)*cn),[t,n]}}function bF(e){var t=gF(e);return t.invert=gF(-e),t}function xF(e,t){var n=K(e),r=Q(e),i=K(t),o=Q(t);function s(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,d=Q(c),h=d*n+u*r;return[We(f*i-h*o,u*n-d*r),ve(h*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,d=Q(c),h=d*i-f*o;return[We(f*i+d*o,u*n+h*r),ve(h*n-u*r)]},s}function _F(e){e=zS(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]*=Ce,n[1]*=Ce,n}return t.invert=function(n){return n=e.invert(n[0]*qt,n[1]*qt),n[0]*=Ce,n[1]*=Ce,n},t}function vF(e,t,n,r,i,o){if(n){var s=K(t),a=Q(t),c=r*n;i==null?(i=t+r*cn,o=t-c/2):(i=wF(s,i),o=wF(s,o),(r>0?i<o:i>o)&&(i+=r*cn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=lp([s,-a*K(u),-a*Q(u)]),e.point(l[0],l[1])}}function wF(e,t){t=xo(t),t[0]-=e,dp(t);var n=yb(-t[1]);return((-t[2]<0?-n:n)+cn-J)%cn}function Eb(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Xe,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function zu(e,t){return Bt(e[0]-t[0])<J&&Bt(e[1]-t[1])<J}function Mb(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 Ab(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((y=p.length-1)<=0)){var y,b=p[0],m=p[y],g;if(zu(b,m)){if(!b[2]&&!m[2]){for(i.lineStart(),a=0;a<y;++a)i.point((b=p[a])[0],b[1]);i.lineEnd();return}m[0]+=2*J}o.push(g=new Mb(b,p,null,!0)),s.push(g.o=new Mb(b,null,g,!1)),o.push(g=new Mb(m,p,null,!1)),s.push(g.o=new Mb(m,null,g,!0))}}),!!o.length){for(s.sort(t),SF(o),SF(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 SF(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 qS(e){return Bt(e[0])<=At?e[0]:Pn(e[0])*((Bt(e[0])+At)%cn-At)}function IF(e,t){var n=qS(t),r=t[1],i=Q(r),o=[Q(n),-K(n),0],s=0,a=0,c=new In;i===1?r=de+J:i===-1&&(r=-de-J);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=qS(h),y=h[1]/2+kS,b=Q(y),m=K(y),g=0;g<d;++g,p=_,b=w,m=T,h=x){var x=f[g],_=qS(x),v=x[1]/2+kS,w=Q(v),T=K(v),A=_-p,R=A>=0?1:-1,I=R*A,E=I>At,O=b*w;if(c.add(We(O*R*Q(I),m*T+O*K(I))),s+=E?A+R*cn:A,E^p>=n^_>=n){var k=$u(xo(h),xo(x));dp(k);var S=$u(o,k);dp(S);var M=(E^A>=0?-1:1)*ve(S[2]);(r>M||r===M&&(k[0]||k[1]))&&(a+=E^A>=0?1:-1)}}return(s<-J||s<J&&c<-rl)^a&1}function Nb(e,t,n,r){return function(i){var o=t(i),s=Eb(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:y,lineEnd:b,polygonStart:function(){d.point=m,d.lineStart=g,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=y,d.lineEnd=b,u=vu(u);var _=IF(l,r);u.length?(c||(i.polygonStart(),c=!0),Ab(u,TG,_,n,i)):_&&(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(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function y(){d.point=p,o.lineStart()}function b(){d.point=h,o.lineEnd()}function m(_,v){f.push([_,v]),a.point(_,v)}function g(){a.lineStart(),f=[]}function x(){m(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,A,R,I;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(R=v[0],(A=R.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<A;++w)i.point((I=R[w])[0],I[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(IG))}}return d}}function IG(e){return e.length>1}function TG(e,t){return((e=e.x)[0]<0?e[1]-de-J:de-e[1])-((t=t.x)[0]<0?t[1]-de-J:de-t[1])}var jS=Nb(function(){return!0},EG,AG,[-At,-de]);function EG(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?At:-At,c=Bt(o-t);Bt(c-At)<J?(e.point(t,n=(n+s)/2>0?de:-de),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=At&&(Bt(t-r)<J&&(t-=r*J),Bt(o-a)<J&&(o-=a*J),n=MG(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 MG(e,t,n,r){var i,o,s=Q(e-n);return Bt(s)>J?li((Q(t)*(o=K(r))*Q(n)-Q(r)*(i=K(t))*Q(e))/(i*o*s)):(t+r)/2}function AG(e,t,n,r){var i;if(e==null)i=n*de,r.point(-At,i),r.point(0,i),r.point(At,i),r.point(At,0),r.point(At,-i),r.point(0,-i),r.point(-At,-i),r.point(-At,0),r.point(-At,i);else if(Bt(e[0]-t[0])>J){var o=e[0]<t[0]?At:-At;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function TF(e){var t=K(e),n=6*qt,r=t>0,i=Bt(t)>J;function o(u,f,d,h){vF(h,e,n,d,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,d,h,p,y;return{lineStart:function(){p=h=!1,y=1},point:function(b,m){var g=[b,m],x,_=s(b,m),v=r?_?0:l(b,m):_?l(b+(b<0?At:-At),m):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,g),(!x||zu(f,x)||zu(g,x))&&(g[2]=1)),_!==h)y=0,_?(u.lineStart(),x=c(g,f),u.point(x[0],x[1])):(x=c(f,g),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&r^_){var w;!(v&d)&&(w=c(g,f,!0))&&(y=0,r?(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||!zu(f,g))&&u.point(g[0],g[1]),f=g,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return y|(p&&h)<<1}}}function c(u,f,d){var h=xo(u),p=xo(f),y=[1,0,0],b=$u(h,p),m=up(b,b),g=b[0],x=m-g*g;if(!x)return!d&&u;var _=t*m/x,v=-t*g/x,w=$u(y,b),T=fp(y,_),A=fp(b,v);bb(T,A);var R=w,I=up(T,R),E=up(R,R),O=I*I-E*(up(T,T)-1);if(!(O<0)){var k=he(O),S=fp(R,(-I-k)/E);if(bb(S,T),S=lp(S),!d)return S;var M=u[0],N=f[0],F=u[1],B=f[1],C;N<M&&(C=M,M=N,N=C);var P=N-M,U=Bt(P-At)<J,$=U||P<J;if(!U&&B<F&&(C=F,F=B,B=C),$?U?F+B>0^S[1]<(Bt(S[0]-M)<J?F:B):F<=S[1]&&S[1]<=B:P>At^(M<=S[0]&&S[0]<=N)){var X=fp(R,(-I+k)/E);return bb(X,T),[S,lp(X)]}}}function l(u,f){var d=r?e:At-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Nb(s,a,o,r?[0,-e]:[-At,e-At])}function EF(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 yp=1e9,Rb=-yp;function qu(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 Bt(l[0]-e)<J?u>0?0:3:Bt(l[0]-n)<J?u>0?2:1:Bt(l[1]-t)<J?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=Eb(),d,h,p,y,b,m,g,x,_,v,w,T={point:A,lineStart:O,lineEnd:k,polygonStart:I,polygonEnd:E};function A(M,N){i(M,N)&&u.point(M,N)}function R(){for(var M=0,N=0,F=h.length;N<F;++N)for(var B=h[N],C=1,P=B.length,U=B[0],$,X,tt=U[0],nt=U[1];C<P;++C)$=tt,X=nt,U=B[C],tt=U[0],nt=U[1],X<=r?nt>r&&(tt-$)*(r-X)>(nt-X)*(e-$)&&++M:nt<=r&&(tt-$)*(r-X)<(nt-X)*(e-$)&&--M;return M}function I(){u=f,d=[],h=[],w=!0}function E(){var M=R(),N=w&&M,F=(d=vu(d)).length;(N||F)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),F&&Ab(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,g=x=NaN}function k(){d&&(S(y,b),m&&_&&f.rejoin(),d.push(f.result())),T.point=A,_&&u.lineEnd()}function S(M,N){var F=i(M,N);if(h&&p.push([M,N]),v)y=M,b=N,m=F,v=!1,F&&(u.lineStart(),u.point(M,N));else if(F&&_)u.point(M,N);else{var B=[g=Math.max(Rb,Math.min(yp,g)),x=Math.max(Rb,Math.min(yp,x))],C=[M=Math.max(Rb,Math.min(yp,M)),N=Math.max(Rb,Math.min(yp,N))];EF(B,C,e,t,n,r)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),F||u.lineEnd(),w=!1):F&&(u.lineStart(),u.point(M,N),w=!1)}g=M,x=N,_=F}return T}}function MF(e,t,n){var r=Ue(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function AF(e,t,n){var r=Ue(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function VS(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,y,b=2.5;function m(){return{type:"MultiLineString",coordinates:g()}}function g(){return Ue(cp(r/u)*u,n,u).map(p).concat(Ue(cp(a/f)*f,s,f).map(y)).concat(Ue(cp(t/c)*c,e,c).filter(function(x){return Bt(x%u)>J}).map(d)).concat(Ue(cp(o/l)*l,i,l).filter(function(x){return Bt(x%f)>J}).map(h))}return m.lines=function(){return g().map(function(x){return{type:"LineString",coordinates:x}})},m.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(y(s).slice(1),p(n).reverse().slice(1),y(a).reverse().slice(1))]}},m.extent=function(x){return arguments.length?m.extentMajor(x).extentMinor(x):m.extentMinor()},m.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),m.precision(b)):[[r,a],[n,s]]},m.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),m.precision(b)):[[t,o],[e,i]]},m.step=function(x){return arguments.length?m.stepMajor(x).stepMinor(x):m.stepMinor()},m.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],m):[u,f]},m.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],m):[c,l]},m.precision=function(x){return arguments.length?(b=+x,d=MF(o,i,90),h=AF(t,e,b),p=MF(a,s,90),y=AF(r,n,b),m):b},m.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function YS(){return VS()()}var gp=e=>e;var GS=new In,WS=new In,NF,RF,XS,HS,Ca={point:Xe,lineStart:Xe,lineEnd:Xe,polygonStart:function(){Ca.lineStart=NG,Ca.lineEnd=OG},polygonEnd:function(){Ca.lineStart=Ca.lineEnd=Ca.point=Xe,GS.add(Bt(WS)),WS=new In},result:function(){var e=GS/2;return GS=new In,e}};function NG(){Ca.point=RG}function RG(e,t){Ca.point=OF,NF=XS=e,RF=HS=t}function OF(e,t){WS.add(HS*e-XS*t),XS=e,HS=t}function OG(){OF(NF,RF)}var ZS=Ca;var ju=1/0,Ob=ju,bp=-ju,Db=bp,DG={point:kG,lineStart:Xe,lineEnd:Xe,polygonStart:Xe,polygonEnd:Xe,result:function(){var e=[[ju,Ob],[bp,Db]];return bp=Db=-(Ob=ju=1/0),e}};function kG(e,t){e<ju&&(ju=e),e>bp&&(bp=e),t<Ob&&(Ob=t),t>Db&&(Db=t)}var Vu=DG;var QS=0,KS=0,xp=0,kb=0,Fb=0,Yu=0,JS=0,tI=0,_p=0,FF,LF,_o,wo,$i={point:ol,lineStart:DF,lineEnd:kF,polygonStart:function(){$i.lineStart=CG,$i.lineEnd=BG},polygonEnd:function(){$i.point=ol,$i.lineStart=DF,$i.lineEnd=kF},result:function(){var e=_p?[JS/_p,tI/_p]:Yu?[kb/Yu,Fb/Yu]:xp?[QS/xp,KS/xp]:[NaN,NaN];return QS=KS=xp=kb=Fb=Yu=JS=tI=_p=0,e}};function ol(e,t){QS+=e,KS+=t,++xp}function DF(){$i.point=FG}function FG(e,t){$i.point=LG,ol(_o=e,wo=t)}function LG(e,t){var n=e-_o,r=t-wo,i=he(n*n+r*r);kb+=i*(_o+e)/2,Fb+=i*(wo+t)/2,Yu+=i,ol(_o=e,wo=t)}function kF(){$i.point=ol}function CG(){$i.point=PG}function BG(){CF(FF,LF)}function PG(e,t){$i.point=CF,ol(FF=_o=e,LF=wo=t)}function CF(e,t){var n=e-_o,r=t-wo,i=he(n*n+r*r);kb+=i*(_o+e)/2,Fb+=i*(wo+t)/2,Yu+=i,i=wo*e-_o*t,JS+=i*(_o+e),tI+=i*(wo+t),_p+=i*3,ol(_o=e,wo=t)}var eI=$i;function Lb(e){this._context=e}Lb.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,cn);break}}},result:Xe};var rI=new In,nI,BF,PF,wp,vp,Cb={point:Xe,lineStart:function(){Cb.point=UG},lineEnd:function(){nI&&UF(BF,PF),Cb.point=Xe},polygonStart:function(){nI=!0},polygonEnd:function(){nI=null},result:function(){var e=+rI;return rI=new In,e}};function UG(e,t){Cb.point=UF,BF=wp=e,PF=vp=t}function UF(e,t){wp-=e,vp-=t,rI.add(he(wp*wp+vp*vp)),wp=e,vp=t}var iI=Cb;var $F,Bb,zF,qF,Gu=class{constructor(t){this._append=t==null?jF:$G(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!==zF||this._append!==Bb){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`,zF=r,Bb=this._append,qF=this._,this._=i}this._+=qF;break}}}result(){let t=this._;return this._="",t.length?t:null}};function jF(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function $G(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return jF;if(t!==$F){let n=10**t;$F=t,Bb=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 Bb}function An(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Cr(a,i(o))),o.result()}return s.area=function(a){return Cr(a,i(ZS)),ZS.result()},s.measure=function(a){return Cr(a,i(iI)),iI.result()},s.bounds=function(a){return Cr(a,i(Vu)),Vu.result()},s.centroid=function(a){return Cr(a,i(eI)),eI.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,gp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Gu(n)):new Lb(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 Gu(n)),s},s.projection(e).digits(n).context(t)}function sl(e){return{stream:Wu(e)}}function Wu(e){return function(t){var n=new oI;for(var r in e)n[r]=e[r];return n.stream=t,n}}function oI(){}oI.prototype={constructor:oI,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 sI(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Cr(n,e.stream(Vu)),t(Vu.result()),r!=null&&e.clipExtent(r),e}function Sp(e,t,n){return sI(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 Pb(e,t,n){return Sp(e,[[0,0],t],n)}function Ub(e,t,n){return sI(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 $b(e,t,n){return sI(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 VF=16,zG=K(30*qt);function aI(e,t){return+t?jG(e,t):qG(e)}function qG(e){return Wu({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function jG(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,y,b){var m=l-r,g=u-i,x=m*m+g*g;if(x>4*t&&y--){var _=s+d,v=a+h,w=c+p,T=he(_*_+v*v+w*w),A=ve(w/=T),R=Bt(Bt(w)-1)<J||Bt(o-f)<J?(o+f)/2:We(v,_),I=e(R,A),E=I[0],O=I[1],k=E-r,S=O-i,M=g*k-m*S;(M*M/x>t||Bt((m*k+g*S)/x-.5)>.3||s*d+a*h+c*p<zG)&&(n(r,i,o,s,a,c,E,O,R,_/=T,v/=T,w,y,b),b.point(E,O),n(E,O,R,_,v,w,l,u,f,d,h,p,y,b))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,y,b={point:m,lineStart:g,lineEnd:_,polygonStart:function(){r.polygonStart(),b.lineStart=v},polygonEnd:function(){r.polygonEnd(),b.lineStart=g}};function m(A,R){A=e(A,R),r.point(A[0],A[1])}function g(){f=NaN,b.point=x,r.lineStart()}function x(A,R){var I=xo([A,R]),E=e(A,R);n(f,d,u,h,p,y,f=E[0],d=E[1],u=A,h=I[0],p=I[1],y=I[2],VF,r),r.point(f,d)}function _(){b.point=m,r.lineEnd()}function v(){g(),b.point=w,b.lineEnd=T}function w(A,R){x(i=A,R),o=f,s=d,a=h,c=p,l=y,b.point=x}function T(){n(f,d,u,h,p,y,o,s,i,a,c,l,VF,r),b.lineEnd=_,_()}return b}}var VG=Wu({point:function(e,t){this.stream.point(e*qt,t*qt)}});function YG(e){return Wu({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function GG(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 YF(e,t,n,r,i,o){if(!o)return GG(e,t,n,r,i);var s=K(o),a=Q(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(y,b){return y*=r,b*=i,[c*y-l*b+t,n-l*y-c*b]}return p.invert=function(y,b){return[r*(u*y-f*b+d),i*(h-f*y-u*b)]},p}function Nn(e){return cI(function(){return e})()}function cI(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,y=jS,b=null,m,g,x,_=gp,v=.5,w,T,A,R,I;function E(M){return A(M[0]*qt,M[1]*qt)}function O(M){return M=A.invert(M[0],M[1]),M&&[M[0]*Ce,M[1]*Ce]}E.stream=function(M){return R&&I===M?R:R=VG(YG(u)(y(w(_(I=M)))))},E.preclip=function(M){return arguments.length?(y=M,p=void 0,S()):y},E.postclip=function(M){return arguments.length?(_=M,b=m=g=x=null,S()):_},E.clipAngle=function(M){return arguments.length?(y=+M?TF(p=M*qt):(p=null,jS),S()):p*Ce},E.clipExtent=function(M){return arguments.length?(_=M==null?(b=m=g=x=null,gp):qu(b=+M[0][0],m=+M[0][1],g=+M[1][0],x=+M[1][1]),S()):b==null?null:[[b,m],[g,x]]},E.scale=function(M){return arguments.length?(n=+M,k()):n},E.translate=function(M){return arguments.length?(r=+M[0],i=+M[1],k()):[r,i]},E.center=function(M){return arguments.length?(o=M[0]%360*qt,s=M[1]%360*qt,k()):[o*Ce,s*Ce]},E.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*Ce,c*Ce,l*Ce]},E.angle=function(M){return arguments.length?(f=M%360*qt,k()):f*Ce},E.reflectX=function(M){return arguments.length?(d=M?-1:1,k()):d<0},E.reflectY=function(M){return arguments.length?(h=M?-1:1,k()):h<0},E.precision=function(M){return arguments.length?(w=aI(T,v=M*M),S()):he(v)},E.fitExtent=function(M,N){return Sp(E,M,N)},E.fitSize=function(M,N){return Pb(E,M,N)},E.fitWidth=function(M,N){return Ub(E,M,N)},E.fitHeight=function(M,N){return $b(E,M,N)};function k(){var M=YF(n,0,0,d,h,f).apply(null,t(o,s)),N=YF(n,r-M[0],i-M[1],d,h,f);return u=zS(a,c,l),T=mp(t,N),A=mp(u,T),w=aI(T,v),S()}function S(){return R=I=null,E}return function(){return t=e.apply(this,arguments),E.invert=t.invert&&O,k()}}function Xu(e){var t=0,n=At/3,r=cI(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*qt,n=o[1]*qt):[t*Ce,n*Ce]},i}function GF(e){var t=K(e);function n(r,i){return[r*t,Q(i)/t]}return n.invert=function(r,i){return[r/t,ve(i*t)]},n}function WF(e,t){var n=Q(e),r=(n+Q(t))/2;if(Bt(r)<J)return GF(e);var i=1+n*(2*r-n),o=he(i)/r;function s(a,c){var l=he(i-2*r*Q(c))/r;return[l*Q(a*=r),o-l*K(a)]}return s.invert=function(a,c){var l=o-c,u=We(a,Bt(l))*Pn(l);return l*r<0&&(u-=At*Pn(a)*Pn(l)),[u/r,ve((i-(a*a+l*l)*r*r)/(2*r))]},s}function Ba(){return Xu(WF).scale(155.424).center([0,33.6442])}function Ip(){return Ba().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function WG(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 lI(){var e,t,n=Ip(),r,i=Ba().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Ba().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(),y=(d[0]-p[0])/h,b=(d[1]-p[1])/h;return(b>=.12&&b<.234&&y>=-.425&&y<-.214?i:b>=.166&&b<.234&&y>=-.214&&y<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=WG([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],y=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,y-.238*h],[p+.455*h,y+.238*h]]).stream(l),o=i.translate([p-.307*h,y+.201*h]).clipExtent([[p-.425*h+J,y+.12*h+J],[p-.214*h-J,y+.234*h-J]]).stream(l),a=s.translate([p-.205*h,y+.212*h]).clipExtent([[p-.214*h+J,y+.166*h+J],[p-.115*h-J,y+.234*h-J]]).stream(l),f()},u.fitExtent=function(d,h){return Sp(u,d,h)},u.fitSize=function(d,h){return Pb(u,d,h)},u.fitWidth=function(d,h){return Ub(u,d,h)},u.fitHeight=function(d,h){return $b(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function zb(e){return function(t,n){var r=K(t),i=K(n),o=e(r*i);return o===1/0?[2,0]:[o*i*Q(t),o*Q(n)]}}function vo(e){return function(t,n){var r=he(t*t+n*n),i=e(r),o=Q(i),s=K(i);return[We(t*o,r*s),ve(r&&n*o/r)]}}var uI=zb(function(e){return he(2/(1+e))});uI.invert=vo(function(e){return 2*ve(e/2)});function fI(){return Nn(uI).scale(124.75).clipAngle(180-.001)}var dI=zb(function(e){return(e=yb(e))&&e/Q(e)});dI.invert=vo(function(e){return e});function hI(){return Nn(dI).scale(79.4188).clipAngle(180-.001)}function Hu(e,t){return[e,il(Uu((de+t)/2))]}Hu.invert=function(e,t){return[e,2*li(hb(t))-de]};function pI(){return mI(Hu).scale(961/cn)}function mI(e){var t=Nn(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=At*r(),d=t(_F(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Hu?[[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 qb(e){return Uu((de+e)/2)}function XF(e,t){var n=K(e),r=e===t?Q(e):il(n/K(t))/il(qb(t)/qb(e)),i=n*mb(qb(e),r)/r;if(!r)return Hu;function o(s,a){i>0?a<-de+J&&(a=-de+J):a>de-J&&(a=de-J);var c=i/mb(qb(a),r);return[c*Q(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=Pn(r)*he(s*s+c*c),u=We(s,Bt(c))*Pn(c);return c*r<0&&(u-=At*Pn(s)*Pn(c)),[u/r,2*li(mb(i/l,1/r))-de]},o}function yI(){return Xu(XF).scale(109.5).parallels([30,30])}function Zu(e,t){return[e,t]}Zu.invert=Zu;function gI(){return Nn(Zu).scale(152.63)}function HF(e,t){var n=K(e),r=e===t?Q(e):(n-K(t))/(t-e),i=n/r+e;if(Bt(r)<J)return Zu;function o(s,a){var c=i-a,l=r*s;return[c*Q(l),i-c*K(l)]}return o.invert=function(s,a){var c=i-a,l=We(s,Bt(c))*Pn(c);return c*r<0&&(l-=At*Pn(s)*Pn(c)),[l/r,i-Pn(r)*he(s*s+c*c)]},o}function bI(){return Xu(HF).scale(131.154).center([0,13.9389])}var Tp=1.340264,Ep=-.081106,Mp=893e-6,Ap=.003796,jb=he(3)/2,XG=12;function xI(e,t){var n=ve(jb*Q(t)),r=n*n,i=r*r*r;return[e*K(n)/(jb*(Tp+3*Ep*r+i*(7*Mp+9*Ap*r))),n*(Tp+Ep*r+i*(Mp+Ap*r))]}xI.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<XG&&(a=n*(Tp+Ep*r+i*(Mp+Ap*r))-t,c=Tp+3*Ep*r+i*(7*Mp+9*Ap*r),n-=s=a/c,r=n*n,i=r*r*r,!(Bt(s)<rl));++o);return[jb*e*(Tp+3*Ep*r+i*(7*Mp+9*Ap*r))/K(n),ve(Q(n)/jb)]};function _I(){return Nn(xI).scale(177.158)}function wI(e,t){var n=K(t),r=K(e)*n;return[n*Q(e)/r,Q(t)/r]}wI.invert=vo(li);function vI(){return Nn(wI).scale(144.049).clipAngle(60)}function SI(e,t){return[K(t)*Q(e),Q(t)]}SI.invert=vo(ve);function II(){return Nn(SI).scale(249.5).clipAngle(90+J)}function TI(e,t){var n=K(t),r=1+K(e)*n;return[n*Q(e)/r,Q(t)/r]}TI.invert=vo(function(e){return 2*li(e)});function EI(){return Nn(TI).scale(250).clipAngle(142)}function MI(e,t){return[il(Uu((de+t)/2)),-e]}MI.invert=function(e,t){return[-t,2*li(hb(e))-de]};function AI(){var e=mI(MI),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 HG(e,t){return e.parent===t.parent?1:2}function ZG(e){return e.reduce(QG,0)/e.length}function QG(e,t){return e+t.x}function KG(e){return 1+e.reduce(JG,0)}function JG(e,t){return Math.max(e,t.y)}function tW(e){for(var t;t=e.children;)e=t[0];return e}function eW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function Vb(){var e=HG,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=ZG(h),d.y=KG(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=tW(o),l=eW(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 nW(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 ZF(){return this.eachAfter(nW)}function QF(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function KF(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 JF(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 tL(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function eL(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 nL(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function rL(e){for(var t=this,n=rW(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 rW(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 iL(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function oL(){return Array.from(this)}function sL(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function aL(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*cL(){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 NI(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=sW)):t===void 0&&(t=oW);for(var n=new Pa(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 Pa(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(RI)}function iW(){return NI(this).eachBefore(aW)}function oW(e){return e.children}function sW(e){return Array.isArray(e)?e[1]:null}function aW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function RI(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Pa(e){this.data=e,this.depth=this.height=0,this.parent=null}Pa.prototype=NI.prototype={constructor:Pa,count:ZF,each:QF,eachAfter:JF,eachBefore:KF,find:tL,sum:eL,sort:nL,path:rL,ancestors:iL,descendants:oL,leaves:sL,links:aL,copy:iW,[Symbol.iterator]:cL};function Yb(e){return e==null?null:cW(e)}function cW(e){if(typeof e!="function")throw new Error;return e}var lW={depth:-1},lL={},OI={};function uW(e){return e.id}function fW(e){return e.parentId}function Gb(){var e=uW,t=fW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,y,b=new Map;if(n!=null){let m=o.map((_,v)=>dW(n(_,v,i))),g=m.map(uL),x=new Set(m).add("");for(let _ of g)x.has(_)||(x.add(_),m.push(_),g.push(uL(_)),o.push(OI));s=(_,v)=>m[v],a=(_,v)=>g[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Pa(l),(p=s(l,u,i))!=null&&(p+="")&&(y=h.id=p,b.set(y,b.has(y)?lL: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=b.get(p),!d)throw new Error("missing: "+p);if(d===lL)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===OI&&f.children.length===1;)f=f.children[0],--c;for(let m=o.length-1;m>=0&&(h=o[m],h.data===OI);--m)h.data=null}if(f.parent=lW,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(RI),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=Yb(i),r):e},r.parentId=function(i){return arguments.length?(t=Yb(i),r):t},r.path=function(i){return arguments.length?(n=Yb(i),r):n},r}function dW(e){e=`${e}`;let t=e.length;return DI(e,t-1)&&!DI(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function uL(e){let t=e.length;if(t<2)return"";for(;--t>1&&!DI(e,t););return e.slice(0,t)}function DI(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function hW(e,t){return e.parent===t.parent?1:2}function kI(e){var t=e.children;return t?t[0]:e.t}function FI(e){var t=e.children;return t?t[t.length-1]:e.t}function pW(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function mW(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 yW(e,t,n){return e.a.parent===t.parent?e.a:n}function Wb(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Wb.prototype=Object.create(Pa.prototype);function gW(e){for(var t=new Wb(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new Wb(o[s],s)),i.parent=n;return(t.parent=new Wb(null,0)).children=[t],t}function al(){var e=hW,t=1,n=1,r=null;function i(l){var u=gW(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(g){g.x<f.x&&(f=g),g.x>d.x&&(d=g),g.depth>h.depth&&(h=g)});var p=f===d?1:e(f,d)/2,y=p-f.x,b=t/(d.x+p+y),m=n/(h.depth||1);l.eachBefore(function(g){g.x=(g.x+y)*b,g.y=g.depth*m})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){mW(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,y=d.parent.children[0],b=d.m,m=h.m,g=p.m,x=y.m,_;p=FI(p),d=kI(d),p&&d;)y=kI(y),h=FI(h),h.a=l,_=p.z+g-d.z-b+e(p._,d._),_>0&&(pW(yW(p,l,f),l,_),b+=_,m+=_),g+=p.m,b+=d.m,x+=y.m,m+=h.m;p&&!FI(h)&&(h.t=p,h.m+=g-m),d&&!kI(y)&&(y.t=d,y.m+=b-x,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 fL=23283064365386963e-26;function cl(e=Math.random()){let t=(0<=e&&e<1?e/fL:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,fL*(t>>>0))}function He(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Np(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 Rp=Symbol("implicit");function ll(){var e=new Hn,t=[],n=[],r=Rp;function i(o){let s=e.get(o);if(s===void 0){if(r!==Rp)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 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?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return ll(t,n).unknown(r)},He.apply(i,arguments),i}function Ua(){var e=ll().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,y=h?r:i;o=(y-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(y-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var b=Ue(d).map(function(m){return p+o*m});return n(h?b.reverse():b)}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 Ua(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},He.apply(f(),arguments)}function dL(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return dL(t())},e}function LI(){return dL(Ua.apply(null,arguments).paddingInner(1))}function CI(e){return function(){return e}}function Qu(e){return+e}var hL=[0,1];function gr(e){return e}function BI(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:CI(isNaN(t)?NaN:.5)}function bW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function xW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=BI(i,r),o=n(s,o)):(r=BI(r,i),o=n(o,s)),function(a){return o(r(a))}}function _W(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]=BI(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=ws(e,a,1,r)-1;return o[c](i[c](a))}}function So(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ul(){var e=hL,t=hL,n=Lr,r,i,o,s=gr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==gr&&(s=bW(e[0],e[d-1])),a=d>2?_W:xW,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),we)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Qu),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=Qc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:gr,u()):s!==gr},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 Op(){return ul()(gr,gr)}function PI(e,t,n,r){var i=_u(e,t,n),o;switch(r=bo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=OS(i,s))&&(r.precision=o),db(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=DS(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=RS(i))&&(r.precision=o-(r.type==="%")*2);break}}return ci(r)}function Ds(e){var t=e.domain;return e.ticks=function(n){var r=t();return Tn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return PI(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=vs(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 ks(){var e=Op();return e.copy=function(){return So(e,ks())},He.apply(e,arguments),Ds(e)}function Dp(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,Qu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Dp(e).unknown(t)},e=arguments.length?Array.from(e,Qu):[0,1],Ds(n)}function kp(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function pL(e){return Math.log(e)}function mL(e){return Math.exp(e)}function wW(e){return-Math.log(-e)}function vW(e){return-Math.exp(-e)}function SW(e){return isFinite(e)?+("1e"+e):e<0?0:e}function IW(e){return e===10?SW:e===Math.E?Math.exp:t=>Math.pow(e,t)}function TW(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 yL(e){return(t,n)=>-e(-t,n)}function UI(e){let t=e(pL,mL),n=t.domain,r=10,i,o;function s(){return i=TW(r),o=IW(r),n()[0]<0?(i=yL(i),o=yL(o),e(wW,vW)):e(pL,mL),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,y,b=a==null?10:+a,m=[];if(!(r%1)&&h-d<b){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(y=d<0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(y=d>0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}m.length*2<b&&(m=Tn(l,u,b))}else m=Tn(d,h,Math.min(h-d,b)).map(o);return f?m.reverse():m},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=bo(c)).precision==null&&(c.trim=!0),c=ci(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(kp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Fp(){let e=UI(ul()).domain([1,10]);return e.copy=()=>So(e,Fp()).base(e.base()),He.apply(e,arguments),e}function gL(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function bL(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function $I(e){var t=1,n=e(gL(t),bL(t));return n.constant=function(r){return arguments.length?e(gL(t=+r),bL(t)):t},Ds(n)}function Lp(){var e=$I(ul());return e.copy=function(){return So(e,Lp()).constant(e.constant())},He.apply(e,arguments)}function xL(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function EW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function MW(e){return e<0?-e*e:e*e}function zI(e){var t=e(gr,gr),n=1;function r(){return n===1?e(gr,gr):n===.5?e(EW,MW):e(xL(n),xL(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ds(t)}function Cp(){var e=zI(ul());return e.copy=function(){return So(e,Cp()).exponent(e.exponent())},He.apply(e,arguments),e}function Bp(){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]=$2(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[ws(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(Gt),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 Bp().domain(e).range(t).unknown(r)},He.apply(o,arguments)}function Pp(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[ws(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 Pp().domain(e).range(t).unknown(n)},He.apply(i,arguments)}var qI=new Date,jI=new Date;function pe(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=>pe(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)=>(qI.setTime(+o),jI.setTime(+s),e(qI),e(jI),Math.floor(n(qI,jI))),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 Up=pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Up.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Up);var sMt=Up.range;var ln=pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),_L=ln.range;var Fs=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),AW=Fs.range,Ls=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),NW=Ls.range;var Cs=pe(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()),RW=Cs.range,Bs=pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),OW=Bs.range;var ui=pe(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),DW=ui.range,hl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),kW=hl.range,pl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),FW=pl.range;function ml(e){return pe(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 Br=ml(0),$a=ml(1),Xb=ml(2),Hb=ml(3),To=ml(4),Zb=ml(5),Qb=ml(6),vL=Br.range,LW=$a.range,CW=Xb.range,BW=Hb.range,PW=To.range,UW=Zb.range,$W=Qb.range;function yl(e){return pe(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 Pr=yl(0),za=yl(1),Kb=yl(2),Jb=yl(3),Eo=yl(4),tx=yl(5),ex=yl(6),SL=Pr.range,zW=za.range,qW=Kb.range,jW=Jb.range,VW=Eo.range,YW=tx.range,GW=ex.range;var Ps=pe(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()),WW=Ps.range,Us=pe(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()),XW=Us.range;var Un=pe(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());Un.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(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 HW=Un.range,$n=pe(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());$n.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(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 ZW=$n.range;function TL(e,t,n,r,i,o){let s=[[ln,1,1e3],[ln,5,5*1e3],[ln,15,15*1e3],[ln,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=_s(([,,b])=>b).right(s,d);if(h===s.length)return e.every(_u(l/31536e6,u/31536e6,f));if(h===0)return Up.every(Math.max(_u(l,u,f),1));let[p,y]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(y)}return[a,c]}var[VI,zp]=TL($n,Us,Pr,pl,Bs,Ls),[YI,GI]=TL(Un,Ps,Br,ui,Cs,Fs);function WI(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 XI(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 qp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function HI(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=jp(i),u=Vp(i),f=jp(o),d=Vp(o),h=jp(s),p=Vp(s),y=jp(a),b=Vp(a),m=jp(c),g=Vp(c),x={a:F,A:B,b:C,B:P,c:null,d:OL,e:OL,f:_X,g:RX,G:DX,H:gX,I:bX,j:xX,L:CL,m:wX,M:vX,p:U,q:$,Q:FL,s:LL,S:SX,u:IX,U:TX,V:EX,w:MX,W:AX,x:null,X:null,y:NX,Y:OX,Z:kX,"%":kL},_={a:X,A:tt,b:nt,B:st,c:null,d:DL,e:DL,f:BX,g:WX,G:HX,H:FX,I:LX,j:CX,L:PL,m:PX,M:UX,p:Y,q:rt,Q:FL,s:LL,S:$X,u:zX,U:qX,V:jX,w:VX,W:YX,x:null,X:null,y:GX,Y:XX,Z:ZX,"%":kL},v={a:I,A:E,b:O,B:k,c:S,d:NL,e:NL,f:hX,g:AL,G:ML,H:RL,I:RL,j:lX,L:dX,m:cX,M:uX,p:R,q:aX,Q:mX,s:yX,S:fX,u:nX,U:rX,V:iX,w:eX,W:oX,x:M,X:N,y:AL,Y:ML,Z:sX,"%":pX};x.x=w(n,x),x.X=w(r,x),x.c=w(t,x),_.x=w(n,_),_.X=w(r,_),_.c=w(t,_);function w(q,H){return function(ot){var z=[],Lt=-1,dt=0,Wt=q.length,Xt,et,oe;for(ot instanceof Date||(ot=new Date(+ot));++Lt<Wt;)q.charCodeAt(Lt)===37&&(z.push(q.slice(dt,Lt)),(et=EL[Xt=q.charAt(++Lt)])!=null?Xt=q.charAt(++Lt):et=Xt==="e"?" ":"0",(oe=H[Xt])&&(Xt=oe(ot,et)),z.push(Xt),dt=Lt+1);return z.push(q.slice(dt,Lt)),z.join("")}}function T(q,H){return function(ot){var z=qp(1900,void 0,1),Lt=A(z,q,ot+="",0),dt,Wt;if(Lt!=ot.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(dt=XI(qp(z.y,0,1)),Wt=dt.getUTCDay(),dt=Wt>4||Wt===0?za.ceil(dt):za(dt),dt=hl.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=WI(qp(z.y,0,1)),Wt=dt.getDay(),dt=Wt>4||Wt===0?$a.ceil(dt):$a(dt),dt=ui.offset(dt,(z.V-1)*7),z.y=dt.getFullYear(),z.m=dt.getMonth(),z.d=dt.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Wt="Z"in z?XI(qp(z.y,0,1)).getUTCDay():WI(qp(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Wt+5)%7:z.w+z.U*7-(Wt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,XI(z)):WI(z)}}function A(q,H,ot,z){for(var Lt=0,dt=H.length,Wt=ot.length,Xt,et;Lt<dt;){if(z>=Wt)return-1;if(Xt=H.charCodeAt(Lt++),Xt===37){if(Xt=H.charAt(Lt++),et=v[Xt in EL?H.charAt(Lt++):Xt],!et||(z=et(q,ot,z))<0)return-1}else if(Xt!=ot.charCodeAt(z++))return-1}return z}function R(q,H,ot){var z=l.exec(H.slice(ot));return z?(q.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function I(q,H,ot){var z=h.exec(H.slice(ot));return z?(q.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function E(q,H,ot){var z=f.exec(H.slice(ot));return z?(q.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(q,H,ot){var z=m.exec(H.slice(ot));return z?(q.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function k(q,H,ot){var z=y.exec(H.slice(ot));return z?(q.m=b.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(q,H,ot){return A(q,t,H,ot)}function M(q,H,ot){return A(q,n,H,ot)}function N(q,H,ot){return A(q,r,H,ot)}function F(q){return s[q.getDay()]}function B(q){return o[q.getDay()]}function C(q){return c[q.getMonth()]}function P(q){return a[q.getMonth()]}function U(q){return i[+(q.getHours()>=12)]}function $(q){return 1+~~(q.getMonth()/3)}function X(q){return s[q.getUTCDay()]}function tt(q){return o[q.getUTCDay()]}function nt(q){return c[q.getUTCMonth()]}function st(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function rt(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var H=w(q+="",x);return H.toString=function(){return q},H},parse:function(q){var H=T(q+="",!1);return H.toString=function(){return q},H},utcFormat:function(q){var H=w(q+="",_);return H.toString=function(){return q},H},utcParse:function(q){var H=T(q+="",!0);return H.toString=function(){return q},H}}}var EL={"-":"",_:" ",0:"0"},un=/^\s*\d+/,KW=/^%/,JW=/[\\^$*+?|[\]().{}]/g;function te(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 tX(e){return e.replace(JW,"\\$&")}function jp(e){return new RegExp("^(?:"+e.map(tX).join("|")+")","i")}function Vp(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function eX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function nX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function rX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function iX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function oX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function ML(e,t,n){var r=un.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function AL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function sX(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 aX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function cX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function NL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function lX(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function RL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function uX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function fX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function dX(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function hX(e,t,n){var r=un.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function pX(e,t,n){var r=KW.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function mX(e,t,n){var r=un.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function yX(e,t,n){var r=un.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function OL(e,t){return te(e.getDate(),t,2)}function gX(e,t){return te(e.getHours(),t,2)}function bX(e,t){return te(e.getHours()%12||12,t,2)}function xX(e,t){return te(1+ui.count(Un(e),e),t,3)}function CL(e,t){return te(e.getMilliseconds(),t,3)}function _X(e,t){return CL(e,t)+"000"}function wX(e,t){return te(e.getMonth()+1,t,2)}function vX(e,t){return te(e.getMinutes(),t,2)}function SX(e,t){return te(e.getSeconds(),t,2)}function IX(e){var t=e.getDay();return t===0?7:t}function TX(e,t){return te(Br.count(Un(e)-1,e),t,2)}function BL(e){var t=e.getDay();return t>=4||t===0?To(e):To.ceil(e)}function EX(e,t){return e=BL(e),te(To.count(Un(e),e)+(Un(e).getDay()===4),t,2)}function MX(e){return e.getDay()}function AX(e,t){return te($a.count(Un(e)-1,e),t,2)}function NX(e,t){return te(e.getFullYear()%100,t,2)}function RX(e,t){return e=BL(e),te(e.getFullYear()%100,t,2)}function OX(e,t){return te(e.getFullYear()%1e4,t,4)}function DX(e,t){var n=e.getDay();return e=n>=4||n===0?To(e):To.ceil(e),te(e.getFullYear()%1e4,t,4)}function kX(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function DL(e,t){return te(e.getUTCDate(),t,2)}function FX(e,t){return te(e.getUTCHours(),t,2)}function LX(e,t){return te(e.getUTCHours()%12||12,t,2)}function CX(e,t){return te(1+hl.count($n(e),e),t,3)}function PL(e,t){return te(e.getUTCMilliseconds(),t,3)}function BX(e,t){return PL(e,t)+"000"}function PX(e,t){return te(e.getUTCMonth()+1,t,2)}function UX(e,t){return te(e.getUTCMinutes(),t,2)}function $X(e,t){return te(e.getUTCSeconds(),t,2)}function zX(e){var t=e.getUTCDay();return t===0?7:t}function qX(e,t){return te(Pr.count($n(e)-1,e),t,2)}function UL(e){var t=e.getUTCDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function jX(e,t){return e=UL(e),te(Eo.count($n(e),e)+($n(e).getUTCDay()===4),t,2)}function VX(e){return e.getUTCDay()}function YX(e,t){return te(za.count($n(e)-1,e),t,2)}function GX(e,t){return te(e.getUTCFullYear()%100,t,2)}function WX(e,t){return e=UL(e),te(e.getUTCFullYear()%100,t,2)}function XX(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function HX(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function ZX(){return"+0000"}function kL(){return"%"}function FL(e){return+e}function LL(e){return Math.floor(+e/1e3)}var Ku,Ju,$L,Mo,zL;ZI({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 ZI(e){return Ku=HI(e),Ju=Ku.format,$L=Ku.parse,Mo=Ku.utcFormat,zL=Ku.utcParse,Ku}function QX(e){return new Date(e)}function KX(e){return e instanceof Date?+e:+new Date(+e)}function nx(e,t,n,r,i,o,s,a,c,l){var u=Op(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),y=l("%I:%M"),b=l("%I %p"),m=l("%a %d"),g=l("%b %d"),x=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?y:o(w)<w?b:r(w)<w?i(w)<w?m:g:n(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,KX)):d().map(QX)},u.ticks=function(w){var T=d();return e(T[0],T[T.length-1],w??10)},u.tickFormat=function(w,T){return T==null?v:l(T)},u.nice=function(w){var T=d();return(!w||typeof w.range!="function")&&(w=t(T[0],T[T.length-1],w??10)),w?d(kp(T,w)):u},u.copy=function(){return So(u,nx(e,t,n,r,i,o,s,a,c,l))},u}function rx(){return He.apply(nx(YI,GI,Un,Ps,Br,ui,Cs,Fs,ln,Ju).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ix(){return He.apply(nx(VI,zp,$n,Us,Pr,hl,Bs,Ls,ln,Mo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Yp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ox(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=gr,u,f=!1,d;function h(y){return isNaN(y=+y)?d:(y=.5+((y=+u(y))-o)*(r*y<r*o?a:c),l(f?Math.max(0,Math.min(1,y)):y))}h.domain=function(y){return arguments.length?([e,t,n]=y,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(y){return arguments.length?(f=!!y,h):f},h.interpolator=function(y){return arguments.length?(l=y,h):l};function p(y){return function(b){var m,g,x;return arguments.length?([m,g,x]=b,l=po(y,[m,g,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(Lr),h.rangeRound=p(Qc),h.unknown=function(y){return arguments.length?(d=y,h):d},function(y){return u=y,i=y(e),o=y(t),s=y(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function Gp(){var e=Ds(ox()(gr));return e.copy=function(){return Yp(e,Gp())},Np.apply(e,arguments)}function sx(){var e=UI(ox()).domain([.1,1,10]);return e.copy=function(){return Yp(e,sx()).base(e.base())},Np.apply(e,arguments)}function ax(){var e=$I(ox());return e.copy=function(){return Yp(e,ax()).constant(e.constant())},Np.apply(e,arguments)}function cx(){var e=zI(ox());return e.copy=function(){return Yp(e,cx()).exponent(e.exponent())},Np.apply(e,arguments)}function G(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 QI=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var KI=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var JI=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var tT=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var eT=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var nT=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var rT=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var iT=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var oT=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var sT=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>nS(e[e.length-1]);var lx=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),ux=ht(lx);var fx=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),dx=ht(fx);var hx=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),px=ht(hx);var mx=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),yx=ht(mx);var Wp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),tf=ht(Wp);var gx=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),bx=ht(gx);var Xp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),ef=ht(Xp);var xx=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),_x=ht(xx);var wx=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),vx=ht(wx);var Sx=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Ix=ht(Sx);var Tx=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),Ex=ht(Tx);var Mx=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),Ax=ht(Mx);var Nx=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Rx=ht(Nx);var Ox=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),Dx=ht(Ox);var kx=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Fx=ht(kx);var Lx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),Cx=ht(Lx);var Bx=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),Px=ht(Bx);var Ux=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),$x=ht(Ux);var zx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),qx=ht(zx);var jx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),Vx=ht(jx);var Yx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),Gx=ht(Yx);var Wx=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),Xx=ht(Wx);var Hx=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),Zx=ht(Hx);var Qx=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),Kx=ht(Qx);var Jx=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),t1=ht(Jx);var e1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),n1=ht(e1);var r1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),i1=ht(r1);function o1(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 s1=Nu(Qn(300,.5,0),Qn(-240,.5,1));var c1=Nu(Qn(-100,.75,.35),Qn(80,1.5,.8)),l1=Nu(Qn(260,.75,.35),Qn(80,1.5,.8)),a1=Qn();function u1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return a1.h=360*e-100,a1.s=1.5-1.5*t,a1.l=.8-.9*t,a1+""}var f1=an(),JX=Math.PI/3,tH=Math.PI*2/3;function d1(e){var t;return e=(.5-e)*Math.PI,f1.r=255*(t=Math.sin(e))*t,f1.g=255*(t=Math.sin(e+JX))*t,f1.b=255*(t=Math.sin(e+tH))*t,f1+""}function h1(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 p1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var m1=p1(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),y1=p1(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),g1=p1(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),b1=p1(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ze(e){return function(){return e}}var aT=Math.cos;var nf=Math.min,Hp=Math.sin,ee=Math.sqrt,cT=1e-12,gl=Math.PI,ANt=gl/2,rf=2*gl;function x1(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new ka(t)}var DNt=Array.prototype.slice;function _1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qL(e){this._context=e}qL.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 $s(e){return new qL(e)}function w1(e){return e[0]}function v1(e){return e[1]}function Zp(e,t){var n=Ze(!0),r=null,i=$s,o=null,s=x1(a);e=typeof e=="function"?e:e===void 0?w1:Ze(e),t=typeof t=="function"?t:t===void 0?v1:Ze(t);function a(c){var l,u=(c=_1(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:Ze(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ze(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ze(!!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 of(e,t,n){var r=null,i=Ze(!0),o=null,s=$s,a=null,c=x1(l);e=typeof e=="function"?e:e===void 0?w1:Ze(+e),t=typeof t=="function"?t:t===void 0?Ze(0):Ze(+t),n=typeof n=="function"?n:n===void 0?v1:Ze(+n);function l(f){var d,h,p,y=(f=_1(f)).length,b,m=!1,g,x=new Array(y),_=new Array(y);for(o==null&&(a=s(g=c())),d=0;d<=y;++d){if(!(d<y&&i(b=f[d],d,f))===m)if(m=!m)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()}m&&(x[d]=+e(b,d,f),_[d]=+t(b,d,f),a.point(r?+r(b,d,f):x[d],n?+n(b,d,f):_[d]))}if(g)return a=null,g+""||null}function u(){return Zp().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ze(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ze(+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:Ze(!!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 S1=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 lT(e){return new S1(e,!0)}function uT(e){return new S1(e,!1)}var eH=ee(3),Qp={draw(e,t){let n=ee(t+nf(t/28,.75))*.59436,r=n/2,i=r*eH;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 zs={draw(e,t){let n=ee(t/gl);e.moveTo(n,0),e.arc(0,0,n,0,rf)}};var Kp={draw(e,t){let n=ee(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 jL=ee(1/3),nH=jL*2,Jp={draw(e,t){let n=ee(t/nH),r=n*jL;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var tm={draw(e,t){let n=ee(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var em={draw(e,t){let n=ee(t-nf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var nm={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var rm={draw(e,t){let n=ee(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var rH=.8908130915292852,VL=Hp(gl/10)/Hp(7*gl/10),iH=Hp(rf/10)*VL,oH=-aT(rf/10)*VL,im={draw(e,t){let n=ee(t*rH),r=iH*n,i=oH*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=rf*o/5,a=aT(s),c=Hp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var fT=ee(3),om={draw(e,t){let n=-ee(t/(fT*3));e.moveTo(0,n*2),e.lineTo(-fT*n,-n),e.lineTo(fT*n,-n),e.closePath()}};var sH=ee(3),sm={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*sH/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ee(3)/2,dT=1/ee(12),aH=(dT/2+1)*3,am={draw(e,t){let n=ee(t/aH),r=n/2,i=n*dT,o=r,s=n*dT+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(fi*r-di*i,di*r+fi*i),e.lineTo(fi*o-di*s,di*o+fi*s),e.lineTo(fi*a-di*c,di*a+fi*c),e.lineTo(fi*r+di*i,fi*i-di*r),e.lineTo(fi*o+di*s,fi*s-di*o),e.lineTo(fi*a+di*c,fi*c-di*a),e.closePath()}};var sf={draw(e,t){let n=ee(t-nf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var I1=[zs,Kp,Jp,nm,im,om,am],hT=[zs,em,sf,sm,Qp,rm,tm];function hi(){}function af(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 cm(e){this._context=e}cm.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:af(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:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function pT(e){return new cm(e)}function YL(e){this._context=e}YL.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function mT(e){return new YL(e)}function GL(e){this._context=e}GL.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:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yT(e){return new GL(e)}function WL(e,t){this._basis=new cm(e),this._beta=t}WL.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 gT=function e(t){function n(r){return t===1?new cm(r):new WL(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function cf(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 T1(e,t){this._context=e,this._k=(1-t)/6}T1.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:cf(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:cf(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 bT=function e(t){function n(r){return new T1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function E1(e,t){this._context=e,this._k=(1-t)/6}E1.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:cf(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 xT=function e(t){function n(r){return new E1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function M1(e,t){this._context=e,this._k=(1-t)/6}M1.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:cf(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 _T=function e(t){function n(r){return new M1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function lm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>cT){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>cT){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 XL(e,t){this._context=e,this._alpha=t}XL.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:lm(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 wT=function e(t){function n(r){return t?new XL(r,t):new T1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function HL(e,t){this._context=e,this._alpha=t}HL.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:lm(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 vT=function e(t){function n(r){return t?new HL(r,t):new E1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function ZL(e,t){this._context=e,this._alpha=t}ZL.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:lm(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 ST=function e(t){function n(r){return t?new ZL(r,t):new M1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function QL(e){this._context=e}QL.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function IT(e){return new QL(e)}function KL(e){return e<0?-1:1}function JL(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(KL(o)+KL(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function t5(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function TT(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 A1(e){this._context=e}A1.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:TT(this,this._t0,t5(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,TT(this,t5(this,n=JL(this,e,t)),n);break;default:TT(this,this._t0,n=JL(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function e5(e){this._context=new n5(e)}(e5.prototype=Object.create(A1.prototype)).point=function(e,t){A1.prototype.point.call(this,t,e)};function n5(e){this._context=e}n5.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 ET(e){return new A1(e)}function MT(e){return new e5(e)}function i5(e){this._context=e}i5.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=r5(e),i=r5(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 r5(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 AT(e){return new i5(e)}function N1(e,t){this._context=e,this._t=t}N1.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 NT(e){return new N1(e,.5)}function RT(e){return new N1(e,0)}function OT(e){return new N1(e,1)}var um=e=>()=>e;function DT(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 Ur(e,t,n){this.k=e,this.x=t,this.y=n}Ur.prototype={constructor:Ur,scale:function(e){return e===1?this:new Ur(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ur(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 fm=new Ur(1,0,0);kT.prototype=Ur.prototype;function kT(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fm;return e.__zoom}function R1(e){e.stopImmediatePropagation()}function lf(e){e.preventDefault(),e.stopImmediatePropagation()}function cH(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lH(){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 o5(){return this.__zoom||fm}function uH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fH(){return navigator.maxTouchPoints||"ontouchstart"in this}function dH(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 FT(){var e=cH,t=lH,n=dH,r=uH,i=fH,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=cS,l=Yc("start","zoom","end"),u,f,d,h=500,p=150,y=0,b=10;function m(S){S.property("__zoom",o5).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",E).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(S,M,N,F){var B=S.selection?S.selection():S;B.property("__zoom",o5),S!==B?v(S,M,N,F):B.interrupt().each(function(){w(this,arguments).event(F).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},m.scaleBy=function(S,M,N,F){m.scaleTo(S,function(){var B=this.__zoom.k,C=typeof M=="function"?M.apply(this,arguments):M;return B*C},N,F)},m.scaleTo=function(S,M,N,F){m.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?_(B):typeof N=="function"?N.apply(this,arguments):N,U=C.invert(P),$=typeof M=="function"?M.apply(this,arguments):M;return n(x(g(C,$),P,U),B,s)},N,F)},m.translateBy=function(S,M,N,F){m.transform(S,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,F)},m.translateTo=function(S,M,N,F,B){m.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,U=F==null?_(C):typeof F=="function"?F.apply(this,arguments):F;return n(fm.translate(U[0],U[1]).scale(P.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},F,B)};function g(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new Ur(M,S.x,S.y)}function x(S,M,N){var F=M[0]-N[0]*S.k,B=M[1]-N[1]*S.k;return F===S.x&&B===S.y?S:new Ur(S.k,F,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,N,F){S.on("start.zoom",function(){w(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(F).end()}).tween("zoom",function(){var B=this,C=arguments,P=w(B,C).event(F),U=t.apply(B,C),$=N==null?_(U):typeof N=="function"?N.apply(B,C):N,X=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),tt=B.__zoom,nt=typeof M=="function"?M.apply(B,C):M,st=c(tt.invert($).concat(X/tt.k),nt.invert($).concat(X/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=st(Y),q=X/rt[2];Y=new Ur(q,$[0]-rt[0]*q,$[1]-rt[1]*q)}P.zoom(null,Y)}})}function w(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=zt(this.that).datum();l.call(S,this.that,new DT(S,{sourceEvent:this.sourceEvent,target:m,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function A(S,...M){if(!e.apply(this,arguments))return;var N=w(this,M).event(S),F=this.__zoom,B=Math.max(o[0],Math.min(o[1],F.k*Math.pow(2,r.apply(this,arguments)))),C=Fn(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=F.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(F.k===B)return;N.mouse=[C,F.invert(C)],mo(this),N.start()}lf(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(x(g(F,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function R(S,...M){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,F=w(this,M,!0).event(S),B=zt(S.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",X,!0),C=Fn(S,N),P=S.clientX,U=S.clientY;zh(S.view),R1(S),F.mouse=[C,this.__zoom.invert(C)],mo(this),F.start();function $(tt){if(lf(tt),!F.moved){var nt=tt.clientX-P,st=tt.clientY-U;F.moved=nt*nt+st*st>y}F.event(tt).zoom("mouse",n(x(F.that.__zoom,F.mouse[0]=Fn(tt,N),F.mouse[1]),F.extent,s))}function X(tt){B.on("mousemove.zoom mouseup.zoom",null),qh(tt.view,F.moved),lf(tt),F.event(tt).end()}}function I(S,...M){if(e.apply(this,arguments)){var N=this.__zoom,F=Fn(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(F),C=N.k*(S.shiftKey?.5:2),P=n(x(g(N,C),F,B),t.apply(this,M),s);lf(S),a>0?zt(this).transition().duration(a).call(v,P,F,S):zt(this).call(m.transform,P,F,S)}}function E(S,...M){if(e.apply(this,arguments)){var N=S.touches,F=N.length,B=w(this,M,S.changedTouches.length===F).event(S),C,P,U,$;for(R1(S),P=0;P<F;++P)U=N[P],$=Fn(U,this),$=[$,this.__zoom.invert($),U.identifier],B.touch0?!B.touch1&&B.touch0[2]!==$[2]&&(B.touch1=$,B.taps=0):(B.touch0=$,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=$[0],u=setTimeout(function(){u=null},h)),mo(this),B.start())}}function O(S,...M){if(this.__zooming){var N=w(this,M).event(S),F=S.changedTouches,B=F.length,C,P,U,$;for(lf(S),C=0;C<B;++C)P=F[C],U=Fn(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=U:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=U);if(P=N.that.__zoom,N.touch1){var X=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],st=N.touch1[1],Y=(Y=nt[0]-X[0])*Y+(Y=nt[1]-X[1])*Y,rt=(rt=st[0]-tt[0])*rt+(rt=st[1]-tt[1])*rt;P=g(P,Math.sqrt(Y/rt)),U=[(X[0]+nt[0])/2,(X[1]+nt[1])/2],$=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)U=N.touch0[0],$=N.touch0[1];else return;N.zoom("touch",n(x(P,U,$),N.extent,s))}}function k(S,...M){if(this.__zooming){var N=w(this,M).event(S),F=S.changedTouches,B=F.length,C,P;for(R1(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=F[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=Fn(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<b)){var U=zt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return m.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:um(+S),m):r},m.filter=function(S){return arguments.length?(e=typeof S=="function"?S:um(!!S),m):e},m.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:um(!!S),m):i},m.extent=function(S){return arguments.length?(t=typeof S=="function"?S:um([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),m):t},m.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],m):[o[0],o[1]]},m.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],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(S){return arguments.length?(n=S,m):n},m.duration=function(S){return arguments.length?(a=+S,m):a},m.interpolate=function(S){return arguments.length?(c=S,m):c},m.on=function(){var S=l.on.apply(l,arguments);return S===l?m:S},m.clickDistance=function(S){return arguments.length?(y=(S=+S)*S,m):Math.sqrt(y)},m.tapDistance=function(S){return arguments.length?(b=+S,m):b},m}function $e(e){return e!=null&&!Number.isNaN(e)}function fn(e,t){return+$e(t)-+$e(e)||Gt(e,t)}function bl(e,t){return+$e(t)-+$e(e)||Xn(e,t)}function dm(e){return e!=null&&`${e}`!=""}function uf(e){return isFinite(e)?e:NaN}function ir(e){return e>0&&isFinite(e)?e:NaN}function qa(e){return e<0&&isFinite(e)?e:NaN}function ff(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`${hH(e.getUTCFullYear(),4)}-${qs(e.getUTCMonth()+1,2)}-${qs(e.getUTCDate(),2)}${n||r||i||o?`T${qs(n,2)}:${qs(r,2)}${i||o?`:${qs(i,2)}${o?`.${qs(o,3)}`:""}`:""}Z`:""}`}function hH(e){return e<0?`-${qs(-e,6)}`:e>9999?`+${qs(e,6)}`:qs(e,4)}function qs(e,t){return`${e}`.padStart(t,"0")}var pH=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function hm(e,t){return pH.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var hf=1e3,Va=hf*60,Ya=Va*60,No=Ya*24,Ao=No*7,xl=No*30,ja=No*365,LT=[["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",hf],["5 seconds",5*hf],["15 seconds",15*hf],["30 seconds",30*hf],["minute",Va],["5 minutes",5*Va],["15 minutes",15*Va],["30 minutes",30*Va],["hour",Ya],["3 hours",3*Ya],["6 hours",6*Ya],["12 hours",12*Ya],["day",No],["2 days",2*No],["week",Ao],["2 weeks",2*Ao],["month",xl],["3 months",3*xl],["6 months",6*xl],["year",ja],["2 years",2*ja],["5 years",5*ja],["10 years",10*ja],["20 years",20*ja],["50 years",50*ja],["100 years",100*ja]],CT=new Map([["second",hf],["minute",Va],["hour",Ya],["day",No],["monday",Ao],["tuesday",Ao],["wednesday",Ao],["thursday",Ao],["friday",Ao],["saturday",Ao],["sunday",Ao],["week",Ao],["month",xl],["year",ja]]),a5=new Map([["second",ln],["minute",Fs],["hour",Cs],["day",ui],["monday",$a],["tuesday",Xb],["wednesday",Hb],["thursday",To],["friday",Zb],["saturday",Qb],["sunday",Br],["week",Br],["month",Ps],["year",Un]]),BT=new Map([["second",ln],["minute",Ls],["hour",Bs],["day",pl],["monday",za],["tuesday",Kb],["wednesday",Jb],["thursday",Eo],["friday",tx],["saturday",ex],["sunday",Pr],["week",Pr],["month",Us],["year",$n]]),pf=Symbol("intervalDuration"),D1=Symbol("intervalType");for(let[e,t]of a5)t[pf]=CT.get(e),t[D1]="time";for(let[e,t]of BT)t[pf]=CT.get(e),t[D1]="utc";var pm=[["year",$n,"utc"],["month",Us,"utc"],["day",pl,"utc",6*xl],["hour",Bs,"utc",3*No],["minute",Ls,"utc",6*Ya],["second",ln,"utc",30*Va]],O1=[["year",Un,"time"],["month",Ps,"time"],["day",ui,"time",6*xl],["hour",Cs,"time",3*No],["minute",Fs,"time",6*Ya],["second",ln,"time",30*Va]],mH=[pm[0],O1[0],pm[1],O1[1],pm[2],O1[2],...pm.slice(3)];function k1(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=BT.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 PT(e){return c5(k1(e),"time")}function mm(e){return c5(k1(e),"utc")}function c5([e,t],n){let r=(n==="time"?a5:BT).get(e);return t>1&&(r=r.every(t),r[pf]=CT.get(e)*t,r[D1]=n),r}function UT(e,t){if(!(t>1))return;let n=e[pf];if(!LT.some(([,i])=>i===n)||n%No===0&&No<n&&n<xl)return;let[r]=LT[_s(([,i])=>Math.log(i)).center(LT,Math.log(n*t))];return(e[D1]==="time"?PT:mm)(r)}function s5(e,t,n){let r=t==="time"?Ju:Mo;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=yH(n);switch(e){case"millisecond":return df(r(".%L"),r(":%M:%S"),i);case"second":return df(r(":%S"),r("%-I:%M"),i);case"minute":return df(r("%-I:%M"),r("%p"),i);case"hour":return df(r("%-I %p"),r("%b %-d"),i);case"day":return df(r("%-d"),r("%b"),i);case"month":return df(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function yH(e){return e==="left"||e==="right"?(t,n)=>`
11
12
  ${t}
12
13
  ${n}`:e==="top"?(t,n)=>`${n}
13
14
  ${t}`:(t,n)=>`${t}
14
- ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let r=Ut(B0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return mk("millisecond","utc",n);for(let[i,o,s,a]of OH(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return mk(i,s,n)}}function ff(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-zs(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var xl=Object.getPrototypeOf(Uint8Array),kH=Object.prototype.toString,ST=Symbol("reindex");function dt(e,t,n){let r=typeof t;return r==="string"?xk(e,IT(t),n):r==="function"?xk(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Yt(e,pn(t),n):typeof t?.transform=="function"?_k(t.transform(e),n):FH(_k(t,n),e?.[ST])}function FH(e,t){return t?um(e,t):e}function xk(e,t,n){return Yt(e,n?.prototype instanceof xl?DH(t):t,n)}function _k(e,t){return t===void 0?je(e):e instanceof t?e:t.prototype instanceof xl&&!(e instanceof xl)?t.from(e,TT):t.from(e)}function DH(e){return(t,n)=>TT(e(t,n))}var Wa=[null],IT=e=>t=>t[e],Ie={transform:ir},W={transform:e=>e};var lm=()=>1,wk=()=>!0,ze=e=>e==null?e:`${e}`,It=e=>e==null?e:+e;var js=e=>e?e[0]:void 0,Xa=e=>e?e[1]:void 0,vk=e=>e?e[2]:void 0,pn=e=>()=>e;function pf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Hn(n,t,r)}function Qe(e){return e instanceof xl?e:Yt(e,TT,Float64Array)}function TT(e){return e==null?NaN:Number(e)}function Sk(e){return Yt(e,ET)}function ET(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?Uc(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Ne(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Za(e)?[void 0,e]:[e,void 0]}function ie(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function AT(e,t,n){if(e!=null)return Ze(e,t,n)}function Ze(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function je(e){return e==null||e instanceof Array||e instanceof xl?e:Array.from(e)}function Yt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Ha(e,t=Array){return e instanceof t?e.slice():t.from(e)}function MT({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function NT({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function mf(e){return MT(e)||NT(e)||e.interval!==void 0}function mn(e){return e?.toString===kH}function Lo(e){return mn(e)&&(e.type!==void 0||e.domain!==void 0)}function qr(e){return mn(e)&&typeof e.transform!="function"}function Co(e){return qr(e)&&e.value===void 0&&e.channel===void 0}function RT(e,t,n,r=W){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 Le(e,t){return e===void 0&&t===void 0?[js,Xa]:[e,t]}function jn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Ne(t)),e===void 0&&([e]=Ne(n)),e}function ir(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function um(e,t){return Yt(t,n=>e[n],e.constructor)}function yf(e){return e.length===1?(t,n)=>e(um(n,t)):e}function qs(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Vs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function V1(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 yn(e){let t;return[{transform:()=>t,label:Fn(e)},n=>t=n]}function kn(e){return e==null?[e]:yn(e)}function Fn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function gf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Re(r)||Re(i)?Yt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Yt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function _l(e,t){let n=OT(t?.interval,t?.type);return n?Yt(e,n):e}function OT(e,t){let n=bf(e,t);return n&&(r=>Ue(r)?n.floor(r):r)}function bf(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>$e(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>$e(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?wT:cm)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function Bo(e,t){if(e=bf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function Ik(e,t){if(e=Bo(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function Tk(e){return Qa(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Qa(e){return typeof e?.range=="function"}function mi(e){return e===void 0||qr(e)?e:{value:e}}function Ek(e){return e==null?null:{transform:t=>dt(t,e,Float64Array),label:Fn(e)}}function Ak(e){if(!or(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function or(e){return e&&typeof e[Symbol.iterator]=="function"}function Y1(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Te(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Re(e){for(let t of e)if(t!=null)return t instanceof Date}function Mk(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&Uc(t)}function Nk(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Ys(e){for(let t of e)if(t!=null)return typeof t=="number"}function G1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var LH=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 Za(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)||LH.has(e))}function Rk(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ne(e){return e==null||Gs(e)}function Gs(e){return/^\s*none\s*$/i.test(e)}function Ok(e){return/^\s*round\s*$/i.test(e)}function W1(e,t){return AT(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Po(e="middle"){return W1(e,"frameAnchor")}function zs(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Wn(t,n)}function kk(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 CH(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 fm(e){return or(e)?CH(e):e}var yi=Symbol("position"),Vr=Symbol("color"),wl=Symbol("radius"),vl=Symbol("length"),Sl=Symbol("opacity"),xf=Symbol("symbol"),Fk=Symbol("projection"),ue=new Map([["x",yi],["y",yi],["fx",yi],["fy",yi],["r",wl],["color",Vr],["opacity",Sl],["symbol",xf],["length",vl],["projection",Fk]]);function Dk(e){return e===yi||e===Fk}function Lk(e){return e===yi||e===wl||e===vl||e===Sl}var kT=Math.sqrt(3),FT=2/kT,BH={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*FT,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()}},DT=new Map([["asterisk",Yp],["circle",Us],["cross",Gp],["diamond",Wp],["diamond2",Xp],["hexagon",BH],["plus",Hp],["square",Qp],["square2",Zp],["star",Kp],["times",sf],["triangle",Jp],["triangle2",tm],["wye",em]]);function LT(e){return e&&typeof e.draw=="function"}function Ck(e){return LT(e)?!0:typeof e!="string"?!1:DT.has(e.toLowerCase())}function _f(e){if(e==null||LT(e))return e;let t=DT.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function Bk(e){if(e==null||LT(e))return[void 0,e];if(typeof e=="string"){let t=DT.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function gn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=PT(e)),t!=null&&!Co(t)&&(r=CT(r,UT(t))),n&&(r=CT(r,$T))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Co(t))&&{sort:t},transform:CT(r,s)}}function ve({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=PT(e)),t!=null&&!Co(t)&&(r=BT(r,UT(t))),n&&(r=BT(r,$T))),{...i,...(t===null||Co(t))&&{sort:t},initializer:BT(r,o)}}function CT(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,je(n),r,i)}}function BT(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 X1(e,t){return(e.initializer!=null?ve:gn)(e,t)}function Pk(e,t){return X1(t,PT(e))}function PT(e){return(t,n)=>{let r=dt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function $k({sort:e,...t}={}){return{...X1(t,$T),sort:Co(e)?e:null}}function $T(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function Uk({seed:e,sort:t,...n}={}){return{...X1(n,zk(e==null?Math.random:al(e))),sort:Co(t)?t:null}}function H1(e,{sort:t,...n}={}){return{...(qr(e)&&e.channel!==void 0?ve:X1)(n,UT(e)),sort:Co(t)?t:null}}function UT(e){return(typeof e=="function"&&e.length!==1?PH:zk)(e)}function PH(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function zk(e){let t,n;({channel:t,value:e,order:n}={...mi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?gl:hn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=hn;break;case"descending":n=gl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=dt(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 hm(e,t){return Q1(null,null,e,t)}function Ja(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return Q1(n,null,e,t)}function tc(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return Q1(null,n,e,t)}function pm(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Le(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return Q1(n,r,e,t)}function Q1(e,t,{data:n=J1,filter:r,sort:i,reverse:o,...s}={},a={}){s=jT(s,a),n=Gk(n,W),i=i==null?void 0:Vk("sort",i,a),r=r==null?void 0:Yk("filter",r,a);let[c,l]=kn(e),[u,f]=kn(t),{z:d,fill:h,stroke:p,x1:y,x2:g,y1:m,y2:b,...x}=a,[_,v]=kn(d),[w]=Ne(h),[T]=Ne(p),[M,R]=kn(w),[I,E]=kn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:M||h},..."stroke"in a&&{stroke:I||p},...gn(x,(O,F,S)=>{let A=_l(dt(O,e),S?.x),N=_l(dt(O,t),S?.y),D=dt(O,d),B=dt(O,w),C=dt(O,T),P=mm(s,{z:D,fill:B,stroke:C}),$=[],U=[],X=A&&l([]),tt=N&&f([]),nt=D&&v([]),st=B&&R([]),Y=C&&E([]),rt=0;for(let j of s)j.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let j of F){let H=[];for(let ot of s)ot.scope("facet",j);i&&i.scope("facet",j),r&&r.scope("facet",j);for(let[ot,z]of Ka(j,P))for(let[Nt,lt]of Ka(z,N))for(let[Wt,Xt]of Ka(lt,A)){let et={data:O};if(A&&(et.x=Wt),N&&(et.y=Nt),!(r&&!r.reduce(Xt,et))){H.push(rt++),U.push(n.reduceIndex(Xt,O,et)),A&&X.push(Wt),N&&tt.push(Nt),D&&nt.push(P===D?ot:D[Xt[0]]),B&&st.push(P===B?ot:B[Xt[0]]),C&&Y.push(P===C?ot:C[Xt[0]]);for(let oe of s)oe.reduce(Xt,et);i&&i.reduce(Xt,et)}}$.push(H)}return qT($,i,o),{data:U,facets:$}}),...!$o(s,"x")&&(c?{x:c}:{x1:y,x2:g}),...!$o(s,"y")&&(u?{y:u}:{y1:m,y2:b}),...Object.fromEntries(s.map(({name:O,output:F})=>[O,F]))}}function $o(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function zT(e,t,n=Z1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",VH]),t.href!=null&&e.href===void 0&&r.push(["href",t_]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?$H(i):n(i,o,t))}function Z1(e,t,n,r=K1){let i;mn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=yn(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 $H(e){return{name:e,initialize(){},scope(){},reduce(){}}}function K1(e,t,n,r=wf){let i=V1(e,n),o=r(t,i),s,a;return{label:Fn(o===dm?null:i,o.label),initialize(c){s=i===void 0?c:dt(c,i),o.scope==="data"&&(a=o.reduceIndex(ir(c),s))},scope(c,l){o.scope===c&&(a=o.reduceIndex(l,s))},reduce(c,l){return o.scope==null?o.reduceIndex(c,s,l):o.reduceIndex(c,s,a,l)}}}function Ka(e,t){return t?mo(cn(e,n=>t[n]),js):[[,e]]}function wf(e,t,n=UH){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&mn(e))return jH(e);if(typeof e=="function")return qH(e);if(/^p\d{2}$/i.test(e))return Ws(pf(e));switch(`${e}`.toLowerCase()){case"first":return t_;case"last":return YH;case"identity":return J1;case"count":return dm;case"distinct":return GH;case"sum":return t==null?dm:WH;case"proportion":return qk(t,"data");case"proportion-facet":return qk(t,"facet");case"deviation":return Ws(ii);case"min":return Ws(ae);case"min-index":return Ws(D0);case"max":return Ws(Ut);case"max-index":return Ws(F0);case"mean":return jk(vs);case"median":return jk(zi);case"variance":return Ws(Aa);case"mode":return Ws(Su)}return n(e)}function UH(e){throw new Error(`invalid reduce: ${e}`)}function jT(e,t){return zT(e,t,Vk)}function Vk(e,t,n){return Z1(e,t,n,Yk)}function Yk(e,t,n){return K1(e,t,n,Gk)}function Gk(e,t){return wf(e,t,zH)}function zH(e){switch(`${e}`.toLowerCase()){case"x":return XH;case"y":return HH}throw new Error(`invalid group reduce: ${e}`)}function mm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function qT(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>hn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function jH(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function qH(e){return{reduceIndex(t,n,r){return e(um(n,t),r)}}}function Ws(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function jk(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Re(n)?new Date(r):r}}}var J1={reduceIndex(e,t){return um(t,e)}},t_={reduceIndex(e,t){return t[e[0]]}},VH={reduceIndex(e,t){let r=mo(Ui(e,o=>o.length,o=>t[o]),Xa),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`,Mn(o,Xa)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
15
- `)}},YH={reduceIndex(e,t){return t[e[e.length-1]]}},dm={label:"Frequency",reduceIndex(e){return e.length}},GH={label:"Distinct",reduceIndex(e,t){let n=new Cr;for(let r of e)n.add(t[r]);return n.size}},WH=Ws(Mn);function qk(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>Mn(n,o=>r[o])/i}}var XH={reduceIndex(e,t,{x:n}){return n}},HH={reduceIndex(e,t,{y:n}){return n}};function Wk(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function vf(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Fn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),YT(a,{scale:t,type:n,value:dt(e,r),label:s,filter:i,hint:o})}function e_(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,vf(t,r,n)]))}function Sf(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:Yt(o,s)]}));return n.channels=e,n}function YT(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&&G1(r,Za)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&G1(r,Rk)?null:"opacity";break;case"symbol":n!==!0&&G1(r,Ck)?(t.scale=null,t.value=Yt(r,_f)):t.scale="symbol";break;default:t.scale=ue.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!ue.has(n))throw new Error(`unknown scale: ${n}`);return t}function Hk(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!ue.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=mi(i[l]),y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?Zk:Qk:KH(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?ZH(t,r[l]):QH(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let m=g.value,[b=0,x=1/0]=or(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let _=Array.from(new Cr(m));return d&&(_=_.reverse()),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_};else{let _=u==="data"?e:u==="height"?Xk(n,"y1","y2"):u==="width"?Xk(n,"x1","x2"):VT(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=wf(h===!0?"max":h,_);g.domain=()=>{let w=_2(ir(m),T=>v.reduceIndex(T,_),T=>m[T]);return f&&w.sort(f),d&&w.reverse(),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w.map(js)}}}}function QH(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function ZH(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 Xk(e,t,n){let r=VT(e,t),i=VT(e,n);return Yt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function VT(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 KH(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return Qk;case"descending":return Zk}throw new Error(`invalid order: ${e}`)}function Qk([e,t],[n,r]){return hn(t,r)||hn(e,n)}function Zk([e,t],[n,r]){return gl(t,r)||hn(e,n)}function ym(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function n_(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var JH=n_(e=>new Intl.NumberFormat(e)),tQ=n_((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),eQ=n_((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function nQ(e="en-US"){let t=JH(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function Kk(e="en-US",t="short"){let n=tQ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function Jk(e="en-US",t="short"){let n=eQ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function GT(e){return yu(e,"Invalid Date")}function rQ(e="en-US"){let t=nQ(e);return n=>(n instanceof Date?GT:typeof n=="number"?t:ze)(n)}var Yi=rQ();var WT=0,XT;function t8(){let e=WT;return WT=0,XT=void 0,e}function qn(e){e!==XT&&(XT=e,console.warn(e),++WT)}var Oe=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,iQ=0;function r_(){return`plot-clip-${++iQ}`}function i_(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:y,strokeDashoffset:g,opacity:m,mixBlendMode:b,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:M,fill:R="currentColor",fillOpacity:I,stroke:E="none",strokeOpacity:O,strokeWidth:F,strokeLinecap:S,strokeLinejoin:A,strokeMiterlimit:N,paintOrder:D}){R===null&&(a=null,c=null),E===null&&(l=null,f=null),ne(R)?!ne(E)&&(!ne(a)||T?.fill)&&(E="none"):ne(E)&&(!ne(l)||T?.stroke)&&(R="none");let[B,C]=Ne(a,R),[P,$]=ie(c,I),[U,X]=Ne(l,E),[tt,nt]=ie(f,O),[st,Y]=ie(m);Gs(X)||(u===void 0&&(u=F),h===void 0&&(h=S),d===void 0&&(d=A),p===void 0&&!Ok(d)&&(p=N),!Gs(C)&&_===void 0&&(_=D));let[rt,j]=ie(u);return R!==null&&(e.fill=ce(C,"currentColor"),e.fillOpacity=gm($,1)),E!==null&&(e.stroke=ce(X,"none"),e.strokeWidth=gm(j,1),e.strokeOpacity=gm(nt,1),e.strokeLinejoin=ce(d,"miter"),e.strokeLinecap=ce(h,"butt"),e.strokeMiterlimit=gm(p,4),e.strokeDasharray=ce(y,"none"),e.strokeDashoffset=ce(g,"0")),e.target=ze(s),e.ariaLabel=ze(M),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=gm(Y,1),e.mixBlendMode=ce(b,"normal"),e.imageFilter=ce(x,"none"),e.paintOrder=ce(_,"normal"),e.pointerEvents=ce(v,"auto"),e.shapeRendering=ce(w,"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:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function oQ(e,t){t&&e.filter(n=>sm(t[n])).append("title").call(aQ,t)}function sQ(e,t){t&&e.filter(([n])=>sm(t[n])).append("title").call(cQ,t)}function aQ(e,t){t&&e.text(n=>Yi(t[n]))}function cQ(e,t){t&&e.text(([n])=>Yi(t[n]))}function Qt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ct(e,"aria-label",d=>r[d]),o&&ct(e,"fill",d=>o[d]),s&&ct(e,"fill-opacity",d=>s[d]),a&&ct(e,"stroke",d=>a[d]),c&&ct(e,"stroke-opacity",d=>c[d]),l&&ct(e,"stroke-width",d=>l[d]),u&&ct(e,"opacity",d=>u[d]),f&&e8(e,d=>f[d],t),n||oQ(e,i)}function Il(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ct(e,"aria-label",([d])=>r[d]),o&&ct(e,"fill",([d])=>o[d]),s&&ct(e,"fill-opacity",([d])=>s[d]),a&&ct(e,"stroke",([d])=>a[d]),c&&ct(e,"stroke-opacity",([d])=>c[d]),l&&ct(e,"stroke-width",([d])=>l[d]),u&&ct(e,"opacity",([d])=>u[d]),f&&e8(e,([d])=>f[d],t),n||sQ(e,i)}function lQ({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 bm(e,t,n){let r=cn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&qn("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*o_(e,t,n,r){let{z:i}=n,{z:o}=r,s=lQ(r,n),a=[...t,...s];for(let c of o?bm(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ue(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Vs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Vs(s[d][f])!==l[d]){yield u,l=s.map(p=>Vs(p[f])),u=[f];continue t}}u&&(yield u)}}function s_(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ze(e,"clip",["frame","sphere"])),e}function uQ(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=r_();i=`url(#${d})`,e=at("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=r_();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",Rn(s)({type:"Sphere"}));break}}ct(e,"aria-label",t.ariaLabel),ct(e,"aria-description",t.ariaDescription),ct(e,"aria-hidden",t.ariaHidden),ct(e,"clip-path",i)}function Mt(e,t,n,r){uQ(e,t,n,r),ct(e,"fill",t.fill),ct(e,"fill-opacity",t.fillOpacity),ct(e,"stroke",t.stroke),ct(e,"stroke-width",t.strokeWidth),ct(e,"stroke-opacity",t.strokeOpacity),ct(e,"stroke-linejoin",t.strokeLinejoin),ct(e,"stroke-linecap",t.strokeLinecap),ct(e,"stroke-miterlimit",t.strokeMiterlimit),ct(e,"stroke-dasharray",t.strokeDasharray),ct(e,"stroke-dashoffset",t.strokeDashoffset),ct(e,"shape-rendering",t.shapeRendering),ct(e,"filter",t.imageFilter),ct(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ct(e,"pointer-events",i)}function Tt(e,t){fQ(e,"mix-blend-mode",t.mixBlendMode),ct(e,"opacity",t.opacity)}function e8(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(oi.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(oi.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ct(e,t,n){n!=null&&e.attr(t,n)}function fQ(e,t,n){n!=null&&e.style(t,n)}function bt(e,t,{x:n,y:r},i=Oe,o=Oe){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 ce(e,t){if((e=ze(e))!==t)return e}function gm(e,t){if((e=It(e))!==t)return e}var dQ=/^-?([_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 If(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!dQ.test(e))throw new Error(`invalid class name: ${e}`);return e}function Tf(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 bn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}function ec(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:s_(n)}}function at(e,{document:t}){return zt(Is(e).call(t.documentElement))}var r8=Math.PI,Xs=2*r8,n8=.618;function i8({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(mn(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}=o8(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:y}=s,g=u-d-h-o-r,m=f-p-y-n-i;if(e=e?.({width:g,height:m,clip:l,...a}),e==null)return;l=hQ(l,d,p,u-h,f-y);let b=d+o,x=p+n,_;if(c!=null){let[[v,w],[T,M]]=Rn(e).bounds(c),R=Math.min(g/(T-v),m/(M-w));R>0?(b-=(R*(v+T)-g)/2,x-=(R*(w+M)-m)/2,_=ol({point(I,E){this.stream.point(I*R+b,E*R+x)}})):qn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=b===0&&x===0?s8():ol({point(v,w){this.stream.point(v+b,w+x)}}),{stream:v=>e.stream(_.stream(l(v)))}}function o8(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Gi(GS,.7463,.4673);case"albers":return a_(bp,.7463,.4673);case"azimuthal-equal-area":return Gi(XS,4,4);case"azimuthal-equidistant":return Gi(QS,Xs,Xs);case"conic-conformal":return a_(JS,Xs,Xs);case"conic-equal-area":return a_(Pa,6.1702,2.9781);case"conic-equidistant":return a_(eI,7.312,3.6282);case"equal-earth":return Gi(rI,5.4133,2.6347);case"equirectangular":return Gi(tI,Xs,r8);case"gnomonic":return Gi(oI,3.4641,3.4641);case"identity":return{type:s8};case"reflect-y":return{type:pQ};case"mercator":return Gi(ZS,Xs,Xs);case"orthographic":return Gi(aI,2,2);case"stereographic":return Gi(lI,2,2);case"transverse-mercator":return Gi(fI,Xs,Xs);default:throw new Error(`unknown projection type: ${e}`)}}function hQ(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 ju(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Gi(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function a_(e,t,n){let{type:r,aspectRatio:i}=Gi(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var s8=pn({stream:e=>e}),pQ=pn(ol({point(e,t){this.stream.point(e,-t)}}));function HT(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 a8({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(mn(e)&&(e=e.type),e!=null)}function c8(e){if(typeof e?.stream=="function")return n8;if(mn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=o8(e);if(t)return t}return n8}}function nc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Sf(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&HT("x","y",o,n),r&&(o.x=Qe(o.x)),i&&(o.y=Qe(o.y)),o}function l8(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)$r(s,o);return[r,i]}var mQ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],p8=new Map([["accent",LI],["category10",DI],["dark2",CI],["observable10",mQ],["paired",BI],["pastel1",PI],["pastel2",$I],["set1",UI],["set2",zI],["set3",jI],["tableau10",qI]]);function m8(e){return e!=null&&p8.has(`${e}`.toLowerCase())}var u8=new Map([...p8,["brbg",Hs(xx,_x)],["prgn",Hs(wx,vx)],["piyg",Hs(Sx,Ix)],["puor",Hs(Tx,Ex)],["rdbu",Hs(zp,tf)],["rdgy",Hs(Ax,Mx)],["rdylbu",Hs(jp,ef)],["rdylgn",Hs(Nx,Rx)],["spectral",Hs(Ox,kx)],["burd",f8(zp,tf)],["buylrd",f8(jp,ef)],["blues",xn(r1,i1)],["greens",xn(o1,s1)],["greys",xn(a1,c1)],["oranges",xn(h1,p1)],["purples",xn(l1,u1)],["reds",xn(f1,d1)],["turbo",Qs(S1)],["viridis",Qs(T1)],["magma",Qs(E1)],["inferno",Qs(A1)],["plasma",Qs(M1)],["cividis",Qs(m1)],["cubehelix",Qs(y1)],["warm",Qs(b1)],["cool",Qs(x1)],["bugn",xn(Fx,Dx)],["bupu",xn(Lx,Cx)],["gnbu",xn(Bx,Px)],["orrd",xn($x,Ux)],["pubu",xn(qx,Vx)],["pubugn",xn(zx,jx)],["purd",xn(Yx,Gx)],["rdpu",xn(Wx,Xx)],["ylgn",xn(Zx,Kx)],["ylgnbu",xn(Hx,Qx)],["ylorbr",xn(Jx,t1)],["ylorrd",xn(e1,n1)],["rainbow",d8(_1)],["sinebow",d8(v1)]]);function xn(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Cn(t,n):e[n])}function Hs(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(t,n):e[n])}function f8(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(r=>t(1-r),n):e[n].slice().reverse())}function Qs(e){return({length:t})=>Cn(e,Math.max(2,Math.floor(t)))}function d8(e){return({length:t})=>Cn(e,Math.floor(t)+1).slice(0,-1)}function QT(e){let t=`${e}`.toLowerCase();if(!u8.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return u8.get(t)}function xm(e,t){let n=QT(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function y8(e,t="greys"){let n=new Set,[r,i]=xm(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 h8=new Map([["brbg",_x],["prgn",vx],["piyg",Ix],["puor",Ex],["rdbu",tf],["rdgy",Mx],["rdylbu",ef],["rdylgn",Rx],["spectral",kx],["burd",e=>tf(1-e)],["buylrd",e=>ef(1-e)],["blues",i1],["greens",s1],["greys",c1],["purples",u1],["reds",d1],["oranges",p1],["turbo",S1],["viridis",T1],["magma",E1],["inferno",A1],["plasma",M1],["cividis",m1],["cubehelix",y1],["warm",b1],["cool",x1],["bugn",Dx],["bupu",Cx],["gnbu",Px],["orrd",Ux],["pubugn",jx],["pubu",Vx],["purd",Gx],["rdpu",Xx],["ylgnbu",Qx],["ylgn",Kx],["ylorbr",t1],["ylorrd",n1],["rainbow",_1],["sinebow",v1]]);function Ef(e){let t=`${e}`.toLowerCase();if(!h8.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return h8.get(t)}var yQ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function g8(e){return e!=null&&yQ.has(`${e}`.toLowerCase())}var KT=e=>t=>e(1-t),ZT=[0,1],b8=new Map([["number",_e],["rgb",si],["hsl",G2],["hcl",W2],["lab",nb]]);function JT(e){let t=`${e}`.toLowerCase();if(!b8.has(t))throw new Error(`unknown interpolator: ${t}`);return b8.get(t)}function Mf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=E8(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=ue.get(e)===wl?_Q(n,a):ue.get(e)===vl?wQ(n,a):ue.get(e)===Sl?ZT:void 0,interpolate:h=ue.get(e)===Vr?u==null&&d!==void 0?si:Ef(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Qc:_e,reverse:p}){if(f=Bo(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=JT(h)),p=!!p,d!==void 0){let y=(a=je(a)).length,g=(d=je(d)).length;if(y!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=xo(h,d),d=void 0}}if(h.length===1?(p&&(h=KT(h),p=!1),d===void 0&&(d=Float64Array.from(a,(y,g)=>g/(a.length-1)),d.length===2&&(d=ZT)),t.interpolate((d===ZT?pn:_m)(h))):t.interpolate(h),s){let[y,g]=se(a);(y>0||g<0)&&(a=Ha(a),zs(a)!==Math.sign(y)?a[a.length-1]=0:a[0]=0)}return p&&(a=Na(a)),t.domain(a).unknown(c),i&&(t.nice(gQ(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 gQ(e,t){return e===!0?void 0:typeof e=="number"?e:Ik(e,t)}function x8(e,t,n){return Mf(e,ks(),t,n)}function _8(e,t,n){return tE(e,t,{...n,exponent:.5})}function tE(e,t,{exponent:n=1,...r}){return Mf(e,Rp().exponent(n),t,{...r,type:"pow"})}function w8(e,t,{base:n=10,domain:r=vQ(t),...i}){return Mf(e,Mp().base(n),t,{...i,domain:r})}function v8(e,t,{constant:n=1,...r}){return Mf(e,Np().constant(n),t,r)}function S8(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=SQ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Cn(c,i):ue.get(e)===Vr?xm(o,i):void 0),s.length>0&&(s=Op(s,n===void 0?{length:i}:n).quantiles()),c_(e,t,{domain:s,range:n,reverse:l,unknown:a})}function I8(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=E8(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=se(o),f;return n===void 0?(f=An(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?Cn(a,r):ue.get(e)===Vr?xm(i,r):void 0):(f=Cn(_e(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),zs(je(o))<0&&f.reverse(),c_(e,t,{domain:f,range:n,reverse:c,unknown:s})}function c_(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Cn(o,n.length+1):ue.get(e)===Vr?xm(i,n.length+1):void 0,reverse:a}){n=je(n);let c=zs(n);if(!isNaN(c)&&!bQ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Na(s)),{type:"threshold",scale:kp(c<0?Na(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function bQ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Wn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function T8(e){return{type:"identity",scale:Lk(ue.get(e))?Ep():t=>t}}function Af(e,t=uf){return e.length?[ae(e,({value:n})=>n===void 0?n:ae(n,t)),Ut(e,({value:n})=>n===void 0?n:Ut(n,t))]:[0,1]}function E8(e,t){let n=ue.get(e);return(n===wl||n===Sl||n===vl?xQ:Af)(t)}function xQ(e){return[0,e.length?Ut(e,({value:t})=>t===void 0?t:Ut(t,uf)):1]}function _Q(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Hn(e,.5,({value:s})=>s===void 0?NaN:Hn(s,.25,rr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Ut(i);return o<1?i.map(s=>s*o):i}function wQ(e,t){let n=zi(e,({value:o})=>o===void 0?NaN:zi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Ut(r);return i<1?r.map(o=>o*i):r}function vQ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Af(e,rr);if(n<0)return Af(e,qa)}return[1,10]}function SQ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function _m(e){return(t,n)=>r=>e(t+r*(n-t))}function l_(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Af(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=ue.get(e)===Vr?u==null&&f!==void 0?si:Ef(u!==void 0?u:"rdbu"):_e,reverse:p}){l=+l,a=je(a);let[y,g]=a;if(a.length>2&&qn(`Warning: the diverging ${e} scale domain contains extra elements.`),Wn(y,g)<0&&([y,g]=[g,y],p=!p),y=Math.min(y,l),g=Math.max(g,l),typeof h!="function"&&(h=JT(h)),f!==void 0&&(h=h.length===1?_m(h)(...f):xo(h,f)),p&&(h=KT(h)),d){let m=n.apply(l),b=m-n.apply(y),x=n.apply(g)-m;b<x?y=n.invert(m-x):b>x&&(g=n.invert(m+b))}return t.domain([y,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[y,g],pivot:l,interpolate:h,scale:t}}function A8(e,t,n){return l_(e,Up(),IQ,t,n)}function M8(e,t,n){return eE(e,t,{...n,exponent:.5})}function eE(e,t,{exponent:n=1,...r}){return l_(e,bx().exponent(n=+n),AQ(n),t,{...r,type:"diverging-pow"})}function N8(e,t,{base:n=10,pivot:r=1,domain:i=Af(t,r<0?qa:rr),...o}){return l_(e,yx().base(n=+n),TQ,t,{domain:i,pivot:r,...o})}function R8(e,t,{constant:n=1,...r}){return l_(e,gx().constant(n=+n),MQ(n),t,r)}var IQ={apply(e){return e},invert(e){return e}},TQ={apply:Math.log,invert:Math.exp},EQ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function AQ(e){return e===.5?EQ:{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 MQ(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 O8(e,t,n,r){return Mf(e,t,n,r)}function k8(e,t,n){return O8(e,hx(),t,n)}function F8(e,t,n){return O8(e,px(),t,n)}var Nf=Symbol("ordinal");function L8(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Bo(i,r),o===void 0&&(o=U8(n,i,e)),(r==="categorical"||r===Nf)&&(r="ordinal"),a&&(o=Na(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 C8(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=Bo(r,n),i===void 0&&(i=U8(t,r,e));let l;if(ue.get(e)===xf)l=NQ(t),o=o===void 0?RQ(l):Yt(o,_f);else if(ue.get(e)===Vr&&(o===void 0&&(n==="ordinal"||n===Nf)&&(o=y8(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=Ef(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Cn(p=>u(f+d*p),h)}else o=QT(s);if(a===Ip)throw new Error(`implicit unknown on ${e} scale is not supported`);return L8(e,cl().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function B8(e,t,{align:n=.5,padding:r=.5,...i}){return $8(bI().align(n).padding(r),t,i,e)}function P8(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return $8(Ua().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function $8(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=L8(r,e,t,n),e.round=i,e}function U8(e,t,n){let r=new Cr;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]=se(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&ue.get(n)===yi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return mo(r,hn)}function D8(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 NQ(e){return{fill:D8(e,"fill"),stroke:D8(e,"stroke")}}function RQ(e){return ne(e.fill)?QI:D1}function wm(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}={},...y}={}){let g={};for(let[m,b]of e){let x=y[m],_=X8(m,b,{round:ue.get(m)===yi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=m==="fx"||m==="fy"?p:t,percent:w,transform:T,inset:M,insetTop:R=M!==void 0?M:m==="y"?r:0,insetRight:I=M!==void 0?M:m==="x"?i:0,insetBottom:E=M!==void 0?M:m==="y"?o:0,insetLeft:O=M!==void 0?M:m==="x"?s:0}=x||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?OQ(b,_):v,_.transform=T,m==="x"||m==="fx"?(_.insetLeft=+O,_.insetRight=+I):(m==="y"||m==="fy")&&(_.insetTop=+R,_.insetBottom=+E),g[m]=_}}return g}function rE(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]=Q8(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function Y8(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?d_(t):t;i&&z8(i,s),o&&j8(o,s);let a=i||o?iE(e,t):t;n&&z8(n,a),r&&j8(r,a)}function OQ(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!Uo(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function f_(e){return Math.sign(zs(e.domain()))*Math.sign(zs(e.range()))}function d_(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 iE({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=d_(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 z8(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)],Uo(e)||(e.range=W8(e)),e.scale.range(e.range)}G8(e)}function j8(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],Uo(e)?e.range.reverse():e.range=W8(e),e.scale.range(e.range)}G8(e)}function G8(e){e.round===void 0&&DQ(e)&&kQ(e)<=30&&e.scale.round(!0)}function kQ({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 W8(e){let t=e.scale.domain().length+oE(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 h_(e,t,n){return X8(e,n===void 0?void 0:[{hint:n}],{...t})}function X8(e,t=[],n={}){let r=FQ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Uo({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Re)?qn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Rf(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Rf(r)}".`):i.some(Mk)?qn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${Rf(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Rf(r)}".`):i.some(Nk)&&qn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${Rf(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Rf(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=u_(t,n,Qe);break;case"identity":switch(ue.get(e)){case yi:n=u_(t,n,Qe);break;case xf:n=u_(t,n,LQ);break}break;case"utc":case"time":n=u_(t,n,Sk);break}switch(r){case"diverging":return A8(e,t,n);case"diverging-sqrt":return M8(e,t,n);case"diverging-pow":return eE(e,t,n);case"diverging-log":return N8(e,t,n);case"diverging-symlog":return R8(e,t,n);case"categorical":case"ordinal":case Nf:return C8(e,t,n);case"cyclical":case"sequential":case"linear":return x8(e,t,n);case"sqrt":return _8(e,t,n);case"threshold":return c_(e,t,n);case"quantile":return S8(e,t,n);case"quantize":return I8(e,t,n);case"pow":return tE(e,t,n);case"log":return w8(e,t,n);case"symlog":return v8(e,t,n);case"utc":return F8(e,t,n);case"time":return k8(e,t,n);case"point":return B8(e,t,n);case"band":return P8(e,t,n);case"identity":return T8(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Rf(e){return typeof e=="symbol"?e.description:e}function q8(e){return typeof e=="string"?`${e}`.toLowerCase():e}var V8={toString:()=>"projection"};function FQ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=q8(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=V8);for(let l of t){let u=q8(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===V8)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=ue.get(e);if(c===wl)return"sqrt";if(c===Sl||c===vl)return"linear";if(c===xf)return"ordinal";if((r||i||[]).length>2)return nE(c);if(r!==void 0){if(Te(r))return nE(c);if(Re(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Te))return nE(c);if(l.some(Re))return"utc"}if(c===Vr){if(s!=null||g8(o))return"diverging";if(m8(o))return"categorical"}return"linear"}function nE(e){switch(e){case yi:return"point";case Vr:return Nf;default:return"ordinal"}}function Uo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Nf}function oE({type:e}){return e==="threshold"}function DQ({type:e}){return e==="point"||e==="band"}function sr(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 u_(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 LQ(e){return Yt(e,_f)}function zo(e={}){let t;for(let n in e)if(ue.has(n)&&Lo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Q8(h_(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function H8(e){return t=>{if(!ue.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Q8({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:Ha(n),...r!==void 0&&{range:Ha(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 K8(e,t,n={}){let r=.5-Oe,i=.5+Oe,o=.5+Oe,s=.5-Oe;for(let{marginTop:y,marginRight:g,marginBottom:m,marginLeft:b}of t)y>r&&(r=y),g>i&&(i=g),m>o&&(o=m),b>s&&(s=b);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=CQ(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:y,marginTop:g=y!==void 0?y:c,marginRight:m=y!==void 0?y:l,marginBottom:b=y!==void 0?y:u,marginLeft:x=y!==void 0?y:f}=n.facet??{};g=+g,m=+m,b=+b,x=+x,p.facet={marginTop:g,marginRight:m,marginBottom:b,marginLeft:x}}return p}function CQ({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=c8(i);if(d){let p=r?r.scale.domain().length:1,y=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,y));return Math.round((s-u-c)*g+a+l)}let h=t?Uo(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=Z8("y",t)/(Z8("x",e)*o),y=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,m=y*(s-u-c)-e.insetLeft-e.insetRight;return(p*m+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function Z8(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]=se(r);return Math.abs(i(s)-i(o))}function tF(e,t){let{fx:n,fy:r}=wm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?R0(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 eF(e,{x:t,y:n}){return t&&=uE(t),n&&=uE(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 m_(e,{fx:t,fy:n}){let r=ir(e),i=t?.value,o=n?.value;return t&&n?Ui(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ui(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Ui(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function nF(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 rF(e){let t=[],n=new Uint32Array(Mn(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 BQ=new Map([["top",sE],["right",lE],["bottom",aE],["left",cE],["top-left",p_(sE,cE)],["top-right",p_(sE,lE)],["bottom-left",p_(aE,cE)],["bottom-right",p_(aE,lE)],["top-empty",$Q],["right-empty",jQ],["bottom-empty",UQ],["left-empty",zQ],["empty",qQ]]);function iF(e){if(e==null)return null;let t=BQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var J8=new WeakMap;function uE(e){let t=J8.get(e);return t||J8.set(e,t=new Xn(Yt(e,(n,r)=>[n,r]))),t}function rc(e,t){return uE(e).get(t)}function PQ(e,t,n){return t=Vs(t),n=Vs(n),e.find(r=>Object.is(Vs(r.x),t)&&Object.is(Vs(r.y),n))}function y_(e,t,n){return PQ(e,t,n)?.empty}function sE(e,{y:t},{y:n}){return t?rc(t,n)===0:!0}function aE(e,{y:t},{y:n}){return t?rc(t,n)===t.length-1:!0}function cE(e,{x:t},{x:n}){return t?rc(t,n)===0:!0}function lE(e,{x:t},{x:n}){return t?rc(t,n)===t.length-1:!0}function $Q(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,r);if(o>0)return y_(e,n,t[o-1])}function UQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,r);if(o<t.length-1)return y_(e,n,t[o+1])}function zQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,n);if(o>0)return y_(e,t[o-1],r)}function jQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,n);if(o<t.length-1)return y_(e,t[o+1],r)}function qQ(e,t,{empty:n}){return n}function p_(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function g_(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 mt=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:y=d,marginLeft:g=d,clip:m=i?.clip,channels:b,tip:x,render:_}=r;if(this.data=t,this.sort=Co(l)?l:null,this.initializer=ve(r).initializer,this.transform=this.initializer?r.transform:gn(r).transform,o===null||o===!1?this.facet=null:(this.facet=Ze(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Wa&&typeof a=="string"?[a]:a,this.fy=t===Wa&&typeof c=="string"?[c]:c),this.facetAnchor=iF(s),n=fm(n),b!==void 0&&(n={...VQ(b),...n}),i!==void 0&&(n={...i_(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,w])=>{if(qr(w.value)){let{value:T,label:M=w.label,scale:R=w.scale}=w.value;w={...w,label:M,scale:R,value:T}}if(t===Wa&&typeof w.value=="string"){let{value:T}=w;w={...w,value:[T]}}return[v,w]}).filter(([v,{value:w,optional:T}])=>{if(w!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+y,this.marginLeft=+g,this.clip=s_(m),this.tip=YQ(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}=n[v];if(!(w!=="x"&&w!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=Of(_,this.render))}initialize(t,n,r){let i=je(this.data);t===void 0&&i!=null&&(t=[ir(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=je(i)),t!==void 0&&(t.original=o);let s=e_(this.channels,i);return this.sort!=null&&Hk(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ue}=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"&&HT(i,o,n,r.projection)}}scale(t,n,r){let i=Sf(t,n);return r.projection&&this.project(t,i,r),i}};function Ke(...e){return e.plot=mt.prototype.plot,e}function Of(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 VQ(e){return Object.fromEntries(Object.entries(fm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:mi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function YQ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ze(e,"tip",["x","y","xy"]):e}function Wi(e,t){return e?.tip===!0?{...e,tip:t}:mn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var oF=new WeakMap;function fE(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:Of(function(u,f,d,h,p,y){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:m}=p.getMarkState(this),b=oF.get(g);b||oF.set(g,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,M=w?w(u.fx)-h.marginLeft:0,R=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(M+=_.bandwidth()/2),v?.bandwidth&&(R+=v.bandwidth()/2);let I=u.fi!=null,E;if(I){let Y=b.facetStates;Y||(b.facetStates=Y=new Map),E=Y.get(this),E||Y.set(this,E=new Map)}let[O,F]=bn(this,h),{px:S,py:A}=d,N=S?Y=>S[Y]:dE(d,O),D=A?Y=>A[Y]:hE(d,F),B,C,P,$;function U(Y,rt){if(I)if($&&($=cancelAnimationFrame($)),Y==null)E.delete(u.fi);else{E.set(u.fi,rt),$=requestAnimationFrame(()=>{$=null;for(let[j,H]of E)if(H<rt||H===rt&&j<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===b.sticky)return;B=Y,P=p.pointerSticky=b.sticky;let rt=B==null?[]:[B];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let j=y(rt,f,d,h,p);if(C){if(I){let H=C.parentNode,ot=C.getAttribute("transform"),z=j.getAttribute("transform");ot?j.setAttribute("transform",ot):j.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),j.removeAttribute("aria-label"),j.removeAttribute("aria-description"),j.removeAttribute("aria-hidden")}C.replaceWith(j)}return b.roots[x]=C=j,B==null&&E?.size>1||p.dispatchValue(B==null?null:m[B]),j}function tt(Y){if(b.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,j]=Ln(Y);rt-=M,j-=R;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=j<h.marginTop||j>h.height-h.marginBottom?1:t,z=null,Nt=s*s;for(let lt of u){let Wt=H*(N(lt)-rt),Xt=ot*(D(lt)-j),et=Wt*Wt+Xt*Xt;et<=Nt&&(z=lt,Nt=et)}if(z!=null&&(e!==1||t!==1)){let lt=N(z)-rt,Wt=D(z)-j;Nt=lt*lt+Wt*Wt}U(z,Nt)}function nt(Y){Y.pointerType==="mouse"&&B!=null&&(b.sticky&&b.roots.some(rt=>rt?.contains(Y.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(rt=>rt(null))):(b.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(b.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",st),X(null)},c)}}function kf(e){return fE(1,1,e)}function Ff(e){return fE(1,.01,e)}function Tl(e){return fE(.01,1,e)}function dE({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function hE({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function b_(e){return Uo(e)&&e.interval===void 0?void 0:"tabular-nums"}function sF(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=b_(e),round:p=!0,opacity:y,className:g}=t,m=ec(t);g=If(g),y=ie(y)[1],d===null&&(d=()=>null);let b=at("svg",m).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${g}-ramp) {
15
+ ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let r=$t(M0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return s5("millisecond","utc",n);for(let[i,o,s,a]of gH(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return s5(i,s,n)}}function df(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-js(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var _l=Object.getPrototypeOf(Uint8Array),bH=Object.prototype.toString,$T=Symbol("reindex");function mt(e,t,n){let r=typeof t;return r==="string"?u5(e,zT(t),n):r==="function"?u5(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Yt(e,dn(t),n):typeof t?.transform=="function"?f5(t.transform(e),n):xH(f5(t,n),e?.[$T])}function xH(e,t){return t?gm(e,t):e}function u5(e,t,n){return Yt(e,n?.prototype instanceof _l?_H(t):t,n)}function f5(e,t){return t===void 0?qe(e):e instanceof t?e:t.prototype instanceof _l&&!(e instanceof _l)?t.from(e,qT):t.from(e)}function _H(e){return(t,n)=>qT(e(t,n))}var Ga=[null],zT=e=>t=>t[e],Me={transform:or},W={transform:e=>e};var ym=()=>1,d5=()=>!0,ze=e=>e==null?e:`${e}`,Nt=e=>e==null?e:+e;var Vs=e=>e?e[0]:void 0,Wa=e=>e?e[1]:void 0,h5=e=>e?e[2]:void 0,dn=e=>()=>e;function mf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Zn(n,t,r)}function Qe(e){return e instanceof _l?e:Yt(e,qT,Float64Array)}function qT(e){return e==null?NaN:Number(e)}function p5(e){return Yt(e,jT)}function jT(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?hm(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Re(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Za(e)?[void 0,e]:[e,void 0]}function ie(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function VT(e,t,n){if(e!=null)return Ke(e,t,n)}function Ke(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function qe(e){return e==null||e instanceof Array||e instanceof _l?e:Array.from(e)}function Yt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Xa(e,t=Array){return e instanceof t?e.slice():t.from(e)}function YT({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function GT({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function yf(e){return YT(e)||GT(e)||e.interval!==void 0}function hn(e){return e?.toString===bH}function Ro(e){return hn(e)&&(e.type!==void 0||e.domain!==void 0)}function $r(e){return hn(e)&&typeof e.transform!="function"}function Oo(e){return $r(e)&&e.value===void 0&&e.channel===void 0}function WT(e,t,n,r=W){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 Be(e,t){return e===void 0&&t===void 0?[Vs,Wa]:[e,t]}function zn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Re(t)),e===void 0&&([e]=Re(n)),e}function or(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function gm(e,t){return Yt(t,n=>e[n],e.constructor)}function gf(e){return e.length===1?(t,n)=>e(gm(n,t)):e}function Ys(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Gs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function F1(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 pn(e){let t;return[{transform:()=>t,label:On(e)},n=>t=n]}function Rn(e){return e==null?[e]:pn(e)}function On(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function bf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Oe(r)||Oe(i)?Yt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Yt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function wl(e,t){let n=XT(t?.interval,t?.type);return n?Yt(e,n):e}function XT(e,t){let n=xf(e,t);return n&&(r=>$e(r)?n.floor(r):r)}function xf(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>Ue(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Ue(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?PT:mm)(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 Do(e,t){if(e=xf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function m5(e,t){if(e=Do(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function y5(e){return Ha(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Ha(e){return typeof e?.range=="function"}function pi(e){return e===void 0||$r(e)?e:{value:e}}function g5(e){return e==null?null:{transform:t=>mt(t,e,Float64Array),label:On(e)}}function b5(e){if(!sr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function sr(e){return e&&typeof e[Symbol.iterator]=="function"}function L1(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ae(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Oe(e){for(let t of e)if(t!=null)return t instanceof Date}function x5(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&hm(t)}function _5(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Ws(e){for(let t of e)if(t!=null)return typeof t=="number"}function C1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var wH=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 Za(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)||wH.has(e))}function w5(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ne(e){return e==null||Xs(e)}function Xs(e){return/^\s*none\s*$/i.test(e)}function v5(e){return/^\s*round\s*$/i.test(e)}function B1(e,t){return VT(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function ko(e="middle"){return B1(e,"frameAnchor")}function js(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Xn(t,n)}function S5(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 vH(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 bm(e){return sr(e)?vH(e):e}var mi=Symbol("position"),zr=Symbol("color"),vl=Symbol("radius"),Sl=Symbol("length"),Il=Symbol("opacity"),_f=Symbol("symbol"),I5=Symbol("projection"),fe=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",vl],["color",zr],["opacity",Il],["symbol",_f],["length",Sl],["projection",I5]]);function T5(e){return e===mi||e===I5}function E5(e){return e===mi||e===vl||e===Sl||e===Il}var HT=Math.sqrt(3),ZT=2/HT,SH={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*ZT,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()}},QT=new Map([["asterisk",Qp],["circle",zs],["cross",Kp],["diamond",Jp],["diamond2",tm],["hexagon",SH],["plus",em],["square",nm],["square2",rm],["star",im],["times",sf],["triangle",om],["triangle2",sm],["wye",am]]);function KT(e){return e&&typeof e.draw=="function"}function M5(e){return KT(e)?!0:typeof e!="string"?!1:QT.has(e.toLowerCase())}function wf(e){if(e==null||KT(e))return e;let t=QT.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function A5(e){if(e==null||KT(e))return[void 0,e];if(typeof e=="string"){let t=QT.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function mn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=eE(e)),t!=null&&!Oo(t)&&(r=JT(r,rE(t))),n&&(r=JT(r,nE))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Oo(t))&&{sort:t},transform:JT(r,s)}}function Se({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=eE(e)),t!=null&&!Oo(t)&&(r=tE(r,rE(t))),n&&(r=tE(r,nE))),{...i,...(t===null||Oo(t))&&{sort:t},initializer:tE(r,o)}}function JT(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,qe(n),r,i)}}function tE(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 P1(e,t){return(e.initializer!=null?Se:mn)(e,t)}function N5(e,t){return P1(t,eE(e))}function eE(e){return(t,n)=>{let r=mt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function R5({sort:e,...t}={}){return{...P1(t,nE),sort:Oo(e)?e:null}}function nE(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function O5({seed:e,sort:t,...n}={}){return{...P1(n,D5(e==null?Math.random:cl(e))),sort:Oo(t)?t:null}}function U1(e,{sort:t,...n}={}){return{...($r(e)&&e.channel!==void 0?Se:P1)(n,rE(e)),sort:Oo(t)?t:null}}function rE(e){return(typeof e=="function"&&e.length!==1?IH:D5)(e)}function IH(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function D5(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?bl:fn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=fn;break;case"descending":n=bl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=mt(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 _m(e,t){return $1(null,null,e,t)}function Ka(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return $1(n,null,e,t)}function Ja(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return $1(null,n,e,t)}function wm(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Be(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return $1(n,r,e,t)}function $1(e,t,{data:n=j1,filter:r,sort:i,reverse:o,...s}={},a={}){s=oE(s,a),n=B5(n,W),i=i==null?void 0:L5("sort",i,a),r=r==null?void 0:C5("filter",r,a);let[c,l]=Rn(e),[u,f]=Rn(t),{z:d,fill:h,stroke:p,x1:y,x2:b,y1:m,y2:g,...x}=a,[_,v]=Rn(d),[w]=Re(h),[T]=Re(p),[A,R]=Rn(w),[I,E]=Rn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:I||p},...mn(x,(O,k,S)=>{let M=wl(mt(O,e),S?.x),N=wl(mt(O,t),S?.y),F=mt(O,d),B=mt(O,w),C=mt(O,T),P=vm(s,{z:F,fill:B,stroke:C}),U=[],$=[],X=M&&l([]),tt=N&&f([]),nt=F&&v([]),st=B&&R([]),Y=C&&E([]),rt=0;for(let q of s)q.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let q of k){let H=[];for(let ot of s)ot.scope("facet",q);i&&i.scope("facet",q),r&&r.scope("facet",q);for(let[ot,z]of Qa(q,P))for(let[Lt,dt]of Qa(z,N))for(let[Wt,Xt]of Qa(dt,M)){let et={data:O};if(M&&(et.x=Wt),N&&(et.y=Lt),!(r&&!r.reduce(Xt,et))){H.push(rt++),$.push(n.reduceIndex(Xt,O,et)),M&&X.push(Wt),N&&tt.push(Lt),F&&nt.push(P===F?ot:F[Xt[0]]),B&&st.push(P===B?ot:B[Xt[0]]),C&&Y.push(P===C?ot:C[Xt[0]]);for(let oe of s)oe.reduce(Xt,et);i&&i.reduce(Xt,et)}}U.push(H)}return sE(U,i,o),{data:$,facets:U}}),...!Fo(s,"x")&&(c?{x:c}:{x1:y,x2:b}),...!Fo(s,"y")&&(u?{y:u}:{y1:m,y2:g}),...Object.fromEntries(s.map(({name:O,output:k})=>[O,k]))}}function Fo(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function iE(e,t,n=z1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",RH]),t.href!=null&&e.href===void 0&&r.push(["href",V1]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?TH(i):n(i,o,t))}function z1(e,t,n,r=q1){let i;hn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=pn(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 TH(e){return{name:e,initialize(){},scope(){},reduce(){}}}function q1(e,t,n,r=vf){let i=F1(e,n),o=r(t,i),s,a;return{label:On(o===xm?null:i,o.label),initialize(c){s=i===void 0?c:mt(c,i),o.scope==="data"&&(a=o.reduceIndex(or(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 Qa(e,t){return t?lo(sn(e,n=>t[n]),Vs):[[,e]]}function vf(e,t,n=EH){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&hn(e))return AH(e);if(typeof e=="function")return NH(e);if(/^p\d{2}$/i.test(e))return Hs(mf(e));switch(`${e}`.toLowerCase()){case"first":return V1;case"last":return OH;case"identity":return j1;case"count":return xm;case"distinct":return DH;case"sum":return t==null?xm:kH;case"proportion":return F5(t,"data");case"proportion-facet":return F5(t,"facet");case"deviation":return Hs(ri);case"min":return Hs(ce);case"min-index":return Hs(I0);case"max":return Hs($t);case"max-index":return Hs(S0);case"mean":return k5(Ss);case"median":return k5(Bi);case"variance":return Hs(Ea);case"mode":return Hs(Su)}return n(e)}function EH(e){throw new Error(`invalid reduce: ${e}`)}function oE(e,t){return iE(e,t,L5)}function L5(e,t,n){return z1(e,t,n,C5)}function C5(e,t,n){return q1(e,t,n,B5)}function B5(e,t){return vf(e,t,MH)}function MH(e){switch(`${e}`.toLowerCase()){case"x":return FH;case"y":return LH}throw new Error(`invalid group reduce: ${e}`)}function vm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function sE(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>fn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function AH(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function NH(e){return{reduceIndex(t,n,r){return e(gm(n,t),r)}}}function Hs(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function k5(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Oe(n)?new Date(r):r}}}var j1={reduceIndex(e,t){return gm(t,e)}},V1={reduceIndex(e,t){return t[e[0]]}},RH={reduceIndex(e,t){let r=lo(Ci(e,o=>o.length,o=>t[o]),Wa),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`,En(o,Wa)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},OH={reduceIndex(e,t){return t[e[e.length-1]]}},xm={label:"Frequency",reduceIndex(e){return e.length}},DH={label:"Distinct",reduceIndex(e,t){let n=new kr;for(let r of e)n.add(t[r]);return n.size}},kH=Hs(En);function F5(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>En(n,o=>r[o])/i}}var FH={reduceIndex(e,t,{x:n}){return n}},LH={reduceIndex(e,t,{y:n}){return n}};function P5(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function Sf(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=On(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),cE(a,{scale:t,type:n,value:mt(e,r),label:s,filter:i,hint:o})}function Y1(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Sf(t,r,n)]))}function If(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:Yt(o,s)]}));return n.channels=e,n}function cE(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&&C1(r,Za)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&C1(r,w5)?null:"opacity";break;case"symbol":n!==!0&&C1(r,M5)?(t.scale=null,t.value=Yt(r,wf)):t.scale="symbol";break;default:t.scale=fe.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!fe.has(n))throw new Error(`unknown scale: ${n}`);return t}function $5(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!fe.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?q5:z5:PH(f),h==null||h===!1)continue;let b=l==="fx"||l==="fy"?BH(t,r[l]):CH(n,l);if(!b)throw new Error(`missing channel for scale: ${l}`);let m=b.value,[g=0,x=1/0]=sr(p)?p:p<0?[p]:[0,p];if(u==null)b.domain=()=>{let _=Array.from(new kr(m));return d&&(_=_.reverse()),(g!==0||x!==1/0)&&(_=_.slice(g,x)),_};else{let _=u==="data"?e:u==="height"?U5(n,"y1","y2"):u==="width"?U5(n,"x1","x2"):aE(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=vf(h===!0?"max":h,_);b.domain=()=>{let w=B2(or(m),T=>v.reduceIndex(T,_),T=>m[T]);return f&&w.sort(f),d&&w.reverse(),(g!==0||x!==1/0)&&(w=w.slice(g,x)),w.map(Vs)}}}}function CH(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function BH(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 U5(e,t,n){let r=aE(e,t),i=aE(e,n);return Yt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function aE(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 PH(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return z5;case"descending":return q5}throw new Error(`invalid order: ${e}`)}function z5([e,t],[n,r]){return fn(t,r)||fn(e,n)}function q5([e,t],[n,r]){return bl(t,r)||fn(e,n)}function Sm(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function G1(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var UH=G1(e=>new Intl.NumberFormat(e)),$H=G1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),zH=G1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function qH(e="en-US"){let t=UH(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function j5(e="en-US",t="short"){let n=$H(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function V5(e="en-US",t="short"){let n=zH(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function lE(e){return ff(e,"Invalid Date")}function jH(e="en-US"){let t=qH(e);return n=>(n instanceof Date?lE:typeof n=="number"?t:ze)(n)}var zi=jH();var uE=0,fE;function Y5(){let e=uE;return uE=0,fE=void 0,e}function qn(e){e!==fE&&(fE=e,console.warn(e),++uE)}var De=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,VH=0;function W1(){return`plot-clip-${++VH}`}function X1(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:y,strokeDashoffset:b,opacity:m,mixBlendMode:g,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:A,fill:R="currentColor",fillOpacity:I,stroke:E="none",strokeOpacity:O,strokeWidth:k,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:N,paintOrder:F}){R===null&&(a=null,c=null),E===null&&(l=null,f=null),ne(R)?!ne(E)&&(!ne(a)||T?.fill)&&(E="none"):ne(E)&&(!ne(l)||T?.stroke)&&(R="none");let[B,C]=Re(a,R),[P,U]=ie(c,I),[$,X]=Re(l,E),[tt,nt]=ie(f,O),[st,Y]=ie(m);Xs(X)||(u===void 0&&(u=k),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!v5(d)&&(p=N),!Xs(C)&&_===void 0&&(_=F));let[rt,q]=ie(u);return R!==null&&(e.fill=le(C,"currentColor"),e.fillOpacity=Im(U,1)),E!==null&&(e.stroke=le(X,"none"),e.strokeWidth=Im(q,1),e.strokeOpacity=Im(nt,1),e.strokeLinejoin=le(d,"miter"),e.strokeLinecap=le(h,"butt"),e.strokeMiterlimit=Im(p,4),e.strokeDasharray=le(y,"none"),e.strokeDashoffset=le(b,"0")),e.target=ze(s),e.ariaLabel=ze(A),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=Im(Y,1),e.mixBlendMode=le(g,"normal"),e.imageFilter=le(x,"none"),e.paintOrder=le(_,"normal"),e.pointerEvents=le(v,"auto"),e.shapeRendering=le(w,"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:$,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function YH(e,t){t&&e.filter(n=>dm(t[n])).append("title").call(WH,t)}function GH(e,t){t&&e.filter(([n])=>dm(t[n])).append("title").call(XH,t)}function WH(e,t){t&&e.text(n=>zi(t[n]))}function XH(e,t){t&&e.text(([n])=>zi(t[n]))}function Zt(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&&G5(e,d=>f[d],t),n||YH(e,i)}function Tl(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&G5(e,([d])=>f[d],t),n||GH(e,i)}function HH({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 Tm(e,t,n){let r=sn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&qn("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*H1(e,t,n,r){let{z:i}=n,{z:o}=r,s=HH(r,n),a=[...t,...s];for(let c of o?Tm(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!$e(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Gs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Gs(s[d][f])!==l[d]){yield u,l=s.map(p=>Gs(p[f])),u=[f];continue t}}u&&(yield u)}}function Z1(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ke(e,"clip",["frame","sphere"])),e}function ZH(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=W1();i=`url(#${d})`,e=ct("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=W1();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",An(s)({type:"Sphere"}));break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function Ft(e,t,n,r){ZH(e,t,n,r),ft(e,"fill",t.fill),ft(e,"fill-opacity",t.fillOpacity),ft(e,"stroke",t.stroke),ft(e,"stroke-width",t.strokeWidth),ft(e,"stroke-opacity",t.strokeOpacity),ft(e,"stroke-linejoin",t.strokeLinejoin),ft(e,"stroke-linecap",t.strokeLinecap),ft(e,"stroke-miterlimit",t.strokeMiterlimit),ft(e,"stroke-dasharray",t.strokeDasharray),ft(e,"stroke-dashoffset",t.strokeDashoffset),ft(e,"shape-rendering",t.shapeRendering),ft(e,"filter",t.imageFilter),ft(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ft(e,"pointer-events",i)}function Rt(e,t){QH(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function G5(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ii.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ii.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 QH(e,t,n){n!=null&&e.style(t,n)}function It(e,t,{x:n,y:r},i=De,o=De){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 le(e,t){if((e=ze(e))!==t)return e}function Im(e,t){if((e=Nt(e))!==t)return e}var KH=/^-?([_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 Tf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!KH.test(e))throw new Error(`invalid class name: ${e}`);return e}function Ef(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 yn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}function tc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:Z1(n)}}function ct(e,{document:t}){return zt(Ts(e).call(t.documentElement))}var X5=Math.PI,Zs=2*X5,W5=.618;function H5({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(hn(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}=Z5(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:y}=s,b=u-d-h-o-r,m=f-p-y-n-i;if(e=e?.({width:b,height:m,clip:l,...a}),e==null)return;l=JH(l,d,p,u-h,f-y);let g=d+o,x=p+n,_;if(c!=null){let[[v,w],[T,A]]=An(e).bounds(c),R=Math.min(b/(T-v),m/(A-w));R>0?(g-=(R*(v+T)-b)/2,x-=(R*(w+A)-m)/2,_=Object.assign(sl({point(I,E){this.stream.point(I*R+g,E*R+x)}}),{invert:([I,E])=>[(I-g)/R,(E-x)/R]})):qn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=g===0&&x===0?Q5():Object.assign(sl({point(v,w){this.stream.point(v+g,w+x)}}),{invert:([v,w])=>[v-g,w-x]}),{stream:v=>e.stream(_.stream(l(v))),invert:v=>e.invert(_.invert(v))}}function Z5(e){switch(`${e}`.toLowerCase()){case"albers-usa":return qi(lI,.7463,.4673);case"albers":return Q1(Ip,.7463,.4673);case"azimuthal-equal-area":return qi(fI,4,4);case"azimuthal-equidistant":return qi(hI,Zs,Zs);case"conic-conformal":return Q1(yI,Zs,Zs);case"conic-equal-area":return Q1(Ba,6.1702,2.9781);case"conic-equidistant":return Q1(bI,7.312,3.6282);case"equal-earth":return qi(_I,5.4133,2.6347);case"equirectangular":return qi(gI,Zs,X5);case"gnomonic":return qi(vI,3.4641,3.4641);case"identity":return{type:Q5};case"reflect-y":return{type:tZ};case"mercator":return qi(pI,Zs,Zs);case"orthographic":return qi(II,2,2);case"stereographic":return qi(EI,2,2);case"transverse-mercator":return qi(AI,Zs,Zs);default:throw new Error(`unknown projection type: ${e}`)}}function JH(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 qu(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function qi(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function Q1(e,t,n){let{type:r,aspectRatio:i}=qi(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var Q5=dn({stream:e=>e,invert:e=>e}),tZ=dn(Object.assign(sl({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function dE(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 K5({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(hn(e)&&(e=e.type),e!=null)}function J5(e){if(typeof e?.stream=="function")return W5;if(hn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=Z5(e);if(t)return t}return W5}}function ec(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=If(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&dE("x","y",o,n),r&&(o.x=Qe(o.x)),i&&(o.y=Qe(o.y)),o}function tC(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)Cr(s,o);return[r,i]}var eZ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],oC=new Map([["accent",KI],["category10",QI],["dark2",JI],["observable10",eZ],["paired",tT],["pastel1",eT],["pastel2",nT],["set1",rT],["set2",iT],["set3",oT],["tableau10",sT]]);function sC(e){return e!=null&&oC.has(`${e}`.toLowerCase())}var eC=new Map([...oC,["brbg",Qs(lx,ux)],["prgn",Qs(fx,dx)],["piyg",Qs(hx,px)],["puor",Qs(mx,yx)],["rdbu",Qs(Wp,tf)],["rdgy",Qs(gx,bx)],["rdylbu",Qs(Xp,ef)],["rdylgn",Qs(xx,_x)],["spectral",Qs(wx,vx)],["burd",nC(Wp,tf)],["buylrd",nC(Xp,ef)],["blues",gn(Wx,Xx)],["greens",gn(Hx,Zx)],["greys",gn(Qx,Kx)],["oranges",gn(r1,i1)],["purples",gn(Jx,t1)],["reds",gn(e1,n1)],["turbo",Ks(h1)],["viridis",Ks(m1)],["magma",Ks(y1)],["inferno",Ks(g1)],["plasma",Ks(b1)],["cividis",Ks(o1)],["cubehelix",Ks(s1)],["warm",Ks(c1)],["cool",Ks(l1)],["bugn",gn(Sx,Ix)],["bupu",gn(Tx,Ex)],["gnbu",gn(Mx,Ax)],["orrd",gn(Nx,Rx)],["pubu",gn(kx,Fx)],["pubugn",gn(Ox,Dx)],["purd",gn(Lx,Cx)],["rdpu",gn(Bx,Px)],["ylgn",gn(zx,qx)],["ylgnbu",gn(Ux,$x)],["ylorbr",gn(jx,Vx)],["ylorrd",gn(Yx,Gx)],["rainbow",rC(u1)],["sinebow",rC(d1)]]);function gn(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?Ln(t,n):e[n])}function Qs(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Ln(t,n):e[n])}function nC(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Ln(r=>t(1-r),n):e[n].slice().reverse())}function Ks(e){return({length:t})=>Ln(e,Math.max(2,Math.floor(t)))}function rC(e){return({length:t})=>Ln(e,Math.floor(t)+1).slice(0,-1)}function hE(e){let t=`${e}`.toLowerCase();if(!eC.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return eC.get(t)}function Em(e,t){let n=hE(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function aC(e,t="greys"){let n=new Set,[r,i]=Em(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 iC=new Map([["brbg",ux],["prgn",dx],["piyg",px],["puor",yx],["rdbu",tf],["rdgy",bx],["rdylbu",ef],["rdylgn",_x],["spectral",vx],["burd",e=>tf(1-e)],["buylrd",e=>ef(1-e)],["blues",Xx],["greens",Zx],["greys",Kx],["purples",t1],["reds",n1],["oranges",i1],["turbo",h1],["viridis",m1],["magma",y1],["inferno",g1],["plasma",b1],["cividis",o1],["cubehelix",s1],["warm",c1],["cool",l1],["bugn",Ix],["bupu",Ex],["gnbu",Ax],["orrd",Rx],["pubugn",Dx],["pubu",Fx],["purd",Cx],["rdpu",Px],["ylgnbu",$x],["ylgn",qx],["ylorbr",Vx],["ylorrd",Gx],["rainbow",u1],["sinebow",d1]]);function Mf(e){let t=`${e}`.toLowerCase();if(!iC.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return iC.get(t)}var nZ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function cC(e){return e!=null&&nZ.has(`${e}`.toLowerCase())}var mE=e=>t=>e(1-t),pE=[0,1],lC=new Map([["number",we],["rgb",oi],["hsl",lS],["hcl",uS],["lab",G0]]);function yE(e){let t=`${e}`.toLowerCase();if(!lC.has(t))throw new Error(`unknown interpolator: ${t}`);return lC.get(t)}function Nf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=gC(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=fe.get(e)===vl?sZ(n,a):fe.get(e)===Sl?aZ(n,a):fe.get(e)===Il?pE:void 0,interpolate:h=fe.get(e)===zr?u==null&&d!==void 0?oi:Mf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Qc:we,reverse:p}){if(f=Do(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=yE(h)),p=!!p,d!==void 0){let y=(a=qe(a)).length,b=(d=qe(d)).length;if(y!==b){if(h.length===1)throw new Error("invalid piecewise interpolator");h=po(h,d),d=void 0}}if(h.length===1?(p&&(h=mE(h),p=!1),d===void 0&&(d=Float64Array.from(a,(y,b)=>b/(a.length-1)),d.length===2&&(d=pE)),t.interpolate((d===pE?dn:Mm)(h))):t.interpolate(h),s){let[y,b]=ae(a);(y>0||b<0)&&(a=Xa(a),js(a)!==Math.sign(y)?a[a.length-1]=0:a[0]=0)}return p&&(a=Aa(a)),t.domain(a).unknown(c),i&&(t.nice(rZ(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 rZ(e,t){return e===!0?void 0:typeof e=="number"?e:m5(e,t)}function uC(e,t,n){return Nf(e,ks(),t,n)}function fC(e,t,n){return gE(e,t,{...n,exponent:.5})}function gE(e,t,{exponent:n=1,...r}){return Nf(e,Cp().exponent(n),t,{...r,type:"pow"})}function dC(e,t,{base:n=10,domain:r=cZ(t),...i}){return Nf(e,Fp().base(n),t,{...i,domain:r})}function hC(e,t,{constant:n=1,...r}){return Nf(e,Lp().constant(n),t,r)}function pC(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=lZ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Ln(c,i):fe.get(e)===zr?Em(o,i):void 0),s.length>0&&(s=Bp(s,n===void 0?{length:i}:n).quantiles()),K1(e,t,{domain:s,range:n,reverse:l,unknown:a})}function mC(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=gC(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ae(o),f;return n===void 0?(f=Tn(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?Ln(a,r):fe.get(e)===zr?Em(i,r):void 0):(f=Ln(we(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),js(qe(o))<0&&f.reverse(),K1(e,t,{domain:f,range:n,reverse:c,unknown:s})}function K1(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Ln(o,n.length+1):fe.get(e)===zr?Em(i,n.length+1):void 0,reverse:a}){n=qe(n);let c=js(n);if(!isNaN(c)&&!iZ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Aa(s)),{type:"threshold",scale:Pp(c<0?Aa(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function iZ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Xn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function yC(e){return{type:"identity",scale:E5(fe.get(e))?Dp():t=>t}}function Af(e,t=uf){return e.length?[ce(e,({value:n})=>n===void 0?n:ce(n,t)),$t(e,({value:n})=>n===void 0?n:$t(n,t))]:[0,1]}function gC(e,t){let n=fe.get(e);return(n===vl||n===Il||n===Sl?oZ:Af)(t)}function oZ(e){return[0,e.length?$t(e,({value:t})=>t===void 0?t:$t(t,uf)):1]}function sZ(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Zn(e,.5,({value:s})=>s===void 0?NaN:Zn(s,.25,ir)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/$t(i);return o<1?i.map(s=>s*o):i}function aZ(e,t){let n=Bi(e,({value:o})=>o===void 0?NaN:Bi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/$t(r);return i<1?r.map(o=>o*i):r}function cZ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Af(e,ir);if(n<0)return Af(e,qa)}return[1,10]}function lZ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function Mm(e){return(t,n)=>r=>e(t+r*(n-t))}function J1(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Af(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=fe.get(e)===zr?u==null&&f!==void 0?oi:Mf(u!==void 0?u:"rdbu"):we,reverse:p}){l=+l,a=qe(a);let[y,b]=a;if(a.length>2&&qn(`Warning: the diverging ${e} scale domain contains extra elements.`),Xn(y,b)<0&&([y,b]=[b,y],p=!p),y=Math.min(y,l),b=Math.max(b,l),typeof h!="function"&&(h=yE(h)),f!==void 0&&(h=h.length===1?Mm(h)(...f):po(h,f)),p&&(h=mE(h)),d){let m=n.apply(l),g=m-n.apply(y),x=n.apply(b)-m;g<x?y=n.invert(m-x):g>x&&(b=n.invert(m+g))}return t.domain([y,l,b]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[y,b],pivot:l,interpolate:h,scale:t}}function bC(e,t,n){return J1(e,Gp(),uZ,t,n)}function xC(e,t,n){return bE(e,t,{...n,exponent:.5})}function bE(e,t,{exponent:n=1,...r}){return J1(e,cx().exponent(n=+n),hZ(n),t,{...r,type:"diverging-pow"})}function _C(e,t,{base:n=10,pivot:r=1,domain:i=Af(t,r<0?qa:ir),...o}){return J1(e,sx().base(n=+n),fZ,t,{domain:i,pivot:r,...o})}function wC(e,t,{constant:n=1,...r}){return J1(e,ax().constant(n=+n),pZ(n),t,r)}var uZ={apply(e){return e},invert(e){return e}},fZ={apply:Math.log,invert:Math.exp},dZ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function hZ(e){return e===.5?dZ:{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 pZ(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 vC(e,t,n,r){return Nf(e,t,n,r)}function SC(e,t,n){return vC(e,rx(),t,n)}function IC(e,t,n){return vC(e,ix(),t,n)}var Rf=Symbol("ordinal");function EC(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Do(i,r),o===void 0&&(o=OC(n,i,e)),(r==="categorical"||r===Rf)&&(r="ordinal"),a&&(o=Aa(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 MC(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=Do(r,n),i===void 0&&(i=OC(t,r,e));let l;if(fe.get(e)===_f)l=mZ(t),o=o===void 0?yZ(l):Yt(o,wf);else if(fe.get(e)===zr&&(o===void 0&&(n==="ordinal"||n===Rf)&&(o=aC(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=Mf(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Ln(p=>u(f+d*p),h)}else o=hE(s);if(a===Rp)throw new Error(`implicit unknown on ${e} scale is not supported`);return EC(e,ll().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function AC(e,t,{align:n=.5,padding:r=.5,...i}){return RC(LI().align(n).padding(r),t,i,e)}function NC(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return RC(Ua().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function RC(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=EC(r,e,t,n),e.round=i,e}function OC(e,t,n){let r=new kr;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]=ae(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&fe.get(n)===mi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return lo(r,fn)}function TC(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 mZ(e){return{fill:TC(e,"fill"),stroke:TC(e,"stroke")}}function yZ(e){return ne(e.fill)?hT:I1}function Am(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}={},...y}={}){let b={};for(let[m,g]of e){let x=y[m],_=UC(m,g,{round:fe.get(m)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=m==="fx"||m==="fy"?p:t,percent:w,transform:T,inset:A,insetTop:R=A!==void 0?A:m==="y"?r:0,insetRight:I=A!==void 0?A:m==="x"?i:0,insetBottom:E=A!==void 0?A:m==="y"?o:0,insetLeft:O=A!==void 0?A:m==="x"?s:0}=x||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?gZ(g,_):v,_.transform=T,m==="x"||m==="fx"?(_.insetLeft=+O,_.insetRight=+I):(m==="y"||m==="fy")&&(_.insetTop=+R,_.insetBottom=+E),b[m]=_}}return b}function _E(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]=zC(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function CC(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?n_(t):t;i&&DC(i,s),o&&kC(o,s);let a=i||o?wE(e,t):t;n&&DC(n,a),r&&kC(r,a)}function gZ(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!Lo(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function e_(e){return Math.sign(js(e.domain()))*Math.sign(js(e.range()))}function n_(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 wE({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=n_(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 DC(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)],Lo(e)||(e.range=PC(e)),e.scale.range(e.range)}BC(e)}function kC(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],Lo(e)?e.range.reverse():e.range=PC(e),e.scale.range(e.range)}BC(e)}function BC(e){e.round===void 0&&_Z(e)&&bZ(e)<=30&&e.scale.round(!0)}function bZ({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 PC(e){let t=e.scale.domain().length+vE(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 r_(e,t,n){return UC(e,n===void 0?void 0:[{hint:n}],{...t})}function UC(e,t=[],n={}){let r=xZ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Lo({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Oe)?qn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Of(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 "${Of(r)}".`):i.some(x5)?qn(`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 "${Of(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 "${Of(r)}".`):i.some(_5)&&qn(`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 "${Of(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 "${Of(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=t_(t,n,Qe);break;case"identity":switch(fe.get(e)){case mi:n=t_(t,n,Qe);break;case _f:n=t_(t,n,wZ);break}break;case"utc":case"time":n=t_(t,n,p5);break}switch(r){case"diverging":return bC(e,t,n);case"diverging-sqrt":return xC(e,t,n);case"diverging-pow":return bE(e,t,n);case"diverging-log":return _C(e,t,n);case"diverging-symlog":return wC(e,t,n);case"categorical":case"ordinal":case Rf:return MC(e,t,n);case"cyclical":case"sequential":case"linear":return uC(e,t,n);case"sqrt":return fC(e,t,n);case"threshold":return K1(e,t,n);case"quantile":return pC(e,t,n);case"quantize":return mC(e,t,n);case"pow":return gE(e,t,n);case"log":return dC(e,t,n);case"symlog":return hC(e,t,n);case"utc":return IC(e,t,n);case"time":return SC(e,t,n);case"point":return AC(e,t,n);case"band":return NC(e,t,n);case"identity":return yC(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Of(e){return typeof e=="symbol"?e.description:e}function FC(e){return typeof e=="string"?`${e}`.toLowerCase():e}var LC={toString:()=>"projection"};function xZ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=FC(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=LC);for(let l of t){let u=FC(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===LC)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=fe.get(e);if(c===vl)return"sqrt";if(c===Il||c===Sl)return"linear";if(c===_f)return"ordinal";if((r||i||[]).length>2)return xE(c);if(r!==void 0){if(Ae(r))return xE(c);if(Oe(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ae))return xE(c);if(l.some(Oe))return"utc"}if(c===zr){if(s!=null||cC(o))return"diverging";if(sC(o))return"categorical"}return"linear"}function xE(e){switch(e){case mi:return"point";case zr:return Rf;default:return"ordinal"}}function Lo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Rf}function vE({type:e}){return e==="threshold"}function _Z({type:e}){return e==="point"||e==="band"}function ar(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 t_(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 wZ(e){return Yt(e,wf)}function Co(e={}){let t;for(let n in e)if(fe.has(n)&&Ro(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=zC(r_(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function $C(e){return t=>{if(!fe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function zC({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:Xa(n),...r!==void 0&&{range:Xa(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 jC(e,t,n={}){let r=.5-De,i=.5+De,o=.5+De,s=.5-De;for(let{marginTop:y,marginRight:b,marginBottom:m,marginLeft:g}of t)y>r&&(r=y),b>i&&(i=b),m>o&&(o=m),g>s&&(s=g);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=vZ(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:y,marginTop:b=y!==void 0?y:c,marginRight:m=y!==void 0?y:l,marginBottom:g=y!==void 0?y:u,marginLeft:x=y!==void 0?y:f}=n.facet??{};b=+b,m=+m,g=+g,x=+x,p.facet={marginTop:b,marginRight:m,marginBottom:g,marginLeft:x}}return p}function vZ({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=J5(i);if(d){let p=r?r.scale.domain().length:1,y=(1.1*f-.1)/(1.1*p-.1)*d,b=Math.max(.1,Math.min(10,y));return Math.round((s-u-c)*b+a+l)}let h=t?Lo(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=qC("y",t)/(qC("x",e)*o),y=r?r.scale.bandwidth():1,b=n?n.scale.bandwidth():1,m=y*(s-u-c)-e.insetLeft-e.insetRight;return(p*m+t.insetTop+t.insetBottom)/b+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function qC(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]=ae(r);return Math.abs(i(s)-i(o))}function YC(e,t){let{fx:n,fy:r}=Am(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?_0(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 GC(e,{x:t,y:n}){return t&&=ME(t),n&&=ME(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 o_(e,{fx:t,fy:n}){let r=or(e),i=t?.value,o=n?.value;return t&&n?Ci(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ci(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Ci(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function WC(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 XC(e){let t=[],n=new Uint32Array(En(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 SZ=new Map([["top",SE],["right",EE],["bottom",IE],["left",TE],["top-left",i_(SE,TE)],["top-right",i_(SE,EE)],["bottom-left",i_(IE,TE)],["bottom-right",i_(IE,EE)],["top-empty",TZ],["right-empty",AZ],["bottom-empty",EZ],["left-empty",MZ],["empty",NZ]]);function HC(e){if(e==null)return null;let t=SZ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var VC=new WeakMap;function ME(e){let t=VC.get(e);return t||VC.set(e,t=new Hn(Yt(e,(n,r)=>[n,r]))),t}function nc(e,t){return ME(e).get(t)}function IZ(e,t,n){return t=Gs(t),n=Gs(n),e.find(r=>Object.is(Gs(r.x),t)&&Object.is(Gs(r.y),n))}function s_(e,t,n){return IZ(e,t,n)?.empty}function SE(e,{y:t},{y:n}){return t?nc(t,n)===0:!0}function IE(e,{y:t},{y:n}){return t?nc(t,n)===t.length-1:!0}function TE(e,{x:t},{x:n}){return t?nc(t,n)===0:!0}function EE(e,{x:t},{x:n}){return t?nc(t,n)===t.length-1:!0}function TZ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,r);if(o>0)return s_(e,n,t[o-1])}function EZ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,r);if(o<t.length-1)return s_(e,n,t[o+1])}function MZ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,n);if(o>0)return s_(e,t[o-1],r)}function AZ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,n);if(o<t.length-1)return s_(e,t[o+1],r)}function NZ(e,t,{empty:n}){return n}function i_(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function a_(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 wt=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:y=d,marginLeft:b=d,clip:m=i?.clip,channels:g,tip:x,render:_}=r;if(this.data=t,this.sort=Oo(l)?l:null,this.initializer=Se(r).initializer,this.transform=this.initializer?r.transform:mn(r).transform,o===null||o===!1?this.facet=null:(this.facet=Ke(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Ga&&typeof a=="string"?[a]:a,this.fy=t===Ga&&typeof c=="string"?[c]:c),this.facetAnchor=HC(s),n=bm(n),g!==void 0&&(n={...RZ(g),...n}),i!==void 0&&(n={...X1(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,w])=>{if($r(w.value)){let{value:T,label:A=w.label,scale:R=w.scale}=w.value;w={...w,label:A,scale:R,value:T}}if(t===Ga&&typeof w.value=="string"){let{value:T}=w;w={...w,value:[T]}}return[v,w]}).filter(([v,{value:w,optional:T}])=>{if(w!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+y,this.marginLeft=+b,this.clip=Z1(m),this.tip=OZ(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}=n[v];if(!(w!=="x"&&w!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=Df(_,this.render))}initialize(t,n,r){let i=qe(this.data);t===void 0&&i!=null&&(t=[or(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=qe(i)),t!==void 0&&(t.original=o);let s=Y1(this.channels,i);return this.sort!=null&&$5(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=$e}=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"&&dE(i,o,n,r.projection)}}scale(t,n,r){let i=If(t,n);return r.projection&&this.project(t,i,r),i}};function Je(...e){return e.plot=wt.prototype.plot,e}function Df(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 RZ(e){return Object.fromEntries(Object.entries(bm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:pi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function OZ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ke(e,"tip",["x","y","xy"]):e}function ji(e,t){return e?.tip===!0?{...e,tip:t}:hn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var ZC=new WeakMap;function AE(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:Df(function(u,f,d,h,p,y){p={...p,pointerSticky:!1};let b=p.ownerSVGElement,{data:m}=p.getMarkState(this),g=ZC.get(b);g||ZC.set(b,g={sticky:!1,roots:[],renders:[]});let x=g.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,A=w?w(u.fx)-h.marginLeft:0,R=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(A+=_.bandwidth()/2),v?.bandwidth&&(R+=v.bandwidth()/2);let I=u.fi!=null,E;if(I){let Y=g.facetStates;Y||(g.facetStates=Y=new Map),E=Y.get(this),E||Y.set(this,E=new Map)}let[O,k]=yn(this,h),{px:S,py:M}=d,N=S?Y=>S[Y]:NE(d,O),F=M?Y=>M[Y]:RE(d,k),B,C,P,U;function $(Y,rt){if(I)if(U&&(U=cancelAnimationFrame(U)),Y==null)E.delete(u.fi);else{E.set(u.fi,rt),U=requestAnimationFrame(()=>{U=null;for(let[q,H]of E)if(H<rt||H===rt&&q<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===g.sticky)return;B=Y,P=p.pointerSticky=g.sticky;let rt=B==null?[]:[B];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let q=y(rt,f,d,h,p);if(C){if(I){let H=C.parentNode,ot=C.getAttribute("transform"),z=q.getAttribute("transform");ot?q.setAttribute("transform",ot):q.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}C.replaceWith(q)}return g.roots[x]=C=q,B==null&&E?.size>1||p.dispatchValue(B==null?null:m[B]),q}function tt(Y){if(g.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,q]=Fn(Y);rt-=A,q-=R;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=q<h.marginTop||q>h.height-h.marginBottom?1:t,z=null,Lt=s*s;for(let dt of u){let Wt=H*(N(dt)-rt),Xt=ot*(F(dt)-q),et=Wt*Wt+Xt*Xt;et<=Lt&&(z=dt,Lt=et)}if(z!=null&&(e!==1||t!==1)){let dt=N(z)-rt,Wt=F(z)-q;Lt=dt*dt+Wt*Wt}$(z,Lt)}function nt(Y){Y.pointerType==="mouse"&&B!=null&&(g.sticky&&g.roots.some(rt=>rt?.contains(Y.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(rt=>rt(null))):(g.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(g.sticky||$(null))}return b.addEventListener("pointerenter",tt),b.addEventListener("pointermove",tt),b.addEventListener("pointerdown",nt),b.addEventListener("pointerleave",st),X(null)},c)}}function kf(e){return AE(1,1,e)}function Ff(e){return AE(1,.01,e)}function El(e){return AE(.01,1,e)}function NE({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function RE({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function c_(e){return Lo(e)&&e.interval===void 0?void 0:"tabular-nums"}function QC(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=c_(e),round:p=!0,opacity:y,className:b}=t,m=tc(t);b=Tf(b),y=ie(y)[1],d===null&&(d=()=>null);let g=ct("svg",m).attr("class",`${b}-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(.${b}-ramp) {
16
17
  display: block;
17
18
  height: auto;
18
19
  height: intrinsic;
19
20
  max-width: 100%;
20
21
  overflow: visible;
21
22
  }
22
- :where(.${g}-ramp text) {
23
+ :where(.${b}-ramp text) {
23
24
  white-space: pre;
24
- }`)).call(Tf,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,F)=>O.rangeRound(F):(O,F)=>O.range(F),{type:w,domain:T,range:M,interpolate:R,scale:I,pivot:E}=e;if(R){let O=M===void 0?R:xo(R.length===1?_m(R):R,M);_=v(I.copy(),Cn(_e(l,i-a),Math.min(T.length+(E!==void 0),M===void 0?1/0:M.length)));let F=256,S=m.document.createElement("canvas");S.width=F,S.height=1;let A=S.getContext("2d");for(let N=0,D=F-1;N<F;++N)A.fillStyle=O(N/D),A.fillRect(N,0,1,1);b.append("image").attr("opacity",y).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=T,F=d===void 0?S=>S:typeof d=="string"?li(d):d;_=v(ks().domain([-1,M.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",y).selectAll().data(M).enter().append("rect").attr("x",(S,A)=>_(A-1)).attr("y",s).attr("width",(S,A)=>_(A)-_(A-1)).attr("height",o-s-c).attr("fill",S=>S),f=Yt(O,(S,A)=>A),d=S=>F(O[S],S)}else _=v(Ua().domain(T),[l,i-a]),b.append("g").attr("fill-opacity",y).selectAll().data(T).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),x=()=>{};return b.append("g").attr("transform",`translate(0,${o-c})`).call(A2(_).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",ce(h,"normal")).call(x).call(O=>O.select(".domain").remove()),n!==void 0&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),b.node()}var Df=Math.PI/180;function Xi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=pE(n),e.markerMid=pE(r),e.markerEnd=pE(i)}function pE(e){if(e==null||e===!1)return null;if(e===!0)return cF;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return aF("auto");case"arrow-reverse":return aF("auto-start-reverse");case"dot":return GQ;case"circle":case"circle-fill":return cF;case"circle-stroke":return WQ;case"tick":return mE("auto");case"tick-x":return mE(90);case"tick-y":return mE(0)}throw new Error(`invalid marker: ${e}`)}function aF(e){return(t,n)=>at("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 GQ(e,t){return at("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 cF(e,t){return at("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 WQ(e,t){return at("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 mE(e){return(t,n)=>at("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 XQ=0;function Zs(e,t,{stroke:n},r){return uF(e,t,n&&(i=>n[i]),r)}function lF(e,t,{stroke:n},r){return uF(e,t,n&&(([i])=>n[i]),r)}function uF(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),y=`plot-marker-${++XQ}`;p.setAttribute("id",y),d.set(f,h=`url(#${y})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function El({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=fF(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Al({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=fF(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function fF(e,t,n){return e===void 0&&t===void 0&&n===void 0?Oe?[1,0]:[.5,.5]:[t,n]}function dF(e,{interval:t}){return e={...mi(e)},e.interval=bf(e.interval===void 0?t:e.interval),e}function x_(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=dF(i,n);if(a==null||c==null&&!r)return n;let l=Fn(i);if(c==null){let h,p={transform:y=>h||(h=dt(y,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=Yt(dt(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 hF(e,t,n){let{[e]:r}=n,{value:i,interval:o}=dF(r,n);return i==null||o==null?n:t({...n,[e]:{label:Fn(r),transform:s=>{let a=Yt(dt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Re(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 yE(e={}){return x_("x",El,e,!0)}function gE(e={}){return x_("y",Al,e,!0)}function __(e={}){return x_("x",El,e)}function w_(e={}){return x_("y",Al,e)}function v_(e={}){return hF("x",El,e)}function S_(e={}){return hF("y",Al,e)}var pF={ariaLabel:"rule",fill:null,stroke:"currentColor"},vm=class extends mt{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}},Wi(n,"x"),pF),this.insetTop=It(a),this.insetBottom=It(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:g}=i,{insetTop:m,insetBottom:b}=this;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s},Oe,0).call(x=>x.selectAll().data(t).enter().append("line").call(Tt,this).attr("x1",c?_=>c[_]:(y+f-p)/2).attr("x2",c?_=>c[_]:(y+f-p)/2).attr("y1",l&&!sr(a)?_=>l[_]+m:h+m).attr("y2",u&&!sr(a)?a.bandwidth?_=>u[_]+a.bandwidth()-b:_=>u[_]-b:d-g-b).call(Qt,this,r).call(Zs,this,r,o)).node()}},Sm=class extends mt{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}},Wi(n,"y"),pF),this.insetRight=It(a),this.insetLeft=It(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:g}=i,{insetLeft:m,insetRight:b}=this;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{y:c&&a},0,Oe).call(x=>x.selectAll().data(t).enter().append("line").call(Tt,this).attr("x1",l&&!sr(s)?_=>l[_]+m:y+m).attr("x2",u&&!sr(s)?s.bandwidth?_=>u[_]+s.bandwidth()-b:_=>u[_]-b:f-p-b).attr("y1",c?_=>c[_]:(h+d-g)/2).attr("y2",c?_=>c[_]:(h+d-g)/2).call(Qt,this,r).call(Zs,this,r,o)).node()}};function Yr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=w_(t);return[i,o]=mF(r,i,o),new vm(e,{...s,x:n,y1:i,y2:o})}function Gr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=__(t);return[i,o]=mF(r,i,o),new Sm(e,{...s,y:n,x1:i,x2:o})}function mF(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 ic(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 HQ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},_F="\xAD",Nl=class extends mt{constructor(t,n={}){let{x:r,y:i,text:o=or(t)&&Y1(t)?W:Ie,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:y,fontVariant:g,fontWeight:m,rotate:b}=n,[x,_]=ie(b,0),[v,w]=JQ(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:Ek(x),optional:!0},text:{value:o,filter:sm,optional:!0}},n,HQ),this.rotate=_,this.textAnchor=ce(a,"middle"),this.lineAnchor=Ze(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=xE(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=w,this.fontStyle=ze(y),this.fontVariant=ze(g),this.fontWeight=ze(m),this.frameAnchor=Po(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=wE(this),this.clipLine=vE(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,[y,g]=bn(this,i);return at("svg:g",o).call(Mt,this,i,o).call(_E,this,f,i).call(bt,this,{x:c&&s,y:l&&a}).call(m=>m.selectAll().data(t).enter().append("text").call(Tt,this).call(QQ,this,f,d).attr("transform",ic`translate(${c?b=>c[b]:y},${l?b=>l[b]:g})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(ct,"font-size",h&&(b=>h[b])).call(Qt,this,r)).node()}};function xE(e){return e==null?null:Ze(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function QQ(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(Yi(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 y=this.ownerDocument.createElementNS(oi.svg,"tspan");y.setAttribute("x",0),p===h-1?y.setAttribute("y",`${(d+p)*o}em`):y.setAttribute("dy",`${h*o}em`),y.textContent=u[p],this.appendChild(y),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(oi.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function jo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Nl(e,{...r,x:t,y:n})}function I_(e,{x:t=W,...n}={}){return new Nl(e,S_({...n,x:t}))}function T_(e,{y:t=W,...n}={}){return new Nl(e,v_({...n,y:t}))}function _E(e,t,n){ct(e,"text-anchor",t.textAnchor),ct(e,"font-family",t.fontFamily),ct(e,"font-size",t.fontSize),ct(e,"font-style",t.fontStyle),ct(e,"font-variant",t.fontVariant===void 0?ZQ(n):t.fontVariant),ct(e,"font-weight",t.fontWeight)}function ZQ(e){return e&&(Ys(e)||Re(e))?"tabular-nums":void 0}var KQ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function JQ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),KQ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function tZ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of eZ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===_F?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*eZ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case _F:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
25
+ }`)).call(Ef,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,k)=>O.rangeRound(k):(O,k)=>O.range(k),{type:w,domain:T,range:A,interpolate:R,scale:I,pivot:E}=e;if(R){let O=A===void 0?R:po(R.length===1?Mm(R):R,A);_=v(I.copy(),Ln(we(l,i-a),Math.min(T.length+(E!==void 0),A===void 0?1/0:A.length)));let k=256,S=m.document.createElement("canvas");S.width=k,S.height=1;let M=S.getContext("2d");for(let N=0,F=k-1;N<k;++N)M.fillStyle=O(N/F),M.fillRect(N,0,1,1);g.append("image").attr("opacity",y).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=T,k=d===void 0?S=>S:typeof d=="string"?ci(d):d;_=v(ks().domain([-1,A.length-1]),[l,i-a]),g.append("g").attr("fill-opacity",y).selectAll().data(A).enter().append("rect").attr("x",(S,M)=>_(M-1)).attr("y",s).attr("width",(S,M)=>_(M)-_(M-1)).attr("height",o-s-c).attr("fill",S=>S),f=Yt(O,(S,M)=>M),d=S=>k(O[S],S)}else _=v(Ua().domain(T),[l,i-a]),g.append("g").attr("fill-opacity",y).selectAll().data(T).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),x=()=>{};return g.append("g").attr("transform",`translate(0,${o-c})`).call(V2(_).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",le(h,"normal")).call(x).call(O=>O.select(".domain").remove()),n!==void 0&&g.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),g.node()}var Lf=Math.PI/180;function Vi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=OE(n),e.markerMid=OE(r),e.markerEnd=OE(i)}function OE(e){if(e==null||e===!1)return null;if(e===!0)return JC;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return KC("auto");case"arrow-reverse":return KC("auto-start-reverse");case"dot":return DZ;case"circle":case"circle-fill":return JC;case"circle-stroke":return kZ;case"tick":return DE("auto");case"tick-x":return DE(90);case"tick-y":return DE(0)}throw new Error(`invalid marker: ${e}`)}function KC(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 DZ(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 JC(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 kZ(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 DE(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 FZ=0;function Js(e,t,{stroke:n},r){return eB(e,t,n&&(i=>n[i]),r)}function tB(e,t,{stroke:n},r){return eB(e,t,n&&(([i])=>n[i]),r)}function eB(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),y=`plot-marker-${++FZ}`;p.setAttribute("id",y),d.set(f,h=`url(#${y})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Ml({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=nB(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Al({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=nB(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function nB(e,t,n){return e===void 0&&t===void 0&&n===void 0?De?[1,0]:[.5,.5]:[t,n]}function rB(e,{interval:t}){return e={...pi(e)},e.interval=xf(e.interval===void 0?t:e.interval),e}function l_(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=rB(i,n);if(a==null||c==null&&!r)return n;let l=On(i);if(c==null){let h,p={transform:y=>h||(h=mt(y,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=Yt(mt(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 iB(e,t,n){let{[e]:r}=n,{value:i,interval:o}=rB(r,n);return i==null||o==null?n:t({...n,[e]:{label:On(r),transform:s=>{let a=Yt(mt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Oe(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 kE(e={}){return l_("x",Ml,e,!0)}function FE(e={}){return l_("y",Al,e,!0)}function u_(e={}){return l_("x",Ml,e)}function f_(e={}){return l_("y",Al,e)}function d_(e={}){return iB("x",Ml,e)}function h_(e={}){return iB("y",Al,e)}var oB={ariaLabel:"rule",fill:null,stroke:"currentColor"},Nm=class extends wt{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}},ji(n,"x"),oB),this.insetTop=Nt(a),this.insetBottom=Nt(c),Vi(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:y,marginBottom:b}=i,{insetTop:m,insetBottom:g}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s},De,0).call(x=>x.selectAll().data(t).enter().append("line").call(Rt,this).attr("x1",c?_=>c[_]:(y+f-p)/2).attr("x2",c?_=>c[_]:(y+f-p)/2).attr("y1",l&&!ar(a)?_=>l[_]+m:h+m).attr("y2",u&&!ar(a)?a.bandwidth?_=>u[_]+a.bandwidth()-g:_=>u[_]-g:d-b-g).call(Zt,this,r).call(Js,this,r,o)).node()}},Rm=class extends wt{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}},ji(n,"y"),oB),this.insetRight=Nt(a),this.insetLeft=Nt(c),Vi(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:y,marginBottom:b}=i,{insetLeft:m,insetRight:g}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{y:c&&a},0,De).call(x=>x.selectAll().data(t).enter().append("line").call(Rt,this).attr("x1",l&&!ar(s)?_=>l[_]+m:y+m).attr("x2",u&&!ar(s)?s.bandwidth?_=>u[_]+s.bandwidth()-g:_=>u[_]-g:f-p-g).attr("y1",c?_=>c[_]:(h+d-b)/2).attr("y2",c?_=>c[_]:(h+d-b)/2).call(Zt,this,r).call(Js,this,r,o)).node()}};function qr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=f_(t);return[i,o]=sB(r,i,o),new Nm(e,{...s,x:n,y1:i,y2:o})}function jr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=u_(t);return[i,o]=sB(r,i,o),new Rm(e,{...s,y:n,x1:i,x2:o})}function sB(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 rc(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 LZ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},fB="\xAD",Rl=class extends wt{constructor(t,n={}){let{x:r,y:i,text:o=sr(t)&&L1(t)?W:Me,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:y,fontVariant:b,fontWeight:m,rotate:g}=n,[x,_]=ie(g,0),[v,w]=UZ(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:g5(x),optional:!0},text:{value:o,filter:dm,optional:!0}},n,LZ),this.rotate=_,this.textAnchor=le(a,"middle"),this.lineAnchor=Ke(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=CE(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=w,this.fontStyle=ze(y),this.fontVariant=ze(b),this.fontWeight=ze(m),this.frameAnchor=ko(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=PE(this),this.clipLine=UE(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,[y,b]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(BE,this,f,i).call(It,this,{x:c&&s,y:l&&a}).call(m=>m.selectAll().data(t).enter().append("text").call(Rt,this).call(CZ,this,f,d).attr("transform",rc`translate(${c?g=>c[g]:y},${l?g=>l[g]:b})${u?g=>` rotate(${u[g]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(g=>h[g])).call(Zt,this,r)).node()}};function CE(e){return e==null?null:Ke(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function CZ(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(zi(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 y=this.ownerDocument.createElementNS(ii.svg,"tspan");y.setAttribute("x",0),p===h-1?y.setAttribute("y",`${(d+p)*o}em`):y.setAttribute("dy",`${h*o}em`),y.textContent=u[p],this.appendChild(y),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(ii.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Bo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Rl(e,{...r,x:t,y:n})}function p_(e,{x:t=W,...n}={}){return new Rl(e,h_({...n,x:t}))}function m_(e,{y:t=W,...n}={}){return new Rl(e,d_({...n,y:t}))}function BE(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?BZ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function BZ(e){return e&&(Ws(e)||Oe(e))?"tabular-nums":void 0}var PZ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function UZ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),PZ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function $Z(e,t,n){let r=[],i,o=0;for(let[s,a,c]of zZ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===fB?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*zZ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case fB:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
25
26
  `&&++i;case`
26
- `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var yF={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 E_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Lf(e,i))r+=yF[e[i]]??(vF(e,i)?120:yF.e);return r}function A_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Lf(e,i))r+=vF(e,i)?126:63;return r}function wE({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?A_:E_,i=t*100;return o=>tZ(o,i,r)}function vE({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?A_:E_,i=t*100;switch(n){case"clip-start":return o=>bF(o,i,r,"");case"clip-end":return o=>gF(o,i,r,"");case"ellipsis-start":return o=>bF(o,i,r,Ml);case"ellipsis-middle":return o=>nZ(o,i,r,Ml);case"ellipsis-end":return o=>gF(o,i,r,Ml)}}var Ml="\u2026";function Rl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Lf(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 gF(e,t,n,r){e=e.trim();let i=n(r),[o]=Rl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function nZ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Rl(e,t/2,n,o),[c]=Rl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Lf(e,c)).trimStart()}function bF(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Rl(e,i-t+o,n,-o);return s<0?r:r+e.slice(Lf(e,s)).trimStart()}var bE=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,xF=/\p{Extended_Pictographic}/uy;function Lf(e,t){return t+=rZ(e,t)?2:1,oZ(e,t)&&(t=bE.lastIndex),iZ(e,t)?Lf(e,t+1):t}function wF(e,t){return e.charCodeAt(t)<128}function rZ(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 iZ(e,t){return e.charCodeAt(t)===8205}function oZ(e,t){return wF(e,t)?!1:(bE.lastIndex=t,bE.test(e))}function vF(e,t){return wF(e,t)?!1:(xF.lastIndex=t,xF.test(e))}var SF={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},IF=3.5,sZ=IF*5,TF={draw(e,t,n){let r=t*n/sZ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},EF={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},aZ=new Map([["arrow",TF],["spike",EF]]);function cZ(e){return e&&typeof e.draw=="function"}function lZ(e){if(cZ(e))return e;let t=aZ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Ol=class extends mt{constructor(t,n={}){let{x:r,y:i,r:o=IF,length:s,rotate:a,shape:c=TF,anchor:l="middle",frameAnchor:u}=n,[f,d]=ie(s,12),[h,p]=ie(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,SF),this.r=+o,this.length=d,this.rotate=p,this.shape=lZ(c),this.anchor=Ze(l,"anchor",["start","middle","end"]),this.frameAnchor=Po(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:y,r:g}=this,[m,b]=bn(this,i);return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Tt,this).attr("transform",ic`translate(${c?_=>c[_]:m},${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=Kn();return y.draw(v,u[_],g),v}:(()=>{let _=Kn();return y.draw(_,d,g),_})()).call(Qt,this,r)).node()}};function SE(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Le(n,r)),new Ol(e,{...i,x:n,y:r})}function M_(e,t={}){let{x:n=W,...r}=t;return new Ol(e,{...r,x:n})}function N_(e,t={}){let{y:n=W,...r}=t;return new Ol(e,{...r,y:n})}function AF(e,t={}){let{shape:n=EF,stroke:r=SF.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return SE(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function oc(e,t){return arguments.length<2&&!or(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function R_({anchor:e}={},t){return e===void 0?t[0]:Ze(e,"anchor",t)}function MF(e){return R_(e,["left","right"])}function NF(e){return R_(e,["right","left"])}function RF(e){return R_(e,["bottom","top"])}function OF(e){return R_(e,["top","bottom"])}function Im(){let[e,t]=oc(...arguments);return kF("y",MF(t),e,t)}function O_(){let[e,t]=oc(...arguments);return kF("fy",NF(t),e,t)}function Tm(){let[e,t]=oc(...arguments);return FF("x",RF(t),e,t)}function k_(){let[e,t]=oc(...arguments);return FF("fx",OF(t),e,t)}function kF(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:y,tickRotate:g,x:m,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:T,labelAnchor:M,labelArrow:R,labelOffset:I,...E}){return p=It(p),y=It(y),g=It(g),M!==void 0&&(M=Ze(M,"labelAnchor",["center","top","bottom"])),R=zF(R),Ke(p&&!ne(o)?uZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:g,x:m,...E}):null,ne(c)?null:dZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:g,x:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?jo([],BF({fill:c,fillOpacity:l,...E},function(O,F,S,A,N){let D=A[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="y"&&N.inset||N,U=M??(D.bandwidth?"center":"top"),X=I??(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"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[UF(e,D,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function FF(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:y,tickRotate:g,y:m,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:T,labelAnchor:M,labelArrow:R,labelOffset:I,...E}){return p=It(p),y=It(y),g=It(g),M!==void 0&&(M=Ze(M,"labelAnchor",["center","left","right"])),R=zF(R),Ke(p&&!ne(o)?fZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:g,y:m,...E}):null,ne(c)?null:hZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:g,y:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?jo([],BF({fill:c,fillOpacity:l,...E},function(O,F,S,A,N){let D=A[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="x"&&N.inset||N,U=M??(D.bandwidth?"center":"right"),X=I??(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"?-X:X,this.dx=U==="right"?C-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[UF(e,D,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function uZ(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 Cf(N_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Oe+ +u:+d+Oe-f,anchor:"start",length:c,shape:t==="left"?gZ:bZ})}function fZ(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 Cf(M_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Oe-f:+d+Oe+ +u,anchor:"start",length:c,shape:t==="bottom"?mZ:yZ})}function dZ(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*Df):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:y=0,y:g=e==="y"?void 0:null,...m}){return Cf(T_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...m,dx:t==="left"?+y-o-a+ +h:+y+ +o+ +a-p},function(b,x,_,v,w){f===void 0&&(this.fontVariant=$F(b)),c===void 0&&(w.text=PF(b,x,_,v,t))})}function hZ(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*Df):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:y=0,x:g=e==="x"?void 0:null,...m}){return Cf(I_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...m,dy:t==="bottom"?+y+ +o+ +a-p:+y-o-a+ +h},function(b,x,_,v,w){f===void 0&&(this.fontVariant=$F(b)),c===void 0&&(w.text=PF(b,x,_,v,t))})}function F_(){let[e,t]=oc(...arguments);return DF("y",MF(t),e,t)}function D_(){let[e,t]=oc(...arguments);return DF("fy",NF(t),e,t)}function L_(){let[e,t]=oc(...arguments);return LF("x",RF(t),e,t)}function C_(){let[e,t]=oc(...arguments);return LF("fx",OF(t),e,t)}function DF(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 Cf(Gr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...CF(a)})}function LF(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 Cf(Yr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...CF(a)})}function CF({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 BF({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]=Ne(e),[,t]=ie(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 Cf(e,t,n,r,i,o,s){let a;function c(f,d,h,p,y,g){let m=f==null&&(t==="fx"||t==="fy"),{[t]:b}=p;if(!b)throw new Error(`missing scale: ${t}`);let x=b.domain(),{interval:_,ticks:v,tickFormat:w,tickSpacing:T=t==="x"?80:35}=o;if(typeof v=="string"&&jF(b)&&(_=v,v=void 0),v===void 0&&(v=Bo(_,b.type)??pZ(b,T)),f==null){if(or(v))f=je(v);else if(Qa(v))f=IE(v,...se(x));else if(b.interval){let R=b.interval;if(b.ticks){let[I,E]=se(x),O=(E-I)/R[hf];R=vT(R,O/v)??R,f=IE(R,I,E)}else{f=x;let I=f.length;R=vT(R,I/v)??R,R!==b.interval&&(f=IE(R,...se(f)))}if(R===b.interval){let I=Math.round(f.length/v);I>1&&(f=f.filter((E,O)=>O%I===0))}}else b.ticks?f=b.ticks(v):f=x;if(!b.ticks&&f.length&&f!==x){let R=new Cr(x);f=f.filter(I=>R.has(I)),f.length||qn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[ir(f)]:a[t]={scale:t,value:W}}s?.call(this,b,f,v,w,a);let M=Object.fromEntries(Object.entries(a).map(([R,I])=>[R,{...I,value:dt(f,I.value)}]));return m&&(d=g.filterFacets(f,M)),{data:f,facets:d,channels:M}}let l=ve(o).initializer,u=e(i,ve({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function pZ(e,t){let[n,r]=se(e.range());return(r-n)/t}function PF(e,t,n,r,i){return{value:Em(e,t,n,r,i)}}function Em(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Re(t)?bk(e.type,t,i)??Yi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?Yi:typeof r=="string"?(Re(e.domain())?ko:li)(r):pn(r)}function IE(e,t,n){return e.range(t,e.offset(e.floor(n)))}var mZ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},yZ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},gZ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},bZ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function $F(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function UF(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&jF(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=f_(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 zF(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Ze(e,"labelArrow",["auto","up","right","down","left"])}function jF(e){return Re(e.domain())}function qF(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function VF(e,{opacity:t,...n}={}){if(!Uo(e)&&!oE(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return GF(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ie(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function YF(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:ne(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Ne(t),[f,d]=Ne(r),h=qF(c,l),p=qF(c,f),y=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],GF(e,a,(g,m,b,x)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",b).attr("height",x).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",n).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Kn();return e.scale(_).draw(v,y),v}))}function GF(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=b_(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=ec(t);u=If(u),i=Em(e.scale,e.domain,void 0,i);let p=at("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),y;return r!=null?(y=`:where(.${u}-swatches-columns .${u}-swatch) {
27
+ `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var aB={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 y_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Cf(e,i))r+=aB[e[i]]??(hB(e,i)?120:aB.e);return r}function g_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Cf(e,i))r+=hB(e,i)?126:63;return r}function PE({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?g_:y_,i=t*100;return o=>$Z(o,i,r)}function UE({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?g_:y_,i=t*100;switch(n){case"clip-start":return o=>lB(o,i,r,"");case"clip-end":return o=>cB(o,i,r,"");case"ellipsis-start":return o=>lB(o,i,r,Nl);case"ellipsis-middle":return o=>qZ(o,i,r,Nl);case"ellipsis-end":return o=>cB(o,i,r,Nl)}}var Nl="\u2026";function Ol(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Cf(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 cB(e,t,n,r){e=e.trim();let i=n(r),[o]=Ol(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function qZ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Ol(e,t/2,n,o),[c]=Ol(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Cf(e,c)).trimStart()}function lB(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Ol(e,i-t+o,n,-o);return s<0?r:r+e.slice(Cf(e,s)).trimStart()}var LE=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,uB=/\p{Extended_Pictographic}/uy;function Cf(e,t){return t+=jZ(e,t)?2:1,YZ(e,t)&&(t=LE.lastIndex),VZ(e,t)?Cf(e,t+1):t}function dB(e,t){return e.charCodeAt(t)<128}function jZ(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 VZ(e,t){return e.charCodeAt(t)===8205}function YZ(e,t){return dB(e,t)?!1:(LE.lastIndex=t,LE.test(e))}function hB(e,t){return dB(e,t)?!1:(uB.lastIndex=t,uB.test(e))}var pB={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},mB=3.5,GZ=mB*5,yB={draw(e,t,n){let r=t*n/GZ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},gB={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},WZ=new Map([["arrow",yB],["spike",gB]]);function XZ(e){return e&&typeof e.draw=="function"}function HZ(e){if(XZ(e))return e;let t=WZ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Dl=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o=mB,length:s,rotate:a,shape:c=yB,anchor:l="middle",frameAnchor:u}=n,[f,d]=ie(s,12),[h,p]=ie(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,pB),this.r=+o,this.length=d,this.rotate=p,this.shape=HZ(c),this.anchor=Ke(l,"anchor",["start","middle","end"]),this.frameAnchor=ko(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:y,r:b}=this,[m,g]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Rt,this).attr("transform",rc`translate(${c?_=>c[_]:m},${l?_=>l[_]:g})${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=Jn();return y.draw(v,u[_],b),v}:(()=>{let _=Jn();return y.draw(_,d,b),_})()).call(Zt,this,r)).node()}};function $E(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Be(n,r)),new Dl(e,{...i,x:n,y:r})}function b_(e,t={}){let{x:n=W,...r}=t;return new Dl(e,{...r,x:n})}function x_(e,t={}){let{y:n=W,...r}=t;return new Dl(e,{...r,y:n})}function bB(e,t={}){let{shape:n=gB,stroke:r=pB.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return $E(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function ic(e,t){return arguments.length<2&&!sr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function __({anchor:e}={},t){return e===void 0?t[0]:Ke(e,"anchor",t)}function xB(e){return __(e,["left","right"])}function _B(e){return __(e,["right","left"])}function wB(e){return __(e,["bottom","top"])}function vB(e){return __(e,["top","bottom"])}function Om(){let[e,t]=ic(...arguments);return SB("y",xB(t),e,t)}function w_(){let[e,t]=ic(...arguments);return SB("fy",_B(t),e,t)}function Dm(){let[e,t]=ic(...arguments);return IB("x",wB(t),e,t)}function v_(){let[e,t]=ic(...arguments);return IB("fx",vB(t),e,t)}function SB(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:y,tickRotate:b,x:m,margin:g,marginTop:x=g===void 0?20:g,marginRight:_=g===void 0?t==="right"?40:0:g,marginBottom:v=g===void 0?20:g,marginLeft:w=g===void 0?t==="left"?40:0:g,label:T,labelAnchor:A,labelArrow:R,labelOffset:I,...E}){return p=Nt(p),y=Nt(y),b=Nt(b),A!==void 0&&(A=Ke(A,"labelAnchor",["center","top","bottom"])),R=DB(R),Je(p&&!ne(o)?ZZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:b,x:m,...E}):null,ne(c)?null:KZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:b,x:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?Bo([],AB({fill:c,fillOpacity:l,...E},function(O,k,S,M,N){let F=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:U}=e==="y"&&N.inset||N,$=A??(F.bandwidth?"center":"top"),X=I??(t==="right"?C:U)-3;return $==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=$,this.frameAnchor=`${$}-${t}`,this.rotate=0),this.dy=$==="top"?3-B:$==="bottom"?P-3:0,this.dx=t==="right"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[OB(e,F,{anchor:t,label:T,labelAnchor:$,labelArrow:R})]}}}})):null)}function IB(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:y,tickRotate:b,y:m,margin:g,marginTop:x=g===void 0?t==="top"?30:0:g,marginRight:_=g===void 0?20:g,marginBottom:v=g===void 0?t==="bottom"?30:0:g,marginLeft:w=g===void 0?20:g,label:T,labelAnchor:A,labelArrow:R,labelOffset:I,...E}){return p=Nt(p),y=Nt(y),b=Nt(b),A!==void 0&&(A=Ke(A,"labelAnchor",["center","left","right"])),R=DB(R),Je(p&&!ne(o)?QZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:b,y:m,...E}):null,ne(c)?null:JZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:b,y:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?Bo([],AB({fill:c,fillOpacity:l,...E},function(O,k,S,M,N){let F=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:U}=e==="x"&&N.inset||N,$=A??(F.bandwidth?"center":"right"),X=I??(t==="top"?B:P)-3;return $==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${$}`,this.textAnchor=$==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-X:X,this.dx=$==="right"?C-3:$==="left"?3-U:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[OB(e,F,{anchor:t,label:T,labelAnchor:$,labelArrow:R})]}}}})):null)}function ZZ(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 Bf(x_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-De+ +u:+d+De-f,anchor:"start",length:c,shape:t==="left"?rQ:iQ})}function QZ(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 Bf(b_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-De-f:+d+De+ +u,anchor:"start",length:c,shape:t==="bottom"?eQ:nQ})}function KZ(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*Lf):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:y=0,y:b=e==="y"?void 0:null,...m}){return Bf(m_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:b,...m,dx:t==="left"?+y-o-a+ +h:+y+ +o+ +a-p},function(g,x,_,v,w){f===void 0&&(this.fontVariant=RB(g)),c===void 0&&(w.text=NB(g,x,_,v,t))})}function JZ(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*Lf):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:y=0,x:b=e==="x"?void 0:null,...m}){return Bf(p_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:b,...m,dy:t==="bottom"?+y+ +o+ +a-p:+y-o-a+ +h},function(g,x,_,v,w){f===void 0&&(this.fontVariant=RB(g)),c===void 0&&(w.text=NB(g,x,_,v,t))})}function S_(){let[e,t]=ic(...arguments);return TB("y",xB(t),e,t)}function I_(){let[e,t]=ic(...arguments);return TB("fy",_B(t),e,t)}function T_(){let[e,t]=ic(...arguments);return EB("x",wB(t),e,t)}function E_(){let[e,t]=ic(...arguments);return EB("fx",vB(t),e,t)}function TB(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 Bf(jr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...MB(a)})}function EB(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 Bf(qr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...MB(a)})}function MB({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 AB({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]=Re(e),[,t]=ie(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 Bf(e,t,n,r,i,o,s){let a;function c(f,d,h,p,y,b){let m=f==null&&(t==="fx"||t==="fy"),{[t]:g}=p;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:_,ticks:v,tickFormat:w,tickSpacing:T=t==="x"?80:35}=o;if(typeof v=="string"&&kB(g)&&(_=v,v=void 0),v===void 0&&(v=Do(_,g.type)??tQ(g,T)),f==null){if(sr(v))f=qe(v);else if(Ha(v))f=zE(v,...ae(x));else if(g.interval){let R=g.interval;if(g.ticks){let[I,E]=ae(x),O=(E-I)/R[pf];R=UT(R,O/v)??R,f=zE(R,I,E)}else{f=x;let I=f.length;R=UT(R,I/v)??R,R!==g.interval&&(f=zE(R,...ae(f)))}if(R===g.interval){let I=Math.round(f.length/v);I>1&&(f=f.filter((E,O)=>O%I===0))}}else g.ticks?f=g.ticks(v):f=x;if(!g.ticks&&f.length&&f!==x){let R=new kr(x);f=f.filter(I=>R.has(I)),f.length||qn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[or(f)]:a[t]={scale:t,value:W}}s?.call(this,g,f,v,w,a);let A=Object.fromEntries(Object.entries(a).map(([R,I])=>[R,{...I,value:mt(f,I.value)}]));return m&&(d=b.filterFacets(f,A)),{data:f,facets:d,channels:A}}let l=Se(o).initializer,u=e(i,Se({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function tQ(e,t){let[n,r]=ae(e.range());return(r-n)/t}function NB(e,t,n,r,i){return{value:km(e,t,n,r,i)}}function km(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Oe(t)?l5(e.type,t,i)??zi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?zi:typeof r=="string"?(Oe(e.domain())?Mo:ci)(r):dn(r)}function zE(e,t,n){return e.range(t,e.offset(e.floor(n)))}var eQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},nQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},rQ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},iQ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function RB(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function OB(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&kB(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=e_(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 DB(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Ke(e,"labelArrow",["auto","up","right","down","left"])}function kB(e){return Oe(e.domain())}function FB(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function LB(e,{opacity:t,...n}={}){if(!Lo(e)&&!vE(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return BB(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ie(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function CB(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:ne(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Re(t),[f,d]=Re(r),h=FB(c,l),p=FB(c,f),y=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],BB(e,a,(b,m,g,x)=>b.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",x).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",n).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Jn();return e.scale(_).draw(v,y),v}))}function BB(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=c_(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=tc(t);u=Tf(u),i=km(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),y;return r!=null?(y=`:where(.${u}-swatches-columns .${u}-swatch) {
27
28
  display: flex;
28
29
  align-items: center;
29
30
  break-inside: avoid;
@@ -36,7 +37,7 @@ ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let
36
37
  white-space: nowrap;
37
38
  overflow: hidden;
38
39
  text-overflow: ellipsis;
39
- }`,p.style("columns",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,c).call(g=>g.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(y=`: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(b=>b.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(y=`:where(.${u}-swatches-wrap) {
40
41
  display: flex;
41
42
  align-items: center;
42
43
  min-height: 33px;
@@ -46,7 +47,7 @@ ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let
46
47
  display: inline-flex;
47
48
  align-items: center;
48
49
  margin-right: 1em;
49
- }`,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(g=>g.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(b=>b.insert("style","*").text(`:where(.${u}-swatches) {
50
51
  font-family: system-ui, sans-serif;
51
52
  font-size: 10px;
52
53
  margin-bottom: 0.5em;
@@ -55,7 +56,7 @@ ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let
55
56
  margin-right: 0.5em;
56
57
  overflow: visible;
57
58
  }
58
- ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",ce(o,"normal")).call(Tf,f).node()}var B_=new Map([["symbol",YF],["color",HF],["opacity",xZ]]);function WF(e={}){for(let[t,n]of B_){let r=e[t];if(Lo(r)){let i=ec(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Lo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(h_(t,r,o),TE(i,r,e),s=>Lo(e[s])?h_(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function XF(e,t,n={}){return(r,i)=>{if(!B_.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return B_.get(r)(e[r],TE(t,n[r],i),o=>e[o])}}function TE({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return kk(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function HF(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return VF(e,n);case"ramp":return sF(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function xZ({type:e,interpolate:t,...n},{legend:r=!0,color:i=ln(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 HF({type:e,...n,interpolate:_Z(i)},{legend:r,...o})}function _Z(e){let{r:t,g:n,b:r}=ln(e)||ln(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function QF(e,t,n){let r=[];for(let[i,o]of B_){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],TE(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var wZ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},vZ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Am=class extends mt{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Wa,void 0,t,n==null?wZ:vZ),this.anchor=AT(n,"anchor",["top","right","bottom","left"]),this.insetTop=It(i),this.insetRight=It(o),this.insetBottom=It(s),this.insetLeft=It(a),this.rx=It(c),this.ry=It(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:y,insetLeft:g,rx:m,ry:b}=this,x=l+g,_=u-a-p,v=s+h,w=f-c-y;return at(d?"svg:line":"svg:rect",o).datum(0).call(Mt,this,i,o).call(Tt,this).call(Qt,this,r).call(bt,this,{}).call(d==="left"?T=>T.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",w):d==="right"?T=>T.attr("x1",_).attr("x2",_).attr("y1",v).attr("y2",w):d==="top"?T=>T.attr("x1",x).attr("x2",_).attr("y1",v).attr("y2",v):d==="bottom"?T=>T.attr("x1",x).attr("x2",_).attr("y1",w).attr("y2",w):T=>T.attr("x",x).attr("y",v).attr("width",_-x).attr("height",w-v).attr("rx",m).attr("ry",b)).node()}};function Bf(e){return new Am(e)}var EE={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},SZ=new Set(["geometry","href","src","ariaLabel","scales"]),Mm=class extends mt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&or(t)&&Y1(t)&&(n={...n,title:W});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:y,fontWeight:g,lineHeight:m=1,lineWidth:b=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:M,pointerSize:R=12,pathFilter:I="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:M,optional:!0}},n,EE),this.anchor=W1(l,"anchor"),this.preferredAnchor=W1(u,"preferredAnchor"),this.frameAnchor=Po(x),this.textAnchor=ce(v,"middle"),this.textPadding=+T,this.pointerSize=+R,this.pathFilter=ze(I),this.lineHeight=+m,this.lineWidth=+b,this.textOverflow=xE(w),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=It(h),this.fontStyle=ze(p),this.fontVariant=ze(y),this.fontWeight=ze(g);for(let E in EE)E in this.channels&&(this[E]=EE[E]);this.splitLines=wE(this),this.clipLine=vE(this),this.format={..._}}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:y,lineWidth:g}=this,{textPadding:m,pointerSize:b,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:M,y2:R,x:I=w??M,y:E=T??R}=r,O=l?l(t.fx)-v:0,F=u?u(t.fy)-_:0,[S,A]=bn(this,i),N=dE(r,S),D=hE(r,A),B=p?A_:E_,C=B(Ml),P,$;"title"in r?(P=r.channels,$=MZ):(P=AZ.call(this,r,n),$=NZ);let U=at("svg:g",o).call(Mt,this,i,o).call(_E,this).call(bt,this,{x:I&&a,y:E&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(D(st))})`).call(Tt,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(Y){let rt=zt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let j=$.call(s,Y,t,P,n,r);if(typeof j=="string")for(let H of s.splitLines(j))X(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of j){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),X(rt,ot))}}})));function X(nt,{label:st,value:Y,color:rt,opacity:j}){st??="",Y??="";let H=rt!=null||j!=null,ot,z=g*100,[Nt]=Rl(st,z,B,C);if(Nt>=0)st=st.slice(0,Nt).trimEnd()+Ml,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=Rl(Y,z-B(st),B,C);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Ml)}let lt=nt.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");st&&lt.append("tspan").attr("font-weight","bold").text(st),Y&&lt.append(()=>d.createTextNode(Y)),H&&lt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",j).style("user-select","none"),ot&&lt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:j,height:H}=this.getBBox();j=Math.round(j),H=Math.round(H);let ot=h;if(ot===void 0){let lt=N(Y)+O,Wt=D(Y)+F,Xt=lt+j+b+m*2<nt,et=lt-j-b-m*2>0,oe=Wt+H+b+m*2<st,Ir=Wt-H-b-m*2>0;ot=Xt&&et?oe&&Ir?s.preferredAnchor:Ir?"bottom":"top":oe&&Ir?Xt?"left":"right":(Xt||et)&&(oe||Ir)?`${Ir?"bottom":"top"}-${Xt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Nt=this.lastChild;if(z.setAttribute("d",EZ(ot,b,m,j,H)),rt)for(let lt of Nt.childNodes)lt.setAttribute("x",-rt);Nt.setAttribute("y",`${+IZ(ot,Nt.childNodes.length,y).toFixed(6)}em`),Nt.setAttribute("transform",`translate(${TZ(ot,b,m,j,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function $_(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Mm(e,{...r,x:t,y:n})}function IZ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function TZ(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 EZ(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 AZ({channels:e},t){let n={},r=this.format;r=ZF(r,e,"x"),r=ZF(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=ym(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||SZ.has(i))continue;let o=ym(e,i);o&&(n[i]=o)}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Re(s)?ko:li)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Em(s,s.domain()):Yi}}return n}function ZF(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 MZ(e,t,{title:n}){return Yi(n.value[e],e)}function*NZ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:P_(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:JF(r,n,"x"),value:KF(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:JF(r,n,"y"),value:KF(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ue(a)&&c==null)continue;yield{label:P_(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function KF(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 JF(e,t,n){let r=P_(e,t,`${n}1`,n),i=P_(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function P_(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Rm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=If(e.className),l=e.marks===void 0?[]:eD(e.marks);l.push(...CZ(l));let u=DZ(t,e),f=new Map;for(let C of l){let P=nD(C,u,e);P&&f.set(C,P)}let d=new Map;u&&Nm(d,[u],e),Nm(d,f,e);let h=eD(BZ(l,d,e));for(let C of h){let P=nD(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=tF(d,e);if(p!==void 0){let C=u?g_(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?g_(p,U):C)}let P=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,X)=>{U?.length>0&&P.add(X)});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=rF(U.facetsIndex))}}for(let C of ue.keys())Lo(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let y=new Map;for(let C of l){if(y.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:$}=f.get(C)??{},{data:U,facets:X,channels:tt}=C.initialize(P,$,e);NE(tt,e),y.set(C,{data:U,facets:X,channels:tt})}let g=wm(Nm(d,y,e),e),m=K8(g,l,e);Y8(g,m);let b=rE(g),{fx:x,fy:_}=b,v=x||_?iE(g,m):m,w=x||_?VZ(b,m):m,T=ec(e),M=T.document,R=Is("svg").call(M.documentElement),I=R;T.ownerSVGElement=R,T.className=c,T.projection=i8(e,v),T.filterFacets=(C,P)=>g_(p,{channels:P,groups:m_(C,P)}),T.getMarkState=C=>{let P=y.get(C),$=f.get(C);return{...P,channels:{...P.channels,...$?.channels}}},T.dispatchValue=C=>{I.value!==C&&(I.value=C,I.dispatchEvent(new Event("input",{bubbles:!0})))};let E=new Set;for(let[C,P]of y)if(C.initializer!=null){let $=C.facet==="super"?w:v,U=C.initializer(P.data,P.facets,P.channels,b,$,T);if(U.data!==void 0&&(P.data=U.data),U.facets!==void 0&&(P.facets=U.facets),U.channels!==void 0){let{fx:X,fy:tt,...nt}=U.channels;FZ(nt),Object.assign(P.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!Dk(ue.get(Y))&&(oD(st,e),E.add(Y))}(X!=null||tt!=null)&&f.set(C,!0)}}if(E.size){let C=new Map;Nm(C,y,e,X=>E.has(X)),Nm(d,y,e,X=>E.has(X));let P=qZ(wm(C,e),g),{scales:$,...U}=rE(P);Object.assign(g,P),Object.assign(b,U),Object.assign(b.scales,$)}let O,F;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=eF(p,O),F=nF(x,_,m));for(let[C,P]of y)P.values=C.scale(P.channels,b,T);let{width:S,height:A}=m;zt(R).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",A).attr("viewBox",`0 0 ${S} ${A}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
59
+ ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",le(o,"normal")).call(Ef,f).node()}var M_=new Map([["symbol",CB],["color",$B],["opacity",oQ]]);function PB(e={}){for(let[t,n]of M_){let r=e[t];if(Ro(r)){let i=tc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Ro(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(r_(t,r,o),qE(i,r,e),s=>Ro(e[s])?r_(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function UB(e,t,n={}){return(r,i)=>{if(!M_.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return M_.get(r)(e[r],qE(t,n[r],i),o=>e[o])}}function qE({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return S5(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function $B(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return LB(e,n);case"ramp":return QC(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function oQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=an(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 $B({type:e,...n,interpolate:sQ(i)},{legend:r,...o})}function sQ(e){let{r:t,g:n,b:r}=an(e)||an(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function zB(e,t,n){let r=[];for(let[i,o]of M_){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],qE(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var aQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},cQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Fm=class extends wt{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Ga,void 0,t,n==null?aQ:cQ),this.anchor=VT(n,"anchor",["top","right","bottom","left"]),this.insetTop=Nt(i),this.insetRight=Nt(o),this.insetBottom=Nt(s),this.insetLeft=Nt(a),this.rx=Nt(c),this.ry=Nt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:y,insetLeft:b,rx:m,ry:g}=this,x=l+b,_=u-a-p,v=s+h,w=f-c-y;return ct(d?"svg:line":"svg:rect",o).datum(0).call(Ft,this,i,o).call(Rt,this).call(Zt,this,r).call(It,this,{}).call(d==="left"?T=>T.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",w):d==="right"?T=>T.attr("x1",_).attr("x2",_).attr("y1",v).attr("y2",w):d==="top"?T=>T.attr("x1",x).attr("x2",_).attr("y1",v).attr("y2",v):d==="bottom"?T=>T.attr("x1",x).attr("x2",_).attr("y1",w).attr("y2",w):T=>T.attr("x",x).attr("y",v).attr("width",_-x).attr("height",w-v).attr("rx",m).attr("ry",g)).node()}};function Pf(e){return new Fm(e)}var jE={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},lQ=new Set(["geometry","href","src","ariaLabel","scales"]),Lm=class extends wt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&sr(t)&&L1(t)&&(n={...n,title:W});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:y,fontWeight:b,lineHeight:m=1,lineWidth:g=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:A,pointerSize:R=12,pathFilter:I="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,jE),this.anchor=B1(l,"anchor"),this.preferredAnchor=B1(u,"preferredAnchor"),this.frameAnchor=ko(x),this.textAnchor=le(v,"middle"),this.textPadding=+T,this.pointerSize=+R,this.pathFilter=ze(I),this.lineHeight=+m,this.lineWidth=+g,this.textOverflow=CE(w),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=Nt(h),this.fontStyle=ze(p),this.fontVariant=ze(y),this.fontWeight=ze(b);for(let E in jE)E in this.channels&&(this[E]=jE[E]);this.splitLines=PE(this),this.clipLine=UE(this),this.format={..._}}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:y,lineWidth:b}=this,{textPadding:m,pointerSize:g,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:A,y2:R,x:I=w??A,y:E=T??R}=r,O=l?l(t.fx)-v:0,k=u?u(t.fy)-_:0,[S,M]=yn(this,i),N=NE(r,S),F=RE(r,M),B=p?g_:y_,C=B(Nl),P,U;"title"in r?(P=r.channels,U=pQ):(P=hQ.call(this,r,n),U=mQ);let $=ct("svg:g",o).call(Ft,this,i,o).call(BE,this).call(It,this,{x:I&&a,y:E&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(F(st))})`).call(Rt,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(Y){let rt=zt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=U.call(s,Y,t,P,n,r);if(typeof q=="string")for(let H of s.splitLines(q))X(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of q){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),X(rt,ot))}}})));function X(nt,{label:st,value:Y,color:rt,opacity:q}){st??="",Y??="";let H=rt!=null||q!=null,ot,z=b*100,[Lt]=Ol(st,z,B,C);if(Lt>=0)st=st.slice(0,Lt).trimEnd()+Nl,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=Ol(Y,z-B(st),B,C);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Nl)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");st&&dt.append("tspan").attr("font-weight","bold").text(st),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",q).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;$.selectChildren().each(function(Y){let{x:rt,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let ot=h;if(ot===void 0){let dt=N(Y)+O,Wt=F(Y)+k,Xt=dt+q+g+m*2<nt,et=dt-q-g-m*2>0,oe=Wt+H+g+m*2<st,xr=Wt-H-g-m*2>0;ot=Xt&&et?oe&&xr?s.preferredAnchor:xr?"bottom":"top":oe&&xr?Xt?"left":"right":(Xt||et)&&(oe||xr)?`${xr?"bottom":"top"}-${Xt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Lt=this.lastChild;if(z.setAttribute("d",dQ(ot,g,m,q,H)),rt)for(let dt of Lt.childNodes)dt.setAttribute("x",-rt);Lt.setAttribute("y",`${+uQ(ot,Lt.childNodes.length,y).toFixed(6)}em`),Lt.setAttribute("transform",`translate(${fQ(ot,g,m,q,H)})`)}),$.attr("visibility",null)}return t.length&&($.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),$.node()}};function N_(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Lm(e,{...r,x:t,y:n})}function uQ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function fQ(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function dQ(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 hQ({channels:e},t){let n={},r=this.format;r=qB(r,e,"x"),r=qB(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=Sm(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||lQ.has(i))continue;let o=Sm(e,i);o&&(n[i]=o)}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Oe(s)?Mo:ci)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?km(s,s.domain()):zi}}return n}function qB(e,t,n){if(!(n in e))return e;let r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function pQ(e,t,{title:n}){return zi(n.value[e],e)}function*mQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:A_(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:VB(r,n,"x"),value:jB(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:VB(r,n,"y"),value:jB(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!$e(a)&&c==null)continue;yield{label:A_(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function jB(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 VB(e,t,n){let r=A_(e,t,`${n}1`,n),i=A_(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function A_(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Bm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Tf(e.className),l=e.marks===void 0?[]:GB(e.marks);l.push(...vQ(l));let u=_Q(t,e),f=new Map;for(let C of l){let P=WB(C,u,e);P&&f.set(C,P)}let d=new Map;u&&Cm(d,[u],e),Cm(d,f,e);let h=GB(SQ(l,d,e));for(let C of h){let P=WB(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=YC(d,e);if(p!==void 0){let C=u?a_(p,u):void 0;for(let U of l){if(U.facet===null||U.facet==="super")continue;let $=f.get(U);$!==void 0&&($.facetsIndex=U.fx!=null||U.fy!=null?a_(p,$):C)}let P=new Set;for(let{facetsIndex:U}of f.values())U?.forEach(($,X)=>{$?.length>0&&P.add(X)});p.forEach(0<P.size&&P.size<p.length?(U,$)=>U.empty=!P.has($):U=>U.empty=!1);for(let U of l)if(U.facet==="exclude"){let $=f.get(U);$!==void 0&&($.facetsIndex=XC($.facetsIndex))}}for(let C of fe.keys())Ro(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let y=new Map;for(let C of l){if(y.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:U}=f.get(C)??{},{data:$,facets:X,channels:tt}=C.initialize(P,U,e);GE(tt,e),y.set(C,{data:$,facets:X,channels:tt})}let b=Am(Cm(d,y,e),e),m=jC(b,l,e);CC(b,m);let g=_E(b),{fx:x,fy:_}=g,v=x||_?wE(b,m):m,w=x||_?RQ(g,m):m,T=tc(e),A=T.document,R=Ts("svg").call(A.documentElement),I=R;T.ownerSVGElement=R,T.className=c,T.projection=H5(e,v),T.filterFacets=(C,P)=>a_(p,{channels:P,groups:o_(C,P)}),T.getMarkState=C=>{let P=y.get(C),U=f.get(C);return{...P,channels:{...P.channels,...U?.channels}}},T.dispatchValue=C=>{I.value!==C&&(I.value=C,I.dispatchEvent(new Event("input",{bubbles:!0})))};let E=new Set;for(let[C,P]of y)if(C.initializer!=null){let U=C.facet==="super"?w:v,$=C.initializer(P.data,P.facets,P.channels,g,U,T);if($.data!==void 0&&(P.data=$.data),$.facets!==void 0&&(P.facets=$.facets),$.channels!==void 0){let{fx:X,fy:tt,...nt}=$.channels;xQ(nt),Object.assign(P.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!T5(fe.get(Y))&&(ZB(st,e),E.add(Y))}(X!=null||tt!=null)&&f.set(C,!0)}}if(E.size){let C=new Map;Cm(C,y,e,X=>E.has(X)),Cm(d,y,e,X=>E.has(X));let P=NQ(Am(C,e),b),{scales:U,...$}=_E(P);Object.assign(b,P),Object.assign(g,$),Object.assign(g.scales,U)}let O,k;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=GC(p,O),k=WC(x,_,m));for(let[C,P]of y)P.values=C.scale(P.channels,g,T);let{width:S,height:M}=m;zt(R).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",M).attr("viewBox",`0 0 ${S} ${M}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
59
60
  --plot-background: white;
60
61
  display: block;
61
62
  height: auto;
@@ -65,26 +66,4 @@ ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
65
66
  :where(.${c} text),
66
67
  :where(.${c} tspan) {
67
68
  white-space: pre;
68
- }`)).call(Tf,n);for(let C of l){let{channels:P,values:$,facets:U}=y.get(C);if(p===void 0||C.facet==="super"){let X=null;if(U&&(X=U[0],X=C.filter(X,P,$),X.length===0))continue;let tt=C.render(X,b,$,w,T);if(tt==null)continue;R.appendChild(tt)}else{let X;for(let tt of p){if(!(C.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if(U){let Y=f.has(C);if(nt=U[Y?tt.i:0],nt=C.filter(nt,P,$),nt.length===0)continue;!Y&&nt===U[0]&&(nt=qs(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=C.render(nt,b,$,v,T);if(st!=null){(X??=zt(R).append("g")).append(()=>st).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(Y)&&(X.attr(Y,st.getAttribute(Y)),st.removeAttribute(Y))}}X?.selectChildren().attr("transform",F)}}let N=QF(g,T,e),{figure:D=r!=null||i!=null||o!=null||N.length>0}=e;D&&(I=M.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(tD(M,r,"h2")),i!=null&&I.append(tD(M,i,"h3")),I.append(...N,R),o!=null&&I.append(RZ(M,o))),I.scale=H8(b.scales),I.legend=XF(g,T,e);let B=t8();return B>0&&zt(R).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.`),I}function tD(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function RZ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function OZ({marks:e=[],...t}={}){return Rm({...t,marks:[...e,this]})}mt.prototype.plot=OZ;function eD(e){return e.flat(1/0).filter(t=>t!=null).map(kZ)}function kZ(e){return typeof e.render=="function"?e:new ME(e)}var ME=class extends mt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function NE(e,t){for(let n in e)oD(e[n],t);return e}function oD(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:OT(s,i)}=t[n]??{};a!=null&&(e.value=Yt(e.value,a),e.transform=!1)}function FZ(e){for(let t in e)YT(t,e[t])}function Nm(e,t,n,r=wk){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(!a8(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=l8(s);c&&AE(e,"x",u),l&&AE(e,"y",f)}}}else AE(e,a,s)}return e}function AE(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function DZ(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=je(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=vf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=vf(i,{value:r,scale:"fy"})),NE(o,t);let s=m_(i,o);return{channels:o,groups:s,data:e.data}}function nD(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=je(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=vf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=vf(c,{value:i,scale:"fy"})),NE(l,n),{channels:l,groups:m_(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&je(e.data)?.length===a.length&&qn(`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 LZ(e,t={}){return ve({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function CZ(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)?Ff:/^y$/i.test(i)?Tl:kf,r=i(LZ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Tl?"left":"bottom");let s=$_(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function BZ(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:y=c,grid:g=y===null?null:l}=o,fx:{axis:m=f,grid:b=m===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=n;(r||!Lo(i)&&!rD("x",e))&&(h=p=null),(r||!Lo(o)&&!rD("y",e))&&(y=g=null),t.has("fx")||(m=b=null),t.has("fy")||(x=_=null),h===void 0&&(h=!j_(e,"x")),y===void 0&&(y=!j_(e,"y")),m===void 0&&(m=!j_(e,"fx")),x===void 0&&(x=!j_(e,"fy")),h===!0&&(h="bottom"),y===!0&&(y="left"),m===!0&&(m=h==="top"||h===null?"bottom":"top"),x===!0&&(x=y==="right"||y===null?"left":"right");let v=[];return z_(v,_,D_,a),U_(v,x,O_,"right","left",u,a),z_(v,b,C_,s),U_(v,m,k_,"top","bottom",u,s),z_(v,g,F_,o),U_(v,y,Im,"left","right",n,o),z_(v,p,L_,i),U_(v,h,Tm,"bottom","top",n,i),v}function U_(e,t,n,r,i,o,s){if(!t)return;let a=PZ(t);s=$Z(a?r:t,o,s);let{line:c}=s;(n===Im||n===Tm)&&c&&!Gs(c)&&e.push(Bf(UZ(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function z_(e,t,n,r){!t||Gs(t)||e.push(n(zZ(t,r)))}function PZ(e){return/^\s*both\s*$/i.test(e)}function $Z(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:y}){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:y}}function UZ(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function zZ(e,{stroke:t=Za(e)?e:void 0,ticks:n=jZ(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function jZ(e){switch(typeof e){case"number":return!0;case"string":return!Za(e)}return or(e)||typeof e?.range=="function"}function j_(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function rD(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 qZ(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 VZ({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=d_(n),l=e&&iD(e),u=t&&iD(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 iD(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var YZ=new Map([["basis",ZI],["basis-closed",KI],["basis-open",JI],["bundle",tT],["bump-x",GI],["bump-y",WI],["cardinal",eT],["cardinal-closed",nT],["cardinal-open",rT],["catmull-rom",iT],["catmull-rom-closed",oT],["catmull-rom-open",sT],["linear",$s],["linear-closed",aT],["monotone-x",lT],["monotone-y",uT],["natural",fT],["step",dT],["step-after",pT],["step-before",hT]]);function Om(e=$s,t){if(typeof e=="function")return e;let n=YZ.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 q_(e=sc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?sc:Om(e,t)}function sc(e){return $s(e)}function qo(e={y:"count"},t={}){[e,t]=OE(e,t);let{x:n,y:r}=t;return RE(V_(n,t,W),null,null,r,e,El(t))}function Vo(e={x:"count"},t={}){[e,t]=OE(e,t);let{x:n,y:r}=t;return RE(null,V_(r,t,W),n,null,e,Al(t))}function Ks(e={fill:"count"},t={}){[e,t]=OE(e,t);let{x:n,y:r}=GZ(t);return RE(n,r,null,null,e,El(Al(t)))}function cD(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=t_}=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 Pf(e={}){return cD(qo,"y",Wi(e,"x"))}function $f(e={}){return cD(Vo,"x",Wi(e,"y"))}function RE(e,t,n,r,{data:i=J1,filter:o=dm,sort:s,reverse:a,...c}={},l={}){e=sD(e),t=sD(t),c=WZ(c,l),i=fD(i,W),s=s==null?void 0:lD("sort",s,l),o=o==null?void 0:uD("filter",o,l),n!=null&&$o(c,"x","x1","x2")&&(n=null),r!=null&&$o(c,"y","y1","y2")&&(r=null);let[u,f]=kn(e),[d,h]=kn(e),[p,y]=kn(t),[g,m]=kn(t),[b,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[_,v]=kn(b),{x:w,y:T,z:M,fill:R,stroke:I,x1:E,x2:O,y1:F,y2:S,domain:A,cumulative:N,thresholds:D,interval:B,...C}=l,[P,$]=kn(M),[U]=Ne(R),[X]=Ne(I),[tt,nt]=kn(U),[st,Y]=kn(X);return{..."z"in l&&{z:P||M},..."fill"in l&&{fill:tt||R},..."stroke"in l&&{stroke:st||I},...gn(C,(rt,j,H)=>{let ot=_l(dt(rt,b),H?.[x]),z=dt(rt,M),Nt=dt(rt,U),lt=dt(rt,X),Wt=mm(c,{z,fill:Nt,stroke:lt}),Xt=[],et=[],oe=ot&&v([]),Ir=z&&$([]),Hi=Nt&&nt([]),H$=lt&&Y([]),qA=e&&f([]),Q$=e&&h([]),VA=t&&y([]),Z$=t&&m([]),K$=QZ(e,t,rt),J$=0;for(let Ul of c)Ul.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let Ul of j){let YA=[];for(let bd of c)bd.scope("facet",Ul);s&&s.scope("facet",Ul),o&&o.scope("facet",Ul);for(let[bd,t9]of Ka(Ul,Wt))for(let[e9,hy]of Ka(t9,ot))for(let[Qi,gc]of K$(hy))if(!(o&&!o.reduce(Qi,gc))){YA.push(J$++),et.push(i.reduceIndex(Qi,rt,gc)),ot&&oe.push(e9),z&&Ir.push(Wt===z?bd:z[(Qi.length>0?Qi:hy)[0]]),Nt&&Hi.push(Wt===Nt?bd:Nt[(Qi.length>0?Qi:hy)[0]]),lt&&H$.push(Wt===lt?bd:lt[(Qi.length>0?Qi:hy)[0]]),qA&&(qA.push(gc.x1),Q$.push(gc.x2)),VA&&(VA.push(gc.y1),Z$.push(gc.y2));for(let n9 of c)n9.reduce(Qi,gc);s&&s.reduce(Qi)}Xt.push(YA)}return qT(Xt,s,a),{data:et,facets:Xt}}),...!$o(c,"x")&&(u?{x1:u,x2:d,x:gf(u,d)}:{x:w,x1:E,x2:O}),...!$o(c,"y")&&(p?{y1:p,y2:g,y:gf(p,g)}:{y:T,y1:F,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:rt,output:j})=>[rt,j]))}}function OE({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function V_(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...mi(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=kE(e.thresholds,e.interval),e}function GZ(e){let{x:t,y:n}=e;return t=V_(t,e),n=V_(n,e),[t.value,n.value]=Le(t.value,n.value),{x:t,y:n}}function sD(e){if(e==null)return;let{value:t,cumulative:n,domain:r=se,thresholds:i}=e,o=s=>{let a=dt(s,t),c;if(Re(a)||HZ(i)){a=Yt(a,ET,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Qa(i)?i(a,u,f):i;typeof d=="number"&&(d=Lp(u,f,d)),Qa(d)&&(r===se&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Qe(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Qa(i)?i(a,u,f):i;if(typeof d=="number")if(r===se){let h=ws(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),y=Math.round(f/h);p*h<=u||--p,y*h>f||++y;let g=y-p+1;d=new Float64Array(g);for(let m=0;m<g;++m)d[m]=(p+m)*h}else if(h<0){h=-h;let p=Math.round(u*h),y=Math.round(f*h);p/h<=u||--p,y/h>f||++y;let g=y-p+1;d=new Float64Array(g);for(let m=0;m<g;++m)d[m]=(p+m)/h}else d=[u];else d=[u]}else d=An(u,f,d);else Qa(d)&&(r===se&&(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?KZ:n>0?ZZ:FE)(l,c,a),l};return o.label=Fn(t),o}function kE(e,t,n=aD){if(e===void 0)return t===void 0?n:Bo(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return C0;case"scott":return Rh;case"sturges":return Ma;case"auto":return aD}return cm(e)}return e}function WZ(e,t){return zT(e,t,lD)}function lD(e,t,n){return Z1(e,t,n,uD)}function uD(e,t,n){return K1(e,t,n,fD)}function fD(e,t){return wf(e,t,XZ)}function XZ(e){switch(`${e}`.toLowerCase()){case"x":return JZ;case"x1":return eK;case"x2":return nK;case"y":return tK;case"y1":return rK;case"y2":return iK}throw new Error(`invalid bin reduce: ${e}`)}function aD(e,t,n){return Math.min(200,Rh(e,t,n))}function HZ(e){return Tk(e)||or(e)&&Re(e)}function QZ(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 FE(e,t,n){return t=Qe(t),r=>{let i=e.map(()=>[]);for(let o of r)i[_s(t,n[o])-1]?.push(o);return i}}function ZZ(e,t,n){let r=FE(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 KZ(e,t,n){let r=FE(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 dD(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var JZ={reduceIndex(e,t,{x1:n,x2:r}){return dD(n,r)}},tK={reduceIndex(e,t,{y1:n,y2:r}){return dD(n,r)}},eK={reduceIndex(e,t,{x1:n}){return n}},nK={reduceIndex(e,t,{x2:n}){return n}},rK={reduceIndex(e,t,{y1:n}){return n}},iK={reduceIndex(e,t,{y2:n}){return n}};function Uf(e={}){return MT(e)?e:{...e,x:W}}function zf(e={}){return NT(e)?e:{...e,y:W}}function hD(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Ha(e);let o=e[ST]=new Uint32Array(n+i);t=t.map(a=>Ha(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 DE(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Yf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:gf(c,l)}}function yD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Yf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function gD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Yf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function LE(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Yf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:gf(c,l)}}function bD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Yf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function xD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Yf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function jf({x:e,x1:t,x2:n,...r}={}){return r=Wi(r,"y"),t===void 0&&n===void 0?DE({x:e,...r}):([t,n]=RT(e,t,n),{...r,x1:t,x2:n})}function qf({y:e,y1:t,y2:n,...r}={}){return r=Wi(r,"x"),t===void 0&&n===void 0?LE({y:e,...r}):([t,n]=RT(e,t,n),{...r,y1:t,y2:n})}function Vf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var oK={length:!0};function Yf(e,t=lm,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=jn(a),[l,u]=kn(e),[f,d]=yn(t),[h,p]=yn(t);return f.hint=h.hint=oK,i=sK(i),o=lK(o,i,r),[gn(a,(y,g,m)=>{({data:y,facets:g}=hD(y,g));let b=e==null?void 0:u(_l(dt(y,e),m?.[n])),x=dt(y,t,Float64Array),_=dt(y,c),v=o&&o(y,b,x,_),w=y.length,T=d(new Float64Array(w)),M=p(new Float64Array(w)),R=[];for(let I of g){let E=b?Array.from(cn(I,O=>b[O]).values()):[I];if(v)for(let O of E)O.sort(v);for(let O of E){let F=0,S=0;s&&O.reverse();for(let A of O){let N=x[A];N<0?F=M[A]=(T[A]=F)+N:N>0?S=M[A]=(T[A]=S)+N:M[A]=T[A]=S}}R.push(E)}return i&&i(R,T,M,_),{data:y,facets:g}}),l,f,h]}function sK(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return aK;case"center":case"silhouette":return cK;case"wiggle":return wD}throw new Error(`unknown offset: ${e}`)}}function _D(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 aK(e,t,n){for(let r of e)for(let i of r){let[o,s]=_D(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 cK(e,t,n){for(let r of e){for(let i of r){let[o,s]=_D(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}vD(r,t,n)}SD(e,t,n)}function wD(e,t,n,r){for(let i of e){let o=new Xn,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],y=o.has(c)?p-o.get(c):0;return o.set(c,p),y}),f=[0,...O0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=Mn(l);d&&(s-=Mn(l,(h,p)=>(u[p]/2+f[p])*h)/d)}vD(i,t,n)}SD(e,t,n)}function vD(e,t,n){let r=ae(e,i=>ae(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function SD(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ae(a,c=>t[c])+Ut(a,c=>n[c]))/2),s=ae(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 lK(e,t,n){if(e===void 0&&t===wD)return pD(hn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?gl:hn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return uK(i);case"z":return fK(i);case"sum":return dK(i);case"appearance":return hK(i);case"inside-out":return pD(i)}return mD(IT(e))}if(typeof e=="function")return(e.length===1?mD:pK)(e);if(Array.isArray(e))return mK(e);throw new Error(`invalid order: ${e}`)}}function uK(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function fK(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function dK(e){return Y_(e,(t,n,r,i)=>xu(ir(t),o=>Mn(o,s=>r[s]),o=>i[o]))}function hK(e){return Y_(e,(t,n,r,i)=>xu(ir(t),o=>n[qc(o,s=>r[s])],o=>i[o]))}function pD(e){return Y_(e,(t,n,r,i)=>{let o=ir(t),s=xu(o,f=>n[qc(f,d=>r[d])],f=>i[f]),a=Ui(o,f=>Mn(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 mD(e){return t=>{let n=dt(t,e);return(r,i)=>hn(n[r],n[i])}}function pK(e){return t=>(n,r)=>e(t[n],t[r])}function mK(e){return Y_(hn,()=>e)}function Y_(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Xn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var yK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},kl=class extends mt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:jn(n),optional:!0}},n,yK),this.z=a,this.curve=Om(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 at("svg:g",o).call(Mt,this,i,o).call(bt,this,n,0,0).call(u=>u.selectAll().data(o_(t,[s,a,c,l],this,r)).enter().append("path").call(Tt,this).call(Il,this,r).attr("d",of().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 km(e,t){return t===void 0?Js(e,{x:js,y:Xa}):new kl(e,t)}function ac(e,t){let{y:n=Ie,...r}=$f(t);return new kl(e,jf(Uf({...r,y1:n,y2:void 0})))}function Js(e,t){let{x:n=Ie,...r}=Pf(t);return new kl(e,qf(zf({...r,x1:n,x2:void 0})))}var gK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Fm=class extends mt{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,gK),this.curve=q_(a,c),Xi(this,n)}project(t,n,r){this.curve!==sc&&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 at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",u===sc&&o.projection?bK(o.projection,s,a,c,l):d=>{let h=Kn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Qt,this,r).call(Zs,this,r,o)).node()}};function bK(e,t,n,r,i){let o=Rn(e);return t=Qe(t),n=Qe(n),r=Qe(r),i=Qe(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function G_(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Dm(t,n,r),[o,s]=Dm(i,o,s),new Fm(e,{...a,x1:n,x2:r,y1:o,y2:s})}function Dm(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 xK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},Lm=class extends mt{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,xK),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=_K(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:y,insetEnd:g}=this,m=u?_=>u[_]:pn(f===void 0?1:f),b=h*Df/2,x=p/1.5;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(_=>_.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",v=>{let w=s[v],T=a[v],M=c[v],R=l[v],I=Math.hypot(M-w,R-T);if(I<=y+g)return null;let E=Math.atan2(R-T,M-w),O=Math.min(x*m(v),I/3),F=this.sweep(w,T,M,R)*d*Df,S=Math.hypot(I/Math.tan(F),I)/2;if(y||g)if(S<1e5){let tt=Math.sign(F),[nt,st]=wK([w,T],[M,R],S,tt);if(y&&([w,T]=ID([nt,st,S],[w,T,y],-tt*Math.sign(y))),g){let[Y,rt]=ID([nt,st,S],[M,R,g],tt*Math.sign(g));E+=Math.atan2(rt-st,Y-nt)-Math.atan2(R-st,M-nt),M=Y,R=rt}}else{let tt=M-w,nt=R-T,st=Math.hypot(tt,nt);y&&(w+=tt/st*y,T+=nt/st*y),g&&(M-=tt/st*g,R-=nt/st*g)}let A=E+F,N=A+b,D=A-b,B=M-O*Math.cos(N),C=R-O*Math.sin(N),P=M-O*Math.cos(D),$=R-O*Math.sin(D),U=S<1e5?`A${S},${S} 0,0,${F>0?1:0} `:"L",X=O?`M${B},${C}L${M},${R}L${P},${$}`:"";return`M${w},${T}${U}${M},${R}${X}`}).call(Qt,this,r)).node()}};function _K(e=1){if(typeof e=="number")return pn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Ze(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Gt(t,r);case"-x":return(t,n,r)=>Wn(t,r);case"+y":return(t,n,r,i)=>Gt(n,i);case"-y":return(t,n,r,i)=>Wn(n,i)}}function wK([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 ID([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 TD(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Dm(t,n,r),[o,s]=Dm(i,o,s),new Lm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Gf=class extends mt{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=It(s),this.insetRight=It(a),this.insetBottom=It(c),this.insetLeft=It(l),this.rx=ce(u,"auto"),this.ry=ce(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return at("svg:g",o).call(Mt,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Tt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ct,"rx",s).call(ct,"ry",a).call(Qt,this,r)).node()}_x(t,{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){let{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}},ED={ariaLabel:"bar"},Cm=class extends Gf{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,ED)}_transform(t,n,{x:r}){t.call(bt,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return sr(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 sr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Bm=class extends Gf{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,ED)}_transform(t,n,{y:r}){t.call(bt,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return sr(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 sr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function Yo(e,t={}){return mf(t)||(t={...t,y:Ie,x2:W}),new Cm(e,jf(__(Uf(t))))}function Go(e,t={}){return mf(t)||(t={...t,x:Ie,y2:W}),new Bm(e,qf(w_(zf(t))))}var vK={ariaLabel:"cell"},Fl=class extends Gf{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,vK)}_transform(t,n){t.call(bt,n,{},0,0)}};function cc(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new Fl(e,{...r,x:t,y:n})}function AD(e,{x:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&Ne(r)[0]===void 0&&(n=W),new Fl(e,{...i,x:t,fill:n,stroke:r})}function MD(e,{y:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&Ne(r)[0]===void 0&&(n=W),new Fl(e,{...i,y:t,fill:n,stroke:r})}var SK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Pm(e){return e.sort===void 0&&e.reverse===void 0?H1({channel:"-r"},e):e}var Dl=class extends mt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Us,frameAnchor:c}=n,[l,u]=ie(s,0),[f,d]=Bk(a),[h,p]=ie(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:rr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Pm(n),SK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Po(c);let{channels:y}=this,{symbol:g}=y;if(g){let{fill:m,stroke:b}=y;g.hint={fill:m?m.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:y}=this,[g,m]=bn(this,i),b=y===Us,x=u?void 0:h*h*Math.PI;return qa(h)&&(t=[]),at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(b?"circle":"path").call(Tt,this).call(b?v=>{v.attr("cx",c?w=>c[w]:g).attr("cy",l?w=>l[w]:m).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",ic`translate(${c?w=>c[w]:g},${l?w=>l[w]:m})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=Kn();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=Kn();return y.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=Kn();return d[w].draw(T,x),T}:(()=>{let w=Kn();return y.draw(w,x),w})())}).call(Qt,this,r)).node()}};function gi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Dl(e,{...r,x:t,y:n})}function ND(e,{x:t=W,...n}={}){return new Dl(e,S_({...n,x:t}))}function RD(e,{y:t=W,...n}={}){return new Dl(e,v_({...n,y:t}))}function OD(e,t){return gi(e,{...t,symbol:"circle"})}function kD(e,t){return gi(e,{...t,symbol:"hexagon"})}var IK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Ll=class extends mt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:jn(n),optional:!0}},n,IK),this.z=o,this.curve=q_(s,a),Xi(this,n)}filter(t){return t}project(t,n,r){this.curve!==sc&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(l=>l.selectAll().data(o_(t,[s,a],this,r)).enter().append("path").call(Tt,this).call(Il,this,r).call(lF,this,r,o).attr("d",c===sc&&o.projection?TK(o.projection,s,a):Vp().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function TK(e,t,n){let r=Rn(e);return t=Qe(t),n=Qe(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 Cl(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new Ll(e,{...r,x:t,y:n})}function lc(e,{x:t=W,y:n=Ie,...r}={}){return new Ll(e,$f({...r,x:t,y:n}))}function uc(e,{x:t=Ie,y:n=W,...r}={}){return new Ll(e,Pf({...r,x:t,y:n}))}var EK={ariaLabel:"rect"},Bl=class extends mt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,EK),this.insetTop=It(c),this.insetRight=It(l),this.insetBottom=It(u),this.insetLeft=It(f),this.rx=ce(d,"auto"),this.ry=ce(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:y,width:g,height:m}=i,{projection:b}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:T,ry:M}=this,R=(s?.bandwidth?s.bandwidth():0)-w-_,I=(a?.bandwidth?a.bandwidth():0)-x-v;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{},0,0).call(E=>E.selectAll().data(t).enter().append("rect").call(Tt,this).attr("x",c&&(b||!sr(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:y+w).attr("y",l&&(b||!sr(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(b||!sr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+R):R:g-h-y-_-w).attr("height",l&&(b||!sr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:m-d-p-x-v).call(ct,"rx",T).call(ct,"ry",M).call(Qt,this,r)).node()}};function $m(e,t){return new Bl(e,yE(gE(t)))}function Wf(e,t={}){return mf(t)||(t={...t,y:Ie,x2:W,interval:1}),new Bl(e,jf(gE(Uf(t))))}function Xf(e,t={}){return mf(t)||(t={...t,x:Ie,y2:W,interval:1}),new Bl(e,qf(yE(zf(t))))}function BE(e,t){t=AK(t);let{x:n,y:r,color:i,size:o}=t,s=W_(e,n),a=W_(e,r),c=W_(e,i),l=W_(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...y},y:{value:g,reduce:m,zero:b,...x},color:{value:_,color:v,reduce:w},size:{value:T,reduce:M},mark:R}=t;if(h===void 0&&(h=m==null&&d==null&&T==null&&g!=null?"count":null),m===void 0&&(m=h==null&&g==null&&T==null&&d!=null?"count":null),M===void 0&&T==null&&w==null&&h==null&&m==null&&(d==null||Te(s))&&(g==null||Te(a))&&(M="count"),p===void 0&&(p=X_(h)?!0:void 0),b===void 0&&(b=X_(m)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(m!=null&&d==null)throw new Error("reducing y requires x");R===void 0&&(R=T!=null||M!=null?"dot":X_(h)||X_(m)||w!=null?"bar":d!=null&&g!=null?Te(s)||Te(a)||h==null&&m==null&&!Um(s)&&!Um(a)?"dot":"line":d!=null||g!=null?"rule":null);let I,E,O;switch(R){case"dot":O=gi,E="stroke";break;case"line":O=s&&a||h!=null||m!=null?b||m!=null||s&&Um(s)?uc:p||h!=null||a&&Um(a)?lc:Cl:s?lc:uc,E="stroke",DD(c)&&(I=null);break;case"area":O=!(b||m!=null)&&(p||h!=null||a&&Um(a))?ac:Js,E="fill",DD(c)&&(I=null);break;case"rule":O=s?Yr:Gr,E="stroke";break;case"bar":O=h!=null?Te(a)?FD(h)&&s&&Te(s)?cc:Yo:Wf:m!=null?Te(s)?FD(m)&&a&&Te(a)?cc:Go:Xf:w!=null||M!=null?s&&Te(s)&&a&&Te(a)?cc:s&&Te(s)?Go:a&&Te(a)?Yo:$m:s&&Ys(s)&&!(a&&Ys(a))?Yo:a&&Ys(a)&&!(s&&Ys(s))?Go:cc,E="fill";break;default:throw new Error(`invalid mark: ${R}`)}let F={fx:u,fy:f,x:s??void 0,y:a??void 0,[E]:c??v,z:I,r:l??void 0,tip:!0},S,A={[E]:w??void 0,r:M??void 0};if(h!=null&&m!=null)throw new Error("cannot reduce both x and y");return m!=null?(A.y=m,S=Te(s)?Ja:qo):h!=null?(A.x=h,S=Te(a)?tc:Vo):(w!=null||M!=null)&&(s&&a?S=Te(s)&&Te(a)?pm:Te(s)?Vo:Te(a)?qo:Ks:s?S=Te(s)?Ja:qo:a&&(S=Te(a)?tc:Vo)),(S===Ks||S===qo)&&(F.x={value:s,...y}),(S===Ks||S===Vo)&&(F.y={value:a,...x}),p===void 0&&(p=s&&!(S===Ks||S===qo)&&(O===Yo||O===ac||O===Wf||O===Gr)),b===void 0&&(b=a&&!(S===Ks||S===Vo)&&(O===Go||O===Js||O===Xf||O===Yr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...y},y:{value:g??null,reduce:m??null,zero:!!b,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:M??null},mark:R,markImpl:LD[O],markOptions:F,transformImpl:LD[S],transformOptions:A,colorMode:E}}function CD(e,t){let n=BE(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=CE[n.markImpl],f=CE[n.transformImpl],d=r!=null||i!=null?Bf({strokeOpacity:.1}):null,h=[o?Yr([0]):null,s?Gr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Ke(d,h,p):Ke(d,p,h)}function Um(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Gt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function AK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return qr(e)||(e=Hf(e)),qr(t)||(t=Hf(t)),qr(n)||(n=Za(n)?{color:n}:Hf(n)),qr(r)||(r=Hf(r)),qr(i)&&({value:i}=Hf(i)),qr(o)&&({value:o}=Hf(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function W_(e,t){let n=dt(e,t.value);return n&&(n.label=Fn(t.value)),n}function Hf(e){return MK(e)?{reduce:e}:{value:e}}function X_(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function FD(e){return/^(?:first|last|mode)$/i.test(e)}function MK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&mn(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 DD(e){return e?new Cr(e).size>e.length>>1:!1}var CE={dot:gi,line:Cl,lineX:lc,lineY:uc,areaX:ac,areaY:Js,ruleX:Yr,ruleY:Gr,barX:Yo,barY:Go,rect:$m,rectX:Wf,rectY:Xf,cell:cc,bin:Ks,binX:qo,binY:Vo,group:pm,groupX:Ja,groupY:tc},LD=Object.fromEntries(Object.entries(CE).map(([e,t])=>[t,e]));function Qf(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=W});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),Sr(o,t)}function Zf(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=W});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),Sr(o,t)}function Sr(e={},t={}){let n=jn(t),r=Object.entries(e).map(([i,o])=>{let s=V1(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=yn(s);return{key:i,input:s,output:a,setOutput:c,map:NK(o)}});return{...gn(t,(i,o)=>{let s=dt(i,n),a=r.map(({input:l})=>dt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?cn(l,f=>s[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function NK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&mn(e))return RK(e);if(typeof e=="function")return PE(yf(e));switch(`${e}`.toLowerCase()){case"cumsum":return kK;case"rank":return PE((t,n)=>Oh(t,r=>n[r]));case"quantile":return PE((t,n)=>OK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function RK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function OK(e,t){let n=po(e,t)-1;return Oh(e,t).map(r=>r/n)}function PE(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 kK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function BD(e={},t){return arguments.length===1&&(t=e),Qf(Kf(e),t)}function PD(e={},t){return arguments.length===1&&(t=e),Zf(Kf(e),t)}function Kf(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=DK(r),qn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return LK(n)(t,FK(i,t),o)}function FK(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 DK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function LK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return H_(pf(e));switch(e.toLowerCase()){case"deviation":return H_(ii);case"max":return Q_((t,n)=>Ut(t,r=>n[r]));case"mean":return CK;case"median":return H_(zi);case"min":return Q_((t,n)=>ae(t,r=>n[r]));case"mode":return Q_((t,n)=>Su(t,r=>n[r]));case"sum":return $D;case"variance":return H_(Aa);case"difference":return $K;case"ratio":return UK;case"first":return zK;case"last":return jK}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return Q_(yf(e))}function H_(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(qs(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(qs(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(qs(i,c,c+t),a)}}}function Q_(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ue(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ue(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(qs(i,c,c+t),o)),a-=Ue(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(qs(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(qs(i,a,a+t),o)}}}function $D(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 CK(e,t,n){if(n){let r=$D(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 BK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ue(o))return o}}function PK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ue(o))return o}}function UD(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 zD(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 $K(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]]=zD(i,r,s,e)-UD(i,r,s,e)}}}function UK(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]]=zD(i,r,s,e)/UD(i,r,s,e)}}}function zK(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]]=BK(i,r,s,e)}}}function jK(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)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]]=PK(i,r,s,e)}}}var ta={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function jD(e,{x:t=W,y:n,k:r=ta.k,color:i=ta.color,opacity:o=ta.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:ac(e,Sr({x1:fc({k:-r,...f}),x2:fc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:lc(e,Sr({x:fc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function qD(e,{x:t,y:n=W,k:r=ta.k,color:i=ta.color,opacity:o=ta.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:Js(e,Sr({y1:fc({k:-r,...f}),y2:fc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:uc(e,Sr({y:fc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function fc({n:e=ta.n,k:t=0,strict:n=ta.strict,anchor:r=ta.anchor}={}){return Kf({k:e,reduce:i=>vs(i)+t*(ii(i)||0),strict:n,anchor:r})}var qK={ariaLabel:"tick",fill:null,stroke:"currentColor"},Z_=class extends mt{constructor(t,n,r){super(t,n,r,qK),Xi(this,r)}render(t,n,r,i,o){return at("svg:g",o).call(Mt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Tt,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Qt,this,r).call(Zs,this,r,o)).node()}},zm=class extends Z_{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=It(s),this.insetBottom=It(a)}_transform(t,n,{x:r}){t.call(bt,n,{x:r},Oe,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}},jm=class extends Z_{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=It(s),this.insetLeft=It(a)}_transform(t,n,{y:r}){t.call(bt,n,{y:r},0,Oe)}_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 K_(e,{x:t=W,...n}={}){return new zm(e,{...n,x:t})}function J_(e,{y:t=W,...n}={}){return new jm(e,{...n,y:t})}function VD(e,{x:t=W,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?tc:hm;return Ke(Gr(e,u({x1:$E,x2:UE},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),Yo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),K_(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),gi(e,Sr({x:GD},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function YD(e,{y:t=W,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?Ja:hm;return Ke(Yr(e,u({y1:$E,y2:UE},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),Go(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),J_(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),gi(e,Sr({y:GD},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function GD(e){let t=$E(e),n=UE(e);return e.map(r=>r<t||r>n?r:NaN)}function $E(e){let t=WD(e)*2.5-XD(e)*1.5;return ae(e,n=>n>=t?n:NaN)}function UE(e){let t=XD(e)*2.5-WD(e)*1.5;return Ut(e,n=>n<=t?n:NaN)}function WD(e){return Hn(e,.25)}function XD(e){return Hn(e,.75)}var VK={ariaLabel:"raster",stroke:null,pixelSize:1};function Jf(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function HD(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var Vm=class extends mt{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:y}=r;if(o!=null&&(o=HD(o,"width")),s!=null&&(s=HD(s,"height")),l!=null&&(l=Jf(l,"x1")),u!=null&&(u=Jf(u,"y1")),f!=null&&(f=Jf(f,"x2")),d!=null&&(d=Jf(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=KK(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=JK(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=Jf(h,"pixelSize"),this.blur=Jf(p,"blur"),this.interpolate=a==null||c==null?null:YK(y)}},Ym=class extends Vm{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=tw("fillOpacity",n)),Ne(i)[0]!==void 0&&(n=tw("fill",n))}super(t,void 0,n,VK),this.imageRendering=ce(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]??(A=>A),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=ZD(r,i,o),p=d-u,y=h-f,{pixelSize:g,width:m=Math.round(Math.abs(p)/g),height:b=Math.round(Math.abs(y)/g)}=this,x=m*b,{fill:_,fillOpacity:v}=r,w=0;if(this.interpolate){let A=m/p,N=b/y,D=Yt(a,C=>(C-u)*A,Float64Array),B=Yt(c,C=>(C-f)*N,Float64Array);_&&(_=this.interpolate(t,m,b,D,B,_)),v&&(v=this.interpolate(t,m,b,D,B,v))}else this.data==null&&t&&(w=t.fi*x);let T=l.createElement("canvas");T.width=m,T.height=b;let M=T.getContext("2d"),R=M.createImageData(m,b),I=R.data,{r:E,g:O,b:F}=ln(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let A=0;A<x;++A){let N=A<<2;if(_){let D=s(_[A+w]);if(D==null){I[N+3]=0;continue}({r:E,g:O,b:F}=ln(D))}v&&(S=v[A+w]*255),I[N+0]=E,I[N+1]=O,I[N+2]=F,I[N+3]=S}return this.blur>0&&b2(R,this.blur),M.putImageData(R,0,0),at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(A=>A.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(y)).attr("preserveAspectRatio","none").call(ct,"image-rendering",this.imageRendering).call(Tt,this).attr("xlink:href",T.toDataURL())).node()}};function zE(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&&Ak(t)&&(r=js,i=Xa,o===void 0&&(o=vk)),[t,{...s,x:r,y:i,[e]:o}]}function QD(){let[e,t]=zE("fill",...arguments);return new Ym(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function ZD({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 jE({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),ZD(Sf(a,i),o,s)}function tw(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return ve({...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]=jE(o,s,a,c),y=h-f,g=p-d,{pixelSize:m}=this,{width:b=Math.round(Math.abs(y)/m),height:x=Math.round(Math.abs(g)/m)}=t,_=new Array(b*x*(i?i.length:1)),v=y/b,w=g/x,T=0;for(let M of i??[void 0])for(let R=.5;R<x;++R)for(let I=.5;I<b;++I,++T)_[T]=n(l.invert(f+I*v),u.invert(d+R*w),M);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function YK(e){if(typeof e=="function")return e;if(e==null)return ew;switch(`${e}`.toLowerCase()){case"none":return ew;case"nearest":return VE;case"barycentric":return qE();case"random-walk":return YE()}throw new Error(`invalid interpolate: ${e}`)}function ew(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 qE({random:e=al(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ci.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=ZK(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],y=c[h+1],g=c[h+2],m=a[2*p],b=a[2*y],x=a[2*g],_=a[2*p+1],v=a[2*y+1],w=a[2*g+1],T=Math.min(m,b,x),M=Math.max(m,b,x),R=Math.min(_,v,w),I=Math.max(_,v,w),E=(v-w)*(m-x)+(_-w)*(x-b);if(!E)continue;let O=s[t[p]],F=s[t[y]],S=s[t[g]];for(let A=Math.floor(T);A<M;++A)for(let N=Math.floor(R);N<I;++N){if(A<0||A>=n||N<0||N>=r)continue;let D=A+.5,B=N+.5,C=((v-w)*(D-x)+(B-w)*(x-b))/E;if(C<0)continue;let P=((w-_)*(D-x)+(B-w)*(m-x))/E;if(P<0)continue;let $=1-C-P;if($<0)continue;let U=A+n*N;u[U]=d(O,C,F,P,S,$,A,N),f[U]=1}}return GK(u,f,i,o,s,n,r,l,t,d),u}}function GK(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)=>XK(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let y=0;y<o;++y){let g=y+o*h;if(!t[g]){let m=y+.5;for(let b=0;b<u;++b){let x=(u+d+(b%2?(b+1)/2:-b/2))%u;if(f[x](m,p)){let _=WK(n.at(x-1),r.at(x-1),n[x],r[x],m,p);e[g]=l(i.at(x-1),_,i[x],1-_,i[x],0,y,h),d=x;break}}}}}}function WK(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 qm(e,t,n,r){return e*r-n*t}function XK(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,y=o-a,g=c-u,m=l-f,b=Math.hypot(d,h),x=Math.hypot(p,y),_=Math.hypot(g,m);return(v,w)=>{let T=v-s,M=w-a,R=v-c,I=w-l;return qm(T,M,R,I)>-1e-6&&qm(T,M,d,h)*x-qm(T,M,p,y)*b>-1e-6&&qm(R,I,g,m)*b-qm(R,I,d,h)*_<=0}}function VE(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ci.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 YE({random:e=al(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ci.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,y=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++y){let m=g,b=p;h=d=u.find(m,b,d),g===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[r[h]]-m,a[r[h]]-b))>t&&_<n;){let v=e(g,p,_)*2*Math.PI;m+=Math.cos(v)*x,b+=Math.sin(v)*x,h=u.find(m,b,h),++_}l[y]=c[r[h]]}}return l}}function HK(e,t,n,r,i,o){return t*e+r*n+o*i}function QK(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 ZK(e,t){return Ys(e)||Re(e)?HK:QK(t)}function KK(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 JK(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 KD={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Gm=class extends Vm{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=i_({},i,KD);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:Fn(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=tw("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=W),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},tJ(i),KD);let s={geometry:{value:W}};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=Rn();return at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",l=>a(s[l])).call(Qt,this,r)}).node()}};function tJ({thresholds:e,interval:t,...n}){return e=kE(e,t,Ma),ve(n,function(r,i,o,s,a,c){let[l,u,f,d]=jE(o,s,a,c),h=f-l,p=d-u,{pixelSize:y,width:g=Math.round(Math.abs(h)/y),height:m=Math.round(Math.abs(p)/y)}=this,b=g/h,x=m/p,_=o.value.value,v=[];if(this.interpolate){let{x:I,y:E}=nc(o,s,c),O=Yt(I,N=>(N-l)*b,Float64Array),F=Yt(E,N=>(N-u)*x,Float64Array),S=[o.x,o.y,o.value],A=[O,F,_];for(let N of i){let D=this.filter(N,S,A);v.push(this.interpolate(D,g,m,O,F,_))}}else if(i){let I=g*m,E=i.length;for(let O=0;O<E;++O)v.push(_.slice(O*I,O*I+I))}else v.push(_);if(this.blur>0)for(let I of v)Eh({data:I,width:g,height:m},this.blur);let w=eJ(e,_,...nJ(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=La().size([g,m]).smooth(this.smooth),M=[],R=[];for(let I of v)R.push($e(M.length,M.push(...Yt(w,E=>T(I,E)))));for(let{coordinates:I}of M)for(let E of I)for(let O of E)for(let F of O)F[0]=F[0]/b+l,F[1]=F[1]/x+u;return{data:M,facets:R,channels:e_(this.contourChannels,M)}})}function eJ(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return je(e);let i=An(...wu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function tL(){return new Gm(...zE("value",...arguments))}function nJ(e){return[ae(e,t=>ae(t,JD)),Ut(e,t=>Ut(t,JD))]}function JD(e){return isFinite(e)?e:NaN}function rL(e,t){return GE(kf,e,t)}function iL(e,t={}){return GE(Ff,e,t)}function oL(e,t={}){return GE(Tl,e,t)}function GE(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Yr(t,eL("x",{...s,inset:-6},n))),i!=null&&a.push(Gr(t,eL("y",{...s,inset:-6},n))),r!=null&&a.push(jo(t,nL("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(jo(t,nL("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Ke(...a)}function sL(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:rJ(e,u)}}function rJ(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 eL(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...sL(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function nL(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...sL(e,t,iJ(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function iJ(e,t){return ve(t,(n,r,i)=>({channels:{text:{value:ym(i,e)?.value}}}))}var oJ={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},sJ={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},aJ={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},cJ={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},lJ={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},WE=class extends mt{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,oJ),this.curve=Om(s,a),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=bn(this,i),p=c?b=>c[b]:pn(d),y=l?b=>l[b]:pn(h),g=this;function m(b){let x=-1,_=[],v={};for(let S in r)v[S]=[];let w=[],T=[],M=[],R=[];function I(S,A){S=b[S],A=b[A],_.push(++x),w[x]=p(S),M[x]=y(S),T[x]=p(A),R[x]=y(A);for(let N in r)v[N].push(r[N][A])}let{halfedges:E,hull:O,triangles:F}=ci.from(b,p,y);for(let S=0;S<E.length;++S){let A=E[S];A>S&&I(F[S],F[A])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);zt(this).selectAll().data(_).enter().append("path").call(Tt,g).attr("d",S=>{let A=Kn(),N=f(A);return N.lineStart(),N.point(w[S],M[S]),N.point(T[S],R[S]),N.lineEnd(),A}).call(Qt,g,v).call(Zs,g,v,o)}return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(cn(t,x=>u[x]).values()).enter().append("g").each(m):b=>b.datum(t).each(m)).node()}},Wm=class extends mt{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]=bn(this,i),h=c?m=>c[m]:pn(f),p=l?m=>l[m]:pn(d),y=this;function g(m){let b=ci.from(m,h,p);zt(this).append("path").datum(m[0]).call(Tt,y).attr("d",y._render(b,i)).call(Qt,y,r)}return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(cn(t,b=>u[b]).values()).enter().append("g").each(g):m=>m.datum(t).each(g)).node()}},XE=class extends Wm{constructor(t,n={}){super(t,n,sJ),this.fill="none"}_render(t){return t.render()}},HE=class extends Wm{constructor(t,n={}){super(t,n,aJ,jn)}_render(t){return t.renderHull()}},QE=class extends mt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,cJ)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=bn(this,i),h=c?m=>c[m]:pn(f),p=l?m=>l[m]:pn(d),y=this;function g(m){let b=ci.from(m,h,p),x=aL(b,i);zt(this).selectAll().data(m).enter().append("path").call(Tt,y).attr("d",(_,v)=>x.renderCell(v)).call(Qt,y,r)}return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(cn(t,b=>u[b]).values()).enter().append("g").each(g):m=>m.datum(t).each(g)).node()}},ZE=class extends Wm{constructor(t,n){super(t,n,lJ),this.fill="none"}_render(t,n){return aL(t,n).render()}};function aL(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 Xm(e,t,{x:n,y:r,...i}={}){return[n,r]=Le(n,r),new e(t,{...i,x:n,y:r})}function cL(e,t){return Xm(WE,e,t)}function lL(e,t){return Xm(XE,e,t)}function uL(e,t){return Xm(HE,e,t)}function fL(e,t){return Xm(QE,e,t)}function dL(e,t){return Xm(ZE,e,t)}var uJ={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Hm=class extends mt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=hL(s)&&(s="currentColor",!0),u=hL(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:jn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},dJ({...c,fill:s,stroke:a},l,u),uJ),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=Rn();return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Tt,this).call(Qt,this,r).attr("d",l=>a(s[l]))).node()}};function pL(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new Hm(e,{...r,x:t,y:n})}var fJ=new Set(["x","y","z","weight"]);function dJ(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"?Qe(o):+o,ve(e,function(s,a,c,l,u,f){let d=c.weight?Qe(c.weight.value):null,h=c.z?.value,{z:p}=this,[y,g]=bn(this,u),{width:m,height:b}=u,{x,y:_}=nc(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([F])=>!fJ.has(F)).map(([F,S])=>[F,{...S,value:[]}])),w=t&&[],T=n&&[],M=sS().x(x?F=>x[F]:y).y(_?F=>_[F]:g).weight(d?F=>d[F]:1).size([m,b]).bandwidth(i),R=[];for(let F of a){let S=[];R.push(S);for(let A of h?bm(F,h,p):[F]){let N=M.contours(A);S.push([A,N])}}let I=o;if(!(I instanceof xl)){let F=0;for(let S of R)for(let[,A]of S){let N=A.max;N>F&&(F=N)}I=Float64Array.from({length:o-1},(S,A)=>F*100*(A+1)/o)}let E=[],O=[];for(let F of R){let S=[];E.push(S);for(let[A,N]of F)for(let D of I){S.push(O.length),O.push(N(D/100)),w&&w.push(D),T&&T.push(D);for(let B in v)v[B].value.push(c[B].value[A[0]])}}return w&&w.push(0),T&&T.push(0),{data:s,facets:E,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:O}}}})}function hL(e){return/^density$/i.test(e)}function gL(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ie:void 0,y:s=r===void 0&&i===void 0?W:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:y=Ne(h)[0],clip:g,tip:m,render:b,...x}={}){return[t,n]=mL(o,t,n),[r,i]=mL(s,r,i),t===n&&r===i&&(r=dc(0)),{tip:m}=Wi({tip:m},"x"),Ke(ne(c)?null:Object.assign(km(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:c,fillOpacity:f,render:Of(b,yL(!0)),clip:g,...x}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(km(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:l,fillOpacity:d,render:Of(b,yL(!1)),clip:g,...x}),{ariaLabel:"negative difference"}),Cl(e,{x:n,y:i,z:y,stroke:h,strokeOpacity:p,tip:m,clip:!0,...x}))}function mL(e,t,n){return t===void 0&&n===void 0?t=n=dc(e):t===void 0?(n=dc(n),t=e===void 0?n:dc(e)):n===void 0?(t=dc(t),n=e===void 0?t:dc(e)):(t=dc(t),n=dc(n)),[t,n]}function dc(e){let t,{value:n,label:r=Fn(n)}=mi(e);return{transform:i=>t||(t=dt(i,n)),label:r}}function yL(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===f_(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,y=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let m=r_(),b=at("svg:clipPath",o).attr("id",m).node();b.appendChild(p.firstChild),y.childNodes[g].setAttribute("clip-path",`url(#${m})`),y.insertBefore(b,y.childNodes[g])}return h}}var hJ={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Qm=class extends mt{constructor(t,n={}){let[r,i]=ie(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:rr,optional:!0}},Pm(n),hJ),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=Rn(o.projection??pJ(n)),{r:l}=this;return qa(l)?t=[]:l!==void 0&&c.pointRadius(l),at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Qt,this,r)}).node()}};function pJ({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,ol({point(n,r){this.stream.point(e(n),t(r))}})}function nw(e,{geometry:t=W,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new Qm(e,{geometry:t,...n})}function bL({strokeWidth:e=1.5,...t}={}){return nw({type:"Sphere"},{strokeWidth:e,...t})}function xL({strokeOpacity:e=.1,...t}={}){return nw(MS(),{strokeOpacity:e,...t})}var td=.5,ed=0;function _L(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:It(t),e=jT(e,n),$o(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!$o(e,"r")&&(n.r=t/2),ve(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:y}=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}=nc(s,a,l)),d=d?d.value:dt(i,r),h=h?.value,p=p?.value,y=y?.value;let g=mm(e,{z:d,fill:h,stroke:p,symbol:y}),m=d&&[],b=h&&[],x=p&&[],_=y&&[],v=[],w=[],T=[],M=-1;for(let O of e)O.initialize(i);for(let O of o){let F=[];for(let S of e)S.scope("facet",O);for(let[S,A]of Ka(O,g))for(let{index:N,extent:D}of mJ(i,A,u,f,t)){F.push(++M),w.push(D.x),T.push(D.y),d&&m.push(g===d?S:d[N[0]]),h&&b.push(g===h?S:h[N[0]]),p&&x.push(g===p?S:p[N[0]]),y&&_.push(g===y?S:y[N[0]]);for(let B of e)B.reduce(N,D)}v.push(F)}let R=s.x.scale,I=s.y.scale,E={x:{value:w,source:a[R]?{value:Yt(w,a[R].invert),scale:R}:null},y:{value:T,source:a[I]?{value:Yt(T,a[I].invert),scale:I}:null},...d&&{z:{value:m}},...h&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...y&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:F})=>[O,{scale:"auto",label:F.label,radius:O==="r"?t/2:void 0,value:F.transform()}]))};return{data:i,facets:v,channels:E}})}function mJ(e,t,n,r,i){let o=i*(1.5/kT),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-ed)/o),f=Math.round(c=(c-td)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let y=c-f,g=f+(c<f?-1:1)/2,m=u+(l<u?-1:1),b=c-g,x=l-m;y*y+d*d>b*b+x*x&&(f=g+(u&1?1:-1)/2,u=m)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+td,y:u*o+ed}},s.set(h,p)),p.index.push(a)}return s.values()}var yJ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function wL(e){return new Zm(e)}var Zm=class extends mt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Wa,void 0,{clip:n,...r},yJ),this.binWidth=It(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-td,p=f-c-td,y=a-ed,g=d-l-ed,m=s/2,b=m*FT,x=b/2,_=m*2,v=b*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),M=Math.floor((y+x)/v),R=Math.ceil((g-x)/v)+1,I=`m0,${hc(-b)}l${hc(m)},${hc(x)}v${hc(b)}l${hc(-m)},${hc(x)}`,E=I;for(let O=M;O<R;++O)for(let F=w;F<T;++F)E+=`M${hc(F*_+(O&1)*m)},${hc(O*v)}${I}`;return at("svg:g",o).datum(0).call(Mt,this,i,o).call(bt,this,{},Oe+td,Oe+ed).call(O=>O.append("path").call(Tt,this).call(Qt,this,r).attr("d",E)).node()}};function hc(e){return Math.round(e*1e3)/1e3}var gJ={ariaLabel:"image",fill:null,stroke:null};function bJ(e){return/^\.*\//.test(e)}function xJ(e){return/^(blob|data|file|http|https):/i.test(e)}function _J(e){return typeof e=="string"&&(bJ(e)||xJ(e))?[void 0,e]:[e,void 0]}var Km=class extends mt{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,y]=_J(l),[g,m]=ie(o),[b,x]=ie(s,m!==void 0?m*2:void 0),[_,v]=ie(a,m!==void 0?m*2:void 0),[w,T]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:rr,optional:!0},width:{value:b,filter:rr,optional:!0},height:{value:_,filter:rr,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},Pm(n),gJ),this.src=y,this.width=x,this.rotate=T,this.height=v,this.r=m,this.preserveAspectRatio=ce(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=Po(d),this.imageRendering=ce(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:y,width:g,height:m,rotate:b}=this,[x,_]=bn(this,i);return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Tt,this).attr("x",vL(c,u,d,x,g,y)).attr("y",vL(l,f,d,_,m,y)).attr("width",u?w=>u[w]:g!==void 0?g:d?w=>d[w]*2:y*2).attr("height",f?w=>f[w]:m!==void 0?m:d?w=>d[w]*2:y*2).attr("transform",h?w=>`rotate(${h[w]})`:b?`rotate(${b})`:null).attr("transform-origin",h||b?ic`${c?w=>c[w]:x}px ${l?w=>l[w]:_}px`:null).call(ct,"href",p?w=>p[w]:this.src).call(ct,"preserveAspectRatio",this.preserveAspectRatio).call(ct,"crossorigin",this.crossOrigin).call(ct,"image-rendering",this.imageRendering).call(ct,"clip-path",d?w=>`circle(${d[w]}px)`:y!==void 0?`circle(${y}px)`:null).call(Qt,this,r)).node()}};function vL(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 SL(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Km(e,{...r,x:t,y:n})}function wJ(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,g,m;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,y=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),m=-nd(t)-nd(n)+nd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=vJ(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),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 vJ(e,t,n){var r=e===0||e===1?0:Math.exp(nd(t+n)-nd(t)-nd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*IL(e,t,n)/t:1-r*IL(1-e,n,t)/n}function IL(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 nd(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 TL(e,t){var n=wJ(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var SJ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},rw=class extends mt{constructor(t,n={}){let{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:jn(n),optional:!0}},n,SJ),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 at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(u=>u.selectAll().data(c?bm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Tt,this).call(Il,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Gs(this.fill)?d=>d.select(IJ).attr("stroke","none").call(Tt,this).call(Il,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function IJ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(oi.svg,"path"),this)}var KE=class extends rw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=se(t,u=>r[u]),c=iw(t,r,n),l=ML(t,r,n,(1-i)/2,c);return of().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=se(t,a=>r[a]),s=iw(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},JE=class extends rw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=se(t,u=>n[u]),c=iw(t,n,r),l=ML(t,n,r,(1-i)/2,c);return of().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=se(t,a=>n[a]),s=iw(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function EL(e,{y:t=Ie,x:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new KE(e,$f({...o,x:n,y:t,fill:i,stroke:r}))}function AL(e,{x:t=Ie,y:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new JE(e,Pf({...o,x:t,y:n,fill:i,stroke:r}))}function iw(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 ML(e,t,n,r,i){let o=Mn(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=TL(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 Jm({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=sl,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=cw(s),i=OL(i),a!=null&&(a=eA(a)),n===void 0&&(n=s.frameAnchor);let l=kL(t),u=$L(c,eA),[f,d]=yn(),[h,p]=yn();return{x:f,y:h,frameAnchor:n,...gn(c,(y,g)=>{let m=l(dt(y,e)),b=d([]),x=p([]),_=-1,v=[],w=[],T=nx().path(R=>m[R]),M=r();M.nodeSize&&M.nodeSize([1,1]),M.separation&&o!==void 0&&M.separation(o??lm);for(let R of u)R[sw]=R[BL]([]);for(let R of g){let I=[],E=T(R.filter(O=>m[O]!=null)).each(O=>O.data=y[O.data]);i!=null&&E.sort(i),M(E);for(let O of E.descendants())if(!(a!=null&&!a(O))){I.push(++_),v[_]=O.data,s.position(O,_,b,x);for(let F of u)F[sw][_]=F[PL](O)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function aw({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=sl,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=cw(l),a=OL(a),u!=null&&(u=RL(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=kL(t),h=$L(f,RL),[p,y]=yn(),[g,m]=yn(),[b,x]=yn(),[_,v]=yn();return{x1:p,x2:g,y1:b,y2:_,...gn(f,(w,T)=>{let M=d(dt(w,e)),R=y([]),I=m([]),E=x([]),O=v([]),F=-1,S=[],A=[],N=nx().path(B=>M[B]),D=s();D.nodeSize&&D.nodeSize([1,1]),D.separation&&c!==void 0&&D.separation(c??lm);for(let B of h)B[sw]=B[BL]([]);for(let B of T){let C=[],P=N(B.filter($=>M[$]!=null)).each($=>$.data=w[$.data]);a!=null&&P.sort(a),D(P);for(let{source:$,target:U}of P.links())if(!(u!=null&&!u(U,$))){C.push(++F),S[F]=U.data,l.position($,F,R,E),l.position(U,F,I,O);for(let X of h)X[sw][F]=X[PL](U,$)}A.push(C)}return{data:S,facets:A}}),...Object.fromEntries(h)}}function cw(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return TJ;case"right":return EJ}throw new Error(`invalid tree anchor: ${e}`)}var TJ={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},EJ={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function OL(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?NL(eA(e)):NL(AJ(e))}function NL(e){return(t,n)=>hn(e(t),e(n))}function AJ(e){return t=>t.data?.[e]}function kL(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=>MJ(r,t))}var tA=92,FL=47;function MJ(e,t){if(t===tA)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 tA: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 FL: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 NJ(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case tA:if(!t){t=!0;continue}case FL:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function DL(e){return mn(e)&&typeof e.node=="function"}function RJ(e){return mn(e)&&typeof e.link=="function"}function eA(e){if(DL(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return rA;case"node:path":return nA;case"node:internal":return LL;case"node:external":return CL;case"node:depth":return iA;case"node:height":return oA}throw new Error(`invalid node value: ${e}`)}}function RL(e){if(DL(e))return e.node;if(RJ(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return ow(rA);case"parent:path":return ow(nA);case"parent:depth":return ow(iA);case"parent:height":return ow(oA);case"node:name":return rA;case"node:path":return nA;case"node:internal":return LL;case"node:external":return CL;case"node:depth":return iA;case"node:height":return oA}throw new Error(`invalid link value: ${e}`)}}function nA(e){return e.id}function rA(e){return OJ(e.id)}function iA(e){return e.depth}function oA(e){return e.height}function LL(e){return!!e.children}function CL(e){return!e.children}function ow(e){return(t,n)=>n==null?void 0:e(n)}function OJ(e){let t=e.length;for(;--t>0&&!kJ(e,t););return NJ(e.slice(t+1))}function kJ(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var BL=2,PL=3,sw=4;function $L(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...yn(i),o])}return n}function sA(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=ne(f)&&ne(d),text:p="node:name",textStroke:y="var(--plot-background)",title:g="node:path",dx:m,dy:b,textAnchor:x,treeLayout:_=sl,textLayout:v=_===sl||_===tx?"mirrored":"normal",tip:w,...T}={}){if(m===void 0&&(m=cw(T.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ze(v,"textLayout",["mirrored","normal"]);function M(R){return jo(e,Jm({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:y,dx:m,dy:b,title:g,...R,...T}))}return Ke(G_(e,aw({treeLayout:_,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?gi(e,Jm({treeLayout:_,fill:t===void 0?"node:internal":t,title:g,tip:w,...T})):null,p!=null?v==="mirrored"?[M({textAnchor:"start",treeFilter:"node:external"}),M({textAnchor:"end",treeFilter:"node:internal",dx:-m})]:M():null)}function UL(e,t){return sA(e,{...t,treeLayout:tx})}function zL({geometry:e=W,...t}={}){return ve({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=dt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=Rn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function jL({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=dt(dt(r,e),vS),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var JL=l9(KL(),1);var UJ=({marginLeft:e})=>[1,e],zJ=({width:e,marginRight:t})=>[-1,e-t],jJ=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],qJ=({marginTop:e})=>[1,e],VJ=({height:e,marginBottom:t})=>[-1,e-t],YJ=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function t5(e){return typeof e=="string"?{anchor:e}:e}function e5(e={},t={}){arguments.length===1&&([e,t]=r5(e));let{anchor:n="left",padding:r=1,r:i=t.r}=t5(e);switch(`${n}`.toLowerCase()){case"left":n=UJ;break;case"right":n=zJ;break;case"middle":n=jJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return i5("x","y",n,It(r),i,t)}function n5(e={},t={}){arguments.length===1&&([e,t]=r5(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=t5(e);switch(`${n}`.toLowerCase()){case"top":n=qJ;break;case"bottom":n=VJ;break;case"middle":n=YJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return i5("y","x",n,It(r),i,t)}function r5(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function i5(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=fm(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 ve(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}=nc(c,l,f));let p=h?void 0:i!==void 0?It(i):this.r!==void 0?this.r:3;h&&(h=dt(h.value,l[h.scale]||W,Float64Array));let[y,g]=n(u),m=y?WJ:GJ,b=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,JL.default)();_=_.filter(h?T=>uf(d[T])&&rr(h[T]):T=>uf(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let M=x(T),R=y?M+r:0,I=d[T]-M,E=d[T]+M,O=2;v.queryInterval(I-r,E+r,([,,S])=>{let A=b[S]-R,N=d[T]-d[S],D=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(D*D-N*N);w[O++]=A-B,w[O++]=A+B});let F=w.slice(0,O);y&&(F=F.filter(S=>S>=0));t:for(let S of F.sort(m)){for(let A=0;A<O;A+=2)if(w[A]+1e-6<S&&S<w[A+1]-1e-6)continue t;b[T]=S+R;break}v.insert([I,E,T])}}y||(y=1);for(let _ of a)for(let v of _)b[v]=b[v]*y+g;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 GJ(e,t){return Math.abs(e)-Math.abs(t)}function WJ(e,t){return e-t}function s5(e,t){return arguments.length===1&&({basis:e,...t}=e),Qf(fw(e),t)}function a5(e,t){return arguments.length===1&&({basis:e,...t}=e),Zf(fw(e),t)}function fw(e){if(e===void 0)return o5;if(typeof e=="function")return dw(yf(e));if(/^p\d{2}$/i.test(e))return sd(pf(e));switch(`${e}`.toLowerCase()){case"deviation":return QJ;case"first":return o5;case"last":return HJ;case"max":return ZJ;case"mean":return KJ;case"median":return JJ;case"min":return ttt;case"sum":return ett;case"extent":return XJ}throw new Error(`invalid basis: ${e}`)}function dw(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 sd(e){return dw((t,n)=>e(t,r=>n[r]))}var XJ={mapIndex(e,t,n){let[r,i]=se(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},o5=dw((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ue(r))return r}}),HJ=dw((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ue(r))return r}}),QJ={mapIndex(e,t,n){let r=vs(e,o=>t[o]),i=ii(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},ZJ=sd(Ut),KJ=sd(vs),JJ=sd(zi),ttt=sd(ae),ett=sd(Mn);function c5(e,t){return ntt("x",e,t)}function ntt(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]=q1(t.replace(/^[+-]/,"")),i*=l}t=bf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Sr({[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]=se(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function l5(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return dA(t);case"last":return hA(t)}if(typeof e=="function")return pc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=rtt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return pc(n,r,t)}function rtt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return pA;case"max":return mA}throw new Error(`unknown selector: ${e}`)}function dA(e){return pc(null,itt,e)}function hA(e){return pc(null,ott,e)}function u5(e){return pc("x",pA,e)}function f5(e){return pc("y",pA,e)}function d5(e){return pc("x",mA,e)}function h5(e){return pc("y",mA,e)}function*itt(e){yield e[0]}function*ott(e){yield e[e.length-1]}function*pA(e,t){yield P0(e,n=>t[n])}function*mA(e,t){yield qc(e,n=>t[n])}function pc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=jn(n);return gn(n,(i,o)=>{let s=dt(i,r),a=dt(i,e),c=[];for(let l of o){let u=[];for(let f of s?cn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var stt=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["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 att(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 p5(e,t,n){for(let r in e){let i=stt.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&&att(t,i.split("."),o)}}var ctt=new Set(["frame","hexgrid","sphere","graticule"]);async function y5(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;p5(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())ctt.has(c)?t.marks.push(hw[c](u)):t.marks.push(hw[c](l,u)),o.push(a.index);utt(t,e);let s=Rm(t);ftt(s,o),ltt(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function ltt(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===zc){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 utt(e,t){let{marks:n}=t;pw("x",e,n,["x","x1","x2"]),pw("y",e,n,["y","y1","y2"]),pw("fx",e,n),pw("fy",e,n)}function pw(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=dtt(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function ftt(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)m5(r,t);else m5(e,t)}function m5(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 dtt(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var htt={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},ny=class{constructor(t){this.attributes={...htt},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=h2()}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(){let{top:t,bottom:n}=this.margins();return this.getAttribute("height")-t-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 y5(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 Sh(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.requestQuery()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function gA(...e){let t=new ny;return e.flat().forEach(n=>n(t)),t.marks.forEach(n=>Tn().connect(n)),t.element}var yA=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)}},ad=new yA;function ptt(){ad.clear(),Tn().clear()}function g5(e){return t=>ad.set(e,t)}function b5(e,t,n){_r(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 bA(e,t){return n=>{b5(n,e,t)}}function mw(e){return t=>{for(let[n,r]of Object.entries(e))b5(t,n,r)}}function x5(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),mw(o)}function _5(e){return mw({xDomain:e,yDomain:e})}var L=e=>t=>bA(e,t),w5=L("style"),v5=L("width"),S5=L("height"),I5=L("margin"),T5=L("marginLeft"),E5=L("marginRight"),A5=L("marginTop"),M5=L("marginBottom"),N5=L("align"),R5=L("aspectRatio"),O5=L("axis"),k5=L("inset"),F5=L("grid"),D5=L("label"),L5=L("padding"),C5=L("round"),B5=L("xScale"),P5=L("xDomain"),$5=L("xRange"),U5=L("xNice"),z5=L("xInset"),j5=L("xInsetLeft"),q5=L("xInsetRight"),V5=L("xClamp"),Y5=L("xRound"),G5=L("xAlign"),W5=L("xPadding"),X5=L("xPaddingInner"),H5=L("xPaddingOuter"),Q5=L("xAxis"),Z5=L("xTicks"),K5=L("xTickSize"),J5=L("xTickSpacing"),tC=L("xTickPadding"),eC=L("xTickFormat"),nC=L("xTickRotate"),rC=L("xGrid"),iC=L("xLine"),oC=L("xLabel"),sC=L("xLabelAnchor"),aC=L("xLabelOffset"),cC=L("xFontVariant"),lC=L("xAriaLabel"),uC=L("xAriaDescription"),fC=L("xReverse"),dC=L("xZero"),hC=L("yScale"),pC=L("yDomain"),mC=L("yRange"),yC=L("yNice"),gC=L("yInset"),bC=L("yInsetTop"),xC=L("yInsetBottom"),_C=L("yClamp"),wC=L("yRound"),vC=L("yAlign"),SC=L("yPadding"),IC=L("yPaddingInner"),TC=L("yPaddingOuter"),EC=L("yAxis"),AC=L("yTicks"),MC=L("yTickSize"),NC=L("yTickSpacing"),RC=L("yTickPadding"),OC=L("yTickFormat"),kC=L("yTickRotate"),FC=L("yGrid"),DC=L("yLine"),LC=L("yLabel"),CC=L("yLabelAnchor"),BC=L("yLabelOffset"),PC=L("yFontVariant"),$C=L("yAriaLabel"),UC=L("yAriaDescription"),zC=L("yReverse"),jC=L("yZero"),qC=L("facetMargin"),VC=L("facetMarginTop"),YC=L("facetMarginBottom"),GC=L("facetMarginLeft"),WC=L("facetMarginRight"),XC=L("facetGrid"),HC=L("facetLabel"),QC=L("fxDomain"),ZC=L("fxRange"),KC=L("fxNice"),JC=L("fxInset"),tB=L("fxInsetLeft"),eB=L("fxInsetRight"),nB=L("fxRound"),rB=L("fxAlign"),iB=L("fxPadding"),oB=L("fxPaddingInner"),sB=L("fxPaddingOuter"),aB=L("fxAxis"),cB=L("fxTicks"),lB=L("fxTickSize"),uB=L("fxTickSpacing"),fB=L("fxTickPadding"),dB=L("fxTickFormat"),hB=L("fxTickRotate"),pB=L("fxGrid"),mB=L("fxLine"),yB=L("fxLabel"),gB=L("fxLabelAnchor"),bB=L("fxLabelOffset"),xB=L("fxFontVariant"),_B=L("fxAriaLabel"),wB=L("fxAriaDescription"),vB=L("fxReverse"),SB=L("fyDomain"),IB=L("fyRange"),TB=L("fyNice"),EB=L("fyInset"),AB=L("fyInsetTop"),MB=L("fyInsetBottom"),NB=L("fyRound"),RB=L("fyAlign"),OB=L("fyPadding"),kB=L("fyPaddingInner"),FB=L("fyPaddingOuter"),DB=L("fyAxis"),LB=L("fyTicks"),CB=L("fyTickSize"),BB=L("fyTickSpacing"),PB=L("fyTickPadding"),$B=L("fyTickFormat"),UB=L("fyTickRotate"),zB=L("fyGrid"),jB=L("fyLine"),qB=L("fyLabel"),VB=L("fyLabelAnchor"),YB=L("fyLabelOffset"),GB=L("fyFontVariant"),WB=L("fyAriaLabel"),XB=L("fyAriaDescription"),HB=L("fyReverse"),QB=L("colorScale"),ZB=L("colorDomain"),KB=L("colorRange"),JB=L("colorClamp"),t7=L("colorNice"),e7=L("colorScheme"),n7=L("colorInterpolate"),r7=L("colorPivot"),i7=L("colorSymmetric"),o7=L("colorLabel"),s7=L("colorReverse"),a7=L("colorZero"),c7=L("colorTickFormat"),l7=L("opacityScale"),u7=L("opacityDomain"),f7=L("opacityRange"),d7=L("opacityClamp"),h7=L("opacityNice"),p7=L("opacityLabel"),m7=L("opacityReverse"),y7=L("opacityZero"),g7=L("opacityTickFormat"),b7=L("rScale"),x7=L("rDomain"),_7=L("rRange"),w7=L("rClamp"),v7=L("rNice"),S7=L("rZero"),I7=L("lengthScale"),T7=L("lengthDomain"),E7=L("lengthRange"),A7=L("lengthClamp"),M7=L("lengthNice"),N7=L("lengthZero"),R7=L("projectionType"),O7=L("projectionParallels"),k7=L("projectionPrecision"),F7=L("projectionRotate"),D7=L("projectionDomain"),L7=L("projectionInset"),C7=L("projectionInsetLeft"),B7=L("projectionInsetRight"),P7=L("projectionInsetTop"),$7=L("projectionInsetBottom"),U7=L("projectionClip");function _A(e,t){return{table:e,options:t}}var MA={};_i(MA,{area:()=>tP,areaX:()=>eP,areaY:()=>nP,arrow:()=>GP,axisFx:()=>ZP,axisFy:()=>KP,axisX:()=>HP,axisY:()=>QP,barX:()=>sP,barY:()=>aP,cell:()=>cP,cellX:()=>lP,cellY:()=>uP,circle:()=>gP,contour:()=>LP,delaunayLink:()=>qP,delaunayMesh:()=>VP,denseLine:()=>DP,density:()=>FP,densityX:()=>OP,densityY:()=>kP,dot:()=>pP,dotX:()=>mP,dotY:()=>yP,frame:()=>XP,geo:()=>r$,graticule:()=>o$,gridFx:()=>e$,gridFy:()=>n$,gridX:()=>JP,gridY:()=>t$,hexagon:()=>bP,hexbin:()=>PP,hexgrid:()=>$P,hull:()=>YP,image:()=>RP,line:()=>rP,lineX:()=>iP,lineY:()=>oP,link:()=>WP,raster:()=>CP,rasterTile:()=>BP,rect:()=>fP,rectX:()=>dP,rectY:()=>hP,regressionY:()=>UP,ruleX:()=>vP,ruleY:()=>SP,sphere:()=>i$,spike:()=>NP,text:()=>xP,textX:()=>_P,textY:()=>wP,tickX:()=>IP,tickY:()=>TP,vector:()=>EP,vectorX:()=>AP,vectorY:()=>MP,voronoi:()=>zP,voronoiMesh:()=>jP});function cd(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Br(e)!==null)}var mtt=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"]);function z7(e){return mtt.has(e)}var ytt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function j7(e){return ytt.has(`${e}`.toLowerCase())}function ry(e){return typeof e?.getChild=="function"}var gtt=2,btt=10;function yw(e){return ry(e)?xtt(e):e}function xtt(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=_tt(h);for(let y=i,g=0;g<c;++g,++y)r[y][d]=p(f.get(g))}i+=c}return r}function _tt(e){let{typeId:t}=e;return t===btt?n=>n==null?n:new Date(n):t===gtt&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}var q7=e=>e==="stroke"||e==="fill",wtt=e=>e==="symbol",vtt=(e,t)=>e!=="sort"&&t!=null&&!Array.isArray(t),wA=(e,t)=>({channel:e,field:t,as:t instanceof mr?t.column:e}),vA=(e,t)=>({channel:e,value:t}),ar=class extends xr{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Array.isArray(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.params=new Set,a=(c,l)=>{let u=typeof l;if(u==="function"&&l[N0]){let f=l(this,c);for(let d in f)a(d,f[d])}else if(u==="string")z7(c)||q7(c)&&cd(l)||wtt(c)&&j7(l)?o.push(vA(c,l)):o.push(wA(c,Cc(l)));else if(gs(l))if(Array.isArray(l.columns))o.push(wA(c,l)),s.add(l);else{let f=vA(c,l.value);o.push(f),l.addEventListener("value",d=>(f.value=d,this.update()))}else u==="object"&&vtt(c,l)?o.push(wA(c,l)):l!==void 0&&o.push(vA(c,l))};for(let c in r)a(c,r[c])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||Array.isArray(this.source)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return SA(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=yw(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,channels:r}=this,i={};for(let o of r)i[o.channel]=bi(o);return[{type:t,data:n,options:i}]}};function bi(e){return Object.hasOwn(e,"value")?e.value:q7(e.channel)?{value:e.as,scale:"color"}:e.as}function SA(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 Wr(e,t,n){if(!e.stats)return r;let{field:r}=e.channelField(t),{type:i}=e.stats[r.column];return n=n??r,i==="date"?_h(n):n}function iy(e,t,n,r,i=!1,o=1){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${+n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${+t})${a}`}var IA={x:["min","max"]},TA={y:["min","max"]},gw={...IA,...TA};function V7(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[$i])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=EA(t,u)||(c?ks().domain([f,d]).nice().domain():[f,d]);return a!==zc&&(h[$i]=!0),o.setAttribute(r,h,{silent:!0}),h}}function Wo(e,t){return V7(e,t,"x","xDomain","xNice")}function Xo(e,t){return V7(e,t,"y","yDomain","yNice")}function EA(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var bw=class extends ar{constructor(t,n,r){let i=t.endsWith("X")?"y":"x",o={[i]:["count","min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},{field:a,as:c}=this.channelField(r),l=super.query(t);if(s){let{column:u}=a,{count:f,max:d,min:h}=o[u],p=r==="x"?n.innerWidth():n.innerHeight(),[y,g]=EA(t,u)||[h,d],m=(g-y)/(d-h);if(f*m>p*4){let b=Wr(this,r,c),x=this.channelField(r==="x"?"y":"x").as,_=l.select().map(v=>v.as).filter(v=>v!==c&&v!==x);return Stt(l,b,c,x,y,g,p,_)}}return l.orderby(c)}};function Stt(e,t,n,r,i,o,s,a=[]){let c=q`FLOOR(${s/(o-i)}::DOUBLE * (${t} - ${+i}::DOUBLE))::INTEGER`,l=u=>pt.from(e).select(u).groupby(c,a);return pt.union(l([{[n]:Lr(n),[r]:gh(r,n)},...a]),l([{[n]:Dr(n),[r]:bh(r,n)},...a]),l([{[n]:gh(n,r),[r]:Lr(r)},...a]),l([{[n]:bh(n,r),[r]:Dr(r)},...a])).orderby(a,n)}function oy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Itt(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 Itt(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 Y7(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);xw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);xw(t,u,i,r,o,s,a,u)}return c}function xw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Ttt){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 Ttt(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let y=t[f];if(y>0)for(p=0;p<a;++p)e[p]+=l[p]*y}function G7(e,t){return X7(new Float64Array(e),t)}function W7(e,t,n,r=[]){return r.length?Object.values(Ett(e*t,n,r)):[{grid:X7(new Float64Array(e*t),n)}]}function X7(e,t){if(ry(t)){let n=t.numRows;if(n===0)return e;let r=t.getChild("index").toArray(),i=t.getChild("value").toArray();for(let o=0;o<n;++o)e[r[o]]=i[o]}else for(let n of t)e[n.index]=n.value;return e}function Ett(e,t,n){let r={},i=o=>(r[o]||(r[o]={key:o,grid:new Float64Array(e)})).grid;if(ry(t)){let o=t.numRows;if(o===0)return r;let s=t.getChild("index").toArray(),a=t.getChild("value").toArray(),c=n.map(l=>t.getChild(l));for(let l=0;l<o;++l){let u=c.map(f=>f.get(l));i(u)[s[l]]=a[l]}}else for(let o of t){let s=n.map(a=>o[a]);i(s)[o.index]=o.value}return r}function _n(e,t,n,r){_r(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}var sy=class extends ar{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"?IA:TA),this.dim=a,_n(this,"bins",i),_n(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[$i]}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,a]=this.extent=(i==="x"?Wo:Xo)(this,t),c=Wr(this,i);return Att(SA(r,o,[i]).where(t.concat(Me(c,[s,a]))),iy(c,s,a,n),this.channelField("weight")?"weight":null)}queryResult(t){return this.grid=G7(this.bins,t),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=oy(n*(t-1)/l,c),f=xw(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,y=+s,g=(a-y)/(t-1),m=1/g;for(let b=0;b<t;++b)d.push({[p]:y+b*g,[h]:f[b]*m});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=bi(s);return[{type:t,data:n,options:o}]}};function Att(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",value:br("w")}).groupby("index").having(mu("value",0))}var Ho=class extends ar{constructor(t,n,r){let{bandwidth:i=20,binType:o="linear",binWidth:s=2,binPad:a=1,...c}=r,l=Mtt(c);super(t,n,c,gw),this.densityMap=l,_n(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),_n(this,"binWidth",s),_n(this,"binType",o),_n(this,"binPad",a)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[$i]&&!n[$i]}query(t=[]){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[c,l]=this.extentX=Wo(this,t),[u,f]=this.extentY=Xo(this,t),[d,h]=this.bins=this.binDimensions(this),p=Wr(this,"x"),y=Wr(this,"y"),g=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),b=H7(p,c,l,d,g,this.binPad),x=H7(y,u,f,h,m,this.binPad),_=i?[Me(p,[c,l]),Me(y,[u,f])]:[Ta(c,p),Ia(p,l),Ta(u,y),Ia(y,f)],v=pt.from(a.table).where(t.concat(_)),w=this.groupby=[],T=gr();for(let M of o)if(Object.hasOwn(M,"field")){let{as:R,channel:I,field:E}=M;E.aggregate?(T=E,s[I]=!0):I==="weight"?T=br(E):I!=="x"&&I!=="y"&&(v.select({[R]:E}),w.push(R))}return r==="linear"?Rtt(v,b,x,T,d,w):Ntt(v,b,x,T,d,w)}binDimensions(){let{plot:t,binWidth:n}=this;return[Math.round(t.innerWidth()/n),Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=W7(n,r,t,this.groupby),this.convolve()}convolve(){let{bandwidth:t,bins:n,grids:r,plot:i}=this;if(t<=0)this.kde=this.grids.map(({key:o,grid:s})=>(s.key=o,s));else{let o=i.innerWidth(),s=i.innerHeight(),[a,c]=n,l=r.some(({grid:d})=>d.some(h=>h<0)),u=oy(t*(a-1)/o,l),f=oy(t*(c-1)/s,l);this.kde=this.grids.map(({key:d,grid:h})=>{let p=Y7(u,f,h,n);return p.key=d,p})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function Mtt(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function H7(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${t})${a}`}function Ntt(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function Rtt(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",value:br("w")},o).groupby("index",o).having(mu("value",0))}var _w=class extends Ho{constructor(t,n){let{type:r="dot",binsX:i,binsY:o,...s}=n;s.binPad=s.binPad??0,super(r,t,s),_n(this,"binsX",i),_n(this,"binsY",o)}convolve(){super.convolve();let{bins:t,binPad:n,extentX:r,extentY:i}=this,[o,s]=t,[a,c]=r,[l,u]=i,f=(c-a)/(o-n),d=(u-l)/(s-n),h=n?0:.5;return this.data=Ott(this.kde,t,a,l,f,d,h),this}binDimensions(){let{plot:t,binWidth:n,binsX:r,binsY:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:bi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function Ott(e,t,n,r,i,o,s){let a=1/(i*o),[c,l]=t,u=[];for(let f of e)for(let d=0,h=0;h<l;++h)for(let p=0;p<c;++p,++d)u.push({x:n+(p+s)*i,y:r+(h+s)*o,density:f[d]*a});return u}function ww(e,t,n,r,i,o){let s=(o.length>>2)-1;for(let a=0,c=0;a<r;++a)for(let l=0,u=(r-a-1)*n;l<n;++l,c+=4){let f=s*i(e[l+u])<<2;t[c+0]=o[f+0],t[c+1]=o[f+1],t[c+2]=o[f+2],t[c+3]=o[f+3]}}function ld(e,t){let n=new Uint8ClampedArray(4*e),r=e-1;for(let i=0;i<=r;++i){let o=t(i/r),{r:s,g:a,b:c,opacity:l=1}=typeof o=="string"?ln(o):o,u=i<<2;n[u+0]=s,n[u+1]=a,n[u+2]=c,n[u+3]=255*l|0}return n}function vw(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 Sw(e="black"){let{r:t,g:n,b:r}=ln(e);return i=>({r:t,g:n,b:r,opacity:i})}var ud=class extends Ho{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=ktt(this,i,o),l=Ftt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=Dtt(this,f,d.key?.[u]);return ww(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}};function ktt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=vw(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 Ftt(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return zo({x:{type:o,domain:i,range:[0,1]}}).apply}function Dtt(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a;if(i.fill){if(s)try{return ld(r,zo({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(c){console.warn(c)}}else if(t.length){let c=o.getAttribute("colorRange");a=zo({color:{domain:t,range:c,scheme:s||(c?void 0:"tableau10")}}).apply(n)}else{let c=e.channelField("fill");a=cd(c?.value)?c.value:void 0}return ld(r,Sw(a))}var Iw=class extends ud{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,{bandwidth:0,...i}),_n(this,"normalize",r)}query(t=[]){let{plot:n,channels:r,normalize:i,source:o}=this,[s,a]=Wo(this,t),[c,l]=Xo(this,t),[u,f]=this.bins=this.binDimensions(this),d=Wr(this,"x"),h=Wr(this,"y"),p=!!n.getAttribute("xReverse"),y=!!n.getAttribute("yReverse"),g=iy(d,s,a,u,p,this.binPad),m=iy(h,c,l,f,y,this.binPad),b=pt.from(o.table).where(Ltt(this,t)),x=this.groupby=[],_=[];for(let v of r)if(Object.hasOwn(v,"field")){let{channel:w,field:T}=v;w==="z"?(b.select({[w]:T}),_.push("z")):w!=="x"&&w!=="y"&&(b.select({[w]:T}),x.push(w))}return Ctt(b,g,m,_,u,f,x,i)}};function Ltt(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?yr(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function Ctt(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(yr(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(pu("dx"))),p=["x"].concat(c).join(", "),y=pt.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(yr(Me("x",[0,i]),Me("y",[0,o])));return pt.with({pairs:u,indices:d,raster:h,points:y}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,value:a?br("w"):gr()}).groupby("index",s)}var Tw=class extends Ho{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,i),_n(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,groupby:o,plot:s}=this,a=i;if(!Array.isArray(a)){let v=Ut(r.map(w=>Ut(w)));a=Array.from({length:a-1},(w,T)=>v*(T+1)/a)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[c,l]=t,[u,f]=s.getAttribute("xDomain"),[d,h]=s.getAttribute("yDomain"),p=(f-u)/c,y=(h-d)/l,g=+u,m=+d,b=v=>g+v*p,x=v=>m+v*y,_=La().size(t);return this.data=r.flatMap(v=>a.map(w=>{let T=Btt(_.contour(v,w),b,x);return o.forEach((M,R)=>T[M]=v.key[R]),T.density=w,T})),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=bi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function Btt(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}var Ew=class extends ar{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},gw),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[$i]&&!n[$i]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Wo(this,t),[c,l]=Xo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,y=`${n.innerHeight()/(l-c)}::DOUBLE`,g,m,b=new Set,x={};for(let M of i)M.channel==="orderby"?_.orderby(M.value):M.channel==="x"?g=M:M.channel==="y"?m=M:Object.hasOwn(M,"field")&&(x[M.as]=M.field,M.field.aggregate&&M.field.columns.forEach(R=>b.add(R)));let _=pt.select({[g.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[m.as]:q`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${y}`,...x}).groupby("x","y"),v=`${p} * (${g.field} - ${s}::DOUBLE)`,w=`${y} * (${l}::DOUBLE - ${m.field})`,T=pt.select({py:q`(${w} - ${f}) / ${h}`,pj:q`ROUND(py)::INTEGER`,px:q`(${v} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:q`ROUND(px)::INTEGER`,tt:q`ABS(py-pj) * 3 > 1 AND (px-pi)**2 + (py-pj)**2 > (px - pi - 0.5 * CASE WHEN px < pi THEN -1 ELSE 1 END)**2 + (py - pj - CASE WHEN py < pj THEN -1 ELSE 1 END)**2`,x:q`CASE WHEN tt THEN (pi + (CASE WHEN px < pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE pi END`,y:q`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(b)).from(o.table).where(wa(g.field),wa(m.field),t);return _.from(T)}};var Aw=class extends Ho{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[[c,l],[u,f]]=t,[d,h]=this.bins,p=Wr(this,"x"),y=Wr(this,"y"),g=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),b=Q7(p,c,l,d,g,i),x=Q7(y,u,f,h,m,i),_=i?[Me(p,[c,l]),Me(y,[u,f])]:[Ta(c,p),Ia(p,l),Ta(u,y),Ia(y,f)],v=pt.from(a.table).where(_),w=this.groupby=[],T=gr();for(let M of o)if(Object.hasOwn(M,"field")){let{channel:R,field:I}=M;I.aggregate?(T=I,s[R]=!0):R==="weight"?T=br(I):R!=="x"&&R!=="y"&&(v.select({[R]:I}),w.push(R))}return r==="linear"?Vtt(v,b,x,T,d,w):qtt(v,b,x,T,d,w)}async requestTiles(){let t=Tn();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=Wo(this,this._filter),[f,d]=Xo(this,this._filter),h=u-l,p=d-f,y=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),m=(I,E)=>[[o+I*h,o+(I+1)*h],[s+E*p,s+(E+1)*p]],b=Math.floor((l-o)/h),x=r?Z7((u-o)/h):b,_=Math.floor((f-s)/p),v=i?Z7((d-s)/p):_,w=[];for(let I=b;I<=x;++I)for(let E=_;E<=v;++E)w.push([I,E]);let T=w.map(([I,E])=>t.query(this.tileQuery(m(I,E)))),M=[];if(r)for(let I=_;I<=v;++I)M.push([x+1,I]),M.push([b-1,I]);if(i){let I=r?b-1:b,E=r?x+1:x;for(let O=I;O<=E;++O)M.push([O,v+1]),M.push([O,_-1])}this.prefetch=M.map(([I,E])=>t.prefetch(this.tileQuery(m(I,E))));let R=await Promise.all(T);this.grids=[{grid:Ptt(a,c,y,g,w,R)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=Utt(this,i,o),l=ztt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=jtt(this,f,d.key?.[u]);return ww(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function Ptt(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;$tt(e,t,s,a,f,d)}),s}function $tt(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("value").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 Utt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=vw(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 ztt(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return zo({x:{type:o,domain:i,range:[0,1]}}).apply}function jtt(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a;if(i.fill){if(s)try{return ld(r,zo({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(c){console.warn(c)}}else if(t.length){let c=o.getAttribute("colorRange");a=zo({color:{domain:t,range:c,scheme:s||(c?void 0:"tableau10")}}).apply(n)}else{let c=e.channelField("fill");a=cd(c?.value)?c.value:void 0}return ld(r,Sw(a))}function Q7(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${t})${a}`}function qtt(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function Vtt(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",value:br("w")},o).groupby("index",o).having(Ug("value",0))}function Z7(e){let t=Math.floor(e);return t===e?t-1:t}function Ytt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,g,m;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,y=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),m=-fd(t)-fd(n)+fd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Gtt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),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 Gtt(e,t,n){var r=e===0||e===1?0:Math.exp(fd(t+n)-fd(t)-fd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*K7(e,t,n)/t:1-r*K7(1-e,n,t)/n}function K7(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 fd(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 J7(e,t){var n=Ytt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Mw=class extends ar{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;_n(this,"ci",r,s),_n(this,"precision",i,s)}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return pt.from(super.query(t)).select({intercept:Hv(r,n),slope:Qv(r,n),n:Zv(r,n),ssy:Kv(r,n),ssx:Jv(r,n),xm:t2(r,n),x0:xh(Lr(n).where(wa(r))),x1:xh(Dr(n).where(wa(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=yw(t),this.lineData=this.modelFit.flatMap(n=>Wtt(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>Xtt(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=bi(a);break;case"strokeOpacity":o.strokeOpacity=bi(a);break;case"fillOpacity":s.fillOpacity=bi(a);break;default:o[a.channel]=s[a.channel]=bi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function Wtt(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function Xtt(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=J7((1-e)/2,l-2)*Math.sqrt(f/(l-2));return $e(i,o-h/2,h).concat(o).map(y=>{let g=a+y*c,m=p*Math.sqrt(1/l+(y-s)**2/u);return{x:y,y1:g-m,y2:g+m,...d}})}var Htt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function yt(e,t,n){arguments.length===2&&(n=t,t=Htt.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?bw:ar;return AA(r,e,t,n)}function AA(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function $l(e,t,n){return r=>{r.addMark(new e(t,n))}}var tP=(...e)=>yt("area",...e),eP=(...e)=>yt("areaX",...e),nP=(...e)=>yt("areaY",...e),rP=(...e)=>yt("line",...e),iP=(...e)=>yt("lineX",...e),oP=(...e)=>yt("lineY",...e),sP=(...e)=>yt("barX",...e),aP=(...e)=>yt("barY",...e),cP=(...e)=>yt("cell",...e),lP=(...e)=>yt("cellX",...e),uP=(...e)=>yt("cellY",...e),fP=(...e)=>yt("rect",...e),dP=(...e)=>yt("rectX",...e),hP=(...e)=>yt("rectY",...e),pP=(...e)=>yt("dot",...e),mP=(...e)=>yt("dotX",...e),yP=(...e)=>yt("dotY",...e),gP=(...e)=>yt("circle",...e),bP=(...e)=>yt("hexagon",...e),xP=(...e)=>yt("text",...e),_P=(...e)=>yt("textX",...e),wP=(...e)=>yt("textY",...e),vP=(...e)=>yt("ruleX",...e),SP=(...e)=>yt("ruleY",...e),IP=(...e)=>yt("tickX",...e),TP=(...e)=>yt("tickY",...e),EP=(...e)=>yt("vector",...e),AP=(...e)=>yt("vectoX",...e),MP=(...e)=>yt("vectorY",...e),NP=(...e)=>yt("spike",...e),RP=(...e)=>yt("image",...e),OP=(...e)=>AA(sy,"areaX",...e),kP=(...e)=>AA(sy,"areaY",...e),FP=(...e)=>$l(_w,...e),DP=(...e)=>$l(Iw,...e),LP=(...e)=>$l(Tw,...e),CP=(...e)=>$l(ud,...e),BP=(...e)=>$l(Aw,...e),PP=(...e)=>$l(Ew,...e),$P=(...e)=>yt("hexgrid",...e),UP=(...e)=>$l(Mw,...e),zP=(...e)=>yt("voronoi",...e),jP=(...e)=>yt("voronoiMesh",...e),qP=(...e)=>yt("delaunayLink",...e),VP=(...e)=>yt("delaunayMesh",...e),YP=(...e)=>yt("hull",...e),GP=(...e)=>yt("arrow",...e),WP=(...e)=>yt("link",...e),XP=(...e)=>yt("frame",...e),HP=(...e)=>yt("axisX",...e),QP=(...e)=>yt("axisY",...e),ZP=(...e)=>yt("axisFx",...e),KP=(...e)=>yt("axisFy",...e),JP=(...e)=>yt("gridX",...e),t$=(...e)=>yt("gridY",...e),e$=(...e)=>yt("gridFx",...e),n$=(...e)=>yt("gridFy",...e),r$=(...e)=>yt("geo",...e),i$=(...e)=>yt("sphere",...e),o$=(...e)=>yt("graticule",...e);var kA={};_i(kA,{highlight:()=>f$,intervalX:()=>g$,intervalXY:()=>x$,intervalY:()=>b$,nearestX:()=>m$,nearestY:()=>y$,pan:()=>_$,panX:()=>w$,panY:()=>v$,panZoom:()=>S$,panZoomX:()=>I$,panZoomY:()=>T$,toggle:()=>fy,toggleColor:()=>p$,toggleX:()=>d$,toggleY:()=>h$});function s$(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 dd(e){let t={};for(let n in e)t[s$(n)]=e[n];return t}function Qtt(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 Nw=class{constructor(t,{selection:n,channels:r={}}){this.mark=Qtt(t),this.selection=n;let i=Object.entries(dd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",vh(()=>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 Ztt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function Ztt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:yr(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await Tn().query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}var hd=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>zg(n[l].field,ei(c)));return a.length>1?yr(a):a[0]});i=o.length>1?hu(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(Ktt(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>NA(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!NA(u[0],h)?d=null:d=[h]}this.value=d,Jtt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function Ktt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function Jtt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>NA(n,t[r]))}function NA(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}function RA(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 a$(){return RA(eS())}function c$(){return RA(J2())}function l$(){return RA(tS())}function ay(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 Qo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function cy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function Rw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var ly=class{constructor(t,{channel:n,selection:r,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||Qo(t,[n,n+"1",n+"2"]),this.style=a&&dd(a),this.brush=n==="y"?l$():c$(),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=>cy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),ay(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Me(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ae(o),ae(s)],[Ut(o),Ut(s)]]);let a=zt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:zt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(Rw).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var Ow=(e,t)=>e-t,kw=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||Qo(t,["x","x1","x2"]),this.yfield=i||Qo(t,["y","y1","y2"]),this.style=a&&dd(a),this.brush=a$(),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=>cy(u,i,r)).sort(Ow),a=[c[1],l[1]].map(u=>cy(u,o,r)).sort(Ow)}(!ay(s,n?.[0])||!ay(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?yr(Me(i,t[0]),Me(o,t[1])):null}}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ae(s),ae(a)],[Ut(s),Ut(a)]]);let c=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t);if(this.g=l.append("g").attr("class","interval-xy").each(Rw).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(Ow),[d,h]=this.value[1].map(o.apply).sort(Ow);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var u$=(e,t)=>e-t,Fw=class{constructor(t,{x:n=new wr,y:r=new wr,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||Qo(t,["x","x1","x2"]),this.yfield=o||Qo(t,["y","y1","y2"]),this.zoom=OA(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=tet(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=eet(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Me(n,t):null}}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(u$),c=this.yscale.range.slice().sort(u$),l=OA(n,[-1/0,1/0],a),u=OA(r,[-1/0,1/0],c),f=gT().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(zt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function OA(e,t,n){return e?Array.isArray(e)?e:t:n}function tet(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function eet(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var uy=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Qo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?Sa(r,ei(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t),u=t.scale(i),f=!ri(o);l.on("pointerdown pointermove",function(d){let[h,p]=Ln(d,this),y=net(s,a,u.invert(i==="x"?h:p));o.update(f?y:n.clause(y))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function net(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}function mc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function f$({by:e,...t}){return mc(Nw,{selection:e,channels:t})}function fy({as:e,...t}){return mc(hd,{...t,selection:e})}function d$(e){return fy({...e,channels:["x"]})}function h$(e){return fy({...e,channels:["y"]})}function p$(e){return fy({...e,channels:["color"]})}function m$({as:e,...t}){return mc(uy,{...t,selection:e,channel:"x"})}function y$({as:e,...t}){return mc(uy,{...t,selection:e,channel:"y"})}function g$({as:e,...t}){return mc(ly,{...t,selection:e,channel:"x"})}function b$({as:e,...t}){return mc(ly,{...t,selection:e,channel:"y"})}function x$({as:e,...t}){return mc(kw,{...t,selection:e})}function pd(e){return mc(Fw,e)}function _$(e={}){return pd({...e,zoom:!1})}function w$(e={}){return pd({...e,zoom:!1,pany:!1})}function v$(e={}){return pd({...e,zoom:!1,panx:!1})}function S$(e={}){return pd(e)}function I$(e={}){return pd({...e,pany:!1})}function T$(e={}){return pd({...e,panx:!1})}var DA={};_i(DA,{colorLegend:()=>E$,opacityLegend:()=>A$,symbolLegend:()=>M$});var dy=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=ret(t,n);this.selection&&i&&(this.handler=new hd(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function ret({marks:e},t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)if(e[r].channelField(n))return e[r];return null}function FA(e,t={}){if(t.for){let{for:n,...r}=t,i=new dy(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?ad.request(n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new dy(e,t))}var E$=e=>FA("color",e),A$=e=>FA("opacity",e),M$=e=>FA("symbol",e);function N$({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),r.value={element:r},r}function Dw(...e){return N$({direction:"vertical"},e.flat())}function Lw(...e){return N$({direction:"horizontal"},e.flat())}function R$({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function Cw(e){return R$({dim:"height",size:e})}function Bw(e){return R$({dim:"width",size:e})}function LA(e){return e}function Pw(e){if(e==null)return LA;var t,n,r=e.scale[0],i=e.scale[1],o=e.translate[0],s=e.translate[1];return function(a,c){c||(t=n=0);var l=2,u=a.length,f=new Array(u);for(f[0]=(t+=a[0])*r+o,f[1]=(n+=a[1])*i+s;l<u;)f[l]=a[l],++l;return f}}function O$(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function CA(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return k$(e,n)})}:k$(e,t)}function k$(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,o=$w(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:o}:r==null?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function $w(e,t){var n=Pw(e.transform),r=e.arcs;function i(u,f){f.length&&f.pop();for(var d=r[u<0?~u:u],h=0,p=d.length;h<p;++h)f.push(n(d[h],h));u<0&&O$(f,p)}function o(u){return n(u)}function s(u){for(var f=[],d=0,h=u.length;d<h;++d)i(u[d],f);return f.length<2&&f.push(f[0]),f}function a(u){for(var f=s(u);f.length<4;)f.push(f[0]);return f}function c(u){return u.map(a)}function l(u){var f=u.type,d;switch(f){case"GeometryCollection":return{type:f,geometries:u.geometries.map(l)};case"Point":d=o(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(o);break;case"LineString":d=s(u.arcs);break;case"MultiLineString":d=u.arcs.map(s);break;case"Polygon":d=c(u.arcs);break;case"MultiPolygon":d=u.arcs.map(c);break;default:return null}return{type:f,coordinates:d}}return l(t)}function BA(e,t){var n={},r={},i={},o=[],s=-1;t.forEach(function(l,u){var f=e.arcs[l<0?~l:l],d;f.length<3&&!f[1][0]&&!f[1][1]&&(d=t[++s],t[s]=l,t[u]=d)}),t.forEach(function(l){var u=a(l),f=u[0],d=u[1],h,p;if(h=i[f])if(delete i[h.end],h.push(l),h.end=d,p=r[d]){delete r[p.start];var y=p===h?h:h.concat(p);r[y.start=h.start]=i[y.end=p.end]=y}else r[h.start]=i[h.end]=h;else if(h=r[d])if(delete r[h.start],h.unshift(l),h.start=f,p=i[f]){delete i[p.end];var g=p===h?h:p.concat(h);r[g.start=p.start]=i[g.end=h.end]=g}else r[h.start]=i[h.end]=h;else h=[l],r[h.start=f]=i[h.end=d]=h});function a(l){var u=e.arcs[l<0?~l:l],f=u[0],d;return e.transform?(d=[0,0],u.forEach(function(h){d[0]+=h[0],d[1]+=h[1]})):d=u[u.length-1],l<0?[d,f]:[f,d]}function c(l,u){for(var f in l){var d=l[f];delete u[d.start],delete d.start,delete d.end,d.forEach(function(h){n[h<0?~h:h]=1}),o.push(d)}}return c(i,r),c(r,i),t.forEach(function(l){n[l<0?~l:l]||o.push([l])}),o}function PA(e){return $w(e,F$.apply(this,arguments))}function F$(e,t,n){var r,i,o;if(arguments.length>1)r=iet(e,t,n);else for(i=0,r=new Array(o=e.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:BA(e,r)}}function iet(e,t,n){var r=[],i=[],o;function s(f){var d=f<0?~f:f;(i[d]||(i[d]=[])).push({i:f,g:o})}function a(f){f.forEach(s)}function c(f){f.forEach(a)}function l(f){f.forEach(c)}function u(f){switch(o=f,f.type){case"GeometryCollection":f.geometries.forEach(u);break;case"LineString":a(f.arcs);break;case"MultiLineString":case"Polygon":c(f.arcs);break;case"MultiPolygon":l(f.arcs);break}}return u(t),i.forEach(n==null?function(f){r.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&r.push(f[0].i)}),r}function Uw(e){let t=typeof e;return t==="object"?e?.param:t==="string"?aet(e):null}function aet(e){return e?.[0]==="$"?e.slice(1):null}function yc(e){return[e].flat()}function Xr(e){return Array.isArray(e)}function md(e){return e!==null&&typeof e=="object"&&!Xr(e)}function yd(e){let t=typeof e;return t==="number"||t==="string"}function rn(e){return typeof e=="string"}function xi(e){return typeof e=="function"}function Ce(e,t){throw Object.assign(Error(e),{data:t})}function zw(e,t,n){t=cet(t,n);let r=n.dataFormats.get(t.type);if(r)return r(e,t,n);Ce("Unrecognized data format type.",t)}function cet(e,t){return Xr(e)&&(e={type:"json",data:e}),rn(e)&&(e={type:"table",query:e}),{...e,type:uet(e),file:det(e,t)}}function uet(e){return e.type||fet(e.file)||"table"}function fet(e){let t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function det({file:e},t){return e&&t.baseURL?new URL(e,t.baseURL).toString():e}function D$(e,t){let{query:n,type:r,...i}=t;if(n)return fo(e,n,i)}function L$(e,t){let{file:n,type:r,...i}=t;return f0(e,n,i)}function C$(e,t){let{file:n,type:r,...i}=t;return l0(e,n,i)}function B$(e,t){let{data:n,file:r,type:i,...o}=t;return n?d0(e,n,o):u0(e,r,o)}var het={menu:w0,search:S0,slider:T0,table:M0},pet=new Map([["intersect",()=>wr.intersect()],["crossfilter",()=>wr.crossfilter()],["union",()=>wr.union()],["single",()=>wr.single()],["value",({date:e,value:t},n)=>Array.isArray(t)?Pi.array(t.map(r=>n.maybeParam(r))):Pi.value(Uc(e,t))]]),met=new Map([["plot",{type:Xr,parse:$$}],["mark",{type:rn,parse:Fet}],["legend",{type:rn,parse:U$}],["hconcat",{type:Xr,parse:ket}],["vconcat",{type:Xr,parse:Oet}],["hspace",{type:yd,parse:Met}],["vspace",{type:yd,parse:Net}],["input",{type:rn,parse:Ret}]]),yet=new Map([["csv",C$],["json",B$],["geojson",Tet],["topojson",Eet],["parquet",L$],["table",D$]]),get=new Map([["avg",Jg],["bin",Ih],["count",gr],["dateMonth",i0],["dateMonthDay",o0],["dateDay",s0],["bin",Ih],["max",Dr],["median",t0],["min",Lr],["mode",n0],["quantile",e0],["sum",br],["row_number",jg],["rank",qg],["dense_rank",Vg],["percent_rank",Yg],["cume_dist",Gg],["ntile",Wg],["lag",Xg],["lead",Hg],["first_value",Qg],["last_value",Zg],["nth_value",Kg]]),bet=new Map(Object.entries(MA)),xet=new Map(Object.entries(het)),_et=new Map(Object.entries(DA)),wet=new Map(Object.entries(xA)),vet=new Map(Object.entries(kA));function Iet(e,t){return e=rn(e)?JSON.parse(e):e,new gd(t).parse(e)}var gd=class{constructor({specParsers:t=met,paramParsers:n=pet,dataFormats:r=yet,transforms:i=get,attributes:o=wet,interactors:s=vet,legends:a=_et,inputs:c=xet,marks:l=bet,params:u=[],datasets:f=[],baseURL:d=null}={}){this.specParsers=t,this.paramParsers=n,this.dataFormats=r,this.transforms=i,this.attributes=o,this.interactors=s,this.legends=a,this.inputs=c,this.marks=l,this.params=new Map(u),this.datasets=new Map(f),this.baseURL=d,this.postQueue=[]}after(t){this.postQueue.push(t)}maybeParam(t,n=()=>Pi.value()){let{params:r}=this,i=Uw(t);if(i){if(r.has(i))return r.get(i);{let o=n();return r.set(i,o),o}}return t}maybeSelection(t){return this.maybeParam(t,()=>wr.intersect())}maybeTransform(t){if(md(t))return t.expr?j$(t,this):t.agg?$et(t,this):Uet(t,this)}async parse(t){let{meta:n,data:r={},plotDefaults:i={},params:o,...s}=t;for(let c in r){let l=await zw(c,r[c],this);l?.data?this.datasets.set(c,l.data):l&&await Tn().exec(l)}this.plotDefaults=Object.keys(i).map(c=>z$(i,c,this));for(let c in o)this.params.set(c,Aet(o[c],this));let a=$A(s,this);return this.postQueue.forEach(c=>c()),this.postQueue=[],this.plotDefaults={},a}};async function P$(e){let{data:t,file:n}=e;return t||await fetch(n).then(r=>r.json())}async function Tet(e,t){return{data:await P$(t)}}async function Eet(e,t){let n=await P$(t),r;if(t.feature)r=CA(n,n.objects[t.feature]);else{let i=t.mesh?n.objects[t.mesh]:void 0,o={interior:(s,a)=>s!==a,exterior:(s,a)=>s===a}[t.filter];r=PA(n,i,o)}return{data:r&&r.features||[r]}}function Aet(e,t){e=md(e)?e:{value:e};let{select:n="value"}=e,r=t.paramParsers.get(n);return r||Ce(`Unrecognized param type: ${n}`,e),r(e,t)}function $A(e,t){for(let[n,{type:r,parse:i}]of t.specParsers){let o=e[n];if(o!=null){if(r(o))return i(e,t);Ce(`Invalid property type: ${n}`,e)}}Ce("Invalid specification.",e)}function Met(e){return Bw(e.hspace)}function Net(e){return Cw(e.vspace)}function Ret(e,t){let{input:n,...r}=e,i=t.inputs.get(n);xi(i)||Ce(`Unrecognized input: ${n}`,e);for(let o in r)r[o]=t.maybeSelection(r[o]);return i(r)}function Oet(e,t){return Dw(e.vconcat.map(n=>$A(n,t)))}function ket(e,t){return Lw(e.hconcat.map(n=>$A(n,t)))}function $$(e,t){let{plot:n,...r}=e,i=t.plotDefaults.concat(Object.keys(r).map(s=>z$(e,s,t))),o=n.map(s=>Det(s,t));return gA(i,o)}function Fet(e,t){return $$({plot:[e]},t)}function U$(e,t){let{legend:n,...r}=e,i=`${n}Legend`,o=t.legends.get(i);xi(o)||Ce(`Unrecognized legend type: ${n}`,e);for(let s in r)r[s]=t.maybeSelection(r[s]);return o(r)}function z$(e,t,n){let r=n.attributes.get(t);xi(r)||Ce(`Unrecognized attribute: ${t}`,e);let i=e[t],o=i==="Fixed"?zc:n.maybeParam(i);return r(o)}function Det(e,t){return rn(e.mark)?Let(e,t):rn(e.legend)?U$(e,t):rn(e.select)?Pet(e,t):Ce("Invalid plot entry.",e)}function Let(e,t){let{mark:n,data:r,...i}=e,o=t.marks.get(n);xi(o)||Ce(`Unrecognized mark type: ${n}`,e);let s=Cet(r,t);for(let a in i)i[a]=Bet(i[a],t);return s?o(s,i):o(i)}function Cet(e,t){if(!e)return null;if(Xr(e))return e;let{from:n,...r}=e;if(t.datasets.has(n))return t.datasets.get(n);for(let i in r)r[i]=t.maybeSelection(r[i]);return _A(n,r)}function Bet(e,t){return t.maybeTransform(e)||t.maybeParam(e)}function Pet(e,t){let{select:n,...r}=e,i=t.interactors.get(n);xi(i)||Ce(`Unrecognized interactor type: ${n}`,e);for(let o in r)r[o]=t.maybeSelection(r[o]);return i(r)}function j$(e,t,n="expr"){let{label:r}=e,o=e[n].split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),s=[""],a=[];for(let c=0,l=0;c<o.length;++c){let u=o[c];u.startsWith("$")?(a[l]=t.maybeParam(u),s[++l]=""):s[l]+=u}return q(s,...a).annotate({label:r})}function $et(e,t){return j$(e,t,"agg").annotate({aggregate:!0})}function Uet(e,t){let{transforms:n}=t,r;for(let a in e)n.has(a)&&(r=a);if(!r)return;let i=n.get(r),o=r==="count"||r==null?[]:yc(e[r]),s=i(...o);if(e.distinct&&(s=s.distinct()),e.orderby){let a=yc(e.orderby).map(c=>t.maybeParam(c));s=s.orderby(a)}if(e.partitionby){let a=yc(e.partitionby).map(c=>t.maybeParam(c));s=s.partitionby(a)}return e.rows?s=s.rows(t.maybeParam(e.rows)):e.range&&(s=s.range(t.maybeParam(e.range))),s}var q$="https://cdn.jsdelivr.net/npm/topojson@3.0.2/+esm",zet=new Map([["plot",{type:Xr,parse:G$}],["mark",{type:rn,parse:rnt}],["legend",{type:rn,parse:W$}],["hconcat",{type:Xr,parse:nnt}],["vconcat",{type:Xr,parse:ent}],["hspace",{type:yd,parse:Ket}],["vspace",{type:yd,parse:Jet}],["input",{type:rn,parse:tnt}]]),jet=new Map([["csv",Xet],["json",Het],["geojson",Qet],["topojson",Zet],["parquet",Wet],["table",Get]]);function qet(e,t){return e=rn(e)?JSON.parse(e):e,new UA(t).generate(e)}function jw(e){return e?.length?[""]:[]}var UA=class extends gd{constructor(t){super({specParsers:zet,dataFormats:jet,...t}),this.imports=t?.imports||new Map([["@uwdata/vgplot","* as vg"]]),this.depth=0}async generate(t){let{meta:n,data:r={},plotDefaults:i={},params:o,...s}=t,a=await Promise.all(Object.keys(r).flatMap(h=>{let p=zw(h,r[h],this);return p?p.data?`const ${h} = ${p.data};`:`await vg.coordinator().exec(
69
- ${p}
70
- );`:[]})),c=Object.keys(i).map(h=>X$(i,h,this)),l=[];c.length&&(this.plotDefaults="defaultAttributes",l=["const defaultAttributes = [",c.map(h=>" "+h).join(`,
71
- `),"];"]);for(let h in o)this.params.set(`$${h}`,Yet(o[h],this));let u=[`export default ${jA(s,this)};`],f=[];for(let[h,p]of this.params)f.push(`const ${h} = ${p};`);let d=[];for(let[h,p]of this.imports)d.push(rn(p)?`import ${p} from "${h}";`:`import { ${p.join(", ")} } from "${h}";`);return[...d,...jw(d),...a,...jw(a),...f,...jw(f),...l,...jw(l),...u].join(`
72
- `)}addImport(t,n){this.imports.has(t)||this.imports.set(t,[]),this.imports.get(t).push(n)}setImports(t,n){this.imports.set(t,n)}maybeParam(t,n="vg.Param.value()"){let{params:r}=this,i=Uw(t);if(i){let o=`$${i}`;return r.has(o)||r.set(o,n),o}return JSON.stringify(t)}maybeSelection(t){return this.maybeParam(t,"vg.Selection.intersect()")}maybeTransform(t){if(md(t))return t.expr?V$(t,this):t.agg?V$(t,this,"agg","agg"):Vet(t,this)}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}};function V$(e,t,n="expr",r="sql"){let{label:i}=e,s=e[n].split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),a="";for(let c=0;c<s.length;++c){let l=s[c];l.startsWith("$")?a+=`\${${t.maybeParam(l)}}`:a+=l}return`vg.${r}\`${a}\``+(i?`.annotate({ label: ${JSON.stringify(i)} })`:"")}function Vet(e,t){let{transforms:n}=t,r;for(let s in e)n.has(s)&&(r=s);if(!r)return;let i=r==="count"||r==null?[]:yc(e[r]),o=`vg.${r}(`+i.map(s=>t.maybeParam(s)).join(", ")+")";if(e.distinct&&(o+=".distinct()"),e.orderby){let s=yc(e.orderby).map(a=>t.maybeParam(a));o+=`.orderby(${s.join(", ")})`}if(e.partitionby){let s=yc(e.partitionby).map(a=>t.maybeParam(a));o+=`.partitionby(${s.join(", ")})`}return e.rows?o+=`.rows(${t.maybeParam(e.rows)})`:e.range&&(o+=`.range(${t.maybeParam(e.rows)})`),o}function Yet(e,t){e=md(e)?e:{value:e};let{select:n="value"}=e;if(t.paramParsers.get(n)||Ce(`Unrecognized param type: ${n}`,e),n==="value"){let{value:i,date:o}=e;return Array.isArray(i)?`vg.Param.array([${i.map(s=>t.maybeParam(s)).join(", ")}])`:o?`vg.Param.value(new Date(${JSON.stringify(o)}))`:`vg.Param.value(${JSON.stringify(i)})`}else return`vg.Selection.${n}()`}function zA(e){let t=[];for(let n in e)t.push(`${n}: ${JSON.stringify(e[n])}`);return t.length?`, { ${t.join(", ")} }`:""}function Get(e,t){let{query:n,type:r,...i}=t;if(n)return`\`${fo(e,n,i)}\``}function Wet(e,t){let{file:n,type:r,...i}=t;return`vg.loadParquet("${e}", "${n}"${zA(i)})`}function Xet(e,t){let{file:n,type:r,...i}=t;return`vg.loadCSV("${e}", "${n}"${zA(i)})`}function Het(e,t){let{data:n,file:r,type:i,...o}=t,s=zA(o);if(n){let a=`[
73
- `+n.map(c=>JSON.stringify(c)).join(`,
74
- `)+`
75
- ]`;return`vg.loadObjects("${e}", ${a}${s})`}else return`vg.loadCSV("${e}", "${r}"${s})`}function Y$(e){let{data:t,file:n}=e;return t?JSON.stringify(t):`await fetch("${n}")
76
- .then(r => r.json())`}function Qet(e,t,n){return n.datasets.set(e,e),{data:Y$(t)}}function Zet(e,t,n){n.datasets.set(e,e);let r=Y$(t),i;if(t.feature){n.addImport(q$,"feature");let o=`json.objects['${t.feature}']`;i=r+`
77
- .then(json => feature(json, ${o}).features)`}else{n.addImport(q$,"mesh");let o=t.mesh?`json.objects['${t.mesh}']`:"undefined",s=t.filter==="interior"?", (a, b) => a !== b":t.filter==="exterior"?", (a, b) => a === b":"";i=r+`
78
- .then(json => [mesh(json, ${o}${s})])`}return{data:i}}function jA(e,t){for(let[n,{type:r,parse:i}]of t.specParsers){let o=e[n];if(o!=null){if(r(o))return i(e,t);Ce(`Invalid property type: ${n}`,e)}}Ce("Invalid specification.",e)}function Ket(e,t){return`${t.tab()}vg.hspace(${e.hspace})`}function Jet(e,t){return`${t.tab()}vg.vspace(${e.vspace})`}function tnt(e,t){let{input:n,...r}=e,i=t.inputs.get(n);xi(i)||Ce(`Unrecognized input: ${n}`,e);let o=[];for(let s in r)o.push(`${s}: ${t.maybeSelection(r[s])}`);return`${t.tab()}vg.${n}({ ${o.join(", ")} })`}function ent(e,t){t.indent();let n=e.vconcat.map(r=>jA(r,t));return t.undent(),`${t.tab()}vg.vconcat(
79
- ${n.join(`,
80
- `)}
81
- ${t.tab()})`}function nnt(e,t){t.indent();let n=e.hconcat.map(r=>jA(r,t));return t.undent(),`${t.tab()}vg.hconcat(
82
- ${n.join(`,
83
- `)}
84
- ${t.tab()})`}function G$(e,t){let{plot:n,...r}=e;t.indent();let i=[...t.plotDefaults?[`${t.tab()}...defaultAttributes`]:[],...Object.keys(r).map(a=>X$(e,a,t))],s=n.map(a=>int(a,t)).concat(i);return t.undent(),`${t.tab()}vg.plot(
85
- ${s.join(`,
86
- `)}
87
- ${t.tab()})`}function rnt(e,t){return G$({plot:[e]},t)}function W$(e,t){let{legend:n,...r}=e,i=`${n}Legend`;xi(t.legends.get(i))||Ce(`Unrecognized legend type: ${n}`,e);let o=[];for(let s in r)o.push(`${s}: ${t.maybeSelection(r[s])}`);return`${t.tab()}vg.${i}({ ${o.join(", ")} })`}function X$(e,t,n){let r=n.attributes.get(t);xi(r)||Ce(`Unrecognized attribute: ${t}`,e);let i=e[t],o=i==="Fixed"?"vg.Fixed":n.maybeParam(i);return`${n.tab()}vg.${t}(${o})`}function int(e,t){return rn(e.mark)?ont(e,t):rn(e.legend)?W$(e,t):rn(e.select)?cnt(e,t):Ce("Invalid plot entry.",e)}function ont(e,t){let{mark:n,data:r,...i}=e;xi(t.marks.get(n))||Ce(`Unrecognized mark type: ${n}`,e);let o=snt(r,t),s=[];for(let u in i)s.push(`${u}: ${ant(i[u],t)}`);let a=o||"",c=s.length?`{ ${s.join(", ")} }`:"",l=`${a}${c}`;return a&&c&&(t.indent(),l=`
88
- ${t.tab()}${a},
89
- ${t.tab()}${c}
90
- `,t.undent(),l+=t.tab()),`${t.tab()}vg.${n}(${l})`}function snt(e,t){if(!e)return null;if(Xr(e))return JSON.stringify(e);let{from:n,...r}=e;if(t.datasets.has(n))return t.datasets.get(n);{let i=[];for(let s in r)i.push(`${s}: ${t.maybeSelection(r[s])}`);let o=i.length?`, { ${i.join(", ")} }`:"";return`vg.from("${n}"${o})`}}function ant(e,t){return t.maybeTransform(e)||t.maybeParam(e)}function cnt(e,t){let{select:n,...r}=e;xi(t.interactors.get(n))||Ce(`Unrecognized interactor type: ${n}`,e);let i=[];for(let o in r)i.push(`${o}: ${t.maybeSelection(r[o])}`);return`${t.tab()}vg.${n}({ ${i.join(", ")} })`}export{wh as Coordinator,zc as Fixed,ar as Mark,xr as MosaicClient,Pi as Param,gd as ParseContext,ny as Plot,pt as Query,wr as Selection,V3 as agg,N5 as align,yr as and,tP as area,eP as areaX,nP as areaY,bh as argmax,gh as argmin,i6 as arrayAgg,GP as arrow,R5 as aspectRatio,bA as attribute,mw as attributes,Jg as avg,O5 as axis,ZP as axisFx,KP as axisFy,HP as axisX,QP as axisY,sP as barX,aP as barY,Ih as bin,r0 as cast,xh as castDouble,o6 as castInteger,cP as cell,lP as cellX,uP as cellY,gP as circle,JB as colorClamp,ZB as colorDomain,n7 as colorInterpolate,o7 as colorLabel,E$ as colorLegend,t7 as colorNice,r7 as colorPivot,KB as colorRange,s7 as colorReverse,QB as colorScale,e7 as colorScheme,i7 as colorSymmetric,c7 as colorTickFormat,a7 as colorZero,Cc as column,LP as contour,Tn as coordinator,t6 as corr,gr as count,e6 as covarPop,Gg as cume_dist,s0 as dateDay,i0 as dateMonth,o0 as dateMonthDay,qP as delaunayLink,VP as delaunayMesh,DP as denseLine,Vg as dense_rank,FP as density,OP as densityX,kP as densityY,pP as dot,mP as dotX,yP as dotY,Z3 as entropy,Sa as eq,XC as facetGrid,HC as facetLabel,qC as facetMargin,YC as facetMarginBottom,GC as facetMarginLeft,WC as facetMarginRight,VC as facetMarginTop,Qg as first_value,XP as frame,_A as from,rB as fxAlign,wB as fxAriaDescription,_B as fxAriaLabel,aB as fxAxis,QC as fxDomain,xB as fxFontVariant,pB as fxGrid,JC as fxInset,tB as fxInsetLeft,eB as fxInsetRight,yB as fxLabel,gB as fxLabelAnchor,bB as fxLabelOffset,mB as fxLine,KC as fxNice,iB as fxPadding,oB as fxPaddingInner,sB as fxPaddingOuter,ZC as fxRange,vB as fxReverse,nB as fxRound,dB as fxTickFormat,fB as fxTickPadding,hB as fxTickRotate,lB as fxTickSize,uB as fxTickSpacing,cB as fxTicks,RB as fyAlign,XB as fyAriaDescription,WB as fyAriaLabel,DB as fyAxis,SB as fyDomain,GB as fyFontVariant,zB as fyGrid,EB as fyInset,MB as fyInsetBottom,AB as fyInsetTop,qB as fyLabel,VB as fyLabelAnchor,YB as fyLabelOffset,jB as fyLine,TB as fyNice,OB as fyPadding,kB as fyPaddingInner,FB as fyPaddingOuter,IB as fyRange,HB as fyReverse,NB as fyRound,$B as fyTickFormat,PB as fyTickPadding,UB as fyTickRotate,CB as fyTickSize,BB as fyTickSpacing,LB as fyTicks,r$ as geo,o$ as graticule,F5 as grid,e$ as gridFx,n$ as gridFy,JP as gridX,t$ as gridY,mu as gt,P3 as gte,Lw as hconcat,S5 as height,bP as hexagon,PP as hexbin,$P as hexgrid,f$ as highlight,Bw as hspace,YP as hull,RP as image,k5 as inset,g$ as intervalX,x$ as intervalXY,b$ as intervalY,Me as isBetween,$3 as isDistinct,z3 as isNotBetween,zg as isNotDistinct,wa as isNotNull,pu as isNull,Q3 as kurtosis,D5 as label,Xg as lag,n6 as last,Zg as last_value,Hg as lead,A7 as lengthClamp,T7 as lengthDomain,M7 as lengthNice,E7 as lengthRange,I7 as lengthScale,N7 as lengthZero,rP as line,iP as lineX,oP as lineY,WP as link,ei as literal,l0 as loadCSV,u0 as loadJSON,d0 as loadObjects,f0 as loadParquet,Ia as lt,Ta as lte,Y3 as mad,I5 as margin,M5 as marginBottom,T5 as marginLeft,E5 as marginRight,A5 as marginTop,x5 as margins,Dr as max,t0 as median,w0 as menu,Lr as min,n0 as mode,g5 as name,ad as namedPlots,m$ as nearestX,y$ as nearestY,Ug as neq,C3 as not,Kg as nth_value,Wg as ntile,d7 as opacityClamp,u7 as opacityDomain,p7 as opacityLabel,A$ as opacityLegend,h7 as opacityNice,f7 as opacityRange,m7 as opacityReverse,l7 as opacityScale,g7 as opacityTickFormat,y7 as opacityZero,hu as or,L5 as padding,_$ as pan,w$ as panX,v$ as panY,S$ as panZoom,I$ as panZoomX,T$ as panZoomY,Iet as parseSpec,Yg as percent_rank,gA as plot,G3 as product,U7 as projectionClip,D7 as projectionDomain,L7 as projectionInset,$7 as projectionInsetBottom,C7 as projectionInsetLeft,B7 as projectionInsetRight,P7 as projectionInsetTop,O7 as projectionParallels,k7 as projectionPrecision,F7 as projectionRotate,R7 as projectionType,e0 as quantile,w7 as rClamp,x7 as rDomain,v7 as rNice,_7 as rRange,b7 as rScale,S7 as rZero,qg as rank,CP as raster,BP as rasterTile,fP as rect,dP as rectX,hP as rectY,UP as regressionY,ptt as reset,v6 as restConnector,C5 as round,jg as row_number,vP as ruleX,SP as ruleY,S0 as search,H3 as skewness,T0 as slider,Pg as socketConnector,qet as specToModule,i$ as sphere,NP as spike,q as sql,X3 as stddev,J3 as stddevPop,r6 as stringAgg,w5 as style,br as sum,M$ as symbolLegend,M0 as table,xP as text,_P as textX,wP as textY,IP as tickX,TP as tickY,fy as toggle,p$ as toggleColor,d$ as toggleX,h$ as toggleY,K3 as varPop,W3 as variance,Dw as vconcat,EP as vector,AP as vectorX,MP as vectorY,zP as voronoi,jP as voronoiMesh,Cw as vspace,R6 as wasmConnector,v5 as width,G5 as xAlign,uC as xAriaDescription,lC as xAriaLabel,Q5 as xAxis,V5 as xClamp,P5 as xDomain,cC as xFontVariant,rC as xGrid,z5 as xInset,j5 as xInsetLeft,q5 as xInsetRight,oC as xLabel,sC as xLabelAnchor,aC as xLabelOffset,iC as xLine,U5 as xNice,W5 as xPadding,X5 as xPaddingInner,H5 as xPaddingOuter,$5 as xRange,fC as xReverse,Y5 as xRound,B5 as xScale,eC as xTickFormat,tC as xTickPadding,nC as xTickRotate,K5 as xTickSize,J5 as xTickSpacing,Z5 as xTicks,dC as xZero,_5 as xyDomain,vC as yAlign,UC as yAriaDescription,$C as yAriaLabel,EC as yAxis,_C as yClamp,pC as yDomain,PC as yFontVariant,FC as yGrid,gC as yInset,xC as yInsetBottom,bC as yInsetTop,LC as yLabel,CC as yLabelAnchor,BC as yLabelOffset,DC as yLine,yC as yNice,SC as yPadding,IC as yPaddingInner,TC as yPaddingOuter,mC as yRange,zC as yReverse,wC as yRound,hC as yScale,OC as yTickFormat,RC as yTickPadding,kC as yTickRotate,MC as yTickSize,NC as yTickSpacing,AC as yTicks,jC as yZero};
69
+ }`)).call(Ef,n);for(let C of l){let{channels:P,values:U,facets:$}=y.get(C);if(p===void 0||C.facet==="super"){let X=null;if($&&(X=$[0],X=C.filter(X,P,U),X.length===0))continue;let tt=C.render(X,g,U,w,T);if(tt==null)continue;R.appendChild(tt)}else{let X;for(let tt of p){if(!(C.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if($){let Y=f.has(C);if(nt=$[Y?tt.i:0],nt=C.filter(nt,P,U),nt.length===0)continue;!Y&&nt===$[0]&&(nt=Ys(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=C.render(nt,g,U,v,T);if(st!=null){(X??=zt(R).append("g")).append(()=>st).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(Y)&&(X.attr(Y,st.getAttribute(Y)),st.removeAttribute(Y))}}X?.selectChildren().attr("transform",k)}}let N=zB(b,T,e),{figure:F=r!=null||i!=null||o!=null||N.length>0}=e;F&&(I=A.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(YB(A,r,"h2")),i!=null&&I.append(YB(A,i,"h3")),I.append(...N,R),o!=null&&I.append(yQ(A,o))),I.scale=$C(g.scales),I.legend=UB(b,T,e),I.projection=T.projection;let B=Y5();return B>0&&zt(R).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.`),I}function YB(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function yQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function gQ({marks:e=[],...t}={}){return Bm({...t,marks:[...e,this]})}wt.prototype.plot=gQ;function GB(e){return e.flat(1/0).filter(t=>t!=null).map(bQ)}function bQ(e){return typeof e.render=="function"?e:new YE(e)}var YE=class extends wt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function GE(e,t){for(let n in e)ZB(e[n],t);return e}function ZB(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:XT(s,i)}=t[n]??{};a!=null&&(e.value=Yt(e.value,a),e.transform=!1)}function xQ(e){for(let t in e)cE(t,e[t])}function Cm(e,t,n,r=d5){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(!K5(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=tC(s);c&&VE(e,"x",u),l&&VE(e,"y",f)}}}else VE(e,a,s)}return e}function VE(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function _Q(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=qe(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Sf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Sf(i,{value:r,scale:"fy"})),GE(o,t);let s=o_(i,o);return{channels:o,groups:s,data:e.data}}function WB(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=qe(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=Sf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Sf(c,{value:i,scale:"fy"})),GE(l,n),{channels:l,groups:o_(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&qe(e.data)?.length===a.length&&qn(`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 wQ(e,t={}){return Se({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function vQ(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)?Ff:/^y$/i.test(i)?El:kf,r=i(wQ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===El?"left":"bottom");let s=N_(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function SQ(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:y=c,grid:b=y===null?null:l}=o,fx:{axis:m=f,grid:g=m===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=n;(r||!Ro(i)&&!XB("x",e))&&(h=p=null),(r||!Ro(o)&&!XB("y",e))&&(y=b=null),t.has("fx")||(m=g=null),t.has("fy")||(x=_=null),h===void 0&&(h=!D_(e,"x")),y===void 0&&(y=!D_(e,"y")),m===void 0&&(m=!D_(e,"fx")),x===void 0&&(x=!D_(e,"fy")),h===!0&&(h="bottom"),y===!0&&(y="left"),m===!0&&(m=h==="top"||h===null?"bottom":"top"),x===!0&&(x=y==="right"||y===null?"left":"right");let v=[];return O_(v,_,I_,a),R_(v,x,w_,"right","left",u,a),O_(v,g,E_,s),R_(v,m,v_,"top","bottom",u,s),O_(v,b,S_,o),R_(v,y,Om,"left","right",n,o),O_(v,p,T_,i),R_(v,h,Dm,"bottom","top",n,i),v}function R_(e,t,n,r,i,o,s){if(!t)return;let a=IQ(t);s=TQ(a?r:t,o,s);let{line:c}=s;(n===Om||n===Dm)&&c&&!Xs(c)&&e.push(Pf(EQ(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function O_(e,t,n,r){!t||Xs(t)||e.push(n(MQ(t,r)))}function IQ(e){return/^\s*both\s*$/i.test(e)}function TQ(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:y}){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:y}}function EQ(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function MQ(e,{stroke:t=Za(e)?e:void 0,ticks:n=AQ(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function AQ(e){switch(typeof e){case"number":return!0;case"string":return!Za(e)}return sr(e)||typeof e?.range=="function"}function D_(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function XB(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 NQ(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 RQ({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=n_(n),l=e&&HB(e),u=t&&HB(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 HB(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var OQ=new Map([["basis",pT],["basis-closed",mT],["basis-open",yT],["bundle",gT],["bump-x",lT],["bump-y",uT],["cardinal",bT],["cardinal-closed",xT],["cardinal-open",_T],["catmull-rom",wT],["catmull-rom-closed",vT],["catmull-rom-open",ST],["linear",$s],["linear-closed",IT],["monotone-x",ET],["monotone-y",MT],["natural",AT],["step",NT],["step-after",OT],["step-before",RT]]);function Pm(e=$s,t){if(typeof e=="function")return e;let n=OQ.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 k_(e=oc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?oc:Pm(e,t)}function oc(e){return $s(e)}function Po(e={y:"count"},t={}){[e,t]=XE(e,t);let{x:n,y:r}=t;return WE(F_(n,t,W),null,null,r,e,Ml(t))}function Uo(e={x:"count"},t={}){[e,t]=XE(e,t);let{x:n,y:r}=t;return WE(null,F_(r,t,W),n,null,e,Al(t))}function ta(e={fill:"count"},t={}){[e,t]=XE(e,t);let{x:n,y:r}=DQ(t);return WE(n,r,null,null,e,Ml(Al(t)))}function JB(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=V1}=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 Uf(e={}){return JB(Po,"y",ji(e,"x"))}function $f(e={}){return JB(Uo,"x",ji(e,"y"))}function WE(e,t,n,r,{data:i=j1,filter:o=xm,sort:s,reverse:a,...c}={},l={}){e=QB(e),t=QB(t),c=kQ(c,l),i=n7(i,W),s=s==null?void 0:t7("sort",s,l),o=o==null?void 0:e7("filter",o,l),n!=null&&Fo(c,"x","x1","x2")&&(n=null),r!=null&&Fo(c,"y","y1","y2")&&(r=null);let[u,f]=Rn(e),[d,h]=Rn(e),[p,y]=Rn(t),[b,m]=Rn(t),[g,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[_,v]=Rn(g),{x:w,y:T,z:A,fill:R,stroke:I,x1:E,x2:O,y1:k,y2:S,domain:M,cumulative:N,thresholds:F,interval:B,...C}=l,[P,U]=Rn(A),[$]=Re(R),[X]=Re(I),[tt,nt]=Rn($),[st,Y]=Rn(X);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:tt||R},..."stroke"in l&&{stroke:st||I},...mn(C,(rt,q,H)=>{let ot=wl(mt(rt,g),H?.[x]),z=mt(rt,A),Lt=mt(rt,$),dt=mt(rt,X),Wt=vm(c,{z,fill:Lt,stroke:dt}),Xt=[],et=[],oe=ot&&v([]),xr=z&&U([]),Gi=Lt&&nt([]),V9=dt&&Y([]),W4=e&&f([]),Y9=e&&h([]),X4=t&&y([]),G9=t&&m([]),W9=CQ(e,t,rt),X9=0;for(let ql of c)ql.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let ql of q){let H4=[];for(let bd of c)bd.scope("facet",ql);s&&s.scope("facet",ql),o&&o.scope("facet",ql);for(let[bd,H9]of Qa(ql,Wt))for(let[Z9,Dy]of Qa(H9,ot))for(let[Wi,yc]of W9(Dy))if(!(o&&!o.reduce(Wi,yc))){H4.push(X9++),et.push(i.reduceIndex(Wi,rt,yc)),ot&&oe.push(Z9),z&&xr.push(Wt===z?bd:z[(Wi.length>0?Wi:Dy)[0]]),Lt&&Gi.push(Wt===Lt?bd:Lt[(Wi.length>0?Wi:Dy)[0]]),dt&&V9.push(Wt===dt?bd:dt[(Wi.length>0?Wi:Dy)[0]]),W4&&(W4.push(yc.x1),Y9.push(yc.x2)),X4&&(X4.push(yc.y1),G9.push(yc.y2));for(let Q9 of c)Q9.reduce(Wi,yc);s&&s.reduce(Wi)}Xt.push(H4)}return sE(Xt,s,a),{data:et,facets:Xt}}),...!Fo(c,"x")&&(u?{x1:u,x2:d,x:bf(u,d)}:{x:w,x1:E,x2:O}),...!Fo(c,"y")&&(p?{y1:p,y2:b,y:bf(p,b)}:{y:T,y1:k,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:rt,output:q})=>[rt,q]))}}function XE({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function F_(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...pi(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=HE(e.thresholds,e.interval),e}function DQ(e){let{x:t,y:n}=e;return t=F_(t,e),n=F_(n,e),[t.value,n.value]=Be(t.value,n.value),{x:t,y:n}}function QB(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ae,thresholds:i}=e,o=s=>{let a=mt(s,t),c;if(Oe(a)||LQ(i)){a=Yt(a,jT,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ha(i)?i(a,u,f):i;typeof d=="number"&&(d=zp(u,f,d)),Ha(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Qe(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ha(i)?i(a,u,f):i;if(typeof d=="number")if(r===ae){let h=vs(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),y=Math.round(f/h);p*h<=u||--p,y*h>f||++y;let b=y-p+1;d=new Float64Array(b);for(let m=0;m<b;++m)d[m]=(p+m)*h}else if(h<0){h=-h;let p=Math.round(u*h),y=Math.round(f*h);p/h<=u||--p,y/h>f||++y;let b=y-p+1;d=new Float64Array(b);for(let m=0;m<b;++m)d[m]=(p+m)/h}else d=[u];else d=[u]}else d=Tn(u,f,d);else Ha(d)&&(r===ae&&(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?PQ:n>0?BQ:ZE)(l,c,a),l};return o.label=On(t),o}function HE(e,t,n=KB){if(e===void 0)return t===void 0?n:Do(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return E0;case"scott":return Ch;case"sturges":return Ma;case"auto":return KB}return mm(e)}return e}function kQ(e,t){return iE(e,t,t7)}function t7(e,t,n){return z1(e,t,n,e7)}function e7(e,t,n){return q1(e,t,n,n7)}function n7(e,t){return vf(e,t,FQ)}function FQ(e){switch(`${e}`.toLowerCase()){case"x":return UQ;case"x1":return zQ;case"x2":return qQ;case"y":return $Q;case"y1":return jQ;case"y2":return VQ}throw new Error(`invalid bin reduce: ${e}`)}function KB(e,t,n){return Math.min(200,Ch(e,t,n))}function LQ(e){return y5(e)||sr(e)&&Oe(e)}function CQ(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 ZE(e,t,n){return t=Qe(t),r=>{let i=e.map(()=>[]);for(let o of r)i[ws(t,n[o])-1]?.push(o);return i}}function BQ(e,t,n){let r=ZE(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 PQ(e,t,n){let r=ZE(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 r7(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var UQ={reduceIndex(e,t,{x1:n,x2:r}){return r7(n,r)}},$Q={reduceIndex(e,t,{y1:n,y2:r}){return r7(n,r)}},zQ={reduceIndex(e,t,{x1:n}){return n}},qQ={reduceIndex(e,t,{x2:n}){return n}},jQ={reduceIndex(e,t,{y1:n}){return n}},VQ={reduceIndex(e,t,{y2:n}){return n}};function zf(e={}){return YT(e)?e:{...e,x:W}}function qf(e={}){return GT(e)?e:{...e,y:W}}function i7(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Xa(e);let o=e[$T]=new Uint32Array(n+i);t=t.map(a=>Xa(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 QE(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Gf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:bf(c,l)}}function a7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Gf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function c7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Gf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function KE(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Gf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:bf(c,l)}}function l7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Gf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function u7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Gf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function jf({x:e,x1:t,x2:n,...r}={}){return r=ji(r,"y"),t===void 0&&n===void 0?QE({x:e,...r}):([t,n]=WT(e,t,n),{...r,x1:t,x2:n})}function Vf({y:e,y1:t,y2:n,...r}={}){return r=ji(r,"x"),t===void 0&&n===void 0?KE({y:e,...r}):([t,n]=WT(e,t,n),{...r,y1:t,y2:n})}function Yf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var YQ={length:!0};function Gf(e,t=ym,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=zn(a),[l,u]=Rn(e),[f,d]=pn(t),[h,p]=pn(t);return f.hint=h.hint=YQ,i=GQ(i),o=HQ(o,i,r),[mn(a,(y,b,m)=>{({data:y,facets:b}=i7(y,b));let g=e==null?void 0:u(wl(mt(y,e),m?.[n])),x=mt(y,t,Float64Array),_=mt(y,c),v=o&&o(y,g,x,_),w=y.length,T=d(new Float64Array(w)),A=p(new Float64Array(w)),R=[];for(let I of b){let E=g?Array.from(sn(I,O=>g[O]).values()):[I];if(v)for(let O of E)O.sort(v);for(let O of E){let k=0,S=0;s&&O.reverse();for(let M of O){let N=x[M];N<0?k=A[M]=(T[M]=k)+N:N>0?S=A[M]=(T[M]=S)+N:A[M]=T[M]=S}}R.push(E)}return i&&i(R,T,A,_),{data:y,facets:b}}),l,f,h]}function GQ(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return WQ;case"center":case"silhouette":return XQ;case"wiggle":return d7}throw new Error(`unknown offset: ${e}`)}}function f7(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 WQ(e,t,n){for(let r of e)for(let i of r){let[o,s]=f7(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 XQ(e,t,n){for(let r of e){for(let i of r){let[o,s]=f7(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}h7(r,t,n)}p7(e,t,n)}function d7(e,t,n,r){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(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],y=o.has(c)?p-o.get(c):0;return o.set(c,p),y}),f=[0,...w0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=En(l);d&&(s-=En(l,(h,p)=>(u[p]/2+f[p])*h)/d)}h7(i,t,n)}p7(e,t,n)}function h7(e,t,n){let r=ce(e,i=>ce(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function p7(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ce(a,c=>t[c])+$t(a,c=>n[c]))/2),s=ce(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 HQ(e,t,n){if(e===void 0&&t===d7)return o7(fn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?bl:fn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return ZQ(i);case"z":return QQ(i);case"sum":return KQ(i);case"appearance":return JQ(i);case"inside-out":return o7(i)}return s7(zT(e))}if(typeof e=="function")return(e.length===1?s7:tK)(e);if(Array.isArray(e))return eK(e);throw new Error(`invalid order: ${e}`)}}function ZQ(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function QQ(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function KQ(e){return L_(e,(t,n,r,i)=>xu(or(t),o=>En(o,s=>r[s]),o=>i[o]))}function JQ(e){return L_(e,(t,n,r,i)=>xu(or(t),o=>n[Vc(o,s=>r[s])],o=>i[o]))}function o7(e){return L_(e,(t,n,r,i)=>{let o=or(t),s=xu(o,f=>n[Vc(f,d=>r[d])],f=>i[f]),a=Ci(o,f=>En(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 s7(e){return t=>{let n=mt(t,e);return(r,i)=>fn(n[r],n[i])}}function tK(e){return t=>(n,r)=>e(t[n],t[r])}function eK(e){return L_(fn,()=>e)}function L_(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Hn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var nK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},kl=class extends wt{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:zn(n),optional:!0}},n,nK),this.z=a,this.curve=Pm(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(Ft,this,i,o).call(It,this,n,0,0).call(u=>u.selectAll().data(H1(t,[s,a,c,l],this,r)).enter().append("path").call(Rt,this).call(Tl,this,r).attr("d",of().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 Um(e,t){return t===void 0?ea(e,{x:Vs,y:Wa}):new kl(e,t)}function sc(e,t){let{y:n=Me,...r}=$f(t);return new kl(e,jf(zf({...r,y1:n,y2:void 0})))}function ea(e,t){let{x:n=Me,...r}=Uf(t);return new kl(e,Vf(qf({...r,x1:n,x2:void 0})))}var rK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},$m=class extends wt{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,rK),this.curve=k_(a,c),Vi(this,n)}project(t,n,r){this.curve!==oc&&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(Ft,this,i,o).call(It,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",u===oc&&o.projection?iK(o.projection,s,a,c,l):d=>{let h=Jn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Zt,this,r).call(Js,this,r,o)).node()}};function iK(e,t,n,r,i){let o=An(e);return t=Qe(t),n=Qe(n),r=Qe(r),i=Qe(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function C_(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=zm(t,n,r),[o,s]=zm(i,o,s),new $m(e,{...a,x1:n,x2:r,y1:o,y2:s})}function zm(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 oK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},qm=class extends wt{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,oK),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=sK(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:y,insetEnd:b}=this,m=u?_=>u[_]:dn(f===void 0?1:f),g=h*Lf/2,x=p/1.5;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(_=>_.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",v=>{let w=s[v],T=a[v],A=c[v],R=l[v],I=Math.hypot(A-w,R-T);if(I<=y+b)return null;let E=Math.atan2(R-T,A-w),O=Math.min(x*m(v),I/3),k=this.sweep(w,T,A,R)*d*Lf,S=Math.hypot(I/Math.tan(k),I)/2;if(y||b)if(S<1e5){let tt=Math.sign(k),[nt,st]=aK([w,T],[A,R],S,tt);if(y&&([w,T]=m7([nt,st,S],[w,T,y],-tt*Math.sign(y))),b){let[Y,rt]=m7([nt,st,S],[A,R,b],tt*Math.sign(b));E+=Math.atan2(rt-st,Y-nt)-Math.atan2(R-st,A-nt),A=Y,R=rt}}else{let tt=A-w,nt=R-T,st=Math.hypot(tt,nt);y&&(w+=tt/st*y,T+=nt/st*y),b&&(A-=tt/st*b,R-=nt/st*b)}let M=E+k,N=M+g,F=M-g,B=A-O*Math.cos(N),C=R-O*Math.sin(N),P=A-O*Math.cos(F),U=R-O*Math.sin(F),$=S<1e5?`A${S},${S} 0,0,${k>0?1:0} `:"L",X=O?`M${B},${C}L${A},${R}L${P},${U}`:"";return`M${w},${T}${$}${A},${R}${X}`}).call(Zt,this,r)).node()}};function sK(e=1){if(typeof e=="number")return dn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Ke(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Gt(t,r);case"-x":return(t,n,r)=>Xn(t,r);case"+y":return(t,n,r,i)=>Gt(n,i);case"-y":return(t,n,r,i)=>Xn(n,i)}}function aK([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 m7([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 y7(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=zm(t,n,r),[o,s]=zm(i,o,s),new qm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Wf=class extends wt{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Nt(s),this.insetRight=Nt(a),this.insetBottom=Nt(c),this.insetLeft=Nt(l),this.rx=le(u,"auto"),this.ry=le(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ct("svg:g",o).call(Ft,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Rt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ft,"rx",s).call(ft,"ry",a).call(Zt,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)}},g7={ariaLabel:"bar"},jm=class extends Wf{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,g7)}_transform(t,n,{x:r}){t.call(It,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return ar(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 ar(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Vm=class extends Wf{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,g7)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return ar(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 ar(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function $o(e,t={}){return yf(t)||(t={...t,y:Me,x2:W}),new jm(e,jf(u_(zf(t))))}function zo(e,t={}){return yf(t)||(t={...t,x:Me,y2:W}),new Vm(e,Vf(f_(qf(t))))}var cK={ariaLabel:"cell"},Fl=class extends Wf{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,cK)}_transform(t,n){t.call(It,n,{},0,0)}};function ac(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Fl(e,{...r,x:t,y:n})}function b7(e,{x:t=Me,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Fl(e,{...i,x:t,fill:n,stroke:r})}function x7(e,{y:t=Me,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Fl(e,{...i,y:t,fill:n,stroke:r})}var lK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Ym(e){return e.sort===void 0&&e.reverse===void 0?U1({channel:"-r"},e):e}var Ll=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=zs,frameAnchor:c}=n,[l,u]=ie(s,0),[f,d]=A5(a),[h,p]=ie(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:ir,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Ym(n),lK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=ko(c);let{channels:y}=this,{symbol:b}=y;if(b){let{fill:m,stroke:g}=y;b.hint={fill:m?m.value===b.value?"color":"currentColor":this.fill??"currentColor",stroke:g?g.value===b.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:y}=this,[b,m]=yn(this,i),g=y===zs,x=u?void 0:h*h*Math.PI;return qa(h)&&(t=[]),ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(g?"circle":"path").call(Rt,this).call(g?v=>{v.attr("cx",c?w=>c[w]:b).attr("cy",l?w=>l[w]:m).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",rc`translate(${c?w=>c[w]:b},${l?w=>l[w]:m})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=Jn();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=Jn();return y.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=Jn();return d[w].draw(T,x),T}:(()=>{let w=Jn();return y.draw(w,x),w})())}).call(Zt,this,r)).node()}};function yi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Ll(e,{...r,x:t,y:n})}function _7(e,{x:t=W,...n}={}){return new Ll(e,h_({...n,x:t}))}function w7(e,{y:t=W,...n}={}){return new Ll(e,d_({...n,y:t}))}function v7(e,t){return yi(e,{...t,symbol:"circle"})}function S7(e,t){return yi(e,{...t,symbol:"hexagon"})}var uK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Cl=class extends wt{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:zn(n),optional:!0}},n,uK),this.z=o,this.curve=k_(s,a),Vi(this,n)}filter(t){return t}project(t,n,r){this.curve!==oc&&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(Ft,this,i,o).call(It,this,n).call(l=>l.selectAll().data(H1(t,[s,a],this,r)).enter().append("path").call(Rt,this).call(Tl,this,r).call(tB,this,r,o).attr("d",c===oc&&o.projection?fK(o.projection,s,a):Zp().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function fK(e,t,n){let r=An(e);return t=Qe(t),n=Qe(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 Bl(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Cl(e,{...r,x:t,y:n})}function cc(e,{x:t=W,y:n=Me,...r}={}){return new Cl(e,$f({...r,x:t,y:n}))}function lc(e,{x:t=Me,y:n=W,...r}={}){return new Cl(e,Uf({...r,x:t,y:n}))}var dK={ariaLabel:"rect"},Pl=class extends wt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,dK),this.insetTop=Nt(c),this.insetRight=Nt(l),this.insetBottom=Nt(u),this.insetLeft=Nt(f),this.rx=le(d,"auto"),this.ry=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:y,width:b,height:m}=i,{projection:g}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:T,ry:A}=this,R=(s?.bandwidth?s.bandwidth():0)-w-_,I=(a?.bandwidth?a.bandwidth():0)-x-v;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{},0,0).call(E=>E.selectAll().data(t).enter().append("rect").call(Rt,this).attr("x",c&&(g||!ar(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:y+w).attr("y",l&&(g||!ar(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(g||!ar(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+R):R:b-h-y-_-w).attr("height",l&&(g||!ar(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:m-d-p-x-v).call(ft,"rx",T).call(ft,"ry",A).call(Zt,this,r)).node()}};function Gm(e,t){return new Pl(e,kE(FE(t)))}function Xf(e,t={}){return yf(t)||(t={...t,y:Me,x2:W,interval:1}),new Pl(e,jf(FE(zf(t))))}function Hf(e,t={}){return yf(t)||(t={...t,x:Me,y2:W,interval:1}),new Pl(e,Vf(kE(qf(t))))}function tM(e,t){t=hK(t);let{x:n,y:r,color:i,size:o}=t,s=B_(e,n),a=B_(e,r),c=B_(e,i),l=B_(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...y},y:{value:b,reduce:m,zero:g,...x},color:{value:_,color:v,reduce:w},size:{value:T,reduce:A},mark:R}=t;if(h===void 0&&(h=m==null&&d==null&&T==null&&b!=null?"count":null),m===void 0&&(m=h==null&&b==null&&T==null&&d!=null?"count":null),A===void 0&&T==null&&w==null&&h==null&&m==null&&(d==null||Ae(s))&&(b==null||Ae(a))&&(A="count"),p===void 0&&(p=P_(h)?!0:void 0),g===void 0&&(g=P_(m)?!0:void 0),d==null&&b==null)throw new Error("must specify x or y");if(h!=null&&b==null)throw new Error("reducing x requires y");if(m!=null&&d==null)throw new Error("reducing y requires x");R===void 0&&(R=T!=null||A!=null?"dot":P_(h)||P_(m)||w!=null?"bar":d!=null&&b!=null?Ae(s)||Ae(a)||h==null&&m==null&&!Wm(s)&&!Wm(a)?"dot":"line":d!=null||b!=null?"rule":null);let I,E,O;switch(R){case"dot":O=yi,E="stroke";break;case"line":O=s&&a||h!=null||m!=null?g||m!=null||s&&Wm(s)?lc:p||h!=null||a&&Wm(a)?cc:Bl:s?cc:lc,E="stroke",T7(c)&&(I=null);break;case"area":O=!(g||m!=null)&&(p||h!=null||a&&Wm(a))?sc:ea,E="fill",T7(c)&&(I=null);break;case"rule":O=s?qr:jr,E="stroke";break;case"bar":O=h!=null?Ae(a)?I7(h)&&s&&Ae(s)?ac:$o:Xf:m!=null?Ae(s)?I7(m)&&a&&Ae(a)?ac:zo:Hf:w!=null||A!=null?s&&Ae(s)&&a&&Ae(a)?ac:s&&Ae(s)?zo:a&&Ae(a)?$o:Gm:s&&Ws(s)&&!(a&&Ws(a))?$o:a&&Ws(a)&&!(s&&Ws(s))?zo:ac,E="fill";break;default:throw new Error(`invalid mark: ${R}`)}let k={fx:u,fy:f,x:s??void 0,y:a??void 0,[E]:c??v,z:I,r:l??void 0,tip:!0},S,M={[E]:w??void 0,r:A??void 0};if(h!=null&&m!=null)throw new Error("cannot reduce both x and y");return m!=null?(M.y=m,S=Ae(s)?Ka:Po):h!=null?(M.x=h,S=Ae(a)?Ja:Uo):(w!=null||A!=null)&&(s&&a?S=Ae(s)&&Ae(a)?wm:Ae(s)?Uo:Ae(a)?Po:ta:s?S=Ae(s)?Ka:Po:a&&(S=Ae(a)?Ja:Uo)),(S===ta||S===Po)&&(k.x={value:s,...y}),(S===ta||S===Uo)&&(k.y={value:a,...x}),p===void 0&&(p=s&&!(S===ta||S===Po)&&(O===$o||O===sc||O===Xf||O===jr)),g===void 0&&(g=a&&!(S===ta||S===Uo)&&(O===zo||O===ea||O===Hf||O===qr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...y},y:{value:b??null,reduce:m??null,zero:!!g,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:A??null},mark:R,markImpl:E7[O],markOptions:k,transformImpl:E7[S],transformOptions:M,colorMode:E}}function M7(e,t){let n=tM(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=JE[n.markImpl],f=JE[n.transformImpl],d=r!=null||i!=null?Pf({strokeOpacity:.1}):null,h=[o?qr([0]):null,s?jr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Je(d,h,p):Je(d,p,h)}function Wm(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Gt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function hK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return $r(e)||(e=Zf(e)),$r(t)||(t=Zf(t)),$r(n)||(n=Za(n)?{color:n}:Zf(n)),$r(r)||(r=Zf(r)),$r(i)&&({value:i}=Zf(i)),$r(o)&&({value:o}=Zf(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function B_(e,t){let n=mt(e,t.value);return n&&(n.label=On(t.value)),n}function Zf(e){return pK(e)?{reduce:e}:{value:e}}function P_(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function I7(e){return/^(?:first|last|mode)$/i.test(e)}function pK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&hn(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 T7(e){return e?new kr(e).size>e.length>>1:!1}var JE={dot:yi,line:Bl,lineX:cc,lineY:lc,areaX:sc,areaY:ea,ruleX:qr,ruleY:jr,barX:$o,barY:zo,rect:Gm,rectX:Xf,rectY:Hf,cell:ac,bin:ta,binX:Po,binY:Uo,group:wm,groupX:Ka,groupY:Ja},E7=Object.fromEntries(Object.entries(JE).map(([e,t])=>[t,e]));function Qf(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=W});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),br(o,t)}function Kf(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=W});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),br(o,t)}function br(e={},t={}){let n=zn(t),r=Object.entries(e).map(([i,o])=>{let s=F1(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=pn(s);return{key:i,input:s,output:a,setOutput:c,map:mK(o)}});return{...mn(t,(i,o)=>{let s=mt(i,n),a=r.map(({input:l})=>mt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?sn(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 mK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&hn(e))return yK(e);if(typeof e=="function")return eM(gf(e));switch(`${e}`.toLowerCase()){case"cumsum":return bK;case"rank":return eM((t,n)=>Bh(t,r=>n[r]));case"quantile":return eM((t,n)=>gK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function yK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function gK(e,t){let n=co(e,t)-1;return Bh(e,t).map(r=>r/n)}function eM(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 bK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function A7(e={},t){return arguments.length===1&&(t=e),Qf(Jf(e),t)}function N7(e={},t){return arguments.length===1&&(t=e),Kf(Jf(e),t)}function Jf(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=_K(r),qn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return wK(n)(t,xK(i,t),o)}function xK(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 _K(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function wK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return U_(mf(e));switch(e.toLowerCase()){case"deviation":return U_(ri);case"max":return $_((t,n)=>$t(t,r=>n[r]));case"mean":return vK;case"median":return U_(Bi);case"min":return $_((t,n)=>ce(t,r=>n[r]));case"mode":return $_((t,n)=>Su(t,r=>n[r]));case"sum":return R7;case"variance":return U_(Ea);case"difference":return TK;case"ratio":return EK;case"first":return MK;case"last":return AK}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return $_(gf(e))}function U_(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(Ys(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(Ys(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Ys(i,c,c+t),a)}}}function $_(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=$e(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=$e(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Ys(i,c,c+t),o)),a-=$e(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Ys(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Ys(i,a,a+t),o)}}}function R7(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 vK(e,t,n){if(n){let r=R7(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 SK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if($e(o))return o}}function IK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if($e(o))return o}}function O7(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 D7(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 TK(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]]=D7(i,r,s,e)-O7(i,r,s,e)}}}function EK(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]]=D7(i,r,s,e)/O7(i,r,s,e)}}}function MK(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]]=SK(i,r,s,e)}}}function AK(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]]=IK(i,r,s,e)}}}var na={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function k7(e,{x:t=W,y:n,k:r=na.k,color:i=na.color,opacity:o=na.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Je(ne(s)?null:sc(e,br({x1:uc({k:-r,...f}),x2:uc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:cc(e,br({x:uc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function F7(e,{x:t,y:n=W,k:r=na.k,color:i=na.color,opacity:o=na.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Je(ne(s)?null:ea(e,br({y1:uc({k:-r,...f}),y2:uc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:lc(e,br({y:uc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function uc({n:e=na.n,k:t=0,strict:n=na.strict,anchor:r=na.anchor}={}){return Jf({k:e,reduce:i=>Ss(i)+t*(ri(i)||0),strict:n,anchor:r})}var NK={ariaLabel:"tick",fill:null,stroke:"currentColor"},z_=class extends wt{constructor(t,n,r){super(t,n,r,NK),Vi(this,r)}render(t,n,r,i,o){return ct("svg:g",o).call(Ft,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Rt,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(Zt,this,r).call(Js,this,r,o)).node()}},Xm=class extends z_{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=Nt(s),this.insetBottom=Nt(a)}_transform(t,n,{x:r}){t.call(It,n,{x:r},De,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}},Hm=class extends z_{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=Nt(s),this.insetLeft=Nt(a)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,De)}_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 q_(e,{x:t=W,...n}={}){return new Xm(e,{...n,x:t})}function j_(e,{y:t=W,...n}={}){return new Hm(e,{...n,y:t})}function L7(e,{x:t=W,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?Ja:_m;return Je(jr(e,u({x1:nM,x2:rM},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),$o(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),q_(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,br({x:B7},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function C7(e,{y:t=W,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?Ka:_m;return Je(qr(e,u({y1:nM,y2:rM},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),zo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),j_(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,br({y:B7},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function B7(e){let t=nM(e),n=rM(e);return e.map(r=>r<t||r>n?r:NaN)}function nM(e){let t=P7(e)*2.5-U7(e)*1.5;return ce(e,n=>n>=t?n:NaN)}function rM(e){let t=U7(e)*2.5-P7(e)*1.5;return $t(e,n=>n<=t?n:NaN)}function P7(e){return Zn(e,.25)}function U7(e){return Zn(e,.75)}var RK={ariaLabel:"raster",stroke:null,pixelSize:1};function td(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function $7(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var Qm=class extends wt{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:y}=r;if(o!=null&&(o=$7(o,"width")),s!=null&&(s=$7(s,"height")),l!=null&&(l=td(l,"x1")),u!=null&&(u=td(u,"y1")),f!=null&&(f=td(f,"x2")),d!=null&&(d=td(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=PK(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=UK(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=td(h,"pixelSize"),this.blur=td(p,"blur"),this.interpolate=a==null||c==null?null:OK(y)}},Km=class extends Qm{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=V_("fillOpacity",n)),Re(i)[0]!==void 0&&(n=V_("fill",n))}super(t,void 0,n,RK),this.imageRendering=le(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]=q7(r,i,o),p=d-u,y=h-f,{pixelSize:b,width:m=Math.round(Math.abs(p)/b),height:g=Math.round(Math.abs(y)/b)}=this,x=m*g,{fill:_,fillOpacity:v}=r,w=0;if(this.interpolate){let M=m/p,N=g/y,F=Yt(a,C=>(C-u)*M,Float64Array),B=Yt(c,C=>(C-f)*N,Float64Array);_&&(_=this.interpolate(t,m,g,F,B,_)),v&&(v=this.interpolate(t,m,g,F,B,v))}else this.data==null&&t&&(w=t.fi*x);let T=l.createElement("canvas");T.width=m,T.height=g;let A=T.getContext("2d"),R=A.createImageData(m,g),I=R.data,{r:E,g:O,b:k}=an(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<x;++M){let N=M<<2;if(_){let F=s(_[M+w]);if(F==null){I[N+3]=0;continue}({r:E,g:O,b:k}=an(F))}v&&(S=v[M+w]*255),I[N+0]=E,I[N+1]=O,I[N+2]=k,I[N+3]=S}return this.blur>0&&L2(R,this.blur),A.putImageData(R,0,0),ct("svg:g",o).call(Ft,this,i,o).call(It,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(y)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(Rt,this).attr("xlink:href",T.toDataURL())).node()}};function iM(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&&b5(t)&&(r=Vs,i=Wa,o===void 0&&(o=h5)),[t,{...s,x:r,y:i,[e]:o}]}function z7(){let[e,t]=iM("fill",...arguments);return new Km(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function q7({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 oM({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),q7(If(a,i),o,s)}function V_(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return Se({...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]=oM(o,s,a,c),y=h-f,b=p-d,{pixelSize:m}=this,{width:g=Math.round(Math.abs(y)/m),height:x=Math.round(Math.abs(b)/m)}=t,_=new Array(g*x*(i?i.length:1)),v=y/g,w=b/x,T=0;for(let A of i??[void 0])for(let R=.5;R<x;++R)for(let I=.5;I<g;++I,++T)_[T]=n(l.invert(f+I*v),u.invert(d+R*w),A);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function OK(e){if(typeof e=="function")return e;if(e==null)return Y_;switch(`${e}`.toLowerCase()){case"none":return Y_;case"nearest":return aM;case"barycentric":return sM();case"random-walk":return cM()}throw new Error(`invalid interpolate: ${e}`)}function Y_(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 sM({random:e=cl(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ai.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=BK(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],y=c[h+1],b=c[h+2],m=a[2*p],g=a[2*y],x=a[2*b],_=a[2*p+1],v=a[2*y+1],w=a[2*b+1],T=Math.min(m,g,x),A=Math.max(m,g,x),R=Math.min(_,v,w),I=Math.max(_,v,w),E=(v-w)*(m-x)+(_-w)*(x-g);if(!E)continue;let O=s[t[p]],k=s[t[y]],S=s[t[b]];for(let M=Math.floor(T);M<A;++M)for(let N=Math.floor(R);N<I;++N){if(M<0||M>=n||N<0||N>=r)continue;let F=M+.5,B=N+.5,C=((v-w)*(F-x)+(B-w)*(x-g))/E;if(C<0)continue;let P=((w-_)*(F-x)+(B-w)*(m-x))/E;if(P<0)continue;let U=1-C-P;if(U<0)continue;let $=M+n*N;u[$]=d(O,C,k,P,S,U,M,N),f[$]=1}}return DK(u,f,i,o,s,n,r,l,t,d),u}}function DK(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)=>FK(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let y=0;y<o;++y){let b=y+o*h;if(!t[b]){let m=y+.5;for(let g=0;g<u;++g){let x=(u+d+(g%2?(g+1)/2:-g/2))%u;if(f[x](m,p)){let _=kK(n.at(x-1),r.at(x-1),n[x],r[x],m,p);e[b]=l(i.at(x-1),_,i[x],1-_,i[x],0,y,h),d=x;break}}}}}}function kK(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 Zm(e,t,n,r){return e*r-n*t}function FK(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,y=o-a,b=c-u,m=l-f,g=Math.hypot(d,h),x=Math.hypot(p,y),_=Math.hypot(b,m);return(v,w)=>{let T=v-s,A=w-a,R=v-c,I=w-l;return Zm(T,A,R,I)>-1e-6&&Zm(T,A,d,h)*x-Zm(T,A,p,y)*g>-1e-6&&Zm(R,I,b,m)*g-Zm(R,I,d,h)*_<=0}}function aM(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ai.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 cM({random:e=cl(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ai.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,y=0;p<o;++p){d=f;for(let b=.5;b<i;++b,++y){let m=b,g=p;h=d=u.find(m,g,d),b===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[r[h]]-m,a[r[h]]-g))>t&&_<n;){let v=e(b,p,_)*2*Math.PI;m+=Math.cos(v)*x,g+=Math.sin(v)*x,h=u.find(m,g,h),++_}l[y]=c[r[h]]}}return l}}function LK(e,t,n,r,i,o){return t*e+r*n+o*i}function CK(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 BK(e,t){return Ws(e)||Oe(e)?LK:CK(t)}function PK(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 UK(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 j7={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Jm=class extends Qm{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=X1({},i,j7);if(r===void 0){for(let a in o)if(o[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=i[a],i[a]="value"}}if(r!=null){let a={transform:c=>c.map(l=>l.value),label:On(r)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=V_("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=W),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},$K(i),j7);let s={geometry:{value:W}};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=An();return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",l=>a(s[l])).call(Zt,this,r)}).node()}};function $K({thresholds:e,interval:t,...n}){return e=HE(e,t,Ma),Se(n,function(r,i,o,s,a,c){let[l,u,f,d]=oM(o,s,a,c),h=f-l,p=d-u,{pixelSize:y,width:b=Math.round(Math.abs(h)/y),height:m=Math.round(Math.abs(p)/y)}=this,g=b/h,x=m/p,_=o.value.value,v=[];if(this.interpolate){let{x:I,y:E}=ec(o,s,c),O=Yt(I,N=>(N-l)*g,Float64Array),k=Yt(E,N=>(N-u)*x,Float64Array),S=[o.x,o.y,o.value],M=[O,k,_];for(let N of i){let F=this.filter(N,S,M);v.push(this.interpolate(F,b,m,O,k,_))}}else if(i){let I=b*m,E=i.length;for(let O=0;O<E;++O)v.push(_.slice(O*I,O*I+I))}else v.push(_);if(this.blur>0)for(let I of v)Dh({data:I,width:b,height:m},this.blur);let w=zK(e,_,...qK(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=Fa().size([b,m]).smooth(this.smooth),A=[],R=[];for(let I of v)R.push(Ue(A.length,A.push(...Yt(w,E=>T(I,E)))));for(let{coordinates:I}of A)for(let E of I)for(let O of E)for(let k of O)k[0]=k[0]/g+l,k[1]=k[1]/x+u;return{data:A,facets:R,channels:Y1(this.contourChannels,A)}})}function zK(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return qe(e);let i=Tn(...wu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function Y7(){return new Jm(...iM("value",...arguments))}function qK(e){return[ce(e,t=>ce(t,V7)),$t(e,t=>$t(t,V7))]}function V7(e){return isFinite(e)?e:NaN}function X7(e,t){return lM(kf,e,t)}function H7(e,t={}){return lM(Ff,e,t)}function Z7(e,t={}){return lM(El,e,t)}function lM(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(qr(t,G7("x",{...s,inset:-6},n))),i!=null&&a.push(jr(t,G7("y",{...s,inset:-6},n))),r!=null&&a.push(Bo(t,W7("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Bo(t,W7("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Je(...a)}function Q7(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:jK(e,u)}}function jK(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 G7(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...Q7(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function W7(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...Q7(e,t,VK(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function VK(e,t){return Se(t,(n,r,i)=>({channels:{text:{value:Sm(i,e)?.value}}}))}var YK={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},GK={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},WK={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},XK={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},HK={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},uM=class extends wt{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,YK),this.curve=Pm(s,a),Vi(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]=yn(this,i),p=c?g=>c[g]:dn(d),y=l?g=>l[g]:dn(h),b=this;function m(g){let x=-1,_=[],v={};for(let S in r)v[S]=[];let w=[],T=[],A=[],R=[];function I(S,M){S=g[S],M=g[M],_.push(++x),w[x]=p(S),A[x]=y(S),T[x]=p(M),R[x]=y(M);for(let N in r)v[N].push(r[N][M])}let{halfedges:E,hull:O,triangles:k}=ai.from(g,p,y);for(let S=0;S<E.length;++S){let M=E[S];M>S&&I(k[S],k[M])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);zt(this).selectAll().data(_).enter().append("path").call(Rt,b).attr("d",S=>{let M=Jn(),N=f(M);return N.lineStart(),N.point(w[S],A[S]),N.point(T[S],R[S]),N.lineEnd(),M}).call(Zt,b,v).call(Js,b,v,o)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(sn(t,x=>u[x]).values()).enter().append("g").each(m):g=>g.datum(t).each(m)).node()}},ty=class extends wt{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]=yn(this,i),h=c?m=>c[m]:dn(f),p=l?m=>l[m]:dn(d),y=this;function b(m){let g=ai.from(m,h,p);zt(this).append("path").datum(m[0]).call(Rt,y).attr("d",y._render(g,i)).call(Zt,y,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(sn(t,g=>u[g]).values()).enter().append("g").each(b):m=>m.datum(t).each(b)).node()}},fM=class extends ty{constructor(t,n={}){super(t,n,GK),this.fill="none"}_render(t){return t.render()}},dM=class extends ty{constructor(t,n={}){super(t,n,WK,zn)}_render(t){return t.renderHull()}},hM=class extends wt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,XK)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=yn(this,i),h=c?m=>c[m]:dn(f),p=l?m=>l[m]:dn(d),y=this;function b(m){let g=ai.from(m,h,p),x=K7(g,i);zt(this).selectAll().data(m).enter().append("path").call(Rt,y).attr("d",(_,v)=>x.renderCell(v)).call(Zt,y,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(sn(t,g=>u[g]).values()).enter().append("g").each(b):m=>m.datum(t).each(b)).node()}},pM=class extends ty{constructor(t,n){super(t,n,HK),this.fill="none"}_render(t,n){return K7(t,n).render()}};function K7(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 ey(e,t,{x:n,y:r,...i}={}){return[n,r]=Be(n,r),new e(t,{...i,x:n,y:r})}function J7(e,t){return ey(uM,e,t)}function tP(e,t){return ey(fM,e,t)}function eP(e,t){return ey(dM,e,t)}function nP(e,t){return ey(hM,e,t)}function rP(e,t){return ey(pM,e,t)}var ZK={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ny=class extends wt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=iP(s)&&(s="currentColor",!0),u=iP(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:zn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},KK({...c,fill:s,stroke:a},l,u),ZK),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=An();return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Rt,this).call(Zt,this,r).attr("d",l=>a(s[l]))).node()}};function oP(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new ny(e,{...r,x:t,y:n})}var QK=new Set(["x","y","z","weight"]);function KK(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"?Qe(o):+o,Se(e,function(s,a,c,l,u,f){let d=c.weight?Qe(c.weight.value):null,h=c.z?.value,{z:p}=this,[y,b]=yn(this,u),{width:m,height:g}=u,{x,y:_}=ec(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([k])=>!QK.has(k)).map(([k,S])=>[k,{...S,value:[]}])),w=t&&[],T=n&&[],A=SS().x(x?k=>x[k]:y).y(_?k=>_[k]:b).weight(d?k=>d[k]:1).size([m,g]).bandwidth(i),R=[];for(let k of a){let S=[];R.push(S);for(let M of h?Tm(k,h,p):[k]){let N=A.contours(M);S.push([M,N])}}let I=o;if(!(I instanceof _l)){let k=0;for(let S of R)for(let[,M]of S){let N=M.max;N>k&&(k=N)}I=Float64Array.from({length:o-1},(S,M)=>k*100*(M+1)/o)}let E=[],O=[];for(let k of R){let S=[];E.push(S);for(let[M,N]of k)for(let F of I){S.push(O.length),O.push(N(F/100)),w&&w.push(F),T&&T.push(F);for(let B in v)v[B].value.push(c[B].value[M[0]])}}return w&&w.push(0),T&&T.push(0),{data:s,facets:E,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:O}}}})}function iP(e){return/^density$/i.test(e)}function cP(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Me:void 0,y:s=r===void 0&&i===void 0?W:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:y=Re(h)[0],clip:b,tip:m,render:g,...x}={}){return[t,n]=sP(o,t,n),[r,i]=sP(s,r,i),t===n&&r===i&&(r=fc(0)),{tip:m}=ji({tip:m},"x"),Je(ne(c)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:c,fillOpacity:f,render:Df(g,aP(!0)),clip:b,...x}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:l,fillOpacity:d,render:Df(g,aP(!1)),clip:b,...x}),{ariaLabel:"negative difference"}),Bl(e,{x:n,y:i,z:y,stroke:h,strokeOpacity:p,tip:m,clip:!0,...x}))}function sP(e,t,n){return t===void 0&&n===void 0?t=n=fc(e):t===void 0?(n=fc(n),t=e===void 0?n:fc(e)):n===void 0?(t=fc(t),n=e===void 0?t:fc(e)):(t=fc(t),n=fc(n)),[t,n]}function fc(e){let t,{value:n,label:r=On(n)}=pi(e);return{transform:i=>t||(t=mt(i,n)),label:r}}function aP(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===e_(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,y=h.querySelector("g")??h;for(let b=0;p.firstChild;b+=2){let m=W1(),g=ct("svg:clipPath",o).attr("id",m).node();g.appendChild(p.firstChild),y.childNodes[b].setAttribute("clip-path",`url(#${m})`),y.insertBefore(g,y.childNodes[b])}return h}}var JK={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},ry=class extends wt{constructor(t,n={}){let[r,i]=ie(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:ir,optional:!0}},Ym(n),JK),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=An(o.projection??tJ(n)),{r:l}=this;return qa(l)?t=[]:l!==void 0&&c.pointRadius(l),ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Zt,this,r)}).node()}};function tJ({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,sl({point(n,r){this.stream.point(e(n),t(r))}})}function G_(e,{geometry:t=W,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new ry(e,{geometry:t,...n})}function lP({strokeWidth:e=1.5,...t}={}){return G_({type:"Sphere"},{strokeWidth:e,...t})}function uP({strokeOpacity:e=.1,...t}={}){return G_(YS(),{strokeOpacity:e,...t})}var ed=.5,nd=0;function fP(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Nt(t),e=oE(e,n),Fo(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Fo(e,"r")&&(n.r=t/2),Se(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:y}=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}=ec(s,a,l)),d=d?d.value:mt(i,r),h=h?.value,p=p?.value,y=y?.value;let b=vm(e,{z:d,fill:h,stroke:p,symbol:y}),m=d&&[],g=h&&[],x=p&&[],_=y&&[],v=[],w=[],T=[],A=-1;for(let O of e)O.initialize(i);for(let O of o){let k=[];for(let S of e)S.scope("facet",O);for(let[S,M]of Qa(O,b))for(let{index:N,extent:F}of eJ(i,M,u,f,t)){k.push(++A),w.push(F.x),T.push(F.y),d&&m.push(b===d?S:d[N[0]]),h&&g.push(b===h?S:h[N[0]]),p&&x.push(b===p?S:p[N[0]]),y&&_.push(b===y?S:y[N[0]]);for(let B of e)B.reduce(N,F)}v.push(k)}let R=s.x.scale,I=s.y.scale,E={x:{value:w,source:a[R]?{value:Yt(w,a[R].invert),scale:R}:null},y:{value:T,source:a[I]?{value:Yt(T,a[I].invert),scale:I}:null},...d&&{z:{value:m}},...h&&{fill:{value:g,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...y&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:k})=>[O,{scale:"auto",label:k.label,radius:O==="r"?t/2:void 0,value:k.transform()}]))};return{data:i,facets:v,channels:E}})}function eJ(e,t,n,r,i){let o=i*(1.5/HT),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-nd)/o),f=Math.round(c=(c-ed)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let y=c-f,b=f+(c<f?-1:1)/2,m=u+(l<u?-1:1),g=c-b,x=l-m;y*y+d*d>g*g+x*x&&(f=b+(u&1?1:-1)/2,u=m)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+ed,y:u*o+nd}},s.set(h,p)),p.index.push(a)}return s.values()}var nJ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function dP(e){return new iy(e)}var iy=class extends wt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Ga,void 0,{clip:n,...r},nJ),this.binWidth=Nt(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-ed,p=f-c-ed,y=a-nd,b=d-l-nd,m=s/2,g=m*ZT,x=g/2,_=m*2,v=g*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),A=Math.floor((y+x)/v),R=Math.ceil((b-x)/v)+1,I=`m0,${dc(-g)}l${dc(m)},${dc(x)}v${dc(g)}l${dc(-m)},${dc(x)}`,E=I;for(let O=A;O<R;++O)for(let k=w;k<T;++k)E+=`M${dc(k*_+(O&1)*m)},${dc(O*v)}${I}`;return ct("svg:g",o).datum(0).call(Ft,this,i,o).call(It,this,{},De+ed,De+nd).call(O=>O.append("path").call(Rt,this).call(Zt,this,r).attr("d",E)).node()}};function dc(e){return Math.round(e*1e3)/1e3}var rJ={ariaLabel:"image",fill:null,stroke:null};function iJ(e){return/^\.*\//.test(e)}function oJ(e){return/^(blob|data|file|http|https):/i.test(e)}function sJ(e){return typeof e=="string"&&(iJ(e)||oJ(e))?[void 0,e]:[e,void 0]}var oy=class extends wt{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,y]=sJ(l),[b,m]=ie(o),[g,x]=ie(s,m!==void 0?m*2:void 0),[_,v]=ie(a,m!==void 0?m*2:void 0),[w,T]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:b,scale:"r",filter:ir,optional:!0},width:{value:g,filter:ir,optional:!0},height:{value:_,filter:ir,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},Ym(n),rJ),this.src=y,this.width=x,this.rotate=T,this.height=v,this.r=m,this.preserveAspectRatio=le(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=ko(d),this.imageRendering=le(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:y,width:b,height:m,rotate:g}=this,[x,_]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Rt,this).attr("x",hP(c,u,d,x,b,y)).attr("y",hP(l,f,d,_,m,y)).attr("width",u?w=>u[w]:b!==void 0?b:d?w=>d[w]*2:y*2).attr("height",f?w=>f[w]:m!==void 0?m:d?w=>d[w]*2:y*2).attr("transform",h?w=>`rotate(${h[w]})`:g?`rotate(${g})`:null).attr("transform-origin",h||g?rc`${c?w=>c[w]:x}px ${l?w=>l[w]:_}px`:null).call(ft,"href",p?w=>p[w]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?w=>`circle(${d[w]}px)`:y!==void 0?`circle(${y}px)`:null).call(Zt,this,r)).node()}};function hP(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 pP(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new oy(e,{...r,x:t,y:n})}function aJ(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,b,m;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,y=2/(1/(2*t-1)+1/(2*n-1)),b=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*b))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,b=u+f,e<u/b?h=Math.pow(t*b*e,1/t):h=1-Math.pow(n*b*(1-e),1/n)),m=-rd(t)-rd(n)+rd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=cJ(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),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 cJ(e,t,n){var r=e===0||e===1?0:Math.exp(rd(t+n)-rd(t)-rd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*mP(e,t,n)/t:1-r*mP(1-e,n,t)/n}function mP(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 rd(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 yP(e,t){var n=aJ(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var lJ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},W_=class extends wt{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:zn(n),optional:!0}},n,lJ),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(Ft,this,i,o).call(It,this,n).call(u=>u.selectAll().data(c?Tm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Rt,this).call(Tl,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Xs(this.fill)?d=>d.select(uJ).attr("stroke","none").call(Rt,this).call(Tl,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function uJ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ii.svg,"path"),this)}var mM=class extends W_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>r[u]),c=X_(t,r,n),l=xP(t,r,n,(1-i)/2,c);return of().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>r[a]),s=X_(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},yM=class extends W_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>n[u]),c=X_(t,n,r),l=xP(t,n,r,(1-i)/2,c);return of().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>n[a]),s=X_(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function gP(e,{y:t=Me,x:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new mM(e,$f({...o,x:n,y:t,fill:i,stroke:r}))}function bP(e,{x:t=Me,y:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new yM(e,Uf({...o,x:t,y:n,fill:i,stroke:r}))}function X_(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 xP(e,t,n,r,i){let o=En(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=yP(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 sy({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=al,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=K_(s),i=vP(i),a!=null&&(a=bM(a)),n===void 0&&(n=s.frameAnchor);let l=SP(t),u=RP(c,bM),[f,d]=pn(),[h,p]=pn();return{x:f,y:h,frameAnchor:n,...mn(c,(y,b)=>{let m=l(mt(y,e)),g=d([]),x=p([]),_=-1,v=[],w=[],T=Gb().path(R=>m[R]),A=r();A.nodeSize&&A.nodeSize([1,1]),A.separation&&o!==void 0&&A.separation(o??ym);for(let R of u)R[Z_]=R[AP]([]);for(let R of b){let I=[],E=T(R.filter(O=>m[O]!=null)).each(O=>O.data=y[O.data]);i!=null&&E.sort(i),A(E);for(let O of E.descendants())if(!(a!=null&&!a(O))){I.push(++_),v[_]=O.data,s.position(O,_,g,x);for(let k of u)k[Z_][_]=k[NP](O)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function Q_({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=al,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=K_(l),a=vP(a),u!=null&&(u=wP(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=SP(t),h=RP(f,wP),[p,y]=pn(),[b,m]=pn(),[g,x]=pn(),[_,v]=pn();return{x1:p,x2:b,y1:g,y2:_,...mn(f,(w,T)=>{let A=d(mt(w,e)),R=y([]),I=m([]),E=x([]),O=v([]),k=-1,S=[],M=[],N=Gb().path(B=>A[B]),F=s();F.nodeSize&&F.nodeSize([1,1]),F.separation&&c!==void 0&&F.separation(c??ym);for(let B of h)B[Z_]=B[AP]([]);for(let B of T){let C=[],P=N(B.filter(U=>A[U]!=null)).each(U=>U.data=w[U.data]);a!=null&&P.sort(a),F(P);for(let{source:U,target:$}of P.links())if(!(u!=null&&!u($,U))){C.push(++k),S[k]=$.data,l.position(U,k,R,E),l.position($,k,I,O);for(let X of h)X[Z_][k]=X[NP]($,U)}M.push(C)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function K_(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return fJ;case"right":return dJ}throw new Error(`invalid tree anchor: ${e}`)}var fJ={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},dJ={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function vP(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?_P(bM(e)):_P(hJ(e))}function _P(e){return(t,n)=>fn(e(t),e(n))}function hJ(e){return t=>t.data?.[e]}function SP(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=>pJ(r,t))}var gM=92,IP=47;function pJ(e,t){if(t===gM)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 gM: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 IP: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 mJ(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case gM:if(!t){t=!0;continue}case IP:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function TP(e){return hn(e)&&typeof e.node=="function"}function yJ(e){return hn(e)&&typeof e.link=="function"}function bM(e){if(TP(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return _M;case"node:path":return xM;case"node:internal":return EP;case"node:external":return MP;case"node:depth":return wM;case"node:height":return vM}throw new Error(`invalid node value: ${e}`)}}function wP(e){if(TP(e))return e.node;if(yJ(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return H_(_M);case"parent:path":return H_(xM);case"parent:depth":return H_(wM);case"parent:height":return H_(vM);case"node:name":return _M;case"node:path":return xM;case"node:internal":return EP;case"node:external":return MP;case"node:depth":return wM;case"node:height":return vM}throw new Error(`invalid link value: ${e}`)}}function xM(e){return e.id}function _M(e){return gJ(e.id)}function wM(e){return e.depth}function vM(e){return e.height}function EP(e){return!!e.children}function MP(e){return!e.children}function H_(e){return(t,n)=>n==null?void 0:e(n)}function gJ(e){let t=e.length;for(;--t>0&&!bJ(e,t););return mJ(e.slice(t+1))}function bJ(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var AP=2,NP=3,Z_=4;function RP(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...pn(i),o])}return n}function SM(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=ne(f)&&ne(d),text:p="node:name",textStroke:y="var(--plot-background)",title:b="node:path",dx:m,dy:g,textAnchor:x,treeLayout:_=al,textLayout:v=_===al||_===Vb?"mirrored":"normal",tip:w,...T}={}){if(m===void 0&&(m=K_(T.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ke(v,"textLayout",["mirrored","normal"]);function A(R){return Bo(e,sy({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:y,dx:m,dy:g,title:b,...R,...T}))}return Je(C_(e,Q_({treeLayout:_,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?yi(e,sy({treeLayout:_,fill:t===void 0?"node:internal":t,title:b,tip:w,...T})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-m})]:A():null)}function OP(e,t){return SM(e,{...t,treeLayout:Vb})}function DP({geometry:e=W,...t}={}){return Se({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=mt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=An(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function kP({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=mt(mt(r,e),US),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var VP=iU(jP(),1);var EJ=({marginLeft:e})=>[1,e],MJ=({width:e,marginRight:t})=>[-1,e-t],AJ=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],NJ=({marginTop:e})=>[1,e],RJ=({height:e,marginBottom:t})=>[-1,e-t],OJ=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function YP(e){return typeof e=="string"?{anchor:e}:e}function GP(e={},t={}){arguments.length===1&&([e,t]=XP(e));let{anchor:n="left",padding:r=1,r:i=t.r}=YP(e);switch(`${n}`.toLowerCase()){case"left":n=EJ;break;case"right":n=MJ;break;case"middle":n=AJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return HP("x","y",n,Nt(r),i,t)}function WP(e={},t={}){arguments.length===1&&([e,t]=XP(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=YP(e);switch(`${n}`.toLowerCase()){case"top":n=NJ;break;case"bottom":n=RJ;break;case"middle":n=OJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return HP("y","x",n,Nt(r),i,t)}function XP(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function HP(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=bm(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 Se(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}=ec(c,l,f));let p=h?void 0:i!==void 0?Nt(i):this.r!==void 0?this.r:3;h&&(h=mt(h.value,l[h.scale]||W,Float64Array));let[y,b]=n(u),m=y?kJ:DJ,g=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,VP.default)();_=_.filter(h?T=>uf(d[T])&&ir(h[T]):T=>uf(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let A=x(T),R=y?A+r:0,I=d[T]-A,E=d[T]+A,O=2;v.queryInterval(I-r,E+r,([,,S])=>{let M=g[S]-R,N=d[T]-d[S],F=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(F*F-N*N);w[O++]=M-B,w[O++]=M+B});let k=w.slice(0,O);y&&(k=k.filter(S=>S>=0));t:for(let S of k.sort(m)){for(let M=0;M<O;M+=2)if(w[M]+1e-6<S&&S<w[M+1]-1e-6)continue t;g[T]=S+R;break}v.insert([I,E,T])}}y||(y=1);for(let _ of a)for(let v of _)g[v]=g[v]*y+b;return{data:s,facets:a,channels:{[e]:{value:g,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function DJ(e,t){return Math.abs(e)-Math.abs(t)}function kJ(e,t){return e-t}function QP(e,t){return arguments.length===1&&({basis:e,...t}=e),Qf(ew(e),t)}function KP(e,t){return arguments.length===1&&({basis:e,...t}=e),Kf(ew(e),t)}function ew(e){if(e===void 0)return ZP;if(typeof e=="function")return nw(gf(e));if(/^p\d{2}$/i.test(e))return ad(mf(e));switch(`${e}`.toLowerCase()){case"deviation":return CJ;case"first":return ZP;case"last":return LJ;case"max":return BJ;case"mean":return PJ;case"median":return UJ;case"min":return $J;case"sum":return zJ;case"extent":return FJ}throw new Error(`invalid basis: ${e}`)}function nw(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 ad(e){return nw((t,n)=>e(t,r=>n[r]))}var FJ={mapIndex(e,t,n){let[r,i]=ae(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},ZP=nw((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if($e(r))return r}}),LJ=nw((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if($e(r))return r}}),CJ={mapIndex(e,t,n){let r=Ss(e,o=>t[o]),i=ri(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},BJ=ad($t),PJ=ad(Ss),UJ=ad(Bi),$J=ad(ce),zJ=ad(En);function JP(e,t){return qJ("x",e,t)}function qJ(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]=k1(t.replace(/^[+-]/,"")),i*=l}t=xf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=br({[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]=ae(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function t9(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return NM(t);case"last":return RM(t)}if(typeof e=="function")return hc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=jJ(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return hc(n,r,t)}function jJ(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return OM;case"max":return DM}throw new Error(`unknown selector: ${e}`)}function NM(e){return hc(null,VJ,e)}function RM(e){return hc(null,YJ,e)}function e9(e){return hc("x",OM,e)}function n9(e){return hc("y",OM,e)}function r9(e){return hc("x",DM,e)}function i9(e){return hc("y",DM,e)}function*VJ(e){yield e[0]}function*YJ(e){yield e[e.length-1]}function*OM(e,t){yield A0(e,n=>t[n])}function*DM(e,t){yield Vc(e,n=>t[n])}function hc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=zn(n);return mn(n,(i,o)=>{let s=mt(i,r),a=mt(i,e),c=[];for(let l of o){let u=[];for(let f of s?sn(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 GJ=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["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 WJ(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 o9(e,t,n){for(let r in e){let i=GJ.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&&WJ(t,i.split("."),o)}}var XJ=new Set(["frame","hexgrid","sphere","graticule"]);async function a9(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;o9(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())XJ.has(c)?t.marks.push(rw[c](u)):t.marks.push(rw[c](l,u)),o.push(a.index);ZJ(t,e);let s=Bm(t);QJ(s,o),HJ(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function HJ(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===qc){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 ZJ(e,t){let{marks:n}=t;iw("x",e,n,["x","x1","x2"]),iw("y",e,n,["y","y1","y2"]),iw("fx",e,n),iw("fy",e,n)}function iw(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=KJ(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function QJ(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)s9(r,t);else s9(e,t)}function s9(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 KJ(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var JJ={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},ly=class{constructor(t){this.attributes={...JJ},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=F2()}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(){let{top:t,bottom:n}=this.margins();return this.getAttribute("height")-t-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 a9(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 Nh(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.requestQuery()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function cd(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Fr(e)!==null)}var ttt=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target"]);function c9(e){return ttt.has(e)}var ett=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function l9(e){return ett.has(`${e}`.toLowerCase())}function uy(e){return typeof e?.getChild=="function"}var ntt=2,rtt=10;function ow(e){return uy(e)?itt(e):e}function itt(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=ott(h);for(let y=i,b=0;b<c;++b,++y)r[y][d]=p(f.get(b))}i+=c}return r}function ott(e){let{typeId:t}=e;return t===rtt?n=>n==null?n:new Date(n):t===ntt&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}var u9=e=>e==="stroke"||e==="fill",stt=e=>e==="symbol",att=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),kM=(e,t)=>({channel:e,field:t,as:t instanceof mr?t.column:e}),FM=(e,t)=>({channel:e,value:t}),sw=e=>Array.isArray(e),Dn=class extends cr{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,sw(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Rh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")c9(l)||u9(l)&&cd(u)||stt(l)&&l9(u)?o.push(FM(l,u)):o.push(kM(l,wa(u)));else if(ps(u))if(Array.isArray(u.columns))o.push(kM(l,u)),a.add(u);else{let d=FM(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&att(l,u)?o.push(kM(l,u)):u!==void 0&&o.push(FM(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||sw(this.source)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return LM(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=ow(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=gi(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function gi(e){return Object.hasOwn(e,"value")?e.value:u9(e.channel)?{value:e.as,scale:"color"}:e.as}function LM(e,t,n=[]){let r=yt.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 Vr(e,t,n){if(!e.stats)return r;let{field:r}=e.channelField(t),{type:i}=e.stats[r.column];return n=n??r,i==="date"?Th(n):n}function fy(e,t,n,r,i=!1,o=1){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?j`(${+n} - ${e}::DOUBLE)${a}`:j`(${e}::DOUBLE - ${+t})${a}`}var CM={x:["min","max"]},BM={y:["min","max"]},aw={...CM,...BM};function f9(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[ni])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=PM(t,u)||(c?ks().domain([f,d]).nice().domain():[f,d]);return a!==qc&&(h[ni]=!0),o.setAttribute(r,h,{silent:!0}),h}}function qo(e,t){return f9(e,t,"x","xDomain","xNice")}function jo(e,t){return f9(e,t,"y","yDomain","yNice")}function PM(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var dy=class extends Dn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["count","min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(s&&r){let{field:c,as:l}=this.channelField(r),{column:u}=c,{count:f,max:d,min:h}=o[u],p=r==="x"?n.innerWidth():n.innerHeight(),[y,b]=PM(t,u)||[h,d],m=(b-y)/(d-h);if(f*m>p*4){let g=Vr(this,r,l),x=this.channelField(r==="x"?"y":"x").as,_=a.select().map(v=>v.as).filter(v=>v!==l&&v!==x);return ctt(a,g,l,x,y,b,p,_)}a.orderby(l)}return a}};function ctt(e,t,n,r,i,o,s,a=[]){let c=j`FLOOR(${s/(o-i)}::DOUBLE * (${t} - ${+i}::DOUBLE))::INTEGER`,l=u=>yt.from(e).select(u).groupby(c,a);return yt.union(l([{[n]:Jr(n),[r]:pu(r,n)},...a]),l([{[n]:Kr(n),[r]:mu(r,n)},...a]),l([{[n]:pu(n,r),[r]:Jr(r)},...a]),l([{[n]:mu(n,r),[r]:Kr(r)},...a])).orderby(a,n)}function bn(e,t,n,r){yr(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function hy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);ltt(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 ltt(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 d9(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);cw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);cw(t,u,i,r,o,s,a,u)}return c}function cw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=utt){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 utt(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let y=t[f];if(y>0)for(p=0;p<a;++p)e[p]+=l[p]*y}function h9(e,t){return m9(new Float64Array(e),t)}function p9(e,t,n,r=[]){return r.length?Object.values(ftt(e*t,n,r)):[{grid:m9(new Float64Array(e*t),n)}]}function m9(e,t){if(uy(t)){let n=t.numRows;if(n===0)return e;let r=t.getChild("index").toArray(),i=t.getChild("value").toArray();for(let o=0;o<n;++o)e[r[o]]=i[o]}else for(let n of t)e[n.index]=n.value;return e}function ftt(e,t,n){let r={},i=o=>(r[o]||(r[o]={key:o,grid:new Float64Array(e)})).grid;if(uy(t)){let o=t.numRows;if(o===0)return r;let s=t.getChild("index").toArray(),a=t.getChild("value").toArray(),c=n.map(l=>t.getChild(l));for(let l=0;l<o;++l){let u=c.map(f=>f.get(l));i(u)[s[l]]=a[l]}}else for(let o of t){let s=n.map(a=>o[a]);i(s)[o.index]=o.value}return r}var Yi=class extends Dn{constructor(t,n,r){let{bandwidth:i=20,binType:o="linear",binWidth:s=2,binPad:a=1,...c}=r,l=dtt(c);super(t,n,c,aw),this.densityMap=l,bn(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),bn(this,"binWidth",s),bn(this,"binType",o),bn(this,"binPad",a)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[ni]&&!n[ni]}query(t=[]){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[c,l]=this.extentX=qo(this,t),[u,f]=this.extentY=jo(this,t),[d,h]=this.bins=this.binDimensions(this),p=Vr(this,"x"),y=Vr(this,"y"),b=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),g=y9(p,c,l,d,b,this.binPad),x=y9(y,u,f,h,m,this.binPad),_=i?[Te(p,[c,l]),Te(y,[u,f])]:[bs(c,p),gs(p,l),bs(u,y),gs(y,f)],v=yt.from(a.table).where(t.concat(_)),w=this.groupby=[],T=Or();for(let A of o)if(Object.hasOwn(A,"field")){let{as:R,channel:I,field:E}=A;E.aggregate?(T=E,s[I]=!0):I==="weight"?T=Dr(E):I!=="x"&&I!=="y"&&(v.select({[R]:E}),w.push(R))}return r==="linear"?ptt(v,g,x,T,d,w):htt(v,g,x,T,d,w)}binDimensions(){let{plot:t,binWidth:n}=this;return[Math.round(t.innerWidth()/n),Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=p9(n,r,t,this.groupby),this.convolve()}convolve(){let{bandwidth:t,bins:n,grids:r,plot:i}=this;if(t<=0)this.kde=this.grids.map(({key:o,grid:s})=>(s.key=o,s));else{let o=i.innerWidth(),s=i.innerHeight(),[a,c]=n,l=r.some(({grid:d})=>d.some(h=>h<0)),u=hy(t*(a-1)/o,l),f=hy(t*(c-1)/s,l);this.kde=this.grids.map(({key:d,grid:h})=>{let p=d9(u,f,h,n);return p.key=d,p})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function dtt(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function y9(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?j`(${n} - ${e}::DOUBLE)${a}`:j`(${e}::DOUBLE - ${t})${a}`}function htt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function ptt(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(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",value:Dr("w")},o).groupby("index",o).having(Pc("value",0))}var py=class extends Yi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,i),bn(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,groupby:o,plot:s}=this,a=i;if(!Array.isArray(a)){let v=$t(r.map(w=>$t(w)));a=Array.from({length:a-1},(w,T)=>v*(T+1)/a)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[c,l]=t,[u,f]=s.getAttribute("xDomain"),[d,h]=s.getAttribute("yDomain"),p=(f-u)/c,y=(h-d)/l,b=+u,m=+d,g=v=>b+v*p,x=v=>m+v*y,_=Fa().size(t);return this.data=r.flatMap(v=>a.map(w=>{let T=mtt(_.contour(v,w),g,x);return o.forEach((A,R)=>T[A]=v.key[R]),T.density=w,T})),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=gi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function mtt(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 lw(e,t,n,r,i,o){let s=(o.length>>2)-1;for(let a=0,c=0;a<r;++a)for(let l=0,u=(r-a-1)*n;l<n;++l,c+=4){let f=s*i(e[l+u])<<2;t[c+0]=o[f+0],t[c+1]=o[f+1],t[c+2]=o[f+2],t[c+3]=o[f+3]}}function ld(e,t){let n=new Uint8ClampedArray(4*e),r=e-1;for(let i=0;i<=r;++i){let o=t(i/r),{r:s,g:a,b:c,opacity:l=1}=typeof o=="string"?an(o):o,u=i<<2;n[u+0]=s,n[u+1]=a,n[u+2]=c,n[u+3]=255*l|0}return n}function uw(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 fw(e="black"){let{r:t,g:n,b:r}=an(e);return i=>({r:t,g:n,b:r,opacity:i})}var $l=class extends Yi{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=ytt(this,i,o),l=gtt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=btt(this,f,d.key?.[u]);return lw(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}};function ytt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=uw(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 gtt(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return Co({x:{type:o,domain:i,range:[0,1]}}).apply}function btt(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=cd(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return ld(r,Co({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=Co({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return ld(r,fw(c))}var my=class extends $l{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,{bandwidth:0,...i}),bn(this,"normalize",r)}query(t=[]){let{plot:n,channels:r,normalize:i,source:o}=this,[s,a]=qo(this,t),[c,l]=jo(this,t),[u,f]=this.bins=this.binDimensions(this),d=Vr(this,"x"),h=Vr(this,"y"),p=!!n.getAttribute("xReverse"),y=!!n.getAttribute("yReverse"),b=fy(d,s,a,u,p,this.binPad),m=fy(h,c,l,f,y,this.binPad),g=yt.from(o.table).where(xtt(this,t)),x=this.groupby=[],_=[];for(let v of r)if(Object.hasOwn(v,"field")){let{channel:w,field:T}=v;w==="z"?(g.select({[w]:T}),_.push("z")):w!=="x"&&w!=="y"&&(g.select({[w]:T}),x.push(w))}return _tt(g,b,m,_,u,f,x,i)}};function xtt(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?Wn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function _tt(e,t,n,r,i,o,s=[],a=!0){e.select({x:j`FLOOR(${t})::INTEGER`,y:j`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=yt.from(e).select(c,{x0:"x",y0:"y",dx:j`(lead(x) OVER sw - x)`,dy:j`(lead(y) OVER sw - y)`}).window({sw:j`${l}ORDER BY x ASC`}).qualify(Wn(j`(x0 < ${i} OR x0 + dx < ${i})`,j`(y0 < ${o} OR y0 + dy < ${o})`,j`(x0 > 0 OR x0 + dx > 0)`,j`(y0 > 0 OR y0 + dy > 0)`)),f=yt.select({x:j`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=yt.select({i:j`UNNEST(range((${f})))::INTEGER`}),h=yt.unionAll(yt.select(c,{x:j`x0 + i`,y:j`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(j`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),yt.select(c,{x:j`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:j`y0 + SIGN(dy) * i`}).from("pairs","indices").where(j`ABS(dy) > ABS(dx) AND i < ABS(dy)`),yt.select(c,{x:"x0",y:"y0"}).from("pairs").where(Bc("dx"))),p=["x"].concat(c).join(", "),y=yt.from("raster").select(c,"x","y",a?{w:j`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Wn(Te("x",[0,i]),Te("y",[0,o])));return yt.with({pairs:u,indices:d,raster:h,points:y}).from("points").select(s,{index:j`x + y * ${i}::INTEGER`,value:a?Dr("w"):Or()}).groupby("index",s)}var ud=class extends Dn{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"?CM:BM),this.dim=a,bn(this,"bins",i),bn(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[ni]}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,a]=this.extent=(i==="x"?qo:jo)(this,t),c=Vr(this,i);return wtt(LM(r,o,[i]).where(t.concat(Te(c,[s,a]))),fy(c,s,a,n),this.channelField("weight")?"weight":null)}queryResult(t){return this.grid=h9(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(g=>g<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=hy(n*(t-1)/l,c),f=cw(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,y=+s,b=(a-y)/(t-1),m=1/b;for(let g=0;g<t;++g)d.push({[p]:y+g*b,[h]:f[g]*m});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function wtt(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER`,w:j`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER + 1`,w:j`(p - FLOOR(p))${r}`});return yt.from(yt.unionAll(i,o)).select({index:"i",value:Dr("w")}).groupby("index").having(Pc("value",0))}var yy=class extends Yi{constructor(t,n){let{type:r="dot",binsX:i,binsY:o,...s}=n;s.binPad=s.binPad??0,super(r,t,s),bn(this,"binsX",i),bn(this,"binsY",o)}convolve(){super.convolve();let{bins:t,binPad:n,extentX:r,extentY:i}=this,[o,s]=t,[a,c]=r,[l,u]=i,f=(c-a)/(o-n),d=(u-l)/(s-n),h=n?0:.5;return this.data=vtt(this.kde,t,a,l,f,d,h),this}binDimensions(){let{plot:t,binWidth:n,binsX:r,binsY:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function vtt(e,t,n,r,i,o,s){let a=1/(i*o),[c,l]=t,u=[];for(let f of e)for(let d=0,h=0;h<l;++h)for(let p=0;p<c;++p,++d)u.push({x:n+(p+s)*i,y:r+(h+s)*o,density:f[d]*a});return u}var Stt="geom",gy=class extends Dn{constructor(t,n={},r){!sw(t)&&!n?.geometry&&(n.geometry=Eh(Stt)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var by=class extends Dn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},aw),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[ni]&&!n[ni]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=qo(this,t),[c,l]=jo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,y=`${n.innerHeight()/(l-c)}::DOUBLE`,b,m,g=new Set,x={};for(let A of i)A.channel==="orderby"?_.orderby(A.value):A.channel==="x"?b=A:A.channel==="y"?m=A:Object.hasOwn(A,"field")&&(x[A.as]=A.field,A.field.aggregate&&A.field.columns.forEach(R=>g.add(R)));let _=yt.select({[b.as]:j`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[m.as]:j`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${y}`,...x}).groupby("x","y"),v=`${p} * (${b.field} - ${s}::DOUBLE)`,w=`${y} * (${l}::DOUBLE - ${m.field})`,T=yt.select({py:j`(${w} - ${f}) / ${h}`,pj:j`ROUND(py)::INTEGER`,px:j`(${v} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:j`ROUND(px)::INTEGER`,tt:j`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:j`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:j`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(g)).from(o.table).where(ms(b.field),ms(m.field),t);return _.from(T)}};var xy=class extends Yi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[[c,l],[u,f]]=t,[d,h]=this.bins,p=Vr(this,"x"),y=Vr(this,"y"),b=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),g=g9(p,c,l,d,b,i),x=g9(y,u,f,h,m,i),_=i?[Te(p,[c,l]),Te(y,[u,f])]:[bs(c,p),gs(p,l),bs(u,y),gs(y,f)],v=yt.from(a.table).where(_),w=this.groupby=[],T=Or();for(let A of o)if(Object.hasOwn(A,"field")){let{channel:R,field:I}=A;I.aggregate?(T=I,s[R]=!0):R==="weight"?T=Dr(I):R!=="x"&&R!=="y"&&(v.select({[R]:I}),w.push(R))}return r==="linear"?Rtt(v,g,x,T,d,w):Ntt(v,g,x,T,d,w)}async requestTiles(){let t=ti();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=qo(this,this._filter),[f,d]=jo(this,this._filter),h=u-l,p=d-f,y=Math.floor((l-o)*(a-n)/h),b=Math.floor((f-s)*(c-n)/p),m=(I,E)=>[[o+I*h,o+(I+1)*h],[s+E*p,s+(E+1)*p]],g=Math.floor((l-o)/h),x=r?b9((u-o)/h):g,_=Math.floor((f-s)/p),v=i?b9((d-s)/p):_,w=[];for(let I=g;I<=x;++I)for(let E=_;E<=v;++E)w.push([I,E]);let T=w.map(([I,E])=>t.query(this.tileQuery(m(I,E)))),A=[];if(r)for(let I=_;I<=v;++I)A.push([x+1,I]),A.push([g-1,I]);if(i){let I=r?g-1:g,E=r?x+1:x;for(let O=I;O<=E;++O)A.push([O,v+1]),A.push([O,_-1])}this.prefetch=A.map(([I,E])=>t.prefetch(this.tileQuery(m(I,E))));let R=await Promise.all(T);this.grids=[{grid:Itt(a,c,y,b,w,R)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=Ett(this,i,o),l=Mtt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=Att(this,f,d.key?.[u]);return lw(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function Itt(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;Ttt(e,t,s,a,f,d)}),s}function Ttt(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("value").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 Ett(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=uw(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 Mtt(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return Co({x:{type:o,domain:i,range:[0,1]}}).apply}function Att(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=cd(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return ld(r,Co({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=Co({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return ld(r,fw(c))}function g9(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?j`(${n} - ${e}::DOUBLE)${a}`:j`(${e}::DOUBLE - ${t})${a}`}function Ntt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function Rtt(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(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",value:Dr("w")},o).groupby("index",o).having(wh("value",0))}function b9(e){let t=Math.floor(e);return t===e?t-1:t}function Ott(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,b,m;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,y=2/(1/(2*t-1)+1/(2*n-1)),b=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*b))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,b=u+f,e<u/b?h=Math.pow(t*b*e,1/t):h=1-Math.pow(n*b*(1-e),1/n)),m=-fd(t)-fd(n)+fd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Dtt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),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 Dtt(e,t,n){var r=e===0||e===1?0:Math.exp(fd(t+n)-fd(t)-fd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*x9(e,t,n)/t:1-r*x9(1-e,n,t)/n}function x9(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 fd(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 _9(e,t){var n=Ott(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var _y=class extends Dn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;bn(this,"ci",r,s),bn(this,"precision",i,s)}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return yt.from(super.query(t)).select({intercept:n2(r,n),slope:r2(r,n),n:i2(r,n),ssy:o2(r,n),ssx:s2(r,n),xm:a2(r,n),x0:yu(Jr(n).where(ms(r))),x1:yu(Kr(n).where(ms(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=ow(t),this.lineData=this.modelFit.flatMap(n=>ktt(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>Ftt(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function ktt(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function Ftt(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=_9((1-e)/2,l-2)*Math.sqrt(f/(l-2));return Ue(i,o-h/2,h).concat(o).map(y=>{let b=a+y*c,m=p*Math.sqrt(1/l+(y-s)**2/u);return{x:y,y1:b-m,y2:b+m,...d}})}function w9(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 dd(e){let t={};for(let n in e)t[w9(n)]=e[n];return t}function Ltt(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 wy=class{constructor(t,{selection:n,channels:r={}}){this.mark=Ltt(t),this.selection=n;let i=Object.entries(dd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",xd(()=>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 Ctt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function Ctt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Wn(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await e.coordinator.query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}function UM(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 v9(){return UM(bS())}function S9(){return UM(yS())}function I9(){return UM(gS())}function vy(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 Vo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function Sy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function dw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var hd=class{constructor(t,{channel:n,selection:r,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||Vo(t,[n,n+"1",n+"2"]),this.style=a&&dd(a),this.brush=n==="y"?I9():S9(),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=>Sy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),vy(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Te(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ce(o),ce(s)],[$t(o),$t(s)]]);let a=zt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:zt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(dw).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var hw=(e,t)=>e-t,Iy=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||Vo(t,["x","x1","x2"]),this.yfield=i||Vo(t,["y","y1","y2"]),this.style=a&&dd(a),this.brush=v9(),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=>Sy(u,i,r)).sort(hw),a=[c[1],l[1]].map(u=>Sy(u,o,r)).sort(hw)}(!vy(s,n?.[0])||!vy(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Wn(Te(i,t[0]),Te(o,t[1])):null}}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ce(s),ce(a)],[$t(s),$t(a)]]);let c=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t);if(this.g=l.append("g").attr("class","interval-xy").each(dw).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(hw),[d,h]=this.value[1].map(o.apply).sort(hw);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var pd=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Vo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?ys(r,Rr(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t),u=t.scale(i),f=!ei(o);l.on("pointerdown pointermove",function(d){let[h,p]=Fn(d,this),y=Btt(s,a,u.invert(i==="x"?h:p));o.update(f?y:n.clause(y))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function Btt(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var T9=(e,t)=>e-t,Ty=class{constructor(t,{x:n=new xs,y:r=new xs,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||Vo(t,["x","x1","x2"]),this.yfield=o||Vo(t,["y","y1","y2"]),this.zoom=$M(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=Ptt(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=Utt(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Te(n,t):null}}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(T9),c=this.yscale.range.slice().sort(T9),l=$M(n,[-1/0,1/0],a),u=$M(r,[-1/0,1/0],c),f=FT().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 Ur(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(zt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function $M(e,t,n){return e?Array.isArray(e)?e:t:n}function Ptt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function Utt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var zl=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>vh(n[l].field,Rr(c)));return a.length>1?Wn(a):a[0]});i=o.length>1?Cc(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if($tt(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>zM(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!zM(u[0],h)?d=null:d=[h]}this.value=d,ztt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function $tt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function ztt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>zM(n,t[r]))}function zM(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 md=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=qtt(t,n);this.selection&&i&&(this.handler=new zl(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function qtt({marks:e},t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)if(e[r].channelField(n))return e[r];return null}var jtt=["rectY-x","rectX-y","rect-x","rect-y"];function Vtt(e,t){return jtt.includes(`${t}-${e}`)}function pw(e,t={steps:25}){let n=(r,i)=>Vtt(i,r.type)?{[`${i}1`]:qM(r,e,t),[`${i}2`]:qM(r,e,{...t,offset:1})}:{[i]:qM(r,e,t)};return n[Rh]=!0,n}function qM(e,t,n){return{column:t,label:t,get stats(){return["min","max"]},get columns(){return[t]},get basis(){return t},toString(){let{min:r,max:i}=e.stats[t],o=Ytt(r,i,n),s=Vt(t),a=o.min===0?s:`(${s} - ${o.min})`,c=`${(o.max-o.min)/o.steps}::DOUBLE`,l=n.offset?`${n.offset} + `:"";return`${o.min} + ${c} * (${l}FLOOR(${a} / ${c})::INTEGER)`}}}function Ytt(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let y=0,b=f.length;y<b;++y)d=u/f[y],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var Gtt=e=>e&&typeof e=="object"&&!Array.isArray(e);var Ey=class extends cr{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>Gtt(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ei(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ei(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?ys(r,Rr(t)):null}):yr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var Wtt={contains:Tv,prefix:Ev,suffix:Mv,regexp:Iv},Xtt=0;var My=class extends cr{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++Xtt,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ei(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ei(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?Wtt[i](r,Rr(t)):null}):yr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.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 Htt=0;var Ay=class extends cr{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++Htt,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ei(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:yt.select({min:Jr(r),max:Kr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ei(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:ys(r,Rr(t))}):yr(this.selection)&&n.update(t)}};var VM=GM(e=>{let t=mw(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?YM(n):`${n}`}),mw=GM(e=>t=>t===0?"0":t.toLocaleString(e)),Tzt=VM(),Ezt=mw();function YM(e){return ff(e,"Invalid Date")}function GM(e){let t=GM,n;return(r="en")=>r===t?n:n=e(t=r)}var Ztt=-1;var Ny=class extends cr{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++Ztt}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:y,scrollTop:b,clientHeight:m}=d.target,g=b<f;f=b,!(g||h||p)&&y-b<2*m&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ti().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>wa(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=Qtt(this.format,t),this.style.innerText=tet(this.id,Ktt(this.align,t),Jtt(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return yt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?xv(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Qtt(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return mw(n);case"date":return YM;default:return VM(n)}})}function Ktt(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Jtt(e={},t){return t.map(({column:n})=>e[n])}function tet(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 Ry(e,...t){let n=e?.context?.coordinator??ti();for(let r of t)n.connect(r)}function yw(e,t,n){let r=new t(n);return Ry(e,r),r.element}function E9(e){return yw(this,Ey,e)}function M9(e){return yw(this,My,e)}function A9(e){return yw(this,Ay,e)}function N9(e){return yw(this,Ny,e)}function R9({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),r.value={element:r},r}function O9(...e){return R9({direction:"vertical"},e.flat())}function D9(...e){return R9({direction:"horizontal"},e.flat())}function k9({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function F9(e){return k9({dim:"height",size:e})}function L9(e){return k9({dim:"width",size:e})}var P9={};_r(P9,{align:()=>aA,aspectRatio:()=>cA,axis:()=>lA,colorClamp:()=>O6,colorDomain:()=>N6,colorInterpolate:()=>L6,colorLabel:()=>P6,colorN:()=>D6,colorNice:()=>k6,colorPivot:()=>C6,colorRange:()=>R6,colorReverse:()=>U6,colorScale:()=>A6,colorScheme:()=>F6,colorSymmetric:()=>B6,colorTickFormat:()=>z6,colorZero:()=>$6,facetGrid:()=>E3,facetLabel:()=>M3,facetMargin:()=>w3,facetMarginBottom:()=>S3,facetMarginLeft:()=>I3,facetMarginRight:()=>T3,facetMarginTop:()=>v3,fxAlign:()=>L3,fxAriaDescription:()=>J3,fxAriaLabel:()=>K3,fxAxis:()=>U3,fxDomain:()=>A3,fxFontVariant:()=>Q3,fxGrid:()=>G3,fxInset:()=>O3,fxInsetLeft:()=>D3,fxInsetRight:()=>k3,fxLabel:()=>X3,fxLabelAnchor:()=>H3,fxLabelOffset:()=>Z3,fxLine:()=>W3,fxNice:()=>R3,fxPadding:()=>C3,fxPaddingInner:()=>B3,fxPaddingOuter:()=>P3,fxRange:()=>N3,fxReverse:()=>t6,fxRound:()=>F3,fxTickFormat:()=>V3,fxTickPadding:()=>j3,fxTickRotate:()=>Y3,fxTickSize:()=>z3,fxTickSpacing:()=>q3,fxTicks:()=>$3,fyAlign:()=>c6,fyAriaDescription:()=>E6,fyAriaLabel:()=>T6,fyAxis:()=>d6,fyDomain:()=>e6,fyFontVariant:()=>I6,fyGrid:()=>x6,fyInset:()=>i6,fyInsetBottom:()=>s6,fyInsetTop:()=>o6,fyLabel:()=>w6,fyLabelAnchor:()=>v6,fyLabelOffset:()=>S6,fyLine:()=>_6,fyNice:()=>r6,fyPadding:()=>l6,fyPaddingInner:()=>u6,fyPaddingOuter:()=>f6,fyRange:()=>n6,fyReverse:()=>M6,fyRound:()=>a6,fyTickFormat:()=>g6,fyTickPadding:()=>y6,fyTickRotate:()=>b6,fyTickSize:()=>p6,fyTickSpacing:()=>m6,fyTicks:()=>h6,grid:()=>fA,height:()=>nA,inset:()=>uA,label:()=>dA,lengthClamp:()=>sN,lengthDomain:()=>iN,lengthNice:()=>aN,lengthRange:()=>oN,lengthScale:()=>rN,lengthZero:()=>cN,margin:()=>KM,marginBottom:()=>sA,marginLeft:()=>rA,marginRight:()=>iA,marginTop:()=>oA,margins:()=>QM,name:()=>HM,opacityClamp:()=>Y6,opacityDomain:()=>j6,opacityLabel:()=>W6,opacityNice:()=>G6,opacityRange:()=>V6,opacityReverse:()=>X6,opacityScale:()=>q6,opacityTickFormat:()=>Z6,opacityZero:()=>H6,padding:()=>hA,projectionClip:()=>xN,projectionDomain:()=>hN,projectionInset:()=>pN,projectionInsetBottom:()=>bN,projectionInsetLeft:()=>mN,projectionInsetRight:()=>yN,projectionInsetTop:()=>gN,projectionParallels:()=>uN,projectionPrecision:()=>fN,projectionRotate:()=>dN,projectionType:()=>lN,rClamp:()=>tN,rDomain:()=>K6,rNice:()=>eN,rRange:()=>J6,rScale:()=>Q6,rZero:()=>nN,round:()=>pA,style:()=>tA,width:()=>eA,xAlign:()=>IA,xAriaDescription:()=>qA,xAriaLabel:()=>zA,xAxis:()=>AA,xClamp:()=>vA,xDomain:()=>yA,xFontVariant:()=>$A,xGrid:()=>LA,xInset:()=>xA,xInsetLeft:()=>_A,xInsetRight:()=>wA,xLabel:()=>BA,xLabelAnchor:()=>PA,xLabelOffset:()=>UA,xLine:()=>CA,xNice:()=>bA,xPadding:()=>TA,xPaddingInner:()=>EA,xPaddingOuter:()=>MA,xRange:()=>gA,xReverse:()=>jA,xRound:()=>SA,xScale:()=>mA,xTickFormat:()=>kA,xTickPadding:()=>DA,xTickRotate:()=>FA,xTickSize:()=>RA,xTickSpacing:()=>OA,xTicks:()=>NA,xZero:()=>VA,xyDomain:()=>JM,yAlign:()=>t3,yAriaDescription:()=>b3,yAriaLabel:()=>g3,yAxis:()=>i3,yClamp:()=>KA,yDomain:()=>GA,yFontVariant:()=>y3,yGrid:()=>f3,yInset:()=>HA,yInsetBottom:()=>QA,yInsetTop:()=>ZA,yLabel:()=>h3,yLabelAnchor:()=>p3,yLabelOffset:()=>m3,yLine:()=>d3,yNice:()=>XA,yPadding:()=>e3,yPaddingInner:()=>n3,yPaddingOuter:()=>r3,yRange:()=>WA,yReverse:()=>x3,yRound:()=>JA,yScale:()=>YA,yTickFormat:()=>l3,yTickPadding:()=>c3,yTickRotate:()=>u3,yTickSize:()=>s3,yTickSpacing:()=>a3,yTicks:()=>o3,yZero:()=>_3});var Oy=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)}},WM=new Oy;function XM(e,t,n){(e?.context?.namedPlots??WM).request(t,n)}function C9(e,t,n){(e?.context?.namedPlots??WM).set(t,n)}function HM(e){return t=>C9(this,e,t)}function B9(e,t,n){yr(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 eet(e,t){return n=>{B9(n,e,t)}}function ZM(e){return t=>{for(let[n,r]of Object.entries(e))B9(t,n,r)}}function QM(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),ZM(o)}function KM(e){return ZM({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function JM(e){return ZM({xDomain:e,yDomain:e})}var L=e=>t=>eet(e,t),tA=L("style"),eA=L("width"),nA=L("height"),rA=L("marginLeft"),iA=L("marginRight"),oA=L("marginTop"),sA=L("marginBottom"),aA=L("align"),cA=L("aspectRatio"),lA=L("axis"),uA=L("inset"),fA=L("grid"),dA=L("label"),hA=L("padding"),pA=L("round"),mA=L("xScale"),yA=L("xDomain"),gA=L("xRange"),bA=L("xNice"),xA=L("xInset"),_A=L("xInsetLeft"),wA=L("xInsetRight"),vA=L("xClamp"),SA=L("xRound"),IA=L("xAlign"),TA=L("xPadding"),EA=L("xPaddingInner"),MA=L("xPaddingOuter"),AA=L("xAxis"),NA=L("xTicks"),RA=L("xTickSize"),OA=L("xTickSpacing"),DA=L("xTickPadding"),kA=L("xTickFormat"),FA=L("xTickRotate"),LA=L("xGrid"),CA=L("xLine"),BA=L("xLabel"),PA=L("xLabelAnchor"),UA=L("xLabelOffset"),$A=L("xFontVariant"),zA=L("xAriaLabel"),qA=L("xAriaDescription"),jA=L("xReverse"),VA=L("xZero"),YA=L("yScale"),GA=L("yDomain"),WA=L("yRange"),XA=L("yNice"),HA=L("yInset"),ZA=L("yInsetTop"),QA=L("yInsetBottom"),KA=L("yClamp"),JA=L("yRound"),t3=L("yAlign"),e3=L("yPadding"),n3=L("yPaddingInner"),r3=L("yPaddingOuter"),i3=L("yAxis"),o3=L("yTicks"),s3=L("yTickSize"),a3=L("yTickSpacing"),c3=L("yTickPadding"),l3=L("yTickFormat"),u3=L("yTickRotate"),f3=L("yGrid"),d3=L("yLine"),h3=L("yLabel"),p3=L("yLabelAnchor"),m3=L("yLabelOffset"),y3=L("yFontVariant"),g3=L("yAriaLabel"),b3=L("yAriaDescription"),x3=L("yReverse"),_3=L("yZero"),w3=L("facetMargin"),v3=L("facetMarginTop"),S3=L("facetMarginBottom"),I3=L("facetMarginLeft"),T3=L("facetMarginRight"),E3=L("facetGrid"),M3=L("facetLabel"),A3=L("fxDomain"),N3=L("fxRange"),R3=L("fxNice"),O3=L("fxInset"),D3=L("fxInsetLeft"),k3=L("fxInsetRight"),F3=L("fxRound"),L3=L("fxAlign"),C3=L("fxPadding"),B3=L("fxPaddingInner"),P3=L("fxPaddingOuter"),U3=L("fxAxis"),$3=L("fxTicks"),z3=L("fxTickSize"),q3=L("fxTickSpacing"),j3=L("fxTickPadding"),V3=L("fxTickFormat"),Y3=L("fxTickRotate"),G3=L("fxGrid"),W3=L("fxLine"),X3=L("fxLabel"),H3=L("fxLabelAnchor"),Z3=L("fxLabelOffset"),Q3=L("fxFontVariant"),K3=L("fxAriaLabel"),J3=L("fxAriaDescription"),t6=L("fxReverse"),e6=L("fyDomain"),n6=L("fyRange"),r6=L("fyNice"),i6=L("fyInset"),o6=L("fyInsetTop"),s6=L("fyInsetBottom"),a6=L("fyRound"),c6=L("fyAlign"),l6=L("fyPadding"),u6=L("fyPaddingInner"),f6=L("fyPaddingOuter"),d6=L("fyAxis"),h6=L("fyTicks"),p6=L("fyTickSize"),m6=L("fyTickSpacing"),y6=L("fyTickPadding"),g6=L("fyTickFormat"),b6=L("fyTickRotate"),x6=L("fyGrid"),_6=L("fyLine"),w6=L("fyLabel"),v6=L("fyLabelAnchor"),S6=L("fyLabelOffset"),I6=L("fyFontVariant"),T6=L("fyAriaLabel"),E6=L("fyAriaDescription"),M6=L("fyReverse"),A6=L("colorScale"),N6=L("colorDomain"),R6=L("colorRange"),O6=L("colorClamp"),D6=L("colorN"),k6=L("colorNice"),F6=L("colorScheme"),L6=L("colorInterpolate"),C6=L("colorPivot"),B6=L("colorSymmetric"),P6=L("colorLabel"),U6=L("colorReverse"),$6=L("colorZero"),z6=L("colorTickFormat"),q6=L("opacityScale"),j6=L("opacityDomain"),V6=L("opacityRange"),Y6=L("opacityClamp"),G6=L("opacityNice"),W6=L("opacityLabel"),X6=L("opacityReverse"),H6=L("opacityZero"),Z6=L("opacityTickFormat"),Q6=L("rScale"),K6=L("rDomain"),J6=L("rRange"),tN=L("rClamp"),eN=L("rNice"),nN=L("rZero"),rN=L("lengthScale"),iN=L("lengthDomain"),oN=L("lengthRange"),sN=L("lengthClamp"),aN=L("lengthNice"),cN=L("lengthZero"),lN=L("projectionType"),uN=L("projectionParallels"),fN=L("projectionPrecision"),dN=L("projectionRotate"),hN=L("projectionDomain"),pN=L("projectionInset"),mN=L("projectionInsetLeft"),yN=L("projectionInsetRight"),gN=L("projectionInsetTop"),bN=L("projectionInsetBottom"),xN=L("projectionClip");function U9(e,t){return{table:e,options:t}}var $9={};_r($9,{area:()=>wN,areaX:()=>vN,areaY:()=>SN,arrow:()=>h4,axisFx:()=>b4,axisFy:()=>x4,axisX:()=>y4,axisY:()=>g4,barX:()=>MN,barY:()=>AN,cell:()=>NN,cellX:()=>RN,cellY:()=>ON,circle:()=>PN,contour:()=>n4,delaunayLink:()=>u4,delaunayMesh:()=>f4,denseLine:()=>e4,density:()=>t4,densityX:()=>KN,densityY:()=>JN,dot:()=>LN,dotX:()=>CN,dotY:()=>BN,frame:()=>m4,geo:()=>I4,graticule:()=>E4,gridFx:()=>v4,gridFy:()=>S4,gridX:()=>_4,gridY:()=>w4,hexagon:()=>UN,hexbin:()=>o4,hexgrid:()=>s4,hull:()=>d4,image:()=>QN,line:()=>IN,lineX:()=>TN,lineY:()=>EN,link:()=>p4,raster:()=>r4,rasterTile:()=>i4,rect:()=>DN,rectX:()=>kN,rectY:()=>FN,regressionY:()=>a4,ruleX:()=>jN,ruleY:()=>VN,sphere:()=>T4,spike:()=>ZN,text:()=>$N,textX:()=>zN,textY:()=>qN,tickX:()=>YN,tickY:()=>GN,vector:()=>WN,vectorX:()=>XN,vectorY:()=>HN,voronoi:()=>c4,voronoiMesh:()=>l4});var net=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function St(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=net.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?dy:Dn;return _N(r,e,t,n)}function _N(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function pc(e,t,n){return r=>{r.addMark(new e(t,n))}}var wN=(...e)=>St("area",...e),vN=(...e)=>St("areaX",...e),SN=(...e)=>St("areaY",...e),IN=(...e)=>St("line",...e),TN=(...e)=>St("lineX",...e),EN=(...e)=>St("lineY",...e),MN=(...e)=>St("barX",...e),AN=(...e)=>St("barY",...e),NN=(...e)=>St("cell",...e),RN=(...e)=>St("cellX",...e),ON=(...e)=>St("cellY",...e),DN=(...e)=>St("rect",...e),kN=(...e)=>St("rectX",...e),FN=(...e)=>St("rectY",...e),LN=(...e)=>St("dot",...e),CN=(...e)=>St("dotX",...e),BN=(...e)=>St("dotY",...e),PN=(...e)=>St("circle",...e),UN=(...e)=>St("hexagon",...e),$N=(...e)=>St("text",...e),zN=(...e)=>St("textX",...e),qN=(...e)=>St("textY",...e),jN=(...e)=>St("ruleX",...e),VN=(...e)=>St("ruleY",...e),YN=(...e)=>St("tickX",...e),GN=(...e)=>St("tickY",...e),WN=(...e)=>St("vector",...e),XN=(...e)=>St("vectoX",...e),HN=(...e)=>St("vectorY",...e),ZN=(...e)=>St("spike",...e),QN=(...e)=>St("image",...e),KN=(...e)=>_N(ud,"areaX",...e),JN=(...e)=>_N(ud,"areaY",...e),t4=(...e)=>pc(yy,...e),e4=(...e)=>pc(my,...e),n4=(...e)=>pc(py,...e),r4=(...e)=>pc($l,...e),i4=(...e)=>pc(xy,...e),o4=(...e)=>pc(by,...e),s4=(...e)=>St("hexgrid",...e),a4=(...e)=>pc(_y,...e),c4=(...e)=>St("voronoi",...e),l4=(...e)=>St("voronoiMesh",...e),u4=(...e)=>St("delaunayLink",...e),f4=(...e)=>St("delaunayMesh",...e),d4=(...e)=>St("hull",...e),h4=(...e)=>St("arrow",...e),p4=(...e)=>St("link",...e),m4=(...e)=>St("frame",...e),y4=(...e)=>St("axisX",...e),g4=(...e)=>St("axisY",...e),b4=(...e)=>St("axisFx",...e),x4=(...e)=>St("axisFy",...e),_4=(...e)=>St("gridX",...e),w4=(...e)=>St("gridY",...e),v4=(...e)=>St("gridFx",...e),S4=(...e)=>St("gridFy",...e),I4=(...e)=>pc(gy,...e),T4=(...e)=>St("sphere",...e),E4=(...e)=>St("graticule",...e);var z9={};_r(z9,{highlight:()=>M4,intervalX:()=>k4,intervalXY:()=>L4,intervalY:()=>F4,nearestX:()=>O4,nearestY:()=>D4,pan:()=>C4,panX:()=>B4,panY:()=>P4,panZoom:()=>U4,panZoomX:()=>$4,panZoomY:()=>z4,toggle:()=>yd,toggleColor:()=>R4,toggleX:()=>A4,toggleY:()=>N4});function mc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function M4({by:e,...t}){return mc(wy,{selection:e,channels:t})}function yd({as:e,...t}){return mc(zl,{...t,selection:e})}function A4(e){return yd({...e,channels:["x"]})}function N4(e){return yd({...e,channels:["y"]})}function R4(e){return yd({...e,channels:["color"]})}function O4({as:e,...t}){return mc(pd,{...t,selection:e,channel:"x"})}function D4({as:e,...t}){return mc(pd,{...t,selection:e,channel:"y"})}function k4({as:e,...t}){return mc(hd,{...t,selection:e,channel:"x"})}function F4({as:e,...t}){return mc(hd,{...t,selection:e,channel:"y"})}function L4({as:e,...t}){return mc(Iy,{...t,selection:e})}function gd(e){return mc(Ty,e)}function C4(e={}){return gd({...e,zoom:!1})}function B4(e={}){return gd({...e,zoom:!1,pany:!1})}function P4(e={}){return gd({...e,zoom:!1,panx:!1})}function U4(e={}){return gd(e)}function $4(e={}){return gd({...e,pany:!1})}function z4(e={}){return gd({...e,panx:!1})}var q9={};_r(q9,{colorLegend:()=>j4,opacityLegend:()=>V4,symbolLegend:()=>Y4});function q4(e,t={}){if(t.for){let{for:n,...r}=t,i=new md(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?XM(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new md(e,t))}function j4(e){return q4.call(this,"color",e)}function V4(e){return q4.call(this,"opacity",e)}function Y4(e){return q4.call(this,"symbol",e)}function j9(...e){let t=new ly;return e.flat().forEach(n=>n(t)),Ry(this,...t.marks),t.element}function ret({coordinator:e=ti(),namedPlots:t=new Oy,extensions:n=null,...r}={}){return{...G4,...n,context:{coordinator:e,namedPlots:t,...r}}}export{Ah as Coordinator,qc as Fixed,cr as MosaicClient,Ta as Param,yt as Query,xs as Selection,$v as agg,aA as align,Wn as and,wN as area,vN as areaX,SN as areaY,mu as argmax,pu as argmin,u2 as arrayAgg,h4 as arrow,cA as aspectRatio,P9 as attributeDirectives,zv as avg,lA as axis,b4 as axisFx,x4 as axisFy,y4 as axisX,g4 as axisY,MN as barX,AN as barY,pw as bin,Ih as cast,yu as castDouble,f2 as castInteger,NN as cell,RN as cellX,ON as cellY,Mh as centroid,m2 as centroidX,y2 as centroidY,PN as circle,O6 as colorClamp,N6 as colorDomain,L6 as colorInterpolate,P6 as colorLabel,j4 as colorLegend,D6 as colorN,k6 as colorNice,C6 as colorPivot,R6 as colorRange,U6 as colorReverse,A6 as colorScale,F6 as colorScheme,B6 as colorSymmetric,z6 as colorTickFormat,$6 as colorZero,wa as column,Ry as connect,n4 as contour,ti as coordinator,t2 as corr,Or as count,e2 as covarPop,Ia as create,ret as createAPIContext,Dv as cume_dist,p2 as dateDay,d2 as dateMonth,h2 as dateMonthDay,u4 as delaunayLink,f4 as delaunayMesh,e4 as denseLine,Rv as dense_rank,t4 as density,KN as densityX,JN as densityY,LN as dot,CN as dotX,BN as dotY,Qv as entropy,ys as eq,E3 as facetGrid,M3 as facetLabel,w3 as facetMargin,S3 as facetMarginBottom,I3 as facetMarginLeft,T3 as facetMarginRight,v3 as facetMarginTop,Cv as first_value,m4 as frame,U9 as from,L3 as fxAlign,J3 as fxAriaDescription,K3 as fxAriaLabel,U3 as fxAxis,A3 as fxDomain,Q3 as fxFontVariant,G3 as fxGrid,O3 as fxInset,D3 as fxInsetLeft,k3 as fxInsetRight,X3 as fxLabel,H3 as fxLabelAnchor,Z3 as fxLabelOffset,W3 as fxLine,R3 as fxNice,C3 as fxPadding,B3 as fxPaddingInner,P3 as fxPaddingOuter,N3 as fxRange,t6 as fxReverse,F3 as fxRound,V3 as fxTickFormat,j3 as fxTickPadding,Y3 as fxTickRotate,z3 as fxTickSize,q3 as fxTickSpacing,$3 as fxTicks,c6 as fyAlign,E6 as fyAriaDescription,T6 as fyAriaLabel,d6 as fyAxis,e6 as fyDomain,I6 as fyFontVariant,x6 as fyGrid,i6 as fyInset,s6 as fyInsetBottom,o6 as fyInsetTop,w6 as fyLabel,v6 as fyLabelAnchor,S6 as fyLabelOffset,_6 as fyLine,r6 as fyNice,l6 as fyPadding,u6 as fyPaddingInner,f6 as fyPaddingOuter,n6 as fyRange,M6 as fyReverse,a6 as fyRound,g6 as fyTickFormat,y6 as fyTickPadding,b6 as fyTickRotate,p6 as fyTickSize,m6 as fyTickSpacing,h6 as fyTicks,I4 as geo,Eh as geojson,E4 as graticule,fA as grid,v4 as gridFx,S4 as gridFy,_4 as gridX,w4 as gridY,Pc as gt,wv as gte,D9 as hconcat,nA as height,UN as hexagon,o4 as hexbin,s4 as hexgrid,M4 as highlight,L9 as hspace,d4 as hull,QN as image,uA as inset,z9 as interactorDirectives,k4 as intervalX,L4 as intervalXY,F4 as intervalY,Te as isBetween,vv as isDistinct,Sv as isNotBetween,vh as isNotDistinct,ms as isNotNull,Bc as isNull,Zv as kurtosis,dA as label,Fv as lag,c2 as last,Bv as last_value,Lv as lead,q9 as legendDirectives,sN as lengthClamp,iN as lengthDomain,aN as lengthNice,oN as lengthRange,rN as lengthScale,cN as lengthZero,IN as line,TN as lineX,EN as lineY,p4 as link,Rr as literal,x2 as loadCSV,g2 as loadExtension,_2 as loadJSON,S2 as loadObjects,w2 as loadParquet,v2 as loadSpatial,gs as lt,bs as lte,qv as mad,KM as margin,sA as marginBottom,rA as marginLeft,iA as marginRight,oA as marginTop,QM as margins,$9 as markDirectives,Kr as max,Vv as median,E9 as menu,Jr as min,Gv as mode,HM as name,WM as namedPlots,O4 as nearestX,D4 as nearestY,wh as neq,_v as not,Pv as nth_value,kv as ntile,Y6 as opacityClamp,j6 as opacityDomain,W6 as opacityLabel,V4 as opacityLegend,G6 as opacityNice,V6 as opacityRange,X6 as opacityReverse,q6 as opacityScale,Z6 as opacityTickFormat,H6 as opacityZero,Cc as or,hA as padding,C4 as pan,B4 as panX,P4 as panY,U4 as panZoom,$4 as panZoomX,z4 as panZoomY,Ov as percent_rank,j9 as plot,jv as product,xN as projectionClip,hN as projectionDomain,pN as projectionInset,bN as projectionInsetBottom,mN as projectionInsetLeft,yN as projectionInsetRight,gN as projectionInsetTop,uN as projectionParallels,fN as projectionPrecision,dN as projectionRotate,lN as projectionType,Yv as quantile,tN as rClamp,K6 as rDomain,eN as rNice,J6 as rRange,Q6 as rScale,nN as rZero,Nv as rank,r4 as raster,i4 as rasterTile,DN as rect,kN as rectX,FN as rectY,a4 as regressionY,XM as requestNamedPlot,hD as restConnector,pA as round,Av as row_number,jN as ruleX,VN as ruleY,M9 as search,Hv as skewness,A9 as slider,c0 as socketConnector,T4 as sphere,ZN as spike,j as sql,Xv as stddev,Jv as stddevPop,l2 as stringAgg,tA as style,Dr as sum,Y4 as symbolLegend,N9 as table,$N as text,zN as textX,qN as textY,YN as tickX,GN as tickY,yd as toggle,R4 as toggleColor,A4 as toggleX,N4 as toggleY,Kv as varPop,Wv as variance,O9 as vconcat,WN as vector,XN as vectorX,HN as vectorY,c4 as voronoi,l4 as voronoiMesh,F9 as vspace,wD as wasmConnector,eA as width,IA as xAlign,qA as xAriaDescription,zA as xAriaLabel,AA as xAxis,vA as xClamp,yA as xDomain,$A as xFontVariant,LA as xGrid,xA as xInset,_A as xInsetLeft,wA as xInsetRight,BA as xLabel,PA as xLabelAnchor,UA as xLabelOffset,CA as xLine,bA as xNice,TA as xPadding,EA as xPaddingInner,MA as xPaddingOuter,gA as xRange,jA as xReverse,SA as xRound,mA as xScale,kA as xTickFormat,DA as xTickPadding,FA as xTickRotate,RA as xTickSize,OA as xTickSpacing,NA as xTicks,VA as xZero,JM as xyDomain,t3 as yAlign,b3 as yAriaDescription,g3 as yAriaLabel,i3 as yAxis,KA as yClamp,GA as yDomain,y3 as yFontVariant,f3 as yGrid,HA as yInset,QA as yInsetBottom,ZA as yInsetTop,h3 as yLabel,p3 as yLabelAnchor,m3 as yLabelOffset,d3 as yLine,XA as yNice,e3 as yPadding,n3 as yPaddingInner,r3 as yPaddingOuter,WA as yRange,x3 as yReverse,JA as yRound,YA as yScale,l3 as yTickFormat,c3 as yTickPadding,u3 as yTickRotate,s3 as yTickSize,a3 as yTickSpacing,o3 as yTicks,_3 as yZero};