@uwdata/mosaic-spec 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/mosaic-schema.json +9664 -2691
- package/dist/mosaic-spec.js +4174 -2653
- package/dist/mosaic-spec.min.js +24 -24
- package/dist/types/ast/ColumnParamRefNode.d.ts +8 -0
- package/dist/types/ast/ExpressionNode.d.ts +2 -4
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/spec/Input.d.ts +1 -1
- package/dist/types/spec/PlotAttribute.d.ts +11 -5
- package/dist/types/spec/PlotFrom.d.ts +1 -1
- package/dist/types/spec/PlotInteractor.d.ts +2 -1
- package/dist/types/spec/PlotMark.d.ts +2 -1
- package/dist/types/spec/Transform.d.ts +8 -2
- package/dist/types/spec/interactors/BrushStyles.d.ts +27 -0
- package/dist/types/spec/interactors/Interval1D.d.ts +6 -27
- package/dist/types/spec/interactors/Interval2D.d.ts +6 -5
- package/dist/types/spec/interactors/Region.d.ts +32 -0
- package/dist/types/spec/interactors/Toggle.d.ts +3 -3
- package/dist/types/spec/marks/Marks.d.ts +5 -0
- package/dist/types/spec/marks/Waffle.d.ts +58 -0
- package/package.json +6 -6
- package/src/ast/ColumnParamRefNode.js +21 -0
- package/src/ast/DataNode.js +3 -3
- package/src/ast/ExpressionNode.js +17 -22
- package/src/ast/PlotFromNode.js +6 -6
- package/src/ast/PlotMarkNode.js +2 -2
- package/src/ast/TransformNode.js +14 -12
- package/src/config/transforms.js +1 -0
- package/src/constants.js +1 -1
- package/src/spec/Input.ts +1 -1
- package/src/spec/PlotAttribute.ts +13 -5
- package/src/spec/PlotFrom.ts +1 -1
- package/src/spec/PlotInteractor.ts +7 -5
- package/src/spec/PlotMark.ts +3 -1
- package/src/spec/Transform.ts +10 -1
- package/src/spec/interactors/BrushStyles.ts +27 -0
- package/src/spec/interactors/Interval1D.ts +6 -28
- package/src/spec/interactors/Interval2D.ts +6 -5
- package/src/spec/interactors/Region.ts +34 -0
- package/src/spec/interactors/Toggle.ts +3 -3
- package/src/spec/marks/Marks.ts +6 -0
- package/src/spec/marks/Waffle.ts +61 -0
package/dist/mosaic-spec.min.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
var YD=Object.create;var ub=Object.defineProperty;var UD=Object.getOwnPropertyDescriptor;var jD=Object.getOwnPropertyNames;var XD=Object.getPrototypeOf,GD=Object.prototype.hasOwnProperty;var cT=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ec=(t,e)=>{for(var n in e)ub(t,n,{get:e[n],enumerable:!0})},VD=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jD(e))!GD.call(t,o)&&o!==n&&ub(t,o,{get:()=>e[o],enumerable:!(r=UD(e,o))||r.enumerable});return t};var WD=(t,e,n)=>(n=t!=null?YD(XD(t)):{},VD(e||!t||!t.__esModule?ub(n,"default",{value:t,enumerable:!0}):n,t));var OR=cT((G9t,NR)=>{"use strict";function pH(t,e,n,r,o){for(var i=o+1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c>=0?(i=s,o=s-1):r=s+1}return i}function dH(t,e,n,r,o){for(var i=o+1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c>0?(i=s,o=s-1):r=s+1}return i}function hH(t,e,n,r,o){for(var i=r-1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c<0?(i=s,r=s+1):o=s-1}return i}function mH(t,e,n,r,o){for(var i=r-1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c<=0?(i=s,r=s+1):o=s-1}return i}function gH(t,e,n,r,o){for(;r<=o;){var i=r+o>>>1,s=t[i],a=n!==void 0?n(s,e):s-e;if(a===0)return i;a<=0?r=i+1:o=i-1}return-1}function Td(t,e,n,r,o,i){return typeof n=="function"?i(t,e,n,r===void 0?0:r|0,o===void 0?t.length-1:o|0):i(t,e,void 0,n===void 0?0:n|0,r===void 0?t.length-1:r|0)}NR.exports={ge:function(t,e,n,r,o){return Td(t,e,n,r,o,pH)},gt:function(t,e,n,r,o){return Td(t,e,n,r,o,dH)},lt:function(t,e,n,r,o){return Td(t,e,n,r,o,hH)},le:function(t,e,n,r,o){return Td(t,e,n,r,o,mH)},eq:function(t,e,n,r,o){return Td(t,e,n,r,o,gH)}}});var zR=cT((V9t,BR)=>{"use strict";var o1=OR(),Hf=0,Xa=1,r1=2;BR.exports=xH;function Q3(t,e,n,r,o){this.mid=t,this.left=e,this.right=n,this.leftPoints=r,this.rightPoints=o,this.count=(e?e.count:0)+(n?n.count:0)+r.length}var Ed=Q3.prototype;function H3(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function DR(t,e){var n=Zf(e);t.mid=n.mid,t.left=n.left,t.right=n.right,t.leftPoints=n.leftPoints,t.rightPoints=n.rightPoints,t.count=n.count}function RR(t,e){var n=t.intervals([]);n.push(e),DR(t,n)}function LR(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?Hf:(n.splice(r,1),DR(t,n),Xa)}Ed.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t};Ed.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?RR(this,t):this.left.insert(t):this.left=Zf([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?RR(this,t):this.right.insert(t):this.right=Zf([t]);else{var n=o1.ge(this.leftPoints,t,J3),r=o1.ge(this.rightPoints,t,K3);this.leftPoints.splice(n,0,t),this.rightPoints.splice(r,0,t)}};Ed.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return Hf;var n=this.right?this.right.count:0;if(4*n>3*(e-1))return LR(this,t);var r=this.left.remove(t);return r===r1?(this.left=null,this.count-=1,Xa):(r===Xa&&(this.count-=1),r)}else if(t[0]>this.mid){if(!this.right)return Hf;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return LR(this,t);var r=this.right.remove(t);return r===r1?(this.right=null,this.count-=1,Xa):(r===Xa&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===t?r1:Hf;if(this.leftPoints.length===1&&this.leftPoints[0]===t){if(this.left&&this.right){for(var i=this,s=this.left;s.right;)i=s,s=s.right;if(i===this)s.right=this.right;else{var a=this.left,r=this.right;i.count-=s.count,i.right=s.left,s.left=a,s.right=r}H3(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?H3(this,this.left):H3(this,this.right);return Xa}for(var a=o1.ge(this.leftPoints,t,J3);a<this.leftPoints.length&&this.leftPoints[a][0]===t[0];++a)if(this.leftPoints[a]===t){this.count-=1,this.leftPoints.splice(a,1);for(var r=o1.ge(this.rightPoints,t,K3);r<this.rightPoints.length&&this.rightPoints[r][1]===t[1];++r)if(this.rightPoints[r]===t)return this.rightPoints.splice(r,1),Xa}return Hf}};function PR(t,e,n){for(var r=0;r<t.length&&t[r][0]<=e;++r){var o=n(t[r]);if(o)return o}}function FR(t,e,n){for(var r=t.length-1;r>=0&&t[r][1]>=e;--r){var o=n(t[r]);if(o)return o}}function qR(t,e){for(var n=0;n<t.length;++n){var r=e(t[n]);if(r)return r}}Ed.queryPoint=function(t,e){if(t<this.mid){if(this.left){var n=this.left.queryPoint(t,e);if(n)return n}return PR(this.leftPoints,t,e)}else if(t>this.mid){if(this.right){var n=this.right.queryPoint(t,e);if(n)return n}return FR(this.rightPoints,t,e)}else return qR(this.leftPoints,e)};Ed.queryInterval=function(t,e,n){if(t<this.mid&&this.left){var r=this.left.queryInterval(t,e,n);if(r)return r}if(e>this.mid&&this.right){var r=this.right.queryInterval(t,e,n);if(r)return r}return e<this.mid?PR(this.leftPoints,e,n):t>this.mid?FR(this.rightPoints,t,n):qR(this.leftPoints,n)};function yH(t,e){return t-e}function J3(t,e){var n=t[0]-e[0];return n||t[1]-e[1]}function K3(t,e){var n=t[1]-e[1];return n||t[0]-e[0]}function Zf(t){if(t.length===0)return null;for(var e=[],n=0;n<t.length;++n)e.push(t[n][0],t[n][1]);e.sort(yH);for(var r=e[e.length>>1],o=[],i=[],s=[],n=0;n<t.length;++n){var a=t[n];a[1]<r?o.push(a):r<a[0]?i.push(a):s.push(a)}var c=s,f=s.slice();return c.sort(J3),f.sort(K3),new Q3(r,Zf(o),Zf(i),c,f)}function Z3(t){this.root=t}var Qf=Z3.prototype;Qf.insert=function(t){this.root?this.root.insert(t):this.root=new Q3(t[0],null,null,[t],[t])};Qf.remove=function(t){if(this.root){var e=this.root.remove(t);return e===r1&&(this.root=null),e!==Hf}return!1};Qf.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)};Qf.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)};Object.defineProperty(Qf,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(Qf,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function xH(t){return!t||t.length===0?new Z3(null):new Z3(Zf(t))}});var fT={};function ml(t,e=!1){let n,r,o=fT;function i(f){n=t(f).finally(()=>{if(r){let{value:l}=r;r=null,i(l)}else n=null})}function s(f){r={event:f}}function a(f){n?s(f):i(f)}function c(f){o!==f&&requestAnimationFrame(()=>{let l=o;o=fT,a(l)}),o=f}return e?c:a}var _n=class{constructor(e){this._filterBy=e,this._requestUpdate=ml(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(e){this._coordinator=e}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(e){return this}query(e){return null}queryPending(){return this}queryResult(e){return this}queryError(e){return this}requestQuery(e){let n=e||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var gl=Uint8Array.of(65,82,82,79,87,49),Zn={V1:0,V2:1,V3:2,V4:3,V5:4};var Qn={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},z={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},nc={HALF:0,SINGLE:1,DOUBLE:2},To={DAY:0,MILLISECOND:1},Ae={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},Jn={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},Eo={Sparse:0,Dense:1};var rc=Uint8Array,dh=Uint16Array,hh=Uint32Array,mh=BigUint64Array,yl=Int8Array,lT=Int16Array,Sn=Int32Array,On=BigInt64Array,pb=Float32Array,Mi=Float64Array;function uT(t,e){let n=Math.log2(t)-3;return(e?[yl,lT,Sn,On]:[rc,dh,hh,mh])[n]}var AQ=Object.getPrototypeOf(Int8Array);function oc(t,e){let n=0,r=t.length;if(r<=2147483648)do{let o=n+r>>>1;t[o]<=e?n=o+1:r=o}while(n<r);else do{let o=Math.trunc((n+r)/2);t[o]<=e?n=o+1:r=o}while(n<r);return n}function gh(t,e,n){if(e(t))return t;throw new Error(n(t))}function Mn(t,e,n){return e=Array.isArray(e)?e:Object.values(e),gh(t,r=>e.includes(r),n??(()=>`${t} must be one of ${e}`))}function yh(t,e){for(let[n,r]of Object.entries(t))if(r===e)return n;return"<Unknown>"}var Io=t=>`Unsupported data type: "${yh(z,t)}" (id ${t})`,xl=(t,e,n=!0,r=null)=>({name:t,type:e,nullable:n,metadata:r});function pT(t){return Object.hasOwn(t,"name")&&dT(t.type)}function dT(t){return typeof t?.typeId=="number"}function Ai(t,e="",n=!0){return pT(t)?t:xl(e,gh(t,dT,()=>"Data type expected."),n)}var xh=(t,e,n=!1,r=-1)=>({typeId:z.Dictionary,id:r,dictionary:t,indices:e||ic(),ordered:n});var bh=(t=32,e=!0)=>({typeId:z.Int,bitWidth:Mn(t,[8,16,32,64]),signed:e,values:uT(t,e)});var ic=()=>bh(32);var db=(t=2)=>({typeId:z.Float,precision:Mn(t,nc),values:[dh,pb,Mi][t]});var hb=()=>({typeId:z.Binary,offsets:Sn}),wh=()=>({typeId:z.Utf8,offsets:Sn});var mb=(t,e,n=128)=>({typeId:z.Decimal,precision:t,scale:e,bitWidth:Mn(n,[128,256]),values:mh}),gb=t=>({typeId:z.Date,unit:Mn(t,To),values:t===To.DAY?Sn:On});var yb=(t=Ae.MILLISECOND,e=32)=>({typeId:z.Time,unit:Mn(t,Ae),bitWidth:Mn(e,[32,64]),values:e===32?Sn:On});var vh=(t=Ae.MILLISECOND,e=null)=>({typeId:z.Timestamp,unit:Mn(t,Ae),timezone:e,values:On}),xb=(t=Jn.MONTH_DAY_NANO)=>({typeId:z.Interval,unit:Mn(t,Jn),values:t===Jn.MONTH_DAY_NANO?void 0:Sn}),_h=t=>({typeId:z.List,children:[Ai(t)],offsets:Sn}),Sh=t=>({typeId:z.Struct,children:Array.isArray(t)&&pT(t[0])?t:Object.entries(t).map(([e,n])=>xl(e,n))}),bb=(t,e,n,r)=>(n??=e.map((o,i)=>i),{typeId:z.Union,mode:Mn(t,Eo),typeIds:n,typeMap:n.reduce((o,i,s)=>(o[i]=s,o),{}),children:e.map((o,i)=>Ai(o,`_${i}`)),typeIdForValue:r,offsets:Sn}),wb=t=>({typeId:z.FixedSizeBinary,stride:t}),Mh=(t,e)=>({typeId:z.FixedSizeList,stride:e,children:[Ai(t)]}),hT=(t,e)=>({typeId:z.Map,keysSorted:t,children:[e],offsets:Sn});var vb=(t=Ae.MILLISECOND)=>({typeId:z.Duration,unit:Mn(t,Ae),values:On}),_b=()=>({typeId:z.LargeBinary,offsets:On}),Sb=()=>({typeId:z.LargeUtf8,offsets:On}),Mb=t=>({typeId:z.LargeList,children:[Ai(t)],offsets:On}),Ab=(t,e)=>({typeId:z.RunEndEncoded,children:[gh(Ai(t,"run_ends"),n=>n.type.typeId===z.Int,()=>"Run-ends must have an integer type."),Ai(e,"values")]});var Tb=t=>({typeId:z.ListView,children:[Ai(t,"value")],offsets:Sn}),Eb=t=>({typeId:z.LargeListView,children:[Ai(t,"value")],offsets:On});var HD=new Mi(2),Ah=HD.buffer,RQ=new On(Ah),LQ=new hh(Ah),DQ=new Sn(Ah),PQ=new rc(Ah);function Or(t){if(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${t}`);return Number(t)}function Th(t,e){return Number(t/e)+Number(t%e)/Number(e)}var sc=t=>BigInt.asUintN(64,t);function gT(t,e){let n=e<<1,r;return BigInt.asIntN(64,t[n+1])<0?(r=sc(~t[n])|sc(~t[n+1])<<64n,r=-(r+1n)):r=t[n]|t[n+1]<<64n,r}function yT(t,e){let n=e<<2,r;return BigInt.asIntN(64,t[n+3])<0?(r=sc(~t[n])|sc(~t[n+1])<<64n|sc(~t[n+2])<<128n|sc(~t[n+3])<<192n,r=-(r+1n)):r=t[n]|t[n+1]<<64n|t[n+2]<<128n|t[n+3]<<192n,r}var QD=new TextDecoder("utf-8"),YQ=new TextEncoder;function ac(t){return QD.decode(t)}var ks=4;function Ib(t,e){return(t[e>>3]&1<<e%8)!==0}function We(t,e){let n=e+zt(t,e),r=n-zt(t,n),o=Pe(t,r);return(i,s,a=null)=>{if(i<o){let c=Pe(t,r+i);if(c)return s(t,n+c)}return a}}function yr(t,e){return e}function Ti(t,e){return!!JD(t,e)}function JD(t,e){return bl(t,e)<<24>>24}function bl(t,e){return t[e]}function Pe(t,e){return KD(t,e)<<16>>16}function KD(t,e){return t[e]|t[e+1]<<8}function zt(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function xT(t,e){return zt(t,e)>>>0}function Te(t,e){return Or(BigInt.asIntN(64,BigInt(xT(t,e))+(BigInt(xT(t,e+ks))<<32n)))}function Ns(t,e){let n=e+zt(t,e),r=zt(t,n);return n+=ks,ac(t.subarray(n,n+r))}function Rn(t,e,n,r){if(!e)return[];let o=e+zt(t,e);return Array.from({length:zt(t,o)},(i,s)=>r(t,o+ks+s*n))}var $b=Symbol("rowIndex");function wl(t,e){class n{constructor(i){this[$b]=i}toJSON(){return bT(t,e,this[$b])}}let r=n.prototype;for(let o=0;o<t.length;++o){if(Object.hasOwn(r,t[o]))continue;let i=e[o];Object.defineProperty(r,t[o],{get(){return i.at(this[$b])},enumerable:!0})}return o=>new n(o)}function Eh(t,e){return n=>bT(t,e,n)}function bT(t,e,n){let r={};for(let o=0;o<t.length;++o)r[t[o]]=e[o].at(n);return r}function wT(t){return t instanceof Ei}var Os=class{static ArrayType=null;constructor({length:e,nullCount:n,type:r,validity:o,values:i,offsets:s,sizes:a,children:c}){this.length=e,this.nullCount=n,this.type=r,this.validity=o,this.values=i,this.offsets=s,this.sizes=a,this.children=c,(!n||!this.validity)&&(this.at=f=>this.value(f))}get[Symbol.toStringTag](){return"Batch"}at(e){return this.isValid(e)?this.value(e):null}isValid(e){return Ib(this.validity,e)}value(e){return this.values[e]}slice(e,n){let r=n-e,o=Array(r);for(let i=0;i<r;++i)o[i]=this.at(e+i);return o}*[Symbol.iterator](){for(let e=0;e<this.length;++e)yield this.at(e)}},Ei=class extends Os{constructor(e){super(e);let{length:n,values:r}=this;this.values=r.subarray(0,n)}slice(e,n){return this.nullCount?super.slice(e,n):this.values.subarray(e,n)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},vl=class extends Os{static ArrayType=Mi},te=class extends Os{static ArrayType=Array},_l=class extends te{value(e){return null}},Rr=class extends vl{value(e){return Or(this.values[e])}},Ih=class extends vl{value(e){let n=this.values[e],r=(n&31744)>>10,o=(n&1023)/1024,i=(-1)**((n&32768)>>15);switch(r){case 31:return i*(o?Number.NaN:1/0);case 0:return i*(o?6103515625e-14*o:0)}return i*2**(r-15)*(1+o)}},$h=class extends te{value(e){return Ib(this.values,e)}},Ch=class extends Os{constructor(e){super(e);let{bitWidth:n,scale:r}=this.type;this.decimal=n===128?gT:yT,this.scale=10n**BigInt(r)}},kh=class extends Ch{static ArrayType=Mi;value(e){return Th(this.decimal(this.values,e),this.scale)}},Nh=class extends Ch{static ArrayType=Array;value(e){return this.decimal(this.values,e)}},Sl=class extends te{constructor(e){super(e),this.source=e}value(e){return new Date(this.source.value(e))}},Oh=class extends vl{value(e){return 864e5*this.values[e]}},vT=Rr,Rh=class extends Rr{value(e){return super.value(e)*1e3}},_T=Rr,Lh=class extends Rr{value(e){return Th(this.values[e],1000n)}},Dh=class extends Rr{value(e){return Th(this.values[e],1000000n)}},Ph=class extends te{value(e){return this.values.subarray(e<<1,e+1<<1)}},Fh=class extends te{value(e){let n=this.values,r=e<<4;return Float64Array.of(zt(n,r),zt(n,r+4),Te(n,r+8))}},ST=({values:t,offsets:e},n)=>t.subarray(e[n],e[n+1]),MT=({values:t,offsets:e},n)=>t.subarray(Or(e[n]),Or(e[n+1])),qh=class extends te{value(e){return ST(this,e)}},Bh=class extends te{value(e){return MT(this,e)}},zh=class extends te{value(e){return ac(ST(this,e))}},Yh=class extends te{value(e){return ac(MT(this,e))}},Uh=class extends te{value(e){let n=this.offsets;return this.children[0].slice(n[e],n[e+1])}},jh=class extends te{value(e){let n=this.offsets;return this.children[0].slice(Or(n[e]),Or(n[e+1]))}},Xh=class extends te{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(n,r)}},Gh=class extends te{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(Or(n),Or(r))}},Vh=class extends te{constructor(e){super(e),this.stride=this.type.stride}},Wh=class extends Vh{value(e){let{stride:n,values:r}=this;return r.subarray(e*n,(e+1)*n)}},Hh=class extends Vh{value(e){let{children:n,stride:r}=this;return n[0].slice(e*r,(e+1)*r)}};function AT({children:t,offsets:e},n){let[r,o]=t[0].children,i=e[n],s=e[n+1],a=[];for(let c=i;c<s;++c)a.push([r.at(c),o.at(c)]);return a}var Zh=class extends te{value(e){return AT(this,e)}},Qh=class extends te{value(e){return new Map(AT(this,e))}},Ml=class extends te{constructor({typeIds:e,...n}){super(n),this.typeIds=e,this.typeMap=this.type.typeMap}value(e,n=e){let{typeIds:r,children:o,typeMap:i}=this;return o[i[r[e]]].at(n)}},Jh=class extends Ml{value(e){return super.value(e,this.offsets[e])}},Al=class extends te{constructor(e,n=Eh){super(e),this.names=this.type.children.map(r=>r.name),this.factory=n(this.names,this.children)}value(e){return this.factory(e)}},Kh=class extends Al{constructor(e){super(e,wl)}},tm=class extends te{value(e){let[{values:n},r]=this.children;return r.at(oc(n,e))}},em=class extends te{setDictionary(e){return this.dictionary=e,this.cache=e.cache(),this}value(e){return this.cache[this.key(e)]}key(e){return this.values[e]}},nm=class extends te{constructor({data:e,...n}){super(n),this.data=e}view(e){let{values:n,data:r}=this,o=e<<4,i=o+4,s=n,a=zt(s,o);return a>12&&(i=zt(s,o+12),s=r[zt(s,o+8)]),s.subarray(i,i+a)}},rm=class extends nm{value(e){return this.view(e)}},om=class extends nm{value(e){return ac(this.view(e))}};function Cb(t){let e=[];return{add(n){return e.push(n),this},clear:()=>e=[],done:()=>new Rs(e,t)}}var Rs=class{constructor(e,n=e[0]?.type){this.type=n,this.length=e.reduce((i,s)=>i+s.length,0),this.nullCount=e.reduce((i,s)=>i+s.nullCount,0),this.data=e;let r=e.length,o=new Int32Array(r+1);if(r===1){let[i]=e;o[1]=i.length,this.at=s=>i.at(s)}else for(let i=0,s=0;i<r;++i)o[i+1]=s+=e[i].length;this.offsets=o}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let e=this.data;return e.length===1?e[0][Symbol.iterator]():tP(e)}at(e){let{data:n,offsets:r}=this,o=oc(r,e)-1;return n[o]?.at(e-r[o])}get(e){return this.at(e)}toArray(){let{length:e,nullCount:n,data:r}=this,o=!n&&wT(r[0]),i=r.length;if(o&&i===1)return r[0].values;let s=!i||n>0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new s(e);return o?eP(a,r):nP(a,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*tP(t){for(let e=0;e<t.length;++e){let n=t[e][Symbol.iterator]();for(let r=n.next();!r.done;r=n.next())yield r.value}}function eP(t,e){for(let n=0,r=0;n<e.length;++n){let{values:o}=e[n];t.set(o,r),r+=o.length}return t}function nP(t,e){let n=-1;for(let r=0;r<e.length;++r){let o=e[r];for(let i=0;i<o.length;++i)t[++n]=o.at(i)}return t}var cc=class t{constructor(e,n,r=!1){let o=e.fields.map(s=>s.name);this.schema=e,this.names=o,this.children=n,this.factory=r?wl:Eh;let i=[];this.getFactory=s=>i[s]??(i[s]=this.factory(o,n.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(e){return this.children[e]}getChild(e){let n=this.names.findIndex(r=>r===e);return n>-1?this.children[n]:void 0}selectAt(e,n=[]){let{children:r,factory:o,schema:i}=this,{fields:s}=i;return new t({...i,fields:e.map((a,c)=>rP(s[a],n[c]))},e.map(a=>r[a]),o===wl)}select(e,n){let r=this.names,o=e.map(i=>r.indexOf(i));return this.selectAt(o,n)}toColumns(){let{children:e,names:n}=this,r={};return n.forEach((o,i)=>r[o]=e[i]?.toArray()??[]),r}toArray(){let{children:e,getFactory:n,numRows:r}=this,o=e[0]?.data??[],i=Array(r);for(let s=0,a=-1;s<o.length;++s){let c=n(s);for(let f=0;f<o[s].length;++f)i[++a]=c(f)}return i}*[Symbol.iterator](){let{children:e,getFactory:n}=this,r=e[0]?.data??[];for(let o=0;o<r.length;++o){let i=n(o);for(let s=0;s<r[o].length;++s)yield i(s)}}at(e){let{children:n,getFactory:r,numRows:o}=this;if(e<0||e>=o)return null;let[{offsets:i}]=n,s=oc(i,e)-1;return r(s)(e-i[s])}get(e){return this.at(e)}};function rP(t,e){return e!=null&&e!==t.name?{...t,name:e}:t}function Tl(t,e={}){let{typeId:n,bitWidth:r,precision:o,unit:i}=t,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:f,useProxy:l}=e;switch(n){case z.Null:return _l;case z.Bool:return $h;case z.Int:case z.Time:case z.Duration:return s||r<64?Ei:Rr;case z.Float:return o?Ei:Ih;case z.Date:return TT(i===To.DAY?Oh:vT,a&&Sl);case z.Timestamp:return TT(i===Ae.SECOND?Rh:i===Ae.MILLISECOND?_T:i===Ae.MICROSECOND?Lh:Dh,a&&Sl);case z.Decimal:return c?Nh:kh;case z.Interval:return i===Jn.DAY_TIME?Ph:i===Jn.YEAR_MONTH?Ei:Fh;case z.FixedSizeBinary:return Wh;case z.Utf8:return zh;case z.LargeUtf8:return Yh;case z.Binary:return qh;case z.LargeBinary:return Bh;case z.BinaryView:return rm;case z.Utf8View:return om;case z.List:return Uh;case z.LargeList:return jh;case z.Map:return f?Qh:Zh;case z.ListView:return Xh;case z.LargeListView:return Gh;case z.FixedSizeList:return Hh;case z.Struct:return l?Kh:Al;case z.RunEndEncoded:return tm;case z.Dictionary:return em;case z.Union:return t.mode?Jh:Ml}throw new Error(Io(n))}function TT(t,e){return e?class extends e{constructor(r){super(new t(r))}}:t}function oP(t,e){return{offset:Te(t,e),metadataLength:zt(t,e+8),bodyLength:Te(t,e+16)}}function kb(t,e){return Rn(t,e,24,oP)}function im(t,e,n){let r=We(t,e);if(r(10,yr,0))throw new Error("Record batch compression not implemented");let o=n<Zn.V4?8:0;return{length:r(4,Te,0),nodes:Rn(t,r(6,yr),16,(i,s)=>({length:Te(i,s),nullCount:Te(i,s+8)})),regions:Rn(t,r(8,yr),16+o,(i,s)=>({offset:Te(i,s+o),length:Te(i,s+o+8)})),variadic:Rn(t,r(12,yr),8,Te)}}function ET(t,e,n){let r=We(t,e);return{id:r(4,Te,0),data:r(6,(o,i)=>im(o,i,n)),isDelta:r(8,Ti,!1)}}function Nb(t,e,n,r){Mn(n,z,Io);let o=We(t,e);switch(n){case z.Binary:return hb();case z.Utf8:return wh();case z.LargeBinary:return _b();case z.LargeUtf8:return Sb();case z.List:return _h(r[0]);case z.ListView:return Tb(r[0]);case z.LargeList:return Mb(r[0]);case z.LargeListView:return Eb(r[0]);case z.Struct:return Sh(r);case z.RunEndEncoded:return Ab(r[0],r[1]);case z.Int:return bh(o(4,zt,0),o(6,Ti,!1));case z.Float:return db(o(4,Pe,nc.HALF));case z.Decimal:return mb(o(4,zt,0),o(6,zt,0),o(8,zt,128));case z.Date:return gb(o(4,Pe,To.MILLISECOND));case z.Time:return yb(o(4,Pe,Ae.MILLISECOND),o(6,zt,32));case z.Timestamp:return vh(o(4,Pe,Ae.SECOND),o(6,Ns));case z.Interval:return xb(o(4,Pe,Jn.YEAR_MONTH));case z.Duration:return vb(o(4,Pe,Ae.MILLISECOND));case z.FixedSizeBinary:return wb(o(4,zt,0));case z.FixedSizeList:return Mh(r[0],o(4,zt,0));case z.Map:return hT(o(4,Ti,!1),r[0]);case z.Union:return bb(o(4,Pe,Eo.Sparse),r,Rn(t,o(6,yr),4,zt))}return{typeId:n}}function El(t,e){let n=Rn(t,e,4,(r,o)=>{let i=We(r,o);return[i(4,Ns),i(6,Ns)]});return n.length?new Map(n):null}function sm(t,e,n){let r=We(t,e);return{version:n,endianness:r(4,Pe,0),fields:r(6,iP,[]),metadata:r(8,El)}}function iP(t,e){return Rn(t,e,4,IT)}function IT(t,e){let n=We(t,e),r=n(8,bl,z.NONE),o=n(10,yr,0),i=n(12,aP),s=n(14,(c,f)=>sP(c,f)),a=Nb(t,o,r,s);return i&&(i.dictionary=a,a=i),{name:n(4,Ns),type:a,nullable:n(6,Ti,!1),metadata:n(16,El)}}function sP(t,e){let n=Rn(t,e,4,IT);return n.length?n:null}function aP(t,e){if(!e)return null;let n=We(t,e);return xh(null,n(6,cP,ic()),n(8,Ti,!1),n(4,Te,0))}function cP(t,e){return Nb(t,e,z.Int)}var fP=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,lP=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`,uP=t=>`Unsupported message type: ${t} (${yh(Qn,t)})`;function am(t,e){let n=zt(t,e)||0;if(e+=ks,n===-1&&(n=zt(t,e)||0,e+=ks),n===0)return null;let r=t.subarray(e,e+=n);if(r.byteLength<n)throw new Error(fP(n,r.byteLength));let o=We(r,0),i=o(4,Pe,Zn.V1),s=o(6,bl,Qn.NONE),a=o(8,yr,0),c=o(10,Te,0),f;if(a){let l=s===Qn.Schema?sm:s===Qn.DictionaryBatch?ET:s===Qn.RecordBatch?im:null;if(!l)throw new Error(uP(s));if(f=l(r,a,i),c>0){let u=t.subarray(e,e+=c);if(u.byteLength<c)throw new Error(lP(c,u.byteLength));f.body=u}}return{version:i,type:s,index:e,content:f}}function $T(t){let e=t instanceof ArrayBuffer?new Uint8Array(t):t;return e instanceof Uint8Array&&pP(e)?hP(e):dP(e)}function pP(t){if(!t||t.length<4)return!1;for(let e=0;e<6;++e)if(gl[e]!==t[e])return!1;return!0}function dP(t){let e=[t].flat(),n,r=[],o=[];for(let i of e){if(!(i instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=am(i,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case Qn.Schema:n||(n=a.content);break;case Qn.RecordBatch:r.push(a.content);break;case Qn.DictionaryBatch:o.push(a.content);break}}}return{schema:n,dictionaries:o,records:r,metadata:null}}function hP(t){let e=t.byteLength-(gl.length+4),n=zt(t,e),r=We(t,e-n),o=r(4,Pe,Zn.V1),i=r(8,kb,[]),s=r(10,kb,[]);return{schema:r(6,(a,c)=>sm(a,c,o)),dictionaries:i.map(({offset:a})=>am(t,a).content),records:s.map(({offset:a})=>am(t,a).content),metadata:r(12,El)}}function Rb(t,e){return mP($T(t),e)}function mP(t,e={}){let{schema:n={fields:[]},dictionaries:r,records:o}=t,{version:i,fields:s}=n,a=new Map,c=yP(e,i,a),f=new Map;gP(n,p=>{let d=p.type;d.typeId===z.Dictionary&&f.set(d.id,d.dictionary)});let l=new Map;for(let p of r){let{id:d,data:h,isDelta:m,body:g}=p,y=f.get(d),x=Ob(y,c({...h,body:g}));if(l.has(d)){let b=l.get(d);m||b.clear(),b.add(x)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");l.set(d,Cb(y).add(x))}}l.forEach((p,d)=>a.set(d,p.done()));let u=s.map(p=>Cb(p.type));for(let p of o){let d=c(p);s.forEach((h,m)=>u[m].add(Ob(h.type,d)))}return new cc(n,u.map(p=>p.done()),e.useProxy)}function gP(t,e){t.fields.forEach(function n(r){e(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function yP(t,e,n){let r={version:e,options:t,dictionary:o=>n.get(o)};return o=>{let{length:i,nodes:s,regions:a,variadic:c,body:f}=o,l=-1,u=-1,p=-1;return{...r,length:i,node:()=>s[++l],buffer:d=>{let{length:h,offset:m}=a[++u];return d?new d(f.buffer,f.byteOffset+m,h/d.BYTES_PER_ELEMENT):f.subarray(m,m+h)},variadic:()=>c[++p],visit(d){return d.map(h=>Ob(h.type,this))}}}}function Ob(t,e){let{typeId:n}=t,{length:r,options:o,node:i,buffer:s,variadic:a,version:c}=e,f=Tl(t,o);if(n===z.Null)return new f({length:r,nullCount:r,type:t});let l={...i(),type:t};switch(n){case z.Bool:case z.Int:case z.Time:case z.Duration:case z.Float:case z.Decimal:case z.Date:case z.Timestamp:case z.Interval:case z.FixedSizeBinary:return new f({...l,validity:s(),values:s(t.values)});case z.Utf8:case z.LargeUtf8:case z.Binary:case z.LargeBinary:return new f({...l,validity:s(),offsets:s(t.offsets),values:s()});case z.BinaryView:case z.Utf8View:return new f({...l,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case z.List:case z.LargeList:case z.Map:return new f({...l,validity:s(),offsets:s(t.offsets),children:e.visit(t.children)});case z.ListView:case z.LargeListView:return new f({...l,validity:s(),offsets:s(t.offsets),sizes:s(t.offsets),children:e.visit(t.children)});case z.FixedSizeList:case z.Struct:return new f({...l,validity:s(),children:e.visit(t.children)});case z.RunEndEncoded:return new f({...l,children:e.visit(t.children)});case z.Dictionary:{let{id:u,indices:p}=t;return new f({...l,validity:s(),values:s(p.values)}).setDictionary(e.dictionary(u))}case z.Union:return c<Zn.V5&&s(),new f({...l,typeIds:s(yl),offsets:t.mode===Eo.Sparse?null:s(t.offsets),children:e.visit(t.children)});default:throw new Error(Io(n))}}var yK=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function Il(t){return Rb(t,{useDate:!0})}function cm(t="ws://localhost:3000/"){let e=[],n=!1,r=null,o,i={open(){n=!0,c()},close(){for(n=!1,r=null,o=null;e.length;)e.shift().reject("Socket closed")},error(f){if(r){let{reject:l}=r;r=null,c(),l(f)}else console.error("WebSocket error: ",f)},message({data:f}){if(r){let{query:l,resolve:u,reject:p}=r;if(r=null,c(),typeof f=="string"){let d=JSON.parse(f);d.error?p(d.error):u(d)}else if(l.type==="exec")u();else if(l.type==="arrow")u(Il(f));else throw new Error(`Unexpected socket data: ${f}`)}else console.log("WebSocket message: ",f)}};function s(){o=new WebSocket(t),o.binaryType="arraybuffer";for(let f in i)o.addEventListener(f,i[f])}function a(f,l,u){o==null&&s(),e.push({query:f,resolve:l,reject:u}),n&&!r&&c()}function c(){e.length&&(r=e.shift(),o.send(JSON.stringify(r.query)))}return{get connected(){return n},query(f){return new Promise((l,u)=>a(f,l,u))}}}var An=class{constructor(e,n){e&&(this.table=String(e)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:e,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${e?`${DT(e)}.`:""}${r}`}else return e?DT(e):"NULL"}};function DT(t){return t.split(".").map(n=>`"${n}"`).join(".")}function PT(t,e){return t instanceof An&&t.column===e}function _t(t){return typeof t=="string"?Ii(t):t}function Ds(t){return typeof t=="string"?FT(t):t}function FT(t){return new An(t)}function Ii(t,e=null){return arguments.length===1&&(e=t,t=null),new An(t,e)}function Lr(t){switch(typeof t){case"boolean":return t?"TRUE":"FALSE";case"string":return`'${t.replace("'","''")}'`;case"number":return Number.isFinite(t)?String(t):"NULL";default:if(t==null)return"NULL";if(t instanceof Date){let e=+t;if(Number.isNaN(e))return"NULL";let n=t.getUTCFullYear(),r=t.getUTCMonth(),o=t.getUTCDate();return e===Date.UTC(n,r,o)?`MAKE_DATE(${n}, ${r+1}, ${o})`:`EPOCH_MS(${e})`}else return t instanceof RegExp?`'${t.source}'`:String(t)}}var Co=t=>typeof t?.addEventListener=="function";function fm(t){return t instanceof ko}var ko=class{constructor(e,n,r){this._expr=Array.isArray(e)?e:[e],this._deps=n||[],this.annotate(r);let o=this._expr.filter(i=>Co(i));o.length>0?(this._params=Array.from(new Set(o)),this._params.forEach(i=>{i.addEventListener("value",()=>BP(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:e,_deps:n}=this;if(e){let r=new Set(e.flatMap(o=>{let i=o.value?.columns;return Array.isArray(i)?i:[]}));if(r.size){let o=new Set(n);return r.forEach(i=>o.add(i)),Array.from(o)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...e){return Object.assign(this,...e)}toString(){return this._expr.map(e=>Co(e)&&!fm(e)?Lr(e.value):e).join("")}addEventListener(e,n){let r=this.map||(this.map=new Map);(r.get(e)||(r.set(e,new Set),r.get(e))).add(n)}};function BP(t,e){if(e?.size)return Promise.allSettled(Array.from(e,n=>n(t)))}function Lb(t,e){let n=[t[0]],r=new Set,o=e.length;for(let i=0,s=0;i<o;){let a=e[i];Co(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(f=>r.add(f)),n[s]+=typeof a=="string"?a:Lr(a));let c=t[++i];Co(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function U(t,...e){let{spans:n,cols:r}=Lb(t,e);return new ko(n,r)}function Db(t){let e=_t(t);return U`${e} DESC NULLS LAST`.annotate({label:e?.label,desc:!0})}var Ps=t=>({value:t,toString:()=>Lr(t)});function $l(t){t(this.op,this),this.children?.forEach(e=>e.visit(t))}function qT(t,e){let n=e.filter(o=>o!=null).map(_t),r=n.map((o,i)=>i?` ${t} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),U(r,...n).annotate({op:t,children:n,visit:$l})}var Tn=(...t)=>qT("AND",t.flat()),Fs=(...t)=>qT("OR",t.flat()),zP=t=>e=>U`(${t} ${_t(e)})`.annotate({op:t,a:e,visit:$l}),Pb=zP("NOT"),BT=t=>e=>U`(${_t(e)} ${t})`.annotate({op:t,a:e,visit:$l}),qs=BT("IS NULL"),No=BT("IS NOT NULL"),$i=t=>(e,n)=>U`(${_t(e)} ${t} ${_t(n)})`.annotate({op:t,a:e,b:n,visit:$l}),Fb=$i("="),Bs=$i("<>"),Oo=$i("<"),Cl=$i(">"),Ro=$i("<="),qb=$i(">="),Bb=$i("IS DISTINCT FROM"),fc=$i("IS NOT DISTINCT FROM");function zT(t,e,n,r){e=_t(e);let o=t.startsWith("NOT ")?"NOT ":"";return(n?r?U`${o}(${n[0]} <= ${e} AND ${e} < ${n[1]})`:U`(${e} ${t} ${n[0]} AND ${n[1]})`:U``).annotate({op:t,visit:$l,field:e,range:n})}var ue=(t,e,n)=>zT("BETWEEN",t,e,n),zb=(t,e,n)=>zT("NOT BETWEEN",t,e,n);function zs(t,e){return Array.from({length:t},()=>e)}function Fe(t,e){return(...n)=>{let r=n.map(_t),o=e?`::${e}`:"";return(r.length?U([`${t}(`,...zs(r.length-1,", "),`)${o}`],...r):U`${t}()${o}`).annotate({func:t,args:r})}}var Yb=Fe("REGEXP_MATCHES"),Ub=Fe("CONTAINS"),jb=Fe("PREFIX"),Xb=Fe("SUFFIX"),YP=Fe("LOWER"),UP=Fe("UPPER"),jP=Fe("LENGTH"),XP=Fe("ISNAN"),GP=Fe("ISFINITE"),VP=Fe("ISINF");var kl=class t extends ko{constructor(e,n,r,o,i="",s="",a=""){let c;if(o&&!(i||s||a))c=o?U`${n} OVER "${o}"`:U`${n} OVER ()`;else{let p=i&&s?" ":"",d=(i||s)&&a?" ":"";c=U`${n} OVER (${o?`"${o}" `:""}${i}${p}${s}${d}${a})`}r&&(c=U`(${c})::${r}`);let{_expr:l,_deps:u}=c;super(l,u),this.window=e,this.func=n,this.type=r,this.name=o,this.group=i,this.order=s,this.frame=a}get basis(){return this.column}get label(){let{func:e}=this;return e.label??e.toString()}over(e){let{window:n,func:r,type:o,group:i,order:s,frame:a}=this;return new t(n,r,o,e,i,s,a)}partitionby(...e){let n=e.flat().filter(l=>l).map(_t),r=U(["PARTITION BY ",zs(n.length-1,", "),""],...n),{window:o,func:i,type:s,name:a,order:c,frame:f}=this;return new t(o,i,s,a,r,c,f)}orderby(...e){let n=e.flat().filter(l=>l).map(_t),r=U(["ORDER BY ",zs(n.length-1,", "),""],...n),{window:o,func:i,type:s,name:a,group:c,frame:f}=this;return new t(o,i,s,a,c,r,f)}rows(e){let n=YT("ROWS",e),{window:r,func:o,type:i,name:s,group:a,order:c}=this;return new t(r,o,i,s,a,c,n)}range(e){let n=YT("RANGE",e),{window:r,func:o,type:i,name:s,group:a,order:c}=this;return new t(r,o,i,s,a,c,n)}};function YT(t,e){if(Co(e)){let n=U`${e}`;return n.toString=()=>`${t} ${UT(e.value)}`,n}return`${t} ${UT(e)}`}function UT(t){let[e,n]=t,r=e===0?"CURRENT ROW":Number.isFinite(e)?`${Math.abs(e)} PRECEDING`:"UNBOUNDED PRECEDING",o=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${o}`}function xr(t,e){return(...n)=>{let r=Fe(t)(...n);return new kl(t,r,e)}}var Gb=xr("ROW_NUMBER","INTEGER"),Vb=xr("RANK","INTEGER"),Wb=xr("DENSE_RANK","INTEGER"),Hb=xr("PERCENT_RANK"),Zb=xr("CUME_DIST"),Qb=xr("NTILE"),Jb=xr("LAG"),Kb=xr("LEAD"),t2=xr("FIRST_VALUE"),e2=xr("LAST_VALUE"),n2=xr("NTH_VALUE");function Mt(t,...e){return U(t,...e).annotate({aggregate:!0})}var r2=class t extends ko{constructor(e,n,r,o,i){n=(n||[]).map(_t);let{strings:s,exprs:a}=WP(e,n,r,o,i),{spans:c,cols:f}=Lb(s,a);super(c,f),this.aggregate=e,this.args=n,this.type=r,this.isDistinct=o,this.filter=i}get basis(){return this.column}get label(){let{aggregate:e,args:n,isDistinct:r}=this,o=r?"DISTINCT"+(n.length?" ":""):"",i=n.length?`(${o}${n.map(HP).join(", ")})`:"";return`${e.toLowerCase()}${i}`}distinct(){let{aggregate:e,args:n,type:r,filter:o}=this;return new t(e,n,r,!0,o)}where(e){let{aggregate:n,args:r,type:o,isDistinct:i}=this;return new t(n,r,o,i,e)}window(){let{aggregate:e,args:n,type:r,isDistinct:o}=this,i=new t(e,n,null,o);return new kl(e,i,r)}partitionby(...e){return this.window().partitionby(...e)}orderby(...e){return this.window().orderby(...e)}rows(e){return this.window().rows(e)}range(e){return this.window().range(e)}};function WP(t,e,n,r,o){let i=`)${n?`::${n}`:""}`,s=[`${t}(${r?"DISTINCT ":""}`],a=[];return e.length?(s=s.concat([...zs(e.length-1,", "),`${i}${o?" FILTER (WHERE ":""}`,...o?[")"]:[]]),a=[...e,...o?[o]:[]]):s[0]+="*"+i,{exprs:a,strings:s}}function HP(t){let e=Lr(t);return e&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function $t(t,e){return(...n)=>new r2(t,n,e)}var sn=$t("COUNT","INTEGER"),Nl=$t("AVG"),ZP=$t("AVG"),o2=$t("MAD"),Kn=$t("MAX"),tr=$t("MIN"),Ln=$t("SUM","DOUBLE"),i2=$t("PRODUCT"),s2=$t("MEDIAN"),a2=$t("QUANTILE"),c2=$t("MODE"),f2=$t("VARIANCE"),Ol=$t("STDDEV"),l2=$t("SKEWNESS"),u2=$t("KURTOSIS"),p2=$t("ENTROPY"),d2=$t("VAR_POP"),h2=$t("STDDEV_POP"),m2=$t("CORR"),g2=$t("COVAR_SAMP"),y2=$t("COVAR_POP"),x2=$t("REGR_INTERCEPT"),b2=$t("REGR_SLOPE"),w2=$t("REGR_COUNT"),QP=$t("REGR_R2"),v2=$t("REGR_SYY"),_2=$t("REGR_SXX"),JP=$t("REGR_SXY"),S2=$t("REGR_AVGX"),KP=$t("REGR_AVGY"),M2=$t("FIRST"),A2=$t("LAST"),lc=$t("ARG_MIN"),uc=$t("ARG_MAX"),T2=$t("STRING_AGG"),E2=$t("ARRAY_AGG");function Rl(t,e){let n=_t(t),r=U`CAST(${n} AS ${e})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return t.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return t.aggregate||!1}}),r}var pc=t=>Rl(t,"DOUBLE"),I2=t=>Rl(t,"INTEGER");var $2=t=>U`epoch_ms(${_t(t)})`;function C2(t,e,n=1){let r=`INTERVAL ${n} ${e}`,o=_t(t);return U`TIME_BUCKET(${r}, ${o})`.annotate({label:e})}var k2=t=>{let e=_t(t);return U`MAKE_DATE(2012, MONTH(${e}), 1)`.annotate({label:"month"})},N2=t=>{let e=_t(t);return U`MAKE_DATE(2012, MONTH(${e}), DAY(${e}))`.annotate({label:"date"})},O2=t=>{let e=_t(t);return U`MAKE_DATE(2012, 1, DAY(${e}))`.annotate({label:"date"})};var Ll=Fe("ST_AsGeoJSON"),jT=Fe("ST_X"),XT=Fe("ST_Y"),Dl=Fe("ST_CENTROID"),R2=t=>jT(Dl(t)),L2=t=>XT(Dl(t));var ft=class t{static select(...e){return new t().select(...e)}static from(...e){return new t().from(...e)}static with(...e){return new t().with(...e)}static union(...e){return new Ys("UNION",e.flat())}static unionAll(...e){return new Ys("UNION ALL",e.flat())}static intersect(...e){return new Ys("INTERSECT",e.flat())}static except(...e){return new Ys("EXCEPT",e.flat())}static describe(e){let n=e.clone(),{clone:r,toString:o}=n;return Object.assign(n,{describe:!0,clone:()=>t.describe(r.call(n)),toString:()=>`DESCRIBE ${o.call(n)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}clone(){let e=new t;return e.query={...this.query},e}with(...e){let{query:n}=this;if(e.length===0)return n.with;{let r=[],o=(i,s)=>{let a=s.clone();a.cteFor=this,r.push({as:i,query:a})};return e.flat().forEach(i=>{if(i!=null)if(i.as&&i.query)o(i.as,i.query);else for(let s in i)o(s,i[s])}),n.with=n.with.concat(r),this}}select(...e){let{query:n}=this;if(e.length===0)return n.select;{let r=[];for(let i of e.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:_t(i)});else if(i instanceof An)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let s in i)r.push({as:lm(s),expr:_t(i[s])});let o=new Set(r.map(i=>i.as));return n.select=n.select.filter(i=>!o.has(i.as)).concat(r.filter(i=>i.expr)),this}}$select(...e){return this.query.select=[],this.select(...e)}distinct(e=!0){return this.query.distinct=!!e,this}from(...e){let{query:n}=this;if(e.length===0)return n.from;{let r=[];return e.flat().forEach(o=>{if(o!=null)if(typeof o=="string")r.push({as:o,from:Ds(o)});else if(o instanceof An)r.push({as:o.table,from:o});else if(Pl(o)||fm(o))r.push({from:o});else if(Array.isArray(o))r.push({as:lm(o[0]),from:Ds(o[1])});else for(let i in o)r.push({as:lm(i),from:Ds(o[i])})}),n.from=n.from.concat(r),this}}$from(...e){return this.query.from=[],this.from(...e)}sample(e,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let o=e;return typeof e=="number"&&(o=e>0&&e<1?{perc:100*e,method:n}:{rows:Math.round(e),method:n}),r.sample=o,this}}where(...e){let{query:n}=this;return e.length===0?n.where:(n.where=n.where.concat(e.flat().filter(r=>r)),this)}$where(...e){return this.query.where=[],this.where(...e)}groupby(...e){let{query:n}=this;return e.length===0?n.groupby:(n.groupby=n.groupby.concat(e.flat().filter(r=>r).map(_t)),this)}$groupby(...e){return this.query.groupby=[],this.groupby(...e)}having(...e){let{query:n}=this;return e.length===0?n.having:(n.having=n.having.concat(e.flat().filter(r=>r)),this)}window(...e){let{query:n}=this;if(e.length===0)return n.window;{let r=[];return e.flat().forEach(o=>{if(o!=null)for(let i in o)r.push({as:lm(i),expr:o[i]})}),n.window=n.window.concat(r),this}}qualify(...e){let{query:n}=this;return e.length===0?n.qualify:(n.qualify=n.qualify.concat(e.flat().filter(r=>r)),this)}orderby(...e){let{query:n}=this;return e.length===0?n.orderby:(n.orderby=n.orderby.concat(e.flat().filter(r=>r).map(_t)),this)}limit(e){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(e)?e:void 0,this)}offset(e){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(e)?e:void 0,this)}get subqueries(){let{query:e,cteFor:n}=this,o=(n?.query||e).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),i=[];return e.from.forEach(({from:s})=>{if(Pl(s))i.push(s);else if(o[s.table]){let a=o[s.table];i.push(a)}}),i}toString(){let{with:e,select:n,distinct:r,from:o,sample:i,where:s,groupby:a,having:c,window:f,qualify:l,orderby:u,limit:p,offset:d}=this.query,h=[];if(e.length){let g=e.map(({as:y,query:x})=>`"${y}" AS (${x})`);h.push(`WITH ${g.join(", ")}`)}let m=n.map(({as:g,expr:y})=>PT(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(h.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),o.length){let g=o.map(({as:y,from:x})=>{let b=Pl(x)?`(${x})`:`${x}`;return!y||y===x.table?b:`${b} AS "${y}"`});h.push(`FROM ${g.join(", ")}`)}if(s.length){let g=s.map(String).filter(y=>y).join(" AND ");g&&h.push(`WHERE ${g}`)}if(i){let{rows:g,perc:y,method:x,seed:b}=i,w=g?`${g} ROWS`:`${y} PERCENT`,_=x?` (${x}${b!=null?`, ${b}`:""})`:"";h.push(`USING SAMPLE ${w}${_}`)}if(a.length&&h.push(`GROUP BY ${a.join(", ")}`),c.length){let g=c.map(String).filter(y=>y).join(" AND ");g&&h.push(`HAVING ${g}`)}if(f.length){let g=f.map(({as:y,expr:x})=>`"${y}" AS (${x})`);h.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(y=>y).join(" AND ");g&&h.push(`QUALIFY ${g}`)}return u.length&&h.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(p)&&h.push(`LIMIT ${p}`),Number.isFinite(d)&&h.push(`OFFSET ${d}`),h.join(" ")}},Ys=class t{constructor(e,n){this.op=e,this.queries=n.map(r=>r.clone()),this.query={orderby:[]},this.cteFor=null}clone(){let e=new t(this.op,this.queries);return e.query={...this.query},e}orderby(...e){let{query:n}=this;return e.length===0?n.orderby:(n.orderby=n.orderby.concat(e.flat().filter(r=>r).map(_t)),this)}limit(e){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(e)?e:void 0,this)}offset(e){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(e)?e:void 0,this)}get subqueries(){let{queries:e,cteFor:n}=this;return n&&e.forEach(r=>r.cteFor=n),e}toString(){let{op:e,queries:n,query:{orderby:r,limit:o,offset:i}}=this,s=[n.join(` ${e} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(o)&&s.push(`LIMIT ${o}`),Number.isFinite(i)&&s.push(`OFFSET ${i}`),s.join(" ")}};function Pl(t){return t instanceof ft||t instanceof Ys}function D2(t){return Pl(t)&&t.describe}function lm(t){return tF(t)?t.slice(1,-1):t}function tF(t){return t[0]==='"'&&t[t.length-1]==='"'}var um=t=>t;function GT(){return{apply:um,invert:um,sqlApply:_t,sqlInvert:um}}function eF({base:t=null}={}){if(t==null||t===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:e=>U`LN(${_t(e)})`,sqlInvert:e=>U`EXP(${e})`};if(t===10)return{apply:Math.log10,invert:e=>Math.pow(10,e),sqlApply:e=>U`LOG(${_t(e)})`,sqlInvert:e=>U`POW(10, ${e})`};{let e=+t;return{apply:n=>Math.log(n)/Math.log(e),invert:n=>Math.pow(e,n),sqlApply:n=>U`LN(${_t(n)}) / LN(${e})`,sqlInvert:n=>U`POW(${e}, ${n})`}}}function nF({constant:t=1}={}){let e=+t;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-e),sqlApply:n=>(n=_t(n),U`SIGN(${n}) * LN(${e} + ABS(${n}))`),sqlInvert:n=>U`SIGN(${n}) * (EXP(ABS(${n})) - ${e})`}}function rF(){return{apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*t*t,sqlApply:t=>(t=_t(t),U`SIGN(${t}) * SQRT(ABS(${t}))`),sqlInvert:t=>U`SIGN(${t}) * (${t}) ** 2`}}function oF({exponent:t=1}={}){let e=+t;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),e),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/e),sqlApply:n=>(n=_t(n),U`SIGN(${n}) * POW(ABS(${n}), ${e})`),sqlInvert:n=>U`SIGN(${n}) * POW(ABS(${n}), 1/${e})`}}function VT(){return{apply:t=>+t,invert:t=>new Date(t),sqlApply:t=>t instanceof Date?+t:$2(_t(t)),sqlInvert:um}}var iF={identity:GT,linear:GT,log:eF,symlog:nF,sqrt:rF,pow:oF,time:VT,utc:VT};function Fl(t){let e=iF[t.type];return e?{...t,...e(t)}:null}function Dr(t,e,{replace:n=!1,temp:r=!0,view:o=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(o?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+t+" AS "+e}function ql(t){return`INSTALL ${t}; LOAD ${t}`}function WT(t,{columns:e=Object.keys(t?.[0]||{})}={}){let n=[];if(Array.isArray(e)?(n=e,e=n.reduce((o,i)=>(o[i]=i,o),{})):e&&(n=Object.keys(e)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let o of t){let i=n.map(s=>`${Lr(o[s])} AS "${e[s]}"`);r.push(`(SELECT ${i.join(", ")})`)}return r.join(" UNION ALL ")}function pm(t,e,n,r={},o={}){let{select:i=["*"],where:s,view:a,temp:c,replace:f,...l}=r,u=sF({...o,...l}),p=`${t}('${n}'${u?", "+u:""})`,d=s?` WHERE ${s}`:"",h=`SELECT ${i.join(", ")} FROM ${p}${d}`;return Dr(e,h,{view:a,temp:c,replace:f})}function F2(t,e,n){return pm("read_csv",t,e,n,{auto_detect:!0,sample_size:-1})}function q2(t,e,n){return pm("read_json",t,e,n,{auto_detect:!0,json_format:"auto"})}function B2(t,e,n){return pm("read_parquet",t,e,n)}function z2(t,e,n={}){let{options:r,...o}=n;if(r){let i=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(o,{open_options:i.toUpperCase()})}return pm("st_read",t,e,o)}function Y2(t,e,n={}){let{select:r=["*"],...o}=n,i=WT(e),s=r.length===1&&r[0]==="*"?i:`SELECT ${r} FROM ${i}`;return Dr(t,s,o)}function sF(t){return Object.entries(t).map(([e,n])=>`${e}=${P2(n)}`).join(", ")}function P2(t){switch(typeof t){case"boolean":return String(t);case"string":return`'${t}'`;case"undefined":case"object":return t==null?"NULL":Array.isArray(t)?"["+t.map(e=>P2(e)).join(", ")+"]":"{"+Object.entries(t).map(([e,n])=>`'${e}': ${P2(n)}`).join(", ")+"}";default:return t}}function ZT(t){if(!t.filterIndexable)return null;let e=t.query(),n=mm(e,a=>a.from()?.[0].from.table);if(typeof n!="string"||!e.select)return null;let r=[],o=[],i={},s=a=>{let c=a.column;return`(SELECT AVG(${mm(e,l=>l.select().find(u=>u.as===c)?.expr)??a}) FROM "${n}")`};for(let a of e.select()){let{as:c,expr:{aggregate:f,args:l}}=a,u=f?.toUpperCase?.();switch(u){case"COUNT":case"SUM":r.push({[c]:Mt`SUM("${c}")::DOUBLE`});break;case"AVG":r.push({[c]:cF(i,c,l[0])});break;case"ARG_MAX":r.push({[c]:fF(i,c,l)});break;case"ARG_MIN":r.push({[c]:lF(i,c,l)});break;case"VARIANCE":case"VAR_SAMP":i[c]=null,r.push({[c]:dm(i,l[0],s)});break;case"VAR_POP":i[c]=null,r.push({[c]:dm(i,l[0],s,!1)});break;case"STDDEV":case"STDDEV_SAMP":i[c]=null,r.push({[c]:Mt`SQRT(${dm(i,l[0],s)})`});break;case"STDDEV_POP":i[c]=null,r.push({[c]:Mt`SQRT(${dm(i,l[0],s,!1)})`});break;case"COVAR_SAMP":i[c]=null,r.push({[c]:hm(i,l,s)});break;case"COVAR_POP":i[c]=null,r.push({[c]:hm(i,l,s,!1)});break;case"CORR":i[c]=null,r.push({[c]:HT(i,l,s)});break;case"REGR_COUNT":i[c]=null,r.push({[c]:Mt`${dc(i,l)}::DOUBLE`});break;case"REGR_AVGX":i[c]=null,r.push({[c]:KT(i,l)});break;case"REGR_AVGY":i[c]=null,r.push({[c]:tE(i,l)});break;case"REGR_SYY":i[c]=null,r.push({[c]:j2(i,0,l,s)});break;case"REGR_SXX":i[c]=null,r.push({[c]:j2(i,1,l,s)});break;case"REGR_SXY":i[c]=null,r.push({[c]:hm(i,l,s,null)});break;case"REGR_SLOPE":i[c]=null,r.push({[c]:eE(i,l,s)});break;case"REGR_INTERCEPT":i[c]=null,r.push({[c]:uF(i,l,s)});break;case"REGR_R2":i[c]=null,r.push({[c]:Mt`(${HT(i,l,s)}) ** 2`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":r.push({[c]:Mt`${u}("${c}")`});break;default:if(!f)o.push(c);else return null}}return r.length?{from:n,dims:o,aggr:r,aux:i}:null}function br(t,...e){let n=e.length?"_"+e.map(aF).join("_"):"";return`__${t}${n}__`}function aF(t){return`${t}`.replaceAll('"',"").replaceAll(" ","_")}function mm(t,e){let n=t.subqueries;if(t.select&&n.length===0)return e(t);let r=mm(n[0],e);for(let o=1;o<n.length;++o){let i=mm(n[o],e);if(i!==void 0&&i!==r)return NaN}return r}function QT(t,e){let n=br("count",e);return t[n]=Mt`COUNT(${e})`,Mt`SUM(${n})`.annotate({name:n})}function cF(t,e,n){let r=QT(t,n);return Mt`(SUM("${e}" * ${r.name}) / ${r})`}function fF(t,e,[,n]){let r=br("max",n);return t[r]=Mt`MAX(${n})`,Mt`ARG_MAX("${e}", ${r})`}function lF(t,e,[,n]){let r=br("min",n);return t[r]=Mt`MIN(${n})`,Mt`ARG_MIN("${e}", ${r})`}function dm(t,e,n,r=!0){let o=QT(t,e),i=br("rssq",e),s=br("rsum",e),a=U`${e} - ${n(e)}`;return t[i]=Mt`SUM((${a}) ** 2)`,t[s]=Mt`SUM(${a})`,Mt`(SUM(${i}) - (SUM(${s}) ** 2 / ${o})) / (${o}${r?" - 1":""})`}function hm(t,e,n,r=!0){let o=dc(t,e),i=JT(t,e,n),s=Bl(t,1,e,n),a=Bl(t,0,e,n),c=r===null?"":r?` / (${o} - 1)`:` / ${o}`;return Mt`(${i} - ${s} * ${a} / ${o})${c}`}function HT(t,e,n){let r=dc(t,e),o=JT(t,e,n),i=U2(t,1,e,n),s=U2(t,0,e,n),a=Bl(t,1,e,n),c=Bl(t,0,e,n),f=Mt`(${i} - (${a} ** 2) / ${r})`,l=Mt`(${s} - (${c} ** 2) / ${r})`;return Mt`(${o} - ${a} * ${c} / ${r}) / SQRT(${f} * ${l})`}function dc(t,[e,n]){let r=br("count",e,n);return t[r]=Mt`REGR_COUNT(${e}, ${n})`,Mt`SUM(${r})`.annotate({name:r})}function Bl(t,e,n,r){let o=n[e],i=n[1-e],s=br("rs",o);return t[s]=Mt`SUM(${o} - ${r(o)}) FILTER (${i} IS NOT NULL)`,Mt`SUM(${s})`}function U2(t,e,n,r){let o=n[e],i=n[1-e],s=br("rss",o);return t[s]=Mt`SUM((${o} - ${r(o)}) ** 2) FILTER (${i} IS NOT NULL)`,Mt`SUM(${s})`}function JT(t,e,n){let[r,o]=e,i=br("sxy",r,o);return t[i]=Mt`SUM((${o} - ${n(o)}) * (${r} - ${n(r)}))`,Mt`SUM(${i})`}function KT(t,e){let[n,r]=e,o=dc(t,e),i=br("avg",r,n);return t[i]=Mt`REGR_AVGX(${n}, ${r})`,Mt`(SUM(${i} * ${o.name}) / ${o})`}function tE(t,e){let[n,r]=e,o=dc(t,e),i=br("avg",n,r);return t[i]=Mt`REGR_AVGY(${n}, ${r})`,Mt`(SUM(${i} * ${o.name}) / ${o})`}function j2(t,e,n,r){let o=dc(t,n),i=Bl(t,e,n,r),s=U2(t,e,n,r);return Mt`(${s} - (${i} ** 2 / ${o}))`}function eE(t,e,n){let r=hm(t,e,n,null),o=j2(t,1,e,n);return Mt`(${r}) / ${o}`}function uF(t,e,n){let r=KT(t,e),o=tE(t,e),i=eE(t,e,n);return Mt`${o} - (${i}) * ${r}`}function rE(t){let e=2166136261;for(let n=0,r=t.length;n<r;++n){let o=t.charCodeAt(n),i=o&65280;i&&(e=nE(e^i>>8)),e=nE(e^o&255)}return pF(e)}function nE(t){return t+(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}function pF(t){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,t&4294967295}var dF={skip:!0,result:null},gm=class{constructor(e,{schema:n="mosaic",enabled:r=!0}={}){this.indexes=new Map,this.active=null,this.mc=e,this._schema=n,this._enabled=r}set enabled(e){this._enabled!==e&&(e||this.clear(),this._enabled=e)}get enabled(){return this._enabled}set schema(e){this._schema!==e&&(this.clear(),this._schema=e)}get schema(){return this._schema}dropIndexTables(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.indexes.clear(),this.active=null}index(e,n,r){if(!this.enabled)return null;let{indexes:o,mc:i,schema:s}=this,{source:a}=r;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=hF(r),c.source===null))return null;if(o.has(e))return o.get(e);let f=ZT(e),l;if(!f)l=null;else if(n.skip(e,r))l=dF;else{let u=n.remove(a).predicate(e);l=yF(e.query(u),c,f,s),l.result=i.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,Dr(l.table,l.create,{temp:!1})]),l.result.catch(p=>i.logger().error(p))}return o.set(e,l),l}};function hF(t){let{source:e,meta:n}=t,r=t.predicate,o=r?.columns,i,s;if(!n||!o)return{source:null,columns:s,predicate:i};let{type:a,scales:c,bin:f,pixelSize:l=1}=n;if(a==="point")i=u=>u,s=Object.fromEntries(o.map(u=>[`${u}`,_t(u)]));else if(a==="interval"&&c){let u=c.map(p=>gF(p,l,f));u.some(p=>!p)||(u.length===1?(i=p=>p?ue("active0",p.range.map(u[0])):[],s={active0:u[0](r.field)}):(i=p=>p?Tn(p.children.map(({range:d},h)=>ue(`active${h}`,d.map(u[h])))):[],s=Object.fromEntries(r.children.map((p,d)=>[`active${d}`,u[d](p.field)]))))}return{source:s?e:null,columns:s,predicate:i}}var mF={ceil:"CEIL",round:"ROUND"};function gF(t,e,n){let{type:r,domain:o,range:i,apply:s,sqlApply:a}=Fl(t);if(!s)return;let c=mF[`${n}`.toLowerCase()]||"FLOOR",f=s(Math.min(...o)),l=s(Math.max(...o)),u=r==="identity"?1:Math.abs(i[1]-i[0])/(l-f),p=u/e===1?"":`${u/e}::DOUBLE * `,d=f===0?"":` - ${f}::DOUBLE`;return h=>U`${c}(${p}(${a(h)}${d}))::INTEGER`}function yF(t,e,n,r){let{dims:o,aggr:i,aux:s}=n,{columns:a}=e,c=t.select({...a,...s}).groupby(Object.keys(a)),[f]=c.subqueries;if(f){let m=Object.values(a).flatMap(g=>g.columns);xF(f,m)}let l=c.orderby();c.query.orderby=[];let u=c.toString(),p=(rE(u)>>>0).toString(16),d=`${r}.cube_${p}`,h=ft.select(o,i).from(d).groupby(o).orderby(l);return new X2({id:p,table:d,create:u,active:e,select:h})}function xF(t,e){let n=new Set,r=o=>{n.has(o)||(n.add(o),o.select&&o.from().length&&o.select(e),o.subqueries.forEach(r))};r(t)}var X2=class{constructor({table:e,create:n,active:r,select:o}={}){this.table=e,this.create=n,this.result=null,this.active=r,this.select=o,this.skip=!1}query(e){return this.select.clone().where(this.active.predicate(e))}};var Us=class extends Promise{constructor(){let e,n;super((r,o)=>{e=r,n=o}),this._resolve=e,this._reject=n}fulfill(e){return this._resolve(e),this}reject(e){return this._reject(e),this}};Us.prototype.constructor=Promise;function bF(t){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(t)}function oE(t,e,n){let r=[],o=0;function i(){let s=wF(r,e);r=[],o=0;for(let a of s)_F(a,t,n),AF(a,e)}return{add(s,a){s.request.type==="arrow"?(o=o||bF(()=>i()),r.push({entry:s,priority:a,index:r.length})):t(s,a)}}}function wF(t,e){let n=[],r=new Map;for(let o of t){let{entry:{request:i}}=o,s=vF(i.query,e);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(o)}return n}function vF(t,e){let n=`${t}`;if(t instanceof ft&&!e.get(n)){if(t.orderby().length||t.where().length||t.qualify().length||t.having().length)return n;let r=t.clone().$select("*"),o=t.groupby();if(o.length){let i={};t.select().forEach(({as:s,expr:a})=>i[s]=a),r.$groupby(o.map(s=>s instanceof An&&i[s.column]||s))}else t.select().some(({expr:i})=>i.aggregate)&&r.$groupby("ALL");return`${r}`}else return n}function _F(t,e,n){if(SF(t))e({request:{type:"arrow",cache:!1,record:!1,query:t.query=MF(t,n)},result:t.result=new Us});else for(let{entry:r,priority:o}of t)e(r,o)}function SF(t){if(t.length>1){let e=`${t[0].entry.request.query}`;for(let n=1;n<t.length;++n)if(e!==`${t[n].entry.request.query}`)return!0}return!1}function MF(t,e){let n=t.maps=[],r=new Map;for(let s of t){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:f,expr:l}of a.select()){let u=`${l}`;r.has(u)||r.set(u,[`col${r.size}`,l]);let[p]=r.get(u);c.push([p,f])}e(`${a}`)}let o=t[0].entry.request.query.clone(),i=o.groupby();if(i.length){let s={};t.maps[0].forEach(([a,c])=>s[c]=a),o.$groupby(i.map(a=>a instanceof An&&s[a.column]||a))}return o.$select(Array.from(r.values()))}async function AF(t,e){let{maps:n,query:r,result:o}=t;if(!n)return;let i;try{i=await o}catch(a){for(let{entry:c}of t)c.result.reject(a);return}let s=D2(r);t.forEach(({entry:a},c)=>{let{request:f,result:l}=a,u=n[c],p=s&&u?EF(i,u):u?TF(i,u):i;f.cache&&e.set(String(f.query),p),l.fulfill(p)})}function TF(t,e){return t.select(e.map(n=>n[0]),e.map(n=>n[1]))}function EF(t,e){let n=new Map(e),r=[];for(let o of t)n.has(o.column_name)&&r.push({...o,column_name:n.get(o.column_name)});return r}var IF=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,iE=()=>({get:()=>{},set:(t,e)=>e,clear:()=>{}});function sE({max:t=1e3,ttl:e=3*60*60*1e3}={}){let n=new Map;function r(){let o=performance.now()-e,i=null,s=1/0;for(let[a,c]of n){let{last:f}=c;f<s&&(i=a,s=f),o>f&&n.delete(a)}i&&n.delete(i)}return{get(o){let i=n.get(o);if(i)return i.last=performance.now(),i.value},set(o,i){return n.set(o,{last:performance.now(),value:i}),n.size>t&&IF(r),i},clear(){n=new Map}}}var ym=class{constructor(e){this.queue=Array.from({length:e},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(e=>!e.head)}insert(e,n){let r=this.queue[n];if(!r)throw new Error(`Invalid queue priority rank: ${n}`);let o={item:e,next:null};r.head===null?r.head=r.tail=o:r.tail=r.tail.next=o}remove(e){for(let n of this.queue){let{head:r,tail:o}=n;for(let i=null,s=r;s;i=s,s=s.next)e(s.item)&&(s===r?r=s.next:i.next=s.next,s===o&&(o=i||r));n.head=r,n.tail=o}}next(){for(let e of this.queue){let{head:n}=e;if(n!==null)return e.head=n.next,e.tail===n&&(e.tail=null),n.item}}};var Pr={High:0,Normal:1,Low:2},xm=class{constructor(){this.queue=new ym(3),this.db=null,this.clientCache=null,this._logger=null,this._logQueries=!1,this.recorders=[],this.pending=null,this._consolidate=null}next(){if(this.pending||this.queue.isEmpty())return;let{request:e,result:n}=this.queue.next();this.pending=this.submit(e,n),this.pending.finally(()=>{this.pending=null,this.next()})}enqueue(e,n=Pr.Normal){this.queue.insert(e,n),this.next()}recordQuery(e){this.recorders.length&&e&&this.recorders.forEach(n=>n.add(e))}async submit(e,n){try{let{query:r,type:o,cache:i=!1,record:s=!0,options:a}=e,c=r?`${r}`:null;if(s&&this.recordQuery(c),i){let u=this.clientCache.get(c);if(u){this._logger.debug("Cache"),n.fulfill(u);return}}let f=performance.now();this._logQueries&&this._logger.debug("Query",{type:o,sql:c,...a});let l=await this.db.query({type:o,sql:c,...a});i&&this.clientCache.set(c,l),this._logger.debug(`Request: ${(performance.now()-f).toFixed(1)}`),n.fulfill(l)}catch(r){n.reject(r)}}cache(e){return e!==void 0?this.clientCache=e===!0?sE():e||iE():this.clientCache}logger(e){return e?this._logger=e:this._logger}logQueries(e){return e!==void 0?this._logQueries=!!e:this._logQueries}connector(e){return e?this.db=e:this.db}consolidate(e){e&&!this._consolidate?this._consolidate=oE(this.enqueue.bind(this),this.clientCache,this.recordQuery.bind(this)):!e&&this._consolidate&&(this._consolidate=null)}request(e,n=Pr.Normal){let r=new Us,o={request:e,result:r};return this._consolidate?this._consolidate.add(o,n):this.enqueue(o,n),r}cancel(e){let n=new Set(e);n.size&&this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1)}clear(){this.queue.remove(({result:e})=>(e.reject("Cleared"),!0))}record(){let e=[],n={add(r){e.push(r)},reset(){e=[]},snapshot(){return e.slice()},stop(){return this.recorders=this.recorders.filter(r=>r!==n),e}};return this.recorders.push(n),n}};function G2(t){switch(t){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(t.startsWith("DECIMAL"))return"number";if(t.startsWith("STRUCT")||t.startsWith("MAP"))return"object";if(t.endsWith("]"))return"array";throw new Error(`Unsupported type: ${t}`)}}var $F="count",CF="nulls",kF="max",NF="min",OF="distinct";var RF={[$F]:sn,[OF]:t=>sn(t).distinct(),[kF]:Kn,[NF]:tr,[CF]:t=>sn().where(qs(t))};function LF(t,e,n){return ft.from(t).select(Array.from(n,r=>[r,RF[r](e)]))}async function aE(t,e){return e.length===1&&`${e[0].column}`=="*"?PF(t,e[0].table):(await Promise.all(e.map(n=>DF(t,n)))).filter(n=>n)}async function DF(t,{table:e,column:n,stats:r}){let o=ft.from({source:e}).select({column:n}).groupby(n.aggregate?U`ALL`:[]),[i]=Array.from(await t.query(ft.describe(o))),s={table:e,column:`${n}`,sqlType:i.column_type,type:G2(i.column_type),nullable:i.null==="YES"};if(!(r?.length||r?.size))return s;let[a]=await t.query(LF(e,n,r),{persist:!0});return Object.assign(s,a)}async function PF(t,e){let n=await t.query(`DESCRIBE ${Ds(e)}`);return Array.from(n).map(r=>({table:e,column:r.column_name,sqlType:r.column_type,type:G2(r.column_type),nullable:r.null==="YES"}))}function cE(){return{debug(){},info(){},log(){},warn(){},error(){}}}var bm;function er(t){return t?bm=t:bm==null&&(bm=new zl),bm}var zl=class{constructor(e=cm(),{logger:n=console,manager:r=new xm,cache:o=!0,consolidate:i=!0,indexes:s={}}={}){this.manager=r,this.manager.cache(o),this.manager.consolidate(i),this.databaseConnector(e),this.logger(n),this.clear(),this.dataCubeIndexer=new gm(this,s)}clear({clients:e=!0,cache:n=!0}={}){this.manager.clear(),e&&(this.filterGroups?.forEach(r=>r.disconnect()),this.filterGroups=new Map,this.clients?.forEach(r=>this.disconnect(r)),this.clients=new Set),n&&this.manager.cache().clear()}databaseConnector(e){return this.manager.connector(e)}logger(e){return arguments.length&&(this._logger=e||cE(),this.manager.logger(this._logger)),this._logger}cancel(e){this.manager.cancel(e)}exec(e,{priority:n=Pr.Normal}={}){return e=Array.isArray(e)?e.filter(r=>r).join(`;
|
|
2
|
-
`):e,this.manager.request({type:"exec",query:e},n)}query(e,{type:n="arrow",cache:r=!0,priority:o=Pr.Normal,...i}={}){return this.manager.request({type:n,query:e,cache:r,options:i},o)}prefetch(e,n={}){return this.query(e,{...n,cache:!0,priority:Pr.Low})}createBundle(e,n,r=Pr.Low){let o={name:e,queries:n.map(i=>typeof i=="string"?{sql:i}:i)};return this.manager.request({type:"create-bundle",options:o},r)}loadBundle(e,n=Pr.High){let r={name:e};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(e,n,r=Pr.Normal){return e.queryPending(),this.query(n,{priority:r}).then(o=>e.queryResult(o).update(),o=>{this._logger.error(o),e.queryError(o)}).catch(o=>this._logger.error(o))}requestQuery(e,n){return this.dataCubeIndexer.clear(),n?this.updateClient(e,n):Promise.resolve(e.update())}async connect(e){let{clients:n}=this;if(n.has(e))throw new Error("Client already connected.");n.add(e),e.coordinator=this,this.initializeClient(e),FF(this,e.filterBy,e)}async initializeClient(e){let n=e.fields();return n?.length&&e.fieldInfo(await aE(this,n)),e.requestQuery()}disconnect(e){let{clients:n,filterGroups:r}=this;if(!n.has(e))return;n.delete(e),e.coordinator=null;let o=r.get(e.filterBy);o&&o.clients.delete(e)}};function FF(t,e,n){if(!e)return;let r=t.filterGroups.get(e);if(!r){let o=s=>qF(t,e,s),i=()=>BF(t,e);e.addEventListener("activate",o),e.addEventListener("value",i),r={selection:e,clients:new Set,disconnect(){e.removeEventListener("activate",o),e.removeEventListener("value",i)}},t.filterGroups.set(e,r)}r.clients.add(n)}function qF(t,e,n){let{dataCubeIndexer:r,filterGroups:o}=t,{clients:i}=o.get(e);for(let s of i)r.index(s,e,n)}function BF(t,e){let{dataCubeIndexer:n,filterGroups:r}=t,{clients:o}=r.get(e),{active:i}=e;return Promise.allSettled(Array.from(o,s=>{let a=n.index(s,e,i),c=a?null:e.predicate(s);if(a?.skip||!a&&!c)return;let f=a?.query(i.predicate)??s.query(c);return t.updateClient(s,f)}))}var wm=class{constructor(){this._callbacks=new Map}addEventListener(e,n){this._callbacks.has(e)||this._callbacks.set(e,{callbacks:new Set,pending:null,queue:new V2}),this._callbacks.get(e).callbacks.add(n)}removeEventListener(e,n){let r=this._callbacks.get(e);r&&r.callbacks.delete(n)}willEmit(e,n){return n}emitQueueFilter(e,n){return null}cancel(e){this._callbacks.get(e)?.queue.clear()}async pending(e){await this._callbacks.get(e)?.pending}emit(e,n){let r=this._callbacks.get(e)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(e,n));else{let o=this.willEmit(e,n),{callbacks:i,queue:s}=r;if(i?.size){let a=Array.from(i,c=>c(o));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(e,s.dequeue())})}}}},V2=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(e,n){let r={value:e};if(n&&this.next){let o=this;for(;o.next;)n(o.next.value)?o=o.next:o.next=o.next.next;o.next=r}else this.next=r}dequeue(){let{next:e}=this;return this.next=e?.next,e?.value}};function Yl(t,e){return t===e?!1:t instanceof Date&&e instanceof Date?+t!=+e:Array.isArray(t)&&Array.isArray(e)?zF(t,e):!0}function zF(t,e){if(t.length!==e.length)return!0;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!0;return!1}function En(t){return t instanceof Ci}var Ci=class t extends wm{constructor(e){super(),this._value=e}static value(e){return new t(e)}static array(e){if(e.some(n=>En(n))){let n=new t,r=()=>{n.update(e.map(o=>En(o)?o.value:o))};return r(),e.forEach(o=>En(o)?o.addEventListener("value",r):0),n}return new t(e)}get value(){return this._value}update(e,{force:n}={}){return Yl(this._value,e)||n?this.emit("value",e):this.cancel("value"),this}willEmit(e,n){return e==="value"&&(this._value=n),n}};function Dn(t){return t instanceof Fr}function vm(t,e){return new Fr(new _m(t),e&&[e].flat())}var Fr=class t extends Ci{static intersect({cross:e=!1,empty:n=!1,include:r=[]}={}){return vm({cross:e,empty:n},r)}static union({cross:e=!1,empty:n=!1,include:r=[]}={}){return vm({cross:e,empty:n,union:!0},r)}static single({cross:e=!1,empty:n=!1,include:r=[]}={}){return vm({cross:e,empty:n,single:!0},r)}static crossfilter({empty:e=!1,include:n=[]}={}){return vm({cross:!0,empty:e},n)}constructor(e=new _m,n=[]){if(super([]),this._resolved=this._value,this._resolver=e,this._relay=new Set,Array.isArray(n))for(let r of n)r._relay.add(this)}clone(){let e=new t(this._resolver);return e._value=e._resolved=this._value,e}remove(e){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:e}),n._value.active={source:e},n}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(e){return this.clauses.find(n=>n.source===e)?.value}activate(e){this.emit("activate",e),this._relay.forEach(n=>n.activate(e))}update(e){return this._resolved=this._resolver.resolve(this._resolved,e,!0),this._resolved.active=e,this._relay.forEach(n=>n.update(e)),super.update(this._resolved)}willEmit(e,n){return e==="value"?(this._value=n,this.value):n}emitQueueFilter(e,n){return e==="value"?this._resolver.queueFilter(n):null}skip(e,n){return this._resolver.skip(e,n)}predicate(e,n=!1){let{clauses:r}=this,o=n?null:r.active;return this._resolver.predicate(r,o,e)}},_m=class{constructor({union:e,cross:n,single:r,empty:o}={}){this.union=!!e,this.cross=!!n,this.single=!!r,this.empty=!!o}resolve(e,n,r=!1){let{source:o,predicate:i}=n,s=e.filter(c=>o!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),i&&a.push(n),a}skip(e,n){return this.cross&&n?.clients?.has(e)}predicate(e,n,r){let{empty:o,union:i}=this;if(o&&!e.length)return["FALSE"];if(this.skip(r,n))return;let s=e.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return i&&s.length>1?Fs(s):s}queueFilter(e){if(this.cross){let n=e.active?.source;return r=>r.active?.source!==n}return null}};function js(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=e!==void 0?fc(t,Ps(e)):null;return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function Xs(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=null;if(e){let i=e.map(s=>{let a=s.map((c,f)=>fc(t[f],Ps(c)));return a.length>1?Tn(a):a[0]});o=i.length>1?Fs(i):i[0]}return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function Gs(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scale:i,pixelSize:s=1}){let a=e!=null?ue(t,e):null;return{meta:{type:"interval",scales:i&&[i],bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}function W2(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scales:i=[],pixelSize:s=1}){let a=e!=null?Tn(t.map((f,l)=>ue(f,e[l]))):null;return{meta:{type:"interval",scales:i,bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}var YF={contains:Ub,prefix:jb,suffix:Xb,regexp:Yb};function H2(t,e,{source:n,clients:r=void 0,method:o="contains"}){let i=YF[o],s=e?i(t,Ps(e)):null;return{meta:{type:"match",method:o},source:n,clients:r,value:e,predicate:s}}function Z2(t){return typeof t?.getChild=="function"}function Q2(){let t=new Set,e,n=new Promise(r=>e=r);return{pending(r){t.add(r)},ready(r){return t.delete(r),t.size===0},resolve(){n=new Promise(r=>{e(),e=r})},get promise(){return n}}}function In(t){return Z2(t)?UF(t):jF(t)}function UF(t){let{numRows:e}=t;return{numRows:e,columns:t.toColumns()}}function jF(t){let e=t.length;if(typeof t[0]=="object"){let n=e?Object.keys(t[0]):[],r={};return n.length>0&&n.forEach(o=>{r[o]=t.map(i=>i[o])}),{numRows:e,columns:r}}else return{numRows:e,values:t}}var WA={};ec(WA,{Fixed:()=>qr,Param:()=>Ci,Query:()=>ft,Selection:()=>Fr,agg:()=>Mt,align:()=>NS,and:()=>Tn,area:()=>x8,areaX:()=>b8,areaY:()=>w8,argmax:()=>uc,argmin:()=>lc,arrayAgg:()=>E2,arrow:()=>dA,aspectRatio:()=>OS,avg:()=>Nl,axis:()=>RS,axisFx:()=>xA,axisFy:()=>bA,axisX:()=>gA,axisY:()=>yA,barX:()=>M8,barY:()=>A8,bin:()=>A1,cast:()=>Rl,castDouble:()=>pc,castInteger:()=>I2,cell:()=>T8,cellX:()=>E8,cellY:()=>I8,centroid:()=>Dl,centroidX:()=>R2,centroidY:()=>L2,circle:()=>L8,colorBase:()=>v5,colorClamp:()=>f5,colorConstant:()=>S5,colorDomain:()=>a5,colorExponent:()=>_5,colorInterpolate:()=>d5,colorLabel:()=>g5,colorLegend:()=>XA,colorN:()=>l5,colorNice:()=>u5,colorPercent:()=>y5,colorPivot:()=>h5,colorRange:()=>c5,colorReverse:()=>x5,colorScale:()=>s5,colorScheme:()=>p5,colorSymmetric:()=>m5,colorTickFormat:()=>w5,colorZero:()=>b5,column:()=>Ii,contour:()=>K8,coordinator:()=>er,corr:()=>m2,count:()=>sn,covarPop:()=>y2,covariance:()=>g2,create:()=>Dr,cume_dist:()=>Zb,dateDay:()=>O2,dateMonth:()=>k2,dateMonthDay:()=>N2,delaunayLink:()=>lA,delaunayMesh:()=>uA,denseLine:()=>J8,dense_rank:()=>Wb,density:()=>Q8,densityX:()=>H8,densityY:()=>Z8,dot:()=>N8,dotX:()=>O8,dotY:()=>R8,entropy:()=>p2,eq:()=>Fb,errorbarX:()=>sA,errorbarY:()=>aA,facetGrid:()=>sM,facetLabel:()=>aM,facetMargin:()=>eM,facetMarginBottom:()=>rM,facetMarginLeft:()=>oM,facetMarginRight:()=>iM,facetMarginTop:()=>nM,first:()=>M2,first_value:()=>t2,frame:()=>mA,from:()=>HL,fxAlign:()=>hM,fxAriaDescription:()=>NM,fxAriaLabel:()=>kM,fxAxis:()=>xM,fxDomain:()=>cM,fxFontVariant:()=>CM,fxGrid:()=>AM,fxInset:()=>lM,fxInsetLeft:()=>uM,fxInsetRight:()=>pM,fxLabel:()=>EM,fxLabelAnchor:()=>IM,fxLabelOffset:()=>$M,fxLine:()=>TM,fxPadding:()=>mM,fxPaddingInner:()=>gM,fxPaddingOuter:()=>yM,fxRange:()=>fM,fxReverse:()=>OM,fxRound:()=>dM,fxTickFormat:()=>SM,fxTickPadding:()=>_M,fxTickRotate:()=>MM,fxTickSize:()=>wM,fxTickSpacing:()=>vM,fxTicks:()=>bM,fyAlign:()=>BM,fyAriaDescription:()=>o5,fyAriaLabel:()=>r5,fyAxis:()=>jM,fyDomain:()=>RM,fyFontVariant:()=>n5,fyGrid:()=>QM,fyInset:()=>DM,fyInsetBottom:()=>FM,fyInsetTop:()=>PM,fyLabel:()=>KM,fyLabelAnchor:()=>t5,fyLabelOffset:()=>e5,fyLine:()=>JM,fyPadding:()=>zM,fyPaddingInner:()=>YM,fyPaddingOuter:()=>UM,fyRange:()=>LM,fyReverse:()=>i5,fyRound:()=>qM,fyTickFormat:()=>HM,fyTickPadding:()=>WM,fyTickRotate:()=>ZM,fyTickSize:()=>GM,fyTickSpacing:()=>VM,fyTicks:()=>XM,geo:()=>MA,geojson:()=>Ll,graticule:()=>TA,grid:()=>DS,gridFx:()=>_A,gridFy:()=>SA,gridX:()=>wA,gridY:()=>vA,gt:()=>Cl,gte:()=>qb,hconcat:()=>UL,heatmap:()=>tA,height:()=>ES,hexagon:()=>D8,hexbin:()=>rA,hexgrid:()=>oA,highlight:()=>EA,hspace:()=>GL,hull:()=>pA,image:()=>W8,inset:()=>LS,intervalX:()=>LA,intervalXY:()=>PA,intervalY:()=>DA,isBetween:()=>ue,isDistinct:()=>Bb,isNotBetween:()=>zb,isNotDistinct:()=>fc,isNotNull:()=>No,isNull:()=>qs,kurtosis:()=>u2,label:()=>PS,lag:()=>Jb,last:()=>A2,last_value:()=>e2,lead:()=>Kb,lengthBase:()=>o8,lengthClamp:()=>t8,lengthConstant:()=>s8,lengthDomain:()=>J5,lengthExponent:()=>i8,lengthNice:()=>e8,lengthPercent:()=>n8,lengthRange:()=>K5,lengthScale:()=>Q5,lengthZero:()=>r8,line:()=>v8,lineX:()=>_8,lineY:()=>S8,link:()=>hA,literal:()=>Ps,loadCSV:()=>F2,loadExtension:()=>ql,loadJSON:()=>q2,loadObjects:()=>Y2,loadParquet:()=>B2,loadSpatial:()=>z2,lt:()=>Oo,lte:()=>Ro,mad:()=>o2,margin:()=>SS,marginBottom:()=>kS,marginLeft:()=>IS,marginRight:()=>$S,marginTop:()=>CS,margins:()=>_S,max:()=>Kn,median:()=>s2,menu:()=>PL,min:()=>tr,mode:()=>c2,name:()=>wS,nearest:()=>NA,nearestX:()=>OA,nearestY:()=>RA,neq:()=>Bs,not:()=>Pb,nth_value:()=>n2,ntile:()=>Qb,opacityBase:()=>R5,opacityClamp:()=>E5,opacityConstant:()=>D5,opacityDomain:()=>A5,opacityExponent:()=>L5,opacityLabel:()=>$5,opacityLegend:()=>GA,opacityNice:()=>I5,opacityPercent:()=>C5,opacityRange:()=>T5,opacityReverse:()=>k5,opacityScale:()=>M5,opacityTickFormat:()=>O5,opacityZero:()=>N5,or:()=>Fs,padding:()=>FS,pan:()=>FA,panX:()=>qA,panY:()=>BA,panZoom:()=>zA,panZoomX:()=>YA,panZoomY:()=>UA,percent_rank:()=>Hb,plot:()=>ZL,product:()=>i2,projectionClip:()=>y8,projectionDomain:()=>u8,projectionInset:()=>p8,projectionInsetBottom:()=>g8,projectionInsetLeft:()=>d8,projectionInsetRight:()=>h8,projectionInsetTop:()=>m8,projectionParallels:()=>c8,projectionPrecision:()=>f8,projectionRotate:()=>l8,projectionType:()=>a8,quantile:()=>a2,rBase:()=>W5,rClamp:()=>U5,rConstant:()=>Z5,rDomain:()=>z5,rExponent:()=>H5,rLabel:()=>X5,rNice:()=>j5,rPercent:()=>G5,rRange:()=>Y5,rScale:()=>B5,rZero:()=>V5,rank:()=>Vb,raster:()=>eA,rasterTile:()=>nA,rect:()=>$8,rectX:()=>C8,rectY:()=>k8,regressionY:()=>iA,row_number:()=>Gb,ruleX:()=>B8,ruleY:()=>z8,search:()=>FL,skewness:()=>l2,slider:()=>qL,sphere:()=>AA,spike:()=>V8,sql:()=>U,stddev:()=>Ol,stddevPop:()=>h2,stringAgg:()=>T2,style:()=>AS,sum:()=>Ln,symbolDomain:()=>F5,symbolLegend:()=>VA,symbolRange:()=>q5,symbolScale:()=>P5,table:()=>BL,text:()=>P8,textX:()=>F8,textY:()=>q8,tickX:()=>Y8,tickY:()=>U8,toggle:()=>Ha,toggleColor:()=>kA,toggleX:()=>IA,toggleY:()=>$A,toggleZ:()=>CA,varPop:()=>d2,variance:()=>f2,vconcat:()=>YL,vector:()=>j8,vectorX:()=>X8,vectorY:()=>G8,voronoi:()=>cA,voronoiMesh:()=>fA,vspace:()=>XL,width:()=>TS,xAlign:()=>WS,xAriaDescription:()=>d4,xAriaLabel:()=>p4,xAxis:()=>JS,xBase:()=>y4,xClamp:()=>GS,xConstant:()=>b4,xDomain:()=>BS,xExponent:()=>x4,xFontVariant:()=>u4,xGrid:()=>i4,xInset:()=>US,xInsetLeft:()=>jS,xInsetRight:()=>XS,xLabel:()=>a4,xLabelAnchor:()=>c4,xLabelArrow:()=>f4,xLabelOffset:()=>l4,xLine:()=>s4,xNice:()=>YS,xPadding:()=>HS,xPaddingInner:()=>ZS,xPaddingOuter:()=>QS,xPercent:()=>h4,xRange:()=>zS,xReverse:()=>m4,xRound:()=>VS,xScale:()=>qS,xTickFormat:()=>r4,xTickPadding:()=>n4,xTickRotate:()=>o4,xTickSize:()=>t4,xTickSpacing:()=>e4,xTicks:()=>KS,xZero:()=>g4,xyDomain:()=>MS,yAlign:()=>$4,yAriaDescription:()=>W4,yAriaLabel:()=>V4,yAxis:()=>O4,yBase:()=>J4,yClamp:()=>E4,yConstant:()=>tM,yDomain:()=>v4,yExponent:()=>K4,yFontVariant:()=>G4,yGrid:()=>B4,yInset:()=>M4,yInsetBottom:()=>T4,yInsetTop:()=>A4,yLabel:()=>Y4,yLabelAnchor:()=>U4,yLabelArrow:()=>j4,yLabelOffset:()=>X4,yLine:()=>z4,yNice:()=>S4,yPadding:()=>C4,yPaddingInner:()=>k4,yPaddingOuter:()=>N4,yPercent:()=>H4,yRange:()=>_4,yReverse:()=>Z4,yRound:()=>I4,yScale:()=>w4,yTickFormat:()=>F4,yTickPadding:()=>P4,yTickRotate:()=>q4,yTickSize:()=>L4,yTickSpacing:()=>D4,yTicks:()=>R4,yZero:()=>Q4});var qr=Symbol("Fixed"),qe=Symbol("Transient"),Ul=Symbol("Transform");var nS={};ec(nS,{Area:()=>Fa,Arrow:()=>id,BarX:()=>qa,BarY:()=>Ba,Cell:()=>za,Contour:()=>gd,Density:()=>bd,Dot:()=>Ya,Frame:()=>Jp,Geo:()=>wd,Hexgrid:()=>vd,Image:()=>_d,Line:()=>Ua,Link:()=>rd,Mark:()=>pt,Raster:()=>pd,Rect:()=>Pa,RuleX:()=>Up,RuleY:()=>jp,Text:()=>Ra,TickX:()=>cd,TickY:()=>fd,Tip:()=>Kp,Vector:()=>Da,WaffleX:()=>Md,WaffleY:()=>Ad,area:()=>nd,areaX:()=>xs,areaY:()=>xi,arrow:()=>sO,auto:()=>yO,autoSpec:()=>E3,axisFx:()=>_x,axisFy:()=>vx,axisX:()=>Gp,axisY:()=>Xp,barX:()=>bo,barY:()=>wo,bin:()=>yi,binX:()=>yo,binY:()=>xo,bollinger:()=>_s,bollingerX:()=>SO,bollingerY:()=>MO,boxX:()=>AO,boxY:()=>TO,cell:()=>bs,cellX:()=>cO,cellY:()=>fO,centroid:()=>Hx,circle:()=>pO,cluster:()=>MR,column:()=>Oe,contour:()=>LO,crosshair:()=>FO,crosshairX:()=>qO,crosshairY:()=>BO,delaunayLink:()=>UO,delaunayMesh:()=>jO,density:()=>HO,differenceX:()=>JO,differenceY:()=>KO,dodgeX:()=>jR,dodgeY:()=>XR,dot:()=>mr,dotX:()=>lO,dotY:()=>uO,filter:()=>xC,find:()=>EC,formatIsoDate:()=>J6,formatMonth:()=>Nk,formatNumber:()=>Q6,formatWeekday:()=>Ok,frame:()=>Df,geo:()=>Zx,geoCentroid:()=>eR,graticule:()=>rR,gridFx:()=>Tx,gridFy:()=>Mx,gridX:()=>Ax,gridY:()=>Sx,group:()=>Lp,groupX:()=>rs,groupY:()=>os,groupZ:()=>Rp,hexagon:()=>dO,hexbin:()=>oR,hexgrid:()=>iR,hull:()=>XO,identity:()=>V,image:()=>aR,indexOf:()=>Xt,initializer:()=>Vt,interpolateNearest:()=>hd,interpolateNone:()=>Wx,interpolatorBarycentric:()=>dd,interpolatorRandomWalk:()=>md,legend:()=>IN,line:()=>ja,lineX:()=>ws,lineY:()=>vs,linearRegressionX:()=>lR,linearRegressionY:()=>uR,link:()=>qx,map:()=>kn,mapX:()=>Yf,mapY:()=>Uf,marks:()=>we,normalize:()=>i1,normalizeX:()=>HR,normalizeY:()=>ZR,numberInterval:()=>m6,plot:()=>Pf,pointer:()=>ls,pointerX:()=>us,pointerY:()=>mi,raster:()=>kO,rect:()=>Qp,rectX:()=>Rf,rectY:()=>Lf,reverse:()=>bC,ruleX:()=>Vn,ruleY:()=>Wn,scale:()=>is,select:()=>tL,selectFirst:()=>Id,selectLast:()=>$d,selectMaxX:()=>f1,selectMaxY:()=>l1,selectMinX:()=>a1,selectMinY:()=>c1,shiftX:()=>QR,shiftY:()=>JR,shuffle:()=>wC,sort:()=>Uy,sphere:()=>nR,spike:()=>cN,stackX:()=>g3,stackX1:()=>RN,stackX2:()=>LN,stackY:()=>y3,stackY1:()=>DN,stackY2:()=>PN,text:()=>go,textX:()=>hx,textY:()=>mx,tickX:()=>Xx,tickY:()=>Gx,timeInterval:()=>Ip,tip:()=>Ox,transform:()=>be,tree:()=>V3,treeLink:()=>e1,treeNode:()=>Sd,utcInterval:()=>Ma,valueof:()=>ut,vector:()=>d3,vectorX:()=>xx,vectorY:()=>bx,voronoi:()=>GO,voronoiMesh:()=>VO,waffleX:()=>CR,waffleY:()=>kR,window:()=>jf,windowX:()=>xO,windowY:()=>bO});function gt(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function an(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function wr(t){let e,n,r;t.length!==2?(e=gt,n=(a,c)=>gt(t(a),c),r=(a,c)=>t(a)-c):(e=t===gt||t===an?t:VF,n=t,r=t);function o(a,c,f=0,l=a.length){if(f<l){if(e(c,c)!==0)return l;do{let u=f+l>>>1;n(a[u],c)<0?f=u+1:l=u}while(f<l)}return f}function i(a,c,f=0,l=a.length){if(f<l){if(e(c,c)!==0)return l;do{let u=f+l>>>1;n(a[u],c)<=0?f=u+1:l=u}while(f<l)}return f}function s(a,c,f=0,l=a.length){let u=o(a,c,f,l-1);return u>f&&r(a[u-1],c)>-r(a[u],c)?u-1:u}return{left:o,center:s,right:i}}function VF(){return 0}function jl(t){return t===null?NaN:+t}function*fE(t,e){if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(yield r)}}var lE=wr(gt),uE=lE.right,WF=lE.left,HF=wr(jl).center,Lo=uE;var Xl=pE(dE),J2=pE(ZF);function pE(t){return function(e,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:o,width:i,height:s}=e;if(!((i=Math.floor(i))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:o.length/i))>=0))throw new RangeError("invalid height");if(!i||!s||!n&&!r)return e;let a=n&&t(n),c=r&&t(r),f=o.slice();return a&&c?(hc(a,f,o,i,s),hc(a,o,f,i,s),hc(a,f,o,i,s),mc(c,o,f,i,s),mc(c,f,o,i,s),mc(c,o,f,i,s)):a?(hc(a,o,f,i,s),hc(a,f,o,i,s),hc(a,o,f,i,s)):c&&(mc(c,o,f,i,s),mc(c,f,o,i,s),mc(c,o,f,i,s)),e}}function hc(t,e,n,r,o){for(let i=0,s=r*o;i<s;)t(e,n,i,i+=r,1)}function mc(t,e,n,r,o){for(let i=0,s=r*o;i<r;++i)t(e,n,i,i+s,r)}function ZF(t){let e=dE(t);return(n,r,o,i,s)=>{o<<=2,i<<=2,s<<=2,e(n,r,o+0,i+0,s),e(n,r,o+1,i+1,s),e(n,r,o+2,i+2,s),e(n,r,o+3,i+3,s)}}function dE(t){let e=Math.floor(t);if(e===t)return QF(t);let n=t-e,r=2*t+1;return(o,i,s,a,c)=>{if(!((a-=c)>=s))return;let f=e*i[s],l=c*e,u=l+c;for(let p=s,d=s+l;p<d;p+=c)f+=i[Math.min(a,p)];for(let p=s,d=a;p<=d;p+=c)f+=i[Math.min(a,p+l)],o[p]=(f+n*(i[Math.max(s,p-u)]+i[Math.min(a,p+u)]))/r,f-=i[Math.max(s,p-l)]}}function QF(t){let e=2*t+1;return(n,r,o,i,s)=>{if(!((i-=s)>=o))return;let a=t*r[o],c=s*t;for(let f=o,l=o+c;f<l;f+=s)a+=r[Math.min(i,f)];for(let f=o,l=i;f<=l;f+=s)a+=r[Math.min(i,f+c)],n[f]=a/e,a-=r[Math.max(o,f-c)]}}function Br(t,e){let n=0;if(e===void 0)for(let r of t)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(o=+o)>=o&&++n}return n}function JF(t){return t.length|0}function KF(t){return!(t>0)}function tq(t){return typeof t!="object"||"length"in t?t:Array.from(t)}function eq(t){return e=>t(...e)}function Sm(...t){let e=typeof t[t.length-1]=="function"&&eq(t.pop());t=t.map(tq);let n=t.map(JF),r=t.length-1,o=new Array(r+1).fill(0),i=[];if(r<0||n.some(KF))return i;for(;;){i.push(o.map((a,c)=>t[c][a]));let s=r;for(;++o[s]===n[s];){if(s===0)return e?i.map(e):i;o[s--]=0}}}function Mm(t,e){var n=0,r=0;return Float64Array.from(t,e===void 0?o=>n+=+o||0:o=>n+=+e(o,r++,t)||0)}function ki(t,e){let n=0,r,o=0,i=0;if(e===void 0)for(let s of t)s!=null&&(s=+s)>=s&&(r=s-o,o+=r/++n,i+=r*(s-o));else{let s=-1;for(let a of t)(a=e(a,++s,t))!=null&&(a=+a)>=a&&(r=a-o,o+=r/++n,i+=r*(a-o))}if(n>1)return i/(n-1)}function nr(t,e){let n=ki(t,e);return n&&Math.sqrt(n)}function Rt(t,e){let n,r;if(e===void 0)for(let o of t)o!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)));else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}var Be=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let n=this._partials,r=0;for(let o=0;o<this._n&&o<32;o++){let i=n[o],s=e+i,a=Math.abs(e)<Math.abs(i)?e-(s-i):i-(s-e);a&&(n[r++]=a),e=s}return n[r]=e,this._n=r+1,this}valueOf(){let e=this._partials,n=this._n,r,o,i,s=0;if(n>0){for(s=e[--n];n>0&&(r=s,o=e[--n],s=r+o,i=o-(s-r),!i););n>0&&(i<0&&e[n-1]<0||i>0&&e[n-1]>0)&&(o=i*2,r=s+o,o==r-s&&(s=r))}return s}};var cn=class extends Map{constructor(e,n=gE){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(let[r,o]of e)this.set(r,o)}get(e){return super.get(K2(this,e))}has(e){return super.has(K2(this,e))}set(e,n){return super.set(hE(this,e),n)}delete(e){return super.delete(mE(this,e))}},fn=class extends Set{constructor(e,n=gE){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(let r of e)this.add(r)}has(e){return super.has(K2(this,e))}add(e){return super.add(hE(this,e))}delete(e){return super.delete(mE(this,e))}};function K2({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):n}function hE({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function mE({_intern:t,_key:e},n){let r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function gE(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Gl(t){return t}function ze(t,...e){return ew(t,Gl,Gl,e)}function vr(t,e,...n){return ew(t,Gl,e,n)}function tw(t,e,...n){return ew(t,Array.from,e,n)}function ew(t,e,n,r){return function o(i,s){if(s>=r.length)return n(i);let a=new cn,c=r[s++],f=-1;for(let l of i){let u=c(l,++f,i),p=a.get(u);p?p.push(l):a.set(u,[l])}for(let[l,u]of a)a.set(l,o(u,s));return e(a)}(t,0)}function nw(t,e){return Array.from(e,n=>t[n])}function Do(t,...e){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");t=Array.from(t);let[n]=e;if(n&&n.length!==2||e.length>1){let r=Uint32Array.from(t,(o,i)=>i);return e.length>1?(e=e.map(o=>t.map(o)),r.sort((o,i)=>{for(let s of e){let a=Vs(s[o],s[i]);if(a)return a}})):(n=t.map(n),r.sort((o,i)=>Vs(n[o],n[i]))),nw(t,r)}return t.sort(Vl(n))}function Vl(t=gt){if(t===gt)return Vs;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{let r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function Vs(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}function gc(t,e,n){return(e.length!==2?Do(vr(t,e,n),([r,o],[i,s])=>gt(o,s)||gt(r,i)):Do(ze(t,n),([r,o],[i,s])=>e(o,s)||gt(r,i))).map(([r])=>r)}var nq=Math.sqrt(50),rq=Math.sqrt(10),oq=Math.sqrt(2);function Am(t,e,n){let r=(e-t)/Math.max(0,n),o=Math.floor(Math.log10(r)),i=r/Math.pow(10,o),s=i>=nq?10:i>=rq?5:i>=oq?2:1,a,c,f;return o<0?(f=Math.pow(10,-o)/s,a=Math.round(t*f),c=Math.round(e*f),a/f<t&&++a,c/f>e&&--c,f=-f):(f=Math.pow(10,o)*s,a=Math.round(t/f),c=Math.round(e/f),a*f<t&&++a,c*f>e&&--c),c<a&&.5<=n&&n<2?Am(t,e,n*2):[a,c,f]}function Ye(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];let r=e<t,[o,i,s]=r?Am(e,t,n):Am(t,e,n);if(!(i>=o))return[];let a=i-o+1,c=new Array(a);if(r)if(s<0)for(let f=0;f<a;++f)c[f]=(i-f)/-s;else for(let f=0;f<a;++f)c[f]=(i-f)*s;else if(s<0)for(let f=0;f<a;++f)c[f]=(o+f)/-s;else for(let f=0;f<a;++f)c[f]=(o+f)*s;return c}function Po(t,e,n){return e=+e,t=+t,n=+n,Am(t,e,n)[2]}function yc(t,e,n){e=+e,t=+t,n=+n;let r=e<t,o=r?Po(e,t,n):Po(t,e,n);return(r?-1:1)*(o<0?1/-o:o)}function xc(t,e,n){let r;for(;;){let o=Po(t,e,n);if(o===r||o===0||!isFinite(o))return[t,e];o>0?(t=Math.floor(t/o)*o,e=Math.ceil(e/o)*o):o<0&&(t=Math.ceil(t*o)/o,e=Math.floor(e*o)/o),r=o}}function Ni(t){return Math.max(1,Math.ceil(Math.log(Br(t))/Math.LN2)+1)}function Ct(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function Tm(t,e){let n,r=-1,o=-1;if(e===void 0)for(let i of t)++o,i!=null&&(n<i||n===void 0&&i>=i)&&(n=i,r=o);else for(let i of t)(i=e(i,++o,t))!=null&&(n<i||n===void 0&&i>=i)&&(n=i,r=o);return r}function Bt(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Em(t,e){let n,r=-1,o=-1;if(e===void 0)for(let i of t)++o,i!=null&&(n>i||n===void 0&&i>=i)&&(n=i,r=o);else for(let i of t)(i=e(i,++o,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i,r=o);return r}function Im(t,e,n=0,r=1/0,o){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(o=o===void 0?Vs:Vl(o);r>n;){if(r-n>600){let c=r-n+1,f=e-n+1,l=Math.log(c),u=.5*Math.exp(2*l/3),p=.5*Math.sqrt(l*u*(c-u)/c)*(f-c/2<0?-1:1),d=Math.max(n,Math.floor(e-f*u/c+p)),h=Math.min(r,Math.floor(e+(c-f)*u/c+p));Im(t,e,d,h,o)}let i=t[e],s=n,a=r;for(Wl(t,n,e),o(t[r],i)>0&&Wl(t,n,r);s<a;){for(Wl(t,s,a),++s,--a;o(t[s],i)<0;)++s;for(;o(t[a],i)>0;)--a}o(t[n],i)===0?Wl(t,n,a):(++a,Wl(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function Wl(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Ws(t,e=gt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?gt(s,o)>0:gt(s,s)===0)&&(n=i,o=s,r=!0)}}else for(let o of t)(r?e(o,n)>0:e(o,o)===0)&&(n=o,r=!0);return n}function ln(t,e,n){if(t=Float64Array.from(fE(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return Bt(t);if(e>=1)return Ct(t);var r,o=(r-1)*e,i=Math.floor(o),s=Ct(Im(t,i).subarray(0,i+1)),a=Bt(t.subarray(i+1));return s+(a-s)*(o-i)}}function rw(t,e,n=jl){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),s=+n(t[i],i,t),a=+n(t[i+1],i+1,t);return s+(a-s)*(o-i)}}function $m(t,e,n){let r=Br(t),o=ln(t,.75)-ln(t,.25);return r&&o?Math.ceil((n-e)/(2*o*Math.pow(r,-1/3))):1}function Hl(t,e,n){let r=Br(t),o=nr(t);return r&&o?Math.ceil((n-e)*Math.cbrt(r)/(3.49*o)):1}function Fo(t,e){let n=0,r=0;if(e===void 0)for(let o of t)o!=null&&(o=+o)>=o&&(++n,r+=o);else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(i=+i)>=i&&(++n,r+=i)}if(n)return r/n}function _r(t,e){return ln(t,.5,e)}function*sq(t){for(let e of t)yield*e}function bc(t){return Array.from(sq(t))}function wc(t,e){let n=new cn;if(e===void 0)for(let i of t)i!=null&&i>=i&&n.set(i,(n.get(i)||0)+1);else{let i=-1;for(let s of t)(s=e(s,++i,t))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,o=0;for(let[i,s]of n)s>o&&(o=s,r=i);return r}function Cm(t,e=aq){let n=[],r,o=!1;for(let i of t)o&&n.push(e(r,i)),r=i,o=!0;return n}function aq(t,e){return[t,e]}function ce(t,e,n){t=+t,e=+e,n=(o=arguments.length)<2?(e=t,t=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(o);++r<o;)i[r]=t+r*n;return i}function Zl(t,e=gt){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(t),r=new Float64Array(n.length);e.length!==2&&(n=n.map(e),e=gt);let o=(a,c)=>e(n[a],n[c]),i,s;return t=Uint32Array.from(n,(a,c)=>c),t.sort(e===gt?(a,c)=>Vs(n[a],n[c]):Vl(o)),t.forEach((a,c)=>{let f=o(a,i===void 0?a:i);f>=0?((i===void 0||f>0)&&(i=a,s=c),r[a]=s):r[a]=NaN}),r}function km(t,e=gt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?gt(s,o)<0:gt(s,s)===0)&&(n=i,o=s,r=!0)}}else for(let o of t)(r?e(o,n)<0:e(o,o)===0)&&(n=o,r=!0);return n}function Ue(t,e){let n=0;if(e===void 0)for(let r of t)(r=+r)&&(n+=r);else{let r=-1;for(let o of t)(o=+e(o,++r,t))&&(n+=o)}return n}function Oi(t){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(t).reverse()}function yE(t){return t}var ow=1,iw=2,sw=3,Nm=4,xE=1e-6;function cq(t){return"translate("+t+",0)"}function fq(t){return"translate(0,"+t+")"}function lq(t){return e=>+t(e)}function uq(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function pq(){return!this.__axis}function dq(t,e){var n=[],r=null,o=null,i=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,f=t===ow||t===Nm?-1:1,l=t===Nm||t===iw?"x":"y",u=t===ow||t===sw?cq:fq;function p(d){var h=r??(e.ticks?e.ticks.apply(e,n):e.domain()),m=o??(e.tickFormat?e.tickFormat.apply(e,n):yE),g=Math.max(i,0)+a,y=e.range(),x=+y[0]+c,b=+y[y.length-1]+c,w=(e.bandwidth?uq:lq)(e.copy(),c),_=d.selection?d.selection():d,v=_.selectAll(".domain").data([null]),A=_.selectAll(".tick").data(h,e).order(),E=A.exit(),T=A.enter().append("g").attr("class","tick"),$=A.select("line"),M=A.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),A=A.merge(T),$=$.merge(T.append("line").attr("stroke","currentColor").attr(l+"2",f*i)),M=M.merge(T.append("text").attr("fill","currentColor").attr(l,f*g).attr("dy",t===ow?"0em":t===sw?"0.71em":"0.32em")),d!==_&&(v=v.transition(d),A=A.transition(d),$=$.transition(d),M=M.transition(d),E=E.transition(d).attr("opacity",xE).attr("transform",function(k){return isFinite(k=w(k))?u(k+c):this.getAttribute("transform")}),T.attr("opacity",xE).attr("transform",function(k){var R=this.parentNode.__axis;return u((R&&isFinite(R=R(k))?R:w(k))+c)})),E.remove(),v.attr("d",t===Nm||t===iw?s?"M"+f*s+","+x+"H"+c+"V"+b+"H"+f*s:"M"+c+","+x+"V"+b:s?"M"+x+","+f*s+"V"+c+"H"+b+"V"+f*s:"M"+x+","+c+"H"+b),A.attr("opacity",1).attr("transform",function(k){return u(w(k)+c)}),$.attr(l+"2",f*i),M.attr(l,f*g).text(m),_.filter(pq).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===iw?"start":t===Nm?"end":"middle"),_.each(function(){this.__axis=w})}return p.scale=function(d){return arguments.length?(e=d,p):e},p.ticks=function(){return n=Array.from(arguments),p},p.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),p):n.slice()},p.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),p):r&&r.slice()},p.tickFormat=function(d){return arguments.length?(o=d,p):o},p.tickSize=function(d){return arguments.length?(i=s=+d,p):i},p.tickSizeInner=function(d){return arguments.length?(i=+d,p):i},p.tickSizeOuter=function(d){return arguments.length?(s=+d,p):s},p.tickPadding=function(d){return arguments.length?(a=+d,p):a},p.offset=function(d){return arguments.length?(c=+d,p):c},p}function aw(t){return dq(sw,t)}var hq={value:()=>{}};function wE(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Om(n)}function Om(t){this._=t}function mq(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Om.prototype=wE.prototype={constructor:Om,on:function(t,e){var n=this._,r=mq(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=gq(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=r[i]).type)n[o]=bE(n[o],t.name,e);else if(e==null)for(o in n)n[o]=bE(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Om(t)},call:function(t,e){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};function gq(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function bE(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=hq,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Hs=wE;var Rm="http://www.w3.org/1999/xhtml",un={svg:"http://www.w3.org/2000/svg",xhtml:Rm,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qo(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),un.hasOwnProperty(e)?{space:un[e],local:t}:t}function yq(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Rm&&e.documentElement.namespaceURI===Rm?e.createElement(t):e.createElementNS(n,t)}}function xq(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Bo(t){var e=qo(t);return(e.local?xq:yq)(e)}function bq(){}function Zs(t){return t==null?bq:function(){return this.querySelector(t)}}function vE(t){typeof t!="function"&&(t=Zs(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=new Array(s),c,f,l=0;l<s;++l)(c=i[l])&&(f=t.call(c,c.__data__,l,i))&&("__data__"in c&&(f.__data__=c.__data__),a[l]=f);return new ie(r,this._parents)}function cw(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function wq(){return[]}function Ql(t){return t==null?wq:function(){return this.querySelectorAll(t)}}function vq(t){return function(){return cw(t.apply(this,arguments))}}function _E(t){typeof t=="function"?t=vq(t):t=Ql(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&(r.push(t.call(c,c.__data__,f,s)),o.push(c));return new ie(r,o)}function Jl(t){return function(){return this.matches(t)}}function Lm(t){return function(e){return e.matches(t)}}var _q=Array.prototype.find;function Sq(t){return function(){return _q.call(this.children,t)}}function Mq(){return this.firstElementChild}function SE(t){return this.select(t==null?Mq:Sq(typeof t=="function"?t:Lm(t)))}var Aq=Array.prototype.filter;function Tq(){return Array.from(this.children)}function Eq(t){return function(){return Aq.call(this.children,t)}}function ME(t){return this.selectAll(t==null?Tq:Eq(typeof t=="function"?t:Lm(t)))}function AE(t){typeof t!="function"&&(t=Jl(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,f=0;f<s;++f)(c=i[f])&&t.call(c,c.__data__,f,i)&&a.push(c);return new ie(r,this._parents)}function Dm(t){return new Array(t.length)}function TE(){return new ie(this._enter||this._groups.map(Dm),this._parents)}function Kl(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Kl.prototype={constructor:Kl,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function EE(t){return function(){return t}}function Iq(t,e,n,r,o,i){for(var s=0,a,c=e.length,f=i.length;s<f;++s)(a=e[s])?(a.__data__=i[s],r[s]=a):n[s]=new Kl(t,i[s]);for(;s<c;++s)(a=e[s])&&(o[s]=a)}function $q(t,e,n,r,o,i,s){var a,c,f=new Map,l=e.length,u=i.length,p=new Array(l),d;for(a=0;a<l;++a)(c=e[a])&&(p[a]=d=s.call(c,c.__data__,a,e)+"",f.has(d)?o[a]=c:f.set(d,c));for(a=0;a<u;++a)d=s.call(t,i[a],a,i)+"",(c=f.get(d))?(r[a]=c,c.__data__=i[a],f.delete(d)):n[a]=new Kl(t,i[a]);for(a=0;a<l;++a)(c=e[a])&&f.get(p[a])===c&&(o[a]=c)}function Cq(t){return t.__data__}function IE(t,e){if(!arguments.length)return Array.from(this,Cq);var n=e?$q:Iq,r=this._parents,o=this._groups;typeof t!="function"&&(t=EE(t));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),f=0;f<i;++f){var l=r[f],u=o[f],p=u.length,d=kq(t.call(l,l&&l.__data__,f,r)),h=d.length,m=a[f]=new Array(h),g=s[f]=new Array(h),y=c[f]=new Array(p);n(l,u,m,g,y,d,e);for(var x=0,b=0,w,_;x<h;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(_=g[b])&&++b<h;);w._next=_||null}}return s=new ie(s,r),s._enter=a,s._exit=c,s}function kq(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $E(){return new ie(this._exit||this._groups.map(Dm),this._parents)}function CE(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function kE(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var f=n[c],l=r[c],u=f.length,p=a[c]=new Array(u),d,h=0;h<u;++h)(d=f[h]||l[h])&&(p[h]=d);for(;c<o;++c)a[c]=n[c];return new ie(a,this._parents)}function NE(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function OE(t){t||(t=Nq);function e(u,p){return u&&p?t(u.__data__,p.__data__):!u-!p}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),f,l=0;l<a;++l)(f=s[l])&&(c[l]=f);c.sort(e)}return new ie(o,this._parents).order()}function Nq(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function RE(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function LE(){return Array.from(this)}function DE(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function PE(){let t=0;for(let e of this)++t;return t}function FE(){return!this.node()}function qE(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&t.call(a,a.__data__,i,o);return this}function Oq(t){return function(){this.removeAttribute(t)}}function Rq(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Lq(t,e){return function(){this.setAttribute(t,e)}}function Dq(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Pq(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Fq(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function BE(t,e){var n=qo(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Rq:Oq:typeof e=="function"?n.local?Fq:Pq:n.local?Dq:Lq)(n,e))}function Pm(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function qq(t){return function(){this.style.removeProperty(t)}}function Bq(t,e,n){return function(){this.style.setProperty(t,e,n)}}function zq(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function zE(t,e,n){return arguments.length>1?this.each((e==null?qq:typeof e=="function"?zq:Bq)(t,e,n??"")):Ri(this.node(),t)}function Ri(t,e){return t.style.getPropertyValue(e)||Pm(t).getComputedStyle(t,null).getPropertyValue(e)}function Yq(t){return function(){delete this[t]}}function Uq(t,e){return function(){this[t]=e}}function jq(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function YE(t,e){return arguments.length>1?this.each((e==null?Yq:typeof e=="function"?jq:Uq)(t,e)):this.node()[t]}function UE(t){return t.trim().split(/^|\s+/)}function fw(t){return t.classList||new jE(t)}function jE(t){this._node=t,this._names=UE(t.getAttribute("class")||"")}jE.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function XE(t,e){for(var n=fw(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function GE(t,e){for(var n=fw(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function Xq(t){return function(){XE(this,t)}}function Gq(t){return function(){GE(this,t)}}function Vq(t,e){return function(){(e.apply(this,arguments)?XE:GE)(this,t)}}function VE(t,e){var n=UE(t+"");if(arguments.length<2){for(var r=fw(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?Vq:e?Xq:Gq)(n,e))}function Wq(){this.textContent=""}function Hq(t){return function(){this.textContent=t}}function Zq(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function WE(t){return arguments.length?this.each(t==null?Wq:(typeof t=="function"?Zq:Hq)(t)):this.node().textContent}function Qq(){this.innerHTML=""}function Jq(t){return function(){this.innerHTML=t}}function Kq(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function HE(t){return arguments.length?this.each(t==null?Qq:(typeof t=="function"?Kq:Jq)(t)):this.node().innerHTML}function tB(){this.nextSibling&&this.parentNode.appendChild(this)}function ZE(){return this.each(tB)}function eB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function QE(){return this.each(eB)}function JE(t){var e=typeof t=="function"?t:Bo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function nB(){return null}function KE(t,e){var n=typeof t=="function"?t:Bo(t),r=e==null?nB:typeof e=="function"?e:Zs(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function rB(){var t=this.parentNode;t&&t.removeChild(this)}function t7(){return this.each(rB)}function oB(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function iB(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function e7(t){return this.select(t?iB:oB)}function n7(t){return arguments.length?this.property("__data__",t):this.node().__data__}function sB(t){return function(e){t.call(this,e,this.__data__)}}function aB(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function cB(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function fB(t,e,n){return function(){var r=this.__on,o,i=sB(e);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function r7(t,e,n){var r=aB(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,f=a.length,l;c<f;++c)for(o=0,l=a[c];o<i;++o)if((s=r[o]).type===l.type&&s.name===l.name)return l.value}return}for(a=e?fB:cB,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function o7(t,e,n){var r=Pm(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function lB(t,e){return function(){return o7(this,t,e)}}function uB(t,e){return function(){return o7(this,t,e.apply(this,arguments))}}function i7(t,e){return this.each((typeof e=="function"?uB:lB)(t,e))}function*s7(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var lw=[null];function ie(t,e){this._groups=t,this._parents=e}function a7(){return new ie([[document.documentElement]],lw)}function pB(){return this}ie.prototype=a7.prototype={constructor:ie,select:vE,selectAll:_E,selectChild:SE,selectChildren:ME,filter:AE,data:IE,enter:TE,exit:$E,join:CE,merge:kE,selection:pB,order:NE,sort:OE,call:RE,nodes:LE,node:DE,size:PE,empty:FE,each:qE,attr:BE,style:zE,property:YE,classed:VE,text:WE,html:HE,raise:ZE,lower:QE,append:JE,insert:KE,remove:t7,clone:e7,datum:n7,on:r7,dispatch:i7,[Symbol.iterator]:s7};var zo=a7;function St(t){return typeof t=="string"?new ie([[document.querySelector(t)]],[document.documentElement]):new ie([[t]],lw)}function c7(t){let e;for(;e=t.sourceEvent;)t=e;return t}function He(t,e){if(t=c7(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}var Fm={capture:!0,passive:!1};function qm(t){t.preventDefault(),t.stopImmediatePropagation()}function tu(t){var e=t.document.documentElement,n=St(t).on("dragstart.drag",qm,Fm);"onselectstart"in e?n.on("selectstart.drag",qm,Fm):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function eu(t,e){var n=t.document.documentElement,r=St(t).on("dragstart.drag",null);e&&(r.on("click.drag",qm,Fm),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 Yo(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Li(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Yr(){}var Di=.7,Ks=1/Di,vc="\\s*([+-]?\\d+)\\s*",nu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dB=/^#([0-9a-f]{3,8})$/,hB=new RegExp(`^rgb\\(${vc},${vc},${vc}\\)$`),mB=new RegExp(`^rgb\\(${zr},${zr},${zr}\\)$`),gB=new RegExp(`^rgba\\(${vc},${vc},${vc},${nu}\\)$`),yB=new RegExp(`^rgba\\(${zr},${zr},${zr},${nu}\\)$`),xB=new RegExp(`^hsl\\(${nu},${zr},${zr}\\)$`),bB=new RegExp(`^hsla\\(${nu},${zr},${zr},${nu}\\)$`),f7={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};Yo(Yr,Pn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:l7,formatHex:l7,formatHex8:wB,formatHsl:vB,formatRgb:u7,toString:u7});function l7(){return this.rgb().formatHex()}function wB(){return this.rgb().formatHex8()}function vB(){return y7(this).formatHsl()}function u7(){return this.rgb().formatRgb()}function Pn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=dB.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?p7(e):n===3?new pe(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Bm(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Bm(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=hB.exec(t))?new pe(e[1],e[2],e[3],1):(e=mB.exec(t))?new pe(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=gB.exec(t))?Bm(e[1],e[2],e[3],e[4]):(e=yB.exec(t))?Bm(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=xB.exec(t))?m7(e[1],e[2]/100,e[3]/100,1):(e=bB.exec(t))?m7(e[1],e[2]/100,e[3]/100,e[4]):f7.hasOwnProperty(t)?p7(f7[t]):t==="transparent"?new pe(NaN,NaN,NaN,0):null}function p7(t){return new pe(t>>16&255,t>>8&255,t&255,1)}function Bm(t,e,n,r){return r<=0&&(t=e=n=NaN),new pe(t,e,n,r)}function ru(t){return t instanceof Yr||(t=Pn(t)),t?(t=t.rgb(),new pe(t.r,t.g,t.b,t.opacity)):new pe}function ve(t,e,n,r){return arguments.length===1?ru(t):new pe(t,e,n,r??1)}function pe(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Yo(pe,ve,Li(Yr,{brighter(t){return t=t==null?Ks:Math.pow(Ks,t),new pe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Di:Math.pow(Di,t),new pe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new pe(Js(this.r),Js(this.g),Js(this.b),Ym(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:d7,formatHex:d7,formatHex8:_B,formatRgb:h7,toString:h7}));function d7(){return`#${Qs(this.r)}${Qs(this.g)}${Qs(this.b)}`}function _B(){return`#${Qs(this.r)}${Qs(this.g)}${Qs(this.b)}${Qs((isNaN(this.opacity)?1:this.opacity)*255)}`}function h7(){let t=Ym(this.opacity);return`${t===1?"rgb(":"rgba("}${Js(this.r)}, ${Js(this.g)}, ${Js(this.b)}${t===1?")":`, ${t})`}`}function Ym(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Js(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qs(t){return t=Js(t),(t<16?"0":"")+t.toString(16)}function m7(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Sr(t,e,n,r)}function y7(t){if(t instanceof Sr)return new Sr(t.h,t.s,t.l,t.opacity);if(t instanceof Yr||(t=Pn(t)),!t)return new Sr;if(t instanceof Sr)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new Sr(s,a,c,t.opacity)}function ou(t,e,n,r){return arguments.length===1?y7(t):new Sr(t,e,n,r??1)}function Sr(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Yo(Sr,ou,Li(Yr,{brighter(t){return t=t==null?Ks:Math.pow(Ks,t),new Sr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Di:Math.pow(Di,t),new Sr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new pe(uw(t>=240?t-240:t+120,o,r),uw(t,o,r),uw(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Sr(g7(this.h),zm(this.s),zm(this.l),Ym(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 t=Ym(this.opacity);return`${t===1?"hsl(":"hsla("}${g7(this.h)}, ${zm(this.s)*100}%, ${zm(this.l)*100}%${t===1?")":`, ${t})`}`}}));function g7(t){return t=(t||0)%360,t<0?t+360:t}function zm(t){return Math.max(0,Math.min(1,t||0))}function uw(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}var Um=Math.PI/180,jm=180/Math.PI;var Xm=18,x7=.96422,b7=1,w7=.82521,v7=4/29,_c=6/29,_7=3*_c*_c,SB=_c*_c*_c;function S7(t){if(t instanceof Ur)return new Ur(t.l,t.a,t.b,t.opacity);if(t instanceof Uo)return M7(t);t instanceof pe||(t=ru(t));var e=mw(t.r),n=mw(t.g),r=mw(t.b),o=pw((.2225045*e+.7168786*n+.0606169*r)/b7),i,s;return e===n&&n===r?i=s=o:(i=pw((.4360747*e+.3850649*n+.1430804*r)/x7),s=pw((.0139322*e+.0971045*n+.7141733*r)/w7)),new Ur(116*o-16,500*(i-o),200*(o-s),t.opacity)}function Sc(t,e,n,r){return arguments.length===1?S7(t):new Ur(t,e,n,r??1)}function Ur(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}Yo(Ur,Sc,Li(Yr,{brighter(t){return new Ur(this.l+Xm*(t??1),this.a,this.b,this.opacity)},darker(t){return new Ur(this.l-Xm*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=x7*dw(e),t=b7*dw(t),n=w7*dw(n),new pe(hw(3.1338561*e-1.6168667*t-.4906146*n),hw(-.9787684*e+1.9161415*t+.033454*n),hw(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function pw(t){return t>SB?Math.pow(t,1/3):t/_7+v7}function dw(t){return t>_c?t*t*t:_7*(t-v7)}function hw(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function mw(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function MB(t){if(t instanceof Uo)return new Uo(t.h,t.c,t.l,t.opacity);if(t instanceof Ur||(t=S7(t)),t.a===0&&t.b===0)return new Uo(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*jm;return new Uo(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function iu(t,e,n,r){return arguments.length===1?MB(t):new Uo(t,e,n,r??1)}function Uo(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function M7(t){if(isNaN(t.h))return new Ur(t.l,0,0,t.opacity);var e=t.h*Um;return new Ur(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}Yo(Uo,iu,Li(Yr,{brighter(t){return new Uo(this.h,this.c,this.l+Xm*(t??1),this.opacity)},darker(t){return new Uo(this.h,this.c,this.l-Xm*(t??1),this.opacity)},rgb(){return M7(this).rgb()}}));var I7=-.14861,gw=1.78277,yw=-.29227,Gm=-.90649,su=1.97294,A7=su*Gm,T7=su*gw,E7=gw*yw-Gm*I7;function AB(t){if(t instanceof ta)return new ta(t.h,t.s,t.l,t.opacity);t instanceof pe||(t=ru(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(E7*r+A7*e-T7*n)/(E7+A7-T7),i=r-o,s=(su*(n-o)-yw*i)/Gm,a=Math.sqrt(s*s+i*i)/(su*o*(1-o)),c=a?Math.atan2(s,i)*jm-120:NaN;return new ta(c<0?c+360:c,a,o,t.opacity)}function pn(t,e,n,r){return arguments.length===1?AB(t):new ta(t,e,n,r??1)}function ta(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Yo(ta,pn,Li(Yr,{brighter(t){return t=t==null?Ks:Math.pow(Ks,t),new ta(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Di:Math.pow(Di,t),new ta(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Um,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new pe(255*(e+n*(I7*r+gw*o)),255*(e+n*(yw*r+Gm*o)),255*(e+n*(su*r)),this.opacity)}}));function xw(t,e,n,r,o){var i=t*t,s=i*t;return((1-3*t+3*i-s)*e+(4-6*i+3*s)*n+(1+3*t+3*i-3*s)*r+s*o)/6}function $7(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[r],i=t[r+1],s=r>0?t[r-1]:2*o-i,a=r<e-1?t[r+2]:2*i-o;return xw((n-r/e)*e,s,o,i,a)}}function C7(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],s=t[(r+1)%e],a=t[(r+2)%e];return xw((n-r/e)*e,o,i,s,a)}}var Mc=t=>()=>t;function k7(t,e){return function(n){return t+n*e}}function TB(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Ac(t,e){var n=e-t;return n?k7(t,n>180||n<-180?n-360*Math.round(n/360):n):Mc(isNaN(t)?e:t)}function N7(t){return(t=+t)==1?Qt:function(e,n){return n-e?TB(e,n,t):Mc(isNaN(e)?n:e)}}function Qt(t,e){var n=e-t;return n?k7(t,n):Mc(isNaN(t)?e:t)}var rr=function t(e){var n=N7(e);function r(o,i){var s=n((o=ve(o)).r,(i=ve(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),f=Qt(o.opacity,i.opacity);return function(l){return o.r=s(l),o.g=a(l),o.b=c(l),o.opacity=f(l),o+""}}return r.gamma=t,r}(1);function O7(t){return function(e){var n=e.length,r=new Array(n),o=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=ve(e[s]),r[s]=a.r||0,o[s]=a.g||0,i[s]=a.b||0;return r=t(r),o=t(o),i=t(i),a.opacity=1,function(c){return a.r=r(c),a.g=o(c),a.b=i(c),a+""}}}var bw=O7($7),EB=O7(C7);function R7(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function L7(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function D7(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=Fn(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function P7(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Ht(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function F7(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=Fn(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var vw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ww=new RegExp(vw.source,"g");function IB(t){return function(){return t}}function $B(t){return function(e){return t(e)+""}}function au(t,e){var n=vw.lastIndex=ww.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=vw.exec(t))&&(o=ww.exec(e));)(i=o.index)>n&&(i=e.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:Ht(r,o)})),n=ww.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?$B(c[0].x):IB(e):(e=c.length,function(f){for(var l=0,u;l<e;++l)a[(u=c[l]).i]=u.x(f);return a.join("")})}function Fn(t,e){var n=typeof e,r;return e==null||n==="boolean"?Mc(e):(n==="number"?Ht:n==="string"?(r=Pn(e))?(e=r,rr):au:e instanceof Pn?rr:e instanceof Date?P7:L7(e)?R7:Array.isArray(e)?D7:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?F7:Ht)(t,e)}function ea(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var q7=180/Math.PI,Vm={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _w(t,e,n,r,o,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*q7,skewX:Math.atan(c)*q7,scaleX:s,scaleY:a}}var Wm;function B7(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Vm:_w(e.a,e.b,e.c,e.d,e.e,e.f)}function z7(t){return t==null?Vm:(Wm||(Wm=document.createElementNS("http://www.w3.org/2000/svg","g")),Wm.setAttribute("transform",t),(t=Wm.transform.baseVal.consolidate())?(t=t.matrix,_w(t.a,t.b,t.c,t.d,t.e,t.f)):Vm)}function Y7(t,e,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,l,u,p,d,h){if(f!==u||l!==p){var m=d.push("translate(",null,e,null,n);h.push({i:m-4,x:Ht(f,u)},{i:m-2,x:Ht(l,p)})}else(u||p)&&d.push("translate("+u+e+p+n)}function s(f,l,u,p){f!==l?(f-l>180?l+=360:l-f>180&&(f+=360),p.push({i:u.push(o(u)+"rotate(",null,r)-2,x:Ht(f,l)})):l&&u.push(o(u)+"rotate("+l+r)}function a(f,l,u,p){f!==l?p.push({i:u.push(o(u)+"skewX(",null,r)-2,x:Ht(f,l)}):l&&u.push(o(u)+"skewX("+l+r)}function c(f,l,u,p,d,h){if(f!==u||l!==p){var m=d.push(o(d)+"scale(",null,",",null,")");h.push({i:m-4,x:Ht(f,u)},{i:m-2,x:Ht(l,p)})}else(u!==1||p!==1)&&d.push(o(d)+"scale("+u+","+p+")")}return function(f,l){var u=[],p=[];return f=t(f),l=t(l),i(f.translateX,f.translateY,l.translateX,l.translateY,u,p),s(f.rotate,l.rotate,u,p),a(f.skewX,l.skewX,u,p),c(f.scaleX,f.scaleY,l.scaleX,l.scaleY,u,p),f=l=null,function(d){for(var h=-1,m=p.length,g;++h<m;)u[(g=p[h]).i]=g.x(d);return u.join("")}}}var Sw=Y7(B7,"px, ","px)","deg)"),Mw=Y7(z7,", ",")",")");var CB=1e-12;function U7(t){return((t=Math.exp(t))+1/t)/2}function kB(t){return((t=Math.exp(t))-1/t)/2}function NB(t){return((t=Math.exp(2*t))-1)/(t+1)}var Aw=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],f=i[2],l=s[0],u=s[1],p=s[2],d=l-a,h=u-c,m=d*d+h*h,g,y;if(m<CB)y=Math.log(p/f)/e,g=function(A){return[a+A*d,c+A*h,f*Math.exp(e*A*y)]};else{var x=Math.sqrt(m),b=(p*p-f*f+r*m)/(2*f*n*x),w=(p*p-f*f-r*m)/(2*p*n*x),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);y=(v-_)/e,g=function(A){var E=A*y,T=U7(_),$=f/(n*x)*(T*NB(e*E+_)-kB(_));return[a+$*d,c+$*h,f*T/U7(e*E+_)]}}return g.duration=y*1e3*e/Math.SQRT2,g}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},o}(Math.SQRT2,2,4);function j7(t){return function(e,n){var r=t((e=ou(e)).h,(n=ou(n)).h),o=Qt(e.s,n.s),i=Qt(e.l,n.l),s=Qt(e.opacity,n.opacity);return function(a){return e.h=r(a),e.s=o(a),e.l=i(a),e.opacity=s(a),e+""}}}var Tw=j7(Ac),OB=j7(Qt);function Hm(t,e){var n=Qt((t=Sc(t)).l,(e=Sc(e)).l),r=Qt(t.a,e.a),o=Qt(t.b,e.b),i=Qt(t.opacity,e.opacity);return function(s){return t.l=n(s),t.a=r(s),t.b=o(s),t.opacity=i(s),t+""}}function X7(t){return function(e,n){var r=t((e=iu(e)).h,(n=iu(n)).h),o=Qt(e.c,n.c),i=Qt(e.l,n.l),s=Qt(e.opacity,n.opacity);return function(a){return e.h=r(a),e.c=o(a),e.l=i(a),e.opacity=s(a),e+""}}}var Ew=X7(Ac),RB=X7(Qt);function G7(t){return function e(n){n=+n;function r(o,i){var s=t((o=pn(o)).h,(i=pn(i)).h),a=Qt(o.s,i.s),c=Qt(o.l,i.l),f=Qt(o.opacity,i.opacity);return function(l){return o.h=s(l),o.s=a(l),o.l=c(Math.pow(l,n)),o.opacity=f(l),o+""}}return r.gamma=e,r}(1)}var LB=G7(Ac),Tc=G7(Qt);function jr(t,e){e===void 0&&(e=t,t=Fn);for(var n=0,r=e.length-1,o=e[0],i=new Array(r<0?0:r);n<r;)i[n]=t(o,o=e[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return i[a](s-a)}}function Ze(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}var Ec=0,fu=0,cu=0,W7=1e3,Zm,lu,Qm=0,na=0,Jm=0,uu=typeof performance=="object"&&performance.now?performance:Date,H7=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function du(){return na||(H7(DB),na=uu.now()+Jm)}function DB(){na=0}function pu(){this._call=this._time=this._next=null}pu.prototype=Km.prototype={constructor:pu,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?du():+n)+(e==null?0:+e),!this._next&&lu!==this&&(lu?lu._next=this:Zm=this,lu=this),this._call=t,this._time=n,Iw()},stop:function(){this._call&&(this._call=null,this._time=1/0,Iw())}};function Km(t,e,n){var r=new pu;return r.restart(t,e,n),r}function Z7(){du(),++Ec;for(var t=Zm,e;t;)(e=na-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ec}function V7(){na=(Qm=uu.now())+Jm,Ec=fu=0;try{Z7()}finally{Ec=0,FB(),na=0}}function PB(){var t=uu.now(),e=t-Qm;e>W7&&(Jm-=e,Qm=t)}function FB(){for(var t,e=Zm,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Zm=n);lu=t,Iw(r)}function Iw(t){if(!Ec){fu&&(fu=clearTimeout(fu));var e=t-na;e>24?(t<1/0&&(fu=setTimeout(V7,t-uu.now()-Jm)),cu&&(cu=clearInterval(cu))):(cu||(Qm=uu.now(),cu=setInterval(PB,W7)),Ec=1,H7(V7))}}function t0(t,e,n){var r=new pu;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var qB=Hs("start","end","cancel","interrupt"),BB=[],K7=0,Q7=1,n0=2,e0=3,J7=4,r0=5,hu=6;function Pi(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;zB(t,n,{name:e,index:r,group:o,on:qB,tween:BB,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:K7})}function mu(t,e){var n=_e(t,e);if(n.state>K7)throw new Error("too late; already scheduled");return n}function je(t,e){var n=_e(t,e);if(n.state>e0)throw new Error("too late; already running");return n}function _e(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function zB(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Km(i,0,n.time);function i(f){n.state=Q7,n.timer.restart(s,n.delay,n.time),n.delay<=f&&s(f-n.delay)}function s(f){var l,u,p,d;if(n.state!==Q7)return c();for(l in r)if(d=r[l],d.name===n.name){if(d.state===e0)return t0(s);d.state===J7?(d.state=hu,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[l]):+l<e&&(d.state=hu,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[l])}if(t0(function(){n.state===e0&&(n.state=J7,n.timer.restart(a,n.delay,n.time),a(f))}),n.state=n0,n.on.call("start",t,t.__data__,n.index,n.group),n.state===n0){for(n.state=e0,o=new Array(p=n.tween.length),l=0,u=-1;l<p;++l)(d=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(o[++u]=d);o.length=u+1}}function a(f){for(var l=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(c),n.state=r0,1),u=-1,p=o.length;++u<p;)o[u].call(t,l);n.state===r0&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=hu,n.timer.stop(),delete r[e];for(var f in r)return;delete t.__transition}}function Xr(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){i=!1;continue}o=r.state>n0&&r.state<r0,r.state=hu,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function tI(t){return this.each(function(){Xr(this,t)})}function YB(t,e){var n,r;return function(){var o=je(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function UB(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=je(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:e,value:n},c=0,f=o.length;c<f;++c)if(o[c].name===e){o[c]=a;break}c===f&&o.push(a)}i.tween=o}}function eI(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=_e(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===t)return s.value;return null}return this.each((e==null?YB:UB)(n,t,e))}function Ic(t,e,n){var r=t._id;return t.each(function(){var o=je(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return _e(o,r).value[e]}}function o0(t,e){var n;return(typeof e=="number"?Ht:e instanceof Pn?rr:(n=Pn(e))?(e=n,rr):au)(t,e)}function jB(t){return function(){this.removeAttribute(t)}}function XB(t){return function(){this.removeAttributeNS(t.space,t.local)}}function GB(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function VB(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function WB(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function HB(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function nI(t,e){var n=qo(t),r=n==="transform"?Mw:o0;return this.attrTween(t,typeof e=="function"?(n.local?HB:WB)(n,r,Ic(this,"attr."+t,e)):e==null?(n.local?XB:jB)(n):(n.local?VB:GB)(n,r,e))}function ZB(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function QB(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function JB(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&QB(t,i)),n}return o._value=e,o}function KB(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&ZB(t,i)),n}return o._value=e,o}function rI(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=qo(t);return this.tween(n,(r.local?JB:KB)(r,e))}function tz(t,e){return function(){mu(this,t).delay=+e.apply(this,arguments)}}function ez(t,e){return e=+e,function(){mu(this,t).delay=e}}function oI(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?tz:ez)(e,t)):_e(this.node(),e).delay}function nz(t,e){return function(){je(this,t).duration=+e.apply(this,arguments)}}function rz(t,e){return e=+e,function(){je(this,t).duration=e}}function iI(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?nz:rz)(e,t)):_e(this.node(),e).duration}function oz(t,e){if(typeof e!="function")throw new Error;return function(){je(this,t).ease=e}}function sI(t){var e=this._id;return arguments.length?this.each(oz(e,t)):_e(this.node(),e).ease}function iz(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;je(this,t).ease=n}}function aI(t){if(typeof t!="function")throw new Error;return this.each(iz(this._id,t))}function cI(t){typeof t!="function"&&(t=Jl(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,f=0;f<s;++f)(c=i[f])&&t.call(c,c.__data__,f,i)&&a.push(c);return new dn(r,this._parents,this._name,this._id)}function fI(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=e[a],f=n[a],l=c.length,u=s[a]=new Array(l),p,d=0;d<l;++d)(p=c[d]||f[d])&&(u[d]=p);for(;a<r;++a)s[a]=e[a];return new dn(s,this._parents,this._name,this._id)}function sz(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function az(t,e,n){var r,o,i=sz(e)?mu:je;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function lI(t,e){var n=this._id;return arguments.length<2?_e(this.node(),n).on.on(t):this.each(az(n,t,e))}function cz(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function uI(){return this.on("end.remove",cz(this._id))}function pI(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Zs(t));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,f=i[s]=new Array(c),l,u,p=0;p<c;++p)(l=a[p])&&(u=t.call(l,l.__data__,p,a))&&("__data__"in l&&(u.__data__=l.__data__),f[p]=u,Pi(f[p],e,n,p,f,_e(l,n)));return new dn(i,this._parents,e,n)}function dI(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ql(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],f=c.length,l,u=0;u<f;++u)if(l=c[u]){for(var p=t.call(l,l.__data__,u,c),d,h=_e(l,n),m=0,g=p.length;m<g;++m)(d=p[m])&&Pi(d,e,n,m,p,h);i.push(p),s.push(l)}return new dn(i,s,e,n)}var fz=zo.prototype.constructor;function hI(){return new fz(this._groups,this._parents)}function lz(t,e){var n,r,o;return function(){var i=Ri(this,t),s=(this.style.removeProperty(t),Ri(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function mI(t){return function(){this.style.removeProperty(t)}}function uz(t,e,n){var r,o=n+"",i;return function(){var s=Ri(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function pz(t,e,n){var r,o,i;return function(){var s=Ri(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ri(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a))}}function dz(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var c=je(this,t),f=c.on,l=c.value[i]==null?a||(a=mI(e)):void 0;(f!==n||o!==l)&&(r=(n=f).copy()).on(s,o=l),c.on=r}}function gI(t,e,n){var r=(t+="")=="transform"?Sw:o0;return e==null?this.styleTween(t,lz(t,r)).on("end.style."+t,mI(t)):typeof e=="function"?this.styleTween(t,pz(t,r,Ic(this,"style."+t,e))).each(dz(this._id,t)):this.styleTween(t,uz(t,r,e),n).on("end.style."+t,null)}function hz(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function mz(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&hz(t,s,n)),r}return i._value=e,i}function yI(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,mz(t,e,n??""))}function gz(t){return function(){this.textContent=t}}function yz(t){return function(){var e=t(this);this.textContent=e??""}}function xI(t){return this.tween("text",typeof t=="function"?yz(Ic(this,"text",t)):gz(t==null?"":t+""))}function xz(t){return function(e){this.textContent=t.call(this,e)}}function bz(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&xz(o)),e}return r._value=t,r}function bI(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,bz(t))}function wI(){for(var t=this._name,e=this._id,n=i0(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,f=0;f<a;++f)if(c=s[f]){var l=_e(c,e);Pi(c,t,n,f,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new dn(r,this._parents,t,n)}function vI(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var f=je(this,r),l=f.on;l!==t&&(e=(t=l).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),f.on=e}),o===0&&i()})}var wz=0;function dn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function _I(t){return zo().transition(t)}function i0(){return++wz}var jo=zo.prototype;dn.prototype=_I.prototype={constructor:dn,select:pI,selectAll:dI,selectChild:jo.selectChild,selectChildren:jo.selectChildren,filter:cI,merge:fI,selection:hI,transition:wI,call:jo.call,nodes:jo.nodes,node:jo.node,size:jo.size,empty:jo.empty,each:jo.each,on:lI,attr:nI,attrTween:rI,style:gI,styleTween:yI,text:xI,textTween:bI,remove:uI,tween:eI,delay:oI,duration:iI,ease:sI,easeVarying:aI,end:vI,[Symbol.iterator]:jo[Symbol.iterator]};function s0(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var vz={time:null,delay:0,duration:250,ease:s0};function _z(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function SI(t){var e,n;t instanceof dn?(e=t._id,t=t._name):(e=i0(),(n=vz).time=du(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&Pi(c,t,e,f,s,n||_z(c,e));return new dn(r,this._parents,t,e)}zo.prototype.interrupt=tI;zo.prototype.transition=SI;var a0=t=>()=>t;function $w(t,{sourceEvent:e,target:n,selection:r,mode:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function MI(t){t.stopImmediatePropagation()}function c0(t){t.preventDefault(),t.stopImmediatePropagation()}var AI={name:"drag"},Cw={name:"space"},$c={name:"handle"},Cc={name:"center"},{abs:TI,max:Qe,min:Je}=Math;function EI(t){return[+t[0],+t[1]]}function Nw(t){return[EI(t[0]),EI(t[1])]}var f0={name:"x",handles:["w","e"].map(gu),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},l0={name:"y",handles:["n","s"].map(gu),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Sz={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(gu),input:function(t){return t==null?null:Nw(t)},output:function(t){return t}},Xo={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"},II={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},$I={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Mz={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Az={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function gu(t){return{type:t}}function Tz(t){return!t.ctrlKey&&!t.button}function Ez(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Iz(){return navigator.maxTouchPoints||"ontouchstart"in this}function kw(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function $z(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Ow(){return Dw(f0)}function Rw(){return Dw(l0)}function Lw(){return Dw(Sz)}function Dw(t){var e=Ez,n=Tz,r=Iz,o=!0,i=Hs("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([gu("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Xo.overlay).merge(y).each(function(){var b=kw(this).extent;St(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),g.selectAll(".selection").data([gu("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Xo.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=g.selectAll(".handle").data(t.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return Xo[b.type]}),g.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",p).filter(r).on("touchstart.brush",p).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",h).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,y,x){g.tween?g.on("start.brush",function(b){l(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){l(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,_=l(b,arguments),v=w.selection,A=t.input(typeof y=="function"?y.apply(this,arguments):y,w.extent),E=Fn(v,A);function T($){w.selection=$===1&&A===null?null:E($),f.call(b),_.brush()}return v!==null&&A!==null?T:T(1)}):g.each(function(){var b=this,w=arguments,_=b.__brush,v=t.input(typeof y=="function"?y.apply(b,w):y,_.extent),A=l(b,w).beforestart();Xr(b),_.selection=v===null?null:v,f.call(b),A.start(x).brush(x).end(x)})},c.clear=function(g,y){c.move(g,null,y)};function f(){var g=St(this),y=kw(this).selection;y?(g.selectAll(".selection").style("display",null).attr("x",y[0][0]).attr("y",y[0][1]).attr("width",y[1][0]-y[0][0]).attr("height",y[1][1]-y[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?y[1][1]-y[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function l(g,y,x){var b=g.__brush.emitter;return b&&(!x||!b.clean)?b:new u(g,y,x)}function u(g,y,x){this.that=g,this.args=y,this.state=g.__brush,this.active=0,this.clean=x}u.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(g,y){return this.starting?(this.starting=!1,this.emit("start",g,y)):this.emit("brush",g),this},brush:function(g,y){return this.emit("brush",g,y),this},end:function(g,y){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,y)),this},emit:function(g,y,x){var b=St(this.that).datum();i.call(g,this.that,new $w(g,{sourceEvent:y,target:c,selection:t.output(this.state.selection),mode:x,dispatch:i}),b)}};function p(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,x=g.target.__data__.type,b=(o&&g.metaKey?x="overlay":x)==="selection"?AI:o&&g.altKey?Cc:$c,w=t===l0?null:Mz[x],_=t===f0?null:Az[x],v=kw(y),A=v.extent,E=v.selection,T=A[0][0],$,M,k=A[0][1],R,S,I=A[1][0],C,N,D=A[1][1],L,P,F=0,q=0,W,tt=w&&_&&o&&g.shiftKey,nt,ot,X=Array.from(g.touches||[g],J=>{let qt=J.identifier;return J=He(J,y),J.point0=J.slice(),J.identifier=qt,J});Xr(y);var rt=l(y,arguments,!0).beforestart();if(x==="overlay"){E&&(W=!0);let J=[X[0],X[1]||X[0]];v.selection=E=[[$=t===l0?T:Je(J[0][0],J[1][0]),R=t===f0?k:Je(J[0][1],J[1][1])],[C=t===l0?I:Qe(J[0][0],J[1][0]),L=t===f0?D:Qe(J[0][1],J[1][1])]],X.length>1&&wt(g)}else $=E[0][0],R=E[0][1],C=E[1][0],L=E[1][1];M=$,S=R,N=C,P=L;var Y=St(y).attr("pointer-events","none"),H=Y.selectAll(".overlay").attr("cursor",Xo[x]);if(g.touches)rt.moved=B,rt.ended=ct;else{var et=St(g.view).on("mousemove.brush",B,!0).on("mouseup.brush",ct,!0);o&&et.on("keydown.brush",It,!0).on("keyup.brush",kt,!0),tu(g.view)}f.call(y),rt.start(g,b.name);function B(J){for(let qt of J.changedTouches||[J])for(let Nn of X)Nn.identifier===qt.identifier&&(Nn.cur=He(qt,y));if(tt&&!nt&&!ot&&X.length===1){let qt=X[0];TI(qt.cur[0]-qt[0])>TI(qt.cur[1]-qt[1])?ot=!0:nt=!0}for(let qt of X)qt.cur&&(qt[0]=qt.cur[0],qt[1]=qt.cur[1]);W=!0,c0(J),wt(J)}function wt(J){let qt=X[0],Nn=qt.point0;var kr;switch(F=qt[0]-Nn[0],q=qt[1]-Nn[1],b){case Cw:case AI:{w&&(F=Qe(T-$,Je(I-C,F)),M=$+F,N=C+F),_&&(q=Qe(k-R,Je(D-L,q)),S=R+q,P=L+q);break}case $c:{X[1]?(w&&(M=Qe(T,Je(I,X[0][0])),N=Qe(T,Je(I,X[1][0])),w=1),_&&(S=Qe(k,Je(D,X[0][1])),P=Qe(k,Je(D,X[1][1])),_=1)):(w<0?(F=Qe(T-$,Je(I-$,F)),M=$+F,N=C):w>0&&(F=Qe(T-C,Je(I-C,F)),M=$,N=C+F),_<0?(q=Qe(k-R,Je(D-R,q)),S=R+q,P=L):_>0&&(q=Qe(k-L,Je(D-L,q)),S=R,P=L+q));break}case Cc:{w&&(M=Qe(T,Je(I,$-F*w)),N=Qe(T,Je(I,C+F*w))),_&&(S=Qe(k,Je(D,R-q*_)),P=Qe(k,Je(D,L+q*_)));break}}N<M&&(w*=-1,kr=$,$=C,C=kr,kr=M,M=N,N=kr,x in II&&H.attr("cursor",Xo[x=II[x]])),P<S&&(_*=-1,kr=R,R=L,L=kr,kr=S,S=P,P=kr,x in $I&&H.attr("cursor",Xo[x=$I[x]])),v.selection&&(E=v.selection),nt&&(M=E[0][0],N=E[1][0]),ot&&(S=E[0][1],P=E[1][1]),(E[0][0]!==M||E[0][1]!==S||E[1][0]!==N||E[1][1]!==P)&&(v.selection=[[M,S],[N,P]],f.call(y),rt.brush(J,b.name))}function ct(J){if(MI(J),J.touches){if(J.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else eu(J.view,W),et.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Y.attr("pointer-events","all"),H.attr("cursor",Xo.overlay),v.selection&&(E=v.selection),$z(E)&&(v.selection=null,f.call(y)),rt.end(J,b.name)}function It(J){switch(J.keyCode){case 16:{tt=w&&_;break}case 18:{b===$c&&(w&&(C=N-F*w,$=M+F*w),_&&(L=P-q*_,R=S+q*_),b=Cc,wt(J));break}case 32:{(b===$c||b===Cc)&&(w<0?C=N-F:w>0&&($=M-F),_<0?L=P-q:_>0&&(R=S-q),b=Cw,H.attr("cursor",Xo.selection),wt(J));break}default:return}c0(J)}function kt(J){switch(J.keyCode){case 16:{tt&&(nt=ot=tt=!1,wt(J));break}case 18:{b===Cc&&(w<0?C=N:w>0&&($=M),_<0?L=P:_>0&&(R=S),b=$c,wt(J));break}case 32:{b===Cw&&(J.altKey?(w&&(C=N-F*w,$=M+F*w),_&&(L=P-q*_,R=S+q*_),b=Cc):(w<0?C=N:w>0&&($=M),_<0?L=P:_>0&&(R=S),b=$c),H.attr("cursor",Xo[x]),wt(J));break}default:return}c0(J)}}function d(g){l(this,arguments).moved(g)}function h(g){l(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=Nw(e.apply(this,arguments)),g.dim=t,g}return c.extent=function(g){return arguments.length?(e=typeof g=="function"?g:a0(Nw(g)),c):e},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:a0(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:a0(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(o=!!g,c):o},c.on=function(){var g=i.on.apply(i,arguments);return g===i?c:g},c}var Pw=Math.PI,Fw=2*Pw,ra=1e-6,Cz=Fw-ra;function CI(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function kz(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return CI;let n=10**e;return function(r){this._+=r[0];for(let o=1,i=r.length;o<i;++o)this._+=Math.round(arguments[o]*n)/n+r[o]}}var Fi=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?CI:kz(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,o){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+o}`}bezierCurveTo(e,n,r,o,i,s){this._append`C${+e},${+n},${+r},${+o},${this._x1=+i},${this._y1=+s}`}arcTo(e,n,r,o,i){if(e=+e,n=+n,r=+r,o=+o,i=+i,i<0)throw new Error(`negative radius: ${i}`);let s=this._x1,a=this._y1,c=r-e,f=o-n,l=s-e,u=a-n,p=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(p>ra)if(!(Math.abs(u*c-f*l)>ra)||!i)this._append`L${this._x1=e},${this._y1=n}`;else{let d=r-s,h=o-a,m=c*c+f*f,g=d*d+h*h,y=Math.sqrt(m),x=Math.sqrt(p),b=i*Math.tan((Pw-Math.acos((m+p-g)/(2*y*x)))/2),w=b/x,_=b/y;Math.abs(w-1)>ra&&this._append`L${e+w*l},${n+w*u}`,this._append`A${i},${i},0,0,${+(u*d>l*h)},${this._x1=e+_*c},${this._y1=n+_*f}`}}arc(e,n,r,o,i,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(o),c=r*Math.sin(o),f=e+a,l=n+c,u=1^s,p=s?o-i:i-o;this._x1===null?this._append`M${f},${l}`:(Math.abs(this._x1-f)>ra||Math.abs(this._y1-l)>ra)&&this._append`L${f},${l}`,r&&(p<0&&(p=p%Fw+Fw),p>Cz?this._append`A${r},${r},0,1,${u},${e-a},${n-c}A${r},${r},0,1,${u},${this._x1=f},${this._y1=l}`:p>ra&&this._append`A${r},${r},0,${+(p>=Pw)},${u},${this._x1=e+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(e,n,r,o){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+o}h${-r}Z`}toString(){return this._}};function kI(){return new Fi}kI.prototype=Fi.prototype;function hn(t=3){return new Fi(+t)}var Nz=Array.prototype,u0=Nz.slice;function NI(t,e){return t-e}function OI(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}var Gr=t=>()=>t;function RI(t,e){for(var n=-1,r=e.length,o;++n<r;)if(o=Oz(t,e[n]))return o;return 0}function Oz(t,e){for(var n=e[0],r=e[1],o=-1,i=0,s=t.length,a=s-1;i<s;a=i++){var c=t[i],f=c[0],l=c[1],u=t[a],p=u[0],d=u[1];if(Rz(c,u,e))return 0;l>r!=d>r&&n<(p-f)*(r-l)/(d-l)+f&&(o=-o)}return o}function Rz(t,e,n){var r;return Lz(t,e,n)&&Dz(t[r=+(t[0]===e[0])],n[r],e[r])}function Lz(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}function Dz(t,e,n){return t<=e&&e<=n||n<=e&&e<=t}function LI(){}var Go=[[],[[[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 qi(){var t=1,e=1,n=Ni,r=c;function o(f){var l=n(f);if(Array.isArray(l))l=l.slice().sort(NI);else{let u=Rt(f,Pz);for(l=Ye(...xc(u[0],u[1],l),l);l[l.length-1]>=u[1];)l.pop();for(;l[1]<u[0];)l.shift()}return l.map(u=>i(f,u))}function i(f,l){let u=l==null?NaN:+l;if(isNaN(u))throw new Error(`invalid value: ${l}`);var p=[],d=[];return s(f,u,function(h){r(h,f,u),OI(h)>0?p.push([h]):d.push(h)}),d.forEach(function(h){for(var m=0,g=p.length,y;m<g;++m)if(RI((y=p[m])[0],h)!==-1){y.push(h);return}}),{type:"MultiPolygon",value:l,coordinates:p}}function s(f,l,u){var p=new Array,d=new Array,h,m,g,y,x,b;for(h=m=-1,y=oa(f[0],l),Go[y<<1].forEach(w);++h<t-1;)g=y,y=oa(f[h+1],l),Go[g|y<<1].forEach(w);for(Go[y<<0].forEach(w);++m<e-1;){for(h=-1,y=oa(f[m*t+t],l),x=oa(f[m*t],l),Go[y<<1|x<<2].forEach(w);++h<t-1;)g=y,y=oa(f[m*t+t+h+1],l),b=x,x=oa(f[m*t+h+1],l),Go[g|y<<1|x<<2|b<<3].forEach(w);Go[y|x<<3].forEach(w)}for(h=-1,x=f[m*t]>=l,Go[x<<2].forEach(w);++h<t-1;)b=x,x=oa(f[m*t+h+1],l),Go[x<<2|b<<3].forEach(w);Go[x<<3].forEach(w);function w(_){var v=[_[0][0]+h,_[0][1]+m],A=[_[1][0]+h,_[1][1]+m],E=a(v),T=a(A),$,M;($=d[E])?(M=p[T])?(delete d[$.end],delete p[M.start],$===M?($.ring.push(A),u($.ring)):p[$.start]=d[M.end]={start:$.start,end:M.end,ring:$.ring.concat(M.ring)}):(delete d[$.end],$.ring.push(A),d[$.end=T]=$):($=p[T])?(M=d[E])?(delete p[$.start],delete d[M.end],$===M?($.ring.push(A),u($.ring)):p[M.start]=d[$.end]={start:M.start,end:$.end,ring:M.ring.concat($.ring)}):(delete p[$.start],$.ring.unshift(v),p[$.start=E]=$):p[E]=d[T]={start:E,end:T,ring:[v,A]}}}function a(f){return f[0]*2+f[1]*(t+1)*4}function c(f,l,u){f.forEach(function(p){var d=p[0],h=p[1],m=d|0,g=h|0,y=qw(l[g*t+m]);d>0&&d<t&&m===d&&(p[0]=DI(d,qw(l[g*t+m-1]),y,u)),h>0&&h<e&&g===h&&(p[1]=DI(h,qw(l[(g-1)*t+m]),y,u))})}return o.contour=i,o.size=function(f){if(!arguments.length)return[t,e];var l=Math.floor(f[0]),u=Math.floor(f[1]);if(!(l>=0&&u>=0))throw new Error("invalid size");return t=l,e=u,o},o.thresholds=function(f){return arguments.length?(n=typeof f=="function"?f:Array.isArray(f)?Gr(u0.call(f)):Gr(f),o):n},o.smooth=function(f){return arguments.length?(r=f?c:LI,o):r===c},o}function Pz(t){return isFinite(t)?t:NaN}function oa(t,e){return t==null?!1:+t>=e}function qw(t){return t==null||isNaN(t=+t)?-1/0:t}function DI(t,e,n,r){let o=r-e,i=n-e,s=isFinite(o)||isFinite(i)?o/i:Math.sign(o)/Math.sign(i);return isNaN(s)?t:t+s-.5}function Fz(t){return t[0]}function qz(t){return t[1]}function Bz(){return 1}function Bw(){var t=Fz,e=qz,n=Bz,r=960,o=500,i=20,s=2,a=i*3,c=r+a*2>>s,f=o+a*2>>s,l=Gr(20);function u(x){var b=new Float32Array(c*f),w=Math.pow(2,-s),_=-1;for(let R of x){var v=(t(R,++_,x)+a)*w,A=(e(R,_,x)+a)*w,E=+n(R,_,x);if(E&&v>=0&&v<c&&A>=0&&A<f){var T=Math.floor(v),$=Math.floor(A),M=v-T-.5,k=A-$-.5;b[T+$*c]+=(1-M)*(1-k)*E,b[T+1+$*c]+=M*(1-k)*E,b[T+1+($+1)*c]+=M*k*E,b[T+($+1)*c]+=(1-M)*k*E}}return Xl({data:b,width:c,height:f},i*w),b}function p(x){var b=u(x),w=l(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=Ye(Number.MIN_VALUE,Ct(b)/_,w)),qi().size([c,f]).thresholds(w.map(v=>v*_))(b).map((v,A)=>(v.value=+w[A],d(v)))}p.contours=function(x){var b=u(x),w=qi().size([c,f]),_=Math.pow(2,2*s),v=A=>{A=+A;var E=d(w.contour(b,A*_));return E.value=A,E};return Object.defineProperty(v,"max",{get:()=>Ct(b)/_}),v};function d(x){return x.coordinates.forEach(h),x}function h(x){x.forEach(m)}function m(x){x.forEach(g)}function g(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function y(){return a=i*3,c=r+a*2>>s,f=o+a*2>>s,p}return p.x=function(x){return arguments.length?(t=typeof x=="function"?x:Gr(+x),p):t},p.y=function(x){return arguments.length?(e=typeof x=="function"?x:Gr(+x),p):e},p.weight=function(x){return arguments.length?(n=typeof x=="function"?x:Gr(+x),p):n},p.size=function(x){if(!arguments.length)return[r,o];var b=+x[0],w=+x[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,o=w,y()},p.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),y()},p.thresholds=function(x){return arguments.length?(l=typeof x=="function"?x:Array.isArray(x)?Gr(u0.call(x)):Gr(x),p):l},p.bandwidth=function(x){if(!arguments.length)return Math.sqrt(i*(i+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return i=(Math.sqrt(4*x*x+1)-1)/2,y()},p}var Nt=11102230246251565e-32,de=134217729,yu=(3+8*Nt)*Nt;function ia(t,e,n,r,o){let i,s,a,c,f=e[0],l=r[0],u=0,p=0;l>f==l>-f?(i=f,f=e[++u]):(i=l,l=r[++p]);let d=0;if(u<t&&p<n)for(l>f==l>-f?(s=f+i,a=i-(s-f),f=e[++u]):(s=l+i,a=i-(s-l),l=r[++p]),i=s,a!==0&&(o[d++]=a);u<t&&p<n;)l>f==l>-f?(s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++u]):(s=i+l,c=s-i,a=i-(s-c)+(l-c),l=r[++p]),i=s,a!==0&&(o[d++]=a);for(;u<t;)s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++u],i=s,a!==0&&(o[d++]=a);for(;p<n;)s=i+l,c=s-i,a=i-(s-c)+(l-c),l=r[++p],i=s,a!==0&&(o[d++]=a);return(i!==0||d===0)&&(o[d++]=i),d}function xu(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function j(t){return new Float64Array(t)}var zz=(3+16*Nt)*Nt,Yz=(2+12*Nt)*Nt,Uz=(9+64*Nt)*Nt*Nt,kc=j(4),PI=j(8),FI=j(12),qI=j(16),mn=j(4);function jz(t,e,n,r,o,i,s){let a,c,f,l,u,p,d,h,m,g,y,x,b,w,_,v,A,E,T=t-o,$=n-o,M=e-i,k=r-i;w=T*k,p=de*T,d=p-(p-T),h=T-d,p=de*k,m=p-(p-k),g=k-m,_=h*g-(w-d*m-h*m-d*g),v=M*$,p=de*M,d=p-(p-M),h=M-d,p=de*$,m=p-(p-$),g=$-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,kc[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,kc[1]=b-(y+u)+(u-v),E=x+y,u=E-x,kc[2]=x-(E-u)+(y-u),kc[3]=E;let R=xu(4,kc),S=Yz*s;if(R>=S||-R>=S||(u=t-T,a=t-(T+u)+(u-o),u=n-$,f=n-($+u)+(u-o),u=e-M,c=e-(M+u)+(u-i),u=r-k,l=r-(k+u)+(u-i),a===0&&c===0&&f===0&&l===0)||(S=Uz*s+yu*Math.abs(R),R+=T*l+k*a-(M*f+$*c),R>=S||-R>=S))return R;w=a*k,p=de*a,d=p-(p-a),h=a-d,p=de*k,m=p-(p-k),g=k-m,_=h*g-(w-d*m-h*m-d*g),v=c*$,p=de*c,d=p-(p-c),h=c-d,p=de*$,m=p-(p-$),g=$-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,mn[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,mn[1]=b-(y+u)+(u-v),E=x+y,u=E-x,mn[2]=x-(E-u)+(y-u),mn[3]=E;let I=ia(4,kc,4,mn,PI);w=T*l,p=de*T,d=p-(p-T),h=T-d,p=de*l,m=p-(p-l),g=l-m,_=h*g-(w-d*m-h*m-d*g),v=M*f,p=de*M,d=p-(p-M),h=M-d,p=de*f,m=p-(p-f),g=f-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,mn[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,mn[1]=b-(y+u)+(u-v),E=x+y,u=E-x,mn[2]=x-(E-u)+(y-u),mn[3]=E;let C=ia(I,PI,4,mn,FI);w=a*l,p=de*a,d=p-(p-a),h=a-d,p=de*l,m=p-(p-l),g=l-m,_=h*g-(w-d*m-h*m-d*g),v=c*f,p=de*c,d=p-(p-c),h=c-d,p=de*f,m=p-(p-f),g=f-m,A=h*g-(v-d*m-h*m-d*g),y=_-A,u=_-y,mn[0]=_-(y+u)+(u-A),x=w+y,u=x-w,b=w-(x-u)+(y-u),y=b-v,u=b-y,mn[1]=b-(y+u)+(u-v),E=x+y,u=E-x,mn[2]=x-(E-u)+(y-u),mn[3]=E;let N=ia(C,FI,4,mn,qI);return qI[N-1]}function Nc(t,e,n,r,o,i){let s=(e-i)*(n-o),a=(t-o)*(r-i),c=s-a,f=Math.abs(s+a);return Math.abs(c)>=zz*f?c:-jz(t,e,n,r,o,i,f)}var Iht=(7+56*Nt)*Nt,$ht=(3+28*Nt)*Nt,Cht=(26+288*Nt)*Nt*Nt,kht=j(4),Nht=j(4),Oht=j(4),Rht=j(4),Lht=j(4),Dht=j(4),Pht=j(4),Fht=j(4),qht=j(4),Bht=j(8),zht=j(8),Yht=j(8),Uht=j(4),jht=j(8),Xht=j(8),Ght=j(8),Vht=j(12),Wht=j(192),Hht=j(192);var Jht=(10+96*Nt)*Nt,Kht=(4+48*Nt)*Nt,tmt=(44+576*Nt)*Nt*Nt,emt=j(4),nmt=j(4),rmt=j(4),omt=j(4),imt=j(4),smt=j(4),amt=j(4),cmt=j(4),fmt=j(8),lmt=j(8),umt=j(8),pmt=j(8),dmt=j(8),hmt=j(8),mmt=j(8),gmt=j(8),ymt=j(8),xmt=j(4),bmt=j(4),wmt=j(4),vmt=j(8),_mt=j(16),Smt=j(16),Mmt=j(16),Amt=j(32),Tmt=j(32),Emt=j(48),Imt=j(64),$mt=j(1152),Cmt=j(1152);var Rmt=(16+224*Nt)*Nt,Lmt=(5+72*Nt)*Nt,Dmt=(71+1408*Nt)*Nt*Nt,Pmt=j(4),Fmt=j(4),qmt=j(4),Bmt=j(4),zmt=j(4),Ymt=j(4),Umt=j(4),jmt=j(4),Xmt=j(4),Gmt=j(4),Vmt=j(24),Wmt=j(24),Hmt=j(24),Zmt=j(24),Qmt=j(24),Jmt=j(24),Kmt=j(24),t0t=j(24),e0t=j(24),n0t=j(24),r0t=j(1152),o0t=j(1152),i0t=j(1152),s0t=j(1152),a0t=j(1152),c0t=j(2304),f0t=j(2304),l0t=j(3456),u0t=j(5760),p0t=j(8),d0t=j(8),h0t=j(8),m0t=j(16),g0t=j(24),y0t=j(48),x0t=j(48),b0t=j(96),w0t=j(192),v0t=j(384),_0t=j(384),S0t=j(384),M0t=j(768);var A0t=j(96),T0t=j(96),E0t=j(96),I0t=j(1152);var zI=Math.pow(2,-52),p0=new Uint32Array(512),Rc=class t{static from(e,n=Zz,r=Qz){let o=e.length,i=new Float64Array(o*2);for(let s=0;s<o;s++){let a=e[s];i[2*s]=n(a),i[2*s+1]=r(a)}return new t(i)}constructor(e){let n=e.length>>1;if(n>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:e,_hullPrev:n,_hullNext:r,_hullTri:o,_hullHash:i}=this,s=e.length>>1,a=1/0,c=1/0,f=-1/0,l=-1/0;for(let T=0;T<s;T++){let $=e[2*T],M=e[2*T+1];$<a&&(a=$),M<c&&(c=M),$>f&&(f=$),M>l&&(l=M),this._ids[T]=T}let u=(a+f)/2,p=(c+l)/2,d,h,m;for(let T=0,$=1/0;T<s;T++){let M=zw(u,p,e[2*T],e[2*T+1]);M<$&&(d=T,$=M)}let g=e[2*d],y=e[2*d+1];for(let T=0,$=1/0;T<s;T++){if(T===d)continue;let M=zw(g,y,e[2*T],e[2*T+1]);M<$&&M>0&&(h=T,$=M)}let x=e[2*h],b=e[2*h+1],w=1/0;for(let T=0;T<s;T++){if(T===d||T===h)continue;let $=Wz(g,y,x,b,e[2*T],e[2*T+1]);$<w&&(m=T,w=$)}let _=e[2*m],v=e[2*m+1];if(w===1/0){for(let M=0;M<s;M++)this._dists[M]=e[2*M]-e[0]||e[2*M+1]-e[1];Oc(this._ids,this._dists,0,s-1);let T=new Uint32Array(s),$=0;for(let M=0,k=-1/0;M<s;M++){let R=this._ids[M],S=this._dists[R];S>k&&(T[$++]=R,k=S)}this.hull=T.subarray(0,$),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Nc(g,y,x,b,_,v)<0){let T=h,$=x,M=b;h=m,x=_,b=v,m=T,_=$,v=M}let A=Hz(g,y,x,b,_,v);this._cx=A.x,this._cy=A.y;for(let T=0;T<s;T++)this._dists[T]=zw(e[2*T],e[2*T+1],A.x,A.y);Oc(this._ids,this._dists,0,s-1),this._hullStart=d;let E=3;r[d]=n[m]=h,r[h]=n[d]=m,r[m]=n[h]=d,o[d]=0,o[h]=1,o[m]=2,i.fill(-1),i[this._hashKey(g,y)]=d,i[this._hashKey(x,b)]=h,i[this._hashKey(_,v)]=m,this.trianglesLen=0,this._addTriangle(d,h,m,-1,-1,-1);for(let T=0,$,M;T<this._ids.length;T++){let k=this._ids[T],R=e[2*k],S=e[2*k+1];if(T>0&&Math.abs(R-$)<=zI&&Math.abs(S-M)<=zI||($=R,M=S,k===d||k===h||k===m))continue;let I=0;for(let P=0,F=this._hashKey(R,S);P<this._hashSize&&(I=i[(F+P)%this._hashSize],!(I!==-1&&I!==r[I]));P++);I=n[I];let C=I,N;for(;N=r[C],Nc(R,S,e[2*C],e[2*C+1],e[2*N],e[2*N+1])>=0;)if(C=N,C===I){C=-1;break}if(C===-1)continue;let D=this._addTriangle(C,k,r[C],-1,-1,o[C]);o[k]=this._legalize(D+2),o[C]=D,E++;let L=r[C];for(;N=r[L],Nc(R,S,e[2*L],e[2*L+1],e[2*N],e[2*N+1])<0;)D=this._addTriangle(L,k,N,o[k],-1,o[L]),o[k]=this._legalize(D+2),r[L]=L,E--,L=N;if(C===I)for(;N=n[C],Nc(R,S,e[2*N],e[2*N+1],e[2*C],e[2*C+1])<0;)D=this._addTriangle(N,k,C,-1,o[C],o[N]),this._legalize(D+2),o[N]=D,r[C]=C,E--,C=N;this._hullStart=n[k]=C,r[C]=n[L]=k,r[k]=L,i[this._hashKey(R,S)]=k,i[this._hashKey(e[2*C],e[2*C+1])]=C}this.hull=new Uint32Array(E);for(let T=0,$=this._hullStart;T<E;T++)this.hull[T]=$,$=r[$];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,n){return Math.floor(Gz(e-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:n,_halfedges:r,coords:o}=this,i=0,s=0;for(;;){let a=r[e],c=e-e%3;if(s=c+(e+2)%3,a===-1){if(i===0)break;e=p0[--i];continue}let f=a-a%3,l=c+(e+1)%3,u=f+(a+2)%3,p=n[s],d=n[e],h=n[l],m=n[u];if(Vz(o[2*p],o[2*p+1],o[2*d],o[2*d+1],o[2*h],o[2*h+1],o[2*m],o[2*m+1])){n[e]=m,n[a]=p;let y=r[u];if(y===-1){let b=this._hullStart;do{if(this._hullTri[b]===u){this._hullTri[b]=e;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(e,y),this._link(a,r[s]),this._link(s,u);let x=f+(a+1)%3;i<p0.length&&(p0[i++]=x)}else{if(i===0)break;e=p0[--i]}}return s}_link(e,n){this._halfedges[e]=n,n!==-1&&(this._halfedges[n]=e)}_addTriangle(e,n,r,o,i,s){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,o),this._link(a+1,i),this._link(a+2,s),this.trianglesLen+=3,a}};function Gz(t,e){let n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}function zw(t,e,n,r){let o=t-n,i=e-r;return o*o+i*i}function Vz(t,e,n,r,o,i,s,a){let c=t-s,f=e-a,l=n-s,u=r-a,p=o-s,d=i-a,h=c*c+f*f,m=l*l+u*u,g=p*p+d*d;return c*(u*g-m*d)-f*(l*g-m*p)+h*(l*d-u*p)<0}function Wz(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,l=s*s+a*a,u=c*c+f*f,p=.5/(s*f-a*c),d=(f*l-a*u)*p,h=(s*u-c*l)*p;return d*d+h*h}function Hz(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,l=s*s+a*a,u=c*c+f*f,p=.5/(s*f-a*c),d=t+(f*l-a*u)*p,h=e+(s*u-c*l)*p;return{x:d,y:h}}function Oc(t,e,n,r){if(r-n<=20)for(let o=n+1;o<=r;o++){let i=t[o],s=e[i],a=o-1;for(;a>=n&&e[t[a]]>s;)t[a+1]=t[a--];t[a+1]=i}else{let o=n+r>>1,i=n+1,s=r;bu(t,o,i),e[t[n]]>e[t[r]]&&bu(t,n,r),e[t[i]]>e[t[r]]&&bu(t,i,r),e[t[n]]>e[t[i]]&&bu(t,n,i);let a=t[i],c=e[a];for(;;){do i++;while(e[t[i]]<c);do s--;while(e[t[s]]>c);if(s<i)break;bu(t,i,s)}t[n+1]=t[s],t[s]=a,r-i+1>=s-n?(Oc(t,e,i,r),Oc(t,e,n,s-1)):(Oc(t,e,n,s-1),Oc(t,e,i,r))}}function bu(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Zz(t){return t[0]}function Qz(t){return t[1]}var or=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,n){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,n){this._+=`L${this._x1=+e},${this._y1=+n}`}arc(e,n,r){e=+e,n=+n,r=+r;let o=e+r,i=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${o},${i}`:(Math.abs(this._x1-o)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+o+","+i),r&&(this._+=`A${r},${r},0,1,1,${e-r},${n}A${r},${r},0,1,1,${this._x1=o},${this._y1=i}`)}rect(e,n,r,o){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${+r}v${+o}h${-r}Z`}value(){return this._||null}};var Bi=class{constructor(){this._=[]}moveTo(e,n){this._.push([e,n])}closePath(){this._.push(this._[0].slice())}lineTo(e,n){this._.push([e,n])}value(){return this._.length?this._:null}};var wu=class{constructor(e,[n,r,o,i]=[0,0,960,500]){if(!((o=+o)>=(n=+n))||!((i=+i)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=o,this.xmin=n,this.ymax=i,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:n,triangles:r},vectors:o}=this,i,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,g=0,y=r.length,x,b;m<y;m+=3,g+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,A=e[w],E=e[w+1],T=e[_],$=e[_+1],M=e[v],k=e[v+1],R=T-A,S=$-E,I=M-A,C=k-E,N=(R*C-S*I)*2;if(Math.abs(N)<1e-9){if(i===void 0){i=s=0;for(let L of n)i+=e[L*2],s+=e[L*2+1];i/=n.length,s/=n.length}let D=1e9*Math.sign((i-A)*C-(s-E)*I);x=(A+M)/2-D*C,b=(E+k)/2+D*I}else{let D=1/N,L=R*R+S*S,P=I*I+C*C;x=A+(C*L-S*P)*D,b=E+(R*P-I*L)*D}a[g]=x,a[g+1]=b}let c=n[n.length-1],f,l=c*4,u,p=e[2*c],d,h=e[2*c+1];o.fill(0);for(let m=0;m<n.length;++m)c=n[m],f=l,u=p,d=h,l=c*4,p=e[2*c],h=e[2*c+1],o[f+2]=o[l]=d-h,o[f+3]=o[l+1]=p-u}render(e){let n=e==null?e=new or:void 0,{delaunay:{halfedges:r,inedges:o,hull:i},circumcenters:s,vectors:a}=this;if(i.length<=1)return null;for(let l=0,u=r.length;l<u;++l){let p=r[l];if(p<l)continue;let d=Math.floor(l/3)*2,h=Math.floor(p/3)*2,m=s[d],g=s[d+1],y=s[h],x=s[h+1];this._renderSegment(m,g,y,x,e)}let c,f=i[i.length-1];for(let l=0;l<i.length;++l){c=f,f=i[l];let u=Math.floor(o[f]/3)*2,p=s[u],d=s[u+1],h=c*4,m=this._project(p,d,a[h+2],a[h+3]);m&&this._renderSegment(p,d,m[0],m[1],e)}return n&&n.value()}renderBounds(e){let n=e==null?e=new or:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(e,n){let r=n==null?n=new or:void 0,o=this._clip(e);if(o===null||!o.length)return;n.moveTo(o[0],o[1]);let i=o.length;for(;o[0]===o[i-2]&&o[1]===o[i-1]&&i>1;)i-=2;for(let s=2;s<i;s+=2)(o[s]!==o[s-2]||o[s+1]!==o[s-1])&&n.lineTo(o[s],o[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let n=0,r=e.length/2;n<r;++n){let o=this.cellPolygon(n);o&&(o.index=n,yield o)}}cellPolygon(e){let n=new Bi;return this.renderCell(e,n),n.value()}_renderSegment(e,n,r,o,i){let s,a=this._regioncode(e,n),c=this._regioncode(r,o);a===0&&c===0?(i.moveTo(e,n),i.lineTo(r,o)):(s=this._clipSegment(e,n,r,o,a,c))&&(i.moveTo(s[0],s[1]),i.lineTo(s[2],s[3]))}contains(e,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(e,n,r)===e}*neighbors(e){let n=this._clip(e);if(n)for(let r of this.delaunay.neighbors(e)){let o=this._clip(r);if(o){t:for(let i=0,s=n.length;i<s;i+=2)for(let a=0,c=o.length;a<c;a+=2)if(n[i]===o[a]&&n[i+1]===o[a+1]&&n[(i+2)%s]===o[(a+c-2)%c]&&n[(i+3)%s]===o[(a+c-1)%c]){yield r;break t}}}}_cell(e){let{circumcenters:n,delaunay:{inedges:r,halfedges:o,triangles:i}}=this,s=r[e];if(s===-1)return null;let a=[],c=s;do{let f=Math.floor(c/3);if(a.push(n[f*2],n[f*2+1]),c=c%3===2?c-2:c+1,i[c]!==e)break;c=o[c]}while(c!==s&&c!==-1);return a}_clip(e){if(e===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(e);if(n===null)return null;let{vectors:r}=this,o=e*4;return this._simplify(r[o]||r[o+1]?this._clipInfinite(e,n,r[o],r[o+1],r[o+2],r[o+3]):this._clipFinite(e,n))}_clipFinite(e,n){let r=n.length,o=null,i,s,a=n[r-2],c=n[r-1],f,l=this._regioncode(a,c),u,p=0;for(let d=0;d<r;d+=2)if(i=a,s=c,a=n[d],c=n[d+1],f=l,l=this._regioncode(a,c),f===0&&l===0)u=p,p=0,o?o.push(a,c):o=[a,c];else{let h,m,g,y,x;if(f===0){if((h=this._clipSegment(i,s,a,c,f,l))===null)continue;[m,g,y,x]=h}else{if((h=this._clipSegment(a,c,i,s,l,f))===null)continue;[y,x,m,g]=h,u=p,p=this._edgecode(m,g),u&&p&&this._edge(e,u,p,o,o.length),o?o.push(m,g):o=[m,g]}u=p,p=this._edgecode(y,x),u&&p&&this._edge(e,u,p,o,o.length),o?o.push(y,x):o=[y,x]}if(o)u=p,p=this._edgecode(o[0],o[1]),u&&p&&this._edge(e,u,p,o,o.length);else if(this.contains(e,(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 o}_clipSegment(e,n,r,o,i,s){let a=i<s;for(a&&([e,n,r,o,i,s]=[r,o,e,n,s,i]);;){if(i===0&&s===0)return a?[r,o,e,n]:[e,n,r,o];if(i&s)return null;let c,f,l=i||s;l&8?(c=e+(r-e)*(this.ymax-n)/(o-n),f=this.ymax):l&4?(c=e+(r-e)*(this.ymin-n)/(o-n),f=this.ymin):l&2?(f=n+(o-n)*(this.xmax-e)/(r-e),c=this.xmax):(f=n+(o-n)*(this.xmin-e)/(r-e),c=this.xmin),i?(e=c,n=f,i=this._regioncode(e,n)):(r=c,o=f,s=this._regioncode(r,o))}}_clipInfinite(e,n,r,o,i,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,o))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],i,s))&&a.push(c[0],c[1]),a=this._clipFinite(e,a))for(let f=0,l=a.length,u,p=this._edgecode(a[l-2],a[l-1]);f<l;f+=2)u=p,p=this._edgecode(a[f],a[f+1]),u&&p&&(f=this._edge(e,u,p,a,f),l=a.length);else this.contains(e,(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(e,n,r,o,i){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}(o[i]!==s||o[i+1]!==a)&&this.contains(e,s,a)&&(o.splice(i,0,s,a),i+=2)}return i}_project(e,n,r,o){let i=1/0,s,a,c;if(o<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/o)<i&&(c=this.ymin,a=e+(i=s)*r)}else if(o>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/o)<i&&(c=this.ymax,a=e+(i=s)*r)}if(r>0){if(e>=this.xmax)return null;(s=(this.xmax-e)/r)<i&&(a=this.xmax,c=n+(i=s)*o)}else if(r<0){if(e<=this.xmin)return null;(s=(this.xmin-e)/r)<i&&(a=this.xmin,c=n+(i=s)*o)}return[a,c]}_edgecode(e,n){return(e===this.xmin?1:e===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(e,n){return(e<this.xmin?1:e>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let n=0;n<e.length;n+=2){let r=(n+2)%e.length,o=(n+4)%e.length;(e[n]===e[r]&&e[r]===e[o]||e[n+1]===e[r+1]&&e[r+1]===e[o+1])&&(e.splice(r,2),n-=2)}e.length||(e=null)}return e}};var Jz=2*Math.PI,Lc=Math.pow;function Kz(t){return t[0]}function tY(t){return t[1]}function eY(t){let{triangles:e,coords:n}=t;for(let r=0;r<e.length;r+=3){let o=2*e[r],i=2*e[r+1],s=2*e[r+2];if((n[s]-n[o])*(n[i+1]-n[o+1])-(n[i]-n[o])*(n[s+1]-n[o+1])>1e-10)return!1}return!0}function nY(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}var ir=class t{static from(e,n=Kz,r=tY,o){return new t("length"in e?rY(e,n,r,o):Float64Array.from(oY(e,n,r,o)))}constructor(e){this._delaunator=new Rc(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,n=this.points;if(e.hull&&e.hull.length>2&&eY(e)){this.collinear=Int32Array.from({length:n.length/2},(p,d)=>d).sort((p,d)=>n[2*p]-n[2*d]||n[2*p+1]-n[2*d+1]);let c=this.collinear[0],f=this.collinear[this.collinear.length-1],l=[n[2*c],n[2*c+1],n[2*f],n[2*f+1]],u=1e-8*Math.hypot(l[3]-l[1],l[2]-l[0]);for(let p=0,d=n.length/2;p<d;++p){let h=nY(n[2*p],n[2*p+1],u);n[2*p]=h[0],n[2*p+1]=h[1]}this._delaunator=new Rc(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,o=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,f=r.length;c<f;++c){let l=i[c%3===2?c-2:c+1];(r[c]===-1||s[l]===-1)&&(s[l]=c)}for(let c=0,f=o.length;c<f;++c)a[o[c]]=c;o.length<=2&&o.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=o[0],s[o[0]]=1,o.length===2&&(s[o[1]]=0,this.triangles[1]=o[1],this.triangles[2]=o[1]))}voronoi(e){return new wu(this,e)}*neighbors(e){let{inedges:n,hull:r,_hullIndex:o,halfedges:i,triangles:s,collinear:a}=this;if(a){let u=a.indexOf(e);u>0&&(yield a[u-1]),u<a.length-1&&(yield a[u+1]);return}let c=n[e];if(c===-1)return;let f=c,l=-1;do{if(yield l=s[f],f=f%3===2?f-2:f+1,s[f]!==e)return;if(f=i[f],f===-1){let u=r[(o[e]+1)%r.length];u!==l&&(yield u);return}}while(f!==c)}find(e,n,r=0){if(e=+e,e!==e||(n=+n,n!==n))return-1;let o=r,i;for(;(i=this._step(r,e,n))>=0&&i!==r&&i!==o;)r=i;return i}_step(e,n,r){let{inedges:o,hull:i,_hullIndex:s,halfedges:a,triangles:c,points:f}=this;if(o[e]===-1||!f.length)return(e+1)%(f.length>>1);let l=e,u=Lc(n-f[e*2],2)+Lc(r-f[e*2+1],2),p=o[e],d=p;do{let h=c[d],m=Lc(n-f[h*2],2)+Lc(r-f[h*2+1],2);if(m<u&&(u=m,l=h),d=d%3===2?d-2:d+1,c[d]!==e)break;if(d=a[d],d===-1){if(d=i[(s[e]+1)%i.length],d!==h&&Lc(n-f[d*2],2)+Lc(r-f[d*2+1],2)<u)return d;break}}while(d!==p);return l}render(e){let n=e==null?e=new or:void 0,{points:r,halfedges:o,triangles:i}=this;for(let s=0,a=o.length;s<a;++s){let c=o[s];if(c<s)continue;let f=i[s]*2,l=i[c]*2;e.moveTo(r[f],r[f+1]),e.lineTo(r[l],r[l+1])}return this.renderHull(e),n&&n.value()}renderPoints(e,n){n===void 0&&(!e||typeof e.moveTo!="function")&&(n=e,e=null),n=n==null?2:+n;let r=e==null?e=new or:void 0,{points:o}=this;for(let i=0,s=o.length;i<s;i+=2){let a=o[i],c=o[i+1];e.moveTo(a+n,c),e.arc(a,c,n,0,Jz)}return r&&r.value()}renderHull(e){let n=e==null?e=new or:void 0,{hull:r,points:o}=this,i=r[0]*2,s=r.length;e.moveTo(o[i],o[i+1]);for(let a=1;a<s;++a){let c=2*r[a];e.lineTo(o[c],o[c+1])}return e.closePath(),n&&n.value()}hullPolygon(){let e=new Bi;return this.renderHull(e),e.value()}renderTriangle(e,n){let r=n==null?n=new or:void 0,{points:o,triangles:i}=this,s=i[e*=3]*2,a=i[e+1]*2,c=i[e+2]*2;return n.moveTo(o[s],o[s+1]),n.lineTo(o[a],o[a+1]),n.lineTo(o[c],o[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:e}=this;for(let n=0,r=e.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(e){let n=new Bi;return this.renderTriangle(e,n),n.value()}};function rY(t,e,n,r){let o=t.length,i=new Float64Array(o*2);for(let s=0;s<o;++s){let a=t[s];i[s*2]=e.call(r,a,s,t),i[s*2+1]=n.call(r,a,s,t)}return i}function*oY(t,e,n,r){let o=0;for(let i of t)yield e.call(r,i,o,t),yield n.call(r,i,o,t),++o}function YI(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function sa(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vr(t){return t=sa(Math.abs(t)),t?t[1]:NaN}function UI(t,e){return function(n,r){for(var o=n.length,i=[],s=0,a=t[0],c=0;o>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(n.substring(o-=a,o+a)),!((c+=a+1)>r));)a=t[s=(s+1)%t.length];return i.reverse().join(e)}}function jI(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var iY=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wr(t){if(!(e=iY.exec(t)))throw new Error("invalid format: "+t);var e;return new d0({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Wr.prototype=d0.prototype;function d0(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}d0.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 XI(t){t:for(var e=t.length,n=1,r=-1,o;n<e;++n)switch(t[n]){case".":r=o=n;break;case"0":r===0&&(r=n),o=n;break;default:if(!+t[n])break t;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(o+1):t}var Yw;function GI(t,e){var n=sa(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Yw=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+sa(t,Math.max(0,e+i-1))[0]}function Uw(t,e){var n=sa(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}var jw={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:YI,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Uw(t*100,e),r:Uw,s:GI,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Xw(t){return t}var VI=Array.prototype.map,WI=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function HI(t){var e=t.grouping===void 0||t.thousands===void 0?Xw:UI(VI.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?Xw:jI(VI.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"\u2212":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function f(u){u=Wr(u);var p=u.fill,d=u.align,h=u.sign,m=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,w=u.trim,_=u.type;_==="n"?(x=!0,_="g"):jw[_]||(b===void 0&&(b=12),w=!0,_="g"),(g||p==="0"&&d==="=")&&(g=!0,p="0",d="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",A=m==="$"?r:/[%p]/.test(_)?s:"",E=jw[_],T=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function $(M){var k=v,R=A,S,I,C;if(_==="c")R=E(M)+R,M="";else{M=+M;var N=M<0||1/M<0;if(M=isNaN(M)?c:E(Math.abs(M),b),w&&(M=XI(M)),N&&+M==0&&h!=="+"&&(N=!1),k=(N?h==="("?h:a:h==="-"||h==="("?"":h)+k,R=(_==="s"?WI[8+Yw/3]:"")+R+(N&&h==="("?")":""),T){for(S=-1,I=M.length;++S<I;)if(C=M.charCodeAt(S),48>C||C>57){R=(C===46?o+M.slice(S+1):M.slice(S))+R,M=M.slice(0,S);break}}}x&&!g&&(M=e(M,1/0));var D=k.length+M.length+R.length,L=D<y?new Array(y-D+1).join(p):"";switch(x&&g&&(M=e(L+M,L.length?y-R.length:1/0),L=""),d){case"<":M=k+M+R+L;break;case"=":M=k+L+M+R;break;case"^":M=L.slice(0,D=L.length>>1)+k+M+R+L.slice(D);break;default:M=L+k+M+R;break}return i(M)}return $.toString=function(){return u+""},$}function l(u,p){var d=f((u=Wr(u),u.type="f",u)),h=Math.max(-8,Math.min(8,Math.floor(Vr(p)/3)))*3,m=Math.pow(10,-h),g=WI[8+h/3];return function(y){return d(m*y)+g}}return{format:f,formatPrefix:l}}var h0,sr,m0;Gw({thousands:",",grouping:[3],currency:["$",""]});function Gw(t){return h0=HI(t),sr=h0.format,m0=h0.formatPrefix,h0}function Vw(t){return Math.max(0,-Vr(Math.abs(t)))}function Ww(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Vr(e)/3)))*3-Vr(Math.abs(t)))}function Hw(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vr(e)-Vr(t))+1}var K=1e-6,aa=1e-12,yt=Math.PI,Ut=yt/2,Zw=yt/4,Ee=yt*2,se=180/yt,At=yt/180,vt=Math.abs,ar=Math.atan,he=Math.atan2,Q=Math.cos,vu=Math.ceil,g0=Math.exp;var y0=Math.hypot,ca=Math.log,x0=Math.pow,Z=Math.sin,Ke=Math.sign||function(t){return t>0?1:t<0?-1:0},jt=Math.sqrt,Dc=Math.tan;function b0(t){return t>1?0:t<-1?yt:Math.acos(t)}function Zt(t){return t>1?Ut:t<-1?-Ut:Math.asin(t)}function me(){}function w0(t,e){t&&QI.hasOwnProperty(t.type)&&QI[t.type](t,e)}var ZI={Feature:function(t,e){w0(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)w0(n[r].geometry,e)}},QI={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Qw(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)Qw(n[r],e,0)},Polygon:function(t,e){JI(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)JI(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)w0(n[r],e)}};function Qw(t,e,n){var r=-1,o=t.length-n,i;for(e.lineStart();++r<o;)i=t[r],e.point(i[0],i[1],i[2]);e.lineEnd()}function JI(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Qw(t[n],e,1);e.polygonEnd()}function qn(t,e){t&&ZI.hasOwnProperty(t.type)?ZI[t.type](t,e):w0(t,e)}function _u(t){return[he(t[1],t[0]),Zt(t[2])]}function Hr(t){var e=t[0],n=t[1],r=Q(n);return[r*Q(e),r*Z(e),Z(n)]}function Su(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Pc(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function v0(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Mu(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Au(t){var e=jt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Tu,_0,S0,M0,A0,T0,E0,I0,Jw,Kw,tv,e$,n$,gn,yn,xn,Mr={sphere:me,point:ev,lineStart:KI,lineEnd:t$,polygonStart:function(){Mr.lineStart=cY,Mr.lineEnd=fY},polygonEnd:function(){Mr.lineStart=KI,Mr.lineEnd=t$}};function ev(t,e){t*=At,e*=At;var n=Q(e);Eu(n*Q(t),n*Z(t),Z(e))}function Eu(t,e,n){++Tu,S0+=(t-S0)/Tu,M0+=(e-M0)/Tu,A0+=(n-A0)/Tu}function KI(){Mr.point=sY}function sY(t,e){t*=At,e*=At;var n=Q(e);gn=n*Q(t),yn=n*Z(t),xn=Z(e),Mr.point=aY,Eu(gn,yn,xn)}function aY(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*Z(t),i=Z(e),s=he(jt((s=yn*i-xn*o)*s+(s=xn*r-gn*i)*s+(s=gn*o-yn*r)*s),gn*r+yn*o+xn*i);_0+=s,T0+=s*(gn+(gn=r)),E0+=s*(yn+(yn=o)),I0+=s*(xn+(xn=i)),Eu(gn,yn,xn)}function t$(){Mr.point=ev}function cY(){Mr.point=lY}function fY(){r$(e$,n$),Mr.point=ev}function lY(t,e){e$=t,n$=e,t*=At,e*=At,Mr.point=r$;var n=Q(e);gn=n*Q(t),yn=n*Z(t),xn=Z(e),Eu(gn,yn,xn)}function r$(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*Z(t),i=Z(e),s=yn*i-xn*o,a=xn*r-gn*i,c=gn*o-yn*r,f=y0(s,a,c),l=Zt(f),u=f&&-l/f;Jw.add(u*s),Kw.add(u*a),tv.add(u*c),_0+=l,T0+=l*(gn+(gn=r)),E0+=l*(yn+(yn=o)),I0+=l*(xn+(xn=i)),Eu(gn,yn,xn)}function nv(t){Tu=_0=S0=M0=A0=T0=E0=I0=0,Jw=new Be,Kw=new Be,tv=new Be,qn(t,Mr);var e=+Jw,n=+Kw,r=+tv,o=y0(e,n,r);return o<aa&&(e=T0,n=E0,r=I0,_0<K&&(e=S0,n=M0,r=A0),o=y0(e,n,r),o<aa)?[NaN,NaN]:[he(n,e)*se,Zt(r/o)*se]}function Iu(t,e){function n(r,o){return r=t(r,o),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,o){return r=e.invert(r,o),r&&t.invert(r[0],r[1])}),n}function rv(t,e){return vt(t)>yt&&(t-=Math.round(t/Ee)*Ee),[t,e]}rv.invert=rv;function ov(t,e,n){return(t%=Ee)?e||n?Iu(i$(t),s$(e,n)):i$(t):e||n?s$(e,n):rv}function o$(t){return function(e,n){return e+=t,vt(e)>yt&&(e-=Math.round(e/Ee)*Ee),[e,n]}}function i$(t){var e=o$(t);return e.invert=o$(-t),e}function s$(t,e){var n=Q(t),r=Z(t),o=Q(e),i=Z(e);function s(a,c){var f=Q(c),l=Q(a)*f,u=Z(a)*f,p=Z(c),d=p*n+l*r;return[he(u*o-d*i,l*n-p*r),Zt(d*o+u*i)]}return s.invert=function(a,c){var f=Q(c),l=Q(a)*f,u=Z(a)*f,p=Z(c),d=p*o-u*i;return[he(u*o+p*i,l*n+d*r),Zt(d*n-l*r)]},s}function a$(t){t=ov(t[0]*At,t[1]*At,t.length>2?t[2]*At:0);function e(n){return n=t(n[0]*At,n[1]*At),n[0]*=se,n[1]*=se,n}return e.invert=function(n){return n=t.invert(n[0]*At,n[1]*At),n[0]*=se,n[1]*=se,n},e}function f$(t,e,n,r,o,i){if(n){var s=Q(e),a=Z(e),c=r*n;o==null?(o=e+r*Ee,i=e-c/2):(o=c$(s,o),i=c$(s,i),(r>0?o<i:o>i)&&(o+=r*Ee));for(var f,l=o;r>0?l>i:l<i;l-=c)f=_u([s,-a*Q(l),-a*Z(l)]),t.point(f[0],f[1])}}function c$(t,e){e=Hr(e),e[0]-=t,Au(e);var n=b0(-e[1]);return((-e[2]<0?-n:n)+Ee-K)%Ee}function $0(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:me,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Fc(t,e){return vt(t[0]-e[0])<K&&vt(t[1]-e[1])<K}function C0(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function k0(t,e,n,r,o){var i=[],s=[],a,c;if(t.forEach(function(h){if(!((m=h.length-1)<=0)){var m,g=h[0],y=h[m],x;if(Fc(g,y)){if(!g[2]&&!y[2]){for(o.lineStart(),a=0;a<m;++a)o.point((g=h[a])[0],g[1]);o.lineEnd();return}y[0]+=2*K}i.push(x=new C0(g,h,null,!0)),s.push(x.o=new C0(g,null,x,!1)),i.push(x=new C0(y,h,null,!1)),s.push(x.o=new C0(y,null,x,!0))}}),!!i.length){for(s.sort(e),l$(i),l$(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var f=i[0],l,u;;){for(var p=f,d=!0;p.v;)if((p=p.n)===f)return;l=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(a=0,c=l.length;a<c;++a)o.point((u=l[a])[0],u[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(d)for(l=p.p.z,a=l.length-1;a>=0;--a)o.point((u=l[a])[0],u[1]);else r(p.x,p.p.x,-1,o);p=p.p}p=p.o,l=p.z,d=!d}while(!p.v);o.lineEnd()}}}function l$(t){if(e=t.length){for(var e,n=0,r=t[0],o;++n<e;)r.n=o=t[n],o.p=r,r=o;r.n=o=t[0],o.p=r}}function iv(t){return vt(t[0])<=yt?t[0]:Ke(t[0])*((vt(t[0])+yt)%Ee-yt)}function u$(t,e){var n=iv(e),r=e[1],o=Z(r),i=[Z(n),-Q(n),0],s=0,a=0,c=new Be;o===1?r=Ut+K:o===-1&&(r=-Ut-K);for(var f=0,l=t.length;f<l;++f)if(p=(u=t[f]).length)for(var u,p,d=u[p-1],h=iv(d),m=d[1]/2+Zw,g=Z(m),y=Q(m),x=0;x<p;++x,h=w,g=v,y=A,d=b){var b=u[x],w=iv(b),_=b[1]/2+Zw,v=Z(_),A=Q(_),E=w-h,T=E>=0?1:-1,$=T*E,M=$>yt,k=g*v;if(c.add(he(k*T*Z($),y*A+k*Q($))),s+=M?E+T*Ee:E,M^h>=n^w>=n){var R=Pc(Hr(d),Hr(b));Au(R);var S=Pc(i,R);Au(S);var I=(M^E>=0?-1:1)*Zt(S[2]);(r>I||r===I&&(R[0]||R[1]))&&(a+=M^E>=0?1:-1)}}return(s<-K||s<K&&c<-aa)^a&1}function N0(t,e,n,r){return function(o){var i=e(o),s=$0(),a=e(s),c=!1,f,l,u,p={point:d,lineStart:m,lineEnd:g,polygonStart:function(){p.point=y,p.lineStart=x,p.lineEnd=b,l=[],f=[]},polygonEnd:function(){p.point=d,p.lineStart=m,p.lineEnd=g,l=bc(l);var w=u$(f,r);l.length?(c||(o.polygonStart(),c=!0),k0(l,pY,w,n,o)):w&&(c||(o.polygonStart(),c=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),c&&(o.polygonEnd(),c=!1),l=f=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(w,_){t(w,_)&&o.point(w,_)}function h(w,_){i.point(w,_)}function m(){p.point=h,i.lineStart()}function g(){p.point=d,i.lineEnd()}function y(w,_){u.push([w,_]),a.point(w,_)}function x(){a.lineStart(),u=[]}function b(){y(u[0][0],u[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,A=_.length,E,T,$;if(u.pop(),f.push(u),u=null,!!A){if(w&1){if(T=_[0],(E=T.length-1)>0){for(c||(o.polygonStart(),c=!0),o.lineStart(),v=0;v<E;++v)o.point(($=T[v])[0],$[1]);o.lineEnd()}return}A>1&&w&2&&_.push(_.pop().concat(_.shift())),l.push(_.filter(uY))}}return p}}function uY(t){return t.length>1}function pY(t,e){return((t=t.x)[0]<0?t[1]-Ut-K:Ut-t[1])-((e=e.x)[0]<0?e[1]-Ut-K:Ut-e[1])}var sv=N0(function(){return!0},dY,mY,[-yt,-Ut]);function dY(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(i,s){var a=i>0?yt:-yt,c=vt(i-e);vt(c-yt)<K?(t.point(e,n=(n+s)/2>0?Ut:-Ut),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(i,n),o=0):r!==a&&c>=yt&&(vt(e-r)<K&&(e-=r*K),vt(i-a)<K&&(i-=a*K),n=hY(e,n,i,s),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),o=0),t.point(e=i,n=s),r=a},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-o}}}function hY(t,e,n,r){var o,i,s=Z(t-n);return vt(s)>K?ar((Z(e)*(i=Q(r))*Z(n)-Z(r)*(o=Q(e))*Z(t))/(o*i*s)):(e+r)/2}function mY(t,e,n,r){var o;if(t==null)o=n*Ut,r.point(-yt,o),r.point(0,o),r.point(yt,o),r.point(yt,0),r.point(yt,-o),r.point(0,-o),r.point(-yt,-o),r.point(-yt,0),r.point(-yt,o);else if(vt(t[0]-e[0])>K){var i=t[0]<e[0]?yt:-yt;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(e[0],e[1])}function p$(t){var e=Q(t),n=6*At,r=e>0,o=vt(e)>K;function i(l,u,p,d){f$(d,t,n,p,l,u)}function s(l,u){return Q(l)*Q(u)>e}function a(l){var u,p,d,h,m;return{lineStart:function(){h=d=!1,m=1},point:function(g,y){var x=[g,y],b,w=s(g,y),_=r?w?0:f(g,y):w?f(g+(g<0?yt:-yt),y):0;if(!u&&(h=d=w)&&l.lineStart(),w!==d&&(b=c(u,x),(!b||Fc(u,b)||Fc(x,b))&&(x[2]=1)),w!==d)m=0,w?(l.lineStart(),b=c(x,u),l.point(b[0],b[1])):(b=c(u,x),l.point(b[0],b[1],2),l.lineEnd()),u=b;else if(o&&u&&r^w){var v;!(_&p)&&(v=c(x,u,!0))&&(m=0,r?(l.lineStart(),l.point(v[0][0],v[0][1]),l.point(v[1][0],v[1][1]),l.lineEnd()):(l.point(v[1][0],v[1][1]),l.lineEnd(),l.lineStart(),l.point(v[0][0],v[0][1],3)))}w&&(!u||!Fc(u,x))&&l.point(x[0],x[1]),u=x,d=w,p=_},lineEnd:function(){d&&l.lineEnd(),u=null},clean:function(){return m|(h&&d)<<1}}}function c(l,u,p){var d=Hr(l),h=Hr(u),m=[1,0,0],g=Pc(d,h),y=Su(g,g),x=g[0],b=y-x*x;if(!b)return!p&&l;var w=e*y/b,_=-e*x/b,v=Pc(m,g),A=Mu(m,w),E=Mu(g,_);v0(A,E);var T=v,$=Su(A,T),M=Su(T,T),k=$*$-M*(Su(A,A)-1);if(!(k<0)){var R=jt(k),S=Mu(T,(-$-R)/M);if(v0(S,A),S=_u(S),!p)return S;var I=l[0],C=u[0],N=l[1],D=u[1],L;C<I&&(L=I,I=C,C=L);var P=C-I,F=vt(P-yt)<K,q=F||P<K;if(!F&&D<N&&(L=N,N=D,D=L),q?F?N+D>0^S[1]<(vt(S[0]-I)<K?N:D):N<=S[1]&&S[1]<=D:P>yt^(I<=S[0]&&S[0]<=C)){var W=Mu(T,(-$+R)/M);return v0(W,A),[S,_u(W)]}}}function f(l,u){var p=r?t:yt-t,d=0;return l<-p?d|=1:l>p&&(d|=2),u<-p?d|=4:u>p&&(d|=8),d}return N0(s,a,i,r?[0,-t]:[-yt,t-yt])}function d$(t,e,n,r,o,i){var s=t[0],a=t[1],c=e[0],f=e[1],l=0,u=1,p=c-s,d=f-a,h;if(h=n-s,!(!p&&h>0)){if(h/=p,p<0){if(h<l)return;h<u&&(u=h)}else if(p>0){if(h>u)return;h>l&&(l=h)}if(h=o-s,!(!p&&h<0)){if(h/=p,p<0){if(h>u)return;h>l&&(l=h)}else if(p>0){if(h<l)return;h<u&&(u=h)}if(h=r-a,!(!d&&h>0)){if(h/=d,d<0){if(h<l)return;h<u&&(u=h)}else if(d>0){if(h>u)return;h>l&&(l=h)}if(h=i-a,!(!d&&h<0)){if(h/=d,d<0){if(h>u)return;h>l&&(l=h)}else if(d>0){if(h<l)return;h<u&&(u=h)}return l>0&&(t[0]=s+l*p,t[1]=a+l*d),u<1&&(e[0]=s+u*p,e[1]=a+u*d),!0}}}}}var $u=1e9,O0=-$u;function qc(t,e,n,r){function o(f,l){return t<=f&&f<=n&&e<=l&&l<=r}function i(f,l,u,p){var d=0,h=0;if(f==null||(d=s(f,u))!==(h=s(l,u))||c(f,l)<0^u>0)do p.point(d===0||d===3?t:n,d>1?r:e);while((d=(d+u+4)%4)!==h);else p.point(l[0],l[1])}function s(f,l){return vt(f[0]-t)<K?l>0?0:3:vt(f[0]-n)<K?l>0?2:1:vt(f[1]-e)<K?l>0?1:0:l>0?3:2}function a(f,l){return c(f.x,l.x)}function c(f,l){var u=s(f,1),p=s(l,1);return u!==p?u-p:u===0?l[1]-f[1]:u===1?f[0]-l[0]:u===2?f[1]-l[1]:l[0]-f[0]}return function(f){var l=f,u=$0(),p,d,h,m,g,y,x,b,w,_,v,A={point:E,lineStart:k,lineEnd:R,polygonStart:$,polygonEnd:M};function E(I,C){o(I,C)&&l.point(I,C)}function T(){for(var I=0,C=0,N=d.length;C<N;++C)for(var D=d[C],L=1,P=D.length,F=D[0],q,W,tt=F[0],nt=F[1];L<P;++L)q=tt,W=nt,F=D[L],tt=F[0],nt=F[1],W<=r?nt>r&&(tt-q)*(r-W)>(nt-W)*(t-q)&&++I:nt<=r&&(tt-q)*(r-W)<(nt-W)*(t-q)&&--I;return I}function $(){l=u,p=[],d=[],v=!0}function M(){var I=T(),C=v&&I,N=(p=bc(p)).length;(C||N)&&(f.polygonStart(),C&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),N&&k0(p,a,I,i,f),f.polygonEnd()),l=f,p=d=h=null}function k(){A.point=S,d&&d.push(h=[]),_=!0,w=!1,x=b=NaN}function R(){p&&(S(m,g),y&&w&&u.rejoin(),p.push(u.result())),A.point=E,w&&l.lineEnd()}function S(I,C){var N=o(I,C);if(d&&h.push([I,C]),_)m=I,g=C,y=N,_=!1,N&&(l.lineStart(),l.point(I,C));else if(N&&w)l.point(I,C);else{var D=[x=Math.max(O0,Math.min($u,x)),b=Math.max(O0,Math.min($u,b))],L=[I=Math.max(O0,Math.min($u,I)),C=Math.max(O0,Math.min($u,C))];d$(D,L,t,e,n,r)?(w||(l.lineStart(),l.point(D[0],D[1])),l.point(L[0],L[1]),N||l.lineEnd(),v=!1):N&&(l.lineStart(),l.point(I,C),v=!1)}x=I,b=C,w=N}return A}}function h$(t,e,n){var r=ce(t,e-K,n).concat(e);return function(o){return r.map(function(i){return[o,i]})}}function m$(t,e,n){var r=ce(t,e-K,n).concat(e);return function(o){return r.map(function(i){return[i,o]})}}function av(){var t,e,n,r,o,i,s,a,c=10,f=c,l=90,u=360,p,d,h,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:x()}}function x(){return ce(vu(r/l)*l,n,l).map(h).concat(ce(vu(a/u)*u,s,u).map(m)).concat(ce(vu(e/c)*c,t,c).filter(function(b){return vt(b%l)>K}).map(p)).concat(ce(vu(i/f)*f,o,f).filter(function(b){return vt(b%u)>K}).map(d))}return y.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},y.outline=function(){return{type:"Polygon",coordinates:[h(r).concat(m(s).slice(1),h(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(b){return arguments.length?y.extentMajor(b).extentMinor(b):y.extentMinor()},y.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),y.precision(g)):[[r,a],[n,s]]},y.extentMinor=function(b){return arguments.length?(e=+b[0][0],t=+b[1][0],i=+b[0][1],o=+b[1][1],e>t&&(b=e,e=t,t=b),i>o&&(b=i,i=o,o=b),y.precision(g)):[[e,i],[t,o]]},y.step=function(b){return arguments.length?y.stepMajor(b).stepMinor(b):y.stepMinor()},y.stepMajor=function(b){return arguments.length?(l=+b[0],u=+b[1],y):[l,u]},y.stepMinor=function(b){return arguments.length?(c=+b[0],f=+b[1],y):[c,f]},y.precision=function(b){return arguments.length?(g=+b,p=h$(i,o,90),d=m$(e,t,g),h=h$(a,s,90),m=m$(r,n,g),y):g},y.extentMajor([[-180,-90+K],[180,90-K]]).extentMinor([[-180,-80-K],[180,80+K]])}function cv(){return av()()}var Cu=t=>t;var fv=new Be,lv=new Be,g$,y$,uv,pv,zi={point:me,lineStart:me,lineEnd:me,polygonStart:function(){zi.lineStart=gY,zi.lineEnd=xY},polygonEnd:function(){zi.lineStart=zi.lineEnd=zi.point=me,fv.add(vt(lv)),lv=new Be},result:function(){var t=fv/2;return fv=new Be,t}};function gY(){zi.point=yY}function yY(t,e){zi.point=x$,g$=uv=t,y$=pv=e}function x$(t,e){lv.add(pv*t-uv*e),uv=t,pv=e}function xY(){x$(g$,y$)}var dv=zi;var Bc=1/0,R0=Bc,ku=-Bc,L0=ku,bY={point:wY,lineStart:me,lineEnd:me,polygonStart:me,polygonEnd:me,result:function(){var t=[[Bc,R0],[ku,L0]];return ku=L0=-(R0=Bc=1/0),t}};function wY(t,e){t<Bc&&(Bc=t),t>ku&&(ku=t),e<R0&&(R0=e),e>L0&&(L0=e)}var zc=bY;var hv=0,mv=0,Nu=0,D0=0,P0=0,Yc=0,gv=0,yv=0,Ou=0,v$,_$,Zr,Qr,Ar={point:fa,lineStart:b$,lineEnd:w$,polygonStart:function(){Ar.lineStart=SY,Ar.lineEnd=MY},polygonEnd:function(){Ar.point=fa,Ar.lineStart=b$,Ar.lineEnd=w$},result:function(){var t=Ou?[gv/Ou,yv/Ou]:Yc?[D0/Yc,P0/Yc]:Nu?[hv/Nu,mv/Nu]:[NaN,NaN];return hv=mv=Nu=D0=P0=Yc=gv=yv=Ou=0,t}};function fa(t,e){hv+=t,mv+=e,++Nu}function b$(){Ar.point=vY}function vY(t,e){Ar.point=_Y,fa(Zr=t,Qr=e)}function _Y(t,e){var n=t-Zr,r=e-Qr,o=jt(n*n+r*r);D0+=o*(Zr+t)/2,P0+=o*(Qr+e)/2,Yc+=o,fa(Zr=t,Qr=e)}function w$(){Ar.point=fa}function SY(){Ar.point=AY}function MY(){S$(v$,_$)}function AY(t,e){Ar.point=S$,fa(v$=Zr=t,_$=Qr=e)}function S$(t,e){var n=t-Zr,r=e-Qr,o=jt(n*n+r*r);D0+=o*(Zr+t)/2,P0+=o*(Qr+e)/2,Yc+=o,o=Qr*t-Zr*e,gv+=o*(Zr+t),yv+=o*(Qr+e),Ou+=o*3,fa(Zr=t,Qr=e)}var xv=Ar;function F0(t){this._context=t}F0.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,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(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ee);break}}},result:me};var wv=new Be,bv,M$,A$,Ru,Lu,q0={point:me,lineStart:function(){q0.point=TY},lineEnd:function(){bv&&T$(M$,A$),q0.point=me},polygonStart:function(){bv=!0},polygonEnd:function(){bv=null},result:function(){var t=+wv;return wv=new Be,t}};function TY(t,e){q0.point=T$,M$=Ru=t,A$=Lu=e}function T$(t,e){Ru-=t,Lu-=e,wv.add(jt(Ru*Ru+Lu*Lu)),Ru=t,Lu=e}var vv=q0;var E$,B0,I$,$$,Uc=class{constructor(e){this._append=e==null?C$:EY(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(e,n){switch(this._point){case 0:{this._append`M${e},${n}`,this._point=1;break}case 1:{this._append`L${e},${n}`;break}default:{if(this._append`M${e},${n}`,this._radius!==I$||this._append!==B0){let r=this._radius,o=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`,I$=r,B0=this._append,$$=this._,this._=o}this._+=$$;break}}}result(){let e=this._;return this._="",e.length?e:null}};function C$(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function EY(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return C$;if(e!==E$){let n=10**e;E$=e,B0=function(o){let i=1;this._+=o[0];for(let s=o.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+o[i]}}return B0}function Ie(t,e){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),qn(a,o(i))),i.result()}return s.area=function(a){return qn(a,o(dv)),dv.result()},s.measure=function(a){return qn(a,o(vv)),vv.result()},s.bounds=function(a){return qn(a,o(zc)),zc.result()},s.centroid=function(a){return qn(a,o(xv)),xv.result()},s.projection=function(a){return arguments.length?(o=a==null?(t=null,Cu):(t=a).stream,s):t},s.context=function(a){return arguments.length?(i=a==null?(e=null,new Uc(n)):new F0(e=a),typeof r!="function"&&i.pointRadius(r),s):e},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(i.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 e===null&&(i=new Uc(n)),s},s.projection(t).digits(n).context(e)}function la(t){return{stream:jc(t)}}function jc(t){return function(e){var n=new _v;for(var r in t)n[r]=t[r];return n.stream=e,n}}function _v(){}_v.prototype={constructor:_v,point:function(t,e){this.stream.point(t,e)},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 Sv(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),qn(n,t.stream(zc)),e(zc.result()),r!=null&&t.clipExtent(r),t}function Du(t,e,n){return Sv(t,function(r){var o=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(o/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+e[0][0]+(o-s*(r[1][0]+r[0][0]))/2,c=+e[0][1]+(i-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([a,c])},n)}function z0(t,e,n){return Du(t,[[0,0],e],n)}function Y0(t,e,n){return Sv(t,function(r){var o=+e,i=o/(r[1][0]-r[0][0]),s=(o-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];t.scale(150*i).translate([s,a])},n)}function U0(t,e,n){return Sv(t,function(r){var o=+e,i=o/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(o-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,a])},n)}var k$=16,IY=Q(30*At);function Mv(t,e){return+e?CY(t,e):$Y(t)}function $Y(t){return jc({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function CY(t,e){function n(r,o,i,s,a,c,f,l,u,p,d,h,m,g){var y=f-r,x=l-o,b=y*y+x*x;if(b>4*e&&m--){var w=s+p,_=a+d,v=c+h,A=jt(w*w+_*_+v*v),E=Zt(v/=A),T=vt(vt(v)-1)<K||vt(i-u)<K?(i+u)/2:he(_,w),$=t(T,E),M=$[0],k=$[1],R=M-r,S=k-o,I=x*R-y*S;(I*I/b>e||vt((y*R+x*S)/b-.5)>.3||s*p+a*d+c*h<IY)&&(n(r,o,i,s,a,c,M,k,T,w/=A,_/=A,v,m,g),g.point(M,k),n(M,k,T,w,_,v,f,l,u,p,d,h,m,g))}}return function(r){var o,i,s,a,c,f,l,u,p,d,h,m,g={point:y,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),g.lineStart=_},polygonEnd:function(){r.polygonEnd(),g.lineStart=x}};function y(E,T){E=t(E,T),r.point(E[0],E[1])}function x(){u=NaN,g.point=b,r.lineStart()}function b(E,T){var $=Hr([E,T]),M=t(E,T);n(u,p,l,d,h,m,u=M[0],p=M[1],l=E,d=$[0],h=$[1],m=$[2],k$,r),r.point(u,p)}function w(){g.point=y,r.lineEnd()}function _(){x(),g.point=v,g.lineEnd=A}function v(E,T){b(o=E,T),i=u,s=p,a=d,c=h,f=m,g.point=b}function A(){n(u,p,l,d,h,m,i,s,o,a,c,f,k$,r),g.lineEnd=w,w()}return g}}var kY=jc({point:function(t,e){this.stream.point(t*At,e*At)}});function NY(t){return jc({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function OY(t,e,n,r,o){function i(s,a){return s*=r,a*=o,[e+t*s,n-t*a]}return i.invert=function(s,a){return[(s-e)/t*r,(n-a)/t*o]},i}function N$(t,e,n,r,o,i){if(!i)return OY(t,e,n,r,o);var s=Q(i),a=Z(i),c=s*t,f=a*t,l=s/t,u=a/t,p=(a*n-s*e)/t,d=(a*e+s*n)/t;function h(m,g){return m*=r,g*=o,[c*m-f*g+e,n-f*m-c*g]}return h.invert=function(m,g){return[r*(l*m-u*g+p),o*(d-u*m-l*g)]},h}function Xe(t){return Av(function(){return t})()}function Av(t){var e,n=150,r=480,o=250,i=0,s=0,a=0,c=0,f=0,l,u=0,p=1,d=1,h=null,m=sv,g=null,y,x,b,w=Cu,_=.5,v,A,E,T,$;function M(I){return E(I[0]*At,I[1]*At)}function k(I){return I=E.invert(I[0],I[1]),I&&[I[0]*se,I[1]*se]}M.stream=function(I){return T&&$===I?T:T=kY(NY(l)(m(v(w($=I)))))},M.preclip=function(I){return arguments.length?(m=I,h=void 0,S()):m},M.postclip=function(I){return arguments.length?(w=I,g=y=x=b=null,S()):w},M.clipAngle=function(I){return arguments.length?(m=+I?p$(h=I*At):(h=null,sv),S()):h*se},M.clipExtent=function(I){return arguments.length?(w=I==null?(g=y=x=b=null,Cu):qc(g=+I[0][0],y=+I[0][1],x=+I[1][0],b=+I[1][1]),S()):g==null?null:[[g,y],[x,b]]},M.scale=function(I){return arguments.length?(n=+I,R()):n},M.translate=function(I){return arguments.length?(r=+I[0],o=+I[1],R()):[r,o]},M.center=function(I){return arguments.length?(i=I[0]%360*At,s=I[1]%360*At,R()):[i*se,s*se]},M.rotate=function(I){return arguments.length?(a=I[0]%360*At,c=I[1]%360*At,f=I.length>2?I[2]%360*At:0,R()):[a*se,c*se,f*se]},M.angle=function(I){return arguments.length?(u=I%360*At,R()):u*se},M.reflectX=function(I){return arguments.length?(p=I?-1:1,R()):p<0},M.reflectY=function(I){return arguments.length?(d=I?-1:1,R()):d<0},M.precision=function(I){return arguments.length?(v=Mv(A,_=I*I),S()):jt(_)},M.fitExtent=function(I,C){return Du(M,I,C)},M.fitSize=function(I,C){return z0(M,I,C)},M.fitWidth=function(I,C){return Y0(M,I,C)},M.fitHeight=function(I,C){return U0(M,I,C)};function R(){var I=N$(n,0,0,p,d,u).apply(null,e(i,s)),C=N$(n,r-I[0],o-I[1],p,d,u);return l=ov(a,c,f),A=Iu(e,C),E=Iu(l,A),v=Mv(A,_),S()}function S(){return T=$=null,M}return function(){return e=t.apply(this,arguments),M.invert=e.invert&&k,R()}}function Xc(t){var e=0,n=yt/3,r=Av(t),o=r(e,n);return o.parallels=function(i){return arguments.length?r(e=i[0]*At,n=i[1]*At):[e*se,n*se]},o}function O$(t){var e=Q(t);function n(r,o){return[r*e,Z(o)/e]}return n.invert=function(r,o){return[r/e,Zt(o*e)]},n}function R$(t,e){var n=Z(t),r=(n+Z(e))/2;if(vt(r)<K)return O$(t);var o=1+n*(2*r-n),i=jt(o)/r;function s(a,c){var f=jt(o-2*r*Z(c))/r;return[f*Z(a*=r),i-f*Q(a)]}return s.invert=function(a,c){var f=i-c,l=he(a,vt(f))*Ke(f);return f*r<0&&(l-=yt*Ke(a)*Ke(f)),[l/r,Zt((o-(a*a+f*f)*r*r)/(2*r))]},s}function Yi(){return Xc(R$).scale(155.424).center([0,33.6442])}function Pu(){return Yi().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function RY(t){var e=t.length;return{point:function(n,r){for(var o=-1;++o<e;)t[o].point(n,r)},sphere:function(){for(var n=-1;++n<e;)t[n].sphere()},lineStart:function(){for(var n=-1;++n<e;)t[n].lineStart()},lineEnd:function(){for(var n=-1;++n<e;)t[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<e;)t[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<e;)t[n].polygonEnd()}}}function Tv(){var t,e,n=Pu(),r,o=Yi().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=Yi().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,f={point:function(p,d){c=[p,d]}};function l(p){var d=p[0],h=p[1];return c=null,r.point(d,h),c||(i.point(d,h),c)||(a.point(d,h),c)}l.invert=function(p){var d=n.scale(),h=n.translate(),m=(p[0]-h[0])/d,g=(p[1]-h[1])/d;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?o:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(p)},l.stream=function(p){return t&&e===p?t:t=RY([n.stream(e=p),o.stream(p),s.stream(p)])},l.precision=function(p){return arguments.length?(n.precision(p),o.precision(p),s.precision(p),u()):n.precision()},l.scale=function(p){return arguments.length?(n.scale(p),o.scale(p*.35),s.scale(p),l.translate(n.translate())):n.scale()},l.translate=function(p){if(!arguments.length)return n.translate();var d=n.scale(),h=+p[0],m=+p[1];return r=n.translate(p).clipExtent([[h-.455*d,m-.238*d],[h+.455*d,m+.238*d]]).stream(f),i=o.translate([h-.307*d,m+.201*d]).clipExtent([[h-.425*d+K,m+.12*d+K],[h-.214*d-K,m+.234*d-K]]).stream(f),a=s.translate([h-.205*d,m+.212*d]).clipExtent([[h-.214*d+K,m+.166*d+K],[h-.115*d-K,m+.234*d-K]]).stream(f),u()},l.fitExtent=function(p,d){return Du(l,p,d)},l.fitSize=function(p,d){return z0(l,p,d)},l.fitWidth=function(p,d){return Y0(l,p,d)},l.fitHeight=function(p,d){return U0(l,p,d)};function u(){return t=e=null,l}return l.scale(1070)}function j0(t){return function(e,n){var r=Q(e),o=Q(n),i=t(r*o);return i===1/0?[2,0]:[i*o*Z(e),i*Z(n)]}}function Jr(t){return function(e,n){var r=jt(e*e+n*n),o=t(r),i=Z(o),s=Q(o);return[he(e*i,r*s),Zt(r&&n*i/r)]}}var Ev=j0(function(t){return jt(2/(1+t))});Ev.invert=Jr(function(t){return 2*Zt(t/2)});function Iv(){return Xe(Ev).scale(124.75).clipAngle(180-.001)}var $v=j0(function(t){return(t=b0(t))&&t/Z(t)});$v.invert=Jr(function(t){return t});function Cv(){return Xe($v).scale(79.4188).clipAngle(180-.001)}function Gc(t,e){return[t,ca(Dc((Ut+e)/2))]}Gc.invert=function(t,e){return[t,2*ar(g0(e))-Ut]};function kv(){return Nv(Gc).scale(961/Ee)}function Nv(t){var e=Xe(t),n=e.center,r=e.scale,o=e.translate,i=e.clipExtent,s=null,a,c,f;e.scale=function(u){return arguments.length?(r(u),l()):r()},e.translate=function(u){return arguments.length?(o(u),l()):o()},e.center=function(u){return arguments.length?(n(u),l()):n()},e.clipExtent=function(u){return arguments.length?(u==null?s=a=c=f=null:(s=+u[0][0],a=+u[0][1],c=+u[1][0],f=+u[1][1]),l()):s==null?null:[[s,a],[c,f]]};function l(){var u=yt*r(),p=e(a$(e.rotate()).invert([0,0]));return i(s==null?[[p[0]-u,p[1]-u],[p[0]+u,p[1]+u]]:t===Gc?[[Math.max(p[0]-u,s),a],[Math.min(p[0]+u,c),f]]:[[s,Math.max(p[1]-u,a)],[c,Math.min(p[1]+u,f)]])}return l()}function X0(t){return Dc((Ut+t)/2)}function L$(t,e){var n=Q(t),r=t===e?Z(t):ca(n/Q(e))/ca(X0(e)/X0(t)),o=n*x0(X0(t),r)/r;if(!r)return Gc;function i(s,a){o>0?a<-Ut+K&&(a=-Ut+K):a>Ut-K&&(a=Ut-K);var c=o/x0(X0(a),r);return[c*Z(r*s),o-c*Q(r*s)]}return i.invert=function(s,a){var c=o-a,f=Ke(r)*jt(s*s+c*c),l=he(s,vt(c))*Ke(c);return c*r<0&&(l-=yt*Ke(s)*Ke(c)),[l/r,2*ar(x0(o/f,1/r))-Ut]},i}function Ov(){return Xc(L$).scale(109.5).parallels([30,30])}function Vc(t,e){return[t,e]}Vc.invert=Vc;function Rv(){return Xe(Vc).scale(152.63)}function D$(t,e){var n=Q(t),r=t===e?Z(t):(n-Q(e))/(e-t),o=n/r+t;if(vt(r)<K)return Vc;function i(s,a){var c=o-a,f=r*s;return[c*Z(f),o-c*Q(f)]}return i.invert=function(s,a){var c=o-a,f=he(s,vt(c))*Ke(c);return c*r<0&&(f-=yt*Ke(s)*Ke(c)),[f/r,o-Ke(r)*jt(s*s+c*c)]},i}function Lv(){return Xc(D$).scale(131.154).center([0,13.9389])}var Fu=1.340264,qu=-.081106,Bu=893e-6,zu=.003796,G0=jt(3)/2,LY=12;function Dv(t,e){var n=Zt(G0*Z(e)),r=n*n,o=r*r*r;return[t*Q(n)/(G0*(Fu+3*qu*r+o*(7*Bu+9*zu*r))),n*(Fu+qu*r+o*(Bu+zu*r))]}Dv.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,i=0,s,a,c;i<LY&&(a=n*(Fu+qu*r+o*(Bu+zu*r))-e,c=Fu+3*qu*r+o*(7*Bu+9*zu*r),n-=s=a/c,r=n*n,o=r*r*r,!(vt(s)<aa));++i);return[G0*t*(Fu+3*qu*r+o*(7*Bu+9*zu*r))/Q(n),Zt(Z(n)/G0)]};function Pv(){return Xe(Dv).scale(177.158)}function Fv(t,e){var n=Q(e),r=Q(t)*n;return[n*Z(t)/r,Z(e)/r]}Fv.invert=Jr(ar);function qv(){return Xe(Fv).scale(144.049).clipAngle(60)}function Bv(t,e){return[Q(e)*Z(t),Z(e)]}Bv.invert=Jr(Zt);function zv(){return Xe(Bv).scale(249.5).clipAngle(90+K)}function Yv(t,e){var n=Q(e),r=1+Q(t)*n;return[n*Z(t)/r,Z(e)/r]}Yv.invert=Jr(function(t){return 2*ar(t)});function Uv(){return Xe(Yv).scale(250).clipAngle(142)}function jv(t,e){return[ca(Dc((Ut+e)/2)),-t]}jv.invert=function(t,e){return[-e,2*ar(g0(t))-Ut]};function Xv(){var t=Nv(jv),e=t.center,n=t.rotate;return t.center=function(r){return arguments.length?e([-r[1],r[0]]):(r=e(),[r[1],-r[0]])},t.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 DY(t,e){return t.parent===e.parent?1:2}function PY(t){return t.reduce(FY,0)/t.length}function FY(t,e){return t+e.x}function qY(t){return 1+t.reduce(BY,0)}function BY(t,e){return Math.max(t,e.y)}function zY(t){for(var e;e=t.children;)t=e[0];return t}function YY(t){for(var e;e=t.children;)t=e[e.length-1];return t}function V0(){var t=DY,e=1,n=1,r=!1;function o(i){var s,a=0;i.eachAfter(function(p){var d=p.children;d?(p.x=PY(d),p.y=qY(d)):(p.x=s?a+=t(p,s):0,p.y=0,s=p)});var c=zY(i),f=YY(i),l=c.x-t(c,f)/2,u=f.x+t(f,c)/2;return i.eachAfter(r?function(p){p.x=(p.x-i.x)*e,p.y=(i.y-p.y)*n}:function(p){p.x=(p.x-l)/(u-l)*e,p.y=(1-(i.y?p.y/i.y:1))*n})}return o.separation=function(i){return arguments.length?(t=i,o):t},o.size=function(i){return arguments.length?(r=!1,e=+i[0],n=+i[1],o):r?null:[e,n]},o.nodeSize=function(i){return arguments.length?(r=!0,e=+i[0],n=+i[1],o):r?[e,n]:null},o}function UY(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function P$(){return this.eachAfter(UY)}function F$(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}function q$(t,e){for(var n=this,r=[n],o,i,s=-1;n=r.pop();)if(t.call(e,n,++s,this),o=n.children)for(i=o.length-1;i>=0;--i)r.push(o[i]);return this}function B$(t,e){for(var n=this,r=[n],o=[],i,s,a,c=-1;n=r.pop();)if(o.push(n),i=n.children)for(s=0,a=i.length;s<a;++s)r.push(i[s]);for(;n=o.pop();)t.call(e,n,++c,this);return this}function z$(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}function Y$(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,o=r&&r.length;--o>=0;)n+=r[o].value;e.value=n})}function U$(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function j$(t){for(var e=this,n=jY(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var o=r.length;t!==n;)r.splice(o,0,t),t=t.parent;return r}function jY(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),o=null;for(t=n.pop(),e=r.pop();t===e;)o=t,t=n.pop(),e=r.pop();return o}function X$(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function G$(){return Array.from(this)}function V$(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function W$(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*H$(){var t=this,e,n=[t],r,o,i;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(o=0,i=r.length;o<i;++o)n.push(r[o]);while(n.length)}function Gv(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=VY)):e===void 0&&(e=GY);for(var n=new Ui(t),r,o=[n],i,s,a,c;r=o.pop();)if((s=e(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)o.push(i=s[a]=new Ui(s[a])),i.parent=r,i.depth=r.depth+1;return n.eachBefore(Vv)}function XY(){return Gv(this).eachBefore(WY)}function GY(t){return t.children}function VY(t){return Array.isArray(t)?t[1]:null}function WY(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Vv(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Ui(t){this.data=t,this.depth=this.height=0,this.parent=null}Ui.prototype=Gv.prototype={constructor:Ui,count:P$,each:F$,eachAfter:B$,eachBefore:q$,find:z$,sum:Y$,sort:U$,path:j$,ancestors:X$,descendants:G$,leaves:V$,links:W$,copy:XY,[Symbol.iterator]:H$};function W0(t){return t==null?null:HY(t)}function HY(t){if(typeof t!="function")throw new Error;return t}var ZY={depth:-1},Z$={},Wv={};function QY(t){return t.id}function JY(t){return t.parentId}function H0(){var t=QY,e=JY,n;function r(o){var i=Array.from(o),s=t,a=e,c,f,l,u,p,d,h,m,g=new Map;if(n!=null){let y=i.map((w,_)=>KY(n(w,_,o))),x=y.map(Q$),b=new Set(y).add("");for(let w of x)b.has(w)||(b.add(w),y.push(w),x.push(Q$(w)),i.push(Wv));s=(w,_)=>y[_],a=(w,_)=>x[_]}for(l=0,c=i.length;l<c;++l)f=i[l],d=i[l]=new Ui(f),(h=s(f,l,o))!=null&&(h+="")&&(m=d.id=h,g.set(m,g.has(m)?Z$:d)),(h=a(f,l,o))!=null&&(h+="")&&(d.parent=h);for(l=0;l<c;++l)if(d=i[l],h=d.parent){if(p=g.get(h),!p)throw new Error("missing: "+h);if(p===Z$)throw new Error("ambiguous: "+h);p.children?p.children.push(d):p.children=[d],d.parent=p}else{if(u)throw new Error("multiple roots");u=d}if(!u)throw new Error("no root");if(n!=null){for(;u.data===Wv&&u.children.length===1;)u=u.children[0],--c;for(let y=i.length-1;y>=0&&(d=i[y],d.data===Wv);--y)d.data=null}if(u.parent=ZY,u.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(Vv),u.parent=null,c>0)throw new Error("cycle");return u}return r.id=function(o){return arguments.length?(t=W0(o),r):t},r.parentId=function(o){return arguments.length?(e=W0(o),r):e},r.path=function(o){return arguments.length?(n=W0(o),r):n},r}function KY(t){t=`${t}`;let e=t.length;return Hv(t,e-1)&&!Hv(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function Q$(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Hv(t,e););return t.slice(0,e)}function Hv(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}function tU(t,e){return t.parent===e.parent?1:2}function Zv(t){var e=t.children;return e?e[0]:t.t}function Qv(t){var e=t.children;return e?e[e.length-1]:t.t}function eU(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function nU(t){for(var e=0,n=0,r=t.children,o=r.length,i;--o>=0;)i=r[o],i.z+=e,i.m+=e,e+=i.s+(n+=i.c)}function rU(t,e,n){return t.a.parent===e.parent?t.a:n}function Z0(t,e){this._=t,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=e}Z0.prototype=Object.create(Ui.prototype);function oU(t){for(var e=new Z0(t,0),n,r=[e],o,i,s,a;n=r.pop();)if(i=n._.children)for(n.children=new Array(a=i.length),s=a-1;s>=0;--s)r.push(o=n.children[s]=new Z0(i[s],s)),o.parent=n;return(e.parent=new Z0(null,0)).children=[e],e}function ua(){var t=tU,e=1,n=1,r=null;function o(f){var l=oU(f);if(l.eachAfter(i),l.parent.m=-l.z,l.eachBefore(s),r)f.eachBefore(c);else{var u=f,p=f,d=f;f.eachBefore(function(x){x.x<u.x&&(u=x),x.x>p.x&&(p=x),x.depth>d.depth&&(d=x)});var h=u===p?1:t(u,p)/2,m=h-u.x,g=e/(p.x+h+m),y=n/(d.depth||1);f.eachBefore(function(x){x.x=(x.x+m)*g,x.y=x.depth*y})}return f}function i(f){var l=f.children,u=f.parent.children,p=f.i?u[f.i-1]:null;if(l){nU(f);var d=(l[0].z+l[l.length-1].z)/2;p?(f.z=p.z+t(f._,p._),f.m=f.z-d):f.z=d}else p&&(f.z=p.z+t(f._,p._));f.parent.A=a(f,p,f.parent.A||u[0])}function s(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function a(f,l,u){if(l){for(var p=f,d=f,h=l,m=p.parent.children[0],g=p.m,y=d.m,x=h.m,b=m.m,w;h=Qv(h),p=Zv(p),h&&p;)m=Zv(m),d=Qv(d),d.a=f,w=h.z+x-p.z-g+t(h._,p._),w>0&&(eU(rU(h,f,u),f,w),g+=w,y+=w),x+=h.m,g+=p.m,b+=m.m,y+=d.m;h&&!Qv(d)&&(d.t=h,d.m+=x-y),p&&!Zv(m)&&(m.t=p,m.m+=g-b,u=f)}return u}function c(f){f.x*=e,f.y=f.depth*n}return o.separation=function(f){return arguments.length?(t=f,o):t},o.size=function(f){return arguments.length?(r=!1,e=+f[0],n=+f[1],o):r?null:[e,n]},o.nodeSize=function(f){return arguments.length?(r=!0,e=+f[0],n=+f[1],o):r?[e,n]:null},o}var J$=23283064365386963e-26;function pa(t=Math.random()){let e=(0<=t&&t<1?t/J$:Math.abs(t))|0;return()=>(e=1664525*e+1013904223|0,J$*(e>>>0))}function ge(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Yu(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}var Uu=Symbol("implicit");function da(){var t=new cn,e=[],n=[],r=Uu;function o(i){let s=t.get(i);if(s===void 0){if(r!==Uu)return r;t.set(i,s=e.push(i)-1)}return n[s%n.length]}return o.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new cn;for(let s of i)t.has(s)||t.set(s,e.push(s)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return da(e,n).unknown(r)},ge.apply(o,arguments),o}function ji(){var t=da().unknown(void 0),e=t.domain,n=t.range,r=0,o=1,i,s,a=!1,c=0,f=0,l=.5;delete t.unknown;function u(){var p=e().length,d=o<r,h=d?o:r,m=d?r:o;i=(m-h)/Math.max(1,p-c+f*2),a&&(i=Math.floor(i)),h+=(m-h-i*(p-c))*l,s=i*(1-c),a&&(h=Math.round(h),s=Math.round(s));var g=ce(p).map(function(y){return h+i*y});return n(d?g.reverse():g)}return t.domain=function(p){return arguments.length?(e(p),u()):e()},t.range=function(p){return arguments.length?([r,o]=p,r=+r,o=+o,u()):[r,o]},t.rangeRound=function(p){return[r,o]=p,r=+r,o=+o,a=!0,u()},t.bandwidth=function(){return s},t.step=function(){return i},t.round=function(p){return arguments.length?(a=!!p,u()):a},t.padding=function(p){return arguments.length?(c=Math.min(1,f=+p),u()):c},t.paddingInner=function(p){return arguments.length?(c=Math.min(1,p),u()):c},t.paddingOuter=function(p){return arguments.length?(f=+p,u()):f},t.align=function(p){return arguments.length?(l=Math.max(0,Math.min(1,p)),u()):l},t.copy=function(){return ji(e(),[r,o]).round(a).paddingInner(c).paddingOuter(f).align(l)},ge.apply(u(),arguments)}function K$(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return K$(e())},t}function Jv(){return K$(ji.apply(null,arguments).paddingInner(1))}function Kv(t){return function(){return t}}function Wc(t){return+t}var t9=[0,1];function $n(t){return t}function t_(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Kv(isNaN(e)?NaN:.5)}function iU(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function sU(t,e,n){var r=t[0],o=t[1],i=e[0],s=e[1];return o<r?(r=t_(o,r),i=n(s,i)):(r=t_(r,o),i=n(i,s)),function(a){return i(r(a))}}function aU(t,e,n){var r=Math.min(t.length,e.length)-1,o=new Array(r),i=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)o[s]=t_(t[s],t[s+1]),i[s]=n(e[s],e[s+1]);return function(a){var c=Lo(t,a,1,r)-1;return i[c](o[c](a))}}function Kr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ha(){var t=t9,e=t9,n=Fn,r,o,i,s=$n,a,c,f;function l(){var p=Math.min(t.length,e.length);return s!==$n&&(s=iU(t[0],t[p-1])),a=p>2?aU:sU,c=f=null,u}function u(p){return p==null||isNaN(p=+p)?i:(c||(c=a(t.map(r),e,n)))(r(s(p)))}return u.invert=function(p){return s(o((f||(f=a(e,t.map(r),Ht)))(p)))},u.domain=function(p){return arguments.length?(t=Array.from(p,Wc),l()):t.slice()},u.range=function(p){return arguments.length?(e=Array.from(p),l()):e.slice()},u.rangeRound=function(p){return e=Array.from(p),n=ea,l()},u.clamp=function(p){return arguments.length?(s=p?!0:$n,l()):s!==$n},u.interpolate=function(p){return arguments.length?(n=p,l()):n},u.unknown=function(p){return arguments.length?(i=p,u):i},function(p,d){return r=p,o=d,l()}}function ju(){return ha()($n,$n)}function e_(t,e,n,r){var o=yc(t,e,n),i;switch(r=Wr(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=Ww(o,s))&&(r.precision=i),m0(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=Hw(o,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=Vw(o))&&(r.precision=i-(r.type==="%")*2);break}}return sr(r)}function Vo(t){var e=t.domain;return t.ticks=function(n){var r=e();return Ye(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var o=e();return e_(o[0],o[o.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),o=0,i=r.length-1,s=r[o],a=r[i],c,f,l=10;for(a<s&&(f=s,s=a,a=f,f=o,o=i,i=f);l-- >0;){if(f=Po(s,a,n),f===c)return r[o]=s,r[i]=a,e(r);if(f>0)s=Math.floor(s/f)*f,a=Math.ceil(a/f)*f;else if(f<0)s=Math.ceil(s*f)/f,a=Math.floor(a*f)/f;else break;c=f}return t},t}function Wo(){var t=ju();return t.copy=function(){return Kr(t,Wo())},ge.apply(t,arguments),Vo(t)}function Xu(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Wc),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return Xu(t).unknown(e)},t=arguments.length?Array.from(t,Wc):[0,1],Vo(n)}function Gu(t,e){t=t.slice();var n=0,r=t.length-1,o=t[n],i=t[r],s;return i<o&&(s=n,n=r,r=s,s=o,o=i,i=s),t[n]=e.floor(o),t[r]=e.ceil(i),t}function e9(t){return Math.log(t)}function n9(t){return Math.exp(t)}function cU(t){return-Math.log(-t)}function fU(t){return-Math.exp(-t)}function lU(t){return isFinite(t)?+("1e"+t):t<0?0:t}function uU(t){return t===10?lU:t===Math.E?Math.exp:e=>Math.pow(t,e)}function pU(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function r9(t){return(e,n)=>-t(-e,n)}function n_(t){let e=t(e9,n9),n=e.domain,r=10,o,i;function s(){return o=pU(r),i=uU(r),n()[0]<0?(o=r9(o),i=r9(i),t(cU,fU)):t(e9,n9),e}return e.base=function(a){return arguments.length?(r=+a,s()):r},e.domain=function(a){return arguments.length?(n(a),s()):n()},e.ticks=a=>{let c=n(),f=c[0],l=c[c.length-1],u=l<f;u&&([f,l]=[l,f]);let p=o(f),d=o(l),h,m,g=a==null?10:+a,y=[];if(!(r%1)&&d-p<g){if(p=Math.floor(p),d=Math.ceil(d),f>0){for(;p<=d;++p)for(h=1;h<r;++h)if(m=p<0?h/i(-p):h*i(p),!(m<f)){if(m>l)break;y.push(m)}}else for(;p<=d;++p)for(h=r-1;h>=1;--h)if(m=p>0?h/i(-p):h*i(p),!(m<f)){if(m>l)break;y.push(m)}y.length*2<g&&(y=Ye(f,l,g))}else y=Ye(p,d,Math.min(d-p,g)).map(i);return u?y.reverse():y},e.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Wr(c)).precision==null&&(c.trim=!0),c=sr(c)),a===1/0)return c;let f=Math.max(1,r*a/e.ticks().length);return l=>{let u=l/i(Math.round(o(l)));return u*r<r-.5&&(u*=r),u<=f?c(l):""}},e.nice=()=>n(Gu(n(),{floor:a=>i(Math.floor(o(a))),ceil:a=>i(Math.ceil(o(a)))})),e}function Vu(){let t=n_(ha()).domain([1,10]);return t.copy=()=>Kr(t,Vu()).base(t.base()),ge.apply(t,arguments),t}function o9(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function i9(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function r_(t){var e=1,n=t(o9(e),i9(e));return n.constant=function(r){return arguments.length?t(o9(e=+r),i9(e)):e},Vo(n)}function Wu(){var t=r_(ha());return t.copy=function(){return Kr(t,Wu()).constant(t.constant())},ge.apply(t,arguments)}function s9(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function dU(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function hU(t){return t<0?-t*t:t*t}function o_(t){var e=t($n,$n),n=1;function r(){return n===1?t($n,$n):n===.5?t(dU,hU):t(s9(n),s9(1/n))}return e.exponent=function(o){return arguments.length?(n=+o,r()):n},Vo(e)}function Hu(){var t=o_(ha());return t.copy=function(){return Kr(t,Hu()).exponent(t.exponent())},ge.apply(t,arguments),t}function Zu(){var t=[],e=[],n=[],r;function o(){var s=0,a=Math.max(1,e.length);for(n=new Array(a-1);++s<a;)n[s-1]=rw(t,s/a);return i}function i(s){return s==null||isNaN(s=+s)?r:e[Lo(n,s)]}return i.invertExtent=function(s){var a=e.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:t[0],a<n.length?n[a]:t[t.length-1]]},i.domain=function(s){if(!arguments.length)return t.slice();t=[];for(let a of s)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(gt),o()},i.range=function(s){return arguments.length?(e=Array.from(s),o()):e.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return Zu().domain(t).range(e).unknown(r)},ge.apply(i,arguments)}function Qu(){var t=[.5],e=[0,1],n,r=1;function o(i){return i!=null&&i<=i?e[Lo(t,i,0,r)]:n}return o.domain=function(i){return arguments.length?(t=Array.from(i),r=Math.min(t.length,e.length-1),o):t.slice()},o.range=function(i){return arguments.length?(e=Array.from(i),r=Math.min(t.length,e.length-1),o):e.slice()},o.invertExtent=function(i){var s=e.indexOf(i);return[t[s-1],t[s]]},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return Qu().domain(t).range(e).unknown(n)},ge.apply(o,arguments)}var i_=new Date,s_=new Date;function Gt(t,e,n,r){function o(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return o.floor=i=>(t(i=new Date(+i)),i),o.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),o.round=i=>{let s=o(i),a=o.ceil(i);return i-s<a-i?s:a},o.offset=(i,s)=>(e(i=new Date(+i),s==null?1:Math.floor(s)),i),o.range=(i,s,a)=>{let c=[];if(i=o.ceil(i),a=a==null?1:Math.floor(a),!(i<s)||!(a>0))return c;let f;do c.push(f=new Date(+i)),e(i,a),t(i);while(f<i&&i<s);return c},o.filter=i=>Gt(s=>{if(s>=s)for(;t(s),!i(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;e(s,-1),!i(s););else for(;--a>=0;)for(;e(s,1),!i(s););}),n&&(o.count=(i,s)=>(i_.setTime(+i),s_.setTime(+s),t(i_),t(s_),Math.floor(n(i_,s_))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(r?s=>r(s)%i===0:s=>o.count(0,s)%i===0):o)),o}var Ju=Gt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Ju.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Gt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Ju);var F2t=Ju.range;var $e=Gt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),a9=$e.range;var Ho=Gt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),mU=Ho.range,Zo=Gt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),gU=Zo.range;var Qo=Gt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),yU=Qo.range,Jo=Gt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),xU=Jo.range;var cr=Gt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),bU=cr.range,ya=Gt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),wU=ya.range,xa=Gt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),vU=xa.range;function ba(t){return Gt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}var Bn=ba(0),Xi=ba(1),Q0=ba(2),J0=ba(3),eo=ba(4),K0=ba(5),tg=ba(6),f9=Bn.range,_U=Xi.range,SU=Q0.range,MU=J0.range,AU=eo.range,TU=K0.range,EU=tg.range;function wa(t){return Gt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/6048e5)}var zn=wa(0),Gi=wa(1),eg=wa(2),ng=wa(3),no=wa(4),rg=wa(5),og=wa(6),l9=zn.range,IU=Gi.range,$U=eg.range,CU=ng.range,kU=no.range,NU=rg.range,OU=og.range;var Ko=Gt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),RU=Ko.range,ti=Gt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),LU=ti.range;var tn=Gt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());tn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Gt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});var DU=tn.range,en=Gt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());en.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Gt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});var PU=en.range;function p9(t,e,n,r,o,i){let s=[[$e,1,1e3],[$e,5,5*1e3],[$e,15,15*1e3],[$e,30,30*1e3],[i,1,6e4],[i,5,5*6e4],[i,15,15*6e4],[i,30,30*6e4],[o,1,36e5],[o,3,3*36e5],[o,6,6*36e5],[o,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function a(f,l,u){let p=l<f;p&&([f,l]=[l,f]);let d=u&&typeof u.range=="function"?u:c(f,l,u),h=d?d.range(f,+l+1):[];return p?h.reverse():h}function c(f,l,u){let p=Math.abs(l-f)/u,d=wr(([,,g])=>g).right(s,p);if(d===s.length)return t.every(yc(f/31536e6,l/31536e6,u));if(d===0)return Ju.every(Math.max(yc(f,l,u),1));let[h,m]=s[p/s[d-1][2]<s[d][2]/p?d-1:d];return h.every(m)}return[a,c]}var[a_,tp]=p9(en,ti,zn,xa,Jo,Zo),[c_,f_]=p9(tn,Ko,Bn,cr,Qo,Ho);function l_(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function u_(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ep(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function p_(t){var e=t.dateTime,n=t.date,r=t.time,o=t.periods,i=t.days,s=t.shortDays,a=t.months,c=t.shortMonths,f=np(o),l=rp(o),u=np(i),p=rp(i),d=np(s),h=rp(s),m=np(a),g=rp(a),y=np(c),x=rp(c),b={a:N,A:D,b:L,B:P,c:null,d:x9,e:x9,f:aj,g:yj,G:bj,H:oj,I:ij,j:sj,L:S9,m:cj,M:fj,p:F,q,Q:v9,s:_9,S:lj,u:uj,U:pj,V:dj,w:hj,W:mj,x:null,X:null,y:gj,Y:xj,Z:wj,"%":w9},w={a:W,A:tt,b:nt,B:ot,c:null,d:b9,e:b9,f:Mj,g:Rj,G:Dj,H:vj,I:_j,j:Sj,L:A9,m:Aj,M:Tj,p:X,q:rt,Q:v9,s:_9,S:Ej,u:Ij,U:$j,V:Cj,w:kj,W:Nj,x:null,X:null,y:Oj,Y:Lj,Z:Pj,"%":w9},_={a:$,A:M,b:k,B:R,c:S,d:g9,e:g9,f:tj,g:m9,G:h9,H:y9,I:y9,j:ZU,L:KU,m:HU,M:QU,p:T,q:WU,Q:nj,s:rj,S:JU,u:UU,U:jU,V:XU,w:YU,W:GU,x:I,X:C,y:m9,Y:h9,Z:VU,"%":ej};b.x=v(n,b),b.X=v(r,b),b.c=v(e,b),w.x=v(n,w),w.X=v(r,w),w.c=v(e,w);function v(Y,H){return function(et){var B=[],wt=-1,ct=0,It=Y.length,kt,J,qt;for(et instanceof Date||(et=new Date(+et));++wt<It;)Y.charCodeAt(wt)===37&&(B.push(Y.slice(ct,wt)),(J=d9[kt=Y.charAt(++wt)])!=null?kt=Y.charAt(++wt):J=kt==="e"?" ":"0",(qt=H[kt])&&(kt=qt(et,J)),B.push(kt),ct=wt+1);return B.push(Y.slice(ct,wt)),B.join("")}}function A(Y,H){return function(et){var B=ep(1900,void 0,1),wt=E(B,Y,et+="",0),ct,It;if(wt!=et.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(H&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(ct=u_(ep(B.y,0,1)),It=ct.getUTCDay(),ct=It>4||It===0?Gi.ceil(ct):Gi(ct),ct=ya.offset(ct,(B.V-1)*7),B.y=ct.getUTCFullYear(),B.m=ct.getUTCMonth(),B.d=ct.getUTCDate()+(B.w+6)%7):(ct=l_(ep(B.y,0,1)),It=ct.getDay(),ct=It>4||It===0?Xi.ceil(ct):Xi(ct),ct=cr.offset(ct,(B.V-1)*7),B.y=ct.getFullYear(),B.m=ct.getMonth(),B.d=ct.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),It="Z"in B?u_(ep(B.y,0,1)).getUTCDay():l_(ep(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(It+5)%7:B.w+B.U*7-(It+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,u_(B)):l_(B)}}function E(Y,H,et,B){for(var wt=0,ct=H.length,It=et.length,kt,J;wt<ct;){if(B>=It)return-1;if(kt=H.charCodeAt(wt++),kt===37){if(kt=H.charAt(wt++),J=_[kt in d9?H.charAt(wt++):kt],!J||(B=J(Y,et,B))<0)return-1}else if(kt!=et.charCodeAt(B++))return-1}return B}function T(Y,H,et){var B=f.exec(H.slice(et));return B?(Y.p=l.get(B[0].toLowerCase()),et+B[0].length):-1}function $(Y,H,et){var B=d.exec(H.slice(et));return B?(Y.w=h.get(B[0].toLowerCase()),et+B[0].length):-1}function M(Y,H,et){var B=u.exec(H.slice(et));return B?(Y.w=p.get(B[0].toLowerCase()),et+B[0].length):-1}function k(Y,H,et){var B=y.exec(H.slice(et));return B?(Y.m=x.get(B[0].toLowerCase()),et+B[0].length):-1}function R(Y,H,et){var B=m.exec(H.slice(et));return B?(Y.m=g.get(B[0].toLowerCase()),et+B[0].length):-1}function S(Y,H,et){return E(Y,e,H,et)}function I(Y,H,et){return E(Y,n,H,et)}function C(Y,H,et){return E(Y,r,H,et)}function N(Y){return s[Y.getDay()]}function D(Y){return i[Y.getDay()]}function L(Y){return c[Y.getMonth()]}function P(Y){return a[Y.getMonth()]}function F(Y){return o[+(Y.getHours()>=12)]}function q(Y){return 1+~~(Y.getMonth()/3)}function W(Y){return s[Y.getUTCDay()]}function tt(Y){return i[Y.getUTCDay()]}function nt(Y){return c[Y.getUTCMonth()]}function ot(Y){return a[Y.getUTCMonth()]}function X(Y){return o[+(Y.getUTCHours()>=12)]}function rt(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var H=v(Y+="",b);return H.toString=function(){return Y},H},parse:function(Y){var H=A(Y+="",!1);return H.toString=function(){return Y},H},utcFormat:function(Y){var H=v(Y+="",w);return H.toString=function(){return Y},H},utcParse:function(Y){var H=A(Y+="",!0);return H.toString=function(){return Y},H}}}var d9={"-":"",_:" ",0:"0"},Ce=/^\s*\d+/,qU=/^%/,BU=/[\\^$*+?|[\]().{}]/g;function Lt(t,e,n){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(e)+o:o)}function zU(t){return t.replace(BU,"\\$&")}function np(t){return new RegExp("^(?:"+t.map(zU).join("|")+")","i")}function rp(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function YU(t,e,n){var r=Ce.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function UU(t,e,n){var r=Ce.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function jU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function XU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function GU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function h9(t,e,n){var r=Ce.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function m9(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function VU(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function WU(t,e,n){var r=Ce.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function HU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function g9(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ZU(t,e,n){var r=Ce.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function y9(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function QU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function JU(t,e,n){var r=Ce.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function KU(t,e,n){var r=Ce.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function tj(t,e,n){var r=Ce.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ej(t,e,n){var r=qU.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function nj(t,e,n){var r=Ce.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function rj(t,e,n){var r=Ce.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function x9(t,e){return Lt(t.getDate(),e,2)}function oj(t,e){return Lt(t.getHours(),e,2)}function ij(t,e){return Lt(t.getHours()%12||12,e,2)}function sj(t,e){return Lt(1+cr.count(tn(t),t),e,3)}function S9(t,e){return Lt(t.getMilliseconds(),e,3)}function aj(t,e){return S9(t,e)+"000"}function cj(t,e){return Lt(t.getMonth()+1,e,2)}function fj(t,e){return Lt(t.getMinutes(),e,2)}function lj(t,e){return Lt(t.getSeconds(),e,2)}function uj(t){var e=t.getDay();return e===0?7:e}function pj(t,e){return Lt(Bn.count(tn(t)-1,t),e,2)}function M9(t){var e=t.getDay();return e>=4||e===0?eo(t):eo.ceil(t)}function dj(t,e){return t=M9(t),Lt(eo.count(tn(t),t)+(tn(t).getDay()===4),e,2)}function hj(t){return t.getDay()}function mj(t,e){return Lt(Xi.count(tn(t)-1,t),e,2)}function gj(t,e){return Lt(t.getFullYear()%100,e,2)}function yj(t,e){return t=M9(t),Lt(t.getFullYear()%100,e,2)}function xj(t,e){return Lt(t.getFullYear()%1e4,e,4)}function bj(t,e){var n=t.getDay();return t=n>=4||n===0?eo(t):eo.ceil(t),Lt(t.getFullYear()%1e4,e,4)}function wj(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Lt(e/60|0,"0",2)+Lt(e%60,"0",2)}function b9(t,e){return Lt(t.getUTCDate(),e,2)}function vj(t,e){return Lt(t.getUTCHours(),e,2)}function _j(t,e){return Lt(t.getUTCHours()%12||12,e,2)}function Sj(t,e){return Lt(1+ya.count(en(t),t),e,3)}function A9(t,e){return Lt(t.getUTCMilliseconds(),e,3)}function Mj(t,e){return A9(t,e)+"000"}function Aj(t,e){return Lt(t.getUTCMonth()+1,e,2)}function Tj(t,e){return Lt(t.getUTCMinutes(),e,2)}function Ej(t,e){return Lt(t.getUTCSeconds(),e,2)}function Ij(t){var e=t.getUTCDay();return e===0?7:e}function $j(t,e){return Lt(zn.count(en(t)-1,t),e,2)}function T9(t){var e=t.getUTCDay();return e>=4||e===0?no(t):no.ceil(t)}function Cj(t,e){return t=T9(t),Lt(no.count(en(t),t)+(en(t).getUTCDay()===4),e,2)}function kj(t){return t.getUTCDay()}function Nj(t,e){return Lt(Gi.count(en(t)-1,t),e,2)}function Oj(t,e){return Lt(t.getUTCFullYear()%100,e,2)}function Rj(t,e){return t=T9(t),Lt(t.getUTCFullYear()%100,e,2)}function Lj(t,e){return Lt(t.getUTCFullYear()%1e4,e,4)}function Dj(t,e){var n=t.getUTCDay();return t=n>=4||n===0?no(t):no.ceil(t),Lt(t.getUTCFullYear()%1e4,e,4)}function Pj(){return"+0000"}function w9(){return"%"}function v9(t){return+t}function _9(t){return Math.floor(+t/1e3)}var Hc,Zc,E9,ro,I9;d_({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 d_(t){return Hc=p_(t),Zc=Hc.format,E9=Hc.parse,ro=Hc.utcFormat,I9=Hc.utcParse,Hc}function Fj(t){return new Date(t)}function qj(t){return t instanceof Date?+t:+new Date(+t)}function ig(t,e,n,r,o,i,s,a,c,f){var l=ju(),u=l.invert,p=l.domain,d=f(".%L"),h=f(":%S"),m=f("%I:%M"),g=f("%I %p"),y=f("%a %d"),x=f("%b %d"),b=f("%B"),w=f("%Y");function _(v){return(c(v)<v?d:a(v)<v?h:s(v)<v?m:i(v)<v?g:r(v)<v?o(v)<v?y:x:n(v)<v?b:w)(v)}return l.invert=function(v){return new Date(u(v))},l.domain=function(v){return arguments.length?p(Array.from(v,qj)):p().map(Fj)},l.ticks=function(v){var A=p();return t(A[0],A[A.length-1],v??10)},l.tickFormat=function(v,A){return A==null?_:f(A)},l.nice=function(v){var A=p();return(!v||typeof v.range!="function")&&(v=e(A[0],A[A.length-1],v??10)),v?p(Gu(A,v)):l},l.copy=function(){return Kr(l,ig(t,e,n,r,o,i,s,a,c,f))},l}function sg(){return ge.apply(ig(c_,f_,tn,Ko,Bn,cr,Qo,Ho,$e,Zc).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ag(){return ge.apply(ig(a_,tp,en,ti,zn,ya,Jo,Zo,$e,ro).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function op(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function cg(){var t=0,e=.5,n=1,r=1,o,i,s,a,c,f=$n,l,u=!1,p;function d(m){return isNaN(m=+m)?p:(m=.5+((m=+l(m))-i)*(r*m<r*i?a:c),f(u?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([t,e,n]=m,o=l(t=+t),i=l(e=+e),s=l(n=+n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,d):[t,e,n]},d.clamp=function(m){return arguments.length?(u=!!m,d):u},d.interpolator=function(m){return arguments.length?(f=m,d):f};function h(m){return function(g){var y,x,b;return arguments.length?([y,x,b]=g,f=jr(m,[y,x,b]),d):[f(0),f(.5),f(1)]}}return d.range=h(Fn),d.rangeRound=h(ea),d.unknown=function(m){return arguments.length?(p=m,d):p},function(m){return l=m,o=m(t),i=m(e),s=m(n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,d}}function ip(){var t=Vo(cg()($n));return t.copy=function(){return op(t,ip())},Yu.apply(t,arguments)}function fg(){var t=n_(cg()).domain([.1,1,10]);return t.copy=function(){return op(t,fg()).base(t.base())},Yu.apply(t,arguments)}function lg(){var t=r_(cg());return t.copy=function(){return op(t,lg()).constant(t.constant())},Yu.apply(t,arguments)}function ug(){var t=o_(cg());return t.copy=function(){return op(t,ug()).exponent(t.exponent())},Yu.apply(t,arguments)}function G(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}var h_=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var m_=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var g_=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var y_=G("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var x_=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var b_=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var w_=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var v_=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var __=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var S_=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var M_=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var lt=t=>bw(t[t.length-1]);var pg=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),dg=lt(pg);var hg=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),mg=lt(hg);var gg=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),yg=lt(gg);var xg=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),bg=lt(xg);var sp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),Qc=lt(sp);var wg=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),vg=lt(wg);var ap=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),Jc=lt(ap);var _g=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),Sg=lt(_g);var Mg=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),Ag=lt(Mg);var Tg=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Eg=lt(Tg);var Ig=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),$g=lt(Ig);var Cg=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),kg=lt(Cg);var Ng=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Og=lt(Ng);var Rg=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),Lg=lt(Rg);var Dg=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Pg=lt(Dg);var Fg=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),qg=lt(Fg);var Bg=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),zg=lt(Bg);var Yg=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),Ug=lt(Yg);var jg=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),Xg=lt(jg);var Gg=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),Vg=lt(Gg);var Wg=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),Hg=lt(Wg);var Zg=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),Qg=lt(Zg);var Jg=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),Kg=lt(Jg);var ty=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),ey=lt(ty);var ny=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),ry=lt(ny);var oy=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),iy=lt(oy);var sy=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),ay=lt(sy);function cy(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}var fy=Tc(pn(300,.5,0),pn(-240,.5,1));var uy=Tc(pn(-100,.75,.35),pn(80,1.5,.8)),py=Tc(pn(260,.75,.35),pn(80,1.5,.8)),ly=pn();function dy(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return ly.h=360*t-100,ly.s=1.5-1.5*e,ly.l=.8-.9*e,ly+""}var hy=ve(),Bj=Math.PI/3,zj=Math.PI*2/3;function my(t){var e;return t=(.5-t)*Math.PI,hy.r=255*(e=Math.sin(t))*e,hy.g=255*(e=Math.sin(t+Bj))*e,hy.b=255*(e=Math.sin(t+zj))*e,hy+""}function gy(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function yy(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var xy=yy(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),by=yy(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),wy=yy(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),vy=yy(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function ye(t){return function(){return t}}var A_=Math.cos;var Kc=Math.min,cp=Math.sin,Dt=Math.sqrt,T_=1e-12,va=Math.PI,f3t=va/2,tf=2*va;function _y(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new Fi(e)}var d3t=Array.prototype.slice;function Sy(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $9(t){this._context=t}$9.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function ei(t){return new $9(t)}function My(t){return t[0]}function Ay(t){return t[1]}function fp(t,e){var n=ye(!0),r=null,o=ei,i=null,s=_y(a);t=typeof t=="function"?t:t===void 0?My:ye(t),e=typeof e=="function"?e:e===void 0?Ay:ye(e);function a(c){var f,l=(c=Sy(c)).length,u,p=!1,d;for(r==null&&(i=o(d=s())),f=0;f<=l;++f)!(f<l&&n(u=c[f],f,c))===p&&((p=!p)?i.lineStart():i.lineEnd()),p&&i.point(+t(u,f,c),+e(u,f,c));if(d)return i=null,d+""||null}return a.x=function(c){return arguments.length?(t=typeof c=="function"?c:ye(+c),a):t},a.y=function(c){return arguments.length?(e=typeof c=="function"?c:ye(+c),a):e},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:ye(!!c),a):n},a.curve=function(c){return arguments.length?(o=c,r!=null&&(i=o(r)),a):o},a.context=function(c){return arguments.length?(c==null?r=i=null:i=o(r=c),a):r},a}function ef(t,e,n){var r=null,o=ye(!0),i=null,s=ei,a=null,c=_y(f);t=typeof t=="function"?t:t===void 0?My:ye(+t),e=typeof e=="function"?e:e===void 0?ye(0):ye(+e),n=typeof n=="function"?n:n===void 0?Ay:ye(+n);function f(u){var p,d,h,m=(u=Sy(u)).length,g,y=!1,x,b=new Array(m),w=new Array(m);for(i==null&&(a=s(x=c())),p=0;p<=m;++p){if(!(p<m&&o(g=u[p],p,u))===y)if(y=!y)d=p,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),h=p-1;h>=d;--h)a.point(b[h],w[h]);a.lineEnd(),a.areaEnd()}y&&(b[p]=+t(g,p,u),w[p]=+e(g,p,u),a.point(r?+r(g,p,u):b[p],n?+n(g,p,u):w[p]))}if(x)return a=null,x+""||null}function l(){return fp().defined(o).curve(s).context(i)}return f.x=function(u){return arguments.length?(t=typeof u=="function"?u:ye(+u),r=null,f):t},f.x0=function(u){return arguments.length?(t=typeof u=="function"?u:ye(+u),f):t},f.x1=function(u){return arguments.length?(r=u==null?null:typeof u=="function"?u:ye(+u),f):r},f.y=function(u){return arguments.length?(e=typeof u=="function"?u:ye(+u),n=null,f):e},f.y0=function(u){return arguments.length?(e=typeof u=="function"?u:ye(+u),f):e},f.y1=function(u){return arguments.length?(n=u==null?null:typeof u=="function"?u:ye(+u),f):n},f.lineX0=f.lineY0=function(){return l().x(t).y(e)},f.lineY1=function(){return l().x(t).y(n)},f.lineX1=function(){return l().x(r).y(e)},f.defined=function(u){return arguments.length?(o=typeof u=="function"?u:ye(!!u),f):o},f.curve=function(u){return arguments.length?(s=u,i!=null&&(a=s(i)),f):s},f.context=function(u){return arguments.length?(u==null?i=a=null:a=s(i=u),f):i},f}var Ty=class{constructor(e,n){this._context=e,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(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}};function E_(t){return new Ty(t,!0)}function I_(t){return new Ty(t,!1)}var Yj=Dt(3),lp={draw(t,e){let n=Dt(e+Kc(e/28,.75))*.59436,r=n/2,o=r*Yj;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-o,-r),t.lineTo(o,r),t.moveTo(-o,r),t.lineTo(o,-r)}};var ni={draw(t,e){let n=Dt(e/va);t.moveTo(n,0),t.arc(0,0,n,0,tf)}};var up={draw(t,e){let n=Dt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};var C9=Dt(1/3),Uj=C9*2,pp={draw(t,e){let n=Dt(e/Uj),r=n*C9;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}};var dp={draw(t,e){let n=Dt(e)*.62625;t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}};var hp={draw(t,e){let n=Dt(e-Kc(e/7,2))*.87559;t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}};var mp={draw(t,e){let n=Dt(e),r=-n/2;t.rect(r,r,n,n)}};var gp={draw(t,e){let n=Dt(e)*.4431;t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};var jj=.8908130915292852,k9=cp(va/10)/cp(7*va/10),Xj=cp(tf/10)*k9,Gj=-A_(tf/10)*k9,yp={draw(t,e){let n=Dt(e*jj),r=Xj*n,o=Gj*n;t.moveTo(0,-n),t.lineTo(r,o);for(let i=1;i<5;++i){let s=tf*i/5,a=A_(s),c=cp(s);t.lineTo(c*n,-a*n),t.lineTo(a*r-c*o,c*r+a*o)}t.closePath()}};var $_=Dt(3),xp={draw(t,e){let n=-Dt(e/($_*3));t.moveTo(0,n*2),t.lineTo(-$_*n,-n),t.lineTo($_*n,-n),t.closePath()}};var Vj=Dt(3),bp={draw(t,e){let n=Dt(e)*.6824,r=n/2,o=n*Vj/2;t.moveTo(0,-n),t.lineTo(o,r),t.lineTo(-o,r),t.closePath()}};var fr=-.5,lr=Dt(3)/2,C_=1/Dt(12),Wj=(C_/2+1)*3,wp={draw(t,e){let n=Dt(e/Wj),r=n/2,o=n*C_,i=r,s=n*C_+n,a=-i,c=s;t.moveTo(r,o),t.lineTo(i,s),t.lineTo(a,c),t.lineTo(fr*r-lr*o,lr*r+fr*o),t.lineTo(fr*i-lr*s,lr*i+fr*s),t.lineTo(fr*a-lr*c,lr*a+fr*c),t.lineTo(fr*r+lr*o,fr*o-lr*r),t.lineTo(fr*i+lr*s,fr*s-lr*i),t.lineTo(fr*a+lr*c,fr*c-lr*a),t.closePath()}};var nf={draw(t,e){let n=Dt(e-Kc(e/6,1.7))*.6189;t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};var Ey=[ni,up,pp,mp,yp,xp,wp],k_=[ni,hp,nf,bp,lp,gp,dp];function ur(){}function rf(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function vp(t){this._context=t}vp.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:rf(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:rf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function N_(t){return new vp(t)}function N9(t){this._context=t}N9.prototype={areaStart:ur,areaEnd:ur,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:rf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function O_(t){return new N9(t)}function O9(t){this._context=t}O9.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(t,e){switch(t=+t,e=+e,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+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:rf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function R_(t){return new O9(t)}function R9(t,e){this._basis=new vp(t),this._beta=e}R9.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r=t[0],o=e[0],i=t[n]-r,s=e[n]-o,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*t[a]+(1-this._beta)*(r+c*i),this._beta*e[a]+(1-this._beta)*(o+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var L_=function t(e){function n(r){return e===1?new vp(r):new R9(r,e)}return n.beta=function(r){return t(+r)},n}(.85);function of(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Iy(t,e){this._context=t,this._k=(1-e)/6}Iy.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:of(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:of(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var D_=function t(e){function n(r){return new Iy(r,e)}return n.tension=function(r){return t(+r)},n}(0);function $y(t,e){this._context=t,this._k=(1-e)/6}$y.prototype={areaStart:ur,areaEnd:ur,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:of(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var P_=function t(e){function n(r){return new $y(r,e)}return n.tension=function(r){return t(+r)},n}(0);function Cy(t,e){this._context=t,this._k=(1-e)/6}Cy.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(t,e){switch(t=+t,e=+e,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:of(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var F_=function t(e){function n(r){return new Cy(r,e)}return n.tension=function(r){return t(+r)},n}(0);function _p(t,e,n){var r=t._x1,o=t._y1,i=t._x2,s=t._y2;if(t._l01_a>T_){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,o=(o*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>T_){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);i=(i*f+t._x1*t._l23_2a-e*t._l12_2a)/l,s=(s*f+t._y1*t._l23_2a-n*t._l12_2a)/l}t._context.bezierCurveTo(r,o,i,s,t._x2,t._y2)}function L9(t,e){this._context=t,this._alpha=e}L9.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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:_p(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var q_=function t(e){function n(r){return e?new L9(r,e):new Iy(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function D9(t,e){this._context=t,this._alpha=e}D9.prototype={areaStart:ur,areaEnd:ur,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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:_p(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var B_=function t(e){function n(r){return e?new D9(r,e):new $y(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function P9(t,e){this._context=t,this._alpha=e}P9.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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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:_p(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var z_=function t(e){function n(r){return e?new P9(r,e):new Cy(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function F9(t){this._context=t}F9.prototype={areaStart:ur,areaEnd:ur,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Y_(t){return new F9(t)}function q9(t){return t<0?-1:1}function B9(t,e,n){var r=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(r||o<0&&-0),s=(n-t._y1)/(o||r<0&&-0),a=(i*o+s*r)/(r+o);return(q9(i)+q9(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(a))||0}function z9(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function U_(t,e,n){var r=t._x0,o=t._y0,i=t._x1,s=t._y1,a=(i-r)/3;t._context.bezierCurveTo(r+a,o+a*e,i-a,s-a*n,i,s)}function ky(t){this._context=t}ky.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:U_(this,this._t0,z9(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,U_(this,z9(this,n=B9(this,t,e)),n);break;default:U_(this,this._t0,n=B9(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function Y9(t){this._context=new U9(t)}(Y9.prototype=Object.create(ky.prototype)).point=function(t,e){ky.prototype.point.call(this,e,t)};function U9(t){this._context=t}U9.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,o,i){this._context.bezierCurveTo(e,t,r,n,i,o)}};function j_(t){return new ky(t)}function X_(t){return new Y9(t)}function X9(t){this._context=t}X9.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=j9(t),o=j9(e),i=0,s=1;s<n;++i,++s)this._context.bezierCurveTo(r[0][i],o[0][i],r[1][i],o[1][i],t[s],e[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function j9(t){var e,n=t.length-1,r,o=new Array(n),i=new Array(n),s=new Array(n);for(o[0]=0,i[0]=2,s[0]=t[0]+2*t[1],e=1;e<n-1;++e)o[e]=1,i[e]=4,s[e]=4*t[e]+2*t[e+1];for(o[n-1]=2,i[n-1]=7,s[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=o[e]/i[e-1],i[e]-=r,s[e]-=r*s[e-1];for(o[n-1]=s[n-1]/i[n-1],e=n-2;e>=0;--e)o[e]=(s[e]-o[e+1])/i[e];for(i[n-1]=(t[n]+o[n-1])/2,e=0;e<n-1;++e)i[e]=2*t[e+1]-o[e+1];return[o,i]}function G_(t){return new X9(t)}function Ny(t,e){this._context=t,this._t=e}Ny.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function V_(t){return new Ny(t,.5)}function W_(t){return new Ny(t,0)}function H_(t){return new Ny(t,1)}var Sp=t=>()=>t;function Z_(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Yn(t,e,n){this.k=t,this.x=e,this.y=n}Yn.prototype={constructor:Yn,scale:function(t){return t===1?this:new Yn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Yn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Mp=new Yn(1,0,0);Q_.prototype=Yn.prototype;function Q_(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Mp;return t.__zoom}function Oy(t){t.stopImmediatePropagation()}function sf(t){t.preventDefault(),t.stopImmediatePropagation()}function Hj(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Zj(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function G9(){return this.__zoom||Mp}function Qj(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Jj(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kj(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function J_(){var t=Hj,e=Zj,n=Kj,r=Qj,o=Jj,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Aw,f=Hs("start","zoom","end"),l,u,p,d=500,h=150,m=0,g=10;function y(S){S.property("__zoom",G9).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",$).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,I,C,N){var D=S.selection?S.selection():S;D.property("__zoom",G9),S!==D?_(S,I,C,N):D.interrupt().each(function(){v(this,arguments).event(N).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},y.scaleBy=function(S,I,C,N){y.scaleTo(S,function(){var D=this.__zoom.k,L=typeof I=="function"?I.apply(this,arguments):I;return D*L},C,N)},y.scaleTo=function(S,I,C,N){y.transform(S,function(){var D=e.apply(this,arguments),L=this.__zoom,P=C==null?w(D):typeof C=="function"?C.apply(this,arguments):C,F=L.invert(P),q=typeof I=="function"?I.apply(this,arguments):I;return n(b(x(L,q),P,F),D,s)},C,N)},y.translateBy=function(S,I,C,N){y.transform(S,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),e.apply(this,arguments),s)},null,N)},y.translateTo=function(S,I,C,N,D){y.transform(S,function(){var L=e.apply(this,arguments),P=this.__zoom,F=N==null?w(L):typeof N=="function"?N.apply(this,arguments):N;return n(Mp.translate(F[0],F[1]).scale(P.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),L,s)},N,D)};function x(S,I){return I=Math.max(i[0],Math.min(i[1],I)),I===S.k?S:new Yn(I,S.x,S.y)}function b(S,I,C){var N=I[0]-C[0]*S.k,D=I[1]-C[1]*S.k;return N===S.x&&D===S.y?S:new Yn(S.k,N,D)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,I,C,N){S.on("start.zoom",function(){v(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(N).end()}).tween("zoom",function(){var D=this,L=arguments,P=v(D,L).event(N),F=e.apply(D,L),q=C==null?w(F):typeof C=="function"?C.apply(D,L):C,W=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),tt=D.__zoom,nt=typeof I=="function"?I.apply(D,L):I,ot=c(tt.invert(q).concat(W/tt.k),nt.invert(q).concat(W/nt.k));return function(X){if(X===1)X=nt;else{var rt=ot(X),Y=W/rt[2];X=new Yn(Y,q[0]-rt[0]*Y,q[1]-rt[1]*Y)}P.zoom(null,X)}})}function v(S,I,C){return!C&&S.__zooming||new A(S,I)}function A(S,I){this.that=S,this.args=I,this.active=0,this.sourceEvent=null,this.extent=e.apply(S,I),this.taps=0}A.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,I){return this.mouse&&S!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var I=St(this.that).datum();f.call(S,this.that,new Z_(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:f}),I)}};function E(S,...I){if(!t.apply(this,arguments))return;var C=v(this,I).event(S),N=this.__zoom,D=Math.max(i[0],Math.min(i[1],N.k*Math.pow(2,r.apply(this,arguments)))),L=He(S);if(C.wheel)(C.mouse[0][0]!==L[0]||C.mouse[0][1]!==L[1])&&(C.mouse[1]=N.invert(C.mouse[0]=L)),clearTimeout(C.wheel);else{if(N.k===D)return;C.mouse=[L,N.invert(L)],Xr(this),C.start()}sf(S),C.wheel=setTimeout(P,h),C.zoom("mouse",n(b(x(N,D),C.mouse[0],C.mouse[1]),C.extent,s));function P(){C.wheel=null,C.end()}}function T(S,...I){if(p||!t.apply(this,arguments))return;var C=S.currentTarget,N=v(this,I,!0).event(S),D=St(S.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",W,!0),L=He(S,C),P=S.clientX,F=S.clientY;tu(S.view),Oy(S),N.mouse=[L,this.__zoom.invert(L)],Xr(this),N.start();function q(tt){if(sf(tt),!N.moved){var nt=tt.clientX-P,ot=tt.clientY-F;N.moved=nt*nt+ot*ot>m}N.event(tt).zoom("mouse",n(b(N.that.__zoom,N.mouse[0]=He(tt,C),N.mouse[1]),N.extent,s))}function W(tt){D.on("mousemove.zoom mouseup.zoom",null),eu(tt.view,N.moved),sf(tt),N.event(tt).end()}}function $(S,...I){if(t.apply(this,arguments)){var C=this.__zoom,N=He(S.changedTouches?S.changedTouches[0]:S,this),D=C.invert(N),L=C.k*(S.shiftKey?.5:2),P=n(b(x(C,L),N,D),e.apply(this,I),s);sf(S),a>0?St(this).transition().duration(a).call(_,P,N,S):St(this).call(y.transform,P,N,S)}}function M(S,...I){if(t.apply(this,arguments)){var C=S.touches,N=C.length,D=v(this,I,S.changedTouches.length===N).event(S),L,P,F,q;for(Oy(S),P=0;P<N;++P)F=C[P],q=He(F,this),q=[q,this.__zoom.invert(q),F.identifier],D.touch0?!D.touch1&&D.touch0[2]!==q[2]&&(D.touch1=q,D.taps=0):(D.touch0=q,L=!0,D.taps=1+!!l);l&&(l=clearTimeout(l)),L&&(D.taps<2&&(u=q[0],l=setTimeout(function(){l=null},d)),Xr(this),D.start())}}function k(S,...I){if(this.__zooming){var C=v(this,I).event(S),N=S.changedTouches,D=N.length,L,P,F,q;for(sf(S),L=0;L<D;++L)P=N[L],F=He(P,this),C.touch0&&C.touch0[2]===P.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===P.identifier&&(C.touch1[0]=F);if(P=C.that.__zoom,C.touch1){var W=C.touch0[0],tt=C.touch0[1],nt=C.touch1[0],ot=C.touch1[1],X=(X=nt[0]-W[0])*X+(X=nt[1]-W[1])*X,rt=(rt=ot[0]-tt[0])*rt+(rt=ot[1]-tt[1])*rt;P=x(P,Math.sqrt(X/rt)),F=[(W[0]+nt[0])/2,(W[1]+nt[1])/2],q=[(tt[0]+ot[0])/2,(tt[1]+ot[1])/2]}else if(C.touch0)F=C.touch0[0],q=C.touch0[1];else return;C.zoom("touch",n(b(P,F,q),C.extent,s))}}function R(S,...I){if(this.__zooming){var C=v(this,I).event(S),N=S.changedTouches,D=N.length,L,P;for(Oy(S),p&&clearTimeout(p),p=setTimeout(function(){p=null},d),L=0;L<D;++L)P=N[L],C.touch0&&C.touch0[2]===P.identifier?delete C.touch0:C.touch1&&C.touch1[2]===P.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(P=He(P,this),Math.hypot(u[0]-P[0],u[1]-P[1])<g)){var F=St(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Sp(+S),y):r},y.filter=function(S){return arguments.length?(t=typeof S=="function"?S:Sp(!!S),y):t},y.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Sp(!!S),y):o},y.extent=function(S){return arguments.length?(e=typeof S=="function"?S:Sp([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):e},y.scaleExtent=function(S){return arguments.length?(i[0]=+S[0],i[1]=+S[1],y):[i[0],i[1]]},y.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(a=+S,y):a},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=f.on.apply(f,arguments);return S===f?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(g=+S,y):g},y}function Jt(t){return t!=null&&!Number.isNaN(t)}function ke(t,e){return+Jt(e)-+Jt(t)||gt(t,e)}function _a(t,e){return+Jt(e)-+Jt(t)||an(t,e)}function Ap(t){return t!=null&&`${t}`!=""}function af(t){return isFinite(t)?t:NaN}function bn(t){return t>0&&isFinite(t)?t:NaN}function Vi(t){return t<0&&isFinite(t)?t:NaN}function cf(t,e){if(t instanceof Date||(t=new Date(+t)),isNaN(t))return typeof e=="function"?e(t):e;let n=t.getUTCHours(),r=t.getUTCMinutes(),o=t.getUTCSeconds(),i=t.getUTCMilliseconds();return`${tX(t.getUTCFullYear(),4)}-${ri(t.getUTCMonth()+1,2)}-${ri(t.getUTCDate(),2)}${n||r||o||i?`T${ri(n,2)}:${ri(r,2)}${o||i?`:${ri(o,2)}${i?`.${ri(i,3)}`:""}`:""}Z`:""}`}function tX(t){return t<0?`-${ri(-t,6)}`:t>9999?`+${ri(t,6)}`:ri(t,4)}function ri(t,e){return`${t}`.padStart(e,"0")}var eX=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Tp(t,e){return eX.test(t+="")?new Date(t):typeof e=="function"?e(t):e}function oi(t){if(t==null)return;let e=t[0],n=t[t.length-1];return an(e,n)}var lf=1e3,Hi=lf*60,Zi=Hi*60,io=Zi*24,oo=io*7,Sa=io*30,Wi=io*365,K_=[["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",lf],["5 seconds",5*lf],["15 seconds",15*lf],["30 seconds",30*lf],["minute",Hi],["5 minutes",5*Hi],["15 minutes",15*Hi],["30 minutes",30*Hi],["hour",Zi],["3 hours",3*Zi],["6 hours",6*Zi],["12 hours",12*Zi],["day",io],["2 days",2*io],["week",oo],["2 weeks",2*oo],["month",Sa],["3 months",3*Sa],["6 months",6*Sa],["year",Wi],["2 years",2*Wi],["5 years",5*Wi],["10 years",10*Wi],["20 years",20*Wi],["50 years",50*Wi],["100 years",100*Wi]],t6=new Map([["second",lf],["minute",Hi],["hour",Zi],["day",io],["monday",oo],["tuesday",oo],["wednesday",oo],["thursday",oo],["friday",oo],["saturday",oo],["sunday",oo],["week",oo],["month",Sa],["year",Wi]]),W9=new Map([["second",$e],["minute",Ho],["hour",Qo],["day",cr],["monday",Xi],["tuesday",Q0],["wednesday",J0],["thursday",eo],["friday",K0],["saturday",tg],["sunday",Bn],["week",Bn],["month",Ko],["year",tn]]),e6=new Map([["second",$e],["minute",Zo],["hour",Jo],["day",xa],["monday",Gi],["tuesday",eg],["wednesday",ng],["thursday",no],["friday",rg],["saturday",og],["sunday",zn],["week",zn],["month",ti],["year",en]]),uf=Symbol("intervalDuration"),Ly=Symbol("intervalType");for(let[t,e]of W9)e[uf]=t6.get(t),e[Ly]="time";for(let[t,e]of e6)e[uf]=t6.get(t),e[Ly]="utc";var Ep=[["year",en,"utc"],["month",ti,"utc"],["day",xa,"utc",6*Sa],["hour",Jo,"utc",3*io],["minute",Zo,"utc",6*Zi],["second",$e,"utc",30*Hi]],Ry=[["year",tn,"time"],["month",Ko,"time"],["day",cr,"time",6*Sa],["hour",Qo,"time",3*io],["minute",Ho,"time",6*Zi],["second",$e,"time",30*Hi]],nX=[Ep[0],Ry[0],Ep[1],Ry[1],Ep[2],Ry[2],...Ep.slice(3)];function Dy(t){let e=`${t}`.toLowerCase();e.endsWith("s")&&(e=e.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(e);switch(r&&(e=e.slice(r[0].length),n=+r[1]),e){case"quarter":e="month",n*=3;break;case"half":e="month",n*=6;break}let o=e6.get(e);if(!o)throw new Error(`unknown interval: ${t}`);if(n>1&&!o.every)throw new Error(`non-periodic interval: ${e}`);return[e,n]}function Ip(t){return H9(Dy(t),"time")}function Ma(t){return H9(Dy(t),"utc")}function H9([t,e],n){let r=(n==="time"?W9:e6).get(t);return e>1&&(r=r.every(e),r[uf]=t6.get(t)*e,r[Ly]=n),r}function n6(t,e){if(!(e>1))return;let n=t[uf];if(!K_.some(([,o])=>o===n)||n%io===0&&io<n&&n<Sa)return;let[r]=K_[wr(([,o])=>Math.log(o)).center(K_,Math.log(n*e))];return(t[Ly]==="time"?Ip:Ma)(r)}function V9(t,e,n){let r=e==="time"?Zc:ro;if(n==null)return r(t==="year"?"%Y":t==="month"?"%Y-%m":t==="day"?"%Y-%m-%d":t==="hour"||t==="minute"?"%Y-%m-%dT%H:%M":t==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let o=rX(n);switch(t){case"millisecond":return ff(r(".%L"),r(":%M:%S"),o);case"second":return ff(r(":%S"),r("%-I:%M"),o);case"minute":return ff(r("%-I:%M"),r("%p"),o);case"hour":return ff(r("%-I %p"),r("%b %-d"),o);case"day":return ff(r("%-d"),r("%b"),o);case"month":return ff(r("%b"),r("%Y"),o);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function rX(t){return t==="left"||t==="right"?(e,n)=>`
|
|
1
|
+
var bq=Object.create;var cw=Object.defineProperty;var wq=Object.getOwnPropertyDescriptor;var vq=Object.getOwnPropertyNames;var _q=Object.getPrototypeOf,Sq=Object.prototype.hasOwnProperty;var S7=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pc=(t,e)=>{for(var n in e)cw(t,n,{get:e[n],enumerable:!0})},Mq=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vq(e))!Sq.call(t,o)&&o!==n&&cw(t,o,{get:()=>e[o],enumerable:!(r=wq(e,o))||r.enumerable});return t};var Aq=(t,e,n)=>(n=t!=null?bq(_q(t)):{},Mq(e||!t||!t.__esModule?cw(n,"default",{value:t,enumerable:!0}):n,t));var JD=S7((kPt,ZD)=>{"use strict";function qZ(t,e,n,r,o){for(var i=o+1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c>=0?(i=s,o=s-1):r=s+1}return i}function BZ(t,e,n,r,o){for(var i=o+1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c>0?(i=s,o=s-1):r=s+1}return i}function zZ(t,e,n,r,o){for(var i=r-1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c<0?(i=s,r=s+1):o=s-1}return i}function YZ(t,e,n,r,o){for(var i=r-1;r<=o;){var s=r+o>>>1,a=t[s],c=n!==void 0?n(a,e):a-e;c<=0?(i=s,r=s+1):o=s-1}return i}function UZ(t,e,n,r,o){for(;r<=o;){var i=r+o>>>1,s=t[i],a=n!==void 0?n(s,e):s-e;if(a===0)return i;a<=0?r=i+1:o=i-1}return-1}function Bh(t,e,n,r,o,i){return typeof n=="function"?i(t,e,n,r===void 0?0:r|0,o===void 0?t.length-1:o|0):i(t,e,void 0,n===void 0?0:n|0,r===void 0?t.length-1:r|0)}ZD.exports={ge:function(t,e,n,r,o){return Bh(t,e,n,r,o,qZ)},gt:function(t,e,n,r,o){return Bh(t,e,n,r,o,BZ)},lt:function(t,e,n,r,o){return Bh(t,e,n,r,o,zZ)},le:function(t,e,n,r,o){return Bh(t,e,n,r,o,YZ)},eq:function(t,e,n,r,o){return Bh(t,e,n,r,o,UZ)}}});var sP=S7((LPt,iP)=>{"use strict";var Zb=JD(),qu=0,Ac=1,Qb=2;iP.exports=XZ;function sM(t,e,n,r,o){this.mid=t,this.left=e,this.right=n,this.leftPoints=r,this.rightPoints=o,this.count=(e?e.count:0)+(n?n.count:0)+r.length}var zh=sM.prototype;function oM(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function eP(t,e){var n=Bu(e);t.mid=n.mid,t.left=n.left,t.right=n.right,t.leftPoints=n.leftPoints,t.rightPoints=n.rightPoints,t.count=n.count}function KD(t,e){var n=t.intervals([]);n.push(e),eP(t,n)}function tP(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?qu:(n.splice(r,1),eP(t,n),Ac)}zh.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t};zh.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?KD(this,t):this.left.insert(t):this.left=Bu([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?KD(this,t):this.right.insert(t):this.right=Bu([t]);else{var n=Zb.ge(this.leftPoints,t,aM),r=Zb.ge(this.rightPoints,t,cM);this.leftPoints.splice(n,0,t),this.rightPoints.splice(r,0,t)}};zh.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return qu;var n=this.right?this.right.count:0;if(4*n>3*(e-1))return tP(this,t);var r=this.left.remove(t);return r===Qb?(this.left=null,this.count-=1,Ac):(r===Ac&&(this.count-=1),r)}else if(t[0]>this.mid){if(!this.right)return qu;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return tP(this,t);var r=this.right.remove(t);return r===Qb?(this.right=null,this.count-=1,Ac):(r===Ac&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===t?Qb:qu;if(this.leftPoints.length===1&&this.leftPoints[0]===t){if(this.left&&this.right){for(var i=this,s=this.left;s.right;)i=s,s=s.right;if(i===this)s.right=this.right;else{var a=this.left,r=this.right;i.count-=s.count,i.right=s.left,s.left=a,s.right=r}oM(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?oM(this,this.left):oM(this,this.right);return Ac}for(var a=Zb.ge(this.leftPoints,t,aM);a<this.leftPoints.length&&this.leftPoints[a][0]===t[0];++a)if(this.leftPoints[a]===t){this.count-=1,this.leftPoints.splice(a,1);for(var r=Zb.ge(this.rightPoints,t,cM);r<this.rightPoints.length&&this.rightPoints[r][1]===t[1];++r)if(this.rightPoints[r]===t)return this.rightPoints.splice(r,1),Ac}return qu}};function nP(t,e,n){for(var r=0;r<t.length&&t[r][0]<=e;++r){var o=n(t[r]);if(o)return o}}function rP(t,e,n){for(var r=t.length-1;r>=0&&t[r][1]>=e;--r){var o=n(t[r]);if(o)return o}}function oP(t,e){for(var n=0;n<t.length;++n){var r=e(t[n]);if(r)return r}}zh.queryPoint=function(t,e){if(t<this.mid){if(this.left){var n=this.left.queryPoint(t,e);if(n)return n}return nP(this.leftPoints,t,e)}else if(t>this.mid){if(this.right){var n=this.right.queryPoint(t,e);if(n)return n}return rP(this.rightPoints,t,e)}else return oP(this.leftPoints,e)};zh.queryInterval=function(t,e,n){if(t<this.mid&&this.left){var r=this.left.queryInterval(t,e,n);if(r)return r}if(e>this.mid&&this.right){var r=this.right.queryInterval(t,e,n);if(r)return r}return e<this.mid?nP(this.leftPoints,e,n):t>this.mid?rP(this.rightPoints,t,n):oP(this.leftPoints,n)};function jZ(t,e){return t-e}function aM(t,e){var n=t[0]-e[0];return n||t[1]-e[1]}function cM(t,e){var n=t[1]-e[1];return n||t[0]-e[0]}function Bu(t){if(t.length===0)return null;for(var e=[],n=0;n<t.length;++n)e.push(t[n][0],t[n][1]);e.sort(jZ);for(var r=e[e.length>>1],o=[],i=[],s=[],n=0;n<t.length;++n){var a=t[n];a[1]<r?o.push(a):r<a[0]?i.push(a):s.push(a)}var c=s,f=s.slice();return c.sort(aM),f.sort(cM),new sM(r,Bu(o),Bu(i),c,f)}function iM(t){this.root=t}var zu=iM.prototype;zu.insert=function(t){this.root?this.root.insert(t):this.root=new sM(t[0],null,null,[t],[t])};zu.remove=function(t){if(this.root){var e=this.root.remove(t);return e===Qb&&(this.root=null),e!==qu}return!1};zu.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)};zu.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)};Object.defineProperty(zu,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(zu,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function XZ(t){return!t||t.length===0?new iM(null):new iM(Bu(t))}});var M7={};function il(t,e=!1){let n,r,o=M7;function i(f){n=t(f).catch(()=>{}).finally(()=>{if(r){let{value:u}=r;r=null,i(u)}else n=null})}function s(f){r={event:f}}function a(f){n?s(f):i(f)}function c(f){o!==f&&requestAnimationFrame(()=>{let u=o;o=M7,a(u)}),o=f}return e?c:a}var Bn=class{constructor(e){this._filterBy=e,this._requestUpdate=il(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(e){this._coordinator=e}get filterBy(){return this._filterBy}get filterStable(){return!0}fields(){return null}fieldInfo(e){return this}query(e){return null}queryPending(){return this}queryResult(e){return this}queryError(e){return this}requestQuery(e){let n=e||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var sl=Uint8Array.of(65,82,82,79,87,49),mr={V1:0,V2:1,V3:2,V4:3,V5:4};var xr={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},z={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},Fc={HALF:0,SINGLE:1,DOUBLE:2},Ko={DAY:0,MILLISECOND:1},De={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},gr={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},ti={Sparse:0,Dense:1};var qc=Uint8Array,Im=Uint16Array,Nm=Uint32Array,Cm=BigUint64Array,al=Int8Array,A7=Int16Array,zn=Int32Array,Zn=BigInt64Array,fw=Float32Array,Hi=Float64Array;function T7(t,e){let n=Math.log2(t)-3;return(e?[al,A7,zn,Zn]:[qc,Im,Nm,Cm])[n]}var rtt=Object.getPrototypeOf(Int8Array);function Bc(t,e){let n=0,r=t.length;if(r<=2147483648)do{let o=n+r>>>1;t[o]<=e?n=o+1:r=o}while(n<r);else do{let o=Math.trunc((n+r)/2);t[o]<=e?n=o+1:r=o}while(n<r);return n}function km(t,e,n){if(e(t))return t;throw new Error(n(t))}function Yn(t,e,n){return e=Array.isArray(e)?e:Object.values(e),km(t,r=>e.includes(r),n??(()=>`${t} must be one of ${e}`))}function Lm(t,e){for(let[n,r]of Object.entries(t))if(r===e)return n;return"<Unknown>"}var ei=t=>`Unsupported data type: "${Lm(z,t)}" (id ${t})`,cl=(t,e,n=!0,r=null)=>({name:t,type:e,nullable:n,metadata:r});function E7(t){return Object.hasOwn(t,"name")&&I7(t.type)}function I7(t){return typeof t?.typeId=="number"}function Qi(t,e="",n=!0){return E7(t)?t:cl(e,km(t,I7,()=>"Data type expected."),n)}var Rm=(t,e,n=!1,r=-1)=>({typeId:z.Dictionary,id:r,dictionary:t,indices:e||zc(),ordered:n});var Om=(t=32,e=!0)=>({typeId:z.Int,bitWidth:Yn(t,[8,16,32,64]),signed:e,values:T7(t,e)});var zc=()=>Om(32);var uw=(t=2)=>({typeId:z.Float,precision:Yn(t,Fc),values:[Im,fw,Hi][t]});var lw=()=>({typeId:z.Binary,offsets:zn}),$m=()=>({typeId:z.Utf8,offsets:zn});var pw=(t,e,n=128)=>({typeId:z.Decimal,precision:t,scale:e,bitWidth:Yn(n,[128,256]),values:Cm}),dw=t=>({typeId:z.Date,unit:Yn(t,Ko),values:t===Ko.DAY?zn:Zn});var hw=(t=De.MILLISECOND,e=32)=>({typeId:z.Time,unit:Yn(t,De),bitWidth:Yn(e,[32,64]),values:e===32?zn:Zn});var Dm=(t=De.MILLISECOND,e=null)=>({typeId:z.Timestamp,unit:Yn(t,De),timezone:e,values:Zn}),mw=(t=gr.MONTH_DAY_NANO)=>({typeId:z.Interval,unit:Yn(t,gr),values:t===gr.MONTH_DAY_NANO?void 0:zn}),Pm=t=>({typeId:z.List,children:[Qi(t)],offsets:zn}),Fm=t=>({typeId:z.Struct,children:Array.isArray(t)&&E7(t[0])?t:Object.entries(t).map(([e,n])=>cl(e,n))}),xw=(t,e,n,r)=>(n??=e.map((o,i)=>i),{typeId:z.Union,mode:Yn(t,ti),typeIds:n,typeMap:n.reduce((o,i,s)=>(o[i]=s,o),{}),children:e.map((o,i)=>Qi(o,`_${i}`)),typeIdForValue:r,offsets:zn}),gw=t=>({typeId:z.FixedSizeBinary,stride:t}),qm=(t,e)=>({typeId:z.FixedSizeList,stride:e,children:[Qi(t)]}),N7=(t,e)=>({typeId:z.Map,keysSorted:t,children:[e],offsets:zn});var yw=(t=De.MILLISECOND)=>({typeId:z.Duration,unit:Yn(t,De),values:Zn}),bw=()=>({typeId:z.LargeBinary,offsets:Zn}),ww=()=>({typeId:z.LargeUtf8,offsets:Zn}),vw=t=>({typeId:z.LargeList,children:[Qi(t)],offsets:Zn}),_w=(t,e)=>({typeId:z.RunEndEncoded,children:[km(Qi(t,"run_ends"),n=>n.type.typeId===z.Int,()=>"Run-ends must have an integer type."),Qi(e,"values")]});var Sw=t=>({typeId:z.ListView,children:[Qi(t,"value")],offsets:zn}),Mw=t=>({typeId:z.LargeListView,children:[Qi(t,"value")],offsets:Zn});var Tq=new Hi(2),Bm=Tq.buffer,ptt=new Zn(Bm),dtt=new Nm(Bm),htt=new zn(Bm),mtt=new qc(Bm);function io(t){if(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${t}`);return Number(t)}function zm(t,e){return Number(t/e)+Number(t%e)/Number(e)}var Yc=t=>BigInt.asUintN(64,t);function k7(t,e){let n=e<<1,r;return BigInt.asIntN(64,t[n+1])<0?(r=Yc(~t[n])|Yc(~t[n+1])<<64n,r=-(r+1n)):r=t[n]|t[n+1]<<64n,r}function L7(t,e){let n=e<<2,r;return BigInt.asIntN(64,t[n+3])<0?(r=Yc(~t[n])|Yc(~t[n+1])<<64n|Yc(~t[n+2])<<128n|Yc(~t[n+3])<<192n,r=-(r+1n)):r=t[n]|t[n+1]<<64n|t[n+2]<<128n|t[n+3]<<192n,r}var Iq=new TextDecoder("utf-8"),wtt=new TextEncoder;function Uc(t){return Iq.decode(t)}var aa=4;function Aw(t,e){return(t[e>>3]&1<<e%8)!==0}function ln(t,e){let n=e+Xt(t,e),r=n-Xt(t,n),o=Je(t,r);return(i,s,a=null)=>{if(i<o){let c=Je(t,r+i);if(c)return s(t,n+c)}return a}}function qr(t,e){return e}function Zi(t,e){return!!Nq(t,e)}function Nq(t,e){return fl(t,e)<<24>>24}function fl(t,e){return t[e]}function Je(t,e){return Cq(t,e)<<16>>16}function Cq(t,e){return t[e]|t[e+1]<<8}function Xt(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function R7(t,e){return Xt(t,e)>>>0}function Pe(t,e){return io(BigInt.asIntN(64,BigInt(R7(t,e))+(BigInt(R7(t,e+aa))<<32n)))}function ca(t,e){let n=e+Xt(t,e),r=Xt(t,n);return n+=aa,Uc(t.subarray(n,n+r))}function Jn(t,e,n,r){if(!e)return[];let o=e+Xt(t,e);return Array.from({length:Xt(t,o)},(i,s)=>r(t,o+aa+s*n))}var Tw=Symbol("rowIndex");function ul(t,e){class n{constructor(i){this[Tw]=i}toJSON(){return O7(t,e,this[Tw])}}let r=n.prototype;for(let o=0;o<t.length;++o){if(Object.hasOwn(r,t[o]))continue;let i=e[o];Object.defineProperty(r,t[o],{get(){return i.at(this[Tw])},enumerable:!0})}return o=>new n(o)}function Ym(t,e){return n=>O7(t,e,n)}function O7(t,e,n){let r={};for(let o=0;o<t.length;++o)r[t[o]]=e[o].at(n);return r}function $7(t){return t instanceof Ji}var fa=class{static ArrayType=null;constructor({length:e,nullCount:n,type:r,validity:o,values:i,offsets:s,sizes:a,children:c}){this.length=e,this.nullCount=n,this.type=r,this.validity=o,this.values=i,this.offsets=s,this.sizes=a,this.children=c,(!n||!this.validity)&&(this.at=f=>this.value(f))}get[Symbol.toStringTag](){return"Batch"}at(e){return this.isValid(e)?this.value(e):null}isValid(e){return Aw(this.validity,e)}value(e){return this.values[e]}slice(e,n){let r=n-e,o=Array(r);for(let i=0;i<r;++i)o[i]=this.at(e+i);return o}*[Symbol.iterator](){for(let e=0;e<this.length;++e)yield this.at(e)}},Ji=class extends fa{constructor(e){super(e);let{length:n,values:r}=this;this.values=r.subarray(0,n)}slice(e,n){return this.nullCount?super.slice(e,n):this.values.subarray(e,n)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},ll=class extends fa{static ArrayType=Hi},se=class extends fa{static ArrayType=Array},pl=class extends se{value(e){return null}},so=class extends ll{value(e){return io(this.values[e])}},Um=class extends ll{value(e){let n=this.values[e],r=(n&31744)>>10,o=(n&1023)/1024,i=(-1)**((n&32768)>>15);switch(r){case 31:return i*(o?Number.NaN:1/0);case 0:return i*(o?6103515625e-14*o:0)}return i*2**(r-15)*(1+o)}},jm=class extends se{value(e){return Aw(this.values,e)}},Xm=class extends fa{constructor(e){super(e);let{bitWidth:n,scale:r}=this.type;this.decimal=n===128?k7:L7,this.scale=10n**BigInt(r)}},Wm=class extends Xm{static ArrayType=Hi;value(e){return zm(this.decimal(this.values,e),this.scale)}},Vm=class extends Xm{static ArrayType=Array;value(e){return this.decimal(this.values,e)}},dl=class extends se{constructor(e){super(e),this.source=e}value(e){return new Date(this.source.value(e))}},Gm=class extends ll{value(e){return 864e5*this.values[e]}},D7=so,Hm=class extends so{value(e){return super.value(e)*1e3}},P7=so,Qm=class extends so{value(e){return zm(this.values[e],1000n)}},Zm=class extends so{value(e){return zm(this.values[e],1000000n)}},Jm=class extends se{value(e){return this.values.subarray(e<<1,e+1<<1)}},Km=class extends se{value(e){let n=this.values,r=e<<4;return Float64Array.of(Xt(n,r),Xt(n,r+4),Pe(n,r+8))}},F7=({values:t,offsets:e},n)=>t.subarray(e[n],e[n+1]),q7=({values:t,offsets:e},n)=>t.subarray(io(e[n]),io(e[n+1])),t0=class extends se{value(e){return F7(this,e)}},e0=class extends se{value(e){return q7(this,e)}},n0=class extends se{value(e){return Uc(F7(this,e))}},r0=class extends se{value(e){return Uc(q7(this,e))}},o0=class extends se{value(e){let n=this.offsets;return this.children[0].slice(n[e],n[e+1])}},i0=class extends se{value(e){let n=this.offsets;return this.children[0].slice(io(n[e]),io(n[e+1]))}},s0=class extends se{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(n,r)}},a0=class extends se{value(e){let n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(io(n),io(r))}},c0=class extends se{constructor(e){super(e),this.stride=this.type.stride}},f0=class extends c0{value(e){let{stride:n,values:r}=this;return r.subarray(e*n,(e+1)*n)}},u0=class extends c0{value(e){let{children:n,stride:r}=this;return n[0].slice(e*r,(e+1)*r)}};function B7({children:t,offsets:e},n){let[r,o]=t[0].children,i=e[n],s=e[n+1],a=[];for(let c=i;c<s;++c)a.push([r.at(c),o.at(c)]);return a}var l0=class extends se{value(e){return B7(this,e)}},p0=class extends se{value(e){return new Map(B7(this,e))}},hl=class extends se{constructor({typeIds:e,...n}){super(n),this.typeIds=e,this.typeMap=this.type.typeMap}value(e,n=e){let{typeIds:r,children:o,typeMap:i}=this;return o[i[r[e]]].at(n)}},d0=class extends hl{value(e){return super.value(e,this.offsets[e])}},ml=class extends se{constructor(e,n=Ym){super(e),this.names=this.type.children.map(r=>r.name),this.factory=n(this.names,this.children)}value(e){return this.factory(e)}},h0=class extends ml{constructor(e){super(e,ul)}},m0=class extends se{value(e){let[{values:n},r]=this.children;return r.at(Bc(n,e))}},x0=class extends se{setDictionary(e){return this.dictionary=e,this.cache=e.cache(),this}value(e){return this.cache[this.key(e)]}key(e){return this.values[e]}},g0=class extends se{constructor({data:e,...n}){super(n),this.data=e}view(e){let{values:n,data:r}=this,o=e<<4,i=o+4,s=n,a=Xt(s,o);return a>12&&(i=Xt(s,o+12),s=r[Xt(s,o+8)]),s.subarray(i,i+a)}},y0=class extends g0{value(e){return this.view(e)}},b0=class extends g0{value(e){return Uc(this.view(e))}};function Ew(t){let e=[];return{add(n){return e.push(n),this},clear:()=>e=[],done:()=>new ua(e,t)}}var ua=class{constructor(e,n=e[0]?.type){this.type=n,this.length=e.reduce((i,s)=>i+s.length,0),this.nullCount=e.reduce((i,s)=>i+s.nullCount,0),this.data=e;let r=e.length,o=new Int32Array(r+1);if(r===1){let[i]=e;o[1]=i.length,this.at=s=>i.at(s)}else for(let i=0,s=0;i<r;++i)o[i+1]=s+=e[i].length;this.offsets=o}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let e=this.data;return e.length===1?e[0][Symbol.iterator]():kq(e)}at(e){let{data:n,offsets:r}=this,o=Bc(r,e)-1;return n[o]?.at(e-r[o])}get(e){return this.at(e)}toArray(){let{length:e,nullCount:n,data:r}=this,o=!n&&$7(r[0]),i=r.length;if(o&&i===1)return r[0].values;let s=!i||n>0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new s(e);return o?Lq(a,r):Rq(a,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*kq(t){for(let e=0;e<t.length;++e){let n=t[e][Symbol.iterator]();for(let r=n.next();!r.done;r=n.next())yield r.value}}function Lq(t,e){for(let n=0,r=0;n<e.length;++n){let{values:o}=e[n];t.set(o,r),r+=o.length}return t}function Rq(t,e){let n=-1;for(let r=0;r<e.length;++r){let o=e[r];for(let i=0;i<o.length;++i)t[++n]=o.at(i)}return t}var jc=class t{constructor(e,n,r=!1){let o=e.fields.map(s=>s.name);this.schema=e,this.names=o,this.children=n,this.factory=r?ul:Ym;let i=[];this.getFactory=s=>i[s]??(i[s]=this.factory(o,n.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(e){return this.children[e]}getChild(e){let n=this.names.findIndex(r=>r===e);return n>-1?this.children[n]:void 0}selectAt(e,n=[]){let{children:r,factory:o,schema:i}=this,{fields:s}=i;return new t({...i,fields:e.map((a,c)=>Oq(s[a],n[c]))},e.map(a=>r[a]),o===ul)}select(e,n){let r=this.names,o=e.map(i=>r.indexOf(i));return this.selectAt(o,n)}toColumns(){let{children:e,names:n}=this,r={};return n.forEach((o,i)=>r[o]=e[i]?.toArray()??[]),r}toArray(){let{children:e,getFactory:n,numRows:r}=this,o=e[0]?.data??[],i=Array(r);for(let s=0,a=-1;s<o.length;++s){let c=n(s);for(let f=0;f<o[s].length;++f)i[++a]=c(f)}return i}*[Symbol.iterator](){let{children:e,getFactory:n}=this,r=e[0]?.data??[];for(let o=0;o<r.length;++o){let i=n(o);for(let s=0;s<r[o].length;++s)yield i(s)}}at(e){let{children:n,getFactory:r,numRows:o}=this;if(e<0||e>=o)return null;let[{offsets:i}]=n,s=Bc(i,e)-1;return r(s)(e-i[s])}get(e){return this.at(e)}};function Oq(t,e){return e!=null&&e!==t.name?{...t,name:e}:t}function xl(t,e={}){let{typeId:n,bitWidth:r,precision:o,unit:i}=t,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:f,useProxy:u}=e;switch(n){case z.Null:return pl;case z.Bool:return jm;case z.Int:case z.Time:case z.Duration:return s||r<64?Ji:so;case z.Float:return o?Ji:Um;case z.Date:return z7(i===Ko.DAY?Gm:D7,a&&dl);case z.Timestamp:return z7(i===De.SECOND?Hm:i===De.MILLISECOND?P7:i===De.MICROSECOND?Qm:Zm,a&&dl);case z.Decimal:return c?Vm:Wm;case z.Interval:return i===gr.DAY_TIME?Jm:i===gr.YEAR_MONTH?Ji:Km;case z.FixedSizeBinary:return f0;case z.Utf8:return n0;case z.LargeUtf8:return r0;case z.Binary:return t0;case z.LargeBinary:return e0;case z.BinaryView:return y0;case z.Utf8View:return b0;case z.List:return o0;case z.LargeList:return i0;case z.Map:return f?p0:l0;case z.ListView:return s0;case z.LargeListView:return a0;case z.FixedSizeList:return u0;case z.Struct:return u?h0:ml;case z.RunEndEncoded:return m0;case z.Dictionary:return x0;case z.Union:return t.mode?d0:hl}throw new Error(ei(n))}function z7(t,e){return e?class extends e{constructor(r){super(new t(r))}}:t}function $q(t,e){return{offset:Pe(t,e),metadataLength:Xt(t,e+8),bodyLength:Pe(t,e+16)}}function Iw(t,e){return Jn(t,e,24,$q)}function w0(t,e,n){let r=ln(t,e);if(r(10,qr,0))throw new Error("Record batch compression not implemented");let o=n<mr.V4?8:0;return{length:r(4,Pe,0),nodes:Jn(t,r(6,qr),16,(i,s)=>({length:Pe(i,s),nullCount:Pe(i,s+8)})),regions:Jn(t,r(8,qr),16+o,(i,s)=>({offset:Pe(i,s+o),length:Pe(i,s+o+8)})),variadic:Jn(t,r(12,qr),8,Pe)}}function Y7(t,e,n){let r=ln(t,e);return{id:r(4,Pe,0),data:r(6,(o,i)=>w0(o,i,n)),isDelta:r(8,Zi,!1)}}function Nw(t,e,n,r){Yn(n,z,ei);let o=ln(t,e);switch(n){case z.Binary:return lw();case z.Utf8:return $m();case z.LargeBinary:return bw();case z.LargeUtf8:return ww();case z.List:return Pm(r[0]);case z.ListView:return Sw(r[0]);case z.LargeList:return vw(r[0]);case z.LargeListView:return Mw(r[0]);case z.Struct:return Fm(r);case z.RunEndEncoded:return _w(r[0],r[1]);case z.Int:return Om(o(4,Xt,0),o(6,Zi,!1));case z.Float:return uw(o(4,Je,Fc.HALF));case z.Decimal:return pw(o(4,Xt,0),o(6,Xt,0),o(8,Xt,128));case z.Date:return dw(o(4,Je,Ko.MILLISECOND));case z.Time:return hw(o(4,Je,De.MILLISECOND),o(6,Xt,32));case z.Timestamp:return Dm(o(4,Je,De.SECOND),o(6,ca));case z.Interval:return mw(o(4,Je,gr.YEAR_MONTH));case z.Duration:return yw(o(4,Je,De.MILLISECOND));case z.FixedSizeBinary:return gw(o(4,Xt,0));case z.FixedSizeList:return qm(r[0],o(4,Xt,0));case z.Map:return N7(o(4,Zi,!1),r[0]);case z.Union:return xw(o(4,Je,ti.Sparse),r,Jn(t,o(6,qr),4,Xt))}return{typeId:n}}function gl(t,e){let n=Jn(t,e,4,(r,o)=>{let i=ln(r,o);return[i(4,ca),i(6,ca)]});return n.length?new Map(n):null}function v0(t,e,n){let r=ln(t,e);return{version:n,endianness:r(4,Je,0),fields:r(6,Dq,[]),metadata:r(8,gl)}}function Dq(t,e){return Jn(t,e,4,U7)}function U7(t,e){let n=ln(t,e),r=n(8,fl,z.NONE),o=n(10,qr,0),i=n(12,Fq),s=n(14,(c,f)=>Pq(c,f)),a=Nw(t,o,r,s);return i&&(i.dictionary=a,a=i),{name:n(4,ca),type:a,nullable:n(6,Zi,!1),metadata:n(16,gl)}}function Pq(t,e){let n=Jn(t,e,4,U7);return n.length?n:null}function Fq(t,e){if(!e)return null;let n=ln(t,e);return Rm(null,n(6,qq,zc()),n(8,Zi,!1),n(4,Pe,0))}function qq(t,e){return Nw(t,e,z.Int)}var Bq=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,zq=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`,Yq=t=>`Unsupported message type: ${t} (${Lm(xr,t)})`;function _0(t,e){let n=Xt(t,e)||0;if(e+=aa,n===-1&&(n=Xt(t,e)||0,e+=aa),n===0)return null;let r=t.subarray(e,e+=n);if(r.byteLength<n)throw new Error(Bq(n,r.byteLength));let o=ln(r,0),i=o(4,Je,mr.V1),s=o(6,fl,xr.NONE),a=o(8,qr,0),c=o(10,Pe,0),f;if(a){let u=s===xr.Schema?v0:s===xr.DictionaryBatch?Y7:s===xr.RecordBatch?w0:null;if(!u)throw new Error(Yq(s));if(f=u(r,a,i),c>0){let p=t.subarray(e,e+=c);if(p.byteLength<c)throw new Error(zq(c,p.byteLength));f.body=p}}return{version:i,type:s,index:e,content:f}}function j7(t){let e=t instanceof ArrayBuffer?new Uint8Array(t):t;return e instanceof Uint8Array&&Uq(e)?Xq(e):jq(e)}function Uq(t){if(!t||t.length<4)return!1;for(let e=0;e<6;++e)if(sl[e]!==t[e])return!1;return!0}function jq(t){let e=[t].flat(),n,r=[],o=[];for(let i of e){if(!(i instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=_0(i,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case xr.Schema:n||(n=a.content);break;case xr.RecordBatch:r.push(a.content);break;case xr.DictionaryBatch:o.push(a.content);break}}}return{schema:n,dictionaries:o,records:r,metadata:null}}function Xq(t){let e=t.byteLength-(sl.length+4),n=Xt(t,e),r=ln(t,e-n),o=r(4,Je,mr.V1),i=r(8,Iw,[]),s=r(10,Iw,[]);return{schema:r(6,(a,c)=>v0(a,c,o)),dictionaries:i.map(({offset:a})=>_0(t,a).content),records:s.map(({offset:a})=>_0(t,a).content),metadata:r(12,gl)}}function kw(t,e){return Wq(j7(t),e)}function Wq(t,e={}){let{schema:n={fields:[]},dictionaries:r,records:o}=t,{version:i,fields:s}=n,a=new Map,c=Gq(e,i,a),f=new Map;Vq(n,l=>{let d=l.type;d.typeId===z.Dictionary&&f.set(d.id,d.dictionary)});let u=new Map;for(let l of r){let{id:d,data:h,isDelta:m,body:x}=l,g=f.get(d),y=Cw(g,c({...h,body:x}));if(u.has(d)){let b=u.get(d);m||b.clear(),b.add(y)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(d,Ew(g).add(y))}}u.forEach((l,d)=>a.set(d,l.done()));let p=s.map(l=>Ew(l.type));for(let l of o){let d=c(l);s.forEach((h,m)=>p[m].add(Cw(h.type,d)))}return new jc(n,p.map(l=>l.done()),e.useProxy)}function Vq(t,e){t.fields.forEach(function n(r){e(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Gq(t,e,n){let r={version:e,options:t,dictionary:o=>n.get(o)};return o=>{let{length:i,nodes:s,regions:a,variadic:c,body:f}=o,u=-1,p=-1,l=-1;return{...r,length:i,node:()=>s[++u],buffer:d=>{let{length:h,offset:m}=a[++p];return d?new d(f.buffer,f.byteOffset+m,h/d.BYTES_PER_ELEMENT):f.subarray(m,m+h)},variadic:()=>c[++l],visit(d){return d.map(h=>Cw(h.type,this))}}}}function Cw(t,e){let{typeId:n}=t,{length:r,options:o,node:i,buffer:s,variadic:a,version:c}=e,f=xl(t,o);if(n===z.Null)return new f({length:r,nullCount:r,type:t});let u={...i(),type:t};switch(n){case z.Bool:case z.Int:case z.Time:case z.Duration:case z.Float:case z.Decimal:case z.Date:case z.Timestamp:case z.Interval:case z.FixedSizeBinary:return new f({...u,validity:s(),values:s(t.values)});case z.Utf8:case z.LargeUtf8:case z.Binary:case z.LargeBinary:return new f({...u,validity:s(),offsets:s(t.offsets),values:s()});case z.BinaryView:case z.Utf8View:return new f({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case z.List:case z.LargeList:case z.Map:return new f({...u,validity:s(),offsets:s(t.offsets),children:e.visit(t.children)});case z.ListView:case z.LargeListView:return new f({...u,validity:s(),offsets:s(t.offsets),sizes:s(t.offsets),children:e.visit(t.children)});case z.FixedSizeList:case z.Struct:return new f({...u,validity:s(),children:e.visit(t.children)});case z.RunEndEncoded:return new f({...u,children:e.visit(t.children)});case z.Dictionary:{let{id:p,indices:l}=t;return new f({...u,validity:s(),values:s(l.values)}).setDictionary(e.dictionary(p))}case z.Union:return c<mr.V5&&s(),new f({...u,typeIds:s(al),offsets:t.mode===ti.Sparse?null:s(t.offsets),children:e.visit(t.children)});default:throw new Error(ei(n))}}var Zet=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function yl(t){return kw(t,{useDate:!0})}function S0(t="ws://localhost:3000/"){let e=[],n=!1,r=null,o,i={open(){n=!0,c()},close(){for(n=!1,r=null,o=null;e.length;)e.shift().reject("Socket closed")},error(f){if(r){let{reject:u}=r;r=null,c(),u(f)}else console.error("WebSocket error: ",f)},message({data:f}){if(r){let{query:u,resolve:p,reject:l}=r;if(r=null,c(),typeof f=="string"){let d=JSON.parse(f);d.error?l(d.error):p(d)}else if(u.type==="exec")p();else if(u.type==="arrow")p(yl(f));else throw new Error(`Unexpected socket data: ${f}`)}else console.log("WebSocket message: ",f)}};function s(){o=new WebSocket(t),o.binaryType="arraybuffer";for(let f in i)o.addEventListener(f,i[f])}function a(f,u,p){o==null&&s(),e.push({query:f,resolve:u,reject:p}),n&&!r&&c()}function c(){e.length&&(r=e.shift(),o.send(JSON.stringify(r.query)))}return{get connected(){return n},query(f){return new Promise((u,p)=>a(f,u,p))}}}var Xc="COLUMN_REF",M0="COLUMN_PARAM",Z7="TABLE_REF",J7="LITERAL",K7="INTERVAL",A0="ORDER_BY",T0="CAST",E0="CASE",I0="WHEN",N0="UNARY",tI="UNARY_POSTFIX",C0="BINARY",k0="BETWEEN",L0="NOT_BETWEEN",R0="LOGICAL_OPERATOR",O0="IN",$0="FUNCTION",pa="AGGREGATE",Wc="WINDOW",D0="WINDOW_DEF",P0="WINDOW_FRAME",eI="EXPRESSION",Vc="FRAGMENT",F0="VERBATIM",Gc="PARAM",nI="WITH_CLAUSE",q0="SELECT_CLAUSE",B0="FROM_CLAUSE";var rI="SAMPLE_CLAUSE";var z0="WINDOW_CLAUSE";var Y0="SELECT_QUERY",U0="DESCRIBE_QUERY",j0="SET_OPERATION";function pn(t){return t instanceof xe}var xe=class{constructor(e){this.type=e}},vt=class extends xe{};var da=class extends vt{constructor(e){super(J7),this.value=e}toString(){return Lw(this.value)}};function Lw(t){switch(typeof t){case"number":return Number.isFinite(t)?`${t}`:"NULL";case"string":return`'${t.replace("'","''")}'`;case"boolean":return t?"TRUE":"FALSE";default:if(t==null)return"NULL";if(t instanceof Date){let e=+t;if(Number.isNaN(e))return"NULL";let n=t.getUTCFullYear(),r=t.getUTCMonth(),o=t.getUTCDate();return e===Date.UTC(n,r,o)?`DATE '${n}-${r+1}-${o}'`:`epoch_ms(${e})`}else return t instanceof RegExp?`'${t.source}'`:`${t}`}}var Br=class extends vt{constructor(e){super(Gc),this.param=e}get value(){return this.param.value}toString(){return Lw(this.value)}};function Rw(t){return t.split(".")}function zr(t){return`"${t}"`}function X0(t){return t&&gB(t)?t.slice(1,-1):t}function gB(t){return t[0]==='"'&&t[t.length-1]==='"'}function Ki(t){return t instanceof Hc}var Hc=class extends vt{constructor(e){super(Z7),this.table=[e].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(e=>zr(e)).join(".")}};var ha=class extends vt{constructor(e,n=[]){super($0),this.name=e,this.args=n}toString(){let{name:e,args:n}=this;return`${e}(${n.join(", ")})`}};function Vt(t,...e){return new ha(t,bl(e).map(Mt))}function Ot(t,...e){return new vl(t,bl(e).map(Mt))}function yr(t,...e){return new ma(new wl(t,bl(e).map(Mt)))}function Un(t,e=Mt){return t.flat().filter(n=>n!=null).map(n=>e(n))}function bl(t){let e=t.length,n=e;for(;n>0&&t[n-1]===void 0;--n);return n<e?t.slice(0,n):t}function br(t){return typeof t=="string"}function _l(t){return Array.isArray(t)}function Yr(t){return t&&typeof t.addEventListener=="function"&&t.dynamic!==!1&&"value"in t}var Ml=class extends xe{constructor(e,n){super(z0),this.name=e,this.def=n}toString(){return`${zr(this.name)} AS ${this.def}`}},ma=class t extends vt{constructor(e,n=new xa){super(Wc),this.func=e,this.def=n}over(e){return new t(this.func,this.def.over(e))}partitionby(...e){return new t(this.func,this.def.partitionby(...e))}orderby(...e){return new t(this.func,this.def.orderby(...e))}rows(e){return new t(this.func,this.def.rows(e))}range(e){return new t(this.func,this.def.range(e))}toString(){return`${this.func} OVER ${this.def}`}},wl=class extends ha{constructor(e,n){super(e,n)}},xa=class extends xe{constructor(e,n,r,o){super(D0),this.name=e,this.partition=n,this.order=r,this.frame=o}over(e){return Sl(this,{name:e})}partitionby(...e){return Sl(this,{partition:Un(e)})}orderby(...e){return Sl(this,{order:Un(e)})}rows(e){return Sl(this,{frame:new Al(e)})}range(e){return Sl(this,{frame:new Al(e,!0)})}toString(){let{name:e,partition:n,order:r,frame:o}=this,i=e&&zr(e),s=[i,n?.length&&`PARTITION BY ${n.join(", ")}`,r?.length&&`ORDER BY ${r.join(", ")}`,o].filter(a=>a);return i&&s.length<2?i:`(${s.join(" ")})`}},Al=class extends xe{constructor(e,n=!1,r=void 0){super(P0),this.extent=Yr(e)?new Br(e):e,this.range=n,this.exclude=r}toString(){let{range:e,exclude:n,extent:r}=this,o=e?"RANGE":"ROWS",[i,s]=pn(r)?r.value:r,a=oI(i,"PRECEDING"),c=oI(s,"FOLLOWING");return`${o} BETWEEN ${a} AND ${c}${n?` ${n}`:""}`}};function Sl(t,e){return new xa(e.name??t.name,e.partition??t.partition,e.order??t.order,e.frame??t.frame)}function oI(t,e){return t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} ${e}`:`UNBOUNDED ${e}`}function ts(t){return t instanceof ri}var ri=class extends vt{constructor(e,n){super(e),this.table=n}get column(){return null}toString(){let{column:e,table:n}=this,r=`${n??""}`,o=e==="*"?"*":zr(e);return(r?r+".":"")+o}},Tl=class extends ri{constructor(e,n){super(Xc,n),this.name=e}get column(){return this.name}};var El=class extends ri{constructor(e,n){super(M0,n),this.param=e}get column(){return`${this.param.value}`}};function oi(t,e){let n=ga(e);return Yr(t)?new El(new Br(t),n):new Tl(t,n)}var ya=class extends vt{constructor(e){super(F0),this.value=e}toString(){return this.value}};function Fe(t){return new da(t)}function iI(t){return new ya(t)}function W0(...t){let e=Un(t,String);return e?.length?new Hc(e):void 0}function Mt(t){return br(t)?yB(t):wa(t)}function ba(t){return br(t)?iI(t):wa(t)}function wa(t){return t instanceof vt?t:Yr(t)?new Br(t):Fe(t)}function ga(t){return br(t)?bB(t):_l(t)?W0(t):t}function yB(t){let e=Rw(t);return oi(e.pop(),W0(e))}function bB(t){return W0(Rw(t))}function Ow(){return new xa}var vl=class t extends vt{constructor(e,n,r,o){super(pa),this.name=e,this.args=n,this.isDistinct=r,this.filter=o}distinct(e=!0){return new t(this.name,this.args,e,this.filter)}where(e){return br(e)&&(e=ba(e)),new t(this.name,this.args,this.isDistinct,e)}window(){return new ma(this)}partitionby(...e){return this.window().partitionby(...e)}orderby(...e){return this.window().orderby(...e)}toString(){let{name:e,args:n,isDistinct:r,filter:o}=this,i=r?"DISTINCT ":"",s=n?.length?n.join(", "):"*",a=o?` FILTER (WHERE ${o})`:"";return`${e}(${i}${s})${a}`}},sI=["any_value","approx_count_distinct","approx_quantile","arbitrary","arg_max","arg_max_null","arg_min","arg_min_null","array_agg","avg","bit_and","bit_or","bit_xor","bitstring_agg","bool_and","bool_or","corr","count","covar_pop","covar_samp","entropy","favg","first","fsum","geomean","kurtosis_pop","kurtosis","last","mad","max","max_by","median","min","min_by","mode","product","quantile","quantile_cont","quantile_disc","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_sxx","regr_sxy","regr_syy","regr_slope","reservoir_quantile","skewness","stddev","stddev_pop","stddev_samp","string_agg","sum","variance","var_pop","var_samp"];var V0=class extends vt{constructor(e,n,r){super(e),this.expr=n,this.extent=r}toSQL(e){let{extent:n,expr:r}=this;return n?`(${r} ${e} ${n[0]} AND ${n[1]})`:""}},va=class extends V0{constructor(e,n){super(k0,e,n)}toString(){return super.toSQL("BETWEEN")}},Il=class extends V0{constructor(e,n){super(L0,e,n)}toString(){return super.toSQL("NOT BETWEEN")}};var Nl=class extends vt{constructor(e,n,r){super(C0),this.op=e,this.left=n,this.right=r}toString(){return`(${this.left} ${this.op} ${this.right})`}};var Qc=class t extends vt{constructor(e=void 0,n=[],r=void 0){super(E0),this.expr=e,this._when=n,this._else=r}when(e,n){return new t(this.expr,this._when.concat(new Zc(Mt(e),Mt(n))),this._else)}else(e){return new t(this.expr,this._when,Mt(e))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}},Zc=class extends xe{constructor(e,n){super(I0),this.when=e,this.then=n}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var Cl=class extends vt{constructor(e,n){super(T0),this.expr=e,this.cast=n}toString(){return`(${this.expr})::${this.cast}`}};var kl=class extends vt{constructor(e){super(Vc),this.spans=e}toString(){return this.spans.join("")}};var Ll=class extends xe{constructor(e,n=!1,r=void 0,o=void 0){super(rI),this.size=e,this.perc=n,this.method=r,this.seed=o}toString(){let{size:e,perc:n,method:r,seed:o}=this,i=n?"%":" ROWS",s=o!=null?`, ${o}`:"";return`${e}${i}${r?` (${r}${s})`:""}`}};var Rl=class extends xe{constructor(e,n){super(q0),this.expr=e,this.alias=n}toString(){let{expr:e,alias:n}=this;return!n||wB(e,n)?`${e}`:`${e} AS ${zr(n)}`}};function wB(t,e){return t instanceof ri&&t.table==null&&t.column===e}var Ol=class extends xe{constructor(e,n){super(nI),this.name=e,this.query=n}toString(){return`"${this.name}" AS (${this.query})`}};function G0(t){return t instanceof st}function es(t){return t instanceof Sa}function $w(t){return t instanceof $l}var st=class extends vt{static select(...e){return new Sa().select(...e)}static from(...e){return new Sa().from(...e)}static with(...e){return new Sa().with(...e)}static union(...e){return new _a("UNION",e.flat())}static unionAll(...e){return new _a("UNION ALL",e.flat())}static intersect(...e){return new _a("INTERSECT",e.flat())}static except(...e){return new _a("EXCEPT",e.flat())}static describe(e){return new $l(e)}constructor(e){super(e),this._orderby=[],this._limit=void 0,this._offset=void 0,this.cteFor=null}get subqueries(){return[]}clone(){return this}orderby(...e){return this._orderby=this._orderby.concat(Un(e)),this}limit(e){return this._limit=Number.isFinite(e)?e:void 0,this}offset(e){return this._offset=Number.isFinite(e)?e:void 0,this}},Sa=class t extends st{constructor(){super(Y0),this._with=[],this._select=[],this._from=[],this._where=[],this._sample=void 0,this._groupby=[],this._having=[],this._window=[],this._qualify=[]}get subqueries(){let e=this.cteFor||this,r=(e instanceof t?e._with:[]).reduce((i,s)=>(i[s.name]=s.query,i),{}),o=[];return this._from.forEach(({expr:i})=>{if(G0(i))o.push(i);else if(Ki(i)){let s=r[i.name];s&&o.push(s)}}),o}clone(){return Object.assign(new t,this)}with(...e){let n=[],r=(o,i)=>{let s=i.clone();s.cteFor=this,n.push(new Ol(o,s))};return e.flat().forEach(o=>{if(o!=null)for(let i in o)r(i,o[i])}),this._with=this._with.concat(n),this}select(...e){let n=[],r=(i,s)=>n.push(new Rl(i==null?i:Mt(i),X0(s)));e.flat().forEach(i=>{if(i!=null)if(br(i))r(i,i);else if(ts(i))r(i,i.column);else if(_l(i))r(i[1],i[0]);else for(let s in i)r(i[s],s)});let o=new Set(n.map(i=>i.alias));return this._select=this._select.filter(i=>!o.has(i.alias)).concat(n.filter(i=>i.expr)),this}setSelect(...e){return this._select=[],this.select(...e)}distinct(e=!0){return this._distinct=!!e,this}from(...e){let n=[],r=(o,i)=>n.push(new Dl(ga(o),X0(i)));return e.flat().forEach(o=>{if(o!=null)if(br(o))r(o,o);else if(Ki(o))r(o,o.name);else if(pn(o))r(o);else if(_l(o))r(o[1],o[0]);else for(let i in o)r(o[i],i)}),this._from=this._from.concat(n),this}setFrom(...e){return this._from=[],this.from(...e)}sample(e,n,r){let o;if(typeof e=="number"){let i=e>0&&e<1,s=i?e*100:Math.floor(e);o=new Ll(s,i,n,r)}else o=e;return this._sample=o,this}where(...e){return this._where=this._where.concat(Un(e,ba)),this}setWhere(...e){return this._where=[],this.where(...e)}groupby(...e){return this._groupby=this._groupby.concat(Un(e)),this}setGroupby(...e){return this._groupby=[],this.groupby(...e)}having(...e){return this._having=this._having.concat(Un(e,ba)),this}window(...e){let n=[];return e.flat().forEach(r=>{if(r!=null)for(let o in r)n.push(new Ml(X0(o),r[o]))}),this._window=this._window.concat(n),this}qualify(...e){return this._qualify=this._qualify.concat(Un(e,ba)),this}toString(){let{_with:e,_select:n,_distinct:r,_from:o,_sample:i,_where:s,_groupby:a,_having:c,_window:f,_qualify:u,_orderby:p,_limit:l,_offset:d}=this,h=[];if(e.length&&h.push(`WITH ${e.join(", ")}`),h.push(`SELECT${r?" DISTINCT":""} ${n.join(", ")}`),o.length&&h.push(`FROM ${o.join(", ")}`),s.length){let m=s.map(String).filter(x=>x).join(" AND ");m&&h.push(`WHERE ${m}`)}if(i&&h.push(`USING SAMPLE ${i}`),a.length&&h.push(`GROUP BY ${a.join(", ")}`),c.length){let m=c.map(String).filter(x=>x).join(" AND ");m&&h.push(`HAVING ${m}`)}if(f.length&&h.push(`WINDOW ${f.join(", ")}`),u.length){let m=u.map(String).filter(x=>x).join(" AND ");m&&h.push(`QUALIFY ${m}`)}return p.length&&h.push(`ORDER BY ${p.join(", ")}`),Number.isFinite(l)&&h.push(`LIMIT ${l}`),Number.isFinite(d)&&h.push(`OFFSET ${d}`),h.join(" ")}},$l=class t extends xe{constructor(e){super(U0),this.query=e}clone(){return new t(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}},_a=class t extends st{constructor(e,n){super(j0),this.op=e,this.queries=n}get subqueries(){let{queries:e,cteFor:n}=this;return n&&e.forEach(r=>r.cteFor=n),e}clone(){let{op:e,queries:n,...r}=this;return Object.assign(new t(e,n),r)}toString(){let{op:e,queries:n,_orderby:r,_limit:o,_offset:i}=this,s=[n.join(` ${e} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(o)&&s.push(`LIMIT ${o}`),Number.isFinite(i)&&s.push(`OFFSET ${i}`),s.join(" ")}};var Dl=class extends xe{constructor(e,n){super(B0),this.expr=e,this.alias=n}toString(){let{expr:e,alias:n}=this,r=G0(e)?`(${e})`:`${e}`;return n&&!(Ki(e)&&e.table.join(".")===n)?`${r} AS ${zr(n)}`:`${r}`}};var Pl=class extends vt{constructor(e,n){super(O0),this.expr=e,this.values=n}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}};var Fl=class extends vt{constructor(e,n=1){super(K7),this.name=e,this.steps=n}toString(){return`INTERVAL ${this.steps} ${this.name}`}};var H0=class extends vt{constructor(e,n){super(R0),this.op=e,this.clauses=n}toString(){let e=this.clauses;return e.length===0?"":e.length===1?`${e[0]}`:`(${e.join(` ${this.op} `)})`}},ql=class extends H0{constructor(e){super("AND",e)}},Bl=class extends H0{constructor(e){super("OR",e)}};var Jc=class extends vt{constructor(e,n,r){super(A0),this.expr=e,this.desc=n,this.nullsFirst=r}toString(){let{expr:e,desc:n,nullsFirst:r}=this;return`${e}${n?" DESC":n===!1?" ASC":""}${r?" NULLS FIRST":r===!1?" NULLS LAST":""}`}};var Q0=class extends vt{constructor(e,n,r){super(e),this.op=n,this.expr=r}},zl=class extends Q0{constructor(e,n){super(N0,e,n)}toString(){return`(${this.op} ${this.expr})`}},Yl=class extends Q0{constructor(e,n){super(tI,e,n)}toString(){return`(${this.expr} ${this.op})`}};function ns(t,e){return Ot("arg_max",t,e)}function rs(t,e){return Ot("arg_min",t,e)}function Dw(t){return Ot("array_agg",t)}function Ul(t){return Ot("avg",t)}function Pw(t,e){return Ot("corr",t,e)}function qe(t){return Ot("count",t)}function Fw(t,e){return Ot("covar_samp",t,e)}function qw(t,e){return Ot("covar_pop",t,e)}function Bw(t){return Ot("entropy",t)}function zw(t){return Ot("first",t)}function Yw(t){return Ot("kurtosis",t)}function Uw(t){return Ot("mad",t)}function Ke(t){return Ot("max",t)}function jw(t){return Ot("median",t)}function jn(t){return Ot("min",t)}function Xw(t){return Ot("mode",t)}function Ww(t){return Ot("last",t)}function Vw(t){return Ot("product",t)}function Gw(t,e){return Ot("quantile",t,e)}function jl(t,e){return Ot("regr_avgx",t,e)}function Hw(t,e){return Ot("regr_avgy",t,e)}function Xl(t,e){return Ot("regr_count",t,e)}function Qw(t,e){return Ot("regr_intercept",t,e)}function Zw(t,e){return Ot("regr_sxx",t,e)}function Jw(t,e){return Ot("regr_syy",t,e)}function Kw(t,e){return Ot("regr_slope",t,e)}function tv(t){return Ot("skewness",t)}function Wl(t){return Ot("stddev",t)}function ev(t){return Ot("stddev_pop",t)}function nv(t){return Ot("string_agg",t)}function Yt(t){return Ot("sum",t)}function rv(t){return Ot("var_samp",t)}function ov(t){return Ot("var_pop",t)}function ii(t,e,n){return t?new Qc(void 0,[new Zc(Mt(t),Mt(e))],Mt(n)):new Qc}function Kc(t,e){return new Cl(Mt(t),e)}function Gt(t){return Kc(t,"INTEGER")}function iv(t){return Kc(t,"FLOAT")}function pe(t){return Kc(t,"DOUBLE")}function Z0(t,e){return new Fl(t,e)}function sv(t){return Vt("epoch_ms",t)}function av(t,e,n=1){return Vt("time_bucket",Z0(e,n),t)}function cv(t){return Vt("make_date",2012,Vt("month",t),1)}function fv(t){let e=Mt(t);return Vt("make_date",2012,Vt("month",e),Vt("day",e))}function uv(t){return Vt("make_date",2012,1,Vt("day",t))}function lv(...t){return Vt("greatest",...t)}function J0(t){return Vt("exp",t)}function pv(t){return Vt("log",t)}function tf(t){return Vt("ln",t)}function Ur(t){return Vt("sign",t)}function Be(t){return Vt("abs",t)}function si(t){return Vt("sqrt",t)}function dv(t){return Vt("ceil",t)}function ze(t){return Vt("floor",t)}function ai(t,e){return Vt("round",t,e)}function vB(t,e){return new zl(t,Mt(e))}function aI(t,e){return new Yl(t,Mt(e))}function Xn(t,e,n){return new Nl(t,Mt(e),Mt(n))}function cI(t,e,n=!1){let r=n?Il:va;return new r(Mt(t),e?.map(Mt))}function dn(...t){return new ql(Un(t))}function wr(...t){return new Bl(Un(t))}function hv(t){return vB("NOT",t)}function Ma(t){return aI("IS NULL",t)}function vr(t){return aI("IS NOT NULL",t)}function Vl(t,e){return Xn("&",t,e)}function Rt(t,e){return Xn("+",t,e)}function dt(t,e){return Xn("-",t,e)}function mt(t,e){return Xn("*",t,e)}function Pt(t,e){return Xn("/",t,e)}function ve(t,e){return Xn("**",t,e)}function mv(t,e){return Xn("=",t,e)}function jr(t,e){return Xn("<>",t,e)}function ae(t,e){return Xn("<",t,e)}function _r(t,e){return Xn(">",t,e)}function Kn(t,e){return Xn("<=",t,e)}function xv(t,e){return Xn(">=",t,e)}function gv(t,e){return Xn("IS DISTINCT FROM",t,e)}function Gl(t,e){return Xn("IS NOT DISTINCT FROM",t,e)}function tn(t,e){return cI(t,e,!1)}function yv(t,e){return cI(t,e,!0)}function K0(t,e){return new Pl(Mt(t),e.map(Mt))}function bv(t,e){return new Jc(Mt(t),!1,e)}function wv(t,e){return new Jc(Mt(t),!0,e)}function Hl(t){return Vt("st_asgeojson",t)}function fI(t){return Vt("st_x",t)}function uI(t){return Vt("st_y",t)}function Ql(t){return Vt("st_centroid",t)}function vv(t){return fI(Ql(t))}function _v(t){return uI(Ql(t))}function ge(t,...e){return new kl(_B(t,e))}function _B(t,e){let n=[t[0]],r=e.length;for(let o=0,i=0;o<r;){let s=e[o];pn(s)?n[++i]=s:Yr(s)?n[++i]=new Br(s):n[i]+=br(s)?s:Fe(s);let a=t[++o];pn(n[i])?n[++i]=a:n[i]+=a}return n.filter(o=>o).map(o=>br(o)?new ya(o):o)}function tx(t,e,...n){return Vt(t,e,...bl(n).map(wa))}function Sv(t,e,n){return tx("regexp_matches",t,e,n)}function Mv(t,e){return tx("contains",t,e)}function Av(t,e){return tx("starts_with",t,e)}function Tv(t,e){return tx("ends_with",t,e)}function Ev(){return yr("row_number")}function Iv(){return yr("rank")}function Nv(){return yr("dense_rank")}function Cv(){return yr("percent_rank")}function kv(){return yr("cume_dist")}function Lv(t){return yr("ntile",t)}function Rv(t,e,n){return yr("lag",t,e,n)}function ef(t,e,n){return yr("lead",t,e,n)}function Ov(t){return yr("first_value",t)}function $v(t){return yr("last_value",t)}function Dv(t,e){return yr("nth_value",t,e)}var ex={[pa]:["args","filter"],[k0]:["expr","extent"],[C0]:["left","right"],[E0]:["expr","_when","_else"],[T0]:["expr"],[M0]:["param","table"],[Xc]:["table"],[U0]:["query"],[eI]:["node"],[Vc]:["spans"],[B0]:["expr"],[$0]:["args"],[O0]:["expr","values"],[R0]:["clauses"],[L0]:["expr","extent"],[A0]:["expr"],[Gc]:["value"],[q0]:["expr"],[Y0]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[j0]:["subqueries","_orderby"],[N0]:["expr"],[I0]:["when","then"],[Wc]:["func","def"],[z0]:["def"],[D0]:["partition","order","frame"],[P0]:["extent"]};function Zl(t,e){if(e.has(t))return e.get(t);if(pn(t)){let n=ex[t.type],r=n?.length??0;for(let o=0;o<r;++o){let i=n[o],s=t[i];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)s[c]=Zl(s[c],e)}else s&&(t[i]=Zl(s,e))}}return t}function ao(t,e){if(!pn(t))return;let n=e(t);if(n)return n;let r=ex[t.type],o=r?.length??0;for(let i=0;i<o;++i){let s=t[r[i]];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)if(s[c]&&+ao(s[c],e)<0)return n}else if(s&&+ao(s,e)<0)return-1}}var SB=new RegExp(`^(${sI.join("|")})$`),MB=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function AB(t){return t.split(MB).some(e=>e.endsWith("(")&&SB.test(e.slice(0,-1)))}function tr(t){let e=0;return ao(t,n=>{switch(n.type){case Wc:return-1;case pa:return e|=1,-1;case Vc:case F0:{let r=`${n}`.toLowerCase(),o=r.indexOf("(select ");return o>=0&&(r=r.slice(0,o)),r.includes(") over ")?-1:AB(r)?(e|=2,-1):1}}}),e}function Pv(t){let e=new Set;return ao(t,n=>{n.type===pa&&e.add(n)}),Array.from(e)}function nf(t){let e={};return ao(t,n=>{n.type===Xc&&(e[n]=n)}),Object.values(e)}function Fv(t){let e=new Set;return ao(t,n=>{n.type===Gc&&e.add(n.param)}),Array.from(e)}function co(t,e,{replace:n=!1,temp:r=!1,view:o=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(o?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+t+" AS "+e}function qv(t,{strict:e=!1}={}){return"CREATE SCHEMA "+(e?"":"IF NOT EXISTS ")+t}function Jl(t){return`INSTALL ${t}; LOAD ${t}`}function lI(t,{columns:e=Object.keys(t?.[0]||{})}={}){let n=[];if(Array.isArray(e)?(n=e,e=n.reduce((o,i)=>(o[i]=i,o),{})):e&&(n=Object.keys(e)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let o of t){let i=n.map(s=>`${wa(o[s])} AS "${e[s]}"`);r.push(`(SELECT ${i.join(", ")})`)}return r.join(" UNION ALL ")}function nx(t,e,n,r={},o={}){let{select:i=["*"],where:s,view:a,temp:c,replace:f,...u}=r,p=TB({...o,...u}),l=`${t}('${n}'${p?", "+p:""})`,d=s?` WHERE ${s}`:"",h=`SELECT ${i.join(", ")} FROM ${l}${d}`;return co(e,h,{view:a,temp:c,replace:f})}function zv(t,e,n){return nx("read_csv",t,e,n,{auto_detect:!0,sample_size:-1})}function Yv(t,e,n){return nx("read_json",t,e,n,{auto_detect:!0,format:"auto"})}function Uv(t,e,n){return nx("read_parquet",t,e,n)}function jv(t,e,n={}){let{options:r,...o}=n;if(r){let i=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(o,{open_options:i.toUpperCase()})}return nx("st_read",t,e,o)}function Xv(t,e,n={}){let{select:r=["*"],...o}=n,i=lI(e),s=r.length===1&&r[0]==="*"?i:`SELECT ${r} FROM ${i}`;return co(t,s,o)}function TB(t){return Object.entries(t).map(([e,n])=>`${e}=${Bv(n)}`).join(", ")}function Bv(t){switch(typeof t){case"boolean":return String(t);case"string":return`'${t}'`;case"undefined":case"object":return t==null?"NULL":Array.isArray(t)?"["+t.map(e=>Bv(e)).join(", ")+"]":"{"+Object.entries(t).map(([e,n])=>`'${e}': ${Bv(n)}`).join(", ")+"}";default:return t}}function Wv(t,e,n,r,o){let i=o?dt(n,pe(t)):dt(pe(t),e),s=n===e?0:r/(n-e);return s?mt(i,pe(s)):i}function Vv(t,e,n,r,o,i){return t.select({index:Rt(Gt(ze(e)),mt(Gt(ze(n)),o)),...r}).groupby("index",i)}function Gv(t,e,n){let r=n?s=>mt(s,n):s=>s,o=ze(e),i=Rt(o,1);return st.from(st.unionAll(t.clone().select({i:Gt(o),w:r(dt(i,e))}),t.clone().select({i:Gt(i),w:r(dt(e,o))}))).select({index:"i",density:Yt("w")}).groupby("index").having(jr("density",0))}function EB(t){return t}function Hv(t,e,n,r,o,i){let s=r?g=>mt(g,r):EB,a=(g,y)=>t.clone().select({xp:e,yp:n,i:g,w:y}),c=(g,y)=>Rt(g,mt(y,o)),f=Gt(ze(e)),u=Gt(ze(n)),p=Rt(f,1),l=Rt(u,1),d=dt(e,f),h=dt(p,e),m=dt(n,u),x=dt(l,n);return st.from(st.unionAll(a(c(f,u),s(mt(h,x))),a(c(f,l),s(mt(h,m))),a(c(p,u),s(mt(d,x))),a(c(p,l),s(mt(d,m))))).select({index:"i",density:Yt("w")},i).groupby("index",i).having(jr("density",0))}function Qv(t,e,n,r,o,i,s=[],a=!0){t.select({x:Gt(ze(e)),y:Gt(ze(n))});let c=s.concat(r),f=st.from(t).select(c,{x0:"x",y0:"y",dx:dt(ef("x").over("sw"),"x"),dy:dt(ef("y").over("sw"),"y")}).window({sw:Ow().partitionby(c).orderby(bv("x"))}).qualify([wr(ae("x0",o),ae(Rt("x0","dx"),o)),wr(ae("y0",i),ae(Rt("y0","dy"),i)),wr(_r("x0",0),_r(Rt("x0","dx"),0)),wr(_r("y0",0),_r(Rt("y0","dy"),0))]),u=st.select({x:lv(Ke(Be("dx")),Ke(Be("dy")))}).from("pairs"),p=st.select({i:Gt(ge`UNNEST(range((${u})))`)}),l=st.unionAll(st.select(c,{x:Rt("x0","i"),y:Rt("y0",Gt(ai(Pt(mt("i","dy"),"dx"))))}).from("pairs","indices").where([Kn(Be("dy"),Be("dx")),ae("i",Be("dx"))]),st.select(c,{x:Rt("x0",Gt(ai(Pt(mt(mt(Ur("dy"),"i"),"dx"),"dy")))),y:Rt("y0",mt(Ur("dy"),"i"))}).from("pairs","indices").where([_r(Be("dy"),Be("dx")),ae("i",Be("dy"))]),st.select(c,{x:"x0",y:"y0"}).from("pairs").where(Ma("dx"))),d=st.from("raster").select(c,"x","y",a?{w:Pt(1,qe().partitionby(["x"].concat(c)))}:null).where([Kn(0,"x"),ae("x",o),Kn(0,"y"),ae("y",i)]);return st.with({pairs:f,indices:p,raster:l,points:d}).from("points").select(s,{index:Rt("x",mt("y",Gt(o))),density:a?Yt("w"):qe()}).groupby("index",s)}function Zv(t,e,n,r,o=[]){let i=Gt(ze(e)),s=a=>st.from(t).select(a).groupby(i,o);return st.union(s([{[n]:jn(n),[r]:rs(r,n)},...o]),s([{[n]:Ke(n),[r]:ns(r,n)},...o]),s([{[n]:rs(n,r),[r]:jn(r)},...o]),s([{[n]:ns(n,r),[r]:Ke(r)},...o])).orderby(o,n)}var rx=t=>t;function pI(){return{apply:rx,invert:rx,sqlApply:Mt,sqlInvert:rx}}function IB({base:t=null}={}){if(t==null||t===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:e=>tf(e),sqlInvert:e=>J0(e)};if(t===10)return{apply:Math.log10,invert:e=>Math.pow(10,e),sqlApply:e=>pv(e),sqlInvert:e=>ve(10,e)};{let e=+t;return{apply:n=>Math.log(n)/Math.log(e),invert:n=>Math.pow(e,n),sqlApply:n=>Pt(tf(n),tf(e)),sqlInvert:n=>ve(e,n)}}}function NB({constant:t=1}={}){let e=+t;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-e),sqlApply:n=>(n=Mt(n),mt(Ur(n),tf(Rt(e,Be(n))))),sqlInvert:n=>mt(Ur(n),dt(J0(Be(n)),e))}}function CB(){return{apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*t*t,sqlApply:t=>(t=Mt(t),mt(Ur(t),si(Be(t)))),sqlInvert:t=>mt(Ur(t),ve(t,2))}}function kB({exponent:t=1}={}){let e=+t;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),e),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/e),sqlApply:n=>(n=Mt(n),mt(Ur(n),ve(Be(n),e))),sqlInvert:n=>mt(Ur(n),ve(Be(n),Pt(1,e)))}}function dI(){return{apply:t=>+t,invert:t=>new Date(t),sqlApply:t=>t instanceof Date?Fe(+t):RB(t)?Fe(+t.value):sv(t),sqlInvert:rx}}var LB={identity:pI,linear:pI,log:IB,symlog:NB,sqrt:CB,pow:kB,time:dI,utc:dI};function Kl(t){let e=LB[t.type];return e?{...t,...e(t)}:null}function RB(t){return t instanceof da&&t.value instanceof Date}function ox(t){let e=2166136261;for(let n=0,r=t.length;n<r;++n){let o=t.charCodeAt(n),i=o&65280;i&&(e=hI(e^i>>8)),e=hI(e^o&255)}return OB(e)>>>0}function hI(t){return t+(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}function OB(t){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,t&4294967295}function xI(t,e,n){switch(t.name){case"count":case"sum":return $B(e,t);case"avg":return DB(e,t);case"arg_max":return PB(e,t);case"arg_min":return FB(e,t);case"variance":case"var_samp":return ix(e,t,n);case"var_pop":return ix(e,t,n,!1);case"stddev":case"stddev_samp":return si(ix(e,t,n));case"stddev_pop":return si(ix(e,t,n,!1));case"covar_samp":return sx(e,t,n);case"covar_pop":return sx(e,t,n,!1);case"corr":return mI(e,t,n);case"regr_count":return rf(e,t).expr;case"regr_avgx":return wI(e,t);case"regr_avgy":return vI(e,t);case"regr_syy":return Kv(e,0,t,n);case"regr_sxx":return Kv(e,1,t,n);case"regr_sxy":return sx(e,t,n,null);case"regr_slope":return _I(e,t,n);case"regr_intercept":return qB(e,t,n);case"regr_r2":return ve(mI(e,t,n),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{let r=gI(t);return e[r]=t,ge`${t.name}("${r}")`}default:return null}}function gI(t){return"pre_"+ox(`${t}`).toString(16)}function Mn(t,e,n){let r=n?.filter;r&&(e=e.filter?e.where(dn(r,e.filter)):e.where(r));let o=gI(e);return t[o]=e,o}function yI(t,e){let n=Mn(t,qe(e.args[0]),e);return{expr:Yt(n),name:n}}function $B(t,e){return Yt(Mn(t,e))}function DB(t,e){let n=Mn(t,e),{expr:r,name:o}=yI(t,e);return Pt(Yt(mt(n,o)),r)}function PB(t,e){let n=Mn(t,e),r=Mn(t,Ke(e.args[1]),e);return ns(n,r)}function FB(t,e){let n=Mn(t,e),r=Mn(t,jn(e.args[1]),e);return rs(n,r)}function ix(t,e,n,r=!0){let o=e.args[0],{expr:i}=yI(t,e),s=dt(o,n(o)),a=Mn(t,Yt(ve(s,2)),e),c=Mn(t,Yt(s),e),f=r?dt(i,1):i;return Pt(dt(Yt(a),Pt(ve(Yt(c),2),i)),f)}function sx(t,e,n,r=!0){let{expr:o}=rf(t,e),i=bI(t,e,n),s=tp(t,1,e,n),a=tp(t,0,e,n),c=dt(i,Pt(mt(s,a),o));return r===null?c:r?Pt(c,dt(o,1)):Pt(c,o)}function mI(t,e,n){let{expr:r}=rf(t,e),o=bI(t,e,n),i=Jv(t,1,e,n),s=Jv(t,0,e,n),a=tp(t,1,e,n),c=tp(t,0,e,n),f=dt(i,Pt(ve(a,2),r)),u=dt(s,Pt(ve(c,2),r));return Pt(dt(o,Pt(mt(a,c),r)),si(mt(f,u)))}function rf(t,e){let[n,r]=e.args,o=Mn(t,Xl(n,r),e);return{expr:Yt(o),name:o}}function tp(t,e,n,r){let o=n.args,i=o[e],s=o[1-e],a=Yt(dt(i,r(i))).where(vr(s));return Yt(Mn(t,a,n))}function Jv(t,e,n,r){let o=n.args,i=o[e],s=o[1-e],a=Yt(ve(dt(i,r(i)),2)).where(vr(s));return Yt(Mn(t,a,n))}function bI(t,e,n){let[r,o]=e.args,i=Yt(mt(dt(o,n(o)),dt(r,n(r))));return Yt(Mn(t,i,e))}function wI(t,e){let[n,r]=e.args,{expr:o,name:i}=rf(t,e),s=Mn(t,jl(n,r),e);return Pt(Yt(mt(s,i)),o)}function vI(t,e){let[n,r]=e.args,{expr:o,name:i}=rf(t,e),s=Mn(t,Hw(n,r),e);return Pt(Yt(mt(s,i)),o)}function Kv(t,e,n,r){let{expr:o}=rf(t,n),i=tp(t,e,n,r),s=Jv(t,e,n,r);return dt(s,Pt(ve(i,2),o))}function _I(t,e,n){let r=sx(t,e,n,null),o=Kv(t,1,e,n);return Pt(r,o)}function qB(t,e,n){let r=wI(t,e),o=vI(t,e),i=_I(t,e,n);return dt(o,mt(i,r))}function SI(t){if(!t.filterStable)return null;let e=t.query();if(!es(e))return null;let n=ax(e,c=>{let f=c._from[0]?.expr;return Ki(f)?f.name:f});if(typeof n!="string")return null;let r=new Map,o={},i={},s=[],a=c=>{let f=c.column,u=ax(e,p=>p._select.find(l=>l.alias===f)?.expr);return ge`(SELECT avg(${u??c}) FROM "${n}")`};for(let{alias:c,expr:f}of e._select){if(tr(f)>1)return null;let u=Pv(f);if(u.length===0)s.push(c),o[c]=f;else{for(let p of u){if(p.isDistinct)return null;let l=xI(p,o,a);if(!l)return null;r.set(p,l)}i[c]=Zl(f,r)}}return r.size?{group:s,preagg:o,output:i}:null}function ax(t,e){let n=t.subqueries;if(es(t)&&n.length===0)return e(t);let r=ax(n[0],e);for(let o=1;o<n.length;++o){let i=ax(n[o],e);if(i!==void 0&&i!==r)return NaN}return r}var BB={skip:!0,result:null},cx=class{constructor(e,{schema:n="mosaic",enabled:r=!0}={}){this.entries=new Map,this.active=null,this.mc=e,this._schema=n,this._enabled=r}set enabled(e){this._enabled!==e&&(e||this.clear(),this._enabled=e)}get enabled(){return this._enabled}set schema(e){this._schema!==e&&(this.clear(),this._schema=e)}get schema(){return this._schema}dropSchema(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.entries.clear(),this.active=null}request(e,n,r){if(!this.enabled)return null;let{entries:o,mc:i,schema:s}=this,{source:a}=r;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=zB(r),c.source===null))return null;if(o.has(e))return o.get(e);let f=SI(e),u;if(!f)u=null;else if(n.skip(e,r))u=BB;else{let p=n.remove(a).predicate(e);u=jB(e.query(p),c,f,s),u.result=i.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,co(u.table,u.create,{temp:!1})]),u.result.catch(l=>i.logger().error(l))}return o.set(e,u),u}};function zB(t){let{source:e,meta:n}=t,r=t.predicate,o=nf(r).map(p=>p.column),i,s;if(!n||!o)return{source:null,columns:s,predicate:i};let{type:a,scales:c,bin:f,pixelSize:u=1}=n;if(a==="point")i=p=>p,s=Object.fromEntries(o.map(p=>[`${p}`,Mt(p)]));else if(a==="interval"&&c){let p=c.map(l=>UB(l,u,f));p.some(l=>!l)||(p.length===1?(i=l=>l?tn("active0",l.extent.map(p[0])):[],s={active0:p[0](r.expr)}):(i=l=>l?dn(l.clauses.map((d,h)=>tn(`active${h}`,d.extent.map(p[h])))):[],s=Object.fromEntries(r.clauses.map((l,d)=>[`active${d}`,p[d](l.expr)]))))}return{source:s?e:null,columns:s,predicate:i}}var YB={ceil:dv,round:ai};function UB(t,e,n){let{type:r,domain:o,range:i,apply:s,sqlApply:a}=Kl(t);if(!s)return;let c=YB[`${n}`.toLowerCase()]||ze,f=s(Math.min(...o)),u=s(Math.max(...o)),p=(r==="identity"?1:Math.abs(i[1]-i[0])/(u-f))/e,l=p===1?h=>h:h=>mt(pe(p),h),d=f===0?h=>h:h=>dt(h,pe(f));return h=>Gt(c(l(d(a(h)))))}function jB(t,e,n,r){let{group:o,output:i,preagg:s}=n,{columns:a}=e,c=t.setSelect({...s,...a}).groupby(Object.keys(a)),[f]=c.subqueries;if(f){let x=Object.values(a).flatMap(g=>nf(g).map(y=>y.column));XB(f,x)}let u=c._having,p=c._orderby;c._having=[],c._orderby=[];let l=c.toString(),d=(ox(l)>>>0).toString(16),h=`${r}.preagg_${d}`,m=st.select(o,i).from(h).groupby(o).having(u).orderby(p);return new t_({table:h,create:l,active:e,select:m})}function XB(t,e){let n=new Set,r=o=>{n.has(o)||(n.add(o),es(o)&&o._from.length&&o.select(e),o.subqueries.forEach(r))};r(t)}var t_=class{constructor({table:e,create:n,active:r,select:o}){this.table=e,this.create=n,this.result=null,this.active=r,this.select=o,this.skip=!1}query(e){return this.select.clone().where(this.active.predicate(e))}};function e_(t){switch(t){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(t.startsWith("DECIMAL"))return"number";if(t.startsWith("STRUCT")||t.startsWith("MAP"))return"object";if(t.endsWith("]"))return"array";throw new Error(`Unsupported type: ${t}`)}}var WB="count",VB="nulls",GB="max",HB="min",QB="distinct";var ZB={[WB]:qe,[QB]:t=>qe(t).distinct(),[GB]:Ke,[HB]:jn,[VB]:t=>qe().where(Ma(t))};function JB(t,e,n){return st.from(t).select(Array.from(n,r=>({[r]:ZB[r](e)})))}async function MI(t,e){return e.length===1&&e[0].column==="*"?tz(t,e[0].table):(await Promise.all(e.map(n=>KB(t,n)))).filter(n=>n)}async function KB(t,{table:e,column:n,stats:r}){let o=st.from({source:e}).select({column:n}).groupby(n.aggregate?ge`ALL`:[]),[i]=Array.from(await t.query(st.describe(o))),s={table:e,column:`${n}`,sqlType:i.column_type,type:e_(i.column_type),nullable:i.null==="YES"};if(!(r?.length||r?.size))return s;let[a]=await t.query(JB(e,n,r),{persist:!0});return Object.assign(s,a)}async function tz(t,e){let n=await t.query(`DESCRIBE ${ga(e)}`);return Array.from(n).map(r=>({table:e,column:r.column_name,sqlType:r.column_type,type:e_(r.column_type),nullable:r.null==="YES"}))}var os=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")}),Aa=class extends Promise{constructor(){let e,n;super((r,o)=>{e=r,n=o}),this._resolve=e,this._reject=n,this._state=os.pending,this._value=void 0}fulfill(e){if(this._value!==void 0){if(e!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(e===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(e)}return this._state=os.done,this}ready(e){return this._state=os.ready,this._value=e,this}reject(e){return this._state=os.error,this._reject(e),this}get state(){return this._state}};Aa.prototype.constructor=Promise;function fx(){return{debug(...t){},info(...t){},log(...t){},warn(...t){},error(...t){}}}function ez(t){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(t)}function AI(t,e){let n=[],r=0;function o(){let i=nz(n,e);n=[],r=0;for(let s of i)oz(s,t),az(s,e)}return{add(i,s){i.request.type==="arrow"?(r=r||ez(()=>o()),n.push({entry:i,priority:s,index:n.length})):t(i,s)}}}function nz(t,e){let n=[],r=new Map;for(let o of t){let{entry:{request:i}}=o,s=rz(i.query,e);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(o)}return n}function rz(t,e){let n=`${t}`;if(es(t)&&!e.get(n)){if(t._orderby.length||t._where.length||t._qualify.length||t._having.length)return n;let r=t.clone().setSelect("*"),o=t._groupby;if(o.length){let i={};t._select.forEach(({alias:s,expr:a})=>i[s]=a),r.setGroupby(o.map(s=>ts(s)&&i[s.column]||s))}else t._select.some(i=>tr(i.expr))&&r.setGroupby("ALL");return`${r}`}else return n}function oz(t,e){if(iz(t))e({request:{type:"arrow",cache:!1,query:t.query=sz(t)},result:t.result=new Aa});else for(let{entry:n,priority:r}of t)e(n,r)}function iz(t){if(t.length>1){let e=`${t[0].entry.request.query}`;for(let n=1;n<t.length;++n)if(e!==`${t[n].entry.request.query}`)return!0}return!1}function sz(t){let e=t.maps=[],n=new Map;for(let i of t){let{query:s}=i.entry.request,a=[];e.push(a);for(let{alias:c,expr:f}of s._select){let u=`${f}`;n.has(u)||n.set(u,[`col${n.size}`,f]);let[p]=n.get(u);a.push([p,c])}}let r=t[0].entry.request.query.clone(),o=r._groupby;if(o.length){let i={};t.maps[0].forEach(([s,a])=>i[a]=s),r.setGroupby(o.map(s=>ts(s)&&i[s.column]||s))}return r.setSelect(Array.from(n.values()))}async function az(t,e){let{maps:n,query:r,result:o}=t;if(!n)return;let i;try{i=await o}catch(a){for(let{entry:c}of t)c.result.reject(a);return}let s=$w(r);t.forEach(({entry:a},c)=>{let{request:f,result:u}=a,p=n[c],l=s&&p?fz(i,p):p?cz(i,p):i;f.cache&&e.set(String(f.query),l),u.fulfill(l)})}function cz(t,e){return t.select(e.map(n=>n[0]),e.map(n=>n[1]))}function fz(t,e){let n=new Map(e),r=[];for(let o of t)n.has(o.column_name)&&r.push({...o,column_name:n.get(o.column_name)});return r}var uz=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,TI=()=>({get:()=>{},set:(t,e)=>e,clear:()=>{}});function EI({max:t=1e3,ttl:e=3*60*60*1e3}={}){let n=new Map;function r(){let o=performance.now()-e,i=null,s=1/0;for(let[a,c]of n){let{last:f}=c;f<s&&(i=a,s=f),o>f&&n.delete(a)}i&&n.delete(i)}return{get(o){let i=n.get(o);if(i)return i.last=performance.now(),i.value},set(o,i){return n.set(o,{last:performance.now(),value:i}),n.size>t&&uz(r),i},clear(){n=new Map}}}var ux=class{constructor(e){this.queue=Array.from({length:e},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(e=>!e.head)}insert(e,n){let r=this.queue[n];if(!r)throw new Error(`Invalid queue priority rank: ${n}`);let o={item:e,next:null};r.head===null?r.head=r.tail=o:r.tail=r.tail.next=o}remove(e){for(let n of this.queue){let{head:r,tail:o}=n;for(let i=null,s=r;s;i=s,s=s.next)e(s.item)&&(s===r?r=s.next:i.next=s.next,s===o&&(o=i||r));n.head=r,n.tail=o}}next(){for(let e of this.queue){let{head:n}=e;if(n!==null)return e.head=n.next,e.tail===n&&(e.tail=null),n.item}}};var fo=Object.freeze({High:0,Normal:1,Low:2}),lx=class{constructor(e=32){this.queue=new ux(3),this.db=null,this.clientCache=null,this._logger=fx(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=e,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;let{request:e,result:n}=this.queue.next();this.pendingResults.push(n),e.type==="exec"&&(this.pendingExec=!0),this.submit(e,n).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==os.pending;){let r=this.pendingResults.shift();r.state===os.ready?r.fulfill():r.state===os.done&&this._logger.warn("Found resolved query in pending results.")}e.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(e,n=fo.Normal){this.queue.insert(e,n),this.next()}async submit(e,n){try{let{query:r,type:o,cache:i=!1,options:s}=e,a=r?`${r}`:null;if(i){let p=this.clientCache.get(a);if(p){let l=await p;this._logger.debug("Cache"),n.ready(l);return}}let c=performance.now();this._logQueries&&this._logger.debug("Query",{type:o,sql:a,...s});let f=this.db.query({type:o,sql:a,...s});i&&this.clientCache.set(a,f);let u=await f;i&&this.clientCache.set(a,u),this._logger.debug(`Request: ${(performance.now()-c).toFixed(1)}`),n.ready(o==="exec"?null:u)}catch(r){n.reject(r)}}cache(e){return e!==void 0?this.clientCache=e===!0?EI():e||TI():this.clientCache}logger(e){return e?this._logger=e:this._logger}logQueries(e){return e!==void 0?this._logQueries=!!e:this._logQueries}connector(e){return e?this.db=e:this.db}consolidate(e){e&&!this._consolidate?this._consolidate=AI(this.enqueue.bind(this),this.clientCache):!e&&this._consolidate&&(this._consolidate=null)}request(e,n=fo.Normal){let r=new Aa,o={request:e,result:r};return this._consolidate?this._consolidate.add(o,n):this.enqueue(o,n),r}cancel(e){let n=new Set(e);if(n.size){this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1);for(let r of this.pendingResults)n.has(r)&&r.reject("Canceled")}}clear(){this.queue.remove(({result:e})=>(e.reject("Cleared"),!0));for(let e of this.pendingResults)e.reject("Cleared");this.pendingResults=[]}};var px;function Sr(t){return t?px=t:px==null&&(px=new ep),px}var ep=class{constructor(e=S0(),{logger:n=console,manager:r=new lx,cache:o=!0,consolidate:i=!0,preagg:s={}}={}){this.manager=r,this.manager.cache(o),this.manager.consolidate(i),this.databaseConnector(e),this.logger(n),this.clear(),this.preaggregator=new cx(this,s)}clear({clients:e=!0,cache:n=!0}={}){this.manager.clear(),e&&(this.filterGroups?.forEach(r=>r.disconnect()),this.filterGroups=new Map,this.clients?.forEach(r=>this.disconnect(r)),this.clients=new Set),n&&this.manager.cache().clear()}databaseConnector(e){return this.manager.connector(e)}logger(e){return arguments.length&&(this._logger=e||fx(),this.manager.logger(this._logger)),this._logger}cancel(e){this.manager.cancel(e)}exec(e,{priority:n=fo.Normal}={}){return e=Array.isArray(e)?e.filter(r=>r).join(`;
|
|
2
|
+
`):e,this.manager.request({type:"exec",query:e},n)}query(e,{type:n="arrow",cache:r=!0,priority:o=fo.Normal,...i}={}){return this.manager.request({type:n,query:e,cache:r,options:i},o)}prefetch(e,n={}){return this.query(e,{...n,cache:!0,priority:fo.Low})}createBundle(e,n,r=fo.Low){let o={name:e,queries:n.map(i=>typeof i=="string"?{sql:i}:i)};return this.manager.request({type:"create-bundle",options:o},r)}loadBundle(e,n=fo.High){let r={name:e};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(e,n,r=fo.Normal){return e.queryPending(),this.query(n,{priority:r}).then(o=>e.queryResult(o).update(),o=>{this._logger.error(o),e.queryError(o)}).catch(o=>this._logger.error(o))}requestQuery(e,n){return this.preaggregator.clear(),n?this.updateClient(e,n):Promise.resolve(e.update())}async connect(e){let{clients:n}=this;if(n.has(e))throw new Error("Client already connected.");n.add(e),e.coordinator=this,this.initializeClient(e),lz(this,e.filterBy,e)}async initializeClient(e){let n=e.fields();return n?.length&&e.fieldInfo(await MI(this,n)),e.requestQuery()}disconnect(e){let{clients:n,filterGroups:r}=this;if(!n.has(e))return;n.delete(e),e.coordinator=null;let o=r.get(e.filterBy);o&&o.clients.delete(e)}};function lz(t,e,n){if(!e)return;let r=t.filterGroups.get(e);if(!r){let o=s=>pz(t,e,s),i=()=>dz(t,e);e.addEventListener("activate",o),e.addEventListener("value",i),r={selection:e,clients:new Set,disconnect(){e.removeEventListener("activate",o),e.removeEventListener("value",i)}},t.filterGroups.set(e,r)}r.clients.add(n)}function pz(t,e,n){let{preaggregator:r,filterGroups:o}=t,{clients:i}=o.get(e);for(let s of i)r.request(s,e,n)}function dz(t,e){let{preaggregator:n,filterGroups:r}=t,{clients:o}=r.get(e),{active:i}=e;return Promise.allSettled(Array.from(o,s=>{let a=n.request(s,e,i),c=a?null:e.predicate(s);if(a?.skip||!a&&!c)return;let f=a?.query(i.predicate)??s.query(c);return t.updateClient(s,f)}))}var dx=class{constructor(){this._callbacks=new Map}addEventListener(e,n){this._callbacks.has(e)||this._callbacks.set(e,{callbacks:new Set,pending:null,queue:new n_}),this._callbacks.get(e).callbacks.add(n)}removeEventListener(e,n){let r=this._callbacks.get(e);r&&r.callbacks.delete(n)}willEmit(e,n){return n}emitQueueFilter(e,n){return null}cancel(e){this._callbacks.get(e)?.queue.clear()}async pending(e){await this._callbacks.get(e)?.pending}emit(e,n){let r=this._callbacks.get(e)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(e,n));else{let o=this.willEmit(e,n),{callbacks:i,queue:s}=r;if(i?.size){let a=Array.from(i,c=>c(o));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(e,s.dequeue())})}}}},n_=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(e,n){let r={value:e};if(n&&this.next){let o=this;for(;o.next;)n(o.next.value)?o=o.next:o.next=o.next.next;o.next=r}else this.next=r}dequeue(){let{next:e}=this;return this.next=e?.next,e?.value}};function np(t,e){return t===e?!1:t instanceof Date&&e instanceof Date?+t!=+e:Array.isArray(t)&&Array.isArray(e)?hz(t,e):!0}function hz(t,e){if(t.length!==e.length)return!0;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!0;return!1}function _e(t){return t instanceof is}var is=class t extends dx{constructor(e){super(),this._value=e}static value(e){return new t(e)}static array(e){if(e.some(n=>_e(n))){let n=new t,r=()=>{n.update(e.map(o=>_e(o)?o.value:o))};return r(),e.forEach(o=>_e(o)?o.addEventListener("value",r):0),n}return new t(e)}get value(){return this._value}update(e,{force:n}={}){return np(this._value,e)||n?this.emit("value",e):this.cancel("value"),this}willEmit(e,n){return e==="value"&&(this._value=n),n}};function er(t){return t instanceof uo}function hx(t,e){return new uo(new mx(t),e&&[e].flat())}var uo=class t extends is{static intersect({cross:e=!1,empty:n=!1,include:r=[]}={}){return hx({cross:e,empty:n},r)}static union({cross:e=!1,empty:n=!1,include:r=[]}={}){return hx({cross:e,empty:n,union:!0},r)}static single({cross:e=!1,empty:n=!1,include:r=[]}={}){return hx({cross:e,empty:n,single:!0},r)}static crossfilter({empty:e=!1,include:n=[]}={}){return hx({cross:!0,empty:e},n)}constructor(e=new mx,n=[]){if(super([]),this._resolved=this._value,this._resolver=e,this._relay=new Set,Array.isArray(n))for(let r of n)r._relay.add(this)}clone(){let e=new t(this._resolver);return e._value=e._resolved=this._value,e}remove(e){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:e}),n._value.active={source:e},n}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(e){return this.clauses.find(n=>n.source===e)?.value}activate(e){this.emit("activate",e),this._relay.forEach(n=>n.activate(e))}update(e){return this._resolved=this._resolver.resolve(this._resolved,e,!0),this._resolved.active=e,this._relay.forEach(n=>n.update(e)),super.update(this._resolved)}willEmit(e,n){return e==="value"?(this._value=n,this.value):n}emitQueueFilter(e,n){return e==="value"?this._resolver.queueFilter(n):null}skip(e,n){return this._resolver.skip(e,n)}predicate(e,n=!1){let{clauses:r}=this,o=n?null:r.active;return this._resolver.predicate(r,o,e)}},mx=class{constructor({union:e,cross:n,single:r,empty:o}={}){this.union=!!e,this.cross=!!n,this.single=!!r,this.empty=!!o}resolve(e,n,r=!1){let{source:o,predicate:i}=n,s=e.filter(c=>o!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),i&&a.push(n),a}skip(e,n){return this.cross&&n?.clients?.has(e)}predicate(e,n,r){let{empty:o,union:i}=this;if(o&&!e.length)return[Fe(!1)];if(this.skip(r,n))return;let s=e.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return i&&s.length>1?wr(s):s}queueFilter(e){if(this.cross){let n=e.active?.source;return r=>r.active?.source!==n}return null}};function ss(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=e!==void 0?K0(t,[Fe(e)]):null;return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function ci(t,e,{source:n,clients:r=n?new Set([n]):void 0}){let o=null;if(e){let i=e.length&&t.length===1?[K0(t[0],e.map(s=>Fe(s[0])))]:e.map(s=>dn(s.map((a,c)=>Gl(t[c],Fe(a)))));o=e.length===0?Fe(!1):i.length>1?wr(i):i[0]}return{meta:{type:"point"},source:n,clients:r,value:e,predicate:o}}function Ta(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scale:i,pixelSize:s=1}){let a=e!=null?tn(t,e):null;return{meta:{type:"interval",scales:i&&[i],bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}function r_(t,e,{source:n,clients:r=n?new Set([n]):void 0,bin:o,scales:i=[],pixelSize:s=1}){let a=e!=null?dn(t.map((f,u)=>tn(f,e[u]))):null;return{meta:{type:"interval",scales:i,bin:o,pixelSize:s},source:n,clients:r,value:e,predicate:a}}var mz={contains:Mv,prefix:Av,suffix:Tv,regexp:Sv};function o_(t,e,{source:n,clients:r=void 0,method:o="contains"}){let i=mz[o],s=e?i(t,Fe(e)):null;return{meta:{type:"match",method:o},source:n,clients:r,value:e,predicate:s}}function i_(t){return typeof t?.getChild=="function"}function s_(){let t=new Set,e,n=new Promise(r=>e=r);return{pending(r){t.add(r)},ready(r){return t.delete(r),t.size===0},resolve(){n=new Promise(r=>{e(),e=r})},get promise(){return n}}}function Wn(t){return i_(t)?xz(t):gz(t)}function xz(t){let{numRows:e}=t;return{numRows:e,columns:t.toColumns()}}function gz(t){let e=t.length;if(typeof t[0]=="object"){let n=e?Object.keys(t[0]):[],r={};return n.length>0&&n.forEach(o=>{r[o]=t.map(i=>i[o])}),{numRows:e,columns:r}}else return{numRows:e,values:t}}var f7={};Pc(f7,{Fixed:()=>lo,Param:()=>is,Query:()=>st,Selection:()=>uo,align:()=>YM,and:()=>dn,area:()=>CT,areaX:()=>kT,areaY:()=>LT,argmax:()=>ns,argmin:()=>rs,ariaDescription:()=>QM,ariaLabel:()=>HM,arrayAgg:()=>Dw,arrow:()=>AE,aspectRatio:()=>UM,avg:()=>Ul,axis:()=>jM,axisFx:()=>CE,axisFy:()=>kE,axisX:()=>IE,axisY:()=>NE,barX:()=>DT,barY:()=>PT,bin:()=>MM,cast:()=>Kc,cell:()=>FT,cellX:()=>qT,cellY:()=>BT,centroid:()=>Ql,centroidX:()=>vv,centroidY:()=>_v,circle:()=>VT,clip:()=>VM,colorBase:()=>R8,colorClamp:()=>v8,colorConstant:()=>$8,colorDomain:()=>b8,colorExponent:()=>O8,colorInterpolate:()=>A8,colorLabel:()=>I8,colorLegend:()=>s7,colorN:()=>_8,colorNice:()=>S8,colorPercent:()=>N8,colorPivot:()=>T8,colorRange:()=>w8,colorReverse:()=>C8,colorScale:()=>y8,colorScheme:()=>M8,colorSymmetric:()=>E8,colorTickFormat:()=>L8,colorZero:()=>k8,column:()=>oi,contour:()=>lE,coordinator:()=>Sr,corr:()=>Pw,count:()=>qe,covarPop:()=>qw,covariance:()=>Fw,createSchema:()=>qv,createTable:()=>co,cume_dist:()=>kv,dateDay:()=>uv,dateMonth:()=>cv,dateMonthDay:()=>fv,delaunayLink:()=>_E,delaunayMesh:()=>SE,denseLine:()=>uE,dense_rank:()=>Nv,density:()=>fE,densityX:()=>aE,densityY:()=>cE,dot:()=>jT,dotX:()=>XT,dotY:()=>WT,entropy:()=>Bw,eq:()=>mv,errorbarX:()=>yE,errorbarY:()=>bE,facetGrid:()=>yA,facetLabel:()=>bA,facetMargin:()=>dA,facetMarginBottom:()=>mA,facetMarginLeft:()=>xA,facetMarginRight:()=>gA,facetMarginTop:()=>hA,first:()=>zw,first_value:()=>Ov,float32:()=>iv,float64:()=>pe,frame:()=>EE,from:()=>AF,fxAlign:()=>TA,fxAriaDescription:()=>jA,fxAriaLabel:()=>UA,fxAxis:()=>CA,fxDomain:()=>wA,fxFontVariant:()=>YA,fxGrid:()=>PA,fxInset:()=>_A,fxInsetLeft:()=>SA,fxInsetRight:()=>MA,fxLabel:()=>qA,fxLabelAnchor:()=>BA,fxLabelOffset:()=>zA,fxLine:()=>FA,fxPadding:()=>EA,fxPaddingInner:()=>IA,fxPaddingOuter:()=>NA,fxRange:()=>vA,fxReverse:()=>XA,fxRound:()=>AA,fxTickFormat:()=>$A,fxTickPadding:()=>OA,fxTickRotate:()=>DA,fxTickSize:()=>LA,fxTickSpacing:()=>RA,fxTicks:()=>kA,fyAlign:()=>JA,fyAriaDescription:()=>x8,fyAriaLabel:()=>m8,fyAxis:()=>n8,fyDomain:()=>WA,fyFontVariant:()=>h8,fyGrid:()=>f8,fyInset:()=>GA,fyInsetBottom:()=>QA,fyInsetTop:()=>HA,fyLabel:()=>l8,fyLabelAnchor:()=>p8,fyLabelOffset:()=>d8,fyLine:()=>u8,fyPadding:()=>KA,fyPaddingInner:()=>t8,fyPaddingOuter:()=>e8,fyRange:()=>VA,fyReverse:()=>g8,fyRound:()=>ZA,fyTickFormat:()=>a8,fyTickPadding:()=>s8,fyTickRotate:()=>c8,fyTickSize:()=>o8,fyTickSpacing:()=>i8,fyTicks:()=>r8,geo:()=>DE,geojson:()=>Hl,graticule:()=>FE,grid:()=>WM,gridFx:()=>OE,gridFy:()=>$E,gridX:()=>LE,gridY:()=>RE,gt:()=>_r,gte:()=>xv,hconcat:()=>bF,heatmap:()=>pE,height:()=>PM,hexagon:()=>GT,hexbin:()=>mE,hexgrid:()=>xE,highlight:()=>zE,hspace:()=>_F,hull:()=>ME,image:()=>sE,inset:()=>XM,int32:()=>Gt,intervalX:()=>YE,intervalXY:()=>jE,intervalY:()=>UE,isBetween:()=>tn,isDistinct:()=>gv,isNotBetween:()=>yv,isNotDistinct:()=>Gl,isNotNull:()=>vr,isNull:()=>Ma,kurtosis:()=>Yw,lag:()=>Rv,last:()=>Ww,last_value:()=>$v,lead:()=>ef,lengthBase:()=>xT,lengthClamp:()=>pT,lengthConstant:()=>yT,lengthDomain:()=>uT,lengthExponent:()=>gT,lengthNice:()=>dT,lengthPercent:()=>hT,lengthRange:()=>lT,lengthScale:()=>fT,lengthZero:()=>mT,line:()=>RT,lineX:()=>OT,lineY:()=>$T,link:()=>TE,literal:()=>Fe,loadCSV:()=>zv,loadExtension:()=>Jl,loadJSON:()=>Yv,loadObjects:()=>Xv,loadParquet:()=>Uv,loadSpatial:()=>jv,lt:()=>ae,lte:()=>Kn,mad:()=>Uw,margin:()=>RM,marginBottom:()=>zM,marginLeft:()=>FM,marginRight:()=>qM,marginTop:()=>BM,margins:()=>LM,max:()=>Ke,median:()=>jw,menu:()=>dF,min:()=>jn,mode:()=>Xw,name:()=>CM,nearest:()=>XE,nearestX:()=>WE,nearestY:()=>VE,neq:()=>jr,not:()=>hv,nth_value:()=>Dv,ntile:()=>Lv,opacityBase:()=>W8,opacityClamp:()=>q8,opacityConstant:()=>G8,opacityDomain:()=>P8,opacityExponent:()=>V8,opacityLabel:()=>z8,opacityLegend:()=>a7,opacityNice:()=>B8,opacityPercent:()=>Y8,opacityRange:()=>F8,opacityReverse:()=>U8,opacityScale:()=>D8,opacityTickFormat:()=>X8,opacityZero:()=>j8,or:()=>wr,padding:()=>GM,pan:()=>KE,panX:()=>t7,panY:()=>e7,panZoom:()=>n7,panZoomX:()=>r7,panZoomY:()=>o7,percent_rank:()=>Cv,plot:()=>TF,product:()=>Vw,projectionClip:()=>NT,projectionDomain:()=>ST,projectionInset:()=>MT,projectionInsetBottom:()=>IT,projectionInsetLeft:()=>AT,projectionInsetRight:()=>TT,projectionInsetTop:()=>ET,projectionParallels:()=>wT,projectionPrecision:()=>vT,projectionRotate:()=>_T,projectionType:()=>bT,quantile:()=>Gw,rBase:()=>sT,rClamp:()=>eT,rConstant:()=>cT,rDomain:()=>K8,rExponent:()=>aT,rLabel:()=>rT,rNice:()=>nT,rPercent:()=>oT,rRange:()=>tT,rScale:()=>J8,rZero:()=>iT,rank:()=>Iv,raster:()=>dE,rasterTile:()=>hE,rect:()=>zT,rectX:()=>YT,rectY:()=>UT,region:()=>GE,regressionY:()=>gE,row_number:()=>Ev,ruleX:()=>JT,ruleY:()=>KT,search:()=>hF,skewness:()=>tv,slider:()=>mF,sphere:()=>PE,spike:()=>iE,sql:()=>ge,stddev:()=>Wl,stddevPop:()=>ev,stringAgg:()=>nv,style:()=>$M,sum:()=>Yt,symbolDomain:()=>Q8,symbolLegend:()=>c7,symbolRange:()=>Z8,symbolScale:()=>H8,table:()=>xF,text:()=>HT,textX:()=>QT,textY:()=>ZT,tickX:()=>tE,tickY:()=>eE,toggle:()=>Cc,toggleColor:()=>JE,toggleX:()=>HE,toggleY:()=>QE,toggleZ:()=>ZE,varPop:()=>ov,variance:()=>rv,vconcat:()=>yF,vector:()=>nE,vectorX:()=>rE,vectorY:()=>oE,voronoi:()=>wE,voronoiMesh:()=>vE,vspace:()=>vF,waffleX:()=>qE,waffleY:()=>BE,width:()=>DM,xAlign:()=>s5,xAriaDescription:()=>A5,xAriaLabel:()=>M5,xAxis:()=>u5,xBase:()=>N5,xClamp:()=>o5,xConstant:()=>k5,xDomain:()=>JM,xExponent:()=>C5,xFontVariant:()=>S5,xGrid:()=>g5,xInset:()=>e5,xInsetLeft:()=>n5,xInsetRight:()=>r5,xLabel:()=>b5,xLabelAnchor:()=>w5,xLabelArrow:()=>v5,xLabelOffset:()=>_5,xLine:()=>y5,xNice:()=>t5,xPadding:()=>a5,xPaddingInner:()=>c5,xPaddingOuter:()=>f5,xPercent:()=>T5,xRange:()=>KM,xReverse:()=>E5,xRound:()=>i5,xScale:()=>ZM,xTickFormat:()=>m5,xTickPadding:()=>h5,xTickRotate:()=>x5,xTickSize:()=>p5,xTickSpacing:()=>d5,xTicks:()=>l5,xZero:()=>I5,xyDomain:()=>OM,yAlign:()=>z5,yAriaDescription:()=>sA,yAriaLabel:()=>iA,yAxis:()=>X5,yBase:()=>uA,yClamp:()=>q5,yConstant:()=>pA,yDomain:()=>R5,yExponent:()=>lA,yFontVariant:()=>oA,yGrid:()=>J5,yInset:()=>D5,yInsetBottom:()=>F5,yInsetTop:()=>P5,yLabel:()=>tA,yLabelAnchor:()=>eA,yLabelArrow:()=>nA,yLabelOffset:()=>rA,yLine:()=>K5,yNice:()=>$5,yPadding:()=>Y5,yPaddingInner:()=>U5,yPaddingOuter:()=>j5,yPercent:()=>aA,yRange:()=>O5,yReverse:()=>cA,yRound:()=>B5,yScale:()=>L5,yTickFormat:()=>Q5,yTickPadding:()=>H5,yTickRotate:()=>Z5,yTickSize:()=>V5,yTickSpacing:()=>G5,yTicks:()=>W5,yZero:()=>fA});var lo=Symbol("Fixed"),en=Symbol("Transient"),rp=Symbol("Transform");var lM={};Pc(lM,{Area:()=>yc,Arrow:()=>bh,BarX:()=>bc,BarY:()=>wc,Cell:()=>vc,Contour:()=>Ch,Density:()=>Rh,Dot:()=>_c,Frame:()=>ph,Geo:()=>Oh,Hexgrid:()=>$h,Image:()=>Dh,Line:()=>Sc,Link:()=>gh,Mark:()=>lt,Raster:()=>Th,Rect:()=>gc,RuleX:()=>rh,RuleY:()=>oh,Text:()=>hc,TickX:()=>_h,TickY:()=>Sh,Tip:()=>dh,Vector:()=>xc,WaffleX:()=>Fh,WaffleY:()=>qh,area:()=>xh,areaX:()=>Gs,areaY:()=>Wi,arrow:()=>A$,auto:()=>D$,autoSpec:()=>D4,axisFx:()=>mb,axisFy:()=>hb,axisX:()=>sh,axisY:()=>ih,barX:()=>Xo,barY:()=>Wo,bin:()=>Xi,binX:()=>Uo,binY:()=>jo,bollinger:()=>Js,bollingerX:()=>Y$,bollingerY:()=>U$,boxX:()=>j$,boxY:()=>X$,cell:()=>Hs,cellX:()=>E$,cellY:()=>I$,centroid:()=>Yb,circle:()=>k$,cluster:()=>UD,column:()=>Ge,contour:()=>tD,crosshair:()=>rD,crosshairX:()=>oD,crosshairY:()=>iD,delaunayLink:()=>cD,delaunayMesh:()=>fD,density:()=>hD,differenceX:()=>gD,differenceY:()=>yD,dodgeX:()=>fP,dodgeY:()=>uP,dot:()=>Pr,dotX:()=>N$,dotY:()=>C$,filter:()=>PL,find:()=>WL,formatIsoDate:()=>a4,formatMonth:()=>ZR,formatNumber:()=>s4,formatWeekday:()=>JR,frame:()=>Tu,geo:()=>Ub,geoCentroid:()=>wD,graticule:()=>_D,gridFx:()=>bb,gridFy:()=>gb,gridX:()=>yb,gridY:()=>xb,group:()=>Hd,groupX:()=>Rs,groupY:()=>Os,groupZ:()=>Gd,hexagon:()=>L$,hexbin:()=>SD,hexgrid:()=>MD,hull:()=>uD,identity:()=>W,image:()=>TD,indexOf:()=>Zt,initializer:()=>Kt,interpolateNearest:()=>Ih,interpolateNone:()=>zb,interpolatorBarycentric:()=>Eh,interpolatorRandomWalk:()=>Nh,legend:()=>VO,line:()=>Mc,lineX:()=>Qs,lineY:()=>Zs,linearRegressionX:()=>ND,linearRegressionY:()=>CD,link:()=>Lb,map:()=>Hn,mapX:()=>Lu,mapY:()=>Ru,marks:()=>ke,normalize:()=>Jb,normalizeX:()=>hP,normalizeY:()=>mP,numberInterval:()=>MS,plot:()=>Eu,pointer:()=>Bs,pointerX:()=>zs,pointerY:()=>Ui,raster:()=>Q$,rect:()=>lh,rectX:()=>Mu,rectY:()=>Au,reverse:()=>FL,ruleX:()=>pr,ruleY:()=>dr,scale:()=>$s,select:()=>bP,selectFirst:()=>Yh,selectLast:()=>Uh,selectMaxX:()=>n2,selectMaxY:()=>r2,selectMinX:()=>t2,selectMinY:()=>e2,shiftX:()=>xP,shiftY:()=>gP,shuffle:()=>qL,sort:()=>D1,sphere:()=>vD,spike:()=>EO,stackX:()=>A4,stackX1:()=>KO,stackX2:()=>t$,stackY:()=>T4,stackY1:()=>e$,stackY2:()=>n$,text:()=>Yo,textX:()=>ab,textY:()=>cb,tickX:()=>Fb,tickY:()=>qb,timeInterval:()=>Yd,tip:()=>Tb,transform:()=>Ce,tree:()=>nM,treeLink:()=>Gb,treeNode:()=>Ph,utcInterval:()=>oc,valueof:()=>ut,vector:()=>_4,vectorX:()=>lb,vectorY:()=>pb,voronoi:()=>lD,voronoiMesh:()=>pD,waffleX:()=>HD,waffleY:()=>QD,window:()=>Ou,windowX:()=>P$,windowY:()=>F$});function yt(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function An(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Xr(t){let e,n,r;t.length!==2?(e=yt,n=(a,c)=>yt(t(a),c),r=(a,c)=>t(a)-c):(e=t===yt||t===An?t:wz,n=t,r=t);function o(a,c,f=0,u=a.length){if(f<u){if(e(c,c)!==0)return u;do{let p=f+u>>>1;n(a[p],c)<0?f=p+1:u=p}while(f<u)}return f}function i(a,c,f=0,u=a.length){if(f<u){if(e(c,c)!==0)return u;do{let p=f+u>>>1;n(a[p],c)<=0?f=p+1:u=p}while(f<u)}return f}function s(a,c,f=0,u=a.length){let p=o(a,c,f,u-1);return p>f&&r(a[p-1],c)>-r(a[p],c)?p-1:p}return{left:o,center:s,right:i}}function wz(){return 0}function op(t){return t===null?NaN:+t}function*II(t,e){if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(yield r)}}var NI=Xr(yt),CI=NI.right,vz=NI.left,_z=Xr(op).center,fi=CI;var ip=kI(LI),a_=kI(Sz);function kI(t){return function(e,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:o,width:i,height:s}=e;if(!((i=Math.floor(i))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:o.length/i))>=0))throw new RangeError("invalid height");if(!i||!s||!n&&!r)return e;let a=n&&t(n),c=r&&t(r),f=o.slice();return a&&c?(of(a,f,o,i,s),of(a,o,f,i,s),of(a,f,o,i,s),sf(c,o,f,i,s),sf(c,f,o,i,s),sf(c,o,f,i,s)):a?(of(a,o,f,i,s),of(a,f,o,i,s),of(a,o,f,i,s)):c&&(sf(c,o,f,i,s),sf(c,f,o,i,s),sf(c,o,f,i,s)),e}}function of(t,e,n,r,o){for(let i=0,s=r*o;i<s;)t(e,n,i,i+=r,1)}function sf(t,e,n,r,o){for(let i=0,s=r*o;i<r;++i)t(e,n,i,i+s,r)}function Sz(t){let e=LI(t);return(n,r,o,i,s)=>{o<<=2,i<<=2,s<<=2,e(n,r,o+0,i+0,s),e(n,r,o+1,i+1,s),e(n,r,o+2,i+2,s),e(n,r,o+3,i+3,s)}}function LI(t){let e=Math.floor(t);if(e===t)return Mz(t);let n=t-e,r=2*t+1;return(o,i,s,a,c)=>{if(!((a-=c)>=s))return;let f=e*i[s],u=c*e,p=u+c;for(let l=s,d=s+u;l<d;l+=c)f+=i[Math.min(a,l)];for(let l=s,d=a;l<=d;l+=c)f+=i[Math.min(a,l+u)],o[l]=(f+n*(i[Math.max(s,l-p)]+i[Math.min(a,l+p)]))/r,f-=i[Math.max(s,l-u)]}}function Mz(t){let e=2*t+1;return(n,r,o,i,s)=>{if(!((i-=s)>=o))return;let a=t*r[o],c=s*t;for(let f=o,u=o+c;f<u;f+=s)a+=r[Math.min(i,f)];for(let f=o,u=i;f<=u;f+=s)a+=r[Math.min(i,f+c)],n[f]=a/e,a-=r[Math.max(o,f-c)]}}function po(t,e){let n=0;if(e===void 0)for(let r of t)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(o=+o)>=o&&++n}return n}function Az(t){return t.length|0}function Tz(t){return!(t>0)}function Ez(t){return typeof t!="object"||"length"in t?t:Array.from(t)}function Iz(t){return e=>t(...e)}function xx(...t){let e=typeof t[t.length-1]=="function"&&Iz(t.pop());t=t.map(Ez);let n=t.map(Az),r=t.length-1,o=new Array(r+1).fill(0),i=[];if(r<0||n.some(Tz))return i;for(;;){i.push(o.map((a,c)=>t[c][a]));let s=r;for(;++o[s]===n[s];){if(s===0)return e?i.map(e):i;o[s--]=0}}}function gx(t,e){var n=0,r=0;return Float64Array.from(t,e===void 0?o=>n+=+o||0:o=>n+=+e(o,r++,t)||0)}function as(t,e){let n=0,r,o=0,i=0;if(e===void 0)for(let s of t)s!=null&&(s=+s)>=s&&(r=s-o,o+=r/++n,i+=r*(s-o));else{let s=-1;for(let a of t)(a=e(a,++s,t))!=null&&(a=+a)>=a&&(r=a-o,o+=r/++n,i+=r*(a-o))}if(n>1)return i/(n-1)}function Mr(t,e){let n=as(t,e);return n&&Math.sqrt(n)}function Ft(t,e){let n,r;if(e===void 0)for(let o of t)o!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)));else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}var nn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let n=this._partials,r=0;for(let o=0;o<this._n&&o<32;o++){let i=n[o],s=e+i,a=Math.abs(e)<Math.abs(i)?e-(s-i):i-(s-e);a&&(n[r++]=a),e=s}return n[r]=e,this._n=r+1,this}valueOf(){let e=this._partials,n=this._n,r,o,i,s=0;if(n>0){for(s=e[--n];n>0&&(r=s,o=e[--n],s=r+o,i=o-(s-r),!i););n>0&&(i<0&&e[n-1]<0||i>0&&e[n-1]>0)&&(o=i*2,r=s+o,o==r-s&&(s=r))}return s}};var Tn=class extends Map{constructor(e,n=$I){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(let[r,o]of e)this.set(r,o)}get(e){return super.get(c_(this,e))}has(e){return super.has(c_(this,e))}set(e,n){return super.set(RI(this,e),n)}delete(e){return super.delete(OI(this,e))}},En=class extends Set{constructor(e,n=$I){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(let r of e)this.add(r)}has(e){return super.has(c_(this,e))}add(e){return super.add(RI(this,e))}delete(e){return super.delete(OI(this,e))}};function c_({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):n}function RI({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function OI({_intern:t,_key:e},n){let r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function $I(t){return t!==null&&typeof t=="object"?t.valueOf():t}function sp(t){return t}function rn(t,...e){return u_(t,sp,sp,e)}function Wr(t,e,...n){return u_(t,sp,e,n)}function f_(t,e,...n){return u_(t,Array.from,e,n)}function u_(t,e,n,r){return function o(i,s){if(s>=r.length)return n(i);let a=new Tn,c=r[s++],f=-1;for(let u of i){let p=c(u,++f,i),l=a.get(p);l?l.push(u):a.set(p,[u])}for(let[u,p]of a)a.set(u,o(p,s));return e(a)}(t,0)}function l_(t,e){return Array.from(e,n=>t[n])}function ui(t,...e){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");t=Array.from(t);let[n]=e;if(n&&n.length!==2||e.length>1){let r=Uint32Array.from(t,(o,i)=>i);return e.length>1?(e=e.map(o=>t.map(o)),r.sort((o,i)=>{for(let s of e){let a=Ea(s[o],s[i]);if(a)return a}})):(n=t.map(n),r.sort((o,i)=>Ea(n[o],n[i]))),l_(t,r)}return t.sort(ap(n))}function ap(t=yt){if(t===yt)return Ea;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{let r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function Ea(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}function af(t,e,n){return(e.length!==2?ui(Wr(t,e,n),([r,o],[i,s])=>yt(o,s)||yt(r,i)):ui(rn(t,n),([r,o],[i,s])=>e(o,s)||yt(r,i))).map(([r])=>r)}var Nz=Math.sqrt(50),Cz=Math.sqrt(10),kz=Math.sqrt(2);function yx(t,e,n){let r=(e-t)/Math.max(0,n),o=Math.floor(Math.log10(r)),i=r/Math.pow(10,o),s=i>=Nz?10:i>=Cz?5:i>=kz?2:1,a,c,f;return o<0?(f=Math.pow(10,-o)/s,a=Math.round(t*f),c=Math.round(e*f),a/f<t&&++a,c/f>e&&--c,f=-f):(f=Math.pow(10,o)*s,a=Math.round(t/f),c=Math.round(e/f),a*f<t&&++a,c*f>e&&--c),c<a&&.5<=n&&n<2?yx(t,e,n*2):[a,c,f]}function on(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];let r=e<t,[o,i,s]=r?yx(e,t,n):yx(t,e,n);if(!(i>=o))return[];let a=i-o+1,c=new Array(a);if(r)if(s<0)for(let f=0;f<a;++f)c[f]=(i-f)/-s;else for(let f=0;f<a;++f)c[f]=(i-f)*s;else if(s<0)for(let f=0;f<a;++f)c[f]=(o+f)/-s;else for(let f=0;f<a;++f)c[f]=(o+f)*s;return c}function li(t,e,n){return e=+e,t=+t,n=+n,yx(t,e,n)[2]}function cf(t,e,n){e=+e,t=+t,n=+n;let r=e<t,o=r?li(e,t,n):li(t,e,n);return(r?-1:1)*(o<0?1/-o:o)}function ff(t,e,n){let r;for(;;){let o=li(t,e,n);if(o===r||o===0||!isFinite(o))return[t,e];o>0?(t=Math.floor(t/o)*o,e=Math.ceil(e/o)*o):o<0&&(t=Math.ceil(t*o)/o,e=Math.floor(e*o)/o),r=o}}function cs(t){return Math.max(1,Math.ceil(Math.log(po(t))/Math.LN2)+1)}function kt(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function bx(t,e){let n,r=-1,o=-1;if(e===void 0)for(let i of t)++o,i!=null&&(n<i||n===void 0&&i>=i)&&(n=i,r=o);else for(let i of t)(i=e(i,++o,t))!=null&&(n<i||n===void 0&&i>=i)&&(n=i,r=o);return r}function It(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function wx(t,e){let n,r=-1,o=-1;if(e===void 0)for(let i of t)++o,i!=null&&(n>i||n===void 0&&i>=i)&&(n=i,r=o);else for(let i of t)(i=e(i,++o,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i,r=o);return r}function vx(t,e,n=0,r=1/0,o){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(o=o===void 0?Ea:ap(o);r>n;){if(r-n>600){let c=r-n+1,f=e-n+1,u=Math.log(c),p=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*p*(c-p)/c)*(f-c/2<0?-1:1),d=Math.max(n,Math.floor(e-f*p/c+l)),h=Math.min(r,Math.floor(e+(c-f)*p/c+l));vx(t,e,d,h,o)}let i=t[e],s=n,a=r;for(cp(t,n,e),o(t[r],i)>0&&cp(t,n,r);s<a;){for(cp(t,s,a),++s,--a;o(t[s],i)<0;)++s;for(;o(t[a],i)>0;)--a}o(t[n],i)===0?cp(t,n,a):(++a,cp(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function cp(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Ia(t,e=yt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?yt(s,o)>0:yt(s,s)===0)&&(n=i,o=s,r=!0)}}else for(let o of t)(r?e(o,n)>0:e(o,o)===0)&&(n=o,r=!0);return n}function In(t,e,n){if(t=Float64Array.from(II(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return It(t);if(e>=1)return kt(t);var r,o=(r-1)*e,i=Math.floor(o),s=kt(vx(t,i).subarray(0,i+1)),a=It(t.subarray(i+1));return s+(a-s)*(o-i)}}function p_(t,e,n=op){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),s=+n(t[i],i,t),a=+n(t[i+1],i+1,t);return s+(a-s)*(o-i)}}function _x(t,e,n){let r=po(t),o=In(t,.75)-In(t,.25);return r&&o?Math.ceil((n-e)/(2*o*Math.pow(r,-1/3))):1}function fp(t,e,n){let r=po(t),o=Mr(t);return r&&o?Math.ceil((n-e)*Math.cbrt(r)/(3.49*o)):1}function pi(t,e){let n=0,r=0;if(e===void 0)for(let o of t)o!=null&&(o=+o)>=o&&(++n,r+=o);else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(i=+i)>=i&&(++n,r+=i)}if(n)return r/n}function Vr(t,e){return In(t,.5,e)}function*Rz(t){for(let e of t)yield*e}function uf(t){return Array.from(Rz(t))}function lf(t,e){let n=new Tn;if(e===void 0)for(let i of t)i!=null&&i>=i&&n.set(i,(n.get(i)||0)+1);else{let i=-1;for(let s of t)(s=e(s,++i,t))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,o=0;for(let[i,s]of n)s>o&&(o=s,r=i);return r}function Sx(t,e=Oz){let n=[],r,o=!1;for(let i of t)o&&n.push(e(r,i)),r=i,o=!0;return n}function Oz(t,e){return[t,e]}function ye(t,e,n){t=+t,e=+e,n=(o=arguments.length)<2?(e=t,t=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(o);++r<o;)i[r]=t+r*n;return i}function up(t,e=yt){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(t),r=new Float64Array(n.length);e.length!==2&&(n=n.map(e),e=yt);let o=(a,c)=>e(n[a],n[c]),i,s;return t=Uint32Array.from(n,(a,c)=>c),t.sort(e===yt?(a,c)=>Ea(n[a],n[c]):ap(o)),t.forEach((a,c)=>{let f=o(a,i===void 0?a:i);f>=0?((i===void 0||f>0)&&(i=a,s=c),r[a]=s):r[a]=NaN}),r}function Mx(t,e=yt){let n,r=!1;if(e.length===1){let o;for(let i of t){let s=e(i);(r?yt(s,o)<0:yt(s,s)===0)&&(n=i,o=s,r=!0)}}else for(let o of t)(r?e(o,n)<0:e(o,o)===0)&&(n=o,r=!0);return n}function sn(t,e){let n=0;if(e===void 0)for(let r of t)(r=+r)&&(n+=r);else{let r=-1;for(let o of t)(o=+e(o,++r,t))&&(n+=o)}return n}function fs(t){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(t).reverse()}function DI(t){return t}var d_=1,h_=2,m_=3,Ax=4,PI=1e-6;function $z(t){return"translate("+t+",0)"}function Dz(t){return"translate(0,"+t+")"}function Pz(t){return e=>+t(e)}function Fz(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function qz(){return!this.__axis}function Bz(t,e){var n=[],r=null,o=null,i=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,f=t===d_||t===Ax?-1:1,u=t===Ax||t===h_?"x":"y",p=t===d_||t===m_?$z:Dz;function l(d){var h=r??(e.ticks?e.ticks.apply(e,n):e.domain()),m=o??(e.tickFormat?e.tickFormat.apply(e,n):DI),x=Math.max(i,0)+a,g=e.range(),y=+g[0]+c,b=+g[g.length-1]+c,w=(e.bandwidth?Fz:Pz)(e.copy(),c),_=d.selection?d.selection():d,v=_.selectAll(".domain").data([null]),A=_.selectAll(".tick").data(h,e).order(),T=A.exit(),E=A.enter().append("g").attr("class","tick"),N=A.select("line"),M=A.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),A=A.merge(E),N=N.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",f*i)),M=M.merge(E.append("text").attr("fill","currentColor").attr(u,f*x).attr("dy",t===d_?"0em":t===m_?"0.71em":"0.32em")),d!==_&&(v=v.transition(d),A=A.transition(d),N=N.transition(d),M=M.transition(d),T=T.transition(d).attr("opacity",PI).attr("transform",function(k){return isFinite(k=w(k))?p(k+c):this.getAttribute("transform")}),E.attr("opacity",PI).attr("transform",function(k){var O=this.parentNode.__axis;return p((O&&isFinite(O=O(k))?O:w(k))+c)})),T.remove(),v.attr("d",t===Ax||t===h_?s?"M"+f*s+","+y+"H"+c+"V"+b+"H"+f*s:"M"+c+","+y+"V"+b:s?"M"+y+","+f*s+"V"+c+"H"+b+"V"+f*s:"M"+y+","+c+"H"+b),A.attr("opacity",1).attr("transform",function(k){return p(w(k)+c)}),N.attr(u+"2",f*i),M.attr(u,f*x).text(m),_.filter(qz).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===h_?"start":t===Ax?"end":"middle"),_.each(function(){this.__axis=w})}return l.scale=function(d){return arguments.length?(e=d,l):e},l.ticks=function(){return n=Array.from(arguments),l},l.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),l):n.slice()},l.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),l):r&&r.slice()},l.tickFormat=function(d){return arguments.length?(o=d,l):o},l.tickSize=function(d){return arguments.length?(i=s=+d,l):i},l.tickSizeInner=function(d){return arguments.length?(i=+d,l):i},l.tickSizeOuter=function(d){return arguments.length?(s=+d,l):s},l.tickPadding=function(d){return arguments.length?(a=+d,l):a},l.offset=function(d){return arguments.length?(c=+d,l):c},l}function x_(t){return Bz(m_,t)}var zz={value:()=>{}};function qI(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Tx(n)}function Tx(t){this._=t}function Yz(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Tx.prototype=qI.prototype={constructor:Tx,on:function(t,e){var n=this._,r=Yz(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=Uz(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=r[i]).type)n[o]=FI(n[o],t.name,e);else if(e==null)for(o in n)n[o]=FI(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Tx(t)},call:function(t,e){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};function Uz(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function FI(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=zz,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Na=qI;var Ex="http://www.w3.org/1999/xhtml",Nn={svg:"http://www.w3.org/2000/svg",xhtml:Ex,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function di(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Nn.hasOwnProperty(e)?{space:Nn[e],local:t}:t}function jz(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ex&&e.documentElement.namespaceURI===Ex?e.createElement(t):e.createElementNS(n,t)}}function Xz(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function hi(t){var e=di(t);return(e.local?Xz:jz)(e)}function Wz(){}function Ca(t){return t==null?Wz:function(){return this.querySelector(t)}}function BI(t){typeof t!="function"&&(t=Ca(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=new Array(s),c,f,u=0;u<s;++u)(c=i[u])&&(f=t.call(c,c.__data__,u,i))&&("__data__"in c&&(f.__data__=c.__data__),a[u]=f);return new de(r,this._parents)}function g_(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Vz(){return[]}function lp(t){return t==null?Vz:function(){return this.querySelectorAll(t)}}function Gz(t){return function(){return g_(t.apply(this,arguments))}}function zI(t){typeof t=="function"?t=Gz(t):t=lp(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&(r.push(t.call(c,c.__data__,f,s)),o.push(c));return new de(r,o)}function pp(t){return function(){return this.matches(t)}}function Ix(t){return function(e){return e.matches(t)}}var Hz=Array.prototype.find;function Qz(t){return function(){return Hz.call(this.children,t)}}function Zz(){return this.firstElementChild}function YI(t){return this.select(t==null?Zz:Qz(typeof t=="function"?t:Ix(t)))}var Jz=Array.prototype.filter;function Kz(){return Array.from(this.children)}function tY(t){return function(){return Jz.call(this.children,t)}}function UI(t){return this.selectAll(t==null?Kz:tY(typeof t=="function"?t:Ix(t)))}function jI(t){typeof t!="function"&&(t=pp(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,f=0;f<s;++f)(c=i[f])&&t.call(c,c.__data__,f,i)&&a.push(c);return new de(r,this._parents)}function Nx(t){return new Array(t.length)}function XI(){return new de(this._enter||this._groups.map(Nx),this._parents)}function dp(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}dp.prototype={constructor:dp,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function WI(t){return function(){return t}}function eY(t,e,n,r,o,i){for(var s=0,a,c=e.length,f=i.length;s<f;++s)(a=e[s])?(a.__data__=i[s],r[s]=a):n[s]=new dp(t,i[s]);for(;s<c;++s)(a=e[s])&&(o[s]=a)}function nY(t,e,n,r,o,i,s){var a,c,f=new Map,u=e.length,p=i.length,l=new Array(u),d;for(a=0;a<u;++a)(c=e[a])&&(l[a]=d=s.call(c,c.__data__,a,e)+"",f.has(d)?o[a]=c:f.set(d,c));for(a=0;a<p;++a)d=s.call(t,i[a],a,i)+"",(c=f.get(d))?(r[a]=c,c.__data__=i[a],f.delete(d)):n[a]=new dp(t,i[a]);for(a=0;a<u;++a)(c=e[a])&&f.get(l[a])===c&&(o[a]=c)}function rY(t){return t.__data__}function VI(t,e){if(!arguments.length)return Array.from(this,rY);var n=e?nY:eY,r=this._parents,o=this._groups;typeof t!="function"&&(t=WI(t));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),f=0;f<i;++f){var u=r[f],p=o[f],l=p.length,d=oY(t.call(u,u&&u.__data__,f,r)),h=d.length,m=a[f]=new Array(h),x=s[f]=new Array(h),g=c[f]=new Array(l);n(u,p,m,x,g,d,e);for(var y=0,b=0,w,_;y<h;++y)if(w=m[y]){for(y>=b&&(b=y+1);!(_=x[b])&&++b<h;);w._next=_||null}}return s=new de(s,r),s._enter=a,s._exit=c,s}function oY(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function GI(){return new de(this._exit||this._groups.map(Nx),this._parents)}function HI(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function QI(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var f=n[c],u=r[c],p=f.length,l=a[c]=new Array(p),d,h=0;h<p;++h)(d=f[h]||u[h])&&(l[h]=d);for(;c<o;++c)a[c]=n[c];return new de(a,this._parents)}function ZI(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function JI(t){t||(t=iY);function e(p,l){return p&&l?t(p.__data__,l.__data__):!p-!l}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),f,u=0;u<a;++u)(f=s[u])&&(c[u]=f);c.sort(e)}return new de(o,this._parents).order()}function iY(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function KI(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function tN(){return Array.from(this)}function eN(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function nN(){let t=0;for(let e of this)++t;return t}function rN(){return!this.node()}function oN(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&t.call(a,a.__data__,i,o);return this}function sY(t){return function(){this.removeAttribute(t)}}function aY(t){return function(){this.removeAttributeNS(t.space,t.local)}}function cY(t,e){return function(){this.setAttribute(t,e)}}function fY(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function uY(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function lY(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function iN(t,e){var n=di(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?aY:sY:typeof e=="function"?n.local?lY:uY:n.local?fY:cY)(n,e))}function Cx(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function pY(t){return function(){this.style.removeProperty(t)}}function dY(t,e,n){return function(){this.style.setProperty(t,e,n)}}function hY(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function sN(t,e,n){return arguments.length>1?this.each((e==null?pY:typeof e=="function"?hY:dY)(t,e,n??"")):us(this.node(),t)}function us(t,e){return t.style.getPropertyValue(e)||Cx(t).getComputedStyle(t,null).getPropertyValue(e)}function mY(t){return function(){delete this[t]}}function xY(t,e){return function(){this[t]=e}}function gY(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function aN(t,e){return arguments.length>1?this.each((e==null?mY:typeof e=="function"?gY:xY)(t,e)):this.node()[t]}function cN(t){return t.trim().split(/^|\s+/)}function y_(t){return t.classList||new fN(t)}function fN(t){this._node=t,this._names=cN(t.getAttribute("class")||"")}fN.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function uN(t,e){for(var n=y_(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function lN(t,e){for(var n=y_(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function yY(t){return function(){uN(this,t)}}function bY(t){return function(){lN(this,t)}}function wY(t,e){return function(){(e.apply(this,arguments)?uN:lN)(this,t)}}function pN(t,e){var n=cN(t+"");if(arguments.length<2){for(var r=y_(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?wY:e?yY:bY)(n,e))}function vY(){this.textContent=""}function _Y(t){return function(){this.textContent=t}}function SY(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function dN(t){return arguments.length?this.each(t==null?vY:(typeof t=="function"?SY:_Y)(t)):this.node().textContent}function MY(){this.innerHTML=""}function AY(t){return function(){this.innerHTML=t}}function TY(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function hN(t){return arguments.length?this.each(t==null?MY:(typeof t=="function"?TY:AY)(t)):this.node().innerHTML}function EY(){this.nextSibling&&this.parentNode.appendChild(this)}function mN(){return this.each(EY)}function IY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xN(){return this.each(IY)}function gN(t){var e=typeof t=="function"?t:hi(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function NY(){return null}function yN(t,e){var n=typeof t=="function"?t:hi(t),r=e==null?NY:typeof e=="function"?e:Ca(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function CY(){var t=this.parentNode;t&&t.removeChild(this)}function bN(){return this.each(CY)}function kY(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function LY(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function wN(t){return this.select(t?LY:kY)}function vN(t){return arguments.length?this.property("__data__",t):this.node().__data__}function RY(t){return function(e){t.call(this,e,this.__data__)}}function OY(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function $Y(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function DY(t,e,n){return function(){var r=this.__on,o,i=RY(e);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function _N(t,e,n){var r=OY(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,f=a.length,u;c<f;++c)for(o=0,u=a[c];o<i;++o)if((s=r[o]).type===u.type&&s.name===u.name)return u.value}return}for(a=e?DY:$Y,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function SN(t,e,n){var r=Cx(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function PY(t,e){return function(){return SN(this,t,e)}}function FY(t,e){return function(){return SN(this,t,e.apply(this,arguments))}}function MN(t,e){return this.each((typeof e=="function"?FY:PY)(t,e))}function*AN(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var b_=[null];function de(t,e){this._groups=t,this._parents=e}function TN(){return new de([[document.documentElement]],b_)}function qY(){return this}de.prototype=TN.prototype={constructor:de,select:BI,selectAll:zI,selectChild:YI,selectChildren:UI,filter:jI,data:VI,enter:XI,exit:GI,join:HI,merge:QI,selection:qY,order:ZI,sort:JI,call:KI,nodes:tN,node:eN,size:nN,empty:rN,each:oN,attr:iN,style:sN,property:aN,classed:pN,text:dN,html:hN,raise:mN,lower:xN,append:gN,insert:yN,remove:bN,clone:wN,datum:vN,on:_N,dispatch:MN,[Symbol.iterator]:AN};var mi=TN;function Nt(t){return typeof t=="string"?new de([[document.querySelector(t)]],[document.documentElement]):new de([[t]],b_)}function EN(t){let e;for(;e=t.sourceEvent;)t=e;return t}function hn(t,e){if(t=EN(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}var kx={capture:!0,passive:!1};function Lx(t){t.preventDefault(),t.stopImmediatePropagation()}function hp(t){var e=t.document.documentElement,n=Nt(t).on("dragstart.drag",Lx,kx);"onselectstart"in e?n.on("selectstart.drag",Lx,kx):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function mp(t,e){var n=t.document.documentElement,r=Nt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Lx,kx),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 xi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ls(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function mo(){}var ps=.7,Ra=1/ps,pf="\\s*([+-]?\\d+)\\s*",xp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ho="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",BY=/^#([0-9a-f]{3,8})$/,zY=new RegExp(`^rgb\\(${pf},${pf},${pf}\\)$`),YY=new RegExp(`^rgb\\(${ho},${ho},${ho}\\)$`),UY=new RegExp(`^rgba\\(${pf},${pf},${pf},${xp}\\)$`),jY=new RegExp(`^rgba\\(${ho},${ho},${ho},${xp}\\)$`),XY=new RegExp(`^hsl\\(${xp},${ho},${ho}\\)$`),WY=new RegExp(`^hsla\\(${xp},${ho},${ho},${xp}\\)$`),IN={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};xi(mo,nr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:NN,formatHex:NN,formatHex8:VY,formatHsl:GY,formatRgb:CN,toString:CN});function NN(){return this.rgb().formatHex()}function VY(){return this.rgb().formatHex8()}function GY(){return DN(this).formatHsl()}function CN(){return this.rgb().formatRgb()}function nr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=BY.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?kN(e):n===3?new Se(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Rx(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Rx(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=zY.exec(t))?new Se(e[1],e[2],e[3],1):(e=YY.exec(t))?new Se(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=UY.exec(t))?Rx(e[1],e[2],e[3],e[4]):(e=jY.exec(t))?Rx(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=XY.exec(t))?ON(e[1],e[2]/100,e[3]/100,1):(e=WY.exec(t))?ON(e[1],e[2]/100,e[3]/100,e[4]):IN.hasOwnProperty(t)?kN(IN[t]):t==="transparent"?new Se(NaN,NaN,NaN,0):null}function kN(t){return new Se(t>>16&255,t>>8&255,t&255,1)}function Rx(t,e,n,r){return r<=0&&(t=e=n=NaN),new Se(t,e,n,r)}function gp(t){return t instanceof mo||(t=nr(t)),t?(t=t.rgb(),new Se(t.r,t.g,t.b,t.opacity)):new Se}function Le(t,e,n,r){return arguments.length===1?gp(t):new Se(t,e,n,r??1)}function Se(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}xi(Se,Le,ls(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ps:Math.pow(ps,t),new Se(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Se(La(this.r),La(this.g),La(this.b),$x(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:HY,formatRgb:RN,toString:RN}));function LN(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}`}function HY(){return`#${ka(this.r)}${ka(this.g)}${ka(this.b)}${ka((isNaN(this.opacity)?1:this.opacity)*255)}`}function RN(){let t=$x(this.opacity);return`${t===1?"rgb(":"rgba("}${La(this.r)}, ${La(this.g)}, ${La(this.b)}${t===1?")":`, ${t})`}`}function $x(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function La(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ka(t){return t=La(t),(t<16?"0":"")+t.toString(16)}function ON(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Gr(t,e,n,r)}function DN(t){if(t instanceof Gr)return new Gr(t.h,t.s,t.l,t.opacity);if(t instanceof mo||(t=nr(t)),!t)return new Gr;if(t instanceof Gr)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new Gr(s,a,c,t.opacity)}function yp(t,e,n,r){return arguments.length===1?DN(t):new Gr(t,e,n,r??1)}function Gr(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}xi(Gr,yp,ls(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Gr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ps:Math.pow(ps,t),new Gr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new Se(w_(t>=240?t-240:t+120,o,r),w_(t,o,r),w_(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Gr($N(this.h),Ox(this.s),Ox(this.l),$x(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 t=$x(this.opacity);return`${t===1?"hsl(":"hsla("}${$N(this.h)}, ${Ox(this.s)*100}%, ${Ox(this.l)*100}%${t===1?")":`, ${t})`}`}}));function $N(t){return t=(t||0)%360,t<0?t+360:t}function Ox(t){return Math.max(0,Math.min(1,t||0))}function w_(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}var Dx=Math.PI/180,Px=180/Math.PI;var Fx=18,PN=.96422,FN=1,qN=.82521,BN=4/29,df=6/29,zN=3*df*df,QY=df*df*df;function YN(t){if(t instanceof xo)return new xo(t.l,t.a,t.b,t.opacity);if(t instanceof gi)return UN(t);t instanceof Se||(t=gp(t));var e=M_(t.r),n=M_(t.g),r=M_(t.b),o=v_((.2225045*e+.7168786*n+.0606169*r)/FN),i,s;return e===n&&n===r?i=s=o:(i=v_((.4360747*e+.3850649*n+.1430804*r)/PN),s=v_((.0139322*e+.0971045*n+.7141733*r)/qN)),new xo(116*o-16,500*(i-o),200*(o-s),t.opacity)}function hf(t,e,n,r){return arguments.length===1?YN(t):new xo(t,e,n,r??1)}function xo(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}xi(xo,hf,ls(mo,{brighter(t){return new xo(this.l+Fx*(t??1),this.a,this.b,this.opacity)},darker(t){return new xo(this.l-Fx*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=PN*__(e),t=FN*__(t),n=qN*__(n),new Se(S_(3.1338561*e-1.6168667*t-.4906146*n),S_(-.9787684*e+1.9161415*t+.033454*n),S_(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function v_(t){return t>QY?Math.pow(t,1/3):t/zN+BN}function __(t){return t>df?t*t*t:zN*(t-BN)}function S_(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function M_(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ZY(t){if(t instanceof gi)return new gi(t.h,t.c,t.l,t.opacity);if(t instanceof xo||(t=YN(t)),t.a===0&&t.b===0)return new gi(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Px;return new gi(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bp(t,e,n,r){return arguments.length===1?ZY(t):new gi(t,e,n,r??1)}function gi(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function UN(t){if(isNaN(t.h))return new xo(t.l,0,0,t.opacity);var e=t.h*Dx;return new xo(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}xi(gi,bp,ls(mo,{brighter(t){return new gi(this.h,this.c,this.l+Fx*(t??1),this.opacity)},darker(t){return new gi(this.h,this.c,this.l-Fx*(t??1),this.opacity)},rgb(){return UN(this).rgb()}}));var VN=-.14861,A_=1.78277,T_=-.29227,qx=-.90649,wp=1.97294,jN=wp*qx,XN=wp*A_,WN=A_*T_-qx*VN;function JY(t){if(t instanceof Oa)return new Oa(t.h,t.s,t.l,t.opacity);t instanceof Se||(t=gp(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(WN*r+jN*e-XN*n)/(WN+jN-XN),i=r-o,s=(wp*(n-o)-T_*i)/qx,a=Math.sqrt(s*s+i*i)/(wp*o*(1-o)),c=a?Math.atan2(s,i)*Px-120:NaN;return new Oa(c<0?c+360:c,a,o,t.opacity)}function Cn(t,e,n,r){return arguments.length===1?JY(t):new Oa(t,e,n,r??1)}function Oa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}xi(Oa,Cn,ls(mo,{brighter(t){return t=t==null?Ra:Math.pow(Ra,t),new Oa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ps:Math.pow(ps,t),new Oa(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Dx,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new Se(255*(e+n*(VN*r+A_*o)),255*(e+n*(T_*r+qx*o)),255*(e+n*(wp*r)),this.opacity)}}));function E_(t,e,n,r,o){var i=t*t,s=i*t;return((1-3*t+3*i-s)*e+(4-6*i+3*s)*n+(1+3*t+3*i-3*s)*r+s*o)/6}function GN(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[r],i=t[r+1],s=r>0?t[r-1]:2*o-i,a=r<e-1?t[r+2]:2*i-o;return E_((n-r/e)*e,s,o,i,a)}}function HN(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],s=t[(r+1)%e],a=t[(r+2)%e];return E_((n-r/e)*e,o,i,s,a)}}var mf=t=>()=>t;function QN(t,e){return function(n){return t+n*e}}function KY(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function xf(t,e){var n=e-t;return n?QN(t,n>180||n<-180?n-360*Math.round(n/360):n):mf(isNaN(t)?e:t)}function ZN(t){return(t=+t)==1?re:function(e,n){return n-e?KY(e,n,t):mf(isNaN(e)?n:e)}}function re(t,e){var n=e-t;return n?QN(t,n):mf(isNaN(t)?e:t)}var Ar=function t(e){var n=ZN(e);function r(o,i){var s=n((o=Le(o)).r,(i=Le(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),f=re(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=c(u),o.opacity=f(u),o+""}}return r.gamma=t,r}(1);function JN(t){return function(e){var n=e.length,r=new Array(n),o=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=Le(e[s]),r[s]=a.r||0,o[s]=a.g||0,i[s]=a.b||0;return r=t(r),o=t(o),i=t(i),a.opacity=1,function(c){return a.r=r(c),a.g=o(c),a.b=i(c),a+""}}}var I_=JN(GN),tU=JN(HN);function KN(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function tC(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function eC(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=rr(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function nC(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function ee(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function rC(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=rr(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var C_=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,N_=new RegExp(C_.source,"g");function eU(t){return function(){return t}}function nU(t){return function(e){return t(e)+""}}function vp(t,e){var n=C_.lastIndex=N_.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=C_.exec(t))&&(o=N_.exec(e));)(i=o.index)>n&&(i=e.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:ee(r,o)})),n=N_.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?nU(c[0].x):eU(e):(e=c.length,function(f){for(var u=0,p;u<e;++u)a[(p=c[u]).i]=p.x(f);return a.join("")})}function rr(t,e){var n=typeof e,r;return e==null||n==="boolean"?mf(e):(n==="number"?ee:n==="string"?(r=nr(e))?(e=r,Ar):vp:e instanceof nr?Ar:e instanceof Date?nC:tC(e)?KN:Array.isArray(e)?eC:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?rC:ee)(t,e)}function $a(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var oC=180/Math.PI,Bx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function k_(t,e,n,r,o,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*oC,skewX:Math.atan(c)*oC,scaleX:s,scaleY:a}}var zx;function iC(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Bx:k_(e.a,e.b,e.c,e.d,e.e,e.f)}function sC(t){return t==null?Bx:(zx||(zx=document.createElementNS("http://www.w3.org/2000/svg","g")),zx.setAttribute("transform",t),(t=zx.transform.baseVal.consolidate())?(t=t.matrix,k_(t.a,t.b,t.c,t.d,t.e,t.f)):Bx)}function aC(t,e,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,u,p,l,d,h){if(f!==p||u!==l){var m=d.push("translate(",null,e,null,n);h.push({i:m-4,x:ee(f,p)},{i:m-2,x:ee(u,l)})}else(p||l)&&d.push("translate("+p+e+l+n)}function s(f,u,p,l){f!==u?(f-u>180?u+=360:u-f>180&&(f+=360),l.push({i:p.push(o(p)+"rotate(",null,r)-2,x:ee(f,u)})):u&&p.push(o(p)+"rotate("+u+r)}function a(f,u,p,l){f!==u?l.push({i:p.push(o(p)+"skewX(",null,r)-2,x:ee(f,u)}):u&&p.push(o(p)+"skewX("+u+r)}function c(f,u,p,l,d,h){if(f!==p||u!==l){var m=d.push(o(d)+"scale(",null,",",null,")");h.push({i:m-4,x:ee(f,p)},{i:m-2,x:ee(u,l)})}else(p!==1||l!==1)&&d.push(o(d)+"scale("+p+","+l+")")}return function(f,u){var p=[],l=[];return f=t(f),u=t(u),i(f.translateX,f.translateY,u.translateX,u.translateY,p,l),s(f.rotate,u.rotate,p,l),a(f.skewX,u.skewX,p,l),c(f.scaleX,f.scaleY,u.scaleX,u.scaleY,p,l),f=u=null,function(d){for(var h=-1,m=l.length,x;++h<m;)p[(x=l[h]).i]=x.x(d);return p.join("")}}}var L_=aC(iC,"px, ","px)","deg)"),R_=aC(sC,", ",")",")");var rU=1e-12;function cC(t){return((t=Math.exp(t))+1/t)/2}function oU(t){return((t=Math.exp(t))-1/t)/2}function iU(t){return((t=Math.exp(2*t))-1)/(t+1)}var O_=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],f=i[2],u=s[0],p=s[1],l=s[2],d=u-a,h=p-c,m=d*d+h*h,x,g;if(m<rU)g=Math.log(l/f)/e,x=function(A){return[a+A*d,c+A*h,f*Math.exp(e*A*g)]};else{var y=Math.sqrt(m),b=(l*l-f*f+r*m)/(2*f*n*y),w=(l*l-f*f-r*m)/(2*l*n*y),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);g=(v-_)/e,x=function(A){var T=A*g,E=cC(_),N=f/(n*y)*(E*iU(e*T+_)-oU(_));return[a+N*d,c+N*h,f*E/cC(e*T+_)]}}return x.duration=g*1e3*e/Math.SQRT2,x}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},o}(Math.SQRT2,2,4);function fC(t){return function(e,n){var r=t((e=yp(e)).h,(n=yp(n)).h),o=re(e.s,n.s),i=re(e.l,n.l),s=re(e.opacity,n.opacity);return function(a){return e.h=r(a),e.s=o(a),e.l=i(a),e.opacity=s(a),e+""}}}var $_=fC(xf),sU=fC(re);function Yx(t,e){var n=re((t=hf(t)).l,(e=hf(e)).l),r=re(t.a,e.a),o=re(t.b,e.b),i=re(t.opacity,e.opacity);return function(s){return t.l=n(s),t.a=r(s),t.b=o(s),t.opacity=i(s),t+""}}function uC(t){return function(e,n){var r=t((e=bp(e)).h,(n=bp(n)).h),o=re(e.c,n.c),i=re(e.l,n.l),s=re(e.opacity,n.opacity);return function(a){return e.h=r(a),e.c=o(a),e.l=i(a),e.opacity=s(a),e+""}}}var D_=uC(xf),aU=uC(re);function lC(t){return function e(n){n=+n;function r(o,i){var s=t((o=Cn(o)).h,(i=Cn(i)).h),a=re(o.s,i.s),c=re(o.l,i.l),f=re(o.opacity,i.opacity);return function(u){return o.h=s(u),o.s=a(u),o.l=c(Math.pow(u,n)),o.opacity=f(u),o+""}}return r.gamma=e,r}(1)}var cU=lC(xf),gf=lC(re);function go(t,e){e===void 0&&(e=t,t=rr);for(var n=0,r=e.length-1,o=e[0],i=new Array(r<0?0:r);n<r;)i[n]=t(o,o=e[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return i[a](s-a)}}function mn(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}var yf=0,Sp=0,_p=0,dC=1e3,Ux,Mp,jx=0,Da=0,Xx=0,Ap=typeof performance=="object"&&performance.now?performance:Date,hC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ep(){return Da||(hC(fU),Da=Ap.now()+Xx)}function fU(){Da=0}function Tp(){this._call=this._time=this._next=null}Tp.prototype=Wx.prototype={constructor:Tp,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ep():+n)+(e==null?0:+e),!this._next&&Mp!==this&&(Mp?Mp._next=this:Ux=this,Mp=this),this._call=t,this._time=n,P_()},stop:function(){this._call&&(this._call=null,this._time=1/0,P_())}};function Wx(t,e,n){var r=new Tp;return r.restart(t,e,n),r}function mC(){Ep(),++yf;for(var t=Ux,e;t;)(e=Da-t._time)>=0&&t._call.call(void 0,e),t=t._next;--yf}function pC(){Da=(jx=Ap.now())+Xx,yf=Sp=0;try{mC()}finally{yf=0,lU(),Da=0}}function uU(){var t=Ap.now(),e=t-jx;e>dC&&(Xx-=e,jx=t)}function lU(){for(var t,e=Ux,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ux=n);Mp=t,P_(r)}function P_(t){if(!yf){Sp&&(Sp=clearTimeout(Sp));var e=t-Da;e>24?(t<1/0&&(Sp=setTimeout(pC,t-Ap.now()-Xx)),_p&&(_p=clearInterval(_p))):(_p||(jx=Ap.now(),_p=setInterval(uU,dC)),yf=1,hC(pC))}}function Vx(t,e,n){var r=new Tp;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var pU=Na("start","end","cancel","interrupt"),dU=[],yC=0,xC=1,Hx=2,Gx=3,gC=4,Qx=5,Ip=6;function ds(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;hU(t,n,{name:e,index:r,group:o,on:pU,tween:dU,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:yC})}function Np(t,e){var n=Re(t,e);if(n.state>yC)throw new Error("too late; already scheduled");return n}function an(t,e){var n=Re(t,e);if(n.state>Gx)throw new Error("too late; already running");return n}function Re(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function hU(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Wx(i,0,n.time);function i(f){n.state=xC,n.timer.restart(s,n.delay,n.time),n.delay<=f&&s(f-n.delay)}function s(f){var u,p,l,d;if(n.state!==xC)return c();for(u in r)if(d=r[u],d.name===n.name){if(d.state===Gx)return Vx(s);d.state===gC?(d.state=Ip,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[u]):+u<e&&(d.state=Ip,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[u])}if(Vx(function(){n.state===Gx&&(n.state=gC,n.timer.restart(a,n.delay,n.time),a(f))}),n.state=Hx,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Hx){for(n.state=Gx,o=new Array(l=n.tween.length),u=0,p=-1;u<l;++u)(d=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(o[++p]=d);o.length=p+1}}function a(f){for(var u=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(c),n.state=Qx,1),p=-1,l=o.length;++p<l;)o[p].call(t,u);n.state===Qx&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ip,n.timer.stop(),delete r[e];for(var f in r)return;delete t.__transition}}function yo(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){i=!1;continue}o=r.state>Hx&&r.state<Qx,r.state=Ip,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function bC(t){return this.each(function(){yo(this,t)})}function mU(t,e){var n,r;return function(){var o=an(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function xU(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=an(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:e,value:n},c=0,f=o.length;c<f;++c)if(o[c].name===e){o[c]=a;break}c===f&&o.push(a)}i.tween=o}}function wC(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Re(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===t)return s.value;return null}return this.each((e==null?mU:xU)(n,t,e))}function bf(t,e,n){var r=t._id;return t.each(function(){var o=an(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return Re(o,r).value[e]}}function Zx(t,e){var n;return(typeof e=="number"?ee:e instanceof nr?Ar:(n=nr(e))?(e=n,Ar):vp)(t,e)}function gU(t){return function(){this.removeAttribute(t)}}function yU(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bU(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function wU(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function vU(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function _U(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function vC(t,e){var n=di(t),r=n==="transform"?R_:Zx;return this.attrTween(t,typeof e=="function"?(n.local?_U:vU)(n,r,bf(this,"attr."+t,e)):e==null?(n.local?yU:gU)(n):(n.local?wU:bU)(n,r,e))}function SU(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function MU(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function AU(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&MU(t,i)),n}return o._value=e,o}function TU(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&SU(t,i)),n}return o._value=e,o}function _C(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=di(t);return this.tween(n,(r.local?AU:TU)(r,e))}function EU(t,e){return function(){Np(this,t).delay=+e.apply(this,arguments)}}function IU(t,e){return e=+e,function(){Np(this,t).delay=e}}function SC(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?EU:IU)(e,t)):Re(this.node(),e).delay}function NU(t,e){return function(){an(this,t).duration=+e.apply(this,arguments)}}function CU(t,e){return e=+e,function(){an(this,t).duration=e}}function MC(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?NU:CU)(e,t)):Re(this.node(),e).duration}function kU(t,e){if(typeof e!="function")throw new Error;return function(){an(this,t).ease=e}}function AC(t){var e=this._id;return arguments.length?this.each(kU(e,t)):Re(this.node(),e).ease}function LU(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;an(this,t).ease=n}}function TC(t){if(typeof t!="function")throw new Error;return this.each(LU(this._id,t))}function EC(t){typeof t!="function"&&(t=pp(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,f=0;f<s;++f)(c=i[f])&&t.call(c,c.__data__,f,i)&&a.push(c);return new kn(r,this._parents,this._name,this._id)}function IC(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=e[a],f=n[a],u=c.length,p=s[a]=new Array(u),l,d=0;d<u;++d)(l=c[d]||f[d])&&(p[d]=l);for(;a<r;++a)s[a]=e[a];return new kn(s,this._parents,this._name,this._id)}function RU(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function OU(t,e,n){var r,o,i=RU(e)?Np:an;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function NC(t,e){var n=this._id;return arguments.length<2?Re(this.node(),n).on.on(t):this.each(OU(n,t,e))}function $U(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function CC(){return this.on("end.remove",$U(this._id))}function kC(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ca(t));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,f=i[s]=new Array(c),u,p,l=0;l<c;++l)(u=a[l])&&(p=t.call(u,u.__data__,l,a))&&("__data__"in u&&(p.__data__=u.__data__),f[l]=p,ds(f[l],e,n,l,f,Re(u,n)));return new kn(i,this._parents,e,n)}function LC(t){var e=this._name,n=this._id;typeof t!="function"&&(t=lp(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],f=c.length,u,p=0;p<f;++p)if(u=c[p]){for(var l=t.call(u,u.__data__,p,c),d,h=Re(u,n),m=0,x=l.length;m<x;++m)(d=l[m])&&ds(d,e,n,m,l,h);i.push(l),s.push(u)}return new kn(i,s,e,n)}var DU=mi.prototype.constructor;function RC(){return new DU(this._groups,this._parents)}function PU(t,e){var n,r,o;return function(){var i=us(this,t),s=(this.style.removeProperty(t),us(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function OC(t){return function(){this.style.removeProperty(t)}}function FU(t,e,n){var r,o=n+"",i;return function(){var s=us(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function qU(t,e,n){var r,o,i;return function(){var s=us(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),us(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a))}}function BU(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var c=an(this,t),f=c.on,u=c.value[i]==null?a||(a=OC(e)):void 0;(f!==n||o!==u)&&(r=(n=f).copy()).on(s,o=u),c.on=r}}function $C(t,e,n){var r=(t+="")=="transform"?L_:Zx;return e==null?this.styleTween(t,PU(t,r)).on("end.style."+t,OC(t)):typeof e=="function"?this.styleTween(t,qU(t,r,bf(this,"style."+t,e))).each(BU(this._id,t)):this.styleTween(t,FU(t,r,e),n).on("end.style."+t,null)}function zU(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function YU(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&zU(t,s,n)),r}return i._value=e,i}function DC(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,YU(t,e,n??""))}function UU(t){return function(){this.textContent=t}}function jU(t){return function(){var e=t(this);this.textContent=e??""}}function PC(t){return this.tween("text",typeof t=="function"?jU(bf(this,"text",t)):UU(t==null?"":t+""))}function XU(t){return function(e){this.textContent=t.call(this,e)}}function WU(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&XU(o)),e}return r._value=t,r}function FC(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,WU(t))}function qC(){for(var t=this._name,e=this._id,n=Jx(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,f=0;f<a;++f)if(c=s[f]){var u=Re(c,e);ds(c,t,n,f,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new kn(r,this._parents,t,n)}function BC(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var f=an(this,r),u=f.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),f.on=e}),o===0&&i()})}var VU=0;function kn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function zC(t){return mi().transition(t)}function Jx(){return++VU}var yi=mi.prototype;kn.prototype=zC.prototype={constructor:kn,select:kC,selectAll:LC,selectChild:yi.selectChild,selectChildren:yi.selectChildren,filter:EC,merge:IC,selection:RC,transition:qC,call:yi.call,nodes:yi.nodes,node:yi.node,size:yi.size,empty:yi.empty,each:yi.each,on:NC,attr:vC,attrTween:_C,style:$C,styleTween:DC,text:PC,textTween:FC,remove:CC,tween:wC,delay:SC,duration:MC,ease:AC,easeVarying:TC,end:BC,[Symbol.iterator]:yi[Symbol.iterator]};function Kx(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var GU={time:null,delay:0,duration:250,ease:Kx};function HU(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function YC(t){var e,n;t instanceof kn?(e=t._id,t=t._name):(e=Jx(),(n=GU).time=Ep(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&ds(c,t,e,f,s,n||HU(c,e));return new kn(r,this._parents,t,e)}mi.prototype.interrupt=bC;mi.prototype.transition=YC;var tg=t=>()=>t;function F_(t,{sourceEvent:e,target:n,selection:r,mode:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function UC(t){t.stopImmediatePropagation()}function eg(t){t.preventDefault(),t.stopImmediatePropagation()}var jC={name:"drag"},q_={name:"space"},wf={name:"handle"},vf={name:"center"},{abs:XC,max:xn,min:gn}=Math;function WC(t){return[+t[0],+t[1]]}function z_(t){return[WC(t[0]),WC(t[1])]}var ng={name:"x",handles:["w","e"].map(Cp),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},rg={name:"y",handles:["n","s"].map(Cp),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},QU={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Cp),input:function(t){return t==null?null:z_(t)},output:function(t){return t}},bi={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"},VC={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},GC={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},ZU={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},JU={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Cp(t){return{type:t}}function KU(t){return!t.ctrlKey&&!t.button}function tj(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function ej(){return navigator.maxTouchPoints||"ontouchstart"in this}function B_(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function nj(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Y_(){return X_(ng)}function U_(){return X_(rg)}function j_(){return X_(QU)}function X_(t){var e=tj,n=KU,r=ej,o=!0,i=Na("start","brush","end"),s=6,a;function c(x){var g=x.property("__brush",m).selectAll(".overlay").data([Cp("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",bi.overlay).merge(g).each(function(){var b=B_(this).extent;Nt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),x.selectAll(".selection").data([Cp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",bi.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var y=x.selectAll(".handle").data(t.handles,function(b){return b.type});y.exit().remove(),y.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return bi[b.type]}),x.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",l).filter(r).on("touchstart.brush",l).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",h).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(x,g,y){x.tween?x.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,_=u(b,arguments),v=w.selection,A=t.input(typeof g=="function"?g.apply(this,arguments):g,w.extent),T=rr(v,A);function E(N){w.selection=N===1&&A===null?null:T(N),f.call(b),_.brush()}return v!==null&&A!==null?E:E(1)}):x.each(function(){var b=this,w=arguments,_=b.__brush,v=t.input(typeof g=="function"?g.apply(b,w):g,_.extent),A=u(b,w).beforestart();yo(b),_.selection=v===null?null:v,f.call(b),A.start(y).brush(y).end(y)})},c.clear=function(x,g){c.move(x,null,g)};function f(){var x=Nt(this),g=B_(this).selection;g?(x.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),x.selectAll(".handle").style("display",null).attr("x",function(y){return y.type[y.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(y){return y.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(y){return y.type==="n"||y.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(y){return y.type==="e"||y.type==="w"?g[1][1]-g[0][1]+s:s})):x.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(x,g,y){var b=x.__brush.emitter;return b&&(!y||!b.clean)?b:new p(x,g,y)}function p(x,g,y){this.that=x,this.args=g,this.state=x.__brush,this.active=0,this.clean=y}p.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(x,g){return this.starting?(this.starting=!1,this.emit("start",x,g)):this.emit("brush",x),this},brush:function(x,g){return this.emit("brush",x,g),this},end:function(x,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",x,g)),this},emit:function(x,g,y){var b=Nt(this.that).datum();i.call(x,this.that,new F_(x,{sourceEvent:g,target:c,selection:t.output(this.state.selection),mode:y,dispatch:i}),b)}};function l(x){if(a&&!x.touches||!n.apply(this,arguments))return;var g=this,y=x.target.__data__.type,b=(o&&x.metaKey?y="overlay":y)==="selection"?jC:o&&x.altKey?vf:wf,w=t===rg?null:ZU[y],_=t===ng?null:JU[y],v=B_(g),A=v.extent,T=v.selection,E=A[0][0],N,M,k=A[0][1],O,S,I=A[1][0],C,L,D=A[1][1],$,P,F=0,q=0,V,K=w&&_&&o&&x.shiftKey,et,rt,j=Array.from(x.touches||[x],Z=>{let jt=Z.identifier;return Z=hn(Z,g),Z.point0=Z.slice(),Z.identifier=jt,Z});yo(g);var nt=u(g,arguments,!0).beforestart();if(y==="overlay"){T&&(V=!0);let Z=[j[0],j[1]||j[0]];v.selection=T=[[N=t===rg?E:gn(Z[0][0],Z[1][0]),O=t===ng?k:gn(Z[0][1],Z[1][1])],[C=t===rg?I:xn(Z[0][0],Z[1][0]),$=t===ng?D:xn(Z[0][1],Z[1][1])]],j.length>1&&_t(x)}else N=T[0][0],O=T[0][1],C=T[1][0],$=T[1][1];M=N,S=O,L=C,P=$;var Y=Nt(g).attr("pointer-events","none"),G=Y.selectAll(".overlay").attr("cursor",bi[y]);if(x.touches)nt.moved=B,nt.ended=ct;else{var tt=Nt(x.view).on("mousemove.brush",B,!0).on("mouseup.brush",ct,!0);o&&tt.on("keydown.brush",Ct,!0).on("keyup.brush",Lt,!0),hp(x.view)}f.call(g),nt.start(x,b.name);function B(Z){for(let jt of Z.changedTouches||[Z])for(let Qn of j)Qn.identifier===jt.identifier&&(Qn.cur=hn(jt,g));if(K&&!et&&!rt&&j.length===1){let jt=j[0];XC(jt.cur[0]-jt[0])>XC(jt.cur[1]-jt[1])?rt=!0:et=!0}for(let jt of j)jt.cur&&(jt[0]=jt.cur[0],jt[1]=jt.cur[1]);V=!0,eg(Z),_t(Z)}function _t(Z){let jt=j[0],Qn=jt.point0;var ro;switch(F=jt[0]-Qn[0],q=jt[1]-Qn[1],b){case q_:case jC:{w&&(F=xn(E-N,gn(I-C,F)),M=N+F,L=C+F),_&&(q=xn(k-O,gn(D-$,q)),S=O+q,P=$+q);break}case wf:{j[1]?(w&&(M=xn(E,gn(I,j[0][0])),L=xn(E,gn(I,j[1][0])),w=1),_&&(S=xn(k,gn(D,j[0][1])),P=xn(k,gn(D,j[1][1])),_=1)):(w<0?(F=xn(E-N,gn(I-N,F)),M=N+F,L=C):w>0&&(F=xn(E-C,gn(I-C,F)),M=N,L=C+F),_<0?(q=xn(k-O,gn(D-O,q)),S=O+q,P=$):_>0&&(q=xn(k-$,gn(D-$,q)),S=O,P=$+q));break}case vf:{w&&(M=xn(E,gn(I,N-F*w)),L=xn(E,gn(I,C+F*w))),_&&(S=xn(k,gn(D,O-q*_)),P=xn(k,gn(D,$+q*_)));break}}L<M&&(w*=-1,ro=N,N=C,C=ro,ro=M,M=L,L=ro,y in VC&&G.attr("cursor",bi[y=VC[y]])),P<S&&(_*=-1,ro=O,O=$,$=ro,ro=S,S=P,P=ro,y in GC&&G.attr("cursor",bi[y=GC[y]])),v.selection&&(T=v.selection),et&&(M=T[0][0],L=T[1][0]),rt&&(S=T[0][1],P=T[1][1]),(T[0][0]!==M||T[0][1]!==S||T[1][0]!==L||T[1][1]!==P)&&(v.selection=[[M,S],[L,P]],f.call(g),nt.brush(Z,b.name))}function ct(Z){if(UC(Z),Z.touches){if(Z.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else mp(Z.view,V),tt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Y.attr("pointer-events","all"),G.attr("cursor",bi.overlay),v.selection&&(T=v.selection),nj(T)&&(v.selection=null,f.call(g)),nt.end(Z,b.name)}function Ct(Z){switch(Z.keyCode){case 16:{K=w&&_;break}case 18:{b===wf&&(w&&(C=L-F*w,N=M+F*w),_&&($=P-q*_,O=S+q*_),b=vf,_t(Z));break}case 32:{(b===wf||b===vf)&&(w<0?C=L-F:w>0&&(N=M-F),_<0?$=P-q:_>0&&(O=S-q),b=q_,G.attr("cursor",bi.selection),_t(Z));break}default:return}eg(Z)}function Lt(Z){switch(Z.keyCode){case 16:{K&&(et=rt=K=!1,_t(Z));break}case 18:{b===vf&&(w<0?C=L:w>0&&(N=M),_<0?$=P:_>0&&(O=S),b=wf,_t(Z));break}case 32:{b===q_&&(Z.altKey?(w&&(C=L-F*w,N=M+F*w),_&&($=P-q*_,O=S+q*_),b=vf):(w<0?C=L:w>0&&(N=M),_<0?$=P:_>0&&(O=S),b=wf),G.attr("cursor",bi[y]),_t(Z));break}default:return}eg(Z)}}function d(x){u(this,arguments).moved(x)}function h(x){u(this,arguments).ended(x)}function m(){var x=this.__brush||{selection:null};return x.extent=z_(e.apply(this,arguments)),x.dim=t,x}return c.extent=function(x){return arguments.length?(e=typeof x=="function"?x:tg(z_(x)),c):e},c.filter=function(x){return arguments.length?(n=typeof x=="function"?x:tg(!!x),c):n},c.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:tg(!!x),c):r},c.handleSize=function(x){return arguments.length?(s=+x,c):s},c.keyModifiers=function(x){return arguments.length?(o=!!x,c):o},c.on=function(){var x=i.on.apply(i,arguments);return x===i?c:x},c}var W_=Math.PI,V_=2*W_,Pa=1e-6,rj=V_-Pa;function HC(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function oj(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return HC;let n=10**e;return function(r){this._+=r[0];for(let o=1,i=r.length;o<i;++o)this._+=Math.round(arguments[o]*n)/n+r[o]}}var hs=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?HC:oj(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,o){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+o}`}bezierCurveTo(e,n,r,o,i,s){this._append`C${+e},${+n},${+r},${+o},${this._x1=+i},${this._y1=+s}`}arcTo(e,n,r,o,i){if(e=+e,n=+n,r=+r,o=+o,i=+i,i<0)throw new Error(`negative radius: ${i}`);let s=this._x1,a=this._y1,c=r-e,f=o-n,u=s-e,p=a-n,l=u*u+p*p;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(l>Pa)if(!(Math.abs(p*c-f*u)>Pa)||!i)this._append`L${this._x1=e},${this._y1=n}`;else{let d=r-s,h=o-a,m=c*c+f*f,x=d*d+h*h,g=Math.sqrt(m),y=Math.sqrt(l),b=i*Math.tan((W_-Math.acos((m+l-x)/(2*g*y)))/2),w=b/y,_=b/g;Math.abs(w-1)>Pa&&this._append`L${e+w*u},${n+w*p}`,this._append`A${i},${i},0,0,${+(p*d>u*h)},${this._x1=e+_*c},${this._y1=n+_*f}`}}arc(e,n,r,o,i,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(o),c=r*Math.sin(o),f=e+a,u=n+c,p=1^s,l=s?o-i:i-o;this._x1===null?this._append`M${f},${u}`:(Math.abs(this._x1-f)>Pa||Math.abs(this._y1-u)>Pa)&&this._append`L${f},${u}`,r&&(l<0&&(l=l%V_+V_),l>rj?this._append`A${r},${r},0,1,${p},${e-a},${n-c}A${r},${r},0,1,${p},${this._x1=f},${this._y1=u}`:l>Pa&&this._append`A${r},${r},0,${+(l>=W_)},${p},${this._x1=e+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(e,n,r,o){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+o}h${-r}Z`}toString(){return this._}};function QC(){return new hs}QC.prototype=hs.prototype;function Ln(t=3){return new hs(+t)}var ij=Array.prototype,og=ij.slice;function ZC(t,e){return t-e}function JC(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}var bo=t=>()=>t;function KC(t,e){for(var n=-1,r=e.length,o;++n<r;)if(o=sj(t,e[n]))return o;return 0}function sj(t,e){for(var n=e[0],r=e[1],o=-1,i=0,s=t.length,a=s-1;i<s;a=i++){var c=t[i],f=c[0],u=c[1],p=t[a],l=p[0],d=p[1];if(aj(c,p,e))return 0;u>r!=d>r&&n<(l-f)*(r-u)/(d-u)+f&&(o=-o)}return o}function aj(t,e,n){var r;return cj(t,e,n)&&fj(t[r=+(t[0]===e[0])],n[r],e[r])}function cj(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}function fj(t,e,n){return t<=e&&e<=n||n<=e&&e<=t}function t9(){}var wi=[[],[[[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 ms(){var t=1,e=1,n=cs,r=c;function o(f){var u=n(f);if(Array.isArray(u))u=u.slice().sort(ZC);else{let p=Ft(f,uj);for(u=on(...ff(p[0],p[1],u),u);u[u.length-1]>=p[1];)u.pop();for(;u[1]<p[0];)u.shift()}return u.map(p=>i(f,p))}function i(f,u){let p=u==null?NaN:+u;if(isNaN(p))throw new Error(`invalid value: ${u}`);var l=[],d=[];return s(f,p,function(h){r(h,f,p),JC(h)>0?l.push([h]):d.push(h)}),d.forEach(function(h){for(var m=0,x=l.length,g;m<x;++m)if(KC((g=l[m])[0],h)!==-1){g.push(h);return}}),{type:"MultiPolygon",value:u,coordinates:l}}function s(f,u,p){var l=new Array,d=new Array,h,m,x,g,y,b;for(h=m=-1,g=Fa(f[0],u),wi[g<<1].forEach(w);++h<t-1;)x=g,g=Fa(f[h+1],u),wi[x|g<<1].forEach(w);for(wi[g<<0].forEach(w);++m<e-1;){for(h=-1,g=Fa(f[m*t+t],u),y=Fa(f[m*t],u),wi[g<<1|y<<2].forEach(w);++h<t-1;)x=g,g=Fa(f[m*t+t+h+1],u),b=y,y=Fa(f[m*t+h+1],u),wi[x|g<<1|y<<2|b<<3].forEach(w);wi[g|y<<3].forEach(w)}for(h=-1,y=f[m*t]>=u,wi[y<<2].forEach(w);++h<t-1;)b=y,y=Fa(f[m*t+h+1],u),wi[y<<2|b<<3].forEach(w);wi[y<<3].forEach(w);function w(_){var v=[_[0][0]+h,_[0][1]+m],A=[_[1][0]+h,_[1][1]+m],T=a(v),E=a(A),N,M;(N=d[T])?(M=l[E])?(delete d[N.end],delete l[M.start],N===M?(N.ring.push(A),p(N.ring)):l[N.start]=d[M.end]={start:N.start,end:M.end,ring:N.ring.concat(M.ring)}):(delete d[N.end],N.ring.push(A),d[N.end=E]=N):(N=l[E])?(M=d[T])?(delete l[N.start],delete d[M.end],N===M?(N.ring.push(A),p(N.ring)):l[M.start]=d[N.end]={start:M.start,end:N.end,ring:M.ring.concat(N.ring)}):(delete l[N.start],N.ring.unshift(v),l[N.start=T]=N):l[T]=d[E]={start:T,end:E,ring:[v,A]}}}function a(f){return f[0]*2+f[1]*(t+1)*4}function c(f,u,p){f.forEach(function(l){var d=l[0],h=l[1],m=d|0,x=h|0,g=G_(u[x*t+m]);d>0&&d<t&&m===d&&(l[0]=e9(d,G_(u[x*t+m-1]),g,p)),h>0&&h<e&&x===h&&(l[1]=e9(h,G_(u[(x-1)*t+m]),g,p))})}return o.contour=i,o.size=function(f){if(!arguments.length)return[t,e];var u=Math.floor(f[0]),p=Math.floor(f[1]);if(!(u>=0&&p>=0))throw new Error("invalid size");return t=u,e=p,o},o.thresholds=function(f){return arguments.length?(n=typeof f=="function"?f:Array.isArray(f)?bo(og.call(f)):bo(f),o):n},o.smooth=function(f){return arguments.length?(r=f?c:t9,o):r===c},o}function uj(t){return isFinite(t)?t:NaN}function Fa(t,e){return t==null?!1:+t>=e}function G_(t){return t==null||isNaN(t=+t)?-1/0:t}function e9(t,e,n,r){let o=r-e,i=n-e,s=isFinite(o)||isFinite(i)?o/i:Math.sign(o)/Math.sign(i);return isNaN(s)?t:t+s-.5}function lj(t){return t[0]}function pj(t){return t[1]}function dj(){return 1}function H_(){var t=lj,e=pj,n=dj,r=960,o=500,i=20,s=2,a=i*3,c=r+a*2>>s,f=o+a*2>>s,u=bo(20);function p(y){var b=new Float32Array(c*f),w=Math.pow(2,-s),_=-1;for(let O of y){var v=(t(O,++_,y)+a)*w,A=(e(O,_,y)+a)*w,T=+n(O,_,y);if(T&&v>=0&&v<c&&A>=0&&A<f){var E=Math.floor(v),N=Math.floor(A),M=v-E-.5,k=A-N-.5;b[E+N*c]+=(1-M)*(1-k)*T,b[E+1+N*c]+=M*(1-k)*T,b[E+1+(N+1)*c]+=M*k*T,b[E+(N+1)*c]+=(1-M)*k*T}}return ip({data:b,width:c,height:f},i*w),b}function l(y){var b=p(y),w=u(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=on(Number.MIN_VALUE,kt(b)/_,w)),ms().size([c,f]).thresholds(w.map(v=>v*_))(b).map((v,A)=>(v.value=+w[A],d(v)))}l.contours=function(y){var b=p(y),w=ms().size([c,f]),_=Math.pow(2,2*s),v=A=>{A=+A;var T=d(w.contour(b,A*_));return T.value=A,T};return Object.defineProperty(v,"max",{get:()=>kt(b)/_}),v};function d(y){return y.coordinates.forEach(h),y}function h(y){y.forEach(m)}function m(y){y.forEach(x)}function x(y){y[0]=y[0]*Math.pow(2,s)-a,y[1]=y[1]*Math.pow(2,s)-a}function g(){return a=i*3,c=r+a*2>>s,f=o+a*2>>s,l}return l.x=function(y){return arguments.length?(t=typeof y=="function"?y:bo(+y),l):t},l.y=function(y){return arguments.length?(e=typeof y=="function"?y:bo(+y),l):e},l.weight=function(y){return arguments.length?(n=typeof y=="function"?y:bo(+y),l):n},l.size=function(y){if(!arguments.length)return[r,o];var b=+y[0],w=+y[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,o=w,g()},l.cellSize=function(y){if(!arguments.length)return 1<<s;if(!((y=+y)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(y)/Math.LN2),g()},l.thresholds=function(y){return arguments.length?(u=typeof y=="function"?y:Array.isArray(y)?bo(og.call(y)):bo(y),l):u},l.bandwidth=function(y){if(!arguments.length)return Math.sqrt(i*(i+1));if(!((y=+y)>=0))throw new Error("invalid bandwidth");return i=(Math.sqrt(4*y*y+1)-1)/2,g()},l}var $t=11102230246251565e-32,Me=134217729,kp=(3+8*$t)*$t;function qa(t,e,n,r,o){let i,s,a,c,f=e[0],u=r[0],p=0,l=0;u>f==u>-f?(i=f,f=e[++p]):(i=u,u=r[++l]);let d=0;if(p<t&&l<n)for(u>f==u>-f?(s=f+i,a=i-(s-f),f=e[++p]):(s=u+i,a=i-(s-u),u=r[++l]),i=s,a!==0&&(o[d++]=a);p<t&&l<n;)u>f==u>-f?(s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++p]):(s=i+u,c=s-i,a=i-(s-c)+(u-c),u=r[++l]),i=s,a!==0&&(o[d++]=a);for(;p<t;)s=i+f,c=s-i,a=i-(s-c)+(f-c),f=e[++p],i=s,a!==0&&(o[d++]=a);for(;l<n;)s=i+u,c=s-i,a=i-(s-c)+(u-c),u=r[++l],i=s,a!==0&&(o[d++]=a);return(i!==0||d===0)&&(o[d++]=i),d}function Lp(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function U(t){return new Float64Array(t)}var hj=(3+16*$t)*$t,mj=(2+12*$t)*$t,xj=(9+64*$t)*$t*$t,_f=U(4),n9=U(8),r9=U(12),o9=U(16),Rn=U(4);function gj(t,e,n,r,o,i,s){let a,c,f,u,p,l,d,h,m,x,g,y,b,w,_,v,A,T,E=t-o,N=n-o,M=e-i,k=r-i;w=E*k,l=Me*E,d=l-(l-E),h=E-d,l=Me*k,m=l-(l-k),x=k-m,_=h*x-(w-d*m-h*m-d*x),v=M*N,l=Me*M,d=l-(l-M),h=M-d,l=Me*N,m=l-(l-N),x=N-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,_f[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,_f[1]=b-(g+p)+(p-v),T=y+g,p=T-y,_f[2]=y-(T-p)+(g-p),_f[3]=T;let O=Lp(4,_f),S=mj*s;if(O>=S||-O>=S||(p=t-E,a=t-(E+p)+(p-o),p=n-N,f=n-(N+p)+(p-o),p=e-M,c=e-(M+p)+(p-i),p=r-k,u=r-(k+p)+(p-i),a===0&&c===0&&f===0&&u===0)||(S=xj*s+kp*Math.abs(O),O+=E*u+k*a-(M*f+N*c),O>=S||-O>=S))return O;w=a*k,l=Me*a,d=l-(l-a),h=a-d,l=Me*k,m=l-(l-k),x=k-m,_=h*x-(w-d*m-h*m-d*x),v=c*N,l=Me*c,d=l-(l-c),h=c-d,l=Me*N,m=l-(l-N),x=N-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,Rn[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,Rn[1]=b-(g+p)+(p-v),T=y+g,p=T-y,Rn[2]=y-(T-p)+(g-p),Rn[3]=T;let I=qa(4,_f,4,Rn,n9);w=E*u,l=Me*E,d=l-(l-E),h=E-d,l=Me*u,m=l-(l-u),x=u-m,_=h*x-(w-d*m-h*m-d*x),v=M*f,l=Me*M,d=l-(l-M),h=M-d,l=Me*f,m=l-(l-f),x=f-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,Rn[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,Rn[1]=b-(g+p)+(p-v),T=y+g,p=T-y,Rn[2]=y-(T-p)+(g-p),Rn[3]=T;let C=qa(I,n9,4,Rn,r9);w=a*u,l=Me*a,d=l-(l-a),h=a-d,l=Me*u,m=l-(l-u),x=u-m,_=h*x-(w-d*m-h*m-d*x),v=c*f,l=Me*c,d=l-(l-c),h=c-d,l=Me*f,m=l-(l-f),x=f-m,A=h*x-(v-d*m-h*m-d*x),g=_-A,p=_-g,Rn[0]=_-(g+p)+(p-A),y=w+g,p=y-w,b=w-(y-p)+(g-p),g=b-v,p=b-g,Rn[1]=b-(g+p)+(p-v),T=y+g,p=T-y,Rn[2]=y-(T-p)+(g-p),Rn[3]=T;let L=qa(C,r9,4,Rn,o9);return o9[L-1]}function Sf(t,e,n,r,o,i){let s=(e-i)*(n-o),a=(t-o)*(r-i),c=s-a,f=Math.abs(s+a);return Math.abs(c)>=hj*f?c:-gj(t,e,n,r,o,i,f)}var d2t=(7+56*$t)*$t,h2t=(3+28*$t)*$t,m2t=(26+288*$t)*$t*$t,x2t=U(4),g2t=U(4),y2t=U(4),b2t=U(4),w2t=U(4),v2t=U(4),_2t=U(4),S2t=U(4),M2t=U(4),A2t=U(8),T2t=U(8),E2t=U(8),I2t=U(4),N2t=U(8),C2t=U(8),k2t=U(8),L2t=U(12),R2t=U(192),O2t=U(192);var P2t=(10+96*$t)*$t,F2t=(4+48*$t)*$t,q2t=(44+576*$t)*$t*$t,B2t=U(4),z2t=U(4),Y2t=U(4),U2t=U(4),j2t=U(4),X2t=U(4),W2t=U(4),V2t=U(4),G2t=U(8),H2t=U(8),Q2t=U(8),Z2t=U(8),J2t=U(8),K2t=U(8),twt=U(8),ewt=U(8),nwt=U(8),rwt=U(4),owt=U(4),iwt=U(4),swt=U(8),awt=U(16),cwt=U(16),fwt=U(16),uwt=U(32),lwt=U(32),pwt=U(48),dwt=U(64),hwt=U(1152),mwt=U(1152);var bwt=(16+224*$t)*$t,wwt=(5+72*$t)*$t,vwt=(71+1408*$t)*$t*$t,_wt=U(4),Swt=U(4),Mwt=U(4),Awt=U(4),Twt=U(4),Ewt=U(4),Iwt=U(4),Nwt=U(4),Cwt=U(4),kwt=U(4),Lwt=U(24),Rwt=U(24),Owt=U(24),$wt=U(24),Dwt=U(24),Pwt=U(24),Fwt=U(24),qwt=U(24),Bwt=U(24),zwt=U(24),Ywt=U(1152),Uwt=U(1152),jwt=U(1152),Xwt=U(1152),Wwt=U(1152),Vwt=U(2304),Gwt=U(2304),Hwt=U(3456),Qwt=U(5760),Zwt=U(8),Jwt=U(8),Kwt=U(8),tvt=U(16),evt=U(24),nvt=U(48),rvt=U(48),ovt=U(96),ivt=U(192),svt=U(384),avt=U(384),cvt=U(384),fvt=U(768);var uvt=U(96),lvt=U(96),pvt=U(96),dvt=U(1152);var s9=Math.pow(2,-52),ig=new Uint32Array(512),Af=class t{static from(e,n=Sj,r=Mj){let o=e.length,i=new Float64Array(o*2);for(let s=0;s<o;s++){let a=e[s];i[2*s]=n(a),i[2*s+1]=r(a)}return new t(i)}constructor(e){let n=e.length>>1;if(n>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:e,_hullPrev:n,_hullNext:r,_hullTri:o,_hullHash:i}=this,s=e.length>>1,a=1/0,c=1/0,f=-1/0,u=-1/0;for(let E=0;E<s;E++){let N=e[2*E],M=e[2*E+1];N<a&&(a=N),M<c&&(c=M),N>f&&(f=N),M>u&&(u=M),this._ids[E]=E}let p=(a+f)/2,l=(c+u)/2,d,h,m;for(let E=0,N=1/0;E<s;E++){let M=Q_(p,l,e[2*E],e[2*E+1]);M<N&&(d=E,N=M)}let x=e[2*d],g=e[2*d+1];for(let E=0,N=1/0;E<s;E++){if(E===d)continue;let M=Q_(x,g,e[2*E],e[2*E+1]);M<N&&M>0&&(h=E,N=M)}let y=e[2*h],b=e[2*h+1],w=1/0;for(let E=0;E<s;E++){if(E===d||E===h)continue;let N=vj(x,g,y,b,e[2*E],e[2*E+1]);N<w&&(m=E,w=N)}let _=e[2*m],v=e[2*m+1];if(w===1/0){for(let M=0;M<s;M++)this._dists[M]=e[2*M]-e[0]||e[2*M+1]-e[1];Mf(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),N=0;for(let M=0,k=-1/0;M<s;M++){let O=this._ids[M],S=this._dists[O];S>k&&(E[N++]=O,k=S)}this.hull=E.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Sf(x,g,y,b,_,v)<0){let E=h,N=y,M=b;h=m,y=_,b=v,m=E,_=N,v=M}let A=_j(x,g,y,b,_,v);this._cx=A.x,this._cy=A.y;for(let E=0;E<s;E++)this._dists[E]=Q_(e[2*E],e[2*E+1],A.x,A.y);Mf(this._ids,this._dists,0,s-1),this._hullStart=d;let T=3;r[d]=n[m]=h,r[h]=n[d]=m,r[m]=n[h]=d,o[d]=0,o[h]=1,o[m]=2,i.fill(-1),i[this._hashKey(x,g)]=d,i[this._hashKey(y,b)]=h,i[this._hashKey(_,v)]=m,this.trianglesLen=0,this._addTriangle(d,h,m,-1,-1,-1);for(let E=0,N,M;E<this._ids.length;E++){let k=this._ids[E],O=e[2*k],S=e[2*k+1];if(E>0&&Math.abs(O-N)<=s9&&Math.abs(S-M)<=s9||(N=O,M=S,k===d||k===h||k===m))continue;let I=0;for(let P=0,F=this._hashKey(O,S);P<this._hashSize&&(I=i[(F+P)%this._hashSize],!(I!==-1&&I!==r[I]));P++);I=n[I];let C=I,L;for(;L=r[C],Sf(O,S,e[2*C],e[2*C+1],e[2*L],e[2*L+1])>=0;)if(C=L,C===I){C=-1;break}if(C===-1)continue;let D=this._addTriangle(C,k,r[C],-1,-1,o[C]);o[k]=this._legalize(D+2),o[C]=D,T++;let $=r[C];for(;L=r[$],Sf(O,S,e[2*$],e[2*$+1],e[2*L],e[2*L+1])<0;)D=this._addTriangle($,k,L,o[k],-1,o[$]),o[k]=this._legalize(D+2),r[$]=$,T--,$=L;if(C===I)for(;L=n[C],Sf(O,S,e[2*L],e[2*L+1],e[2*C],e[2*C+1])<0;)D=this._addTriangle(L,k,C,-1,o[C],o[L]),this._legalize(D+2),o[L]=D,r[C]=C,T--,C=L;this._hullStart=n[k]=C,r[C]=n[$]=k,r[k]=$,i[this._hashKey(O,S)]=k,i[this._hashKey(e[2*C],e[2*C+1])]=C}this.hull=new Uint32Array(T);for(let E=0,N=this._hullStart;E<T;E++)this.hull[E]=N,N=r[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,n){return Math.floor(bj(e-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:n,_halfedges:r,coords:o}=this,i=0,s=0;for(;;){let a=r[e],c=e-e%3;if(s=c+(e+2)%3,a===-1){if(i===0)break;e=ig[--i];continue}let f=a-a%3,u=c+(e+1)%3,p=f+(a+2)%3,l=n[s],d=n[e],h=n[u],m=n[p];if(wj(o[2*l],o[2*l+1],o[2*d],o[2*d+1],o[2*h],o[2*h+1],o[2*m],o[2*m+1])){n[e]=m,n[a]=l;let g=r[p];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===p){this._hullTri[b]=e;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(e,g),this._link(a,r[s]),this._link(s,p);let y=f+(a+1)%3;i<ig.length&&(ig[i++]=y)}else{if(i===0)break;e=ig[--i]}}return s}_link(e,n){this._halfedges[e]=n,n!==-1&&(this._halfedges[n]=e)}_addTriangle(e,n,r,o,i,s){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,o),this._link(a+1,i),this._link(a+2,s),this.trianglesLen+=3,a}};function bj(t,e){let n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}function Q_(t,e,n,r){let o=t-n,i=e-r;return o*o+i*i}function wj(t,e,n,r,o,i,s,a){let c=t-s,f=e-a,u=n-s,p=r-a,l=o-s,d=i-a,h=c*c+f*f,m=u*u+p*p,x=l*l+d*d;return c*(p*x-m*d)-f*(u*x-m*l)+h*(u*d-p*l)<0}function vj(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,u=s*s+a*a,p=c*c+f*f,l=.5/(s*f-a*c),d=(f*u-a*p)*l,h=(s*p-c*u)*l;return d*d+h*h}function _j(t,e,n,r,o,i){let s=n-t,a=r-e,c=o-t,f=i-e,u=s*s+a*a,p=c*c+f*f,l=.5/(s*f-a*c),d=t+(f*u-a*p)*l,h=e+(s*p-c*u)*l;return{x:d,y:h}}function Mf(t,e,n,r){if(r-n<=20)for(let o=n+1;o<=r;o++){let i=t[o],s=e[i],a=o-1;for(;a>=n&&e[t[a]]>s;)t[a+1]=t[a--];t[a+1]=i}else{let o=n+r>>1,i=n+1,s=r;Rp(t,o,i),e[t[n]]>e[t[r]]&&Rp(t,n,r),e[t[i]]>e[t[r]]&&Rp(t,i,r),e[t[n]]>e[t[i]]&&Rp(t,n,i);let a=t[i],c=e[a];for(;;){do i++;while(e[t[i]]<c);do s--;while(e[t[s]]>c);if(s<i)break;Rp(t,i,s)}t[n+1]=t[s],t[s]=a,r-i+1>=s-n?(Mf(t,e,i,r),Mf(t,e,n,s-1)):(Mf(t,e,n,s-1),Mf(t,e,i,r))}}function Rp(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function Sj(t){return t[0]}function Mj(t){return t[1]}var Tr=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,n){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,n){this._+=`L${this._x1=+e},${this._y1=+n}`}arc(e,n,r){e=+e,n=+n,r=+r;let o=e+r,i=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${o},${i}`:(Math.abs(this._x1-o)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+o+","+i),r&&(this._+=`A${r},${r},0,1,1,${e-r},${n}A${r},${r},0,1,1,${this._x1=o},${this._y1=i}`)}rect(e,n,r,o){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${+r}v${+o}h${-r}Z`}value(){return this._||null}};var xs=class{constructor(){this._=[]}moveTo(e,n){this._.push([e,n])}closePath(){this._.push(this._[0].slice())}lineTo(e,n){this._.push([e,n])}value(){return this._.length?this._:null}};var Op=class{constructor(e,[n,r,o,i]=[0,0,960,500]){if(!((o=+o)>=(n=+n))||!((i=+i)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=o,this.xmin=n,this.ymax=i,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:n,triangles:r},vectors:o}=this,i,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,x=0,g=r.length,y,b;m<g;m+=3,x+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,A=e[w],T=e[w+1],E=e[_],N=e[_+1],M=e[v],k=e[v+1],O=E-A,S=N-T,I=M-A,C=k-T,L=(O*C-S*I)*2;if(Math.abs(L)<1e-9){if(i===void 0){i=s=0;for(let $ of n)i+=e[$*2],s+=e[$*2+1];i/=n.length,s/=n.length}let D=1e9*Math.sign((i-A)*C-(s-T)*I);y=(A+M)/2-D*C,b=(T+k)/2+D*I}else{let D=1/L,$=O*O+S*S,P=I*I+C*C;y=A+(C*$-S*P)*D,b=T+(O*P-I*$)*D}a[x]=y,a[x+1]=b}let c=n[n.length-1],f,u=c*4,p,l=e[2*c],d,h=e[2*c+1];o.fill(0);for(let m=0;m<n.length;++m)c=n[m],f=u,p=l,d=h,u=c*4,l=e[2*c],h=e[2*c+1],o[f+2]=o[u]=d-h,o[f+3]=o[u+1]=l-p}render(e){let n=e==null?e=new Tr:void 0,{delaunay:{halfedges:r,inedges:o,hull:i},circumcenters:s,vectors:a}=this;if(i.length<=1)return null;for(let u=0,p=r.length;u<p;++u){let l=r[u];if(l<u)continue;let d=Math.floor(u/3)*2,h=Math.floor(l/3)*2,m=s[d],x=s[d+1],g=s[h],y=s[h+1];this._renderSegment(m,x,g,y,e)}let c,f=i[i.length-1];for(let u=0;u<i.length;++u){c=f,f=i[u];let p=Math.floor(o[f]/3)*2,l=s[p],d=s[p+1],h=c*4,m=this._project(l,d,a[h+2],a[h+3]);m&&this._renderSegment(l,d,m[0],m[1],e)}return n&&n.value()}renderBounds(e){let n=e==null?e=new Tr:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(e,n){let r=n==null?n=new Tr:void 0,o=this._clip(e);if(o===null||!o.length)return;n.moveTo(o[0],o[1]);let i=o.length;for(;o[0]===o[i-2]&&o[1]===o[i-1]&&i>1;)i-=2;for(let s=2;s<i;s+=2)(o[s]!==o[s-2]||o[s+1]!==o[s-1])&&n.lineTo(o[s],o[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let n=0,r=e.length/2;n<r;++n){let o=this.cellPolygon(n);o&&(o.index=n,yield o)}}cellPolygon(e){let n=new xs;return this.renderCell(e,n),n.value()}_renderSegment(e,n,r,o,i){let s,a=this._regioncode(e,n),c=this._regioncode(r,o);a===0&&c===0?(i.moveTo(e,n),i.lineTo(r,o)):(s=this._clipSegment(e,n,r,o,a,c))&&(i.moveTo(s[0],s[1]),i.lineTo(s[2],s[3]))}contains(e,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(e,n,r)===e}*neighbors(e){let n=this._clip(e);if(n)for(let r of this.delaunay.neighbors(e)){let o=this._clip(r);if(o){t:for(let i=0,s=n.length;i<s;i+=2)for(let a=0,c=o.length;a<c;a+=2)if(n[i]===o[a]&&n[i+1]===o[a+1]&&n[(i+2)%s]===o[(a+c-2)%c]&&n[(i+3)%s]===o[(a+c-1)%c]){yield r;break t}}}}_cell(e){let{circumcenters:n,delaunay:{inedges:r,halfedges:o,triangles:i}}=this,s=r[e];if(s===-1)return null;let a=[],c=s;do{let f=Math.floor(c/3);if(a.push(n[f*2],n[f*2+1]),c=c%3===2?c-2:c+1,i[c]!==e)break;c=o[c]}while(c!==s&&c!==-1);return a}_clip(e){if(e===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(e);if(n===null)return null;let{vectors:r}=this,o=e*4;return this._simplify(r[o]||r[o+1]?this._clipInfinite(e,n,r[o],r[o+1],r[o+2],r[o+3]):this._clipFinite(e,n))}_clipFinite(e,n){let r=n.length,o=null,i,s,a=n[r-2],c=n[r-1],f,u=this._regioncode(a,c),p,l=0;for(let d=0;d<r;d+=2)if(i=a,s=c,a=n[d],c=n[d+1],f=u,u=this._regioncode(a,c),f===0&&u===0)p=l,l=0,o?o.push(a,c):o=[a,c];else{let h,m,x,g,y;if(f===0){if((h=this._clipSegment(i,s,a,c,f,u))===null)continue;[m,x,g,y]=h}else{if((h=this._clipSegment(a,c,i,s,u,f))===null)continue;[g,y,m,x]=h,p=l,l=this._edgecode(m,x),p&&l&&this._edge(e,p,l,o,o.length),o?o.push(m,x):o=[m,x]}p=l,l=this._edgecode(g,y),p&&l&&this._edge(e,p,l,o,o.length),o?o.push(g,y):o=[g,y]}if(o)p=l,l=this._edgecode(o[0],o[1]),p&&l&&this._edge(e,p,l,o,o.length);else if(this.contains(e,(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 o}_clipSegment(e,n,r,o,i,s){let a=i<s;for(a&&([e,n,r,o,i,s]=[r,o,e,n,s,i]);;){if(i===0&&s===0)return a?[r,o,e,n]:[e,n,r,o];if(i&s)return null;let c,f,u=i||s;u&8?(c=e+(r-e)*(this.ymax-n)/(o-n),f=this.ymax):u&4?(c=e+(r-e)*(this.ymin-n)/(o-n),f=this.ymin):u&2?(f=n+(o-n)*(this.xmax-e)/(r-e),c=this.xmax):(f=n+(o-n)*(this.xmin-e)/(r-e),c=this.xmin),i?(e=c,n=f,i=this._regioncode(e,n)):(r=c,o=f,s=this._regioncode(r,o))}}_clipInfinite(e,n,r,o,i,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,o))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],i,s))&&a.push(c[0],c[1]),a=this._clipFinite(e,a))for(let f=0,u=a.length,p,l=this._edgecode(a[u-2],a[u-1]);f<u;f+=2)p=l,l=this._edgecode(a[f],a[f+1]),p&&l&&(f=this._edge(e,p,l,a,f),u=a.length);else this.contains(e,(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(e,n,r,o,i){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}(o[i]!==s||o[i+1]!==a)&&this.contains(e,s,a)&&(o.splice(i,0,s,a),i+=2)}return i}_project(e,n,r,o){let i=1/0,s,a,c;if(o<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/o)<i&&(c=this.ymin,a=e+(i=s)*r)}else if(o>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/o)<i&&(c=this.ymax,a=e+(i=s)*r)}if(r>0){if(e>=this.xmax)return null;(s=(this.xmax-e)/r)<i&&(a=this.xmax,c=n+(i=s)*o)}else if(r<0){if(e<=this.xmin)return null;(s=(this.xmin-e)/r)<i&&(a=this.xmin,c=n+(i=s)*o)}return[a,c]}_edgecode(e,n){return(e===this.xmin?1:e===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(e,n){return(e<this.xmin?1:e>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let n=0;n<e.length;n+=2){let r=(n+2)%e.length,o=(n+4)%e.length;(e[n]===e[r]&&e[r]===e[o]||e[n+1]===e[r+1]&&e[r+1]===e[o+1])&&(e.splice(r,2),n-=2)}e.length||(e=null)}return e}};var Aj=2*Math.PI,Tf=Math.pow;function Tj(t){return t[0]}function Ej(t){return t[1]}function Ij(t){let{triangles:e,coords:n}=t;for(let r=0;r<e.length;r+=3){let o=2*e[r],i=2*e[r+1],s=2*e[r+2];if((n[s]-n[o])*(n[i+1]-n[o+1])-(n[i]-n[o])*(n[s+1]-n[o+1])>1e-10)return!1}return!0}function Nj(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}var Er=class t{static from(e,n=Tj,r=Ej,o){return new t("length"in e?Cj(e,n,r,o):Float64Array.from(kj(e,n,r,o)))}constructor(e){this._delaunator=new Af(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,n=this.points;if(e.hull&&e.hull.length>2&&Ij(e)){this.collinear=Int32Array.from({length:n.length/2},(l,d)=>d).sort((l,d)=>n[2*l]-n[2*d]||n[2*l+1]-n[2*d+1]);let c=this.collinear[0],f=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*f],n[2*f+1]],p=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let l=0,d=n.length/2;l<d;++l){let h=Nj(n[2*l],n[2*l+1],p);n[2*l]=h[0],n[2*l+1]=h[1]}this._delaunator=new Af(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,o=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,f=r.length;c<f;++c){let u=i[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,f=o.length;c<f;++c)a[o[c]]=c;o.length<=2&&o.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=o[0],s[o[0]]=1,o.length===2&&(s[o[1]]=0,this.triangles[1]=o[1],this.triangles[2]=o[1]))}voronoi(e){return new Op(this,e)}*neighbors(e){let{inedges:n,hull:r,_hullIndex:o,halfedges:i,triangles:s,collinear:a}=this;if(a){let p=a.indexOf(e);p>0&&(yield a[p-1]),p<a.length-1&&(yield a[p+1]);return}let c=n[e];if(c===-1)return;let f=c,u=-1;do{if(yield u=s[f],f=f%3===2?f-2:f+1,s[f]!==e)return;if(f=i[f],f===-1){let p=r[(o[e]+1)%r.length];p!==u&&(yield p);return}}while(f!==c)}find(e,n,r=0){if(e=+e,e!==e||(n=+n,n!==n))return-1;let o=r,i;for(;(i=this._step(r,e,n))>=0&&i!==r&&i!==o;)r=i;return i}_step(e,n,r){let{inedges:o,hull:i,_hullIndex:s,halfedges:a,triangles:c,points:f}=this;if(o[e]===-1||!f.length)return(e+1)%(f.length>>1);let u=e,p=Tf(n-f[e*2],2)+Tf(r-f[e*2+1],2),l=o[e],d=l;do{let h=c[d],m=Tf(n-f[h*2],2)+Tf(r-f[h*2+1],2);if(m<p&&(p=m,u=h),d=d%3===2?d-2:d+1,c[d]!==e)break;if(d=a[d],d===-1){if(d=i[(s[e]+1)%i.length],d!==h&&Tf(n-f[d*2],2)+Tf(r-f[d*2+1],2)<p)return d;break}}while(d!==l);return u}render(e){let n=e==null?e=new Tr:void 0,{points:r,halfedges:o,triangles:i}=this;for(let s=0,a=o.length;s<a;++s){let c=o[s];if(c<s)continue;let f=i[s]*2,u=i[c]*2;e.moveTo(r[f],r[f+1]),e.lineTo(r[u],r[u+1])}return this.renderHull(e),n&&n.value()}renderPoints(e,n){n===void 0&&(!e||typeof e.moveTo!="function")&&(n=e,e=null),n=n==null?2:+n;let r=e==null?e=new Tr:void 0,{points:o}=this;for(let i=0,s=o.length;i<s;i+=2){let a=o[i],c=o[i+1];e.moveTo(a+n,c),e.arc(a,c,n,0,Aj)}return r&&r.value()}renderHull(e){let n=e==null?e=new Tr:void 0,{hull:r,points:o}=this,i=r[0]*2,s=r.length;e.moveTo(o[i],o[i+1]);for(let a=1;a<s;++a){let c=2*r[a];e.lineTo(o[c],o[c+1])}return e.closePath(),n&&n.value()}hullPolygon(){let e=new xs;return this.renderHull(e),e.value()}renderTriangle(e,n){let r=n==null?n=new Tr:void 0,{points:o,triangles:i}=this,s=i[e*=3]*2,a=i[e+1]*2,c=i[e+2]*2;return n.moveTo(o[s],o[s+1]),n.lineTo(o[a],o[a+1]),n.lineTo(o[c],o[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:e}=this;for(let n=0,r=e.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(e){let n=new xs;return this.renderTriangle(e,n),n.value()}};function Cj(t,e,n,r){let o=t.length,i=new Float64Array(o*2);for(let s=0;s<o;++s){let a=t[s];i[s*2]=e.call(r,a,s,t),i[s*2+1]=n.call(r,a,s,t)}return i}function*kj(t,e,n,r){let o=0;for(let i of t)yield e.call(r,i,o,t),yield n.call(r,i,o,t),++o}function a9(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ba(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function wo(t){return t=Ba(Math.abs(t)),t?t[1]:NaN}function c9(t,e){return function(n,r){for(var o=n.length,i=[],s=0,a=t[0],c=0;o>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(n.substring(o-=a,o+a)),!((c+=a+1)>r));)a=t[s=(s+1)%t.length];return i.reverse().join(e)}}function f9(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Lj=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vo(t){if(!(e=Lj.exec(t)))throw new Error("invalid format: "+t);var e;return new sg({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}vo.prototype=sg.prototype;function sg(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}sg.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 u9(t){t:for(var e=t.length,n=1,r=-1,o;n<e;++n)switch(t[n]){case".":r=o=n;break;case"0":r===0&&(r=n),o=n;break;default:if(!+t[n])break t;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(o+1):t}var Z_;function l9(t,e){var n=Ba(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Z_=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Ba(t,Math.max(0,e+i-1))[0]}function J_(t,e){var n=Ba(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}var K_={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:a9,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>J_(t*100,e),r:J_,s:l9,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function t6(t){return t}var p9=Array.prototype.map,d9=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function h9(t){var e=t.grouping===void 0||t.thousands===void 0?t6:c9(p9.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?t6:f9(p9.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"\u2212":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function f(p){p=vo(p);var l=p.fill,d=p.align,h=p.sign,m=p.symbol,x=p.zero,g=p.width,y=p.comma,b=p.precision,w=p.trim,_=p.type;_==="n"?(y=!0,_="g"):K_[_]||(b===void 0&&(b=12),w=!0,_="g"),(x||l==="0"&&d==="=")&&(x=!0,l="0",d="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",A=m==="$"?r:/[%p]/.test(_)?s:"",T=K_[_],E=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function N(M){var k=v,O=A,S,I,C;if(_==="c")O=T(M)+O,M="";else{M=+M;var L=M<0||1/M<0;if(M=isNaN(M)?c:T(Math.abs(M),b),w&&(M=u9(M)),L&&+M==0&&h!=="+"&&(L=!1),k=(L?h==="("?h:a:h==="-"||h==="("?"":h)+k,O=(_==="s"?d9[8+Z_/3]:"")+O+(L&&h==="("?")":""),E){for(S=-1,I=M.length;++S<I;)if(C=M.charCodeAt(S),48>C||C>57){O=(C===46?o+M.slice(S+1):M.slice(S))+O,M=M.slice(0,S);break}}}y&&!x&&(M=e(M,1/0));var D=k.length+M.length+O.length,$=D<g?new Array(g-D+1).join(l):"";switch(y&&x&&(M=e($+M,$.length?g-O.length:1/0),$=""),d){case"<":M=k+M+O+$;break;case"=":M=k+$+M+O;break;case"^":M=$.slice(0,D=$.length>>1)+k+M+O+$.slice(D);break;default:M=$+k+M+O;break}return i(M)}return N.toString=function(){return p+""},N}function u(p,l){var d=f((p=vo(p),p.type="f",p)),h=Math.max(-8,Math.min(8,Math.floor(wo(l)/3)))*3,m=Math.pow(10,-h),x=d9[8+h/3];return function(g){return d(m*g)+x}}return{format:f,formatPrefix:u}}var ag,Ir,cg;e6({thousands:",",grouping:[3],currency:["$",""]});function e6(t){return ag=h9(t),Ir=ag.format,cg=ag.formatPrefix,ag}function n6(t){return Math.max(0,-wo(Math.abs(t)))}function r6(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wo(e)/3)))*3-wo(Math.abs(t)))}function o6(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,wo(e)-wo(t))+1}var J=1e-6,za=1e-12,bt=Math.PI,Ht=bt/2,i6=bt/4,Ye=bt*2,he=180/bt,At=bt/180,St=Math.abs,Nr=Math.atan,Ae=Math.atan2,Q=Math.cos,$p=Math.ceil,fg=Math.exp;var ug=Math.hypot,Ya=Math.log,lg=Math.pow,H=Math.sin,yn=Math.sign||function(t){return t>0?1:t<0?-1:0},Qt=Math.sqrt,Ef=Math.tan;function pg(t){return t>1?0:t<-1?bt:Math.acos(t)}function ne(t){return t>1?Ht:t<-1?-Ht:Math.asin(t)}function Te(){}function dg(t,e){t&&x9.hasOwnProperty(t.type)&&x9[t.type](t,e)}var m9={Feature:function(t,e){dg(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)dg(n[r].geometry,e)}},x9={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){s6(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)s6(n[r],e,0)},Polygon:function(t,e){g9(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)g9(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)dg(n[r],e)}};function s6(t,e,n){var r=-1,o=t.length-n,i;for(e.lineStart();++r<o;)i=t[r],e.point(i[0],i[1],i[2]);e.lineEnd()}function g9(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)s6(t[n],e,1);e.polygonEnd()}function or(t,e){t&&m9.hasOwnProperty(t.type)?m9[t.type](t,e):dg(t,e)}function Dp(t){return[Ae(t[1],t[0]),ne(t[2])]}function _o(t){var e=t[0],n=t[1],r=Q(n);return[r*Q(e),r*H(e),H(n)]}function Pp(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function If(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function hg(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Fp(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qp(t){var e=Qt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Bp,mg,xg,gg,yg,bg,wg,vg,a6,c6,f6,w9,v9,On,$n,Dn,Hr={sphere:Te,point:u6,lineStart:y9,lineEnd:b9,polygonStart:function(){Hr.lineStart=$j,Hr.lineEnd=Dj},polygonEnd:function(){Hr.lineStart=y9,Hr.lineEnd=b9}};function u6(t,e){t*=At,e*=At;var n=Q(e);zp(n*Q(t),n*H(t),H(e))}function zp(t,e,n){++Bp,xg+=(t-xg)/Bp,gg+=(e-gg)/Bp,yg+=(n-yg)/Bp}function y9(){Hr.point=Rj}function Rj(t,e){t*=At,e*=At;var n=Q(e);On=n*Q(t),$n=n*H(t),Dn=H(e),Hr.point=Oj,zp(On,$n,Dn)}function Oj(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*H(t),i=H(e),s=Ae(Qt((s=$n*i-Dn*o)*s+(s=Dn*r-On*i)*s+(s=On*o-$n*r)*s),On*r+$n*o+Dn*i);mg+=s,bg+=s*(On+(On=r)),wg+=s*($n+($n=o)),vg+=s*(Dn+(Dn=i)),zp(On,$n,Dn)}function b9(){Hr.point=u6}function $j(){Hr.point=Pj}function Dj(){_9(w9,v9),Hr.point=u6}function Pj(t,e){w9=t,v9=e,t*=At,e*=At,Hr.point=_9;var n=Q(e);On=n*Q(t),$n=n*H(t),Dn=H(e),zp(On,$n,Dn)}function _9(t,e){t*=At,e*=At;var n=Q(e),r=n*Q(t),o=n*H(t),i=H(e),s=$n*i-Dn*o,a=Dn*r-On*i,c=On*o-$n*r,f=ug(s,a,c),u=ne(f),p=f&&-u/f;a6.add(p*s),c6.add(p*a),f6.add(p*c),mg+=u,bg+=u*(On+(On=r)),wg+=u*($n+($n=o)),vg+=u*(Dn+(Dn=i)),zp(On,$n,Dn)}function l6(t){Bp=mg=xg=gg=yg=bg=wg=vg=0,a6=new nn,c6=new nn,f6=new nn,or(t,Hr);var e=+a6,n=+c6,r=+f6,o=ug(e,n,r);return o<za&&(e=bg,n=wg,r=vg,mg<J&&(e=xg,n=gg,r=yg),o=ug(e,n,r),o<za)?[NaN,NaN]:[Ae(n,e)*he,ne(r/o)*he]}function Yp(t,e){function n(r,o){return r=t(r,o),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,o){return r=e.invert(r,o),r&&t.invert(r[0],r[1])}),n}function p6(t,e){return St(t)>bt&&(t-=Math.round(t/Ye)*Ye),[t,e]}p6.invert=p6;function d6(t,e,n){return(t%=Ye)?e||n?Yp(M9(t),A9(e,n)):M9(t):e||n?A9(e,n):p6}function S9(t){return function(e,n){return e+=t,St(e)>bt&&(e-=Math.round(e/Ye)*Ye),[e,n]}}function M9(t){var e=S9(t);return e.invert=S9(-t),e}function A9(t,e){var n=Q(t),r=H(t),o=Q(e),i=H(e);function s(a,c){var f=Q(c),u=Q(a)*f,p=H(a)*f,l=H(c),d=l*n+u*r;return[Ae(p*o-d*i,u*n-l*r),ne(d*o+p*i)]}return s.invert=function(a,c){var f=Q(c),u=Q(a)*f,p=H(a)*f,l=H(c),d=l*o-p*i;return[Ae(p*o+l*i,u*n+d*r),ne(d*n-u*r)]},s}function T9(t){t=d6(t[0]*At,t[1]*At,t.length>2?t[2]*At:0);function e(n){return n=t(n[0]*At,n[1]*At),n[0]*=he,n[1]*=he,n}return e.invert=function(n){return n=t.invert(n[0]*At,n[1]*At),n[0]*=he,n[1]*=he,n},e}function I9(t,e,n,r,o,i){if(n){var s=Q(e),a=H(e),c=r*n;o==null?(o=e+r*Ye,i=e-c/2):(o=E9(s,o),i=E9(s,i),(r>0?o<i:o>i)&&(o+=r*Ye));for(var f,u=o;r>0?u>i:u<i;u-=c)f=Dp([s,-a*Q(u),-a*H(u)]),t.point(f[0],f[1])}}function E9(t,e){e=_o(e),e[0]-=t,qp(e);var n=pg(-e[1]);return((-e[2]<0?-n:n)+Ye-J)%Ye}function _g(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:Te,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Nf(t,e){return St(t[0]-e[0])<J&&St(t[1]-e[1])<J}function Sg(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Mg(t,e,n,r,o){var i=[],s=[],a,c;if(t.forEach(function(h){if(!((m=h.length-1)<=0)){var m,x=h[0],g=h[m],y;if(Nf(x,g)){if(!x[2]&&!g[2]){for(o.lineStart(),a=0;a<m;++a)o.point((x=h[a])[0],x[1]);o.lineEnd();return}g[0]+=2*J}i.push(y=new Sg(x,h,null,!0)),s.push(y.o=new Sg(x,null,y,!1)),i.push(y=new Sg(g,h,null,!1)),s.push(y.o=new Sg(g,null,y,!0))}}),!!i.length){for(s.sort(e),N9(i),N9(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var f=i[0],u,p;;){for(var l=f,d=!0;l.v;)if((l=l.n)===f)return;u=l.z,o.lineStart();do{if(l.v=l.o.v=!0,l.e){if(d)for(a=0,c=u.length;a<c;++a)o.point((p=u[a])[0],p[1]);else r(l.x,l.n.x,1,o);l=l.n}else{if(d)for(u=l.p.z,a=u.length-1;a>=0;--a)o.point((p=u[a])[0],p[1]);else r(l.x,l.p.x,-1,o);l=l.p}l=l.o,u=l.z,d=!d}while(!l.v);o.lineEnd()}}}function N9(t){if(e=t.length){for(var e,n=0,r=t[0],o;++n<e;)r.n=o=t[n],o.p=r,r=o;r.n=o=t[0],o.p=r}}function h6(t){return St(t[0])<=bt?t[0]:yn(t[0])*((St(t[0])+bt)%Ye-bt)}function C9(t,e){var n=h6(e),r=e[1],o=H(r),i=[H(n),-Q(n),0],s=0,a=0,c=new nn;o===1?r=Ht+J:o===-1&&(r=-Ht-J);for(var f=0,u=t.length;f<u;++f)if(l=(p=t[f]).length)for(var p,l,d=p[l-1],h=h6(d),m=d[1]/2+i6,x=H(m),g=Q(m),y=0;y<l;++y,h=w,x=v,g=A,d=b){var b=p[y],w=h6(b),_=b[1]/2+i6,v=H(_),A=Q(_),T=w-h,E=T>=0?1:-1,N=E*T,M=N>bt,k=x*v;if(c.add(Ae(k*E*H(N),g*A+k*Q(N))),s+=M?T+E*Ye:T,M^h>=n^w>=n){var O=If(_o(d),_o(b));qp(O);var S=If(i,O);qp(S);var I=(M^T>=0?-1:1)*ne(S[2]);(r>I||r===I&&(O[0]||O[1]))&&(a+=M^T>=0?1:-1)}}return(s<-J||s<J&&c<-za)^a&1}function Ag(t,e,n,r){return function(o){var i=e(o),s=_g(),a=e(s),c=!1,f,u,p,l={point:d,lineStart:m,lineEnd:x,polygonStart:function(){l.point=g,l.lineStart=y,l.lineEnd=b,u=[],f=[]},polygonEnd:function(){l.point=d,l.lineStart=m,l.lineEnd=x,u=uf(u);var w=C9(f,r);u.length?(c||(o.polygonStart(),c=!0),Mg(u,qj,w,n,o)):w&&(c||(o.polygonStart(),c=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),c&&(o.polygonEnd(),c=!1),u=f=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(w,_){t(w,_)&&o.point(w,_)}function h(w,_){i.point(w,_)}function m(){l.point=h,i.lineStart()}function x(){l.point=d,i.lineEnd()}function g(w,_){p.push([w,_]),a.point(w,_)}function y(){a.lineStart(),p=[]}function b(){g(p[0][0],p[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,A=_.length,T,E,N;if(p.pop(),f.push(p),p=null,!!A){if(w&1){if(E=_[0],(T=E.length-1)>0){for(c||(o.polygonStart(),c=!0),o.lineStart(),v=0;v<T;++v)o.point((N=E[v])[0],N[1]);o.lineEnd()}return}A>1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(Fj))}}return l}}function Fj(t){return t.length>1}function qj(t,e){return((t=t.x)[0]<0?t[1]-Ht-J:Ht-t[1])-((e=e.x)[0]<0?e[1]-Ht-J:Ht-e[1])}var m6=Ag(function(){return!0},Bj,Yj,[-bt,-Ht]);function Bj(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(i,s){var a=i>0?bt:-bt,c=St(i-e);St(c-bt)<J?(t.point(e,n=(n+s)/2>0?Ht:-Ht),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(i,n),o=0):r!==a&&c>=bt&&(St(e-r)<J&&(e-=r*J),St(i-a)<J&&(i-=a*J),n=zj(e,n,i,s),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),o=0),t.point(e=i,n=s),r=a},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-o}}}function zj(t,e,n,r){var o,i,s=H(t-n);return St(s)>J?Nr((H(e)*(i=Q(r))*H(n)-H(r)*(o=Q(e))*H(t))/(o*i*s)):(e+r)/2}function Yj(t,e,n,r){var o;if(t==null)o=n*Ht,r.point(-bt,o),r.point(0,o),r.point(bt,o),r.point(bt,0),r.point(bt,-o),r.point(0,-o),r.point(-bt,-o),r.point(-bt,0),r.point(-bt,o);else if(St(t[0]-e[0])>J){var i=t[0]<e[0]?bt:-bt;o=n*i/2,r.point(-i,o),r.point(0,o),r.point(i,o)}else r.point(e[0],e[1])}function k9(t){var e=Q(t),n=2*At,r=e>0,o=St(e)>J;function i(u,p,l,d){I9(d,t,n,l,u,p)}function s(u,p){return Q(u)*Q(p)>e}function a(u){var p,l,d,h,m;return{lineStart:function(){h=d=!1,m=1},point:function(x,g){var y=[x,g],b,w=s(x,g),_=r?w?0:f(x,g):w?f(x+(x<0?bt:-bt),g):0;if(!p&&(h=d=w)&&u.lineStart(),w!==d&&(b=c(p,y),(!b||Nf(p,b)||Nf(y,b))&&(y[2]=1)),w!==d)m=0,w?(u.lineStart(),b=c(y,p),u.point(b[0],b[1])):(b=c(p,y),u.point(b[0],b[1],2),u.lineEnd()),p=b;else if(o&&p&&r^w){var v;!(_&l)&&(v=c(y,p,!0))&&(m=0,r?(u.lineStart(),u.point(v[0][0],v[0][1]),u.point(v[1][0],v[1][1]),u.lineEnd()):(u.point(v[1][0],v[1][1]),u.lineEnd(),u.lineStart(),u.point(v[0][0],v[0][1],3)))}w&&(!p||!Nf(p,y))&&u.point(y[0],y[1]),p=y,d=w,l=_},lineEnd:function(){d&&u.lineEnd(),p=null},clean:function(){return m|(h&&d)<<1}}}function c(u,p,l){var d=_o(u),h=_o(p),m=[1,0,0],x=If(d,h),g=Pp(x,x),y=x[0],b=g-y*y;if(!b)return!l&&u;var w=e*g/b,_=-e*y/b,v=If(m,x),A=Fp(m,w),T=Fp(x,_);hg(A,T);var E=v,N=Pp(A,E),M=Pp(E,E),k=N*N-M*(Pp(A,A)-1);if(!(k<0)){var O=Qt(k),S=Fp(E,(-N-O)/M);if(hg(S,A),S=Dp(S),!l)return S;var I=u[0],C=p[0],L=u[1],D=p[1],$;C<I&&($=I,I=C,C=$);var P=C-I,F=St(P-bt)<J,q=F||P<J;if(!F&&D<L&&($=L,L=D,D=$),q?F?L+D>0^S[1]<(St(S[0]-I)<J?L:D):L<=S[1]&&S[1]<=D:P>bt^(I<=S[0]&&S[0]<=C)){var V=Fp(E,(-N+O)/M);return hg(V,A),[S,Dp(V)]}}}function f(u,p){var l=r?t:bt-t,d=0;return u<-l?d|=1:u>l&&(d|=2),p<-l?d|=4:p>l&&(d|=8),d}return Ag(s,a,i,r?[0,-t]:[-bt,t-bt])}function L9(t,e,n,r,o,i){var s=t[0],a=t[1],c=e[0],f=e[1],u=0,p=1,l=c-s,d=f-a,h;if(h=n-s,!(!l&&h>0)){if(h/=l,l<0){if(h<u)return;h<p&&(p=h)}else if(l>0){if(h>p)return;h>u&&(u=h)}if(h=o-s,!(!l&&h<0)){if(h/=l,l<0){if(h>p)return;h>u&&(u=h)}else if(l>0){if(h<u)return;h<p&&(p=h)}if(h=r-a,!(!d&&h>0)){if(h/=d,d<0){if(h<u)return;h<p&&(p=h)}else if(d>0){if(h>p)return;h>u&&(u=h)}if(h=i-a,!(!d&&h<0)){if(h/=d,d<0){if(h>p)return;h>u&&(u=h)}else if(d>0){if(h<u)return;h<p&&(p=h)}return u>0&&(t[0]=s+u*l,t[1]=a+u*d),p<1&&(e[0]=s+p*l,e[1]=a+p*d),!0}}}}}var Up=1e9,Tg=-Up;function Cf(t,e,n,r){function o(f,u){return t<=f&&f<=n&&e<=u&&u<=r}function i(f,u,p,l){var d=0,h=0;if(f==null||(d=s(f,p))!==(h=s(u,p))||c(f,u)<0^p>0)do l.point(d===0||d===3?t:n,d>1?r:e);while((d=(d+p+4)%4)!==h);else l.point(u[0],u[1])}function s(f,u){return St(f[0]-t)<J?u>0?0:3:St(f[0]-n)<J?u>0?2:1:St(f[1]-e)<J?u>0?1:0:u>0?3:2}function a(f,u){return c(f.x,u.x)}function c(f,u){var p=s(f,1),l=s(u,1);return p!==l?p-l:p===0?u[1]-f[1]:p===1?f[0]-u[0]:p===2?f[1]-u[1]:u[0]-f[0]}return function(f){var u=f,p=_g(),l,d,h,m,x,g,y,b,w,_,v,A={point:T,lineStart:k,lineEnd:O,polygonStart:N,polygonEnd:M};function T(I,C){o(I,C)&&u.point(I,C)}function E(){for(var I=0,C=0,L=d.length;C<L;++C)for(var D=d[C],$=1,P=D.length,F=D[0],q,V,K=F[0],et=F[1];$<P;++$)q=K,V=et,F=D[$],K=F[0],et=F[1],V<=r?et>r&&(K-q)*(r-V)>(et-V)*(t-q)&&++I:et<=r&&(K-q)*(r-V)<(et-V)*(t-q)&&--I;return I}function N(){u=p,l=[],d=[],v=!0}function M(){var I=E(),C=v&&I,L=(l=uf(l)).length;(C||L)&&(f.polygonStart(),C&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),L&&Mg(l,a,I,i,f),f.polygonEnd()),u=f,l=d=h=null}function k(){A.point=S,d&&d.push(h=[]),_=!0,w=!1,y=b=NaN}function O(){l&&(S(m,x),g&&w&&p.rejoin(),l.push(p.result())),A.point=T,w&&u.lineEnd()}function S(I,C){var L=o(I,C);if(d&&h.push([I,C]),_)m=I,x=C,g=L,_=!1,L&&(u.lineStart(),u.point(I,C));else if(L&&w)u.point(I,C);else{var D=[y=Math.max(Tg,Math.min(Up,y)),b=Math.max(Tg,Math.min(Up,b))],$=[I=Math.max(Tg,Math.min(Up,I)),C=Math.max(Tg,Math.min(Up,C))];L9(D,$,t,e,n,r)?(w||(u.lineStart(),u.point(D[0],D[1])),u.point($[0],$[1]),L||u.lineEnd(),v=!1):L&&(u.lineStart(),u.point(I,C),v=!1)}y=I,b=C,w=L}return A}}function R9(t,e,n){var r=ye(t,e-J,n).concat(e);return function(o){return r.map(function(i){return[o,i]})}}function O9(t,e,n){var r=ye(t,e-J,n).concat(e);return function(o){return r.map(function(i){return[i,o]})}}function x6(){var t,e,n,r,o,i,s,a,c=10,f=c,u=90,p=360,l,d,h,m,x=2.5;function g(){return{type:"MultiLineString",coordinates:y()}}function y(){return ye($p(r/u)*u,n,u).map(h).concat(ye($p(a/p)*p,s,p).map(m)).concat(ye($p(e/c)*c,t,c).filter(function(b){return St(b%u)>J}).map(l)).concat(ye($p(i/f)*f,o,f).filter(function(b){return St(b%p)>J}).map(d))}return g.lines=function(){return y().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[h(r).concat(m(s).slice(1),h(n).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(b){return arguments.length?g.extentMajor(b).extentMinor(b):g.extentMinor()},g.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),g.precision(x)):[[r,a],[n,s]]},g.extentMinor=function(b){return arguments.length?(e=+b[0][0],t=+b[1][0],i=+b[0][1],o=+b[1][1],e>t&&(b=e,e=t,t=b),i>o&&(b=i,i=o,o=b),g.precision(x)):[[e,i],[t,o]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],p=+b[1],g):[u,p]},g.stepMinor=function(b){return arguments.length?(c=+b[0],f=+b[1],g):[c,f]},g.precision=function(b){return arguments.length?(x=+b,l=R9(i,o,90),d=O9(e,t,x),h=R9(a,s,90),m=O9(r,n,x),g):x},g.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function g6(){return x6()()}var jp=t=>t;var y6=new nn,b6=new nn,$9,D9,w6,v6,gs={point:Te,lineStart:Te,lineEnd:Te,polygonStart:function(){gs.lineStart=Uj,gs.lineEnd=Xj},polygonEnd:function(){gs.lineStart=gs.lineEnd=gs.point=Te,y6.add(St(b6)),b6=new nn},result:function(){var t=y6/2;return y6=new nn,t}};function Uj(){gs.point=jj}function jj(t,e){gs.point=P9,$9=w6=t,D9=v6=e}function P9(t,e){b6.add(v6*t-w6*e),w6=t,v6=e}function Xj(){P9($9,D9)}var _6=gs;var kf=1/0,Eg=kf,Xp=-kf,Ig=Xp,Wj={point:Vj,lineStart:Te,lineEnd:Te,polygonStart:Te,polygonEnd:Te,result:function(){var t=[[kf,Eg],[Xp,Ig]];return Xp=Ig=-(Eg=kf=1/0),t}};function Vj(t,e){t<kf&&(kf=t),t>Xp&&(Xp=t),e<Eg&&(Eg=e),e>Ig&&(Ig=e)}var Lf=Wj;var S6=0,M6=0,Wp=0,Ng=0,Cg=0,Rf=0,A6=0,T6=0,Vp=0,B9,z9,So,Mo,Qr={point:Ua,lineStart:F9,lineEnd:q9,polygonStart:function(){Qr.lineStart=Qj,Qr.lineEnd=Zj},polygonEnd:function(){Qr.point=Ua,Qr.lineStart=F9,Qr.lineEnd=q9},result:function(){var t=Vp?[A6/Vp,T6/Vp]:Rf?[Ng/Rf,Cg/Rf]:Wp?[S6/Wp,M6/Wp]:[NaN,NaN];return S6=M6=Wp=Ng=Cg=Rf=A6=T6=Vp=0,t}};function Ua(t,e){S6+=t,M6+=e,++Wp}function F9(){Qr.point=Gj}function Gj(t,e){Qr.point=Hj,Ua(So=t,Mo=e)}function Hj(t,e){var n=t-So,r=e-Mo,o=Qt(n*n+r*r);Ng+=o*(So+t)/2,Cg+=o*(Mo+e)/2,Rf+=o,Ua(So=t,Mo=e)}function q9(){Qr.point=Ua}function Qj(){Qr.point=Jj}function Zj(){Y9(B9,z9)}function Jj(t,e){Qr.point=Y9,Ua(B9=So=t,z9=Mo=e)}function Y9(t,e){var n=t-So,r=e-Mo,o=Qt(n*n+r*r);Ng+=o*(So+t)/2,Cg+=o*(Mo+e)/2,Rf+=o,o=Mo*t-So*e,A6+=o*(So+t),T6+=o*(Mo+e),Vp+=o*3,Ua(So=t,Mo=e)}var E6=Qr;function kg(t){this._context=t}kg.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,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(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ye);break}}},result:Te};var N6=new nn,I6,U9,j9,Gp,Hp,Lg={point:Te,lineStart:function(){Lg.point=Kj},lineEnd:function(){I6&&X9(U9,j9),Lg.point=Te},polygonStart:function(){I6=!0},polygonEnd:function(){I6=null},result:function(){var t=+N6;return N6=new nn,t}};function Kj(t,e){Lg.point=X9,U9=Gp=t,j9=Hp=e}function X9(t,e){Gp-=t,Hp-=e,N6.add(Qt(Gp*Gp+Hp*Hp)),Gp=t,Hp=e}var C6=Lg;var W9,Rg,V9,G9,Of=class{constructor(e){this._append=e==null?H9:tX(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(e,n){switch(this._point){case 0:{this._append`M${e},${n}`,this._point=1;break}case 1:{this._append`L${e},${n}`;break}default:{if(this._append`M${e},${n}`,this._radius!==V9||this._append!==Rg){let r=this._radius,o=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`,V9=r,Rg=this._append,G9=this._,this._=o}this._+=G9;break}}}result(){let e=this._;return this._="",e.length?e:null}};function H9(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function tX(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return H9;if(e!==W9){let n=10**e;W9=e,Rg=function(o){let i=1;this._+=o[0];for(let s=o.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+o[i]}}return Rg}function Ue(t,e){let n=3,r=4.5,o,i;function s(a){return a&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),or(a,o(i))),i.result()}return s.area=function(a){return or(a,o(_6)),_6.result()},s.measure=function(a){return or(a,o(C6)),C6.result()},s.bounds=function(a){return or(a,o(Lf)),Lf.result()},s.centroid=function(a){return or(a,o(E6)),E6.result()},s.projection=function(a){return arguments.length?(o=a==null?(t=null,jp):(t=a).stream,s):t},s.context=function(a){return arguments.length?(i=a==null?(e=null,new Of(n)):new kg(e=a),typeof r!="function"&&i.pointRadius(r),s):e},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(i.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 e===null&&(i=new Of(n)),s},s.projection(t).digits(n).context(e)}function ja(t){return{stream:$f(t)}}function $f(t){return function(e){var n=new k6;for(var r in t)n[r]=t[r];return n.stream=e,n}}function k6(){}k6.prototype={constructor:k6,point:function(t,e){this.stream.point(t,e)},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 L6(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),or(n,t.stream(Lf)),e(Lf.result()),r!=null&&t.clipExtent(r),t}function Qp(t,e,n){return L6(t,function(r){var o=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(o/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+e[0][0]+(o-s*(r[1][0]+r[0][0]))/2,c=+e[0][1]+(i-s*(r[1][1]+r[0][1]))/2;t.scale(150*s).translate([a,c])},n)}function Og(t,e,n){return Qp(t,[[0,0],e],n)}function $g(t,e,n){return L6(t,function(r){var o=+e,i=o/(r[1][0]-r[0][0]),s=(o-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];t.scale(150*i).translate([s,a])},n)}function Dg(t,e,n){return L6(t,function(r){var o=+e,i=o/(r[1][1]-r[0][1]),s=-i*r[0][0],a=(o-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,a])},n)}var Q9=16,eX=Q(30*At);function R6(t,e){return+e?rX(t,e):nX(t)}function nX(t){return $f({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function rX(t,e){function n(r,o,i,s,a,c,f,u,p,l,d,h,m,x){var g=f-r,y=u-o,b=g*g+y*y;if(b>4*e&&m--){var w=s+l,_=a+d,v=c+h,A=Qt(w*w+_*_+v*v),T=ne(v/=A),E=St(St(v)-1)<J||St(i-p)<J?(i+p)/2:Ae(_,w),N=t(E,T),M=N[0],k=N[1],O=M-r,S=k-o,I=y*O-g*S;(I*I/b>e||St((g*O+y*S)/b-.5)>.3||s*l+a*d+c*h<eX)&&(n(r,o,i,s,a,c,M,k,E,w/=A,_/=A,v,m,x),x.point(M,k),n(M,k,E,w,_,v,f,u,p,l,d,h,m,x))}}return function(r){var o,i,s,a,c,f,u,p,l,d,h,m,x={point:g,lineStart:y,lineEnd:w,polygonStart:function(){r.polygonStart(),x.lineStart=_},polygonEnd:function(){r.polygonEnd(),x.lineStart=y}};function g(T,E){T=t(T,E),r.point(T[0],T[1])}function y(){p=NaN,x.point=b,r.lineStart()}function b(T,E){var N=_o([T,E]),M=t(T,E);n(p,l,u,d,h,m,p=M[0],l=M[1],u=T,d=N[0],h=N[1],m=N[2],Q9,r),r.point(p,l)}function w(){x.point=g,r.lineEnd()}function _(){y(),x.point=v,x.lineEnd=A}function v(T,E){b(o=T,E),i=p,s=l,a=d,c=h,f=m,x.point=b}function A(){n(p,l,u,d,h,m,i,s,o,a,c,f,Q9,r),x.lineEnd=w,w()}return x}}var oX=$f({point:function(t,e){this.stream.point(t*At,e*At)}});function iX(t){return $f({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function sX(t,e,n,r,o){function i(s,a){return s*=r,a*=o,[e+t*s,n-t*a]}return i.invert=function(s,a){return[(s-e)/t*r,(n-a)/t*o]},i}function Z9(t,e,n,r,o,i){if(!i)return sX(t,e,n,r,o);var s=Q(i),a=H(i),c=s*t,f=a*t,u=s/t,p=a/t,l=(a*n-s*e)/t,d=(a*e+s*n)/t;function h(m,x){return m*=r,x*=o,[c*m-f*x+e,n-f*m-c*x]}return h.invert=function(m,x){return[r*(u*m-p*x+l),o*(d-p*m-u*x)]},h}function cn(t){return O6(function(){return t})()}function O6(t){var e,n=150,r=480,o=250,i=0,s=0,a=0,c=0,f=0,u,p=0,l=1,d=1,h=null,m=m6,x=null,g,y,b,w=jp,_=.5,v,A,T,E,N;function M(I){return T(I[0]*At,I[1]*At)}function k(I){return I=T.invert(I[0],I[1]),I&&[I[0]*he,I[1]*he]}M.stream=function(I){return E&&N===I?E:E=oX(iX(u)(m(v(w(N=I)))))},M.preclip=function(I){return arguments.length?(m=I,h=void 0,S()):m},M.postclip=function(I){return arguments.length?(w=I,x=g=y=b=null,S()):w},M.clipAngle=function(I){return arguments.length?(m=+I?k9(h=I*At):(h=null,m6),S()):h*he},M.clipExtent=function(I){return arguments.length?(w=I==null?(x=g=y=b=null,jp):Cf(x=+I[0][0],g=+I[0][1],y=+I[1][0],b=+I[1][1]),S()):x==null?null:[[x,g],[y,b]]},M.scale=function(I){return arguments.length?(n=+I,O()):n},M.translate=function(I){return arguments.length?(r=+I[0],o=+I[1],O()):[r,o]},M.center=function(I){return arguments.length?(i=I[0]%360*At,s=I[1]%360*At,O()):[i*he,s*he]},M.rotate=function(I){return arguments.length?(a=I[0]%360*At,c=I[1]%360*At,f=I.length>2?I[2]%360*At:0,O()):[a*he,c*he,f*he]},M.angle=function(I){return arguments.length?(p=I%360*At,O()):p*he},M.reflectX=function(I){return arguments.length?(l=I?-1:1,O()):l<0},M.reflectY=function(I){return arguments.length?(d=I?-1:1,O()):d<0},M.precision=function(I){return arguments.length?(v=R6(A,_=I*I),S()):Qt(_)},M.fitExtent=function(I,C){return Qp(M,I,C)},M.fitSize=function(I,C){return Og(M,I,C)},M.fitWidth=function(I,C){return $g(M,I,C)},M.fitHeight=function(I,C){return Dg(M,I,C)};function O(){var I=Z9(n,0,0,l,d,p).apply(null,e(i,s)),C=Z9(n,r-I[0],o-I[1],l,d,p);return u=d6(a,c,f),A=Yp(e,C),T=Yp(u,A),v=R6(A,_),S()}function S(){return E=N=null,M}return function(){return e=t.apply(this,arguments),M.invert=e.invert&&k,O()}}function Df(t){var e=0,n=bt/3,r=O6(t),o=r(e,n);return o.parallels=function(i){return arguments.length?r(e=i[0]*At,n=i[1]*At):[e*he,n*he]},o}function J9(t){var e=Q(t);function n(r,o){return[r*e,H(o)/e]}return n.invert=function(r,o){return[r/e,ne(o*e)]},n}function K9(t,e){var n=H(t),r=(n+H(e))/2;if(St(r)<J)return J9(t);var o=1+n*(2*r-n),i=Qt(o)/r;function s(a,c){var f=Qt(o-2*r*H(c))/r;return[f*H(a*=r),i-f*Q(a)]}return s.invert=function(a,c){var f=i-c,u=Ae(a,St(f))*yn(f);return f*r<0&&(u-=bt*yn(a)*yn(f)),[u/r,ne((o-(a*a+f*f)*r*r)/(2*r))]},s}function ys(){return Df(K9).scale(155.424).center([0,33.6442])}function Zp(){return ys().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function aX(t){var e=t.length;return{point:function(n,r){for(var o=-1;++o<e;)t[o].point(n,r)},sphere:function(){for(var n=-1;++n<e;)t[n].sphere()},lineStart:function(){for(var n=-1;++n<e;)t[n].lineStart()},lineEnd:function(){for(var n=-1;++n<e;)t[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<e;)t[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<e;)t[n].polygonEnd()}}}function $6(){var t,e,n=Zp(),r,o=ys().rotate([154,0]).center([-2,58.5]).parallels([55,65]),i,s=ys().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,f={point:function(l,d){c=[l,d]}};function u(l){var d=l[0],h=l[1];return c=null,r.point(d,h),c||(i.point(d,h),c)||(a.point(d,h),c)}u.invert=function(l){var d=n.scale(),h=n.translate(),m=(l[0]-h[0])/d,x=(l[1]-h[1])/d;return(x>=.12&&x<.234&&m>=-.425&&m<-.214?o:x>=.166&&x<.234&&m>=-.214&&m<-.115?s:n).invert(l)},u.stream=function(l){return t&&e===l?t:t=aX([n.stream(e=l),o.stream(l),s.stream(l)])},u.precision=function(l){return arguments.length?(n.precision(l),o.precision(l),s.precision(l),p()):n.precision()},u.scale=function(l){return arguments.length?(n.scale(l),o.scale(l*.35),s.scale(l),u.translate(n.translate())):n.scale()},u.translate=function(l){if(!arguments.length)return n.translate();var d=n.scale(),h=+l[0],m=+l[1];return r=n.translate(l).clipExtent([[h-.455*d,m-.238*d],[h+.455*d,m+.238*d]]).stream(f),i=o.translate([h-.307*d,m+.201*d]).clipExtent([[h-.425*d+J,m+.12*d+J],[h-.214*d-J,m+.234*d-J]]).stream(f),a=s.translate([h-.205*d,m+.212*d]).clipExtent([[h-.214*d+J,m+.166*d+J],[h-.115*d-J,m+.234*d-J]]).stream(f),p()},u.fitExtent=function(l,d){return Qp(u,l,d)},u.fitSize=function(l,d){return Og(u,l,d)},u.fitWidth=function(l,d){return $g(u,l,d)},u.fitHeight=function(l,d){return Dg(u,l,d)};function p(){return t=e=null,u}return u.scale(1070)}function Pg(t){return function(e,n){var r=Q(e),o=Q(n),i=t(r*o);return i===1/0?[2,0]:[i*o*H(e),i*H(n)]}}function Ao(t){return function(e,n){var r=Qt(e*e+n*n),o=t(r),i=H(o),s=Q(o);return[Ae(e*i,r*s),ne(r&&n*i/r)]}}var D6=Pg(function(t){return Qt(2/(1+t))});D6.invert=Ao(function(t){return 2*ne(t/2)});function P6(){return cn(D6).scale(124.75).clipAngle(180-.001)}var F6=Pg(function(t){return(t=pg(t))&&t/H(t)});F6.invert=Ao(function(t){return t});function q6(){return cn(F6).scale(79.4188).clipAngle(180-.001)}function Pf(t,e){return[t,Ya(Ef((Ht+e)/2))]}Pf.invert=function(t,e){return[t,2*Nr(fg(e))-Ht]};function B6(){return z6(Pf).scale(961/Ye)}function z6(t){var e=cn(t),n=e.center,r=e.scale,o=e.translate,i=e.clipExtent,s=null,a,c,f;e.scale=function(p){return arguments.length?(r(p),u()):r()},e.translate=function(p){return arguments.length?(o(p),u()):o()},e.center=function(p){return arguments.length?(n(p),u()):n()},e.clipExtent=function(p){return arguments.length?(p==null?s=a=c=f=null:(s=+p[0][0],a=+p[0][1],c=+p[1][0],f=+p[1][1]),u()):s==null?null:[[s,a],[c,f]]};function u(){var p=bt*r(),l=e(T9(e.rotate()).invert([0,0]));return i(s==null?[[l[0]-p,l[1]-p],[l[0]+p,l[1]+p]]:t===Pf?[[Math.max(l[0]-p,s),a],[Math.min(l[0]+p,c),f]]:[[s,Math.max(l[1]-p,a)],[c,Math.min(l[1]+p,f)]])}return u()}function Fg(t){return Ef((Ht+t)/2)}function tk(t,e){var n=Q(t),r=t===e?H(t):Ya(n/Q(e))/Ya(Fg(e)/Fg(t)),o=n*lg(Fg(t),r)/r;if(!r)return Pf;function i(s,a){o>0?a<-Ht+J&&(a=-Ht+J):a>Ht-J&&(a=Ht-J);var c=o/lg(Fg(a),r);return[c*H(r*s),o-c*Q(r*s)]}return i.invert=function(s,a){var c=o-a,f=yn(r)*Qt(s*s+c*c),u=Ae(s,St(c))*yn(c);return c*r<0&&(u-=bt*yn(s)*yn(c)),[u/r,2*Nr(lg(o/f,1/r))-Ht]},i}function Y6(){return Df(tk).scale(109.5).parallels([30,30])}function Ff(t,e){return[t,e]}Ff.invert=Ff;function U6(){return cn(Ff).scale(152.63)}function ek(t,e){var n=Q(t),r=t===e?H(t):(n-Q(e))/(e-t),o=n/r+t;if(St(r)<J)return Ff;function i(s,a){var c=o-a,f=r*s;return[c*H(f),o-c*Q(f)]}return i.invert=function(s,a){var c=o-a,f=Ae(s,St(c))*yn(c);return c*r<0&&(f-=bt*yn(s)*yn(c)),[f/r,o-yn(r)*Qt(s*s+c*c)]},i}function j6(){return Df(ek).scale(131.154).center([0,13.9389])}var Jp=1.340264,Kp=-.081106,td=893e-6,ed=.003796,qg=Qt(3)/2,cX=12;function X6(t,e){var n=ne(qg*H(e)),r=n*n,o=r*r*r;return[t*Q(n)/(qg*(Jp+3*Kp*r+o*(7*td+9*ed*r))),n*(Jp+Kp*r+o*(td+ed*r))]}X6.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,i=0,s,a,c;i<cX&&(a=n*(Jp+Kp*r+o*(td+ed*r))-e,c=Jp+3*Kp*r+o*(7*td+9*ed*r),n-=s=a/c,r=n*n,o=r*r*r,!(St(s)<za));++i);return[qg*t*(Jp+3*Kp*r+o*(7*td+9*ed*r))/Q(n),ne(H(n)/qg)]};function W6(){return cn(X6).scale(177.158)}function V6(t,e){var n=Q(e),r=Q(t)*n;return[n*H(t)/r,H(e)/r]}V6.invert=Ao(Nr);function G6(){return cn(V6).scale(144.049).clipAngle(60)}function H6(t,e){return[Q(e)*H(t),H(e)]}H6.invert=Ao(ne);function Q6(){return cn(H6).scale(249.5).clipAngle(90+J)}function Z6(t,e){var n=Q(e),r=1+Q(t)*n;return[n*H(t)/r,H(e)/r]}Z6.invert=Ao(function(t){return 2*Nr(t)});function J6(){return cn(Z6).scale(250).clipAngle(142)}function K6(t,e){return[Ya(Ef((Ht+e)/2)),-t]}K6.invert=function(t,e){return[-e,2*Nr(fg(t))-Ht]};function t3(){var t=z6(K6),e=t.center,n=t.rotate;return t.center=function(r){return arguments.length?e([-r[1],r[0]]):(r=e(),[r[1],-r[0]])},t.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 fX(t,e){return t.parent===e.parent?1:2}function uX(t){return t.reduce(lX,0)/t.length}function lX(t,e){return t+e.x}function pX(t){return 1+t.reduce(dX,0)}function dX(t,e){return Math.max(t,e.y)}function hX(t){for(var e;e=t.children;)t=e[0];return t}function mX(t){for(var e;e=t.children;)t=e[e.length-1];return t}function Bg(){var t=fX,e=1,n=1,r=!1;function o(i){var s,a=0;i.eachAfter(function(l){var d=l.children;d?(l.x=uX(d),l.y=pX(d)):(l.x=s?a+=t(l,s):0,l.y=0,s=l)});var c=hX(i),f=mX(i),u=c.x-t(c,f)/2,p=f.x+t(f,c)/2;return i.eachAfter(r?function(l){l.x=(l.x-i.x)*e,l.y=(i.y-l.y)*n}:function(l){l.x=(l.x-u)/(p-u)*e,l.y=(1-(i.y?l.y/i.y:1))*n})}return o.separation=function(i){return arguments.length?(t=i,o):t},o.size=function(i){return arguments.length?(r=!1,e=+i[0],n=+i[1],o):r?null:[e,n]},o.nodeSize=function(i){return arguments.length?(r=!0,e=+i[0],n=+i[1],o):r?[e,n]:null},o}function xX(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function nk(){return this.eachAfter(xX)}function rk(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}function ok(t,e){for(var n=this,r=[n],o,i,s=-1;n=r.pop();)if(t.call(e,n,++s,this),o=n.children)for(i=o.length-1;i>=0;--i)r.push(o[i]);return this}function ik(t,e){for(var n=this,r=[n],o=[],i,s,a,c=-1;n=r.pop();)if(o.push(n),i=n.children)for(s=0,a=i.length;s<a;++s)r.push(i[s]);for(;n=o.pop();)t.call(e,n,++c,this);return this}function sk(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}function ak(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,o=r&&r.length;--o>=0;)n+=r[o].value;e.value=n})}function ck(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function fk(t){for(var e=this,n=gX(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var o=r.length;t!==n;)r.splice(o,0,t),t=t.parent;return r}function gX(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),o=null;for(t=n.pop(),e=r.pop();t===e;)o=t,t=n.pop(),e=r.pop();return o}function uk(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function lk(){return Array.from(this)}function pk(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function dk(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*hk(){var t=this,e,n=[t],r,o,i;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(o=0,i=r.length;o<i;++o)n.push(r[o]);while(n.length)}function e3(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=wX)):e===void 0&&(e=bX);for(var n=new bs(t),r,o=[n],i,s,a,c;r=o.pop();)if((s=e(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)o.push(i=s[a]=new bs(s[a])),i.parent=r,i.depth=r.depth+1;return n.eachBefore(n3)}function yX(){return e3(this).eachBefore(vX)}function bX(t){return t.children}function wX(t){return Array.isArray(t)?t[1]:null}function vX(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function n3(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function bs(t){this.data=t,this.depth=this.height=0,this.parent=null}bs.prototype=e3.prototype={constructor:bs,count:nk,each:rk,eachAfter:ik,eachBefore:ok,find:sk,sum:ak,sort:ck,path:fk,ancestors:uk,descendants:lk,leaves:pk,links:dk,copy:yX,[Symbol.iterator]:hk};function zg(t){return t==null?null:_X(t)}function _X(t){if(typeof t!="function")throw new Error;return t}var SX={depth:-1},mk={},r3={};function MX(t){return t.id}function AX(t){return t.parentId}function Yg(){var t=MX,e=AX,n;function r(o){var i=Array.from(o),s=t,a=e,c,f,u,p,l,d,h,m,x=new Map;if(n!=null){let g=i.map((w,_)=>TX(n(w,_,o))),y=g.map(xk),b=new Set(g).add("");for(let w of y)b.has(w)||(b.add(w),g.push(w),y.push(xk(w)),i.push(r3));s=(w,_)=>g[_],a=(w,_)=>y[_]}for(u=0,c=i.length;u<c;++u)f=i[u],d=i[u]=new bs(f),(h=s(f,u,o))!=null&&(h+="")&&(m=d.id=h,x.set(m,x.has(m)?mk:d)),(h=a(f,u,o))!=null&&(h+="")&&(d.parent=h);for(u=0;u<c;++u)if(d=i[u],h=d.parent){if(l=x.get(h),!l)throw new Error("missing: "+h);if(l===mk)throw new Error("ambiguous: "+h);l.children?l.children.push(d):l.children=[d],d.parent=l}else{if(p)throw new Error("multiple roots");p=d}if(!p)throw new Error("no root");if(n!=null){for(;p.data===r3&&p.children.length===1;)p=p.children[0],--c;for(let g=i.length-1;g>=0&&(d=i[g],d.data===r3);--g)d.data=null}if(p.parent=SX,p.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(n3),p.parent=null,c>0)throw new Error("cycle");return p}return r.id=function(o){return arguments.length?(t=zg(o),r):t},r.parentId=function(o){return arguments.length?(e=zg(o),r):e},r.path=function(o){return arguments.length?(n=zg(o),r):n},r}function TX(t){t=`${t}`;let e=t.length;return o3(t,e-1)&&!o3(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function xk(t){let e=t.length;if(e<2)return"";for(;--e>1&&!o3(t,e););return t.slice(0,e)}function o3(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}function EX(t,e){return t.parent===e.parent?1:2}function i3(t){var e=t.children;return e?e[0]:t.t}function s3(t){var e=t.children;return e?e[e.length-1]:t.t}function IX(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function NX(t){for(var e=0,n=0,r=t.children,o=r.length,i;--o>=0;)i=r[o],i.z+=e,i.m+=e,e+=i.s+(n+=i.c)}function CX(t,e,n){return t.a.parent===e.parent?t.a:n}function Ug(t,e){this._=t,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=e}Ug.prototype=Object.create(bs.prototype);function kX(t){for(var e=new Ug(t,0),n,r=[e],o,i,s,a;n=r.pop();)if(i=n._.children)for(n.children=new Array(a=i.length),s=a-1;s>=0;--s)r.push(o=n.children[s]=new Ug(i[s],s)),o.parent=n;return(e.parent=new Ug(null,0)).children=[e],e}function Xa(){var t=EX,e=1,n=1,r=null;function o(f){var u=kX(f);if(u.eachAfter(i),u.parent.m=-u.z,u.eachBefore(s),r)f.eachBefore(c);else{var p=f,l=f,d=f;f.eachBefore(function(y){y.x<p.x&&(p=y),y.x>l.x&&(l=y),y.depth>d.depth&&(d=y)});var h=p===l?1:t(p,l)/2,m=h-p.x,x=e/(l.x+h+m),g=n/(d.depth||1);f.eachBefore(function(y){y.x=(y.x+m)*x,y.y=y.depth*g})}return f}function i(f){var u=f.children,p=f.parent.children,l=f.i?p[f.i-1]:null;if(u){NX(f);var d=(u[0].z+u[u.length-1].z)/2;l?(f.z=l.z+t(f._,l._),f.m=f.z-d):f.z=d}else l&&(f.z=l.z+t(f._,l._));f.parent.A=a(f,l,f.parent.A||p[0])}function s(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function a(f,u,p){if(u){for(var l=f,d=f,h=u,m=l.parent.children[0],x=l.m,g=d.m,y=h.m,b=m.m,w;h=s3(h),l=i3(l),h&&l;)m=i3(m),d=s3(d),d.a=f,w=h.z+y-l.z-x+t(h._,l._),w>0&&(IX(CX(h,f,p),f,w),x+=w,g+=w),y+=h.m,x+=l.m,b+=m.m,g+=d.m;h&&!s3(d)&&(d.t=h,d.m+=y-g),l&&!i3(m)&&(m.t=l,m.m+=x-b,p=f)}return p}function c(f){f.x*=e,f.y=f.depth*n}return o.separation=function(f){return arguments.length?(t=f,o):t},o.size=function(f){return arguments.length?(r=!1,e=+f[0],n=+f[1],o):r?null:[e,n]},o.nodeSize=function(f){return arguments.length?(r=!0,e=+f[0],n=+f[1],o):r?[e,n]:null},o}var gk=23283064365386963e-26;function Wa(t=Math.random()){let e=(0<=t&&t<1?t/gk:Math.abs(t))|0;return()=>(e=1664525*e+1013904223|0,gk*(e>>>0))}function Ee(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function nd(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}var rd=Symbol("implicit");function Va(){var t=new Tn,e=[],n=[],r=rd;function o(i){let s=t.get(i);if(s===void 0){if(r!==rd)return r;t.set(i,s=e.push(i)-1)}return n[s%n.length]}return o.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new Tn;for(let s of i)t.has(s)||t.set(s,e.push(s)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return Va(e,n).unknown(r)},Ee.apply(o,arguments),o}function ws(){var t=Va().unknown(void 0),e=t.domain,n=t.range,r=0,o=1,i,s,a=!1,c=0,f=0,u=.5;delete t.unknown;function p(){var l=e().length,d=o<r,h=d?o:r,m=d?r:o;i=(m-h)/Math.max(1,l-c+f*2),a&&(i=Math.floor(i)),h+=(m-h-i*(l-c))*u,s=i*(1-c),a&&(h=Math.round(h),s=Math.round(s));var x=ye(l).map(function(g){return h+i*g});return n(d?x.reverse():x)}return t.domain=function(l){return arguments.length?(e(l),p()):e()},t.range=function(l){return arguments.length?([r,o]=l,r=+r,o=+o,p()):[r,o]},t.rangeRound=function(l){return[r,o]=l,r=+r,o=+o,a=!0,p()},t.bandwidth=function(){return s},t.step=function(){return i},t.round=function(l){return arguments.length?(a=!!l,p()):a},t.padding=function(l){return arguments.length?(c=Math.min(1,f=+l),p()):c},t.paddingInner=function(l){return arguments.length?(c=Math.min(1,l),p()):c},t.paddingOuter=function(l){return arguments.length?(f=+l,p()):f},t.align=function(l){return arguments.length?(u=Math.max(0,Math.min(1,l)),p()):u},t.copy=function(){return ws(e(),[r,o]).round(a).paddingInner(c).paddingOuter(f).align(u)},Ee.apply(p(),arguments)}function yk(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return yk(e())},t}function a3(){return yk(ws.apply(null,arguments).paddingInner(1))}function c3(t){return function(){return t}}function qf(t){return+t}var bk=[0,1];function Vn(t){return t}function f3(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:c3(isNaN(e)?NaN:.5)}function LX(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function RX(t,e,n){var r=t[0],o=t[1],i=e[0],s=e[1];return o<r?(r=f3(o,r),i=n(s,i)):(r=f3(r,o),i=n(i,s)),function(a){return i(r(a))}}function OX(t,e,n){var r=Math.min(t.length,e.length)-1,o=new Array(r),i=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)o[s]=f3(t[s],t[s+1]),i[s]=n(e[s],e[s+1]);return function(a){var c=fi(t,a,1,r)-1;return i[c](o[c](a))}}function To(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ga(){var t=bk,e=bk,n=rr,r,o,i,s=Vn,a,c,f;function u(){var l=Math.min(t.length,e.length);return s!==Vn&&(s=LX(t[0],t[l-1])),a=l>2?OX:RX,c=f=null,p}function p(l){return l==null||isNaN(l=+l)?i:(c||(c=a(t.map(r),e,n)))(r(s(l)))}return p.invert=function(l){return s(o((f||(f=a(e,t.map(r),ee)))(l)))},p.domain=function(l){return arguments.length?(t=Array.from(l,qf),u()):t.slice()},p.range=function(l){return arguments.length?(e=Array.from(l),u()):e.slice()},p.rangeRound=function(l){return e=Array.from(l),n=$a,u()},p.clamp=function(l){return arguments.length?(s=l?!0:Vn,u()):s!==Vn},p.interpolate=function(l){return arguments.length?(n=l,u()):n},p.unknown=function(l){return arguments.length?(i=l,p):i},function(l,d){return r=l,o=d,u()}}function od(){return Ga()(Vn,Vn)}function u3(t,e,n,r){var o=cf(t,e,n),i;switch(r=vo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=r6(o,s))&&(r.precision=i),cg(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=o6(o,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=n6(o))&&(r.precision=i-(r.type==="%")*2);break}}return Ir(r)}function vi(t){var e=t.domain;return t.ticks=function(n){var r=e();return on(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var o=e();return u3(o[0],o[o.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),o=0,i=r.length-1,s=r[o],a=r[i],c,f,u=10;for(a<s&&(f=s,s=a,a=f,f=o,o=i,i=f);u-- >0;){if(f=li(s,a,n),f===c)return r[o]=s,r[i]=a,e(r);if(f>0)s=Math.floor(s/f)*f,a=Math.ceil(a/f)*f;else if(f<0)s=Math.ceil(s*f)/f,a=Math.floor(a*f)/f;else break;c=f}return t},t}function _i(){var t=od();return t.copy=function(){return To(t,_i())},Ee.apply(t,arguments),vi(t)}function id(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,qf),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return id(t).unknown(e)},t=arguments.length?Array.from(t,qf):[0,1],vi(n)}function sd(t,e){t=t.slice();var n=0,r=t.length-1,o=t[n],i=t[r],s;return i<o&&(s=n,n=r,r=s,s=o,o=i,i=s),t[n]=e.floor(o),t[r]=e.ceil(i),t}function wk(t){return Math.log(t)}function vk(t){return Math.exp(t)}function $X(t){return-Math.log(-t)}function DX(t){return-Math.exp(-t)}function PX(t){return isFinite(t)?+("1e"+t):t<0?0:t}function FX(t){return t===10?PX:t===Math.E?Math.exp:e=>Math.pow(t,e)}function qX(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function _k(t){return(e,n)=>-t(-e,n)}function l3(t){let e=t(wk,vk),n=e.domain,r=10,o,i;function s(){return o=qX(r),i=FX(r),n()[0]<0?(o=_k(o),i=_k(i),t($X,DX)):t(wk,vk),e}return e.base=function(a){return arguments.length?(r=+a,s()):r},e.domain=function(a){return arguments.length?(n(a),s()):n()},e.ticks=a=>{let c=n(),f=c[0],u=c[c.length-1],p=u<f;p&&([f,u]=[u,f]);let l=o(f),d=o(u),h,m,x=a==null?10:+a,g=[];if(!(r%1)&&d-l<x){if(l=Math.floor(l),d=Math.ceil(d),f>0){for(;l<=d;++l)for(h=1;h<r;++h)if(m=l<0?h/i(-l):h*i(l),!(m<f)){if(m>u)break;g.push(m)}}else for(;l<=d;++l)for(h=r-1;h>=1;--h)if(m=l>0?h/i(-l):h*i(l),!(m<f)){if(m>u)break;g.push(m)}g.length*2<x&&(g=on(f,u,x))}else g=on(l,d,Math.min(d-l,x)).map(i);return p?g.reverse():g},e.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=vo(c)).precision==null&&(c.trim=!0),c=Ir(c)),a===1/0)return c;let f=Math.max(1,r*a/e.ticks().length);return u=>{let p=u/i(Math.round(o(u)));return p*r<r-.5&&(p*=r),p<=f?c(u):""}},e.nice=()=>n(sd(n(),{floor:a=>i(Math.floor(o(a))),ceil:a=>i(Math.ceil(o(a)))})),e}function ad(){let t=l3(Ga()).domain([1,10]);return t.copy=()=>To(t,ad()).base(t.base()),Ee.apply(t,arguments),t}function Sk(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Mk(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function p3(t){var e=1,n=t(Sk(e),Mk(e));return n.constant=function(r){return arguments.length?t(Sk(e=+r),Mk(e)):e},vi(n)}function cd(){var t=p3(Ga());return t.copy=function(){return To(t,cd()).constant(t.constant())},Ee.apply(t,arguments)}function Ak(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function BX(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function zX(t){return t<0?-t*t:t*t}function d3(t){var e=t(Vn,Vn),n=1;function r(){return n===1?t(Vn,Vn):n===.5?t(BX,zX):t(Ak(n),Ak(1/n))}return e.exponent=function(o){return arguments.length?(n=+o,r()):n},vi(e)}function fd(){var t=d3(Ga());return t.copy=function(){return To(t,fd()).exponent(t.exponent())},Ee.apply(t,arguments),t}function ud(){var t=[],e=[],n=[],r;function o(){var s=0,a=Math.max(1,e.length);for(n=new Array(a-1);++s<a;)n[s-1]=p_(t,s/a);return i}function i(s){return s==null||isNaN(s=+s)?r:e[fi(n,s)]}return i.invertExtent=function(s){var a=e.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:t[0],a<n.length?n[a]:t[t.length-1]]},i.domain=function(s){if(!arguments.length)return t.slice();t=[];for(let a of s)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(yt),o()},i.range=function(s){return arguments.length?(e=Array.from(s),o()):e.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return ud().domain(t).range(e).unknown(r)},Ee.apply(i,arguments)}function ld(){var t=[.5],e=[0,1],n,r=1;function o(i){return i!=null&&i<=i?e[fi(t,i,0,r)]:n}return o.domain=function(i){return arguments.length?(t=Array.from(i),r=Math.min(t.length,e.length-1),o):t.slice()},o.range=function(i){return arguments.length?(e=Array.from(i),r=Math.min(t.length,e.length-1),o):e.slice()},o.invertExtent=function(i){var s=e.indexOf(i);return[t[s-1],t[s]]},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return ld().domain(t).range(e).unknown(n)},Ee.apply(o,arguments)}var h3=new Date,m3=new Date;function Jt(t,e,n,r){function o(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return o.floor=i=>(t(i=new Date(+i)),i),o.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),o.round=i=>{let s=o(i),a=o.ceil(i);return i-s<a-i?s:a},o.offset=(i,s)=>(e(i=new Date(+i),s==null?1:Math.floor(s)),i),o.range=(i,s,a)=>{let c=[];if(i=o.ceil(i),a=a==null?1:Math.floor(a),!(i<s)||!(a>0))return c;let f;do c.push(f=new Date(+i)),e(i,a),t(i);while(f<i&&i<s);return c},o.filter=i=>Jt(s=>{if(s>=s)for(;t(s),!i(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;e(s,-1),!i(s););else for(;--a>=0;)for(;e(s,1),!i(s););}),n&&(o.count=(i,s)=>(h3.setTime(+i),m3.setTime(+s),t(h3),t(m3),Math.floor(n(h3,m3))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(r?s=>r(s)%i===0:s=>o.count(0,s)%i===0):o)),o}var pd=Jt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);pd.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Jt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):pd);var SMt=pd.range;var je=Jt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),Tk=je.range;var Si=Jt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),YX=Si.range,Mi=Jt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),UX=Mi.range;var Ai=Jt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),jX=Ai.range,Ti=Jt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),XX=Ti.range;var Cr=Jt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),WX=Cr.range,Za=Jt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),VX=Za.range,Ja=Jt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),GX=Ja.range;function Ka(t){return Jt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}var ir=Ka(0),vs=Ka(1),jg=Ka(2),Xg=Ka(3),Io=Ka(4),Wg=Ka(5),Vg=Ka(6),Ik=ir.range,HX=vs.range,QX=jg.range,ZX=Xg.range,JX=Io.range,KX=Wg.range,tW=Vg.range;function tc(t){return Jt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/6048e5)}var sr=tc(0),_s=tc(1),Gg=tc(2),Hg=tc(3),No=tc(4),Qg=tc(5),Zg=tc(6),Nk=sr.range,eW=_s.range,nW=Gg.range,rW=Hg.range,oW=No.range,iW=Qg.range,sW=Zg.range;var Ei=Jt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),aW=Ei.range,Ii=Jt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),cW=Ii.range;var bn=Jt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());bn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Jt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});var fW=bn.range,wn=Jt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Jt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});var uW=wn.range;function kk(t,e,n,r,o,i){let s=[[je,1,1e3],[je,5,5*1e3],[je,15,15*1e3],[je,30,30*1e3],[i,1,6e4],[i,5,5*6e4],[i,15,15*6e4],[i,30,30*6e4],[o,1,36e5],[o,3,3*36e5],[o,6,6*36e5],[o,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function a(f,u,p){let l=u<f;l&&([f,u]=[u,f]);let d=p&&typeof p.range=="function"?p:c(f,u,p),h=d?d.range(f,+u+1):[];return l?h.reverse():h}function c(f,u,p){let l=Math.abs(u-f)/p,d=Xr(([,,x])=>x).right(s,l);if(d===s.length)return t.every(cf(f/31536e6,u/31536e6,p));if(d===0)return pd.every(Math.max(cf(f,u,p),1));let[h,m]=s[l/s[d-1][2]<s[d][2]/l?d-1:d];return h.every(m)}return[a,c]}var[x3,hd]=kk(wn,Ii,sr,Ja,Ti,Mi),[g3,y3]=kk(bn,Ei,ir,Cr,Ai,Si);function b3(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function w3(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function md(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function v3(t){var e=t.dateTime,n=t.date,r=t.time,o=t.periods,i=t.days,s=t.shortDays,a=t.months,c=t.shortMonths,f=xd(o),u=gd(o),p=xd(i),l=gd(i),d=xd(s),h=gd(s),m=xd(a),x=gd(a),g=xd(c),y=gd(c),b={a:L,A:D,b:$,B:P,c:null,d:Pk,e:Pk,f:OW,g:jW,G:WW,H:kW,I:LW,j:RW,L:Yk,m:$W,M:DW,p:F,q,Q:Bk,s:zk,S:PW,u:FW,U:qW,V:BW,w:zW,W:YW,x:null,X:null,y:UW,Y:XW,Z:VW,"%":qk},w={a:V,A:K,b:et,B:rt,c:null,d:Fk,e:Fk,f:ZW,g:aV,G:fV,H:GW,I:HW,j:QW,L:jk,m:JW,M:KW,p:j,q:nt,Q:Bk,s:zk,S:tV,u:eV,U:nV,V:rV,w:oV,W:iV,x:null,X:null,y:sV,Y:cV,Z:uV,"%":qk},_={a:N,A:M,b:k,B:O,c:S,d:$k,e:$k,f:EW,g:Ok,G:Rk,H:Dk,I:Dk,j:SW,L:TW,m:_W,M:MW,p:E,q:vW,Q:NW,s:CW,S:AW,u:xW,U:gW,V:yW,w:mW,W:bW,x:I,X:C,y:Ok,Y:Rk,Z:wW,"%":IW};b.x=v(n,b),b.X=v(r,b),b.c=v(e,b),w.x=v(n,w),w.X=v(r,w),w.c=v(e,w);function v(Y,G){return function(tt){var B=[],_t=-1,ct=0,Ct=Y.length,Lt,Z,jt;for(tt instanceof Date||(tt=new Date(+tt));++_t<Ct;)Y.charCodeAt(_t)===37&&(B.push(Y.slice(ct,_t)),(Z=Lk[Lt=Y.charAt(++_t)])!=null?Lt=Y.charAt(++_t):Z=Lt==="e"?" ":"0",(jt=G[Lt])&&(Lt=jt(tt,Z)),B.push(Lt),ct=_t+1);return B.push(Y.slice(ct,_t)),B.join("")}}function A(Y,G){return function(tt){var B=md(1900,void 0,1),_t=T(B,Y,tt+="",0),ct,Ct;if(_t!=tt.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(G&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(ct=w3(md(B.y,0,1)),Ct=ct.getUTCDay(),ct=Ct>4||Ct===0?_s.ceil(ct):_s(ct),ct=Za.offset(ct,(B.V-1)*7),B.y=ct.getUTCFullYear(),B.m=ct.getUTCMonth(),B.d=ct.getUTCDate()+(B.w+6)%7):(ct=b3(md(B.y,0,1)),Ct=ct.getDay(),ct=Ct>4||Ct===0?vs.ceil(ct):vs(ct),ct=Cr.offset(ct,(B.V-1)*7),B.y=ct.getFullYear(),B.m=ct.getMonth(),B.d=ct.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Ct="Z"in B?w3(md(B.y,0,1)).getUTCDay():b3(md(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Ct+5)%7:B.w+B.U*7-(Ct+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,w3(B)):b3(B)}}function T(Y,G,tt,B){for(var _t=0,ct=G.length,Ct=tt.length,Lt,Z;_t<ct;){if(B>=Ct)return-1;if(Lt=G.charCodeAt(_t++),Lt===37){if(Lt=G.charAt(_t++),Z=_[Lt in Lk?G.charAt(_t++):Lt],!Z||(B=Z(Y,tt,B))<0)return-1}else if(Lt!=tt.charCodeAt(B++))return-1}return B}function E(Y,G,tt){var B=f.exec(G.slice(tt));return B?(Y.p=u.get(B[0].toLowerCase()),tt+B[0].length):-1}function N(Y,G,tt){var B=d.exec(G.slice(tt));return B?(Y.w=h.get(B[0].toLowerCase()),tt+B[0].length):-1}function M(Y,G,tt){var B=p.exec(G.slice(tt));return B?(Y.w=l.get(B[0].toLowerCase()),tt+B[0].length):-1}function k(Y,G,tt){var B=g.exec(G.slice(tt));return B?(Y.m=y.get(B[0].toLowerCase()),tt+B[0].length):-1}function O(Y,G,tt){var B=m.exec(G.slice(tt));return B?(Y.m=x.get(B[0].toLowerCase()),tt+B[0].length):-1}function S(Y,G,tt){return T(Y,e,G,tt)}function I(Y,G,tt){return T(Y,n,G,tt)}function C(Y,G,tt){return T(Y,r,G,tt)}function L(Y){return s[Y.getDay()]}function D(Y){return i[Y.getDay()]}function $(Y){return c[Y.getMonth()]}function P(Y){return a[Y.getMonth()]}function F(Y){return o[+(Y.getHours()>=12)]}function q(Y){return 1+~~(Y.getMonth()/3)}function V(Y){return s[Y.getUTCDay()]}function K(Y){return i[Y.getUTCDay()]}function et(Y){return c[Y.getUTCMonth()]}function rt(Y){return a[Y.getUTCMonth()]}function j(Y){return o[+(Y.getUTCHours()>=12)]}function nt(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var G=v(Y+="",b);return G.toString=function(){return Y},G},parse:function(Y){var G=A(Y+="",!1);return G.toString=function(){return Y},G},utcFormat:function(Y){var G=v(Y+="",w);return G.toString=function(){return Y},G},utcParse:function(Y){var G=A(Y+="",!0);return G.toString=function(){return Y},G}}}var Lk={"-":"",_:" ",0:"0"},Xe=/^\s*\d+/,pW=/^%/,dW=/[\\^$*+?|[\]().{}]/g;function qt(t,e,n){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(e)+o:o)}function hW(t){return t.replace(dW,"\\$&")}function xd(t){return new RegExp("^(?:"+t.map(hW).join("|")+")","i")}function gd(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function mW(t,e,n){var r=Xe.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function xW(t,e,n){var r=Xe.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function gW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function yW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function bW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Rk(t,e,n){var r=Xe.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ok(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function wW(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function vW(t,e,n){var r=Xe.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function _W(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function $k(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function SW(t,e,n){var r=Xe.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Dk(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function MW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function AW(t,e,n){var r=Xe.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function TW(t,e,n){var r=Xe.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function EW(t,e,n){var r=Xe.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function IW(t,e,n){var r=pW.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function NW(t,e,n){var r=Xe.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function CW(t,e,n){var r=Xe.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Pk(t,e){return qt(t.getDate(),e,2)}function kW(t,e){return qt(t.getHours(),e,2)}function LW(t,e){return qt(t.getHours()%12||12,e,2)}function RW(t,e){return qt(1+Cr.count(bn(t),t),e,3)}function Yk(t,e){return qt(t.getMilliseconds(),e,3)}function OW(t,e){return Yk(t,e)+"000"}function $W(t,e){return qt(t.getMonth()+1,e,2)}function DW(t,e){return qt(t.getMinutes(),e,2)}function PW(t,e){return qt(t.getSeconds(),e,2)}function FW(t){var e=t.getDay();return e===0?7:e}function qW(t,e){return qt(ir.count(bn(t)-1,t),e,2)}function Uk(t){var e=t.getDay();return e>=4||e===0?Io(t):Io.ceil(t)}function BW(t,e){return t=Uk(t),qt(Io.count(bn(t),t)+(bn(t).getDay()===4),e,2)}function zW(t){return t.getDay()}function YW(t,e){return qt(vs.count(bn(t)-1,t),e,2)}function UW(t,e){return qt(t.getFullYear()%100,e,2)}function jW(t,e){return t=Uk(t),qt(t.getFullYear()%100,e,2)}function XW(t,e){return qt(t.getFullYear()%1e4,e,4)}function WW(t,e){var n=t.getDay();return t=n>=4||n===0?Io(t):Io.ceil(t),qt(t.getFullYear()%1e4,e,4)}function VW(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+qt(e/60|0,"0",2)+qt(e%60,"0",2)}function Fk(t,e){return qt(t.getUTCDate(),e,2)}function GW(t,e){return qt(t.getUTCHours(),e,2)}function HW(t,e){return qt(t.getUTCHours()%12||12,e,2)}function QW(t,e){return qt(1+Za.count(wn(t),t),e,3)}function jk(t,e){return qt(t.getUTCMilliseconds(),e,3)}function ZW(t,e){return jk(t,e)+"000"}function JW(t,e){return qt(t.getUTCMonth()+1,e,2)}function KW(t,e){return qt(t.getUTCMinutes(),e,2)}function tV(t,e){return qt(t.getUTCSeconds(),e,2)}function eV(t){var e=t.getUTCDay();return e===0?7:e}function nV(t,e){return qt(sr.count(wn(t)-1,t),e,2)}function Xk(t){var e=t.getUTCDay();return e>=4||e===0?No(t):No.ceil(t)}function rV(t,e){return t=Xk(t),qt(No.count(wn(t),t)+(wn(t).getUTCDay()===4),e,2)}function oV(t){return t.getUTCDay()}function iV(t,e){return qt(_s.count(wn(t)-1,t),e,2)}function sV(t,e){return qt(t.getUTCFullYear()%100,e,2)}function aV(t,e){return t=Xk(t),qt(t.getUTCFullYear()%100,e,2)}function cV(t,e){return qt(t.getUTCFullYear()%1e4,e,4)}function fV(t,e){var n=t.getUTCDay();return t=n>=4||n===0?No(t):No.ceil(t),qt(t.getUTCFullYear()%1e4,e,4)}function uV(){return"+0000"}function qk(){return"%"}function Bk(t){return+t}function zk(t){return Math.floor(+t/1e3)}var Bf,zf,Wk,Co,Vk;_3({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 _3(t){return Bf=v3(t),zf=Bf.format,Wk=Bf.parse,Co=Bf.utcFormat,Vk=Bf.utcParse,Bf}function lV(t){return new Date(t)}function pV(t){return t instanceof Date?+t:+new Date(+t)}function Jg(t,e,n,r,o,i,s,a,c,f){var u=od(),p=u.invert,l=u.domain,d=f(".%L"),h=f(":%S"),m=f("%I:%M"),x=f("%I %p"),g=f("%a %d"),y=f("%b %d"),b=f("%B"),w=f("%Y");function _(v){return(c(v)<v?d:a(v)<v?h:s(v)<v?m:i(v)<v?x:r(v)<v?o(v)<v?g:y:n(v)<v?b:w)(v)}return u.invert=function(v){return new Date(p(v))},u.domain=function(v){return arguments.length?l(Array.from(v,pV)):l().map(lV)},u.ticks=function(v){var A=l();return t(A[0],A[A.length-1],v??10)},u.tickFormat=function(v,A){return A==null?_:f(A)},u.nice=function(v){var A=l();return(!v||typeof v.range!="function")&&(v=e(A[0],A[A.length-1],v??10)),v?l(sd(A,v)):u},u.copy=function(){return To(u,Jg(t,e,n,r,o,i,s,a,c,f))},u}function Kg(){return Ee.apply(Jg(g3,y3,bn,Ei,ir,Cr,Ai,Si,je,zf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ty(){return Ee.apply(Jg(x3,hd,wn,Ii,sr,Za,Ti,Mi,je,Co).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function yd(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function ey(){var t=0,e=.5,n=1,r=1,o,i,s,a,c,f=Vn,u,p=!1,l;function d(m){return isNaN(m=+m)?l:(m=.5+((m=+u(m))-i)*(r*m<r*i?a:c),f(p?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([t,e,n]=m,o=u(t=+t),i=u(e=+e),s=u(n=+n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,d):[t,e,n]},d.clamp=function(m){return arguments.length?(p=!!m,d):p},d.interpolator=function(m){return arguments.length?(f=m,d):f};function h(m){return function(x){var g,y,b;return arguments.length?([g,y,b]=x,f=go(m,[g,y,b]),d):[f(0),f(.5),f(1)]}}return d.range=h(rr),d.rangeRound=h($a),d.unknown=function(m){return arguments.length?(l=m,d):l},function(m){return u=m,o=m(t),i=m(e),s=m(n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,d}}function bd(){var t=vi(ey()(Vn));return t.copy=function(){return yd(t,bd())},nd.apply(t,arguments)}function ny(){var t=l3(ey()).domain([.1,1,10]);return t.copy=function(){return yd(t,ny()).base(t.base())},nd.apply(t,arguments)}function ry(){var t=p3(ey());return t.copy=function(){return yd(t,ry()).constant(t.constant())},nd.apply(t,arguments)}function oy(){var t=d3(ey());return t.copy=function(){return yd(t,oy()).exponent(t.exponent())},nd.apply(t,arguments)}function X(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}var S3=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var M3=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var A3=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var T3=X("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var E3=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var I3=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var N3=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var C3=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var k3=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var L3=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var R3=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ft=t=>I_(t[t.length-1]);var iy=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),sy=ft(iy);var ay=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),cy=ft(ay);var fy=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),uy=ft(fy);var ly=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),py=ft(ly);var wd=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),Yf=ft(wd);var dy=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),hy=ft(dy);var vd=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),Uf=ft(vd);var my=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),xy=ft(my);var gy=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),yy=ft(gy);var by=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),wy=ft(by);var vy=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),_y=ft(vy);var Sy=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),My=ft(Sy);var Ay=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),Ty=ft(Ay);var Ey=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),Iy=ft(Ey);var Ny=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),Cy=ft(Ny);var ky=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),Ly=ft(ky);var Ry=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),Oy=ft(Ry);var $y=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),Dy=ft($y);var Py=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),Fy=ft(Py);var qy=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),By=ft(qy);var zy=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),Yy=ft(zy);var Uy=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),jy=ft(Uy);var Xy=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),Wy=ft(Xy);var Vy=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),Gy=ft(Vy);var Hy=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),Qy=ft(Hy);var Zy=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),Jy=ft(Zy);var Ky=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),t1=ft(Ky);function e1(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}var n1=gf(Cn(300,.5,0),Cn(-240,.5,1));var o1=gf(Cn(-100,.75,.35),Cn(80,1.5,.8)),i1=gf(Cn(260,.75,.35),Cn(80,1.5,.8)),r1=Cn();function s1(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return r1.h=360*t-100,r1.s=1.5-1.5*e,r1.l=.8-.9*e,r1+""}var a1=Le(),dV=Math.PI/3,hV=Math.PI*2/3;function c1(t){var e;return t=(.5-t)*Math.PI,a1.r=255*(e=Math.sin(t))*e,a1.g=255*(e=Math.sin(t+dV))*e,a1.b=255*(e=Math.sin(t+hV))*e,a1+""}function f1(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function u1(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var l1=u1(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),p1=u1(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),d1=u1(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),h1=u1(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ie(t){return function(){return t}}var O3=Math.cos;var jf=Math.min,_d=Math.sin,Bt=Math.sqrt,$3=1e-12,ec=Math.PI,GTt=ec/2,Xf=2*ec;function m1(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new hs(e)}var JTt=Array.prototype.slice;function x1(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Gk(t){this._context=t}Gk.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Ni(t){return new Gk(t)}function g1(t){return t[0]}function y1(t){return t[1]}function Sd(t,e){var n=Ie(!0),r=null,o=Ni,i=null,s=m1(a);t=typeof t=="function"?t:t===void 0?g1:Ie(t),e=typeof e=="function"?e:e===void 0?y1:Ie(e);function a(c){var f,u=(c=x1(c)).length,p,l=!1,d;for(r==null&&(i=o(d=s())),f=0;f<=u;++f)!(f<u&&n(p=c[f],f,c))===l&&((l=!l)?i.lineStart():i.lineEnd()),l&&i.point(+t(p,f,c),+e(p,f,c));if(d)return i=null,d+""||null}return a.x=function(c){return arguments.length?(t=typeof c=="function"?c:Ie(+c),a):t},a.y=function(c){return arguments.length?(e=typeof c=="function"?c:Ie(+c),a):e},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ie(!!c),a):n},a.curve=function(c){return arguments.length?(o=c,r!=null&&(i=o(r)),a):o},a.context=function(c){return arguments.length?(c==null?r=i=null:i=o(r=c),a):r},a}function Wf(t,e,n){var r=null,o=Ie(!0),i=null,s=Ni,a=null,c=m1(f);t=typeof t=="function"?t:t===void 0?g1:Ie(+t),e=typeof e=="function"?e:e===void 0?Ie(0):Ie(+e),n=typeof n=="function"?n:n===void 0?y1:Ie(+n);function f(p){var l,d,h,m=(p=x1(p)).length,x,g=!1,y,b=new Array(m),w=new Array(m);for(i==null&&(a=s(y=c())),l=0;l<=m;++l){if(!(l<m&&o(x=p[l],l,p))===g)if(g=!g)d=l,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),h=l-1;h>=d;--h)a.point(b[h],w[h]);a.lineEnd(),a.areaEnd()}g&&(b[l]=+t(x,l,p),w[l]=+e(x,l,p),a.point(r?+r(x,l,p):b[l],n?+n(x,l,p):w[l]))}if(y)return a=null,y+""||null}function u(){return Sd().defined(o).curve(s).context(i)}return f.x=function(p){return arguments.length?(t=typeof p=="function"?p:Ie(+p),r=null,f):t},f.x0=function(p){return arguments.length?(t=typeof p=="function"?p:Ie(+p),f):t},f.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Ie(+p),f):r},f.y=function(p){return arguments.length?(e=typeof p=="function"?p:Ie(+p),n=null,f):e},f.y0=function(p){return arguments.length?(e=typeof p=="function"?p:Ie(+p),f):e},f.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Ie(+p),f):n},f.lineX0=f.lineY0=function(){return u().x(t).y(e)},f.lineY1=function(){return u().x(t).y(n)},f.lineX1=function(){return u().x(r).y(e)},f.defined=function(p){return arguments.length?(o=typeof p=="function"?p:Ie(!!p),f):o},f.curve=function(p){return arguments.length?(s=p,i!=null&&(a=s(i)),f):s},f.context=function(p){return arguments.length?(p==null?i=a=null:a=s(i=p),f):i},f}var b1=class{constructor(e,n){this._context=e,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(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}};function D3(t){return new b1(t,!0)}function P3(t){return new b1(t,!1)}var mV=Bt(3),Md={draw(t,e){let n=Bt(e+jf(e/28,.75))*.59436,r=n/2,o=r*mV;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-o,-r),t.lineTo(o,r),t.moveTo(-o,r),t.lineTo(o,-r)}};var Ci={draw(t,e){let n=Bt(e/ec);t.moveTo(n,0),t.arc(0,0,n,0,Xf)}};var Ad={draw(t,e){let n=Bt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};var Hk=Bt(1/3),xV=Hk*2,Td={draw(t,e){let n=Bt(e/xV),r=n*Hk;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}};var Ed={draw(t,e){let n=Bt(e)*.62625;t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}};var Id={draw(t,e){let n=Bt(e-jf(e/7,2))*.87559;t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}};var Nd={draw(t,e){let n=Bt(e),r=-n/2;t.rect(r,r,n,n)}};var Cd={draw(t,e){let n=Bt(e)*.4431;t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};var gV=.8908130915292852,Qk=_d(ec/10)/_d(7*ec/10),yV=_d(Xf/10)*Qk,bV=-O3(Xf/10)*Qk,kd={draw(t,e){let n=Bt(e*gV),r=yV*n,o=bV*n;t.moveTo(0,-n),t.lineTo(r,o);for(let i=1;i<5;++i){let s=Xf*i/5,a=O3(s),c=_d(s);t.lineTo(c*n,-a*n),t.lineTo(a*r-c*o,c*r+a*o)}t.closePath()}};var F3=Bt(3),Ld={draw(t,e){let n=-Bt(e/(F3*3));t.moveTo(0,n*2),t.lineTo(-F3*n,-n),t.lineTo(F3*n,-n),t.closePath()}};var wV=Bt(3),Rd={draw(t,e){let n=Bt(e)*.6824,r=n/2,o=n*wV/2;t.moveTo(0,-n),t.lineTo(o,r),t.lineTo(-o,r),t.closePath()}};var kr=-.5,Lr=Bt(3)/2,q3=1/Bt(12),vV=(q3/2+1)*3,Od={draw(t,e){let n=Bt(e/vV),r=n/2,o=n*q3,i=r,s=n*q3+n,a=-i,c=s;t.moveTo(r,o),t.lineTo(i,s),t.lineTo(a,c),t.lineTo(kr*r-Lr*o,Lr*r+kr*o),t.lineTo(kr*i-Lr*s,Lr*i+kr*s),t.lineTo(kr*a-Lr*c,Lr*a+kr*c),t.lineTo(kr*r+Lr*o,kr*o-Lr*r),t.lineTo(kr*i+Lr*s,kr*s-Lr*i),t.lineTo(kr*a+Lr*c,kr*c-Lr*a),t.closePath()}};var Vf={draw(t,e){let n=Bt(e-jf(e/6,1.7))*.6189;t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};var w1=[Ci,Ad,Td,Nd,kd,Ld,Od],B3=[Ci,Id,Vf,Rd,Md,Cd,Ed];function Rr(){}function Gf(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function $d(t){this._context=t}$d.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:Gf(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:Gf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function z3(t){return new $d(t)}function Zk(t){this._context=t}Zk.prototype={areaStart:Rr,areaEnd:Rr,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Gf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Y3(t){return new Zk(t)}function Jk(t){this._context=t}Jk.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(t,e){switch(t=+t,e=+e,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+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Gf(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function U3(t){return new Jk(t)}function Kk(t,e){this._basis=new $d(t),this._beta=e}Kk.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r=t[0],o=e[0],i=t[n]-r,s=e[n]-o,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*t[a]+(1-this._beta)*(r+c*i),this._beta*e[a]+(1-this._beta)*(o+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var j3=function t(e){function n(r){return e===1?new $d(r):new Kk(r,e)}return n.beta=function(r){return t(+r)},n}(.85);function Hf(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function v1(t,e){this._context=t,this._k=(1-e)/6}v1.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:Hf(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Hf(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var X3=function t(e){function n(r){return new v1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function _1(t,e){this._context=t,this._k=(1-e)/6}_1.prototype={areaStart:Rr,areaEnd:Rr,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Hf(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var W3=function t(e){function n(r){return new _1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function S1(t,e){this._context=t,this._k=(1-e)/6}S1.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(t,e){switch(t=+t,e=+e,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:Hf(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var V3=function t(e){function n(r){return new S1(r,e)}return n.tension=function(r){return t(+r)},n}(0);function Dd(t,e,n){var r=t._x1,o=t._y1,i=t._x2,s=t._y2;if(t._l01_a>$3){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,o=(o*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>$3){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);i=(i*f+t._x1*t._l23_2a-e*t._l12_2a)/u,s=(s*f+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,o,i,s,t._x2,t._y2)}function tL(t,e){this._context=t,this._alpha=e}tL.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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Dd(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var G3=function t(e){function n(r){return e?new tL(r,e):new v1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function eL(t,e){this._context=t,this._alpha=e}eL.prototype={areaStart:Rr,areaEnd:Rr,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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Dd(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var H3=function t(e){function n(r){return e?new eL(r,e):new _1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function nL(t,e){this._context=t,this._alpha=e}nL.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(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;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:Dd(this,t,e);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=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Q3=function t(e){function n(r){return e?new nL(r,e):new S1(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function rL(t){this._context=t}rL.prototype={areaStart:Rr,areaEnd:Rr,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Z3(t){return new rL(t)}function oL(t){return t<0?-1:1}function iL(t,e,n){var r=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(r||o<0&&-0),s=(n-t._y1)/(o||r<0&&-0),a=(i*o+s*r)/(r+o);return(oL(i)+oL(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(a))||0}function sL(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function J3(t,e,n){var r=t._x0,o=t._y0,i=t._x1,s=t._y1,a=(i-r)/3;t._context.bezierCurveTo(r+a,o+a*e,i-a,s-a*n,i,s)}function M1(t){this._context=t}M1.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:J3(this,this._t0,sL(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,J3(this,sL(this,n=iL(this,t,e)),n);break;default:J3(this,this._t0,n=iL(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function aL(t){this._context=new cL(t)}(aL.prototype=Object.create(M1.prototype)).point=function(t,e){M1.prototype.point.call(this,e,t)};function cL(t){this._context=t}cL.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,o,i){this._context.bezierCurveTo(e,t,r,n,i,o)}};function K3(t){return new M1(t)}function tS(t){return new aL(t)}function uL(t){this._context=t}uL.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=fL(t),o=fL(e),i=0,s=1;s<n;++i,++s)this._context.bezierCurveTo(r[0][i],o[0][i],r[1][i],o[1][i],t[s],e[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function fL(t){var e,n=t.length-1,r,o=new Array(n),i=new Array(n),s=new Array(n);for(o[0]=0,i[0]=2,s[0]=t[0]+2*t[1],e=1;e<n-1;++e)o[e]=1,i[e]=4,s[e]=4*t[e]+2*t[e+1];for(o[n-1]=2,i[n-1]=7,s[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=o[e]/i[e-1],i[e]-=r,s[e]-=r*s[e-1];for(o[n-1]=s[n-1]/i[n-1],e=n-2;e>=0;--e)o[e]=(s[e]-o[e+1])/i[e];for(i[n-1]=(t[n]+o[n-1])/2,e=0;e<n-1;++e)i[e]=2*t[e+1]-o[e+1];return[o,i]}function eS(t){return new uL(t)}function A1(t,e){this._context=t,this._t=e}A1.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function nS(t){return new A1(t,.5)}function rS(t){return new A1(t,0)}function oS(t){return new A1(t,1)}var Pd=t=>()=>t;function iS(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function ar(t,e,n){this.k=t,this.x=e,this.y=n}ar.prototype={constructor:ar,scale:function(t){return t===1?this:new ar(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ar(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Fd=new ar(1,0,0);sS.prototype=ar.prototype;function sS(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Fd;return t.__zoom}function T1(t){t.stopImmediatePropagation()}function Qf(t){t.preventDefault(),t.stopImmediatePropagation()}function _V(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function SV(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function lL(){return this.__zoom||Fd}function MV(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function AV(){return navigator.maxTouchPoints||"ontouchstart"in this}function TV(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function aS(){var t=_V,e=SV,n=TV,r=MV,o=AV,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=O_,f=Na("start","zoom","end"),u,p,l,d=500,h=150,m=0,x=10;function g(S){S.property("__zoom",lL).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",N).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,I,C,L){var D=S.selection?S.selection():S;D.property("__zoom",lL),S!==D?_(S,I,C,L):D.interrupt().each(function(){v(this,arguments).event(L).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},g.scaleBy=function(S,I,C,L){g.scaleTo(S,function(){var D=this.__zoom.k,$=typeof I=="function"?I.apply(this,arguments):I;return D*$},C,L)},g.scaleTo=function(S,I,C,L){g.transform(S,function(){var D=e.apply(this,arguments),$=this.__zoom,P=C==null?w(D):typeof C=="function"?C.apply(this,arguments):C,F=$.invert(P),q=typeof I=="function"?I.apply(this,arguments):I;return n(b(y($,q),P,F),D,s)},C,L)},g.translateBy=function(S,I,C,L){g.transform(S,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),e.apply(this,arguments),s)},null,L)},g.translateTo=function(S,I,C,L,D){g.transform(S,function(){var $=e.apply(this,arguments),P=this.__zoom,F=L==null?w($):typeof L=="function"?L.apply(this,arguments):L;return n(Fd.translate(F[0],F[1]).scale(P.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),$,s)},L,D)};function y(S,I){return I=Math.max(i[0],Math.min(i[1],I)),I===S.k?S:new ar(I,S.x,S.y)}function b(S,I,C){var L=I[0]-C[0]*S.k,D=I[1]-C[1]*S.k;return L===S.x&&D===S.y?S:new ar(S.k,L,D)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,I,C,L){S.on("start.zoom",function(){v(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(L).end()}).tween("zoom",function(){var D=this,$=arguments,P=v(D,$).event(L),F=e.apply(D,$),q=C==null?w(F):typeof C=="function"?C.apply(D,$):C,V=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),K=D.__zoom,et=typeof I=="function"?I.apply(D,$):I,rt=c(K.invert(q).concat(V/K.k),et.invert(q).concat(V/et.k));return function(j){if(j===1)j=et;else{var nt=rt(j),Y=V/nt[2];j=new ar(Y,q[0]-nt[0]*Y,q[1]-nt[1]*Y)}P.zoom(null,j)}})}function v(S,I,C){return!C&&S.__zooming||new A(S,I)}function A(S,I){this.that=S,this.args=I,this.active=0,this.sourceEvent=null,this.extent=e.apply(S,I),this.taps=0}A.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,I){return this.mouse&&S!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var I=Nt(this.that).datum();f.call(S,this.that,new iS(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:f}),I)}};function T(S,...I){if(!t.apply(this,arguments))return;var C=v(this,I).event(S),L=this.__zoom,D=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),$=hn(S);if(C.wheel)(C.mouse[0][0]!==$[0]||C.mouse[0][1]!==$[1])&&(C.mouse[1]=L.invert(C.mouse[0]=$)),clearTimeout(C.wheel);else{if(L.k===D)return;C.mouse=[$,L.invert($)],yo(this),C.start()}Qf(S),C.wheel=setTimeout(P,h),C.zoom("mouse",n(b(y(L,D),C.mouse[0],C.mouse[1]),C.extent,s));function P(){C.wheel=null,C.end()}}function E(S,...I){if(l||!t.apply(this,arguments))return;var C=S.currentTarget,L=v(this,I,!0).event(S),D=Nt(S.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",V,!0),$=hn(S,C),P=S.clientX,F=S.clientY;hp(S.view),T1(S),L.mouse=[$,this.__zoom.invert($)],yo(this),L.start();function q(K){if(Qf(K),!L.moved){var et=K.clientX-P,rt=K.clientY-F;L.moved=et*et+rt*rt>m}L.event(K).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=hn(K,C),L.mouse[1]),L.extent,s))}function V(K){D.on("mousemove.zoom mouseup.zoom",null),mp(K.view,L.moved),Qf(K),L.event(K).end()}}function N(S,...I){if(t.apply(this,arguments)){var C=this.__zoom,L=hn(S.changedTouches?S.changedTouches[0]:S,this),D=C.invert(L),$=C.k*(S.shiftKey?.5:2),P=n(b(y(C,$),L,D),e.apply(this,I),s);Qf(S),a>0?Nt(this).transition().duration(a).call(_,P,L,S):Nt(this).call(g.transform,P,L,S)}}function M(S,...I){if(t.apply(this,arguments)){var C=S.touches,L=C.length,D=v(this,I,S.changedTouches.length===L).event(S),$,P,F,q;for(T1(S),P=0;P<L;++P)F=C[P],q=hn(F,this),q=[q,this.__zoom.invert(q),F.identifier],D.touch0?!D.touch1&&D.touch0[2]!==q[2]&&(D.touch1=q,D.taps=0):(D.touch0=q,$=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),$&&(D.taps<2&&(p=q[0],u=setTimeout(function(){u=null},d)),yo(this),D.start())}}function k(S,...I){if(this.__zooming){var C=v(this,I).event(S),L=S.changedTouches,D=L.length,$,P,F,q;for(Qf(S),$=0;$<D;++$)P=L[$],F=hn(P,this),C.touch0&&C.touch0[2]===P.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===P.identifier&&(C.touch1[0]=F);if(P=C.that.__zoom,C.touch1){var V=C.touch0[0],K=C.touch0[1],et=C.touch1[0],rt=C.touch1[1],j=(j=et[0]-V[0])*j+(j=et[1]-V[1])*j,nt=(nt=rt[0]-K[0])*nt+(nt=rt[1]-K[1])*nt;P=y(P,Math.sqrt(j/nt)),F=[(V[0]+et[0])/2,(V[1]+et[1])/2],q=[(K[0]+rt[0])/2,(K[1]+rt[1])/2]}else if(C.touch0)F=C.touch0[0],q=C.touch0[1];else return;C.zoom("touch",n(b(P,F,q),C.extent,s))}}function O(S,...I){if(this.__zooming){var C=v(this,I).event(S),L=S.changedTouches,D=L.length,$,P;for(T1(S),l&&clearTimeout(l),l=setTimeout(function(){l=null},d),$=0;$<D;++$)P=L[$],C.touch0&&C.touch0[2]===P.identifier?delete C.touch0:C.touch1&&C.touch1[2]===P.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(P=hn(P,this),Math.hypot(p[0]-P[0],p[1]-P[1])<x)){var F=Nt(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Pd(+S),g):r},g.filter=function(S){return arguments.length?(t=typeof S=="function"?S:Pd(!!S),g):t},g.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Pd(!!S),g):o},g.extent=function(S){return arguments.length?(e=typeof S=="function"?S:Pd([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):e},g.scaleExtent=function(S){return arguments.length?(i[0]=+S[0],i[1]=+S[1],g):[i[0],i[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(n=S,g):n},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=f.on.apply(f,arguments);return S===f?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(x=+S,g):x},g}function oe(t){return t!=null&&!Number.isNaN(t)}function We(t,e){return+oe(e)-+oe(t)||yt(t,e)}function nc(t,e){return+oe(e)-+oe(t)||An(t,e)}function qd(t){return t!=null&&`${t}`!=""}function Zf(t){return isFinite(t)?t:NaN}function Pn(t){return t>0&&isFinite(t)?t:NaN}function Ss(t){return t<0&&isFinite(t)?t:NaN}function Jf(t,e){if(t instanceof Date||(t=new Date(+t)),isNaN(t))return typeof e=="function"?e(t):e;let n=t.getUTCHours(),r=t.getUTCMinutes(),o=t.getUTCSeconds(),i=t.getUTCMilliseconds();return`${EV(t.getUTCFullYear(),4)}-${ki(t.getUTCMonth()+1,2)}-${ki(t.getUTCDate(),2)}${n||r||o||i?`T${ki(n,2)}:${ki(r,2)}${o||i?`:${ki(o,2)}${i?`.${ki(i,3)}`:""}`:""}Z`:""}`}function EV(t){return t<0?`-${ki(-t,6)}`:t>9999?`+${ki(t,6)}`:ki(t,4)}function ki(t,e){return`${t}`.padStart(e,"0")}var IV=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Bd(t,e){return IV.test(t+="")?new Date(t):typeof e=="function"?e(t):e}function Li(t){if(t==null)return;let e=t[0],n=t[t.length-1];return An(e,n)}var tu=1e3,As=tu*60,Ts=As*60,Lo=Ts*24,ko=Lo*7,rc=Lo*30,Ms=Lo*365,cS=[["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",tu],["5 seconds",5*tu],["15 seconds",15*tu],["30 seconds",30*tu],["minute",As],["5 minutes",5*As],["15 minutes",15*As],["30 minutes",30*As],["hour",Ts],["3 hours",3*Ts],["6 hours",6*Ts],["12 hours",12*Ts],["day",Lo],["2 days",2*Lo],["week",ko],["2 weeks",2*ko],["month",rc],["3 months",3*rc],["6 months",6*rc],["year",Ms],["2 years",2*Ms],["5 years",5*Ms],["10 years",10*Ms],["20 years",20*Ms],["50 years",50*Ms],["100 years",100*Ms]],fS=new Map([["second",tu],["minute",As],["hour",Ts],["day",Lo],["monday",ko],["tuesday",ko],["wednesday",ko],["thursday",ko],["friday",ko],["saturday",ko],["sunday",ko],["week",ko],["month",rc],["year",Ms]]),dL=new Map([["second",je],["minute",Si],["hour",Ai],["day",Cr],["monday",vs],["tuesday",jg],["wednesday",Xg],["thursday",Io],["friday",Wg],["saturday",Vg],["sunday",ir],["week",ir],["month",Ei],["year",bn]]),uS=new Map([["second",je],["minute",Mi],["hour",Ti],["day",Ja],["monday",_s],["tuesday",Gg],["wednesday",Hg],["thursday",No],["friday",Qg],["saturday",Zg],["sunday",sr],["week",sr],["month",Ii],["year",wn]]),eu=Symbol("intervalDuration"),I1=Symbol("intervalType");for(let[t,e]of dL)e[eu]=fS.get(t),e[I1]="time";for(let[t,e]of uS)e[eu]=fS.get(t),e[I1]="utc";var zd=[["year",wn,"utc"],["month",Ii,"utc"],["day",Ja,"utc",6*rc],["hour",Ti,"utc",3*Lo],["minute",Mi,"utc",6*Ts],["second",je,"utc",30*As]],E1=[["year",bn,"time"],["month",Ei,"time"],["day",Cr,"time",6*rc],["hour",Ai,"time",3*Lo],["minute",Si,"time",6*Ts],["second",je,"time",30*As]],NV=[zd[0],E1[0],zd[1],E1[1],zd[2],E1[2],...zd.slice(3)];function N1(t){let e=`${t}`.toLowerCase();e.endsWith("s")&&(e=e.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(e);switch(r&&(e=e.slice(r[0].length),n=+r[1]),e){case"quarter":e="month",n*=3;break;case"half":e="month",n*=6;break}let o=uS.get(e);if(!o)throw new Error(`unknown interval: ${t}`);if(n>1&&!o.every)throw new Error(`non-periodic interval: ${e}`);return[e,n]}function Yd(t){return hL(N1(t),"time")}function oc(t){return hL(N1(t),"utc")}function hL([t,e],n){let r=(n==="time"?dL:uS).get(t);return e>1&&(r=r.every(e),r[eu]=fS.get(t)*e,r[I1]=n),r}function lS(t,e){if(!(e>1))return;let n=t[eu];if(!cS.some(([,o])=>o===n)||n%Lo===0&&Lo<n&&n<rc)return;let[r]=cS[Xr(([,o])=>Math.log(o)).center(cS,Math.log(n*e))];return(t[I1]==="time"?Yd:oc)(r)}function pL(t,e,n){let r=e==="time"?zf:Co;if(n==null)return r(t==="year"?"%Y":t==="month"?"%Y-%m":t==="day"?"%Y-%m-%d":t==="hour"||t==="minute"?"%Y-%m-%dT%H:%M":t==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let o=CV(n);switch(t){case"millisecond":return Kf(r(".%L"),r(":%M:%S"),o);case"second":return Kf(r(":%S"),r("%-I:%M"),o);case"minute":return Kf(r("%-I:%M"),r("%p"),o);case"hour":return Kf(r("%-I %p"),r("%b %-d"),o);case"day":return Kf(r("%-d"),r("%b"),o);case"month":return Kf(r("%b"),r("%Y"),o);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function CV(t){return t==="left"||t==="right"?(e,n)=>`
|
|
3
3
|
${e}
|
|
4
4
|
${n}`:t==="top"?(e,n)=>`${n}
|
|
5
5
|
${e}`:(e,n)=>`${e}
|
|
6
|
-
${n}`}function oX(t){return t==="time"?Ry:t==="utc"?Ep:nX}function Z9(t,e,n){let r=Ct(Cm(e,(o,i)=>Math.abs(i-o)));if(r<1e3)return V9("millisecond","utc",n);for(let[o,i,s,a]of oX(t)){if(r>a||o==="hour"&&!r)break;if(e.every(c=>i.floor(c)>=c))return V9(o,s,n)}}function ff(t,e,n){return(r,o,i)=>{let s=t(r,o),a=e(r,o),c=o-oi(i);return o!==c&&i[c]!==void 0&&a===e(i[c],c)?s:n(s,a)}}var $p=Object.getPrototypeOf(Uint8Array),iX=Object.prototype.toString;function Cn(t){return t instanceof Array||t instanceof $p}function J9(t){return t instanceof $p&&!sX(t)}function K9(t){return t?.prototype instanceof $p&&!aX(t)}function sX(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function aX(t){return t===BigInt64Array||t===BigUint64Array}var o6=Symbol("reindex");function ut(t,e,n){let r=typeof e;return r==="string"?uC(t)?i6(t.getChild(e),n):Q9(t,s6(e),n):r==="function"?Q9(t,e,n):r==="number"||e instanceof Date||r==="boolean"?Et(t,re(e),n):typeof e?.transform=="function"?r6(e.transform(t),n):cX(r6(e,n),t?.[o6])}function cX(t,e){return t!=null&&e?kp(t,e):t}function Q9(t,e,n){return Et(t,K9(n)?(r,o)=>a6(e(r,o)):e,n)}function r6(t,e){return e===void 0?Un(t):pC(t)?i6(t,e):t instanceof e?t:e.from(t,K9(e)&&!J9(t)?a6:void 0)}function i6(t,e){return t==null?t:(e===void 0||e===Array)&&uX(t.type)?c6(t.toArray()):r6(t.toArray(),e)}var Qi=[null],s6=t=>e=>{let n=e[t];return n===void 0&&e.type==="Feature"?e.properties?.[t]:n},Xt={transform:wn},V={transform:t=>t};var Cp=()=>1,tC=()=>!0,fe=t=>t==null?t:`${t}`,Ot=t=>t==null?t:+t;var Aa=t=>t?t[0]:void 0,Ji=t=>t?t[1]:void 0,eC=t=>t?t[2]:void 0,re=t=>()=>t;function pf(t){let e=+`${t}`.slice(1)/100;return(n,r)=>ln(n,e,r)}function xe(t){return J9(t)?t:Et(t,a6,Float64Array)}function a6(t){return t==null?NaN:Number(t)}function c6(t){return Et(t,f6)}function f6(t){return t instanceof Date&&!isNaN(t)?t:typeof t=="string"?Tp(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function ee(t,e){return t===void 0&&(t=e),t===null?[void 0,"none"]:ns(t)?[void 0,t]:[t,void 0]}function Ft(t,e){return t===void 0&&(t=e),t===null||typeof t=="number"?[void 0,t]:[t,void 0]}function l6(t,e,n){if(t!=null)return Se(t,e,n)}function Se(t,e,n){let r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function ii(t){return uC(t)?t:Un(t)}function Un(t){if(t==null||Cn(t))return t;if(pC(t))return i6(t);switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[t]}return Array.from(t)}function Et(t,e,n=Array){return t==null?t:t instanceof n?t.map(e):n.from(t,e)}function Ki(t,e=Array){return t instanceof e?t.slice():e.from(t)}function u6({x:t,x1:e,x2:n}){return t!==void 0||e!==void 0||n!==void 0}function p6({y:t,y1:e,y2:n}){return t!==void 0||e!==void 0||n!==void 0}function si(t){return u6(t)||p6(t)||t.interval!==void 0}function Ne(t){return t?.toString===iX}function so(t){return Ne(t)&&(t.type!==void 0||t.domain!==void 0)}function jn(t){return Ne(t)&&typeof t.transform!="function"}function ao(t){return jn(t)&&t.value===void 0&&t.channel===void 0}function d6(t,e,n,r=V){return e===void 0&&n===void 0?(e=0,n=t===void 0?r:t):e===void 0?e=t===void 0?0:t:n===void 0&&(n=t===void 0?0:t),[e,n]}function ae(t,e){return t===void 0&&e===void 0?[Aa,Ji]:[t,e]}function nn({z:t,fill:e,stroke:n}={}){return t===void 0&&([t]=ee(e)),t===void 0&&([t]=ee(n)),t}function ts(t){return Cn(t)?t.length:t?.numRows}function wn(t){let e=ts(t),n=new Uint32Array(e);for(let r=0;r<e;++r)n[r]=r;return n}function kp(t,e){return Cn(t)?Et(e,n=>t[n],t.constructor):Et(e,n=>t.at(n))}function df(t){return t.length===1?(e,n)=>t(kp(n,e)):t}function ai(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function pr(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Py(t,e){if(e[t]!==void 0)return e[t];switch(t){case"x1":case"x2":t="x";break;case"y1":case"y2":t="y";break}return e[t]}function Oe(t){let e;return[{transform:()=>e,label:Ve(t)},n=>e=n]}function Ge(t){return t==null?[t]:Oe(t)}function Ve(t,e){return typeof t=="string"?t:t&&t.label!==void 0?t.label:e}function hf(t,e){return{transform(n){let r=t.transform(n),o=e.transform(n);return ne(r)||ne(o)?Et(r,(i,s)=>new Date((+r[s]+ +o[s])/2)):Et(r,(i,s)=>(+r[s]+ +o[s])/2,Float64Array)},label:t.label}}function Ta(t,e){let n=h6(e?.interval,e?.type);return n?Et(t,n):t}function h6(t,e){let n=mf(t,e);return n&&(r=>Jt(r)?n.floor(r):r)}function mf(t,e){if(t!=null){if(typeof t=="number")return m6(t);if(typeof t=="string")return(e==="time"?Ip:Ma)(t);if(typeof t.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof t.offset!="function")throw new Error("invalid interval; missing offset method");return t}}function m6(t){t=+t,0<t&&t<1&&Number.isInteger(1/t)&&(t=-1/t);let e=Math.abs(t);return t<0?{floor:n=>Math.floor(n*e)/e,offset:(n,r=1)=>(n*e+Math.floor(r))/e,range:(n,r)=>ce(Math.ceil(n*e),r*e).map(o=>o/e)}:{floor:n=>Math.floor(n/e)*e,offset:(n,r=1)=>n+e*Math.floor(r),range:(n,r)=>ce(Math.ceil(n/e),r/e).map(o=>o*e)}}function co(t,e){if(t=mf(t,e),t&&typeof t.range!="function")throw new Error("invalid interval: missing range method");return t}function nC(t,e){if(t=co(t,e),t&&typeof t.ceil!="function")throw new Error("invalid interval: missing ceil method");return t}function rC(t){return es(t)&&typeof t?.floor=="function"&&t.floor()instanceof Date}function es(t){return typeof t?.range=="function"}function dr(t){return t===void 0||jn(t)?t:{value:t}}function oC(t){return t==null?null:{transform:e=>ut(e,t,Float64Array),label:Ve(t)}}function iC(t){if(!vn(t))return!1;for(let e of t)if(e!=null)return typeof e=="object"&&"0"in e&&"1"in e}function vn(t){return t&&typeof t[Symbol.iterator]=="function"}function Fy(t){for(let e of t)if(e!=null)return typeof e!="object"||e instanceof Date}function Kt(t){for(let e of t){if(e==null)continue;let n=typeof e;return n==="string"||n==="boolean"}}function ne(t){for(let e of t)if(e!=null)return e instanceof Date}function sC(t){for(let e of t)if(e!=null)return typeof e=="string"&&isNaN(e)&&Tp(e)}function aC(t){for(let e of t)if(e!=null){if(typeof e!="string")return!1;if(e.trim())return!isNaN(e)}}function ci(t){for(let e of t)if(e!=null)return typeof e=="number"}function qy(t,e){let n;for(let r of t)if(r!=null){if(!e(r))return!1;n=!0}return n}var fX=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 ns(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(t)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(t)||fX.has(t))}function cC(t){return typeof t=="number"&&(0<=t&&t<=1||isNaN(t))}function Pt(t){return t==null||fi(t)}function fi(t){return/^\s*none\s*$/i.test(t)}function fC(t){return/^\s*round\s*$/i.test(t)}function By(t,e){return l6(t,e,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function fo(t="middle"){return By(t,"frameAnchor")}function lC(t={},...e){let n=t;for(let r of e)for(let o in r)if(n[o]===void 0){let i=r[o];n===t?n={...n,[o]:i}:n[o]=i}return n}function lX(t){console.warn("named iterables are deprecated; please use an object instead");let e=new Set;return Object.fromEntries(Array.from(t,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let o=`${r}`;if(o==="__proto__")throw new Error(`illegal name: ${o}`);if(e.has(o))throw new Error(`duplicate name: ${o}`);return e.add(o),[r,n]}))}function Np(t){return vn(t)?lX(t):t}function zy(t){return t===!0?t="frame":t===!1?t=null:t!=null&&(t=Se(t,"clip",["frame","sphere"])),t}function uC(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}function pC(t){return t&&typeof t.toArray=="function"&&t.type}function uX(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}var hr=Symbol("position"),Xn=Symbol("color"),Ea=Symbol("radius"),Ia=Symbol("length"),$a=Symbol("opacity"),gf=Symbol("symbol"),dC=Symbol("projection"),Yt=new Map([["x",hr],["y",hr],["fx",hr],["fy",hr],["r",Ea],["color",Xn],["opacity",$a],["symbol",gf],["length",Ia],["projection",dC]]);function hC(t){return t===hr||t===dC}function mC(t){return t===hr||t===Ea||t===Ia||t===$a}var g6=Math.sqrt(3),y6=2/g6,pX={draw(t,e){let n=Math.sqrt(e/Math.PI),r=n*y6,o=r/2;t.moveTo(0,r),t.lineTo(n,o),t.lineTo(n,-o),t.lineTo(0,-r),t.lineTo(-n,-o),t.lineTo(-n,o),t.closePath()}},x6=new Map([["asterisk",lp],["circle",ni],["cross",up],["diamond",pp],["diamond2",dp],["hexagon",pX],["plus",hp],["square",mp],["square2",gp],["star",yp],["times",nf],["triangle",xp],["triangle2",bp],["wye",wp]]);function b6(t){return t&&typeof t.draw=="function"}function gC(t){return b6(t)?!0:typeof t!="string"?!1:x6.has(t.toLowerCase())}function yf(t){if(t==null||b6(t))return t;let e=x6.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function yC(t){if(t==null||b6(t))return[void 0,t];if(typeof t=="string"){let e=x6.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}function be({filter:t,sort:e,reverse:n,transform:r,initializer:o,...i}={},s){if(r===void 0&&(t!=null&&(r=_6(t)),e!=null&&!ao(e)&&(r=w6(r,M6(e))),n&&(r=w6(r,S6))),s!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(e===null||ao(e))&&{sort:e},transform:w6(r,s)}}function Vt({filter:t,sort:e,reverse:n,initializer:r,...o}={},i){return r===void 0&&(t!=null&&(r=_6(t)),e!=null&&!ao(e)&&(r=v6(r,M6(e))),n&&(r=v6(r,S6))),{...o,...(e===null||ao(e))&&{sort:e},initializer:v6(r,i)}}function w6(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,o){return{data:n,facets:r}=t.call(this,n,r,o),e.call(this,ii(n),r,o)}}function v6(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,o,...i){let s,a,c,f,l,u;return{data:a=n,facets:c=r,channels:s}=t.call(this,n,r,o,...i),{data:l=a,facets:u=c,channels:f}=e.call(this,a,c,{...o,...s},...i),{data:l,facets:u,channels:{...s,...f}}}}function Yy(t,e){return(t.initializer!=null?Vt:be)(t,e)}function xC(t,e){return Yy(e,_6(t))}function _6(t){return(e,n)=>{let r=ut(e,t);return{data:e,facets:n.map(o=>o.filter(i=>r[i]))}}}function bC({sort:t,...e}={}){return{...Yy(e,S6),sort:ao(t)?t:null}}function S6(t,e){return{data:t,facets:e.map(n=>n.slice().reverse())}}function wC({seed:t,sort:e,...n}={}){return{...Yy(n,vC(t==null?Math.random:pa(t))),sort:ao(e)?e:null}}function Uy(t,{sort:e,...n}={}){return{...(jn(t)&&t.channel!==void 0?Vt:Yy)(n,M6(t)),sort:ao(e)?e:null}}function M6(t){return(typeof t=="function"&&t.length!==1?dX:vC)(t)}function dX(t){return(e,n)=>{let r=Cn(e)?(o,i)=>t(e[o],e[i]):(o,i)=>t(e.get(o),e.get(i));return{data:e,facets:n.map(o=>o.slice().sort(r))}}}function vC(t){let e,n;({channel:e,value:t,order:n}={...dr(t)});let r=e?.startsWith("-");if(r&&(e=e.slice(1)),n===void 0&&(n=r?_a:ke),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=ke;break;case"descending":n=_a;break;default:throw new Error(`invalid order: ${n}`)}return(o,i,s)=>{let a;if(e===void 0)a=ut(o,t);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[e],!a)return{};a=a.value}let c=(f,l)=>n(a[f],a[l]);return{data:o,facets:i.map(f=>f.slice().sort(c))}}}function Rp(t,e){return jy(null,null,t,e)}function rs(t={y:"count"},e={}){let{x:n=V}=e;if(n==null)throw new Error("missing channel: x");return jy(n,null,t,e)}function os(t={x:"count"},e={}){let{y:n=V}=e;if(n==null)throw new Error("missing channel: y");return jy(null,n,t,e)}function Lp(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=ae(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return jy(n,r,t,e)}function jy(t,e,{data:n=Vy,filter:r,sort:o,reverse:i,...s}={},a={}){s=T6(s,a),n=TC(n,V),o=o==null?void 0:MC("sort",o,a),r=r==null?void 0:AC("filter",r,a);let[c,f]=Ge(t),[l,u]=Ge(e),{z:p,fill:d,stroke:h,x1:m,x2:g,y1:y,y2:x,...b}=a,[w,_]=Ge(p),[v]=ee(d),[A]=ee(h),[E,T]=Ge(v),[$,M]=Ge(A);return{..."z"in a&&{z:w||p},..."fill"in a&&{fill:E||d},..."stroke"in a&&{stroke:$||h},...be(b,(k,R,S)=>{let I=Ta(ut(k,t),S?.x),C=Ta(ut(k,e),S?.y),N=ut(k,p),D=ut(k,v),L=ut(k,A),P=Dp(s,{z:N,fill:D,stroke:L}),F=[],q=[],W=I&&f([]),tt=C&&u([]),nt=N&&_([]),ot=D&&T([]),X=L&&M([]),rt=0;for(let Y of s)Y.initialize(k);o&&o.initialize(k),r&&r.initialize(k);for(let Y of R){let H=[];for(let et of s)et.scope("facet",Y);o&&o.scope("facet",Y),r&&r.scope("facet",Y);for(let[et,B]of lo(Y,P))for(let[wt,ct]of lo(B,C))for(let[It,kt]of lo(ct,I)){let J={data:k};if(I&&(J.x=It),C&&(J.y=wt),P&&(J.z=et),!(r&&!r.reduce(kt,J))){H.push(rt++),q.push(n.reduceIndex(kt,k,J)),I&&W.push(It),C&&tt.push(wt),N&&nt.push(P===N?et:N[kt[0]]),D&&ot.push(P===D?et:D[kt[0]]),L&&X.push(P===L?et:L[kt[0]]);for(let qt of s)qt.reduce(kt,J);o&&o.reduce(kt,J)}}F.push(H)}return E6(F,o,i),{data:q,facets:F}}),...!uo(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!uo(s,"y")&&(l?{y:l}:{y1:y,y2:x}),...Object.fromEntries(s.map(({name:k,output:R})=>[k,R]))}}function uo(t,...e){for(let{name:n}of t)if(e.includes(n))return!0;return!1}function A6(t,e,n=Xy){let r=Object.entries(t);return e.title!=null&&t.title===void 0&&r.push(["title",bX]),e.href!=null&&t.href===void 0&&r.push(["href",Wy]),r.filter(([,o])=>o!==void 0).map(([o,i])=>i===null?hX(o):n(o,i,e))}function Xy(t,e,n,r=Gy){let o;Ne(e)&&"reduce"in e&&(o=e.scale,e=e.reduce);let i=r(t,e,n),[s,a]=Oe(i.label),c;return{name:t,output:o===void 0?s:{value:s,scale:o},initialize(f){i.initialize(f),c=a([])},scope(f,l){i.scope(f,l)},reduce(f,l){c.push(i.reduce(f,l))}}}function hX(t){return{name:t,initialize(){},scope(){},reduce(){}}}function Gy(t,e,n,r=xf){let o=Py(t,n),i=r(e,o),s,a;return{label:Ve(i===Op?null:o,i.label),initialize(c){s=o===void 0?c:ut(c,o),i.scope==="data"&&(a=i.reduceIndex(wn(c),s))},scope(c,f){i.scope===c&&(a=i.reduceIndex(f,s))},reduce(c,f){return i.scope==null?i.reduceIndex(c,s,f):i.reduceIndex(c,s,a,f)}}}function lo(t,e){return e?ze(t,n=>e[n]):[[,t]]}function xf(t,e,n=mX){if(t==null)return n(t);if(typeof t.reduceIndex=="function")return t;if(typeof t.reduce=="function"&&Ne(t))return yX(t);if(typeof t=="function")return xX(t);if(/^p\d{2}$/i.test(t))return li(pf(t));switch(`${t}`.toLowerCase()){case"first":return Wy;case"last":return wX;case"identity":return Vy;case"count":return Op;case"distinct":return vX;case"sum":return e==null?Op:_X;case"proportion":return SC(e,"data");case"proportion-facet":return SC(e,"facet");case"deviation":return li(nr);case"min":return li(Bt);case"min-index":return li(Em);case"max":return li(Ct);case"max-index":return li(Tm);case"mean":return _C(Fo);case"median":return _C(_r);case"variance":return li(ki);case"mode":return li(wc)}return n(t)}function mX(t){throw new Error(`invalid reduce: ${t}`)}function T6(t,e){return A6(t,e,MC)}function MC(t,e,n){return Xy(t,e,n,AC)}function AC(t,e,n){return Gy(t,e,n,TC)}function TC(t,e){return xf(t,e,gX)}function gX(t){switch(`${t}`.toLowerCase()){case"x":return SX;case"y":return MX;case"z":return I6}throw new Error(`invalid group reduce: ${t}`)}function Dp(t,e){for(let n in e){let r=e[n];if(r!==void 0&&!t.some(o=>o.name===n))return r}}function E6(t,e,n){if(e){let r=e.output.transform(),o=(i,s)=>ke(r[i],r[s]);t.forEach(i=>i.sort(o))}n&&t.forEach(r=>r.reverse())}function yX(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function xX(t){return{reduceIndex(e,n,r){return t(kp(n,e),r)}}}function li(t){return{reduceIndex(e,n){return t(e,r=>n[r])}}}function _C(t){return{reduceIndex(e,n){let r=t(e,o=>n[o]);return ne(n)?new Date(r):r}}}var Vy={reduceIndex(t,e){return kp(e,t)}},Wy={reduceIndex(t,e){return e[t[0]]}},bX={reduceIndex(t,e){let r=Do(vr(t,i=>i.length,i=>e[i]),Ji),o=r.slice(-5).reverse();if(o.length<r.length){let i=r.slice(0,-4);o[4]=[`\u2026 ${i.length.toLocaleString("en-US")} more`,Ue(i,Ji)]}return o.map(([i,s])=>`${i} (${s.toLocaleString("en-US")})`).join(`
|
|
7
|
-
`)}},wX={reduceIndex(t,e){return e[t[t.length-1]]}},Op={label:"Frequency",reduceIndex(t){return t.length}},vX={label:"Distinct",reduceIndex(t,e){let n=new fn;for(let r of t)n.add(e[r]);return n.size}},_X=li(Ue);function SC(t,e){return t==null?{scope:e,label:"Frequency",reduceIndex:(n,r,o=1)=>n.length/o}:{scope:e,reduceIndex:(n,r,o=1)=>Ue(n,i=>r[i])/o}}var SX={reduceIndex(t,e,{x:n}){return n}},MX={reduceIndex(t,e,{y:n}){return n}},I6={reduceIndex(t,e,{z:n}){return n}};function EC(t){if(typeof t!="function")throw new Error(`invalid test function: ${t}`);return{reduceIndex(e,n,{data:r}){return n[e.find(Cn(r)?o=>t(r[o],o,r):o=>t(r.get(o),o,r))]}}}function bf(t,{scale:e,type:n,value:r,filter:o,hint:i,label:s=Ve(r)},a){return i===void 0&&typeof r?.transform=="function"&&(i=r.hint),C6(a,{scale:e,type:n,value:ut(t,r),label:s,filter:o,hint:i})}function Hy(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,bf(e,r,n)]))}function wf(t,e){let n=Object.fromEntries(Object.entries(t).map(([r,{scale:o,value:i}])=>{let s=o==null?null:e[o];return[r,s==null?i:Et(i,s)]}));return n.channels=t,n}function C6(t,e){let{scale:n,value:r}=e;if(n===!0||n==="auto")switch(t){case"fill":case"stroke":case"color":e.scale=n!==!0&&qy(r,ns)?null:"color",e.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":e.scale=n!==!0&&qy(r,cC)?null:"opacity",e.defaultScale="opacity";break;case"symbol":n!==!0&&qy(r,gC)?(e.scale=null,e.value=Et(r,yf)):e.scale="symbol",e.defaultScale="symbol";break;default:e.scale=Yt.has(t)?t:null;break}else if(n===!1)e.scale=null;else if(n!=null&&!Yt.has(n))throw new Error(`unknown scale: ${n}`);return e}function $C(t,e,n,r,o){let{order:i,reverse:s,reduce:a=!0,limit:c}=o;for(let f in o){if(!Yt.has(f))continue;let{value:l,order:u=i,reverse:p=s,reduce:d=a,limit:h=c}=dr(o[f]),m=l?.startsWith("-");if(m&&(l=l.slice(1)),u=u===void 0?m!==(l==="width"||l==="height")?kC:CC:EX(u),d==null||d===!1)continue;let g=f==="fx"||f==="fy"?TX(e,r[f]):AX(n,f);if(!g)throw new Error(`missing channel for scale: ${f}`);let y=g.value,[x=0,b=1/0]=vn(h)?h:h<0?[h]:[0,h];if(l==null)g.domain=()=>{let w=Array.from(new fn(y));return p&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=l==="data"?t:l==="height"?IC(n,"y1","y2"):l==="width"?IC(n,"x1","x2"):$6(n,l,l==="y"?"y2":l==="x"?"x2":void 0),_=xf(d===!0?"max":d,w);g.domain=()=>{let v=tw(wn(y),A=>_.reduceIndex(A,w),A=>y[A]);return u&&v.sort(u),p&&v.reverse(),(x!==0||b!==1/0)&&(v=v.slice(x,b)),v.map(Aa)}}}}function AX(t,e){for(let n in t){let r=t[n];if(r.scale===e)return r}}function TX(t,e){let n=t.original;if(n===t)return e;let r=e.value,o=e.value=[];for(let i=0;i<n.length;++i){let s=r[n[i][0]];for(let a of t[i])o[a]=s}return e}function IC(t,e,n){let r=$6(t,e),o=$6(t,n);return Et(o,(i,s)=>Math.abs(i-r[s]),Float64Array)}function $6(t,e,n){let r=t[e];if(!r&&n!==void 0&&(r=t[n]),r)return r.value;throw new Error(`missing channel: ${e}`)}function EX(t){if(t==null||typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return CC;case"descending":return kC}throw new Error(`invalid order: ${t}`)}function CC([t,e],[n,r]){return ke(e,r)||ke(t,n)}function kC([t,e],[n,r]){return _a(e,r)||ke(t,n)}function Pp(t,e){let n=t[e];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}var DC=new Map([["accent",m_],["category10",h_],["dark2",g_],["observable10",y_],["paired",x_],["pastel1",b_],["pastel2",w_],["set1",v_],["set2",__],["set3",S_],["tableau10",M_]]);function PC(t){return t!=null&&DC.has(`${t}`.toLowerCase())}var NC=new Map([...DC,["brbg",ui(pg,dg)],["prgn",ui(hg,mg)],["piyg",ui(gg,yg)],["puor",ui(xg,bg)],["rdbu",ui(sp,Qc)],["rdgy",ui(wg,vg)],["rdylbu",ui(ap,Jc)],["rdylgn",ui(_g,Sg)],["spectral",ui(Mg,Ag)],["burd",OC(sp,Qc)],["buylrd",OC(ap,Jc)],["blues",Re(Zg,Qg)],["greens",Re(Jg,Kg)],["greys",Re(ty,ey)],["oranges",Re(sy,ay)],["purples",Re(ny,ry)],["reds",Re(oy,iy)],["turbo",pi(gy)],["viridis",pi(xy)],["magma",pi(by)],["inferno",pi(wy)],["plasma",pi(vy)],["cividis",pi(cy)],["cubehelix",pi(fy)],["warm",pi(uy)],["cool",pi(py)],["bugn",Re(Tg,Eg)],["bupu",Re(Ig,$g)],["gnbu",Re(Cg,kg)],["orrd",Re(Ng,Og)],["pubu",Re(Dg,Pg)],["pubugn",Re(Rg,Lg)],["purd",Re(Fg,qg)],["rdpu",Re(Bg,zg)],["ylgn",Re(jg,Xg)],["ylgnbu",Re(Yg,Ug)],["ylorbr",Re(Gg,Vg)],["ylorrd",Re(Wg,Hg)],["rainbow",RC(dy)],["sinebow",RC(my)]]);function Re(t,e){return({length:n})=>n===1?[t[3][1]]:n===2?[t[3][1],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Ze(e,n):t[n])}function ui(t,e){return({length:n})=>n===2?[t[3][0],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Ze(e,n):t[n])}function OC(t,e){return({length:n})=>n===2?[t[3][2],t[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Ze(r=>e(1-r),n):t[n].slice().reverse())}function pi(t){return({length:e})=>Ze(t,Math.max(2,Math.floor(e)))}function RC(t){return({length:e})=>Ze(t,Math.floor(e)+1).slice(0,-1)}function k6(t){let e=`${t}`.toLowerCase();if(!NC.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return NC.get(e)}function Fp(t,e){let n=k6(t),r=typeof n=="function"?n({length:e}):n;return r.length!==e?r.slice(0,e):r}function FC(t,e="greys"){let n=new Set,[r,o]=Fp(e,2);for(let i of t)if(i!=null)if(i===!0)n.add(o);else if(i===!1)n.add(r);else return;return[...n]}var LC=new Map([["brbg",dg],["prgn",mg],["piyg",yg],["puor",bg],["rdbu",Qc],["rdgy",vg],["rdylbu",Jc],["rdylgn",Sg],["spectral",Ag],["burd",t=>Qc(1-t)],["buylrd",t=>Jc(1-t)],["blues",Qg],["greens",Kg],["greys",ey],["purples",ry],["reds",iy],["oranges",ay],["turbo",gy],["viridis",xy],["magma",by],["inferno",wy],["plasma",vy],["cividis",cy],["cubehelix",fy],["warm",uy],["cool",py],["bugn",Eg],["bupu",$g],["gnbu",kg],["orrd",Og],["pubugn",Lg],["pubu",Pg],["purd",qg],["rdpu",zg],["ylgnbu",Ug],["ylgn",Xg],["ylorbr",Vg],["ylorrd",Hg],["rainbow",dy],["sinebow",my]]);function vf(t){let e=`${t}`.toLowerCase();if(!LC.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return LC.get(e)}var IX=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function qC(t){return t!=null&&IX.has(`${t}`.toLowerCase())}var O6=t=>e=>t(1-e),N6=[0,1],BC=new Map([["number",Ht],["rgb",rr],["hsl",Tw],["hcl",Ew],["lab",Hm]]);function R6(t){let e=`${t}`.toLowerCase();if(!BC.has(e))throw new Error(`unknown interpolator: ${e}`);return BC.get(e)}function Sf(t,e,n,{type:r,nice:o,clamp:i,zero:s,domain:a=WC(t,n),unknown:c,round:f,scheme:l,interval:u,range:p=Yt.get(t)===Ea?NX(n,a):Yt.get(t)===Ia?OX(n,a):Yt.get(t)===$a?N6:void 0,interpolate:d=Yt.get(t)===Xn?l==null&&p!==void 0?rr:vf(l!==void 0?l:r==="cyclical"?"rainbow":"turbo"):f?ea:Ht,reverse:h}){if(u=co(u,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=R6(d)),h=!!h,p!==void 0){let m=(a=Un(a)).length,g=(p=Un(p)).length;if(m!==g){if(d.length===1)throw new Error("invalid piecewise interpolator");d=jr(d,p),p=void 0}}if(d.length===1?(h&&(d=O6(d),h=!1),p===void 0&&(p=Float64Array.from(a,(m,g)=>g/(a.length-1)),p.length===2&&(p=N6)),e.interpolate((p===N6?re:qp)(d))):e.interpolate(d),s){let[m,g]=Rt(a);(m>0||g<0)&&(a=Ki(a),(oi(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return h&&(a=Oi(a)),e.domain(a).unknown(c),o&&(e.nice($X(o,r)),a=e.domain()),p!==void 0&&e.range(p),i&&e.clamp(i),{type:r,domain:a,range:p,scale:e,interpolate:d,interval:u}}function $X(t,e){return t===!0?void 0:typeof t=="number"?t:nC(t,e)}function zC(t,e,n){return Sf(t,Wo(),e,n)}function YC(t,e,n){return L6(t,e,{...n,exponent:.5})}function L6(t,e,{exponent:n=1,...r}){return Sf(t,Hu().exponent(n),e,{...r,type:"pow"})}function UC(t,e,{base:n=10,domain:r=RX(e),...o}){return Sf(t,Vu().base(n),e,{...o,domain:r})}function jC(t,e,{constant:n=1,...r}){return Sf(t,Wu().constant(n),e,r)}function XC(t,e,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:o=r,scheme:i="rdylbu",domain:s=LX(e),unknown:a,interpolate:c,reverse:f}){return n===void 0&&(n=c!==void 0?Ze(c,o):Yt.get(t)===Xn?Fp(i,o):void 0),s.length>0&&(s=Zu(s,n===void 0?{length:o}:n).quantiles()),Zy(t,e,{domain:s,range:n,reverse:f,unknown:a})}function GC(t,e,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:o="rdylbu",domain:i=WC(t,e),unknown:s,interpolate:a,reverse:c}){let[f,l]=Rt(i),u;return n===void 0?(u=Ye(f,l,r),u[0]<=f&&u.splice(0,1),u[u.length-1]>=l&&u.pop(),r=u.length+1,n=a!==void 0?Ze(a,r):Yt.get(t)===Xn?Fp(o,r):void 0):(u=Ze(Ht(f,l),r+1).slice(1,-1),f instanceof Date&&(u=u.map(p=>new Date(p)))),oi(Un(i))<0&&u.reverse(),Zy(t,e,{domain:u,range:n,reverse:c,unknown:s})}function Zy(t,e,{domain:n=[0],unknown:r,scheme:o="rdylbu",interpolate:i,range:s=i!==void 0?Ze(i,n.length+1):Yt.get(t)===Xn?Fp(o,n.length+1):void 0,reverse:a}){n=Un(n);let c=oi(n);if(!isNaN(c)&&!CX(n,c))throw new Error(`the ${t} scale has a non-monotonic domain`);return a&&(s=Oi(s)),{type:"threshold",scale:Qu(c<0?Oi(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function CX(t,e){for(let n=1,r=t.length,o=t[0];n<r;++n){let i=an(o,o=t[n]);if(i!==0&&i!==e)return!1}return!0}function VC(t){return{type:"identity",scale:mC(Yt.get(t))?Xu():e=>e}}function _f(t,e=af){return t.length?[Bt(t,({value:n})=>n===void 0?n:Bt(n,e)),Ct(t,({value:n})=>n===void 0?n:Ct(n,e))]:[0,1]}function WC(t,e){let n=Yt.get(t);return(n===Ea||n===$a||n===Ia?kX:_f)(e)}function kX(t){return[0,t.length?Ct(t,({value:e})=>e===void 0?e:Ct(e,af)):1]}function NX(t,e){let n=t.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=ln(t,.5,({value:s})=>s===void 0?NaN:ln(s,.25,bn)),o=e.map(s=>3*Math.sqrt(s/r)),i=30/Ct(o);return i<1?o.map(s=>s*i):o}function OX(t,e){let n=_r(t,({value:i})=>i===void 0?NaN:_r(i,Math.abs)),r=e.map(i=>12*i/n),o=60/Ct(r);return o<1?r.map(i=>i*o):r}function RX(t){for(let{value:e}of t)if(e!==void 0)for(let n of e){if(n>0)return _f(t,bn);if(n<0)return _f(t,Vi)}return[1,10]}function LX(t){let e=[];for(let{value:n}of t)if(n!==void 0)for(let r of n)e.push(r);return e}function qp(t){return(e,n)=>r=>t(e+r*(n-e))}var D6=0,P6;function HC(){let t=D6;return D6=0,P6=void 0,t}function rn(t){t!==P6&&(P6=t,console.warn(t),++D6)}function Qy(t,e,n,r,{type:o,nice:i,clamp:s,domain:a=_f(r),unknown:c,pivot:f=0,scheme:l,range:u,symmetric:p=!0,interpolate:d=Yt.get(t)===Xn?l==null&&u!==void 0?rr:vf(l!==void 0?l:"rdbu"):Ht,reverse:h}){f=+f,a=Un(a);let[m,g]=a;if(a.length>2&&rn(`Warning: the diverging ${t} scale domain contains extra elements.`),an(m,g)<0&&([m,g]=[g,m],h=!h),m=Math.min(m,f),g=Math.max(g,f),typeof d!="function"&&(d=R6(d)),u!==void 0&&(d=d.length===1?qp(d)(...u):jr(d,u)),h&&(d=O6(d)),p){let y=n.apply(f),x=y-n.apply(m),b=n.apply(g)-y;x<b?m=n.invert(y-b):x>b&&(g=n.invert(y+x))}return e.domain([m,f,g]).unknown(c).interpolator(d),s&&e.clamp(s),i&&e.nice(i),{type:o,domain:[m,g],pivot:f,interpolate:d,scale:e}}function ZC(t,e,n){return Qy(t,ip(),DX,e,n)}function QC(t,e,n){return F6(t,e,{...n,exponent:.5})}function F6(t,e,{exponent:n=1,...r}){return Qy(t,ug().exponent(n=+n),qX(n),e,{...r,type:"diverging-pow"})}function JC(t,e,{base:n=10,pivot:r=1,domain:o=_f(e,r<0?Vi:bn),...i}){return Qy(t,fg().base(n=+n),PX,e,{domain:o,pivot:r,...i})}function KC(t,e,{constant:n=1,...r}){return Qy(t,lg().constant(n=+n),BX(n),e,r)}var DX={apply(t){return t},invert(t){return t}},PX={apply:Math.log,invert:Math.exp},FX={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function qX(t){return t===.5?FX:{apply(e){return Math.sign(e)*Math.pow(Math.abs(e),t)},invert(e){return Math.sign(e)*Math.pow(Math.abs(e),1/t)}}}function BX(t){return{apply(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))},invert(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}}function tk(t,e,n,r){return Sf(t,e,n,r)}function ek(t,e,n){return tk(t,sg(),e,n)}function nk(t,e,n){return tk(t,ag(),e,n)}var Mf=Symbol("ordinal");function ok(t,e,n,{type:r,interval:o,domain:i,range:s,reverse:a,hint:c}){return o=co(o,r),i===void 0&&(i=fk(n,o,t)),(r==="categorical"||r===Mf)&&(r="ordinal"),a&&(i=Oi(i)),i=e.domain(i).domain(),s!==void 0&&(typeof s=="function"&&(s=s(i)),e.range(s)),{type:r,domain:i,range:s,scale:e,hint:c,interval:o}}function ik(t,e,{type:n,interval:r,domain:o,range:i,scheme:s,unknown:a,...c}){r=co(r,n),o===void 0&&(o=fk(e,r,t));let f;if(Yt.get(t)===gf)f=zX(e),i=i===void 0?YX(f):Et(i,yf);else if(Yt.get(t)===Xn&&(i===void 0&&(n==="ordinal"||n===Mf)&&(i=FC(o,s),i!==void 0&&(s=void 0)),s===void 0&&i===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(i!==void 0){let l=vf(s),u=i[0],p=i[1]-i[0];i=({length:d})=>Ze(h=>l(u+p*h),d)}else i=k6(s);if(a===Uu)throw new Error(`implicit unknown on ${t} scale is not supported`);return ok(t,da().unknown(a),e,{...c,type:n,domain:o,range:i,hint:f})}function sk(t,e,{align:n=.5,padding:r=.5,...o}){return ck(Jv().align(n).padding(r),e,o,t)}function ak(t,e,{align:n=.5,padding:r=.1,paddingInner:o=r,paddingOuter:i=t==="fx"||t==="fy"?0:r,...s}){return ck(ji().align(n).paddingInner(o).paddingOuter(i),e,s,t)}function ck(t,e,n,r){let{round:o}=n;return o!==void 0&&t.round(o=!!o),t=ok(r,t,e,n),t.round=o,t}function fk(t,e,n){let r=new fn;for(let{value:o,domain:i}of t){if(i!==void 0)return i();if(o!==void 0)for(let s of o)r.add(s)}if(e!==void 0){let[o,i]=Rt(r).map(e.floor,e);return e.range(o,e.offset(i))}if(r.size>1e4&&Yt.get(n)===hr)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return Do(r,ke)}function rk(t,e){let n;for(let{hint:r}of t){let o=r?.[e];if(o!==void 0){if(n===void 0)n=o;else if(n!==o)return}}return n}function zX(t){return{fill:rk(t,"fill"),stroke:rk(t,"stroke")}}function YX(t){return Pt(t.fill)?k_:Ey}function Bp(t,{label:e,inset:n=0,insetTop:r=n,insetRight:o=n,insetBottom:i=n,insetLeft:s=n,round:a,nice:c,clamp:f,zero:l,align:u,padding:p,projection:d,facet:{label:h=e}={},...m}={}){let g={};for(let[y,x]of t){let b=m[y],w=yk(y,x,{round:Yt.get(y)===hr?a:void 0,nice:c,clamp:f,zero:l,align:u,padding:p,projection:d,...b});if(w){let{label:_=y==="fx"||y==="fy"?h:e,percent:v,transform:A,inset:E,insetTop:T=E!==void 0?E:y==="y"?r:0,insetRight:$=E!==void 0?E:y==="x"?o:0,insetBottom:M=E!==void 0?E:y==="y"?i:0,insetLeft:k=E!==void 0?E:y==="x"?s:0}=b||{};if(A==null)A=void 0;else if(typeof A!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?UX(x,w):_,w.transform=A,y==="x"||y==="fx"?(w.insetLeft=+k,w.insetRight=+$):(y==="y"||y==="fy")&&(w.insetTop=+T,w.insetBottom=+M),g[y]=w}}return g}function B6(t){let e={},n={scales:e};for(let[r,o]of Object.entries(t)){let{scale:i,type:s,interval:a,label:c}=o;e[r]=bk(o),n[r]=i,i.type=s,a!=null&&(i.interval=a),c!=null&&(i.label=c)}return n}function hk(t,e){let{x:n,y:r,fx:o,fy:i}=t,s=o||i?tx(e):e;o&&lk(o,s),i&&uk(i,s);let a=o||i?z6(t,e):e;n&&lk(n,a),r&&uk(r,a)}function UX(t=[],e){let n;for(let{label:r}of t)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!po(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Ky(t){return Math.sign(oi(t.domain()))*Math.sign(oi(t.range()))}function tx(t){let{marginTop:e,marginRight:n,marginBottom:r,marginLeft:o,width:i,height:s,facet:{marginTop:a,marginRight:c,marginBottom:f,marginLeft:l}}=t;return{marginTop:Math.max(e,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,f),marginLeft:Math.max(o,l),width:i,height:s}}function z6({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=tx(n);return{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:t?t.scale.bandwidth()+s+o:a,height:e?e.scale.bandwidth()+r+i:c,facet:{width:a,height:c}}}function lk(t,e){if(t.range===void 0){let{insetLeft:n,insetRight:r}=t,{width:o,marginLeft:i=0,marginRight:s=0}=e,a=i+n,c=o-s-r;t.range=[a,Math.max(a,c)],po(t)||(t.range=gk(t)),t.scale.range(t.range)}mk(t)}function uk(t,e){if(t.range===void 0){let{insetTop:n,insetBottom:r}=t,{height:o,marginTop:i=0,marginBottom:s=0}=e,a=i+n,c=o-s-r;t.range=[Math.max(a,c),a],po(t)?t.range.reverse():t.range=gk(t),t.scale.range(t.range)}mk(t)}function mk(t){t.round===void 0&&GX(t)&&jX(t)<=30&&t.scale.round(!0)}function jX({scale:t}){let e=t.domain().length,[n,r]=t.range(),o=t.paddingInner?t.paddingInner():1,i=t.paddingOuter?t.paddingOuter():t.padding(),s=e-o,a=Math.abs(r-n)/Math.max(1,s+i*2);return(a-Math.floor(a))*s}function gk(t){let e=t.scale.domain().length+Y6(t);if(!(e>2))return t.range;let[n,r]=t.range;return Array.from({length:e},(o,i)=>n+i/(e-1)*(r-n))}function ex(t,e,n){return yk(t,n===void 0?void 0:[{hint:n}],{...e})}function yk(t,e=[],n={}){let r=XX(t,e,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&t!=="fx"&&t!=="fy"&&po({type:r})){let o=e.map(({value:i})=>i).filter(i=>i!==void 0);o.some(ne)?rn(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Af(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 ${t} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${t} scale to "${Af(r)}".`):o.some(sC)?rn(`Warning: some data associated with the ${t} 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 "${Af(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 ${t} scale to "${Af(r)}".`):o.some(aC)&&rn(`Warning: some data associated with the ${t} 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 "${Af(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${t} scale to "${Af(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=Jy(e,n,xe);break;case"identity":switch(Yt.get(t)){case hr:n=Jy(e,n,xe);break;case gf:n=Jy(e,n,VX);break}break;case"utc":case"time":n=Jy(e,n,c6);break}switch(r){case"diverging":return ZC(t,e,n);case"diverging-sqrt":return QC(t,e,n);case"diverging-pow":return F6(t,e,n);case"diverging-log":return JC(t,e,n);case"diverging-symlog":return KC(t,e,n);case"categorical":case"ordinal":case Mf:return ik(t,e,n);case"cyclical":case"sequential":case"linear":return zC(t,e,n);case"sqrt":return YC(t,e,n);case"threshold":return Zy(t,e,n);case"quantile":return XC(t,e,n);case"quantize":return GC(t,e,n);case"pow":return L6(t,e,n);case"log":return UC(t,e,n);case"symlog":return jC(t,e,n);case"utc":return nk(t,e,n);case"time":return ek(t,e,n);case"point":return sk(t,e,n);case"band":return ak(t,e,n);case"identity":return VC(t);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Af(t){return typeof t=="symbol"?t.description:t}function pk(t){return typeof t=="string"?`${t}`.toLowerCase():t}var dk={toString:()=>"projection"};function XX(t,e,{type:n,domain:r,range:o,scheme:i,pivot:s,projection:a}){if(n=pk(n),t==="fx"||t==="fy")return"band";(t==="x"||t==="y")&&a!=null&&(n=dk);for(let f of e){let l=pk(f.type);if(l!==void 0){if(n===void 0)n=l;else if(n!==l)throw new Error(`scale incompatible with channel: ${n} !== ${l}`)}}if(n===dk)return;if(n!==void 0)return n;if(r===void 0&&!e.some(({value:f})=>f!==void 0))return;let c=Yt.get(t);if(c===Ea)return"sqrt";if(c===$a||c===Ia)return"linear";if(c===gf)return"ordinal";if((r||o||[]).length>2)return q6(c);if(r!==void 0){if(Kt(r))return q6(c);if(ne(r))return"utc"}else{let f=e.map(({value:l})=>l).filter(l=>l!==void 0);if(f.some(Kt))return q6(c);if(f.some(ne))return"utc"}if(c===Xn){if(s!=null||qC(i))return"diverging";if(PC(i))return"categorical"}return"linear"}function q6(t){switch(t){case hr:return"point";case Xn:return Mf;default:return"ordinal"}}function po({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===Mf}function Y6({type:t}){return t==="threshold"}function GX({type:t}){return t==="point"||t==="band"}function Gn(t){if(t===void 0)return!0;let e=t.domain(),n=t(e[0]);for(let r=1,o=e.length;r<o;++r)if(t(e[r])-n)return!1;return!0}function Jy(t,{domain:e,...n},r){for(let o of t)o.value!==void 0&&(e===void 0&&(e=o.value?.domain),o.value=r(o.value));return{domain:e===void 0?e:r(e),...n}}function VX(t){return Et(t,yf)}function is(t={}){let e;for(let n in t)if(Yt.has(n)&&so(t[n])){if(e!==void 0)throw new Error("ambiguous scale definition; multiple scales found");e=bk(ex(n,t[n]))}if(e===void 0)throw new Error("invalid scale definition; no scale found");return e}function xk(t){return e=>{if(!Yt.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return t[e]}}function bk({scale:t,type:e,domain:n,range:r,interpolate:o,interval:i,transform:s,percent:a,pivot:c}){if(e==="identity")return{type:"identity",apply:l=>l,invert:l=>l};let f=t.unknown?t.unknown():void 0;return{type:e,domain:Ki(n),...r!==void 0&&{range:Ki(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...f!==void 0&&{unknown:f},...i!==void 0&&{interval:i},...o!==void 0&&{interpolate:o},...t.clamp&&{clamp:t.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...t.base&&{base:t.base()},...t.exponent&&{exponent:t.exponent()},...t.constant&&{constant:t.constant()},...t.align&&{align:t.align(),round:t.round()},...t.padding&&(t.paddingInner?{paddingInner:t.paddingInner(),paddingOuter:t.paddingOuter()}:{padding:t.padding()}),...t.bandwidth&&{bandwidth:t.bandwidth(),step:t.step()},apply:l=>t(l),...t.invert&&{invert:l=>t.invert(l)}}}function vk(t,e){let{fx:n,fy:r}=Bp(t,e),o=n?.scale.domain(),i=r?.scale.domain();return o&&i?Sm(o,i).map(([s,a],c)=>({x:s,y:a,i:c})):o?o.map((s,a)=>({x:s,i:a})):i?i.map((s,a)=>({y:s,i:a})):void 0}function _k(t,{x:e,y:n}){return e&&=V6(e),n&&=V6(n),t.filter(e&&n?r=>e.has(r.x)&&n.has(r.y):e?r=>e.has(r.x):r=>n.has(r.y)).sort(e&&n?(r,o)=>e.get(r.x)-e.get(o.x)||n.get(r.y)-n.get(o.y):e?(r,o)=>e.get(r.x)-e.get(o.x):(r,o)=>n.get(r.y)-n.get(o.y))}function rx(t,{fx:e,fy:n}){let r=wn(t),o=e?.value,i=n?.value;return e&&n?vr(r,s=>(s.fx=o[s[0]],s.fy=i[s[0]],s),s=>o[s],s=>i[s]):e?vr(r,s=>(s.fx=o[s[0]],s),s=>o[s]):vr(r,s=>(s.fy=i[s[0]],s),s=>i[s])}function Sk(t,e,{marginTop:n,marginLeft:r}){return t&&e?({x:o,y:i})=>`translate(${t(o)-r},${e(i)-n})`:t?({x:o})=>`translate(${t(o)-r},0)`:({y:o})=>`translate(0,${e(o)-n})`}function Mk(t){let e=[],n=new Uint32Array(Ue(t,r=>r.length));for(let r of t){let o=0;for(let i of t)r!==i&&(n.set(i,o),o+=i.length);e.push(n.slice(0,o))}return e}var WX=new Map([["top",U6],["right",G6],["bottom",j6],["left",X6],["top-left",nx(U6,X6)],["top-right",nx(U6,G6)],["bottom-left",nx(j6,X6)],["bottom-right",nx(j6,G6)],["top-empty",ZX],["right-empty",KX],["bottom-empty",QX],["left-empty",JX],["empty",tG]]);function Ak(t){if(t==null)return null;let e=WX.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}var wk=new WeakMap;function V6(t){let e=wk.get(t);return e||wk.set(t,e=new cn(Et(t,(n,r)=>[n,r]))),e}function ss(t,e){return V6(t).get(e)}function HX(t,e,n){return e=pr(e),n=pr(n),t.find(r=>Object.is(pr(r.x),e)&&Object.is(pr(r.y),n))}function ox(t,e,n){return HX(t,e,n)?.empty}function U6(t,{y:e},{y:n}){return e?ss(e,n)===0:!0}function j6(t,{y:e},{y:n}){return e?ss(e,n)===e.length-1:!0}function X6(t,{x:e},{x:n}){return e?ss(e,n)===0:!0}function G6(t,{x:e},{x:n}){return e?ss(e,n)===e.length-1:!0}function ZX(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,r);if(i>0)return ox(t,n,e[i-1])}function QX(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,r);if(i<e.length-1)return ox(t,n,e[i+1])}function JX(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,n);if(i>0)return ox(t,e[i-1],r)}function KX(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=ss(e,n);if(i<e.length-1)return ox(t,e[i+1],r)}function tG(t,e,{empty:n}){return n}function nx(t,e){return function(){return t.apply(null,arguments)&&e.apply(null,arguments)}}function ix(t,{channels:{fx:e,fy:n},groups:r}){return e&&n?t.map(({x:o,y:i})=>r.get(o)?.get(i)??[]):e?t.map(({x:o})=>r.get(o)??[]):t.map(({y:o})=>r.get(o)??[])}var Tk=Math.PI,di=2*Tk,W6=.618;function Ek({projection:t,inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={},s){if(t==null)return;if(typeof t.stream=="function")return t;let a,c,f="frame";if(Ne(t)){let _;if({type:t,domain:c,inset:_,insetTop:n=_!==void 0?_:n,insetRight:r=_!==void 0?_:r,insetBottom:o=_!==void 0?_:o,insetLeft:i=_!==void 0?_:i,clip:f=f,...a}=t,t==null)return}typeof t!="function"&&({type:t}=H6(t));let{width:l,height:u,marginLeft:p,marginRight:d,marginTop:h,marginBottom:m}=s,g=l-p-d-i-r,y=u-h-m-n-o;if(t=t?.({width:g,height:y,clip:f,...a}),t==null)return;f=eG(f,p,h,l-d,u-m);let x=p+i,b=h+n,w;if(c!=null){let[[_,v],[A,E]]=Ie(t).bounds(c),T=Math.min(g/(A-_),y/(E-v));T>0?(x-=(T*(_+A)-g)/2,b-=(T*(v+E)-y)/2,w=la({point($,M){this.stream.point($*T+x,M*T+b)}})):rn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?Ik():la({point(_,v){this.stream.point(_+x,v+b)}}),{stream:_=>t.stream(w.stream(f(_)))}}function H6(t){switch(`${t}`.toLowerCase()){case"albers-usa":return Tr(Tv,.7463,.4673);case"albers":return sx(Pu,.7463,.4673);case"azimuthal-equal-area":return Tr(Iv,4,4);case"azimuthal-equidistant":return Tr(Cv,di,di);case"conic-conformal":return sx(Ov,di,di);case"conic-equal-area":return sx(Yi,6.1702,2.9781);case"conic-equidistant":return sx(Lv,7.312,3.6282);case"equal-earth":return Tr(Pv,5.4133,2.6347);case"equirectangular":return Tr(Rv,di,Tk);case"gnomonic":return Tr(qv,3.4641,3.4641);case"identity":return{type:Ik};case"reflect-y":return{type:nG};case"mercator":return Tr(kv,di,di);case"orthographic":return Tr(zv,2,2);case"stereographic":return Tr(Uv,2,2);case"transverse-mercator":return Tr(Xv,di,di);default:throw new Error(`unknown projection type: ${t}`)}}function eG(t,e,n,r,o){if(t===!1||t==null||typeof t=="number")return i=>i;switch(t===!0&&(t="frame"),`${t}`.toLowerCase()){case"frame":return qc(e,n,r,o);default:throw new Error(`unknown projection clip type: ${t}`)}}function Tr(t,e,n){return{type:({width:r,height:o,rotate:i,precision:s=.15,clip:a})=>{let c=t();return s!=null&&c.precision?.(s),i!=null&&c.rotate?.(i),typeof a=="number"&&c.clipAngle?.(a),r!=null&&(c.scale(Math.min(r/e,o/n)),c.translate([r/2,o/2])),c},aspectRatio:n/e}}function sx(t,e,n){let{type:r,aspectRatio:o}=Tr(t,e,n);return{type:i=>{let{parallels:s,domain:a,width:c,height:f}=i,l=r(i);return s!=null&&(l.parallels(s),a===void 0&&c!=null&&l.fitSize([c,f],{type:"Sphere"})),l},aspectRatio:o}}var Ik=re({stream:t=>t}),nG=re(la({point(t,e){this.stream.point(t,-e)}}));function Z6(t,e,n,r){let o=n[t],i=n[e],s=o.length,a=n[t]=new Float64Array(s).fill(NaN),c=n[e]=new Float64Array(s).fill(NaN),f,l=r.stream({point(u,p){a[f]=u,c[f]=p}});for(f=0;f<s;++f)l.point(o[f],i[f])}function $k({projection:t}={}){return t==null?!1:typeof t.stream=="function"?!0:(Ne(t)&&(t=t.type),t!=null)}function Ck(t){if(typeof t?.stream=="function")return W6;if(Ne(t)){let e,n;if({domain:e,type:t,...n}=t,e!=null&&t!=null){let r=typeof t=="string"?H6(t).type:t,[[o,i],[s,a]]=Ie(r({...n,width:100,height:100})).bounds(e),c=(a-i)/(s-o);return c&&isFinite(c)?c<.2?.2:c>5?5:c:W6}}if(t!=null){if(typeof t!="function"){let{aspectRatio:e}=H6(t);if(e)return e}return W6}}function ho(t,e,{projection:n}){let{x:r,y:o}=t,i={};return r&&(i.x=r),o&&(i.y=o),i=wf(i,e),n&&r?.scale==="x"&&o?.scale==="y"&&Z6("x","y",i,n),r&&(i.x=xe(i.x)),o&&(i.y=xe(i.y)),i}function kk(t){let e=[],n=[],r={scale:"x",value:e},o={scale:"y",value:n},i={point(s,a){e.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of t.value)qn(s,i);return[r,o]}function as(t={}){let{document:e=typeof window<"u"?window.document:void 0,clip:n}=t;return{document:e,clip:zy(n)}}function st(t,{document:e}){return St(Bo(t).call(e.documentElement))}var ax=Symbol("unset");function cs(t){return(t.length===1?rG:oG)(t)}function rG(t){let e,n=ax;return r=>(Object.is(n,r)||(n=r,e=t(r)),e)}function oG(t){let e,n;return(...r)=>((n?.length!==r.length||n.some((o,i)=>!Object.is(o,r[i])))&&(n=r,e=t(...r)),e)}var iG=cs(t=>new Intl.NumberFormat(t)),sG=cs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}})),aG=cs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}}));function Q6(t="en-US"){let e=iG(t);return n=>n!=null&&!isNaN(n)?e.format(n):void 0}function Nk(t="en-US",e="short"){let n=sG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function Ok(t="en-US",e="short"){let n=aG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function J6(t){return cf(t,"Invalid Date")}function cG(t="en-US"){let e=Q6(t);return n=>(n instanceof Date?J6:typeof n=="number"?e:fe)(n)}var mo=cG();var oe=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,fG=0,lG=0;function K6(){return`plot-clip-${++fG}`}function Rk(){return`plot-pattern-${++lG}`}function cx(t,{title:e,href:n,ariaLabel:r,ariaDescription:o,ariaHidden:i,target:s,fill:a,fillOpacity:c,stroke:f,strokeWidth:l,strokeOpacity:u,strokeLinejoin:p,strokeLinecap:d,strokeMiterlimit:h,strokeDasharray:m,strokeDashoffset:g,opacity:y,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:A},{ariaLabel:E,fill:T="currentColor",fillOpacity:$,stroke:M="none",strokeOpacity:k,strokeWidth:R,strokeLinecap:S,strokeLinejoin:I,strokeMiterlimit:C,paintOrder:N}){T===null&&(a=null,c=null),M===null&&(f=null,u=null),Pt(T)?!Pt(M)&&(!Pt(a)||A?.fill)&&(M="none"):Pt(M)&&(!Pt(f)||A?.stroke)&&(T="none");let[D,L]=ee(a,T),[P,F]=Ft(c,$),[q,W]=ee(f,M),[tt,nt]=Ft(u,k),[ot,X]=Ft(y);fi(W)||(l===void 0&&(l=R),d===void 0&&(d=S),p===void 0&&(p=I),h===void 0&&!fC(p)&&(h=C),!fi(L)&&w===void 0&&(w=N));let[rt,Y]=Ft(l);return T!==null&&(t.fill=Wt(L,"currentColor"),t.fillOpacity=zp(F,1)),M!==null&&(t.stroke=Wt(W,"none"),t.strokeWidth=zp(Y,1),t.strokeOpacity=zp(nt,1),t.strokeLinejoin=Wt(p,"miter"),t.strokeLinecap=Wt(d,"butt"),t.strokeMiterlimit=zp(h,4),t.strokeDasharray=Wt(m,"none"),t.strokeDashoffset=Wt(g,"0")),t.target=fe(s),t.ariaLabel=fe(E),t.ariaDescription=fe(o),t.ariaHidden=fe(i),t.opacity=zp(X,1),t.mixBlendMode=Wt(x,"normal"),t.imageFilter=Wt(b,"none"),t.paintOrder=Wt(w,"normal"),t.pointerEvents=Wt(_,"auto"),t.shapeRendering=Wt(v,"auto"),{title:{value:e,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:D,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:q,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:ot,scale:"auto",optional:!0}}}function uG(t,e){e&&t.filter(n=>Ap(e[n])).append("title").call(dG,e)}function pG(t,e){e&&t.filter(([n])=>Ap(e[n])).append("title").call(hG,e)}function dG(t,e){e&&t.text(n=>mo(e[n]))}function hG(t,e){e&&t.text(([n])=>mo(e[n]))}function Tt(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:l,href:u}){r&&at(t,"aria-label",p=>r[p]),i&&at(t,"fill",p=>i[p]),s&&at(t,"fill-opacity",p=>s[p]),a&&at(t,"stroke",p=>a[p]),c&&at(t,"stroke-opacity",p=>c[p]),f&&at(t,"stroke-width",p=>f[p]),l&&at(t,"opacity",p=>l[p]),u&&Dk(t,p=>u[p],e),n||uG(t,o)}function Ca(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:l,href:u}){r&&at(t,"aria-label",([p])=>r[p]),i&&at(t,"fill",([p])=>i[p]),s&&at(t,"fill-opacity",([p])=>s[p]),a&&at(t,"stroke",([p])=>a[p]),c&&at(t,"stroke-opacity",([p])=>c[p]),f&&at(t,"stroke-width",([p])=>f[p]),l&&at(t,"opacity",([p])=>l[p]),u&&Dk(t,([p])=>u[p],e),n||pG(t,o)}function mG({ariaLabel:t,title:e,fill:n,fillOpacity:r,stroke:o,strokeOpacity:i,strokeWidth:s,opacity:a,href:c},{tip:f}){return[t,f?void 0:e,n,r,o,i,s,a,c].filter(l=>l!==void 0)}function Yp(t,e,n){let r=ze(t,o=>e[o]);return n===void 0&&r.size>1+t.length>>1&&rn("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*fx(t,e,n,r){let{z:o}=n,{z:i}=r,s=mG(r,n),a=[...e,...s];for(let c of i?Yp(t,i,o):[t]){let f,l;t:for(let u of c){for(let p of a)if(!Jt(p[u])){l&&l.push(-1);continue t}if(f===void 0){l&&(yield l),f=s.map(p=>pr(p[u])),l=[u];continue}l.push(u);for(let p=0;p<s.length;++p)if(pr(s[p][u])!==f[p]){yield l,f=s.map(h=>pr(h[u])),l=[u];continue t}}l&&(yield l)}}function gG(t,e,n,r){let o,{clip:i=r.clip}=e;switch(i){case"frame":{t=st("svg:g",r).each(function(){this.appendChild(t.node()),t.node=()=>this}),o=yG(r,n);break}case"sphere":{o=xG(r);break}}at(t,"aria-label",e.ariaLabel),at(t,"aria-description",e.ariaDescription),at(t,"aria-hidden",e.ariaHidden),at(t,"clip-path",o)}function Lk(t){let e=new WeakMap;return(n,r)=>{let o=e.get(n);if(!o){let i=K6();St(n.ownerSVGElement).append("clipPath").attr("id",i).call(t,n,r),e.set(n,o=`url(#${i})`)}return o}}var yG=Lk((t,e,n)=>{let{width:r,height:o,marginLeft:i,marginRight:s,marginTop:a,marginBottom:c}=n;t.append("rect").attr("x",i).attr("y",a).attr("width",r-s-i).attr("height",o-a-c)}),xG=Lk((t,e)=>{let{projection:n}=e;if(!n)throw new Error('the "sphere" clip option requires a projection');t.append("path").attr("d",Ie(n)({type:"Sphere"}))});function xt(t,e,n,r){gG(t,e,n,r),at(t,"class",e.className),at(t,"fill",e.fill),at(t,"fill-opacity",e.fillOpacity),at(t,"stroke",e.stroke),at(t,"stroke-width",e.strokeWidth),at(t,"stroke-opacity",e.strokeOpacity),at(t,"stroke-linejoin",e.strokeLinejoin),at(t,"stroke-linecap",e.strokeLinecap),at(t,"stroke-miterlimit",e.strokeMiterlimit),at(t,"stroke-dasharray",e.strokeDasharray),at(t,"stroke-dashoffset",e.strokeDashoffset),at(t,"shape-rendering",e.shapeRendering),at(t,"filter",e.imageFilter),at(t,"paint-order",e.paintOrder);let{pointerEvents:o=r.pointerSticky===!1?"none":void 0}=e;at(t,"pointer-events",o)}function dt(t,e){bG(t,"mix-blend-mode",e.mixBlendMode),at(t,"opacity",e.opacity)}function Dk(t,e,n){t.each(function(r){let o=e(r);if(o!=null){let i=this.ownerDocument.createElementNS(un.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(un.xlink,"href",o),n!=null&&i.setAttribute("target",n),this.parentNode.insertBefore(i,this).appendChild(this)}})}function at(t,e,n){n!=null&&t.attr(e,n)}function bG(t,e,n){n!=null&&t.style(e,n)}function mt(t,e,{x:n,y:r},o=oe,i=oe){o+=e.dx,i+=e.dy,n?.bandwidth&&(o+=n.bandwidth()/2),r?.bandwidth&&(i+=r.bandwidth()/2),(o||i)&&t.attr("transform",`translate(${o},${i})`)}function Wt(t,e){if((t=fe(t))!==e)return t}function zp(t,e){if((t=Ot(t))!==e)return t}var wG=/^-?([_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 fs(t){if(t===void 0)return"plot-d6a7b5";if(t=`${t}`,!wG.test(t))throw new Error(`invalid class name: ${t}`);return t}function Tf(t,e){if(typeof e=="string")t.property("style",e);else if(e!=null)for(let n of t)Object.assign(n.style,e)}function Le({frameAnchor:t},{width:e,height:n,marginTop:r,marginRight:o,marginBottom:i,marginLeft:s}){return[/left$/.test(t)?s:/right$/.test(t)?e-o:(s+e-o)/2,/^top/.test(t)?r:/^bottom/.test(t)?n-i:(r+n-i)/2]}var pt=class{constructor(e,n={},r={},o){let{facet:i="auto",facetAnchor:s,fx:a,fy:c,sort:f,dx:l=0,dy:u=0,margin:p=0,marginTop:d=p,marginRight:h=p,marginBottom:m=p,marginLeft:g=p,className:y,clip:x=o?.clip,channels:b,tip:w,render:_}=r;if(this.data=e,this.sort=ao(f)?f:null,this.initializer=Vt(r).initializer,this.transform=this.initializer?r.transform:be(r).transform,i===null||i===!1?this.facet=null:(this.facet=Se(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=e===Qi&&typeof a=="string"?[a]:a,this.fy=e===Qi&&typeof c=="string"?[c]:c),this.facetAnchor=Ak(s),n=Np(n),b!==void 0&&(n={...vG(b),...n}),o!==void 0&&(n={...cx(this,r,o),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,A])=>{if(jn(A.value)){let{value:E,label:T=A.label,scale:$=A.scale}=A.value;A={...A,label:T,scale:$,value:E}}if(e===Qi&&typeof A.value=="string"){let{value:E}=A;A={...A,value:[E]}}return[v,A]}).filter(([v,{value:A,optional:E}])=>{if(A!=null)return!0;if(E)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+l,this.dy=+u,this.marginTop=+d,this.marginRight=+h,this.marginBottom=+m,this.marginLeft=+g,this.clip=zy(x),this.tip=_G(w),this.className=y?fs(y):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:A}=n[v];if(!(A!=="x"&&A!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=hi(_,this.render))}initialize(e,n,r){let o=ii(this.data);e===void 0&&o!=null&&(e=[wn(o)]);let i=e;this.transform!=null&&({facets:e,data:o}=this.transform(o,e,r),o=ii(o)),e!==void 0&&(e.original=i);let s=Hy(this.channels,o);return this.sort!=null&&$C(o,e,s,n,this.sort),{data:o,facets:e,channels:s}}filter(e,n,r){for(let o in n){let{filter:i=Jt}=n[o];if(i!==null){let s=r[o];e=e.filter(a=>i(s[a]))}}return e}project(e,n,r){for(let o in e)if(e[o].scale==="x"&&/^x|x$/.test(o)){let i=o.replace(/^x|x$/,"y");i in e&&e[i].scale==="y"&&Z6(o,i,n,r.projection)}}scale(e,n,r){let o=wf(e,n);return r.projection&&this.project(e,o,r),o}};function we(...t){return t.plot=pt.prototype.plot,t}function hi(t,e){if(t==null)return e===null?void 0:e;if(e==null)return t===null?void 0:t;if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);return function(n,r,o,i,s,a){return t.call(this,n,r,o,i,s,(c,f,l,u,p)=>e.call(this,c,f,l,u,p,a))}}function vG(t){return Object.fromEntries(Object.entries(Np(t)).map(([e,n])=>(n=typeof n=="string"?{value:n,label:e}:dr(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[e,n])))}function _G(t){return t===!0?"xy":t===!1||t==null?null:typeof t=="string"?Se(t,"tip",["x","y","xy"]):t}function Er(t,e){return t?.tip===!0?{...t,tip:e}:Ne(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:e}}:t}function Fk(t,e,n={}){let r=.5-oe,o=.5+oe,i=.5+oe,s=.5-oe;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:x}of e)m>r&&(r=m),g>o&&(o=g),y>i&&(i=y),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:f=a!==void 0?a:o,marginBottom:l=a!==void 0?a:i,marginLeft:u=a!==void 0?a:s}=n;c=+c,f=+f,l=+l,u=+u;let{width:p=640,height:d=SG(t,n,{width:p,marginTopDefault:r,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:s})+Math.max(0,c-r+l-i)}=n;p=+p,d=+d;let h={width:p,height:d,marginTop:c,marginRight:f,marginBottom:l,marginLeft:u};if(t.fx||t.fy){let{margin:m,marginTop:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:f,marginBottom:x=m!==void 0?m:l,marginLeft:b=m!==void 0?m:u}=n.facet??{};g=+g,y=+y,x=+x,b=+b,h.facet={marginTop:g,marginRight:y,marginBottom:x,marginLeft:b}}return h}function SG({x:t,y:e,fy:n,fx:r},{projection:o,aspectRatio:i},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:f,marginLeftDefault:l}){let u=n&&n.scale.domain().length||1,p=Ck(o);if(p){let h=r?r.scale.domain().length:1,m=(1.1*u-.1)/(1.1*h-.1)*p,g=Math.max(.1,Math.min(10,m));return Math.round((s-l-c)*g+a+f)}let d=e?po(e)?e.scale.domain().length||1:Math.max(7,17/u):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=Pk("y",e)/(Pk("x",t)*i),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-l-c)-t.insetLeft-t.insetRight;return(h*y+e.insetTop+e.insetBottom)/g+a+f}return!!(e||n)*Math.max(1,Math.min(60,d*u))*20+!!r*30+60}function Pk(t,e){if(!e)throw new Error(`aspectRatio requires ${t} scale`);let{type:n,domain:r}=e,o;switch(n){case"linear":case"utc":case"time":o=Number;break;case"pow":{let a=e.scale.exponent();o=c=>Math.pow(c,a);break}case"log":o=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${t} scale for aspectRatio: ${n}`)}let[i,s]=Rt(r);return Math.abs(o(s)-o(i))}var qk=new WeakMap;function t3(t,e,{x:n,y:r,px:o,py:i,maxRadius:s=40,channels:a,render:c,...f}={}){return s=+s,o!=null&&(n??=null,a={...a,px:{value:o,scale:"x"}}),i!=null&&(r??=null,a={...a,py:{value:i,scale:"y"}}),{x:n,y:r,channels:a,...f,render:hi(function(l,u,p,d,h,m){h={...h,pointerSticky:!1};let g=h.ownerSVGElement,{data:y}=h.getMarkState(this),x=qk.get(g);x||qk.set(g,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(W)-1,{x:w,y:_,fx:v,fy:A}=u,E=v?v(l.fx)-d.marginLeft:0,T=A?A(l.fy)-d.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),_?.bandwidth&&(T+=_.bandwidth()/2);let $=l.fi!=null,M;if($){let X=x.facetStates;X||(x.facetStates=X=new Map),M=X.get(this),M||X.set(this,M=new Map)}let[k,R]=Le(this,d),{px:S,py:I}=p,C=S?X=>S[X]:e3(p,k),N=I?X=>I[X]:n3(p,R),D,L,P,F;function q(X,rt){if($)if(F&&(F=cancelAnimationFrame(F)),X==null)M.delete(l.fi);else{M.set(l.fi,rt),F=requestAnimationFrame(()=>{F=null;for(let[Y,H]of M)if(H<rt||H===rt&&Y<l.fi){X=null;break}W(X)});return}W(X)}function W(X){if(D===X&&P===x.sticky)return;D=X,P=h.pointerSticky=x.sticky;let rt=D==null?[]:[D];$&&(rt.fx=l.fx,rt.fy=l.fy,rt.fi=l.fi);let Y=m(rt,u,p,d,h);if(L){if($){let H=L.parentNode,et=L.getAttribute("transform"),B=Y.getAttribute("transform");et?Y.setAttribute("transform",et):Y.removeAttribute("transform"),B?H.setAttribute("transform",B):H.removeAttribute("transform"),Y.removeAttribute("aria-label"),Y.removeAttribute("aria-description"),Y.removeAttribute("aria-hidden")}L.replaceWith(Y)}if(x.roots[b]=L=Y,!(D==null&&M?.size>1)){let H=D==null?null:Cn(y)?y[D]:y.get(D);h.dispatchValue(H)}return Y}function tt(X){if(x.sticky||X.pointerType==="mouse"&&X.buttons===1)return;let[rt,Y]=He(X);rt-=E,Y-=T;let H=rt<d.marginLeft||rt>d.width-d.marginRight?1:t,et=Y<d.marginTop||Y>d.height-d.marginBottom?1:e,B=null,wt=s*s;for(let ct of l){let It=H*(C(ct)-rt),kt=et*(N(ct)-Y),J=It*It+kt*kt;J<=wt&&(B=ct,wt=J)}if(B!=null&&(t!==1||e!==1)){let ct=C(B)-rt,It=N(B)-Y;wt=ct*ct+It*It}q(B,wt)}function nt(X){X.pointerType==="mouse"&&D!=null&&(x.sticky&&x.roots.some(rt=>rt?.contains(X.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(rt=>rt(null))):(x.sticky=!0,W(D)),X.stopImmediatePropagation()))}function ot(X){X.pointerType==="mouse"&&(x.sticky||q(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",ot),W(null)},c)}}function ls(t){return t3(1,1,t)}function us(t){return t3(1,.01,t)}function mi(t){return t3(.01,1,t)}function e3({x1:t,x2:e,x:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function n3({y1:t,y2:e,y:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function lx(t){return po(t)&&t.interval===void 0?void 0:"tabular-nums"}function Bk(t,e){let{label:n=t.label,tickSize:r=6,width:o=240,height:i=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:f=0,style:l,ticks:u=(o-f-a)/64,tickFormat:p,fontVariant:d=lx(t),round:h=!0,opacity:m,className:g}=e,y=as(e);g=fs(g),m=Ft(m)[1],p===null&&(p=()=>null);let x=st("svg",y).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",i).attr("viewBox",`0 0 ${o} ${i}`).call(k=>k.append("style").text(`:where(.${g}-ramp) {
|
|
6
|
+
${n}`}function kV(t){return t==="time"?E1:t==="utc"?zd:NV}function mL(t,e,n){let r=kt(Sx(e,(o,i)=>Math.abs(i-o)));if(r<1e3)return pL("millisecond","utc",n);for(let[o,i,s,a]of kV(t)){if(r>a||o==="hour"&&!r)break;if(e.every(c=>i.floor(c)>=c))return pL(o,s,n)}}function Kf(t,e,n){return(r,o,i)=>{let s=t(r,o),a=e(r,o),c=o-Li(i);return o!==c&&i[c]!==void 0&&a===e(i[c],c)?s:n(s,a)}}var Ud=Object.getPrototypeOf(Uint8Array),LV=Object.prototype.toString;function Gn(t){return t instanceof Array||t instanceof Ud}function gL(t){return t instanceof Ud&&!RV(t)}function yL(t){return t?.prototype instanceof Ud&&!OV(t)}function RV(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function OV(t){return t===BigInt64Array||t===BigUint64Array}var dS=Symbol("reindex");function ut(t,e,n){let r=typeof e;return r==="string"?CL(t)?hS(t.getChild(e),n):xL(t,mS(e),n):r==="function"?xL(t,e,n):r==="number"||e instanceof Date||r==="boolean"?Et(t,ue(e),n):typeof e?.transform=="function"?pS(e.transform(t),n):$V(pS(e,n),t?.[dS])}function $V(t,e){return t!=null&&e?Xd(t,e):t}function xL(t,e,n){return Et(t,yL(n)?(r,o)=>xS(e(r,o)):e,n)}function pS(t,e){return e===void 0?cr(t):kL(t)?hS(t,e):t instanceof e?t:e.from(t,yL(e)&&!gL(t)?xS:void 0)}function hS(t,e){return t==null?t:(e===void 0||e===Array)&&FV(t.type)?gS(t.toArray()):pS(t.toArray(),e)}var Es=[null],mS=t=>e=>{let n=e[t];return n===void 0&&e.type==="Feature"?e.properties?.[t]:n},Zt={transform:Fn},W={transform:t=>t};var jd=()=>1,bL=()=>!0,be=t=>t==null?t:`${t}`,Dt=t=>t==null?t:+t;var ic=t=>t?t[0]:void 0,Is=t=>t?t[1]:void 0,wL=t=>t?t[2]:void 0,ue=t=>()=>t;function nu(t){let e=+`${t}`.slice(1)/100;return(n,r)=>In(n,e,r)}function Ne(t){return gL(t)?t:Et(t,xS,Float64Array)}function xS(t){return t==null?NaN:Number(t)}function gS(t){return Et(t,yS)}function yS(t){return t instanceof Date&&!isNaN(t)?t:typeof t=="string"?Bd(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function ce(t,e){return t===void 0&&(t=e),t===null?[void 0,"none"]:Ls(t)?[void 0,t]:[t,void 0]}function Ut(t,e){return t===void 0&&(t=e),t===null||typeof t=="number"?[void 0,t]:[t,void 0]}function bS(t,e,n){if(t!=null)return Oe(t,e,n)}function Oe(t,e,n){let r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function Ri(t){return CL(t)?t:cr(t)}function cr(t){if(t==null||Gn(t))return t;if(kL(t))return hS(t);switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[t]}return Array.from(t)}function Et(t,e,n=Array){return t==null?t:t instanceof n?t.map(e):n.from(t,e)}function Ns(t,e=Array){return t instanceof e?t.slice():e.from(t)}function wS({x:t,x1:e,x2:n}){return t!==void 0||e!==void 0||n!==void 0}function vS({y:t,y1:e,y2:n}){return t!==void 0||e!==void 0||n!==void 0}function Oi(t){return wS(t)||vS(t)||t.interval!==void 0}function Ve(t){return t?.toString===LV}function Ro(t){return Ve(t)&&(t.type!==void 0||t.domain!==void 0)}function fr(t){return Ve(t)&&typeof t.transform!="function"}function Oo(t){return fr(t)&&t.value===void 0&&t.channel===void 0}function _S(t,e,n,r=W){return e===void 0&&n===void 0?(e=0,n=t===void 0?r:t):e===void 0?e=t===void 0?0:t:n===void 0&&(n=t===void 0?0:t),[e,n]}function me(t,e){return t===void 0&&e===void 0?[ic,Is]:[t,e]}function vn({z:t,fill:e,stroke:n}={}){return t===void 0&&([t]=ce(e)),t===void 0&&([t]=ce(n)),t}function Cs(t){return Gn(t)?t.length:t?.numRows}function Fn(t){let e=Cs(t),n=new Uint32Array(e);for(let r=0;r<e;++r)n[r]=r;return n}function Xd(t,e){return Gn(t)?Et(e,n=>t[n],t.constructor):Et(e,n=>t.at(n))}function ru(t){return t.length===1?(e,n)=>t(Xd(n,e)):t}function $i(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function Or(t){return t!==null&&typeof t=="object"?t.valueOf():t}function C1(t,e){if(e[t]!==void 0)return e[t];switch(t){case"x1":case"x2":t="x";break;case"y1":case"y2":t="y";break}return e[t]}function Ge(t){let e;return[{transform:()=>e,label:un(t)},n=>e=n]}function fn(t){return t==null?[t]:Ge(t)}function un(t,e){return typeof t=="string"?t:t&&t.label!==void 0?t.label:e}function ou(t,e){return{transform(n){let r=t.transform(n),o=e.transform(n);return fe(r)||fe(o)?Et(r,(i,s)=>new Date((+r[s]+ +o[s])/2)):Et(r,(i,s)=>(+r[s]+ +o[s])/2,Float64Array)},label:t.label}}function sc(t,e){let n=SS(e?.interval,e?.type);return n?Et(t,n):t}function SS(t,e){let n=iu(t,e);return n&&(r=>oe(r)?n.floor(r):r)}function iu(t,e){if(t!=null){if(typeof t=="number")return MS(t);if(typeof t=="string")return(e==="time"?Yd:oc)(t);if(typeof t.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof t.offset!="function")throw new Error("invalid interval; missing offset method");return t}}function MS(t){t=+t,0<t&&t<1&&Number.isInteger(1/t)&&(t=-1/t);let e=Math.abs(t);return t<0?{floor:n=>Math.floor(n*e)/e,offset:(n,r=1)=>(n*e+Math.floor(r))/e,range:(n,r)=>ye(Math.ceil(n*e),r*e).map(o=>o/e)}:{floor:n=>Math.floor(n/e)*e,offset:(n,r=1)=>n+e*Math.floor(r),range:(n,r)=>ye(Math.ceil(n/e),r/e).map(o=>o*e)}}function $o(t,e){if(t=iu(t,e),t&&typeof t.range!="function")throw new Error("invalid interval: missing range method");return t}function vL(t,e){if(t=$o(t,e),t&&typeof t.ceil!="function")throw new Error("invalid interval: missing ceil method");return t}function _L(t){return ks(t)&&typeof t?.floor=="function"&&t.floor()instanceof Date}function ks(t){return typeof t?.range=="function"}function $r(t){return t===void 0||fr(t)?t:{value:t}}function SL(t){return t==null?null:{transform:e=>ut(e,t,Float64Array),label:un(t)}}function ML(t){if(!qn(t))return!1;for(let e of t)if(e!=null)return typeof e=="object"&&"0"in e&&"1"in e}function qn(t){return t&&typeof t[Symbol.iterator]=="function"}function k1(t){for(let e of t)if(e!=null)return typeof e!="object"||e instanceof Date}function ie(t){for(let e of t){if(e==null)continue;let n=typeof e;return n==="string"||n==="boolean"}}function fe(t){for(let e of t)if(e!=null)return e instanceof Date}function AL(t){for(let e of t)if(e!=null)return typeof e=="string"&&isNaN(e)&&Bd(e)}function TL(t){for(let e of t)if(e!=null){if(typeof e!="string")return!1;if(e.trim())return!isNaN(e)}}function Di(t){for(let e of t)if(e!=null)return typeof e=="number"}function L1(t,e){let n;for(let r of t)if(r!=null){if(!e(r))return!1;n=!0}return n}var DV=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 Ls(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(t)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(t)||DV.has(t))}function EL(t){return typeof t=="number"&&(0<=t&&t<=1||isNaN(t))}function zt(t){return t==null||Pi(t)}function Pi(t){return/^\s*none\s*$/i.test(t)}function IL(t){return/^\s*round\s*$/i.test(t)}function R1(t,e){return bS(t,e,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Do(t="middle"){return R1(t,"frameAnchor")}function NL(t={},...e){let n=t;for(let r of e)for(let o in r)if(n[o]===void 0){let i=r[o];n===t?n={...n,[o]:i}:n[o]=i}return n}function PV(t){console.warn("named iterables are deprecated; please use an object instead");let e=new Set;return Object.fromEntries(Array.from(t,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let o=`${r}`;if(o==="__proto__")throw new Error(`illegal name: ${o}`);if(e.has(o))throw new Error(`duplicate name: ${o}`);return e.add(o),[r,n]}))}function Wd(t){return qn(t)?PV(t):t}function O1(t){return t===!0?t="frame":t===!1?t=null:t!=null&&(t=Oe(t,"clip",["frame","sphere"])),t}function CL(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}function kL(t){return t&&typeof t.toArray=="function"&&t.type}function FV(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}var Dr=Symbol("position"),ur=Symbol("color"),ac=Symbol("radius"),cc=Symbol("length"),fc=Symbol("opacity"),su=Symbol("symbol"),LL=Symbol("projection"),Wt=new Map([["x",Dr],["y",Dr],["fx",Dr],["fy",Dr],["r",ac],["color",ur],["opacity",fc],["symbol",su],["length",cc],["projection",LL]]);function RL(t){return t===Dr||t===LL}function OL(t){return t===Dr||t===ac||t===cc||t===fc}var AS=Math.sqrt(3),TS=2/AS,qV={draw(t,e){let n=Math.sqrt(e/Math.PI),r=n*TS,o=r/2;t.moveTo(0,r),t.lineTo(n,o),t.lineTo(n,-o),t.lineTo(0,-r),t.lineTo(-n,-o),t.lineTo(-n,o),t.closePath()}},ES=new Map([["asterisk",Md],["circle",Ci],["cross",Ad],["diamond",Td],["diamond2",Ed],["hexagon",qV],["plus",Id],["square",Nd],["square2",Cd],["star",kd],["times",Vf],["triangle",Ld],["triangle2",Rd],["wye",Od]]);function IS(t){return t&&typeof t.draw=="function"}function $L(t){return IS(t)?!0:typeof t!="string"?!1:ES.has(t.toLowerCase())}function au(t){if(t==null||IS(t))return t;let e=ES.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function DL(t){if(t==null||IS(t))return[void 0,t];if(typeof t=="string"){let e=ES.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}function Ce({filter:t,sort:e,reverse:n,transform:r,initializer:o,...i}={},s){if(r===void 0&&(t!=null&&(r=kS(t)),e!=null&&!Oo(e)&&(r=NS(r,RS(e))),n&&(r=NS(r,LS))),s!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(e===null||Oo(e))&&{sort:e},transform:NS(r,s)}}function Kt({filter:t,sort:e,reverse:n,initializer:r,...o}={},i){return r===void 0&&(t!=null&&(r=kS(t)),e!=null&&!Oo(e)&&(r=CS(r,RS(e))),n&&(r=CS(r,LS))),{...o,...(e===null||Oo(e))&&{sort:e},initializer:CS(r,i)}}function NS(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,o){return{data:n,facets:r}=t.call(this,n,r,o),e.call(this,Ri(n),r,o)}}function CS(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,o,...i){let s,a,c,f,u,p;return{data:a=n,facets:c=r,channels:s}=t.call(this,n,r,o,...i),{data:u=a,facets:p=c,channels:f}=e.call(this,a,c,{...o,...s},...i),{data:u,facets:p,channels:{...s,...f}}}}function $1(t,e){return(t.initializer!=null?Kt:Ce)(t,e)}function PL(t,e){return $1(e,kS(t))}function kS(t){return(e,n)=>{let r=ut(e,t);return{data:e,facets:n.map(o=>o.filter(i=>r[i]))}}}function FL({sort:t,...e}={}){return{...$1(e,LS),sort:Oo(t)?t:null}}function LS(t,e){return{data:t,facets:e.map(n=>n.slice().reverse())}}function qL({seed:t,sort:e,...n}={}){return{...$1(n,BL(t==null?Math.random:Wa(t))),sort:Oo(e)?e:null}}function D1(t,{sort:e,...n}={}){return{...(fr(t)&&t.channel!==void 0?Kt:$1)(n,RS(t)),sort:Oo(e)?e:null}}function RS(t){return(typeof t=="function"&&t.length!==1?BV:BL)(t)}function BV(t){return(e,n)=>{let r=Gn(e)?(o,i)=>t(e[o],e[i]):(o,i)=>t(e.get(o),e.get(i));return{data:e,facets:n.map(o=>o.slice().sort(r))}}}function BL(t){let e,n;({channel:e,value:t,order:n}={...$r(t)});let r=e?.startsWith("-");if(r&&(e=e.slice(1)),n===void 0&&(n=r?nc:We),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=We;break;case"descending":n=nc;break;default:throw new Error(`invalid order: ${n}`)}return(o,i,s)=>{let a;if(e===void 0)a=ut(o,t);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[e],!a)return{};a=a.value}let c=(f,u)=>n(a[f],a[u]);return{data:o,facets:i.map(f=>f.slice().sort(c))}}}function Gd(t,e){return P1(null,null,t,e)}function Rs(t={y:"count"},e={}){let{x:n=W}=e;if(n==null)throw new Error("missing channel: x");return P1(n,null,t,e)}function Os(t={x:"count"},e={}){let{y:n=W}=e;if(n==null)throw new Error("missing channel: y");return P1(null,n,t,e)}function Hd(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=me(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return P1(n,r,t,e)}function P1(t,e,{data:n=B1,filter:r,sort:o,reverse:i,...s}={},a={}){s=$S(s,a),n=XL(n,W),o=o==null?void 0:UL("sort",o,a),r=r==null?void 0:jL("filter",r,a);let[c,f]=fn(t),[u,p]=fn(e),{z:l,fill:d,stroke:h,x1:m,x2:x,y1:g,y2:y,...b}=a,[w,_]=fn(l),[v]=ce(d),[A]=ce(h),[T,E]=fn(v),[N,M]=fn(A);return{..."z"in a&&{z:w||l},..."fill"in a&&{fill:T||d},..."stroke"in a&&{stroke:N||h},...Ce(b,(k,O,S)=>{let I=sc(ut(k,t),S?.x),C=sc(ut(k,e),S?.y),L=ut(k,l),D=ut(k,v),$=ut(k,A),P=Qd(s,{z:L,fill:D,stroke:$}),F=[],q=[],V=I&&f([]),K=C&&p([]),et=L&&_([]),rt=D&&E([]),j=$&&M([]),nt=0;for(let Y of s)Y.initialize(k);o&&o.initialize(k),r&&r.initialize(k);for(let Y of O){let G=[];for(let tt of s)tt.scope("facet",Y);o&&o.scope("facet",Y),r&&r.scope("facet",Y);for(let[tt,B]of Po(Y,P))for(let[_t,ct]of Po(B,C))for(let[Ct,Lt]of Po(ct,I)){let Z={data:k};if(I&&(Z.x=Ct),C&&(Z.y=_t),P&&(Z.z=tt),!(r&&!r.reduce(Lt,Z))){G.push(nt++),q.push(n.reduceIndex(Lt,k,Z)),I&&V.push(Ct),C&&K.push(_t),L&&et.push(P===L?tt:L[Lt[0]]),D&&rt.push(P===D?tt:D[Lt[0]]),$&&j.push(P===$?tt:$[Lt[0]]);for(let jt of s)jt.reduce(Lt,Z);o&&o.reduce(Lt,Z)}}F.push(G)}return DS(F,o,i),{data:q,facets:F}}),...!Fo(s,"x")&&(c?{x:c}:{x1:m,x2:x}),...!Fo(s,"y")&&(u?{y:u}:{y1:g,y2:y}),...Object.fromEntries(s.map(({name:k,output:O})=>[k,O]))}}function Fo(t,...e){for(let{name:n}of t)if(e.includes(n))return!0;return!1}function OS(t,e,n=F1){let r=Object.entries(t);return e.title!=null&&t.title===void 0&&r.push(["title",WV]),e.href!=null&&t.href===void 0&&r.push(["href",z1]),r.filter(([,o])=>o!==void 0).map(([o,i])=>i===null?zV(o):n(o,i,e))}function F1(t,e,n,r=q1){let o;Ve(e)&&"reduce"in e&&(o=e.scale,e=e.reduce);let i=r(t,e,n),[s,a]=Ge(i.label),c;return{name:t,output:o===void 0?s:{value:s,scale:o},initialize(f){i.initialize(f),c=a([])},scope(f,u){i.scope(f,u)},reduce(f,u){c.push(i.reduce(f,u))}}}function zV(t){return{name:t,initialize(){},scope(){},reduce(){}}}function q1(t,e,n,r=cu){let o=C1(t,n),i=r(e,o),s,a;return{label:un(i===Vd?null:o,i.label),initialize(c){s=o===void 0?c:ut(c,o),i.scope==="data"&&(a=i.reduceIndex(Fn(c),s))},scope(c,f){i.scope===c&&(a=i.reduceIndex(f,s))},reduce(c,f){return i.scope==null?i.reduceIndex(c,s,f):i.reduceIndex(c,s,a,f)}}}function Po(t,e){return e?rn(t,n=>e[n]):[[,t]]}function cu(t,e,n=YV){if(t==null)return n(t);if(typeof t.reduceIndex=="function")return t;if(typeof t.reduce=="function"&&Ve(t))return jV(t);if(typeof t=="function")return XV(t);if(/^p\d{2}$/i.test(t))return Fi(nu(t));switch(`${t}`.toLowerCase()){case"first":return z1;case"last":return VV;case"identity":return B1;case"count":return Vd;case"distinct":return GV;case"sum":return e==null?Vd:HV;case"proportion":return YL(e,"data");case"proportion-facet":return YL(e,"facet");case"deviation":return Fi(Mr);case"min":return Fi(It);case"min-index":return Fi(wx);case"max":return Fi(kt);case"max-index":return Fi(bx);case"mean":return zL(pi);case"median":return zL(Vr);case"variance":return Fi(as);case"mode":return Fi(lf)}return n(t)}function YV(t){throw new Error(`invalid reduce: ${t}`)}function $S(t,e){return OS(t,e,UL)}function UL(t,e,n){return F1(t,e,n,jL)}function jL(t,e,n){return q1(t,e,n,XL)}function XL(t,e){return cu(t,e,UV)}function UV(t){switch(`${t}`.toLowerCase()){case"x":return QV;case"y":return ZV;case"z":return PS}throw new Error(`invalid group reduce: ${t}`)}function Qd(t,e){for(let n in e){let r=e[n];if(r!==void 0&&!t.some(o=>o.name===n))return r}}function DS(t,e,n){if(e){let r=e.output.transform(),o=(i,s)=>We(r[i],r[s]);t.forEach(i=>i.sort(o))}n&&t.forEach(r=>r.reverse())}function jV(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function XV(t){return{reduceIndex(e,n,r){return t(Xd(n,e),r)}}}function Fi(t){return{reduceIndex(e,n){return t(e,r=>n[r])}}}function zL(t){return{reduceIndex(e,n){let r=t(e,o=>n[o]);return fe(n)?new Date(r):r}}}var B1={reduceIndex(t,e){return Xd(e,t)}},z1={reduceIndex(t,e){return e[t[0]]}},WV={reduceIndex(t,e){let r=ui(Wr(t,i=>i.length,i=>e[i]),Is),o=r.slice(-5).reverse();if(o.length<r.length){let i=r.slice(0,-4);o[4]=[`\u2026 ${i.length.toLocaleString("en-US")} more`,sn(i,Is)]}return o.map(([i,s])=>`${i} (${s.toLocaleString("en-US")})`).join(`
|
|
7
|
+
`)}},VV={reduceIndex(t,e){return e[t[t.length-1]]}},Vd={label:"Frequency",reduceIndex(t){return t.length}},GV={label:"Distinct",reduceIndex(t,e){let n=new En;for(let r of t)n.add(e[r]);return n.size}},HV=Fi(sn);function YL(t,e){return t==null?{scope:e,label:"Frequency",reduceIndex:(n,r,o=1)=>n.length/o}:{scope:e,reduceIndex:(n,r,o=1)=>sn(n,i=>r[i])/o}}var QV={reduceIndex(t,e,{x:n}){return n}},ZV={reduceIndex(t,e,{y:n}){return n}},PS={reduceIndex(t,e,{z:n}){return n}};function WL(t){if(typeof t!="function")throw new Error(`invalid test function: ${t}`);return{reduceIndex(e,n,{data:r}){return n[e.find(Gn(r)?o=>t(r[o],o,r):o=>t(r.get(o),o,r))]}}}function fu(t,{scale:e,type:n,value:r,filter:o,hint:i,label:s=un(r)},a){return i===void 0&&typeof r?.transform=="function"&&(i=r.hint),qS(a,{scale:e,type:n,value:ut(t,r),label:s,filter:o,hint:i})}function Y1(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,fu(e,r,n)]))}function uu(t,e){let n=Object.fromEntries(Object.entries(t).map(([r,{scale:o,value:i}])=>{let s=o==null?null:e[o];return[r,s==null?i:Et(i,s)]}));return n.channels=t,n}function qS(t,e){let{scale:n,value:r}=e;if(n===!0||n==="auto")switch(t){case"fill":case"stroke":case"color":e.scale=n!==!0&&L1(r,Ls)?null:"color",e.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":e.scale=n!==!0&&L1(r,EL)?null:"opacity",e.defaultScale="opacity";break;case"symbol":n!==!0&&L1(r,$L)?(e.scale=null,e.value=Et(r,au)):e.scale="symbol",e.defaultScale="symbol";break;default:e.scale=Wt.has(t)?t:null;break}else if(n===!1)e.scale=null;else if(n!=null&&!Wt.has(n))throw new Error(`unknown scale: ${n}`);return e}function GL(t,e,n,r,o){let{order:i,reverse:s,reduce:a=!0,limit:c}=o;for(let f in o){if(!Wt.has(f))continue;let{value:u,order:p=i,reverse:l=s,reduce:d=a,limit:h=c}=$r(o[f]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),p=p===void 0?m!==(u==="width"||u==="height")?QL:HL:tG(p),d==null||d===!1)continue;let x=f==="fx"||f==="fy"?KV(e,r[f]):JV(n,f);if(!x)throw new Error(`missing channel for scale: ${f}`);let g=x.value,[y=0,b=1/0]=qn(h)?h:h<0?[h]:[0,h];if(u==null)x.domain=()=>{let w=Array.from(new En(g));return l&&(w=w.reverse()),(y!==0||b!==1/0)&&(w=w.slice(y,b)),w};else{let w=u==="data"?t:u==="height"?VL(n,"y1","y2"):u==="width"?VL(n,"x1","x2"):FS(n,u,u==="y"?"y2":u==="x"?"x2":void 0),_=cu(d===!0?"max":d,w);x.domain=()=>{let v=f_(Fn(g),A=>_.reduceIndex(A,w),A=>g[A]);return p&&v.sort(p),l&&v.reverse(),(y!==0||b!==1/0)&&(v=v.slice(y,b)),v.map(ic)}}}}function JV(t,e){for(let n in t){let r=t[n];if(r.scale===e)return r}}function KV(t,e){let n=t.original;if(n===t)return e;let r=e.value,o=e.value=[];for(let i=0;i<n.length;++i){let s=r[n[i][0]];for(let a of t[i])o[a]=s}return e}function VL(t,e,n){let r=FS(t,e),o=FS(t,n);return Et(o,(i,s)=>Math.abs(i-r[s]),Float64Array)}function FS(t,e,n){let r=t[e];if(!r&&n!==void 0&&(r=t[n]),r)return r.value;throw new Error(`missing channel: ${e}`)}function tG(t){if(t==null||typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return HL;case"descending":return QL}throw new Error(`invalid order: ${t}`)}function HL([t,e],[n,r]){return We(e,r)||We(t,n)}function QL([t,e],[n,r]){return nc(e,r)||We(t,n)}function Zd(t,e){let n=t[e];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}var eR=new Map([["accent",M3],["category10",S3],["dark2",A3],["observable10",T3],["paired",E3],["pastel1",I3],["pastel2",N3],["set1",C3],["set2",k3],["set3",L3],["tableau10",R3]]);function nR(t){return t!=null&&eR.has(`${t}`.toLowerCase())}var ZL=new Map([...eR,["brbg",qi(iy,sy)],["prgn",qi(ay,cy)],["piyg",qi(fy,uy)],["puor",qi(ly,py)],["rdbu",qi(wd,Yf)],["rdgy",qi(dy,hy)],["rdylbu",qi(vd,Uf)],["rdylgn",qi(my,xy)],["spectral",qi(gy,yy)],["burd",JL(wd,Yf)],["buylrd",JL(vd,Uf)],["blues",He(Uy,jy)],["greens",He(Xy,Wy)],["greys",He(Vy,Gy)],["oranges",He(Ky,t1)],["purples",He(Hy,Qy)],["reds",He(Zy,Jy)],["turbo",Bi(f1)],["viridis",Bi(l1)],["magma",Bi(p1)],["inferno",Bi(d1)],["plasma",Bi(h1)],["cividis",Bi(e1)],["cubehelix",Bi(n1)],["warm",Bi(o1)],["cool",Bi(i1)],["bugn",He(by,wy)],["bupu",He(vy,_y)],["gnbu",He(Sy,My)],["orrd",He(Ay,Ty)],["pubu",He(Ny,Cy)],["pubugn",He(Ey,Iy)],["purd",He(ky,Ly)],["rdpu",He(Ry,Oy)],["ylgn",He(Py,Fy)],["ylgnbu",He($y,Dy)],["ylorbr",He(qy,By)],["ylorrd",He(zy,Yy)],["rainbow",KL(s1)],["sinebow",KL(c1)]]);function He(t,e){return({length:n})=>n===1?[t[3][1]]:n===2?[t[3][1],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?mn(e,n):t[n])}function qi(t,e){return({length:n})=>n===2?[t[3][0],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?mn(e,n):t[n])}function JL(t,e){return({length:n})=>n===2?[t[3][2],t[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?mn(r=>e(1-r),n):t[n].slice().reverse())}function Bi(t){return({length:e})=>mn(t,Math.max(2,Math.floor(e)))}function KL(t){return({length:e})=>mn(t,Math.floor(e)+1).slice(0,-1)}function BS(t){let e=`${t}`.toLowerCase();if(!ZL.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return ZL.get(e)}function Jd(t,e){let n=BS(t),r=typeof n=="function"?n({length:e}):n;return r.length!==e?r.slice(0,e):r}function rR(t,e="greys"){let n=new Set,[r,o]=Jd(e,2);for(let i of t)if(i!=null)if(i===!0)n.add(o);else if(i===!1)n.add(r);else return;return[...n]}var tR=new Map([["brbg",sy],["prgn",cy],["piyg",uy],["puor",py],["rdbu",Yf],["rdgy",hy],["rdylbu",Uf],["rdylgn",xy],["spectral",yy],["burd",t=>Yf(1-t)],["buylrd",t=>Uf(1-t)],["blues",jy],["greens",Wy],["greys",Gy],["purples",Qy],["reds",Jy],["oranges",t1],["turbo",f1],["viridis",l1],["magma",p1],["inferno",d1],["plasma",h1],["cividis",e1],["cubehelix",n1],["warm",o1],["cool",i1],["bugn",wy],["bupu",_y],["gnbu",My],["orrd",Ty],["pubugn",Iy],["pubu",Cy],["purd",Ly],["rdpu",Oy],["ylgnbu",Dy],["ylgn",Fy],["ylorbr",By],["ylorrd",Yy],["rainbow",s1],["sinebow",c1]]);function lu(t){let e=`${t}`.toLowerCase();if(!tR.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return tR.get(e)}var eG=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function oR(t){return t!=null&&eG.has(`${t}`.toLowerCase())}var YS=t=>e=>t(1-e),zS=[0,1],iR=new Map([["number",ee],["rgb",Ar],["hsl",$_],["hcl",D_],["lab",Yx]]);function US(t){let e=`${t}`.toLowerCase();if(!iR.has(e))throw new Error(`unknown interpolator: ${e}`);return iR.get(e)}function du(t,e,n,{type:r,nice:o,clamp:i,zero:s,domain:a=dR(t,n),unknown:c,round:f,scheme:u,interval:p,range:l=Wt.get(t)===ac?iG(n,a):Wt.get(t)===cc?sG(n,a):Wt.get(t)===fc?zS:void 0,interpolate:d=Wt.get(t)===ur?u==null&&l!==void 0?Ar:lu(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):f?$a:ee,reverse:h}){if(p=$o(p,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=US(d)),h=!!h,l!==void 0){let m=(a=cr(a)).length,x=(l=cr(l)).length;if(m!==x){if(d.length===1)throw new Error("invalid piecewise interpolator");d=go(d,l),l=void 0}}if(d.length===1?(h&&(d=YS(d),h=!1),l===void 0&&(l=Float64Array.from(a,(m,x)=>x/(a.length-1)),l.length===2&&(l=zS)),e.interpolate((l===zS?ue:Kd)(d))):e.interpolate(d),s){let[m,x]=Ft(a);(m>0||x<0)&&(a=Ns(a),(Li(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return h&&(a=fs(a)),e.domain(a).unknown(c),o&&(e.nice(nG(o,r)),a=e.domain()),l!==void 0&&e.range(l),i&&e.clamp(i),{type:r,domain:a,range:l,scale:e,interpolate:d,interval:p}}function nG(t,e){return t===!0?void 0:typeof t=="number"?t:vL(t,e)}function sR(t,e,n){return du(t,_i(),e,n)}function aR(t,e,n){return jS(t,e,{...n,exponent:.5})}function jS(t,e,{exponent:n=1,...r}){return du(t,fd().exponent(n),e,{...r,type:"pow"})}function cR(t,e,{base:n=10,domain:r=aG(e),...o}){return du(t,ad().base(n),e,{...o,domain:r})}function fR(t,e,{constant:n=1,...r}){return du(t,cd().constant(n),e,r)}function uR(t,e,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:o=r,scheme:i="rdylbu",domain:s=cG(e),unknown:a,interpolate:c,reverse:f}){return n===void 0&&(n=c!==void 0?mn(c,o):Wt.get(t)===ur?Jd(i,o):void 0),s.length>0&&(s=ud(s,n===void 0?{length:o}:n).quantiles()),U1(t,e,{domain:s,range:n,reverse:f,unknown:a})}function lR(t,e,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:o="rdylbu",domain:i=dR(t,e),unknown:s,interpolate:a,reverse:c}){let[f,u]=Ft(i),p;return n===void 0?(p=on(f,u,r),p[0]<=f&&p.splice(0,1),p[p.length-1]>=u&&p.pop(),r=p.length+1,n=a!==void 0?mn(a,r):Wt.get(t)===ur?Jd(o,r):void 0):(p=mn(ee(f,u),r+1).slice(1,-1),f instanceof Date&&(p=p.map(l=>new Date(l)))),Li(cr(i))<0&&p.reverse(),U1(t,e,{domain:p,range:n,reverse:c,unknown:s})}function U1(t,e,{domain:n=[0],unknown:r,scheme:o="rdylbu",interpolate:i,range:s=i!==void 0?mn(i,n.length+1):Wt.get(t)===ur?Jd(o,n.length+1):void 0,reverse:a}){n=cr(n);let c=Li(n);if(!isNaN(c)&&!rG(n,c))throw new Error(`the ${t} scale has a non-monotonic domain`);return a&&(s=fs(s)),{type:"threshold",scale:ld(c<0?fs(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function rG(t,e){for(let n=1,r=t.length,o=t[0];n<r;++n){let i=An(o,o=t[n]);if(i!==0&&i!==e)return!1}return!0}function pR(t){return{type:"identity",scale:OL(Wt.get(t))?id():e=>e}}function pu(t,e=Zf){return t.length?[It(t,({value:n})=>n===void 0?n:It(n,e)),kt(t,({value:n})=>n===void 0?n:kt(n,e))]:[0,1]}function dR(t,e){let n=Wt.get(t);return(n===ac||n===fc||n===cc?oG:pu)(e)}function oG(t){return[0,t.length?kt(t,({value:e})=>e===void 0?e:kt(e,Zf)):1]}function iG(t,e){let n=t.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=In(t,.5,({value:s})=>s===void 0?NaN:In(s,.25,Pn)),o=e.map(s=>3*Math.sqrt(s/r)),i=30/kt(o);return i<1?o.map(s=>s*i):o}function sG(t,e){let n=Vr(t,({value:i})=>i===void 0?NaN:Vr(i,Math.abs)),r=e.map(i=>12*i/n),o=60/kt(r);return o<1?r.map(i=>i*o):r}function aG(t){for(let{value:e}of t)if(e!==void 0)for(let n of e){if(n>0)return pu(t,Pn);if(n<0)return pu(t,Ss)}return[1,10]}function cG(t){let e=[];for(let{value:n}of t)if(n!==void 0)for(let r of n)e.push(r);return e}function Kd(t){return(e,n)=>r=>t(e+r*(n-e))}var XS=0,WS;function hR(){let t=XS;return XS=0,WS=void 0,t}function _n(t){t!==WS&&(WS=t,console.warn(t),++XS)}function j1(t,e,n,r,{type:o,nice:i,clamp:s,domain:a=pu(r),unknown:c,pivot:f=0,scheme:u,range:p,symmetric:l=!0,interpolate:d=Wt.get(t)===ur?u==null&&p!==void 0?Ar:lu(u!==void 0?u:"rdbu"):ee,reverse:h}){f=+f,a=cr(a);let[m,x]=a;if(a.length>2&&_n(`Warning: the diverging ${t} scale domain contains extra elements.`),An(m,x)<0&&([m,x]=[x,m],h=!h),m=Math.min(m,f),x=Math.max(x,f),typeof d!="function"&&(d=US(d)),p!==void 0&&(d=d.length===1?Kd(d)(...p):go(d,p)),h&&(d=YS(d)),l){let g=n.apply(f),y=g-n.apply(m),b=n.apply(x)-g;y<b?m=n.invert(g-b):y>b&&(x=n.invert(g+y))}return e.domain([m,f,x]).unknown(c).interpolator(d),s&&e.clamp(s),i&&e.nice(i),{type:o,domain:[m,x],pivot:f,interpolate:d,scale:e}}function mR(t,e,n){return j1(t,bd(),fG,e,n)}function xR(t,e,n){return VS(t,e,{...n,exponent:.5})}function VS(t,e,{exponent:n=1,...r}){return j1(t,oy().exponent(n=+n),pG(n),e,{...r,type:"diverging-pow"})}function gR(t,e,{base:n=10,pivot:r=1,domain:o=pu(e,r<0?Ss:Pn),...i}){return j1(t,ny().base(n=+n),uG,e,{domain:o,pivot:r,...i})}function yR(t,e,{constant:n=1,...r}){return j1(t,ry().constant(n=+n),dG(n),e,r)}var fG={apply(t){return t},invert(t){return t}},uG={apply:Math.log,invert:Math.exp},lG={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function pG(t){return t===.5?lG:{apply(e){return Math.sign(e)*Math.pow(Math.abs(e),t)},invert(e){return Math.sign(e)*Math.pow(Math.abs(e),1/t)}}}function dG(t){return{apply(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))},invert(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}}function bR(t,e,n,r){return du(t,e,n,r)}function wR(t,e,n){return bR(t,Kg(),e,n)}function vR(t,e,n){return bR(t,ty(),e,n)}var hu=Symbol("ordinal");function SR(t,e,n,{type:r,interval:o,domain:i,range:s,reverse:a,hint:c}){return o=$o(o,r),i===void 0&&(i=IR(n,o,t)),(r==="categorical"||r===hu)&&(r="ordinal"),a&&(i=fs(i)),i=e.domain(i).domain(),s!==void 0&&(typeof s=="function"&&(s=s(i)),e.range(s)),{type:r,domain:i,range:s,scale:e,hint:c,interval:o}}function MR(t,e,{type:n,interval:r,domain:o,range:i,scheme:s,unknown:a,...c}){r=$o(r,n),o===void 0&&(o=IR(e,r,t));let f;if(Wt.get(t)===su)f=hG(e),i=i===void 0?mG(f):Et(i,au);else if(Wt.get(t)===ur&&(i===void 0&&(n==="ordinal"||n===hu)&&(i=rR(o,s),i!==void 0&&(s=void 0)),s===void 0&&i===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(i!==void 0){let u=lu(s),p=i[0],l=i[1]-i[0];i=({length:d})=>mn(h=>u(p+l*h),d)}else i=BS(s);if(a===rd)throw new Error(`implicit unknown on ${t} scale is not supported`);return SR(t,Va().unknown(a),e,{...c,type:n,domain:o,range:i,hint:f})}function AR(t,e,{align:n=.5,padding:r=.5,...o}){return ER(a3().align(n).padding(r),e,o,t)}function TR(t,e,{align:n=.5,padding:r=.1,paddingInner:o=r,paddingOuter:i=t==="fx"||t==="fy"?0:r,...s}){return ER(ws().align(n).paddingInner(o).paddingOuter(i),e,s,t)}function ER(t,e,n,r){let{round:o}=n;return o!==void 0&&t.round(o=!!o),t=SR(r,t,e,n),t.round=o,t}function IR(t,e,n){let r=new En;for(let{value:o,domain:i}of t){if(i!==void 0)return i();if(o!==void 0)for(let s of o)r.add(s)}if(e!==void 0){let[o,i]=Ft(r).map(e.floor,e);return e.range(o,e.offset(i))}if(r.size>1e4&&Wt.get(n)===Dr)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return ui(r,We)}function _R(t,e){let n;for(let{hint:r}of t){let o=r?.[e];if(o!==void 0){if(n===void 0)n=o;else if(n!==o)return}}return n}function hG(t){return{fill:_R(t,"fill"),stroke:_R(t,"stroke")}}function mG(t){return zt(t.fill)?B3:w1}function th(t,{label:e,inset:n=0,insetTop:r=n,insetRight:o=n,insetBottom:i=n,insetLeft:s=n,round:a,nice:c,clamp:f,zero:u,align:p,padding:l,projection:d,facet:{label:h=e}={},...m}={}){let x={};for(let[g,y]of t){let b=m[g],w=DR(g,y,{round:Wt.get(g)===Dr?a:void 0,nice:c,clamp:f,zero:u,align:p,padding:l,projection:d,...b});if(w){let{label:_=g==="fx"||g==="fy"?h:e,percent:v,transform:A,inset:T,insetTop:E=T!==void 0?T:g==="y"?r:0,insetRight:N=T!==void 0?T:g==="x"?o:0,insetBottom:M=T!==void 0?T:g==="y"?i:0,insetLeft:k=T!==void 0?T:g==="x"?s:0}=b||{};if(A==null)A=void 0;else if(typeof A!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?xG(y,w):_,w.transform=A,g==="x"||g==="fx"?(w.insetLeft=+k,w.insetRight=+N):(g==="y"||g==="fy")&&(w.insetTop=+E,w.insetBottom=+M),x[g]=w}}return x}function HS(t){let e={},n={scales:e};for(let[r,o]of Object.entries(t)){let{scale:i,type:s,interval:a,label:c}=o;e[r]=FR(o),n[r]=i,i.type=s,a!=null&&(i.interval=a),c!=null&&(i.label=c)}return n}function RR(t,e){let{x:n,y:r,fx:o,fy:i}=t,s=o||i?V1(e):e;o&&NR(o,s),i&&CR(i,s);let a=o||i?QS(t,e):e;n&&NR(n,a),r&&CR(r,a)}function xG(t=[],e){let n;for(let{label:r}of t)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!qo(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function W1(t){return Math.sign(Li(t.domain()))*Math.sign(Li(t.range()))}function V1(t){let{marginTop:e,marginRight:n,marginBottom:r,marginLeft:o,width:i,height:s,facet:{marginTop:a,marginRight:c,marginBottom:f,marginLeft:u}}=t;return{marginTop:Math.max(e,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,f),marginLeft:Math.max(o,u),width:i,height:s}}function QS({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=V1(n);return{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:t?t.scale.bandwidth()+s+o:a,height:e?e.scale.bandwidth()+r+i:c,facet:{width:a,height:c}}}function NR(t,e){if(t.range===void 0){let{insetLeft:n,insetRight:r}=t,{width:o,marginLeft:i=0,marginRight:s=0}=e,a=i+n,c=o-s-r;t.range=[a,Math.max(a,c)],qo(t)||(t.range=$R(t)),t.scale.range(t.range)}OR(t)}function CR(t,e){if(t.range===void 0){let{insetTop:n,insetBottom:r}=t,{height:o,marginTop:i=0,marginBottom:s=0}=e,a=i+n,c=o-s-r;t.range=[Math.max(a,c),a],qo(t)?t.range.reverse():t.range=$R(t),t.scale.range(t.range)}OR(t)}function OR(t){t.round===void 0&&bG(t)&&gG(t)<=30&&t.scale.round(!0)}function gG({scale:t}){let e=t.domain().length,[n,r]=t.range(),o=t.paddingInner?t.paddingInner():1,i=t.paddingOuter?t.paddingOuter():t.padding(),s=e-o,a=Math.abs(r-n)/Math.max(1,s+i*2);return(a-Math.floor(a))*s}function $R(t){let e=t.scale.domain().length+ZS(t);if(!(e>2))return t.range;let[n,r]=t.range;return Array.from({length:e},(o,i)=>n+i/(e-1)*(r-n))}function G1(t,e,n){return DR(t,n===void 0?void 0:[{hint:n}],{...e})}function DR(t,e=[],n={}){let r=yG(t,e,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&t!=="fx"&&t!=="fy"&&qo({type:r})){let o=e.map(({value:i})=>i).filter(i=>i!==void 0);o.some(fe)?_n(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${mu(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 ${t} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${t} scale to "${mu(r)}".`):o.some(AL)?_n(`Warning: some data associated with the ${t} 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 "${mu(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 ${t} scale to "${mu(r)}".`):o.some(TL)&&_n(`Warning: some data associated with the ${t} 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 "${mu(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${t} scale to "${mu(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=X1(e,n,Ne);break;case"identity":switch(Wt.get(t)){case Dr:n=X1(e,n,Ne);break;case su:n=X1(e,n,wG);break}break;case"utc":case"time":n=X1(e,n,gS);break}switch(r){case"diverging":return mR(t,e,n);case"diverging-sqrt":return xR(t,e,n);case"diverging-pow":return VS(t,e,n);case"diverging-log":return gR(t,e,n);case"diverging-symlog":return yR(t,e,n);case"categorical":case"ordinal":case hu:return MR(t,e,n);case"cyclical":case"sequential":case"linear":return sR(t,e,n);case"sqrt":return aR(t,e,n);case"threshold":return U1(t,e,n);case"quantile":return uR(t,e,n);case"quantize":return lR(t,e,n);case"pow":return jS(t,e,n);case"log":return cR(t,e,n);case"symlog":return fR(t,e,n);case"utc":return vR(t,e,n);case"time":return wR(t,e,n);case"point":return AR(t,e,n);case"band":return TR(t,e,n);case"identity":return pR(t);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function mu(t){return typeof t=="symbol"?t.description:t}function kR(t){return typeof t=="string"?`${t}`.toLowerCase():t}var LR={toString:()=>"projection"};function yG(t,e,{type:n,domain:r,range:o,scheme:i,pivot:s,projection:a}){if(n=kR(n),t==="fx"||t==="fy")return"band";(t==="x"||t==="y")&&a!=null&&(n=LR);for(let f of e){let u=kR(f.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===LR)return;if(n!==void 0)return n;if(r===void 0&&!e.some(({value:f})=>f!==void 0))return;let c=Wt.get(t);if(c===ac)return"sqrt";if(c===fc||c===cc)return"linear";if(c===su)return"ordinal";if((r||o||[]).length>2)return GS(c);if(r!==void 0){if(ie(r))return GS(c);if(fe(r))return"utc"}else{let f=e.map(({value:u})=>u).filter(u=>u!==void 0);if(f.some(ie))return GS(c);if(f.some(fe))return"utc"}if(c===ur){if(s!=null||oR(i))return"diverging";if(nR(i))return"categorical"}return"linear"}function GS(t){switch(t){case Dr:return"point";case ur:return hu;default:return"ordinal"}}function qo({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===hu}function ZS({type:t}){return t==="threshold"}function bG({type:t}){return t==="point"||t==="band"}function lr(t){if(t===void 0)return!0;let e=t.domain(),n=t(e[0]);for(let r=1,o=e.length;r<o;++r)if(t(e[r])-n)return!1;return!0}function X1(t,{domain:e,...n},r){for(let o of t)o.value!==void 0&&(e===void 0&&(e=o.value?.domain),o.value=r(o.value));return{domain:e===void 0?e:r(e),...n}}function wG(t){return Et(t,au)}function $s(t={}){let e;for(let n in t)if(Wt.has(n)&&Ro(t[n])){if(e!==void 0)throw new Error("ambiguous scale definition; multiple scales found");e=FR(G1(n,t[n]))}if(e===void 0)throw new Error("invalid scale definition; no scale found");return e}function PR(t){return e=>{if(!Wt.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return t[e]}}function FR({scale:t,type:e,domain:n,range:r,interpolate:o,interval:i,transform:s,percent:a,pivot:c}){if(e==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let f=t.unknown?t.unknown():void 0;return{type:e,domain:Ns(n),...r!==void 0&&{range:Ns(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...f!==void 0&&{unknown:f},...i!==void 0&&{interval:i},...o!==void 0&&{interpolate:o},...t.clamp&&{clamp:t.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...t.base&&{base:t.base()},...t.exponent&&{exponent:t.exponent()},...t.constant&&{constant:t.constant()},...t.align&&{align:t.align(),round:t.round()},...t.padding&&(t.paddingInner?{paddingInner:t.paddingInner(),paddingOuter:t.paddingOuter()}:{padding:t.padding()}),...t.bandwidth&&{bandwidth:t.bandwidth(),step:t.step()},apply:u=>t(u),...t.invert&&{invert:u=>t.invert(u)}}}function BR(t,e){let{fx:n,fy:r}=th(t,e),o=n?.scale.domain(),i=r?.scale.domain();return o&&i?xx(o,i).map(([s,a],c)=>({x:s,y:a,i:c})):o?o.map((s,a)=>({x:s,i:a})):i?i.map((s,a)=>({y:s,i:a})):void 0}function zR(t,{x:e,y:n}){return e&&=n4(e),n&&=n4(n),t.filter(e&&n?r=>e.has(r.x)&&n.has(r.y):e?r=>e.has(r.x):r=>n.has(r.y)).sort(e&&n?(r,o)=>e.get(r.x)-e.get(o.x)||n.get(r.y)-n.get(o.y):e?(r,o)=>e.get(r.x)-e.get(o.x):(r,o)=>n.get(r.y)-n.get(o.y))}function Q1(t,{fx:e,fy:n}){let r=Fn(t),o=e?.value,i=n?.value;return e&&n?Wr(r,s=>(s.fx=o[s[0]],s.fy=i[s[0]],s),s=>o[s],s=>i[s]):e?Wr(r,s=>(s.fx=o[s[0]],s),s=>o[s]):Wr(r,s=>(s.fy=i[s[0]],s),s=>i[s])}function YR(t,e,{marginTop:n,marginLeft:r}){return t&&e?({x:o,y:i})=>`translate(${t(o)-r},${e(i)-n})`:t?({x:o})=>`translate(${t(o)-r},0)`:({y:o})=>`translate(0,${e(o)-n})`}function UR(t){let e=[],n=new Uint32Array(sn(t,r=>r.length));for(let r of t){let o=0;for(let i of t)r!==i&&(n.set(i,o),o+=i.length);e.push(n.slice(0,o))}return e}var vG=new Map([["top",JS],["right",e4],["bottom",KS],["left",t4],["top-left",H1(JS,t4)],["top-right",H1(JS,e4)],["bottom-left",H1(KS,t4)],["bottom-right",H1(KS,e4)],["top-empty",SG],["right-empty",TG],["bottom-empty",MG],["left-empty",AG],["empty",EG]]);function jR(t){if(t==null)return null;let e=vG.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}var qR=new WeakMap;function n4(t){let e=qR.get(t);return e||qR.set(t,e=new Tn(Et(t,(n,r)=>[n,r]))),e}function Ds(t,e){return n4(t).get(e)}function _G(t,e,n){return e=Or(e),n=Or(n),t.find(r=>Object.is(Or(r.x),e)&&Object.is(Or(r.y),n))}function Z1(t,e,n){return _G(t,e,n)?.empty}function JS(t,{y:e},{y:n}){return e?Ds(e,n)===0:!0}function KS(t,{y:e},{y:n}){return e?Ds(e,n)===e.length-1:!0}function t4(t,{x:e},{x:n}){return e?Ds(e,n)===0:!0}function e4(t,{x:e},{x:n}){return e?Ds(e,n)===e.length-1:!0}function SG(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,r);if(i>0)return Z1(t,n,e[i-1])}function MG(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,r);if(i<e.length-1)return Z1(t,n,e[i+1])}function AG(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,n);if(i>0)return Z1(t,e[i-1],r)}function TG(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;let i=Ds(e,n);if(i<e.length-1)return Z1(t,e[i+1],r)}function EG(t,e,{empty:n}){return n}function H1(t,e){return function(){return t.apply(null,arguments)&&e.apply(null,arguments)}}function J1(t,{channels:{fx:e,fy:n},groups:r}){return e&&n?t.map(({x:o,y:i})=>r.get(o)?.get(i)??[]):e?t.map(({x:o})=>r.get(o)??[]):t.map(({y:o})=>r.get(o)??[])}var XR=Math.PI,zi=2*XR,r4=.618;function WR({projection:t,inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={},s){if(t==null)return;if(typeof t.stream=="function")return t;let a,c,f="frame";if(Ve(t)){let _;if({type:t,domain:c,inset:_,insetTop:n=_!==void 0?_:n,insetRight:r=_!==void 0?_:r,insetBottom:o=_!==void 0?_:o,insetLeft:i=_!==void 0?_:i,clip:f=f,...a}=t,t==null)return}typeof t!="function"&&({type:t}=o4(t));let{width:u,height:p,marginLeft:l,marginRight:d,marginTop:h,marginBottom:m}=s,x=u-l-d-i-r,g=p-h-m-n-o;if(t=t?.({width:x,height:g,clip:f,...a}),t==null)return;f=IG(f,l,h,u-d,p-m);let y=l+i,b=h+n,w;if(c!=null){let[[_,v],[A,T]]=Ue(t).bounds(c),E=Math.min(x/(A-_),g/(T-v));E>0?(y-=(E*(_+A)-x)/2,b-=(E*(v+T)-g)/2,w=ja({point(N,M){this.stream.point(N*E+y,M*E+b)}})):_n("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=y===0&&b===0?VR():ja({point(_,v){this.stream.point(_+y,v+b)}}),{stream:_=>t.stream(w.stream(f(_)))}}function o4(t){switch(`${t}`.toLowerCase()){case"albers-usa":return Zr($6,.7463,.4673);case"albers":return K1(Zp,.7463,.4673);case"azimuthal-equal-area":return Zr(P6,4,4);case"azimuthal-equidistant":return Zr(q6,zi,zi);case"conic-conformal":return K1(Y6,zi,zi);case"conic-equal-area":return K1(ys,6.1702,2.9781);case"conic-equidistant":return K1(j6,7.312,3.6282);case"equal-earth":return Zr(W6,5.4133,2.6347);case"equirectangular":return Zr(U6,zi,XR);case"gnomonic":return Zr(G6,3.4641,3.4641);case"identity":return{type:VR};case"reflect-y":return{type:NG};case"mercator":return Zr(B6,zi,zi);case"orthographic":return Zr(Q6,2,2);case"stereographic":return Zr(J6,2,2);case"transverse-mercator":return Zr(t3,zi,zi);default:throw new Error(`unknown projection type: ${t}`)}}function IG(t,e,n,r,o){if(t===!1||t==null||typeof t=="number")return i=>i;switch(t===!0&&(t="frame"),`${t}`.toLowerCase()){case"frame":return Cf(e,n,r,o);default:throw new Error(`unknown projection clip type: ${t}`)}}function Zr(t,e,n){return{type:({width:r,height:o,rotate:i,precision:s=.15,clip:a})=>{let c=t();return s!=null&&c.precision?.(s),i!=null&&c.rotate?.(i),typeof a=="number"&&c.clipAngle?.(a),r!=null&&(c.scale(Math.min(r/e,o/n)),c.translate([r/2,o/2])),c},aspectRatio:n/e}}function K1(t,e,n){let{type:r,aspectRatio:o}=Zr(t,e,n);return{type:i=>{let{parallels:s,domain:a,width:c,height:f}=i,u=r(i);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,f],{type:"Sphere"})),u},aspectRatio:o}}var VR=ue({stream:t=>t}),NG=ue(ja({point(t,e){this.stream.point(t,-e)}}));function i4(t,e,n,r){let o=n[t],i=n[e],s=o.length,a=n[t]=new Float64Array(s).fill(NaN),c=n[e]=new Float64Array(s).fill(NaN),f,u=r.stream({point(p,l){a[f]=p,c[f]=l}});for(f=0;f<s;++f)u.point(o[f],i[f])}function GR({projection:t}={}){return t==null?!1:typeof t.stream=="function"?!0:(Ve(t)&&(t=t.type),t!=null)}function HR(t){if(typeof t?.stream=="function")return r4;if(Ve(t)){let e,n;if({domain:e,type:t,...n}=t,e!=null&&t!=null){let r=typeof t=="string"?o4(t).type:t,[[o,i],[s,a]]=Ue(r({...n,width:100,height:100})).bounds(e),c=(a-i)/(s-o);return c&&isFinite(c)?c<.2?.2:c>5?5:c:r4}}if(t!=null){if(typeof t!="function"){let{aspectRatio:e}=o4(t);if(e)return e}return r4}}function Bo(t,e,{projection:n}){let{x:r,y:o}=t,i={};return r&&(i.x=r),o&&(i.y=o),i=uu(i,e),n&&r?.scale==="x"&&o?.scale==="y"&&i4("x","y",i,n),r&&(i.x=Ne(i.x)),o&&(i.y=Ne(i.y)),i}function QR(t){let e=[],n=[],r={scale:"x",value:e},o={scale:"y",value:n},i={point(s,a){e.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of t.value)or(s,i);return[r,o]}function Ps(t={}){let{document:e=typeof window<"u"?window.document:void 0,clip:n}=t;return{document:e,clip:O1(n)}}function ot(t,{document:e}){return Nt(hi(t).call(e.documentElement))}var tb=Symbol("unset");function Fs(t){return(t.length===1?CG:kG)(t)}function CG(t){let e,n=tb;return r=>(Object.is(n,r)||(n=r,e=t(r)),e)}function kG(t){let e,n;return(...r)=>((n?.length!==r.length||n.some((o,i)=>!Object.is(o,r[i])))&&(n=r,e=t(...r)),e)}var LG=Fs(t=>new Intl.NumberFormat(t)),RG=Fs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}})),OG=Fs((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}}));function s4(t="en-US"){let e=LG(t);return n=>n!=null&&!isNaN(n)?e.format(n):void 0}function ZR(t="en-US",e="short"){let n=RG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function JR(t="en-US",e="short"){let n=OG(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function a4(t){return Jf(t,"Invalid Date")}function $G(t="en-US"){let e=s4(t);return n=>(n instanceof Date?a4:typeof n=="number"?e:be)(n)}var zo=$G();var le=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,DG=0,PG=0;function c4(){return`plot-clip-${++DG}`}function KR(){return`plot-pattern-${++PG}`}function eb(t,{title:e,href:n,ariaLabel:r,ariaDescription:o,ariaHidden:i,target:s,fill:a,fillOpacity:c,stroke:f,strokeWidth:u,strokeOpacity:p,strokeLinejoin:l,strokeLinecap:d,strokeMiterlimit:h,strokeDasharray:m,strokeDashoffset:x,opacity:g,mixBlendMode:y,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:A},{ariaLabel:T,fill:E="currentColor",fillOpacity:N,stroke:M="none",strokeOpacity:k,strokeWidth:O,strokeLinecap:S,strokeLinejoin:I,strokeMiterlimit:C,paintOrder:L}){E===null&&(a=null,c=null),M===null&&(f=null,p=null),zt(E)?!zt(M)&&(!zt(a)||A?.fill)&&(M="none"):zt(M)&&(!zt(f)||A?.stroke)&&(E="none");let[D,$]=ce(a,E),[P,F]=Ut(c,N),[q,V]=ce(f,M),[K,et]=Ut(p,k),[rt,j]=Ut(g);Pi(V)||(u===void 0&&(u=O),d===void 0&&(d=S),l===void 0&&(l=I),h===void 0&&!IL(l)&&(h=C),!Pi($)&&w===void 0&&(w=L));let[nt,Y]=Ut(u);return E!==null&&(t.fill=te($,"currentColor"),t.fillOpacity=eh(F,1)),M!==null&&(t.stroke=te(V,"none"),t.strokeWidth=eh(Y,1),t.strokeOpacity=eh(et,1),t.strokeLinejoin=te(l,"miter"),t.strokeLinecap=te(d,"butt"),t.strokeMiterlimit=eh(h,4),t.strokeDasharray=te(m,"none"),t.strokeDashoffset=te(x,"0")),t.target=be(s),t.ariaLabel=be(T),t.ariaDescription=be(o),t.ariaHidden=be(i),t.opacity=eh(j,1),t.mixBlendMode=te(y,"normal"),t.imageFilter=te(b,"none"),t.paintOrder=te(w,"normal"),t.pointerEvents=te(_,"auto"),t.shapeRendering=te(v,"auto"),{title:{value:e,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:D,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:q,scale:"auto",optional:!0},strokeOpacity:{value:K,scale:"auto",optional:!0},strokeWidth:{value:nt,optional:!0},opacity:{value:rt,scale:"auto",optional:!0}}}function FG(t,e){e&&t.filter(n=>qd(e[n])).append("title").call(BG,e)}function qG(t,e){e&&t.filter(([n])=>qd(e[n])).append("title").call(zG,e)}function BG(t,e){e&&t.text(n=>zo(e[n]))}function zG(t,e){e&&t.text(([n])=>zo(e[n]))}function Tt(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){r&&at(t,"aria-label",l=>r[l]),i&&at(t,"fill",l=>i[l]),s&&at(t,"fill-opacity",l=>s[l]),a&&at(t,"stroke",l=>a[l]),c&&at(t,"stroke-opacity",l=>c[l]),f&&at(t,"stroke-width",l=>f[l]),u&&at(t,"opacity",l=>u[l]),p&&eO(t,l=>p[l],e),n||FG(t,o)}function uc(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:i,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){r&&at(t,"aria-label",([l])=>r[l]),i&&at(t,"fill",([l])=>i[l]),s&&at(t,"fill-opacity",([l])=>s[l]),a&&at(t,"stroke",([l])=>a[l]),c&&at(t,"stroke-opacity",([l])=>c[l]),f&&at(t,"stroke-width",([l])=>f[l]),u&&at(t,"opacity",([l])=>u[l]),p&&eO(t,([l])=>p[l],e),n||qG(t,o)}function YG({ariaLabel:t,title:e,fill:n,fillOpacity:r,stroke:o,strokeOpacity:i,strokeWidth:s,opacity:a,href:c},{tip:f}){return[t,f?void 0:e,n,r,o,i,s,a,c].filter(u=>u!==void 0)}function nh(t,e,n){let r=rn(t,o=>e[o]);return n===void 0&&r.size>1+t.length>>1&&_n("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*nb(t,e,n,r){let{z:o}=n,{z:i}=r,s=YG(r,n),a=[...e,...s];for(let c of i?nh(t,i,o):[t]){let f,u;t:for(let p of c){for(let l of a)if(!oe(l[p])){u&&u.push(-1);continue t}if(f===void 0){u&&(yield u),f=s.map(l=>Or(l[p])),u=[p];continue}u.push(p);for(let l=0;l<s.length;++l)if(Or(s[l][p])!==f[l]){yield u,f=s.map(h=>Or(h[p])),u=[p];continue t}}u&&(yield u)}}function UG(t,e,n,r){let o,{clip:i=r.clip}=e;switch(i){case"frame":{t=ot("svg:g",r).each(function(){this.appendChild(t.node()),t.node=()=>this}),o=jG(r,n);break}case"sphere":{o=XG(r);break}}at(t,"aria-label",e.ariaLabel),at(t,"aria-description",e.ariaDescription),at(t,"aria-hidden",e.ariaHidden),at(t,"clip-path",o)}function tO(t){let e=new WeakMap;return(n,r)=>{let o=e.get(n);if(!o){let i=c4();Nt(n.ownerSVGElement).append("clipPath").attr("id",i).call(t,n,r),e.set(n,o=`url(#${i})`)}return o}}var jG=tO((t,e,n)=>{let{width:r,height:o,marginLeft:i,marginRight:s,marginTop:a,marginBottom:c}=n;t.append("rect").attr("x",i).attr("y",a).attr("width",r-s-i).attr("height",o-a-c)}),XG=tO((t,e)=>{let{projection:n}=e;if(!n)throw new Error('the "sphere" clip option requires a projection');t.append("path").attr("d",Ue(n)({type:"Sphere"}))});function wt(t,e,n,r){UG(t,e,n,r),at(t,"class",e.className),at(t,"fill",e.fill),at(t,"fill-opacity",e.fillOpacity),at(t,"stroke",e.stroke),at(t,"stroke-width",e.strokeWidth),at(t,"stroke-opacity",e.strokeOpacity),at(t,"stroke-linejoin",e.strokeLinejoin),at(t,"stroke-linecap",e.strokeLinecap),at(t,"stroke-miterlimit",e.strokeMiterlimit),at(t,"stroke-dasharray",e.strokeDasharray),at(t,"stroke-dashoffset",e.strokeDashoffset),at(t,"shape-rendering",e.shapeRendering),at(t,"filter",e.imageFilter),at(t,"paint-order",e.paintOrder);let{pointerEvents:o=r.pointerSticky===!1?"none":void 0}=e;at(t,"pointer-events",o)}function ht(t,e){WG(t,"mix-blend-mode",e.mixBlendMode),at(t,"opacity",e.opacity)}function eO(t,e,n){t.each(function(r){let o=e(r);if(o!=null){let i=this.ownerDocument.createElementNS(Nn.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(Nn.xlink,"href",o),n!=null&&i.setAttribute("target",n),this.parentNode.insertBefore(i,this).appendChild(this)}})}function at(t,e,n){n!=null&&t.attr(e,n)}function WG(t,e,n){n!=null&&t.style(e,n)}function xt(t,e,{x:n,y:r},o=le,i=le){o+=e.dx,i+=e.dy,n?.bandwidth&&(o+=n.bandwidth()/2),r?.bandwidth&&(i+=r.bandwidth()/2),(o||i)&&t.attr("transform",`translate(${o},${i})`)}function te(t,e){if((t=be(t))!==e)return t}function eh(t,e){if((t=Dt(t))!==e)return t}var VG=/^-?([_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 qs(t){if(t===void 0)return"plot-d6a7b5";if(t=`${t}`,!VG.test(t))throw new Error(`invalid class name: ${t}`);return t}function xu(t,e){if(typeof e=="string")t.property("style",e);else if(e!=null)for(let n of t)Object.assign(n.style,e)}function Qe({frameAnchor:t},{width:e,height:n,marginTop:r,marginRight:o,marginBottom:i,marginLeft:s}){return[/left$/.test(t)?s:/right$/.test(t)?e-o:(s+e-o)/2,/^top/.test(t)?r:/^bottom/.test(t)?n-i:(r+n-i)/2]}var lt=class{constructor(e,n={},r={},o){let{facet:i="auto",facetAnchor:s,fx:a,fy:c,sort:f,dx:u=0,dy:p=0,margin:l=0,marginTop:d=l,marginRight:h=l,marginBottom:m=l,marginLeft:x=l,className:g,clip:y=o?.clip,channels:b,tip:w,render:_}=r;if(this.data=e,this.sort=Oo(f)?f:null,this.initializer=Kt(r).initializer,this.transform=this.initializer?r.transform:Ce(r).transform,i===null||i===!1?this.facet=null:(this.facet=Oe(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=e===Es&&typeof a=="string"?[a]:a,this.fy=e===Es&&typeof c=="string"?[c]:c),this.facetAnchor=jR(s),n=Wd(n),b!==void 0&&(n={...GG(b),...n}),o!==void 0&&(n={...eb(this,r,o),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,A])=>{if(fr(A.value)){let{value:T,label:E=A.label,scale:N=A.scale}=A.value;A={...A,label:E,scale:N,value:T}}if(e===Es&&typeof A.value=="string"){let{value:T}=A;A={...A,value:[T]}}return[v,A]}).filter(([v,{value:A,optional:T}])=>{if(A!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+p,this.marginTop=+d,this.marginRight=+h,this.marginBottom=+m,this.marginLeft=+x,this.clip=O1(y),this.tip=HG(w),this.className=g?qs(g):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:A}=n[v];if(!(A!=="x"&&A!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=Yi(_,this.render))}initialize(e,n,r){let o=Ri(this.data);e===void 0&&o!=null&&(e=[Fn(o)]);let i=e;this.transform!=null&&({facets:e,data:o}=this.transform(o,e,r),o=Ri(o)),e!==void 0&&(e.original=i);let s=Y1(this.channels,o);return this.sort!=null&&GL(o,e,s,n,this.sort),{data:o,facets:e,channels:s}}filter(e,n,r){for(let o in n){let{filter:i=oe}=n[o];if(i!==null){let s=r[o];e=e.filter(a=>i(s[a]))}}return e}project(e,n,r){for(let o in e)if(e[o].scale==="x"&&/^x|x$/.test(o)){let i=o.replace(/^x|x$/,"y");i in e&&e[i].scale==="y"&&i4(o,i,n,r.projection)}}scale(e,n,r){let o=uu(e,n);return r.projection&&this.project(e,o,r),o}};function ke(...t){return t.plot=lt.prototype.plot,t}function Yi(t,e){if(t==null)return e===null?void 0:e;if(e==null)return t===null?void 0:t;if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);return function(n,r,o,i,s,a){return t.call(this,n,r,o,i,s,(c,f,u,p,l)=>e.call(this,c,f,u,p,l,a))}}function GG(t){return Object.fromEntries(Object.entries(Wd(t)).map(([e,n])=>(n=typeof n=="string"?{value:n,label:e}:$r(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[e,n])))}function HG(t){return t===!0?"xy":t===!1||t==null?null:typeof t=="string"?Oe(t,"tip",["x","y","xy"]):t}function Jr(t,e){return t?.tip===!0?{...t,tip:e}:Ve(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:e}}:t}function rO(t,e,n={}){let r=.5-le,o=.5+le,i=.5+le,s=.5-le;for(let{marginTop:m,marginRight:x,marginBottom:g,marginLeft:y}of e)m>r&&(r=m),x>o&&(o=x),g>i&&(i=g),y>s&&(s=y);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:f=a!==void 0?a:o,marginBottom:u=a!==void 0?a:i,marginLeft:p=a!==void 0?a:s}=n;c=+c,f=+f,u=+u,p=+p;let{width:l=640,height:d=QG(t,n,{width:l,marginTopDefault:r,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:s})+Math.max(0,c-r+u-i)}=n;l=+l,d=+d;let h={width:l,height:d,marginTop:c,marginRight:f,marginBottom:u,marginLeft:p};if(t.fx||t.fy){let{margin:m,marginTop:x=m!==void 0?m:c,marginRight:g=m!==void 0?m:f,marginBottom:y=m!==void 0?m:u,marginLeft:b=m!==void 0?m:p}=n.facet??{};x=+x,g=+g,y=+y,b=+b,h.facet={marginTop:x,marginRight:g,marginBottom:y,marginLeft:b}}return h}function QG({x:t,y:e,fy:n,fx:r},{projection:o,aspectRatio:i},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:f,marginLeftDefault:u}){let p=n&&n.scale.domain().length||1,l=HR(o);if(l){let h=r?r.scale.domain().length:1,m=(1.1*p-.1)/(1.1*h-.1)*l,x=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*x+a+f)}let d=e?qo(e)?e.scale.domain().length||1:Math.max(7,17/p):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=nO("y",e)/(nO("x",t)*i),m=r?r.scale.bandwidth():1,x=n?n.scale.bandwidth():1,g=m*(s-u-c)-t.insetLeft-t.insetRight;return(h*g+e.insetTop+e.insetBottom)/x+a+f}return!!(e||n)*Math.max(1,Math.min(60,d*p))*20+!!r*30+60}function nO(t,e){if(!e)throw new Error(`aspectRatio requires ${t} scale`);let{type:n,domain:r}=e,o;switch(n){case"linear":case"utc":case"time":o=Number;break;case"pow":{let a=e.scale.exponent();o=c=>Math.pow(c,a);break}case"log":o=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${t} scale for aspectRatio: ${n}`)}let[i,s]=Ft(r);return Math.abs(o(s)-o(i))}var oO=new WeakMap;function f4(t,e,{x:n,y:r,px:o,py:i,maxRadius:s=40,channels:a,render:c,...f}={}){return s=+s,o!=null&&(n??=null,a={...a,px:{value:o,scale:"x"}}),i!=null&&(r??=null,a={...a,py:{value:i,scale:"y"}}),{x:n,y:r,channels:a,...f,render:Yi(function(u,p,l,d,h,m){h={...h,pointerSticky:!1};let x=h.ownerSVGElement,{data:g}=h.getMarkState(this),y=oO.get(x);y||oO.set(x,y={sticky:!1,roots:[],renders:[]});let b=y.renders.push(V)-1,{x:w,y:_,fx:v,fy:A}=p,T=v?v(u.fx)-d.marginLeft:0,E=A?A(u.fy)-d.marginTop:0;w?.bandwidth&&(T+=w.bandwidth()/2),_?.bandwidth&&(E+=_.bandwidth()/2);let N=u.fi!=null,M;if(N){let j=y.facetStates;j||(y.facetStates=j=new Map),M=j.get(this),M||j.set(this,M=new Map)}let[k,O]=Qe(this,d),{px:S,py:I}=l,C=S?j=>S[j]:u4(l,k),L=I?j=>I[j]:l4(l,O),D,$,P,F;function q(j,nt){if(N)if(F&&(F=cancelAnimationFrame(F)),j==null)M.delete(u.fi);else{M.set(u.fi,nt),F=requestAnimationFrame(()=>{F=null;for(let[Y,G]of M)if(G<nt||G===nt&&Y<u.fi){j=null;break}V(j)});return}V(j)}function V(j){if(D===j&&P===y.sticky)return;D=j,P=h.pointerSticky=y.sticky;let nt=D==null?[]:[D];N&&(nt.fx=u.fx,nt.fy=u.fy,nt.fi=u.fi);let Y=m(nt,p,l,d,h);if($){if(N){let G=$.parentNode,tt=$.getAttribute("transform"),B=Y.getAttribute("transform");tt?Y.setAttribute("transform",tt):Y.removeAttribute("transform"),B?G.setAttribute("transform",B):G.removeAttribute("transform"),Y.removeAttribute("aria-label"),Y.removeAttribute("aria-description"),Y.removeAttribute("aria-hidden")}$.replaceWith(Y)}if(y.roots[b]=$=Y,!(D==null&&M?.size>1)){let G=D==null?null:Gn(g)?g[D]:g.get(D);h.dispatchValue(G)}return Y}function K(j){if(y.sticky||j.pointerType==="mouse"&&j.buttons===1)return;let[nt,Y]=hn(j);nt-=T,Y-=E;let G=nt<d.marginLeft||nt>d.width-d.marginRight?1:t,tt=Y<d.marginTop||Y>d.height-d.marginBottom?1:e,B=null,_t=s*s;for(let ct of u){let Ct=G*(C(ct)-nt),Lt=tt*(L(ct)-Y),Z=Ct*Ct+Lt*Lt;Z<=_t&&(B=ct,_t=Z)}if(B!=null&&(t!==1||e!==1)){let ct=C(B)-nt,Ct=L(B)-Y;_t=ct*ct+Ct*Ct}q(B,_t)}function et(j){j.pointerType==="mouse"&&D!=null&&(y.sticky&&y.roots.some(nt=>nt?.contains(j.target))||(y.sticky?(y.sticky=!1,y.renders.forEach(nt=>nt(null))):(y.sticky=!0,V(D)),j.stopImmediatePropagation()))}function rt(j){j.pointerType==="mouse"&&(y.sticky||q(null))}return x.addEventListener("pointerenter",K),x.addEventListener("pointermove",K),x.addEventListener("pointerdown",et),x.addEventListener("pointerleave",rt),V(null)},c)}}function Bs(t){return f4(1,1,t)}function zs(t){return f4(1,.01,t)}function Ui(t){return f4(.01,1,t)}function u4({x1:t,x2:e,x:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function l4({y1:t,y2:e,y:n=t},r){return t&&e?o=>(t[o]+e[o])/2:n?o=>n[o]:()=>r}function rb(t){return qo(t)&&t.interval===void 0?void 0:"tabular-nums"}function iO(t,e){let{label:n=t.label,tickSize:r=6,width:o=240,height:i=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:f=0,style:u,ticks:p=(o-f-a)/64,tickFormat:l,fontVariant:d=rb(t),round:h=!0,opacity:m,className:x}=e,g=Ps(e);x=qs(x),m=Ut(m)[1],l===null&&(l=()=>null);let y=ot("svg",g).attr("class",`${x}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",i).attr("viewBox",`0 0 ${o} ${i}`).call(k=>k.append("style").text(`:where(.${x}-ramp) {
|
|
8
8
|
display: block;
|
|
9
9
|
height: auto;
|
|
10
10
|
height: intrinsic;
|
|
11
11
|
max-width: 100%;
|
|
12
12
|
overflow: visible;
|
|
13
13
|
}
|
|
14
|
-
:where(.${
|
|
14
|
+
:where(.${x}-ramp text) {
|
|
15
15
|
white-space: pre;
|
|
16
|
-
}`)).call(Tf,l),b=k=>k.selectAll(".tick line").attr("y1",s+c-i),w,_=h?(k,R)=>k.rangeRound(R):(k,R)=>k.range(R),{type:v,domain:A,range:E,interpolate:T,scale:$,pivot:M}=t;if(T){let k=E===void 0?T:jr(T.length===1?qp(T):T,E);w=_($.copy(),Ze(Ht(f,o-a),Math.min(A.length+(M!==void 0),E===void 0?1/0:E.length)));let R=256,S=y.document.createElement("canvas");S.width=R,S.height=1;let I=S.getContext("2d");for(let C=0,N=R-1;C<R;++C)I.fillStyle=k(C/N),I.fillRect(C,0,1,1);x.append("image").attr("opacity",m).attr("x",f).attr("y",s).attr("width",o-f-a).attr("height",i-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(v==="threshold"){let k=A,R=p===void 0?S=>S:typeof p=="string"?sr(p):p;w=_(Wo().domain([-1,E.length-1]),[f,o-a]),x.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,I)=>w(I-1)).attr("y",s).attr("width",(S,I)=>w(I)-w(I-1)).attr("height",i-s-c).attr("fill",S=>S),u=Et(k,(S,I)=>I),p=S=>R(k[S],S)}else w=_(ji().domain(A),[f,o-a]),x.append("g").attr("fill-opacity",m).selectAll().data(A).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",i-s-c).attr("fill",$),b=()=>{};return x.append("g").attr("transform",`translate(0,${i-c})`).call(aw(w).ticks(Array.isArray(u)?null:u,typeof p=="string"?p:void 0).tickFormat(typeof p=="function"?p:void 0).tickSize(r).tickValues(Array.isArray(u)?u:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Wt(d,"normal")).call(b).call(k=>k.select(".domain").remove()),n!==void 0&&x.append("text").attr("x",f).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),x.node()}var Ef=Math.PI/180;function Ir(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:o=e}={}){t.markerStart=r3(n),t.markerMid=r3(r),t.markerEnd=r3(o)}function r3(t){if(t==null||t===!1)return null;if(t===!0)return Yk;if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return zk("auto");case"arrow-reverse":return zk("auto-start-reverse");case"dot":return MG;case"circle":case"circle-fill":return Yk;case"circle-stroke":return AG;case"tick":return o3("auto");case"tick-x":return o3(90);case"tick-y":return o3(0)}throw new Error(`invalid marker: ${t}`)}function zk(t){return(e,n)=>st("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",t).attr("fill","none").attr("stroke",e).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 MG(t,e){return st("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function Yk(t,e){return st("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function AG(t,e){return st("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",t).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function o3(t){return(e,n)=>st("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",t).attr("stroke",e).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var TG=0;function gi(t,e,{stroke:n},r){return Xk(t,e,n&&(o=>n[o]),null,r)}function Uk(t,e,{stroke:n,z:r},o){return Xk(t,e,n&&(([i])=>n[i]),r,o)}var i3=1,jk=2;function EG(t,e){let n=new Uint8Array(e.length),r=t.data().filter(i=>i.length>1),o=r.length;for(let i=0,s=ax;i<o;++i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=pr(e[c]))&&(n[c]|=i3)}}for(let i=o-1,s=ax;i>=0;--i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=pr(e[c]))&&(n[c]|=jk)}}return([i])=>n[i]}function Xk(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:o},i=()=>o,s,a){if(!e&&!n&&!r)return;let c=new Map,f=s&&EG(t,s);function l(u,p,d){return function(h){if(d&&!d(h))return;let m=i(h),g=c.get(p);g||c.set(p,g=new Map);let y=g.get(m);if(!y){let x=this.parentNode.insertBefore(p(m,a),this),b=`plot-marker-${++TG}`;x.setAttribute("id",b),g.set(m,y=`url(#${b})`)}this.setAttribute(u,y)}}e&&t.each(l("marker-start",e,f&&(u=>f(u)&i3))),n&&f&&t.each(l("marker-start",n,u=>!(f(u)&i3))),n&&t.each(l("marker-mid",n)),r&&t.each(l("marker-end",r,f&&(u=>f(u)&jk)))}function ka({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=Gk(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function Na({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=Gk(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function Gk(t,e,n){return t===void 0&&e===void 0&&n===void 0?oe?[1,0]:[.5,.5]:[e,n]}function Vk(t,{interval:e}){return t={...dr(t)},t.interval=mf(t.interval===void 0?e:t.interval),t}function ux(t,e,n,r){let{[t]:o,[`${t}1`]:i,[`${t}2`]:s}=n,{value:a,interval:c}=Vk(o,n);if(a==null||c==null&&!r)return n;let f=Ve(o);if(c==null){let d,h={transform:m=>d||(d=ut(m,a)),label:f};return{...n,[t]:void 0,[`${t}1`]:i===void 0?h:i,[`${t}2`]:s===void 0&&!(i===s&&r)?h:s}}let l,u;function p(d){return u!==void 0&&d===l?u:u=Et(ut(l=d,a),h=>c.floor(h))}return e({...n,[t]:void 0,[`${t}1`]:i===void 0?{transform:p,label:f}:i,[`${t}2`]:s===void 0?{transform:d=>p(d).map(h=>c.offset(h)),label:f}:s})}function Wk(t,e,n){let{[t]:r}=n,{value:o,interval:i}=Vk(r,n);return o==null||i==null?n:e({...n,[t]:{label:Ve(r),transform:s=>{let a=Et(ut(s,o),f=>i.floor(f)),c=a.map(f=>i.offset(f));return a.map(ne(a)?(f,l)=>f==null||isNaN(f=+f)||(l=c[l],l==null)||isNaN(l=+l)?void 0:new Date((f+l)/2):(f,l)=>f==null||(l=c[l],l==null)?NaN:(+f+ +l)/2)}}})}function s3(t={}){return ux("x",ka,t,!0)}function a3(t={}){return ux("y",Na,t,!0)}function If(t={}){return ux("x",ka,t)}function $f(t={}){return ux("y",Na,t)}function px(t={}){return Wk("x",ka,t)}function dx(t={}){return Wk("y",Na,t)}var Hk={ariaLabel:"rule",fill:null,stroke:"currentColor"},Up=class extends pt{constructor(e,n={}){let{x:r,y1:o,y2:i,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(e,{x:{value:r,scale:"x",optional:!0},y1:{value:o,scale:"y",optional:!0},y2:{value:i,scale:"y",optional:!0}},Er(n,"x"),Hk),this.insetTop=Ot(a),this.insetBottom=Ot(c),Ir(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y1:f,y2:l}=r,{width:u,height:p,marginTop:d,marginRight:h,marginLeft:m,marginBottom:g}=o,{insetTop:y,insetBottom:x}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s},oe,0).call(b=>b.selectAll().data(e).enter().append("line").call(dt,this).attr("x1",c?w=>c[w]:(m+u-h)/2).attr("x2",c?w=>c[w]:(m+u-h)/2).attr("y1",f&&!Gn(a)?w=>f[w]+y:d+y).attr("y2",l&&!Gn(a)?a.bandwidth?w=>l[w]+a.bandwidth()-x:w=>l[w]-x:p-g-x).call(Tt,this,r).call(gi,this,r,i)).node()}},jp=class extends pt{constructor(e,n={}){let{x1:r,x2:o,y:i,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(e,{y:{value:i,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:o,scale:"x",optional:!0}},Er(n,"y"),Hk),this.insetRight=Ot(a),this.insetLeft=Ot(c),Ir(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{y:c,x1:f,x2:l}=r,{width:u,height:p,marginTop:d,marginRight:h,marginLeft:m,marginBottom:g}=o,{insetLeft:y,insetRight:x}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{y:c&&a},0,oe).call(b=>b.selectAll().data(e).enter().append("line").call(dt,this).attr("x1",f&&!Gn(s)?w=>f[w]+y:m+y).attr("x2",l&&!Gn(s)?s.bandwidth?w=>l[w]+s.bandwidth()-x:w=>l[w]-x:u-h-x).attr("y1",c?w=>c[w]:(d+p-g)/2).attr("y2",c?w=>c[w]:(d+p-g)/2).call(Tt,this,r).call(gi,this,r,i)).node()}};function Vn(t,e){let{x:n=V,y:r,y1:o,y2:i,...s}=$f(e);return[o,i]=Zk(r,o,i),new Up(t,{...s,x:n,y1:o,y2:i})}function Wn(t,e){let{y:n=V,x:r,x1:o,x2:i,...s}=If(e);return[o,i]=Zk(r,o,i),new jp(t,{...s,y:n,x1:o,x2:i})}function Zk(t,e,n){if(t==null){if(e===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,e]}else{if(e===void 0)return n===void 0?[0,t]:[t,n];if(n===void 0)return[t,e]}return[e,n]}function $r(t,...e){let n=e.length;for(let r=0,o=!0;r<n;++r)typeof e[r]!="function"&&(o&&(t=t.slice(),o=!1),t.splice(r,2,t[r]+e[r]+t[r+1]),e.splice(r,1),--r,--n);return r=>{let o=t[0];for(let i=0;i<n;++i)o+=e[i](r)+t[i+1];return o}}var IG={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},eN="\xAD",Ra=class extends pt{constructor(e,n={}){let{x:r,y:o,text:i=vn(e)&&Fy(e)?V:Xt,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:f=1,lineWidth:l=1/0,textOverflow:u,monospace:p,fontFamily:d=p?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:m,fontVariant:g,fontWeight:y,rotate:x}=n,[b,w]=Ft(x,0),[_,v]=NG(h);if(super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:oC(b),optional:!0},text:{value:i,filter:Ap,optional:!0}},n,IG),this.rotate=w,this.textAnchor=Wt(a,"middle"),this.lineAnchor=Se(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+f,this.lineWidth=+l,this.textOverflow=f3(u),this.monospace=!!p,this.fontFamily=fe(d),this.fontSize=v,this.fontStyle=fe(m),this.fontVariant=fe(g),this.fontWeight=fe(y),this.frameAnchor=fo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${l}`);this.splitLines=u3(this),this.clipLine=p3(this)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,rotate:l,text:u,title:p,fontSize:d}=r,{rotate:h}=this,[m,g]=Le(this,o);return st("svg:g",i).call(xt,this,o,i).call(l3,this,u,o).call(mt,this,{x:c&&s,y:f&&a}).call(y=>y.selectAll().data(e).enter().append("text").call(dt,this).call($G,this,u,p).attr("transform",$r`translate(${c?x=>c[x]:m},${f?x=>f[x]:g})${l?x=>` rotate(${l[x]})`:h?` rotate(${h})`:""}`).call(at,"font-size",d&&(x=>d[x])).call(Tt,this,r)).node()}};function f3(t){return t==null?null:Se(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function $G(t,e,n,r){if(!n)return;let{lineAnchor:o,lineHeight:i,textOverflow:s,splitLines:a,clipLine:c}=e;t.each(function(f){let l=a(mo(n[f])??"").map(c),u=l.length,p=o==="top"?.71:o==="bottom"?1-u:(164-u*100)/200;if(u>1){let d=0;for(let h=0;h<u;++h){if(++d,!l[h])continue;let m=this.ownerDocument.createElementNS(un.svg,"tspan");m.setAttribute("x",0),h===d-1?m.setAttribute("y",`${(p+h)*i}em`):m.setAttribute("dy",`${d*i}em`),m.textContent=l[h],this.appendChild(m),d=0}}else p&&this.setAttribute("y",`${p*i}em`),this.textContent=l[0];if(s&&!r&&l[0]!==n[f]){let d=this.ownerDocument.createElementNS(un.svg,"title");d.textContent=n[f],this.appendChild(d)}})}function go(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new Ra(t,{...r,x:e,y:n})}function hx(t,{x:e=V,...n}={}){return new Ra(t,dx({...n,x:e}))}function mx(t,{y:e=V,...n}={}){return new Ra(t,px({...n,y:e}))}function l3(t,e,n){at(t,"text-anchor",e.textAnchor),at(t,"font-family",e.fontFamily),at(t,"font-size",e.fontSize),at(t,"font-style",e.fontStyle),at(t,"font-variant",e.fontVariant===void 0?CG(n):e.fontVariant),at(t,"font-weight",e.fontWeight)}function CG(t){return t&&(ci(t)||ne(t))?"tabular-nums":void 0}var kG=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function NG(t){return t==null||typeof t=="number"?[void 0,t]:typeof t!="string"?[t,void 0]:(t=t.trim().toLowerCase(),kG.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}function OG(t,e,n){let r=[],o,i=0;for(let[s,a,c]of RG(t)){if(o===void 0&&(o=s),i>o&&n(t,o,a)>e&&(r.push(t.slice(o,i)+(t[i-1]===eN?"-":"")),o=s),c){r.push(t.slice(o,a)),o=void 0;continue}i=a}return r}function*RG(t){let e=0,n=0,r=t.length;for(;n<r;){let o=1;switch(t[n]){case eN:case"-":++n,yield[e,n,!1],e=n;break;case" ":for(yield[e,n,!1];t[++n]===" ";);e=n;break;case"\r":t[n+1]===`
|
|
16
|
+
}`)).call(xu,u),b=k=>k.selectAll(".tick line").attr("y1",s+c-i),w,_=h?(k,O)=>k.rangeRound(O):(k,O)=>k.range(O),{type:v,domain:A,range:T,interpolate:E,scale:N,pivot:M}=t;if(E){let k=T===void 0?E:go(E.length===1?Kd(E):E,T);w=_(N.copy(),mn(ee(f,o-a),Math.min(A.length+(M!==void 0),T===void 0?1/0:T.length)));let O=256,S=g.document.createElement("canvas");S.width=O,S.height=1;let I=S.getContext("2d");for(let C=0,L=O-1;C<O;++C)I.fillStyle=k(C/L),I.fillRect(C,0,1,1);y.append("image").attr("opacity",m).attr("x",f).attr("y",s).attr("width",o-f-a).attr("height",i-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(v==="threshold"){let k=A,O=l===void 0?S=>S:typeof l=="string"?Ir(l):l;w=_(_i().domain([-1,T.length-1]),[f,o-a]),y.append("g").attr("fill-opacity",m).selectAll().data(T).enter().append("rect").attr("x",(S,I)=>w(I-1)).attr("y",s).attr("width",(S,I)=>w(I)-w(I-1)).attr("height",i-s-c).attr("fill",S=>S),p=Et(k,(S,I)=>I),l=S=>O(k[S],S)}else w=_(ws().domain(A),[f,o-a]),y.append("g").attr("fill-opacity",m).selectAll().data(A).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",i-s-c).attr("fill",N),b=()=>{};return y.append("g").attr("transform",`translate(0,${i-c})`).call(x_(w).ticks(Array.isArray(p)?null:p,typeof l=="string"?l:void 0).tickFormat(typeof l=="function"?l:void 0).tickSize(r).tickValues(Array.isArray(p)?p:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",te(d,"normal")).call(b).call(k=>k.select(".domain").remove()),n!==void 0&&y.append("text").attr("x",f).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),y.node()}var gu=Math.PI/180;function Kr(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:o=e}={}){t.markerStart=p4(n),t.markerMid=p4(r),t.markerEnd=p4(o)}function p4(t){if(t==null||t===!1)return null;if(t===!0)return aO;if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return sO("auto");case"arrow-reverse":return sO("auto-start-reverse");case"dot":return ZG;case"circle":case"circle-fill":return aO;case"circle-stroke":return JG;case"tick":return d4("auto");case"tick-x":return d4(90);case"tick-y":return d4(0)}throw new Error(`invalid marker: ${t}`)}function sO(t){return(e,n)=>ot("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",t).attr("fill","none").attr("stroke",e).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 ZG(t,e){return ot("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function aO(t,e){return ot("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function JG(t,e){return ot("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",t).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function d4(t){return(e,n)=>ot("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",t).attr("stroke",e).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var KG=0;function ji(t,e,{stroke:n},r){return uO(t,e,n&&(o=>n[o]),null,r)}function cO(t,e,{stroke:n,z:r},o){return uO(t,e,n&&(([i])=>n[i]),r,o)}var h4=1,fO=2;function tH(t,e){let n=new Uint8Array(e.length),r=t.data().filter(i=>i.length>1),o=r.length;for(let i=0,s=tb;i<o;++i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=Or(e[c]))&&(n[c]|=h4)}}for(let i=o-1,s=tb;i>=0;--i){let a=r[i];if(a.length>1){let c=a[0];s!==(s=Or(e[c]))&&(n[c]|=fO)}}return([i])=>n[i]}function uO(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:o},i=()=>o,s,a){if(!e&&!n&&!r)return;let c=new Map,f=s&&tH(t,s);function u(p,l,d){return function(h){if(d&&!d(h))return;let m=i(h),x=c.get(l);x||c.set(l,x=new Map);let g=x.get(m);if(!g){let y=this.parentNode.insertBefore(l(m,a),this),b=`plot-marker-${++KG}`;y.setAttribute("id",b),x.set(m,g=`url(#${b})`)}this.setAttribute(p,g)}}e&&t.each(u("marker-start",e,f&&(p=>f(p)&h4))),n&&f&&t.each(u("marker-start",n,p=>!(f(p)&h4))),n&&t.each(u("marker-mid",n)),r&&t.each(u("marker-end",r,f&&(p=>f(p)&fO)))}function lc({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=lO(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function pc({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=lO(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function lO(t,e,n){return t===void 0&&e===void 0&&n===void 0?le?[1,0]:[.5,.5]:[e,n]}function pO(t,{interval:e}){return t={...$r(t)},t.interval=iu(t.interval===void 0?e:t.interval),t}function ob(t,e,n,r){let{[t]:o,[`${t}1`]:i,[`${t}2`]:s}=n,{value:a,interval:c}=pO(o,n);if(a==null||c==null&&!r)return n;let f=un(o);if(c==null){let d,h={transform:m=>d||(d=ut(m,a)),label:f};return{...n,[t]:void 0,[`${t}1`]:i===void 0?h:i,[`${t}2`]:s===void 0&&!(i===s&&r)?h:s}}let u,p;function l(d){return p!==void 0&&d===u?p:p=Et(ut(u=d,a),h=>c.floor(h))}return e({...n,[t]:void 0,[`${t}1`]:i===void 0?{transform:l,label:f}:i,[`${t}2`]:s===void 0?{transform:d=>l(d).map(h=>c.offset(h)),label:f}:s})}function dO(t,e,n){let{[t]:r}=n,{value:o,interval:i}=pO(r,n);return o==null||i==null?n:e({...n,[t]:{label:un(r),transform:s=>{let a=Et(ut(s,o),f=>i.floor(f)),c=a.map(f=>i.offset(f));return a.map(fe(a)?(f,u)=>f==null||isNaN(f=+f)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((f+u)/2):(f,u)=>f==null||(u=c[u],u==null)?NaN:(+f+ +u)/2)}}})}function m4(t={}){return ob("x",lc,t,!0)}function x4(t={}){return ob("y",pc,t,!0)}function yu(t={}){return ob("x",lc,t)}function bu(t={}){return ob("y",pc,t)}function ib(t={}){return dO("x",lc,t)}function sb(t={}){return dO("y",pc,t)}var hO={ariaLabel:"rule",fill:null,stroke:"currentColor"},rh=class extends lt{constructor(e,n={}){let{x:r,y1:o,y2:i,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(e,{x:{value:r,scale:"x",optional:!0},y1:{value:o,scale:"y",optional:!0},y2:{value:i,scale:"y",optional:!0}},Jr(n,"x"),hO),this.insetTop=Dt(a),this.insetBottom=Dt(c),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y1:f,y2:u}=r,{width:p,height:l,marginTop:d,marginRight:h,marginLeft:m,marginBottom:x}=o,{insetTop:g,insetBottom:y}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s},le,0).call(b=>b.selectAll().data(e).enter().append("line").call(ht,this).attr("x1",c?w=>c[w]:(m+p-h)/2).attr("x2",c?w=>c[w]:(m+p-h)/2).attr("y1",f&&!lr(a)?w=>f[w]+g:d+g).attr("y2",u&&!lr(a)?a.bandwidth?w=>u[w]+a.bandwidth()-y:w=>u[w]-y:l-x-y).call(Tt,this,r).call(ji,this,r,i)).node()}},oh=class extends lt{constructor(e,n={}){let{x1:r,x2:o,y:i,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(e,{y:{value:i,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:o,scale:"x",optional:!0}},Jr(n,"y"),hO),this.insetRight=Dt(a),this.insetLeft=Dt(c),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{y:c,x1:f,x2:u}=r,{width:p,height:l,marginTop:d,marginRight:h,marginLeft:m,marginBottom:x}=o,{insetLeft:g,insetRight:y}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{y:c&&a},0,le).call(b=>b.selectAll().data(e).enter().append("line").call(ht,this).attr("x1",f&&!lr(s)?w=>f[w]+g:m+g).attr("x2",u&&!lr(s)?s.bandwidth?w=>u[w]+s.bandwidth()-y:w=>u[w]-y:p-h-y).attr("y1",c?w=>c[w]:(d+l-x)/2).attr("y2",c?w=>c[w]:(d+l-x)/2).call(Tt,this,r).call(ji,this,r,i)).node()}};function pr(t,e){let{x:n=W,y:r,y1:o,y2:i,...s}=bu(e);return[o,i]=mO(r,o,i),new rh(t,{...s,x:n,y1:o,y2:i})}function dr(t,e){let{y:n=W,x:r,x1:o,x2:i,...s}=yu(e);return[o,i]=mO(r,o,i),new oh(t,{...s,y:n,x1:o,x2:i})}function mO(t,e,n){if(t==null){if(e===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,e]}else{if(e===void 0)return n===void 0?[0,t]:[t,n];if(n===void 0)return[t,e]}return[e,n]}function to(t,...e){let n=e.length;for(let r=0,o=!0;r<n;++r)typeof e[r]!="function"&&(o&&(t=t.slice(),o=!1),t.splice(r,2,t[r]+e[r]+t[r+1]),e.splice(r,1),--r,--n);return r=>{let o=t[0];for(let i=0;i<n;++i)o+=e[i](r)+t[i+1];return o}}var eH={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},wO="\xAD",hc=class extends lt{constructor(e,n={}){let{x:r,y:o,text:i=qn(e)&&k1(e)?W:Zt,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:f=1,lineWidth:u=1/0,textOverflow:p,monospace:l,fontFamily:d=l?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:m,fontVariant:x,fontWeight:g,rotate:y}=n,[b,w]=Ut(y,0),[_,v]=iH(h);if(super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:SL(b),optional:!0},text:{value:i,filter:qd,optional:!0}},n,eH),this.rotate=w,this.textAnchor=te(a,"middle"),this.lineAnchor=Oe(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+f,this.lineWidth=+u,this.textOverflow=y4(p),this.monospace=!!l,this.fontFamily=be(d),this.fontSize=v,this.fontStyle=be(m),this.fontVariant=be(x),this.fontWeight=be(g),this.frameAnchor=Do(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=w4(this),this.clipLine=v4(this)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,rotate:u,text:p,title:l,fontSize:d}=r,{rotate:h}=this,[m,x]=Qe(this,o);return ot("svg:g",i).call(wt,this,o,i).call(b4,this,p,o).call(xt,this,{x:c&&s,y:f&&a}).call(g=>g.selectAll().data(e).enter().append("text").call(ht,this).call(nH,this,p,l).attr("transform",to`translate(${c?y=>c[y]:m},${f?y=>f[y]:x})${u?y=>` rotate(${u[y]})`:h?` rotate(${h})`:""}`).call(at,"font-size",d&&(y=>d[y])).call(Tt,this,r)).node()}};function y4(t){return t==null?null:Oe(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function nH(t,e,n,r){if(!n)return;let{lineAnchor:o,lineHeight:i,textOverflow:s,splitLines:a,clipLine:c}=e;t.each(function(f){let u=a(zo(n[f])??"").map(c),p=u.length,l=o==="top"?.71:o==="bottom"?1-p:(164-p*100)/200;if(p>1){let d=0;for(let h=0;h<p;++h){if(++d,!u[h])continue;let m=this.ownerDocument.createElementNS(Nn.svg,"tspan");m.setAttribute("x",0),h===d-1?m.setAttribute("y",`${(l+h)*i}em`):m.setAttribute("dy",`${d*i}em`),m.textContent=u[h],this.appendChild(m),d=0}}else l&&this.setAttribute("y",`${l*i}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[f]){let d=this.ownerDocument.createElementNS(Nn.svg,"title");d.textContent=n[f],this.appendChild(d)}})}function Yo(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new hc(t,{...r,x:e,y:n})}function ab(t,{x:e=W,...n}={}){return new hc(t,sb({...n,x:e}))}function cb(t,{y:e=W,...n}={}){return new hc(t,ib({...n,y:e}))}function b4(t,e,n){at(t,"text-anchor",e.textAnchor),at(t,"font-family",e.fontFamily),at(t,"font-size",e.fontSize),at(t,"font-style",e.fontStyle),at(t,"font-variant",e.fontVariant===void 0?rH(n):e.fontVariant),at(t,"font-weight",e.fontWeight)}function rH(t){return t&&(Di(t)||fe(t))?"tabular-nums":void 0}var oH=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function iH(t){return t==null||typeof t=="number"?[void 0,t]:typeof t!="string"?[t,void 0]:(t=t.trim().toLowerCase(),oH.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}function sH(t,e,n){let r=[],o,i=0;for(let[s,a,c]of aH(t)){if(o===void 0&&(o=s),i>o&&n(t,o,a)>e&&(r.push(t.slice(o,i)+(t[i-1]===wO?"-":"")),o=s),c){r.push(t.slice(o,a)),o=void 0;continue}i=a}return r}function*aH(t){let e=0,n=0,r=t.length;for(;n<r;){let o=1;switch(t[n]){case wO:case"-":++n,yield[e,n,!1],e=n;break;case" ":for(yield[e,n,!1];t[++n]===" ";);e=n;break;case"\r":t[n+1]===`
|
|
17
17
|
`&&++o;case`
|
|
18
|
-
`:yield[e,n,!0],n+=o,e=n;break;default:++n;break}}yield[e,n,!0]}var Qk={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 gx(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=Cf(t,o))r+=Qk[t[o]]??(rN(t,o)?120:Qk.e);return r}function yx(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=Cf(t,o))r+=rN(t,o)?126:63;return r}function u3({monospace:t,lineWidth:e,textOverflow:n}){if(n!=null||e==1/0)return i=>i.split(/\r\n?|\n/g);let r=t?yx:gx,o=e*100;return i=>OG(i,o,r)}function p3({monospace:t,lineWidth:e,textOverflow:n}){if(n==null||e==1/0)return i=>i;let r=t?yx:gx,o=e*100;switch(n){case"clip-start":return i=>Kk(i,o,r,"");case"clip-end":return i=>Jk(i,o,r,"");case"ellipsis-start":return i=>Kk(i,o,r,Oa);case"ellipsis-middle":return i=>LG(i,o,r,Oa);case"ellipsis-end":return i=>Jk(i,o,r,Oa)}}var Oa="\u2026";function La(t,e,n,r){let o=[],i=0;for(let s=0,a=0,c=t.length;s<c;s=a){a=Cf(t,s);let f=n(t,s,a);if(i+f>e){for(i+=r;i>e&&s>0;)a=s,s=o.pop(),i-=n(t,s,a);return[s,e-i]}i+=f,o.push(s)}return[-1,0]}function Jk(t,e,n,r){t=t.trim();let o=n(r),[i]=La(t,e,n,o);return i<0?t:t.slice(0,i).trimEnd()+r}function LG(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r)/2,[s,a]=La(t,e/2,n,i),[c]=La(t,o-e/2-a+i,n,-i);return c<0?r:t.slice(0,s).trimEnd()+r+t.slice(Cf(t,c)).trimStart()}function Kk(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r),[s]=La(t,o-e+i,n,-i);return s<0?r:r+t.slice(Cf(t,s)).trimStart()}var c3=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,tN=/\p{Extended_Pictographic}/uy;function Cf(t,e){return e+=DG(t,e)?2:1,FG(t,e)&&(e=c3.lastIndex),PG(t,e)?Cf(t,e+1):e}function nN(t,e){return t.charCodeAt(e)<128}function DG(t,e){let n=t.charCodeAt(e);if(n>=55296&&n<56320){let r=t.charCodeAt(e+1);return r>=56320&&r<57344}return!1}function PG(t,e){return t.charCodeAt(e)===8205}function FG(t,e){return nN(t,e)?!1:(c3.lastIndex=e,c3.test(t))}function rN(t,e){return nN(t,e)?!1:(tN.lastIndex=e,tN.test(t))}var oN={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},iN=3.5,qG=iN*5,sN={draw(t,e,n){let r=e*n/qG;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},aN={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},BG=new Map([["arrow",sN],["spike",aN]]);function zG(t){return t&&typeof t.draw=="function"}function YG(t){if(zG(t))return t;let e=BG.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}var Da=class extends pt{constructor(e,n={}){let{x:r,y:o,r:i=iN,length:s,rotate:a,shape:c=sN,anchor:f="middle",frameAnchor:l}=n,[u,p]=Ft(s,12),[d,h]=Ft(a,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:u,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,oN),this.r=+i,this.length=p,this.rotate=h,this.shape=YG(c),this.anchor=Se(f,"anchor",["start","middle","end"]),this.frameAnchor=fo(l)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,length:l,rotate:u}=r,{length:p,rotate:d,anchor:h,shape:m,r:g}=this,[y,x]=Le(this,o);return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(b=>b.selectAll().data(e).enter().append("path").call(dt,this).attr("transform",$r`translate(${c?w=>c[w]:y},${f?w=>f[w]:x})${u?w=>` rotate(${u[w]})`:d?` rotate(${d})`:""}${h==="start"?"":h==="end"?l?w=>` translate(0,${l[w]})`:` translate(0,${p})`:l?w=>` translate(0,${l[w]/2})`:` translate(0,${p/2})`}`).attr("d",l?w=>{let _=hn();return m.draw(_,l[w],g),_}:(()=>{let w=hn();return m.draw(w,p,g),w})()).call(Tt,this,r)).node()}};function d3(t,e={}){let{x:n,y:r,...o}=e;return e.frameAnchor===void 0&&([n,r]=ae(n,r)),new Da(t,{...o,x:n,y:r})}function xx(t,e={}){let{x:n=V,...r}=e;return new Da(t,{...r,x:n})}function bx(t,e={}){let{y:n=V,...r}=e;return new Da(t,{...r,y:n})}function cN(t,e={}){let{shape:n=aN,stroke:r=oN.stroke,strokeWidth:o=1,fill:i=r,fillOpacity:s=.3,anchor:a="start",...c}=e;return d3(t,{...c,shape:n,stroke:r,strokeWidth:o,fill:i,fillOpacity:s,anchor:a})}function ps(t,e){return arguments.length<2&&!vn(t)&&(e=t,t=null),e===void 0&&(e={}),[t,e]}function wx({anchor:t}={},e){return t===void 0?e[0]:Se(t,"anchor",e)}function fN(t){return wx(t,["left","right"])}function lN(t){return wx(t,["right","left"])}function uN(t){return wx(t,["bottom","top"])}function pN(t){return wx(t,["top","bottom"])}function Xp(){let[t,e]=ps(...arguments);return dN("y",fN(e),t,e)}function vx(){let[t,e]=ps(...arguments);return dN("fy",lN(e),t,e)}function Gp(){let[t,e]=ps(...arguments);return hN("x",uN(e),t,e)}function _x(){let[t,e]=ps(...arguments);return hN("fx",pN(e),t,e)}function dN(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:s=o,strokeWidth:a=1,fill:c=r,fillOpacity:f=o,textAnchor:l,textStroke:u,textStrokeOpacity:p,textStrokeWidth:d,tickSize:h=t==="y"?6:0,tickPadding:m,tickRotate:g,x:y,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?e==="right"?40:0:x,marginBottom:_=x===void 0?20:x,marginLeft:v=x===void 0?e==="left"?40:0:x,label:A,labelAnchor:E,labelArrow:T,labelOffset:$,...M}){return h=Ot(h),m=Ot(m),g=Ot(g),E!==void 0&&(E=Se(E,"labelAnchor",["center","top","bottom"])),T=_N(T),we(h&&!Pt(i)?UG(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:g,x:y,...M}):null,Pt(c)?null:XG(t,e,n,{fill:c,fillOpacity:f,stroke:u,strokeOpacity:p,strokeWidth:d,textAnchor:l,tickSize:h,tickPadding:m,tickRotate:g,x:y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!Pt(c)&&A!==null?go([],xN({fill:c,fillOpacity:f,...M},function(k,R,S,I,C){let N=I[t],{marginTop:D,marginRight:L,marginBottom:P,marginLeft:F}=t==="y"&&C.inset||C,q=E??(N.bandwidth?"center":"top"),W=$??(e==="right"?L:F)-3;return q==="center"?(this.textAnchor=void 0,this.lineAnchor=e==="right"?"bottom":"top",this.frameAnchor=e,this.rotate=-90):(this.textAnchor=e==="right"?"end":"start",this.lineAnchor=q,this.frameAnchor=`${q}-${e}`,this.rotate=0),this.dy=q==="top"?3-D:q==="bottom"?P-3:0,this.dx=e==="right"?W:-W,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[vN(t,N,{anchor:e,label:A,labelAnchor:q,labelArrow:T})]}}}})):null)}function hN(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:s=o,strokeWidth:a=1,fill:c=r,fillOpacity:f=o,textAnchor:l,textStroke:u,textStrokeOpacity:p,textStrokeWidth:d,tickSize:h=t==="x"?6:0,tickPadding:m,tickRotate:g,y,margin:x,marginTop:b=x===void 0?e==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:_=x===void 0?e==="bottom"?30:0:x,marginLeft:v=x===void 0?20:x,label:A,labelAnchor:E,labelArrow:T,labelOffset:$,...M}){return h=Ot(h),m=Ot(m),g=Ot(g),E!==void 0&&(E=Se(E,"labelAnchor",["center","left","right"])),T=_N(T),we(h&&!Pt(i)?jG(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:g,y,...M}):null,Pt(c)?null:GG(t,e,n,{fill:c,fillOpacity:f,stroke:u,strokeOpacity:p,strokeWidth:d,textAnchor:l,tickSize:h,tickPadding:m,tickRotate:g,y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!Pt(c)&&A!==null?go([],xN({fill:c,fillOpacity:f,...M},function(k,R,S,I,C){let N=I[t],{marginTop:D,marginRight:L,marginBottom:P,marginLeft:F}=t==="x"&&C.inset||C,q=E??(N.bandwidth?"center":"right"),W=$??(e==="top"?D:P)-3;return q==="center"?(this.frameAnchor=e,this.textAnchor=void 0):(this.frameAnchor=`${e}-${q}`,this.textAnchor=q==="right"?"end":"start"),this.lineAnchor=e,this.dy=e==="top"?-W:W,this.dx=q==="right"?L-3:q==="left"?3-F:0,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[vN(t,N,{anchor:e,label:A,labelAnchor:q,labelArrow:T})]}}}})):null)}function UG(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:s=e+(t==="y"?"-empty":""),frameAnchor:a=e,tickSize:c,inset:f=0,insetLeft:l=f,insetRight:u=f,dx:p=0,y:d=t==="y"?void 0:null,...h}){return kf(bx,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:o,strokeLinejoin:i,facetAnchor:s,frameAnchor:a,y:d,...h,dx:e==="left"?+p-oe+ +l:+p+oe-u,anchor:"start",length:c,shape:e==="left"?ZG:QG})}function jG(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:s=e+(t==="x"?"-empty":""),frameAnchor:a=e,tickSize:c,inset:f=0,insetTop:l=f,insetBottom:u=f,dy:p=0,x:d=t==="x"?void 0:null,...h}){return kf(xx,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:i,strokeLinecap:o,facetAnchor:s,frameAnchor:a,x:d,...h,dy:e==="bottom"?+p-oe-u:+p+oe+ +l,anchor:"start",length:c,shape:e==="bottom"?WG:HG})}function XG(t,e,n,{facetAnchor:r=e+(t==="y"?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:s=0,tickPadding:a=Math.max(3,9-i)+(Math.abs(s)>60?4*Math.cos(s*Ef):0),text:c,textAnchor:f=Math.abs(s)>60?"middle":e==="left"?"end":"start",lineAnchor:l=s>60?"top":s<-60?"bottom":"middle",fontVariant:u,inset:p=0,insetLeft:d=p,insetRight:h=p,dx:m=0,y:g=t==="y"?void 0:null,...y}){return kf(mx,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c,textAnchor:f,lineAnchor:l,fontVariant:u,rotate:s,y:g,...y,dx:e==="left"?+m-i-a+ +d:+m+ +i+ +a-h},function(x,b,w,_,v){u===void 0&&(this.fontVariant=wN(x)),c===void 0&&(v.text=bN(x,b,w,_,e))})}function GG(t,e,n,{facetAnchor:r=e+(t==="x"?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:s=0,tickPadding:a=Math.max(3,9-i)+(Math.abs(s)>=10?4*Math.cos(s*Ef):0),text:c,textAnchor:f=Math.abs(s)>=10?s<0^e==="bottom"?"start":"end":"middle",lineAnchor:l=Math.abs(s)>=10?"middle":e==="bottom"?"top":"bottom",fontVariant:u,inset:p=0,insetTop:d=p,insetBottom:h=p,dy:m=0,x:g=t==="x"?void 0:null,...y}){return kf(hx,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c===void 0?null:c,textAnchor:f,lineAnchor:l,fontVariant:u,rotate:s,x:g,...y,dy:e==="bottom"?+m+ +i+ +a-h:+m-i-a+ +d},function(x,b,w,_,v){u===void 0&&(this.fontVariant=wN(x)),c===void 0&&(v.text=bN(x,b,w,_,e))})}function Sx(){let[t,e]=ps(...arguments);return mN("y",fN(e),t,e)}function Mx(){let[t,e]=ps(...arguments);return mN("fy",lN(e),t,e)}function Ax(){let[t,e]=ps(...arguments);return gN("x",uN(e),t,e)}function Tx(){let[t,e]=ps(...arguments);return gN("fx",pN(e),t,e)}function mN(t,e,n,{y:r=t==="y"?void 0:null,x:o=null,x1:i=e==="left"?o:null,x2:s=e==="right"?o:null,...a}){return kf(Wn,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{y:r,x1:i,x2:s,...yN(a)})}function gN(t,e,n,{x:r=t==="x"?void 0:null,y:o=null,y1:i=e==="top"?o:null,y2:s=e==="bottom"?o:null,...a}){return kf(Vn,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{x:r,y1:i,y2:s,...yN(a)})}function yN({color:t="currentColor",opacity:e=.1,stroke:n=t,strokeOpacity:r=e,strokeWidth:o=1,...i}){return{stroke:n,strokeOpacity:r,strokeWidth:o,...i}}function xN({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:l=!1},u){return[,t]=ee(t),[,e]=Ft(e),{facet:"super",x:null,y:null,fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:l,initializer:u}}function kf(t,e,n,r,o,i){let s;function a(l,u,p,d,h,m){let g=l==null&&(e==="fx"||e==="fy"),{[e]:y}=d;if(!y)throw new Error(`missing scale: ${e}`);let x=y.domain(),{interval:b,ticks:w,tickFormat:_,tickSpacing:v=e==="x"?80:35}=o;if(typeof w=="string"&&SN(y)&&(b=w,w=void 0),w===void 0&&(w=co(b,y.type)??VG(y,v)),l==null){if(vn(w))l=Un(w);else if(es(w))l=h3(w,...Rt(x));else if(y.interval){let E=y.interval;if(y.ticks){let[T,$]=Rt(x),M=($-T)/E[uf];E=n6(E,M/w)??E,l=h3(E,T,$)}else{l=x;let T=l.length;E=n6(E,T/w)??E,E!==y.interval&&(l=h3(E,...Rt(l)))}if(E===y.interval){let T=Math.round(l.length/w);T>1&&(l=l.filter(($,M)=>M%T===0))}}else y.ticks?l=y.ticks(w):l=x;if(!y.ticks&&l.length&&l!==x){let E=new fn(x);l=l.filter(T=>E.has(T)),l.length||rn(`Warning: the ${e}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}e==="y"||e==="x"?u=[wn(l)]:s[e]={scale:e,value:V}}i?.call(this,y,l,w,_,s);let A=Object.fromEntries(Object.entries(s).map(([E,T])=>[E,{...T,value:ut(l,T.value)}]));return g&&(u=m.filterFacets(l,A)),{data:l,facets:u,channels:A}}let c=Vt(o).initializer,f=t(n,Vt({...o,initializer:a},c));return n==null?(s=f.channels,f.channels={}):s={},r!==void 0&&Object.assign(f,r),f.clip===void 0&&(f.clip=!1),f}function VG(t,e){let[n,r]=Rt(t.range());return(r-n)/e}function bN(t,e,n,r,o){return{value:Vp(t,e,n,r,o)}}function Vp(t,e,n,r,o){return typeof r=="function"&&!(t.type==="log"&&t.tickFormat)?r:r===void 0&&e&&ne(e)?Z9(t.type,e,o)??mo:t.tickFormat?t.tickFormat(typeof n=="number"?n:null,r):r===void 0?mo:typeof r=="string"?(ne(t.domain())?ro:sr)(r):re(r)}function h3(t,e,n){return t.range(e,t.offset(t.floor(n)))}var WG={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},HG={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},ZG={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},QG={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function wN(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function vN(t,e,{anchor:n,label:r=e.label,labelAnchor:o,labelArrow:i}={}){if(!(r==null||r.inferred&&SN(e)&&/^(date|time|year)$/i.test(r))){if(r=String(r),i==="auto"&&(i=(!e.bandwidth||e.interval)&&!/[↑↓→←]/.test(r)),!i)return r;if(i===!0){let s=Ky(e);s&&(i=/x$/.test(t)||o==="center"?/x$/.test(t)===s<0?"left":"right":s<0?"up":"down")}switch(i){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 _N(t="auto"){return Pt(t)?!1:typeof t=="boolean"?t:Se(t,"labelArrow",["auto","up","right","down","left"])}function SN(t){return ne(t.domain())}function MN(t,e){if(e==null)return e;let n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function AN(t,{opacity:e,...n}={}){if(!po(t)&&!Y6(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return EN(t,n,(r,o,i,s)=>r.append("svg").attr("width",i).attr("height",s).attr("fill",o.scale).attr("fill-opacity",Ft(e)[1]).append("rect").attr("width","100%").attr("height","100%"))}function TN(t,{fill:e=t.hint?.fill!==void 0?t.hint.fill:"none",fillOpacity:n=1,stroke:r=t.hint?.stroke!==void 0?t.hint.stroke:Pt(e)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:s=4.5,...a}={},c){let[f,l]=ee(e),[u,p]=ee(r),d=MN(c,f),h=MN(c,u),m=s*s*Math.PI;return n=Ft(n)[1],o=Ft(o)[1],i=Ft(i)[1],EN(t,a,(g,y,x,b)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",f==="color"?w=>d.scale(w):l).attr("fill-opacity",n).attr("stroke",u==="color"?w=>h.scale(w):p).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",w=>{let _=hn();return t.scale(w).draw(_,m),_}))}function EN(t,e={},n){let{columns:r,tickFormat:o,fontVariant:i=lx(t),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:f=0,className:l,style:u,width:p}=e,d=as(e);l=fs(l),o=Vp(t.scale,t.domain,void 0,o);let h=st("div",d).attr("class",`${l}-swatches ${l}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${l}-swatches-columns .${l}-swatch) {
|
|
18
|
+
`:yield[e,n,!0],n+=o,e=n;break;default:++n;break}}yield[e,n,!0]}var xO={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 fb(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=wu(t,o))r+=xO[t[o]]??(_O(t,o)?120:xO.e);return r}function ub(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=wu(t,o))r+=_O(t,o)?126:63;return r}function w4({monospace:t,lineWidth:e,textOverflow:n}){if(n!=null||e==1/0)return i=>i.split(/\r\n?|\n/g);let r=t?ub:fb,o=e*100;return i=>sH(i,o,r)}function v4({monospace:t,lineWidth:e,textOverflow:n}){if(n==null||e==1/0)return i=>i;let r=t?ub:fb,o=e*100;switch(n){case"clip-start":return i=>yO(i,o,r,"");case"clip-end":return i=>gO(i,o,r,"");case"ellipsis-start":return i=>yO(i,o,r,dc);case"ellipsis-middle":return i=>cH(i,o,r,dc);case"ellipsis-end":return i=>gO(i,o,r,dc)}}var dc="\u2026";function mc(t,e,n,r){let o=[],i=0;for(let s=0,a=0,c=t.length;s<c;s=a){a=wu(t,s);let f=n(t,s,a);if(i+f>e){for(i+=r;i>e&&s>0;)a=s,s=o.pop(),i-=n(t,s,a);return[s,e-i]}i+=f,o.push(s)}return[-1,0]}function gO(t,e,n,r){t=t.trim();let o=n(r),[i]=mc(t,e,n,o);return i<0?t:t.slice(0,i).trimEnd()+r}function cH(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r)/2,[s,a]=mc(t,e/2,n,i),[c]=mc(t,o-e/2-a+i,n,-i);return c<0?r:t.slice(0,s).trimEnd()+r+t.slice(wu(t,c)).trimStart()}function yO(t,e,n,r){t=t.trim();let o=n(t);if(o<=e)return t;let i=n(r),[s]=mc(t,o-e+i,n,-i);return s<0?r:r+t.slice(wu(t,s)).trimStart()}var g4=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,bO=/\p{Extended_Pictographic}/uy;function wu(t,e){return e+=fH(t,e)?2:1,lH(t,e)&&(e=g4.lastIndex),uH(t,e)?wu(t,e+1):e}function vO(t,e){return t.charCodeAt(e)<128}function fH(t,e){let n=t.charCodeAt(e);if(n>=55296&&n<56320){let r=t.charCodeAt(e+1);return r>=56320&&r<57344}return!1}function uH(t,e){return t.charCodeAt(e)===8205}function lH(t,e){return vO(t,e)?!1:(g4.lastIndex=e,g4.test(t))}function _O(t,e){return vO(t,e)?!1:(bO.lastIndex=e,bO.test(t))}var SO={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},MO=3.5,pH=MO*5,AO={draw(t,e,n){let r=e*n/pH;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},TO={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},dH=new Map([["arrow",AO],["spike",TO]]);function hH(t){return t&&typeof t.draw=="function"}function mH(t){if(hH(t))return t;let e=dH.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}var xc=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i=MO,length:s,rotate:a,shape:c=AO,anchor:f="middle",frameAnchor:u}=n,[p,l]=Ut(s,12),[d,h]=Ut(a,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:p,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,SO),this.r=+i,this.length=l,this.rotate=h,this.shape=mH(c),this.anchor=Oe(f,"anchor",["start","middle","end"]),this.frameAnchor=Do(u)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,length:u,rotate:p}=r,{length:l,rotate:d,anchor:h,shape:m,r:x}=this,[g,y]=Qe(this,o);return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(b=>b.selectAll().data(e).enter().append("path").call(ht,this).attr("transform",to`translate(${c?w=>c[w]:g},${f?w=>f[w]:y})${p?w=>` rotate(${p[w]})`:d?` rotate(${d})`:""}${h==="start"?"":h==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${l})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${l/2})`}`).attr("d",u?w=>{let _=Ln();return m.draw(_,u[w],x),_}:(()=>{let w=Ln();return m.draw(w,l,x),w})()).call(Tt,this,r)).node()}};function _4(t,e={}){let{x:n,y:r,...o}=e;return e.frameAnchor===void 0&&([n,r]=me(n,r)),new xc(t,{...o,x:n,y:r})}function lb(t,e={}){let{x:n=W,...r}=e;return new xc(t,{...r,x:n})}function pb(t,e={}){let{y:n=W,...r}=e;return new xc(t,{...r,y:n})}function EO(t,e={}){let{shape:n=TO,stroke:r=SO.stroke,strokeWidth:o=1,fill:i=r,fillOpacity:s=.3,anchor:a="start",...c}=e;return _4(t,{...c,shape:n,stroke:r,strokeWidth:o,fill:i,fillOpacity:s,anchor:a})}function Ys(t,e){return arguments.length<2&&!qn(t)&&(e=t,t=null),e===void 0&&(e={}),[t,e]}function db({anchor:t}={},e){return t===void 0?e[0]:Oe(t,"anchor",e)}function IO(t){return db(t,["left","right"])}function NO(t){return db(t,["right","left"])}function CO(t){return db(t,["bottom","top"])}function kO(t){return db(t,["top","bottom"])}function ih(){let[t,e]=Ys(...arguments);return LO("y",IO(e),t,e)}function hb(){let[t,e]=Ys(...arguments);return LO("fy",NO(e),t,e)}function sh(){let[t,e]=Ys(...arguments);return RO("x",CO(e),t,e)}function mb(){let[t,e]=Ys(...arguments);return RO("fx",kO(e),t,e)}function LO(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:s=o,strokeWidth:a=1,fill:c=r,fillOpacity:f=o,textAnchor:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:d,tickSize:h=t==="y"?6:0,tickPadding:m,tickRotate:x,x:g,margin:y,marginTop:b=y===void 0?20:y,marginRight:w=y===void 0?e==="right"?40:0:y,marginBottom:_=y===void 0?20:y,marginLeft:v=y===void 0?e==="left"?40:0:y,label:A,labelAnchor:T,labelArrow:E,labelOffset:N,...M}){return h=Dt(h),m=Dt(m),x=Dt(x),T!==void 0&&(T=Oe(T,"labelAnchor",["center","top","bottom"])),E=zO(E),ke(h&&!zt(i)?xH(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:x,x:g,...M}):null,zt(c)?null:yH(t,e,n,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:d,textAnchor:u,tickSize:h,tickPadding:m,tickRotate:x,x:g,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!zt(c)&&A!==null?Yo([],PO({fill:c,fillOpacity:f,...M},function(k,O,S,I,C){let L=I[t],{marginTop:D,marginRight:$,marginBottom:P,marginLeft:F}=t==="y"&&C.inset||C,q=T??(L.bandwidth?"center":"top"),V=N??(e==="right"?$:F)-3;return q==="center"?(this.textAnchor=void 0,this.lineAnchor=e==="right"?"bottom":"top",this.frameAnchor=e,this.rotate=-90):(this.textAnchor=e==="right"?"end":"start",this.lineAnchor=q,this.frameAnchor=`${q}-${e}`,this.rotate=0),this.dy=q==="top"?3-D:q==="bottom"?P-3:0,this.dx=e==="right"?V:-V,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[BO(t,L,{anchor:e,label:A,labelAnchor:q,labelArrow:E})]}}}})):null)}function RO(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:s=o,strokeWidth:a=1,fill:c=r,fillOpacity:f=o,textAnchor:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:d,tickSize:h=t==="x"?6:0,tickPadding:m,tickRotate:x,y:g,margin:y,marginTop:b=y===void 0?e==="top"?30:0:y,marginRight:w=y===void 0?20:y,marginBottom:_=y===void 0?e==="bottom"?30:0:y,marginLeft:v=y===void 0?20:y,label:A,labelAnchor:T,labelArrow:E,labelOffset:N,...M}){return h=Dt(h),m=Dt(m),x=Dt(x),T!==void 0&&(T=Oe(T,"labelAnchor",["center","left","right"])),E=zO(E),ke(h&&!zt(i)?gH(t,e,n,{stroke:i,strokeOpacity:s,strokeWidth:a,tickSize:h,tickPadding:m,tickRotate:x,y:g,...M}):null,zt(c)?null:bH(t,e,n,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:d,textAnchor:u,tickSize:h,tickPadding:m,tickRotate:x,y:g,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...M}),!zt(c)&&A!==null?Yo([],PO({fill:c,fillOpacity:f,...M},function(k,O,S,I,C){let L=I[t],{marginTop:D,marginRight:$,marginBottom:P,marginLeft:F}=t==="x"&&C.inset||C,q=T??(L.bandwidth?"center":"right"),V=N??(e==="top"?D:P)-3;return q==="center"?(this.frameAnchor=e,this.textAnchor=void 0):(this.frameAnchor=`${e}-${q}`,this.textAnchor=q==="right"?"end":"start"),this.lineAnchor=e,this.dy=e==="top"?-V:V,this.dx=q==="right"?$-3:q==="left"?3-F:0,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[BO(t,L,{anchor:e,label:A,labelAnchor:q,labelArrow:E})]}}}})):null)}function xH(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:s=e+(t==="y"?"-empty":""),frameAnchor:a=e,tickSize:c,inset:f=0,insetLeft:u=f,insetRight:p=f,dx:l=0,y:d=t==="y"?void 0:null,...h}){return vu(pb,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:o,strokeLinejoin:i,facetAnchor:s,frameAnchor:a,y:d,...h,dx:e==="left"?+l-le+ +u:+l+le-p,anchor:"start",length:c,shape:e==="left"?SH:MH})}function gH(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:s=e+(t==="x"?"-empty":""),frameAnchor:a=e,tickSize:c,inset:f=0,insetTop:u=f,insetBottom:p=f,dy:l=0,x:d=t==="x"?void 0:null,...h}){return vu(lb,t,n,{ariaLabel:`${t}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:i,strokeLinecap:o,facetAnchor:s,frameAnchor:a,x:d,...h,dy:e==="bottom"?+l-le-p:+l+le+ +u,anchor:"start",length:c,shape:e==="bottom"?vH:_H})}function yH(t,e,n,{facetAnchor:r=e+(t==="y"?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:s=0,tickPadding:a=Math.max(3,9-i)+(Math.abs(s)>60?4*Math.cos(s*gu):0),text:c,textAnchor:f=Math.abs(s)>60?"middle":e==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:p,inset:l=0,insetLeft:d=l,insetRight:h=l,dx:m=0,y:x=t==="y"?void 0:null,...g}){return vu(cb,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:s,y:x,...g,dx:e==="left"?+m-i-a+ +d:+m+ +i+ +a-h},function(y,b,w,_,v){p===void 0&&(this.fontVariant=qO(y)),c===void 0&&(v.text=FO(y,b,w,_,e))})}function bH(t,e,n,{facetAnchor:r=e+(t==="x"?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:s=0,tickPadding:a=Math.max(3,9-i)+(Math.abs(s)>=10?4*Math.cos(s*gu):0),text:c,textAnchor:f=Math.abs(s)>=10?s<0^e==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":e==="bottom"?"top":"bottom",fontVariant:p,inset:l=0,insetTop:d=l,insetBottom:h=l,dy:m=0,x=t==="x"?void 0:null,...g}){return vu(ab,t,n,{ariaLabel:`${t}-axis tick label`},{facetAnchor:r,frameAnchor:o,text:c===void 0?null:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:s,x,...g,dy:e==="bottom"?+m+ +i+ +a-h:+m-i-a+ +d},function(y,b,w,_,v){p===void 0&&(this.fontVariant=qO(y)),c===void 0&&(v.text=FO(y,b,w,_,e))})}function xb(){let[t,e]=Ys(...arguments);return OO("y",IO(e),t,e)}function gb(){let[t,e]=Ys(...arguments);return OO("fy",NO(e),t,e)}function yb(){let[t,e]=Ys(...arguments);return $O("x",CO(e),t,e)}function bb(){let[t,e]=Ys(...arguments);return $O("fx",kO(e),t,e)}function OO(t,e,n,{y:r=t==="y"?void 0:null,x:o=null,x1:i=e==="left"?o:null,x2:s=e==="right"?o:null,...a}){return vu(dr,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{y:r,x1:i,x2:s,...DO(a)})}function $O(t,e,n,{x:r=t==="x"?void 0:null,y:o=null,y1:i=e==="top"?o:null,y2:s=e==="bottom"?o:null,...a}){return vu(pr,t,n,{ariaLabel:`${t}-grid`,ariaHidden:!0},{x:r,y1:i,y2:s,...DO(a)})}function DO({color:t="currentColor",opacity:e=.1,stroke:n=t,strokeOpacity:r=e,strokeWidth:o=1,...i}){return{stroke:n,strokeOpacity:r,strokeWidth:o,...i}}function PO({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:u=!1},p){return[,t]=ce(t),[,e]=Ut(e),{facet:"super",x:null,y:null,fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:f,clip:u,initializer:p}}function vu(t,e,n,r,o,i){let s;function a(u,p,l,d,h,m){let x=u==null&&(e==="fx"||e==="fy"),{[e]:g}=d;if(!g)throw new Error(`missing scale: ${e}`);let y=g.domain(),{interval:b,ticks:w,tickFormat:_,tickSpacing:v=e==="x"?80:35}=o;if(typeof w=="string"&&YO(g)&&(b=w,w=void 0),w===void 0&&(w=$o(b,g.type)??wH(g,v)),u==null){if(qn(w))u=cr(w);else if(ks(w))u=S4(w,...Ft(y));else if(g.interval){let T=g.interval;if(g.ticks){let[E,N]=Ft(y),M=(N-E)/T[eu];T=lS(T,M/w)??T,u=S4(T,E,N)}else{u=y;let E=u.length;T=lS(T,E/w)??T,T!==g.interval&&(u=S4(T,...Ft(u)))}if(T===g.interval){let E=Math.round(u.length/w);E>1&&(u=u.filter((N,M)=>M%E===0))}}else g.ticks?u=g.ticks(w):u=y;if(!g.ticks&&u.length&&u!==y){let T=new En(y);u=u.filter(E=>T.has(E)),u.length||_n(`Warning: the ${e}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}e==="y"||e==="x"?p=[Fn(u)]:s[e]={scale:e,value:W}}i?.call(this,g,u,w,_,s);let A=Object.fromEntries(Object.entries(s).map(([T,E])=>[T,{...E,value:ut(u,E.value)}]));return x&&(p=m.filterFacets(u,A)),{data:u,facets:p,channels:A}}let c=Kt(o).initializer,f=t(n,Kt({...o,initializer:a},c));return n==null?(s=f.channels,f.channels={}):s={},r!==void 0&&Object.assign(f,r),f.clip===void 0&&(f.clip=!1),f}function wH(t,e){let[n,r]=Ft(t.range());return(r-n)/e}function FO(t,e,n,r,o){return{value:ah(t,e,n,r,o)}}function ah(t,e,n,r,o){return typeof r=="function"&&!(t.type==="log"&&t.tickFormat)?r:r===void 0&&e&&fe(e)?mL(t.type,e,o)??zo:t.tickFormat?t.tickFormat(typeof n=="number"?n:null,r):r===void 0?zo:typeof r=="string"?(fe(t.domain())?Co:Ir)(r):ue(r)}function S4(t,e,n){return t.range(e,t.offset(t.floor(n)))}var vH={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},_H={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},SH={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},MH={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function qO(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function BO(t,e,{anchor:n,label:r=e.label,labelAnchor:o,labelArrow:i}={}){if(!(r==null||r.inferred&&YO(e)&&/^(date|time|year)$/i.test(r))){if(r=String(r),i==="auto"&&(i=(!e.bandwidth||e.interval)&&!/[↑↓→←]/.test(r)),!i)return r;if(i===!0){let s=W1(e);s&&(i=/x$/.test(t)||o==="center"?/x$/.test(t)===s<0?"left":"right":s<0?"up":"down")}switch(i){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 zO(t="auto"){return zt(t)?!1:typeof t=="boolean"?t:Oe(t,"labelArrow",["auto","up","right","down","left"])}function YO(t){return fe(t.domain())}function UO(t,e){if(e==null)return e;let n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function jO(t,{opacity:e,...n}={}){if(!qo(t)&&!ZS(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return WO(t,n,(r,o,i,s)=>r.append("svg").attr("width",i).attr("height",s).attr("fill",o.scale).attr("fill-opacity",Ut(e)[1]).append("rect").attr("width","100%").attr("height","100%"))}function XO(t,{fill:e=t.hint?.fill!==void 0?t.hint.fill:"none",fillOpacity:n=1,stroke:r=t.hint?.stroke!==void 0?t.hint.stroke:zt(e)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:s=4.5,...a}={},c){let[f,u]=ce(e),[p,l]=ce(r),d=UO(c,f),h=UO(c,p),m=s*s*Math.PI;return n=Ut(n)[1],o=Ut(o)[1],i=Ut(i)[1],WO(t,a,(x,g,y,b)=>x.append("svg").attr("viewBox","-8 -8 16 16").attr("width",y).attr("height",b).attr("fill",f==="color"?w=>d.scale(w):u).attr("fill-opacity",n).attr("stroke",p==="color"?w=>h.scale(w):l).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",w=>{let _=Ln();return t.scale(w).draw(_,m),_}))}function WO(t,e={},n){let{columns:r,tickFormat:o,fontVariant:i=rb(t),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:f=0,className:u,style:p,width:l}=e,d=Ps(e);u=qs(u),o=ah(t.scale,t.domain,void 0,o);let h=ot("div",d).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
|
|
19
19
|
display: flex;
|
|
20
20
|
align-items: center;
|
|
21
21
|
break-inside: avoid;
|
|
22
22
|
padding-bottom: 1px;
|
|
23
23
|
}
|
|
24
|
-
:where(.${
|
|
24
|
+
:where(.${u}-swatches-columns .${u}-swatch::before) {
|
|
25
25
|
flex-shrink: 0;
|
|
26
26
|
}
|
|
27
|
-
:where(.${
|
|
27
|
+
:where(.${u}-swatches-columns .${u}-swatch-label) {
|
|
28
28
|
white-space: nowrap;
|
|
29
29
|
overflow: hidden;
|
|
30
30
|
text-overflow: ellipsis;
|
|
31
|
-
}`,h.style("columns",r).selectAll().data(t.domain).enter().append("div").attr("class",`${
|
|
31
|
+
}`,h.style("columns",r).selectAll().data(t.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,t,a,c).call(x=>x.append("div").attr("class",`${u}-swatch-label`).attr("title",o).text(o))):(m=`:where(.${u}-swatches-wrap) {
|
|
32
32
|
display: flex;
|
|
33
33
|
align-items: center;
|
|
34
34
|
min-height: 33px;
|
|
35
35
|
flex-wrap: wrap;
|
|
36
36
|
}
|
|
37
|
-
:where(.${
|
|
37
|
+
:where(.${u}-swatches-wrap .${u}-swatch) {
|
|
38
38
|
display: inline-flex;
|
|
39
39
|
align-items: center;
|
|
40
40
|
margin-right: 1em;
|
|
41
|
-
}`,h.selectAll().data(t.domain).enter().append("span").attr("class",`${
|
|
41
|
+
}`,h.selectAll().data(t.domain).enter().append("span").attr("class",`${u}-swatch`).call(n,t,a,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),h.call(x=>x.insert("style","*").text(`:where(.${u}-swatches) {
|
|
42
42
|
font-family: system-ui, sans-serif;
|
|
43
43
|
font-size: 10px;
|
|
44
44
|
margin-bottom: 0.5em;
|
|
45
45
|
}
|
|
46
|
-
:where(.${
|
|
46
|
+
:where(.${u}-swatch > svg) {
|
|
47
47
|
margin-right: 0.5em;
|
|
48
48
|
overflow: visible;
|
|
49
49
|
}
|
|
50
|
-
${m}`)).style("margin-left",f?`${+f}px`:null).style("width",p===void 0?null:`${+p}px`).style("font-variant",Wt(i,"normal")).call(Tf,u).node()}var Ex=new Map([["symbol",TN],["color",CN],["opacity",JG]]);function IN(t={}){for(let[e,n]of Ex){let r=t[e];if(so(r)){let o=as(t),i;if(e==="symbol"){let{fill:s,stroke:a=s===void 0&&so(t.color)?"color":void 0}=t;i={fill:s,stroke:a}}return n(ex(e,r,i),m3(o,r,t),s=>so(t[s])?ex(s,t[s]):null)}}throw new Error("unknown legend type; no scale found")}function $N(t,e,n={}){return(r,o)=>{if(!Ex.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return Ex.get(r)(t[r],m3(e,n[r],o),i=>t[i])}}function m3({className:t,...e},{label:n,ticks:r,tickFormat:o}={},i){return lC(i,{className:t,...e},{label:n,ticks:r,tickFormat:o})}function CN(t,{legend:e=!0,...n}){if(e===!0&&(e=t.type==="ordinal"?"swatches":"ramp"),t.domain!==void 0)switch(`${e}`.toLowerCase()){case"swatches":return AN(t,n);case"ramp":return Bk(t,n);default:throw new Error(`unknown legend type: ${e}`)}}function JG({type:t,interpolate:e,...n},{legend:r=!0,color:o=ve(0,0,0),...i}){if(!e)throw new Error(`${t} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return CN({type:t,...n,interpolate:KG(o)},{legend:r,...i})}function KG(t){let{r:e,g:n,b:r}=ve(t)||ve(0,0,0);return o=>`rgba(${e},${n},${r},${o})`}function kN(t,e,n){let r=[];for(let[o,i]of Ex){let s=n[o];if(s?.legend&&o in t){let a=i(t[o],m3(e,t[o],s),c=>t[c]);a!=null&&r.push(a)}}return r}function ds(t={}){return u6(t)?t:{...t,x:V}}function hs(t={}){return p6(t)?t:{...t,y:V}}function Ix(t,e){if(e.length===1)return{data:t,facets:e};let n=ts(t),r=new Uint8Array(n),o=0;for(let a of e)for(let c of a)r[c]&&++o,r[c]=1;if(o===0)return{data:t,facets:e};t=Ki(t);let i=t[o6]=new Uint32Array(n+o);e=e.map(a=>Ki(a,Uint32Array));let s=n;r.fill(0);for(let a of e)for(let c=0,f=a.length;c<f;++c){let l=a[c];r[l]?(a[c]=s,t[s]=t[l],i[s]=l,++s):i[l]=l,r[l]=1}return{data:t,facets:e}}function g3(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{y1:n,y:r=n,x:o,...i}=e,[s,a,c,f]=Of(r,o,"y","x",t,i);return{...s,y1:n,y:a,x1:c,x2:f,x:hf(c,f)}}function RN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{y1:n,y:r=n,x:o}=e,[i,s,a]=Of(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function LN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{y1:n,y:r=n,x:o}=e,[i,s,,a]=Of(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function y3(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{x1:n,x:r=n,y:o,...i}=e,[s,a,c,f]=Of(r,o,"x","y",t,i);return{...s,x1:n,x:a,y1:c,y2:f,y:hf(c,f)}}function DN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{x1:n,x:r=n,y:o}=e,[i,s,a]=Of(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function PN(t={},e={}){arguments.length===1&&([t,e]=Nf(t));let{x1:n,x:r=n,y:o}=e,[i,s,,a]=Of(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function ms({x:t,x1:e,x2:n,...r}={}){return r=Er(r,"y"),e===void 0&&n===void 0?g3({x:t,...r}):([e,n]=d6(t,e,n),{...r,x1:e,x2:n})}function gs({y:t,y1:e,y2:n,...r}={}){return r=Er(r,"x"),e===void 0&&n===void 0?y3({y:t,...r}):([e,n]=d6(t,e,n),{...r,y1:e,y2:n})}function Nf(t){let{offset:e,order:n,reverse:r,...o}=t;return[{offset:e,order:n,reverse:r},o]}var tV={length:!0};function Of(t,e=Cp,n,r,{offset:o,order:i,reverse:s},a){if(e===null)throw new Error(`stack requires ${r}`);let c=nn(a),[f,l]=Ge(t),[u,p]=Oe(e),[d,h]=Oe(e);return u.hint=d.hint=tV,o=eV(o),i=oV(i,o,r),[be(a,(m,g,y)=>{({data:m,facets:g}=Ix(m,g));let x=t==null?void 0:l(Ta(ut(m,t),y?.[n])),b=ut(m,e,Float64Array),w=ut(m,c),_=i&&i(m,x,b,w),v=ts(m),A=p(new Float64Array(v)),E=h(new Float64Array(v)),T=[];for(let $ of g){let M=x?Array.from(ze($,k=>x[k]).values()):[$];if(_)for(let k of M)k.sort(_);for(let k of M){let R=0,S=0;s&&k.reverse();for(let I of k){let C=b[I];C<0?R=E[I]=(A[I]=R)+C:C>0?S=E[I]=(A[I]=S)+C:E[I]=A[I]=S}}T.push(M)}return o&&o(T,A,E,w),{data:m,facets:g}}),f,u,d]}function eV(t){if(t!=null){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return nV;case"center":case"silhouette":return rV;case"wiggle":return qN}throw new Error(`unknown offset: ${t}`)}}function FN(t,e){let n=0,r=0;for(let o of t){let i=e[o];i<n&&(n=i),i>r&&(r=i)}return[n,r]}function nV(t,e,n){for(let r of t)for(let o of r){let[i,s]=FN(o,n);for(let a of o){let c=1/(s-i||1);e[a]=c*(e[a]-i),n[a]=c*(n[a]-i)}}}function rV(t,e,n){for(let r of t){for(let o of r){let[i,s]=FN(o,n);for(let a of o){let c=(s+i)/2;e[a]-=c,n[a]-=c}}BN(r,e,n)}zN(t,e,n)}function qN(t,e,n,r){for(let o of t){let i=new cn,s=0;for(let a of o){let c=-1,f=a.map(d=>Math.abs(n[d]-e[d])),l=a.map(d=>{c=r?r[d]:++c;let h=n[d]-e[d],m=i.has(c)?h-i.get(c):0;return i.set(c,h),m}),u=[0,...Mm(l)];for(let d of a)e[d]+=s,n[d]+=s;let p=Ue(f);p&&(s-=Ue(f,(d,h)=>(l[h]/2+u[h])*d)/p)}BN(o,e,n)}zN(t,e,n)}function BN(t,e,n){let r=Bt(t,o=>Bt(o,i=>e[i]));for(let o of t)for(let i of o)e[i]-=r,n[i]-=r}function zN(t,e,n){let r=t.length;if(r===1)return;let o=t.map(a=>a.flat()),i=o.map(a=>(Bt(a,c=>e[c])+Ct(a,c=>n[c]))/2),s=Bt(i);for(let a=0;a<r;a++){let c=s-i[a];for(let f of o[a])e[f]+=c,n[f]+=c}}function oV(t,e,n){if(t===void 0&&e===qN)return NN(ke);if(t!=null){if(typeof t=="string"){let r=t.startsWith("-"),o=r?_a:ke;switch((r?t.slice(1):t).toLowerCase()){case"value":case n:return iV(o);case"z":return sV(o);case"sum":return aV(o);case"appearance":return cV(o);case"inside-out":return NN(o)}return ON(s6(t))}if(typeof t=="function")return(t.length===1?ON:fV)(t);if(Cn(t))return lV(t);throw new Error(`invalid order: ${t}`)}}function iV(t){return(e,n,r)=>(o,i)=>t(r[o],r[i])}function sV(t){return(e,n,r,o)=>(i,s)=>t(o[i],o[s])}function aV(t){return $x(t,(e,n,r,o)=>gc(wn(e),i=>Ue(i,s=>r[s]),i=>o[i]))}function cV(t){return $x(t,(e,n,r,o)=>gc(wn(e),i=>n[Ws(i,s=>r[s])],i=>o[i]))}function NN(t){return $x(t,(e,n,r,o)=>{let i=wn(e),s=gc(i,u=>n[Ws(u,p=>r[p])],u=>o[u]),a=vr(i,u=>Ue(u,p=>r[p]),u=>o[u]),c=[],f=[],l=0;for(let u of s)l<0?(l+=a.get(u),c.push(u)):(l-=a.get(u),f.push(u));return f.reverse().concat(c)})}function ON(t){return e=>{let n=ut(e,t);return(r,o)=>ke(n[r],n[o])}}function fV(t){return e=>Cn(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r))}function lV(t){return $x(ke,()=>t)}function $x(t,e){return(n,r,o,i)=>{if(!i)throw new Error("missing channel: z");let s=new cn(e(n,r,o,i).map((a,c)=>[a,c]));return(a,c)=>t(s.get(i[a]),s.get(i[c]))}}var uV={ariaLabel:"rect"},Pa=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s}=n;super(e,{x1:{value:r,scale:"x",type:r!=null&&i==null?"band":void 0,optional:!0},y1:{value:o,scale:"y",type:o!=null&&s==null?"band":void 0,optional:!0},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,uV),Wp(this,n),Hp(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x1:c,y1:f,x2:l,y2:u}=r,{marginTop:p,marginRight:d,marginBottom:h,marginLeft:m,width:g,height:y}=o,{projection:x}=i,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v}=this,{rx:A,ry:E,rx1y1:T,rx1y2:$,rx2y1:M,rx2y2:k}=this;(c||l)&&!x&&Gn(s)&&(c=l=null),(f||u)&&!x&&Gn(a)&&(f=u=null);let R=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{},0,0).call(I=>I.selectAll().data(e).enter().call(T||$||M||k?C=>C.append("path").call(dt,this).call(Zp,c&&l?N=>c[N]+(l[N]<c[N]?-w:v):c?N=>c[N]+v:m+v,f&&u?N=>f[N]+(u[N]<f[N]?-_:b):f?N=>f[N]+b:p+b,c&&l?N=>l[N]-(l[N]<c[N]?-v:w):c?N=>c[N]+R-w:g-d-w,f&&u?N=>u[N]-(u[N]<f[N]?-b:_):f?N=>f[N]+S-_:y-h-_,this).call(Tt,this,r):C=>C.append("rect").call(dt,this).attr("x",c?l?N=>Math.min(c[N],l[N])+v:N=>c[N]+v:m+v).attr("y",f?u?N=>Math.min(f[N],u[N])+b:N=>f[N]+b:p+b).attr("width",c?l?N=>Math.max(0,Math.abs(l[N]-c[N])+R-v-w):R-v-w:g-d-m-w-v).attr("height",f?u?N=>Math.max(0,Math.abs(f[N]-u[N])+S-b-_):S-b-_:y-p-h-b-_).call(at,"rx",A).call(at,"ry",E).call(Tt,this,r))).node()}};function Wp(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={}){t.insetTop=Ot(n),t.insetRight=Ot(r),t.insetBottom=Ot(o),t.insetLeft=Ot(i)}function Hp(t,{r:e,rx:n,ry:r,rx1:o=e,ry1:i=e,rx2:s=e,ry2:a=e,rx1y1:c=o!==void 0?+o:i!==void 0?+i:0,rx1y2:f=o!==void 0?+o:a!==void 0?+a:0,rx2y1:l=s!==void 0?+s:i!==void 0?+i:0,rx2y2:u=s!==void 0?+s:a!==void 0?+a:0}={}){c||f||l||u?(t.rx1y1=c,t.rx1y2=f,t.rx2y1=l,t.rx2y2=u):(t.rx=Wt(n,"auto"),t.ry=Wt(r,"auto"))}function Zp(t,e,n,r,o,i){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:f}=i;typeof e!="function"&&(e=re(e)),typeof n!="function"&&(n=re(n)),typeof r!="function"&&(r=re(r)),typeof o!="function"&&(o=re(o));let l=Math.max(Math.abs(s+c),Math.abs(a+f)),u=Math.max(Math.abs(s+a),Math.abs(c+f));t.attr("d",p=>{let d=e(p),h=n(p),m=r(p),g=o(p),y=d>m,x=h>g,b=y?m:d,w=y?d:m,_=x?g:h,v=x?h:g,A=Math.min(1,(w-b)/l,(v-_)/u),E=A*(y?x?f:c:x?a:s),T=A*(y?x?a:s:x?f:c),$=A*(y?x?s:a:x?c:f),M=A*(y?x?c:f:x?s:a);return`M${b},${_+kx(E,M)}A${E},${E} 0 0 ${E<0?0:1} ${b+Cx(E,M)},${_}H${w-Cx(T,$)}A${T},${T} 0 0 ${T<0?0:1} ${w},${_+kx(T,$)}V${v-kx($,T)}A${$},${$} 0 0 ${$<0?0:1} ${w-Cx($,T)},${v}H${b+Cx(M,E)}A${M},${M} 0 0 ${M<0?0:1} ${b},${v-kx(M,E)}Z`})}function Cx(t,e){return e<0?t:Math.abs(t)}function kx(t,e){return e<0?Math.abs(t):t}function Qp(t,e){return new Pa(t,s3(a3(e)))}function Rf(t,e={}){return si(e)||(e={...e,y:Xt,x2:V,interval:1}),new Pa(t,ms(a3(ds(e))))}function Lf(t,e={}){return si(e)||(e={...e,x:Xt,y2:V,interval:1}),new Pa(t,gs(s3(hs(e))))}var pV={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},dV={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Jp=class extends pt{constructor(e={}){let{anchor:n=null}=e;super(Qi,void 0,e,n==null?pV:dV),this.anchor=l6(n,"anchor",["top","right","bottom","left"]),Wp(this,e),n||Hp(this,e)}render(e,n,r,o,i){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:f,width:l,height:u}=o,{anchor:p,insetTop:d,insetRight:h,insetBottom:m,insetLeft:g}=this,{rx:y,ry:x,rx1y1:b,rx1y2:w,rx2y1:_,rx2y2:v}=this,A=f+g,E=l-a-h,T=s+d,$=u-c-m;return st(p?"svg:line":b||w||_||v?"svg:path":"svg:rect",i).datum(0).call(xt,this,o,i).call(dt,this).call(Tt,this,r).call(mt,this,{}).call(p==="left"?M=>M.attr("x1",A).attr("x2",A).attr("y1",T).attr("y2",$):p==="right"?M=>M.attr("x1",E).attr("x2",E).attr("y1",T).attr("y2",$):p==="top"?M=>M.attr("x1",A).attr("x2",E).attr("y1",T).attr("y2",T):p==="bottom"?M=>M.attr("x1",A).attr("x2",E).attr("y1",$).attr("y2",$):b||w||_||v?M=>M.call(Zp,A,T,E,$,this):M=>M.attr("x",A).attr("y",T).attr("width",E-A).attr("height",$-T).attr("rx",y).attr("ry",x)).node()}};function Df(t){return new Jp(t)}var x3={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},hV=new Set(["geometry","href","src","ariaLabel","scales"]),Kp=class extends pt{constructor(e,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&vn(e)&&Fy(e)&&(n={...n,title:V});let{x:r,y:o,x1:i,x2:s,y1:a,y2:c,anchor:f,preferredAnchor:l="bottom",monospace:u,fontFamily:p=u?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:h,fontVariant:m,fontWeight:g,lineHeight:y=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:A=8,title:E,pointerSize:T=12,pathFilter:$="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(e,{x:{value:i!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:o,scale:"y",optional:!0},x1:{value:i,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:i==null},y2:{value:c,scale:"y",optional:a==null},title:{value:E,optional:!0}},n,x3),this.anchor=By(f,"anchor"),this.preferredAnchor=By(l,"preferredAnchor"),this.frameAnchor=fo(b),this.textAnchor=Wt(_,"middle"),this.textPadding=+A,this.pointerSize=+T,this.pathFilter=fe($),this.lineHeight=+y,this.lineWidth=+x,this.textOverflow=f3(v),this.monospace=!!u,this.fontFamily=fe(p),this.fontSize=Ot(d),this.fontStyle=fe(h),this.fontVariant=fe(m),this.fontWeight=fe(g);for(let M in x3)M in this.channels&&(this[M]=x3[M]);this.splitLines=u3(this),this.clipLine=p3(this),this.format=typeof w=="string"||typeof w=="function"?{title:w}:{...w}}render(e,n,r,o,i){let s=this,{x:a,y:c,fx:f,fy:l}=n,{ownerSVGElement:u,document:p}=i,{anchor:d,monospace:h,lineHeight:m,lineWidth:g}=this,{textPadding:y,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:_}=o,{x1:v,y1:A,x2:E,y2:T,x:$=v??E,y:M=A??T}=r,k=f?f(e.fx)-_:0,R=l?l(e.fy)-w:0,[S,I]=Le(this,o),C=e3(r,S),N=n3(r,I),D=h?yx:gx,L=D(Oa),P,F;"title"in r?(P=YN.call(this,{title:r.channels.title},n),F=xV):(P=YN.call(this,r.channels,n),F=bV);let q=st("svg:g",i).call(xt,this,o,i).call(l3,this).call(mt,this,{x:$&&a,y:M&&c}).call(nt=>nt.selectAll().data(e).enter().append("g").attr("transform",ot=>`translate(${Math.round(C(ot))},${Math.round(N(ot))})`).call(dt,this).call(ot=>ot.append("path").attr("filter",b)).call(ot=>ot.append("text").each(function(X){let rt=St(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let Y=F.call(s,X,e,P,n,r);if(typeof Y=="string")for(let H of s.splitLines(Y))W(rt,{value:s.clipLine(H)});else{let H=new Set;for(let et of Y){let{label:B=""}=et;B&&H.has(B)||(H.add(B),W(rt,et))}}})));function W(nt,{label:ot,value:X,color:rt,opacity:Y}){ot??="",X??="";let H=rt!=null||Y!=null,et,B=g*100,[wt]=La(ot,B,D,L);if(wt>=0)ot=ot.slice(0,wt).trimEnd()+Oa,et=X.trim(),X="";else{(ot||!X&&!H)&&(X=" "+X);let[It]=La(X,B-D(ot),D,L);It>=0&&(et=X.trim(),X=X.slice(0,It).trimEnd()+Oa)}let ct=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");ot&&ct.append("tspan").attr("font-weight","bold").text(ot),X&&ct.append(()=>p.createTextNode(X)),H&&ct.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",Y).style("user-select","none"),et&&ct.append("title").text(et)}function tt(){let{width:nt,height:ot}=o.facet??o;q.selectChildren().each(function(X){let{x:rt,width:Y,height:H}=this.getBBox();Y=Math.round(Y),H=Math.round(H);let et=d;if(et===void 0){let ct=C(X)+k,It=N(X)+R,kt=ct+Y+x+y*2<nt,J=ct-Y-x-y*2>0,qt=It+H+x+y*2<ot,Nn=It-H-x-y*2>0;et=kt&&J?qt&&Nn?s.preferredAnchor:Nn?"bottom":"top":qt&&Nn?kt?"left":"right":(kt||J)&&(qt||Nn)?`${Nn?"bottom":"top"}-${kt?"left":"right"}`:s.preferredAnchor}let B=this.firstChild,wt=this.lastChild;if(B.setAttribute("d",yV(et,x,y,Y,H)),rt)for(let ct of wt.childNodes)ct.setAttribute("x",-rt);wt.setAttribute("y",`${+mV(et,wt.childNodes.length,m).toFixed(6)}em`),wt.setAttribute("transform",`translate(${gV(et,x,y,Y,H)})`)}),q.attr("visibility",null)}return e.length&&(q.attr("visibility","hidden"),u.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),q.node()}};function Ox(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new Kp(t,{...r,x:e,y:n})}function mV(t,e,n){return/^top(?:-|$)/.test(t)?.94-n:-.29-e*n}function gV(t,e,n,r,o){switch(t){case"middle":return[-r/2,o/2];case"top-left":return[n,e+n];case"top":return[-r/2,e/2+n];case"top-right":return[-r-n,e+n];case"right":return[-e/2-r-n,o/2];case"bottom-left":return[n,-e-n];case"bottom":return[-r/2,-e/2-n];case"bottom-right":return[-r-n,-e-n];case"left":return[n+e/2,o/2]}}function yV(t,e,n,r,o){let i=r+n*2,s=o+n*2;switch(t){case"middle":return`M${-i/2},${-s/2}h${i}v${s}h${-i}z`;case"top-left":return`M0,0l${e},${e}h${i-e}v${s}h${-i}z`;case"top":return`M0,0l${e/2},${e/2}h${(i-e)/2}v${s}h${-i}v${-s}h${(i-e)/2}z`;case"top-right":return`M0,0l${-e},${e}h${e-i}v${s}h${i}z`;case"right":return`M0,0l${-e/2},${-e/2}v${e/2-s/2}h${-i}v${s}h${i}v${e/2-s/2}z`;case"bottom-left":return`M0,0l${e},${-e}h${i-e}v${-s}h${-i}z`;case"bottom":return`M0,0l${e/2},${-e/2}h${(i-e)/2}v${-s}h${-i}v${s}h${(i-e)/2}z`;case"bottom-right":return`M0,0l${-e},${-e}h${e-i}v${-s}h${i}z`;case"left":return`M0,0l${e/2},${-e/2}v${e/2-s/2}h${i}v${s}h${-i}v${e/2-s/2}z`}}function YN(t,e){let n={},r=this.format;r=UN(r,t,"x"),r=UN(r,t,"y"),this.format=r;for(let o in r){let i=r[o];if(!(i===null||i===!1))if(o==="fx"||o==="fy")n[o]=!0;else{let s=Pp(t,o);s&&(n[o]=s)}}for(let o in t){if(o in n||o in r||hV.has(o)||(o==="x"||o==="y")&&t.geometry)continue;let i=Pp(t,o);if(i){if(i.scale==null&&i.defaultScale==="color")continue;n[o]=i}}this.facet&&(e.fx&&!("fx"in r)&&(n.fx=!0),e.fy&&!("fy"in r)&&(n.fy=!0));for(let o in n){let i=this.format[o];if(typeof i=="string"){let s=n[o]?.value??e[o]?.domain()??[];this.format[o]=(ne(s)?ro:sr)(i)}else if(i===void 0||i===!0){let s=e[o];this.format[o]=s?.bandwidth?Vp(s,s.domain()):mo}}return n}function UN(t,e,n){if(!(n in t))return t;let r=`${n}1`,o=`${n}2`;if((r in t||!(r in e))&&(o in t||!(o in e)))return t;let i=Object.entries(t),s=t[n];return i.splice(i.findIndex(([a])=>a===n)+1,0,[r,s],[o,s]),Object.fromEntries(i)}function xV(t,e,{title:n}){return this.format.title(n.value[t],t)}function*bV(t,e,n,r,o){for(let i in n){if(i==="fx"||i==="fy"){yield{label:Nx(r,n,i),value:this.format[i](e[i],t)};continue}if(i==="x1"&&"x2"in n||i==="y1"&&"y2"in n)continue;let s=n[i];if(i==="x2"&&"x1"in n)yield{label:XN(r,n,"x"),value:jN(this.format.x2,n.x1,s,t)};else if(i==="y2"&&"y1"in n)yield{label:XN(r,n,"y"),value:jN(this.format.y2,n.y1,s,t)};else{let a=s.value[t],c=s.scale;if(!Jt(a)&&c==null)continue;yield{label:Nx(r,n,i),value:this.format[i](a,t),color:c==="color"?o[i][t]:null,opacity:c==="opacity"?o[i][t]:null}}}}function jN(t,e,n,r){return n.hint?.length?`${t(n.value[r]-e.value[r],r)}`:`${t(e.value[r],r)}\u2013${t(n.value[r],r)}`}function XN(t,e,n){let r=Nx(t,e,`${n}1`,n),o=Nx(t,e,`${n}2`,n);return r===o?r:`${r}\u2013${o}`}function Nx(t,e,n,r=n){let o=e[n],i=t[o?.scale??n];return String(i?.label??o?.label??r)}function Pf(t={}){let{facet:e,style:n,title:r,subtitle:o,caption:i,ariaLabel:s,ariaDescription:a}=t,c=fs(t.className),f=t.marks===void 0?[]:VN(t.marks);f.push(...AV(f));let l=SV(e,t),u=new Map;for(let L of f){let P=WN(L,l,t);P&&u.set(L,P)}let p=new Map;l&&td(p,[l],t),td(p,u,t);let d=VN(TV(f,p,t));for(let L of d){let P=WN(L,l,t);P&&u.set(L,P)}f.unshift(...d);let h=vk(p,t);if(h!==void 0){let L=l?ix(h,l):void 0;for(let F of f){if(F.facet===null||F.facet==="super")continue;let q=u.get(F);q!==void 0&&(q.facetsIndex=F.fx!=null||F.fy!=null?ix(h,q):L)}let P=new Set;for(let{facetsIndex:F}of u.values())F?.forEach((q,W)=>{q?.length>0&&P.add(W)});h.forEach(0<P.size&&P.size<h.length?(F,q)=>F.empty=!P.has(q):F=>F.empty=!1);for(let F of f)if(F.facet==="exclude"){let q=u.get(F);q!==void 0&&(q.facetsIndex=Mk(q.facetsIndex))}}for(let L of Yt.keys())so(t[L])&&L!=="fx"&&L!=="fy"&&p.set(L,[]);let m=new Map;for(let L of f){if(m.has(L))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:F}=u.get(L)??{},{data:q,facets:W,channels:tt}=L.initialize(P,F,t);v3(tt,t),m.set(L,{data:q,facets:W,channels:tt})}let g=Bp(td(p,m,t),t),y=Fk(g,f,t);hk(g,y);let x=B6(g),{fx:b,fy:w}=x,_=b||w?z6(g,y):y,v=b||w?OV(x,y):y,A=as(t),E=A.document,T=Bo("svg").call(E.documentElement),$=T;A.ownerSVGElement=T,A.className=c,A.projection=Ek(t,_),A.filterFacets=(L,P)=>ix(h,{channels:P,groups:rx(L,P)}),A.getMarkState=L=>{let P=m.get(L),F=u.get(L);return{...P,channels:{...P.channels,...F?.channels}}},A.dispatchValue=L=>{$.value!==L&&($.value=L,$.dispatchEvent(new Event("input",{bubbles:!0})))};let M=new Set;for(let[L,P]of m)if(L.initializer!=null){let F=L.facet==="super"?v:_,q=L.initializer(P.data,P.facets,P.channels,x,F,A);if(q.data!==void 0&&(P.data=q.data),q.facets!==void 0&&(P.facets=q.facets),q.channels!==void 0){let{fx:W,fy:tt,...nt}=q.channels;_V(nt),Object.assign(P.channels,nt);for(let ot of Object.values(nt)){let{scale:X}=ot;X!=null&&!hC(Yt.get(X))&&(QN(ot,t),M.add(X))}(W!=null||tt!=null)&&u.set(L,!0)}}if(M.size){let L=new Map;td(L,m,t,W=>M.has(W)),td(p,m,t,W=>M.has(W));let P=NV(Bp(L,t),g),{scales:F,...q}=B6(P);Object.assign(g,P),Object.assign(x,q),Object.assign(x.scales,F)}let k,R;h!==void 0&&(k={x:b?.domain(),y:w?.domain()},h=_k(h,k),R=Sk(b,w,y));for(let[L,P]of m)P.values=L.scale(P.channels,x,A);let{width:S,height:I}=y;St(T).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",I).attr("viewBox",`0 0 ${S} ${I}`).attr("aria-label",s).attr("aria-description",a).call(L=>L.append("style").text(`:where(.${c}) {
|
|
50
|
+
${m}`)).style("margin-left",f?`${+f}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",te(i,"normal")).call(xu,p).node()}var wb=new Map([["symbol",XO],["color",HO],["opacity",AH]]);function VO(t={}){for(let[e,n]of wb){let r=t[e];if(Ro(r)){let o=Ps(t),i;if(e==="symbol"){let{fill:s,stroke:a=s===void 0&&Ro(t.color)?"color":void 0}=t;i={fill:s,stroke:a}}return n(G1(e,r,i),M4(o,r,t),s=>Ro(t[s])?G1(s,t[s]):null)}}throw new Error("unknown legend type; no scale found")}function GO(t,e,n={}){return(r,o)=>{if(!wb.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return wb.get(r)(t[r],M4(e,n[r],o),i=>t[i])}}function M4({className:t,...e},{label:n,ticks:r,tickFormat:o}={},i){return NL(i,{className:t,...e},{label:n,ticks:r,tickFormat:o})}function HO(t,{legend:e=!0,...n}){if(e===!0&&(e=t.type==="ordinal"?"swatches":"ramp"),t.domain!==void 0)switch(`${e}`.toLowerCase()){case"swatches":return jO(t,n);case"ramp":return iO(t,n);default:throw new Error(`unknown legend type: ${e}`)}}function AH({type:t,interpolate:e,...n},{legend:r=!0,color:o=Le(0,0,0),...i}){if(!e)throw new Error(`${t} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return HO({type:t,...n,interpolate:TH(o)},{legend:r,...i})}function TH(t){let{r:e,g:n,b:r}=Le(t)||Le(0,0,0);return o=>`rgba(${e},${n},${r},${o})`}function QO(t,e,n){let r=[];for(let[o,i]of wb){let s=n[o];if(s?.legend&&o in t){let a=i(t[o],M4(e,t[o],s),c=>t[c]);a!=null&&r.push(a)}}return r}function Us(t={}){return wS(t)?t:{...t,x:W}}function js(t={}){return vS(t)?t:{...t,y:W}}function vb(t,e){if(e.length===1)return{data:t,facets:e};let n=Cs(t),r=new Uint8Array(n),o=0;for(let a of e)for(let c of a)r[c]&&++o,r[c]=1;if(o===0)return{data:t,facets:e};t=Ns(t);let i=t[dS]=new Uint32Array(n+o);e=e.map(a=>Ns(a,Uint32Array));let s=n;r.fill(0);for(let a of e)for(let c=0,f=a.length;c<f;++c){let u=a[c];r[u]?(a[c]=s,t[s]=t[u],i[s]=u,++s):i[u]=u,r[u]=1}return{data:t,facets:e}}function A4(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{y1:n,y:r=n,x:o,...i}=e,[s,a,c,f]=Su(r,o,"y","x",t,i);return{...s,y1:n,y:a,x1:c,x2:f,x:ou(c,f)}}function KO(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{y1:n,y:r=n,x:o}=e,[i,s,a]=Su(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function t$(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{y1:n,y:r=n,x:o}=e,[i,s,,a]=Su(r,o,"y","x",t,e);return{...i,y1:n,y:s,x:a}}function T4(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{x1:n,x:r=n,y:o,...i}=e,[s,a,c,f]=Su(r,o,"x","y",t,i);return{...s,x1:n,x:a,y1:c,y2:f,y:ou(c,f)}}function e$(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{x1:n,x:r=n,y:o}=e,[i,s,a]=Su(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function n$(t={},e={}){arguments.length===1&&([t,e]=_u(t));let{x1:n,x:r=n,y:o}=e,[i,s,,a]=Su(r,o,"x","y",t,e);return{...i,x1:n,x:s,y:a}}function Xs({x:t,x1:e,x2:n,...r}={}){return r=Jr(r,"y"),e===void 0&&n===void 0?A4({x:t,...r}):([e,n]=_S(t,e,n),{...r,x1:e,x2:n})}function Ws({y:t,y1:e,y2:n,...r}={}){return r=Jr(r,"x"),e===void 0&&n===void 0?T4({y:t,...r}):([e,n]=_S(t,e,n),{...r,y1:e,y2:n})}function _u(t){let{offset:e,order:n,reverse:r,...o}=t;return[{offset:e,order:n,reverse:r},o]}var EH={length:!0};function Su(t,e=jd,n,r,{offset:o,order:i,reverse:s},a){if(e===null)throw new Error(`stack requires ${r}`);let c=vn(a),[f,u]=fn(t),[p,l]=Ge(e),[d,h]=Ge(e);return p.hint=d.hint=EH,o=IH(o),i=kH(i,o,r),[Ce(a,(m,x,g)=>{({data:m,facets:x}=vb(m,x));let y=t==null?void 0:u(sc(ut(m,t),g?.[n])),b=ut(m,e,Float64Array),w=ut(m,c),_=i&&i(m,y,b,w),v=Cs(m),A=l(new Float64Array(v)),T=h(new Float64Array(v)),E=[];for(let N of x){let M=y?Array.from(rn(N,k=>y[k]).values()):[N];if(_)for(let k of M)k.sort(_);for(let k of M){let O=0,S=0;s&&k.reverse();for(let I of k){let C=b[I];C<0?O=T[I]=(A[I]=O)+C:C>0?S=T[I]=(A[I]=S)+C:T[I]=A[I]=S}}E.push(M)}return o&&o(E,A,T,w),{data:m,facets:x}}),f,p,d]}function IH(t){if(t!=null){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return NH;case"center":case"silhouette":return CH;case"wiggle":return o$}throw new Error(`unknown offset: ${t}`)}}function r$(t,e){let n=0,r=0;for(let o of t){let i=e[o];i<n&&(n=i),i>r&&(r=i)}return[n,r]}function NH(t,e,n){for(let r of t)for(let o of r){let[i,s]=r$(o,n);for(let a of o){let c=1/(s-i||1);e[a]=c*(e[a]-i),n[a]=c*(n[a]-i)}}}function CH(t,e,n){for(let r of t){for(let o of r){let[i,s]=r$(o,n);for(let a of o){let c=(s+i)/2;e[a]-=c,n[a]-=c}}i$(r,e,n)}s$(t,e,n)}function o$(t,e,n,r){for(let o of t){let i=new Tn,s=0;for(let a of o){let c=-1,f=a.map(d=>Math.abs(n[d]-e[d])),u=a.map(d=>{c=r?r[d]:++c;let h=n[d]-e[d],m=i.has(c)?h-i.get(c):0;return i.set(c,h),m}),p=[0,...gx(u)];for(let d of a)e[d]+=s,n[d]+=s;let l=sn(f);l&&(s-=sn(f,(d,h)=>(u[h]/2+p[h])*d)/l)}i$(o,e,n)}s$(t,e,n)}function i$(t,e,n){let r=It(t,o=>It(o,i=>e[i]));for(let o of t)for(let i of o)e[i]-=r,n[i]-=r}function s$(t,e,n){let r=t.length;if(r===1)return;let o=t.map(a=>a.flat()),i=o.map(a=>(It(a,c=>e[c])+kt(a,c=>n[c]))/2),s=It(i);for(let a=0;a<r;a++){let c=s-i[a];for(let f of o[a])e[f]+=c,n[f]+=c}}function kH(t,e,n){if(t===void 0&&e===o$)return ZO(We);if(t!=null){if(typeof t=="string"){let r=t.startsWith("-"),o=r?nc:We;switch((r?t.slice(1):t).toLowerCase()){case"value":case n:return LH(o);case"z":return RH(o);case"sum":return OH(o);case"appearance":return $H(o);case"inside-out":return ZO(o)}return JO(mS(t))}if(typeof t=="function")return(t.length===1?JO:DH)(t);if(Gn(t))return PH(t);throw new Error(`invalid order: ${t}`)}}function LH(t){return(e,n,r)=>(o,i)=>t(r[o],r[i])}function RH(t){return(e,n,r,o)=>(i,s)=>t(o[i],o[s])}function OH(t){return _b(t,(e,n,r,o)=>af(Fn(e),i=>sn(i,s=>r[s]),i=>o[i]))}function $H(t){return _b(t,(e,n,r,o)=>af(Fn(e),i=>n[Ia(i,s=>r[s])],i=>o[i]))}function ZO(t){return _b(t,(e,n,r,o)=>{let i=Fn(e),s=af(i,p=>n[Ia(p,l=>r[l])],p=>o[p]),a=Wr(i,p=>sn(p,l=>r[l]),p=>o[p]),c=[],f=[],u=0;for(let p of s)u<0?(u+=a.get(p),c.push(p)):(u-=a.get(p),f.push(p));return f.reverse().concat(c)})}function JO(t){return e=>{let n=ut(e,t);return(r,o)=>We(n[r],n[o])}}function DH(t){return e=>Gn(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r))}function PH(t){return _b(We,()=>t)}function _b(t,e){return(n,r,o,i)=>{if(!i)throw new Error("missing channel: z");let s=new Tn(e(n,r,o,i).map((a,c)=>[a,c]));return(a,c)=>t(s.get(i[a]),s.get(i[c]))}}var FH={ariaLabel:"rect"},gc=class extends lt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s}=n;super(e,{x1:{value:r,scale:"x",type:r!=null&&i==null?"band":void 0,optional:!0},y1:{value:o,scale:"y",type:o!=null&&s==null?"band":void 0,optional:!0},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,FH),ch(this,n),fh(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x1:c,y1:f,x2:u,y2:p}=r,{marginTop:l,marginRight:d,marginBottom:h,marginLeft:m,width:x,height:g}=o,{projection:y}=i,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v}=this,{rx:A,ry:T,rx1y1:E,rx1y2:N,rx2y1:M,rx2y2:k}=this;(c||u)&&!y&&lr(s)&&(c=u=null),(f||p)&&!y&&lr(a)&&(f=p=null);let O=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{},0,0).call(I=>I.selectAll().data(e).enter().call(E||N||M||k?C=>C.append("path").call(ht,this).call(uh,c&&u?L=>c[L]+(u[L]<c[L]?-w:v):c?L=>c[L]+v:m+v,f&&p?L=>f[L]+(p[L]<f[L]?-_:b):f?L=>f[L]+b:l+b,c&&u?L=>u[L]-(u[L]<c[L]?-v:w):c?L=>c[L]+O-w:x-d-w,f&&p?L=>p[L]-(p[L]<f[L]?-b:_):f?L=>f[L]+S-_:g-h-_,this).call(Tt,this,r):C=>C.append("rect").call(ht,this).attr("x",c?u?L=>Math.min(c[L],u[L])+v:L=>c[L]+v:m+v).attr("y",f?p?L=>Math.min(f[L],p[L])+b:L=>f[L]+b:l+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+O-v-w):O-v-w:x-d-m-w-v).attr("height",f?p?L=>Math.max(0,Math.abs(f[L]-p[L])+S-b-_):S-b-_:g-l-h-b-_).call(at,"rx",A).call(at,"ry",T).call(Tt,this,r))).node()}};function ch(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={}){t.insetTop=Dt(n),t.insetRight=Dt(r),t.insetBottom=Dt(o),t.insetLeft=Dt(i)}function fh(t,{r:e,rx:n,ry:r,rx1:o=e,ry1:i=e,rx2:s=e,ry2:a=e,rx1y1:c=o!==void 0?+o:i!==void 0?+i:0,rx1y2:f=o!==void 0?+o:a!==void 0?+a:0,rx2y1:u=s!==void 0?+s:i!==void 0?+i:0,rx2y2:p=s!==void 0?+s:a!==void 0?+a:0}={}){c||f||u||p?(t.rx1y1=c,t.rx1y2=f,t.rx2y1=u,t.rx2y2=p):(t.rx=te(n,"auto"),t.ry=te(r,"auto"))}function uh(t,e,n,r,o,i){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:f}=i;typeof e!="function"&&(e=ue(e)),typeof n!="function"&&(n=ue(n)),typeof r!="function"&&(r=ue(r)),typeof o!="function"&&(o=ue(o));let u=Math.max(Math.abs(s+c),Math.abs(a+f)),p=Math.max(Math.abs(s+a),Math.abs(c+f));t.attr("d",l=>{let d=e(l),h=n(l),m=r(l),x=o(l),g=d>m,y=h>x,b=g?m:d,w=g?d:m,_=y?x:h,v=y?h:x,A=Math.min(1,(w-b)/u,(v-_)/p),T=A*(g?y?f:c:y?a:s),E=A*(g?y?a:s:y?f:c),N=A*(g?y?s:a:y?c:f),M=A*(g?y?c:f:y?s:a);return`M${b},${_+Mb(T,M)}A${T},${T} 0 0 ${T<0?0:1} ${b+Sb(T,M)},${_}H${w-Sb(E,N)}A${E},${E} 0 0 ${E<0?0:1} ${w},${_+Mb(E,N)}V${v-Mb(N,E)}A${N},${N} 0 0 ${N<0?0:1} ${w-Sb(N,E)},${v}H${b+Sb(M,T)}A${M},${M} 0 0 ${M<0?0:1} ${b},${v-Mb(M,T)}Z`})}function Sb(t,e){return e<0?t:Math.abs(t)}function Mb(t,e){return e<0?Math.abs(t):t}function lh(t,e){return new gc(t,m4(x4(e)))}function Mu(t,e={}){return Oi(e)||(e={...e,y:Zt,x2:W,interval:1}),new gc(t,Xs(x4(Us(e))))}function Au(t,e={}){return Oi(e)||(e={...e,x:Zt,y2:W,interval:1}),new gc(t,Ws(m4(js(e))))}var qH={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},BH={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},ph=class extends lt{constructor(e={}){let{anchor:n=null}=e;super(Es,void 0,e,n==null?qH:BH),this.anchor=bS(n,"anchor",["top","right","bottom","left"]),ch(this,e),n||fh(this,e)}render(e,n,r,o,i){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:f,width:u,height:p}=o,{anchor:l,insetTop:d,insetRight:h,insetBottom:m,insetLeft:x}=this,{rx:g,ry:y,rx1y1:b,rx1y2:w,rx2y1:_,rx2y2:v}=this,A=f+x,T=u-a-h,E=s+d,N=p-c-m;return ot(l?"svg:line":b||w||_||v?"svg:path":"svg:rect",i).datum(0).call(wt,this,o,i).call(ht,this).call(Tt,this,r).call(xt,this,{}).call(l==="left"?M=>M.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",N):l==="right"?M=>M.attr("x1",T).attr("x2",T).attr("y1",E).attr("y2",N):l==="top"?M=>M.attr("x1",A).attr("x2",T).attr("y1",E).attr("y2",E):l==="bottom"?M=>M.attr("x1",A).attr("x2",T).attr("y1",N).attr("y2",N):b||w||_||v?M=>M.call(uh,A,E,T,N,this):M=>M.attr("x",A).attr("y",E).attr("width",T-A).attr("height",N-E).attr("rx",g).attr("ry",y)).node()}};function Tu(t){return new ph(t)}var E4={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},zH=new Set(["geometry","href","src","ariaLabel","scales"]),dh=class extends lt{constructor(e,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&qn(e)&&k1(e)&&(n={...n,title:W});let{x:r,y:o,x1:i,x2:s,y1:a,y2:c,anchor:f,preferredAnchor:u="bottom",monospace:p,fontFamily:l=p?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:h,fontVariant:m,fontWeight:x,lineHeight:g=1,lineWidth:y=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:A=8,title:T,pointerSize:E=12,pathFilter:N="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(e,{x:{value:i!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:o,scale:"y",optional:!0},x1:{value:i,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:i==null},y2:{value:c,scale:"y",optional:a==null},title:{value:T,optional:!0}},n,E4),this.anchor=R1(f,"anchor"),this.preferredAnchor=R1(u,"preferredAnchor"),this.frameAnchor=Do(b),this.textAnchor=te(_,"middle"),this.textPadding=+A,this.pointerSize=+E,this.pathFilter=be(N),this.lineHeight=+g,this.lineWidth=+y,this.textOverflow=y4(v),this.monospace=!!p,this.fontFamily=be(l),this.fontSize=Dt(d),this.fontStyle=be(h),this.fontVariant=be(m),this.fontWeight=be(x);for(let M in E4)M in this.channels&&(this[M]=E4[M]);this.splitLines=w4(this),this.clipLine=v4(this),this.format=typeof w=="string"||typeof w=="function"?{title:w}:{...w}}render(e,n,r,o,i){let s=this,{x:a,y:c,fx:f,fy:u}=n,{ownerSVGElement:p,document:l}=i,{anchor:d,monospace:h,lineHeight:m,lineWidth:x}=this,{textPadding:g,pointerSize:y,pathFilter:b}=this,{marginTop:w,marginLeft:_}=o,{x1:v,y1:A,x2:T,y2:E,x:N=v??T,y:M=A??E}=r,k=f?f(e.fx)-_:0,O=u?u(e.fy)-w:0,[S,I]=Qe(this,o),C=u4(r,S),L=l4(r,I),D=h?ub:fb,$=D(dc),P,F;"title"in r?(P=a$.call(this,{title:r.channels.title},n),F=XH):(P=a$.call(this,r.channels,n),F=WH);let q=ot("svg:g",i).call(wt,this,o,i).call(b4,this).call(xt,this,{x:N&&a,y:M&&c}).call(et=>et.selectAll().data(e).enter().append("g").attr("transform",rt=>`translate(${Math.round(C(rt))},${Math.round(L(rt))})`).call(ht,this).call(rt=>rt.append("path").attr("filter",b)).call(rt=>rt.append("text").each(function(j){let nt=Nt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let Y=F.call(s,j,e,P,n,r);if(typeof Y=="string")for(let G of s.splitLines(Y))V(nt,{value:s.clipLine(G)});else{let G=new Set;for(let tt of Y){let{label:B=""}=tt;B&&G.has(B)||(G.add(B),V(nt,tt))}}})));function V(et,{label:rt,value:j,color:nt,opacity:Y}){rt??="",j??="";let G=nt!=null||Y!=null,tt,B=x*100,[_t]=mc(rt,B,D,$);if(_t>=0)rt=rt.slice(0,_t).trimEnd()+dc,tt=j.trim(),j="";else{(rt||!j&&!G)&&(j=" "+j);let[Ct]=mc(j,B-D(rt),D,$);Ct>=0&&(tt=j.trim(),j=j.slice(0,Ct).trimEnd()+dc)}let ct=et.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");rt&&ct.append("tspan").attr("font-weight","bold").text(rt),j&&ct.append(()=>l.createTextNode(j)),G&&ct.append("tspan").text(" \u25A0").attr("fill",nt).attr("fill-opacity",Y).style("user-select","none"),tt&&ct.append("title").text(tt)}function K(){let{width:et,height:rt}=o.facet??o;q.selectChildren().each(function(j){let{x:nt,width:Y,height:G}=this.getBBox();Y=Math.round(Y),G=Math.round(G);let tt=d;if(tt===void 0){let ct=C(j)+k,Ct=L(j)+O,Lt=ct+Y+y+g*2<et,Z=ct-Y-y-g*2>0,jt=Ct+G+y+g*2<rt,Qn=Ct-G-y-g*2>0;tt=Lt&&Z?jt&&Qn?s.preferredAnchor:Qn?"bottom":"top":jt&&Qn?Lt?"left":"right":(Lt||Z)&&(jt||Qn)?`${Qn?"bottom":"top"}-${Lt?"left":"right"}`:s.preferredAnchor}let B=this.firstChild,_t=this.lastChild;if(B.setAttribute("d",jH(tt,y,g,Y,G)),nt)for(let ct of _t.childNodes)ct.setAttribute("x",-nt);_t.setAttribute("y",`${+YH(tt,_t.childNodes.length,m).toFixed(6)}em`),_t.setAttribute("transform",`translate(${UH(tt,y,g,Y,G)})`)}),q.attr("visibility",null)}return e.length&&(q.attr("visibility","hidden"),p.isConnected?Promise.resolve().then(K):typeof requestAnimationFrame<"u"&&requestAnimationFrame(K)),q.node()}};function Tb(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new dh(t,{...r,x:e,y:n})}function YH(t,e,n){return/^top(?:-|$)/.test(t)?.94-n:-.29-e*n}function UH(t,e,n,r,o){switch(t){case"middle":return[-r/2,o/2];case"top-left":return[n,e+n];case"top":return[-r/2,e/2+n];case"top-right":return[-r-n,e+n];case"right":return[-e/2-r-n,o/2];case"bottom-left":return[n,-e-n];case"bottom":return[-r/2,-e/2-n];case"bottom-right":return[-r-n,-e-n];case"left":return[n+e/2,o/2]}}function jH(t,e,n,r,o){let i=r+n*2,s=o+n*2;switch(t){case"middle":return`M${-i/2},${-s/2}h${i}v${s}h${-i}z`;case"top-left":return`M0,0l${e},${e}h${i-e}v${s}h${-i}z`;case"top":return`M0,0l${e/2},${e/2}h${(i-e)/2}v${s}h${-i}v${-s}h${(i-e)/2}z`;case"top-right":return`M0,0l${-e},${e}h${e-i}v${s}h${i}z`;case"right":return`M0,0l${-e/2},${-e/2}v${e/2-s/2}h${-i}v${s}h${i}v${e/2-s/2}z`;case"bottom-left":return`M0,0l${e},${-e}h${i-e}v${-s}h${-i}z`;case"bottom":return`M0,0l${e/2},${-e/2}h${(i-e)/2}v${-s}h${-i}v${s}h${(i-e)/2}z`;case"bottom-right":return`M0,0l${-e},${-e}h${e-i}v${-s}h${i}z`;case"left":return`M0,0l${e/2},${-e/2}v${e/2-s/2}h${i}v${s}h${-i}v${e/2-s/2}z`}}function a$(t,e){let n={},r=this.format;r=c$(r,t,"x"),r=c$(r,t,"y"),this.format=r;for(let o in r){let i=r[o];if(!(i===null||i===!1))if(o==="fx"||o==="fy")n[o]=!0;else{let s=Zd(t,o);s&&(n[o]=s)}}for(let o in t){if(o in n||o in r||zH.has(o)||(o==="x"||o==="y")&&t.geometry)continue;let i=Zd(t,o);if(i){if(i.scale==null&&i.defaultScale==="color")continue;n[o]=i}}this.facet&&(e.fx&&!("fx"in r)&&(n.fx=!0),e.fy&&!("fy"in r)&&(n.fy=!0));for(let o in n){let i=this.format[o];if(typeof i=="string"){let s=n[o]?.value??e[o]?.domain()??[];this.format[o]=(fe(s)?Co:Ir)(i)}else if(i===void 0||i===!0){let s=e[o];this.format[o]=s?.bandwidth?ah(s,s.domain()):zo}}return n}function c$(t,e,n){if(!(n in t))return t;let r=`${n}1`,o=`${n}2`;if((r in t||!(r in e))&&(o in t||!(o in e)))return t;let i=Object.entries(t),s=t[n];return i.splice(i.findIndex(([a])=>a===n)+1,0,[r,s],[o,s]),Object.fromEntries(i)}function XH(t,e,{title:n}){return this.format.title(n.value[t],t)}function*WH(t,e,n,r,o){for(let i in n){if(i==="fx"||i==="fy"){yield{label:Ab(r,n,i),value:this.format[i](e[i],t)};continue}if(i==="x1"&&"x2"in n||i==="y1"&&"y2"in n)continue;let s=n[i];if(i==="x2"&&"x1"in n)yield{label:u$(r,n,"x"),value:f$(this.format.x2,n.x1,s,t)};else if(i==="y2"&&"y1"in n)yield{label:u$(r,n,"y"),value:f$(this.format.y2,n.y1,s,t)};else{let a=s.value[t],c=s.scale;if(!oe(a)&&c==null)continue;yield{label:Ab(r,n,i),value:this.format[i](a,t),color:c==="color"?o[i][t]:null,opacity:c==="opacity"?o[i][t]:null}}}}function f$(t,e,n,r){return n.hint?.length?`${t(n.value[r]-e.value[r],r)}`:`${t(e.value[r],r)}\u2013${t(n.value[r],r)}`}function u$(t,e,n){let r=Ab(t,e,`${n}1`,n),o=Ab(t,e,`${n}2`,n);return r===o?r:`${r}\u2013${o}`}function Ab(t,e,n,r=n){let o=e[n],i=t[o?.scale??n];return String(i?.label??o?.label??r)}function Eu(t={}){let{facet:e,style:n,title:r,subtitle:o,caption:i,ariaLabel:s,ariaDescription:a}=t,c=qs(t.className),f=t.marks===void 0?[]:p$(t.marks);f.push(...JH(f));let u=QH(e,t),p=new Map;for(let $ of f){let P=d$($,u,t);P&&p.set($,P)}let l=new Map;u&&hh(l,[u],t),hh(l,p,t);let d=p$(KH(f,l,t));for(let $ of d){let P=d$($,u,t);P&&p.set($,P)}f.unshift(...d);let h=BR(l,t);if(h!==void 0){let $=u?J1(h,u):void 0;for(let F of f){if(F.facet===null||F.facet==="super")continue;let q=p.get(F);q!==void 0&&(q.facetsIndex=F.fx!=null||F.fy!=null?J1(h,q):$)}let P=new Set;for(let{facetsIndex:F}of p.values())F?.forEach((q,V)=>{q?.length>0&&P.add(V)});h.forEach(0<P.size&&P.size<h.length?(F,q)=>F.empty=!P.has(q):F=>F.empty=!1);for(let F of f)if(F.facet==="exclude"){let q=p.get(F);q!==void 0&&(q.facetsIndex=UR(q.facetsIndex))}}for(let $ of Wt.keys())Ro(t[$])&&$!=="fx"&&$!=="fy"&&l.set($,[]);let m=new Map;for(let $ of f){if(m.has($))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:F}=p.get($)??{},{data:q,facets:V,channels:K}=$.initialize(P,F,t);C4(K,t),m.set($,{data:q,facets:V,channels:K})}let x=th(hh(l,m,t),t),g=rO(x,f,t);RR(x,g);let y=HS(x),{fx:b,fy:w}=y,_=b||w?QS(x,g):g,v=b||w?sQ(y,g):g,A=Ps(t),T=A.document,E=hi("svg").call(T.documentElement),N=E;A.ownerSVGElement=E,A.className=c,A.projection=WR(t,_),A.filterFacets=($,P)=>J1(h,{channels:P,groups:Q1($,P)}),A.getMarkState=$=>{let P=m.get($),F=p.get($);return{...P,channels:{...P.channels,...F?.channels}}},A.dispatchValue=$=>{N.value!==$&&(N.value=$,N.dispatchEvent(new Event("input",{bubbles:!0})))};let M=new Set;for(let[$,P]of m)if($.initializer!=null){let F=$.facet==="super"?v:_,q=$.initializer(P.data,P.facets,P.channels,y,F,A);if(q.data!==void 0&&(P.data=q.data),q.facets!==void 0&&(P.facets=q.facets),q.channels!==void 0){let{fx:V,fy:K,...et}=q.channels;HH(et),Object.assign(P.channels,et);for(let rt of Object.values(et)){let{scale:j}=rt;j!=null&&!RL(Wt.get(j))&&(x$(rt,t),M.add(j))}(V!=null||K!=null)&&p.set($,!0)}}if(M.size){let $=new Map;hh($,m,t,V=>M.has(V)),hh(l,m,t,V=>M.has(V));let P=iQ(th($,t),x),{scales:F,...q}=HS(P);Object.assign(x,P),Object.assign(y,q),Object.assign(y.scales,F)}let k,O;h!==void 0&&(k={x:b?.domain(),y:w?.domain()},h=zR(h,k),O=YR(b,w,g));for(let[$,P]of m)P.values=$.scale(P.channels,y,A);let{width:S,height:I}=g;Nt(E).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",I).attr("viewBox",`0 0 ${S} ${I}`).attr("aria-label",s).attr("aria-description",a).call($=>$.append("style").text(`:where(.${c}) {
|
|
51
51
|
--plot-background: white;
|
|
52
52
|
display: block;
|
|
53
53
|
height: auto;
|
|
@@ -57,24 +57,24 @@ ${m}`)).style("margin-left",f?`${+f}px`:null).style("width",p===void 0?null:`${+
|
|
|
57
57
|
:where(.${c} text),
|
|
58
58
|
:where(.${c} tspan) {
|
|
59
59
|
white-space: pre;
|
|
60
|
-
}`)).call(Tf,n);for(let L of f){let{channels:P,values:F,facets:q}=m.get(L);if(h===void 0||L.facet==="super"){let W=null;if(q&&(W=q[0],W=L.filter(W,P,F),W.length===0))continue;let tt=L.render(W,x,F,v,A);if(tt==null)continue;T.appendChild(tt)}else{let W;for(let tt of h){if(!(L.facetAnchor?.(h,k,tt)??!tt.empty))continue;let nt=null;if(q){let X=u.has(L);if(nt=q[X?tt.i:0],nt=L.filter(nt,P,F),nt.length===0)continue;!X&&nt===q[0]&&(nt=ai(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let ot=L.render(nt,x,F,_,A);if(ot!=null){(W??=St(T).append("g")).append(()=>ot).datum(tt);for(let X of["aria-label","aria-description","aria-hidden","transform"])ot.hasAttribute(X)&&(W.attr(X,ot.getAttribute(X)),ot.removeAttribute(X))}}W?.selectChildren().attr("transform",R)}}let C=kN(g,A,t),{figure:N=r!=null||o!=null||i!=null||C.length>0}=t;N&&($=E.createElement("figure"),$.className=`${c}-figure`,$.style.maxWidth="initial",r!=null&&$.append(GN(E,r,"h2")),o!=null&&$.append(GN(E,o,"h3")),$.append(...C,T),i!=null&&$.append(wV(E,i)),"value"in T&&($.value=T.value,delete T.value)),$.scale=xk(x.scales),$.legend=$N(g,A,t);let D=HC();return D>0&&St(T).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${D.toLocaleString("en-US")} warning${D===1?"":"s"}. Please check the console.`),$}function GN(t,e,n){if(e.ownerDocument)return e;let r=t.createElement(n);return r.append(e),r}function wV(t,e){let n=t.createElement("figcaption");return n.append(e),n}function VN(t){return t.flat(1/0).filter(e=>e!=null).map(vV)}function vV(t){return typeof t.render=="function"?t:new w3(t)}var w3=class extends pt{constructor(e){if(typeof e!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=e}render(){}};function v3(t,e){for(let n in t)QN(t[n],e);return t}function QN(t,e){let{scale:n,transform:r=!0}=t;if(n==null||!r)return;let{type:o,percent:i,interval:s,transform:a=i?c=>c==null?NaN:c*100:h6(s,o)}=e[n]??{};a!=null&&(t.value=Et(t.value,a),t.transform=!1)}function _V(t){for(let e in t)C6(e,t[e])}function td(t,e,n,r=tC){for(let{channels:o}of e.values())for(let i in o){let s=o[i],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!$k(n)){let c=n.x?.domain===void 0,f=n.y?.domain===void 0;if(c||f){let[l,u]=kk(s);c&&b3(t,"x",l),f&&b3(t,"y",u)}}}else b3(t,a,s)}return t}function b3(t,e,n){let r=t.get(e);r!==void 0?r.push(n):t.set(e,[n])}function SV(t,e){if(t==null)return;let{x:n,y:r}=t;if(n==null&&r==null)return;let o=ii(t.data);if(o==null)throw new Error("missing facet data");let i={};n!=null&&(i.fx=bf(o,{value:n,scale:"fx"})),r!=null&&(i.fy=bf(o,{value:r,scale:"fy"})),v3(i,e);let s=rx(o,i);return{channels:i,groups:s,data:t.data}}function WN(t,e,n){if(t.facet===null||t.facet==="super")return;let{fx:r,fy:o}=t;if(r!=null||o!=null){let c=ii(t.data??r??o);if(c===void 0)throw new Error(`missing facet data in ${t.ariaLabel}`);if(c===null)return;let f={};return r!=null&&(f.fx=bf(c,{value:r,scale:"fx"})),o!=null&&(f.fy=bf(c,{value:o,scale:"fy"})),v3(f,n),{channels:f,groups:rx(c,f)}}if(e===void 0)return;let{channels:i,groups:s,data:a}=e;if(t.facet!=="auto"||t.data===a)return{channels:i,groups:s};a.length>0&&(s.size>1||s.size===1&&i.fx&&i.fy&&[...s][0][1].size>1)&&ts(ii(t.data))===ts(a)&&rn(`Warning: the ${t.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 MV(t,e={}){return Vt({...e,x:null,y:null},(n,r,o,i,s,a)=>a.getMarkState(t))}function AV(t){let e=[];for(let n of t){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:o,preferredAnchor:i}=r;o=/^x$/i.test(o)?us:/^y$/i.test(o)?mi:ls,r=o(MV(n,r)),r.title=null,i===void 0&&(r.preferredAnchor=o===mi?"left":"bottom");let s=Ox(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,e.push(s)}}return e}function TV(t,e,n){let{projection:r,x:o={},y:i={},fx:s={},fy:a={},axis:c,grid:f,facet:l={},facet:{axis:u=c,grid:p}=l,x:{axis:d=c,grid:h=d===null?null:f}=o,y:{axis:m=c,grid:g=m===null?null:f}=i,fx:{axis:y=u,grid:x=y===null?null:p}=s,fy:{axis:b=u,grid:w=b===null?null:p}=a}=n;(r||!so(o)&&!HN("x",t))&&(d=h=null),(r||!so(i)&&!HN("y",t))&&(m=g=null),e.has("fx")||(y=x=null),e.has("fy")||(b=w=null),d===void 0&&(d=!Dx(t,"x")),m===void 0&&(m=!Dx(t,"y")),y===void 0&&(y=!Dx(t,"fx")),b===void 0&&(b=!Dx(t,"fy")),d===!0&&(d="bottom"),m===!0&&(m="left"),y===!0&&(y=d==="top"||d===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return Lx(_,w,Mx,a),Rx(_,b,vx,"right","left",l,a),Lx(_,x,Tx,s),Rx(_,y,_x,"top","bottom",l,s),Lx(_,g,Sx,i),Rx(_,m,Xp,"left","right",n,i),Lx(_,h,Ax,o),Rx(_,d,Gp,"bottom","top",n,o),_}function Rx(t,e,n,r,o,i,s){if(!e)return;let a=EV(e);s=IV(a?r:e,i,s);let{line:c}=s;(n===Xp||n===Gp)&&c&&!fi(c)&&t.push(Df($V(s))),t.push(n(s)),a&&t.push(n({...s,anchor:o,label:null}))}function Lx(t,e,n,r){!e||fi(e)||t.push(n(CV(e,r)))}function EV(t){return/^\s*both\s*$/i.test(t)}function IV(t,e,{line:n=e.line,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:l,ariaDescription:u,label:p=e.label,labelAnchor:d,labelArrow:h=e.labelArrow,labelOffset:m}){return{anchor:t,line:n,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:l,ariaDescription:u,label:p,labelAnchor:d,labelArrow:h,labelOffset:m}}function $V(t){let{anchor:e,line:n}=t;return{anchor:e,facetAnchor:e+"-empty",stroke:n===!0?void 0:n}}function CV(t,{stroke:e=ns(t)?t:void 0,ticks:n=kV(t)?t:void 0,tickSpacing:r,ariaLabel:o,ariaDescription:i}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:o,ariaDescription:i}}function kV(t){switch(typeof t){case"number":return!0;case"string":return!ns(t)}return vn(t)||typeof t?.range=="function"}function Dx(t,e){let n=`${e}-axis `;return t.some(r=>r.ariaLabel?.startsWith(n))}function HN(t,e){for(let n of e)for(let r in n.channels){let{scale:o}=n.channels[r];if(o===t||o==="projection")return!0}return!1}function NV(t,e){for(let n in t){let r=t[n],o=e[n];r.label===void 0&&o&&(r.label=o.label)}return t}function OV({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=tx(n),f=t&&ZN(t),l=e&&ZN(e);return{marginTop:e?l[0]:r,marginRight:t?a-f[1]:o,marginBottom:e?c-l[1]:i,marginLeft:t?f[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function ZN(t){let e=t.domain();if(e.length===0)return[0,t.bandwidth()];let n=t(e[0]),r=t(e[e.length-1]);return r<n&&([n,r]=[r,n]),[n,r+t.bandwidth()]}var RV=new Map([["basis",N_],["basis-closed",O_],["basis-open",R_],["bundle",L_],["bump-x",E_],["bump-y",I_],["cardinal",D_],["cardinal-closed",P_],["cardinal-open",F_],["catmull-rom",q_],["catmull-rom-closed",B_],["catmull-rom-open",z_],["linear",ei],["linear-closed",Y_],["monotone-x",j_],["monotone-y",X_],["natural",G_],["step",V_],["step-after",H_],["step-before",W_]]);function ed(t=ei,e){if(typeof t=="function")return t;let n=RV.get(`${t}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${t}`);if(e!==void 0){if("beta"in n)return n.beta(e);if("tension"in n)return n.tension(e);if("alpha"in n)return n.alpha(e)}return n}function Px(t=ys,e){return typeof t!="function"&&`${t}`.toLowerCase()==="auto"?ys:ed(t,e)}function ys(t){return ei(t)}function yo(t={y:"count"},e={}){[t,e]=S3(t,e);let{x:n,y:r}=e;return _3(Fx(n,e,V),null,null,r,t,ka(e))}function xo(t={x:"count"},e={}){[t,e]=S3(t,e);let{x:n,y:r}=e;return _3(null,Fx(r,e,V),n,null,t,Na(e))}function yi(t={fill:"count"},e={}){[t,e]=S3(t,e);let{x:n,y:r}=LV(e);return _3(n,r,null,null,t,ka(Na(e)))}function tO(t,e,n={}){if(n?.interval==null)return n;let{reduce:r=Wy}=n,o={filter:null};return n[e]!=null&&(o[e]=r),n[`${e}1`]!=null&&(o[`${e}1`]=r),n[`${e}2`]!=null&&(o[`${e}2`]=r),t(o,n)}function Ff(t={}){return tO(yo,"y",Er(t,"x"))}function qf(t={}){return tO(xo,"x",Er(t,"y"))}function _3(t,e,n,r,{data:o=Vy,filter:i=Op,sort:s,reverse:a,...c}={},f={}){t=JN(t),e=JN(e),c=DV(c,f),o=rO(o,V),s=s==null?void 0:eO("sort",s,f),i=i==null?void 0:nO("filter",i,f),n!=null&&uo(c,"x","x1","x2")&&(n=null),r!=null&&uo(c,"y","y1","y2")&&(r=null);let[l,u]=Ge(t),[p,d]=Ge(t),[h,m]=Ge(e),[g,y]=Ge(e),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=Ge(x),{x:v,y:A,z:E,fill:T,stroke:$,x1:M,x2:k,y1:R,y2:S,domain:I,cumulative:C,thresholds:N,interval:D,...L}=f,[P,F]=Ge(E),[q]=ee(T),[W]=ee($),[tt,nt]=Ge(q),[ot,X]=Ge(W);return{..."z"in f&&{z:P||E},..."fill"in f&&{fill:tt||T},..."stroke"in f&&{stroke:ot||$},...be(L,(rt,Y,H)=>{let et=Ta(ut(rt,x),H?.[b]),B=ut(rt,E),wt=ut(rt,q),ct=ut(rt,W),It=Dp(c,{z:B,fill:wt,stroke:ct}),kt=[],J=[],qt=et&&_([]),Nn=B&&F([]),kr=wt&&nt([]),RD=ct&&X([]),iT=t&&u([]),LD=t&&d([]),sT=e&&m([]),DD=e&&y([]),PD=qV(t,e,rt),FD=0;for(let Ka of c)Ka.initialize(rt);s&&s.initialize(rt),i&&i.initialize(rt);for(let Ka of Y){let aT=[];for(let tc of c)tc.scope("facet",Ka);s&&s.scope("facet",Ka),i&&i.scope("facet",Ka);for(let[tc,qD]of lo(Ka,It))for(let[BD,ph]of lo(qD,et))for(let[Nr,Ao]of PD(ph))if(It&&(Ao.z=tc),!(i&&!i.reduce(Nr,Ao))){aT.push(FD++),J.push(o.reduceIndex(Nr,rt,Ao)),et&&qt.push(BD),B&&Nn.push(It===B?tc:B[(Nr.length>0?Nr:ph)[0]]),wt&&kr.push(It===wt?tc:wt[(Nr.length>0?Nr:ph)[0]]),ct&&RD.push(It===ct?tc:ct[(Nr.length>0?Nr:ph)[0]]),iT&&(iT.push(Ao.x1),LD.push(Ao.x2)),sT&&(sT.push(Ao.y1),DD.push(Ao.y2));for(let zD of c)zD.reduce(Nr,Ao);s&&s.reduce(Nr,Ao)}kt.push(aT)}return E6(kt,s,a),{data:J,facets:kt}}),...!uo(c,"x")&&(l?{x1:l,x2:p,x:hf(l,p)}:{x:v,x1:M,x2:k}),...!uo(c,"y")&&(h?{y1:h,y2:g,y:hf(h,g)}:{y:A,y1:R,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:rt,output:Y})=>[rt,Y]))}}function S3({cumulative:t,domain:e,thresholds:n,interval:r,...o},i){return[o,{cumulative:t,domain:e,thresholds:n,interval:r,...i}]}function Fx(t,{cumulative:e,domain:n,thresholds:r,interval:o},i){return t={...dr(t)},t.domain===void 0&&(t.domain=n),t.cumulative===void 0&&(t.cumulative=e),t.thresholds===void 0&&(t.thresholds=r),t.interval===void 0&&(t.interval=o),t.value===void 0&&(t.value=i),t.thresholds=M3(t.thresholds,t.interval),t}function LV(t){let{x:e,y:n}=t;return e=Fx(e,t),n=Fx(n,t),[e.value,n.value]=ae(e.value,n.value),{x:e,y:n}}function JN(t){if(t==null)return;let{value:e,cumulative:n,domain:r=Rt,thresholds:o}=t,i=s=>{let a=ut(s,e),c;if(ne(a)||FV(o)){a=Et(a,f6,Float64Array);let[l,u]=typeof r=="function"?r(a):r,p=typeof o=="function"&&!es(o)?o(a,l,u):o;typeof p=="number"&&(p=tp(l,u,p)),es(p)&&(r===Rt&&(l=p.floor(l),u=p.offset(p.floor(u))),p=p.range(l,p.offset(u))),c=p}else{a=xe(a);let[l,u]=typeof r=="function"?r(a):r,p=typeof o=="function"&&!es(o)?o(a,l,u):o;if(typeof p=="number")if(r===Rt){let d=Po(l,u,p);if(isFinite(d))if(d>0){let h=Math.round(l/d),m=Math.round(u/d);h*d<=l||--h,m*d>u||++m;let g=m-h+1;p=new Float64Array(g);for(let y=0;y<g;++y)p[y]=(h+y)*d}else if(d<0){d=-d;let h=Math.round(l*d),m=Math.round(u*d);h/d<=l||--h,m/d>u||++m;let g=m-h+1;p=new Float64Array(g);for(let y=0;y<g;++y)p[y]=(h+y)/d}else p=[l];else p=[l]}else p=Ye(l,u,p);else es(p)&&(r===Rt&&(l=p.floor(l),u=p.offset(p.floor(u))),p=p.range(l,p.offset(u)));c=p}let f=[];if(c.length===1)f.push([c[0],c[0]]);else for(let l=1;l<c.length;++l)f.push([c[l-1],c[l]]);return f.bin=(n<0?zV:n>0?BV:A3)(f,c,a),f};return i.label=Ve(e),i}function M3(t,e,n=KN){if(t===void 0)return e===void 0?n:co(e);if(typeof t=="string"){switch(t.toLowerCase()){case"freedman-diaconis":return $m;case"scott":return Hl;case"sturges":return Ni;case"auto":return KN}return Ma(t)}return t}function DV(t,e){return A6(t,e,eO)}function eO(t,e,n){return Xy(t,e,n,nO)}function nO(t,e,n){return Gy(t,e,n,rO)}function rO(t,e){return xf(t,e,PV)}function PV(t){switch(`${t}`.toLowerCase()){case"x":return YV;case"x1":return jV;case"x2":return XV;case"y":return UV;case"y1":return GV;case"y2":return VV;case"z":return I6}throw new Error(`invalid bin reduce: ${t}`)}function KN(t,e,n){return Math.min(200,Hl(t,e,n))}function FV(t){return rC(t)||vn(t)&&ne(t)}function qV(t,e,n){let r=t?.(n),o=e?.(n);return r&&o?function*(i){let s=r.bin(i);for(let[a,[c,f]]of r.entries()){let l=o.bin(s[a]);for(let[u,[p,d]]of o.entries())yield[l[u],{data:n,x1:c,y1:p,x2:f,y2:d}]}}:r?function*(i){let s=r.bin(i);for(let[a,[c,f]]of r.entries())yield[s[a],{data:n,x1:c,x2:f}]}:function*(i){let s=o.bin(i);for(let[a,[c,f]]of o.entries())yield[s[a],{data:n,y1:c,y2:f}]}}function A3(t,e,n){return e=xe(e),r=>{let o=t.map(()=>[]);for(let i of r)o[Lo(e,n[i])-1]?.push(i);return o}}function BV(t,e,n){let r=A3(t,e,n);return o=>{let i=r(o);for(let s=1,a=i.length;s<a;++s){let c=i[s-1],f=i[s];for(let l of c)f.push(l)}return i}}function zV(t,e,n){let r=A3(t,e,n);return o=>{let i=r(o);for(let s=i.length-2;s>=0;--s){let a=i[s+1],c=i[s];for(let f of a)c.push(f)}return i}}function oO(t,e){let n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}var YV={reduceIndex(t,e,{x1:n,x2:r}){return oO(n,r)}},UV={reduceIndex(t,e,{y1:n,y2:r}){return oO(n,r)}},jV={reduceIndex(t,e,{x1:n}){return n}},XV={reduceIndex(t,e,{x2:n}){return n}},GV={reduceIndex(t,e,{y1:n}){return n}},VV={reduceIndex(t,e,{y2:n}){return n}};var WV={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Fa=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,z:a,curve:c,tension:f}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:nn(n),optional:!0}},n,WV),this.z=a,this.curve=ed(c,f)}filter(e){return e}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n,0,0).call(l=>l.selectAll().data(fx(e,[s,a,c,f],this,r)).enter().append("path").call(dt,this).call(Ca,this,r).attr("d",ef().curve(this.curve).defined(u=>u>=0).x0(u=>s[u]).y0(u=>a[u]).x1(u=>c[u]).y1(u=>f[u]))).node()}};function nd(t,e){return e===void 0?xi(t,{x:Aa,y:Ji}):new Fa(t,e)}function xs(t,e){let{y:n=Xt,...r}=qf(e);return new Fa(t,ms(ds({...r,y1:n,y2:void 0})))}function xi(t,e){let{x:n=Xt,...r}=Ff(e);return new Fa(t,gs(hs({...r,x1:n,x2:void 0})))}var HV={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},rd=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,curve:a,tension:c}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,HV),this.curve=Px(a,c),Ir(this,n)}project(e,n,r){this.curve!==ys&&super.project(e,n,r)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r,{curve:l}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(u=>u.selectAll().data(e).enter().append("path").call(dt,this).attr("d",l===ys&&i.projection?ZV(i.projection,s,a,c,f):p=>{let d=hn(),h=l(d);return h.lineStart(),h.point(s[p],a[p]),h.point(c[p],f[p]),h.lineEnd(),d}).call(Tt,this,r).call(gi,this,r,i)).node()}};function ZV(t,e,n,r,o){let i=Ie(t);return e=xe(e),n=xe(n),r=xe(r),o=xe(o),s=>i({type:"LineString",coordinates:[[e[s],n[s]],[r[s],o[s]]]})}function qx(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=od(e,n,r),[i,s]=od(o,i,s),new rd(t,{...a,x1:n,x2:r,y1:i,y2:s})}function od(t,e,n){if(t===void 0){if(e===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[e]}else{if(e===void 0)return n===void 0?[t]:[t,n];if(n===void 0)return[t,e]}return[e,n]}var QV={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},id=class extends pt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,bend:a=0,headAngle:c=60,headLength:f=8,inset:l=0,insetStart:u=l,insetEnd:p=l,sweep:d}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,QV),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+f,this.insetStart=+u,this.insetEnd=+p,this.sweep=JV(d)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a,SW:l}=r,{strokeWidth:u,bend:p,headAngle:d,headLength:h,insetStart:m,insetEnd:g}=this,y=l?w=>l[w]:re(u===void 0?1:u),x=d*Ef/2,b=h/1.5;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(w=>w.selectAll().data(e).enter().append("path").call(dt,this).attr("d",_=>{let v=s[_],A=a[_],E=c[_],T=f[_],$=Math.hypot(E-v,T-A);if($<=m+g)return null;let M=Math.atan2(T-A,E-v),k=Math.min(b*y(_),$/3),R=this.sweep(v,A,E,T)*p*Ef,S=Math.hypot($/Math.tan(R),$)/2;if(m||g)if(S<1e5){let tt=Math.sign(R),[nt,ot]=KV([v,A],[E,T],S,tt);if(m&&([v,A]=iO([nt,ot,S],[v,A,m],-tt*Math.sign(m))),g){let[X,rt]=iO([nt,ot,S],[E,T,g],tt*Math.sign(g));M+=Math.atan2(rt-ot,X-nt)-Math.atan2(T-ot,E-nt),E=X,T=rt}}else{let tt=E-v,nt=T-A,ot=Math.hypot(tt,nt);m&&(v+=tt/ot*m,A+=nt/ot*m),g&&(E-=tt/ot*g,T-=nt/ot*g)}let I=M+R,C=I+x,N=I-x,D=E-k*Math.cos(C),L=T-k*Math.sin(C),P=E-k*Math.cos(N),F=T-k*Math.sin(N),q=S<1e5?`A${S},${S} 0,0,${R>0?1:0} `:"L",W=k?`M${D},${L}L${E},${T}L${P},${F}`:"";return`M${v},${A}${q}${E},${T}${W}`}).call(Tt,this,r)).node()}};function JV(t=1){if(typeof t=="number")return re(Math.sign(t));if(typeof t=="function")return(e,n,r,o)=>Math.sign(t(e,n,r,o));switch(Se(t,"sweep",["+x","-x","+y","-y"])){case"+x":return(e,n,r)=>gt(e,r);case"-x":return(e,n,r)=>an(e,r);case"+y":return(e,n,r,o)=>gt(n,o);case"-y":return(e,n,r,o)=>an(n,o)}}function KV([t,e],[n,r],o,i){let s=n-t,a=r-e,c=Math.hypot(s,a),f=i*Math.sqrt(o*o-c*c/4)/c;return[(t+n)/2-a*f,(e+r)/2+s*f]}function iO([t,e,n],[r,o,i],s){let a=r-t,c=o-e,f=Math.hypot(a,c),l=(a*a+c*c-i*i+n*n)/(2*f),u=s*Math.sqrt(n*n-l*l);return[t+(a*l+c*u)/f,e+(c*l-a*u)/f]}function sO(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=od(e,n,r),[i,s]=od(o,i,s),new id(t,{...a,x1:n,x2:r,y1:i,y2:s})}var tW={ariaLabel:"bar"},Bf=class extends pt{constructor(e,n,r={},o=tW){super(e,n,r,o),Wp(this,r),Hp(this,r)}render(e,n,r,o,i){let{rx:s,ry:a,rx1y1:c,rx1y2:f,rx2y1:l,rx2y2:u}=this,p=this._x(n,r,o),d=this._y(n,r,o),h=this._width(n,r,o),m=this._height(n,r,o);return st("svg:g",i).call(xt,this,o,i).call(this._transform,this,n).call(g=>g.selectAll().data(e).enter().call(c||f||l||u?y=>y.append("path").call(dt,this).call(Zp,p,d,aO(p,h),aO(d,m),this).call(Tt,this,r):y=>y.append("rect").call(dt,this).attr("x",p).attr("width",h).attr("y",d).attr("height",m).call(at,"rx",s).call(at,"ry",a).call(Tt,this,r))).node()}_x(e,{x:n},{marginLeft:r}){let{insetLeft:o}=this;return n?i=>n[i]+o:r+o}_y(e,{y:n},{marginTop:r}){let{insetTop:o}=this;return n?i=>n[i]+o:r+o}_width({x:e},{x:n},{marginRight:r,marginLeft:o,width:i}){let{insetLeft:s,insetRight:a}=this,c=n&&e?e.bandwidth():i-r-o;return Math.max(0,c-s-a)}_height({y:e},{y:n},{marginTop:r,marginBottom:o,height:i}){let{insetTop:s,insetBottom:a}=this,c=n&&e?e.bandwidth():i-r-o;return Math.max(0,c-s-a)}};function aO(t,e){return typeof t=="function"&&typeof e=="function"?n=>t(n)+e(n):typeof t=="function"?n=>t(n)+e:typeof e=="function"?n=>t+e(n):t+e}var qa=class extends Bf{constructor(e,n={},r){let{x1:o,x2:i,y:s}=n;super(e,{x1:{value:o,scale:"x"},x2:{value:i,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},n,r)}_transform(e,n,{x:r}){e.call(mt,n,{x:r},0,0)}_x({x:e},{x1:n,x2:r},{marginLeft:o}){let{insetLeft:i}=this;return Gn(e)?o+i:s=>Math.min(n[s],r[s])+i}_width({x:e},{x1:n,x2:r},{marginRight:o,marginLeft:i,width:s}){let{insetLeft:a,insetRight:c}=this;return Gn(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}},Ba=class extends Bf{constructor(e,n={},r){let{x:o,y1:i,y2:s}=n;super(e,{y1:{value:i,scale:"y"},y2:{value:s,scale:"y"},x:{value:o,scale:"x",type:"band",optional:!0}},n,r)}_transform(e,n,{y:r}){e.call(mt,n,{y:r},0,0)}_y({y:e},{y1:n,y2:r},{marginTop:o}){let{insetTop:i}=this;return Gn(e)?o+i:s=>Math.min(n[s],r[s])+i}_height({y:e},{y1:n,y2:r},{marginTop:o,marginBottom:i,height:s}){let{insetTop:a,insetBottom:c}=this;return Gn(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}};function bo(t,e={}){return si(e)||(e={...e,y:Xt,x2:V}),new qa(t,ms(If(ds(e))))}function wo(t,e={}){return si(e)||(e={...e,x:Xt,y2:V}),new Ba(t,gs($f(hs(e))))}var eW={ariaLabel:"cell"},za=class extends Bf{constructor(e,{x:n,y:r,...o}={}){super(e,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},o,eW)}_transform(e,n){e.call(mt,n,{},0,0)}};function bs(t,{x:e,y:n,...r}={}){return[e,n]=ae(e,n),new za(t,{...r,x:e,y:n})}function cO(t,{x:e=Xt,fill:n,stroke:r,...o}={}){return n===void 0&&ee(r)[0]===void 0&&(n=V),new za(t,{...o,x:e,fill:n,stroke:r})}function fO(t,{y:e=Xt,fill:n,stroke:r,...o}={}){return n===void 0&&ee(r)[0]===void 0&&(n=V),new za(t,{...o,y:e,fill:n,stroke:r})}var nW={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function sd(t){return t.sort===void 0&&t.reverse===void 0?Uy({channel:"-r"},t):t}var Ya=class extends pt{constructor(e,n={}){let{x:r,y:o,r:i,rotate:s,symbol:a=ni,frameAnchor:c}=n,[f,l]=Ft(s,0),[u,p]=yC(a),[d,h]=Ft(i,u==null?3:4.5);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:d,scale:"r",filter:bn,optional:!0},rotate:{value:f,optional:!0},symbol:{value:u,scale:"auto",optional:!0}},sd(n),nW),this.r=h,this.rotate=l,this.symbol=p,this.frameAnchor=fo(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:x}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,r:l,rotate:u,symbol:p}=r,{r:d,rotate:h,symbol:m}=this,[g,y]=Le(this,o),x=m===ni,b=l?void 0:d*d*Math.PI;return Vi(d)&&(e=[]),st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(w=>w.selectAll().data(e).enter().append(x?"circle":"path").call(dt,this).call(x?_=>{_.attr("cx",c?v=>c[v]:g).attr("cy",f?v=>f[v]:y).attr("r",l?v=>l[v]:d)}:_=>{_.attr("transform",$r`translate(${c?v=>c[v]:g},${f?v=>f[v]:y})${u?v=>` rotate(${u[v]})`:h?` rotate(${h})`:""}`).attr("d",l&&p?v=>{let A=hn();return p[v].draw(A,l[v]*l[v]*Math.PI),A}:l?v=>{let A=hn();return m.draw(A,l[v]*l[v]*Math.PI),A}:p?v=>{let A=hn();return p[v].draw(A,b),A}:(()=>{let v=hn();return m.draw(v,b),v})())}).call(Tt,this,r)).node()}};function mr(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new Ya(t,{...r,x:e,y:n})}function lO(t,{x:e=V,...n}={}){return new Ya(t,dx({...n,x:e}))}function uO(t,{y:e=V,...n}={}){return new Ya(t,px({...n,y:e}))}function pO(t,e){return mr(t,{...e,symbol:"circle"})}function dO(t,e){return mr(t,{...e,symbol:"hexagon"})}var rW={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Ua=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i,curve:s,tension:a}=n;super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y"},z:{value:nn(n),optional:!0}},n,rW),this.z=i,this.curve=Px(s,a),Ir(this,n)}filter(e){return e}project(e,n,r){this.curve!==ys&&super.project(e,n,r)}render(e,n,r,o,i){let{x:s,y:a}=r,{curve:c}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(f=>f.selectAll().data(fx(e,[s,a],this,r)).enter().append("path").call(dt,this).call(Ca,this,r).call(Uk,this,r,i).attr("d",c===ys&&i.projection?oW(i.projection,s,a):fp().curve(c).defined(l=>l>=0).x(l=>s[l]).y(l=>a[l]))).node()}};function oW(t,e,n){let r=Ie(t);return e=xe(e),n=xe(n),o=>{let i=[],s=[i];for(let a of o)a===-1?(i=[],s.push(i)):i.push([e[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function ja(t,{x:e,y:n,...r}={}){return[e,n]=ae(e,n),new Ua(t,{...r,x:e,y:n})}function ws(t,{x:e=V,y:n=Xt,...r}={}){return new Ua(t,qf({...r,x:e,y:n}))}function vs(t,{x:e=Xt,y:n=V,...r}={}){return new Ua(t,Ff({...r,x:e,y:n}))}function E3(t,e){e=iW(e);let{x:n,y:r,color:o,size:i}=e,s=Bx(t,n),a=Bx(t,r),c=Bx(t,o),f=Bx(t,i),{fx:l,fy:u,x:{value:p,reduce:d,zero:h,...m},y:{value:g,reduce:y,zero:x,...b},color:{value:w,color:_,reduce:v},size:{value:A,reduce:E},mark:T}=e;if(d===void 0&&(d=y==null&&p==null&&A==null&&g!=null?"count":null),y===void 0&&(y=d==null&&g==null&&A==null&&p!=null?"count":null),E===void 0&&A==null&&v==null&&d==null&&y==null&&(p==null||Kt(s))&&(g==null||Kt(a))&&(E="count"),h===void 0&&(h=zx(d)?!0:void 0),x===void 0&&(x=zx(y)?!0:void 0),p==null&&g==null)throw new Error("must specify x or y");if(d!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&p==null)throw new Error("reducing y requires x");T===void 0&&(T=A!=null||E!=null?"dot":zx(d)||zx(y)||v!=null?"bar":p!=null&&g!=null?Kt(s)||Kt(a)||d==null&&y==null&&!ad(s)&&!ad(a)?"dot":"line":p!=null||g!=null?"rule":null);let $,M,k;switch(T){case"dot":k=mr,M="stroke";break;case"line":k=s&&a||d!=null||y!=null?x||y!=null||s&&ad(s)?vs:h||d!=null||a&&ad(a)?ws:ja:s?ws:vs,M="stroke",mO(c)&&($=null);break;case"area":k=!(x||y!=null)&&(h||d!=null||a&&ad(a))?xs:xi,M="fill",mO(c)&&($=null);break;case"rule":k=s?Vn:Wn,M="stroke";break;case"bar":k=d!=null?Kt(a)?hO(d)&&s&&Kt(s)?bs:bo:Rf:y!=null?Kt(s)?hO(y)&&a&&Kt(a)?bs:wo:Lf:v!=null||E!=null?s&&Kt(s)&&a&&Kt(a)?bs:s&&Kt(s)?wo:a&&Kt(a)?bo:Qp:s&&ci(s)&&!(a&&ci(a))?bo:a&&ci(a)&&!(s&&ci(s))?wo:bs,M="fill";break;default:throw new Error(`invalid mark: ${T}`)}let R={fx:l,fy:u,x:s??void 0,y:a??void 0,[M]:c??_,z:$,r:f??void 0,tip:!0},S,I={[M]:v??void 0,r:E??void 0};if(d!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(I.y=y,S=Kt(s)?rs:yo):d!=null?(I.x=d,S=Kt(a)?os:xo):(v!=null||E!=null)&&(s&&a?S=Kt(s)&&Kt(a)?Lp:Kt(s)?xo:Kt(a)?yo:yi:s?S=Kt(s)?rs:yo:a&&(S=Kt(a)?os:xo)),(S===yi||S===yo)&&(R.x={value:s,...m}),(S===yi||S===xo)&&(R.y={value:a,...b}),h===void 0&&(h=s&&!(S===yi||S===yo)&&(k===bo||k===xs||k===Rf||k===Wn)),x===void 0&&(x=a&&!(S===yi||S===xo)&&(k===wo||k===xi||k===Lf||k===Vn)),{fx:l??null,fy:u??null,x:{value:p??null,reduce:d??null,zero:!!h,...m},y:{value:g??null,reduce:y??null,zero:!!x,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:A??null,reduce:E??null},mark:T,markImpl:gO[k],markOptions:R,transformImpl:gO[S],transformOptions:I,colorMode:M}}function yO(t,e){let n=E3(t,e),{fx:r,fy:o,x:{zero:i},y:{zero:s},markOptions:a,transformOptions:c,colorMode:f}=n,l=T3[n.markImpl],u=T3[n.transformImpl],p=r!=null||o!=null?Df({strokeOpacity:.1}):null,d=[i?Vn([0]):null,s?Wn([0]):null],h=l(t,u?u(c,a):a);return f==="stroke"?we(p,d,h):we(p,h,d)}function ad(t){let e,n;for(let r of t){if(r==null)continue;if(e===void 0){e=r;continue}let o=Math.sign(gt(e,r));if(o){if(n!==void 0&&o!==n)return!1;e=r,n=o}}return!0}function iW({x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}={}){return jn(t)||(t=zf(t)),jn(e)||(e=zf(e)),jn(n)||(n=ns(n)?{color:n}:zf(n)),jn(r)||(r=zf(r)),jn(o)&&({value:o}=zf(o)),jn(i)&&({value:i}=zf(i)),s!=null&&(s=`${s}`.toLowerCase()),{x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}}function Bx(t,e){let n=ut(t,e.value);return n&&(n.label=Ve(e.value)),n}function zf(t){return sW(t)?{reduce:t}:{value:t}}function zx(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function hO(t){return/^(?:first|last|mode)$/i.test(t)}function sW(t){if(t==null)return!1;if(typeof t.reduceIndex=="function"||typeof t.reduce=="function"&&Ne(t)||/^p\d{2}$/i.test(t))return!0;switch(`${t}`.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 mO(t){return t?new fn(t).size>t.length>>1:!1}var T3={dot:mr,line:ja,lineX:ws,lineY:vs,areaX:xs,areaY:xi,ruleX:Vn,ruleY:Wn,barX:bo,barY:wo,rect:Qp,rectX:Rf,rectY:Lf,cell:bs,bin:yi,binX:yo,binY:xo,group:Lp,groupX:rs,groupY:os},gO=Object.fromEntries(Object.entries(T3).map(([t,e])=>[e,t]));function Yf(t,e={}){let{x:n,x1:r,x2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,x:n=V});let i={};return n!=null&&(i.x=t),r!=null&&(i.x1=t),o!=null&&(i.x2=t),kn(i,e)}function Uf(t,e={}){let{y:n,y1:r,y2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,y:n=V});let i={};return n!=null&&(i.y=t),r!=null&&(i.y1=t),o!=null&&(i.y2=t),kn(i,e)}function kn(t={},e={}){let n=nn(e),r=Object.entries(t).map(([o,i])=>{let s=Py(o,e);if(s==null)throw new Error(`missing channel: ${o}`);let[a,c]=Oe(s);return{key:o,input:s,output:a,setOutput:c,map:aW(i)}});return{...be(e,(o,i)=>{let s=ut(o,n),a=r.map(({input:f})=>ut(o,f)),c=r.map(({setOutput:f})=>f(new Array(o.length)));for(let f of i)for(let l of s?ze(f,u=>s[u]).values():[f])r.forEach(({map:u},p)=>u.mapIndex(l,a[p],c[p]));return{data:o,facets:i}}),...Object.fromEntries(r.map(({key:o,output:i})=>[o,i]))}}function aW(t){if(t==null)throw new Error("missing map");if(typeof t.mapIndex=="function")return t;if(typeof t.map=="function"&&Ne(t))return cW(t);if(typeof t=="function")return I3(df(t));switch(`${t}`.toLowerCase()){case"cumsum":return lW;case"rank":return I3((e,n)=>Zl(e,r=>n[r]));case"quantile":return I3((e,n)=>fW(e,r=>n[r]))}throw new Error(`invalid map: ${t}`)}function cW(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}function fW(t,e){let n=Br(t,e)-1;return Zl(t,e).map(r=>r/n)}function I3(t){return{mapIndex(e,n,r){let o=t(e,n);if(o.length!==e.length)throw new Error("map function returned a mismatched length");for(let i=0,s=e.length;i<s;++i)r[e[i]]=o[i]}}}var lW={mapIndex(t,e,n){let r=0;for(let o of t)n[o]=r+=e[o]}};function xO(t={},e){return arguments.length===1&&(e=t),Yf(jf(t),e)}function bO(t={},e){return arguments.length===1&&(e=t),Uf(jf(t),e)}function jf(t={}){typeof t=="number"&&(t={k:t});let{k:e,reduce:n,shift:r,anchor:o,strict:i}=t;if(o===void 0&&r!==void 0&&(o=pW(r),rn(`Warning: the shift option is deprecated; please use anchor "${o}" instead.`)),!((e=Math.floor(e))>0))throw new Error(`invalid k: ${e}`);return dW(n)(e,uW(o,e),i)}function uW(t="middle",e){switch(`${t}`.toLowerCase()){case"middle":return e-1>>1;case"start":return 0;case"end":return e-1}throw new Error(`invalid anchor: ${t}`)}function pW(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}function dW(t="mean"){if(typeof t=="string"){if(/^p\d{2}$/i.test(t))return Yx(pf(t));switch(t.toLowerCase()){case"deviation":return Yx(nr);case"max":return Ux((e,n)=>Ct(e,r=>n[r]));case"mean":return hW;case"median":return Yx(_r);case"min":return Ux((e,n)=>Bt(e,r=>n[r]));case"mode":return Ux((e,n)=>wc(e,r=>n[r]));case"sum":return wO;case"variance":return Yx(ki);case"difference":return yW;case"ratio":return xW;case"first":return bW;case"last":return wW}}if(typeof t!="function")throw new Error(`invalid reduce: ${t}`);return Ux(df(t))}function Yx(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=f=>i[f]==null?NaN:+i[f],c=0;for(let f=0;f<e-1;++f)isNaN(a(f))&&++c;for(let f=0,l=o.length-e+1;f<l;++f)isNaN(a(f+e-1))&&++c,s[o[f+n]]=c===0?t(ai(o,f,f+e),a):NaN,isNaN(a(f))&&--c}}:{mapIndex(o,i,s){let a=c=>i[c]==null?NaN:+i[c];for(let c=-n;c<0;++c)s[o[c+n]]=t(ai(o,0,c+e),a);for(let c=0,f=o.length-n;c<f;++c)s[o[c+n]]=t(ai(o,c,c+e),a)}}}function Ux(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=0;for(let c=0;c<e-1;++c)a+=Jt(i[o[c]]);for(let c=0,f=o.length-e+1;c<f;++c)a+=Jt(i[o[c+e-1]]),a===e&&(s[o[c+n]]=t(ai(o,c,c+e),i)),a-=Jt(i[o[c]])}}:{mapIndex(o,i,s){for(let a=-n;a<0;++a)s[o[a+n]]=t(ai(o,0,a+e),i);for(let a=0,c=o.length-n;a<c;++a)s[o[a+n]]=t(ai(o,a,a+e),i)}}}function wO(t,e,n){return n?{mapIndex(r,o,i){let s=0,a=0;for(let c=0;c<t-1;++c){let f=o[r[c]];f===null||isNaN(f)?++s:a+=+f}for(let c=0,f=r.length-t+1;c<f;++c){let l=o[r[c]],u=o[r[c+t-1]];u===null||isNaN(u)?++s:a+=+u,i[r[c+e]]=s===0?a:NaN,l===null||isNaN(l)?--s:a-=+l}}}:{mapIndex(r,o,i){let s=0,a=r.length;for(let c=0,f=Math.min(a,t-e-1);c<f;++c)s+=+o[r[c]]||0;for(let c=-e,f=a-e;c<f;++c)s+=+o[r[c+t-1]]||0,i[r[c+e]]=s,s-=+o[r[c]]||0}}}function hW(t,e,n){if(n){let r=wO(t,e,n);return{mapIndex(o,i,s){r.mapIndex(o,i,s);for(let a=0,c=o.length-t+1;a<c;++a)s[o[a+e]]/=t}}}else return{mapIndex(r,o,i){let s=0,a=0,c=r.length;for(let f=0,l=Math.min(c,t-e-1);f<l;++f){let u=o[r[f]];u!==null&&!isNaN(u=+u)&&(s+=u,++a)}for(let f=-e,l=c-e;f<l;++f){let u=o[r[f+t-1]],p=o[r[f]];u!==null&&!isNaN(u=+u)&&(s+=u,++a),i[r[f+e]]=s/a,p!==null&&!isNaN(p=+p)&&(s-=p,--a)}}}}function mW(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(Jt(i))return i}}function gW(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(Jt(i))return i}}function vO(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(i!==null&&!isNaN(i=+i))return i}}function _O(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(i!==null&&!isNaN(i=+i))return i}}function yW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s){let c=o[r[s]],f=o[r[s+t-1]];i[r[s+e]]=c===null||f===null?NaN:f-c}}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=_O(o,r,s,t)-vO(o,r,s,t)}}}function xW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s){let c=o[r[s]],f=o[r[s+t-1]];i[r[s+e]]=c===null||f===null?NaN:f/c}}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=_O(o,r,s,t)/vO(o,r,s,t)}}}function bW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s)i[r[s+e]]=o[r[s]]}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=mW(o,r,s,t)}}}function wW(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s)i[r[s+e]]=o[r[s+t-1]]}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=gW(o,r,s,t)}}}var bi={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function SO(t,{x:e=V,y:n,k:r=bi.k,color:o=bi.color,opacity:i=bi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:l,...u}={}){return we(Pt(s)?null:xs(t,kn({x1:_s({k:-r,...u}),x2:_s({k:r,...u})},{x1:e,x2:e,y:n,fill:s,fillOpacity:a,...u})),Pt(c)?null:ws(t,kn({x:_s(u)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:l,...u})))}function MO(t,{x:e,y:n=V,k:r=bi.k,color:o=bi.color,opacity:i=bi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:l,...u}={}){return we(Pt(s)?null:xi(t,kn({y1:_s({k:-r,...u}),y2:_s({k:r,...u})},{x:e,y1:n,y2:n,fill:s,fillOpacity:a,...u})),Pt(c)?null:vs(t,kn({y:_s(u)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:l,...u})))}function _s({n:t=bi.n,k:e=0,strict:n=bi.strict,anchor:r=bi.anchor}={}){return jf({k:t,reduce:o=>Fo(o)+e*(nr(o)||0),strict:n,anchor:r})}var vW={ariaLabel:"tick",fill:null,stroke:"currentColor"},jx=class extends pt{constructor(e,n,r){super(e,n,r,vW),Ir(this,r)}render(e,n,r,o,i){return st("svg:g",i).call(xt,this,o,i).call(this._transform,this,n).call(s=>s.selectAll().data(e).enter().append("line").call(dt,this).attr("x1",this._x1(n,r,o)).attr("x2",this._x2(n,r,o)).attr("y1",this._y1(n,r,o)).attr("y2",this._y2(n,r,o)).call(Tt,this,r).call(gi,this,r,i)).node()}},cd=class extends jx{constructor(e,n={}){let{x:r,y:o,inset:i=0,insetTop:s=i,insetBottom:a=i}=n;super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n),this.insetTop=Ot(s),this.insetBottom=Ot(a)}_transform(e,n,{x:r}){e.call(mt,n,{x:r},oe,0)}_x1(e,{x:n}){return r=>n[r]}_x2(e,{x:n}){return r=>n[r]}_y1({y:e},{y:n},{marginTop:r}){let{insetTop:o}=this;return n&&e?i=>n[i]+o:r+o}_y2({y:e},{y:n},{height:r,marginBottom:o}){let{insetBottom:i}=this;return n&&e?s=>n[s]+e.bandwidth()-i:r-o-i}},fd=class extends jx{constructor(e,n={}){let{x:r,y:o,inset:i=0,insetRight:s=i,insetLeft:a=i}=n;super(e,{y:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=Ot(s),this.insetLeft=Ot(a)}_transform(e,n,{y:r}){e.call(mt,n,{y:r},0,oe)}_x1({x:e},{x:n},{marginLeft:r}){let{insetLeft:o}=this;return n&&e?i=>n[i]+o:r+o}_x2({x:e},{x:n},{width:r,marginRight:o}){let{insetRight:i}=this;return n&&e?s=>n[s]+e.bandwidth()-i:r-o-i}_y1(e,{y:n}){return r=>n[r]}_y2(e,{y:n}){return r=>n[r]}};function Xx(t,{x:e=V,...n}={}){return new cd(t,{...n,x:e})}function Gx(t,{y:e=V,...n}={}){return new fd(t,{...n,y:e})}function AO(t,{x:e=V,y:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...l}={}){let u=n!=null?os:Rp;return we(Wn(t,u({x1:$3,x2:C3},{x:e,y:n,stroke:s,strokeOpacity:a,...l})),bo(t,u({x1:"p25",x2:"p75"},{x:e,y:n,fill:o,fillOpacity:i,...l})),Xx(t,u({x:"p50"},{x:e,y:n,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...l})),mr(t,kn({x:EO},{x:e,y:n,z:n,r,stroke:s,strokeOpacity:a,...l})))}function TO(t,{y:e=V,x:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...l}={}){let u=n!=null?rs:Rp;return we(Vn(t,u({y1:$3,y2:C3},{x:n,y:e,stroke:s,strokeOpacity:a,...l})),wo(t,u({y1:"p25",y2:"p75"},{x:n,y:e,fill:o,fillOpacity:i,...l})),Gx(t,u({y:"p50"},{x:n,y:e,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...l})),mr(t,kn({y:EO},{x:n,y:e,z:n,r,stroke:s,strokeOpacity:a,...l})))}function EO(t){let e=$3(t),n=C3(t);return t.map(r=>r<e||r>n?r:NaN)}function $3(t){let e=IO(t)*2.5-$O(t)*1.5;return Bt(t,n=>n>=e?n:NaN)}function C3(t){let e=$O(t)*2.5-IO(t)*1.5;return Ct(t,n=>n<=e?n:NaN)}function IO(t){return ln(t,.25)}function $O(t){return ln(t,.75)}var _W={ariaLabel:"raster",stroke:null,pixelSize:1};function Xf(t,e){let n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function CO(t,e){let n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}var ud=class extends pt{constructor(e,n,r={},o){let{width:i,height:s,x:a,y:c,x1:f=a==null?0:void 0,y1:l=c==null?0:void 0,x2:u=a==null?i:void 0,y2:p=c==null?s:void 0,pixelSize:d=o.pixelSize,blur:h=0,interpolate:m}=r;if(i!=null&&(i=CO(i,"width")),s!=null&&(s=CO(s,"height")),f!=null&&(f=Xf(f,"x1")),l!=null&&(l=Xf(l,"y1")),u!=null&&(u=Xf(u,"x2")),p!=null&&(p=Xf(p,"y2")),a==null&&(f==null||u==null))throw new Error("missing x");if(c==null&&(l==null||p==null))throw new Error("missing y");e!=null&&i!=null&&s!=null&&(a===void 0&&f!=null&&u!=null&&(a=CW(f,u,i,s)),c===void 0&&l!=null&&p!=null&&(c=kW(l,p,i,s))),super(e,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y1:{value:l==null?null:[l],scale:"y",optional:!0,filter:null},x2:{value:u==null?null:[u],scale:"x",optional:!0,filter:null},y2:{value:p==null?null:[p],scale:"y",optional:!0,filter:null},...n},r,o),this.width=i,this.height=s,this.pixelSize=Xf(d,"pixelSize"),this.blur=Xf(h,"blur"),this.interpolate=a==null||c==null?null:SW(m)}},pd=class extends ud{constructor(e,n={}){let{imageRendering:r}=n;if(e==null){let{fill:o,fillOpacity:i}=n;Ft(i)[0]!==void 0&&(n=Vx("fillOpacity",n)),ee(o)[0]!==void 0&&(n=Vx("fill",n))}super(e,void 0,n,_W),this.imageRendering=Wt(r,"auto")}scale(e,{color:n,...r},o){return super.scale(e,r,o)}render(e,n,r,o,i){let s=n[r.channels.fill?.scale]??(I=>I),{x:a,y:c}=r,{document:f}=i,[l,u,p,d]=NO(r,o,i),h=p-l,m=d-u,{pixelSize:g,width:y=Math.round(Math.abs(h)/g),height:x=Math.round(Math.abs(m)/g)}=this,b=y*x,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let I=y/h,C=x/m,N=Et(a,L=>(L-l)*I,Float64Array),D=Et(c,L=>(L-u)*C,Float64Array);w&&(w=this.interpolate(e,y,x,N,D,w)),_&&(_=this.interpolate(e,y,x,N,D,_))}else this.data==null&&e&&(v=e.fi*b);let A=f.createElement("canvas");A.width=y,A.height=x;let E=A.getContext("2d"),T=E.createImageData(y,x),$=T.data,{r:M,g:k,b:R}=ve(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let I=0;I<b;++I){let C=I<<2;if(w){let N=s(w[I+v]);if(N==null){$[C+3]=0;continue}({r:M,g:k,b:R}=ve(N))}_&&(S=_[I+v]*255),$[C+0]=M,$[C+1]=k,$[C+2]=R,$[C+3]=S}return this.blur>0&&J2(T,this.blur),E.putImageData(T,0,0),st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(I=>I.append("image").attr("transform",`translate(${l},${u}) scale(${Math.sign(p-l)},${Math.sign(d-u)})`).attr("width",Math.abs(h)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(at,"image-rendering",this.imageRendering).call(dt,this).attr("xlink:href",A.toDataURL())).node()}};function k3(t,e,n){arguments.length<3&&(n=e,e=null);let{x:r,y:o,[t]:i,...s}=n;return r===void 0&&o===void 0&&iC(e)&&(r=Aa,o=Ji,i===void 0&&(i=eC)),[e,{...s,x:r,y:o,[t]:i}]}function kO(){let[t,e]=k3("fill",...arguments);return new pd(t,t==null||e.fill!==void 0||e.fillOpacity!==void 0?e:{...e,fill:V})}function NO({x1:t,y1:e,x2:n,y2:r},o,{projection:i}){let{width:s,height:a,marginTop:c,marginRight:f,marginBottom:l,marginLeft:u}=o;return[t&&i==null?t[0]:u,e&&i==null?e[0]:c,n&&i==null?n[0]:s-f,r&&i==null?r[0]:a-l]}function N3({x1:t,y1:e,x2:n,y2:r},o,i,s){let a={};return t&&(a.x1=t),e&&(a.y1=e),n&&(a.x2=n),r&&(a.y2=r),NO(wf(a,o),i,s)}function Vx(t,e={}){let{[t]:n}=e;if(typeof n!="function")throw new Error(`invalid ${t}: not a function`);return Vt({...e,[t]:void 0},function(r,o,i,s,a,c){let{x:f,y:l}=s;if(!f)throw new Error("missing scale: x");if(!l)throw new Error("missing scale: y");let[u,p,d,h]=N3(i,s,a,c),m=d-u,g=h-p,{pixelSize:y}=this,{width:x=Math.round(Math.abs(m)/y),height:b=Math.round(Math.abs(g)/y)}=e,w=new Array(x*b*(o?o.length:1)),_=m/x,v=g/b,A=0;for(let E of o??[void 0])for(let T=.5;T<b;++T)for(let $=.5;$<x;++$,++A)w[A]=n(f.invert(u+$*_),l.invert(p+T*v),E);return{data:w,facets:o,channels:{[t]:{value:w,scale:"auto"}}}})}function SW(t){if(typeof t=="function")return t;if(t==null)return Wx;switch(`${t}`.toLowerCase()){case"none":return Wx;case"nearest":return hd;case"barycentric":return dd();case"random-walk":return md()}throw new Error(`invalid interpolate: ${t}`)}function Wx(t,e,n,r,o,i){let s=new Array(e*n);for(let a of t)r[a]<0||r[a]>=e||o[a]<0||o[a]>=n||(s[Math.floor(o[a])*e+Math.floor(r[a])]=i[a]);return s}function dd({random:t=pa(42)}={}){return(e,n,r,o,i,s)=>{let{points:a,triangles:c,hull:f}=ir.from(e,d=>o[d],d=>i[d]),l=new s.constructor(n*r).fill(NaN),u=new Uint8Array(n*r),p=$W(s,t);for(let d=0;d<c.length;d+=3){let h=c[d],m=c[d+1],g=c[d+2],y=a[2*h],x=a[2*m],b=a[2*g],w=a[2*h+1],_=a[2*m+1],v=a[2*g+1],A=Math.min(y,x,b),E=Math.max(y,x,b),T=Math.min(w,_,v),$=Math.max(w,_,v),M=(_-v)*(y-b)+(w-v)*(b-x);if(!M)continue;let k=s[e[h]],R=s[e[m]],S=s[e[g]];for(let I=Math.floor(A);I<E;++I)for(let C=Math.floor(T);C<$;++C){if(I<0||I>=n||C<0||C>=r)continue;let N=I+.5,D=C+.5,L=Math.sign(M),P=(_-v)*(N-b)+(D-v)*(b-x);if(P*L<0)continue;let F=(v-w)*(N-b)+(D-v)*(y-b);if(F*L<0)continue;let q=M-(P+F);if(q*L<0)continue;let W=I+n*C;l[W]=p(k,P/M,R,F/M,S,q/M,I,C),u[W]=1}}return MW(l,u,o,i,s,n,r,f,e,p),l}}function MW(t,e,n,r,o,i,s,a,c,f){n=Float64Array.from(a,d=>n[c[d]]),r=Float64Array.from(a,d=>r[c[d]]),o=Array.from(a,d=>o[c[d]]);let l=n.length,u=Array.from({length:l},(d,h)=>TW(h,n,r)),p=0;for(let d=0;d<s;++d){let h=d+.5;for(let m=0;m<i;++m){let g=m+i*d;if(!e[g]){let y=m+.5;for(let x=0;x<l;++x){let b=(l+p+(x%2?(x+1)/2:-x/2))%l;if(u[b](y,h)){let w=AW(n.at(b-1),r.at(b-1),n[b],r[b],y,h);t[g]=f(o.at(b-1),w,o[b],1-w,o[b],0,m,d),p=b;break}}}}}}function AW(t,e,n,r,o,i){let s=n-t,a=r-e,c=s*(n-o)+a*(r-i),f=s*(o-t)+a*(i-e);return c>0&&f>0?c/(c+f):+(c>f)}function ld(t,e,n,r){return t*r-n*e}function TW(t,e,n){let r=e.length,o=e.at(t-2),i=n.at(t-2),s=e.at(t-1),a=n.at(t-1),c=e[t],f=n[t],l=e.at(t+1-r),u=n.at(t+1-r),p=s-c,d=a-f,h=o-s,m=i-a,g=c-l,y=f-u,x=Math.hypot(p,d),b=Math.hypot(h,m),w=Math.hypot(g,y);return(_,v)=>{let A=_-s,E=v-a,T=_-c,$=v-f;return ld(A,E,T,$)>-1e-6&&ld(A,E,p,d)*b-ld(A,E,h,m)*x>-1e-6&&ld(T,$,g,y)*x-ld(T,$,p,d)*w<=0}}function hd(t,e,n,r,o,i){let s=new i.constructor(e*n),a=ir.from(t,l=>r[l],l=>o[l]),c,f;for(let l=.5,u=0;l<n;++l){f=c;for(let p=.5;p<e;++p,++u)f=a.find(p,l,f),p===.5&&(c=f),s[u]=i[t[f]]}return s}function md({random:t=pa(42),minDistance:e=.5,maxSteps:n=2}={}){return(r,o,i,s,a,c)=>{let f=new c.constructor(o*i),l=ir.from(r,h=>s[h],h=>a[h]),u,p,d;for(let h=.5,m=0;h<i;++h){p=u;for(let g=.5;g<o;++g,++m){let y=g,x=h;d=p=l.find(y,x,p),g===.5&&(u=p);let b,w=0;for(;(b=Math.hypot(s[r[d]]-y,a[r[d]]-x))>e&&w<n;){let _=t(g,h,w)*2*Math.PI;y+=Math.cos(_)*b,x+=Math.sin(_)*b,d=l.find(y,x,d),++w}f[m]=c[r[d]]}}return f}}function EW(t,e,n,r,o,i){return e*t+r*n+i*o}function IW(t){return(e,n,r,o,i,s,a,c)=>{let f=t(a,c);return f<n?e:f<n+o?r:i}}function $W(t,e){return ci(t)||ne(t)?EW:IW(e)}function CW(t,e,n){return{transform(r){let o=r.length,i=new Float64Array(o),s=(e-t)/n,a=t+s/2;for(let c=0;c<o;++c)i[c]=c%n*s+a;return i}}}function kW(t,e,n,r){return{transform(o){let i=o.length,s=new Float64Array(i),a=(e-t)/r,c=t+a/2;for(let f=0;f<i;++f)s[f]=Math.floor(f/n)%r*a+c;return s}}}var OO={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},gd=class extends ud{constructor(e,{smooth:n=!0,value:r,...o}={}){let i=cx({},o,OO);if(r===void 0){for(let a in i)if(i[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=o[a],o[a]="value"}}if(r!=null){let a={transform:c=>c.map(f=>f.value),label:Ve(r)};for(let c in i)o[c]==="value"&&(o[c]=a)}if(e==null){if(r==null)throw new Error("missing contour value");o=Vx("value",{value:r,...o}),r=null}else{let{interpolate:a}=o;r===void 0&&(r=V),a===void 0&&(o.interpolate="nearest")}super(e,{value:{value:r,optional:!0}},NW(o),OO);let s={geometry:{value:V}};for(let a in this.channels){let c=this.channels[a],{scale:f}=c;f==="x"||f==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(e,{x:n,y:r,value:o,...i},s){return super.filter(e,i,s)}render(e,n,r,o,i){let{geometry:s}=r,a=Ie();return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(c=>{c.selectAll().data(e).enter().append("path").call(dt,this).attr("d",f=>a(s[f])).call(Tt,this,r)}).node()}};function NW({thresholds:t,interval:e,...n}){return t=M3(t,e,Ni),Vt(n,function(r,o,i,s,a,c){let[f,l,u,p]=N3(i,s,a,c),d=u-f,h=p-l,{pixelSize:m,width:g=Math.round(Math.abs(d)/m),height:y=Math.round(Math.abs(h)/m)}=this,x=g/d,b=y/h,w=i.value.value,_=[];if(this.interpolate){let{x:$,y:M}=ho(i,s,c),k=Et($,C=>(C-f)*x,Float64Array),R=Et(M,C=>(C-l)*b,Float64Array),S=[i.x,i.y,i.value],I=[k,R,w];for(let C of o){let N=this.filter(C,S,I);_.push(this.interpolate(N,g,y,k,R,w))}}else if(o){let $=g*y,M=o.length;for(let k=0;k<M;++k)_.push(w.slice(k*$,k*$+$))}else _.push(w);if(this.blur>0)for(let $ of _)Xl({data:$,width:g,height:y},this.blur);let v=OW(t,w,...RW(_));if(v===null)throw new Error(`unsupported thresholds: ${t}`);let{contour:A}=qi().size([g,y]).smooth(this.smooth),E=[],T=[];for(let $ of _)T.push(ce(E.length,E.push(...Et(v,M=>A($,M)))));for(let{coordinates:$}of E)for(let M of $)for(let k of M)for(let R of k)R[0]=R[0]/x+f,R[1]=R[1]/b+l;return{data:E,facets:T,channels:Hy(this.contourChannels,E)}})}function OW(t,e,n,r){if(typeof t?.range=="function")return t.range(t.floor(n),r);if(typeof t=="function"&&(t=t(e,n,r)),typeof t!="number")return Un(t);let o=Ye(...xc(n,r,t),t);for(;o[o.length-1]>=r;)o.pop();for(;o[1]<n;)o.shift();return o}function LO(){return new gd(...k3("value",...arguments))}function RW(t){return[Bt(t,e=>Bt(e,RO)),Ct(t,e=>Ct(e,RO))]}function RO(t){return isFinite(t)?t:NaN}function FO(t,e){return O3(ls,t,e)}function qO(t,e={}){return O3(us,t,e)}function BO(t,e={}){return O3(mi,t,e)}function O3(t,e,n={}){let{x:r,y:o,maxRadius:i}=n,s=t({px:r,py:o,maxRadius:i}),a=[];r!=null&&a.push(Vn(e,DO("x",{...s,inset:-6},n))),o!=null&&a.push(Wn(e,DO("y",{...s,inset:-6},n))),r!=null&&a.push(go(e,PO("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),o!=null&&a.push(go(e,PO("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return we(...a)}function zO(t,{channels:e,...n},{facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:c,transform:f,initializer:l}){return{...n,facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:{...e,...c},transform:f,initializer:LW(t,l)}}function LW(t,e){return e==null?e:function(n,r,{x:o,y:i,px:s,py:a,...c},...f){let{channels:{x:l,y:u,...p}={},...d}=e.call(this,n,r,{...c,x:s,y:a},...f);return{channels:{...p,...l&&{px:l,...t==="x"&&{x:l}},...u&&{py:u,...t==="y"&&{y:u}}},...d}}}function DO(t,e,n){let{color:r="currentColor",opacity:o=.2,ruleStroke:i=r,ruleStrokeOpacity:s=o,ruleStrokeWidth:a}=n;return{...zO(t,e,n),stroke:i,strokeOpacity:s,strokeWidth:a}}function PO(t,e,n){let{color:r="currentColor",textFill:o=r,textFillOpacity:i,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...zO(t,e,DW(t,n)),fill:o,fillOpacity:i,stroke:s,strokeOpacity:a,strokeWidth:c}}function DW(t,e){return Vt(e,(n,r,o)=>({channels:{text:{value:Pp(o,t)?.value}}}))}var PW={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},FW={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},qW={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},BW={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},zW={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},R3=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i,curve:s,tension:a}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:i,optional:!0}},n,PW),this.curve=ed(s,a),Ir(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:l}=r,{curve:u}=this,[p,d]=Le(this,o),h=c?x=>c[x]:re(p),m=f?x=>f[x]:re(d),g=this;function y(x){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],A=[],E=[],T=[];function $(S,I){S=x[S],I=x[I],w.push(++b),v[b]=h(S),E[b]=m(S),A[b]=h(I),T[b]=m(I);for(let C in r)_[C].push(r[C][I])}let{halfedges:M,hull:k,triangles:R}=ir.from(x,h,m);for(let S=0;S<M.length;++S){let I=M[S];I>S&&$(R[S],R[I])}for(let S=0;S<k.length;++S)$(k[S],k[(S+1)%k.length]);St(this).selectAll().data(w).enter().append("path").call(dt,g).attr("d",S=>{let I=hn(),C=u(I);return C.lineStart(),C.point(v[S],E[S]),C.point(A[S],T[S]),C.lineEnd(),I}).call(Tt,g,_).call(gi,g,_,i)}return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(l?x=>x.selectAll().data(ze(e,b=>l[b]).values()).enter().append("g").each(y):x=>x.datum(e).each(y)).node()}},yd=class extends pt{constructor(e,n={},r,o=({z:i})=>i){let{x:i,y:s}=n;super(e,{x:{value:i,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:o(n),optional:!0}},n,r)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:l}=r,[u,p]=Le(this,o),d=c?y=>c[y]:re(u),h=f?y=>f[y]:re(p),m=this;function g(y){let x=ir.from(y,d,h);St(this).append("path").datum(y[0]).call(dt,m).attr("d",m._render(x,o)).call(Tt,m,r)}return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(l?y=>y.selectAll().data(ze(e,x=>l[x]).values()).enter().append("g").each(g):y=>y.datum(e).each(g)).node()}},L3=class extends yd{constructor(e,n={}){super(e,n,FW),this.fill="none"}_render(e){return e.render()}},D3=class extends yd{constructor(e,n={}){super(e,n,qW,nn)}_render(e){return e.renderHull()}},P3=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:i,optional:!0}},Vt(n,function(s,a,c,f,l,u){let{x:p,y:d,z:h}=c;({x:p,y:d}=ho(c,f,u)),h=h?.value;let m=new Array((p??d).length).fill(null),[g,y]=Le(this,l),x=p?w=>p[w]:re(g),b=d?w=>d[w]:re(y);for(let w of a){p&&(w=w.filter(_=>Jt(x(_)))),d&&(w=w.filter(_=>Jt(b(_))));for(let[,_]of lo(w,h)){let v=ir.from(_,x,b),A=YO(v,l);for(let E=0,T=_.length;E<T;++E)m[_[E]]=A.renderCell(E)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),BW)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,cells:l}=r;return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(u=>{u.selectAll().data(e).enter().append("path").call(dt,this).attr("d",p=>l[p]).call(Tt,this,r)}).node()}},F3=class extends yd{constructor(e,n){super(e,n,zW),this.fill="none"}_render(e,n){return YO(e,n).render()}};function YO(t,e){let{width:n,height:r,marginTop:o,marginRight:i,marginBottom:s,marginLeft:a}=e;return t.voronoi([a,o,n-i,r-s])}function xd(t,e,{x:n,y:r,...o}={}){return[n,r]=ae(n,r),new t(e,{...o,x:n,y:r})}function UO(t,e){return xd(R3,t,e)}function jO(t,e){return xd(L3,t,e)}function XO(t,e){return xd(D3,t,e)}function GO(t,{x:e,y:n,initializer:r,...o}={}){return xd(P3,t,{...be({...o,x:e,y:n},Ix),initializer:r})}function VO(t,e){return xd(F3,t,e)}var YW={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},bd=class extends pt{constructor(e,{x:n,y:r,z:o,weight:i,fill:s,stroke:a,...c}={}){let f=WO(s)&&(s="currentColor",!0),l=WO(a)&&(a="currentColor",!0);super(e,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:nn({z:o,fill:s,stroke:a}),optional:!0},weight:{value:i,optional:!0}},jW({...c,fill:s,stroke:a},f,l),YW),f&&(this.fill=void 0),l&&(this.stroke=void 0),this.z=o}filter(e){return e}render(e,n,r,o,i){let{contours:s}=r,a=Ie();return st("svg:g",i).call(xt,this,o,i).call(mt,this,{}).call(c=>c.selectAll().data(e).enter().append("path").call(dt,this).call(Tt,this,r).attr("d",f=>a(s[f]))).node()}};function HO(t,{x:e,y:n,...r}={}){return[e,n]=ae(e,n),new bd(t,{...r,x:e,y:n})}var UW=new Set(["x","y","z","weight"]);function jW(t,e,n){let{bandwidth:o,thresholds:i}=t;return o=o===void 0?20:+o,i=i===void 0?20:typeof i?.[Symbol.iterator]=="function"?xe(i):+i,Vt(t,function(s,a,c,f,l,u){let p=c.weight?xe(c.weight.value):null,d=c.z?.value,{z:h}=this,[m,g]=Le(this,l),{width:y,height:x}=l,{x:b,y:w}=ho(c,f,u),_=Object.fromEntries(Object.entries(c).filter(([R])=>!UW.has(R)).map(([R,S])=>[R,{...S,value:[]}])),v=e&&[],A=n&&[],E=Bw().x(b?R=>b[R]:m).y(w?R=>w[R]:g).weight(p?R=>p[R]:1).size([y,x]).bandwidth(o),T=[];for(let R of a){let S=[];T.push(S);for(let I of d?Yp(R,d,h):[R]){let C=E.contours(I);S.push([I,C])}}let $=i;if(!($ instanceof $p)){let R=0;for(let S of T)for(let[,I]of S){let C=I.max;C>R&&(R=C)}$=Float64Array.from({length:i-1},(S,I)=>R*100*(I+1)/i)}let M=[],k=[];for(let R of T){let S=[];M.push(S);for(let[I,C]of R)for(let N of $){S.push(k.length),k.push(C(N/100)),v&&v.push(N),A&&A.push(N);for(let D in _)_[D].value.push(c[D].value[I[0]])}}return v&&v.push(0),A&&A.push(0),{data:s,facets:M,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...A&&{stroke:{value:A,scale:"color"}},contours:{value:k}}}})}function WO(t){return/^density$/i.test(t)}function JO(t,e){return tR("x",t,e)}function KO(t,e){return tR("y",t,e)}function tR(t,e,{x1:n,x2:r,y1:o,y2:i,x:s=n===void 0&&r===void 0?t==="y"?Xt:V:void 0,y:a=o===void 0&&i===void 0?t==="x"?Xt:V:void 0,fill:c,positiveFill:f="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:p=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:m,z:g=ee(h)[0],clip:y,tip:x,render:b,...w}={}){return[n,r]=ZO(s,n,r),[o,i]=ZO(a,o,i),n===r&&o===i&&(t==="y"?o=wi(0):n=wi(0)),{tip:x}=Er({tip:x},t==="y"?"x":"y"),we(Pt(f)?null:Object.assign(nd(e,{x1:n,x2:r,y1:o,y2:i,z:g,fill:f,fillOpacity:p,render:hi(b,QO(t,!0)),clip:y,...w}),{ariaLabel:"positive difference"}),Pt(l)?null:Object.assign(nd(e,{x1:n,x2:r,y1:o,y2:i,z:g,fill:l,fillOpacity:d,render:hi(b,QO(t,!1)),clip:y,...w}),{ariaLabel:"negative difference"}),ja(e,{x:r,y:i,z:g,stroke:h,strokeOpacity:m,tip:x,clip:!0,...w}))}function ZO(t,e,n){return e===void 0&&n===void 0?e=n=wi(t):e===void 0?(n=wi(n),e=t===void 0?n:wi(t)):n===void 0?(e=wi(e),n=t===void 0?e:wi(t)):(e=wi(e),n=wi(n)),[e,n]}function wi(t){let e,{value:n,label:r=Ve(n)}=dr(t);return{transform:o=>e||(e=ut(o,n)),label:r}}function QO(t,e){let n=t==="x"?"y":"x",r=`${n}1`,o=`${n}2`,i=`${t}1`,s=`${t}2`;return(a,c,f,l,u,p)=>{let{[r]:d,[o]:h}=f,m=new Float32Array(d.length),g=new Float32Array(h.length),y=l[t==="y"?"height":"width"];(e===Ky(c[t])<0?m:g).fill(y);let x=p(a,c,{...f,[o]:d,[s]:g},l,u),b=p(a,c,{...f,[r]:h,[i]:m},l,u),w=x.querySelector("g")??x,_=b.querySelector("g")??b;for(let v=0;w.firstChild;v+=2){let A=K6(),E=st("svg:clipPath",u).attr("id",A).node();E.appendChild(w.firstChild),_.childNodes[v].setAttribute("clip-path",`url(#${A})`),_.insertBefore(E,_.childNodes[v])}return b}}function Hx({geometry:t=V,...e}={}){let n=cs(r=>ut(r,t));return Vt({...e,x:null,y:null,geometry:{transform:n}},(r,o,i,s,a,{projection:c})=>{let f=n(r),l=f.length,u=new Float64Array(l),p=new Float64Array(l),d=Ie(c);for(let h=0;h<l;++h)[u[h],p[h]]=d.centroid(f[h]);return{data:r,facets:o,channels:{x:{value:u,scale:c==null?"x":null,source:null},y:{value:p,scale:c==null?"y":null,source:null}}}})}function eR({geometry:t=V,...e}={}){let n=cs(o=>ut(o,t)),r=cs(o=>ut(n(o),nv));return{...e,x:{transform:o=>Float64Array.from(r(o),([i])=>i)},y:{transform:o=>Float64Array.from(r(o),([,i])=>i)},geometry:{transform:n}}}var XW={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},wd=class extends pt{constructor(e,n={}){let[r,o]=Ft(n.r,3);super(e,{x:{value:n.tip?n.x:null,scale:"x",optional:!0},y:{value:n.tip?n.y:null,scale:"y",optional:!0},r:{value:r,scale:"r",filter:bn,optional:!0},geometry:{value:n.geometry,scale:"projection"}},sd(n),XW),this.r=o}render(e,n,r,o,i){let{geometry:s,r:a}=r,c=Ie(i.projection??GW(n)),{r:f}=this;return Vi(f)?e=[]:f!==void 0&&c.pointRadius(f),st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(l=>{l.selectAll().data(e).enter().append("path").call(dt,this).attr("d",a?u=>c.pointRadius(a[u])(s[u]):u=>c(s[u])).call(Tt,this,r)}).node()}};function GW({x:t,y:e}){if(t||e)return t??=n=>n,e??=n=>n,la({point(n,r){this.stream.point(t(n),e(r))}})}function Zx(t,e={}){return e.tip&&e.x===void 0&&e.y===void 0?e=Hx(e):e.geometry===void 0&&(e={...e,geometry:V}),new wd(t,e)}function nR({strokeWidth:t=1.5,...e}={}){return Zx({type:"Sphere"},{strokeWidth:t,...e})}function rR({strokeOpacity:t=.1,...e}={}){return Zx(cv(),{strokeOpacity:t,...e})}var Gf=.5,Vf=0;function oR(t={fill:"count"},{binWidth:e,...n}={}){let{z:r}=n;return e=e===void 0?20:Ot(e),t=T6(t,n),uo(t,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!uo(t,"r")&&(n.r=e/2),Vt(n,(o,i,s,a,c,f)=>{let{x:l,y:u,z:p,fill:d,stroke:h,symbol:m}=s;if(l===void 0)throw new Error("missing channel: x");if(u===void 0)throw new Error("missing channel: y");({x:l,y:u}=ho(s,a,f)),p=p?p.value:ut(o,r),d=d?.value,h=h?.value,m=m?.value;let g=Dp(t,{z:p,fill:d,stroke:h,symbol:m}),y=p&&[],x=d&&[],b=h&&[],w=m&&[],_=[],v=[],A=[],E=-1;for(let k of t)k.initialize(o);for(let k of i){let R=[];for(let S of t)S.scope("facet",k);for(let[S,I]of lo(k,g))for(let{index:C,extent:N}of VW(o,I,l,u,e)){R.push(++E),v.push(N.x),A.push(N.y),p&&y.push(g===p?S:p[C[0]]),d&&x.push(g===d?S:d[C[0]]),h&&b.push(g===h?S:h[C[0]]),m&&w.push(g===m?S:m[C[0]]);for(let D of t)D.reduce(C,N)}_.push(R)}let T=s.x.scale,$=s.y.scale,M={x:{value:v,source:a[T]?{value:Et(v,a[T].invert),scale:T}:null},y:{value:A,source:a[$]?{value:Et(A,a[$].invert),scale:$}:null},...p&&{z:{value:y}},...d&&{fill:{value:x,scale:"auto"}},...h&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(t.map(({name:k,output:R})=>[k,{scale:"auto",label:R.label,radius:k==="r"?e/2:void 0,value:R.transform()}]))};return{data:o,facets:_,channels:M}})}function VW(t,e,n,r,o){let i=o*(1.5/g6),s=new Map;for(let a of e){let c=n[a],f=r[a];if(isNaN(c)||isNaN(f))continue;let l=Math.round(f=(f-Vf)/i),u=Math.round(c=(c-Gf)/o-(l&1)/2),p=f-l;if(Math.abs(p)*3>1){let m=c-u,g=u+(c<u?-1:1)/2,y=l+(f<l?-1:1),x=c-g,b=f-y;m*m+p*p>x*x+b*b&&(u=g+(l&1?1:-1)/2,l=y)}let d=`${u},${l}`,h=s.get(d);h===void 0&&(h={index:[],extent:{data:t,x:(u+(l&1)/2)*o+Gf,y:l*i+Vf}},s.set(d,h)),h.index.push(a)}return s.values()}var WW={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function iR(t){return new vd(t)}var vd=class extends pt{constructor({binWidth:e=20,clip:n=!0,...r}={}){super(Qi,void 0,{clip:n,...r},WW),this.binWidth=Ot(e)}render(e,n,r,o,i){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:f,marginLeft:l,width:u,height:p}=o,d=l-Gf,h=u-c-Gf,m=a-Vf,g=p-f-Vf,y=s/2,x=y*y6,b=x/2,w=y*2,_=x*1.5,v=Math.floor(d/w),A=Math.ceil(h/w),E=Math.floor((m+b)/_),T=Math.ceil((g-b)/_)+1,$=`m0,${Ss(-x)}l${Ss(y)},${Ss(b)}v${Ss(x)}l${Ss(-y)},${Ss(b)}`,M=$;for(let k=E;k<T;++k)for(let R=v;R<A;++R)M+=`M${Ss(R*w+(k&1)*y)},${Ss(k*_)}${$}`;return st("svg:g",i).datum(0).call(xt,this,o,i).call(mt,this,{},oe+Gf,oe+Vf).call(k=>k.append("path").call(dt,this).call(Tt,this,r).attr("d",M)).node()}};function Ss(t){return Math.round(t*1e3)/1e3}var HW={ariaLabel:"image",fill:null,stroke:null};function ZW(t){return/^\.*\//.test(t)}function QW(t){return/^(blob|data|file|http|https):/i.test(t)}function JW(t){return typeof t=="string"&&(ZW(t)||QW(t))?[void 0,t]:[t,void 0]}var _d=class extends pt{constructor(e,n={}){let{x:r,y:o,r:i,width:s,height:a,rotate:c,src:f,preserveAspectRatio:l,crossOrigin:u,frameAnchor:p,imageRendering:d}=n;i==null&&(i=void 0),i===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[h,m]=JW(f),[g,y]=Ft(i),[x,b]=Ft(s,y!==void 0?y*2:void 0),[w,_]=Ft(a,y!==void 0?y*2:void 0),[v,A]=Ft(c,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:g,scale:"r",filter:bn,optional:!0},width:{value:x,filter:bn,optional:!0},height:{value:w,filter:bn,optional:!0},rotate:{value:v,optional:!0},src:{value:h,optional:!0}},sd(n),HW),this.src=m,this.width=b,this.rotate=A,this.height=_,this.r=y,this.preserveAspectRatio=Wt(l,"xMidYMid"),this.crossOrigin=fe(u),this.frameAnchor=fo(p),this.imageRendering=Wt(d,"auto")}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,width:l,height:u,r:p,rotate:d,src:h}=r,{r:m,width:g,height:y,rotate:x}=this,[b,w]=Le(this,o);return st("svg:g",i).call(xt,this,o,i).call(mt,this,{x:c&&s,y:f&&a}).call(_=>_.selectAll().data(e).enter().append("image").call(dt,this).attr("x",sR(c,l,p,b,g,m)).attr("y",sR(f,u,p,w,y,m)).attr("width",l?v=>l[v]:g!==void 0?g:p?v=>p[v]*2:m*2).attr("height",u?v=>u[v]:y!==void 0?y:p?v=>p[v]*2:m*2).attr("transform",d?v=>`rotate(${d[v]})`:x?`rotate(${x})`:null).attr("transform-origin",d||x?$r`${c?v=>c[v]:b}px ${f?v=>f[v]:w}px`:null).call(at,"href",h?v=>h[v]:this.src).call(at,"preserveAspectRatio",this.preserveAspectRatio).call(at,"crossorigin",this.crossOrigin).call(at,"image-rendering",this.imageRendering).call(at,"clip-path",p?v=>`circle(${p[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Tt,this,r)).node()}};function sR(t,e,n,r,o,i){return e&&t?s=>t[s]-e[s]/2:e?s=>r-e[s]/2:t&&o!==void 0?s=>t[s]-o/2:o!==void 0?r-o/2:n&&t?s=>t[s]-n[s]:n?s=>r-n[s]:t?s=>t[s]-i:r-i}function aR(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=ae(e,n)),new _d(t,{...r,x:e,y:n})}function KW(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,l,u,p,d,h,m,g,y;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,l=Math.sqrt(-2*Math.log(f)),d=(2.30753+l*.27061)/(1+l*(.99229+l*.04481))-l,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),g=d*Math.sqrt(h+m)/m-(1/(2*n-1)-1/(2*e-1))*(h+5/6-2/(3*m)),d=e/(e+n*Math.exp(2*g))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),l=Math.exp(e*a)/e,u=Math.exp(n*c)/n,g=l+u,t<l/g?d=Math.pow(e*g*t,1/e):d=1-Math.pow(n*g*(1-t),1/n)),y=-Wf(e)-Wf(n)+Wf(e+n);s<10;s++){if(d===0||d===1)return d;if(p=tH(d,e,n)-t,l=Math.exp(o*Math.log(d)+i*Math.log(1-d)+y),u=p/l,d-=l=u/(1-.5*Math.min(1,u*(o/d-i/(1-d)))),d<=0&&(d=.5*(d+l)),d>=1&&(d=.5*(d+l+1)),Math.abs(l)<r*d&&s>0)break}return d}function tH(t,e,n){var r=t===0||t===1?0:Math.exp(Wf(e+n)-Wf(e)-Wf(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?!1:t<(e+1)/(e+n+2)?r*cR(t,e,n)/e:1-r*cR(1-t,n,e)/n}function cR(t,e,n){var r=1e-30,o=1,i=e+n,s=e+1,a=e-1,c=1,f=1-i*t/s,l,u,p,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(l=2*o,u=o*(n-o)*t/((a+l)*(e+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,u=-(e+o)*(i+o)*t/((e+l)*(s+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,p=f*c,d*=p,!(Math.abs(p-1)<3e-7));o++);return d}function Wf(t){var e=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,o,i,s;for(s=(i=o=t)+5.5,s-=(o+.5)*Math.log(s);e<6;e++)r+=n[e]/++i;return Math.log(2.506628274631*r/o)-s}function fR(t,e){var n=KW(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}var eH={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Qx=class extends pt{constructor(e,n={}){let{x:r,y:o,z:i,ci:s=.95,precision:a=4}=n;if(super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y"},z:{value:nn(n),optional:!0}},n,eH),this.z=i,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(e,n,r,o,i){let{x:s,y:a,z:c}=r,{ci:f}=this;return st("svg:g",i).call(xt,this,o,i).call(mt,this,n).call(l=>l.selectAll().data(c?Yp(e,c,this.z):[e]).enter().call(u=>u.append("path").attr("fill","none").call(dt,this).call(Ca,this,{...r,fill:null,fillOpacity:null}).attr("d",p=>this._renderLine(p,s,a)).call(f&&!fi(this.fill)?p=>p.select(nH).attr("stroke","none").call(dt,this).call(Ca,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function nH(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(un.svg,"path"),this)}var q3=class extends Qx{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Rt(e,l=>r[l]),c=Jx(e,r,n),f=pR(e,r,n,(1-o)/2,c);return ef().y(l=>l).x0(l=>f(l,-1)).x1(l=>f(l,1))(ce(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Rt(e,a=>r[a]),s=Jx(e,r,n);return`M${s(o)},${o}L${s(i)},${i}`}},B3=class extends Qx{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Rt(e,l=>n[l]),c=Jx(e,n,r),f=pR(e,n,r,(1-o)/2,c);return ef().x(l=>l).y0(l=>f(l,-1)).y1(l=>f(l,1))(ce(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Rt(e,a=>n[a]),s=Jx(e,n,r);return`M${o},${s(o)}L${i},${s(i)}`}};function lR(t,{y:e=Xt,x:n=V,stroke:r,fill:o=Pt(r)?"currentColor":r,...i}={}){return new q3(t,qf({...i,x:n,y:e,fill:o,stroke:r}))}function uR(t,{x:e=Xt,y:n=V,stroke:r,fill:o=Pt(r)?"currentColor":r,...i}={}){return new B3(t,Ff({...i,x:e,y:n,fill:o,stroke:r}))}function Jx(t,e,n){let r=0,o=0,i=0,s=0;for(let l of t){let u=e[l],p=n[l];r+=u,o+=p,i+=u*p,s+=u*u}let a=t.length,c=(a*i-r*o)/(a*s-r*r),f=(o-c*r)/a;return l=>c*l+f}function pR(t,e,n,r,o){let i=Ue(t,l=>e[l])/t.length,s=0,a=0;for(let l of t)s+=(e[l]-i)**2,a+=(n[l]-o(e[l]))**2;let c=Math.sqrt(a/(t.length-2)),f=fR(r,t.length-2);return(l,u)=>{let p=o(l),d=c*Math.sqrt(1/t.length+(l-i)**2/s);return p+u*f*d}}function Sd({path:t=V,delimiter:e,frameAnchor:n,treeLayout:r=ua,treeSort:o,treeSeparation:i,treeAnchor:s,treeFilter:a,...c}={}){s=n1(s),o=mR(o),a!=null&&(a=Y3(a)),n===void 0&&(n=s.frameAnchor);let f=gR(e),l=SR(c,Y3),[u,p]=Oe(),[d,h]=Oe();return{x:u,y:d,frameAnchor:n,...be(c,(m,g)=>{let y=f(ut(m,t)),x=p([]),b=h([]),w=-1,_=[],v=[],A=H0().path($=>y[$]),E=Cn(m)?$=>$.data=m[$.data]:$=>$.data=m.get($.data),T=r();T.nodeSize&&T.nodeSize([1,1]),T.separation&&i!==void 0&&T.separation(i??Cp);for(let $ of l)$[t1]=$[vR]([]);for(let $ of g){let M=[],k=A($.filter(R=>y[R]!=null)).each(E);o!=null&&k.sort(o),T(k);for(let R of k.descendants())if(!(a!=null&&!a(R))){M.push(++w),_[w]=R.data,s.position(R,w,x,b);for(let S of l)S[t1][w]=S[_R](R)}v.push(M)}return{data:_,facets:v}}),...Object.fromEntries(l)}}function e1({path:t=V,delimiter:e,curve:n="bump-x",stroke:r="#555",strokeWidth:o=1.5,strokeOpacity:i=.5,treeLayout:s=ua,treeSort:a,treeSeparation:c,treeAnchor:f,treeFilter:l,...u}={}){f=n1(f),a=mR(a),l!=null&&(l=hR(l)),u={curve:n,stroke:r,strokeWidth:o,strokeOpacity:i,...u};let p=gR(e),d=SR(u,hR),[h,m]=Oe(),[g,y]=Oe(),[x,b]=Oe(),[w,_]=Oe();return{x1:h,x2:g,y1:x,y2:w,...be(u,(v,A)=>{let E=p(ut(v,t)),T=m([]),$=y([]),M=b([]),k=_([]),R=-1,S=[],I=[],C=H0().path(D=>E[D]),N=s();N.nodeSize&&N.nodeSize([1,1]),N.separation&&c!==void 0&&N.separation(c??Cp);for(let D of d)D[t1]=D[vR]([]);for(let D of A){let L=[],P=C(D.filter(F=>E[F]!=null)).each(F=>F.data=v[F.data]);a!=null&&P.sort(a),N(P);for(let{source:F,target:q}of P.links())if(!(l!=null&&!l(q,F))){L.push(++R),S[R]=q.data,f.position(F,R,T,M),f.position(q,R,$,k);for(let W of d)W[t1][R]=W[_R](q,F)}I.push(L)}return{data:S,facets:I}}),...Object.fromEntries(d)}}function n1(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return rH;case"right":return oH}throw new Error(`invalid tree anchor: ${t}`)}var rH={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,o){r[n]=e,o[n]=-t}},oH={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,o){r[n]=-e,o[n]=-t}};function mR(t){return t==null||typeof t=="function"?t:`${t}`.trim().toLowerCase().startsWith("node:")?dR(Y3(t)):dR(iH(t))}function dR(t){return(e,n)=>ke(t(e),t(n))}function iH(t){return e=>e.data?.[t]}function gR(t="/"){if(t=`${t}`,t==="/")return n=>n;if(t.length!==1)throw new Error("delimiter must be exactly one character");let e=t.charCodeAt(0);return n=>n.map(r=>sH(r,e))}var z3=92,yR=47;function sH(t,e){if(e===z3)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,o=t.length;r<o;++r){switch(t.charCodeAt(r)){case z3:if(!n){n=!0;continue}break;case e:n?(t=t.slice(0,r-1)+t.slice(r),--r,--o):t=t.slice(0,r)+"/"+t.slice(r+1);break;case yR:n?(t=t.slice(0,r)+"\\\\"+t.slice(r),r+=2,o+=2):(t=t.slice(0,r)+"\\"+t.slice(r),++r,++o);break}n=!1}return t}function aH(t){let e=!1;for(let n=0,r=t.length;n<r;++n){switch(t.charCodeAt(n)){case z3:if(!e){e=!0;continue}case yR:e&&(t=t.slice(0,n-1)+t.slice(n),--n,--r);break}e=!1}return t}function xR(t){return Ne(t)&&typeof t.node=="function"}function cH(t){return Ne(t)&&typeof t.link=="function"}function Y3(t){if(xR(t))return t.node;if(t=`${t}`.trim().toLowerCase(),!!t.startsWith("node:")){switch(t){case"node:name":return j3;case"node:path":return U3;case"node:internal":return bR;case"node:external":return wR;case"node:depth":return X3;case"node:height":return G3}throw new Error(`invalid node value: ${t}`)}}function hR(t){if(xR(t))return t.node;if(cH(t))return t.link;if(t=`${t}`.trim().toLowerCase(),!(!t.startsWith("node:")&&!t.startsWith("parent:"))){switch(t){case"parent:name":return Kx(j3);case"parent:path":return Kx(U3);case"parent:depth":return Kx(X3);case"parent:height":return Kx(G3);case"node:name":return j3;case"node:path":return U3;case"node:internal":return bR;case"node:external":return wR;case"node:depth":return X3;case"node:height":return G3}throw new Error(`invalid link value: ${t}`)}}function U3(t){return t.id}function j3(t){return fH(t.id)}function X3(t){return t.depth}function G3(t){return t.height}function bR(t){return!!t.children}function wR(t){return!t.children}function Kx(t){return(e,n)=>n==null?void 0:t(n)}function fH(t){let e=t.length;for(;--e>0&&!lH(t,e););return aH(t.slice(e+1))}function lH(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}var vR=2,_R=3,t1=4;function SR(t,e){let n=[];for(let r in t){let o=t[r],i=e(o);i!==void 0&&n.push([r,...Oe(o),i])}return n}function V3(t,{fill:e,stroke:n,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,marker:l,markerStart:u=l,markerEnd:p=l,dot:d=Pt(u)&&Pt(p),text:h="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:x,textAnchor:b,treeLayout:w=ua,textLayout:_=w===ua||w===V0?"mirrored":"normal",tip:v,...A}={}){if(y===void 0&&(y=n1(A.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=Se(_,"textLayout",["mirrored","normal"]);function E(T){return go(t,Sd({treeLayout:w,text:h,fill:e===void 0?"currentColor":e,stroke:m,dx:y,dy:x,title:g,...T,...A}))}return we(qx(t,e1({treeLayout:w,markerStart:u,markerEnd:p,stroke:n!==void 0?n:e===void 0?"node:internal":e,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,...A})),d?mr(t,Sd({treeLayout:w,fill:e===void 0?"node:internal":e,title:g,tip:v,...A})):null,h!=null?_==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:E():null)}function MR(t,e){return V3(t,{...e,treeLayout:V0})}var TR={ariaLabel:"waffle"},Md=class extends qa{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:hi(i,ER("x"))},TR),this.unit=Math.max(0,n),this.gap=+r,this.round=IR(o),this.multiple=$R(s)}},Ad=class extends Ba{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:hi(i,ER("y"))},TR),this.unit=Math.max(0,n),this.gap=+r,this.round=IR(o),this.multiple=$R(s)}};function ER(t){return function(e,n,r,o,i){let{unit:s,gap:a,rx:c,ry:f,round:l}=this,{document:u}=i,p=r.channels[`${t}1`].value,d=r.channels[`${t}2`].value,h=this[t==="y"?"_width":"_height"](n,r,o),m=this[t==="y"?"_x":"_y"](n,r,o),g=s*uH(n.scales[t]),{multiple:y=Math.max(1,Math.floor(Math.sqrt(h/g)))}=this,x=Math.min(h/y,g*y),b=g*y,w=t==="y"?([M,k])=>[M*x,-k*b]:([M,k])=>[k*b,M*x],_=(h-y*x)/2,v=typeof m=="function"?M=>m(M)+_:m+_,A=n[t](0),E=Rk(),T=u.createElementNS(un.svg,"pattern");T.setAttribute("width",t==="y"?x:b),T.setAttribute("height",t==="y"?b:x),T.setAttribute("patternUnits","userSpaceOnUse");let $=T.appendChild(u.createElementNS(un.svg,"rect"));return $.setAttribute("x",a/2),$.setAttribute("y",a/2),$.setAttribute("width",(t==="y"?x:b)-a),$.setAttribute("height",(t==="y"?b:x)-a),c!=null&&$.setAttribute("rx",c),f!=null&&$.setAttribute("ry",f),st("svg:g",i).call(xt,this,o,i).call(this._transform,this,n).call(M=>M.selectAll().data(e).enter().append(()=>T.cloneNode(!0)).attr("id",k=>`${E}-${k}`).select("rect").call(dt,this).call(Tt,this,r)).call(M=>M.selectAll().data(e).enter().append("path").attr("transform",t==="y"?$r`translate(${v},${A})`:$r`translate(${A},${v})`).attr("d",k=>`M${W3(l(p[k]/s),l(d[k]/s),y).map(w).join("L")}Z`).attr("fill",k=>`url(#${E}-${k})`).attr("stroke",this.stroke==null?null:k=>`url(#${E}-${k})`)).node()}}function W3(t,e,n){if(t<0||e<0){let r=Math.ceil(-Math.min(t,e)/n);return W3(t+r*n,e+r*n,n).map(([o,i])=>[o,i-r])}return e<t?W3(e,t,n):[[0,Math.ceil(t/n)],[Math.floor(t%n),Math.ceil(t/n)],[Math.floor(t%n),Math.floor(t/n)+t%1],[Math.ceil(t%n),Math.floor(t/n)+t%1],...t%n>n-1?[]:[[Math.ceil(t%n),Math.floor(t/n)],[n,Math.floor(t/n)]],[n,Math.floor(e/n)],[Math.ceil(e%n),Math.floor(e/n)],[Math.ceil(e%n),Math.floor(e/n)+e%1],[Math.floor(e%n),Math.floor(e/n)+e%1],...e%n<1?[]:[[Math.floor(e%n),Math.ceil(e/n)],[0,Math.ceil(e/n)]]]}function IR(t){if(t===void 0||t===!1)return Number;if(t===!0)return Math.round;if(typeof t!="function")throw new Error(`invalid round: ${t}`);return t}function $R(t){return t===void 0?void 0:Math.max(1,Math.floor(t))}function uH({domain:t,range:e}){return AR(e)/AR(t)}function AR(t){let[e,n]=Rt(t);return n-e}function CR(t,e={}){return si(e)||(e={...e,y:Xt,x2:V}),new Md(t,ms(If(ds(e))))}function kR(t,e={}){return si(e)||(e={...e,x:Xt,y2:V}),new Ad(t,gs($f(hs(e))))}var YR=WD(zR(),1);var bH=({marginLeft:t})=>[1,t],wH=({width:t,marginRight:e})=>[-1,t-e],vH=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],_H=({marginTop:t})=>[1,t],SH=({height:t,marginBottom:e})=>[-1,t-e],MH=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function UR(t){return typeof t=="string"?{anchor:t}:t}function jR(t={},e={}){arguments.length===1&&([t,e]=GR(t));let{anchor:n="left",padding:r=1,r:o=e.r}=UR(t);switch(`${n}`.toLowerCase()){case"left":n=bH;break;case"right":n=wH;break;case"middle":n=vH;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return VR("x","y",n,Ot(r),o,e)}function XR(t={},e={}){arguments.length===1&&([t,e]=GR(t));let{anchor:n="bottom",padding:r=1,r:o=e.r}=UR(t);switch(`${n}`.toLowerCase()){case"top":n=_H;break;case"bottom":n=SH;break;case"middle":n=MH;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return VR("y","x",n,Ot(r),o,e)}function GR(t){let{anchor:e,padding:n,...r}=t,{r:o}=r;return[{anchor:e,padding:n,r:o},r]}function VR(t,e,n,r,o,i){if(o!=null&&typeof o!="number"){let{channels:s,sort:a,reverse:c}=i;s=Np(s),s?.r===void 0&&(i={...i,channels:{...s,r:{value:o,scale:"r"}}}),a===void 0&&c===void 0&&(i.sort={channel:"-r"})}return Vt(i,function(s,a,c,f,l,u){let{[e]:p,r:d}=c;if(!c[e])throw new Error(`missing channel: ${e}`);({[e]:p}=ho(c,f,u));let h=d?void 0:o!==void 0?Ot(o):this.r!==void 0?this.r:3;d&&(d=ut(d.value,f[d.scale]||V,Float64Array));let[m,g]=n(l),y=m?TH:AH,x=new Float64Array(p.length),b=d?w=>d[w]:()=>h;for(let w of a){let _=(0,YR.default)();w=w.filter(d?A=>af(p[A])&&bn(d[A]):A=>af(p[A]));let v=new Float64Array(2*w.length+2);for(let A of w){let E=b(A),T=m?E+r:0,$=p[A]-E,M=p[A]+E,k=2;_.queryInterval($-r,M+r,([,,S])=>{let I=x[S]-T,C=p[A]-p[S],N=r+(d?d[A]+d[S]:2*h),D=Math.sqrt(N*N-C*C);v[k++]=I-D,v[k++]=I+D});let R=v.slice(0,k);m&&(R=R.filter(S=>S>=0));t:for(let S of R.sort(y)){for(let I=0;I<k;I+=2)if(v[I]+1e-6<S&&S<v[I+1]-1e-6)continue t;x[A]=S+T;break}_.insert([$,M,A])}}m||(m=1);for(let w of a)for(let _ of w)x[_]=x[_]*m+g;return{data:s,facets:a,channels:{[t]:{value:x,source:null},[e]:{value:p,source:c[e]},...d&&{r:{value:d,source:c.r}}}}})}function AH(t,e){return Math.abs(t)-Math.abs(e)}function TH(t,e){return t-e}function HR(t,e){return arguments.length===1&&({basis:t,...e}=t),Yf(i1(t),e)}function ZR(t,e){return arguments.length===1&&({basis:t,...e}=t),Uf(i1(t),e)}function i1(t){if(t===void 0)return WR;if(typeof t=="function")return s1(df(t));if(/^p\d{2}$/i.test(t))return Jf(pf(t));switch(`${t}`.toLowerCase()){case"deviation":return $H;case"first":return WR;case"last":return IH;case"max":return CH;case"mean":return kH;case"median":return NH;case"min":return OH;case"sum":return RH;case"extent":return EH}throw new Error(`invalid basis: ${t}`)}function s1(t){return{mapIndex(e,n,r){let o=+t(e,n);for(let i of e)r[i]=n[i]===null?NaN:n[i]/o}}}function Jf(t){return s1((e,n)=>t(e,r=>n[r]))}var EH={mapIndex(t,e,n){let[r,o]=Rt(t,s=>e[s]),i=o-r;for(let s of t)n[s]=e[s]===null?NaN:(e[s]-r)/i}},WR=s1((t,e)=>{for(let n=0;n<t.length;++n){let r=e[t[n]];if(Jt(r))return r}}),IH=s1((t,e)=>{for(let n=t.length-1;n>=0;--n){let r=e[t[n]];if(Jt(r))return r}}),$H={mapIndex(t,e,n){let r=Fo(t,i=>e[i]),o=nr(t,i=>e[i]);for(let i of t)n[i]=e[i]===null?NaN:o?(e[i]-r)/o:0}},CH=Jf(Ct),kH=Jf(Fo),NH=Jf(_r),OH=Jf(Bt),RH=Jf(Ue);function QR(t,e){return KR("x",t,e)}function JR(t,e){return KR("y",t,e)}function KR(t,e,n={}){let r,o=1;if(typeof e=="number")o=e,r=(f,l)=>+f+l;else{if(typeof e=="string"){let f=e.startsWith("-")?-1:1;[e,o]=Dy(e.replace(/^[+-]/,"")),o*=f}e=mf(e),r=(f,l)=>e.offset(f,l)}let i=`${t}1`,s=`${t}2`,a=kn({[i]:f=>f.map(l=>r(l,o)),[s]:f=>f},n),c=a[s].transform;return a[s].transform=()=>{let f=c(),[l,u]=Rt(f);return f.domain=o<0?[l,r(u,o)]:[r(l,o),u],f},a}function tL(t,e={}){if(typeof t=="string")switch(t.toLowerCase()){case"first":return Id(e);case"last":return $d(e)}if(typeof t=="function")return Ms(null,t,e);let n,r;for(n in t){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=LH(t[n])}if(r===void 0)throw new Error(`invalid selector: ${t}`);return Ms(n,r,e)}function LH(t){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"min":return tS;case"max":return eS}throw new Error(`unknown selector: ${t}`)}function Id(t){return Ms(null,DH,t)}function $d(t){return Ms(null,PH,t)}function a1(t){return Ms("x",tS,t)}function c1(t){return Ms("y",tS,t)}function f1(t){return Ms("x",eS,t)}function l1(t){return Ms("y",eS,t)}function*DH(t){yield t[0]}function*PH(t){yield t[t.length-1]}function*tS(t,e){yield km(t,n=>e[n])}function*eS(t,e){yield Ws(t,n=>e[n])}function Ms(t,e,n){if(t!=null){if(n[t]==null)throw new Error(`missing channel: ${t}`);t=n[t]}let r=nn(n);return be(n,(o,i)=>{let s=ut(o,r),a=ut(o,t),c=[];for(let f of i){let l=[];for(let u of s?ze(f,p=>s[p]).values():[f])for(let p of e(u,a))l.push(p);c.push(l)}return{data:o,facets:c}})}pt.prototype.plot=function({marks:t=[],...e}={}){return Pf({...e,marks:[...t,this]})};var FH=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function qH(t,e,n){for(let r=0;r<e.length;++r){let o=e[r];r===e.length-1?t[o]=n:t=t[o]||(t[o]={})}}function eL(t,e,n){for(let r in t){let o=FH.get(r);if(o==null)throw new Error(`Unrecognized plot attribute: ${r}`);let i=t[r];typeof i=="symbol"?n.push(r):i!==void 0&&qH(e,o.split("."),i)}}var BH=new Set(["frame","hexgrid","sphere","graticule"]),zH=new Map([["first",Id],["last",$d],["maxX",f1],["maxY",l1],["minX",a1],["minY",c1],["nearest",ls],["nearestX",us],["nearestXY",mi]]);async function rL(t){let e={marks:[]},n=[],{attributes:r,marks:o}=t;eL(r,e,n);let i=[];for(let a of o)for(let{type:c,data:f,options:l}of a.plotSpecs()){let{select:u,...p}=l,d=zH.get(u)?.(p)??p,h=BH.has(c)?[d]:[f,d];e.marks.push(nS[c](...h)),i.push(a.index)}UH(e,t);let s=Pf(e);jH(s,i),YH(t,s,r,n);for(let a of t.interactors)await a.init(s);return s}function YH(t,e,n,r){r.forEach(o=>{let i=n[o];if(i===qr){if(!o.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${o}`);let s=o.slice(0,-6),a=e.scale(s);a?.domain&&t.setAttribute(o,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${i}`)})}function UH(t,e){let{marks:n}=e;u1("x",t,n),u1("y",t,n),u1("fx",t,n),u1("fy",t,n)}function u1(t,e,n){let r=e[t]||{};if(r.axis===null||r.label!==void 0)return;let o=n.map(f=>f.channelField(t)?.field);if(o.every(f=>f==null))return;let i,s,a;for(let f=0;f<o.length;++f){let{column:l,label:u}=o[f]||{};l===void 0&&u===void 0||(i===void 0&&s===void 0?(i=l,s=u,a=XH(n[f].data,t)||"number"):s!==u?s=void 0:i!==l&&(i=void 0))}let c=s||i;if(c!==void 0){if((a==="number"||a==="date")&&(t==="x"||t==="y")){r.percent&&(c=`${c} (%)`);let f=(t==="x"?1:-1)*(r.reverse?-1:1);t==="x"||r.labelAnchor==="center"?c=t==="x"==f<0?`\u2190 ${c}`:`${c} \u2192`:c=`${f<0?"\u2191 ":"\u2193 "}${c}`}e[t]={...r,label:c}}}function jH(t,e){let n=t.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)nL(r,e);else nL(t,e)}function nL(t,e){let n=-1;for(let r of t.children){let o=r.getAttribute("aria-label")||"";r.nodeName==="style"||o.includes("-axis")||o.includes("-grid")||r.setAttribute("data-index",e[++n])}}function XH(t,e){if(!t)return;let{columns:n}=t,r=n[e]??n[e+"1"]??n[e+"2"];if(r){for(let o of r)if(o!=null)return o instanceof Date?"date":typeof o}}var GH={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Cd=class{constructor(e){this.attributes={...GH},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=e||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=Q2()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:e,right:n}=this.margins();return this.getAttribute("width")-e-n}innerHeight(e=400){let{top:n,bottom:r}=this.margins(),o=this.getAttribute("height");return o==null&&(o=VH(this,n,r)||e,this.setAttribute("height",o,{silent:!0})),o-n-r}pending(e){this.synch.pending(e)}update(e){return this.synch.ready(e)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let e=await rL(this),n=this.legends.flatMap(({legend:r,include:o})=>{let i=r.init(e);return o?i:[]});this.element.replaceChildren(e,...n),this.synch.resolve()}getAttribute(e){return this.attributes[e]}setAttribute(e,n,r){return Yl(this.attributes[e],n)?(n===void 0?delete this.attributes[e]:this.attributes[e]=n,r?.silent||this.listeners?.get(e)?.forEach(o=>o(e,n)),!0):!1}addAttributeListener(e,n){let r=this.listeners||(this.listeners=new Map);return r.has(e)||r.set(e,new Set),r.get(e).add(n),this}removeAttributeListener(e,n){return this.listeners?.get(e)?.delete(n)}addParams(e,n){let{params:r}=this;for(let o of n)r.has(o)?r.get(o).push(e):(r.set(o,[e]),o.addEventListener("value",()=>Promise.allSettled(r.get(o).map(i=>i.initialize()))))}addMark(e){return e.setPlot(this,this.marks.length),this.marks.push(e),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(e){return this.interactors.push(e),this}addLegend(e,n=!0){e.setPlot(this),this.legends.push({legend:e,include:n})}};function VH(t,e,n){let r=t.getAttribute("aspectRatio");if(r==null)return;let o=t.getAttribute("xDomain"),i=t.getAttribute("yDomain");if(!o||!i)return;let s=Math.abs(o[1]-o[0]);return Math.abs(i[1]-i[0])*t.innerWidth()/(r*s)+e+n}function p1(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),t==="none"||t==="currentcolor"||t.startsWith("url(")&&t.endsWith(")")||t.startsWith("var(")&&t.endsWith(")")||Pn(t)!==null)}var WH=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function oL(t){return WH.has(t)}var HH=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function iL(t){return HH.has(`${t}`.toLowerCase())}var sL=t=>t==="stroke"||t==="fill",ZH=t=>/opacity$/i.test(t),QH=t=>t==="symbol",JH=(t,e)=>t!=="sort"&&t!=="tip"&&e!=null&&!Array.isArray(e),rS=(t,e)=>({channel:t,field:e,as:e instanceof An?e.column:t}),oS=(t,e)=>({channel:t,value:e}),d1=t=>Array.isArray(t),Me=class extends _n{constructor(e,n,r,o={}){super(n?.options?.filterBy),this.type=e,this.reqs=o,this.source=n,d1(this.source)&&(this.data=In(this.source));let i=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(f,l)=>{let u=typeof l;if(f==="channels")for(let p in l)s.add(p),c(p,l[p]);else if(u==="function"&&l[Ul]){let p=l(this,f);for(let d in p)c(d,p[d])}else if(u==="string")oL(f)||sL(f)&&p1(l)||QH(f)&&iL(l)?i.push(oS(f,l)):i.push(rS(f,Ii(l)));else if(Co(l))if(Array.isArray(l.columns))i.push(rS(f,l)),a.add(l);else{let p=oS(f,l.value);i.push(p),l.addEventListener("value",d=>(p.value=d,this.update()))}else u==="object"&&JH(f,l)?i.push(rS(f,l)):l!==void 0&&i.push(oS(f,l))};for(let f in r)c(f,r[f])}setPlot(e,n){this.plot=e,this.index=n,e.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||d1(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(e){return this.channels.find(n=>n.channel===e)}channelField(e,{exact:n=!1}={}){let r=n?this.channel(e):this.channels.find(o=>o.channel.startsWith(e));return r?.field?r:null}fields(){if(this.hasOwnData())return null;let{source:{table:e},channels:n,reqs:r}=this,o=new Map;for(let{channel:i,field:s}of n){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,f=o.get(c)??o.set(c,new Set).get(c);a.forEach(l=>f.add(l)),r[i]?.forEach(l=>f.add(l))}return Array.from(o,([i,s])=>({table:e,column:i,stats:s}))}fieldInfo(e){let n=Object.fromEntries(e.map(r=>[r.column,r]));for(let r of this.channels){let{field:o}=r;o&&Object.assign(r,n[o.stats?.column??o])}return this._fieldInfo=!0,this}query(e=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return kd(n,r).where(e)}queryPending(){return this.plot.pending(this),this}queryResult(e){return this.data=In(e),this}update(){return this.plot.update(this)}plotSpecs(){let{type:e,data:n,detail:r,channels:o}=this;return iS(e,r,o,n)}};function on(t,e){let n=e?.[t.as]??t.as;return Object.hasOwn(t,"value")?t.value:sL(t.channel)?{value:n,scale:"color"}:ZH(t.channel)?{value:n,scale:"opacity"}:n}function kd(t,e,n=[]){let r=ft.from({source:e}),o=new Set,i=!1;for(let s of t){let{channel:a,field:c,as:f}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)i=!0;else{if(o.has(f))continue;o.add(f)}r.select({[f]:c})}}}return i&&r.groupby(Array.from(o)),r}function iS(t,e,n,r,o={}){let{numRows:i,values:s,columns:a}=r??{},c={};for(let u of n){let p=e.has(u.channel)?c:o;p[u.channel]=on(u,a)}return e.size&&(o.channels=c),[{type:t,data:s??(r?{length:i}:null),options:o}]}function Ga(t,e){let{plot:n}=t,r=n.getAttribute(`${e}Scale`);if(!r){let{type:i}=t.channelField(e);r=i==="date"?"time":"linear"}let o={type:r};switch(r){case"log":o.base=n.getAttribute(`${e}Base`)??10;break;case"pow":o.exponent=n.getAttribute(`${e}Exponent`)??1;break;case"symlog":o.constant=n.getAttribute(`${e}Constant`)??1;break}return Fl(o)}function Hn(t,e,n,r,o=1,i){let{field:s}=t.channelField(e);i=i??s;let{type:a,apply:c,sqlApply:f}=Ga(t,e),l=!!t.plot.getAttribute(`${e}Reverse`),[u,p]=r.map(x=>c(x)),d=f(i),h=a==="time"||a==="utc"?d:i,m=p===u?0:(n-o)/(p-u),g=m!==1?` * ${m}::DOUBLE`:"";return[l?U`(${p} - ${d}::DOUBLE)${g}`:U`(${d}::DOUBLE - ${u})${g}`,h]}var sS={x:["min","max"]},aS={y:["min","max"]},h1={...sS,...aS};function aL(t,e,n,r,o){let{plot:i}=t,s=i.getAttribute(r),a=i.getAttribute(o);if(Array.isArray(s)&&!s[qe])return s;{let{column:c,min:f,max:l}=t.channelField(n),u=cS(e,c)||(a?Wo().domain([f,l]).nice().domain():[f,l]);return s!==qr&&(u[qe]=!0),i.setAttribute(r,u,{silent:!0}),u}}function vo(t,e){return aL(t,e,"x","xDomain","xNice")}function _o(t,e){return aL(t,e,"y","yDomain","yNice")}function cS(t,e){if(!t)return;let n,r,o=(i,s)=>{if(i==="BETWEEN"&&`${s.field}`===e){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(t)?t.forEach(i=>i.visit?.(o)):t.visit&&t.visit(o),n!=null&&r!=null&&n!==r?[n,r]:void 0}var Nd=class extends Me{constructor(e,n,r){let o=e.endsWith("X")?"y":e.endsWith("Y")?"x":null,i=o?{[o]:["min","max"]}:void 0;super(e,n,r,i),this.dim=o}query(e=[]){let{plot:n,dim:r,source:o}=this,{optimize:i=!0}=o.options||{},s=super.query(e);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:f,as:l,type:u,min:p,max:d}=this.channelField(r);if(i&&(u==="date"||u==="number")&&c){let m=r==="x"?n.innerWidth():n.innerHeight(),[g,y]=cS(e,f)||[p,d],[x]=Hn(this,r,m,[g,y],1,l),b=s.select().map(w=>w.as).filter(w=>w!==l&&w!==c);return KH(s,x,l,c,b)}else return s.orderby(f)}};function KH(t,e,n,r,o=[]){let i=U`FLOOR(${e})::INTEGER`,s=a=>ft.from(t).select(a).groupby(i,o);return ft.union(s([{[n]:tr(n),[r]:lc(r,n)},...o]),s([{[n]:Kn(n),[r]:uc(r,n)},...o]),s([{[n]:lc(n,r),[r]:tr(r)},...o]),s([{[n]:uc(n,r),[r]:Kn(r)},...o])).orderby(o,n)}function cL(t,e=[]){return new e.constructor(t)}function fL(t,e,n){let r=cL(t,n),o=n.length;for(let i=0;i<o;++i)r[e[i]]=n[i];return r}function lL(t,e,n,r,o,i,s){let a=n.length,c=t*e,f=o.map(d=>r[d]),l={},u=[],p=new Int32Array(a);if(i?.length){let d=i.map(m=>r[m]),h={};for(let m=0;m<a;++m){let g=d.map(y=>y[m]);p[m]=h[g]??=u.push(g)-1}for(let m=0;m<i.length;++m)l[i[m]]=u.map(g=>g[m])}else u.push([]);if(s){let d=n.map(g=>g%t),h=n.map(g=>Math.floor(g/t)),m=u.map(()=>[]);for(let g=0;g<a;++g)m[p[g]].push(g);o.forEach((g,y)=>{let x=f[y];l[g]=u.map((b,w)=>s(m[w],t,e,d,h,x))})}else o.forEach((d,h)=>{let m=f[h],g=l[d]=u.map(()=>cL(c,m));for(let y=0;y<a;++y)g[p[y]][n[y]]=m[y]});return{numRows:u.length,columns:l}}function Od(t){let e=1/0,n=-1/0;return t.forEach(r=>{let o=r.length;for(let i=0;i<o;++i){let s=r[i];s<e&&(e=s),s>n&&(n=s)}}),Number.isFinite(e)&&Number.isFinite(n)?[e,n]:[0,1]}function uL(t){let e=new fn;return t.forEach(n=>{let r=n.length;for(let o=0;o<r;++o)e.add(n[o])}),Array.from(e).sort(gt)}function le(t,e){return En(t)?(t.addEventListener("value",e),t.value):t}function Rd(t,e=!1){let n=new Float64Array(5),r=new Float64Array(4);tZ(n,r,t);let o=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]),i=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/i,a=(o[1]+o[2]+o[3]+o[4])/i;return{sigma:t,negative:e,a:n,b_causal:r,b_anticausal:o,sum_causal:s,sum_anticausal:a}}function tZ(t,e,n){let o=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,f=Float64Array.of(-i*Math.cos(a),i*Math.sin(a),-i*Math.cos(-a),i*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),l=n*2.5066282746310007,u=Float64Array.of(o[0],o[1],0,0,0,0,0,0),p=Float64Array.of(1,0,f[0],f[1],0,0,0,0,0,0),d,h;for(h=2;h<8;h+=2){for(u[h]=f[h]*u[h-2]-f[h+1]*u[h-1],u[h+1]=f[h]*u[h-1]+f[h+1]*u[h-2],d=h-2;d>0;d-=2)u[d]+=f[h]*u[d-2]-f[h+1]*u[d-1],u[d+1]+=f[h]*u[d-1]+f[h+1]*u[d-2];for(d=0;d<=h;d+=2)u[d]+=o[h]*p[d]-o[h+1]*p[d+1],u[d+1]+=o[h]*p[d+1]+o[h+1]*p[d];for(p[h+2]=f[h]*p[h]-f[h+1]*p[h+1],p[h+3]=f[h]*p[h+1]+f[h+1]*p[h],d=h;d>0;d-=2)p[d]+=f[h]*p[d-2]-f[h+1]*p[d-1],p[d+1]+=f[h]*p[d-1]+f[h+1]*p[d-2]}for(h=0;h<4;++h)d=h<<1,e[h]=u[d]/l,t[h+1]=p[d+2]}function pL(t,e,n,[r,o]){let i=new Float64Array(Math.max(r,o)),s=new Float64Array(Math.max(r,o)),a=new Float64Array(5),c=new Float64Array(n.length);for(let f=0,l=0;f<o;++f,l+=r){let u=c.subarray(l);m1(t,n.subarray(l),r,1,i,s,a,u)}for(let f=0;f<r;++f){let l=c.subarray(f);m1(e,l,o,r,i,s,a,l)}return c}function m1(t,e,n,r=1,o=new Float64Array(n),i=new Float64Array(n),s=new Float64Array(5),a=o,c=eZ){let f=r*2,l=r*3,u=r*4,p=r*n,d,h;for(c(o,e,n,r,t.b_causal,3,t.a,4,t.sum_causal,s,t.sigma),h=4,d=u;h<n;++h,d+=r)o[h]=t.b_causal[0]*e[d]+t.b_causal[1]*e[d-r]+t.b_causal[2]*e[d-f]+t.b_causal[3]*e[d-l]-t.a[1]*o[h-1]-t.a[2]*o[h-2]-t.a[3]*o[h-3]-t.a[4]*o[h-4];for(c(i,e,n,-r,t.b_anticausal,4,t.a,4,t.sum_anticausal,s,t.sigma),h=4,d=p-r*5;h<n;++h,d-=r)i[h]=t.b_anticausal[1]*e[d+r]+t.b_anticausal[2]*e[d+f]+t.b_anticausal[3]*e[d+l]+t.b_anticausal[4]*e[d+u]-t.a[1]*i[h-1]-t.a[2]*i[h-2]-t.a[3]*i[h-3]-t.a[4]*i[h-4];if(t.negative)for(h=0,d=0;h<n;++h,d+=r)a[d]=o[h]+i[n-h-1];else for(h=0,d=0;h<n;++h,d+=r)a[d]=Math.max(0,o[h]+i[n-h-1]);return a}function eZ(t,e,n,r,o,i,s,a,c,f,l,u=.5){let p=Math.abs(r)*n,d=r<0?p+r:0,h,m,g;for(m=0;m<=a;++m)for(f[m]=m<=i?o[m]:0,g=1;g<=a&&g<=m;++g)f[m]-=s[g]*f[m-g];for(g=0;g<a;++g)for(t[g]=0,m=1;m<=g;++m)h=d+r*m,h>=0&&h<p&&(t[g]+=f[g-m]*e[h]);let y=e[d],x=Math.ceil(l*10);for(m=0;m<x;++m){for(g=0;g<a;++g)t[g]+=f[g]*y;if(c-=Math.abs(f[0]),c<=u)break;for(f[a]=m+a<=i?o[m+a]:0,g=1;g<=a;++g)f[a]-=s[g]*f[a-g];for(g=0;g<a;++g)f[g]=f[g+1]}}var vi="density",Cr=class extends Me{constructor(e,n,r){let{bandwidth:o=0,interpolate:i="none",pixelSize:s=1,pad:a=1,width:c,height:f,...l}=r,u=nZ(l);super(e,n,l,h1),this.densityMap=u,this.bandwidth=le(o,p=>(this.bandwidth=p,this.grids?this.convolve().update():null)),this.interpolate=le(i,p=>(this.interpolate=p,this.requestUpdate())),this.pixelSize=le(s,p=>(this.pixelSize=p,this.requestUpdate())),this.pad=le(a,p=>(this.pad=p,this.requestUpdate())),this.width=le(c,p=>(this.width=p,this.requestUpdate())),this.height=le(f,p=>(this.height=p,this.requestUpdate()))}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};e.addAttributeListener("xDomain",r),e.addAttributeListener("yDomain",r),super.setPlot(e,n)}get filterIndexable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[qe]&&!n[qe]}query(e=[]){let{interpolate:n,pad:r,channels:o,densityMap:i,source:s}=this,[a,c]=this.extentX=vo(this,e),[f,l]=this.extentY=_o(this,e),[u,p]=this.bins=this.binDimensions(),[d,h]=Hn(this,"x",u,[a,c],r),[m,g]=Hn(this,"y",p,[f,l],r),y=r?[ue(h,[+a,+c]),ue(g,[+f,+l])]:[Ro(+a,h),Oo(h,+c),Ro(+f,g),Oo(g,+l)],x=ft.from(s.table).where(e.concat(y)),b=this.groupby=[],w={};for(let v of o)if(Object.hasOwn(v,"field")){let{as:A,channel:E,field:T}=v;T.aggregate?(w[E]=T,i[E]=!0):E==="weight"?w[vi]=Ln(T):E!=="x"&&E!=="y"&&(x.select({[A]:T}),b.push(A))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(vi),w.density=sn()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return iZ(x,d,m,w[vi],u,b)}else return oZ(x,d,m,w,u,b)}binDimensions(){let{plot:e,pixelSize:n,width:r,height:o}=this;return[r??Math.round(e.innerWidth()/n),o??Math.round(e.innerHeight()/n)]}queryResult(e){let[n,r]=this.bins,o=rZ(this.interpolate),{columns:i}=In(e);return this.grids0=lL(n,r,i.index,i,this.aggr,this.groupby,o),this.convolve()}convolve(){let{aggr:e,bandwidth:n,bins:r,grids0:o,plot:i}=this;if(this.grids=o,n>0){let s=e.length===1?e[0]:e.includes(vi)?vi:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.columns[s],c=i.innerWidth(),f=i.innerHeight(),[l,u]=r,p=a.some(m=>m.some(g=>g<0)),d=Rd(n*(l-1)/c,p),h=Rd(n*(u-1)/f,p);this.grids={numRows:o.numRows,columns:{...o.columns,[s]:a.map(m=>pL(d,h,m,r))}}}return this}};function nZ(t){let e={};for(let n in t)t[n]==="density"&&(delete t[n],e[n]=!0);return e}function rZ(t="none"){if(typeof t=="function")return t;switch(t.toLowerCase()){case"none":case"linear":return;case"nearest":return hd;case"barycentric":return dd();case"random-walk":return md()}throw new Error(`invalid interpolate: ${t}`)}function oZ(t,e,n,r,o,i){return t.select({index:U`FLOOR(${e})::INTEGER + FLOOR(${n})::INTEGER * ${o}`,...r}).groupby("index",i)}function iZ(t,e,n,r,o,i){let s=r?.column?`* ${r.column}`:"",a=(p,d)=>t.clone().select({xp:e,yp:n,i:p,w:d}),c=a(U`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(U`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),l=a(U`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),u=a(U`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return ft.from(ft.unionAll(c,f,l,u)).select({index:"i",density:Ln("w")},i).groupby("index",i).having(Bs("density",0))}var Ld=class extends Cr{constructor(e,n){let{thresholds:r=10,...o}=n;super("geo",e,{bandwidth:20,interpolate:"linear",pixelSize:2,...o}),this.thresholds=le(r,i=>(this.thresholds=i,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:e,densityMap:n,grids:r,thresholds:o,plot:i}=this,{numRows:s,columns:a}=r,c=o,f;if(Array.isArray(c))f=c;else{let[,M]=Od(a.density);f=Array.from({length:c-1},(k,R)=>M*(R+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[l,u]=e,[p,d]=i.getAttribute("xDomain"),[h,m]=i.getAttribute("yDomain"),g=(d-p)/l,y=(m-h)/u,x=+p,b=+h,w=M=>x+M*g,_=M=>b+M*y,v=qi().size(e),A=this.contourData=Array(s*f.length),{density:E,...T}=a,$=Object.entries(T);for(let M=0,k=0;M<s;++M){let R=E[M],S=$.reduce((I,[C,N])=>(I[C]=N[M],I),{});for(let I=0;I<f.length;++I,++k)A[k]=Object.assign(sZ(v.contour(R,f[I]),w,_),S)}return this}plotSpecs(){let{type:e,channels:n,densityMap:r,contourData:o}=this,i={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(i[a]=on(s))}for(let s in r)r[s]&&(i[s]=on({channel:s,as:"value"}));return[{type:e,data:o,options:i}]}};function sZ(t,e,n){function r(s){s.forEach(o)}function o(s){s.forEach(i)}function i(s){s[0]=e(s[0]),s[1]=n(s[1])}return t.coordinates.forEach(r),t}function Dd(t){return Array.from({length:t},(e,n)=>n)}function g1(t,e){let n=e.reduce((o,i,s)=>(o[i]=s,o),{}),r=Dd(t.length);return r.sort((o,i)=>n[t[o]]-n[t[i]]),r}function y1(t,e){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",t),n.setAttribute("height",e),n}throw new Error("Can not create a canvas instance.")}function dL(t=1){let e=255*t|0;return(n,r,o)=>{for(let i=0,s=0;i<o;++i)for(let a=0;a<r;++a,s+=4)n[s+3]=e}}function hL(t){let{apply:e}=t;return(n,r,o,i)=>{for(let s=0,a=0;s<o;++s)for(let c=0,f=(o-s-1)*r;c<r;++c,a+=4)n[a+3]=255*e(i[c+f])|0}}function mL(t={}){let{r:e=0,g:n=0,b:r=0,opacity:o=1}=typeof t=="string"?ve(t):t,i=new Uint8ClampedArray([e,n,r,255*o|0]);return(s,a,c)=>{for(let f=0,l=0;f<c;++f)for(let u=0;u<a;++u,l+=4)s[l+0]=i[0],s[l+1]=i[1],s[l+2]=i[2],s[l+3]=i[3]}}function gL(t){let{domain:e,range:n}=t,r=Object.create(null),o=new Uint8ClampedArray(4*e.length),i=e.length-1,s=n.length;for(let a=0;a<=i;++a){let c=n[a%s],{r:f,g:l,b:u,opacity:p=1}=typeof c=="string"?ve(c):c,d=a<<2;o[d+0]=f,o[d+1]=l,o[d+2]=u,o[d+3]=255*p|0,r[e[a]]=d}return(a,c,f,l)=>{if(l.map)for(let u=0,p=0;u<f;++u)for(let d=0,h=(f-u-1)*c;d<c;++d,p+=4){let m=r[l[d+h]];a[p+0]=o[m+0],a[p+1]=o[m+1],a[p+2]=o[m+2],a[p+3]=o[m+3]}else{let u=r[l];for(let p=0,d=0;p<f;++p)for(let h=0;h<c;++h,d+=4)a[d+0]=o[u+0],a[d+1]=o[u+1],a[d+2]=o[u+2],a[d+3]=o[u+3]}}}function yL(t,e,n){let{interpolate:r}=e,o=new Uint8ClampedArray(4*t),i=t-1;for(let s=0;s<=i;++s){let a=r(s/i),{r:c,g:f,b:l,opacity:u=1}=typeof a=="string"?ve(a):a,p=s<<2;o[p+0]=c,o[p+1]=f,o[p+2]=l,o[p+3]=255*u|0}return(s,a,c,f)=>{for(let l=0,u=0;l<c;++l)for(let p=0,d=(c-l-1)*a;p<a;++p,u+=4){let h=i*n(f[p+d])<<2;s[u+0]=o[h+0],s[u+1]=o[h+1],s[u+2]=o[h+2],s[u+3]=o[h+3]}}}var As=class extends Cr{constructor(e,n){super("image",e,n),this.image=null}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};e.addAttributeListener("schemeColor",r),super.setPlot(e,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:e,grids:n}=this,[r,o]=e,{numRows:i,columns:s}=n,{canvas:a,ctx:c,img:f}=lZ(this,r,o),{alpha:l,alphaProp:u,color:p,colorProp:d}=fS(this),h=s[u]??[],m=s[d]??[],g=i>1&&d&&this.groupby?.includes(d)?g1(m,this.plot.getAttribute("colorDomain")):Dd(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(y,x)=>(p?.(f.data,r,o,m[g[x]]),l?.(f.data,r,o,h[g[x]]),c.putImageData(f,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:e,plot:n,data:{numRows:r,columns:o}}=this,i={src:o.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:e,data:{length:r},options:i}]}},Pd=class extends As{constructor(e,n){super(e,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function fS(t){let{aggr:e,densityMap:n,groupby:r,plot:o}=t,i=e.includes(vi),s=e.includes("fillOpacity"),a=t.channel("fill"),c=t.channel("fillOpacity");if(e.length>2||i&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let f=n.fill||e.includes("fill")?"grid":r.includes(a?.as)?"group":p1(a?.value)?a.value:i&&o.getAttribute("colorScheme")?"grid":void 0,l=n.fillOpacity||e.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:i&&f!=="grid"?"grid":void 0;if(f!=="grid"&&l!=="grid")throw new Error("Raster mark missing density values.");let u=a?.as??(f==="grid"?vi:null),p=c?.as??(l==="grid"?vi:null),d=f!=="grid"&&f!=="group"?mL(f):cZ(t,u),h=l!=="grid"?dL(l):aZ(t,p);return{alphaProp:p,colorProp:u,alpha:h,color:d}}function aZ(t,e){let{plot:n,grids:r}=t,o=n.getAttribute("opacityDomain"),i=o===qr,s=o?.[qe],a=!i&&!s&&o||Od(r.columns[e]);(i||s||!o)&&(i||(a[qe]=!0),n.setAttribute("opacityDomain",a));let c=is({opacity:{type:n.getAttribute("opacityScale"),domain:a,clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return hL(c)}function cZ(t,e){let{plot:n,grids:r}=t,o=r.columns[e],i=!o[0]?.map,s=i||Array.isArray(o[0]),a=n.getAttribute("colorDomain"),c=a===qr,f=a?.[qe],l=!c&&!f&&a||(i?o.slice().sort(gt):s?uL(o):Od(o));(c||f||!a)&&(c||(l[qe]=!0),n.setAttribute("colorDomain",l));let u=is({color:{type:n.getAttribute("colorScale"),domain:l,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(s)return gL(u);{let p=is({x:{type:fZ(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return yL(1024,u,p.apply)}}function fZ(t){return t.endsWith("symlog")?"symlog":t.endsWith("log")?"log":t.endsWith("pow")?"pow":t.endsWith("sqrt")?"sqrt":t==="diverging"?"linear":t}function lZ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=y1(e,n),o=r.getContext("2d",{willReadFrequently:!0}),i=o.getImageData(0,0,e,n);t.image={canvas:r,ctx:o,img:i,w:e,h:n}}return t.image}var Fd=class extends As{constructor(e,n){let{normalize:r=!0,...o}=n;super(e,o),this.normalize=le(r,i=>(this.normalize=i,this.requestUpdate()))}query(e=[]){let{channels:n,normalize:r,source:o,pad:i}=this,[s,a]=this.bins=this.binDimensions(),[c]=Hn(this,"x",s,vo(this,e),i),[f]=Hn(this,"y",a,_o(this,e),i),l=ft.from(o.table).where(uZ(this,e));this.aggr=["density"];let u=this.groupby=[],p=[];for(let d of n)if(Object.hasOwn(d,"field")){let{channel:h,field:m}=d;h==="z"?(l.select({[h]:m}),p.push("z")):h!=="x"&&h!=="y"&&(l.select({[h]:m}),u.push(h))}return pZ(l,c,f,p,s,a,u,r)}};function uZ(t,e){if(Array.isArray(e)&&!e.length)return e;let{column:n}=t.channelField("x"),{column:r}=t.channelField("y"),o=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==n&&a!==r},i=s=>s.op==="AND"?Tn(s.children.filter(a=>o(a))):s;return Array.isArray(e)?e.filter(s=>o(s)).map(s=>i(s)):i(e)}function pZ(t,e,n,r,o,i,s=[],a=!0){t.select({x:U`FLOOR(${e})::INTEGER`,y:U`FLOOR(${n})::INTEGER`});let c=s.concat(r),f=c.length?`PARTITION BY ${c.join(", ")} `:"",l=ft.from(t).select(c,{x0:"x",y0:"y",dx:U`(lead(x) OVER sw - x)`,dy:U`(lead(y) OVER sw - y)`}).window({sw:U`${f}ORDER BY x ASC`}).qualify(Tn(U`(x0 < ${o} OR x0 + dx < ${o})`,U`(y0 < ${i} OR y0 + dy < ${i})`,U`(x0 > 0 OR x0 + dx > 0)`,U`(y0 > 0 OR y0 + dy > 0)`)),u=ft.select({x:U`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),p=ft.select({i:U`UNNEST(range((${u})))::INTEGER`}),d=ft.unionAll(ft.select(c,{x:U`x0 + i`,y:U`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(U`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),ft.select(c,{x:U`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:U`y0 + SIGN(dy) * i`}).from("pairs","indices").where(U`ABS(dy) > ABS(dx) AND i < ABS(dy)`),ft.select(c,{x:"x0",y:"y0"}).from("pairs").where(qs("dx"))),h=["x"].concat(c).join(", "),m=ft.from("raster").select(c,"x","y",a?{w:U`1.0 / COUNT(*) OVER (PARTITION BY ${h})`}:null).where(Tn(ue("x",[0,o],!0),ue("y",[0,i],!0)));return ft.with({pairs:l,indices:p,raster:d,points:m}).from("points").select(s,{index:U`x + y * ${o}::INTEGER`,density:a?Ln("w"):sn()}).groupby("index",s)}var Kf=class extends Me{constructor(e,n,r){let{bins:o=1024,bandwidth:i=20,...s}=r,a=e.endsWith("X")?"y":"x";super(e,n,s,a==="x"?sS:aS),this.dim=a,this.bins=le(o,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=le(i,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let e=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(e);return n&&!n[qe]}query(e=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:o,source:{table:i}}=this,s=this.extent=(o==="x"?vo:_o)(this,e),[a,c]=Hn(this,o,n,s),f=kd(r,i,[o]).where(e.concat(ue(c,s))),l=this.channelField("weight")?"weight":null;return dZ(f,a,l)}queryResult(e){let{columns:{index:n,density:r}}=In(e);return this.grid=fL(this.bins,n,r),this.convolve()}convolve(){let{bins:e,bandwidth:n,dim:r,grid:o,plot:i,extent:[s,a]}=this,c=o.some(b=>b<0),f=r==="x"?i.innerWidth():i.innerHeight(),l=Rd(n*(e-1)/f,c),u=m1(l,o,e),p=r==="x"?"y":"x",d=this.channelField(r).as,h=+s,m=(a-h)/(e-1),g=1/m,y=new Float64Array(e),x=new Float64Array(e);for(let b=0;b<e;++b)y[b]=h+b*m,x[b]=u[b]*g;return this.data={numRows:e,columns:{[d]:y,[p]:x}},this}plotSpecs(){let{type:e,data:{numRows:n,columns:r},channels:o,dim:i}=this,s=i==="x"?{y:r.y}:{x:r.x};for(let a of o)s[a.channel]=on(a,r);return[{type:e,data:{length:n},options:s}]}};function dZ(t,e,n){let r=n?`* ${n}`:"",o=t.clone().select({p:e,i:U`FLOOR(p)::INTEGER`,w:U`(FLOOR(p) + 1 - p)${r}`}),i=t.clone().select({p:e,i:U`FLOOR(p)::INTEGER + 1`,w:U`(p - FLOOR(p))${r}`});return ft.from(ft.unionAll(o,i)).select({index:"i",density:Ln("w")}).groupby("index").having(Cl("density",0))}var qd=class extends Cr{constructor(e,n){let{type:r="dot",...o}=n;super(r,e,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...o})}convolve(){super.convolve();let{bins:e,pad:n,extentX:r,extentY:o}=this,[i,s]=e,a=Ga(this,"x"),c=Ga(this,"y"),[f,l]=r.map(g=>a.apply(g)),[u,p]=o.map(g=>c.apply(g)),d=(l-f)/(i-n),h=(p-u)/(s-n),m=n?0:.5;return this.data=hZ(this.grids,e,f,u,d,h,a.invert,c.invert,m),this}plotSpecs(){let{type:e,channels:n,densityMap:r,data:{numRows:o,columns:i}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?i[c]:on(a,i)}for(let a in r)r[a]&&(s[a]=i.density);return[{type:e,data:{length:o},options:s}]}};function hZ(t,e,n,r,o,i,s,a,c){let f=1/(o*i),[l,u]=e,p=l*u,d=p*t.numRows,h=new Float64Array(d),m=new Float64Array(d),g=new Float64Array(d),y={x:h,y:m,density:g},{density:x,...b}=t.columns;for(let _ in b)y[_]=new b[_].constructor(d);let w=0;for(let _=0;_<t.numRows;++_){for(let A in b)y[A].fill(b[A][_],w,w+p);let v=x[_];for(let A=0,E=0;E<u;++E)for(let T=0;T<l;++T,++w,++A)h[w]=s(n+(T+c)*o),m[w]=a(r+(E+c)*i),g[w]=v[A]*f}return{numRows:d,columns:y}}function mZ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,l,u,p,d,h,m,g,y;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,l=Math.sqrt(-2*Math.log(f)),d=(2.30753+l*.27061)/(1+l*(.99229+l*.04481))-l,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),g=d*Math.sqrt(h+m)/m-(1/(2*n-1)-1/(2*e-1))*(h+5/6-2/(3*m)),d=e/(e+n*Math.exp(2*g))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),l=Math.exp(e*a)/e,u=Math.exp(n*c)/n,g=l+u,t<l/g?d=Math.pow(e*g*t,1/e):d=1-Math.pow(n*g*(1-t),1/n)),y=-tl(e)-tl(n)+tl(e+n);s<10;s++){if(d===0||d===1)return d;if(p=gZ(d,e,n)-t,l=Math.exp(o*Math.log(d)+i*Math.log(1-d)+y),u=p/l,d-=l=u/(1-.5*Math.min(1,u*(o/d-i/(1-d)))),d<=0&&(d=.5*(d+l)),d>=1&&(d=.5*(d+l+1)),Math.abs(l)<r*d&&s>0)break}return d}function gZ(t,e,n){var r=t===0||t===1?0:Math.exp(tl(e+n)-tl(e)-tl(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?0:t<(e+1)/(e+n+2)?r*xL(t,e,n)/e:1-r*xL(1-t,n,e)/n}function xL(t,e,n){var r=1e-30,o=1,i=e+n,s=e+1,a=e-1,c=1,f=1-i*t/s,l,u,p,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(l=2*o,u=o*(n-o)*t/((a+l)*(e+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,u=-(e+o)*(i+o)*t/((e+l)*(s+l)),f=1+u*f,Math.abs(f)<r&&(f=r),c=1+u/c,Math.abs(c)<r&&(c=r),f=1/f,p=f*c,d*=p,!(Math.abs(p-1)<3e-7));o++);return d}function tl(t){var e=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,o,i,s;for(s=(i=o=t)+5.5,s-=(o+.5)*Math.log(s);e<6;e++)r+=n[e]/++i;return Math.log(2.506628274631*r/o)-s}function bL(t,e){var n=mZ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}function wL(t){let e=-Math.log((1-t)*(1+t)),n;return e<6.25?(e-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*e,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=-1333171662854621e-31+n*e,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=-4054566272975207e-29+n*e,n=-8151934197605472e-29+n*e,n=26335093153082323e-28+n*e,n=-12975133253453532e-27+n*e,n=-5415412054294628e-26+n*e,n=10512122733215323e-25+n*e,n=-4112633980346984e-24+n*e,n=-29070369957882005e-24+n*e,n=42347877827932404e-23+n*e,n=-13654692000834679e-22+n*e,n=-13882523362786469e-21+n*e,n=.00018673420803405714+n*e,n=-.000740702534166267+n*e,n=-.006033670871430149+n*e,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*e,n=-27517406297064545e-23+n*e,n=18239629214389228e-24+n*e,n=15027403968909828e-22+n*e,n=-4013867526981546e-21+n*e,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=-47318229009055734e-21+n*e,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=-.0003550375203628475+n*e,n=.0009532893797373805+n*e,n=-.0016882755560235047+n*e,n=.002491442096107851+n*e,n=-.003751208507569241+n*e,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*e,n=15076572693500548e-25+n*e,n=-3789465440126737e-24+n*e,n=761570120807834e-23+n*e,n=-1496002662714924e-23+n*e,n=2914795345090108e-23+n*e,n=-6771199775845234e-23+n*e,n=22900482228026655e-23+n*e,n=-99298272942317e-20+n*e,n=4526062597223154e-21+n*e,n=-1968177810553167e-20+n*e,n=7599527703001776e-20+n*e,n=-.00021503011930044477+n*e,n=-.00013871931833623122+n*e,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0,n*t}var el=class extends Me{constructor(e,n,r){let o=e.endsWith("X")?"y":"x",{ci:i=.95,...s}=r;super(e,n,s),this.dim=o,this.field=this.channelField(o).field,this.channels=this.channels.filter(a=>a.channel!==o),this.ci=le(i,a=>(this.ci=a,this.update()))}query(e=[]){let{channels:n,field:r,source:{table:o}}=this,i=n.concat([{field:Nl(r),as:"__avg__"},{field:sn(r),as:"__n__"},{field:Ol(r),as:"__sd__"}]);return kd(i,o).where(e)}queryResult(e){return this.data=In(e),this}plotSpecs(){let{type:e,dim:n,detail:r,data:o,ci:i,channels:s}=this,a=Math.SQRT2*wL(i),{columns:{__avg__:c,__sd__:f,__n__:l}}=o,u={[`${n}1`]:c.map((p,d)=>p-a*f[d]/Math.sqrt(l[d])),[`${n}2`]:c.map((p,d)=>p+a*f[d]/Math.sqrt(l[d]))};return iS(e,r,s,o,u)}};var yZ="geom",Bd=class extends Me{constructor(e,n={},r){!d1(e)&&!n?.geometry&&(n.geometry=Ll(yZ)),super("geo",e,n,r)}queryResult(e){super.queryResult(e);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(o=>JSON.parse(o)))}return this}};var zd=class extends Me{constructor(e,n){let{type:r="hexagon",binWidth:o=20,...i}=n;super(r,e,{r:o/2,clip:!0,...i},h1),this.binWidth=le(o,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[qe]&&!n[qe]}query(e=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:o,source:i}=this,s,a,c=new Set,f={};for(let w of o)if(w.channel!=="orderby"){if(w.channel==="x")s=w;else if(w.channel==="y")a=w;else if(Object.hasOwn(w,"field")){let{as:_,field:v}=w;f[_]=v,v.aggregate||c.add(_)}}let[l,u]=vo(this,e),[p,d]=_o(this,e),h=.5-n.getAttribute("marginLeft"),m=0-n.getAttribute("marginTop"),g=`${r}::DOUBLE`,y=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,x=`${n.innerWidth()/(u-l)}::DOUBLE`,b=`${n.innerHeight()/(d-p)}::DOUBLE`;return ft.select({[s.as]:U`${l}::DOUBLE + ((_x + 0.5 * (_y & 1)) * ${g} + ${h})::DOUBLE / ${x}`,[a.as]:U`${d}::DOUBLE - (_y * ${y} + ${m})::DOUBLE / ${b}`,...f}).groupby("_x","_y",...c).from(ft.select({_py:U`(${b} * (${d}::DOUBLE - ${a.field}) - ${m}) / ${y}`,_pj:U`ROUND(_py)::INTEGER`,_px:U`(${x} * (${s.field} - ${l}::DOUBLE) - ${h}) / ${g} - 0.5 * (_pj & 1)`,_pi:U`ROUND(_px)::INTEGER`,_tt:U`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:U`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:U`CASE WHEN _tt THEN (_pj + CASE WHEN _py < _pj THEN -1 ELSE 1 END)::INTEGER ELSE _pj END`},"*").from(i.table).where(No(s.field),No(a.field),e))}};var Yd=class extends Cr{constructor(e,n){let{origin:r=[0,0],dim:o="xy",...i}=n;super("image",e,i),this.image=null,this.origin=r,this.tileX=o.toLowerCase().includes("x"),this.tileY=o.toLowerCase().includes("y")}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};e.addAttributeListener("schemeColor",r),super.setPlot(e,n)}requestQuery(){return this.requestTiles()}query(e=[]){return this._filter=e,null}tileQuery(e){let{interpolate:n,pad:r,channels:o,densityMap:i,source:s}=this,[[a,c],[f,l]]=e,[u,p]=this.bins,[d,h]=Hn(this,"x",u,[a,c],r),[m,g]=Hn(this,"y",p,[f,l],r),y=r?[ue(h,[+a,+c]),ue(g,[+f,+l])]:[Ro(+a,h),Oo(h,+c),Ro(+f,g),Oo(g,+l)],x=ft.from(s.table).where(y),b=this.groupby=[],w={};for(let v of o)if(Object.hasOwn(v,"field")){let{as:A,channel:E,field:T}=v;T.aggregate?(w[E]=T,i[E]=!0):E==="weight"?w.density=Ln(T):E!=="x"&&E!=="y"&&(x.select({[A]:T}),b.push(A))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),w.density=sn()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return _Z(x,d,m,w.density,u,b)}else return vZ(x,d,m,w,u,b)}async requestTiles(){let e=er();this.prefetch&&e.cancel(this.prefetch);let{pad:n,tileX:r,tileY:o,origin:[i,s]}=this,[a,c]=this.bins=this.binDimensions(),[f,l]=vo(this,this._filter),[u,p]=_o(this,this._filter),d=l-f,h=p-u,m=Math.floor((f-i)*(a-n)/d),g=Math.floor((u-s)*(c-n)/h),y=(M,k)=>[[i+M*d,i+(M+1)*d],[s+k*h,s+(k+1)*h]],x=Math.floor((f-i)/d),b=r?vL((l-i)/d):x,w=Math.floor((u-s)/h),_=o?vL((p-s)/h):w,v=[];for(let M=x;M<=b;++M)for(let k=w;k<=_;++k)v.push([M,k]);let A=v.map(([M,k])=>e.query(this.tileQuery(y(M,k)))),E=[];if(r)for(let M=w;M<=_;++M)E.push([b+1,M]),E.push([x-1,M]);if(o){let M=r?x-1:x,k=r?b+1:b;for(let R=M;R<=k;++R)E.push([R,_+1]),E.push([R,w-1])}this.prefetch=E.map(([M,k])=>e.prefetch(this.tileQuery(y(M,k))));let T=await Promise.all(A),$=xZ(a,c,m,g,v,T);this.grids0={numRows:$.length,columns:{density:[$]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:e,grids:n}=this,[r,o]=e,{numRows:i,columns:s}=n,{canvas:a,ctx:c,img:f}=wZ(this,r,o),{alpha:l,alphaProp:u,color:p,colorProp:d}=fS(this),h=s[u]??[],m=s[d]??[],g=i>1&&d&&this.groupby?.includes(d)?g1(m,this.plot.getAttribute("colorDomain")):Dd(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(y,x)=>(p?.(f.data,r,o,m[g[x]]),l?.(f.data,r,o,h[g[x]]),c.putImageData(f,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:e,plot:n,data:{numRows:r,columns:o}}=this,i={src:o.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:e,data:{length:r},options:i}]}};function xZ(t,e,n,r,o,i){let s=new Float64Array(t*e);return i.forEach((a,c)=>{let[f,l]=o[c],u=f*t-n,p=l*e-r;bZ(t,e,s,a,u,p)}),s}function bZ(t,e,n,r,o,i){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let f=0;f<s;++f){let l=a[f],u=o+l%t,p=i+Math.floor(l/t);0<=u&&u<t&&0<=p&&p<e&&(n[u+p*t]=c[f])}}function wZ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=y1(e,n),o=r.getContext("2d",{willReadFrequently:!0}),i=o.getImageData(0,0,e,n);t.image={canvas:r,ctx:o,img:i,w:e,h:n}}return t.image}function vZ(t,e,n,r,o,i){return t.select({index:U`FLOOR(${e})::INTEGER + FLOOR(${n})::INTEGER * ${o}`,...r}).groupby("index",i)}function _Z(t,e,n,r,o,i){let s=r.column?`* ${r.column}`:"",a=(p,d)=>t.clone().select({xp:e,yp:n,i:p,w:d}),c=a(U`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(U`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),l=a(U`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),u=a(U`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${o}`,U`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return ft.from(ft.unionAll(c,f,l,u)).select({index:"i",density:Ln("w")},i).groupby("index",i).having(Bs("density",0))}function vL(t){let e=Math.floor(t);return e===t?e-1:e}var Ud=class extends Me{constructor(e,n){let{ci:r=.95,precision:o=4,...i}=n;super("line",e,i);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=le(r,a=>(this.ci=a,s())),this.precision=le(o,a=>(this.precision=a,s()))}query(e=[]){let n=this.channelField("x").as,r=this.channelField("y").as,o=Array.from(new Set(["stroke","z","fx","fy"].flatMap(i=>this.channelField(i)?.as||[])));return ft.from(super.query(e)).select({intercept:x2(r,n),slope:b2(r,n),n:w2(r,n),ssy:v2(r,n),ssx:_2(r,n),xm:S2(r,n),x0:pc(tr(n).where(No(r))),x1:pc(Kn(n).where(No(r)))}).select(o).groupby(o)}queryResult(e){return this.modelFit=In(e),this.lineData=SZ(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:e,modelFit:n,precision:r,plot:o}=this,i=o.innerWidth();return this.areaData=e?MZ(n,e,r,i):null,this}plotSpecs(){let{lineData:e,areaData:n,channels:r,ci:o}=this,i=e.columns,s=o?n.columns:{},a={x:i.x,y:i.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let f of r)switch(f.channel){case"x":case"y":case"fill":break;case"tip":c.tip=on(f,s);break;case"stroke":a.stroke=on(f,i),c.fill=on(f,s);break;case"strokeOpacity":a.strokeOpacity=on(f,i);break;case"fillOpacity":c.fillOpacity=on(f,s);break;default:a[f.channel]=on(f,i),c[f.channel]=on(f,s);break}return[...o?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:e.numRows},options:a}]}};function lS(t,e){if(t.concat)return t.concat(e);let n=new t.constructor(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function SZ(t){let{x0:e=[],x1:n=[],xm:r,intercept:o,slope:i,n:s,ssx:a,ssy:c,...f}=t.columns,l=(d,h)=>o[h]+d*i[h],u=lS(e,n),p=lS(e.map(l),n.map(l));for(let d in f)f[d]=lS(f[d],f[d]);return{numRows:u.length,columns:{x:u,y:p,...f}}}function MZ(t,e,n,r){let o=t.numRows,{x0:i,x1:s,xm:a,intercept:c,slope:f,n:l,ssx:u,ssy:p,...d}=t.columns,h=Object.keys(d),m={x:[],y1:[],y2:[]};h.forEach(g=>m[g]=[]);for(let g=0;g<o;++g){let y=n*(s[g]-i[g])/r,x=bL((1-e)/2,l[g]-2)*Math.sqrt(p[g]/(l[g]-2));ce(i[g],s[g]-y/2,y).concat(s[g]).forEach(b=>{let w=c[g]+b*f[g],_=x*Math.sqrt(1/l[g]+(b-a[g])**2/u[g]);m.x.push(b),m.y1.push(w-_),m.y2.push(w+_),h.forEach(v=>m[v].push(d[v][g]))})}return{numRows:m.x.length,columns:m}}function _L(t){let e=t.toLowerCase(),n=t.length,r="";for(let o=0;o<n;++o)r+=(t[o]!==e[o]?"-":"")+e[o];return r}function nl(t){let e={};for(let n in t)e[_L(n)]=t[n];return e}function AZ(t){let{channels:e}=t,n=new Set,r=!1,o=!1;for(let i of e){let{channel:s,field:a,as:c}=i;if(s==="orderby")r=!0;else if(a)if(a.aggregate)o=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&o&&n.size&&t.channels.push({channel:"orderby",value:Array.from(n)}),t}var jd=class{constructor(e,{selection:n,channels:r={}}){this.mark=AZ(e),this.selection=n;let o=Object.entries(nl(r));this.channels=o.length?o:[["opacity",.2]],this.selection.addEventListener("value",ml(()=>this.update()))}init(e){this.svg=e;let n=this.values=[],r=this.mark.index,o=this.nodes=e.querySelectorAll(`[data-index="${r}"] > *`),{channels:i}=this;for(let s=0;s<o.length;++s){let a=o[s];n.push(i.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:e,nodes:n,channels:r,values:o,mark:i,selection:s}=this;if(!e)return;let a=await TZ(i,s);for(let c=0;c<n.length;++c){let f=n[c],l=o[c],u=f.__data__,p=a(Array.isArray(u)?u[0]:u);for(let d=0;d<r.length;++d){let[h,m]=r[d];f.setAttribute(h,p?l[d]:m)}}}};async function TZ(t,e){let n=e?.predicate(t);if(!n||n.length===0)return()=>!0;let r=t.filterBy?.predicate(t,!0),o={__:Tn(n)},i=t.query(r);(i.queries||[i]).forEach(c=>{c.groupby().length?c.select(o):c.$select(o)});let s=await t.coordinator.query(i),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function uS(t){let e=t.on,n=!0;function r(o){n=!1,o(),n=!0}return t.reset=(...o)=>{r(()=>t.clear(...o))},t.moveSilent=(...o)=>{r(()=>t.move(...o))},t.on=(...o)=>{if(o.length>1&&o[1]){let i=o[1];o[1]=(...s)=>n&&i(...s)}return e(...o)},t}function SL(){return uS(Lw())}function ML(){return uS(Ow())}function AL(){return uS(Rw())}function Xd(t,e){return t===e||t&&e&&Math.abs(t[0]-e[0])<1e-12&&Math.abs(t[1]-e[1])<1e-12||!1}function So(t,e){let n=t.channelField(e)?.field;return n?.basis||n}function Gd(t,e,n=1){return e.invert(n*Math.floor(t/n))}function x1(){let t=this,e=t.getScreenCTM,n;t.getScreenCTM=()=>t.isConnected?n=e.call(t):n}var Ts=class{constructor(e,{channel:n,selection:r,field:o=void 0,pixelSize:i=1,peers:s=!0,brush:a}){this.mark=e,this.channel=n,this.pixelSize=i||1,this.selection=r,this.peers=s,this.field=o||So(e,n),this.style=a&&nl(a),this.brush=n==="y"?AL():ML(),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(e){let n;e&&(n=e.map(r=>Gd(r,this.scale,this.pixelSize)).sort((r,o)=>r-o)),Xd(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,e),this.selection.update(this.clause(n)))}clause(e){let{mark:n,pixelSize:r,field:o,scale:i}=this;return Gs(o,e,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:i,pixelSize:r})}init(e,n){let{brush:r,channel:o,style:i}=this;this.scale=e.scale(o);let s=e.scale("x").range,a=e.scale("y").range;r.extent([[Bt(s),Bt(a)],[Ct(s),Ct(a)]]);let c=this.value?.map(this.scale.apply).sort(gt),f=St(e).selectAll('g[aria-label="facet"]');if(n=f.size()?f:St(n??e),this.g=n.append("g").attr("class",`interval-${o}`).each(x1).call(r).call(r.moveSilent,c),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}e.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var Vd=class{constructor(e,{selection:n,xfield:r,yfield:o,pixelSize:i=1,peers:s=!0,brush:a}){this.mark=e,this.pixelSize=i||1,this.selection=n,this.peers=s,this.xfield=r||So(e,"x"),this.yfield=o||So(e,"y"),this.style=a&&nl(a),this.brush=SL(),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(e){let{value:n,pixelSize:r,xscale:o,yscale:i}=this,s,a;if(e){let[c,f]=e;s=[c[0],f[0]].map(l=>Gd(l,o,r)).sort(gt),a=[c[1],f[1]].map(l=>Gd(l,i,r)).sort(gt)}(!Xd(s,n?.[0])||!Xd(a,n?.[1]))&&(this.value=e?[s,a]:void 0,this.g.call(this.brush.moveSilent,e),this.selection.update(this.clause(this.value)))}clause(e){let{mark:n,pixelSize:r,xfield:o,yfield:i,xscale:s,yscale:a}=this;return W2([o,i],e,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}init(e){let{brush:n,style:r}=this,o=this.xscale=e.scale("x"),i=this.yscale=e.scale("y"),s=o.range,a=i.range;n.extent([[Bt(s),Bt(a)],[Ct(s),Ct(a)]]);let c=St(e).selectAll('g[aria-label="facet"]'),f=c.size()?c:St(e);if(this.g=f.append("g").attr("class","interval-xy").each(x1).call(n),r){let l=this.g.selectAll("rect.selection");for(let u in r)l.attr(u,r[u])}if(this.value){let[l,u]=this.value[0].map(o.apply).sort(gt),[p,d]=this.value[1].map(i.apply).sort(gt);this.g.call(n.moveSilent,[[l,p],[u,d]])}e.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var Va=class{constructor(e,{selection:n,pointer:r,channels:o,fields:i,maxRadius:s=40}){this.mark=e,this.selection=n,this.clients=new Set().add(e),this.pointer=r,this.channels=o||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=i||this.channels.map(a=>So(e,[a])),this.maxRadius=s,this.valueIndex=-1}clause(e){let{clients:n,fields:r}=this,o={source:this,clients:n};return r.length>1?Xs(r,e&&[e],o):js(r[0],e?.[0],o)}init(e){let n=this,{mark:r,channels:o,selection:i,maxRadius:s}=this,{data:{columns:a}}=r,c=o.map(x=>r.channelField(x).as),f=!Dn(i),l=St(e).selectAll('g[aria-label="facet"]'),u=l.size()?l:St(e),p=e.scale("x").apply,d=e.scale("y").apply,h=Array.from(a[r.channelField("x").as],p),m=Array.from(a[r.channelField("y").as],d),g=this.pointer==="y"?.01:1,y=this.pointer==="x"?.01:1;u.on("pointerenter pointerdown pointermove",function(x){let[b,w]=He(x,this),_=EZ(h,m,b,w,g,y,s);if(_!==this.valueIndex){this.valueIndex=_;let v=_<0?void 0:c.map(A=>a[A][_]);i.update(f?!v||v.length>1?v:v[0]:n.clause(v))}}),!f&&(u.on("pointerleave",()=>{i.update(n.clause(void 0))}),e.addEventListener("pointerenter",x=>{if(!x.buttons){let b=this.channels.map(()=>0);i.activate(this.clause(b))}}))}};function EZ(t,e,n,r,o,i,s){let a=s*s,c=-1;for(let f=0;f<t.length;++f){let l=o*(t[f]-n),u=i*(e[f]-r),p=l*l+u*u;p<=a&&(a=p,c=f)}return c}var TL=(t,e)=>t-e,Wd=class{constructor(e,{x:n=new Fr,y:r=new Fr,xfield:o,yfield:i,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=e,this.xsel=n,this.ysel=r,this.xfield=o||So(e,"x"),this.yfield=i||So(e,"y"),this.zoom=pS(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:f}=e;a&&this.xsel.addEventListener("value",l=>{f.setAttribute("xDomain",l)&&f.update()}),c&&this.ysel.addEventListener("value",l=>{f.setAttribute("yDomain",l)&&f.update()})}publish(e){if(this.panx){let n=IZ(e,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=$Z(e,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(e,n,r){return Gs(n,e,{source:this,clients:this.mark.plot.markSet,scale:r})}init(e){if(this.svg=e,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:o}},xsel:i,ysel:s}=this;this.xscale=e.scale("x"),this.yscale=e.scale("y");let a=this.xscale.range.slice().sort(TL),c=this.yscale.range.slice().sort(TL),f=pS(n,[-1/0,1/0],a),l=pS(r,[-1/0,1/0],c),u=J_().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[f[0],l[0]],[f[1],l[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>o.__zoom=new Yn(1,0,0)).on("zoom",({transform:p})=>this.publish(p));if(St(o).call(u),n||r){let p=!1;o.addEventListener("pointerenter",d=>{if(!p&&(p=!0,!d.buttons)){if(n){let{xscale:h,xfield:m}=this;i.activate(this.clause(h.domain,m,h))}if(r){let{yscale:h,yfield:m}=this;s.activate(this.clause(h.domain,m,h))}}}),o.addEventListener("pointerleave",()=>p=!1)}}};function pS(t,e,n){return t?Array.isArray(t)?t:e:n}function IZ(t,e){return e.range.map(t.invertX,t).map(e.invert,e)}function $Z(t,e){return e.range.map(t.invertY,t).map(e.invert,e)}var Wa=class{constructor(e,{selection:n,channels:r,peers:o=!0}){this.value=null,this.mark=e,this.selection=n,this.peers=o;let i=this.fields=[],s=this.as=[];r.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let f=0;f<c.length;++f){let l=e.channelField(c[f],{exact:!0});if(l){i.push(l.field?.basis||l.field),s.push(l.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(e){let{fields:n,mark:r}=this;return Xs(n,e,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}init(e,n,r){let{mark:o,as:i,selection:s}=this,{data:{columns:a={}}={}}=o;r??=f=>i.map(l=>{let u=f.__data__;return a[l][Array.isArray(u)?u[0]:u]}),n??=`[data-index="${o.index}"]`;let c=new Set(e.querySelectorAll(n));e.addEventListener("pointerdown",f=>{let l=s.single?s.value:this.value,u=f.target,p=null;if(CZ(c,u)){let d=r(u);(f.shiftKey||f.metaKey)&&l?.length?(p=l.filter(h=>dS(h,d)),p.length===l.length&&p.push(d)):l?.length===1&&!dS(l[0],d)?p=null:p=[d]}this.value=p,kZ(l,p)&&s.update(this.clause(p))}),e.addEventListener("pointerenter",f=>{f.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function CZ(t,e){return t.has(e)||t.has(e.parentNode)||t.has(e.parentNode?.parentNode)}function kZ(t,e){return t==null||e==null?t!=null||e!=null:t.length!==e.length||t.some((n,r)=>dS(n,e[r]))}function dS(t,e){let n=t.length;if(e.length!==n)return!0;for(let r=0;r<n;++r)if(t[r]!==e[r])return!0;return!1}var IL=":scope > div, :scope > span",b1="swatch",EL="ramp",rl=class{constructor(e,n){let{as:r,field:o,...i}=n;this.channel=e,this.options=i,this.type=null,this.handler=null,this.selection=r,this.field=o,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(e){this.plot=e}init(e){let n=NZ(this,e);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;let{selection:e,handler:n}=this,{single:r,value:o}=e,i=r?o:e.valueFor(n),s=i&&i.length?new Set(i.map(c=>c[0])):null,a=this.legend.querySelectorAll(IL);for(let c of a){let f=s?s.has(c.__data__):!0;c.style.opacity=f?1:.2}}};function NZ(t,e){let{channel:n,plot:r,selection:o}=t,i=e.scale(n),s=i.type==="ordinal"?b1:EL,a={label:r.getAttribute(`${n}Label`)??null,...t.options},c=s===b1?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},f=e.legend(n,c);t.legend=f;let l=!!o;if(l&&s===EL){let u=c.width??240,p=DZ(i,u);p?f.scale=function(d){return d==="x"?{range:[0,u]}:d==="y"?{range:[-10,0]}:d===n?p:void 0}:l=!1}if(l){let u=OZ(t,s);s===b1?(u.init(f,IL,p=>[p.__data__]),t.update()):u.init(f,f.querySelector("g:last-of-type"))}return f}function OZ(t,e){let{channel:n,handler:r,selection:o}=t;if(r)return r;let i=RZ(t);return e===b1?(t.handler=new Wa(i,{selection:o,channels:[n],peers:!1}),o.addEventListener("value",()=>t.update())):t.handler=new Ts(i,{selection:o,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),t.handler}function RZ(t){let{channel:e,plot:n}=t,r=t.field??LZ(n.marks,e)??"value";if(r){let o={field:r};return{plot:n,channelField:i=>e===i?o:void 0}}}function LZ(t,e){let n=e==="color"?["fill","stroke"]:e==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=t.length-1;r>-1;--r)for(let o of n){let i=t[r].channelField(o,{exact:!0});if(i)return i.field}return null}function DZ(t,e){let{apply:n,invert:r,interpolate:o,...i}=t,s=t.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return is({x:{...i,type:a,range:[0,e]}})}function w1(t,e,n=0,r=Math.LN10){let o,i=Math.ceil(Math.log(e)/r),s=Math.max(n,Math.pow(10,Math.round(Math.log(t)/r)-i));for(;Math.ceil(t/s)>e;)s*=10;let a=[5,2];for(let c=0,f=a.length;c<f;++c)o=s/a[c],o>=n&&t/o<=e&&(s=o);return s}function $L(t,e,n){let{step:r,steps:o,minstep:i=0,nice:s=!0}=n;if(s!==!1){let a=e-t,c=Math.LN10;r=r||w1(a,o||25,i,c);let f=Math.log(r),l=f>=0?0:~~(-f/c)+1,u=Math.pow(10,-l-1);f=Math.floor(t/r+u)*r,t=t<f?f-r:f,e=Math.ceil(e/r)*r,o=Math.round((e-t)/r)}return{min:t,max:e,steps:o}}var OL="year",CL="month",kL="day",v1="hour",_1="minute",S1="second",PZ="millisecond",Zd=1e3,Qd=Zd*60,Jd=Qd*60,M1=Jd*24,FZ=M1*7,NL=M1*30,RL=M1*365,Hd=[[S1,1,Zd],[S1,5,5*Zd],[S1,15,15*Zd],[S1,30,30*Zd],[_1,1,Qd],[_1,5,5*Qd],[_1,15,15*Qd],[_1,30,30*Qd],[v1,1,Jd],[v1,3,3*Jd],[v1,6,6*Jd],[v1,12,12*Jd],[kL,1,M1],[kL,7,FZ],[CL,1,NL],[CL,3,3*NL],[OL,1,RL]];function LL(t,e,n){let r=e-t,o=r/n,i=wr(s=>s[2]).right(Hd,o);return i===Hd.length?{interval:OL,step:w1(r/RL,n)}:i?(i=Hd[o/Hd[i-1][2]<Hd[i][2]/o?i-1:i],{interval:i[0],step:i[1]}):{interval:PZ,step:w1(r,n,1)}}var qZ=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function BZ(t,e){return qZ.has(`${t.type}-${e}`)}function A1(t,e={}){let n=(r,o)=>BZ(r,o)?{[`${o}1`]:hS(r,o,t,e),[`${o}2`]:hS(r,o,t,{...e,offset:1})}:{[o]:hS(r,o,t,e)};return n[Ul]=!0,n}function hS(t,e,n,r){return{column:n,label:n,get columns(){return[n]},get basis(){return n},get stats(){return{column:n,stats:["min","max"]}},toString(){let{type:o,min:i,max:s}=t.channelField(e),{interval:a,steps:c,offset:f=0}=r,l=a??(o==="date"||zZ(t,e)?"date":"number");if(l==="number"){let{apply:u,sqlApply:p,sqlInvert:d}=Ga(t,e),h=$L(u(i),u(s),r),m=p(n),g=h.min===0?m:`(${m} - ${h.min})`,y=`${(h.max-h.min)/h.steps}::DOUBLE`,x=f?`${f} + `:"",b=`${h.min} + ${y} * (${x}FLOOR(${g} / ${y}))`;return`${d(b)}`}else{let{interval:u,step:p=1}=l==="date"?LL(i,s,c||40):r,d=f?` + INTERVAL ${f*p} ${u}`:"";return`(${C2(n,u,p)}${d})`}}}}function zZ(t,e){let n=t.plot.getAttribute(`${e}Scale`);return n==="utc"||n==="time"}var YZ=t=>t&&typeof t=="object"&&!Array.isArray(t);var Kd=class extends _n{constructor({element:e,filterBy:n,from:r,column:o,label:i=o,format:s=u=>u,options:a,value:c,field:f=o,as:l}={}){super(n),this.from=r,this.column=o,this.format=s,this.field=f;let u=this.selection=l;this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let p=document.createElement("label");if(p.innerText=i||o,this.element.appendChild(p),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(d=>YZ(d)?d:{value:d}),this.selectedValue(c??""),this.update()),u){let d=!Dn(u);c!=null&&(!d||u.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),d&&this.selection.addEventListener("value",h=>{h!==this.select.value&&this.selectedValue(h)})}}selectedValue(e){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===e);n>=0?this.select.selectedIndex=n:this.select.value=String(e)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(e){let{selection:n,field:r}=this;if(Dn(n)){e===""&&(e=void 0);let o=js(r,e,{source:this});n.update(o)}else En(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?ft.from(n).select({value:r}).distinct().where(e).orderby(r):null}queryResult(e){return this.data=[{value:"",label:"All"},...e],this}update(){let{data:e,format:n,select:r,selection:o}=this;r.replaceChildren();for(let{value:i,label:s}of e){let a=document.createElement("option");a.setAttribute("value",i),a.innerText=s??n(i),this.select.appendChild(a)}if(o){let i=Dn(o)?o.valueFor(this):o.value;this.selectedValue(i??"")}return this}};var UZ=0;var th=class extends _n{constructor({element:e,filterBy:n,from:r,column:o,label:i,type:s="contains",field:a=o,as:c}={}){if(super(n),this.id="search_"+ ++UZ,this.type=s,this.from=r,this.column=o,this.selection=c,this.field=a,this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),i){let f=document.createElement("label");f.setAttribute("for",this.id),f.innerText=i,this.element.appendChild(f)}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)}),Dn(this.selection)||this.selection.addEventListener("value",f=>{f!==this.searchbox.value&&(this.searchbox.value=f)}))}reset(){this.searchbox.value=""}publish(e){let{selection:n,field:r,type:o}=this;if(Dn(n)){let i=H2(r,e,{source:this,method:o});n.update(i)}else En(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?ft.from(n).select({list:r}).distinct().where(e):null}queryResult(e){return this.data=e,this}update(){let e=document.createElement("datalist"),n=`${this.id}_list`;e.setAttribute("id",n);for(let r of this.data){let o=document.createElement("option");o.setAttribute("value",r.list),e.append(o)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=e),this.searchbox.setAttribute("list",n),this}};var jZ=0;var eh=class extends _n{constructor({element:e,filterBy:n,as:r,min:o,max:i,step:s,from:a,column:c,label:f=c,value:l=r?.value,select:u="point",field:p=c,width:d}={}){if(super(n),this.id="slider_"+ ++jZ,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=u,this.field=p,this.min=o,this.max=i,this.step=s,this.element=e||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),f){let h=document.createElement("label");h.setAttribute("for",this.id),h.innerText=f,this.element.appendChild(h)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),d!=null&&(this.slider.style.width=`${+d}px`),o!=null&&this.slider.setAttribute("min",`${o}`),i!=null&&this.slider.setAttribute("max",`${i}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),l!=null&&(this.slider.setAttribute("value",`${l}`),this.selection?.value===void 0&&this.publish(l)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:h}=this.slider;this.curval.innerText=h,this.selection&&this.publish(+h)}),this.selection&&!Dn(this.selection)&&this.selection.addEventListener("value",h=>{h!==+this.slider.value&&(this.slider.value=h,this.curval.innerText=h)})}query(e=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:ft.select({min:tr(r),max:Kn(r)}).from(n).where(e)}queryResult(e){let{min:n,max:r}=Array.from(e)[0];return this.min==null&&(this.min=n,this.slider.setAttribute("min",`${n}`)),this.max==null&&(this.max=r,this.slider.setAttribute("max",`${r}`)),this.step==null&&(this.step=(r-n)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(e){let{field:n,selectionType:r,selection:o}=this;if(Dn(o))if(r==="interval"){let i=[this.min??0,e];o.update(Gs(n,i,{source:this,bin:"ceil",scale:{type:"identity",domain:i},pixelSize:this.step}))}else o.update(js(n,e,{source:this}));else En(this.selection)&&o.update(e)}};var gS=DL(t=>{let e=T1(t);return n=>n==null?"":typeof n=="number"?e(n):n instanceof Date?yS(n):`${n}`}),T1=DL(t=>e=>e===0?"0":e.toLocaleString(t)),hLt=gS(),mLt=T1();function yS(t){return cf(t,"Invalid Date")}function DL(t){let e=null,n;return(r="en")=>r===e?n:n=t(e=r)}var XZ=-1;var nh=class extends _n{constructor({element:e,filterBy:n,from:r,columns:o=["*"],align:i={},format:s,width:a,maxWidth:c,height:f=500,rowBatch:l=100,as:u}={}){super(n),this.id=`table-${++XZ}`,this.from=r,this.columns=o,this.format=s,this.align=i,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+l,this.pending=!1,this.selection=u,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=e||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${f}px`,this.element.style.overflow="auto";let p=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:m}=this,{scrollHeight:g,scrollTop:y,clientHeight:x}=d.target,b=y<p;p=y,!(b||h||m)&&g-y<2*x&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",d=>{let h=GZ(d.target);h>-1&&h!==this.currentRow&&(this.currentRow=h,this.selection.update(this.clause([h])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}clause(e=[]){let{data:n,limit:r,schema:o}=this,i=o.map(a=>a.column),s=e.map(a=>{let{columns:c}=n[~~(a/r)];return i.map(f=>c[f][a%r])});return Xs(i,s,{source:this})}requestData(e=0){this.offset=e;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),er().prefetch(n.clone().offset(e+this.limit))}fields(){return this.columns.map(e=>Ii(this.from,e))}fieldInfo(e){this.schema=e;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:o}of e){let i=document.createElement("th");i.addEventListener("click",s=>this.sort(s,o)),i.appendChild(document.createElement("span")),i.appendChild(document.createTextNode(o)),r.appendChild(i)}return n.appendChild(r),this.formats=VZ(this.format,e),this.style.innerText=ZZ(this.id,WZ(this.align,e),HZ(this.widths,e)),this}query(e=[]){let{from:n,limit:r,offset:o,schema:i,sortColumn:s,sortDesc:a}=this;return ft.from(n).select(i.map(c=>c.column)).where(e).orderby(s?a?Db(s):s:[]).limit(r).offset(o)}queryResult(e){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(In(e)),this}update(){let{body:e,formats:n,data:r,schema:o,limit:i}=this,s=o.length,a=r.length-1,c=i*a,{numRows:f,columns:l}=r[a],u=o.map(p=>l[p.column]);for(let p=0;p<f;++p){let d=document.createElement("tr");Object.assign(d,{__row__:c+p});for(let h=0;h<s;++h){let m=u[h][p],g=document.createElement("td");g.innerText=m==null?"":n[h](m),d.appendChild(g)}e.appendChild(d)}return f<i&&(this.loaded=!0),this.pending=!1,this}sort(e,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=e.currentTarget,o=this.sortHeader;o===r&&e.metaKey?(o.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(o&&(o.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function GZ(t){let e=t.parentElement;return Object.hasOwn(e,"__row__")?+e.__row__:-1}function VZ(t={},e,n){return e.map(({column:r,type:o})=>{if(r in t)return t[r];switch(o){case"number":return T1(n);case"date":return yS;default:return gS(n)}})}function WZ(t={},e){return e.map(({column:n,type:r})=>n in t?t[n]:r==="number"?"right":"left")}function HZ(t={},e){return e.map(({column:n})=>t[n])}function ZZ(t,e,n){let r=[];return e.forEach((o,i)=>{let s=+n[i];if(o!=="left"||s){let a=o!=="left"?`text-align:${o};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${t} tr>:nth-child(${i+1}) {${a}${c}}`)}}),r.join(" ")}function rh(t,...e){let n=t?.context?.coordinator??er();for(let r of e)n.connect(r)}function E1(t,e,n){let r=new e(n);return rh(t,r),r.element}function PL(t){return E1(this,Kd,t)}function FL(t){return E1(this,th,t)}function qL(t){return E1(this,eh,t)}function BL(t){return E1(this,nh,t)}function zL({direction:t="vertical",wrap:e=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=t==="vertical"?"column":"row",r.style.flexWrap=e?e===!0?"wrap":e:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(o=>r.appendChild(o)),Object.assign(r,{value:{element:r}}),r}function YL(...t){return zL({direction:"vertical"},t.flat())}function UL(...t){return zL({direction:"horizontal"},t.flat())}function jL({dim:t="width",size:e=10}){let n=document.createElement("span");return n.style.display="inline-block",n.style[t]=Number.isNaN(+e)?e:`${e}px`,Object.assign(n,{value:{element:n}})}function XL(t){return jL({dim:"height",size:t})}function GL(t){return jL({dim:"width",size:t})}var I1={};ec(I1,{align:()=>NS,aspectRatio:()=>OS,axis:()=>RS,colorBase:()=>v5,colorClamp:()=>f5,colorConstant:()=>S5,colorDomain:()=>a5,colorExponent:()=>_5,colorInterpolate:()=>d5,colorLabel:()=>g5,colorN:()=>l5,colorNice:()=>u5,colorPercent:()=>y5,colorPivot:()=>h5,colorRange:()=>c5,colorReverse:()=>x5,colorScale:()=>s5,colorScheme:()=>p5,colorSymmetric:()=>m5,colorTickFormat:()=>w5,colorZero:()=>b5,facetGrid:()=>sM,facetLabel:()=>aM,facetMargin:()=>eM,facetMarginBottom:()=>rM,facetMarginLeft:()=>oM,facetMarginRight:()=>iM,facetMarginTop:()=>nM,fxAlign:()=>hM,fxAriaDescription:()=>NM,fxAriaLabel:()=>kM,fxAxis:()=>xM,fxDomain:()=>cM,fxFontVariant:()=>CM,fxGrid:()=>AM,fxInset:()=>lM,fxInsetLeft:()=>uM,fxInsetRight:()=>pM,fxLabel:()=>EM,fxLabelAnchor:()=>IM,fxLabelOffset:()=>$M,fxLine:()=>TM,fxPadding:()=>mM,fxPaddingInner:()=>gM,fxPaddingOuter:()=>yM,fxRange:()=>fM,fxReverse:()=>OM,fxRound:()=>dM,fxTickFormat:()=>SM,fxTickPadding:()=>_M,fxTickRotate:()=>MM,fxTickSize:()=>wM,fxTickSpacing:()=>vM,fxTicks:()=>bM,fyAlign:()=>BM,fyAriaDescription:()=>o5,fyAriaLabel:()=>r5,fyAxis:()=>jM,fyDomain:()=>RM,fyFontVariant:()=>n5,fyGrid:()=>QM,fyInset:()=>DM,fyInsetBottom:()=>FM,fyInsetTop:()=>PM,fyLabel:()=>KM,fyLabelAnchor:()=>t5,fyLabelOffset:()=>e5,fyLine:()=>JM,fyPadding:()=>zM,fyPaddingInner:()=>YM,fyPaddingOuter:()=>UM,fyRange:()=>LM,fyReverse:()=>i5,fyRound:()=>qM,fyTickFormat:()=>HM,fyTickPadding:()=>WM,fyTickRotate:()=>ZM,fyTickSize:()=>GM,fyTickSpacing:()=>VM,fyTicks:()=>XM,grid:()=>DS,height:()=>ES,inset:()=>LS,label:()=>PS,lengthBase:()=>o8,lengthClamp:()=>t8,lengthConstant:()=>s8,lengthDomain:()=>J5,lengthExponent:()=>i8,lengthNice:()=>e8,lengthPercent:()=>n8,lengthRange:()=>K5,lengthScale:()=>Q5,lengthZero:()=>r8,margin:()=>SS,marginBottom:()=>kS,marginLeft:()=>IS,marginRight:()=>$S,marginTop:()=>CS,margins:()=>_S,name:()=>wS,opacityBase:()=>R5,opacityClamp:()=>E5,opacityConstant:()=>D5,opacityDomain:()=>A5,opacityExponent:()=>L5,opacityLabel:()=>$5,opacityNice:()=>I5,opacityPercent:()=>C5,opacityRange:()=>T5,opacityReverse:()=>k5,opacityScale:()=>M5,opacityTickFormat:()=>O5,opacityZero:()=>N5,padding:()=>FS,projectionClip:()=>y8,projectionDomain:()=>u8,projectionInset:()=>p8,projectionInsetBottom:()=>g8,projectionInsetLeft:()=>d8,projectionInsetRight:()=>h8,projectionInsetTop:()=>m8,projectionParallels:()=>c8,projectionPrecision:()=>f8,projectionRotate:()=>l8,projectionType:()=>a8,rBase:()=>W5,rClamp:()=>U5,rConstant:()=>Z5,rDomain:()=>z5,rExponent:()=>H5,rLabel:()=>X5,rNice:()=>j5,rPercent:()=>G5,rRange:()=>Y5,rScale:()=>B5,rZero:()=>V5,style:()=>AS,symbolDomain:()=>F5,symbolRange:()=>q5,symbolScale:()=>P5,width:()=>TS,xAlign:()=>WS,xAriaDescription:()=>d4,xAriaLabel:()=>p4,xAxis:()=>JS,xBase:()=>y4,xClamp:()=>GS,xConstant:()=>b4,xDomain:()=>BS,xExponent:()=>x4,xFontVariant:()=>u4,xGrid:()=>i4,xInset:()=>US,xInsetLeft:()=>jS,xInsetRight:()=>XS,xLabel:()=>a4,xLabelAnchor:()=>c4,xLabelArrow:()=>f4,xLabelOffset:()=>l4,xLine:()=>s4,xNice:()=>YS,xPadding:()=>HS,xPaddingInner:()=>ZS,xPaddingOuter:()=>QS,xPercent:()=>h4,xRange:()=>zS,xReverse:()=>m4,xRound:()=>VS,xScale:()=>qS,xTickFormat:()=>r4,xTickPadding:()=>n4,xTickRotate:()=>o4,xTickSize:()=>t4,xTickSpacing:()=>e4,xTicks:()=>KS,xZero:()=>g4,xyDomain:()=>MS,yAlign:()=>$4,yAriaDescription:()=>W4,yAriaLabel:()=>V4,yAxis:()=>O4,yBase:()=>J4,yClamp:()=>E4,yConstant:()=>tM,yDomain:()=>v4,yExponent:()=>K4,yFontVariant:()=>G4,yGrid:()=>B4,yInset:()=>M4,yInsetBottom:()=>T4,yInsetTop:()=>A4,yLabel:()=>Y4,yLabelAnchor:()=>U4,yLabelArrow:()=>j4,yLabelOffset:()=>X4,yLine:()=>z4,yNice:()=>S4,yPadding:()=>C4,yPaddingInner:()=>k4,yPaddingOuter:()=>N4,yPercent:()=>H4,yRange:()=>_4,yReverse:()=>Z4,yRound:()=>I4,yScale:()=>w4,yTickFormat:()=>F4,yTickPadding:()=>P4,yTickRotate:()=>q4,yTickSize:()=>L4,yTickSpacing:()=>D4,yTicks:()=>R4,yZero:()=>Q4});var oh=class extends Map{request(e,n){if(this.has(e))n(this.get(e));else{let r=this.waiting||(this.waiting=new Map),o=r.get(e)||[];r.set(e,o.concat(n))}}set(e,n){this.has(e)&&console.warn(`Overwriting named plot "${e}".`);let{waiting:r}=this;return r?.has(e)&&(r.get(e).forEach(o=>o(n)),r.delete(e)),super.set(e,n)}clear(){return this.waiting?.clear(),super.clear()}},xS=new oh;function bS(t,e,n){(t?.context?.namedPlots??xS).request(e,n)}function VL(t,e,n){(t?.context?.namedPlots??xS).set(e,n)}function wS(t){return e=>VL(this,t,e)}function WL(t,e,n){En(n)?(n.addEventListener("value",r=>{t.setAttribute(e,r),t.update()}),n.value!==void 0&&t.setAttribute(e,n.value)):t.setAttribute(e,n)}function QZ(t,e){return n=>{WL(n,t,e)}}function vS(t){return e=>{for(let[n,r]of Object.entries(t))WL(e,n,r)}}function _S(t){let{top:e,bottom:n,left:r,right:o}=t,i={};return e!==void 0&&(i.marginTop=e),n!==void 0&&(i.marginBottom=n),r!==void 0&&(i.marginLeft=r),o!==void 0&&(i.marginRight=o),vS(i)}function SS(t){return vS({marginTop:t,marginBottom:t,marginLeft:t,marginRight:t})}function MS(t){return vS({xDomain:t,yDomain:t})}var O=t=>e=>QZ(t,e),AS=O("style"),TS=O("width"),ES=O("height"),IS=O("marginLeft"),$S=O("marginRight"),CS=O("marginTop"),kS=O("marginBottom"),NS=O("align"),OS=O("aspectRatio"),RS=O("axis"),LS=O("inset"),DS=O("grid"),PS=O("label"),FS=O("padding"),qS=O("xScale"),BS=O("xDomain"),zS=O("xRange"),YS=O("xNice"),US=O("xInset"),jS=O("xInsetLeft"),XS=O("xInsetRight"),GS=O("xClamp"),VS=O("xRound"),WS=O("xAlign"),HS=O("xPadding"),ZS=O("xPaddingInner"),QS=O("xPaddingOuter"),JS=O("xAxis"),KS=O("xTicks"),t4=O("xTickSize"),e4=O("xTickSpacing"),n4=O("xTickPadding"),r4=O("xTickFormat"),o4=O("xTickRotate"),i4=O("xGrid"),s4=O("xLine"),a4=O("xLabel"),c4=O("xLabelAnchor"),f4=O("xLabelArrow"),l4=O("xLabelOffset"),u4=O("xFontVariant"),p4=O("xAriaLabel"),d4=O("xAriaDescription"),h4=O("xPercent"),m4=O("xReverse"),g4=O("xZero"),y4=O("xBase"),x4=O("xExponent"),b4=O("xConstant"),w4=O("yScale"),v4=O("yDomain"),_4=O("yRange"),S4=O("yNice"),M4=O("yInset"),A4=O("yInsetTop"),T4=O("yInsetBottom"),E4=O("yClamp"),I4=O("yRound"),$4=O("yAlign"),C4=O("yPadding"),k4=O("yPaddingInner"),N4=O("yPaddingOuter"),O4=O("yAxis"),R4=O("yTicks"),L4=O("yTickSize"),D4=O("yTickSpacing"),P4=O("yTickPadding"),F4=O("yTickFormat"),q4=O("yTickRotate"),B4=O("yGrid"),z4=O("yLine"),Y4=O("yLabel"),U4=O("yLabelAnchor"),j4=O("yLabelArrow"),X4=O("yLabelOffset"),G4=O("yFontVariant"),V4=O("yAriaLabel"),W4=O("yAriaDescription"),H4=O("yPercent"),Z4=O("yReverse"),Q4=O("yZero"),J4=O("yBase"),K4=O("yExponent"),tM=O("yConstant"),eM=O("facetMargin"),nM=O("facetMarginTop"),rM=O("facetMarginBottom"),oM=O("facetMarginLeft"),iM=O("facetMarginRight"),sM=O("facetGrid"),aM=O("facetLabel"),cM=O("fxDomain"),fM=O("fxRange"),lM=O("fxInset"),uM=O("fxInsetLeft"),pM=O("fxInsetRight"),dM=O("fxRound"),hM=O("fxAlign"),mM=O("fxPadding"),gM=O("fxPaddingInner"),yM=O("fxPaddingOuter"),xM=O("fxAxis"),bM=O("fxTicks"),wM=O("fxTickSize"),vM=O("fxTickSpacing"),_M=O("fxTickPadding"),SM=O("fxTickFormat"),MM=O("fxTickRotate"),AM=O("fxGrid"),TM=O("fxLine"),EM=O("fxLabel"),IM=O("fxLabelAnchor"),$M=O("fxLabelOffset"),CM=O("fxFontVariant"),kM=O("fxAriaLabel"),NM=O("fxAriaDescription"),OM=O("fxReverse"),RM=O("fyDomain"),LM=O("fyRange"),DM=O("fyInset"),PM=O("fyInsetTop"),FM=O("fyInsetBottom"),qM=O("fyRound"),BM=O("fyAlign"),zM=O("fyPadding"),YM=O("fyPaddingInner"),UM=O("fyPaddingOuter"),jM=O("fyAxis"),XM=O("fyTicks"),GM=O("fyTickSize"),VM=O("fyTickSpacing"),WM=O("fyTickPadding"),HM=O("fyTickFormat"),ZM=O("fyTickRotate"),QM=O("fyGrid"),JM=O("fyLine"),KM=O("fyLabel"),t5=O("fyLabelAnchor"),e5=O("fyLabelOffset"),n5=O("fyFontVariant"),r5=O("fyAriaLabel"),o5=O("fyAriaDescription"),i5=O("fyReverse"),s5=O("colorScale"),a5=O("colorDomain"),c5=O("colorRange"),f5=O("colorClamp"),l5=O("colorN"),u5=O("colorNice"),p5=O("colorScheme"),d5=O("colorInterpolate"),h5=O("colorPivot"),m5=O("colorSymmetric"),g5=O("colorLabel"),y5=O("colorPercent"),x5=O("colorReverse"),b5=O("colorZero"),w5=O("colorTickFormat"),v5=O("colorBase"),_5=O("colorExponent"),S5=O("colorConstant"),M5=O("opacityScale"),A5=O("opacityDomain"),T5=O("opacityRange"),E5=O("opacityClamp"),I5=O("opacityNice"),$5=O("opacityLabel"),C5=O("opacityPercent"),k5=O("opacityReverse"),N5=O("opacityZero"),O5=O("opacityTickFormat"),R5=O("opacityBase"),L5=O("opacityExponent"),D5=O("opacityConstant"),P5=O("symbolScale"),F5=O("symbolDomain"),q5=O("symbolRange"),B5=O("rScale"),z5=O("rDomain"),Y5=O("rRange"),U5=O("rClamp"),j5=O("rNice"),X5=O("rLabel"),G5=O("rPercent"),V5=O("rZero"),W5=O("rBase"),H5=O("rExponent"),Z5=O("rConstant"),Q5=O("lengthScale"),J5=O("lengthDomain"),K5=O("lengthRange"),t8=O("lengthClamp"),e8=O("lengthNice"),n8=O("lengthPercent"),r8=O("lengthZero"),o8=O("lengthBase"),i8=O("lengthExponent"),s8=O("lengthConstant"),a8=O("projectionType"),c8=O("projectionParallels"),f8=O("projectionPrecision"),l8=O("projectionRotate"),u8=O("projectionDomain"),p8=O("projectionInset"),d8=O("projectionInsetLeft"),h8=O("projectionInsetRight"),m8=O("projectionInsetTop"),g8=O("projectionInsetBottom"),y8=O("projectionClip");function HL(t,e){return{table:t,options:e}}var C1={};ec(C1,{area:()=>x8,areaX:()=>b8,areaY:()=>w8,arrow:()=>dA,axisFx:()=>xA,axisFy:()=>bA,axisX:()=>gA,axisY:()=>yA,barX:()=>M8,barY:()=>A8,cell:()=>T8,cellX:()=>E8,cellY:()=>I8,circle:()=>L8,contour:()=>K8,delaunayLink:()=>lA,delaunayMesh:()=>uA,denseLine:()=>J8,density:()=>Q8,densityX:()=>H8,densityY:()=>Z8,dot:()=>N8,dotX:()=>O8,dotY:()=>R8,errorbarX:()=>sA,errorbarY:()=>aA,frame:()=>mA,geo:()=>MA,graticule:()=>TA,gridFx:()=>_A,gridFy:()=>SA,gridX:()=>wA,gridY:()=>vA,heatmap:()=>tA,hexagon:()=>D8,hexbin:()=>rA,hexgrid:()=>oA,hull:()=>pA,image:()=>W8,line:()=>v8,lineX:()=>_8,lineY:()=>S8,link:()=>hA,raster:()=>eA,rasterTile:()=>nA,rect:()=>$8,rectX:()=>C8,rectY:()=>k8,regressionY:()=>iA,ruleX:()=>B8,ruleY:()=>z8,sphere:()=>AA,spike:()=>V8,text:()=>P8,textX:()=>F8,textY:()=>q8,tickX:()=>Y8,tickY:()=>U8,vector:()=>j8,vectorX:()=>X8,vectorY:()=>G8,voronoi:()=>cA,voronoiMesh:()=>fA});var JZ=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function ht(t,e,n={}){arguments.length===2&&!Array.isArray(e)&&(n=e,e=JZ.has(t)?null:[{}]);let r=t.startsWith("area")||t.startsWith("line")?Nd:Me;return $1(r,t,e,n)}function $1(t,e,n,r){return o=>{o.addMark(new t(e,n,r))}}function Mo(t,e,n){return r=>{r.addMark(new t(e,n))}}var x8=(...t)=>ht("area",...t),b8=(...t)=>ht("areaX",...t),w8=(...t)=>ht("areaY",...t),v8=(...t)=>ht("line",...t),_8=(...t)=>ht("lineX",...t),S8=(...t)=>ht("lineY",...t),M8=(...t)=>ht("barX",...t),A8=(...t)=>ht("barY",...t),T8=(...t)=>ht("cell",...t),E8=(...t)=>ht("cellX",...t),I8=(...t)=>ht("cellY",...t),$8=(...t)=>ht("rect",...t),C8=(...t)=>ht("rectX",...t),k8=(...t)=>ht("rectY",...t),N8=(...t)=>ht("dot",...t),O8=(...t)=>ht("dotX",...t),R8=(...t)=>ht("dotY",...t),L8=(...t)=>ht("circle",...t),D8=(...t)=>ht("hexagon",...t),P8=(...t)=>ht("text",...t),F8=(...t)=>ht("textX",...t),q8=(...t)=>ht("textY",...t),B8=(...t)=>ht("ruleX",...t),z8=(...t)=>ht("ruleY",...t),Y8=(...t)=>ht("tickX",...t),U8=(...t)=>ht("tickY",...t),j8=(...t)=>ht("vector",...t),X8=(...t)=>ht("vectoX",...t),G8=(...t)=>ht("vectorY",...t),V8=(...t)=>ht("spike",...t),W8=(...t)=>ht("image",...t),H8=(...t)=>$1(Kf,"areaX",...t),Z8=(...t)=>$1(Kf,"areaY",...t),Q8=(...t)=>Mo(qd,...t),J8=(...t)=>Mo(Fd,...t),K8=(...t)=>Mo(Ld,...t),tA=(...t)=>Mo(Pd,...t),eA=(...t)=>Mo(As,...t),nA=(...t)=>Mo(Yd,...t),rA=(...t)=>Mo(zd,...t),oA=(...t)=>ht("hexgrid",...t),iA=(...t)=>Mo(Ud,...t),sA=(...t)=>$1(el,"ruleY",...t),aA=(...t)=>Mo(el,"ruleX",...t),cA=(...t)=>ht("voronoi",...t),fA=(...t)=>ht("voronoiMesh",...t),lA=(...t)=>ht("delaunayLink",...t),uA=(...t)=>ht("delaunayMesh",...t),pA=(...t)=>ht("hull",...t),dA=(...t)=>ht("arrow",...t),hA=(...t)=>ht("link",...t),mA=(...t)=>ht("frame",...t),gA=(...t)=>ht("axisX",...t),yA=(...t)=>ht("axisY",...t),xA=(...t)=>ht("axisFx",...t),bA=(...t)=>ht("axisFy",...t),wA=(...t)=>ht("gridX",...t),vA=(...t)=>ht("gridY",...t),_A=(...t)=>ht("gridFx",...t),SA=(...t)=>ht("gridFy",...t),MA=(...t)=>Mo(Bd,...t),AA=(...t)=>ht("sphere",...t),TA=(...t)=>ht("graticule",...t);var k1={};ec(k1,{highlight:()=>EA,intervalX:()=>LA,intervalXY:()=>PA,intervalY:()=>DA,nearest:()=>NA,nearestX:()=>OA,nearestY:()=>RA,pan:()=>FA,panX:()=>qA,panY:()=>BA,panZoom:()=>zA,panZoomX:()=>YA,panZoomY:()=>UA,toggle:()=>Ha,toggleColor:()=>kA,toggleX:()=>IA,toggleY:()=>$A,toggleZ:()=>CA});function _i(t,e){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new t(r,e))}}function EA({by:t,...e}){return _i(jd,{selection:t,channels:e})}function Ha({as:t,...e}){return _i(Wa,{...e,selection:t})}function IA(t){return Ha({...t,channels:["x"]})}function $A(t){return Ha({...t,channels:["y"]})}function CA(t){return Ha({...t,channels:["z"]})}function kA(t){return Ha({...t,channels:["color"]})}function NA({as:t,...e}){return _i(Va,{...e,selection:t,pointer:"xy"})}function OA({as:t,...e}){return _i(Va,{...e,selection:t,pointer:"x"})}function RA({as:t,...e}){return _i(Va,{...e,selection:t,pointer:"y"})}function LA({as:t,...e}){return _i(Ts,{...e,selection:t,channel:"x"})}function DA({as:t,...e}){return _i(Ts,{...e,selection:t,channel:"y"})}function PA({as:t,...e}){return _i(Vd,{...e,selection:t})}function ol(t){return _i(Wd,t)}function FA(t={}){return ol({...t,zoom:!1})}function qA(t={}){return ol({...t,zoom:!1,pany:!1})}function BA(t={}){return ol({...t,zoom:!1,panx:!1})}function zA(t={}){return ol(t)}function YA(t={}){return ol({...t,pany:!1})}function UA(t={}){return ol({...t,panx:!1})}var N1={};ec(N1,{colorLegend:()=>XA,opacityLegend:()=>GA,symbolLegend:()=>VA});function jA(t,e={}){if(e.for){let{for:n,...r}=e,o=new rl(t,r),i=typeof n,s=a=>a.addLegend(o,!1);return i==="string"?bS(this,n,s):n.value&&s(n.value),o.element}else return n=>n.addLegend(new rl(t,e))}function XA(t){return jA.call(this,"color",t)}function GA(t){return jA.call(this,"opacity",t)}function VA(t){return jA.call(this,"symbol",t)}function ZL(...t){let e=new Cd;return t.flat().forEach(n=>n(e)),rh(this,...e.marks),e.update(),e.element}function HA({coordinator:t=er(),namedPlots:e=new oh,extensions:n=null,...r}={}){return{...WA,...n,context:{coordinator:t,namedPlots:e,...r}}}var QL="spec",O1="literal",gDt="dataref",JL="options",KL="selection",tD="paramref",eD="param",nD="include",ZA="select",R1="value",rD="crossfilter",L1="intersect",oD="union",iD="single",sD="data",aD="expression",Es="sql",Si="agg",ih="input",il="hconcat",sl="vconcat",al="hspace",cl="vspace",D1="mark",QA="from",fl="plot",sh="legend",cD="attribute",JA="transform",fD="interactor",ah="Fixed";var bt=class{constructor(e,n=null){this.type=e,this.children=n}instantiate(e){throw Error("instantiate not implemented")}codegen(e){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var ch=class extends bt{constructor(e,n,r,o,i,s){super(QL,[e]),this.root=e,this.meta=n,this.config=r,this.data=o,this.params=i,this.plotDefaults=s}toJSON(){let{root:e,meta:n,config:r,plotDefaults:o}=this,i=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),i?.size){let c=a.data={};for(let[f,l]of i)c[f]=l.toJSON()}if(s?.size){let c=a.params={};for(let[f,l]of s)c[f]=l.toJSON()}if(o?.length){let c=a.plotDefaults={};for(let f of o)Object.assign(c,f.toJSON())}return Object.assign(a,e.toJSON())}};function fh(t){let e=typeof t;return e==="object"?t?.param:e==="string"?KZ(t):null}function KZ(t){return t?.[0]==="$"?t.slice(1):null}function lh(t){return`$${t}`}function ll(t){return[t].flat()}function gr(t){return Array.isArray(t)}function ul(t){return t!==null&&typeof t=="object"&&!gr(t)}function Is(t){return typeof t=="string"}function pl(t,e){throw Object.assign(Error(t),{data:e})}var tQ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function lD(t,e){return tQ.test(t+="")?new Date(t):e}function De(t,e){let n={};for(let r in t)n[r]=e.maybeSelection(t[r]);return new $s(n)}var $s=class t extends bt{constructor(e){super(JL),this.options=e}filter(e){let n=Object.fromEntries(Object.entries(this.options).filter(([r,o])=>e(r,o)));return new t(n)}instantiate(e){let{options:n}=this,r={};for(let o in n)r[o]=n[o].instantiate(e);return r}codegen(e){let{options:n}=this,r=[];for(let o in n)r.push(`${o}: ${n[o].codegen(e)}`);return r.length?`{${e.maybeLineWrap(r)}}`:""}toJSON(){let{options:e}=this,n={};for(let r in e)n[r]=e[r].toJSON();return n}};var dD="table",hD="parquet",mD="csv",KA="json",j1="spatial",uD=new Map([[dD,oQ],[hD,iQ],[mD,sQ],[KA,aQ],[j1,cQ]]);function gD(t,e,n){let r=eQ(e);if(uD.has(r.type))return uD.get(r.type)(t,r,n);n.error("Unrecognized data format type.",e)}function eQ(t){return gr(t)&&(t={type:"json",data:t}),Is(t)&&(t={type:"table",query:t}),{...t,type:nQ(t)}}function nQ(t){return t.type||rQ(t.file)||"table"}function rQ(t){let e=t?.lastIndexOf(".");return e>0?t.slice(e+1):null}function oQ(t,e,n){let{query:r,type:o,...i}=e;return new F1(t,r,De(i,n))}function iQ(t,e,n){let{file:r,type:o,...i}=e;return new B1(t,r,De(i,n))}function sQ(t,e,n){let{file:r,type:o,...i}=e;return new z1(t,r,De(i,n))}function aQ(t,e,n){let{data:r,file:o,type:i,...s}=e,a=De(s,n);return r?new U1(t,r,a):new Y1(t,o,a)}function cQ(t,e,n){let{file:r,type:o,...i}=e;return new q1(t,r,De(i,n))}function pD(t,e){return e?new URL(t,e).toString():t}function fQ(t,e){let n=t?.codegen(e);return n?`, ${n}`:""}var P1=class extends bt{constructor(e,n){super(sD),this.name=e,this.format=n}},dl=class extends P1{constructor(e,n){super(e,n)}instantiateQuery(e){e.error("instantiateQuery not implemented")}codegenQuery(e){e.error("codegenQuery not implemented")}instantiate(e){let n=this.instantiateQuery(e);if(n)return n}codegen(e){let n=this.codegenQuery(e);if(n)return n}},F1=class extends dl{constructor(e,n,r){super(e,dD),this.query=n?.trim(),this.options=r}instantiateQuery(e){let{name:n,query:r,options:o}=this;if(r)return e.api.create(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,query:r,options:o}=this;if(r)return`\`${Dr(n,r,o.instantiate(e))}\``}toJSON(){let{format:e,query:n,options:r}=this;return{type:e,query:n,...r.toJSON()}}},Za=class extends dl{constructor(e,n,r,o,i){super(e,n),this.file=o,this.method=r,this.options=i}instantiateQuery(e){let{name:n,method:r,file:o,options:i}=this,s=pD(o,e.baseURL),a=i?.instantiate(e);return e.api[r](n,s,a)}codegenQuery(e){let{name:n,method:r,file:o,options:i}=this,s=pD(o,e.baseURL),a=fQ(i,e);return`${e.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:e,file:n,options:r}=this;return{type:e,file:n,...r.toJSON()}}},q1=class extends Za{constructor(e,n,r){super(e,j1,"loadSpatial",n,r)}},B1=class extends Za{constructor(e,n,r){super(e,hD,"loadParquet",n,r)}},z1=class extends Za{constructor(e,n,r){super(e,mD,"loadCSV",n,r)}},Y1=class extends Za{constructor(e,n,r){super(e,KA,"loadJSON",n,r)}},U1=class extends dl{constructor(e,n,r){super(e,KA),this.data=n,this.options=r}instantiateQuery(e){let{name:n,data:r,options:o}=this;return e.api.loadObjects(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,data:r,options:o}=this,i=o?","+o.codegen(e):"",s=`[
|
|
60
|
+
}`)).call(xu,n);for(let $ of f){let{channels:P,values:F,facets:q}=m.get($);if(h===void 0||$.facet==="super"){let V=null;if(q&&(V=q[0],V=$.filter(V,P,F),V.length===0))continue;let K=$.render(V,y,F,v,A);if(K==null)continue;E.appendChild(K)}else{let V;for(let K of h){if(!($.facetAnchor?.(h,k,K)??!K.empty))continue;let et=null;if(q){let j=p.has($);if(et=q[j?K.i:0],et=$.filter(et,P,F),et.length===0)continue;!j&&et===q[0]&&(et=$i(et)),et.fx=K.x,et.fy=K.y,et.fi=K.i}let rt=$.render(et,y,F,_,A);if(rt!=null){(V??=Nt(E).append("g")).append(()=>rt).datum(K);for(let j of["aria-label","aria-description","aria-hidden","transform"])rt.hasAttribute(j)&&(V.attr(j,rt.getAttribute(j)),rt.removeAttribute(j))}}V?.selectChildren().attr("transform",O)}}let C=QO(x,A,t),{figure:L=r!=null||o!=null||i!=null||C.length>0}=t;L&&(N=T.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",r!=null&&N.append(l$(T,r,"h2")),o!=null&&N.append(l$(T,o,"h3")),N.append(...C,E),i!=null&&N.append(VH(T,i)),"value"in E&&(N.value=E.value,delete E.value)),N.scale=PR(y.scales),N.legend=GO(x,A,t);let D=hR();return D>0&&Nt(E).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${D.toLocaleString("en-US")} warning${D===1?"":"s"}. Please check the console.`),N}function l$(t,e,n){if(e.ownerDocument)return e;let r=t.createElement(n);return r.append(e),r}function VH(t,e){let n=t.createElement("figcaption");return n.append(e),n}function p$(t){return t.flat(1/0).filter(e=>e!=null).map(GH)}function GH(t){return typeof t.render=="function"?t:new N4(t)}var N4=class extends lt{constructor(e){if(typeof e!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=e}render(){}};function C4(t,e){for(let n in t)x$(t[n],e);return t}function x$(t,e){let{scale:n,transform:r=!0}=t;if(n==null||!r)return;let{type:o,percent:i,interval:s,transform:a=i?c=>c==null?NaN:c*100:SS(s,o)}=e[n]??{};a!=null&&(t.value=Et(t.value,a),t.transform=!1)}function HH(t){for(let e in t)qS(e,t[e])}function hh(t,e,n,r=bL){for(let{channels:o}of e.values())for(let i in o){let s=o[i],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!GR(n)){let c=n.x?.domain===void 0,f=n.y?.domain===void 0;if(c||f){let[u,p]=QR(s);c&&I4(t,"x",u),f&&I4(t,"y",p)}}}else I4(t,a,s)}return t}function I4(t,e,n){let r=t.get(e);r!==void 0?r.push(n):t.set(e,[n])}function QH(t,e){if(t==null)return;let{x:n,y:r}=t;if(n==null&&r==null)return;let o=Ri(t.data);if(o==null)throw new Error("missing facet data");let i={};n!=null&&(i.fx=fu(o,{value:n,scale:"fx"})),r!=null&&(i.fy=fu(o,{value:r,scale:"fy"})),C4(i,e);let s=Q1(o,i);return{channels:i,groups:s,data:t.data}}function d$(t,e,n){if(t.facet===null||t.facet==="super")return;let{fx:r,fy:o}=t;if(r!=null||o!=null){let c=Ri(t.data??r??o);if(c===void 0)throw new Error(`missing facet data in ${t.ariaLabel}`);if(c===null)return;let f={};return r!=null&&(f.fx=fu(c,{value:r,scale:"fx"})),o!=null&&(f.fy=fu(c,{value:o,scale:"fy"})),C4(f,n),{channels:f,groups:Q1(c,f)}}if(e===void 0)return;let{channels:i,groups:s,data:a}=e;if(t.facet!=="auto"||t.data===a)return{channels:i,groups:s};a.length>0&&(s.size>1||s.size===1&&i.fx&&i.fy&&[...s][0][1].size>1)&&Cs(Ri(t.data))===Cs(a)&&_n(`Warning: the ${t.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 ZH(t,e={}){return Kt({...e,x:null,y:null},(n,r,o,i,s,a)=>a.getMarkState(t))}function JH(t){let e=[];for(let n of t){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:o,preferredAnchor:i}=r;o=/^x$/i.test(o)?zs:/^y$/i.test(o)?Ui:Bs,r=o(ZH(n,r)),r.title=null,i===void 0&&(r.preferredAnchor=o===Ui?"left":"bottom");let s=Tb(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,e.push(s)}}return e}function KH(t,e,n){let{projection:r,x:o={},y:i={},fx:s={},fy:a={},axis:c,grid:f,facet:u={},facet:{axis:p=c,grid:l}=u,x:{axis:d=c,grid:h=d===null?null:f}=o,y:{axis:m=c,grid:x=m===null?null:f}=i,fx:{axis:g=p,grid:y=g===null?null:l}=s,fy:{axis:b=p,grid:w=b===null?null:l}=a}=n;(r||!Ro(o)&&!h$("x",t))&&(d=h=null),(r||!Ro(i)&&!h$("y",t))&&(m=x=null),e.has("fx")||(g=y=null),e.has("fy")||(b=w=null),d===void 0&&(d=!Nb(t,"x")),m===void 0&&(m=!Nb(t,"y")),g===void 0&&(g=!Nb(t,"fx")),b===void 0&&(b=!Nb(t,"fy")),d===!0&&(d="bottom"),m===!0&&(m="left"),g===!0&&(g=d==="top"||d===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return Ib(_,w,gb,a),Eb(_,b,hb,"right","left",u,a),Ib(_,y,bb,s),Eb(_,g,mb,"top","bottom",u,s),Ib(_,x,xb,i),Eb(_,m,ih,"left","right",n,i),Ib(_,h,yb,o),Eb(_,d,sh,"bottom","top",n,o),_}function Eb(t,e,n,r,o,i,s){if(!e)return;let a=tQ(e);s=eQ(a?r:e,i,s);let{line:c}=s;(n===ih||n===sh)&&c&&!Pi(c)&&t.push(Tu(nQ(s))),t.push(n(s)),a&&t.push(n({...s,anchor:o,label:null}))}function Ib(t,e,n,r){!e||Pi(e)||t.push(n(rQ(e,r)))}function tQ(t){return/^\s*both\s*$/i.test(t)}function eQ(t,e,{line:n=e.line,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:u,ariaDescription:p,label:l=e.label,labelAnchor:d,labelArrow:h=e.labelArrow,labelOffset:m}){return{anchor:t,line:n,ticks:r,tickSize:o,tickSpacing:i,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:f,ariaLabel:u,ariaDescription:p,label:l,labelAnchor:d,labelArrow:h,labelOffset:m}}function nQ(t){let{anchor:e,line:n}=t;return{anchor:e,facetAnchor:e+"-empty",stroke:n===!0?void 0:n}}function rQ(t,{stroke:e=Ls(t)?t:void 0,ticks:n=oQ(t)?t:void 0,tickSpacing:r,ariaLabel:o,ariaDescription:i}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:o,ariaDescription:i}}function oQ(t){switch(typeof t){case"number":return!0;case"string":return!Ls(t)}return qn(t)||typeof t?.range=="function"}function Nb(t,e){let n=`${e}-axis `;return t.some(r=>r.ariaLabel?.startsWith(n))}function h$(t,e){for(let n of e)for(let r in n.channels){let{scale:o}=n.channels[r];if(o===t||o==="projection")return!0}return!1}function iQ(t,e){for(let n in t){let r=t[n],o=e[n];r.label===void 0&&o&&(r.label=o.label)}return t}function sQ({fx:t,fy:e},n){let{marginTop:r,marginRight:o,marginBottom:i,marginLeft:s,width:a,height:c}=V1(n),f=t&&m$(t),u=e&&m$(e);return{marginTop:e?u[0]:r,marginRight:t?a-f[1]:o,marginBottom:e?c-u[1]:i,marginLeft:t?f[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function m$(t){let e=t.domain();if(e.length===0)return[0,t.bandwidth()];let n=t(e[0]),r=t(e[e.length-1]);return r<n&&([n,r]=[r,n]),[n,r+t.bandwidth()]}var aQ=new Map([["basis",z3],["basis-closed",Y3],["basis-open",U3],["bundle",j3],["bump-x",D3],["bump-y",P3],["cardinal",X3],["cardinal-closed",W3],["cardinal-open",V3],["catmull-rom",G3],["catmull-rom-closed",H3],["catmull-rom-open",Q3],["linear",Ni],["linear-closed",Z3],["monotone-x",K3],["monotone-y",tS],["natural",eS],["step",nS],["step-after",oS],["step-before",rS]]);function mh(t=Ni,e){if(typeof t=="function")return t;let n=aQ.get(`${t}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${t}`);if(e!==void 0){if("beta"in n)return n.beta(e);if("tension"in n)return n.tension(e);if("alpha"in n)return n.alpha(e)}return n}function Cb(t=Vs,e){return typeof t!="function"&&`${t}`.toLowerCase()==="auto"?Vs:mh(t,e)}function Vs(t){return Ni(t)}function Uo(t={y:"count"},e={}){[t,e]=L4(t,e);let{x:n,y:r}=e;return k4(kb(n,e,W),null,null,r,t,lc(e))}function jo(t={x:"count"},e={}){[t,e]=L4(t,e);let{x:n,y:r}=e;return k4(null,kb(r,e,W),n,null,t,pc(e))}function Xi(t={fill:"count"},e={}){[t,e]=L4(t,e);let{x:n,y:r}=cQ(e);return k4(n,r,null,null,t,lc(pc(e)))}function b$(t,e,n={}){if(n?.interval==null)return n;let{reduce:r=z1}=n,o={filter:null};return n[e]!=null&&(o[e]=r),n[`${e}1`]!=null&&(o[`${e}1`]=r),n[`${e}2`]!=null&&(o[`${e}2`]=r),t(o,n)}function Iu(t={}){return b$(Uo,"y",Jr(t,"x"))}function Nu(t={}){return b$(jo,"x",Jr(t,"y"))}function k4(t,e,n,r,{data:o=B1,filter:i=Vd,sort:s,reverse:a,...c}={},f={}){t=g$(t),e=g$(e),c=fQ(c,f),o=_$(o,W),s=s==null?void 0:w$("sort",s,f),i=i==null?void 0:v$("filter",i,f),n!=null&&Fo(c,"x","x1","x2")&&(n=null),r!=null&&Fo(c,"y","y1","y2")&&(r=null);let[u,p]=fn(t),[l,d]=fn(t),[h,m]=fn(e),[x,g]=fn(e),[y,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=fn(y),{x:v,y:A,z:T,fill:E,stroke:N,x1:M,x2:k,y1:O,y2:S,domain:I,cumulative:C,thresholds:L,interval:D,...$}=f,[P,F]=fn(T),[q]=ce(E),[V]=ce(N),[K,et]=fn(q),[rt,j]=fn(V);return{..."z"in f&&{z:P||T},..."fill"in f&&{fill:K||E},..."stroke"in f&&{stroke:rt||N},...Ce($,(nt,Y,G)=>{let tt=sc(ut(nt,y),G?.[b]),B=ut(nt,T),_t=ut(nt,q),ct=ut(nt,V),Ct=Qd(c,{z:B,fill:_t,stroke:ct}),Lt=[],Z=[],jt=tt&&_([]),Qn=B&&F([]),ro=_t&&et([]),lq=ct&&j([]),w7=t&&p([]),pq=t&&d([]),v7=e&&m([]),dq=e&&g([]),hq=pQ(t,e,nt),mq=0;for(let $c of c)$c.initialize(nt);s&&s.initialize(nt),i&&i.initialize(nt);for(let $c of Y){let _7=[];for(let Dc of c)Dc.scope("facet",$c);s&&s.scope("facet",$c),i&&i.scope("facet",$c);for(let[Dc,xq]of Po($c,Ct))for(let[gq,Em]of Po(xq,tt))for(let[oo,Jo]of hq(Em))if(Ct&&(Jo.z=Dc),!(i&&!i.reduce(oo,Jo))){_7.push(mq++),Z.push(o.reduceIndex(oo,nt,Jo)),tt&&jt.push(gq),B&&Qn.push(Ct===B?Dc:B[(oo.length>0?oo:Em)[0]]),_t&&ro.push(Ct===_t?Dc:_t[(oo.length>0?oo:Em)[0]]),ct&&lq.push(Ct===ct?Dc:ct[(oo.length>0?oo:Em)[0]]),w7&&(w7.push(Jo.x1),pq.push(Jo.x2)),v7&&(v7.push(Jo.y1),dq.push(Jo.y2));for(let yq of c)yq.reduce(oo,Jo);s&&s.reduce(oo,Jo)}Lt.push(_7)}return DS(Lt,s,a),{data:Z,facets:Lt}}),...!Fo(c,"x")&&(u?{x1:u,x2:l,x:ou(u,l)}:{x:v,x1:M,x2:k}),...!Fo(c,"y")&&(h?{y1:h,y2:x,y:ou(h,x)}:{y:A,y1:O,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:nt,output:Y})=>[nt,Y]))}}function L4({cumulative:t,domain:e,thresholds:n,interval:r,...o},i){return[o,{cumulative:t,domain:e,thresholds:n,interval:r,...i}]}function kb(t,{cumulative:e,domain:n,thresholds:r,interval:o},i){return t={...$r(t)},t.domain===void 0&&(t.domain=n),t.cumulative===void 0&&(t.cumulative=e),t.thresholds===void 0&&(t.thresholds=r),t.interval===void 0&&(t.interval=o),t.value===void 0&&(t.value=i),t.thresholds=R4(t.thresholds,t.interval),t}function cQ(t){let{x:e,y:n}=t;return e=kb(e,t),n=kb(n,t),[e.value,n.value]=me(e.value,n.value),{x:e,y:n}}function g$(t){if(t==null)return;let{value:e,cumulative:n,domain:r=Ft,thresholds:o}=t,i=s=>{let a=ut(s,e),c;if(fe(a)||lQ(o)){a=Et(a,yS,Float64Array);let[u,p]=typeof r=="function"?r(a):r,l=typeof o=="function"&&!ks(o)?o(a,u,p):o;typeof l=="number"&&(l=hd(u,p,l)),ks(l)&&(r===Ft&&(u=l.floor(u),p=l.offset(l.floor(p))),l=l.range(u,l.offset(p))),c=l}else{a=Ne(a);let[u,p]=typeof r=="function"?r(a):r,l=typeof o=="function"&&!ks(o)?o(a,u,p):o;if(typeof l=="number")if(r===Ft){let d=li(u,p,l);if(isFinite(d))if(d>0){let h=Math.round(u/d),m=Math.round(p/d);h*d<=u||--h,m*d>p||++m;let x=m-h+1;l=new Float64Array(x);for(let g=0;g<x;++g)l[g]=(h+g)*d}else if(d<0){d=-d;let h=Math.round(u*d),m=Math.round(p*d);h/d<=u||--h,m/d>p||++m;let x=m-h+1;l=new Float64Array(x);for(let g=0;g<x;++g)l[g]=(h+g)/d}else l=[u];else l=[u]}else l=on(u,p,l);else ks(l)&&(r===Ft&&(u=l.floor(u),p=l.offset(l.floor(p))),l=l.range(u,l.offset(p)));c=l}let f=[];if(c.length===1)f.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)f.push([c[u-1],c[u]]);return f.bin=(n<0?hQ:n>0?dQ:O4)(f,c,a),f};return i.label=un(e),i}function R4(t,e,n=y$){if(t===void 0)return e===void 0?n:$o(e);if(typeof t=="string"){switch(t.toLowerCase()){case"freedman-diaconis":return _x;case"scott":return fp;case"sturges":return cs;case"auto":return y$}return oc(t)}return t}function fQ(t,e){return OS(t,e,w$)}function w$(t,e,n){return F1(t,e,n,v$)}function v$(t,e,n){return q1(t,e,n,_$)}function _$(t,e){return cu(t,e,uQ)}function uQ(t){switch(`${t}`.toLowerCase()){case"x":return mQ;case"x1":return gQ;case"x2":return yQ;case"y":return xQ;case"y1":return bQ;case"y2":return wQ;case"z":return PS}throw new Error(`invalid bin reduce: ${t}`)}function y$(t,e,n){return Math.min(200,fp(t,e,n))}function lQ(t){return _L(t)||qn(t)&&fe(t)}function pQ(t,e,n){let r=t?.(n),o=e?.(n);return r&&o?function*(i){let s=r.bin(i);for(let[a,[c,f]]of r.entries()){let u=o.bin(s[a]);for(let[p,[l,d]]of o.entries())yield[u[p],{data:n,x1:c,y1:l,x2:f,y2:d}]}}:r?function*(i){let s=r.bin(i);for(let[a,[c,f]]of r.entries())yield[s[a],{data:n,x1:c,x2:f}]}:function*(i){let s=o.bin(i);for(let[a,[c,f]]of o.entries())yield[s[a],{data:n,y1:c,y2:f}]}}function O4(t,e,n){return e=Ne(e),r=>{let o=t.map(()=>[]);for(let i of r)o[fi(e,n[i])-1]?.push(i);return o}}function dQ(t,e,n){let r=O4(t,e,n);return o=>{let i=r(o);for(let s=1,a=i.length;s<a;++s){let c=i[s-1],f=i[s];for(let u of c)f.push(u)}return i}}function hQ(t,e,n){let r=O4(t,e,n);return o=>{let i=r(o);for(let s=i.length-2;s>=0;--s){let a=i[s+1],c=i[s];for(let f of a)c.push(f)}return i}}function S$(t,e){let n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}var mQ={reduceIndex(t,e,{x1:n,x2:r}){return S$(n,r)}},xQ={reduceIndex(t,e,{y1:n,y2:r}){return S$(n,r)}},gQ={reduceIndex(t,e,{x1:n}){return n}},yQ={reduceIndex(t,e,{x2:n}){return n}},bQ={reduceIndex(t,e,{y1:n}){return n}},wQ={reduceIndex(t,e,{y2:n}){return n}};var vQ={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},yc=class extends lt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,z:a,curve:c,tension:f}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:vn(n),optional:!0}},n,vQ),this.z=a,this.curve=mh(c,f)}filter(e){return e}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n,0,0).call(u=>u.selectAll().data(nb(e,[s,a,c,f],this,r)).enter().append("path").call(ht,this).call(uc,this,r).attr("d",Wf().curve(this.curve).defined(p=>p>=0).x0(p=>s[p]).y0(p=>a[p]).x1(p=>c[p]).y1(p=>f[p]))).node()}};function xh(t,e){return e===void 0?Wi(t,{x:ic,y:Is}):new yc(t,e)}function Gs(t,e){let{y:n=Zt,...r}=Nu(e);return new yc(t,Xs(Us({...r,y1:n,y2:void 0})))}function Wi(t,e){let{x:n=Zt,...r}=Iu(e);return new yc(t,Ws(js({...r,x1:n,x2:void 0})))}var _Q={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},gh=class extends lt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,curve:a,tension:c}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,_Q),this.curve=Cb(a,c),Kr(this,n)}project(e,n,r){this.curve!==Vs&&super.project(e,n,r)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a}=r,{curve:u}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(p=>p.selectAll().data(e).enter().append("path").call(ht,this).attr("d",u===Vs&&i.projection?SQ(i.projection,s,a,c,f):l=>{let d=Ln(),h=u(d);return h.lineStart(),h.point(s[l],a[l]),h.point(c[l],f[l]),h.lineEnd(),d}).call(Tt,this,r).call(ji,this,r,i)).node()}};function SQ(t,e,n,r,o){let i=Ue(t);return e=Ne(e),n=Ne(n),r=Ne(r),o=Ne(o),s=>i({type:"LineString",coordinates:[[e[s],n[s]],[r[s],o[s]]]})}function Lb(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=yh(e,n,r),[i,s]=yh(o,i,s),new gh(t,{...a,x1:n,x2:r,y1:i,y2:s})}function yh(t,e,n){if(t===void 0){if(e===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[e]}else{if(e===void 0)return n===void 0?[t]:[t,n];if(n===void 0)return[t,e]}return[e,n]}var MQ={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},bh=class extends lt{constructor(e,n={}){let{x1:r,y1:o,x2:i,y2:s,bend:a=0,headAngle:c=60,headLength:f=8,inset:u=0,insetStart:p=u,insetEnd:l=u,sweep:d}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,MQ),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+f,this.insetStart=+p,this.insetEnd=+l,this.sweep=AQ(d)}render(e,n,r,o,i){let{x1:s,y1:a,x2:c=s,y2:f=a,SW:u}=r,{strokeWidth:p,bend:l,headAngle:d,headLength:h,insetStart:m,insetEnd:x}=this,g=u?w=>u[w]:ue(p===void 0?1:p),y=d*gu/2,b=h/1.5;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(w=>w.selectAll().data(e).enter().append("path").call(ht,this).attr("d",_=>{let v=s[_],A=a[_],T=c[_],E=f[_],N=Math.hypot(T-v,E-A);if(N<=m+x)return null;let M=Math.atan2(E-A,T-v),k=Math.min(b*g(_),N/3),O=this.sweep(v,A,T,E)*l*gu,S=Math.hypot(N/Math.tan(O),N)/2;if(m||x)if(S<1e5){let K=Math.sign(O),[et,rt]=TQ([v,A],[T,E],S,K);if(m&&([v,A]=M$([et,rt,S],[v,A,m],-K*Math.sign(m))),x){let[j,nt]=M$([et,rt,S],[T,E,x],K*Math.sign(x));M+=Math.atan2(nt-rt,j-et)-Math.atan2(E-rt,T-et),T=j,E=nt}}else{let K=T-v,et=E-A,rt=Math.hypot(K,et);m&&(v+=K/rt*m,A+=et/rt*m),x&&(T-=K/rt*x,E-=et/rt*x)}let I=M+O,C=I+y,L=I-y,D=T-k*Math.cos(C),$=E-k*Math.sin(C),P=T-k*Math.cos(L),F=E-k*Math.sin(L),q=S<1e5?`A${S},${S} 0,0,${O>0?1:0} `:"L",V=k?`M${D},${$}L${T},${E}L${P},${F}`:"";return`M${v},${A}${q}${T},${E}${V}`}).call(Tt,this,r)).node()}};function AQ(t=1){if(typeof t=="number")return ue(Math.sign(t));if(typeof t=="function")return(e,n,r,o)=>Math.sign(t(e,n,r,o));switch(Oe(t,"sweep",["+x","-x","+y","-y"])){case"+x":return(e,n,r)=>yt(e,r);case"-x":return(e,n,r)=>An(e,r);case"+y":return(e,n,r,o)=>yt(n,o);case"-y":return(e,n,r,o)=>An(n,o)}}function TQ([t,e],[n,r],o,i){let s=n-t,a=r-e,c=Math.hypot(s,a),f=i*Math.sqrt(o*o-c*c/4)/c;return[(t+n)/2-a*f,(e+r)/2+s*f]}function M$([t,e,n],[r,o,i],s){let a=r-t,c=o-e,f=Math.hypot(a,c),u=(a*a+c*c-i*i+n*n)/(2*f),p=s*Math.sqrt(n*n-u*u);return[t+(a*u+c*p)/f,e+(c*u-a*p)/f]}function A$(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:s,...a}={}){return[n,r]=yh(e,n,r),[i,s]=yh(o,i,s),new bh(t,{...a,x1:n,x2:r,y1:i,y2:s})}var EQ={ariaLabel:"bar"},Cu=class extends lt{constructor(e,n,r={},o=EQ){super(e,n,r,o),ch(this,r),fh(this,r)}render(e,n,r,o,i){let{rx:s,ry:a,rx1y1:c,rx1y2:f,rx2y1:u,rx2y2:p}=this,l=this._x(n,r,o),d=this._y(n,r,o),h=this._width(n,r,o),m=this._height(n,r,o);return ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(x=>x.selectAll().data(e).enter().call(c||f||u||p?g=>g.append("path").call(ht,this).call(uh,l,d,T$(l,h),T$(d,m),this).call(Tt,this,r):g=>g.append("rect").call(ht,this).attr("x",l).attr("width",h).attr("y",d).attr("height",m).call(at,"rx",s).call(at,"ry",a).call(Tt,this,r))).node()}_x(e,{x:n},{marginLeft:r}){let{insetLeft:o}=this;return n?i=>n[i]+o:r+o}_y(e,{y:n},{marginTop:r}){let{insetTop:o}=this;return n?i=>n[i]+o:r+o}_width({x:e},{x:n},{marginRight:r,marginLeft:o,width:i}){let{insetLeft:s,insetRight:a}=this,c=n&&e?e.bandwidth():i-r-o;return Math.max(0,c-s-a)}_height({y:e},{y:n},{marginTop:r,marginBottom:o,height:i}){let{insetTop:s,insetBottom:a}=this,c=n&&e?e.bandwidth():i-r-o;return Math.max(0,c-s-a)}};function T$(t,e){return typeof t=="function"&&typeof e=="function"?n=>t(n)+e(n):typeof t=="function"?n=>t(n)+e:typeof e=="function"?n=>t+e(n):t+e}var bc=class extends Cu{constructor(e,n={},r){let{x1:o,x2:i,y:s}=n;super(e,{x1:{value:o,scale:"x"},x2:{value:i,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},n,r)}_transform(e,n,{x:r}){e.call(xt,n,{x:r},0,0)}_x({x:e},{x1:n,x2:r},{marginLeft:o}){let{insetLeft:i}=this;return lr(e)?o+i:s=>Math.min(n[s],r[s])+i}_width({x:e},{x1:n,x2:r},{marginRight:o,marginLeft:i,width:s}){let{insetLeft:a,insetRight:c}=this;return lr(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}},wc=class extends Cu{constructor(e,n={},r){let{x:o,y1:i,y2:s}=n;super(e,{y1:{value:i,scale:"y"},y2:{value:s,scale:"y"},x:{value:o,scale:"x",type:"band",optional:!0}},n,r)}_transform(e,n,{y:r}){e.call(xt,n,{y:r},0,0)}_y({y:e},{y1:n,y2:r},{marginTop:o}){let{insetTop:i}=this;return lr(e)?o+i:s=>Math.min(n[s],r[s])+i}_height({y:e},{y1:n,y2:r},{marginTop:o,marginBottom:i,height:s}){let{insetTop:a,insetBottom:c}=this;return lr(e)?s-o-i-a-c:f=>Math.max(0,Math.abs(r[f]-n[f])-a-c)}};function Xo(t,e={}){return Oi(e)||(e={...e,y:Zt,x2:W}),new bc(t,Xs(yu(Us(e))))}function Wo(t,e={}){return Oi(e)||(e={...e,x:Zt,y2:W}),new wc(t,Ws(bu(js(e))))}var IQ={ariaLabel:"cell"},vc=class extends Cu{constructor(e,{x:n,y:r,...o}={}){super(e,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},o,IQ)}_transform(e,n){e.call(xt,n,{},0,0)}};function Hs(t,{x:e,y:n,...r}={}){return[e,n]=me(e,n),new vc(t,{...r,x:e,y:n})}function E$(t,{x:e=Zt,fill:n,stroke:r,...o}={}){return n===void 0&&ce(r)[0]===void 0&&(n=W),new vc(t,{...o,x:e,fill:n,stroke:r})}function I$(t,{y:e=Zt,fill:n,stroke:r,...o}={}){return n===void 0&&ce(r)[0]===void 0&&(n=W),new vc(t,{...o,y:e,fill:n,stroke:r})}var NQ={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function wh(t){return t.sort===void 0&&t.reverse===void 0?D1({channel:"-r"},t):t}var _c=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i,rotate:s,symbol:a=Ci,frameAnchor:c}=n,[f,u]=Ut(s,0),[p,l]=DL(a),[d,h]=Ut(i,p==null?3:4.5);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:d,scale:"r",filter:Pn,optional:!0},rotate:{value:f,optional:!0},symbol:{value:p,scale:"auto",optional:!0}},wh(n),NQ),this.r=h,this.rotate=u,this.symbol=l,this.frameAnchor=Do(c);let{channels:m}=this,{symbol:x}=m;if(x){let{fill:g,stroke:y}=m;x.hint={fill:g?g.value===x.value?"color":"currentColor":this.fill??"currentColor",stroke:y?y.value===x.value?"color":"currentColor":this.stroke??"none"}}}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,r:u,rotate:p,symbol:l}=r,{r:d,rotate:h,symbol:m}=this,[x,g]=Qe(this,o),y=m===Ci,b=u?void 0:d*d*Math.PI;return Ss(d)&&(e=[]),ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(w=>w.selectAll().data(e).enter().append(y?"circle":"path").call(ht,this).call(y?_=>{_.attr("cx",c?v=>c[v]:x).attr("cy",f?v=>f[v]:g).attr("r",u?v=>u[v]:d)}:_=>{_.attr("transform",to`translate(${c?v=>c[v]:x},${f?v=>f[v]:g})${p?v=>` rotate(${p[v]})`:h?` rotate(${h})`:""}`).attr("d",u&&l?v=>{let A=Ln();return l[v].draw(A,u[v]*u[v]*Math.PI),A}:u?v=>{let A=Ln();return m.draw(A,u[v]*u[v]*Math.PI),A}:l?v=>{let A=Ln();return l[v].draw(A,b),A}:(()=>{let v=Ln();return m.draw(v,b),v})())}).call(Tt,this,r)).node()}};function Pr(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new _c(t,{...r,x:e,y:n})}function N$(t,{x:e=W,...n}={}){return new _c(t,sb({...n,x:e}))}function C$(t,{y:e=W,...n}={}){return new _c(t,ib({...n,y:e}))}function k$(t,e){return Pr(t,{...e,symbol:"circle"})}function L$(t,e){return Pr(t,{...e,symbol:"hexagon"})}var CQ={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Sc=class extends lt{constructor(e,n={}){let{x:r,y:o,z:i,curve:s,tension:a}=n;super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y"},z:{value:vn(n),optional:!0}},n,CQ),this.z=i,this.curve=Cb(s,a),Kr(this,n)}filter(e){return e}project(e,n,r){this.curve!==Vs&&super.project(e,n,r)}render(e,n,r,o,i){let{x:s,y:a}=r,{curve:c}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(f=>f.selectAll().data(nb(e,[s,a],this,r)).enter().append("path").call(ht,this).call(uc,this,r).call(cO,this,r,i).attr("d",c===Vs&&i.projection?kQ(i.projection,s,a):Sd().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function kQ(t,e,n){let r=Ue(t);return e=Ne(e),n=Ne(n),o=>{let i=[],s=[i];for(let a of o)a===-1?(i=[],s.push(i)):i.push([e[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function Mc(t,{x:e,y:n,...r}={}){return[e,n]=me(e,n),new Sc(t,{...r,x:e,y:n})}function Qs(t,{x:e=W,y:n=Zt,...r}={}){return new Sc(t,Nu({...r,x:e,y:n}))}function Zs(t,{x:e=Zt,y:n=W,...r}={}){return new Sc(t,Iu({...r,x:e,y:n}))}function D4(t,e){e=LQ(e);let{x:n,y:r,color:o,size:i}=e,s=Rb(t,n),a=Rb(t,r),c=Rb(t,o),f=Rb(t,i),{fx:u,fy:p,x:{value:l,reduce:d,zero:h,...m},y:{value:x,reduce:g,zero:y,...b},color:{value:w,color:_,reduce:v},size:{value:A,reduce:T},mark:E}=e;if(d===void 0&&(d=g==null&&l==null&&A==null&&x!=null?"count":null),g===void 0&&(g=d==null&&x==null&&A==null&&l!=null?"count":null),T===void 0&&A==null&&v==null&&d==null&&g==null&&(l==null||ie(s))&&(x==null||ie(a))&&(T="count"),h===void 0&&(h=Ob(d)?!0:void 0),y===void 0&&(y=Ob(g)?!0:void 0),l==null&&x==null)throw new Error("must specify x or y");if(d!=null&&x==null)throw new Error("reducing x requires y");if(g!=null&&l==null)throw new Error("reducing y requires x");E===void 0&&(E=A!=null||T!=null?"dot":Ob(d)||Ob(g)||v!=null?"bar":l!=null&&x!=null?ie(s)||ie(a)||d==null&&g==null&&!vh(s)&&!vh(a)?"dot":"line":l!=null||x!=null?"rule":null);let N,M,k;switch(E){case"dot":k=Pr,M="stroke";break;case"line":k=s&&a||d!=null||g!=null?y||g!=null||s&&vh(s)?Zs:h||d!=null||a&&vh(a)?Qs:Mc:s?Qs:Zs,M="stroke",O$(c)&&(N=null);break;case"area":k=!(y||g!=null)&&(h||d!=null||a&&vh(a))?Gs:Wi,M="fill",O$(c)&&(N=null);break;case"rule":k=s?pr:dr,M="stroke";break;case"bar":k=d!=null?ie(a)?R$(d)&&s&&ie(s)?Hs:Xo:Mu:g!=null?ie(s)?R$(g)&&a&&ie(a)?Hs:Wo:Au:v!=null||T!=null?s&&ie(s)&&a&&ie(a)?Hs:s&&ie(s)?Wo:a&&ie(a)?Xo:lh:s&&Di(s)&&!(a&&Di(a))?Xo:a&&Di(a)&&!(s&&Di(s))?Wo:Hs,M="fill";break;default:throw new Error(`invalid mark: ${E}`)}let O={fx:u,fy:p,x:s??void 0,y:a??void 0,[M]:c??_,z:N,r:f??void 0,tip:!0},S,I={[M]:v??void 0,r:T??void 0};if(d!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(I.y=g,S=ie(s)?Rs:Uo):d!=null?(I.x=d,S=ie(a)?Os:jo):(v!=null||T!=null)&&(s&&a?S=ie(s)&&ie(a)?Hd:ie(s)?jo:ie(a)?Uo:Xi:s?S=ie(s)?Rs:Uo:a&&(S=ie(a)?Os:jo)),(S===Xi||S===Uo)&&(O.x={value:s,...m}),(S===Xi||S===jo)&&(O.y={value:a,...b}),h===void 0&&(h=s&&!(S===Xi||S===Uo)&&(k===Xo||k===Gs||k===Mu||k===dr)),y===void 0&&(y=a&&!(S===Xi||S===jo)&&(k===Wo||k===Wi||k===Au||k===pr)),{fx:u??null,fy:p??null,x:{value:l??null,reduce:d??null,zero:!!h,...m},y:{value:x??null,reduce:g??null,zero:!!y,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:A??null,reduce:T??null},mark:E,markImpl:$$[k],markOptions:O,transformImpl:$$[S],transformOptions:I,colorMode:M}}function D$(t,e){let n=D4(t,e),{fx:r,fy:o,x:{zero:i},y:{zero:s},markOptions:a,transformOptions:c,colorMode:f}=n,u=$4[n.markImpl],p=$4[n.transformImpl],l=r!=null||o!=null?Tu({strokeOpacity:.1}):null,d=[i?pr([0]):null,s?dr([0]):null],h=u(t,p?p(c,a):a);return f==="stroke"?ke(l,d,h):ke(l,h,d)}function vh(t){let e,n;for(let r of t){if(r==null)continue;if(e===void 0){e=r;continue}let o=Math.sign(yt(e,r));if(o){if(n!==void 0&&o!==n)return!1;e=r,n=o}}return!0}function LQ({x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}={}){return fr(t)||(t=ku(t)),fr(e)||(e=ku(e)),fr(n)||(n=Ls(n)?{color:n}:ku(n)),fr(r)||(r=ku(r)),fr(o)&&({value:o}=ku(o)),fr(i)&&({value:i}=ku(i)),s!=null&&(s=`${s}`.toLowerCase()),{x:t,y:e,color:n,size:r,fx:o,fy:i,mark:s}}function Rb(t,e){let n=ut(t,e.value);return n&&(n.label=un(e.value)),n}function ku(t){return RQ(t)?{reduce:t}:{value:t}}function Ob(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function R$(t){return/^(?:first|last|mode)$/i.test(t)}function RQ(t){if(t==null)return!1;if(typeof t.reduceIndex=="function"||typeof t.reduce=="function"&&Ve(t)||/^p\d{2}$/i.test(t))return!0;switch(`${t}`.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 O$(t){return t?new En(t).size>t.length>>1:!1}var $4={dot:Pr,line:Mc,lineX:Qs,lineY:Zs,areaX:Gs,areaY:Wi,ruleX:pr,ruleY:dr,barX:Xo,barY:Wo,rect:lh,rectX:Mu,rectY:Au,cell:Hs,bin:Xi,binX:Uo,binY:jo,group:Hd,groupX:Rs,groupY:Os},$$=Object.fromEntries(Object.entries($4).map(([t,e])=>[e,t]));function Lu(t,e={}){let{x:n,x1:r,x2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,x:n=W});let i={};return n!=null&&(i.x=t),r!=null&&(i.x1=t),o!=null&&(i.x2=t),Hn(i,e)}function Ru(t,e={}){let{y:n,y1:r,y2:o}=e;n===void 0&&r===void 0&&o===void 0&&(e={...e,y:n=W});let i={};return n!=null&&(i.y=t),r!=null&&(i.y1=t),o!=null&&(i.y2=t),Hn(i,e)}function Hn(t={},e={}){let n=vn(e),r=Object.entries(t).map(([o,i])=>{let s=C1(o,e);if(s==null)throw new Error(`missing channel: ${o}`);let[a,c]=Ge(s);return{key:o,input:s,output:a,setOutput:c,map:OQ(i)}});return{...Ce(e,(o,i)=>{let s=ut(o,n),a=r.map(({input:f})=>ut(o,f)),c=r.map(({setOutput:f})=>f(new Array(o.length)));for(let f of i)for(let u of s?rn(f,p=>s[p]).values():[f])r.forEach(({map:p},l)=>p.mapIndex(u,a[l],c[l]));return{data:o,facets:i}}),...Object.fromEntries(r.map(({key:o,output:i})=>[o,i]))}}function OQ(t){if(t==null)throw new Error("missing map");if(typeof t.mapIndex=="function")return t;if(typeof t.map=="function"&&Ve(t))return $Q(t);if(typeof t=="function")return P4(ru(t));switch(`${t}`.toLowerCase()){case"cumsum":return PQ;case"rank":return P4((e,n)=>up(e,r=>n[r]));case"quantile":return P4((e,n)=>DQ(e,r=>n[r]))}throw new Error(`invalid map: ${t}`)}function $Q(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}function DQ(t,e){let n=po(t,e)-1;return up(t,e).map(r=>r/n)}function P4(t){return{mapIndex(e,n,r){let o=t(e,n);if(o.length!==e.length)throw new Error("map function returned a mismatched length");for(let i=0,s=e.length;i<s;++i)r[e[i]]=o[i]}}}var PQ={mapIndex(t,e,n){let r=0;for(let o of t)n[o]=r+=e[o]}};function P$(t={},e){return arguments.length===1&&(e=t),Lu(Ou(t),e)}function F$(t={},e){return arguments.length===1&&(e=t),Ru(Ou(t),e)}function Ou(t={}){typeof t=="number"&&(t={k:t});let{k:e,reduce:n,shift:r,anchor:o,strict:i}=t;if(o===void 0&&r!==void 0&&(o=qQ(r),_n(`Warning: the shift option is deprecated; please use anchor "${o}" instead.`)),!((e=Math.floor(e))>0))throw new Error(`invalid k: ${e}`);return BQ(n)(e,FQ(o,e),i)}function FQ(t="middle",e){switch(`${t}`.toLowerCase()){case"middle":return e-1>>1;case"start":return 0;case"end":return e-1}throw new Error(`invalid anchor: ${t}`)}function qQ(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}function BQ(t="mean"){if(typeof t=="string"){if(/^p\d{2}$/i.test(t))return $b(nu(t));switch(t.toLowerCase()){case"deviation":return $b(Mr);case"max":return Db((e,n)=>kt(e,r=>n[r]));case"mean":return zQ;case"median":return $b(Vr);case"min":return Db((e,n)=>It(e,r=>n[r]));case"mode":return Db((e,n)=>lf(e,r=>n[r]));case"sum":return q$;case"variance":return $b(as);case"difference":return jQ;case"ratio":return XQ;case"first":return WQ;case"last":return VQ}}if(typeof t!="function")throw new Error(`invalid reduce: ${t}`);return Db(ru(t))}function $b(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=f=>i[f]==null?NaN:+i[f],c=0;for(let f=0;f<e-1;++f)isNaN(a(f))&&++c;for(let f=0,u=o.length-e+1;f<u;++f)isNaN(a(f+e-1))&&++c,s[o[f+n]]=c===0?t($i(o,f,f+e),a):NaN,isNaN(a(f))&&--c}}:{mapIndex(o,i,s){let a=c=>i[c]==null?NaN:+i[c];for(let c=-n;c<0;++c)s[o[c+n]]=t($i(o,0,c+e),a);for(let c=0,f=o.length-n;c<f;++c)s[o[c+n]]=t($i(o,c,c+e),a)}}}function Db(t){return(e,n,r)=>r?{mapIndex(o,i,s){let a=0;for(let c=0;c<e-1;++c)a+=oe(i[o[c]]);for(let c=0,f=o.length-e+1;c<f;++c)a+=oe(i[o[c+e-1]]),a===e&&(s[o[c+n]]=t($i(o,c,c+e),i)),a-=oe(i[o[c]])}}:{mapIndex(o,i,s){for(let a=-n;a<0;++a)s[o[a+n]]=t($i(o,0,a+e),i);for(let a=0,c=o.length-n;a<c;++a)s[o[a+n]]=t($i(o,a,a+e),i)}}}function q$(t,e,n){return n?{mapIndex(r,o,i){let s=0,a=0;for(let c=0;c<t-1;++c){let f=o[r[c]];f===null||isNaN(f)?++s:a+=+f}for(let c=0,f=r.length-t+1;c<f;++c){let u=o[r[c]],p=o[r[c+t-1]];p===null||isNaN(p)?++s:a+=+p,i[r[c+e]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(r,o,i){let s=0,a=r.length;for(let c=0,f=Math.min(a,t-e-1);c<f;++c)s+=+o[r[c]]||0;for(let c=-e,f=a-e;c<f;++c)s+=+o[r[c+t-1]]||0,i[r[c+e]]=s,s-=+o[r[c]]||0}}}function zQ(t,e,n){if(n){let r=q$(t,e,n);return{mapIndex(o,i,s){r.mapIndex(o,i,s);for(let a=0,c=o.length-t+1;a<c;++a)s[o[a+e]]/=t}}}else return{mapIndex(r,o,i){let s=0,a=0,c=r.length;for(let f=0,u=Math.min(c,t-e-1);f<u;++f){let p=o[r[f]];p!==null&&!isNaN(p=+p)&&(s+=p,++a)}for(let f=-e,u=c-e;f<u;++f){let p=o[r[f+t-1]],l=o[r[f]];p!==null&&!isNaN(p=+p)&&(s+=p,++a),i[r[f+e]]=s/a,l!==null&&!isNaN(l=+l)&&(s-=l,--a)}}}}function YQ(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(oe(i))return i}}function UQ(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(oe(i))return i}}function B$(t,e,n,r){for(let o=n+r;n<o;++n){let i=t[e[n]];if(i!==null&&!isNaN(i=+i))return i}}function z$(t,e,n,r){for(let o=n+r-1;o>=n;--o){let i=t[e[o]];if(i!==null&&!isNaN(i=+i))return i}}function jQ(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s){let c=o[r[s]],f=o[r[s+t-1]];i[r[s+e]]=c===null||f===null?NaN:f-c}}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=z$(o,r,s,t)-B$(o,r,s,t)}}}function XQ(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s){let c=o[r[s]],f=o[r[s+t-1]];i[r[s+e]]=c===null||f===null?NaN:f/c}}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=z$(o,r,s,t)/B$(o,r,s,t)}}}function WQ(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s)i[r[s+e]]=o[r[s]]}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=YQ(o,r,s,t)}}}function VQ(t,e,n){return n?{mapIndex(r,o,i){for(let s=0,a=r.length-t;s<a;++s)i[r[s+e]]=o[r[s+t-1]]}}:{mapIndex(r,o,i){for(let s=-e,a=r.length-t+e+1;s<a;++s)i[r[s+e]]=UQ(o,r,s,t)}}}var Vi={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function Y$(t,{x:e=W,y:n,k:r=Vi.k,color:o=Vi.color,opacity:i=Vi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:u,...p}={}){return ke(zt(s)?null:Gs(t,Hn({x1:Js({k:-r,...p}),x2:Js({k:r,...p})},{x1:e,x2:e,y:n,fill:s,fillOpacity:a,...p})),zt(c)?null:Qs(t,Hn({x:Js(p)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:u,...p})))}function U$(t,{x:e,y:n=W,k:r=Vi.k,color:o=Vi.color,opacity:i=Vi.opacity,fill:s=o,fillOpacity:a=i,stroke:c=o,strokeOpacity:f,strokeWidth:u,...p}={}){return ke(zt(s)?null:Wi(t,Hn({y1:Js({k:-r,...p}),y2:Js({k:r,...p})},{x:e,y1:n,y2:n,fill:s,fillOpacity:a,...p})),zt(c)?null:Zs(t,Hn({y:Js(p)},{x:e,y:n,stroke:c,strokeOpacity:f,strokeWidth:u,...p})))}function Js({n:t=Vi.n,k:e=0,strict:n=Vi.strict,anchor:r=Vi.anchor}={}){return Ou({k:t,reduce:o=>pi(o)+e*(Mr(o)||0),strict:n,anchor:r})}var GQ={ariaLabel:"tick",fill:null,stroke:"currentColor"},Pb=class extends lt{constructor(e,n,r){super(e,n,r,GQ),Kr(this,r)}render(e,n,r,o,i){return ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(s=>s.selectAll().data(e).enter().append("line").call(ht,this).attr("x1",this._x1(n,r,o)).attr("x2",this._x2(n,r,o)).attr("y1",this._y1(n,r,o)).attr("y2",this._y2(n,r,o)).call(Tt,this,r).call(ji,this,r,i)).node()}},_h=class extends Pb{constructor(e,n={}){let{x:r,y:o,inset:i=0,insetTop:s=i,insetBottom:a=i}=n;super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n),this.insetTop=Dt(s),this.insetBottom=Dt(a)}_transform(e,n,{x:r}){e.call(xt,n,{x:r},le,0)}_x1(e,{x:n}){return r=>n[r]}_x2(e,{x:n}){return r=>n[r]}_y1({y:e},{y:n},{marginTop:r}){let{insetTop:o}=this;return n&&e?i=>n[i]+o:r+o}_y2({y:e},{y:n},{height:r,marginBottom:o}){let{insetBottom:i}=this;return n&&e?s=>n[s]+e.bandwidth()-i:r-o-i}},Sh=class extends Pb{constructor(e,n={}){let{x:r,y:o,inset:i=0,insetRight:s=i,insetLeft:a=i}=n;super(e,{y:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=Dt(s),this.insetLeft=Dt(a)}_transform(e,n,{y:r}){e.call(xt,n,{y:r},0,le)}_x1({x:e},{x:n},{marginLeft:r}){let{insetLeft:o}=this;return n&&e?i=>n[i]+o:r+o}_x2({x:e},{x:n},{width:r,marginRight:o}){let{insetRight:i}=this;return n&&e?s=>n[s]+e.bandwidth()-i:r-o-i}_y1(e,{y:n}){return r=>n[r]}_y2(e,{y:n}){return r=>n[r]}};function Fb(t,{x:e=W,...n}={}){return new _h(t,{...n,x:e})}function qb(t,{y:e=W,...n}={}){return new Sh(t,{...n,y:e})}function j$(t,{x:e=W,y:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...u}={}){let p=n!=null?Os:Gd;return ke(dr(t,p({x1:F4,x2:q4},{x:e,y:n,stroke:s,strokeOpacity:a,...u})),Xo(t,p({x1:"p25",x2:"p75"},{x:e,y:n,fill:o,fillOpacity:i,...u})),Fb(t,p({x:"p50"},{x:e,y:n,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...u})),Pr(t,Hn({x:W$},{x:e,y:n,z:n,r,stroke:s,strokeOpacity:a,...u})))}function X$(t,{y:e=W,x:n=null,r,fill:o="#ccc",fillOpacity:i,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:f,...u}={}){let p=n!=null?Rs:Gd;return ke(pr(t,p({y1:F4,y2:q4},{x:n,y:e,stroke:s,strokeOpacity:a,...u})),Wo(t,p({y1:"p25",y2:"p75"},{x:n,y:e,fill:o,fillOpacity:i,...u})),qb(t,p({y:"p50"},{x:n,y:e,stroke:s,strokeOpacity:a,strokeWidth:c,sort:f,...u})),Pr(t,Hn({y:W$},{x:n,y:e,z:n,r,stroke:s,strokeOpacity:a,...u})))}function W$(t){let e=F4(t),n=q4(t);return t.map(r=>r<e||r>n?r:NaN)}function F4(t){let e=V$(t)*2.5-G$(t)*1.5;return It(t,n=>n>=e?n:NaN)}function q4(t){let e=G$(t)*2.5-V$(t)*1.5;return kt(t,n=>n<=e?n:NaN)}function V$(t){return In(t,.25)}function G$(t){return In(t,.75)}var HQ={ariaLabel:"raster",stroke:null,pixelSize:1};function $u(t,e){let n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function H$(t,e){let n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}var Ah=class extends lt{constructor(e,n,r={},o){let{width:i,height:s,x:a,y:c,x1:f=a==null?0:void 0,y1:u=c==null?0:void 0,x2:p=a==null?i:void 0,y2:l=c==null?s:void 0,pixelSize:d=o.pixelSize,blur:h=0,interpolate:m}=r;if(i!=null&&(i=H$(i,"width")),s!=null&&(s=H$(s,"height")),f!=null&&(f=$u(f,"x1")),u!=null&&(u=$u(u,"y1")),p!=null&&(p=$u(p,"x2")),l!=null&&(l=$u(l,"y2")),a==null&&(f==null||p==null))throw new Error("missing x");if(c==null&&(u==null||l==null))throw new Error("missing y");e!=null&&i!=null&&s!=null&&(a===void 0&&f!=null&&p!=null&&(a=rZ(f,p,i,s)),c===void 0&&u!=null&&l!=null&&(c=oZ(u,l,i,s))),super(e,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:p==null?null:[p],scale:"x",optional:!0,filter:null},y2:{value:l==null?null:[l],scale:"y",optional:!0,filter:null},...n},r,o),this.width=i,this.height=s,this.pixelSize=$u(d,"pixelSize"),this.blur=$u(h,"blur"),this.interpolate=a==null||c==null?null:QQ(m)}},Th=class extends Ah{constructor(e,n={}){let{imageRendering:r}=n;if(e==null){let{fill:o,fillOpacity:i}=n;Ut(i)[0]!==void 0&&(n=Bb("fillOpacity",n)),ce(o)[0]!==void 0&&(n=Bb("fill",n))}super(e,void 0,n,HQ),this.imageRendering=te(r,"auto")}scale(e,{color:n,...r},o){return super.scale(e,r,o)}render(e,n,r,o,i){let s=n[r.channels.fill?.scale]??(I=>I),{x:a,y:c}=r,{document:f}=i,[u,p,l,d]=Z$(r,o,i),h=l-u,m=d-p,{pixelSize:x,width:g=Math.round(Math.abs(h)/x),height:y=Math.round(Math.abs(m)/x)}=this,b=g*y,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let I=g/h,C=y/m,L=Et(a,$=>($-u)*I,Float64Array),D=Et(c,$=>($-p)*C,Float64Array);w&&(w=this.interpolate(e,g,y,L,D,w)),_&&(_=this.interpolate(e,g,y,L,D,_))}else this.data==null&&e&&(v=e.fi*b);let A=f.createElement("canvas");A.width=g,A.height=y;let T=A.getContext("2d"),E=T.createImageData(g,y),N=E.data,{r:M,g:k,b:O}=Le(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let I=0;I<b;++I){let C=I<<2;if(w){let L=s(w[I+v]);if(L==null){N[C+3]=0;continue}({r:M,g:k,b:O}=Le(L))}_&&(S=_[I+v]*255),N[C+0]=M,N[C+1]=k,N[C+2]=O,N[C+3]=S}return this.blur>0&&a_(E,this.blur),T.putImageData(E,0,0),ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(I=>I.append("image").attr("transform",`translate(${u},${p}) scale(${Math.sign(l-u)},${Math.sign(d-p)})`).attr("width",Math.abs(h)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(at,"image-rendering",this.imageRendering).call(ht,this).attr("xlink:href",A.toDataURL())).node()}};function B4(t,e,n){arguments.length<3&&(n=e,e=null);let{x:r,y:o,[t]:i,...s}=n;return r===void 0&&o===void 0&&ML(e)&&(r=ic,o=Is,i===void 0&&(i=wL)),[e,{...s,x:r,y:o,[t]:i}]}function Q$(){let[t,e]=B4("fill",...arguments);return new Th(t,t==null||e.fill!==void 0||e.fillOpacity!==void 0?e:{...e,fill:W})}function Z$({x1:t,y1:e,x2:n,y2:r},o,{projection:i}){let{width:s,height:a,marginTop:c,marginRight:f,marginBottom:u,marginLeft:p}=o;return[t&&i==null?t[0]:p,e&&i==null?e[0]:c,n&&i==null?n[0]:s-f,r&&i==null?r[0]:a-u]}function z4({x1:t,y1:e,x2:n,y2:r},o,i,s){let a={};return t&&(a.x1=t),e&&(a.y1=e),n&&(a.x2=n),r&&(a.y2=r),Z$(uu(a,o),i,s)}function Bb(t,e={}){let{[t]:n}=e;if(typeof n!="function")throw new Error(`invalid ${t}: not a function`);return Kt({...e,[t]:void 0},function(r,o,i,s,a,c){let{x:f,y:u}=s;if(!f)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[p,l,d,h]=z4(i,s,a,c),m=d-p,x=h-l,{pixelSize:g}=this,{width:y=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(x)/g)}=e,w=new Array(y*b*(o?o.length:1)),_=m/y,v=x/b,A=0;for(let T of o??[void 0])for(let E=.5;E<b;++E)for(let N=.5;N<y;++N,++A)w[A]=n(f.invert(p+N*_),u.invert(l+E*v),T);return{data:w,facets:o,channels:{[t]:{value:w,scale:"auto"}}}})}function QQ(t){if(typeof t=="function")return t;if(t==null)return zb;switch(`${t}`.toLowerCase()){case"none":return zb;case"nearest":return Ih;case"barycentric":return Eh();case"random-walk":return Nh()}throw new Error(`invalid interpolate: ${t}`)}function zb(t,e,n,r,o,i){let s=new Array(e*n);for(let a of t)r[a]<0||r[a]>=e||o[a]<0||o[a]>=n||(s[Math.floor(o[a])*e+Math.floor(r[a])]=i[a]);return s}function Eh({random:t=Wa(42)}={}){return(e,n,r,o,i,s)=>{let{points:a,triangles:c,hull:f}=Er.from(e,d=>o[d],d=>i[d]),u=new s.constructor(n*r).fill(NaN),p=new Uint8Array(n*r),l=nZ(s,t);for(let d=0;d<c.length;d+=3){let h=c[d],m=c[d+1],x=c[d+2],g=a[2*h],y=a[2*m],b=a[2*x],w=a[2*h+1],_=a[2*m+1],v=a[2*x+1],A=Math.min(g,y,b),T=Math.max(g,y,b),E=Math.min(w,_,v),N=Math.max(w,_,v),M=(_-v)*(g-b)+(w-v)*(b-y);if(!M)continue;let k=s[e[h]],O=s[e[m]],S=s[e[x]];for(let I=Math.floor(A);I<T;++I)for(let C=Math.floor(E);C<N;++C){if(I<0||I>=n||C<0||C>=r)continue;let L=I+.5,D=C+.5,$=Math.sign(M),P=(_-v)*(L-b)+(D-v)*(b-y);if(P*$<0)continue;let F=(v-w)*(L-b)+(D-v)*(g-b);if(F*$<0)continue;let q=M-(P+F);if(q*$<0)continue;let V=I+n*C;u[V]=l(k,P/M,O,F/M,S,q/M,I,C),p[V]=1}}return ZQ(u,p,o,i,s,n,r,f,e,l),u}}function ZQ(t,e,n,r,o,i,s,a,c,f){n=Float64Array.from(a,d=>n[c[d]]),r=Float64Array.from(a,d=>r[c[d]]),o=Array.from(a,d=>o[c[d]]);let u=n.length,p=Array.from({length:u},(d,h)=>KQ(h,n,r)),l=0;for(let d=0;d<s;++d){let h=d+.5;for(let m=0;m<i;++m){let x=m+i*d;if(!e[x]){let g=m+.5;for(let y=0;y<u;++y){let b=(u+l+(y%2?(y+1)/2:-y/2))%u;if(p[b](g,h)){let w=JQ(n.at(b-1),r.at(b-1),n[b],r[b],g,h);t[x]=f(o.at(b-1),w,o[b],1-w,o[b],0,m,d),l=b;break}}}}}}function JQ(t,e,n,r,o,i){let s=n-t,a=r-e,c=s*(n-o)+a*(r-i),f=s*(o-t)+a*(i-e);return c>0&&f>0?c/(c+f):+(c>f)}function Mh(t,e,n,r){return t*r-n*e}function KQ(t,e,n){let r=e.length,o=e.at(t-2),i=n.at(t-2),s=e.at(t-1),a=n.at(t-1),c=e[t],f=n[t],u=e.at(t+1-r),p=n.at(t+1-r),l=s-c,d=a-f,h=o-s,m=i-a,x=c-u,g=f-p,y=Math.hypot(l,d),b=Math.hypot(h,m),w=Math.hypot(x,g);return(_,v)=>{let A=_-s,T=v-a,E=_-c,N=v-f;return Mh(A,T,E,N)>-1e-6&&Mh(A,T,l,d)*b-Mh(A,T,h,m)*y>-1e-6&&Mh(E,N,x,g)*y-Mh(E,N,l,d)*w<=0}}function Ih(t,e,n,r,o,i){let s=new i.constructor(e*n),a=Er.from(t,u=>r[u],u=>o[u]),c,f;for(let u=.5,p=0;u<n;++u){f=c;for(let l=.5;l<e;++l,++p)f=a.find(l,u,f),l===.5&&(c=f),s[p]=i[t[f]]}return s}function Nh({random:t=Wa(42),minDistance:e=.5,maxSteps:n=2}={}){return(r,o,i,s,a,c)=>{let f=new c.constructor(o*i),u=Er.from(r,h=>s[h],h=>a[h]),p,l,d;for(let h=.5,m=0;h<i;++h){l=p;for(let x=.5;x<o;++x,++m){let g=x,y=h;d=l=u.find(g,y,l),x===.5&&(p=l);let b,w=0;for(;(b=Math.hypot(s[r[d]]-g,a[r[d]]-y))>e&&w<n;){let _=t(x,h,w)*2*Math.PI;g+=Math.cos(_)*b,y+=Math.sin(_)*b,d=u.find(g,y,d),++w}f[m]=c[r[d]]}}return f}}function tZ(t,e,n,r,o,i){return e*t+r*n+i*o}function eZ(t){return(e,n,r,o,i,s,a,c)=>{let f=t(a,c);return f<n?e:f<n+o?r:i}}function nZ(t,e){return Di(t)||fe(t)?tZ:eZ(e)}function rZ(t,e,n){return{transform(r){let o=r.length,i=new Float64Array(o),s=(e-t)/n,a=t+s/2;for(let c=0;c<o;++c)i[c]=c%n*s+a;return i}}}function oZ(t,e,n,r){return{transform(o){let i=o.length,s=new Float64Array(i),a=(e-t)/r,c=t+a/2;for(let f=0;f<i;++f)s[f]=Math.floor(f/n)%r*a+c;return s}}}var J$={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Ch=class extends Ah{constructor(e,{smooth:n=!0,value:r,...o}={}){let i=eb({},o,J$);if(r===void 0){for(let a in i)if(i[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=o[a],o[a]="value"}}if(r!=null){let a={transform:c=>c.map(f=>f.value),label:un(r)};for(let c in i)o[c]==="value"&&(o[c]=a)}if(e==null){if(r==null)throw new Error("missing contour value");o=Bb("value",{value:r,...o}),r=null}else{let{interpolate:a}=o;r===void 0&&(r=W),a===void 0&&(o.interpolate="nearest")}super(e,{value:{value:r,optional:!0}},iZ(o),J$);let s={geometry:{value:W}};for(let a in this.channels){let c=this.channels[a],{scale:f}=c;f==="x"||f==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(e,{x:n,y:r,value:o,...i},s){return super.filter(e,i,s)}render(e,n,r,o,i){let{geometry:s}=r,a=Ue();return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(c=>{c.selectAll().data(e).enter().append("path").call(ht,this).attr("d",f=>a(s[f])).call(Tt,this,r)}).node()}};function iZ({thresholds:t,interval:e,...n}){return t=R4(t,e,cs),Kt(n,function(r,o,i,s,a,c){let[f,u,p,l]=z4(i,s,a,c),d=p-f,h=l-u,{pixelSize:m,width:x=Math.round(Math.abs(d)/m),height:g=Math.round(Math.abs(h)/m)}=this,y=x/d,b=g/h,w=i.value.value,_=[];if(this.interpolate){let{x:N,y:M}=Bo(i,s,c),k=Et(N,C=>(C-f)*y,Float64Array),O=Et(M,C=>(C-u)*b,Float64Array),S=[i.x,i.y,i.value],I=[k,O,w];for(let C of o){let L=this.filter(C,S,I);_.push(this.interpolate(L,x,g,k,O,w))}}else if(o){let N=x*g,M=o.length;for(let k=0;k<M;++k)_.push(w.slice(k*N,k*N+N))}else _.push(w);if(this.blur>0)for(let N of _)ip({data:N,width:x,height:g},this.blur);let v=sZ(t,w,...aZ(_));if(v===null)throw new Error(`unsupported thresholds: ${t}`);let{contour:A}=ms().size([x,g]).smooth(this.smooth),T=[],E=[];for(let N of _)E.push(ye(T.length,T.push(...Et(v,M=>A(N,M)))));for(let{coordinates:N}of T)for(let M of N)for(let k of M)for(let O of k)O[0]=O[0]/y+f,O[1]=O[1]/b+u;return{data:T,facets:E,channels:Y1(this.contourChannels,T)}})}function sZ(t,e,n,r){if(typeof t?.range=="function")return t.range(t.floor(n),r);if(typeof t=="function"&&(t=t(e,n,r)),typeof t!="number")return cr(t);let o=on(...ff(n,r,t),t);for(;o[o.length-1]>=r;)o.pop();for(;o[1]<n;)o.shift();return o}function tD(){return new Ch(...B4("value",...arguments))}function aZ(t){return[It(t,e=>It(e,K$)),kt(t,e=>kt(e,K$))]}function K$(t){return isFinite(t)?t:NaN}function rD(t,e){return Y4(Bs,t,e)}function oD(t,e={}){return Y4(zs,t,e)}function iD(t,e={}){return Y4(Ui,t,e)}function Y4(t,e,n={}){let{x:r,y:o,maxRadius:i}=n,s=t({px:r,py:o,maxRadius:i}),a=[];r!=null&&a.push(pr(e,eD("x",{...s,inset:-6},n))),o!=null&&a.push(dr(e,eD("y",{...s,inset:-6},n))),r!=null&&a.push(Yo(e,nD("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),o!=null&&a.push(Yo(e,nD("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return ke(...a)}function sD(t,{channels:e,...n},{facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:c,transform:f,initializer:u}){return{...n,facet:r,facetAnchor:o,fx:i,fy:s,[t]:a,channels:{...e,...c},transform:f,initializer:cZ(t,u)}}function cZ(t,e){return e==null?e:function(n,r,{x:o,y:i,px:s,py:a,...c},...f){let{channels:{x:u,y:p,...l}={},...d}=e.call(this,n,r,{...c,x:s,y:a},...f);return{channels:{...l,...u&&{px:u,...t==="x"&&{x:u}},...p&&{py:p,...t==="y"&&{y:p}}},...d}}}function eD(t,e,n){let{color:r="currentColor",opacity:o=.2,ruleStroke:i=r,ruleStrokeOpacity:s=o,ruleStrokeWidth:a}=n;return{...sD(t,e,n),stroke:i,strokeOpacity:s,strokeWidth:a}}function nD(t,e,n){let{color:r="currentColor",textFill:o=r,textFillOpacity:i,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...sD(t,e,fZ(t,n)),fill:o,fillOpacity:i,stroke:s,strokeOpacity:a,strokeWidth:c}}function fZ(t,e){return Kt(e,(n,r,o)=>({channels:{text:{value:Zd(o,t)?.value}}}))}var uZ={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},lZ={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},pZ={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},dZ={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},hZ={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},U4=class extends lt{constructor(e,n={}){let{x:r,y:o,z:i,curve:s,tension:a}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:i,optional:!0}},n,uZ),this.curve=mh(s,a),Kr(this,n)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:u}=r,{curve:p}=this,[l,d]=Qe(this,o),h=c?y=>c[y]:ue(l),m=f?y=>f[y]:ue(d),x=this;function g(y){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],A=[],T=[],E=[];function N(S,I){S=y[S],I=y[I],w.push(++b),v[b]=h(S),T[b]=m(S),A[b]=h(I),E[b]=m(I);for(let C in r)_[C].push(r[C][I])}let{halfedges:M,hull:k,triangles:O}=Er.from(y,h,m);for(let S=0;S<M.length;++S){let I=M[S];I>S&&N(O[S],O[I])}for(let S=0;S<k.length;++S)N(k[S],k[(S+1)%k.length]);Nt(this).selectAll().data(w).enter().append("path").call(ht,x).attr("d",S=>{let I=Ln(),C=p(I);return C.lineStart(),C.point(v[S],T[S]),C.point(A[S],E[S]),C.lineEnd(),I}).call(Tt,x,_).call(ji,x,_,i)}return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(u?y=>y.selectAll().data(rn(e,b=>u[b]).values()).enter().append("g").each(g):y=>y.datum(e).each(g)).node()}},kh=class extends lt{constructor(e,n={},r,o=({z:i})=>i){let{x:i,y:s}=n;super(e,{x:{value:i,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:o(n),optional:!0}},n,r)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,z:u}=r,[p,l]=Qe(this,o),d=c?g=>c[g]:ue(p),h=f?g=>f[g]:ue(l),m=this;function x(g){let y=Er.from(g,d,h);Nt(this).append("path").datum(g[0]).call(ht,m).attr("d",m._render(y,o)).call(Tt,m,r)}return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(u?g=>g.selectAll().data(rn(e,y=>u[y]).values()).enter().append("g").each(x):g=>g.datum(e).each(x)).node()}},j4=class extends kh{constructor(e,n={}){super(e,n,lZ),this.fill="none"}_render(e){return e.render()}},X4=class extends kh{constructor(e,n={}){super(e,n,pZ,vn)}_render(e){return e.renderHull()}},W4=class extends lt{constructor(e,n={}){let{x:r,y:o,z:i}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:i,optional:!0}},Kt(n,function(s,a,c,f,u,p){let{x:l,y:d,z:h}=c;({x:l,y:d}=Bo(c,f,p)),h=h?.value;let m=new Array((l??d).length).fill(null),[x,g]=Qe(this,u),y=l?w=>l[w]:ue(x),b=d?w=>d[w]:ue(g);for(let w of a){l&&(w=w.filter(_=>oe(y(_)))),d&&(w=w.filter(_=>oe(b(_))));for(let[,_]of Po(w,h)){let v=Er.from(_,y,b),A=aD(v,u);for(let T=0,E=_.length;T<E;++T)m[_[T]]=A.renderCell(T)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),dZ)}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,cells:u}=r;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(p=>{p.selectAll().data(e).enter().append("path").call(ht,this).attr("d",l=>u[l]).call(Tt,this,r)}).node()}},V4=class extends kh{constructor(e,n){super(e,n,hZ),this.fill="none"}_render(e,n){return aD(e,n).render()}};function aD(t,e){let{width:n,height:r,marginTop:o,marginRight:i,marginBottom:s,marginLeft:a}=e;return t.voronoi([a,o,n-i,r-s])}function Lh(t,e,{x:n,y:r,...o}={}){return[n,r]=me(n,r),new t(e,{...o,x:n,y:r})}function cD(t,e){return Lh(U4,t,e)}function fD(t,e){return Lh(j4,t,e)}function uD(t,e){return Lh(X4,t,e)}function lD(t,{x:e,y:n,initializer:r,...o}={}){return Lh(W4,t,{...Ce({...o,x:e,y:n},vb),initializer:r})}function pD(t,e){return Lh(V4,t,e)}var mZ={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Rh=class extends lt{constructor(e,{x:n,y:r,z:o,weight:i,fill:s,stroke:a,...c}={}){let f=dD(s)&&(s="currentColor",!0),u=dD(a)&&(a="currentColor",!0);super(e,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:vn({z:o,fill:s,stroke:a}),optional:!0},weight:{value:i,optional:!0}},gZ({...c,fill:s,stroke:a},f,u),mZ),f&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=o}filter(e){return e}render(e,n,r,o,i){let{contours:s}=r,a=Ue();return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{}).call(c=>c.selectAll().data(e).enter().append("path").call(ht,this).call(Tt,this,r).attr("d",f=>a(s[f]))).node()}};function hD(t,{x:e,y:n,...r}={}){return[e,n]=me(e,n),new Rh(t,{...r,x:e,y:n})}var xZ=new Set(["x","y","z","weight"]);function gZ(t,e,n){let{bandwidth:o,thresholds:i}=t;return o=o===void 0?20:+o,i=i===void 0?20:typeof i?.[Symbol.iterator]=="function"?Ne(i):+i,Kt(t,function(s,a,c,f,u,p){let l=c.weight?Ne(c.weight.value):null,d=c.z?.value,{z:h}=this,[m,x]=Qe(this,u),{width:g,height:y}=u,{x:b,y:w}=Bo(c,f,p),_=Object.fromEntries(Object.entries(c).filter(([O])=>!xZ.has(O)).map(([O,S])=>[O,{...S,value:[]}])),v=e&&[],A=n&&[],T=H_().x(b?O=>b[O]:m).y(w?O=>w[O]:x).weight(l?O=>l[O]:1).size([g,y]).bandwidth(o),E=[];for(let O of a){let S=[];E.push(S);for(let I of d?nh(O,d,h):[O]){let C=T.contours(I);S.push([I,C])}}let N=i;if(!(N instanceof Ud)){let O=0;for(let S of E)for(let[,I]of S){let C=I.max;C>O&&(O=C)}N=Float64Array.from({length:i-1},(S,I)=>O*100*(I+1)/i)}let M=[],k=[];for(let O of E){let S=[];M.push(S);for(let[I,C]of O)for(let L of N){S.push(k.length),k.push(C(L/100)),v&&v.push(L),A&&A.push(L);for(let D in _)_[D].value.push(c[D].value[I[0]])}}return v&&v.push(0),A&&A.push(0),{data:s,facets:M,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...A&&{stroke:{value:A,scale:"color"}},contours:{value:k}}}})}function dD(t){return/^density$/i.test(t)}function gD(t,e){return bD("x",t,e)}function yD(t,e){return bD("y",t,e)}function bD(t,e,{x1:n,x2:r,y1:o,y2:i,x:s=n===void 0&&r===void 0?t==="y"?Zt:W:void 0,y:a=o===void 0&&i===void 0?t==="x"?Zt:W:void 0,fill:c,positiveFill:f="#3ca951",negativeFill:u="#4269d0",fillOpacity:p=1,positiveFillOpacity:l=p,negativeFillOpacity:d=p,stroke:h,strokeOpacity:m,z:x=ce(h)[0],clip:g,tip:y,render:b,...w}={}){return[n,r]=mD(s,n,r),[o,i]=mD(a,o,i),n===r&&o===i&&(t==="y"?o=Gi(0):n=Gi(0)),{tip:y}=Jr({tip:y},t==="y"?"x":"y"),ke(zt(f)?null:Object.assign(xh(e,{x1:n,x2:r,y1:o,y2:i,z:x,fill:f,fillOpacity:l,render:Yi(b,xD(t,!0)),clip:g,...w}),{ariaLabel:"positive difference"}),zt(u)?null:Object.assign(xh(e,{x1:n,x2:r,y1:o,y2:i,z:x,fill:u,fillOpacity:d,render:Yi(b,xD(t,!1)),clip:g,...w}),{ariaLabel:"negative difference"}),Mc(e,{x:r,y:i,z:x,stroke:h,strokeOpacity:m,tip:y,clip:!0,...w}))}function mD(t,e,n){return e===void 0&&n===void 0?e=n=Gi(t):e===void 0?(n=Gi(n),e=t===void 0?n:Gi(t)):n===void 0?(e=Gi(e),n=t===void 0?e:Gi(t)):(e=Gi(e),n=Gi(n)),[e,n]}function Gi(t){let e,{value:n,label:r=un(n)}=$r(t);return{transform:o=>e||(e=ut(o,n)),label:r}}function xD(t,e){let n=t==="x"?"y":"x",r=`${n}1`,o=`${n}2`,i=`${t}1`,s=`${t}2`;return(a,c,f,u,p,l)=>{let{[r]:d,[o]:h}=f,m=new Float32Array(d.length),x=new Float32Array(h.length),g=u[t==="y"?"height":"width"];(e===W1(c[t])<0?m:x).fill(g);let y=l(a,c,{...f,[o]:d,[s]:x},u,p),b=l(a,c,{...f,[r]:h,[i]:m},u,p),w=y.querySelector("g")??y,_=b.querySelector("g")??b;for(let v=0;w.firstChild;v+=2){let A=c4(),T=ot("svg:clipPath",p).attr("id",A).node();T.appendChild(w.firstChild),_.childNodes[v].setAttribute("clip-path",`url(#${A})`),_.insertBefore(T,_.childNodes[v])}return b}}function Yb({geometry:t=W,...e}={}){let n=Fs(r=>ut(r,t));return Kt({...e,x:null,y:null,geometry:{transform:n}},(r,o,i,s,a,{projection:c})=>{let f=n(r),u=f.length,p=new Float64Array(u),l=new Float64Array(u),d=Ue(c);for(let h=0;h<u;++h)[p[h],l[h]]=d.centroid(f[h]);return{data:r,facets:o,channels:{x:{value:p,scale:c==null?"x":null,source:null},y:{value:l,scale:c==null?"y":null,source:null}}}})}function wD({geometry:t=W,...e}={}){let n=Fs(o=>ut(o,t)),r=Fs(o=>ut(n(o),l6));return{...e,x:{transform:o=>Float64Array.from(r(o),([i])=>i)},y:{transform:o=>Float64Array.from(r(o),([,i])=>i)},geometry:{transform:n}}}var yZ={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Oh=class extends lt{constructor(e,n={}){let[r,o]=Ut(n.r,3);super(e,{x:{value:n.tip?n.x:null,scale:"x",optional:!0},y:{value:n.tip?n.y:null,scale:"y",optional:!0},r:{value:r,scale:"r",filter:Pn,optional:!0},geometry:{value:n.geometry,scale:"projection"}},wh(n),yZ),this.r=o}render(e,n,r,o,i){let{geometry:s,r:a}=r,c=Ue(i.projection??bZ(n)),{r:f}=this;return Ss(f)?e=[]:f!==void 0&&c.pointRadius(f),ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(u=>{u.selectAll().data(e).enter().append("path").call(ht,this).attr("d",a?p=>c.pointRadius(a[p])(s[p]):p=>c(s[p])).call(Tt,this,r)}).node()}};function bZ({x:t,y:e}){if(t||e)return t??=n=>n,e??=n=>n,ja({point(n,r){this.stream.point(t(n),e(r))}})}function Ub(t,e={}){return e.tip&&e.x===void 0&&e.y===void 0?e=Yb(e):e.geometry===void 0&&(e={...e,geometry:W}),new Oh(t,e)}function vD({strokeWidth:t=1.5,...e}={}){return Ub({type:"Sphere"},{strokeWidth:t,...e})}function _D({strokeOpacity:t=.1,...e}={}){return Ub(g6(),{strokeOpacity:t,...e})}var Du=.5,Pu=0;function SD(t={fill:"count"},{binWidth:e,...n}={}){let{z:r}=n;return e=e===void 0?20:Dt(e),t=$S(t,n),Fo(t,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Fo(t,"r")&&(n.r=e/2),Kt(n,(o,i,s,a,c,f)=>{let{x:u,y:p,z:l,fill:d,stroke:h,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(p===void 0)throw new Error("missing channel: y");({x:u,y:p}=Bo(s,a,f)),l=l?l.value:ut(o,r),d=d?.value,h=h?.value,m=m?.value;let x=Qd(t,{z:l,fill:d,stroke:h,symbol:m}),g=l&&[],y=d&&[],b=h&&[],w=m&&[],_=[],v=[],A=[],T=-1;for(let k of t)k.initialize(o);for(let k of i){let O=[];for(let S of t)S.scope("facet",k);for(let[S,I]of Po(k,x))for(let{index:C,extent:L}of wZ(o,I,u,p,e)){O.push(++T),v.push(L.x),A.push(L.y),l&&g.push(x===l?S:l[C[0]]),d&&y.push(x===d?S:d[C[0]]),h&&b.push(x===h?S:h[C[0]]),m&&w.push(x===m?S:m[C[0]]);for(let D of t)D.reduce(C,L)}_.push(O)}let E=s.x.scale,N=s.y.scale,M={x:{value:v,source:a[E]?{value:Et(v,a[E].invert),scale:E}:null},y:{value:A,source:a[N]?{value:Et(A,a[N].invert),scale:N}:null},...l&&{z:{value:g}},...d&&{fill:{value:y,scale:"auto"}},...h&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(t.map(({name:k,output:O})=>[k,{scale:"auto",label:O.label,radius:k==="r"?e/2:void 0,value:O.transform()}]))};return{data:o,facets:_,channels:M}})}function wZ(t,e,n,r,o){let i=o*(1.5/AS),s=new Map;for(let a of e){let c=n[a],f=r[a];if(isNaN(c)||isNaN(f))continue;let u=Math.round(f=(f-Pu)/i),p=Math.round(c=(c-Du)/o-(u&1)/2),l=f-u;if(Math.abs(l)*3>1){let m=c-p,x=p+(c<p?-1:1)/2,g=u+(f<u?-1:1),y=c-x,b=f-g;m*m+l*l>y*y+b*b&&(p=x+(u&1?1:-1)/2,u=g)}let d=`${p},${u}`,h=s.get(d);h===void 0&&(h={index:[],extent:{data:t,x:(p+(u&1)/2)*o+Du,y:u*i+Pu}},s.set(d,h)),h.index.push(a)}return s.values()}var vZ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function MD(t){return new $h(t)}var $h=class extends lt{constructor({binWidth:e=20,clip:n=!0,...r}={}){super(Es,void 0,{clip:n,...r},vZ),this.binWidth=Dt(e)}render(e,n,r,o,i){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:f,marginLeft:u,width:p,height:l}=o,d=u-Du,h=p-c-Du,m=a-Pu,x=l-f-Pu,g=s/2,y=g*TS,b=y/2,w=g*2,_=y*1.5,v=Math.floor(d/w),A=Math.ceil(h/w),T=Math.floor((m+b)/_),E=Math.ceil((x-b)/_)+1,N=`m0,${Ks(-y)}l${Ks(g)},${Ks(b)}v${Ks(y)}l${Ks(-g)},${Ks(b)}`,M=N;for(let k=T;k<E;++k)for(let O=v;O<A;++O)M+=`M${Ks(O*w+(k&1)*g)},${Ks(k*_)}${N}`;return ot("svg:g",i).datum(0).call(wt,this,o,i).call(xt,this,{},le+Du,le+Pu).call(k=>k.append("path").call(ht,this).call(Tt,this,r).attr("d",M)).node()}};function Ks(t){return Math.round(t*1e3)/1e3}var _Z={ariaLabel:"image",fill:null,stroke:null};function SZ(t){return/^\.*\//.test(t)}function MZ(t){return/^(blob|data|file|http|https):/i.test(t)}function AZ(t){return typeof t=="string"&&(SZ(t)||MZ(t))?[void 0,t]:[t,void 0]}var Dh=class extends lt{constructor(e,n={}){let{x:r,y:o,r:i,width:s,height:a,rotate:c,src:f,preserveAspectRatio:u,crossOrigin:p,frameAnchor:l,imageRendering:d}=n;i==null&&(i=void 0),i===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[h,m]=AZ(f),[x,g]=Ut(i),[y,b]=Ut(s,g!==void 0?g*2:void 0),[w,_]=Ut(a,g!==void 0?g*2:void 0),[v,A]=Ut(c,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:x,scale:"r",filter:Pn,optional:!0},width:{value:y,filter:Pn,optional:!0},height:{value:w,filter:Pn,optional:!0},rotate:{value:v,optional:!0},src:{value:h,optional:!0}},wh(n),_Z),this.src=m,this.width=b,this.rotate=A,this.height=_,this.r=g,this.preserveAspectRatio=te(u,"xMidYMid"),this.crossOrigin=be(p),this.frameAnchor=Do(l),this.imageRendering=te(d,"auto")}render(e,n,r,o,i){let{x:s,y:a}=n,{x:c,y:f,width:u,height:p,r:l,rotate:d,src:h}=r,{r:m,width:x,height:g,rotate:y}=this,[b,w]=Qe(this,o);return ot("svg:g",i).call(wt,this,o,i).call(xt,this,{x:c&&s,y:f&&a}).call(_=>_.selectAll().data(e).enter().append("image").call(ht,this).attr("x",AD(c,u,l,b,x,m)).attr("y",AD(f,p,l,w,g,m)).attr("width",u?v=>u[v]:x!==void 0?x:l?v=>l[v]*2:m*2).attr("height",p?v=>p[v]:g!==void 0?g:l?v=>l[v]*2:m*2).attr("transform",d?v=>`rotate(${d[v]})`:y?`rotate(${y})`:null).attr("transform-origin",d||y?to`${c?v=>c[v]:b}px ${f?v=>f[v]:w}px`:null).call(at,"href",h?v=>h[v]:this.src).call(at,"preserveAspectRatio",this.preserveAspectRatio).call(at,"crossorigin",this.crossOrigin).call(at,"image-rendering",this.imageRendering).call(at,"clip-path",l?v=>`circle(${l[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Tt,this,r)).node()}};function AD(t,e,n,r,o,i){return e&&t?s=>t[s]-e[s]/2:e?s=>r-e[s]/2:t&&o!==void 0?s=>t[s]-o/2:o!==void 0?r-o/2:n&&t?s=>t[s]-n[s]:n?s=>r-n[s]:t?s=>t[s]-i:r-i}function TD(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=me(e,n)),new Dh(t,{...r,x:e,y:n})}function TZ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,u,p,l,d,h,m,x,g;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,u=Math.sqrt(-2*Math.log(f)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),x=d*Math.sqrt(h+m)/m-(1/(2*n-1)-1/(2*e-1))*(h+5/6-2/(3*m)),d=e/(e+n*Math.exp(2*x))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),u=Math.exp(e*a)/e,p=Math.exp(n*c)/n,x=u+p,t<u/x?d=Math.pow(e*x*t,1/e):d=1-Math.pow(n*x*(1-t),1/n)),g=-Fu(e)-Fu(n)+Fu(e+n);s<10;s++){if(d===0||d===1)return d;if(l=EZ(d,e,n)-t,u=Math.exp(o*Math.log(d)+i*Math.log(1-d)+g),p=l/u,d-=u=p/(1-.5*Math.min(1,p*(o/d-i/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function EZ(t,e,n){var r=t===0||t===1?0:Math.exp(Fu(e+n)-Fu(e)-Fu(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?!1:t<(e+1)/(e+n+2)?r*ED(t,e,n)/e:1-r*ED(1-t,n,e)/n}function ED(t,e,n){var r=1e-30,o=1,i=e+n,s=e+1,a=e-1,c=1,f=1-i*t/s,u,p,l,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(u=2*o,p=o*(n-o)*t/((a+u)*(e+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,p=-(e+o)*(i+o)*t/((e+u)*(s+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,l=f*c,d*=l,!(Math.abs(l-1)<3e-7));o++);return d}function Fu(t){var e=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,o,i,s;for(s=(i=o=t)+5.5,s-=(o+.5)*Math.log(s);e<6;e++)r+=n[e]/++i;return Math.log(2.506628274631*r/o)-s}function ID(t,e){var n=TZ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}var IZ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},jb=class extends lt{constructor(e,n={}){let{x:r,y:o,z:i,ci:s=.95,precision:a=4}=n;if(super(e,{x:{value:r,scale:"x"},y:{value:o,scale:"y"},z:{value:vn(n),optional:!0}},n,IZ),this.z=i,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(e,n,r,o,i){let{x:s,y:a,z:c}=r,{ci:f}=this;return ot("svg:g",i).call(wt,this,o,i).call(xt,this,n).call(u=>u.selectAll().data(c?nh(e,c,this.z):[e]).enter().call(p=>p.append("path").attr("fill","none").call(ht,this).call(uc,this,{...r,fill:null,fillOpacity:null}).attr("d",l=>this._renderLine(l,s,a)).call(f&&!Pi(this.fill)?l=>l.select(NZ).attr("stroke","none").call(ht,this).call(uc,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function NZ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(Nn.svg,"path"),this)}var G4=class extends jb{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Ft(e,u=>r[u]),c=Xb(e,r,n),f=kD(e,r,n,(1-o)/2,c);return Wf().y(u=>u).x0(u=>f(u,-1)).x1(u=>f(u,1))(ye(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Ft(e,a=>r[a]),s=Xb(e,r,n);return`M${s(o)},${o}L${s(i)},${i}`}},H4=class extends jb{constructor(e,n){super(e,n)}_renderBand(e,n,r){let{ci:o,precision:i}=this,[s,a]=Ft(e,u=>n[u]),c=Xb(e,n,r),f=kD(e,n,r,(1-o)/2,c);return Wf().x(u=>u).y0(u=>f(u,-1)).y1(u=>f(u,1))(ye(s,a-i/2,i).concat(a))}_renderLine(e,n,r){let[o,i]=Ft(e,a=>n[a]),s=Xb(e,n,r);return`M${o},${s(o)}L${i},${s(i)}`}};function ND(t,{y:e=Zt,x:n=W,stroke:r,fill:o=zt(r)?"currentColor":r,...i}={}){return new G4(t,Nu({...i,x:n,y:e,fill:o,stroke:r}))}function CD(t,{x:e=Zt,y:n=W,stroke:r,fill:o=zt(r)?"currentColor":r,...i}={}){return new H4(t,Iu({...i,x:e,y:n,fill:o,stroke:r}))}function Xb(t,e,n){let r=0,o=0,i=0,s=0;for(let u of t){let p=e[u],l=n[u];r+=p,o+=l,i+=p*l,s+=p*p}let a=t.length,c=(a*i-r*o)/(a*s-r*r),f=(o-c*r)/a;return u=>c*u+f}function kD(t,e,n,r,o){let i=sn(t,u=>e[u])/t.length,s=0,a=0;for(let u of t)s+=(e[u]-i)**2,a+=(n[u]-o(e[u]))**2;let c=Math.sqrt(a/(t.length-2)),f=ID(r,t.length-2);return(u,p)=>{let l=o(u),d=c*Math.sqrt(1/t.length+(u-i)**2/s);return l+p*f*d}}function Ph({path:t=W,delimiter:e,frameAnchor:n,treeLayout:r=Xa,treeSort:o,treeSeparation:i,treeAnchor:s,treeFilter:a,...c}={}){s=Hb(s),o=OD(o),a!=null&&(a=Z4(a)),n===void 0&&(n=s.frameAnchor);let f=$D(e),u=YD(c,Z4),[p,l]=Ge(),[d,h]=Ge();return{x:p,y:d,frameAnchor:n,...Ce(c,(m,x)=>{let g=f(ut(m,t)),y=l([]),b=h([]),w=-1,_=[],v=[],A=Yg().path(N=>g[N]),T=Gn(m)?N=>N.data=m[N.data]:N=>N.data=m.get(N.data),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&i!==void 0&&E.separation(i??jd);for(let N of u)N[Vb]=N[BD]([]);for(let N of x){let M=[],k=A(N.filter(O=>g[O]!=null)).each(T);o!=null&&k.sort(o),E(k);for(let O of k.descendants())if(!(a!=null&&!a(O))){M.push(++w),_[w]=O.data,s.position(O,w,y,b);for(let S of u)S[Vb][w]=S[zD](O)}v.push(M)}return{data:_,facets:v}}),...Object.fromEntries(u)}}function Gb({path:t=W,delimiter:e,curve:n="bump-x",stroke:r="#555",strokeWidth:o=1.5,strokeOpacity:i=.5,treeLayout:s=Xa,treeSort:a,treeSeparation:c,treeAnchor:f,treeFilter:u,...p}={}){f=Hb(f),a=OD(a),u!=null&&(u=RD(u)),p={curve:n,stroke:r,strokeWidth:o,strokeOpacity:i,...p};let l=$D(e),d=YD(p,RD),[h,m]=Ge(),[x,g]=Ge(),[y,b]=Ge(),[w,_]=Ge();return{x1:h,x2:x,y1:y,y2:w,...Ce(p,(v,A)=>{let T=l(ut(v,t)),E=m([]),N=g([]),M=b([]),k=_([]),O=-1,S=[],I=[],C=Yg().path(D=>T[D]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??jd);for(let D of d)D[Vb]=D[BD]([]);for(let D of A){let $=[],P=C(D.filter(F=>T[F]!=null)).each(F=>F.data=v[F.data]);a!=null&&P.sort(a),L(P);for(let{source:F,target:q}of P.links())if(!(u!=null&&!u(q,F))){$.push(++O),S[O]=q.data,f.position(F,O,E,M),f.position(q,O,N,k);for(let V of d)V[Vb][O]=V[zD](q,F)}I.push($)}return{data:S,facets:I}}),...Object.fromEntries(d)}}function Hb(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return CZ;case"right":return kZ}throw new Error(`invalid tree anchor: ${t}`)}var CZ={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,o){r[n]=e,o[n]=-t}},kZ={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,o){r[n]=-e,o[n]=-t}};function OD(t){return t==null||typeof t=="function"?t:`${t}`.trim().toLowerCase().startsWith("node:")?LD(Z4(t)):LD(LZ(t))}function LD(t){return(e,n)=>We(t(e),t(n))}function LZ(t){return e=>e.data?.[t]}function $D(t="/"){if(t=`${t}`,t==="/")return n=>n;if(t.length!==1)throw new Error("delimiter must be exactly one character");let e=t.charCodeAt(0);return n=>n.map(r=>RZ(r,e))}var Q4=92,DD=47;function RZ(t,e){if(e===Q4)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,o=t.length;r<o;++r){switch(t.charCodeAt(r)){case Q4:if(!n){n=!0;continue}break;case e:n?(t=t.slice(0,r-1)+t.slice(r),--r,--o):t=t.slice(0,r)+"/"+t.slice(r+1);break;case DD:n?(t=t.slice(0,r)+"\\\\"+t.slice(r),r+=2,o+=2):(t=t.slice(0,r)+"\\"+t.slice(r),++r,++o);break}n=!1}return t}function OZ(t){let e=!1;for(let n=0,r=t.length;n<r;++n){switch(t.charCodeAt(n)){case Q4:if(!e){e=!0;continue}case DD:e&&(t=t.slice(0,n-1)+t.slice(n),--n,--r);break}e=!1}return t}function PD(t){return Ve(t)&&typeof t.node=="function"}function $Z(t){return Ve(t)&&typeof t.link=="function"}function Z4(t){if(PD(t))return t.node;if(t=`${t}`.trim().toLowerCase(),!!t.startsWith("node:")){switch(t){case"node:name":return K4;case"node:path":return J4;case"node:internal":return FD;case"node:external":return qD;case"node:depth":return tM;case"node:height":return eM}throw new Error(`invalid node value: ${t}`)}}function RD(t){if(PD(t))return t.node;if($Z(t))return t.link;if(t=`${t}`.trim().toLowerCase(),!(!t.startsWith("node:")&&!t.startsWith("parent:"))){switch(t){case"parent:name":return Wb(K4);case"parent:path":return Wb(J4);case"parent:depth":return Wb(tM);case"parent:height":return Wb(eM);case"node:name":return K4;case"node:path":return J4;case"node:internal":return FD;case"node:external":return qD;case"node:depth":return tM;case"node:height":return eM}throw new Error(`invalid link value: ${t}`)}}function J4(t){return t.id}function K4(t){return DZ(t.id)}function tM(t){return t.depth}function eM(t){return t.height}function FD(t){return!!t.children}function qD(t){return!t.children}function Wb(t){return(e,n)=>n==null?void 0:t(n)}function DZ(t){let e=t.length;for(;--e>0&&!PZ(t,e););return OZ(t.slice(e+1))}function PZ(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}var BD=2,zD=3,Vb=4;function YD(t,e){let n=[];for(let r in t){let o=t[r],i=e(o);i!==void 0&&n.push([r,...Ge(o),i])}return n}function nM(t,{fill:e,stroke:n,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,marker:u,markerStart:p=u,markerEnd:l=u,dot:d=zt(p)&&zt(l),text:h="node:name",textStroke:m="var(--plot-background)",title:x="node:path",dx:g,dy:y,textAnchor:b,treeLayout:w=Xa,textLayout:_=w===Xa||w===Bg?"mirrored":"normal",tip:v,...A}={}){if(g===void 0&&(g=Hb(A.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=Oe(_,"textLayout",["mirrored","normal"]);function T(E){return Yo(t,Ph({treeLayout:w,text:h,fill:e===void 0?"currentColor":e,stroke:m,dx:g,dy:y,title:x,...E,...A}))}return ke(Lb(t,Gb({treeLayout:w,markerStart:p,markerEnd:l,stroke:n!==void 0?n:e===void 0?"node:internal":e,strokeWidth:r,strokeOpacity:o,strokeLinejoin:i,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:f,...A})),d?Pr(t,Ph({treeLayout:w,fill:e===void 0?"node:internal":e,title:x,tip:v,...A})):null,h!=null?_==="mirrored"?[T({textAnchor:"start",treeFilter:"node:external"}),T({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:T():null)}function UD(t,e){return nM(t,{...e,treeLayout:Bg})}var XD={ariaLabel:"waffle"},Fh=class extends bc{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:Yi(i,WD("x"))},XD),this.unit=Math.max(0,n),this.gap=+r,this.round=VD(o),this.multiple=GD(s)}},qh=class extends wc{constructor(e,{unit:n=1,gap:r=1,round:o,render:i,multiple:s,...a}={}){super(e,{...a,render:Yi(i,WD("y"))},XD),this.unit=Math.max(0,n),this.gap=+r,this.round=VD(o),this.multiple=GD(s)}};function WD(t){return function(e,n,r,o,i){let{unit:s,gap:a,rx:c,ry:f,round:u}=this,{document:p}=i,l=r.channels[`${t}1`].value,d=r.channels[`${t}2`].value,h=this[t==="y"?"_width":"_height"](n,r,o),m=this[t==="y"?"_x":"_y"](n,r,o),x=s*FZ(n.scales[t]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(h/x)))}=this,y=Math.min(h/g,x*g),b=x*g,w=t==="y"?([M,k])=>[M*y,-k*b]:([M,k])=>[k*b,M*y],_=(h-g*y)/2,v=typeof m=="function"?M=>m(M)+_:m+_,A=n[t](0),T=KR(),E=p.createElementNS(Nn.svg,"pattern");E.setAttribute("width",t==="y"?y:b),E.setAttribute("height",t==="y"?b:y),E.setAttribute("patternUnits","userSpaceOnUse");let N=E.appendChild(p.createElementNS(Nn.svg,"rect"));return N.setAttribute("x",a/2),N.setAttribute("y",a/2),N.setAttribute("width",(t==="y"?y:b)-a),N.setAttribute("height",(t==="y"?b:y)-a),c!=null&&N.setAttribute("rx",c),f!=null&&N.setAttribute("ry",f),ot("svg:g",i).call(wt,this,o,i).call(this._transform,this,n).call(M=>M.selectAll().data(e).enter().append(()=>E.cloneNode(!0)).attr("id",k=>`${T}-${k}`).select("rect").call(ht,this).call(Tt,this,r)).call(M=>M.selectAll().data(e).enter().append("path").attr("transform",t==="y"?to`translate(${v},${A})`:to`translate(${A},${v})`).attr("d",k=>`M${rM(u(l[k]/s),u(d[k]/s),g).map(w).join("L")}Z`).attr("fill",k=>`url(#${T}-${k})`).attr("stroke",this.stroke==null?null:k=>`url(#${T}-${k})`)).node()}}function rM(t,e,n){if(t<0||e<0){let r=Math.ceil(-Math.min(t,e)/n);return rM(t+r*n,e+r*n,n).map(([o,i])=>[o,i-r])}return e<t?rM(e,t,n):[[0,Math.ceil(t/n)],[Math.floor(t%n),Math.ceil(t/n)],[Math.floor(t%n),Math.floor(t/n)+t%1],[Math.ceil(t%n),Math.floor(t/n)+t%1],...t%n>n-1?[]:[[Math.ceil(t%n),Math.floor(t/n)],[n,Math.floor(t/n)]],[n,Math.floor(e/n)],[Math.ceil(e%n),Math.floor(e/n)],[Math.ceil(e%n),Math.floor(e/n)+e%1],[Math.floor(e%n),Math.floor(e/n)+e%1],...e%n<1?[]:[[Math.floor(e%n),Math.ceil(e/n)],[0,Math.ceil(e/n)]]]}function VD(t){if(t===void 0||t===!1)return Number;if(t===!0)return Math.round;if(typeof t!="function")throw new Error(`invalid round: ${t}`);return t}function GD(t){return t===void 0?void 0:Math.max(1,Math.floor(t))}function FZ({domain:t,range:e}){return jD(e)/jD(t)}function jD(t){let[e,n]=Ft(t);return n-e}function HD(t,e={}){return Oi(e)||(e={...e,y:Zt,x2:W}),new Fh(t,Xs(yu(Us(e))))}function QD(t,e={}){return Oi(e)||(e={...e,x:Zt,y2:W}),new qh(t,Ws(bu(js(e))))}var aP=Aq(sP(),1);var WZ=({marginLeft:t})=>[1,t],VZ=({width:t,marginRight:e})=>[-1,t-e],GZ=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],HZ=({marginTop:t})=>[1,t],QZ=({height:t,marginBottom:e})=>[-1,t-e],ZZ=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function cP(t){return typeof t=="string"?{anchor:t}:t}function fP(t={},e={}){arguments.length===1&&([t,e]=lP(t));let{anchor:n="left",padding:r=1,r:o=e.r}=cP(t);switch(`${n}`.toLowerCase()){case"left":n=WZ;break;case"right":n=VZ;break;case"middle":n=GZ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return pP("x","y",n,Dt(r),o,e)}function uP(t={},e={}){arguments.length===1&&([t,e]=lP(t));let{anchor:n="bottom",padding:r=1,r:o=e.r}=cP(t);switch(`${n}`.toLowerCase()){case"top":n=HZ;break;case"bottom":n=QZ;break;case"middle":n=ZZ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return pP("y","x",n,Dt(r),o,e)}function lP(t){let{anchor:e,padding:n,...r}=t,{r:o}=r;return[{anchor:e,padding:n,r:o},r]}function pP(t,e,n,r,o,i){if(o!=null&&typeof o!="number"){let{channels:s,sort:a,reverse:c}=i;s=Wd(s),s?.r===void 0&&(i={...i,channels:{...s,r:{value:o,scale:"r"}}}),a===void 0&&c===void 0&&(i.sort={channel:"-r"})}return Kt(i,function(s,a,c,f,u,p){let{[e]:l,r:d}=c;if(!c[e])throw new Error(`missing channel: ${e}`);({[e]:l}=Bo(c,f,p));let h=d?void 0:o!==void 0?Dt(o):this.r!==void 0?this.r:3;d&&(d=ut(d.value,f[d.scale]||W,Float64Array));let[m,x]=n(u),g=m?KZ:JZ,y=new Float64Array(l.length),b=d?w=>d[w]:()=>h;for(let w of a){let _=(0,aP.default)();w=w.filter(d?A=>Zf(l[A])&&Pn(d[A]):A=>Zf(l[A]));let v=new Float64Array(2*w.length+2);for(let A of w){let T=b(A),E=m?T+r:0,N=l[A]-T,M=l[A]+T,k=2;_.queryInterval(N-r,M+r,([,,S])=>{let I=y[S]-E,C=l[A]-l[S],L=r+(d?d[A]+d[S]:2*h),D=Math.sqrt(L*L-C*C);v[k++]=I-D,v[k++]=I+D});let O=v.slice(0,k);m&&(O=O.filter(S=>S>=0));t:for(let S of O.sort(g)){for(let I=0;I<k;I+=2)if(v[I]+1e-6<S&&S<v[I+1]-1e-6)continue t;y[A]=S+E;break}_.insert([N,M,A])}}m||(m=1);for(let w of a)for(let _ of w)y[_]=y[_]*m+x;return{data:s,facets:a,channels:{[t]:{value:y,source:null},[e]:{value:l,source:c[e]},...d&&{r:{value:d,source:c.r}}}}})}function JZ(t,e){return Math.abs(t)-Math.abs(e)}function KZ(t,e){return t-e}function hP(t,e){return arguments.length===1&&({basis:t,...e}=t),Lu(Jb(t),e)}function mP(t,e){return arguments.length===1&&({basis:t,...e}=t),Ru(Jb(t),e)}function Jb(t){if(t===void 0)return dP;if(typeof t=="function")return Kb(ru(t));if(/^p\d{2}$/i.test(t))return Yu(nu(t));switch(`${t}`.toLowerCase()){case"deviation":return nJ;case"first":return dP;case"last":return eJ;case"max":return rJ;case"mean":return oJ;case"median":return iJ;case"min":return sJ;case"sum":return aJ;case"extent":return tJ}throw new Error(`invalid basis: ${t}`)}function Kb(t){return{mapIndex(e,n,r){let o=+t(e,n);for(let i of e)r[i]=n[i]===null?NaN:n[i]/o}}}function Yu(t){return Kb((e,n)=>t(e,r=>n[r]))}var tJ={mapIndex(t,e,n){let[r,o]=Ft(t,s=>e[s]),i=o-r;for(let s of t)n[s]=e[s]===null?NaN:(e[s]-r)/i}},dP=Kb((t,e)=>{for(let n=0;n<t.length;++n){let r=e[t[n]];if(oe(r))return r}}),eJ=Kb((t,e)=>{for(let n=t.length-1;n>=0;--n){let r=e[t[n]];if(oe(r))return r}}),nJ={mapIndex(t,e,n){let r=pi(t,i=>e[i]),o=Mr(t,i=>e[i]);for(let i of t)n[i]=e[i]===null?NaN:o?(e[i]-r)/o:0}},rJ=Yu(kt),oJ=Yu(pi),iJ=Yu(Vr),sJ=Yu(It),aJ=Yu(sn);function xP(t,e){return yP("x",t,e)}function gP(t,e){return yP("y",t,e)}function yP(t,e,n={}){let r,o=1;if(typeof e=="number")o=e,r=(f,u)=>+f+u;else{if(typeof e=="string"){let f=e.startsWith("-")?-1:1;[e,o]=N1(e.replace(/^[+-]/,"")),o*=f}e=iu(e),r=(f,u)=>e.offset(f,u)}let i=`${t}1`,s=`${t}2`,a=Hn({[i]:f=>f.map(u=>r(u,o)),[s]:f=>f},n),c=a[s].transform;return a[s].transform=()=>{let f=c(),[u,p]=Ft(f);return f.domain=o<0?[u,r(p,o)]:[r(u,o),p],f},a}function bP(t,e={}){if(typeof t=="string")switch(t.toLowerCase()){case"first":return Yh(e);case"last":return Uh(e)}if(typeof t=="function")return ta(null,t,e);let n,r;for(n in t){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=cJ(t[n])}if(r===void 0)throw new Error(`invalid selector: ${t}`);return ta(n,r,e)}function cJ(t){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"min":return fM;case"max":return uM}throw new Error(`unknown selector: ${t}`)}function Yh(t){return ta(null,fJ,t)}function Uh(t){return ta(null,uJ,t)}function t2(t){return ta("x",fM,t)}function e2(t){return ta("y",fM,t)}function n2(t){return ta("x",uM,t)}function r2(t){return ta("y",uM,t)}function*fJ(t){yield t[0]}function*uJ(t){yield t[t.length-1]}function*fM(t,e){yield Mx(t,n=>e[n])}function*uM(t,e){yield Ia(t,n=>e[n])}function ta(t,e,n){if(t!=null){if(n[t]==null)throw new Error(`missing channel: ${t}`);t=n[t]}let r=vn(n);return Ce(n,(o,i)=>{let s=ut(o,r),a=ut(o,t),c=[];for(let f of i){let u=[];for(let p of s?rn(f,l=>s[l]).values():[f])for(let l of e(p,a))u.push(l);c.push(u)}return{data:o,facets:c}})}lt.prototype.plot=function({marks:t=[],...e}={}){return Eu({...e,marks:[...t,this]})};var lJ=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function pJ(t,e,n){for(let r=0;r<e.length;++r){let o=e[r];r===e.length-1?t[o]=n:t=t[o]||(t[o]={})}}function wP(t,e,n){for(let r in t){let o=lJ.get(r);if(o==null)throw new Error(`Unrecognized plot attribute: ${r}`);let i=t[r];typeof i=="symbol"?n.push(r):i!==void 0&&pJ(e,o.split("."),i)}}var dJ=new Set(["frame","hexgrid","sphere","graticule"]),hJ=new Map([["first",Yh],["last",Uh],["maxX",n2],["maxY",r2],["minX",t2],["minY",e2],["nearest",Bs],["nearestX",zs],["nearestXY",Ui]]);async function vP(t){let e={marks:[]},n=[],{attributes:r,marks:o}=t;wP(r,e,n);let i=[];for(let a of o)for(let{type:c,data:f,options:u}of a.plotSpecs()){let{select:p,...l}=u,d=hJ.get(p)?.(l)??l,h=dJ.has(c)?[d]:[f,d];e.marks.push(lM[c](...h)),i.push(a.index)}xJ(e,t);let s=Eu(e);yJ(s,i),mJ(t,s,r,n);for(let a of t.interactors)await a.init(s);return s}function mJ(t,e,n,r){r.forEach(o=>{let i=n[o];if(i===lo){if(!o.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${o}`);let s=o.slice(0,-6),a=e.scale(s);a?.domain&&t.setAttribute(o,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${i}`)})}function xJ(t,e){let{marks:n}=e;o2("x",t,n),o2("y",t,n),o2("fx",t,n),o2("fy",t,n)}function o2(t,e,n){let r=e[t]||{};if(r.axis===null||r.label!==void 0)return;let o=n.map(s=>s.channelField(t)?.field);if(o.every(s=>s==null))return;let i;for(let s=0;s<o.length;++s){let a=_P(o[s]);a!==void 0&&(i===void 0?i=a:i!==a&&(i=void 0))}i!==void 0&&(e[t]={...r,label:i})}function _P(t){if(t){switch(t.type){case"COLUMN_REF":return t.column;case"CAST":return _P(t.expr);case"FUNCTION":if(t.name==="make_date")return"date";break}return gJ(t)}}function gJ(t){let e=`${t}`.replaceAll('"',"").replaceAll("(*)","()");return e.endsWith("()")?e.slice(0,-2):e}function yJ(t,e){let n=-1;for(let r of t.children){let o=r.getAttribute("aria-label")||"";r.nodeName==="style"||o.includes("-axis")||o.includes("-grid")||r.setAttribute("data-index",e[++n])}}var bJ={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},jh=class{constructor(e){this.attributes={...bJ},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=e||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=s_()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:e,right:n}=this.margins();return this.getAttribute("width")-e-n}innerHeight(e=400){let{top:n,bottom:r}=this.margins(),o=this.getAttribute("height");return o==null&&(o=wJ(this,n,r)||e,this.setAttribute("height",o,{silent:!0})),o-n-r}pending(e){this.synch.pending(e)}update(e){return this.synch.ready(e)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let e=await vP(this),n=this.legends.flatMap(({legend:r,include:o})=>{let i=r.init(e);return o?i:[]});this.element.replaceChildren(e,...n),this.synch.resolve()}getAttribute(e){return this.attributes[e]}setAttribute(e,n,r){return np(this.attributes[e],n)?(n===void 0?delete this.attributes[e]:this.attributes[e]=n,r?.silent||this.listeners?.get(e)?.forEach(o=>o(e,n)),!0):!1}addAttributeListener(e,n){let r=this.listeners||(this.listeners=new Map);return r.has(e)||r.set(e,new Set),r.get(e).add(n),this}removeAttributeListener(e,n){return this.listeners?.get(e)?.delete(n)}addParams(e,n){let{params:r}=this;for(let o of n)r.has(o)?r.get(o).push(e):(r.set(o,[e]),o.addEventListener("value",()=>Promise.allSettled(r.get(o).map(i=>i.initialize()))))}addMark(e){return e.setPlot(this,this.marks.length),this.marks.push(e),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(e){return this.interactors.push(e),this}addLegend(e,n=!0){e.setPlot(this),this.legends.push({legend:e,include:n})}};function wJ(t,e,n){let r=t.getAttribute("aspectRatio");if(r==null)return;let o=t.getAttribute("xDomain"),i=t.getAttribute("yDomain");if(!o||!i)return;let s=Math.abs(o[1]-o[0]);return Math.abs(i[1]-i[0])*t.innerWidth()/(r*s)+e+n}function i2(t){return typeof t!="string"?!1:(t=t.toLowerCase().trim(),t==="none"||t==="currentcolor"||t.startsWith("url(")&&t.endsWith(")")||t.startsWith("var(")&&t.endsWith(")")||nr(t)!==null)}var vJ=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function SP(t){return vJ.has(t)}var _J=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function MP(t){return _J.has(`${t}`.toLowerCase())}var AP=t=>t==="stroke"||t==="fill",SJ=t=>/opacity$/i.test(t),MJ=t=>t==="symbol",AJ=(t,e)=>t!=="sort"&&t!=="tip"&&e!=null&&!Array.isArray(e),pM=(t,e)=>({channel:t,field:e,as:ts(e)?e.column:t}),dM=(t,e)=>({channel:t,value:e}),s2=t=>Array.isArray(t),$e=class extends Bn{constructor(e,n,r,o={}){super(n?.options?.filterBy),this.type=e,this.reqs=o,this.source=n;let i=this.channels=[],s=this.detail=new Set,a=this.params=new Set;s2(n)?this.data=Wn(n):_e(n?.table)&&a.add(n.table);let c=(f,u)=>{let p=typeof u;if(f==="channels")for(let l in u)s.add(l),c(l,u[l]);else if(p==="function"&&u[rp]){let l=u(this,f);for(let d in l)c(d,l[d])}else if(p==="string")SP(f)||AP(f)&&i2(u)||MJ(f)&&MP(u)?i.push(dM(f,u)):i.push(pM(f,oi(u)));else if(Yr(u)){let l=dM(f,u.value);i.push(l),u.addEventListener("value",d=>(l.value=d,this.update()))}else pn(u)?(Fv(u).forEach(l=>a.add(l)),i.push(pM(f,u))):p==="object"&&AJ(f,u)?i.push(pM(f,u)):u!==void 0&&i.push(dM(f,u))};for(let f in r)c(f,r[f])}setPlot(e,n){this.plot=e,this.index=n,e.addParams(this,this.params),this.source?.table&&this.queryPending()}sourceTable(){let e=this.source?.table;return e?_e(e)?e.value:e:null}hasOwnData(){return this.source==null||s2(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(e){return this.channels.find(n=>n.channel===e)}channelField(e,{exact:n=!1}={}){let r=n?this.channel(e):this.channels.find(o=>o.channel.startsWith(e));return r?.field?r:null}fields(){if(this.hasOwnData())return null;let{channels:e,reqs:n}=this,r=new Map;for(let{channel:i,field:s}of e){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,f=r.get(c)??r.set(c,new Set).get(c);a.forEach(u=>f.add(u)),n[i]?.forEach(u=>f.add(u))}let o=this.sourceTable();return Array.from(r,([i,s])=>({table:o,column:i,stats:s}))}fieldInfo(e){let n=Object.fromEntries(e.map(r=>[r.column,r]));for(let r of this.channels){let{field:o}=r;o&&Object.assign(r,n[o.stats?.column??o])}return this._fieldInfo=!0,this}query(e=[]){return this.hasOwnData()?null:Xh(this.channels,this.sourceTable()).where(e)}queryPending(){return this.plot.pending(this),this}queryResult(e){return this.data=Wn(e),this}update(){return this.plot.update(this)}plotSpecs(){let{type:e,data:n,detail:r,channels:o}=this;return hM(e,r,o,n)}};function Sn(t,e){let n=e?.[t.as]??t.as;return Object.hasOwn(t,"value")?t.value:AP(t.channel)?{value:n,scale:"color"}:SJ(t.channel)?{value:n,scale:"opacity"}:n}function Xh(t,e,n=[]){let r=st.from({source:e}),o=new Set,i=!1;for(let s of t){let{channel:a,field:c,as:f}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(tr(c))i=!0;else{if(o.has(f))continue;o.add(f)}r.select({[f]:c})}}}return i&&r.groupby(Array.from(o)),r}function hM(t,e,n,r,o={}){let{numRows:i,values:s,columns:a}=r??{},c={};for(let p of n){let l=e.has(p.channel)?c:o;l[p.channel]=Sn(p,a)}return e.size&&(o.channels=c),[{type:t,data:s??(r?{length:i}:null),options:o}]}function Tc(t,e){let{plot:n}=t,r=n.getAttribute(`${e}Scale`);if(!r){let{type:i}=t.channelField(e);r=i==="date"?"time":"linear"}let o={type:r};switch(r){case"log":o.base=n.getAttribute(`${e}Base`)??10;break;case"pow":o.exponent=n.getAttribute(`${e}Exponent`)??1;break;case"symlog":o.constant=n.getAttribute(`${e}Constant`)??1;break}return Kl(o)}function hr(t,e,n,r,o=1,i){let{field:s}=t.channelField(e);i=i??s;let{type:a,apply:c,sqlApply:f}=Tc(t,e),u=!!t.plot.getAttribute(`${e}Reverse`),[p,l]=r.map(m=>c(m)),d=f(i),h=a==="time"||a==="utc"?d:i;return[Wv(d,p,l,n-o,u),h]}var mM={x:["min","max"]},xM={y:["min","max"]},a2={...mM,...xM};function TP(t,e,n,r,o){let{plot:i}=t,s=i.getAttribute(r),a=i.getAttribute(o);if(Array.isArray(s)&&!s[en])return s;{let{column:c,min:f,max:u}=t.channelField(n),p=gM(e,c)||(a?_i().domain([f,u]).nice().domain():[f,u]);return s!==lo&&(p[en]=!0),i.setAttribute(r,p,{silent:!0}),p}}function Vo(t,e){return TP(t,e,"x","xDomain","xNice")}function Go(t,e){return TP(t,e,"y","yDomain","yNice")}function gM(t,e){if(!t)return;let n,r;return[t].flat().forEach(o=>ao(o,i=>{if(i instanceof va&&`${i.expr}`===e){let s=(i.extent??[]).map(a=>a?.value??a);(n==null||s[0]<n)&&(n=s[0]),(r==null||s[1]>r)&&(r=s[1])}})),n!=null&&r!=null&&n!==r?[n,r]:void 0}var Wh=class extends $e{constructor(e,n,r){let o=e.endsWith("X")?"y":e.endsWith("Y")?"x":null,i=o?{[o]:["count","min","max"]}:void 0;super(e,n,r,i),this.dim=o}query(e=[]){let{plot:n,dim:r,source:o}=this,i=o.options?.optimize,s=super.query(e);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:f,as:u,type:p,count:l,min:d,max:h}=this.channelField(r),m=p==="date"||p==="number",x=r==="x"?n.innerWidth():n.innerHeight();if(i??=l/x>10,i&&m&&c){let[g,y]=gM(e,f)||[d,h],[b]=hr(this,r,x,[g,y],1,u),w=s._select.map(_=>_.alias).filter(_=>_!==u&&_!==c);return Zv(s,b,u,c,w)}else return s.orderby(f)}};function EP(t,e=[]){return new e.constructor(t)}function IP(t,e,n){let r=EP(t,n),o=n.length;for(let i=0;i<o;++i)r[e[i]]=n[i];return r}function NP(t,e,n,r,o,i,s){let a=n.length,c=t*e,f=o.map(d=>r[d]),u={},p=[],l=new Int32Array(a);if(i?.length){let d=i.map(m=>r[m]),h={};for(let m=0;m<a;++m){let x=d.map(g=>g[m]);l[m]=h[x]??=p.push(x)-1}for(let m=0;m<i.length;++m)u[i[m]]=p.map(x=>x[m])}else p.push([]);if(s){let d=n.map(x=>x%t),h=n.map(x=>Math.floor(x/t)),m=p.map(()=>[]);for(let x=0;x<a;++x)m[l[x]].push(x);o.forEach((x,g)=>{let y=f[g];u[x]=p.map((b,w)=>s(m[w],t,e,d,h,y))})}else o.forEach((d,h)=>{let m=f[h],x=u[d]=p.map(()=>EP(c,m));for(let g=0;g<a;++g)x[l[g]][n[g]]=m[g]});return{numRows:p.length,columns:u}}function Vh(t){let e=1/0,n=-1/0;return t.forEach(r=>{let o=r.length;for(let i=0;i<o;++i){let s=r[i];s<e&&(e=s),s>n&&(n=s)}}),Number.isFinite(e)&&Number.isFinite(n)?[e,n]:[0,1]}function CP(t){let e=new En;return t.forEach(n=>{let r=n.length;for(let o=0;o<r;++o)e.add(n[o])}),Array.from(e).sort(yt)}function we(t,e){return _e(t)?(t.addEventListener("value",e),t.value):t}function Gh(t,e=!1){let n=new Float64Array(5),r=new Float64Array(4);TJ(n,r,t);let o=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]),i=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/i,a=(o[1]+o[2]+o[3]+o[4])/i;return{sigma:t,negative:e,a:n,b_causal:r,b_anticausal:o,sum_causal:s,sum_anticausal:a}}function TJ(t,e,n){let o=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,f=Float64Array.of(-i*Math.cos(a),i*Math.sin(a),-i*Math.cos(-a),i*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,p=Float64Array.of(o[0],o[1],0,0,0,0,0,0),l=Float64Array.of(1,0,f[0],f[1],0,0,0,0,0,0),d,h;for(h=2;h<8;h+=2){for(p[h]=f[h]*p[h-2]-f[h+1]*p[h-1],p[h+1]=f[h]*p[h-1]+f[h+1]*p[h-2],d=h-2;d>0;d-=2)p[d]+=f[h]*p[d-2]-f[h+1]*p[d-1],p[d+1]+=f[h]*p[d-1]+f[h+1]*p[d-2];for(d=0;d<=h;d+=2)p[d]+=o[h]*l[d]-o[h+1]*l[d+1],p[d+1]+=o[h]*l[d+1]+o[h+1]*l[d];for(l[h+2]=f[h]*l[h]-f[h+1]*l[h+1],l[h+3]=f[h]*l[h+1]+f[h+1]*l[h],d=h;d>0;d-=2)l[d]+=f[h]*l[d-2]-f[h+1]*l[d-1],l[d+1]+=f[h]*l[d-1]+f[h+1]*l[d-2]}for(h=0;h<4;++h)d=h<<1,e[h]=p[d]/u,t[h+1]=l[d+2]}function kP(t,e,n,[r,o]){let i=new Float64Array(Math.max(r,o)),s=new Float64Array(Math.max(r,o)),a=new Float64Array(5),c=new Float64Array(n.length);for(let f=0,u=0;f<o;++f,u+=r){let p=c.subarray(u);c2(t,n.subarray(u),r,1,i,s,a,p)}for(let f=0;f<r;++f){let u=c.subarray(f);c2(e,u,o,r,i,s,a,u)}return c}function c2(t,e,n,r=1,o=new Float64Array(n),i=new Float64Array(n),s=new Float64Array(5),a=o,c=EJ){let f=r*2,u=r*3,p=r*4,l=r*n,d,h;for(c(o,e,n,r,t.b_causal,3,t.a,4,t.sum_causal,s,t.sigma),h=4,d=p;h<n;++h,d+=r)o[h]=t.b_causal[0]*e[d]+t.b_causal[1]*e[d-r]+t.b_causal[2]*e[d-f]+t.b_causal[3]*e[d-u]-t.a[1]*o[h-1]-t.a[2]*o[h-2]-t.a[3]*o[h-3]-t.a[4]*o[h-4];for(c(i,e,n,-r,t.b_anticausal,4,t.a,4,t.sum_anticausal,s,t.sigma),h=4,d=l-r*5;h<n;++h,d-=r)i[h]=t.b_anticausal[1]*e[d+r]+t.b_anticausal[2]*e[d+f]+t.b_anticausal[3]*e[d+u]+t.b_anticausal[4]*e[d+p]-t.a[1]*i[h-1]-t.a[2]*i[h-2]-t.a[3]*i[h-3]-t.a[4]*i[h-4];if(t.negative)for(h=0,d=0;h<n;++h,d+=r)a[d]=o[h]+i[n-h-1];else for(h=0,d=0;h<n;++h,d+=r)a[d]=Math.max(0,o[h]+i[n-h-1]);return a}function EJ(t,e,n,r,o,i,s,a,c,f,u,p=.5){let l=Math.abs(r)*n,d=r<0?l+r:0,h,m,x;for(m=0;m<=a;++m)for(f[m]=m<=i?o[m]:0,x=1;x<=a&&x<=m;++x)f[m]-=s[x]*f[m-x];for(x=0;x<a;++x)for(t[x]=0,m=1;m<=x;++m)h=d+r*m,h>=0&&h<l&&(t[x]+=f[x-m]*e[h]);let g=e[d],y=Math.ceil(u*10);for(m=0;m<y;++m){for(x=0;x<a;++x)t[x]+=f[x]*g;if(c-=Math.abs(f[0]),c<=p)break;for(f[a]=m+a<=i?o[m+a]:0,x=1;x<=a;++x)f[a]-=s[x]*f[a-x];for(x=0;x<a;++x)f[x]=f[x+1]}}var eo="density",no=class extends $e{constructor(e,n,r){let{bandwidth:o=0,interpolate:i="none",pixelSize:s=1,pad:a=1,width:c,height:f,...u}=r,p=IJ(u);super(e,n,u,a2),this.densityMap=p,this.bandwidth=we(o,l=>(this.bandwidth=l,this.grids?this.convolve().update():null)),this.interpolate=we(i,l=>(this.interpolate=l,this.requestUpdate())),this.pixelSize=we(s,l=>(this.pixelSize=l,this.requestUpdate())),this.pad=we(a,l=>(this.pad=l,this.requestUpdate())),this.width=we(c,l=>(this.width=l,this.requestUpdate())),this.height=we(f,l=>(this.height=l,this.requestUpdate()))}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};e.addAttributeListener("xDomain",r),e.addAttributeListener("yDomain",r),super.setPlot(e,n)}get filterStable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[en]&&!n[en]}query(e=[]){let{interpolate:n,pad:r,channels:o,densityMap:i}=this,[s,a]=this.extentX=Vo(this,e),[c,f]=this.extentY=Go(this,e),[u,p]=this.bins=this.binDimensions(),[l,d]=hr(this,"x",u,[s,a],r),[h,m]=hr(this,"y",p,[c,f],r),x=r?[tn(d,[+s,+a]),tn(m,[+c,+f])]:[Kn(+s,d),ae(d,+a),Kn(+c,m),ae(m,+f)],g=st.from(this.sourceTable()).where(e.concat(x)),y=this.groupby=[],b={};for(let _ of o)if(Object.hasOwn(_,"field")){let{as:v,channel:A,field:T}=_;tr(T)?(b[A]=T,i[A]=!0):A==="weight"?b[eo]=Yt(T):A!=="x"&&A!=="y"&&(g.select({[v]:T}),y.push(v))}let w=this.aggr=Object.keys(b);if(b.density&&w.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(w.length||(w.push(eo),b[eo]=qe()),n==="linear"){if(w.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[eo])throw new Error("Linear binning not applicable to custom aggregates.");let _=nf(b[eo])[0];return Hv(g,l,h,_,u,y)}else return Vv(g,l,h,b,u,y)}binDimensions(){let{plot:e,pixelSize:n,width:r,height:o}=this;return[r??Math.round(e.innerWidth()/n),o??Math.round(e.innerHeight()/n)]}queryResult(e){let[n,r]=this.bins,o=NJ(this.interpolate),{columns:i}=Wn(e);return this.grids0=NP(n,r,i.index,i,this.aggr,this.groupby,o),this.convolve()}convolve(){let{aggr:e,bandwidth:n,bins:r,grids0:o,plot:i}=this;if(this.grids=o,n>0){let s=e.length===1?e[0]:e.includes(eo)?eo:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.columns[s],c=i.innerWidth(),f=i.innerHeight(),[u,p]=r,l=a.some(m=>m.some(x=>x<0)),d=Gh(n*(u-1)/c,l),h=Gh(n*(p-1)/f,l);this.grids={numRows:o.numRows,columns:{...o.columns,[s]:a.map(m=>kP(d,h,m,r))}}}return this}};function IJ(t){let e={};for(let n in t)t[n]==="density"&&(delete t[n],e[n]=!0);return e}function NJ(t="none"){if(typeof t=="function")return t;switch(t.toLowerCase()){case"none":case"linear":return;case"nearest":return Ih;case"barycentric":return Eh();case"random-walk":return Nh()}throw new Error(`invalid interpolate: ${t}`)}var Hh=class extends no{constructor(e,n){let{thresholds:r=10,...o}=n;super("geo",e,{bandwidth:20,interpolate:"linear",pixelSize:2,...o}),this.thresholds=we(r,i=>(this.thresholds=i,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:e,densityMap:n,grids:r,thresholds:o,plot:i}=this,{numRows:s,columns:a}=r,c=o,f;if(Array.isArray(c))f=c;else{let[,M]=Vh(a.density);f=Array.from({length:c-1},(k,O)=>M*(O+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,p]=e,[l,d]=i.getAttribute("xDomain"),[h,m]=i.getAttribute("yDomain"),x=(d-l)/u,g=(m-h)/p,y=+l,b=+h,w=M=>y+M*x,_=M=>b+M*g,v=ms().size(e),A=this.contourData=Array(s*f.length),{density:T,...E}=a,N=Object.entries(E);for(let M=0,k=0;M<s;++M){let O=T[M],S=N.reduce((I,[C,L])=>(I[C]=L[M],I),{});for(let I=0;I<f.length;++I,++k)A[k]=Object.assign(CJ(v.contour(O,f[I]),w,_),S)}return this}plotSpecs(){let{type:e,channels:n,densityMap:r,contourData:o}=this,i={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(i[a]=Sn(s))}for(let s in r)r[s]&&(i[s]=Sn({channel:s,as:"value"}));return[{type:e,data:o,options:i}]}};function CJ(t,e,n){function r(s){s.forEach(o)}function o(s){s.forEach(i)}function i(s){s[0]=e(s[0]),s[1]=n(s[1])}return t.coordinates.forEach(r),t}function Qh(t){return Array.from({length:t},(e,n)=>n)}function f2(t,e){let n=e.reduce((o,i,s)=>(o[i]=s,o),{}),r=Qh(t.length);return r.sort((o,i)=>n[t[o]]-n[t[i]]),r}function u2(t,e){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",t),n.setAttribute("height",e),n}throw new Error("Can not create a canvas instance.")}function LP(t=1){let e=255*t|0;return(n,r,o)=>{for(let i=0,s=0;i<o;++i)for(let a=0;a<r;++a,s+=4)n[s+3]=e}}function RP(t){let{apply:e}=t;return(n,r,o,i)=>{for(let s=0,a=0;s<o;++s)for(let c=0,f=(o-s-1)*r;c<r;++c,a+=4)n[a+3]=255*e(i[c+f])|0}}function OP(t={}){let{r:e=0,g:n=0,b:r=0,opacity:o=1}=typeof t=="string"?Le(t):t,i=new Uint8ClampedArray([e,n,r,255*o|0]);return(s,a,c)=>{for(let f=0,u=0;f<c;++f)for(let p=0;p<a;++p,u+=4)s[u+0]=i[0],s[u+1]=i[1],s[u+2]=i[2],s[u+3]=i[3]}}function $P(t){let{domain:e,range:n}=t,r=Object.create(null),o=new Uint8ClampedArray(4*e.length),i=e.length-1,s=n.length;for(let a=0;a<=i;++a){let c=n[a%s],{r:f,g:u,b:p,opacity:l=1}=typeof c=="string"?Le(c):c,d=a<<2;o[d+0]=f,o[d+1]=u,o[d+2]=p,o[d+3]=255*l|0,r[e[a]]=d}return(a,c,f,u)=>{if(u.map)for(let p=0,l=0;p<f;++p)for(let d=0,h=(f-p-1)*c;d<c;++d,l+=4){let m=r[u[d+h]];a[l+0]=o[m+0],a[l+1]=o[m+1],a[l+2]=o[m+2],a[l+3]=o[m+3]}else{let p=r[u];for(let l=0,d=0;l<f;++l)for(let h=0;h<c;++h,d+=4)a[d+0]=o[p+0],a[d+1]=o[p+1],a[d+2]=o[p+2],a[d+3]=o[p+3]}}}function DP(t,e,n){let{interpolate:r}=e,o=new Uint8ClampedArray(4*t),i=t-1;for(let s=0;s<=i;++s){let a=r(s/i),{r:c,g:f,b:u,opacity:p=1}=typeof a=="string"?Le(a):a,l=s<<2;o[l+0]=c,o[l+1]=f,o[l+2]=u,o[l+3]=255*p|0}return(s,a,c,f)=>{for(let u=0,p=0;u<c;++u)for(let l=0,d=(c-u-1)*a;l<a;++l,p+=4){let h=i*n(f[l+d])<<2;s[p+0]=o[h+0],s[p+1]=o[h+1],s[p+2]=o[h+2],s[p+3]=o[h+3]}}}var ea=class extends no{constructor(e,n){super("image",e,n),this.image=null}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};e.addAttributeListener("schemeColor",r),super.setPlot(e,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:e,grids:n}=this,[r,o]=e,{numRows:i,columns:s}=n,{canvas:a,ctx:c,img:f}=OJ(this,r,o),{alpha:u,alphaProp:p,color:l,colorProp:d}=yM(this),h=s[p]??[],m=s[d]??[],x=i>1&&d&&this.groupby?.includes(d)?f2(m,this.plot.getAttribute("colorDomain")):Qh(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(g,y)=>(l?.(f.data,r,o,m[x[y]]),u?.(f.data,r,o,h[x[y]]),c.putImageData(f,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:e,plot:n,data:{numRows:r,columns:o}}=this,i={src:o.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:e,data:{length:r},options:i}]}},Zh=class extends ea{constructor(e,n){super(e,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function yM(t){let{aggr:e,densityMap:n,groupby:r,plot:o}=t,i=e.includes(eo),s=e.includes("fillOpacity"),a=t.channel("fill"),c=t.channel("fillOpacity");if(e.length>2||i&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let f=n.fill||e.includes("fill")?"grid":r.includes(a?.as)?"group":i2(a?.value)?a.value:i&&o.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||e.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:i&&f!=="grid"?"grid":void 0;if(f!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let p=a?.as??(f==="grid"?eo:null),l=c?.as??(u==="grid"?eo:null),d=f!=="grid"&&f!=="group"?OP(f):LJ(t,p),h=u!=="grid"?LP(u):kJ(t,l);return{alphaProp:l,colorProp:p,alpha:h,color:d}}function kJ(t,e){let{plot:n,grids:r}=t,o=n.getAttribute("opacityDomain"),i=o===lo,s=o?.[en],a=!i&&!s&&o||Vh(r.columns[e]);(i||s||!o)&&(i||(a[en]=!0),n.setAttribute("opacityDomain",a));let c=$s({opacity:{type:n.getAttribute("opacityScale"),domain:a,range:n.getAttribute("opacityRange"),clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return RP(c)}function LJ(t,e){let{plot:n,grids:r}=t,o=r.columns[e],i=!o[0]?.map,s=i||Array.isArray(o[0]),a=n.getAttribute("colorDomain"),c=a===lo,f=a?.[en],u=!c&&!f&&a||(i?o.slice().sort(yt):s?CP(o):Vh(o));(c||f||!a)&&(c||(u[en]=!0),n.setAttribute("colorDomain",u));let p=$s({color:{type:n.getAttribute("colorScale"),domain:u,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(s)return $P(p);{let l=$s({x:{type:RJ(p.type),domain:p.domain,reverse:p.reverse,range:[0,1],clamp:p.clamp,base:p.base,exponent:p.exponent,constant:p.constant}});return DP(1024,p,l.apply)}}function RJ(t){return t.endsWith("symlog")?"symlog":t.endsWith("log")?"log":t.endsWith("pow")?"pow":t.endsWith("sqrt")?"sqrt":t==="diverging"?"linear":t}function OJ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=u2(e,n),o=r.getContext("2d",{willReadFrequently:!0}),i=o.getImageData(0,0,e,n);t.image={canvas:r,ctx:o,img:i,w:e,h:n}}return t.image}var Jh=class extends ea{constructor(e,n){let{normalize:r=!0,...o}=n;super(e,o),this.normalize=we(r,i=>(this.normalize=i,this.requestUpdate()))}query(e=[]){let{channels:n,normalize:r,pad:o}=this,[i,s]=this.bins=this.binDimensions(),[a]=hr(this,"x",i,Vo(this,e),o),[c]=hr(this,"y",s,Go(this,e),o),f=st.from(this.sourceTable()).where($J(this,e));this.aggr=["density"];let u=this.groupby=[],p=[];for(let l of n)if(Object.hasOwn(l,"field")){let{channel:d,field:h}=l;d==="z"?(f.select({[d]:h}),p.push("z")):d!=="x"&&d!=="y"&&(f.select({[d]:h}),u.push(d))}return Qv(f,a,c,p,i,s,u,r)}};function $J(t,e){if(Array.isArray(e)&&!e.length)return e;let n=t.channelField("x").column,r=t.channelField("y").column,o=s=>{let a=`${s.expr}`;return s.type!=="BETWEEN"||a!==n&&a!==r},i=s=>s.op==="AND"?dn(s.clauses.filter(a=>o(a))):s;return Array.isArray(e)?e.filter(s=>o(s)).map(s=>i(s)):i(e)}var Uu=class extends $e{constructor(e,n,r){let{bins:o=1024,bandwidth:i=20,...s}=r,a=e.endsWith("X")?"y":"x";super(e,n,s,a==="x"?mM:xM),this.dim=a,this.bins=we(o,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=we(i,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterStable(){let e=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(e);return n&&!n[en]}query(e=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:o}=this,i=this.extent=(o==="x"?Vo:Go)(this,e),[s,a]=hr(this,o,n,i),c=Xh(r,this.sourceTable(),[o]).where(e.concat(tn(a,i))),f=this.channelField("weight")?"weight":null;return Gv(c,s,f)}queryResult(e){let{columns:{index:n,density:r}}=Wn(e);return this.grid=IP(this.bins,n,r),this.convolve()}convolve(){let{bins:e,bandwidth:n,dim:r,grid:o,plot:i,extent:[s,a]}=this,c=o.some(b=>b<0),f=r==="x"?i.innerWidth():i.innerHeight(),u=Gh(n*(e-1)/f,c),p=c2(u,o,e),l=r==="x"?"y":"x",d=this.channelField(r).as,h=+s,m=(a-h)/(e-1),x=1/m,g=new Float64Array(e),y=new Float64Array(e);for(let b=0;b<e;++b)g[b]=h+b*m,y[b]=p[b]*x;return this.data={numRows:e,columns:{[d]:g,[l]:y}},this}plotSpecs(){let{type:e,data:{numRows:n,columns:r},channels:o,dim:i}=this,s=i==="x"?{y:r.y}:{x:r.x};for(let a of o)s[a.channel]=Sn(a,r);return[{type:e,data:{length:n},options:s}]}};var Kh=class extends no{constructor(e,n){let{type:r="dot",...o}=n;super(r,e,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...o})}convolve(){super.convolve();let{bins:e,pad:n,extentX:r,extentY:o}=this,[i,s]=e,a=Tc(this,"x"),c=Tc(this,"y"),[f,u]=r.map(x=>a.apply(x)),[p,l]=o.map(x=>c.apply(x)),d=(u-f)/(i-n),h=(l-p)/(s-n),m=n?0:.5;return this.data=DJ(this.grids,e,f,p,d,h,a.invert,c.invert,m),this}plotSpecs(){let{type:e,channels:n,densityMap:r,data:{numRows:o,columns:i}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?i[c]:Sn(a,i)}for(let a in r)r[a]&&(s[a]=i.density);return[{type:e,data:{length:o},options:s}]}};function DJ(t,e,n,r,o,i,s,a,c){let f=1/(o*i),[u,p]=e,l=u*p,d=l*t.numRows,h=new Float64Array(d),m=new Float64Array(d),x=new Float64Array(d),g={x:h,y:m,density:x},{density:y,...b}=t.columns;for(let _ in b)g[_]=new b[_].constructor(d);let w=0;for(let _=0;_<t.numRows;++_){for(let A in b)g[A].fill(b[A][_],w,w+l);let v=y[_];for(let A=0,T=0;T<p;++T)for(let E=0;E<u;++E,++w,++A)h[w]=s(n+(E+c)*o),m[w]=a(r+(T+c)*i),x[w]=v[A]*f}return{numRows:d,columns:g}}function PJ(t,e,n){var r=1e-8,o=e-1,i=n-1,s=0,a,c,f,u,p,l,d,h,m,x,g;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(f=t<.5?t:1-t,u=Math.sqrt(-2*Math.log(f)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,t<.5&&(d=-d),h=(d*d-3)/6,m=2/(1/(2*e-1)+1/(2*n-1)),x=d*Math.sqrt(h+m)/m-(1/(2*n-1)-1/(2*e-1))*(h+5/6-2/(3*m)),d=e/(e+n*Math.exp(2*x))):(a=Math.log(e/(e+n)),c=Math.log(n/(e+n)),u=Math.exp(e*a)/e,p=Math.exp(n*c)/n,x=u+p,t<u/x?d=Math.pow(e*x*t,1/e):d=1-Math.pow(n*x*(1-t),1/n)),g=-ju(e)-ju(n)+ju(e+n);s<10;s++){if(d===0||d===1)return d;if(l=FJ(d,e,n)-t,u=Math.exp(o*Math.log(d)+i*Math.log(1-d)+g),p=l/u,d-=u=p/(1-.5*Math.min(1,p*(o/d-i/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function FJ(t,e,n){var r=t===0||t===1?0:Math.exp(ju(e+n)-ju(e)-ju(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?0:t<(e+1)/(e+n+2)?r*PP(t,e,n)/e:1-r*PP(1-t,n,e)/n}function PP(t,e,n){var r=1e-30,o=1,i=e+n,s=e+1,a=e-1,c=1,f=1-i*t/s,u,p,l,d;for(Math.abs(f)<r&&(f=r),f=1/f,d=f;o<=100&&(u=2*o,p=o*(n-o)*t/((a+u)*(e+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,d*=f*c,p=-(e+o)*(i+o)*t/((e+u)*(s+u)),f=1+p*f,Math.abs(f)<r&&(f=r),c=1+p/c,Math.abs(c)<r&&(c=r),f=1/f,l=f*c,d*=l,!(Math.abs(l-1)<3e-7));o++);return d}function ju(t){var e=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,o,i,s;for(s=(i=o=t)+5.5,s-=(o+.5)*Math.log(s);e<6;e++)r+=n[e]/++i;return Math.log(2.506628274631*r/o)-s}function FP(t,e){var n=PJ(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}function qP(t){let e=-Math.log((1-t)*(1+t)),n;return e<6.25?(e-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*e,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=-1333171662854621e-31+n*e,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=-4054566272975207e-29+n*e,n=-8151934197605472e-29+n*e,n=26335093153082323e-28+n*e,n=-12975133253453532e-27+n*e,n=-5415412054294628e-26+n*e,n=10512122733215323e-25+n*e,n=-4112633980346984e-24+n*e,n=-29070369957882005e-24+n*e,n=42347877827932404e-23+n*e,n=-13654692000834679e-22+n*e,n=-13882523362786469e-21+n*e,n=.00018673420803405714+n*e,n=-.000740702534166267+n*e,n=-.006033670871430149+n*e,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*e,n=-27517406297064545e-23+n*e,n=18239629214389228e-24+n*e,n=15027403968909828e-22+n*e,n=-4013867526981546e-21+n*e,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=-47318229009055734e-21+n*e,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=-.0003550375203628475+n*e,n=.0009532893797373805+n*e,n=-.0016882755560235047+n*e,n=.002491442096107851+n*e,n=-.003751208507569241+n*e,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*e,n=15076572693500548e-25+n*e,n=-3789465440126737e-24+n*e,n=761570120807834e-23+n*e,n=-1496002662714924e-23+n*e,n=2914795345090108e-23+n*e,n=-6771199775845234e-23+n*e,n=22900482228026655e-23+n*e,n=-99298272942317e-20+n*e,n=4526062597223154e-21+n*e,n=-1968177810553167e-20+n*e,n=7599527703001776e-20+n*e,n=-.00021503011930044477+n*e,n=-.00013871931833623122+n*e,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0,n*t}var Xu=class extends $e{constructor(e,n,r){let o=e.endsWith("X")?"y":"x",{ci:i=.95,...s}=r;super(e,n,s),this.dim=o,this.field=this.channelField(o).field,this.channels=this.channels.filter(a=>a.channel!==o),this.ci=we(i,a=>(this.ci=a,this.update()))}query(e=[]){let{channels:n,field:r}=this,o=n.concat([{field:Ul(r),as:"__avg__"},{field:Pt(Wl(r),si(qe(r))),as:"__se__"}]);return Xh(o,this.sourceTable()).where(e)}queryResult(e){return this.data=Wn(e),this}plotSpecs(){let{type:e,dim:n,detail:r,data:o,ci:i,channels:s}=this,a=Math.SQRT2*qP(i),{columns:{__avg__:c,__se__:f}}=o,u={[`${n}1`]:c.map((p,l)=>p-a*f[l]),[`${n}2`]:c.map((p,l)=>p+a*f[l])};return hM(e,r,s,o,u)}};var qJ="geom",tm=class extends $e{constructor(e,n={},r){!s2(e)&&!n?.geometry&&(n.geometry=Hl(qJ)),super("geo",e,n,r)}queryResult(e){super.queryResult(e);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(o=>JSON.parse(o)))}return this}};var em=class extends $e{constructor(e,n){let{type:r="hexagon",binWidth:o=20,...i}=n;super(r,e,{r:o/2,clip:!0,...i},a2),this.binWidth=we(o,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){let e=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return e&&n&&!e[en]&&!n[en]}query(e=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:o}=this,i,s,a=new Set,c={};for(let N of o)if(N.channel!=="orderby"){if(N.channel==="x")i=N;else if(N.channel==="y")s=N;else if(Object.hasOwn(N,"field")){let{as:M,field:k}=N;c[M]=k,tr(k)||a.add(M)}}let[f,u]=Vo(this,e),[p,l]=Go(this,e),d=.5-n.getAttribute("marginLeft"),h=0-n.getAttribute("marginTop"),m=pe(r),x=pe(r*(1.5/Math.sqrt(3))),g=pe(n.innerWidth()/(u-f)),y=pe(n.innerHeight()/(l-p)),b="_x",w="_y",_="_px",v="_py",A="_pi",T="_pj",E="_tt";return st.select({[i.as]:Rt(pe(f),Pt(Rt(mt(Rt(b,mt(.5,Vl(w,1))),m),d),g)),[s.as]:dt(pe(l),Pt(Rt(mt(w,x),h),y)),...c}).groupby(b,w,...a).from(st.select({[v]:Pt(dt(mt(y,dt(l,s.field)),h),x),[T]:Gt(ai(v)),[_]:dt(Pt(dt(mt(g,dt(i.field,f)),d),m),mt(.5,Vl(T,1))),[A]:Gt(ai(_)),[E]:dn(_r(mt(Be(dt(v,T)),3),1),_r(Rt(ve(dt(_,A),2),ve(dt(v,T),2)),Rt(ve(dt(dt(_,A),mt(.5,ii(ae(_,A),-1,1))),2),ve(dt(dt(v,T),ii(ae(v,T),-1,1)),2)))),[b]:ii(E,Gt(Rt(Rt(A,ii(ae(_,A),-.5,.5)),ii(jr(Vl(T,1),0),.5,-.5))),A),[w]:ii(E,Gt(Rt(T,ii(ae(v,T),-1,1))),T)},"*").from(this.sourceTable()).where(vr(i.field),vr(s.field),e))}};var nm=class extends no{constructor(e,n){let{origin:r=[0,0],dim:o="xy",...i}=n;super("image",e,i),this.image=null,this.origin=r,this.tileX=o.toLowerCase().includes("x"),this.tileY=o.toLowerCase().includes("y")}setPlot(e,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};e.addAttributeListener("schemeColor",r),super.setPlot(e,n)}requestQuery(){return this.requestTiles()}query(e=[]){return this._filter=e,null}tileQuery(e){let{interpolate:n,pad:r,channels:o,densityMap:i}=this,[[s,a],[c,f]]=e,[u,p]=this.bins,[l,d]=hr(this,"x",u,[s,a],r),[h,m]=hr(this,"y",p,[c,f],r),x=r?[tn(d,[+s,+a]),tn(m,[+c,+f])]:[Kn(+s,d),ae(d,+a),Kn(+c,m),ae(m,+f)],g=st.from(this.sourceTable()).where(x),y=this.groupby=[],b={};for(let _ of o)if(Object.hasOwn(_,"field")){let{as:v,channel:A,field:T}=_;T.aggregate?(b[A]=T,i[A]=!0):A==="weight"?b.density=Yt(T):A!=="x"&&A!=="y"&&(g.select({[v]:T}),y.push(v))}let w=this.aggr=Object.keys(b);if(b.density&&w.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(w.length||(w.push("density"),b.density=qe()),n==="linear"){if(w.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b.density)throw new Error("Linear binning not applicable to custom aggregates.");return jJ(g,l,h,b.density,u,y)}else return UJ(g,l,h,b,u,y)}async requestTiles(){let e=Sr();this.prefetch&&e.cancel(this.prefetch);let{pad:n,tileX:r,tileY:o,origin:[i,s]}=this,[a,c]=this.bins=this.binDimensions(),[f,u]=Vo(this,this._filter),[p,l]=Go(this,this._filter),d=u-f,h=l-p,m=Math.floor((f-i)*(a-n)/d),x=Math.floor((p-s)*(c-n)/h),g=(M,k)=>[[i+M*d,i+(M+1)*d],[s+k*h,s+(k+1)*h]],y=Math.floor((f-i)/d),b=r?BP((u-i)/d):y,w=Math.floor((p-s)/h),_=o?BP((l-s)/h):w,v=[];for(let M=y;M<=b;++M)for(let k=w;k<=_;++k)v.push([M,k]);let A=v.map(([M,k])=>e.query(this.tileQuery(g(M,k)))),T=[];if(r)for(let M=w;M<=_;++M)T.push([b+1,M]),T.push([y-1,M]);if(o){let M=r?y-1:y,k=r?b+1:b;for(let O=M;O<=k;++O)T.push([O,_+1]),T.push([O,w-1])}this.prefetch=T.map(([M,k])=>e.prefetch(this.tileQuery(g(M,k))));let E=await Promise.all(A),N=BJ(a,c,m,x,v,E);this.grids0={numRows:N.length,columns:{density:[N]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:e,grids:n}=this,[r,o]=e,{numRows:i,columns:s}=n,{canvas:a,ctx:c,img:f}=YJ(this,r,o),{alpha:u,alphaProp:p,color:l,colorProp:d}=yM(this),h=s[p]??[],m=s[d]??[],x=i>1&&d&&this.groupby?.includes(d)?f2(m,this.plot.getAttribute("colorDomain")):Qh(i);return this.data={numRows:i,columns:{src:Array.from({length:i},(g,y)=>(l?.(f.data,r,o,m[x[y]]),u?.(f.data,r,o,h[x[y]]),c.putImageData(f,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:e,plot:n,data:{numRows:r,columns:o}}=this,i={src:o.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:e,data:{length:r},options:i}]}};function BJ(t,e,n,r,o,i){let s=new Float64Array(t*e);return i.forEach((a,c)=>{let[f,u]=o[c],p=f*t-n,l=u*e-r;zJ(t,e,s,a,p,l)}),s}function zJ(t,e,n,r,o,i){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let f=0;f<s;++f){let u=a[f],p=o+u%t,l=i+Math.floor(u/t);0<=p&&p<t&&0<=l&&l<e&&(n[p+l*t]=c[f])}}function YJ(t,e,n){if(!t.image||t.image.w!==e||t.image.h!==n){let r=u2(e,n),o=r.getContext("2d",{willReadFrequently:!0}),i=o.getImageData(0,0,e,n);t.image={canvas:r,ctx:o,img:i,w:e,h:n}}return t.image}function UJ(t,e,n,r,o,i){return t.select({index:ge`FLOOR(${e})::INTEGER + FLOOR(${n})::INTEGER * ${o}`,...r}).groupby("index",i)}function jJ(t,e,n,r,o,i){let s=r.column?`* ${r.column}`:"",a=(l,d)=>t.clone().select({xp:e,yp:n,i:l,w:d}),c=a(ge`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${o}`,ge`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(ge`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${o}`,ge`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(ge`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${o}`,ge`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),p=a(ge`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${o}`,ge`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return st.from(st.unionAll(c,f,u,p)).select({index:"i",density:Yt("w")},i).groupby("index",i).having(jr("density",0))}function BP(t){let e=Math.floor(t);return e===t?e-1:e}var rm=class extends $e{constructor(e,n){let{ci:r=.95,precision:o=4,...i}=n;super("line",e,i);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=we(r,a=>(this.ci=a,s())),this.precision=we(o,a=>(this.precision=a,s()))}query(e=[]){let n=this.channelField("x").as,r=this.channelField("y").as,o=Array.from(new Set(["stroke","z","fx","fy"].flatMap(i=>this.channelField(i)?.as||[])));return st.from(super.query(e)).select({intercept:Qw(r,n),slope:Kw(r,n),n:Xl(r,n),ssy:Jw(r,n),ssx:Zw(r,n),xm:jl(r,n),x0:pe(jn(n).where(vr(r))),x1:pe(Ke(n).where(vr(r)))}).select(o).groupby(o)}queryResult(e){return this.modelFit=Wn(e),this.lineData=XJ(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:e,modelFit:n,precision:r,plot:o}=this,i=o.innerWidth();return this.areaData=e?WJ(n,e,r,i):null,this}plotSpecs(){let{lineData:e,areaData:n,channels:r,ci:o}=this,i=e.columns,s=o?n.columns:{},a={x:i.x,y:i.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let f of r)switch(f.channel){case"x":case"y":case"fill":break;case"tip":c.tip=Sn(f,s);break;case"stroke":a.stroke=Sn(f,i),c.fill=Sn(f,s);break;case"strokeOpacity":a.strokeOpacity=Sn(f,i);break;case"fillOpacity":c.fillOpacity=Sn(f,s);break;default:a[f.channel]=Sn(f,i),c[f.channel]=Sn(f,s);break}return[...o?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:e.numRows},options:a}]}};function bM(t,e){if(t.concat)return t.concat(e);let n=new t.constructor(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function XJ(t){let{x0:e=[],x1:n=[],xm:r,intercept:o,slope:i,n:s,ssx:a,ssy:c,...f}=t.columns,u=(d,h)=>o[h]+d*i[h],p=bM(e,n),l=bM(e.map(u),n.map(u));for(let d in f)f[d]=bM(f[d],f[d]);return{numRows:p.length,columns:{x:p,y:l,...f}}}function WJ(t,e,n,r){let o=t.numRows,{x0:i,x1:s,xm:a,intercept:c,slope:f,n:u,ssx:p,ssy:l,...d}=t.columns,h=Object.keys(d),m={x:[],y1:[],y2:[]};h.forEach(x=>m[x]=[]);for(let x=0;x<o;++x){let g=n*(s[x]-i[x])/r,y=FP((1-e)/2,u[x]-2)*Math.sqrt(l[x]/(u[x]-2));ye(i[x],s[x]-g/2,g).concat(s[x]).forEach(b=>{let w=c[x]+b*f[x],_=y*Math.sqrt(1/u[x]+(b-a[x])**2/p[x]);m.x.push(b),m.y1.push(w-_),m.y2.push(w+_),h.forEach(v=>m[v].push(d[v][x]))})}return{numRows:m.x.length,columns:m}}function Wu(t){t.tagName==="a"&&(t=t.children[0]);let e=t.__data__;return Array.isArray(e)?e[0]:e}function zP(t){let e=t.toLowerCase(),n=t.length,r="";for(let o=0;o<n;++o)r+=(t[o]!==e[o]?"-":"")+e[o];return r}function na(t){let e={};for(let n in t)e[zP(n)]=t[n];return e}function VJ(t){let{channels:e}=t,n=new Set,r=!1,o=!1;for(let i of e){let{channel:s,field:a,as:c}=i;if(s==="orderby")r=!0;else if(a)if(tr(a))o=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&o&&n.size&&t.channels.push({channel:"orderby",value:Array.from(n)}),t}var om=class{constructor(e,{selection:n,channels:r={}}){this.mark=VJ(e),this.selection=n;let o=Object.entries(na(r));this.channels=o.length?o:[["opacity",.2]],this.selection.addEventListener("value",il(()=>this.update()))}init(e){this.svg=e;let n=this.values=[],o=`g[data-index="${this.mark.index}"]`,i=`${o} > *:not(g), ${o} > g > *`,s=this.nodes=e.querySelectorAll(i),{channels:a}=this;for(let c=0;c<s.length;++c){let f=s[c];n.push(a.map(u=>f.getAttribute(u[0])))}return this.update()}async update(){let{svg:e,nodes:n,channels:r,values:o,mark:i,selection:s}=this;if(!e)return;let a=await GJ(i,s);for(let c=0;c<n.length;++c){let f=n[c],u=o[c],p=a(Wu(f));for(let l=0;l<r.length;++l){let[d,h]=r[l];f.setAttribute(d,p?u[l]:h)}}}};async function GJ(t,e){let n=e?.predicate(t);if(!n||n.length===0)return()=>!0;let r=t.filterBy?.predicate(t,!0),o={__:dn(n)},i=t.query(r);(i.queries||[i]).forEach(c=>{c._groupby.length?c.select(o):c.setSelect(o)});let s=await t.coordinator.query(i),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function l2(){let t=this,e=t.getScreenCTM,n;t.getScreenCTM=()=>t.isConnected?n=e.call(t):n}function wM(t){let e=t.on,n=!0;function r(o){n=!1,o(),n=!0}return t.reset=(...o)=>{r(()=>t.clear(...o))},t.moveSilent=(...o)=>{r(()=>t.move(...o))},t.on=(...o)=>{if(o.length>1&&o[1]){let i=o[1];o[1]=(...s)=>n&&i(...s)}return e(...o)},t}function p2(){return wM(j_())}function YP(){return wM(Y_())}function UP(){return wM(U_())}function d2(t,e,n,r,o){let i=Nt(e??t).append("g").attr("class",o),s=t.scale("fx"),a=t.scale("fy");if(s||a){let c=s?.domain.map(u=>s.apply(u)-n),f=a?.domain.map(u=>a.apply(u)-r);if(c&&f)for(let u=0;u<c.length;++u)for(let p=0;p<f.length;++p)i.append("g").attr("transform",`translate(${c[u]}, ${f[p]})`);else if(c)for(let u=0;u<c.length;++u)i.append("g").attr("transform",`translate(${c[u]}, 0})`);else if(f)for(let u=0;u<f.length;++u)i.append("g").attr("transform",`translate(0, ${f[u]})`);i=i.selectAll("g")}return i.each(l2)}function im(t,e){return t===e||t&&e&&Math.abs(t[0]-e[0])<1e-12&&Math.abs(t[1]-e[1])<1e-12||!1}function jP(t){if(pn(t)){if(t.type==="COLUMN_REF")return t.column;if(t.type==="AGGREGATE")return t.args[0]??t}return t}function Ho(t,e){return jP(t.channelField(e)?.field)}function XP(t,e){let n=[],r=[];return e.forEach(o=>{let i=o==="color"?["color","fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let s=0;s<i.length;++s){let a=t.channelField(i[s],{exact:!0});if(a){n.push(jP(a.field)),r.push(a.as);return}}throw new Error(`Missing channel: ${o}`)}),{fields:n,as:r}}function sm(t,e,n=1){return e.invert(n*Math.floor(t/n))}var ra=class{constructor(e,{channel:n,selection:r,field:o=void 0,pixelSize:i=1,peers:s=!0,brush:a}){this.mark=e,this.channel=n,this.pixelSize=i||1,this.selection=r,this.peers=s,this.field=o||Ho(e,n),this.style=a&&na(a),this.brush=n==="y"?UP():YP(),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(e){let n;e&&(n=e.map(r=>sm(r,this.scale,this.pixelSize)).sort((r,o)=>r-o)),im(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,e),this.selection.update(this.clause(n)))}clause(e){let{mark:n,pixelSize:r,field:o,scale:i}=this;return Ta(o,e,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:i,pixelSize:r})}init(e,n){let{brush:r,channel:o,style:i}=this;this.scale=e.scale(o);let s=this.value?.map(this.scale.apply).sort(yt),a=e.scale("x").range,c=e.scale("y").range;if(r.extent([[It(a),It(c)],[kt(a),kt(c)]]),this.g=d2(e,n,It(a),It(c),`interval-${o}`).call(r).call(r.moveSilent,s),i){let f=this.g.selectAll("rect.selection");for(let u in i)f.attr(u,i[u])}e.addEventListener("pointerenter",f=>{f.buttons||this.activate()})}};var am=class{constructor(e,{selection:n,xfield:r,yfield:o,pixelSize:i=1,peers:s=!0,brush:a}){this.mark=e,this.pixelSize=i||1,this.selection=n,this.peers=s,this.xfield=r||Ho(e,"x"),this.yfield=o||Ho(e,"y"),this.style=a&&na(a),this.brush=p2(),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(e){let{value:n,pixelSize:r,xscale:o,yscale:i}=this,s,a;if(e){let[c,f]=e;s=[c[0],f[0]].map(u=>sm(u,o,r)).sort(yt),a=[c[1],f[1]].map(u=>sm(u,i,r)).sort(yt)}(!im(s,n?.[0])||!im(a,n?.[1]))&&(this.value=e?[s,a]:void 0,this.g.call(this.brush.moveSilent,e),this.selection.update(this.clause(this.value)))}clause(e){let{mark:n,pixelSize:r,xfield:o,yfield:i,xscale:s,yscale:a}=this;return r_([o,i],e,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}init(e){let{brush:n,style:r,value:o}=this,i=this.xscale=e.scale("x"),s=this.yscale=e.scale("y"),a=i.range,c=s.range;if(n.extent([[It(a),It(c)],[kt(a),kt(c)]]),this.g=d2(e,null,It(a),It(c),"interval-xy").call(n),r){let f=this.g.selectAll("rect.selection");for(let u in r)f.attr(u,r[u])}if(o){let[f,u]=o[0].map(i.apply).sort(yt),[p,l]=o[1].map(s.apply).sort(yt);this.g.call(n.moveSilent,[[f,p],[u,l]])}e.addEventListener("pointerenter",f=>{f.buttons||this.activate()})}};var Ec=class{constructor(e,{selection:n,pointer:r,channels:o,fields:i,maxRadius:s=40}){this.mark=e,this.selection=n,this.clients=new Set().add(e),this.pointer=r,this.channels=o||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=i||this.channels.map(a=>Ho(e,[a])),this.maxRadius=s,this.valueIndex=-1}clause(e){let{clients:n,fields:r}=this,o={source:this,clients:n};return r.length>1?ci(r,e&&[e],o):ss(r[0],e?.[0],o)}init(e){let n=this,{mark:r,channels:o,selection:i,maxRadius:s}=this,{data:{columns:a}}=r,c=o.map(m=>r.channelField(m).as),f=!er(i),[u,p]=HJ(e,r),l=this.pointer==="y"?.01:1,d=this.pointer==="x"?.01:1,h=Nt(e);h.on("pointerenter pointerdown pointermove",function(m){let[x,g]=hn(m,this),y=QJ(u,p,x,g,l,d,s);if(y!==this.valueIndex){this.valueIndex=y;let b=y<0?void 0:c.map(w=>a[w][y]);i.update(f?!b||b.length>1?b:b[0]:n.clause(b))}}),!f&&(h.on("pointerleave",()=>{i.update(n.clause(void 0))}),e.addEventListener("pointerenter",m=>{if(!m.buttons){let x=this.channels.map(()=>0);i.activate(this.clause(x))}}))}};function HJ(t,e){let{data:{columns:n}}=e,r=p=>n[e.channelField(p)?.as],o=p=>t.scale(p),i=t.scale("x"),s=t.scale("y"),a=o("fx")?.apply,c=o("fy")?.apply,f=Array.from(r("x"),i.apply),u=Array.from(r("y"),s.apply);if(a){let p=It(i.range),l=r("fx");for(let d=0;d<l.length;++d)f[d]+=a(l[d])-p}if(c){let p=It(s.range),l=r("fy");for(let d=0;d<l.length;++d)u[d]+=c(l[d])-p}return[f,u]}function QJ(t,e,n,r,o,i,s){let a=s*s,c=-1;for(let f=0;f<t.length;++f){let u=o*(t[f]-n),p=i*(e[f]-r),l=u*u+p*p;l<=a&&(a=l,c=f)}return c}var WP=(t,e)=>t-e,cm=class{constructor(e,{x:n=new uo,y:r=new uo,xfield:o,yfield:i,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=e,this.xsel=n,this.ysel=r,this.xfield=o||Ho(e,"x"),this.yfield=i||Ho(e,"y"),this.zoom=vM(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:f}=e;a&&this.xsel.addEventListener("value",u=>{f.setAttribute("xDomain",u)&&f.update()}),c&&this.ysel.addEventListener("value",u=>{f.setAttribute("yDomain",u)&&f.update()})}publish(e){if(this.panx){let n=ZJ(e,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=JJ(e,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(e,n,r){return Ta(n,e,{source:this,clients:this.mark.plot.markSet,scale:r})}init(e){if(this.svg=e,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:o}},xsel:i,ysel:s}=this;this.xscale=e.scale("x"),this.yscale=e.scale("y");let a=this.xscale.range.slice().sort(WP),c=this.yscale.range.slice().sort(WP),f=vM(n,[-1/0,1/0],a),u=vM(r,[-1/0,1/0],c),p=aS().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[f[0],u[0]],[f[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>o.__zoom=new ar(1,0,0)).on("zoom",({transform:l})=>this.publish(l));if(Nt(o).call(p),n||r){let l=!1;o.addEventListener("pointerenter",d=>{if(!l&&(l=!0,!d.buttons)){if(n){let{xscale:h,xfield:m}=this;i.activate(this.clause(h.domain,m,h))}if(r){let{yscale:h,yfield:m}=this;s.activate(this.clause(h.domain,m,h))}}}),o.addEventListener("pointerleave",()=>l=!1)}}};function vM(t,e,n){return t?Array.isArray(t)?t:e:n}function ZJ(t,e){return e.range.map(t.invertX,t).map(e.invert,e)}function JJ(t,e){return e.range.map(t.invertY,t).map(e.invert,e)}var KJ={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},tK=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,eK=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,nK=/^((\s+,?\s*)|(,\s*))/,rK=/^[01]/,VP=t=>`Invalid SVG path, incorrect parameter ${t}`;function GP(t){let e=[];return(t.match(tK)||[]).forEach(r=>{let o=r[0],i=o.toLowerCase(),s=KJ[i],a=oK(i,s,r.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error(VP("count"));if(e.push([o,...a.slice(0,s)]),c!==s){i==="m"&&(o=o==="M"?"L":"l");for(let f=s;f<c;f+=s)e.push([o,...a.slice(f,f+s)])}}),e}function oK(t,e,n){let r=[];for(let o=0;e&&o<n.length;)for(let i=0;i<e;++i){let s=t==="a"&&(i===3||i===4)?rK:eK,a=n.slice(o).match(s);if(a===null)throw new Error(VP("type"));o+=a[0].length,r.push(+a[0]);let c=n.slice(o).match(nK);c!==null&&(o+=c[0].length)}return r}function KP(t,e,n){let{x:r,y:o}=t.getBoundingClientRect(),i=t.createSVGMatrix(),s=[];for(let a of e.children)if(a.tagName==="g"){let c=tF(a)??i;for(let f of a.children)HP(n,r,o,f,c)&&s.push(f)}else HP(n,r,o,a,i)&&s.push(a);return s}function HP(t,e,n,r,o){let[[i,s],[a,c]]=t,{e:f,f:u}=o,p=r.getBoundingClientRect(),l=p.left-e,d=p.right-e,h=p.top-n,m=p.bottom-n;if(l>=i&&d<=a&&h>=s&&m<=c)return!0;if(l<=a&&d>=i&&h<=c&&m>=s){let x=r.tagName;if(x==="a"&&(r=r.children[0],x=r.tagName),x==="rect"||x==="text"||x==="image")return!0;switch(i-=f,s-=u,a-=f,c-=u,x){case"circle":return eF(i,s,a,c,Ic(r.cx),Ic(r.cy),Ic(r.r));case"line":return nF(i,s,a,c,Ic(r.x1),Ic(r.y1),Ic(r.x2),Ic(r.y2));case"path":return iK(i,s,a,c,r)}}return!1}function Ic(t){return t.baseVal.value}function tF(t){let e=t.transform.baseVal,n=e.length,r=e[0]?.matrix;for(let o=1;o<n;++o)r=r.multiply(e[o].matrix);return r}function eF(t,e,n,r,o,i,s){let a=t<=o&&o<=n,c=e<=i&&i<=r;if(a&&c)return!0;let f=Math.min(Math.abs(t-o),Math.abs(n-o));if(c&&f<=s)return!0;let u=Math.min(Math.abs(e-i),Math.abs(r-i));return a&&u<=s||f*f+u*u<=s*s}function nF(t,e,n,r,o,i,s,a){let c=Math.max(Math.min(o,s),t),f=Math.min(Math.max(o,s),n);if(c>f)return!1;let u=i,p=a,l=s-o;if(Math.abs(l)>1e-8){let m=(a-i)/l,x=i-m*o;u=m*c+x,p=m*f+x}let d=Math.max(Math.min(u,p),e),h=Math.min(Math.max(u,p),r);return d<=h}function iK(t,e,n,r,o){let i=o.__path__||(o.__path__=GP(o.getAttribute("d"))),s=0,a=0,c=0,f=0,u=!1,p=[0,0],l=2,d=tF(o),h=(y,b)=>{p.length=l=2,p[0]=c=s=y,p[1]=f=a=b},m=d?(y,b)=>h(QP(d,y,b),ZP(d,y,b)):(y,b)=>h(y,b),x=(y,b)=>(p[l]=y,p[l+1]=b,l+=2,nF(t,e,n,r,p[l-4],p[l-3],y,b)),g=d?(y,b)=>{u=x(QP(d,c=y,f=b),ZP(d,y,b))}:(y,b)=>{u=x(c=y,f=b)};for(let y=0;y<i.length;++y){let b=i[y];switch(b[0]){case"M":m(b[1],b[2]);break;case"m":m(c+b[1],f+b[2]);break;case"L":case"T":g(b[1],b[2]);break;case"H":g(b[1],f);break;case"V":g(c,b[1]);break;case"l":case"t":g(c+b[1],f+b[2]);break;case"h":g(c+b[1],f);break;case"v":g(c,f+b[1]);break;case"C":g(b[5],b[6]);break;case"c":g(c+b[5],f+b[6]);break;case"S":case"Q":g(b[3],b[4]);break;case"s":case"q":g(c+b[3],f+b[4]);break;case"A":g(b[6],b[7]);break;case"a":if(sK(i,y))return eF(t,e,n,r,c,f-b[2],b[2]);g(c+b[6],c+b[7]);break;case"z":case"Z":if(g(s,a),aK(t,e,p)>0)return!0;m(s,a);break;default:return console.warn("SVG path command not supported: ",b[0]),!1}if(u)return!0}return!1}function QP(t,e,n){return t.a*e+t.c*n+t.e}function ZP(t,e,n){return t.b*e+t.d*n+t.f}function sK(t,e){let n=t[e],r=t[e+1];return r&&r[0]==="a"&&t[e+2]?.[0]==="z"&&n[1]===n[2]&&r[1]===r[2]&&n[1]===r[1]&&n[7]===-r[7]}function aK(t,e,n){let r=0,o=n.length-2;for(let i=0;i<o;i+=2)n[i+1]<=e?n[i+3]>e&&JP(t,e,n,i)>0&&++r:n[i+3]<=e&&JP(t,e,n[i])<0&&--r;return r}function JP(t,e,n,r){return(n[r+2]-n[r])*(e-n[r+1])-(t-n[r])*(n[r+3]-n[r+1])}function h2(t,e){return t==null||e==null?t!=null||e!=null:t.length!==e.length||t.some((n,r)=>m2(n,e[r]))}function m2(t,e){let n=t.length;if(e.length!==n)return!0;for(let r=0;r<n;++r)if(t[r]!==e[r])return!0;return!1}var fm=class{constructor(e,{channels:n,selection:r,peers:o=!0,brush:i={fill:"none",stroke:"currentColor",strokeDasharray:"1,1"}}){this.mark=e,this.selection=r,this.peers=o,this.style=i&&na(i),this.brush=p2(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=XP(e,n);this.fields=s,this.as=a}reset(){this.value=void 0,this.extent=null,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}clause(e){let{fields:n,mark:r}=this;return ci(n,e,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}publish(e){let{as:n,group:r,mark:o,svg:i}=this,s;if(e){let{data:{columns:a={}}={}}=o,c=new Map;KP(i,r,e).forEach(f=>{let u=Wu(f),p=n.map(l=>a[l][u]);c.set(p.join("|"),p)}),s=Array.from(c.values())}this.extent=e,h2(s,this.value)&&(this.value=s,this.selection.update(this.clause(s)))}init(e){let{brush:n,extent:r,mark:o,style:i}=this;this.svg=e;let s=e.width.baseVal.value,a=e.height.baseVal.value;if(n.extent([[0,0],[s,a]]),this.group=e.querySelector(`[data-index="${o.index}"]`),this.g=Nt(e).append("g").attr("class","region-xy").each(l2).call(n).call(n.moveSilent,r),i){let c=this.g.selectAll("rect.selection");for(let f in i)c.attr(f,i[f])}e.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}};var Nc=class{constructor(e,{selection:n,channels:r,peers:o=!0}){this.value=null,this.mark=e,this.selection=n,this.peers=o;let i=this.fields=[],s=this.as=[];r.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let f=0;f<c.length;++f){let u=e.channelField(c[f],{exact:!0});if(u){i.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(e){let{fields:n,mark:r}=this;return ci(n,e,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}init(e,n,r){let{mark:o,as:i,selection:s}=this,{data:{columns:a={}}={}}=o;r??=f=>i.map(u=>a[u][Wu(f)]),n??=`[data-index="${o.index}"]`;let c=Array.from(e.querySelectorAll(n));e.addEventListener("pointerdown",f=>{let u=s.single?s.value:this.value,p=f.target,l=null;if(cK(c,p)){let d=r(p);(f.shiftKey||f.metaKey)&&u?.length?(l=u.filter(h=>m2(h,d)),l.length===u.length&&l.push(d)):u?.length===1&&!m2(u[0],d)?l=null:l=[d]}this.value=l,h2(u,l)&&s.update(this.clause(l))}),e.addEventListener("pointerenter",f=>{f.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function cK(t,e){return t.some(n=>n.contains(e))}var oF=":scope > div, :scope > span",x2="swatch",rF="ramp",Vu=class{constructor(e,n){let{as:r,field:o,...i}=n;this.channel=e,this.options=i,this.type=null,this.handler=null,this.selection=r,this.field=o,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(e){this.plot=e}init(e){let n=fK(this,e);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;let{selection:e,handler:n}=this,{single:r,value:o}=e,i=r?o:e.valueFor(n),s=i&&i.length?new Set(i.map(c=>c[0])):null,a=this.legend.querySelectorAll(oF);for(let c of a){let f=s?s.has(c.__data__):!0;c.style.opacity=f?1:.2}}};function fK(t,e){let{channel:n,plot:r,selection:o}=t,i=e.scale(n),s=i.type==="ordinal"?x2:rF,a={label:r.getAttribute(`${n}Label`)??null,...t.options},c=s===x2?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},f=e.legend(n,c);t.legend=f;let u=!!o;if(u&&s===rF){let p=c.width??240,l=dK(i,p);l?f.scale=function(d){return d==="x"?{range:[0,p]}:d==="y"?{range:[-10,0]}:d===n?l:void 0}:u=!1}if(u){let p=uK(t,s);s===x2?(p.init(f,oF,l=>[l.__data__]),t.update()):p.init(f,f.querySelector("g:last-of-type"))}return f}function uK(t,e){let{channel:n,handler:r,selection:o}=t;if(r)return r;let i=lK(t);return e===x2?(t.handler=new Nc(i,{selection:o,channels:[n],peers:!1}),o.addEventListener("value",()=>t.update())):t.handler=new ra(i,{selection:o,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),t.handler}function lK(t){let{channel:e,plot:n}=t,r=t.field??pK(n.marks,e)??"value";if(r){let o={field:r};return{plot:n,channelField:i=>e===i?o:void 0}}}function pK(t,e){let n=e==="color"?["fill","stroke"]:e==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=t.length-1;r>-1;--r)for(let o of n){let i=t[r].channelField(o,{exact:!0});if(i)return i.field}return null}function dK(t,e){let{apply:n,invert:r,interpolate:o,...i}=t,s=t.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return $s({x:{...i,type:a,range:[0,e]}})}function g2(t,e,n=0,r=Math.LN10){let o,i=Math.ceil(Math.log(e)/r),s=Math.max(n,Math.pow(10,Math.round(Math.log(t)/r)-i));for(;Math.ceil(t/s)>e;)s*=10;let a=[5,2];for(let c=0,f=a.length;c<f;++c)o=s/a[c],o>=n&&t/o<=e&&(s=o);return s}function iF(t,e,n){let{step:r,steps:o,minstep:i=0,nice:s=!0}=n;if(s!==!1){let a=e-t,c=Math.LN10;r=r||g2(a,o||25,i,c);let f=Math.log(r),u=f>=0?0:~~(-f/c)+1,p=Math.pow(10,-u-1);f=Math.floor(t/r+p)*r,t=t<f?f-r:f,e=Math.ceil(e/r)*r,o=Math.round((e-t)/r)}return{min:t,max:e,steps:o}}var fF="year",sF="month",aF="day",y2="hour",b2="minute",w2="second",hK="millisecond",lm=1e3,pm=lm*60,dm=pm*60,v2=dm*24,mK=v2*7,cF=v2*30,uF=v2*365,um=[[w2,1,lm],[w2,5,5*lm],[w2,15,15*lm],[w2,30,30*lm],[b2,1,pm],[b2,5,5*pm],[b2,15,15*pm],[b2,30,30*pm],[y2,1,dm],[y2,3,3*dm],[y2,6,6*dm],[y2,12,12*dm],[aF,1,v2],[aF,7,mK],[sF,1,cF],[sF,3,3*cF],[fF,1,uF]];function lF(t,e,n){let r=e-t,o=r/n,i=Xr(s=>s[2]).right(um,o);return i===um.length?{interval:fF,step:g2(r/uF,n)}:i?(i=um[o/um[i-1][2]<um[i][2]/o?i-1:i],{interval:i[0],step:i[1]}):{interval:hK,step:g2(r,n,1)}}var xK=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function gK(t,e){return xK.has(`${t.type}-${e}`)}function MM(t,e={}){let n=(r,o)=>gK(r,o)?{[`${o}1`]:_M(r,o,t,e),[`${o}2`]:_M(r,o,t,{...e,offset:1})}:{[o]:_M(r,o,t,e)};return n[rp]=!0,n}function _M(t,e,n,r){return new SM(n,t,e,r)}function yK(t,e){let n=t.plot.getAttribute(`${e}Scale`);return n==="utc"||n==="time"}var SM=class extends vt{constructor(e,n,r,o){super("COLUMN_REF"),this.column=e,this.mark=n,this.channel=r,this.options=o}get stats(){return{column:this.column,stats:["min","max"]}}toString(){let{mark:e,channel:n,column:r,options:o}=this,{type:i,min:s,max:a}=e.channelField(n),{interval:c,steps:f,offset:u=0}=o,p=c??(i==="date"||yK(e,n)?"date":"number"),l;if(p==="number"){let{apply:d,sqlApply:h,sqlInvert:m}=Tc(e,n),x=iF(d(s),d(a),o),g=h(r),y=pe((x.max-x.min)/x.steps),b=ze(Pt(x.min===0?g:dt(g,x.min),y)),w=Rt(x.min,mt(y,u?Rt(u,b):b));l=m(w)}else{let{interval:d,step:h=1}=p==="date"?lF(s,a,f||40):o,m=av(r,d,h);l=u?Rt(m,Z0(d,u*h)):m}return`${l}`}};var bK=t=>t&&typeof t=="object"&&!Array.isArray(t);var hm=class extends Bn{constructor({element:e,filterBy:n,from:r,column:o,label:i=o,format:s=p=>p,options:a,value:c,field:f=o,as:u}={}){super(n),this.from=r,this.column=o,this.format=s,this.field=f;let p=this.selection=u;this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let l=document.createElement("label");if(l.innerText=i||o,this.element.appendChild(l),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(d=>bK(d)?d:{value:d}),this.selectedValue(c??""),this.update()),p){let d=!er(p);c!=null&&(!d||p.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),d?this.selection.addEventListener("value",h=>{h!==this.select.value&&this.selectedValue(h)}):(this.select.addEventListener("pointerenter",h=>{h.buttons||this.activate()}),this.select.addEventListener("focus",()=>this.activate()))}}selectedValue(e){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===e);n>=0?this.select.selectedIndex=n:this.select.value=String(e)}}reset(){this.select.selectedIndex=this.from?0:-1}activate(){this.selection.activate(ss(this.field,0,{source:this}))}publish(e){let{selection:n,field:r}=this;if(er(n)){e===""&&(e=void 0);let o=ss(r,e,{source:this});n.update(o)}else _e(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?st.from(n).select({value:r}).distinct().where(e).orderby(r):null}queryResult(e){return this.data=[{value:"",label:"All"},...e],this}update(){let{data:e,format:n,select:r,selection:o}=this;r.replaceChildren();for(let{value:i,label:s}of e){let a=document.createElement("option");a.setAttribute("value",i),a.innerText=s??n(i),this.select.appendChild(a)}if(o){let i=er(o)?o.valueFor(this):o.value;this.selectedValue(i??"")}return this}};var wK=0;var mm=class extends Bn{constructor({element:e,filterBy:n,from:r,column:o,label:i,type:s="contains",field:a=o,as:c}={}){if(super(n),this.id="search_"+ ++wK,this.type=s,this.from=r,this.column=o,this.selection=c,this.field=a,this.element=e??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),i){let f=document.createElement("label");f.setAttribute("for",this.id),f.innerText=i,this.element.appendChild(f)}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)}),er(this.selection)?(this.searchbox.addEventListener("pointerenter",f=>{f.buttons||this.activate()}),this.searchbox.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",f=>{f!==this.searchbox.value&&(this.searchbox.value=f)}))}reset(){this.searchbox.value=""}clause(e){let{field:n,type:r}=this;return o_(n,e,{source:this,method:r})}activate(){this.selection.activate(this.clause(""))}publish(e){let{selection:n}=this;er(n)?n.update(this.clause(e)):_e(n)&&n.update(e)}query(e=[]){let{from:n,column:r}=this;return n?st.from(n).select({list:r}).distinct().where(e):null}queryResult(e){return this.data=e,this}update(){let e=document.createElement("datalist"),n=`${this.id}_list`;e.setAttribute("id",n);for(let r of this.data){let o=document.createElement("option");o.setAttribute("value",r.list),e.append(o)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=e),this.searchbox.setAttribute("list",n),this}};var vK=0;var xm=class extends Bn{constructor({element:e,filterBy:n,as:r,min:o,max:i,step:s,from:a,column:c,label:f=c,value:u=r?.value,select:p="point",field:l=c,width:d}={}){if(super(n),this.id="slider_"+ ++vK,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=p,this.field=l,this.min=o,this.max=i,this.step=s,this.element=e||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),f){let h=document.createElement("label");h.setAttribute("for",this.id),h.innerText=f,this.element.appendChild(h)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),d!=null&&(this.slider.style.width=`${+d}px`),o!=null&&this.slider.setAttribute("min",`${o}`),i!=null&&this.slider.setAttribute("max",`${i}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:h}=this.slider;this.curval.innerText=h,this.selection&&this.publish(+h)}),this.selection&&(er(this.selection)?(this.slider.addEventListener("pointerenter",h=>{h.buttons||this.activate()}),this.slider.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",h=>{h!==+this.slider.value&&(this.slider.value=h,this.curval.innerText=h)}))}query(e=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:st.select({min:jn(r),max:Ke(r)}).from(n).where(e)}queryResult(e){let{min:n,max:r}=Array.from(e)[0];return this.min==null&&(this.min=n,this.slider.setAttribute("min",`${n}`)),this.max==null&&(this.max=r,this.slider.setAttribute("max",`${r}`)),this.step==null&&(this.step=(r-n)/500,this.slider.setAttribute("step",`${this.step}`)),this}clause(e){let{field:n,selectionType:r}=this;if(r==="interval"){let o=[this.min??0,e];return Ta(n,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step})}else return ss(n,e,{source:this})}activate(){this.selection.activate(this.clause(0))}publish(e){let{selection:n}=this;er(n)?n.update(this.clause(e)):_e(this.selection)&&n.update(e)}};var TM=pF(t=>{let e=_2(t);return n=>n==null?"":typeof n=="number"?e(n):n instanceof Date?EM(n):`${n}`}),_2=pF(t=>e=>e===0?"0":e.toLocaleString(t)),bUt=TM(),wUt=_2();function EM(t){return Jf(t,"Invalid Date")}function pF(t){let e=null,n;return(r="en")=>r===e?n:n=t(e=r)}var _K=-1;var gm=class extends Bn{constructor({element:e,filterBy:n,from:r,columns:o=["*"],align:i={},format:s,width:a,maxWidth:c,height:f=500,rowBatch:u=100,as:p}={}){super(n),this.id=`table-${++_K}`,this.from=r,this.columns=o,this.format=s,this.align=i,this.widths=typeof a=="object"?a:{},_e(r)&&r.addEventListener("value",()=>this.initialize()),this.offset=0,this.limit=+u,this.pending=!1,this.selection=p,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=e||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${f}px`,this.element.style.overflow="auto";let l=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:m}=this,{scrollHeight:x,scrollTop:g,clientHeight:y}=d.target,b=g<l;l=g,!(b||h||m)&&x-g<2*y&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",d=>{let h=SK(d.target);h>-1&&h!==this.currentRow&&(this.currentRow=h,this.selection.update(this.clause([h])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}sourceTable(){return _e(this.from)?this.from.value:this.from}clause(e=[]){let{data:n,limit:r,schema:o}=this,i=o.map(a=>a.column),s=e.map(a=>{let{columns:c}=n[~~(a/r)];return i.map(f=>c[f][a%r])});return ci(i,s,{source:this})}requestData(e=0){this.offset=e;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),Sr().prefetch(n.clone().offset(e+this.limit))}fields(){let e=this.sourceTable();return this.columns.map(n=>oi(n,e))}fieldInfo(e){this.schema=e;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:o}of e){let i=document.createElement("th");i.addEventListener("click",s=>this.sort(s,o)),i.appendChild(document.createElement("span")),i.appendChild(document.createTextNode(o)),r.appendChild(i)}return n.appendChild(r),this.formats=MK(this.format,e),this.style.innerText=EK(this.id,AK(this.align,e),TK(this.widths,e)),this}query(e=[]){let{limit:n,offset:r,schema:o,sortColumn:i,sortDesc:s}=this;return st.from(this.sourceTable()).select(o.map(a=>a.column)).where(e).orderby(i?s?wv(i):i:[]).limit(n).offset(r)}queryResult(e){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Wn(e)),this}update(){let{body:e,formats:n,data:r,schema:o,limit:i}=this,s=o.length,a=r.length-1,c=i*a,{numRows:f,columns:u}=r[a],p=o.map(l=>u[l.column]);for(let l=0;l<f;++l){let d=document.createElement("tr");Object.assign(d,{__row__:c+l});for(let h=0;h<s;++h){let m=p[h][l],x=document.createElement("td");x.innerText=m==null?"":n[h](m),d.appendChild(x)}e.appendChild(d)}return f<i&&(this.loaded=!0),this.pending=!1,this}sort(e,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=e.currentTarget,o=this.sortHeader;o===r&&e.metaKey?(o.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(o&&(o.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function SK(t){let e=t.parentElement;return Object.hasOwn(e,"__row__")?+e.__row__:-1}function MK(t={},e,n){return e.map(({column:r,type:o})=>{if(r in t)return t[r];switch(o){case"number":return _2(n);case"date":return EM;default:return TM(n)}})}function AK(t={},e){return e.map(({column:n,type:r})=>n in t?t[n]:r==="number"?"right":"left")}function TK(t={},e){return e.map(({column:n})=>t[n])}function EK(t,e,n){let r=[];return e.forEach((o,i)=>{let s=+n[i];if(o!=="left"||s){let a=o!=="left"?`text-align:${o};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${t} tr>:nth-child(${i+1}) {${a}${c}}`)}}),r.join(" ")}function ym(t,...e){let n=t?.context?.coordinator??Sr();for(let r of e)n.connect(r)}function S2(t,e,n){let r=new e(n);return ym(t,r),r.element}function dF(t){return S2(this,hm,t)}function hF(t){return S2(this,mm,t)}function mF(t){return S2(this,xm,t)}function xF(t){return S2(this,gm,t)}function gF({direction:t="vertical",wrap:e=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=t==="vertical"?"column":"row",r.style.flexWrap=e?e===!0?"wrap":e:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(o=>r.appendChild(o)),Object.assign(r,{value:{element:r}}),r}function yF(...t){return gF({direction:"vertical"},t.flat())}function bF(...t){return gF({direction:"horizontal"},t.flat())}function wF({dim:t="width",size:e=10}){let n=document.createElement("span");return n.style.display="inline-block",n.style[t]=Number.isNaN(+e)?e:`${e}px`,Object.assign(n,{value:{element:n}})}function vF(t){return wF({dim:"height",size:t})}function _F(t){return wF({dim:"width",size:t})}var M2={};Pc(M2,{align:()=>YM,ariaDescription:()=>QM,ariaLabel:()=>HM,aspectRatio:()=>UM,axis:()=>jM,clip:()=>VM,colorBase:()=>R8,colorClamp:()=>v8,colorConstant:()=>$8,colorDomain:()=>b8,colorExponent:()=>O8,colorInterpolate:()=>A8,colorLabel:()=>I8,colorN:()=>_8,colorNice:()=>S8,colorPercent:()=>N8,colorPivot:()=>T8,colorRange:()=>w8,colorReverse:()=>C8,colorScale:()=>y8,colorScheme:()=>M8,colorSymmetric:()=>E8,colorTickFormat:()=>L8,colorZero:()=>k8,facetGrid:()=>yA,facetLabel:()=>bA,facetMargin:()=>dA,facetMarginBottom:()=>mA,facetMarginLeft:()=>xA,facetMarginRight:()=>gA,facetMarginTop:()=>hA,fxAlign:()=>TA,fxAriaDescription:()=>jA,fxAriaLabel:()=>UA,fxAxis:()=>CA,fxDomain:()=>wA,fxFontVariant:()=>YA,fxGrid:()=>PA,fxInset:()=>_A,fxInsetLeft:()=>SA,fxInsetRight:()=>MA,fxLabel:()=>qA,fxLabelAnchor:()=>BA,fxLabelOffset:()=>zA,fxLine:()=>FA,fxPadding:()=>EA,fxPaddingInner:()=>IA,fxPaddingOuter:()=>NA,fxRange:()=>vA,fxReverse:()=>XA,fxRound:()=>AA,fxTickFormat:()=>$A,fxTickPadding:()=>OA,fxTickRotate:()=>DA,fxTickSize:()=>LA,fxTickSpacing:()=>RA,fxTicks:()=>kA,fyAlign:()=>JA,fyAriaDescription:()=>x8,fyAriaLabel:()=>m8,fyAxis:()=>n8,fyDomain:()=>WA,fyFontVariant:()=>h8,fyGrid:()=>f8,fyInset:()=>GA,fyInsetBottom:()=>QA,fyInsetTop:()=>HA,fyLabel:()=>l8,fyLabelAnchor:()=>p8,fyLabelOffset:()=>d8,fyLine:()=>u8,fyPadding:()=>KA,fyPaddingInner:()=>t8,fyPaddingOuter:()=>e8,fyRange:()=>VA,fyReverse:()=>g8,fyRound:()=>ZA,fyTickFormat:()=>a8,fyTickPadding:()=>s8,fyTickRotate:()=>c8,fyTickSize:()=>o8,fyTickSpacing:()=>i8,fyTicks:()=>r8,grid:()=>WM,height:()=>PM,inset:()=>XM,lengthBase:()=>xT,lengthClamp:()=>pT,lengthConstant:()=>yT,lengthDomain:()=>uT,lengthExponent:()=>gT,lengthNice:()=>dT,lengthPercent:()=>hT,lengthRange:()=>lT,lengthScale:()=>fT,lengthZero:()=>mT,margin:()=>RM,marginBottom:()=>zM,marginLeft:()=>FM,marginRight:()=>qM,marginTop:()=>BM,margins:()=>LM,name:()=>CM,opacityBase:()=>W8,opacityClamp:()=>q8,opacityConstant:()=>G8,opacityDomain:()=>P8,opacityExponent:()=>V8,opacityLabel:()=>z8,opacityNice:()=>B8,opacityPercent:()=>Y8,opacityRange:()=>F8,opacityReverse:()=>U8,opacityScale:()=>D8,opacityTickFormat:()=>X8,opacityZero:()=>j8,padding:()=>GM,projectionClip:()=>NT,projectionDomain:()=>ST,projectionInset:()=>MT,projectionInsetBottom:()=>IT,projectionInsetLeft:()=>AT,projectionInsetRight:()=>TT,projectionInsetTop:()=>ET,projectionParallels:()=>wT,projectionPrecision:()=>vT,projectionRotate:()=>_T,projectionType:()=>bT,rBase:()=>sT,rClamp:()=>eT,rConstant:()=>cT,rDomain:()=>K8,rExponent:()=>aT,rLabel:()=>rT,rNice:()=>nT,rPercent:()=>oT,rRange:()=>tT,rScale:()=>J8,rZero:()=>iT,style:()=>$M,symbolDomain:()=>Q8,symbolRange:()=>Z8,symbolScale:()=>H8,width:()=>DM,xAlign:()=>s5,xAriaDescription:()=>A5,xAriaLabel:()=>M5,xAxis:()=>u5,xBase:()=>N5,xClamp:()=>o5,xConstant:()=>k5,xDomain:()=>JM,xExponent:()=>C5,xFontVariant:()=>S5,xGrid:()=>g5,xInset:()=>e5,xInsetLeft:()=>n5,xInsetRight:()=>r5,xLabel:()=>b5,xLabelAnchor:()=>w5,xLabelArrow:()=>v5,xLabelOffset:()=>_5,xLine:()=>y5,xNice:()=>t5,xPadding:()=>a5,xPaddingInner:()=>c5,xPaddingOuter:()=>f5,xPercent:()=>T5,xRange:()=>KM,xReverse:()=>E5,xRound:()=>i5,xScale:()=>ZM,xTickFormat:()=>m5,xTickPadding:()=>h5,xTickRotate:()=>x5,xTickSize:()=>p5,xTickSpacing:()=>d5,xTicks:()=>l5,xZero:()=>I5,xyDomain:()=>OM,yAlign:()=>z5,yAriaDescription:()=>sA,yAriaLabel:()=>iA,yAxis:()=>X5,yBase:()=>uA,yClamp:()=>q5,yConstant:()=>pA,yDomain:()=>R5,yExponent:()=>lA,yFontVariant:()=>oA,yGrid:()=>J5,yInset:()=>D5,yInsetBottom:()=>F5,yInsetTop:()=>P5,yLabel:()=>tA,yLabelAnchor:()=>eA,yLabelArrow:()=>nA,yLabelOffset:()=>rA,yLine:()=>K5,yNice:()=>$5,yPadding:()=>Y5,yPaddingInner:()=>U5,yPaddingOuter:()=>j5,yPercent:()=>aA,yRange:()=>O5,yReverse:()=>cA,yRound:()=>B5,yScale:()=>L5,yTickFormat:()=>Q5,yTickPadding:()=>H5,yTickRotate:()=>Z5,yTickSize:()=>V5,yTickSpacing:()=>G5,yTicks:()=>W5,yZero:()=>fA});var bm=class extends Map{request(e,n){if(this.has(e))n(this.get(e));else{let r=this.waiting||(this.waiting=new Map),o=r.get(e)||[];r.set(e,o.concat(n))}}set(e,n){this.has(e)&&console.warn(`Overwriting named plot "${e}".`);let{waiting:r}=this;return r?.has(e)&&(r.get(e).forEach(o=>o(n)),r.delete(e)),super.set(e,n)}clear(){return this.waiting?.clear(),super.clear()}},IM=new bm;function NM(t,e,n){(t?.context?.namedPlots??IM).request(e,n)}function SF(t,e,n){(t?.context?.namedPlots??IM).set(e,n)}function CM(t){return e=>SF(this,t,e)}function MF(t,e,n){_e(n)?(n.addEventListener("value",r=>{t.setAttribute(e,r),t.update()}),n.value!==void 0&&t.setAttribute(e,n.value)):t.setAttribute(e,n)}function IK(t,e){return n=>{MF(n,t,e)}}function kM(t){return e=>{for(let[n,r]of Object.entries(t))MF(e,n,r)}}function LM(t){let{top:e,bottom:n,left:r,right:o}=t,i={};return e!==void 0&&(i.marginTop=e),n!==void 0&&(i.marginBottom=n),r!==void 0&&(i.marginLeft=r),o!==void 0&&(i.marginRight=o),kM(i)}function RM(t){return kM({marginTop:t,marginBottom:t,marginLeft:t,marginRight:t})}function OM(t){return kM({xDomain:t,yDomain:t})}var R=t=>e=>IK(t,e),$M=R("style"),DM=R("width"),PM=R("height"),FM=R("marginLeft"),qM=R("marginRight"),BM=R("marginTop"),zM=R("marginBottom"),YM=R("align"),UM=R("aspectRatio"),jM=R("axis"),XM=R("inset"),WM=R("grid"),VM=R("clip"),GM=R("padding"),HM=R("ariaLabel"),QM=R("ariaDescription"),ZM=R("xScale"),JM=R("xDomain"),KM=R("xRange"),t5=R("xNice"),e5=R("xInset"),n5=R("xInsetLeft"),r5=R("xInsetRight"),o5=R("xClamp"),i5=R("xRound"),s5=R("xAlign"),a5=R("xPadding"),c5=R("xPaddingInner"),f5=R("xPaddingOuter"),u5=R("xAxis"),l5=R("xTicks"),p5=R("xTickSize"),d5=R("xTickSpacing"),h5=R("xTickPadding"),m5=R("xTickFormat"),x5=R("xTickRotate"),g5=R("xGrid"),y5=R("xLine"),b5=R("xLabel"),w5=R("xLabelAnchor"),v5=R("xLabelArrow"),_5=R("xLabelOffset"),S5=R("xFontVariant"),M5=R("xAriaLabel"),A5=R("xAriaDescription"),T5=R("xPercent"),E5=R("xReverse"),I5=R("xZero"),N5=R("xBase"),C5=R("xExponent"),k5=R("xConstant"),L5=R("yScale"),R5=R("yDomain"),O5=R("yRange"),$5=R("yNice"),D5=R("yInset"),P5=R("yInsetTop"),F5=R("yInsetBottom"),q5=R("yClamp"),B5=R("yRound"),z5=R("yAlign"),Y5=R("yPadding"),U5=R("yPaddingInner"),j5=R("yPaddingOuter"),X5=R("yAxis"),W5=R("yTicks"),V5=R("yTickSize"),G5=R("yTickSpacing"),H5=R("yTickPadding"),Q5=R("yTickFormat"),Z5=R("yTickRotate"),J5=R("yGrid"),K5=R("yLine"),tA=R("yLabel"),eA=R("yLabelAnchor"),nA=R("yLabelArrow"),rA=R("yLabelOffset"),oA=R("yFontVariant"),iA=R("yAriaLabel"),sA=R("yAriaDescription"),aA=R("yPercent"),cA=R("yReverse"),fA=R("yZero"),uA=R("yBase"),lA=R("yExponent"),pA=R("yConstant"),dA=R("facetMargin"),hA=R("facetMarginTop"),mA=R("facetMarginBottom"),xA=R("facetMarginLeft"),gA=R("facetMarginRight"),yA=R("facetGrid"),bA=R("facetLabel"),wA=R("fxDomain"),vA=R("fxRange"),_A=R("fxInset"),SA=R("fxInsetLeft"),MA=R("fxInsetRight"),AA=R("fxRound"),TA=R("fxAlign"),EA=R("fxPadding"),IA=R("fxPaddingInner"),NA=R("fxPaddingOuter"),CA=R("fxAxis"),kA=R("fxTicks"),LA=R("fxTickSize"),RA=R("fxTickSpacing"),OA=R("fxTickPadding"),$A=R("fxTickFormat"),DA=R("fxTickRotate"),PA=R("fxGrid"),FA=R("fxLine"),qA=R("fxLabel"),BA=R("fxLabelAnchor"),zA=R("fxLabelOffset"),YA=R("fxFontVariant"),UA=R("fxAriaLabel"),jA=R("fxAriaDescription"),XA=R("fxReverse"),WA=R("fyDomain"),VA=R("fyRange"),GA=R("fyInset"),HA=R("fyInsetTop"),QA=R("fyInsetBottom"),ZA=R("fyRound"),JA=R("fyAlign"),KA=R("fyPadding"),t8=R("fyPaddingInner"),e8=R("fyPaddingOuter"),n8=R("fyAxis"),r8=R("fyTicks"),o8=R("fyTickSize"),i8=R("fyTickSpacing"),s8=R("fyTickPadding"),a8=R("fyTickFormat"),c8=R("fyTickRotate"),f8=R("fyGrid"),u8=R("fyLine"),l8=R("fyLabel"),p8=R("fyLabelAnchor"),d8=R("fyLabelOffset"),h8=R("fyFontVariant"),m8=R("fyAriaLabel"),x8=R("fyAriaDescription"),g8=R("fyReverse"),y8=R("colorScale"),b8=R("colorDomain"),w8=R("colorRange"),v8=R("colorClamp"),_8=R("colorN"),S8=R("colorNice"),M8=R("colorScheme"),A8=R("colorInterpolate"),T8=R("colorPivot"),E8=R("colorSymmetric"),I8=R("colorLabel"),N8=R("colorPercent"),C8=R("colorReverse"),k8=R("colorZero"),L8=R("colorTickFormat"),R8=R("colorBase"),O8=R("colorExponent"),$8=R("colorConstant"),D8=R("opacityScale"),P8=R("opacityDomain"),F8=R("opacityRange"),q8=R("opacityClamp"),B8=R("opacityNice"),z8=R("opacityLabel"),Y8=R("opacityPercent"),U8=R("opacityReverse"),j8=R("opacityZero"),X8=R("opacityTickFormat"),W8=R("opacityBase"),V8=R("opacityExponent"),G8=R("opacityConstant"),H8=R("symbolScale"),Q8=R("symbolDomain"),Z8=R("symbolRange"),J8=R("rScale"),K8=R("rDomain"),tT=R("rRange"),eT=R("rClamp"),nT=R("rNice"),rT=R("rLabel"),oT=R("rPercent"),iT=R("rZero"),sT=R("rBase"),aT=R("rExponent"),cT=R("rConstant"),fT=R("lengthScale"),uT=R("lengthDomain"),lT=R("lengthRange"),pT=R("lengthClamp"),dT=R("lengthNice"),hT=R("lengthPercent"),mT=R("lengthZero"),xT=R("lengthBase"),gT=R("lengthExponent"),yT=R("lengthConstant"),bT=R("projectionType"),wT=R("projectionParallels"),vT=R("projectionPrecision"),_T=R("projectionRotate"),ST=R("projectionDomain"),MT=R("projectionInset"),AT=R("projectionInsetLeft"),TT=R("projectionInsetRight"),ET=R("projectionInsetTop"),IT=R("projectionInsetBottom"),NT=R("projectionClip");function AF(t,e){return{table:t,options:e}}var T2={};Pc(T2,{area:()=>CT,areaX:()=>kT,areaY:()=>LT,arrow:()=>AE,axisFx:()=>CE,axisFy:()=>kE,axisX:()=>IE,axisY:()=>NE,barX:()=>DT,barY:()=>PT,cell:()=>FT,cellX:()=>qT,cellY:()=>BT,circle:()=>VT,contour:()=>lE,delaunayLink:()=>_E,delaunayMesh:()=>SE,denseLine:()=>uE,density:()=>fE,densityX:()=>aE,densityY:()=>cE,dot:()=>jT,dotX:()=>XT,dotY:()=>WT,errorbarX:()=>yE,errorbarY:()=>bE,frame:()=>EE,geo:()=>DE,graticule:()=>FE,gridFx:()=>OE,gridFy:()=>$E,gridX:()=>LE,gridY:()=>RE,heatmap:()=>pE,hexagon:()=>GT,hexbin:()=>mE,hexgrid:()=>xE,hull:()=>ME,image:()=>sE,line:()=>RT,lineX:()=>OT,lineY:()=>$T,link:()=>TE,raster:()=>dE,rasterTile:()=>hE,rect:()=>zT,rectX:()=>YT,rectY:()=>UT,regressionY:()=>gE,ruleX:()=>JT,ruleY:()=>KT,sphere:()=>PE,spike:()=>iE,text:()=>HT,textX:()=>QT,textY:()=>ZT,tickX:()=>tE,tickY:()=>eE,vector:()=>nE,vectorX:()=>rE,vectorY:()=>oE,voronoi:()=>wE,voronoiMesh:()=>vE,waffleX:()=>qE,waffleY:()=>BE});var NK=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function pt(t,e,n={}){arguments.length===2&&!Array.isArray(e)&&(n=e,e=NK.has(t)?null:[{}]);let r=t.startsWith("area")||t.startsWith("line")?Wh:$e;return A2(r,t,e,n)}function A2(t,e,n,r){return o=>{o.addMark(new t(e,n,r))}}function Qo(t,e,n){return r=>{r.addMark(new t(e,n))}}var CT=(...t)=>pt("area",...t),kT=(...t)=>pt("areaX",...t),LT=(...t)=>pt("areaY",...t),RT=(...t)=>pt("line",...t),OT=(...t)=>pt("lineX",...t),$T=(...t)=>pt("lineY",...t),DT=(...t)=>pt("barX",...t),PT=(...t)=>pt("barY",...t),FT=(...t)=>pt("cell",...t),qT=(...t)=>pt("cellX",...t),BT=(...t)=>pt("cellY",...t),zT=(...t)=>pt("rect",...t),YT=(...t)=>pt("rectX",...t),UT=(...t)=>pt("rectY",...t),jT=(...t)=>pt("dot",...t),XT=(...t)=>pt("dotX",...t),WT=(...t)=>pt("dotY",...t),VT=(...t)=>pt("circle",...t),GT=(...t)=>pt("hexagon",...t),HT=(...t)=>pt("text",...t),QT=(...t)=>pt("textX",...t),ZT=(...t)=>pt("textY",...t),JT=(...t)=>pt("ruleX",...t),KT=(...t)=>pt("ruleY",...t),tE=(...t)=>pt("tickX",...t),eE=(...t)=>pt("tickY",...t),nE=(...t)=>pt("vector",...t),rE=(...t)=>pt("vectoX",...t),oE=(...t)=>pt("vectorY",...t),iE=(...t)=>pt("spike",...t),sE=(...t)=>pt("image",...t),aE=(...t)=>A2(Uu,"areaX",...t),cE=(...t)=>A2(Uu,"areaY",...t),fE=(...t)=>Qo(Kh,...t),uE=(...t)=>Qo(Jh,...t),lE=(...t)=>Qo(Hh,...t),pE=(...t)=>Qo(Zh,...t),dE=(...t)=>Qo(ea,...t),hE=(...t)=>Qo(nm,...t),mE=(...t)=>Qo(em,...t),xE=(...t)=>pt("hexgrid",...t),gE=(...t)=>Qo(rm,...t),yE=(...t)=>A2(Xu,"ruleY",...t),bE=(...t)=>Qo(Xu,"ruleX",...t),wE=(...t)=>pt("voronoi",...t),vE=(...t)=>pt("voronoiMesh",...t),_E=(...t)=>pt("delaunayLink",...t),SE=(...t)=>pt("delaunayMesh",...t),ME=(...t)=>pt("hull",...t),AE=(...t)=>pt("arrow",...t),TE=(...t)=>pt("link",...t),EE=(...t)=>pt("frame",...t),IE=(...t)=>pt("axisX",...t),NE=(...t)=>pt("axisY",...t),CE=(...t)=>pt("axisFx",...t),kE=(...t)=>pt("axisFy",...t),LE=(...t)=>pt("gridX",...t),RE=(...t)=>pt("gridY",...t),OE=(...t)=>pt("gridFx",...t),$E=(...t)=>pt("gridFy",...t),DE=(...t)=>Qo(tm,...t),PE=(...t)=>pt("sphere",...t),FE=(...t)=>pt("graticule",...t),qE=(...t)=>pt("waffleX",...t),BE=(...t)=>pt("waffleY",...t);var E2={};Pc(E2,{highlight:()=>zE,intervalX:()=>YE,intervalXY:()=>jE,intervalY:()=>UE,nearest:()=>XE,nearestX:()=>WE,nearestY:()=>VE,pan:()=>KE,panX:()=>t7,panY:()=>e7,panZoom:()=>n7,panZoomX:()=>r7,panZoomY:()=>o7,region:()=>GE,toggle:()=>Cc,toggleColor:()=>JE,toggleX:()=>HE,toggleY:()=>QE,toggleZ:()=>ZE});function Zo(t,e){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new t(r,e))}}function zE({by:t,...e}){return Zo(om,{selection:t,channels:e})}function YE({as:t,...e}){return Zo(ra,{...e,selection:t,channel:"x"})}function UE({as:t,...e}){return Zo(ra,{...e,selection:t,channel:"y"})}function jE({as:t,...e}){return Zo(am,{...e,selection:t})}function XE({as:t,...e}){return Zo(Ec,{...e,selection:t,pointer:"xy"})}function WE({as:t,...e}){return Zo(Ec,{...e,selection:t,pointer:"x"})}function VE({as:t,...e}){return Zo(Ec,{...e,selection:t,pointer:"y"})}function GE({as:t,...e}){return Zo(fm,{...e,selection:t})}function Cc({as:t,...e}){return Zo(Nc,{...e,selection:t})}function HE(t){return Cc({...t,channels:["x"]})}function QE(t){return Cc({...t,channels:["y"]})}function ZE(t){return Cc({...t,channels:["z"]})}function JE(t){return Cc({...t,channels:["color"]})}function Gu(t){return Zo(cm,t)}function KE(t={}){return Gu({...t,zoom:!1})}function t7(t={}){return Gu({...t,zoom:!1,pany:!1})}function e7(t={}){return Gu({...t,zoom:!1,panx:!1})}function n7(t={}){return Gu(t)}function r7(t={}){return Gu({...t,pany:!1})}function o7(t={}){return Gu({...t,panx:!1})}var I2={};Pc(I2,{colorLegend:()=>s7,opacityLegend:()=>a7,symbolLegend:()=>c7});function i7(t,e={}){if(e.for){let{for:n,...r}=e,o=new Vu(t,r),i=typeof n,s=a=>a.addLegend(o,!1);return i==="string"?NM(this,n,s):n.value&&s(n.value),o.element}else return n=>n.addLegend(new Vu(t,e))}function s7(t){return i7.call(this,"color",t)}function a7(t){return i7.call(this,"opacity",t)}function c7(t){return i7.call(this,"symbol",t)}function TF(...t){let e=new jh;return t.flat().forEach(n=>n(e)),ym(this,...e.marks),e.update(),e.element}function u7({coordinator:t=Sr(),namedPlots:e=new bm,extensions:n=null,...r}={}){return{...f7,...n,context:{coordinator:t,namedPlots:e,...r}}}var EF="spec",N2="literal",vjt="dataref",IF="options",NF="selection",CF="paramref",kF="columnparamref",LF="param",RF="include",l7="select",C2="value",OF="crossfilter",k2="intersect",$F="union",DF="single",PF="data",FF="expression",kc="sql",wm="input",Hu="hconcat",Qu="vconcat",Zu="hspace",Ju="vspace",L2="mark",p7="from",Ku="plot",vm="legend",qF="attribute",d7="transform",BF="interactor",_m="Fixed";var gt=class{constructor(e,n=null){this.type=e,this.children=n}instantiate(e){throw Error("instantiate not implemented")}codegen(e){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var Sm=class extends gt{constructor(e,n,r,o,i,s){super(EF,[e]),this.root=e,this.meta=n,this.config=r,this.data=o,this.params=i,this.plotDefaults=s}toJSON(){let{root:e,meta:n,config:r,plotDefaults:o}=this,i=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),i?.size){let c=a.data={};for(let[f,u]of i)c[f]=u.toJSON()}if(s?.size){let c=a.params={};for(let[f,u]of s)c[f]=u.toJSON()}if(o?.length){let c=a.plotDefaults={};for(let f of o)Object.assign(c,f.toJSON())}return Object.assign(a,e.toJSON())}};function Mm(t){let e=typeof t;return e==="object"?t?.param:e==="string"?CK(t):null}function CK(t){return t?.[0]==="$"?t.slice(1):null}function Am(t){return`$${t}`}function tl(t){return[t].flat()}function Fr(t){return Array.isArray(t)}function el(t){return t!==null&&typeof t=="object"&&!Fr(t)}function oa(t){return typeof t=="string"}function nl(t,e){throw Object.assign(Error(t),{data:e})}var kK=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function zF(t,e){return kK.test(t+="")?new Date(t):e}function Ze(t,e){let n={};for(let r in t)n[r]=e.maybeSelection(t[r]);return new ia(n)}var ia=class t extends gt{constructor(e){super(IF),this.options=e}filter(e){let n=Object.fromEntries(Object.entries(this.options).filter(([r,o])=>e(r,o)));return new t(n)}instantiate(e){let{options:n}=this,r={};for(let o in n)r[o]=n[o].instantiate(e);return r}codegen(e){let{options:n}=this,r=[];for(let o in n)r.push(`${o}: ${n[o].codegen(e)}`);return r.length?`{${e.maybeLineWrap(r)}}`:""}toJSON(){let{options:e}=this,n={};for(let r in e)n[r]=e[r].toJSON();return n}};var jF="table",XF="parquet",WF="csv",h7="json",B2="spatial",YF=new Map([[jF,$K],[XF,DK],[WF,PK],[h7,FK],[B2,qK]]);function VF(t,e,n){let r=LK(e);if(YF.has(r.type))return YF.get(r.type)(t,r,n);n.error("Unrecognized data format type.",e)}function LK(t){return Fr(t)&&(t={type:"json",data:t}),oa(t)&&(t={type:"table",query:t}),{...t,type:RK(t)}}function RK(t){return t.type||OK(t.file)||"table"}function OK(t){let e=t?.lastIndexOf(".");return e>0?t.slice(e+1):null}function $K(t,e,n){let{query:r,type:o,...i}=e;return new O2(t,r,Ze(i,n))}function DK(t,e,n){let{file:r,type:o,...i}=e;return new D2(t,r,Ze(i,n))}function PK(t,e,n){let{file:r,type:o,...i}=e;return new P2(t,r,Ze(i,n))}function FK(t,e,n){let{data:r,file:o,type:i,...s}=e,a=Ze(s,n);return r?new q2(t,r,a):new F2(t,o,a)}function qK(t,e,n){let{file:r,type:o,...i}=e;return new $2(t,r,Ze(i,n))}function UF(t,e){return e?new URL(t,e).toString():t}function BK(t,e){let n=t?.codegen(e);return n?`, ${n}`:""}var R2=class extends gt{constructor(e,n){super(PF),this.name=e,this.format=n}},rl=class extends R2{constructor(e,n){super(e,n)}instantiateQuery(e){e.error("instantiateQuery not implemented")}codegenQuery(e){e.error("codegenQuery not implemented")}instantiate(e){let n=this.instantiateQuery(e);if(n)return n}codegen(e){let n=this.codegenQuery(e);if(n)return n}},O2=class extends rl{constructor(e,n,r){super(e,jF),this.query=n?.trim(),this.options=r}instantiateQuery(e){let{name:n,query:r,options:o}=this;if(r)return e.api.createTable(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,query:r,options:o}=this;if(r)return`\`${co(n,r,o.instantiate(e))}\``}toJSON(){let{format:e,query:n,options:r}=this;return{type:e,query:n,...r.toJSON()}}},Lc=class extends rl{constructor(e,n,r,o,i){super(e,n),this.file=o,this.method=r,this.options=i}instantiateQuery(e){let{name:n,method:r,file:o,options:i}=this,s=UF(o,e.baseURL),a=i?.instantiate(e);return e.api[r](n,s,a)}codegenQuery(e){let{name:n,method:r,file:o,options:i}=this,s=UF(o,e.baseURL),a=BK(i,e);return`${e.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:e,file:n,options:r}=this;return{type:e,file:n,...r.toJSON()}}},$2=class extends Lc{constructor(e,n,r){super(e,B2,"loadSpatial",n,r)}},D2=class extends Lc{constructor(e,n,r){super(e,XF,"loadParquet",n,r)}},P2=class extends Lc{constructor(e,n,r){super(e,WF,"loadCSV",n,r)}},F2=class extends Lc{constructor(e,n,r){super(e,h7,"loadJSON",n,r)}},q2=class extends rl{constructor(e,n,r){super(e,h7),this.data=n,this.options=r}instantiateQuery(e){let{name:n,data:r,options:o}=this;return e.api.loadObjects(n,r,o.instantiate(e))}codegenQuery(e){let{name:n,data:r,options:o}=this,i=o?","+o.codegen(e):"",s=`[
|
|
61
61
|
`+r.map(a=>JSON.stringify(a)).join(`,
|
|
62
62
|
`)+`
|
|
63
|
-
]`;return`${e.ns()}loadObjects("${n}", ${s}${i})`}toJSON(){let{format:e,data:n,options:r}=this;return{type:e,data:n,...r.toJSON()}}};function
|
|
64
|
-
`)),c.undent(),d.push(`${c.tab()}]);`));let h=[];for(let[
|
|
65
|
-
`),"];"]);let
|
|
66
|
-
`)}var
|
|
63
|
+
]`;return`${e.ns()}loadObjects("${n}", ${s}${i})`}toJSON(){let{format:e,data:n,options:r}=this;return{type:e,data:n,...r.toJSON()}}};function z2(t){let e=t.config?.extensions,n=new Set(e?tl(e):[]);for(let r of Object.values(t.data))r.format===B2&&n.add("spatial");return n}async function zK(t,e){let{data:n,params:r,plotDefaults:o}=t,i=new Y2({plotDefaults:o,...e}),s=[],a=z2(t);s.push(...Array.from(a).map(c=>Jl(c)));for(let c of Object.values(n)){let f=c.instantiate(i);f&&s.push(f)}s.length>0&&await i.coordinator.exec(s);for(let[c,f]of Object.entries(r))if(!i.activeParams.has(c)){let u=f.instantiate(i);i.activeParams.set(c,u)}return{element:t.root.instantiate(i),params:i.activeParams}}var Y2=class{constructor({api:e=u7(),plotDefaults:n=[],params:r=new Map,baseURL:o=null}={}){this.api=e,this.plotDefaults=n,this.activeParams=r,this.baseURL=o,this.coordinator=e.context.coordinator}error(e,n){nl(e,n)}};function YK(t,e={}){let{root:n,data:r,params:o,plotDefaults:i}=t,{preamble:s,...a}=e,c=new U2({plotDefaults:i,...a}),f=[];for(let[y,b]of c.imports)f.push(oa(b)?`import ${b} from "${y}";`:`import { ${b.join(", ")} } from "${y}";`);let u=s?tl(s).map(y=>`${c.tab()}${y}`):[],p=[];if(c.connector){let y=`${c.ns()}${c.connector}Connector()`;p.push(`${c.tab()}${c.ns()}coordinator().databaseConnector(${y});`)}let l=[];for(let y of z2(t))l.push(`${c.ns()}loadExtension("${y}")`);for(let y of Object.values(r)){let b=y.codegen(c);b&&l.push(b)}let d=[];l.length&&(d.push(`${c.tab()}await ${c.ns()}coordinator().exec([`),c.indent(),d.push(l.map(y=>`${c.tab()}${y}`).join(`,
|
|
64
|
+
`)),c.undent(),d.push(`${c.tab()}]);`));let h=[];for(let[y,b]of Object.entries(o))h.push(`const ${Am(y)} = ${b.codegen(c)};`);let m=[],x=i;x.length&&(m=["const defaultAttributes = [",x.map(y=>" "+y.codegen(c)).join(`,
|
|
65
|
+
`),"];"]);let g=[`export default ${n.codegen(c)};`];return[...f,...ol(f),...u,...ol(u),...p,...ol(p),...d,...ol(d),...h,...ol(h),...m,...ol(m),...g].join(`
|
|
66
|
+
`)}var U2=class{constructor({plotDefaults:e=void 0,namespace:n="vg",connector:r=void 0,imports:o=new Map([["@uwdata/vgplot","* as vg"]]),baseURL:i=void 0,depth:s=0}={}){this.plotDefaults=e,this.namespace=`${n}.`,this.connector=r,this.imports=o,this.baseURL=i,this.depth=s}addImport(e,n){this.imports.has(e)?this.imports.get(e).push(n):this.imports.set(e,[n])}setImports(e,n){this.imports.set(e,n)}ns(){return this.namespace}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}stringify(e){if(Fr(e)){let n=e.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(el(e)){let n=Object.entries(e).map(([r,o])=>`${UK(r)}: ${this.stringify(o)}`);return`{${this.maybeLineWrap(n)}}`}else return JSON.stringify(e)}maybeLineWrap(e){let n=80-2*this.depth;if(2*e.length+e.reduce((o,i)=>o+i.length,0)>n){this.indent();let o=e.map(i=>`
|
|
67
67
|
${this.tab()}${i}`).join(",");return this.undent(),o+`
|
|
68
|
-
`+this.tab()}else return e.join(", ")}error(e,n){
|
|
68
|
+
`+this.tab()}else return e.join(", ")}error(e,n){nl(e,n)}};function UK(t){return/^[A-Za-z_$]\w*/.test(t)?t:JSON.stringify(t)}function ol(t){return t?.length?[""]:[]}var sa=class extends gt{constructor(e){super(N2),this.value=e}instantiate(){return this.value}codegen(e){return e.stringify(this.value)}toJSON(){return this.value}};function GF(t,e){let{select:n,include:r,...o}=t,i=Ze(o,e);return r&&(i.options.include=new m7(tl(r).map(s=>e.selectionRef(Mm(s))))),new Rc(n,i)}var Rc=class extends gt{constructor(e=k2,n=new ia({})){super(NF),this.select=e,this.options=n}instantiate(e){let{select:n,options:r}=this;return e.api.Selection[n](r.instantiate(e))}codegen(e){let{select:n,options:r}=this;return`${e.ns()}Selection.${n}(${r.codegen(e)})`}toJSON(){let{select:e,options:n}=this;return{select:e,...n.toJSON()}}},m7=class extends gt{constructor(e){super(RF),this.refs=e}instantiate(e){return this.refs.map(n=>n.instantiate(e))}codegen(e){return`[${this.refs.map(n=>n.codegen(e)).join(", ")}]`}toJSON(){return this.refs.map(e=>e.toJSON())}};var jK=new Set([C2,DF,OF,k2,$F]);function HF(t,e){let n=el(t)?t:{value:t},{select:r=C2,value:o,date:i}=n;return jK.has(r)||e.error(`Unrecognized param type: ${r}`,n),r!==C2?GF(t,e):Fr(o)?new Oc(o.map(s=>e.maybeParam(s))):new Oc(o,i)}var Oc=class extends gt{constructor(e,n){super(LF),this.value=e,this.date=n}instantiate(e){let{date:n,value:r}=this,{Param:o}=e.api;return Fr(r)?o.array(r.map(i=>i.instantiate(e))):o.value(zF(n,r))}codegen(e){let{value:n,date:r}=this,o=`${e.ns()}Param.`;return Fr(n)?`${o}array([${n.map(i=>i.codegen(e)).join(", ")}])`:r?`${o}value(new Date(${JSON.stringify(r)}))`:`${o}value(${JSON.stringify(n)})`}toJSON(){let{date:e,value:n}=this;return Fr(n)?n.map(r=>r.toJSON()):e?{date:e}:n}};var Tm=class extends gt{constructor(e){super(CF),this.name=e}instantiate(e){return e.activeParams?.get(this.name)}codegen(e){return Am(this.name)}toJSON(){return Am(this.name)}};function W2(t,e,n){return n.plot?.attributes?.has(t)||n.error(`Unrecognized attribute: ${t}`),new j2(t,e===_m?new X2:n.maybeParam(e))}var j2=class extends gt{constructor(e,n){super(qF),this.name=e,this.value=n}instantiate(e){let{name:n,value:r}=this;return e.api[n](r.instantiate(e))}codegen(e){let{name:n,value:r}=this;return`${e.tab()}${e.ns()}${n}(${r.codegen(e)})`}toJSON(){let{name:e,value:n}=this;return{[e]:n.toJSON()}}},X2=class extends gt{constructor(){super(N2),this.value=_m}instantiate(e){return e.api[_m]}codegen(e){return`${e.ns()}${_m}`}toJSON(){return this.value}};function QF(t,e){let n=t[Hu].map(r=>e.parseComponent(r));return new V2(n)}var V2=class extends gt{constructor(e){super(Hu,e)}instantiate(e){return e.api[Hu](this.children.map(n=>n.instantiate(e)))}codegen(e){e.indent();let n=this.children.map(r=>r.codegen(e));return e.undent(),`${e.tab()}${e.ns()}${this.type}(
|
|
69
69
|
${n.join(`,
|
|
70
70
|
`)}
|
|
71
|
-
${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function
|
|
71
|
+
${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function ZF(t){return new G2(t[Zu])}var G2=class extends gt{constructor(e){super(Zu),this.value=e}instantiate(e){return e.api[Zu](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function JF(t,e){let{[wm]:n,...r}=t;return e.inputs?.has(n)||e.error(`Unrecognized input type: ${n}`,t),new H2(n,Ze(r,e))}var H2=class extends gt{constructor(e,n){super(wm),this.name=e,this.options=n}instantiate(e){return e.api[this.name](this.options.instantiate(e))}codegen(e){let n=this.options.codegen(e);return`${e.tab()}${e.ns()}${this.name}(${n})`}toJSON(){let{type:e,name:n,options:r}=this;return{[e]:n,...r.toJSON()}}};function Z2(t,e){let{[vm]:n,...r}=t,o=`${n}Legend`;return e.plot?.legends?.has(o)||e.error(`Unrecognized legend type: ${n}`,t),new Q2(o,n,Ze(r,e))}var Q2=class extends gt{constructor(e,n,r){super(vm),this.key=e,this.name=n,this.options=r}instantiate(e){return e.api[this.key](this.options.instantiate(e))}codegen(e){let n=this.options.codegen(e);return`${e.tab()}${e.ns()}${this.key}(${n})`}toJSON(){let{type:e,name:n,options:r}=this;return{[e]:n,...r.toJSON()}}};function KF(t,e){let{[l7]:n,...r}=t;return e.plot?.interactors?.has(n)||e.error(`Unrecognized interactor type: ${n}`,t),new J2(n,Ze(r,e))}var J2=class extends gt{constructor(e,n){super(BF),this.name=e,this.options=n}instantiate(e){return e.api[this.name](this.options.instantiate(e))}codegen(e){let n=this.options.codegen(e);return`${e.tab()}${e.ns()}${this.name}(${n})`}toJSON(){let{name:e,options:n}=this;return{[l7]:e,...n.toJSON()}}};var K2=class extends gt{constructor(e){super(kF),this.param=e}instantiate(e){return e.api.column(this.param.instantiate(e))}codegen(e){return`${e.ns()}column(${this.param.codegen(e)})`}toJSON(){return`$${this.param.toJSON}`}};var XK=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\${1,2}\w+)/g;function tq(t,e){let n=t[kc],r=n.split(XK),o=[""],i=[];for(let s=0,a=0;s<r.length;++s){let c=r[s];c.startsWith("$")?(i[a]=c.startsWith("$$")?new K2(e.paramRef(c.slice(2))):e.maybeParam(c),o[++a]=""):o[a]+=c}return new tw(n,o,i)}var tw=class extends gt{constructor(e,n,r){super(FF),this.value=e,this.spans=n,this.params=r}instantiate(e){let{spans:n,params:r}=this,o=e.api[kc],i=r.map(s=>s.instantiate(e));return o(n,...i)}codegen(e){let{spans:n,params:r}=this,o="",i=r.length;for(let s=0;s<i;++s)o+=n[s]+"${"+r[s].codegen(e)+"}";return o+=n[i],`${e.ns()}${kc}\`${o}\``}toJSON(){return{[kc]:this.value}}};function eq(t,e){if(!t)return null;if(Fr(t))return new sa(t);let{from:n,...r}=t;return new ew(e.maybeParam(n),Ze(r,e))}var ew=class extends gt{constructor(e,n){super(p7),this.table=e,this.options=n}instantiate(e){let{table:n,options:r}=this;return e.api[p7](n.instantiate(e),r.instantiate(e))}codegen(e){let n=this.table.codegen(e),r=this.options.codegen(e);return`${e.ns()}${this.type}(${n}${r?", "+r:""})`}toJSON(){let{type:e,table:n,options:r}=this;return{[e]:n.toJSON(),...r.toJSON()}}};function nw(t,e){return t==null?[]:[t].flat().map(n=>e.maybeParam(n))}function nq(t,e){let n;for(let r in t)e.transforms.has(r)&&(n=r);if(n)if(n==="bin"){let{bin:r,...o}=t,[i]=nw(r,e);return new g7(n,i,Ze(o,e))}else{let r=n==="count"&&!t[n]?[]:nw(t[n],e),o={distinct:t.distinct,orderby:nw(t.orderby,e),partitionby:nw(t.partitionby,e),rows:t.rows?e.maybeParam(t.rows):null,range:t.range?e.maybeParam(t.range):null};return new rw(n,r,o)}}var rw=class extends gt{constructor(e,n,r){super(d7),this.name=e,this.args=n,this.options=r}instantiate(e){let{name:n,args:r,options:o}=this,{distinct:i,orderby:s,partitionby:a,rows:c,range:f}=o,u=e.api[n](...r.map(p=>p.instantiate(e)));return i&&(u=u.distinct()),s.length&&(u=u.orderby(s.map(p=>p.instantiate(e)))),a.length&&(u=u.partitionby(a.map(p=>p.instantiate(e)))),c!=null?u=u.rows(c.instantiate(e)):f!=null&&(u=u.range(f.instantiate(e))),u}codegen(e){let{name:n,args:r,options:o}=this,{distinct:i,orderby:s,partitionby:a,rows:c,range:f}=o,u=`${e.ns()}${n}(`+r.map(p=>p.codegen(e)).join(", ")+")";if(i&&(u+=".distinct()"),s.length){let p=s.map(l=>l.codegen(e));u+=`.orderby(${p.join(", ")})`}if(a.length){let p=a.map(l=>l.codegen(e));u+=`.partitionby(${p.join(", ")})`}return c?u+=`.rows(${c.codegen(e)})`:f&&(u+=`.range(${f.codegen(e)})`),u}toJSON(){let{name:e,args:n,options:r}=this,{distinct:o,orderby:i,partitionby:s,rows:a,range:c}=r,f={[e]:x7(n.map(u=>u.toJSON()))};return o&&(f.distinct=!0),i.length&&(f.orderby=x7(i.map(u=>u.toJSON()))),s.length&&(f.partitionby=x7(s.map(u=>u.toJSON()))),a?f.rows=a.toJSON():c&&(f.range=c.toJSON()),f}},g7=class extends gt{constructor(e,n,r){super(d7),this.name=e,this.arg=n,this.options=r}instantiate(e){let{name:n,arg:r,options:o}=this;return e.api[n](r.instantiate(e),o.instantiate(e))}codegen(e){let{name:n,arg:r,options:o}=this,i=o.codegen(e);return`${e.ns()}${n}(`+r.codegen(e)+(i?`, ${i}`:"")+")"}toJSON(){let{name:e,arg:n,options:r}=this;return{[e]:n.toJSON(),...r.toJSON()}}};function x7(t){return t.length===0?"":t.length===1?t[0]:t}function WK(t,e){if(el(t))return t[kc]?tq(t,e):nq(t,e)}function rq(t,e){let{mark:n,data:r,...o}=t;e.plot?.marks?.has(n)||e.error(`Unrecognized mark type: ${n}`,t);let i=eq(r,e),s={};for(let a in o){let c=o[a];s[a]=WK(c,e)||e.maybeParam(c)}return new ow(n,i,new ia(s))}var ow=class extends gt{constructor(e,n,r){super(L2),this.name=e,this.data=n,this.options=r}instantiate(e){let{name:n,data:r,options:o}=this,i=o.instantiate(e);return r?e.api[n](r.instantiate(e),i):e.api[n](i)}codegen(e){let{name:n,data:r,options:o}=this,i=r?r.codegen(e):"",s=o.codegen(e),a;if(i&&s){e.indent();let c=o.codegen(e);a=`
|
|
72
72
|
${e.tab()}${i},
|
|
73
73
|
${e.tab()}${c}
|
|
74
|
-
`,e.undent(),a+=e.tab()}else a=`${i}${s}`;return`${e.tab()}${e.ns()}${n}(${a})`}toJSON(){let{type:e,name:n,data:r,options:o}=this;return{[e]:n,...r?{data:r.toJSON()}:{},...o.toJSON()}}};function
|
|
74
|
+
`,e.undent(),a+=e.tab()}else a=`${i}${s}`;return`${e.tab()}${e.ns()}${n}(${a})`}toJSON(){let{type:e,name:n,data:r,options:o}=this;return{[e]:n,...r?{data:r.toJSON()}:{},...o.toJSON()}}};function oq(t,e){return y7({plot:[t]},e)}function y7(t,e){let{[Ku]:n,...r}=t,o=Object.entries(r).map(([s,a])=>W2(s,a,e)),i=n.map(s=>oa(s.mark)?rq(s,e):oa(s.legend)?Z2(s,e):oa(s.select)?KF(s,e):e.error("Invalid plot entry.",s));return new iw(i,o)}var iw=class extends gt{constructor(e,n){super(Ku,e),this.attributes=n}instantiate(e){let n=[...e.plotDefaults||[],...this.attributes||[]];return e.api[Ku](this.children.map(r=>r.instantiate(e)),n.map(r=>r.instantiate(e)))}codegen(e){let{type:n,children:r,attributes:o}=this;e.indent();let i=[...r.map(s=>s.codegen(e)),...e.plotDefaults?.length?[`${e.tab()}...defaultAttributes`]:[],...o.map(s=>s.codegen(e))].join(`,
|
|
75
75
|
`);return e.undent(),`${e.tab()}${e.ns()}${n}(
|
|
76
76
|
${i}
|
|
77
|
-
${e.tab()})`}toJSON(){let{type:e,children:n,attributes:r}=this,o={[e]:n.map(i=>i.toJSON())};for(let i of r)Object.assign(o,i.toJSON());return o}};function
|
|
77
|
+
${e.tab()})`}toJSON(){let{type:e,children:n,attributes:r}=this,o={[e]:n.map(i=>i.toJSON())};for(let i of r)Object.assign(o,i.toJSON());return o}};function iq(t,e){let n=t[Qu].map(r=>e.parseComponent(r));return new sw(n)}var sw=class extends gt{constructor(e){super(Qu,e)}instantiate(e){return e.api[Qu](this.children.map(n=>n.instantiate(e)))}codegen(e){e.indent();let n=this.children.map(r=>r.codegen(e));return e.undent(),`${e.tab()}${e.ns()}${this.type}(
|
|
78
78
|
${n.join(`,
|
|
79
79
|
`)}
|
|
80
|
-
${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function
|
|
80
|
+
${e.tab()})`}toJSON(){return{[this.type]:this.children.map(e=>e.toJSON())}}};function sq(t){return new aw(t[Ju])}var aw=class extends gt{constructor(e){super(Ju),this.value=e}instantiate(e){return e.api[Ju](this.value)}codegen(e){return`${e.tab()}${e.ns()}${this.type}(${e.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}};function aq(t=[]){return new Map([[Ku,y7],[L2,oq],[vm,Z2],[wm,JF],[Hu,QF],[Qu,iq],[Zu,ZF],[Ju,sq],...t])}function cq(t=[]){return new Set(["menu","search","slider","table",...t])}function fq({attributes:t=VK(),interactors:e=GK(),legends:n=HK(),marks:r=QK()}={}){return{attributes:t,interactors:e,legends:n,marks:r}}function VK(t=[]){return new Set([...Object.keys(M2),...t])}function GK(t=[]){return new Set([...Object.keys(E2),...t])}function HK(t=[]){return new Set([...Object.keys(I2),...t])}function QK(t=[]){return new Set([...Object.keys(T2),...t])}function uq(t=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","column","count","covariance","covarPop","dateMonth","dateMonthDay","dateDay","first","geojson","last","max","median","min","mode","product","quantile","stddev","stddevPop","sum","variance","varPop","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value",...t])}function ZK(t,e){return new b7(e).parse(t)}var b7=class{constructor({components:e=aq(),transforms:n=uq(),inputs:r=cq(),plot:o=fq(),params:i=[],datasets:s=[]}={}){this.components=e,this.transforms=n,this.inputs=r,this.plot=o,this.params=new Map(i),this.datasets=new Map(s)}parse(e){let{meta:n,config:r,data:o={},params:i,plotDefaults:s={},...a}=e;for(let c in o)this.datasets.set(c,VF(c,o[c],this));this.plotDefaults=Object.entries(s).map(([c,f])=>W2(c,f,this));for(let c in i)this.params.set(c,HF(i[c],this));return new Sm(this.parseComponent(a),n?{...n}:void 0,r?{...r}:void 0,Object.fromEntries(this.datasets),Object.fromEntries(this.params),this.plotDefaults)}parseComponent(e){for(let[n,r]of this.components)if(e[n]!=null)return r(e,this);this.error("Invalid specification.",e)}maybeParam(e){let n=Mm(e);return n?this.paramRef(n):new sa(e)}maybeSelection(e){let n=Mm(e);return n?this.selectionRef(n):new sa(e)}paramRef(e,n=()=>new Oc){let{params:r}=this;if(!e)return null;let o=r.get(e);return o||(o=n(),r.set(e,o)),new Tm(e)}selectionRef(e,n=!1){let r=this.params.get(e);return n&&r&&!(r instanceof Rc)?null:this.paramRef(e,()=>new Rc)}error(e,n){nl(e,n)}};export{gt as ASTNode,qF as ATTRIBUTE,kF as COLUMPARAMREF,OF as CROSSFILTER,P2 as CSVDataNode,U2 as CodegenContext,PF as DATA,vjt as DATAREF,R2 as DataNode,FF as EXPRESSION,tw as ExpressionNode,_m as FIXED,p7 as FROM,Lc as FileDataNode,Hu as HCONCAT,V2 as HConcatNode,Zu as HSPACE,G2 as HSpaceNode,RF as INCLUDE,wm as INPUT,BF as INTERACTOR,k2 as INTERSECT,H2 as InputNode,Y2 as InstantiateContext,F2 as JSONDataNode,vm as LEGEND,N2 as LITERAL,q2 as LiteralJSONDataNode,sa as LiteralNode,L2 as MARK,IF as OPTIONS,ia as OptionsNode,LF as PARAM,CF as PARAMREF,Ku as PLOT,Oc as ParamNode,Tm as ParamRefNode,D2 as ParquetDataNode,j2 as PlotAttributeNode,X2 as PlotFixedNode,ew as PlotFromNode,J2 as PlotInteractorNode,Q2 as PlotLegendNode,ow as PlotMarkNode,iw as PlotNode,rl as QueryDataNode,l7 as SELECT,NF as SELECTION,DF as SINGLE,EF as SPEC,kc as SQL,Rc as SelectionNode,$2 as SpatialDataNode,Sm as SpecNode,d7 as TRANSFORM,O2 as TableDataNode,rw as TransformNode,$F as UNION,C2 as VALUE,Qu as VCONCAT,sw as VConcatNode,Ju as VSPACE,aw as VSpaceNode,zK as astToDOM,YK as astToESM,ZK as parseSpec};
|