/** * Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1. * Original file: /npm/@observablehq/plot@0.6.17/src/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ import{descending as We,ascending as lr,timeSecond as Za,timeMinute as Ua,timeHour as Ka,timeDay as Qa,timeMonday as Jd,timeTuesday as th,timeWednesday as eh,timeThursday as nh,timeFriday as rh,timeSaturday as ih,timeSunday as oh,timeWeek as ah,timeMonth as Ja,timeYear as tu,utcSecond as eu,utcMinute as nu,utcHour as ru,unixDay as iu,utcMonday as uh,utcTuesday as sh,utcWednesday as lh,utcThursday as ch,utcFriday as fh,utcSaturday as dh,utcSunday as hh,utcWeek as mh,utcMonth as ou,utcYear as au,max as kt,pairs as yh,timeFormat as ph,utcFormat as Si,bisector as gh,range as vn,quantile as $n,symbolAsterisk as bh,symbolCircle as ki,symbolCross as wh,symbolDiamond as xh,symbolDiamond2 as vh,symbolPlus as $h,symbolSquare as Mh,symbolSquare2 as Ah,symbolStar as Ch,symbolTimes as Sh,symbolTriangle as kh,symbolTriangle2 as Lh,symbolWye as Eh,randomLcg as Li,sort as uu,rollup as Mn,sum as jt,InternSet as An,group as Te,mode as su,variance as lu,median as Cn,mean as cr,maxIndex as Th,minIndex as zh,min as It,deviation as fr,rollups as Nh,quantize as Ot,schemeAccent as Ih,schemeCategory10 as Rh,schemeDark2 as Bh,schemeObservable10 as Oh,schemePaired as Fh,schemePastel1 as Dh,schemePastel2 as Yh,schemeSet1 as Gh,schemeSet2 as jh,schemeSet3 as qh,schemeTableau10 as Ph,interpolateBrBG as cu,interpolatePRGn as fu,interpolatePiYG as du,interpolatePuOr as hu,interpolateRdBu as dr,interpolateRdGy as mu,interpolateRdYlBu as hr,interpolateRdYlGn as yu,interpolateSpectral as pu,interpolateBlues as gu,interpolateGreens as bu,interpolateGreys as wu,interpolatePurples as xu,interpolateReds as vu,interpolateOranges as $u,interpolateTurbo as Mu,interpolateViridis as Au,interpolateMagma as Cu,interpolateInferno as Su,interpolatePlasma as ku,interpolateCividis as Lu,interpolateCubehelixDefault as Eu,interpolateWarm as Tu,interpolateCool as zu,interpolateBuGn as Nu,interpolateBuPu as Iu,interpolateGnBu as Ru,interpolateOrRd as Bu,interpolatePuBuGn as Ou,interpolatePuBu as Fu,interpolatePuRd as Du,interpolateRdPu as Yu,interpolateYlGnBu as Gu,interpolateYlGn as ju,interpolateYlOrBr as qu,interpolateYlOrRd as Pu,interpolateRainbow as Wu,interpolateSinebow as Xu,schemeBrBG as Wh,schemePRGn as Xh,schemePiYG as _h,schemePuOr as Vh,schemeRdBu as _u,schemeRdGy as Hh,schemeRdYlBu as Vu,schemeRdYlGn as Zh,schemeSpectral as Uh,schemeBlues as Kh,schemeGreens as Qh,schemeGreys as Jh,schemeOranges as tm,schemePurples as em,schemeReds as nm,schemeBuGn as rm,schemeBuPu as im,schemeGnBu as om,schemeOrRd as am,schemePuBu as um,schemePuBuGn as sm,schemePuRd as lm,schemeRdPu as cm,schemeYlGn as fm,schemeYlGnBu as dm,schemeYlOrBr as hm,schemeYlOrRd as mm,scaleIdentity as ym,scaleSymlog as pm,scaleLog as gm,scalePow as bm,extent as gt,ticks as Ei,interpolateNumber as Sn,scaleQuantile as wm,reverse as mr,scaleThreshold as xm,scaleLinear as Hu,interpolateRgb as Ti,interpolateRound as vm,piecewise as zi,interpolateHsl as $m,interpolateHcl as Mm,interpolateLab as Am,scaleDivergingSymlog as Cm,scaleDivergingLog as Sm,scaleDivergingPow as km,scaleDiverging as Lm,scaleTime as Em,scaleUtc as Tm,scaleBand as Zu,scalePoint as zm,scaleImplicit as Nm,scaleOrdinal as Im,symbolsStroke as Rm,symbolsFill as Bm,InternMap as Ni,cross as Om,geoTransform as yr,geoPath as kn,geoStream as Fm,geoClipRectangle as Dm,geoTransverseMercator as Ym,geoStereographic as Gm,geoOrthographic as jm,geoMercator as qm,geoGnomonic as Pm,geoEquirectangular as Wm,geoEqualEarth as Xm,geoConicEquidistant as _m,geoConicEqualArea as Vm,geoConicConformal as Hm,geoAzimuthalEquidistant as Zm,geoAzimuthalEqualArea as Um,geoAlbers as Km,geoAlbersUsa as Qm,select as Kt,creator as Uu,namespaces as ze,pointer as Jm,format as Ii,axisBottom as ty,pathRound as Qt,rgb as Ln,cumsum as ey,groupSort as Ri,greatest as Bi,curveLinear as Oi,curveBasis as ny,curveBasisClosed as ry,curveBasisOpen as iy,curveBundle as oy,curveBumpX as ay,curveBumpY as uy,curveCardinal as sy,curveCardinalClosed as ly,curveCardinalOpen as cy,curveCatmullRom as fy,curveCatmullRomClosed as dy,curveCatmullRomOpen as hy,curveLinearClosed as my,curveMonotoneX as yy,curveMonotoneY as py,curveNatural as gy,curveStep as by,curveStepAfter as wy,curveStepBefore as xy,thresholdSturges as Ku,thresholdScott as Qu,thresholdFreedmanDiaconis as vy,utcTickInterval as $y,tickIncrement as My,bisect as Ay,area as Fi,line as Cy,rank as Ju,count as Sy,blurImage as ky,Delaunay as Xe,blur2 as Ly,contours as Ey,nice as Ty,contourDensity as zy,geoCentroid as Ny,geoGraticule10 as Iy,stratify as ts,tree as pr,cluster as es,least as Ry}from"../../d3@7.9.0/080cf928.js";import{parse as ns,format as By}from"../../isoformat@0.2.1/604cb63b.js";import Oy from"../../interval-tree-1d@1.0.4/f53f17b2.js";function wt(t){return t!=null&&!Number.isNaN(t)}function Rt(t,e){return+wt(e)-+wt(t)||lr(t,e)}function gr(t,e){return+wt(e)-+wt(t)||We(t,e)}function Di(t){return t!=null&&`${t}`!=""}function br(t){return isFinite(t)?t:NaN}function Jt(t){return t>0&&isFinite(t)?t:NaN}function wr(t){return t<0&&isFinite(t)?t:NaN}function _e(t){if(t==null)return;const e=t[0],n=t[t.length-1];return We(e,n)}const Ve=1e3,de=Ve*60,he=de*60,qt=he*24,Pt=qt*7,Ne=qt*30,me=qt*365,Yi=[["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",Ve],["5 seconds",5*Ve],["15 seconds",15*Ve],["30 seconds",30*Ve],["minute",de],["5 minutes",5*de],["15 minutes",15*de],["30 minutes",30*de],["hour",he],["3 hours",3*he],["6 hours",6*he],["12 hours",12*he],["day",qt],["2 days",2*qt],["week",Pt],["2 weeks",2*Pt],["month",Ne],["3 months",3*Ne],["6 months",6*Ne],["year",me],["2 years",2*me],["5 years",5*me],["10 years",10*me],["20 years",20*me],["50 years",50*me],["100 years",100*me]],Gi=new Map([["second",Ve],["minute",de],["hour",he],["day",qt],["monday",Pt],["tuesday",Pt],["wednesday",Pt],["thursday",Pt],["friday",Pt],["saturday",Pt],["sunday",Pt],["week",Pt],["month",Ne],["year",me]]),rs=new Map([["second",Za],["minute",Ua],["hour",Ka],["day",Qa],["monday",Jd],["tuesday",th],["wednesday",eh],["thursday",nh],["friday",rh],["saturday",ih],["sunday",oh],["week",ah],["month",Ja],["year",tu]]),ji=new Map([["second",eu],["minute",nu],["hour",ru],["day",iu],["monday",uh],["tuesday",sh],["wednesday",lh],["thursday",ch],["friday",fh],["saturday",dh],["sunday",hh],["week",mh],["month",ou],["year",au]]),En=Symbol("intervalDuration"),xr=Symbol("intervalType");for(const[t,e]of rs)e[En]=Gi.get(t),e[xr]="time";for(const[t,e]of ji)e[En]=Gi.get(t),e[xr]="utc";const Tn=[["year",au,"utc"],["month",ou,"utc"],["day",iu,"utc",6*Ne],["hour",ru,"utc",3*qt],["minute",nu,"utc",6*he],["second",eu,"utc",30*de]],vr=[["year",tu,"time"],["month",Ja,"time"],["day",Qa,"time",6*Ne],["hour",Ka,"time",3*qt],["minute",Ua,"time",6*he],["second",Za,"time",30*de]],Fy=[Tn[0],vr[0],Tn[1],vr[1],Tn[2],vr[2],...Tn.slice(3)];function qi(t){let e=`${t}`.toLowerCase();e.endsWith("s")&&(e=e.slice(0,-1));let n=1;const 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 i=ji.get(e);if(!i)throw new Error(`unknown interval: ${t}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${e}`);return[e,n]}function Pi(t){return is(qi(t),"time")}function $r(t){return is(qi(t),"utc")}function is([t,e],n){let r=(n==="time"?rs:ji).get(t);return e>1&&(r=r.every(e),r[En]=Gi.get(t)*e,r[xr]=n),r}function os(t,e){if(!(e>1))return;const n=t[En];if(!Yi.some(([,i])=>i===n)||n%qt===0&&qtMath.log(i)).center(Yi,Math.log(n*e))];return(t[xr]==="time"?Pi:$r)(r)}function as(t,e,n){const r=e==="time"?ph:Si;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");const i=Dy(n);switch(t){case"millisecond":return He(r(".%L"),r(":%M:%S"),i);case"second":return He(r(":%S"),r("%-I:%M"),i);case"minute":return He(r("%-I:%M"),r("%p"),i);case"hour":return He(r("%-I %p"),r("%b %-d"),i);case"day":return He(r("%-d"),r("%b"),i);case"month":return He(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function Dy(t){return t==="left"||t==="right"?(e,n)=>` ${e} ${n}`:t==="top"?(e,n)=>`${n} ${e}`:(e,n)=>`${e} ${n}`}function Yy(t){return t==="time"?vr:t==="utc"?Tn:Fy}function Gy(t,e,n){const r=kt(yh(e,(i,o)=>Math.abs(o-i)));if(r<1e3)return as("millisecond","utc",n);for(const[i,o,a,u]of Yy(t)){if(r>u||i==="hour"&&!r)break;if(e.every(s=>o.floor(s)>=s))return as(i,a,n)}}function He(t,e,n){return(r,i,o)=>{const a=t(r,i),u=e(r,i),s=i-_e(o);return i!==s&&o[s]!==void 0&&u===e(o[s],s)?a:n(a,u)}}const Mr=Object.getPrototypeOf(Uint8Array),jy=Object.prototype.toString;function te(t){return t instanceof Array||t instanceof Mr}function us(t){return t instanceof Mr&&!qy(t)}function ss(t){return t?.prototype instanceof Mr&&!Py(t)}function qy(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function Py(t){return t===BigInt64Array||t===BigUint64Array}const ls=Symbol("reindex");function H(t,e,n){const r=typeof e;return r==="string"?Cs(t)?Xi(t.getChild(e),n):cs(t,ds(e),n):r==="function"?cs(t,e,n):r==="number"||e instanceof Date||r==="boolean"?J(t,vt(e),n):typeof e?.transform=="function"?Wi(e.transform(t),n):Wy(Wi(e,n),t?.[ls])}function Wy(t,e){return t!=null&&e?Cr(t,e):t}function cs(t,e,n){return J(t,ss(n)?(r,i)=>Hi(e(r,i)):e,n)}function Wi(t,e){return e===void 0?ye(t):Ss(t)?Xi(t,e):t instanceof e?t:e.from(t,ss(e)&&!us(t)?Hi:void 0)}function Xi(t,e){return t==null?t:(e===void 0||e===Array)&&ip(t.type)?hs(fs(t)):Wi(fs(t),e)}function fs(t){return t.nullCount?t.toJSON():t.toArray()}const zn=[null],ds=t=>e=>{const n=e[t];return n===void 0&&e.type==="Feature"?e.properties?.[t]:n},mt={transform:ee},j={transform:t=>t},_i=()=>1,Xy=()=>!0,xt=t=>t==null?t:`${t}`,rt=t=>t==null?t:+t,Ar=t=>t?t[0]:void 0,Nn=t=>t?t[1]:void 0,_y=t=>t?t[2]:void 0,vt=t=>()=>t;function Vi(t){const e=+`${t}`.slice(1)/100;return(n,r)=>$n(n,e,r)}function Lt(t){return us(t)?t:J(t,Hi,Float64Array)}function Hi(t){return t==null?NaN:Number(t)}function hs(t){return J(t,ms)}function ms(t){return t instanceof Date&&!isNaN(t)?t:typeof t=="string"?ns(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function Ct(t,e){return t===void 0&&(t=e),t===null?[void 0,"none"]:Bn(t)?[void 0,t]:[t,void 0]}function dt(t,e){return t===void 0&&(t=e),t===null||typeof t=="number"?[void 0,t]:[t,void 0]}function ys(t,e,n){if(t!=null)return Tt(t,e,n)}function Tt(t,e,n){const r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function Ze(t){return Cs(t)?t:ye(t)}function ye(t){if(t==null||te(t))return t;if(Ss(t))return Xi(t);if(ps(t))switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;default:return[t]}return Array.from(t)}function ps(t){switch(t?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function J(t,e,n=Array){return t==null?t:t instanceof n?t.map(e):n.from(t,e)}function In(t,e=Array){return t instanceof e?t.slice():e.from(t)}function gs({x:t,x1:e,x2:n}){return t!==void 0||e!==void 0||n!==void 0}function bs({y:t,y1:e,y2:n}){return t!==void 0||e!==void 0||n!==void 0}function Ue(t){return gs(t)||bs(t)||t.interval!==void 0}function zt(t){return t?.toString===jy}function Ie(t){return zt(t)&&(t.type!==void 0||t.domain!==void 0)}function Wt(t){return zt(t)&&typeof t.transform!="function"}function pe(t){return Wt(t)&&t.value===void 0&&t.channel===void 0}function ws(t,e,n,r=j){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 Ft(t,e){return t===void 0&&e===void 0?[Ar,Nn]:[t,e]}function ge({z:t,fill:e,stroke:n}={}){return t===void 0&&([t]=Ct(e)),t===void 0&&([t]=Ct(n)),t}function Rn(t){return te(t)?t.length:t?.numRows}function ee(t){const e=Rn(t),n=new Uint32Array(e);for(let r=0;rt[n],t.constructor):J(e,n=>t.at(n))}function Zi(t){return t.length===1?(e,n)=>t(Cr(n,e)):t}function Re(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function ne(t){return t!==null&&typeof t=="object"?t.valueOf():t}function xs(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 Nt(t){let e;return[{transform:()=>e,label:Xt(t)},n=>e=n]}function Et(t){return t==null?[t]:Nt(t)}function Xt(t,e){return typeof t=="string"?t:t&&t.label!==void 0?t.label:e}function Sr(t,e){return{transform(n){const r=t.transform(n),i=e.transform(n);return St(r)||St(i)?J(r,(o,a)=>new Date((+r[a]+ +i[a])/2)):J(r,(o,a)=>(+r[a]+ +i[a])/2,Float64Array)},label:t.label}}function kr(t,e){const n=vs(e?.interval,e?.type);return n?J(t,n):t}function vs(t,e){const n=Lr(t,e);return n&&(r=>wt(r)?n.floor(r):r)}function Lr(t,e){if(t!=null){if(typeof t=="number")return $s(t);if(typeof t=="string")return(e==="time"?Pi:$r)(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 $s(t){t=+t,0Math.floor(n*e)/e,offset:(n,r=1)=>(n*e+Math.floor(r))/e,range:(n,r)=>vn(Math.ceil(n*e),r*e).map(i=>i/e)}:{floor:n=>Math.floor(n/e)*e,offset:(n,r=1)=>n+e*Math.floor(r),range:(n,r)=>vn(Math.ceil(n/e),r/e).map(i=>i*e)}}function Ke(t,e){if(t=Lr(t,e),t&&typeof t.range!="function")throw new Error("invalid interval: missing range method");return t}function Vy(t,e){if(t=Ke(t,e),t&&typeof t.ceil!="function")throw new Error("invalid interval: missing ceil method");return t}function Hy(t){return Qe(t)&&typeof t?.floor=="function"&&t.floor()instanceof Date}function Qe(t){return typeof t?.range=="function"}function Je(t){return t===void 0||Wt(t)?t:{value:t}}function Zy(t){return t==null?null:{transform:e=>H(e,t,Float64Array),label:Xt(t)}}function Uy(t){if(!re(t))return!1;for(const e of t)if(e!=null)return typeof e=="object"&&"0"in e&&"1"in e}function re(t){return t&&typeof t[Symbol.iterator]=="function"}function Ms(t){for(const e of t)if(e!=null)return typeof e!="object"||e instanceof Date}function ct(t){for(const e of t){if(e==null)continue;const n=typeof e;return n==="string"||n==="boolean"}}function St(t){for(const e of t)if(e!=null)return e instanceof Date}function Ky(t){for(const e of t)if(e!=null)return typeof e=="string"&&isNaN(e)&&ns(e)}function Qy(t){for(const e of t)if(e!=null){if(typeof e!="string")return!1;if(e.trim())return!isNaN(e)}}function tn(t){for(const e of t)if(e!=null)return typeof e=="number"}function Ui(t,e){let n;for(const r of t)if(r!=null){if(!e(r))return!1;n=!0}return n}const Jy=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 Bn(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)||Jy.has(t))}function tp(t){return typeof t=="number"&&(0<=t&&t<=1||isNaN(t))}function ut(t){return t==null||en(t)}function en(t){return/^\s*none\s*$/i.test(t)}function ep(t){return/^\s*round\s*$/i.test(t)}function Ki(t,e){return ys(t,e,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function On(t="middle"){return Ki(t,"frameAnchor")}function np(t={},...e){let n=t;for(const r of e)for(const i in r)if(n[i]===void 0){const o=r[i];n===t?n={...n,[i]:o}:n[i]=o}return n}function rp(t){console.warn("named iterables are deprecated; please use an object instead");const e=new Set;return Object.fromEntries(Array.from(t,n=>{const{name:r}=n;if(r==null)throw new Error("missing name");const i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(e.has(i))throw new Error(`duplicate name: ${i}`);return e.add(i),[r,n]}))}function Qi(t){return re(t)?rp(t):t}function As(t){return t===!0?t="frame":t===!1?t=null:!ps(t)&&t!=null&&(t=Tt(t,"clip",["frame","sphere"]),t==="sphere"&&(t={type:"Sphere"})),t}function Cs(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}function Ss(t){return t&&typeof t.toArray=="function"&&t.type}function ip(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}const _t=Symbol("position"),ie=Symbol("color"),Fn=Symbol("radius"),Dn=Symbol("length"),Yn=Symbol("opacity"),Er=Symbol("symbol"),ks=Symbol("projection"),st=new Map([["x",_t],["y",_t],["fx",_t],["fy",_t],["r",Fn],["color",ie],["opacity",Yn],["symbol",Er],["length",Dn],["projection",ks]]);function op(t){return t===_t||t===ks}function ap(t){return t===_t||t===Fn||t===Dn||t===Yn}const Ls=Math.sqrt(3),Es=2/Ls,up={draw(t,e){const n=Math.sqrt(e/Math.PI),r=n*Es,i=r/2;t.moveTo(0,r),t.lineTo(n,i),t.lineTo(n,-i),t.lineTo(0,-r),t.lineTo(-n,-i),t.lineTo(-n,i),t.closePath()}},Ji=new Map([["asterisk",bh],["circle",ki],["cross",wh],["diamond",xh],["diamond2",vh],["hexagon",up],["plus",$h],["square",Mh],["square2",Ah],["star",Ch],["times",Sh],["triangle",kh],["triangle2",Lh],["wye",Eh]]);function to(t){return t&&typeof t.draw=="function"}function sp(t){return to(t)?!0:typeof t!="string"?!1:Ji.has(t.toLowerCase())}function eo(t){if(t==null||to(t))return t;const e=Ji.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function lp(t){if(t==null||to(t))return[void 0,t];if(typeof t=="string"){const e=Ji.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}function Dt({filter:t,sort:e,reverse:n,transform:r,initializer:i,...o}={},a){if(r===void 0&&(t!=null&&(r=io(t)),e!=null&&!pe(e)&&(r=no(r,ao(e))),n&&(r=no(r,oo))),a!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(e===null||pe(e))&&{sort:e},transform:no(r,a)}}function At({filter:t,sort:e,reverse:n,initializer:r,...i}={},o){return r===void 0&&(t!=null&&(r=io(t)),e!=null&&!pe(e)&&(r=ro(r,ao(e))),n&&(r=ro(r,oo))),{...i,...(e===null||pe(e))&&{sort:e},initializer:ro(r,o)}}function no(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,i){return{data:n,facets:r}=t.call(this,n,r,i),e.call(this,Ze(n),r,i)}}function ro(t,e){return t==null?e===null?void 0:e:e==null?t===null?void 0:t:function(n,r,i,...o){let a,u,s,l,c,f;return{data:u=n,facets:s=r,channels:a}=t.call(this,n,r,i,...o),{data:c=u,facets:f=s,channels:l}=e.call(this,u,s,{...i,...a},...o),{data:c,facets:f,channels:{...a,...l}}}}function Tr(t,e){return(t.initializer!=null?At:Dt)(t,e)}function cp(t,e){return Tr(e,io(t))}function io(t){return(e,n)=>{const r=H(e,t);return{data:e,facets:n.map(i=>i.filter(o=>r[o]))}}}function fp({sort:t,...e}={}){return{...Tr(e,oo),sort:pe(t)?t:null}}function oo(t,e){return{data:t,facets:e.map(n=>n.slice().reverse())}}function dp({seed:t,sort:e,...n}={}){return{...Tr(n,zs(t==null?Math.random:Li(t))),sort:pe(e)?e:null}}function Ts(t,{sort:e,...n}={}){return{...(Wt(t)&&t.channel!==void 0?At:Tr)(n,ao(t)),sort:pe(e)?e:null}}function ao(t){return(typeof t=="function"&&t.length!==1?hp:zs)(t)}function hp(t){return(e,n)=>{const r=te(e)?(i,o)=>t(e[i],e[o]):(i,o)=>t(e.get(i),e.get(o));return{data:e,facets:n.map(i=>i.slice().sort(r))}}}function zs(t){let e,n;({channel:e,value:t,order:n}={...Je(t)});const r=e?.startsWith("-");if(r&&(e=e.slice(1)),n===void 0&&(n=r?gr:Rt),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=Rt;break;case"descending":n=gr;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,a)=>{let u;if(e===void 0)u=H(i,t);else{if(a===void 0)throw new Error("channel sort requires an initializer");if(u=a[e],!u)return{};u=u.value}const s=(l,c)=>n(u[l],u[c]);return{data:i,facets:o.map(l=>l.slice().sort(s))}}}function uo(t,e){return zr(null,null,t,e)}function Gn(t={y:"count"},e={}){const{x:n=j}=e;if(n==null)throw new Error("missing channel: x");return zr(n,null,t,e)}function jn(t={x:"count"},e={}){const{y:n=j}=e;if(n==null)throw new Error("missing channel: y");return zr(null,n,t,e)}function so(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=Ft(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return zr(n,r,t,e)}function zr(t,e,{data:n=ho,filter:r,sort:i,reverse:o,...a}={},u={}){a=Is(a,u),n=Os(n,j),i=i==null?void 0:Rs("sort",i,u),r=r==null?void 0:Bs("filter",r,u);const[s,l]=Et(t),[c,f]=Et(e),{z:d,fill:h,stroke:m,x1:y,x2:w,y1:p,y2:g,...v}=u,[b,M]=Et(d),[x]=Ct(h),[$]=Ct(m),[A,C]=Et(x),[S,E]=Et($);return{..."z"in u&&{z:b||d},..."fill"in u&&{fill:A||h},..."stroke"in u&&{stroke:S||m},...Dt(v,(k,T,L)=>{const z=kr(H(k,t),L?.x),N=kr(H(k,e),L?.y),I=H(k,d),G=H(k,x),R=H(k,$),B=fo(a,{z:I,fill:G,stroke:R}),F=[],D=[],Y=z&&l([]),_=N&&f([]),V=I&&M([]),W=G&&C([]),O=R&&E([]);let P=0;for(const X of a)X.initialize(k);i&&i.initialize(k),r&&r.initialize(k);for(const X of T){const U=[];for(const K of a)K.scope("facet",X);i&&i.scope("facet",X),r&&r.scope("facet",X);for(const[K,nt]of Be(X,B))for(const[ft,at]of Be(nt,N))for(const[ht,pt]of Be(at,z)){const Mt={data:k};if(z&&(Mt.x=ht),N&&(Mt.y=ft),B&&(Mt.z=K),!(r&&!r.reduce(pt,Mt))){U.push(P++),D.push(n.reduceIndex(pt,k,Mt)),z&&Y.push(ht),N&&_.push(ft),I&&V.push(B===I?K:I[pt[0]]),G&&W.push(B===G?K:G[pt[0]]),R&&O.push(B===R?K:R[pt[0]]);for(const Le of a)Le.reduce(pt,Mt);i&&i.reduce(pt,Mt)}}F.push(U)}return Fs(F,i,o),{data:D,facets:F}}),...!be(a,"x")&&(s?{x:s}:{x1:y,x2:w}),...!be(a,"y")&&(c?{y:c}:{y1:p,y2:g}),...Object.fromEntries(a.map(({name:k,output:T})=>[k,T]))}}function be(t,...e){for(const{name:n}of t)if(e.includes(n))return!0;return!1}function Ns(t,e,n=lo){const r=Object.entries(t);return e.title!=null&&t.title===void 0&&r.push(["title",wp]),e.href!=null&&t.href===void 0&&r.push(["href",mo]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?mp(i):n(i,o,e))}function lo(t,e,n,r=co){let i;zt(e)&&"reduce"in e&&(i=e.scale,e=e.reduce);const o=r(t,e,n),[a,u]=Nt(o.label);let s;return{name:t,output:i===void 0?a:{value:a,scale:i},initialize(l){o.initialize(l),s=u([])},scope(l,c){o.scope(l,c)},reduce(l,c){s.push(o.reduce(l,c))}}}function mp(t){return{name:t,initialize(){},scope(){},reduce(){}}}function co(t,e,n,r=Nr){const i=xs(t,n),o=r(e,i);let a,u;return{label:Xt(o===Ir?null:i,o.label),initialize(s){a=i===void 0?s:H(s,i),o.scope==="data"&&(u=o.reduceIndex(ee(s),a))},scope(s,l){o.scope===s&&(u=o.reduceIndex(l,a))},reduce(s,l){return o.scope==null?o.reduceIndex(s,a,l):o.reduceIndex(s,a,u,l)}}}function Be(t,e){return e?Te(t,n=>e[n]):[[,t]]}function Nr(t,e,n=yp){if(t==null)return n(t);if(typeof t.reduceIndex=="function")return t;if(typeof t.reduce=="function"&&zt(t))return gp(t);if(typeof t=="function")return bp(t);if(/^p\d{2}$/i.test(t))return oe(Vi(t));switch(`${t}`.toLowerCase()){case"first":return mo;case"last":return xp;case"identity":return ho;case"count":return Ir;case"distinct":return vp;case"sum":return e==null?Ir:$p;case"proportion":return Ys(e,"data");case"proportion-facet":return Ys(e,"facet");case"deviation":return oe(fr);case"min":return oe(It);case"min-index":return oe(zh);case"max":return oe(kt);case"max-index":return oe(Th);case"mean":return Ds(cr);case"median":return Ds(Cn);case"variance":return oe(lu);case"mode":return oe(su)}return n(t)}function yp(t){throw new Error(`invalid reduce: ${t}`)}function Is(t,e){return Ns(t,e,Rs)}function Rs(t,e,n){return lo(t,e,n,Bs)}function Bs(t,e,n){return co(t,e,n,Os)}function Os(t,e){return Nr(t,e,pp)}function pp(t){switch(`${t}`.toLowerCase()){case"x":return Mp;case"y":return Ap;case"z":return Gs}throw new Error(`invalid group reduce: ${t}`)}function fo(t,e){for(const n in e){const r=e[n];if(r!==void 0&&!t.some(i=>i.name===n))return r}}function Fs(t,e,n){if(e){const r=e.output.transform(),i=(o,a)=>Rt(r[o],r[a]);t.forEach(o=>o.sort(i))}n&&t.forEach(r=>r.reverse())}function gp(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function bp(t){return{reduceIndex(e,n,r){return t(Cr(n,e),r)}}}function oe(t){return{reduceIndex(e,n){return t(e,r=>n[r])}}}function Ds(t){return{reduceIndex(e,n){const r=t(e,i=>n[i]);return St(n)?new Date(r):r}}}const ho={reduceIndex(t,e){return Cr(e,t)}},mo={reduceIndex(t,e){return e[t[0]]}},wp={reduceIndex(t,e){const r=uu(Mn(t,o=>o.length,o=>e[o]),Nn),i=r.slice(-5).reverse();if(i.length`${o} (${a.toLocaleString("en-US")})`).join(` `)}},xp={reduceIndex(t,e){return e[t[t.length-1]]}},Ir={label:"Frequency",reduceIndex(t){return t.length}},vp={label:"Distinct",reduceIndex(t,e){const n=new An;for(const r of t)n.add(e[r]);return n.size}},$p=oe(jt);function Ys(t,e){return t==null?{scope:e,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:e,reduceIndex:(n,r,i=1)=>jt(n,o=>r[o])/i}}const Mp={reduceIndex(t,e,{x:n}){return n}},Ap={reduceIndex(t,e,{y:n}){return n}},Gs={reduceIndex(t,e,{z:n}){return n}};function Cp(t){if(typeof t!="function")throw new Error(`invalid test function: ${t}`);return{reduceIndex(e,n,{data:r}){return n[e.find(te(r)?i=>t(r[i],i,r):i=>t(r.get(i),i,r))]}}}function qn(t,{scale:e,type:n,value:r,filter:i,hint:o,label:a=Xt(r)},u){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),qs(u,{scale:e,type:n,value:H(t,r),label:a,filter:i,hint:o})}function js(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,qn(e,r,n)]))}function Rr(t,e){const n=Object.fromEntries(Object.entries(t).map(([r,{scale:i,value:o}])=>{const a=i==null?null:e[i];return[r,a==null?o:J(o,a)]}));return n.channels=t,n}function qs(t,e){const{scale:n,value:r}=e;if(n===!0||n==="auto")switch(t){case"fill":case"stroke":case"color":e.scale=n!==!0&&Ui(r,Bn)?null:"color",e.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":e.scale=n!==!0&&Ui(r,tp)?null:"opacity",e.defaultScale="opacity";break;case"symbol":n!==!0&&Ui(r,sp)?(e.scale=null,e.value=J(r,eo)):e.scale="symbol",e.defaultScale="symbol";break;default:e.scale=st.has(t)?t:null;break}else if(n===!1)e.scale=null;else if(n!=null&&!st.has(n))throw new Error(`unknown scale: ${n}`);return e}function Sp(t,e,n,r,i){const{order:o,reverse:a,reduce:u=!0,limit:s}=i;for(const l in i){if(!st.has(l))continue;let{value:c,order:f=o,reverse:d=a,reduce:h=u,limit:m=s}=Je(i[l]);const y=c?.startsWith("-");if(y&&(c=c.slice(1)),f=f===void 0?y!==(c==="width"||c==="height")?Xs:Ws:Ep(f),h==null||h===!1)continue;const w=l==="fx"||l==="fy"?Lp(e,r[l]):kp(n,l);if(!w)throw new Error(`missing channel for scale: ${l}`);const p=w.value,[g=0,v=1/0]=re(m)?m:m<0?[m]:[0,m];if(c==null)w.domain=()=>{let b=Array.from(new An(p));return d&&(b=b.reverse()),(g!==0||v!==1/0)&&(b=b.slice(g,v)),b};else{const b=c==="data"?t:c==="height"?Ps(n,"y1","y2"):c==="width"?Ps(n,"x1","x2"):yo(n,c,c==="y"?"y2":c==="x"?"x2":void 0),M=Nr(h===!0?"max":h,b);w.domain=()=>{let x=Nh(ee(p),$=>M.reduceIndex($,b),$=>p[$]);return f&&x.sort(f),d&&x.reverse(),(g!==0||v!==1/0)&&(x=x.slice(g,v)),x.map(Ar)}}}}function kp(t,e){for(const n in t){const r=t[n];if(r.scale===e)return r}}function Lp(t,e){const n=t.original;if(n===t)return e;const r=e.value,i=e.value=[];for(let o=0;oMath.abs(o-r[a]),Float64Array)}function yo(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 Ep(t){if(t==null||typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return Ws;case"descending":return Xs}throw new Error(`invalid order: ${t}`)}function Ws([t,e],[n,r]){return Rt(e,r)||Rt(t,n)}function Xs([t,e],[n,r]){return gr(e,r)||Rt(t,n)}function po(t,e){let n=t[e];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}const _s=new Map([["accent",Ih],["category10",Rh],["dark2",Bh],["observable10",Oh],["paired",Fh],["pastel1",Dh],["pastel2",Yh],["set1",Gh],["set2",jh],["set3",qh],["tableau10",Ph]]);function Tp(t){return t!=null&&_s.has(`${t}`.toLowerCase())}const Vs=new Map([..._s,["brbg",ae(Wh,cu)],["prgn",ae(Xh,fu)],["piyg",ae(_h,du)],["puor",ae(Vh,hu)],["rdbu",ae(_u,dr)],["rdgy",ae(Hh,mu)],["rdylbu",ae(Vu,hr)],["rdylgn",ae(Zh,yu)],["spectral",ae(Uh,pu)],["burd",Hs(_u,dr)],["buylrd",Hs(Vu,hr)],["blues",bt(Kh,gu)],["greens",bt(Qh,bu)],["greys",bt(Jh,wu)],["oranges",bt(tm,$u)],["purples",bt(em,xu)],["reds",bt(nm,vu)],["turbo",ue(Mu)],["viridis",ue(Au)],["magma",ue(Cu)],["inferno",ue(Su)],["plasma",ue(ku)],["cividis",ue(Lu)],["cubehelix",ue(Eu)],["warm",ue(Tu)],["cool",ue(zu)],["bugn",bt(rm,Nu)],["bupu",bt(im,Iu)],["gnbu",bt(om,Ru)],["orrd",bt(am,Bu)],["pubu",bt(um,Fu)],["pubugn",bt(sm,Ou)],["purd",bt(lm,Du)],["rdpu",bt(cm,Yu)],["ylgn",bt(fm,ju)],["ylgnbu",bt(dm,Gu)],["ylorbr",bt(hm,qu)],["ylorrd",bt(mm,Pu)],["rainbow",Zs(Wu)],["sinebow",Zs(Xu)]]);function bt(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?Ot(e,n):t[n])}function ae(t,e){return({length:n})=>n===2?[t[3][0],t[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Ot(e,n):t[n])}function Hs(t,e){return({length:n})=>n===2?[t[3][2],t[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Ot(r=>e(1-r),n):t[n].slice().reverse())}function ue(t){return({length:e})=>Ot(t,Math.max(2,Math.floor(e)))}function Zs(t){return({length:e})=>Ot(t,Math.floor(e)+1).slice(0,-1)}function Us(t){const e=`${t}`.toLowerCase();if(!Vs.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return Vs.get(e)}function Br(t,e){const n=Us(t),r=typeof n=="function"?n({length:e}):n;return r.length!==e?r.slice(0,e):r}function zp(t,e="greys"){const n=new Set,[r,i]=Br(e,2);for(const o of t)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}const Ks=new Map([["brbg",cu],["prgn",fu],["piyg",du],["puor",hu],["rdbu",dr],["rdgy",mu],["rdylbu",hr],["rdylgn",yu],["spectral",pu],["burd",t=>dr(1-t)],["buylrd",t=>hr(1-t)],["blues",gu],["greens",bu],["greys",wu],["purples",xu],["reds",vu],["oranges",$u],["turbo",Mu],["viridis",Au],["magma",Cu],["inferno",Su],["plasma",ku],["cividis",Lu],["cubehelix",Eu],["warm",Tu],["cool",zu],["bugn",Nu],["bupu",Iu],["gnbu",Ru],["orrd",Bu],["pubugn",Ou],["pubu",Fu],["purd",Du],["rdpu",Yu],["ylgnbu",Gu],["ylgn",ju],["ylorbr",qu],["ylorrd",Pu],["rainbow",Wu],["sinebow",Xu]]);function go(t){const e=`${t}`.toLowerCase();if(!Ks.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return Ks.get(e)}const Np=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function Ip(t){return t!=null&&Np.has(`${t}`.toLowerCase())}const Qs=t=>e=>t(1-e),bo=[0,1],Js=new Map([["number",Sn],["rgb",Ti],["hsl",$m],["hcl",Mm],["lab",Am]]);function tl(t){const e=`${t}`.toLowerCase();if(!Js.has(e))throw new Error(`unknown interpolator: ${e}`);return Js.get(e)}function Pn(t,e,n,{type:r,nice:i,clamp:o,zero:a,domain:u=rl(t,n),unknown:s,round:l,scheme:c,interval:f,range:d=st.get(t)===Fn?Wp(n,u):st.get(t)===Dn?Xp(n,u):st.get(t)===Yn?bo:void 0,interpolate:h=st.get(t)===ie?c==null&&d!==void 0?Ti:go(c!==void 0?c:r==="cyclical"?"rainbow":"turbo"):l?vm:Sn,reverse:m}){if(u=el(u),f=Ke(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=tl(h)),m=!!m,d!==void 0){const y=u.length,w=(d=el(d)).length;if(y!==w){if(h.length===1)throw new Error("invalid piecewise interpolator");h=zi(h,d),d=void 0}}if(h.length===1?(m&&(h=Qs(h),m=!1),d===void 0&&(d=Float64Array.from(u,(y,w)=>w/(u.length-1)),d.length===2&&(d=bo)),e.interpolate((d===bo?vt:xo)(h))):e.interpolate(h),a){const[y,w]=gt(u);(y>0||w<0)&&(u=In(u),(_e(u)||1)===Math.sign(y)?u[0]=0:u[u.length-1]=0)}return m&&(u=mr(u)),e.domain(u).unknown(s),i&&(e.nice(Rp(i,r)),u=e.domain()),d!==void 0&&e.range(d),o&&e.clamp(o),{type:r,domain:u,range:d,scale:e,interpolate:h,interval:f}}function el(t){return t=ye(t),t.length>=2?t:[t[0],t[0]]}function Rp(t,e){return t===!0?void 0:typeof t=="number"?t:Vy(t,e)}function Bp(t,e,n){return Pn(t,Hu(),e,n)}function Op(t,e,n){return nl(t,e,{...n,exponent:.5})}function nl(t,e,{exponent:n=1,...r}){return Pn(t,bm().exponent(n),e,{...r,type:"pow"})}function Fp(t,e,{base:n=10,domain:r=_p(e),...i}){return Pn(t,gm().base(n),e,{...i,domain:r})}function Dp(t,e,{constant:n=1,...r}){return Pn(t,pm().constant(n),e,r)}function Yp(t,e,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:a=Vp(e),unknown:u,interpolate:s,reverse:l}){return n===void 0&&(n=s!==void 0?Ot(s,i):st.get(t)===ie?Br(o,i):void 0),a.length>0&&(a=wm(a,n===void 0?{length:i}:n).quantiles()),wo(t,e,{domain:a,range:n,reverse:l,unknown:u})}function Gp(t,e,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=rl(t,e),unknown:a,interpolate:u,reverse:s}){const[l,c]=gt(o);let f;return n===void 0?(f=Ei(l,c,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=c&&f.pop(),r=f.length+1,n=u!==void 0?Ot(u,r):st.get(t)===ie?Br(i,r):void 0):(f=Ot(Sn(l,c),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),_e(ye(o))<0&&f.reverse(),wo(t,e,{domain:f,range:n,reverse:s,unknown:a})}function wo(t,e,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:a=o!==void 0?Ot(o,n.length+1):st.get(t)===ie?Br(i,n.length+1):void 0,reverse:u}){n=ye(n);const s=_e(n);if(!isNaN(s)&&!jp(n,s))throw new Error(`the ${t} scale has a non-monotonic domain`);return u&&(a=mr(a)),{type:"threshold",scale:xm(s<0?mr(n):n,a===void 0?[]:a).unknown(r),domain:n,range:a}}function jp(t,e){for(let n=1,r=t.length,i=t[0];ne}}function Wn(t,e=br){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 rl(t,e){const n=st.get(t);return(n===Fn||n===Yn||n===Dn?Pp:Wn)(e)}function Pp(t){return[0,t.length?kt(t,({value:e})=>e===void 0?e:kt(e,br)):1]}function Wp(t,e){const n=t.find(({radius:a})=>a!==void 0);if(n!==void 0)return[0,n.radius];const r=$n(t,.5,({value:a})=>a===void 0?NaN:$n(a,.25,Jt)),i=e.map(a=>3*Math.sqrt(a/r)),o=30/kt(i);return o<1?i.map(a=>a*o):i}function Xp(t,e){const n=Cn(t,({value:o})=>o===void 0?NaN:Cn(o,Math.abs)),r=e.map(o=>12*o/n),i=60/kt(r);return i<1?r.map(o=>o*i):r}function _p(t){for(const{value:e}of t)if(e!==void 0)for(let n of e){if(n>0)return Wn(t,Jt);if(n<0)return Wn(t,wr)}return[1,10]}function Vp(t){const e=[];for(const{value:n}of t)if(n!==void 0)for(const r of n)e.push(r);return e}function xo(t){return(e,n)=>r=>t(e+r*(n-e))}let vo=0,$o;function Hp(){const t=vo;return vo=0,$o=void 0,t}function se(t){t!==$o&&($o=t,console.warn(t),++vo)}function Or(t,e,n,r,{type:i,nice:o,clamp:a,domain:u=Wn(r),unknown:s,pivot:l=0,scheme:c,range:f,symmetric:d=!0,interpolate:h=st.get(t)===ie?c==null&&f!==void 0?Ti:go(c!==void 0?c:"rdbu"):Sn,reverse:m}){l=+l,u=ye(u);let[y,w]=u;if(u.length>2&&se(`Warning: the diverging ${t} scale domain contains extra elements.`),We(y,w)<0&&([y,w]=[w,y],m=!m),y=Math.min(y,l),w=Math.max(w,l),typeof h!="function"&&(h=tl(h)),f!==void 0&&(h=h.length===1?xo(h)(...f):zi(h,f)),m&&(h=Qs(h)),d){const p=n.apply(l),g=p-n.apply(y),v=n.apply(w)-p;gv&&(w=n.invert(p+g))}return e.domain([y,l,w]).unknown(s).interpolator(h),a&&e.clamp(a),o&&e.nice(o),{type:i,domain:[y,w],pivot:l,interpolate:h,scale:e}}function Zp(t,e,n){return Or(t,Lm(),Jp,e,n)}function Up(t,e,n){return il(t,e,{...n,exponent:.5})}function il(t,e,{exponent:n=1,...r}){return Or(t,km().exponent(n=+n),ng(n),e,{...r,type:"diverging-pow"})}function Kp(t,e,{base:n=10,pivot:r=1,domain:i=Wn(e,r<0?wr:Jt),...o}){return Or(t,Sm().base(n=+n),tg,e,{domain:i,pivot:r,...o})}function Qp(t,e,{constant:n=1,...r}){return Or(t,Cm().constant(n=+n),rg(n),e,r)}const Jp={apply(t){return t},invert(t){return t}},tg={apply:Math.log,invert:Math.exp},eg={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function ng(t){return t===.5?eg:{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 rg(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 ol(t,e,n,r){return Pn(t,e,n,r)}function ig(t,e,n){return ol(t,Em(),e,n)}function og(t,e,n){return ol(t,Tm(),e,n)}const Xn=Symbol("ordinal");function al(t,e,n,{type:r,interval:i,domain:o,range:a,reverse:u,hint:s}){return i=Ke(i,r),o===void 0&&(o=sl(n,i,t)),(r==="categorical"||r===Xn)&&(r="ordinal"),u&&(o=mr(o)),o=e.domain(o).domain(),a!==void 0&&(typeof a=="function"&&(a=a(o)),e.range(a)),{type:r,domain:o,range:a,scale:e,hint:s,interval:i}}function ag(t,e,{type:n,interval:r,domain:i,range:o,scheme:a,unknown:u,...s}){r=Ke(r,n),i===void 0&&(i=sl(e,r,t));let l;if(st.get(t)===Er)l=lg(e),o=o===void 0?cg(l):J(o,eo);else if(st.get(t)===ie&&(o===void 0&&(n==="ordinal"||n===Xn)&&(o=zp(i,a),o!==void 0&&(a=void 0)),a===void 0&&o===void 0&&(a=n==="ordinal"?"turbo":"observable10"),a!==void 0))if(o!==void 0){const c=go(a),f=o[0],d=o[1]-o[0];o=({length:h})=>Ot(m=>c(f+d*m),h)}else o=Us(a);if(u===Nm)throw new Error(`implicit unknown on ${t} scale is not supported`);return al(t,Im().unknown(u),e,{...s,type:n,domain:i,range:o,hint:l})}function ug(t,e,{align:n=.5,padding:r=.5,...i}){return ul(zm().align(n).padding(r),e,i,t)}function sg(t,e,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=t==="fx"||t==="fy"?0:r,...a}){return ul(Zu().align(n).paddingInner(i).paddingOuter(o),e,a,t)}function ul(t,e,n,r){let{round:i}=n;return i!==void 0&&t.round(i=!!i),t=al(r,t,e,n),t.round=i,t}function sl(t,e,n){const r=new An;for(const{value:i,domain:o}of t){if(o!==void 0)return o();if(i!==void 0)for(const a of i)r.add(a)}if(e!==void 0){const[i,o]=gt(r).map(e.floor,e);return e.range(i,e.offset(o))}if(r.size>1e4&&st.get(n)===_t)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return uu(r,Rt)}function ll(t,e){let n;for(const{hint:r}of t){const i=r?.[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function lg(t){return{fill:ll(t,"fill"),stroke:ll(t,"stroke")}}function cg(t){return ut(t.fill)?Rm:Bm}function Mo(t,{label:e,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:a=n,round:u,nice:s,clamp:l,zero:c,align:f,padding:d,projection:h,facet:{label:m=e}={},...y}={}){const w={};for(const[p,g]of t){const v=y[p],b=gl(p,g,{round:st.get(p)===_t?u:void 0,nice:s,clamp:l,zero:c,align:f,padding:d,projection:h,...v});if(b){let{label:M=p==="fx"||p==="fy"?m:e,percent:x,transform:$,inset:A,insetTop:C=A!==void 0?A:p==="y"?r:0,insetRight:S=A!==void 0?A:p==="x"?i:0,insetBottom:E=A!==void 0?A:p==="y"?o:0,insetLeft:k=A!==void 0?A:p==="x"?a:0}=v||{};if($==null)$=void 0;else if(typeof $!="function")throw new Error("invalid scale transform; not a function");b.percent=!!x,b.label=M===void 0?dg(g,b):M,b.transform=$,p==="x"||p==="fx"?(b.insetLeft=+k,b.insetRight=+S):(p==="y"||p==="fy")&&(b.insetTop=+C,b.insetBottom=+E),w[p]=b}}return w}function cl(t){const e={},n={scales:e};for(const[r,i]of Object.entries(t)){const{scale:o,type:a,interval:u,label:s}=i;e[r]=vl(i),n[r]=o,o.type=a,u!=null&&(o.interval=u),s!=null&&(o.label=s)}return n}function fg(t,e){const{x:n,y:r,fx:i,fy:o}=t,a=i||o?Ao(e):e;i&&hl(i,a),o&&ml(o,a);const u=i||o?dl(t,e):e;n&&hl(n,u),r&&ml(r,u)}function dg(t=[],e){let n;for(const{label:r}of t)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!Oe(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function fl(t){return Math.sign(_e(t.domain()))*Math.sign(_e(t.range()))}function Ao(t){const{marginTop:e,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:a,facet:{marginTop:u,marginRight:s,marginBottom:l,marginLeft:c}}=t;return{marginTop:Math.max(e,u),marginRight:Math.max(n,s),marginBottom:Math.max(r,l),marginLeft:Math.max(i,c),width:o,height:a}}function dl({fx:t,fy:e},n){const{marginTop:r,marginRight:i,marginBottom:o,marginLeft:a,width:u,height:s}=Ao(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:a,width:t?t.scale.bandwidth()+a+i:u,height:e?e.scale.bandwidth()+r+o:s,facet:{width:u,height:s}}}function hl(t,e){if(t.range===void 0){const{insetLeft:n,insetRight:r}=t,{width:i,marginLeft:o=0,marginRight:a=0}=e,u=o+n,s=i-a-r;t.range=[u,Math.max(u,s)],Oe(t)||(t.range=pl(t)),t.scale.range(t.range)}yl(t)}function ml(t,e){if(t.range===void 0){const{insetTop:n,insetBottom:r}=t,{height:i,marginTop:o=0,marginBottom:a=0}=e,u=o+n,s=i-a-r;t.range=[Math.max(u,s),u],Oe(t)?t.range.reverse():t.range=pl(t),t.scale.range(t.range)}yl(t)}function yl(t){t.round===void 0&&yg(t)&&hg(t)<=30&&t.scale.round(!0)}function hg({scale:t}){const e=t.domain().length,[n,r]=t.range(),i=t.paddingInner?t.paddingInner():1,o=t.paddingOuter?t.paddingOuter():t.padding(),a=e-i,u=Math.abs(r-n)/Math.max(1,a+o*2);return(u-Math.floor(u))*a}function pl(t){const e=t.scale.domain().length+xl(t);if(!(e>2))return t.range;const[n,r]=t.range;return Array.from({length:e},(i,o)=>n+o/(e-1)*(r-n))}function Co(t,e,n){return gl(t,n===void 0?void 0:[{hint:n}],{...e})}function gl(t,e=[],n={}){const r=mg(t,e,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&t!=="fx"&&t!=="fy"&&Oe({type:r})){const i=e.map(({value:o})=>o).filter(o=>o!==void 0);i.some(St)?se(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${nn(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 "${nn(r)}".`):i.some(Ky)?se(`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 "${nn(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 "${nn(r)}".`):i.some(Qy)&&se(`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 "${nn(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 "${nn(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=Fr(e,n,Lt);break;case"identity":switch(st.get(t)){case _t:n=Fr(e,n,Lt);break;case Er:n=Fr(e,n,pg);break}break;case"utc":case"time":n=Fr(e,n,hs);break}switch(r){case"diverging":return Zp(t,e,n);case"diverging-sqrt":return Up(t,e,n);case"diverging-pow":return il(t,e,n);case"diverging-log":return Kp(t,e,n);case"diverging-symlog":return Qp(t,e,n);case"categorical":case"ordinal":case Xn:return ag(t,e,n);case"cyclical":case"sequential":case"linear":return Bp(t,e,n);case"sqrt":return Op(t,e,n);case"threshold":return wo(t,e,n);case"quantile":return Yp(t,e,n);case"quantize":return Gp(t,e,n);case"pow":return nl(t,e,n);case"log":return Fp(t,e,n);case"symlog":return Dp(t,e,n);case"utc":return og(t,e,n);case"time":return ig(t,e,n);case"point":return ug(t,e,n);case"band":return sg(t,e,n);case"identity":return qp(t);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function nn(t){return typeof t=="symbol"?t.description:t}function bl(t){return typeof t=="string"?`${t}`.toLowerCase():t}const wl={toString:()=>"projection"};function mg(t,e,{type:n,domain:r,range:i,scheme:o,pivot:a,projection:u}){if(n=bl(n),t==="fx"||t==="fy")return"band";(t==="x"||t==="y")&&u!=null&&(n=wl);for(const c of e){const f=bl(c.type);if(f!==void 0){if(n===void 0)n=f;else if(n!==f)throw new Error(`scale incompatible with channel: ${n} !== ${f}`)}}if(n===wl)return;if(n!==void 0)return n;if(r===void 0&&!e.some(({value:c})=>c!==void 0))return;const s=st.get(t);if(s===Fn)return"sqrt";if(s===Yn||s===Dn)return"linear";if(s===Er)return"ordinal";const l=(r??i)?.length;if(l<2||l>2)return So(s);if(r!==void 0){if(ct(r))return So(s);if(St(r))return"utc"}else{const c=e.map(({value:f})=>f).filter(f=>f!==void 0);if(c.some(ct))return So(s);if(c.some(St))return"utc"}if(s===ie){if(a!=null||Ip(o))return"diverging";if(Tp(o))return"categorical"}return"linear"}function So(t){switch(t){case _t:return"point";case ie:return Xn;default:return"ordinal"}}function Oe({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===Xn}function xl({type:t}){return t==="threshold"}function yg({type:t}){return t==="point"||t==="band"}function Vt(t){if(t===void 0)return!0;const e=t.domain(),n=t(e[0]);for(let r=1,i=e.length;r{if(!st.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return t[e]}}function vl({scale:t,type:e,domain:n,range:r,interpolate:i,interval:o,transform:a,percent:u,pivot:s}){if(e==="identity")return{type:"identity",apply:c=>c,invert:c=>c};const l=t.unknown?t.unknown():void 0;return{type:e,domain:In(n),...r!==void 0&&{range:In(r)},...a!==void 0&&{transform:a},...u&&{percent:u},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...t.clamp&&{clamp:t.clamp()},...s!==void 0&&{pivot:s,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:c=>t(c),...t.invert&&{invert:c=>t.invert(c)}}}function wg(t,e){const{fx:n,fy:r}=Mo(t,e),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?Om(i,o).map(([a,u],s)=>({x:a,y:u,i:s})):i?i.map((a,u)=>({x:a,i:u})):o?o.map((a,u)=>({y:a,i:u})):void 0}function xg(t,{x:e,y:n}){return e&&=Lo(e),n&&=Lo(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,i)=>e.get(r.x)-e.get(i.x)||n.get(r.y)-n.get(i.y):e?(r,i)=>e.get(r.x)-e.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function ko(t,{fx:e,fy:n}){const r=ee(t),i=e?.value,o=n?.value;return e&&n?Mn(r,a=>(a.fx=i[a[0]],a.fy=o[a[0]],a),a=>i[a],a=>o[a]):e?Mn(r,a=>(a.fx=i[a[0]],a),a=>i[a]):Mn(r,a=>(a.fy=o[a[0]],a),a=>o[a])}function vg(t,e,{marginTop:n,marginLeft:r}){const i=t?({x:a})=>t(a)-r:()=>0,o=e?({y:a})=>e(a)-n:()=>0;return function(a){this.tagName==="svg"?(this.setAttribute("x",i(a)),this.setAttribute("y",o(a))):this.setAttribute("transform",`translate(${i(a)},${o(a)})`)}}function $g(t){const e=[],n=new Uint32Array(jt(t,r=>r.length));for(const r of t){let i=0;for(const o of t)r!==o&&(n.set(o,i),i+=o.length);e.push(n.slice(0,i))}return e}const Mg=new Map([["top",Eo],["right",No],["bottom",To],["left",zo],["top-left",Yr(Eo,zo)],["top-right",Yr(Eo,No)],["bottom-left",Yr(To,zo)],["bottom-right",Yr(To,No)],["top-empty",Sg],["right-empty",Eg],["bottom-empty",kg],["left-empty",Lg],["empty",Tg]]);function Ag(t){if(t==null)return null;const e=Mg.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}const $l=new WeakMap;function Lo(t){let e=$l.get(t);return e||$l.set(t,e=new Ni(J(t,(n,r)=>[n,r]))),e}function we(t,e){return Lo(t).get(e)}function Cg(t,e,n){return e=ne(e),n=ne(n),t.find(r=>Object.is(ne(r.x),e)&&Object.is(ne(r.y),n))}function Dr(t,e,n){return Cg(t,e,n)?.empty}function Eo(t,{y:e},{y:n}){return e?we(e,n)===0:!0}function To(t,{y:e},{y:n}){return e?we(e,n)===e.length-1:!0}function zo(t,{x:e},{x:n}){return e?we(e,n)===0:!0}function No(t,{x:e},{x:n}){return e?we(e,n)===e.length-1:!0}function Sg(t,{y:e},{x:n,y:r,empty:i}){if(i)return!1;if(!e)return;const o=we(e,r);if(o>0)return Dr(t,n,e[o-1])}function kg(t,{y:e},{x:n,y:r,empty:i}){if(i)return!1;if(!e)return;const o=we(e,r);if(o0)return Dr(t,e[o-1],r)}function Eg(t,{x:e},{x:n,y:r,empty:i}){if(i)return!1;if(!e)return;const o=we(e,n);if(or.get(i)?.get(o)??[]):e?t.map(({x:i})=>r.get(i)??[]):t.map(({y:i})=>r.get(i)??[])}const Ml=Math.PI,le=2*Ml,Ro=.618;function zg({projection:t,inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:i=e,insetLeft:o=e}={},a){if(t==null)return;if(typeof t.stream=="function")return t;let u,s,l="frame";if(zt(t)){let M;if({type:t,domain:s,inset:M,insetTop:n=M!==void 0?M:n,insetRight:r=M!==void 0?M:r,insetBottom:i=M!==void 0?M:i,insetLeft:o=M!==void 0?M:o,clip:l=l,...u}=t,t==null)return}typeof t!="function"&&({type:t}=Bo(t));const{width:c,height:f,marginLeft:d,marginRight:h,marginTop:m,marginBottom:y}=a,w=c-d-h-o-r,p=f-m-y-n-i;if(t=t?.({width:w,height:p,clip:l,...u}),t==null)return;l=Ng(l,d,m,c-h,f-y);let g=d+o,v=m+n,b;if(s!=null){const[[M,x],[$,A]]=kn(t).bounds(s),C=Math.min(w/($-M),p/(A-x));C>0?(g-=(C*(M+$)-w)/2,v-=(C*(x+A)-p)/2,b=yr({point(S,E){this.stream.point(S*C+g,E*C+v)}})):se("Warning: the projection could not be fit to the specified domain; using the default scale.")}return b??=g===0&&v===0?Al():yr({point(M,x){this.stream.point(M+g,x+v)}}),{stream:M=>t.stream(b.stream(l(M)))}}function Bo(t){switch(`${t}`.toLowerCase()){case"albers-usa":return Yt(Qm,.7463,.4673);case"albers":return Gr(Km,.7463,.4673);case"azimuthal-equal-area":return Yt(Um,4,4);case"azimuthal-equidistant":return Yt(Zm,le,le);case"conic-conformal":return Gr(Hm,le,le);case"conic-equal-area":return Gr(Vm,6.1702,2.9781);case"conic-equidistant":return Gr(_m,7.312,3.6282);case"equal-earth":return Yt(Xm,5.4133,2.6347);case"equirectangular":return Yt(Wm,le,Ml);case"gnomonic":return Yt(Pm,3.4641,3.4641);case"identity":return{type:Al};case"reflect-y":return{type:Ig};case"mercator":return Yt(qm,le,le);case"orthographic":return Yt(jm,2,2);case"stereographic":return Yt(Gm,2,2);case"transverse-mercator":return Yt(Ym,le,le);default:throw new Error(`unknown projection type: ${t}`)}}function Ng(t,e,n,r,i){if(t===!1||t==null||typeof t=="number")return o=>o;if(t===!0&&(t="frame"),`${t}`.toLowerCase()==="frame")return Dm(e,n,r,i);throw new Error(`unknown projection clip type: ${t}`)}function Yt(t,e,n){return{type:({width:r,height:i,rotate:o,precision:a=.15,clip:u})=>{const s=t();return a!=null&&s.precision?.(a),o!=null&&s.rotate?.(o),typeof u=="number"&&s.clipAngle?.(u),r!=null&&(s.scale(Math.min(r/e,i/n)),s.translate([r/2,i/2])),s},aspectRatio:n/e}}function Gr(t,e,n){const{type:r,aspectRatio:i}=Yt(t,e,n);return{type:o=>{const{parallels:a,domain:u,width:s,height:l}=o,c=r(o);return a!=null&&(c.parallels(a),u===void 0&&s!=null&&c.fitSize([s,l],{type:"Sphere"})),c},aspectRatio:i}}const Al=vt({stream:t=>t}),Ig=vt(yr({point(t,e){this.stream.point(t,-e)}}));function Cl(t,e,n,r){const i=n[t],o=n[e],a=i.length,u=n[t]=new Float64Array(a).fill(NaN),s=n[e]=new Float64Array(a).fill(NaN);let l;const c=r.stream({point(f,d){u[l]=f,s[l]=d}});for(l=0;l5?5:s:Ro}}if(t!=null){if(typeof t!="function"){const{aspectRatio:e}=Bo(t);if(e)return e}return Ro}}function _n(t,e,{projection:n}){const{x:r,y:i}=t;let o={};return r&&(o.x=r),i&&(o.y=i),o=Rr(o,e),n&&r?.scale==="x"&&i?.scale==="y"&&Cl("x","y",o,n),r&&(o.x=Lt(o.x)),i&&(o.y=Lt(o.y)),o}function Og(t){const e=[],n=[],r={scale:"x",value:e},i={scale:"y",value:n},o={point(a,u){e.push(a),n.push(u)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(const a of t.value)Fm(a,o);return[r,i]}function Fg({x:t,y:e}){if(t||e)return t??=n=>n,e??=n=>n,yr({point(n,r){this.stream.point(t(n),e(r))}})}function jr(t={}){const{document:e=typeof window<"u"?window.document:void 0,clip:n}=t;return{document:e,clip:As(n)}}function Z(t,{document:e}){return Kt(Uu(t).call(e.documentElement))}const Oo=Symbol("unset");function rn(t){return(t.length===1?Dg:Yg)(t)}function Dg(t){let e,n=Oo;return r=>(Object.is(n,r)||(n=r,e=t(r)),e)}function Yg(t){let e,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>!Object.is(i,r[o])))&&(n=r,e=t(...r)),e)}const Gg=rn(t=>new Intl.NumberFormat(t)),jg=rn((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}})),qg=rn((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}}));function Sl(t="en-US"){const e=Gg(t);return n=>n!=null&&!isNaN(n)?e.format(n):void 0}function Pg(t="en-US",e="short"){const n=jg(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function Wg(t="en-US",e="short"){const n=qg(t,e);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function kl(t){return By(t,"Invalid Date")}function Xg(t="en-US"){const e=Sl(t);return n=>(n instanceof Date?kl:typeof n=="number"?e:xt)(n)}const on=Xg(),$t=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5;let _g=0,Vg=0;function Fo(){return`plot-clip-${++_g}`}function Hg(){return`plot-pattern-${++Vg}`}function Ll(t,{title:e,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:a,fill:u,fillOpacity:s,stroke:l,strokeWidth:c,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:m,strokeDasharray:y,strokeDashoffset:w,opacity:p,mixBlendMode:g,imageFilter:v,paintOrder:b,pointerEvents:M,shapeRendering:x,channels:$},{ariaLabel:A,fill:C="currentColor",fillOpacity:S,stroke:E="none",strokeOpacity:k,strokeWidth:T,strokeLinecap:L,strokeLinejoin:z,strokeMiterlimit:N,paintOrder:I}){C===null&&(u=null,s=null),E===null&&(l=null,f=null),ut(C)?!ut(E)&&(!ut(u)||$?.fill)&&(E="none"):ut(E)&&(!ut(l)||$?.stroke)&&(C="none");const[G,R]=Ct(u,C),[B,F]=dt(s,S),[D,Y]=Ct(l,E),[_,V]=dt(f,k),[W,O]=dt(p);en(Y)||(c===void 0&&(c=T),h===void 0&&(h=L),d===void 0&&(d=z),m===void 0&&!ep(d)&&(m=N),!en(R)&&b===void 0&&(b=I));const[P,X]=dt(c);return C!==null&&(t.fill=yt(R,"currentColor"),t.fillOpacity=Vn(F,1)),E!==null&&(t.stroke=yt(Y,"none"),t.strokeWidth=Vn(X,1),t.strokeOpacity=Vn(V,1),t.strokeLinejoin=yt(d,"miter"),t.strokeLinecap=yt(h,"butt"),t.strokeMiterlimit=Vn(m,4),t.strokeDasharray=yt(y,"none"),t.strokeDashoffset=yt(w,"0")),t.target=xt(a),t.ariaLabel=xt(A),t.ariaDescription=xt(i),t.ariaHidden=xt(o),t.opacity=Vn(O,1),t.mixBlendMode=yt(g,"normal"),t.imageFilter=yt(v,"none"),t.paintOrder=yt(b,"normal"),t.pointerEvents=yt(M,"auto"),t.shapeRendering=yt(x,"auto"),{title:{value:e,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:G,scale:"auto",optional:!0},fillOpacity:{value:B,scale:"auto",optional:!0},stroke:{value:D,scale:"auto",optional:!0},strokeOpacity:{value:_,scale:"auto",optional:!0},strokeWidth:{value:P,optional:!0},opacity:{value:W,scale:"auto",optional:!0}}}function Zg(t,e){e&&t.filter(n=>Di(e[n])).append("title").call(Kg,e)}function Ug(t,e){e&&t.filter(([n])=>Di(e[n])).append("title").call(Qg,e)}function Kg(t,e){e&&t.text(n=>on(e[n]))}function Qg(t,e){e&&t.text(([n])=>on(e[n]))}function lt(t,{target:e,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:a,stroke:u,strokeOpacity:s,strokeWidth:l,opacity:c,href:f}){r&&q(t,"aria-label",d=>r[d]),o&&q(t,"fill",d=>o[d]),a&&q(t,"fill-opacity",d=>a[d]),u&&q(t,"stroke",d=>u[d]),s&&q(t,"stroke-opacity",d=>s[d]),l&&q(t,"stroke-width",d=>l[d]),c&&q(t,"opacity",d=>c[d]),f&&zl(t,d=>f[d],e),n||Zg(t,i)}function qr(t,{target:e,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:a,stroke:u,strokeOpacity:s,strokeWidth:l,opacity:c,href:f}){r&&q(t,"aria-label",([d])=>r[d]),o&&q(t,"fill",([d])=>o[d]),a&&q(t,"fill-opacity",([d])=>a[d]),u&&q(t,"stroke",([d])=>u[d]),s&&q(t,"stroke-opacity",([d])=>s[d]),l&&q(t,"stroke-width",([d])=>l[d]),c&&q(t,"opacity",([d])=>c[d]),f&&zl(t,([d])=>f[d],e),n||Ug(t,i)}function Jg({ariaLabel:t,title:e,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:a,opacity:u,href:s},{tip:l}){return[t,l?void 0:e,n,r,i,o,a,u,s].filter(c=>c!==void 0)}function Do(t,e,n){const r=Te(t,i=>e[i]);return n===void 0&&r.size>1+t.length>>1&&se("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*El(t,e,n,r){const{z:i}=n,{z:o}=r,a=Jg(r,n),u=[...e,...a];for(const s of o?Do(t,o,i):[t]){let l,c;t:for(const f of s){for(const d of u)if(!wt(d[f])){c&&c.push(-1);continue t}if(l===void 0){c&&(yield c),l=a.map(d=>ne(d[f])),c=[f];continue}c.push(f);for(let d=0;dne(m[f])),c=[f];continue t}}c&&(yield c)}}function tb(t,e,n,r){let i;const{clip:o=r.clip}=e;o==="frame"?(t=Z("svg:g",r).each(function(){this.appendChild(t.node()),t.node=()=>this}),i=nb(r,n)):o&&(i=ib(o,r)),q(t,"aria-label",e.ariaLabel),q(t,"aria-description",e.ariaDescription),q(t,"aria-hidden",e.ariaHidden),q(t,"clip-path",i)}function eb(t){const e=new WeakMap;return(n,r)=>{let i=e.get(n);if(!i){const o=Fo();Kt(n.ownerSVGElement).append("clipPath").attr("id",o).call(t,n,r),e.set(n,i=`url(#${o})`)}return i}}const nb=eb((t,e,n)=>{const{width:r,height:i,marginLeft:o,marginRight:a,marginTop:u,marginBottom:s}=n;t.append("rect").attr("x",o).attr("y",u).attr("width",r-a-o).attr("height",i-u-s)}),Tl=new WeakMap,rb={type:"Sphere"};function ib(t,e){let n,r;if((n=Tl.get(e))||Tl.set(e,n=new WeakMap),t.type==="Sphere"&&(t=rb),!(r=n.get(t))){const i=Fo();Kt(e.ownerSVGElement).append("clipPath").attr("id",i).append("path").attr("d",e.path()(t)),n.set(t,r=`url(#${i})`)}return r}function ot(t,e,n,r){tb(t,e,n,r),q(t,"class",e.className),q(t,"fill",e.fill),q(t,"fill-opacity",e.fillOpacity),q(t,"stroke",e.stroke),q(t,"stroke-width",e.strokeWidth),q(t,"stroke-opacity",e.strokeOpacity),q(t,"stroke-linejoin",e.strokeLinejoin),q(t,"stroke-linecap",e.strokeLinecap),q(t,"stroke-miterlimit",e.strokeMiterlimit),q(t,"stroke-dasharray",e.strokeDasharray),q(t,"stroke-dashoffset",e.strokeDashoffset),q(t,"shape-rendering",e.shapeRendering),q(t,"filter",e.imageFilter),q(t,"paint-order",e.paintOrder);const{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=e;q(t,"pointer-events",i)}function Q(t,e){ob(t,"mix-blend-mode",e.mixBlendMode),q(t,"opacity",e.opacity)}function zl(t,e,n){t.each(function(r){const i=e(r);if(i!=null){const o=this.ownerDocument.createElementNS(ze.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ze.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function q(t,e,n){n!=null&&t.attr(e,n)}function ob(t,e,n){n!=null&&t.style(e,n)}function tt(t,e,{x:n,y:r},i=$t,o=$t){i+=e.dx,o+=e.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&t.attr("transform",`translate(${i},${o})`)}function yt(t,e){if((t=xt(t))!==e)return t}function Vn(t,e){if((t=rt(t))!==e)return t}const ab=/^-?([_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 Yo(t){if(t===void 0)return"plot-d6a7b5";if(t=`${t}`,!ab.test(t))throw new Error(`invalid class name: ${t}`);return t}function Go(t,e){if(typeof e=="string")t.property("style",e);else if(e!=null)for(const n of t)Object.assign(n.style,e)}function Ht({frameAnchor:t},{width:e,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:a}){return[/left$/.test(t)?a:/right$/.test(t)?e-i:(a+e-i)/2,/^top/.test(t)?r:/^bottom/.test(t)?n-o:(r+n-o)/2]}class et{constructor(e,n={},r={},i){const{facet:o="auto",facetAnchor:a,fx:u,fy:s,sort:l,dx:c=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:m=d,marginBottom:y=d,marginLeft:w=d,className:p,clip:g=i?.clip,channels:v,tip:b,render:M}=r;if(this.data=e,this.sort=pe(l)?l:null,this.initializer=At(r).initializer,this.transform=this.initializer?r.transform:Dt(r).transform,o===null||o===!1?this.facet=null:(this.facet=Tt(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=e===zn&&typeof u=="string"?[u]:u,this.fy=e===zn&&typeof s=="string"?[s]:s),this.facetAnchor=Ag(a),n=Qi(n),v!==void 0&&(n={...ub(v),...n}),i!==void 0&&(n={...Ll(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([x,$])=>{if(Wt($.value)){const{value:A,label:C=$.label,scale:S=$.scale}=$.value;$={...$,label:C,scale:S,value:A}}if(e===zn&&typeof $.value=="string"){const{value:A}=$;$={...$,value:[A]}}return[x,$]}).filter(([x,{value:$,optional:A}])=>{if($!=null)return!0;if(A)return!1;throw new Error(`missing channel value: ${x}`)})),this.dx=+c,this.dy=+f,this.marginTop=+h,this.marginRight=+m,this.marginBottom=+y,this.marginLeft=+w,this.clip=As(g),this.tip=sb(b),this.className=xt(p),this.facet==="super"){if(u||s)throw new Error("super-faceting cannot use fx or fy");for(const x in this.channels){const{scale:$}=n[x];if(!($!=="x"&&$!=="y"))throw new Error("super-faceting cannot use x or y")}}M!=null&&(this.render=Hn(M,this.render))}initialize(e,n,r){let i=Ze(this.data);e===void 0&&i!=null&&(e=[ee(i)]);const o=e;this.transform!=null&&({facets:e,data:i}=this.transform(i,e,r),i=Ze(i)),e!==void 0&&(e.original=o);const a=js(this.channels,i);return this.sort!=null&&Sp(i,e,a,n,this.sort),{data:i,facets:e,channels:a}}filter(e,n,r){for(const i in n){const{filter:o=wt}=n[i];if(o!==null){const a=r[i];e=e.filter(u=>o(a[u]))}}return e}project(e,n,r){for(const i in e)if(e[i].scale==="x"&&/^x|x$/.test(i)){const o=i.replace(/^x|x$/,"y");o in e&&e[o].scale==="y"&&Cl(i,o,n,r.projection)}}scale(e,n,r){const i=Rr(e,n);return r.projection&&this.project(e,i,r),i}}function Bt(...t){return t.plot=et.prototype.plot,t}function Hn(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,i,o,a,u){return t.call(this,n,r,i,o,a,(s,l,c,f,d)=>e.call(this,s,l,c,f,d,u))}}function ub(t){return Object.fromEntries(Object.entries(Qi(t)).map(([e,n])=>(n=typeof n=="string"?{value:n,label:e}:Je(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[e,n])))}function sb(t){return t===!0?"xy":t===!1||t==null?null:typeof t=="string"?Tt(t,"tip",["x","y","xy"]):t}function Fe(t,e){return t?.tip===!0?{...t,tip:e}:zt(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:e}}:t}function lb(t,e,n={}){let r=.5-$t,i=.5+$t,o=.5+$t,a=.5-$t;for(const{marginTop:y,marginRight:w,marginBottom:p,marginLeft:g}of e)y>r&&(r=y),w>i&&(i=w),p>o&&(o=p),g>a&&(a=g);let{margin:u,marginTop:s=u!==void 0?u:r,marginRight:l=u!==void 0?u:i,marginBottom:c=u!==void 0?u:o,marginLeft:f=u!==void 0?u:a}=n;s=+s,l=+l,c=+c,f=+f;let{width:d=640,height:h=cb(t,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:a})+Math.max(0,s-r+c-o)}=n;d=+d,h=+h;const m={width:d,height:h,marginTop:s,marginRight:l,marginBottom:c,marginLeft:f};if(t.fx||t.fy){let{margin:y,marginTop:w=y!==void 0?y:s,marginRight:p=y!==void 0?y:l,marginBottom:g=y!==void 0?y:c,marginLeft:v=y!==void 0?y:f}=n.facet??{};w=+w,p=+p,g=+g,v=+v,m.facet={marginTop:w,marginRight:p,marginBottom:g,marginLeft:v}}return m}function cb({x:t,y:e,fy:n,fx:r},{projection:i,aspectRatio:o},{width:a,marginTopDefault:u,marginRightDefault:s,marginBottomDefault:l,marginLeftDefault:c}){const f=n&&n.scale.domain().length||1,d=Bg(i);if(d){const m=r?r.scale.domain().length:1,y=(1.1*f-.1)/(1.1*m-.1)*d,w=Math.max(.1,Math.min(10,y));return Math.round((a-c-s)*w+u+l)}const h=e?Oe(e)?e.scale.domain().length||1:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);const m=Nl("y",e)/(Nl("x",t)*o),y=r?r.scale.bandwidth():1,w=n?n.scale.bandwidth():1,p=y*(a-c-s)-t.insetLeft-t.insetRight;return(m*p+e.insetTop+e.insetBottom)/w+u+l}return!!(e||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function Nl(t,e){if(!e)throw new Error(`aspectRatio requires ${t} scale`);const{type:n,domain:r}=e;let i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{const u=e.scale.exponent();i=s=>Math.pow(s,u);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${t} scale for aspectRatio: ${n}`)}const[o,a]=gt(r);return Math.abs(i(a)-i(o))}const Il=new WeakMap;function jo(t,e,{x:n,y:r,px:i,py:o,maxRadius:a=40,channels:u,render:s,...l}={}){return a=+a,i!=null&&(n??=null,u={...u,px:{value:i,scale:"x"}}),o!=null&&(r??=null,u={...u,py:{value:o,scale:"y"}}),{x:n,y:r,channels:u,...l,render:Hn(function(c,f,d,h,m,y){m={...m,pointerSticky:!1};const w=m.ownerSVGElement,{data:p}=m.getMarkState(this);let g=Il.get(w);g||Il.set(w,g={sticky:!1,roots:[],renders:[]});let v=g.renders.push(Y)-1;const{x:b,y:M,fx:x,fy:$}=f;let A=x?x(c.fx)-h.marginLeft:0,C=$?$(c.fy)-h.marginTop:0;b?.bandwidth&&(A+=b.bandwidth()/2),M?.bandwidth&&(C+=M.bandwidth()/2);const S=c.fi!=null;let E;if(S){let O=g.facetStates;O||(g.facetStates=O=new Map),E=O.get(this),E||O.set(this,E=new Map)}const[k,T]=Ht(this,h),{px:L,py:z}=d,N=L?O=>L[O]:Rl(d,k),I=z?O=>z[O]:Bl(d,T);let G,R,B,F;function D(O,P){if(S)if(F&&(F=cancelAnimationFrame(F)),O==null)E.delete(c.fi);else{E.set(c.fi,P),F=requestAnimationFrame(()=>{F=null;for(const[X,U]of E)if(U1)){const U=G==null?null:te(p)?p[G]:p.get(G);m.dispatchValue(U)}return X}function _(O){if(g.sticky||O.pointerType==="mouse"&&O.buttons===1)return;let[P,X]=Jm(O);P-=A,X-=C;const U=Ph.width-h.marginRight?1:t,K=Xh.height-h.marginBottom?1:e;let nt=null,ft=a*a;for(const at of c){const ht=U*(N(at)-P),pt=K*(I(at)-X),Mt=ht*ht+pt*pt;Mt<=ft&&(nt=at,ft=Mt)}if(nt!=null&&(t!==1||e!==1)){const at=N(nt)-P,ht=I(nt)-X;ft=at*at+ht*ht}D(nt,ft)}function V(O){O.pointerType==="mouse"&&G!=null&&(g.sticky&&g.roots.some(P=>P?.contains(O.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(P=>P(null))):(g.sticky=!0,Y(G)),O.stopImmediatePropagation()))}function W(O){O.pointerType==="mouse"&&(g.sticky||D(null))}return w.addEventListener("pointerenter",_),w.addEventListener("pointermove",_),w.addEventListener("pointerdown",V),w.addEventListener("pointerleave",W),Y(null)},s)}}function qo(t){return jo(1,1,t)}function Po(t){return jo(1,.01,t)}function Pr(t){return jo(.01,1,t)}function Rl({x1:t,x2:e,x:n=t},r){return t&&e?i=>(t[i]+e[i])/2:n?i=>n[i]:()=>r}function Bl({y1:t,y2:e,y:n=t},r){return t&&e?i=>(t[i]+e[i])/2:n?i=>n[i]:()=>r}function Ol(t){return Oe(t)&&t.interval===void 0?void 0:"tabular-nums"}function fb(t,e){let{label:n=t.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:a=18,marginRight:u=0,marginBottom:s=16+r,marginLeft:l=0,style:c,ticks:f=(i-l-u)/64,tickFormat:d,fontVariant:h=Ol(t),round:m=!0,opacity:y,className:w}=e;const p=jr(e);w=Yo(w),y=dt(y)[1],d===null&&(d=()=>null);const g=Z("svg",p).attr("class",`${w}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(k=>k.append("style").text(`:where(.${w}-ramp) { display: block; height: auto; height: intrinsic; max-width: 100%; overflow: visible; } :where(.${w}-ramp text) { white-space: pre; }`)).call(Go,c);let v=k=>k.selectAll(".tick line").attr("y1",a+s-o),b;const M=m?(k,T)=>k.rangeRound(T):(k,T)=>k.range(T),{type:x,domain:$,range:A,interpolate:C,scale:S,pivot:E}=t;if(C){const k=A===void 0?C:zi(C.length===1?xo(C):C,A);b=M(S.copy(),Ot(Sn(l,i-u),Math.min($.length+(E!==void 0),A===void 0?1/0:A.length)));const T=256,L=p.document.createElement("canvas");L.width=T,L.height=1;const z=L.getContext("2d");for(let N=0,I=T-1;NL:typeof d=="string"?Ii(d):d;b=M(Hu().domain([-1,A.length-1]),[l,i-u]),g.append("g").attr("fill-opacity",y).selectAll().data(A).enter().append("rect").attr("x",(L,z)=>b(z-1)).attr("y",a).attr("width",(L,z)=>b(z)-b(z-1)).attr("height",o-a-s).attr("fill",L=>L),f=J(k,(L,z)=>z),d=L=>T(k[L],L)}else b=M(Zu().domain($),[l,i-u]),g.append("g").attr("fill-opacity",y).selectAll().data($).enter().append("rect").attr("x",b).attr("y",a).attr("width",Math.max(0,b.bandwidth()-1)).attr("height",o-a-s).attr("fill",S),v=()=>{};return g.append("g").attr("transform",`translate(0,${o-s})`).call(ty(b).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",yt(h,"normal")).call(v).call(k=>k.select(".domain").remove()),n!==void 0&&g.append("text").attr("x",l).attr("y",a-6).attr("fill","currentColor").attr("font-weight","bold").text(n),g.node()}const Wr=Math.PI/180;function an(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:i=e}={}){t.markerStart=Wo(n),t.markerMid=Wo(r),t.markerEnd=Wo(i)}function Wo(t){if(t==null||t===!1)return null;if(t===!0)return Dl;if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return Fl("auto");case"arrow-reverse":return Fl("auto-start-reverse");case"dot":return db;case"circle":case"circle-fill":return Dl;case"circle-stroke":return hb;case"tick":return Xo("auto");case"tick-x":return Xo(90);case"tick-y":return Xo(0)}throw new Error(`invalid marker: ${t}`)}function Fl(t){return(e,n)=>Z("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 db(t,e){return Z("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 Dl(t,e){return Z("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 hb(t,e){return Z("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 Xo(t){return(e,n)=>Z("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()}let mb=0;function Zn(t,e,{stroke:n},r){return Gl(t,e,n&&(i=>n[i]),null,r)}function yb(t,e,{stroke:n,z:r},i){return Gl(t,e,n&&(([o])=>n[o]),r,i)}const _o=1,Yl=2;function pb(t,e){const n=new Uint8Array(e.length),r=t.data().filter(o=>o.length>1),i=r.length;for(let o=0,a=Oo;o1){const s=u[0];a!==(a=ne(e[s]))&&(n[s]|=_o)}}for(let o=i-1,a=Oo;o>=0;--o){const u=r[o];if(u.length>1){const s=u[0];a!==(a=ne(e[s]))&&(n[s]|=Yl)}}return([o])=>n[o]}function Gl(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:i},o=()=>i,a,u){if(!e&&!n&&!r)return;const s=new Map,l=a&&pb(t,a);function c(f,d,h){return function(m){if(h&&!h(m))return;const y=o(m);let w=s.get(d);w||s.set(d,w=new Map);let p=w.get(y);if(!p){const g=this.parentNode.insertBefore(d(y,u),this),v=`plot-marker-${++mb}`;g.setAttribute("id",v),w.set(y,p=`url(#${v})`)}this.setAttribute(f,p)}}e&&t.each(c("marker-start",e,l&&(f=>l(f)&_o))),n&&l&&t.each(c("marker-start",n,f=>!(l(f)&_o))),n&&t.each(c("marker-mid",n)),r&&t.each(c("marker-end",r,l&&(f=>l(f)&Yl)))}function Un({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=jl(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function Kn({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=jl(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function jl(t,e,n){return t===void 0&&e===void 0&&n===void 0?$t?[1,0]:[.5,.5]:[e,n]}function ql(t,{interval:e}){return t={...Je(t)},t.interval=Lr(t.interval===void 0?e:t.interval),t}function Xr(t,e,n,r){const{[t]:i,[`${t}1`]:o,[`${t}2`]:a}=n,{value:u,interval:s}=ql(i,n);if(u==null||s==null&&!r)return n;const l=Xt(i);if(s==null){let h;const m={transform:y=>h||(h=H(y,u)),label:l};return{...n,[t]:void 0,[`${t}1`]:o===void 0?m:o,[`${t}2`]:a===void 0&&!(o===a&&r)?m:a}}let c,f;function d(h){return f!==void 0&&h===c?f:f=J(H(c=h,u),m=>s.floor(m))}return e({...n,[t]:void 0,[`${t}1`]:o===void 0?{transform:d,label:l}:o,[`${t}2`]:a===void 0?{transform:h=>d(h).map(m=>s.offset(m)),label:l}:a})}function Pl(t,e,n){const{[t]:r}=n,{value:i,interval:o}=ql(r,n);return i==null||o==null?n:e({...n,[t]:{label:Xt(r),transform:a=>{const u=J(H(a,i),l=>o.floor(l)),s=u.map(l=>o.offset(l));return u.map(St(u)?(l,c)=>l==null||isNaN(l=+l)||(c=s[c],c==null)||isNaN(c=+c)?void 0:new Date((l+c)/2):(l,c)=>l==null||(c=s[c],c==null)?NaN:(+l+ +c)/2)}}})}function Wl(t={}){return Xr("x",Un,t,!0)}function Xl(t={}){return Xr("y",Kn,t,!0)}function Vo(t={}){return Xr("x",Un,t)}function Ho(t={}){return Xr("y",Kn,t)}function _l(t={}){return Pl("x",Un,t)}function Vl(t={}){return Pl("y",Kn,t)}const Hl={ariaLabel:"rule",fill:null,stroke:"currentColor"};class Zl extends et{constructor(e,n={}){const{x:r,y1:i,y2:o,inset:a=0,insetTop:u=a,insetBottom:s=a}=n;super(e,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},Fe(n,"x"),Hl),this.insetTop=rt(u),this.insetBottom=rt(s),an(this,n)}render(e,n,r,i,o){const{x:a,y:u}=n,{x:s,y1:l,y2:c}=r,{width:f,height:d,marginTop:h,marginRight:m,marginLeft:y,marginBottom:w}=i,{insetTop:p,insetBottom:g}=this;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{x:s&&a},$t,0).call(v=>v.selectAll().data(e).enter().append("line").call(Q,this).attr("x1",s?b=>s[b]:(y+f-m)/2).attr("x2",s?b=>s[b]:(y+f-m)/2).attr("y1",l&&!Vt(u)?b=>l[b]+p:h+p).attr("y2",c&&!Vt(u)?u.bandwidth?b=>c[b]+u.bandwidth()-g:b=>c[b]-g:d-w-g).call(lt,this,r).call(Zn,this,r,o)).node()}}class Ul extends et{constructor(e,n={}){const{x1:r,x2:i,y:o,inset:a=0,insetRight:u=a,insetLeft:s=a}=n;super(e,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},Fe(n,"y"),Hl),this.insetRight=rt(u),this.insetLeft=rt(s),an(this,n)}render(e,n,r,i,o){const{x:a,y:u}=n,{y:s,x1:l,x2:c}=r,{width:f,height:d,marginTop:h,marginRight:m,marginLeft:y,marginBottom:w}=i,{insetLeft:p,insetRight:g}=this;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{y:s&&u},0,$t).call(v=>v.selectAll().data(e).enter().append("line").call(Q,this).attr("x1",l&&!Vt(a)?b=>l[b]+p:y+p).attr("x2",c&&!Vt(a)?a.bandwidth?b=>c[b]+a.bandwidth()-g:b=>c[b]-g:f-m-g).attr("y1",s?b=>s[b]:(h+d-w)/2).attr("y2",s?b=>s[b]:(h+d-w)/2).call(lt,this,r).call(Zn,this,r,o)).node()}}function xe(t,e){let{x:n=j,y:r,y1:i,y2:o,...a}=Ho(e);return[i,o]=Kl(r,i,o),new Zl(t,{...a,x:n,y1:i,y2:o})}function ve(t,e){let{y:n=j,x:r,x1:i,x2:o,...a}=Vo(e);return[i,o]=Kl(r,i,o),new Ul(t,{...a,y:n,x1:i,x2:o})}function Kl(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 Qn(t,...e){let n=e.length;for(let r=0,i=!0;r{let i=t[0];for(let o=0;o=0))throw new Error(`invalid lineWidth: ${c}`);this.splitLines=ic(this),this.clipLine=oc(this)}render(e,n,r,i,o){const{x:a,y:u}=n,{x:s,y:l,rotate:c,text:f,title:d,fontSize:h}=r,{rotate:m}=this,[y,w]=Ht(this,i);return Z("svg:g",o).call(ot,this,i,o).call(nc,this,f,i).call(tt,this,{x:s&&a,y:l&&u}).call(p=>p.selectAll().data(e).enter().append("text").call(Q,this).call(bb,this,f,d).attr("transform",Qn`translate(${s?g=>s[g]:y},${l?g=>l[g]:w})${c?g=>` rotate(${c[g]})`:m?` rotate(${m})`:""}`).call(q,"font-size",h&&(g=>h[g])).call(lt,this,r)).node()}}function Jl(t){return t==null?null:Tt(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function bb(t,e,n,r){if(!n)return;const{lineAnchor:i,lineHeight:o,textOverflow:a,splitLines:u,clipLine:s}=e;t.each(function(l){const c=u(on(n[l])??"").map(s),f=c.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let m=0;mi&&n(t,i,u)>e&&(r.push(t.slice(i,o)+(t[o-1]===Ql?"-":"")),i=a),s){r.push(t.slice(i,u)),i=void 0;continue}o=u}return r}function*Mb(t){let e=0,n=0;const r=t.length;for(;no.split(/\r\n?|\n/g);const r=t?Uo:Zo,i=e*100;return o=>$b(o,i,r)}function oc({monospace:t,lineWidth:e,textOverflow:n}){if(n==null||e==1/0)return o=>o;const r=t?Uo:Zo,i=e*100;switch(n){case"clip-start":return o=>uc(o,i,r,"");case"clip-end":return o=>ac(o,i,r,"");case"ellipsis-start":return o=>uc(o,i,r,sn);case"ellipsis-middle":return o=>Ab(o,i,r,sn);case"ellipsis-end":return o=>ac(o,i,r,sn)}}const sn="\u2026";function ln(t,e,n,r){const i=[];let o=0;for(let a=0,u=0,s=t.length;ae){for(o+=r;o>e&&a>0;)u=a,a=i.pop(),o-=n(t,a,u);return[a,e-o]}o+=l,i.push(a)}return[-1,0]}function ac(t,e,n,r){t=t.trim();const i=n(r),[o]=ln(t,e,n,i);return o<0?t:t.slice(0,o).trimEnd()+r}function Ab(t,e,n,r){t=t.trim();const i=n(t);if(i<=e)return t;const o=n(r)/2,[a,u]=ln(t,e/2,n,o),[s]=ln(t,i-e/2-u+o,n,-o);return s<0?r:t.slice(0,a).trimEnd()+r+t.slice(cn(t,s)).trimStart()}function uc(t,e,n,r){t=t.trim();const i=n(t);if(i<=e)return t;const o=n(r),[a]=ln(t,i-e+o,n,-o);return a<0?r:r+t.slice(cn(t,a)).trimStart()}const Ko=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,sc=/\p{Extended_Pictographic}/uy;function cn(t,e){return e+=Cb(t,e)?2:1,kb(t,e)&&(e=Ko.lastIndex),Sb(t,e)?cn(t,e+1):e}function lc(t,e){return t.charCodeAt(e)<128}function Cb(t,e){const n=t.charCodeAt(e);if(n>=55296&&n<56320){const r=t.charCodeAt(e+1);return r>=56320&&r<57344}return!1}function Sb(t,e){return t.charCodeAt(e)===8205}function kb(t,e){return lc(t,e)?!1:(Ko.lastIndex=e,Ko.test(t))}function cc(t,e){return lc(t,e)?!1:(sc.lastIndex=e,sc.test(t))}const fc={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},dc=3.5,Lb=dc*5,hc={draw(t,e,n){const r=e*n/Lb;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},mc={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},Eb=new Map([["arrow",hc],["spike",mc]]);function Tb(t){return t&&typeof t.draw=="function"}function zb(t){if(Tb(t))return t;const e=Eb.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}class Vr extends et{constructor(e,n={}){const{x:r,y:i,r:o=dc,length:a,rotate:u,shape:s=hc,anchor:l="middle",frameAnchor:c}=n,[f,d]=dt(a,12),[h,m]=dt(u,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,fc),this.r=+o,this.length=d,this.rotate=m,this.shape=zb(s),this.anchor=Tt(l,"anchor",["start","middle","end"]),this.frameAnchor=On(c)}render(e,n,r,i,o){const{x:a,y:u}=n,{x:s,y:l,length:c,rotate:f}=r,{length:d,rotate:h,anchor:m,shape:y,r:w}=this,[p,g]=Ht(this,i);return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{x:s&&a,y:l&&u}).call(v=>v.selectAll().data(e).enter().append("path").call(Q,this).attr("transform",Qn`translate(${s?b=>s[b]:p},${l?b=>l[b]:g})${f?b=>` rotate(${f[b]})`:h?` rotate(${h})`:""}${m==="start"?"":m==="end"?c?b=>` translate(0,${c[b]})`:` translate(0,${d})`:c?b=>` translate(0,${c[b]/2})`:` translate(0,${d/2})`}`).attr("d",c?b=>{const M=Qt();return y.draw(M,c[b],w),M}:(()=>{const b=Qt();return y.draw(b,d,w),b})()).call(lt,this,r)).node()}}function yc(t,e={}){let{x:n,y:r,...i}=e;return e.frameAnchor===void 0&&([n,r]=Ft(n,r)),new Vr(t,{...i,x:n,y:r})}function pc(t,e={}){const{x:n=j,...r}=e;return new Vr(t,{...r,x:n})}function gc(t,e={}){const{y:n=j,...r}=e;return new Vr(t,{...r,y:n})}function Nb(t,e={}){const{shape:n=mc,stroke:r=fc.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:a=.3,anchor:u="start",...s}=e;return yc(t,{...s,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:a,anchor:u})}function $e(t,e){return arguments.length<2&&!re(t)&&(e=t,t=null),e===void 0&&(e={}),[t,e]}function Hr({anchor:t}={},e){return t===void 0?e[0]:Tt(t,"anchor",e)}function bc(t){return Hr(t,["left","right"])}function wc(t){return Hr(t,["right","left"])}function xc(t){return Hr(t,["bottom","top"])}function vc(t){return Hr(t,["top","bottom"])}function Qo(){const[t,e]=$e(...arguments);return Ac("y",bc(e),t,e)}function $c(){const[t,e]=$e(...arguments);return Ac("fy",wc(e),t,e)}function Jo(){const[t,e]=$e(...arguments);return Cc("x",xc(e),t,e)}function Mc(){const[t,e]=$e(...arguments);return Cc("fx",vc(e),t,e)}function Ac(t,e,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:a=i,strokeWidth:u=1,fill:s=r,fillOpacity:l=i,textAnchor:c,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:m=t==="y"?6:0,tickPadding:y,tickRotate:w,x:p,margin:g,marginTop:v=g===void 0?20:g,marginRight:b=g===void 0?e==="right"?40:0:g,marginBottom:M=g===void 0?20:g,marginLeft:x=g===void 0?e==="left"?40:0:g,label:$,labelAnchor:A,labelArrow:C,labelOffset:S,ariaLabel:E=`${t}-axis`,...k}){return m=rt(m),y=rt(y),w=rt(w),A!==void 0&&(A=Tt(A,"labelAnchor",["center","top","bottom"])),C=Fc(C),Bt(m&&!ut(o)?Ib(t,e,n,{stroke:o,strokeOpacity:a,strokeWidth:u,tickSize:m,tickPadding:y,tickRotate:w,x:p,ariaLabel:E,...k}):null,ut(s)?null:Bb(t,e,n,{fill:s,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:c,tickSize:m,tickPadding:y,tickRotate:w,x:p,marginTop:v,marginRight:b,marginBottom:M,marginLeft:x,ariaLabel:E,...k}),!ut(s)&&$!==null?un([],Ic({fill:s,fillOpacity:l,...k},function(T,L,z,N,I){const G=N[t],{marginTop:R,marginRight:B,marginBottom:F,marginLeft:D}=t==="y"&&I.inset||I,Y=A??(G.bandwidth?"center":"top"),_=S??(e==="right"?B:D)-3;return Y==="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=Y,this.frameAnchor=`${Y}-${e}`,this.rotate=0),this.dy=Y==="top"?3-R:Y==="bottom"?F-3:0,this.dx=e==="right"?_:-_,this.ariaLabel=`${E} label`,{facets:[[0]],channels:{text:{value:[Oc(t,G,{anchor:e,label:$,labelAnchor:Y,labelArrow:C})]}}}})):null)}function Cc(t,e,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:a=i,strokeWidth:u=1,fill:s=r,fillOpacity:l=i,textAnchor:c,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:m=t==="x"?6:0,tickPadding:y,tickRotate:w,y:p,margin:g,marginTop:v=g===void 0?e==="top"?30:0:g,marginRight:b=g===void 0?20:g,marginBottom:M=g===void 0?e==="bottom"?30:0:g,marginLeft:x=g===void 0?20:g,label:$,labelAnchor:A,labelArrow:C,labelOffset:S,ariaLabel:E=`${t}-axis`,...k}){return m=rt(m),y=rt(y),w=rt(w),A!==void 0&&(A=Tt(A,"labelAnchor",["center","left","right"])),C=Fc(C),Bt(m&&!ut(o)?Rb(t,e,n,{stroke:o,strokeOpacity:a,strokeWidth:u,tickSize:m,tickPadding:y,tickRotate:w,y:p,ariaLabel:E,...k}):null,ut(s)?null:Ob(t,e,n,{fill:s,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:c,tickSize:m,tickPadding:y,tickRotate:w,y:p,marginTop:v,marginRight:b,marginBottom:M,marginLeft:x,ariaLabel:E,...k}),!ut(s)&&$!==null?un([],Ic({fill:s,fillOpacity:l,...k},function(T,L,z,N,I){const G=N[t],{marginTop:R,marginRight:B,marginBottom:F,marginLeft:D}=t==="x"&&I.inset||I,Y=A??(G.bandwidth?"center":"right"),_=S??(e==="top"?R:F)-3;return Y==="center"?(this.frameAnchor=e,this.textAnchor=void 0):(this.frameAnchor=`${e}-${Y}`,this.textAnchor=Y==="right"?"end":"start"),this.lineAnchor=e,this.dy=e==="top"?-_:_,this.dx=Y==="right"?B-3:Y==="left"?3-D:0,this.ariaLabel=`${E} label`,{facets:[[0]],channels:{text:{value:[Oc(t,G,{anchor:e,label:$,labelAnchor:Y,labelArrow:C})]}}}})):null)}function Ib(t,e,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:a=e+(t==="y"?"-empty":""),frameAnchor:u=e,tickSize:s,inset:l=0,insetLeft:c=l,insetRight:f=l,dx:d=0,y:h=t==="y"?void 0:null,ariaLabel:m,...y}){return fn(gc,t,n,{ariaLabel:`${m} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:a,frameAnchor:u,y:h,...y,dx:e==="left"?+d-$t+ +c:+d+$t-f,anchor:"start",length:s,shape:e==="left"?Gb:jb})}function Rb(t,e,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:a=e+(t==="x"?"-empty":""),frameAnchor:u=e,tickSize:s,inset:l=0,insetTop:c=l,insetBottom:f=l,dy:d=0,x:h=t==="x"?void 0:null,ariaLabel:m,...y}){return fn(pc,t,n,{ariaLabel:`${m} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:a,frameAnchor:u,x:h,...y,dy:e==="bottom"?+d-$t-f:+d+$t+ +c,anchor:"start",length:s,shape:e==="bottom"?Db:Yb})}function Bb(t,e,n,{facetAnchor:r=e+(t==="y"?"-empty":""),frameAnchor:i=e,tickSize:o,tickRotate:a=0,tickPadding:u=Math.max(3,9-o)+(Math.abs(a)>60?4*Math.cos(a*Wr):0),text:s,textAnchor:l=Math.abs(a)>60?"middle":e==="left"?"end":"start",lineAnchor:c=a>60?"top":a<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:m=d,dx:y=0,ariaLabel:w,y:p=t==="y"?void 0:null,...g}){return fn(ec,t,n,{ariaLabel:`${w} tick label`},{facetAnchor:r,frameAnchor:i,text:s,textAnchor:l,lineAnchor:c,fontVariant:f,rotate:a,y:p,...g,dx:e==="left"?+y-o-u+ +h:+y+ +o+ +u-m},function(v,b,M,x,$){f===void 0&&(this.fontVariant=Bc(v)),s===void 0&&($.text=Rc(v,b,M,x,e))})}function Ob(t,e,n,{facetAnchor:r=e+(t==="x"?"-empty":""),frameAnchor:i=e,tickSize:o,tickRotate:a=0,tickPadding:u=Math.max(3,9-o)+(Math.abs(a)>=10?4*Math.cos(a*Wr):0),text:s,textAnchor:l=Math.abs(a)>=10?a<0^e==="bottom"?"start":"end":"middle",lineAnchor:c=Math.abs(a)>=10?"middle":e==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:m=d,dy:y=0,x:w=t==="x"?void 0:null,ariaLabel:p,...g}){return fn(tc,t,n,{ariaLabel:`${p} tick label`},{facetAnchor:r,frameAnchor:i,text:s===void 0?null:s,textAnchor:l,lineAnchor:c,fontVariant:f,rotate:a,x:w,...g,dy:e==="bottom"?+y+ +o+ +u-m:+y-o-u+ +h},function(v,b,M,x,$){f===void 0&&(this.fontVariant=Bc(v)),s===void 0&&($.text=Rc(v,b,M,x,e))})}function Sc(){const[t,e]=$e(...arguments);return Tc("y",bc(e),t,e)}function kc(){const[t,e]=$e(...arguments);return Tc("fy",wc(e),t,e)}function Lc(){const[t,e]=$e(...arguments);return zc("x",xc(e),t,e)}function Ec(){const[t,e]=$e(...arguments);return zc("fx",vc(e),t,e)}function Tc(t,e,n,{y:r=t==="y"?void 0:null,x:i=null,x1:o=e==="left"?i:null,x2:a=e==="right"?i:null,ariaLabel:u=`${t}-grid`,ariaHidden:s=!0,...l}){return fn(ve,t,n,{ariaLabel:u,ariaHidden:s},{y:r,x1:o,x2:a,...Nc(l)})}function zc(t,e,n,{x:r=t==="x"?void 0:null,y:i=null,y1:o=e==="top"?i:null,y2:a=e==="bottom"?i:null,ariaLabel:u=`${t}-grid`,ariaHidden:s=!0,...l}){return fn(xe,t,n,{ariaLabel:u,ariaHidden:s},{x:r,y1:o,y2:a,...Nc(l)})}function Nc({color:t="currentColor",opacity:e=.1,stroke:n=t,strokeOpacity:r=e,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function Ic({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:a,monospace:u,pointerEvents:s,shapeRendering:l,clip:c=!1},f){return[,t]=Ct(t),[,e]=dt(e),{facet:"super",x:null,y:null,fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:a,monospace:u,pointerEvents:s,shapeRendering:l,clip:c,initializer:f}}function fn(t,e,n,r,i,o){let a;function u(c,f,d,h,m,y){const w=c==null&&(e==="fx"||e==="fy"),{[e]:p}=h;if(!p)throw new Error(`missing scale: ${e}`);const g=p.domain();let{interval:v,ticks:b,tickFormat:M,tickSpacing:x=e==="x"?80:35}=i;if(typeof b=="string"&&Dc(p)&&(v=b,b=void 0),b===void 0&&(b=Ke(v,p.type)??Fb(p,x)),c==null){if(re(b))c=ye(b);else if(Qe(b))c=ea(b,...gt(g));else if(p.interval){let A=p.interval;if(p.ticks){const[C,S]=gt(g),E=(S-C)/A[En];A=os(A,E/b)??A,c=ea(A,C,S)}else{c=g;const C=c.length;A=os(A,C/b)??A,A!==p.interval&&(c=ea(A,...gt(c)))}if(A===p.interval){const C=Math.round(c.length/b);C>1&&(c=c.filter((S,E)=>E%C===0))}}else p.ticks?c=p.ticks(b):c=g;if(!p.ticks&&c.length&&c!==g){const A=new An(g);c=c.filter(C=>A.has(C)),c.length||se(`Warning: the ${e}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}e==="y"||e==="x"?f=[ee(c)]:a[e]={scale:e,value:j}}o?.call(this,p,c,b,M,a);const $=Object.fromEntries(Object.entries(a).map(([A,C])=>[A,{...C,value:H(c,C.value)}]));return w&&(f=y.filterFacets(c,$)),{data:c,facets:f,channels:$}}const s=At(i).initializer,l=t(n,At({...i,initializer:u},s));return n==null?(a=l.channels,l.channels={}):a={},r!==void 0&&Object.assign(l,r),l.clip===void 0&&(l.clip=!1),l}function Fb(t,e){const[n,r]=gt(t.range());return(r-n)/e}function Rc(t,e,n,r,i){return{value:ta(t,e,n,r,i)}}function ta(t,e,n,r,i){return typeof r=="function"&&!(t.type==="log"&&t.tickFormat)?r:r===void 0&&e&&St(e)?Gy(t.type,e,i)??on:t.tickFormat?t.tickFormat(typeof n=="number"?n:null,r):typeof r=="string"&&t.domain().length>0?(St(t.domain())?Si:Ii)(r):r===void 0?on:vt(r)}function ea(t,e,n){return t.range(e,t.offset(t.floor(n)))}const Db={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},Yb={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},Gb={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},jb={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function Bc(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function Oc(t,e,{anchor:n,label:r=e.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&Dc(e)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!e.bandwidth||e.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){const a=fl(e);a&&(o=/x$/.test(t)||i==="center"?/x$/.test(t)===a<0?"left":"right":a<0?"up":"down")}switch(o){case"left":return`\u2190 ${r}`;case"right":return`${r} \u2192`;case"up":return n==="right"?`${r} \u2191`:`\u2191 ${r}`;case"down":return n==="right"?`${r} \u2193`:`\u2193 ${r}`}return r}}function Fc(t="auto"){return ut(t)?!1:typeof t=="boolean"?t:Tt(t,"labelArrow",["auto","up","right","down","left"])}function Dc(t){return St(t.domain())}function Yc(t,e){if(e==null)return e;const n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function qb(t,{opacity:e,...n}={}){if(!Oe(t)&&!xl(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return Gc(t,n,(r,i,o,a)=>r.append("svg").attr("width",o).attr("height",a).attr("fill",i.scale).attr("fill-opacity",dt(e)[1]).append("rect").attr("width","100%").attr("height","100%"))}function Pb(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:ut(e)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:a=4.5,...u}={},s){const[l,c]=Ct(e),[f,d]=Ct(r),h=Yc(s,l),m=Yc(s,f),y=a*a*Math.PI;return n=dt(n)[1],i=dt(i)[1],o=dt(o)[1],Gc(t,u,(w,p,g,v)=>w.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",v).attr("fill",l==="color"?b=>h.scale(b):c).attr("fill-opacity",n).attr("stroke",f==="color"?b=>m.scale(b):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",b=>{const M=Qt();return t.scale(b).draw(M,y),M}))}function Gc(t,e={},n){let{columns:r,tickFormat:i,fontVariant:o=Ol(t),swatchSize:a=15,swatchWidth:u=a,swatchHeight:s=a,marginLeft:l=0,className:c,style:f,width:d}=e;const h=jr(e);c=Yo(c),i=ta(t.scale,t.domain,void 0,i);const m=Z("div",h).attr("class",`${c}-swatches ${c}-swatches-${r!=null?"columns":"wrap"}`);let y;return r!=null?(y=`:where(.${c}-swatches-columns .${c}-swatch) { display: flex; align-items: center; break-inside: avoid; padding-bottom: 1px; } :where(.${c}-swatches-columns .${c}-swatch::before) { flex-shrink: 0; } :where(.${c}-swatches-columns .${c}-swatch-label) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }`,m.style("columns",r).selectAll().data(t.domain).enter().append("div").attr("class",`${c}-swatch`).call(n,t,u,s).call(w=>w.append("div").attr("class",`${c}-swatch-label`).attr("title",i).text(i))):(y=`:where(.${c}-swatches-wrap) { display: flex; align-items: center; min-height: 33px; flex-wrap: wrap; } :where(.${c}-swatches-wrap .${c}-swatch) { display: inline-flex; align-items: center; margin-right: 1em; }`,m.selectAll().data(t.domain).enter().append("span").attr("class",`${c}-swatch`).call(n,t,u,s).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),m.call(w=>w.insert("style","*").text(`:where(.${c}-swatches) { font-family: system-ui, sans-serif; font-size: 10px; margin-bottom: 0.5em; } :where(.${c}-swatch > svg) { margin-right: 0.5em; overflow: visible; } ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",yt(o,"normal")).call(Go,f).node()}const Zr=new Map([["symbol",Pb],["color",jc],["opacity",_b]]);function Wb(t={}){for(const[e,n]of Zr){const r=t[e];if(Ie(r)){const i=jr(t);let o;if(e==="symbol"){const{fill:a,stroke:u=a===void 0&&Ie(t.color)?"color":void 0}=t;o={fill:a,stroke:u}}return n(Co(e,r,o),na(i,r,t),a=>Ie(t[a])?Co(a,t[a]):null)}}throw new Error("unknown legend type; no scale found")}function Xb(t,e,n={}){return(r,i)=>{if(!Zr.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return Zr.get(r)(t[r],na(e,n[r],i),o=>t[o])}}function na({className:t,...e},{label:n,ticks:r,tickFormat:i}={},o){return np(o,{className:t,...e},{label:n,ticks:r,tickFormat:i})}function jc(t,{legend:e=!0,...n}){if(e===!0&&(e=t.type==="ordinal"?"swatches":"ramp"),t.domain!==void 0)switch(`${e}`.toLowerCase()){case"swatches":return qb(t,n);case"ramp":return fb(t,n);default:throw new Error(`unknown legend type: ${e}`)}}function _b({type:t,interpolate:e,...n},{legend:r=!0,color:i=Ln(0,0,0),...o}){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 jc({type:t,...n,interpolate:Vb(i)},{legend:r,...o})}function Vb(t){const{r:e,g:n,b:r}=Ln(t)||Ln(0,0,0);return i=>`rgba(${e},${n},${r},${i})`}function Hb(t,e,n){const r=[];for(const[i,o]of Zr){const a=n[i];if(a?.legend&&i in t){const u=o(t[i],na(e,t[i],a),s=>t[s]);u!=null&&r.push(u)}}return r}function Ur(t={},e="x"){return gs(t)?t:{...t,[e]:j}}function Kr(t={},e="y"){return bs(t)?t:{...t,[e]:j}}function qc(t,e){if(e.length===1)return{data:t,facets:e};const n=Rn(t),r=new Uint8Array(n);let i=0;for(const u of e)for(const s of u)r[s]&&++i,r[s]=1;if(i===0)return{data:t,facets:e};t=In(t);const o=t[ls]=new Uint32Array(n+i);e=e.map(u=>In(u,Uint32Array));let a=n;r.fill(0);for(const u of e)for(let s=0,l=u.length;s{({data:y,facets:w}=qc(y,w));const g=t==null?void 0:c(kr(H(y,t),p?.[n])),v=H(y,e,Float64Array),b=H(y,s),M=o&&o(y,g,v,b),x=Rn(y),$=d(new Float64Array(x)),A=m(new Float64Array(x)),C=[];for(const S of w){const E=g?Array.from(Te(S,k=>g[k]).values()):[S];if(M)for(const k of E)k.sort(M);for(const k of E){let T=0,L=0;a&&k.reverse();for(const z of k){const N=v[z];N<0?T=A[z]=($[z]=T)+N:N>0?L=A[z]=($[z]=L)+N:A[z]=$[z]=L}}C.push(E)}return i&&i(C,$,A,b),{data:y,facets:w}}),l,f,h]}function tw(t){if(t!=null){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return ew;case"center":case"silhouette":return nw;case"wiggle":return _c}throw new Error(`unknown offset: ${t}`)}}function Xc(t,e){let n=0,r=0;for(const i of t){const o=e[i];or&&(r=o)}return[n,r]}function ew(t,e,n){for(const r of t)for(const i of r){const[o,a]=Xc(i,n);for(const u of i){const s=1/(a-o||1);e[u]=s*(e[u]-o),n[u]=s*(n[u]-o)}}}function nw(t,e,n){for(const r of t){for(const i of r){const[o,a]=Xc(i,n);for(const u of i){const s=(a+o)/2;e[u]-=s,n[u]-=s}}Vc(r,e,n)}Hc(t,e,n)}function _c(t,e,n,r){for(const i of t){const o=new Ni;let a=0;for(const u of i){let s=-1;const l=u.map(h=>Math.abs(n[h]-e[h])),c=u.map(h=>{s=r?r[h]:++s;const m=n[h]-e[h],y=o.has(s)?m-o.get(s):0;return o.set(s,m),y}),f=[0,...ey(c)];for(const h of u)e[h]+=a,n[h]+=a;const d=jt(l);d&&(a-=jt(l,(h,m)=>(c[m]/2+f[m])*h)/d)}Vc(i,e,n)}Hc(t,e,n)}function Vc(t,e,n){const r=It(t,i=>It(i,o=>e[o]));for(const i of t)for(const o of i)e[o]-=r,n[o]-=r}function Hc(t,e,n){const r=t.length;if(r===1)return;const i=t.map(u=>u.flat()),o=i.map(u=>(It(u,s=>e[s])+kt(u,s=>n[s]))/2),a=It(o);for(let u=0;u(i,o)=>t(r[i],r[o])}function ow(t){return(e,n,r,i)=>(o,a)=>t(i[o],i[a])}function aw(t){return ti(t,(e,n,r,i)=>Ri(ee(e),o=>jt(o,a=>r[a]),o=>i[o]))}function uw(t){return ti(t,(e,n,r,i)=>Ri(ee(e),o=>n[Bi(o,a=>r[a])],o=>i[o]))}function Zc(t){return ti(t,(e,n,r,i)=>{const o=ee(e),a=Ri(o,f=>n[Bi(f,d=>r[d])],f=>i[f]),u=Mn(o,f=>jt(f,d=>r[d]),f=>i[f]),s=[],l=[];let c=0;for(const f of a)c<0?(c+=u.get(f),s.push(f)):(c-=u.get(f),l.push(f));return l.reverse().concat(s)})}function Uc(t){return e=>{const n=H(e,t);return(r,i)=>Rt(n[r],n[i])}}function sw(t){return e=>te(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r))}function lw(t){return ti(Rt,()=>t)}function ti(t,e){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");const a=new Ni(e(n,r,i,o).map((u,s)=>[u,s]));return(u,s)=>t(a.get(o[u]),a.get(o[s]))}}const cw={ariaLabel:"rect"};class ei extends et{constructor(e,n={}){const{x1:r,y1:i,x2:o,y2:a}=n;super(e,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&a==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0}},n,cw),ra(this,n),ia(this,n)}render(e,n,r,i,o){const{x:a,y:u}=n;let{x1:s,y1:l,x2:c,y2:f}=r;const{marginTop:d,marginRight:h,marginBottom:m,marginLeft:y,width:w,height:p}=i,{projection:g}=o,{insetTop:v,insetRight:b,insetBottom:M,insetLeft:x}=this,{rx:$,ry:A,rx1y1:C,rx1y2:S,rx2y1:E,rx2y2:k}=this;(s||c)&&!g&&Vt(a)&&(s=c=null),(l||f)&&!g&&Vt(u)&&(l=f=null);const T=a?.bandwidth?a.bandwidth():0,L=u?.bandwidth?u.bandwidth():0;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{},0,0).call(z=>z.selectAll().data(e).enter().call(C||S||E||k?N=>N.append("path").call(Q,this).call(oa,s&&c?I=>s[I]+(c[I]s[I]+x:y+x,l&&f?I=>l[I]+(f[I]l[I]+v:d+v,s&&c?I=>c[I]-(c[I]s[I]+T-b:w-h-b,l&&f?I=>f[I]-(f[I]l[I]+L-M:p-m-M,this).call(lt,this,r):N=>N.append("rect").call(Q,this).attr("x",s?c?I=>Math.min(s[I],c[I])+x:I=>s[I]+x:y+x).attr("y",l?f?I=>Math.min(l[I],f[I])+v:I=>l[I]+v:d+v).attr("width",s?c?I=>Math.max(0,Math.abs(c[I]-s[I])+T-x-b):T-x-b:w-h-y-b-x).attr("height",l?f?I=>Math.max(0,Math.abs(l[I]-f[I])+L-v-M):L-v-M:p-d-m-v-M).call(q,"rx",$).call(q,"ry",A).call(lt,this,r))).node()}}function ra(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:i=e,insetLeft:o=e}={}){t.insetTop=rt(n),t.insetRight=rt(r),t.insetBottom=rt(i),t.insetLeft=rt(o)}function ia(t,{r:e,rx:n,ry:r,rx1:i=e,ry1:o=e,rx2:a=e,ry2:u=e,rx1y1:s=i!==void 0?+i:o!==void 0?+o:0,rx1y2:l=i!==void 0?+i:u!==void 0?+u:0,rx2y1:c=a!==void 0?+a:o!==void 0?+o:0,rx2y2:f=a!==void 0?+a:u!==void 0?+u:0}={}){s||l||c||f?(t.rx1y1=s,t.rx1y2=l,t.rx2y1=c,t.rx2y2=f):(t.rx=yt(n,"auto"),t.ry=yt(r,"auto"))}function oa(t,e,n,r,i,o){const{rx1y1:a,rx1y2:u,rx2y1:s,rx2y2:l}=o;typeof e!="function"&&(e=vt(e)),typeof n!="function"&&(n=vt(n)),typeof r!="function"&&(r=vt(r)),typeof i!="function"&&(i=vt(i));const c=Math.max(Math.abs(a+s),Math.abs(u+l)),f=Math.max(Math.abs(a+u),Math.abs(s+l));t.attr("d",d=>{const h=e(d),m=n(d),y=r(d),w=i(d),p=h>y,g=m>w,v=p?y:h,b=p?h:y,M=g?w:m,x=g?m:w,$=Math.min(1,(b-v)/c,(x-M)/f),A=$*(p?g?l:s:g?u:a),C=$*(p?g?u:a:g?l:s),S=$*(p?g?a:u:g?s:l),E=$*(p?g?s:l:g?a:u);return`M${v},${M+ri(A,E)}A${A},${A} 0 0 ${A<0?0:1} ${v+ni(A,E)},${M}H${b-ni(C,S)}A${C},${C} 0 0 ${C<0?0:1} ${b},${M+ri(C,S)}V${x-ri(S,C)}A${S},${S} 0 0 ${S<0?0:1} ${b-ni(S,C)},${x}H${v+ni(E,A)}A${E},${E} 0 0 ${E<0?0:1} ${v},${x-ri(E,A)}Z`})}function ni(t,e){return e<0?t:Math.abs(t)}function ri(t,e){return e<0?Math.abs(t):t}function aa(t,e){return new ei(t,Wl(Xl(e)))}function ii(t,e={}){return Ue(e)||(e={...e,y:mt,x2:j,interval:1}),new ei(t,Qr(Xl(Ur(e))))}function oi(t,e={}){return Ue(e)||(e={...e,x:mt,y2:j,interval:1}),new ei(t,Jr(Wl(Kr(e))))}const fw={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},dw={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1};class Kc extends et{constructor(e={}){const{anchor:n=null}=e;super(zn,void 0,e,n==null?fw:dw),this.anchor=ys(n,"anchor",["top","right","bottom","left"]),ra(this,e),n||ia(this,e)}render(e,n,r,i,o){const{marginTop:a,marginRight:u,marginBottom:s,marginLeft:l,width:c,height:f}=i,{anchor:d,insetTop:h,insetRight:m,insetBottom:y,insetLeft:w}=this,{rx:p,ry:g,rx1y1:v,rx1y2:b,rx2y1:M,rx2y2:x}=this,$=l+w,A=c-u-m,C=a+h,S=f-s-y;return Z(d?"svg:line":v||b||M||x?"svg:path":"svg:rect",o).datum(0).call(ot,this,i,o).call(Q,this).call(lt,this,r).call(tt,this,{}).call(d==="left"?E=>E.attr("x1",$).attr("x2",$).attr("y1",C).attr("y2",S):d==="right"?E=>E.attr("x1",A).attr("x2",A).attr("y1",C).attr("y2",S):d==="top"?E=>E.attr("x1",$).attr("x2",A).attr("y1",C).attr("y2",C):d==="bottom"?E=>E.attr("x1",$).attr("x2",A).attr("y1",S).attr("y2",S):v||b||M||x?E=>E.call(oa,$,C,A,S,this):E=>E.attr("x",$).attr("y",C).attr("width",A-$).attr("height",S-C).attr("rx",p).attr("ry",g)).node()}}function ua(t){return new Kc(t)}const sa={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},hw=new Set(["geometry","href","src","ariaLabel","scales"]);class Qc extends et{constructor(e,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&re(e)&&Ms(e)&&(n={...n,title:j});const{x:r,y:i,x1:o,x2:a,y1:u,y2:s,anchor:l,preferredAnchor:c="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:m,fontVariant:y,fontWeight:w,lineHeight:p=1,lineWidth:g=20,frameAnchor:v,format:b,textAnchor:M="start",textOverflow:x,textPadding:$=8,title:A,pointerSize:C=12,pathFilter:S="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(e,{x:{value:o!=null&&a!=null?null:r,scale:"x",optional:!0},y:{value:u!=null&&s!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:a==null},y1:{value:u,scale:"y",optional:s==null},x2:{value:a,scale:"x",optional:o==null},y2:{value:s,scale:"y",optional:u==null},title:{value:A,optional:!0}},n,sa),this.anchor=Ki(l,"anchor"),this.preferredAnchor=Ki(c,"preferredAnchor"),this.frameAnchor=On(v),this.textAnchor=yt(M,"middle"),this.textPadding=+$,this.pointerSize=+C,this.pathFilter=xt(S),this.lineHeight=+p,this.lineWidth=+g,this.textOverflow=Jl(x),this.monospace=!!f,this.fontFamily=xt(d),this.fontSize=rt(h),this.fontStyle=xt(m),this.fontVariant=xt(y),this.fontWeight=xt(w);for(const E in sa)E in this.channels&&(this[E]=sa[E]);this.splitLines=ic(this),this.clipLine=oc(this),this.format=typeof b=="string"||typeof b=="function"?{title:b}:{...b}}render(e,n,r,i,o){const a=this,{x:u,y:s,fx:l,fy:c}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:m,lineHeight:y,lineWidth:w}=this,{textPadding:p,pointerSize:g,pathFilter:v}=this,{marginTop:b,marginLeft:M}=i,{x1:x,y1:$,x2:A,y2:C,x:S=x??A,y:E=$??C}=r,k=l?l(e.fx)-M:0,T=c?c(e.fy)-b:0,[L,z]=Ht(this,i),N=Rl(r,L),I=Bl(r,z),G=m?Uo:Zo,R=G(sn);let B,F;"title"in r?(B=tf.call(this,{title:r.channels.title},n),F=gw):(B=tf.call(this,r.channels,n),F=bw);const D=Z("svg:g",o).call(ot,this,i,o).call(nc,this).call(tt,this,{x:S&&u,y:E&&s}).call(V=>V.selectAll().data(e).enter().append("g").attr("transform",W=>`translate(${Math.round(N(W))},${Math.round(I(W))})`).call(Q,this).call(W=>W.append("path").attr("filter",v)).call(W=>W.append("text").each(function(O){const P=Kt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");const X=F.call(a,O,e,B,n,r);if(typeof X=="string")for(const U of a.splitLines(X))Y(P,{value:a.clipLine(U)});else{const U=new Set;for(const K of X){const{label:nt=""}=K;nt&&U.has(nt)||(U.add(nt),Y(P,K))}}})));function Y(V,{label:W,value:O,color:P,opacity:X}){W??="",O??="";const U=P!=null||X!=null;let K,nt=w*100;const[ft]=ln(W,nt,G,R);if(ft>=0)W=W.slice(0,ft).trimEnd()+sn,K=O.trim(),O="";else{(W||!O&&!U)&&(O=" "+O);const[ht]=ln(O,nt-G(W),G,R);ht>=0&&(K=O.trim(),O=O.slice(0,ht).trimEnd()+sn)}const at=V.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");W&&at.append("tspan").attr("font-weight","bold").text(W),O&&at.append(()=>d.createTextNode(O)),U&&at.append("tspan").text(" \u25A0").attr("fill",P).attr("fill-opacity",X).style("user-select","none"),K&&at.append("title").text(K)}function _(){const{width:V,height:W}=i.facet??i;D.selectChildren().each(function(O){let{x:P,width:X,height:U}=this.getBBox();X=Math.round(X),U=Math.round(U);let K=h;if(K===void 0){const at=N(O)+k,ht=I(O)+T,pt=at+X+g+p*20,Le=ht+U+g+p*20;K=pt&&Mt?Le&&Ee?a.preferredAnchor:Ee?"bottom":"top":Le&&Ee?pt?"left":"right":(pt||Mt)&&(Le||Ee)?`${Ee?"bottom":"top"}-${pt?"left":"right"}`:a.preferredAnchor}const nt=this.firstChild,ft=this.lastChild;if(nt.setAttribute("d",pw(K,g,p,X,U)),P)for(const at of ft.childNodes)at.setAttribute("x",-P);ft.setAttribute("y",`${+mw(K,ft.childNodes.length,y).toFixed(6)}em`),ft.setAttribute("transform",`translate(${yw(K,g,p,X,U)})`)}),D.attr("visibility",null)}return e.length&&(D.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(_):typeof requestAnimationFrame<"u"&&requestAnimationFrame(_)),D.node()}}function Jc(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=Ft(e,n)),new Qc(t,{...r,x:e,y:n})}function mw(t,e,n){return/^top(?:-|$)/.test(t)?.94-n:-.29-e*n}function yw(t,e,n,r,i){switch(t){case"middle":return[-r/2,i/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,i/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,i/2]}}function pw(t,e,n,r,i){const o=r+n*2,a=i+n*2;switch(t){case"middle":return`M${-o/2},${-a/2}h${o}v${a}h${-o}z`;case"top-left":return`M0,0l${e},${e}h${o-e}v${a}h${-o}z`;case"top":return`M0,0l${e/2},${e/2}h${(o-e)/2}v${a}h${-o}v${-a}h${(o-e)/2}z`;case"top-right":return`M0,0l${-e},${e}h${e-o}v${a}h${o}z`;case"right":return`M0,0l${-e/2},${-e/2}v${e/2-a/2}h${-o}v${a}h${o}v${e/2-a/2}z`;case"bottom-left":return`M0,0l${e},${-e}h${o-e}v${-a}h${-o}z`;case"bottom":return`M0,0l${e/2},${-e/2}h${(o-e)/2}v${-a}h${-o}v${a}h${(o-e)/2}z`;case"bottom-right":return`M0,0l${-e},${-e}h${e-o}v${-a}h${o}z`;case"left":return`M0,0l${e/2},${-e/2}v${e/2-a/2}h${o}v${a}h${-o}v${e/2-a/2}z`}}function tf(t,e){const n={};let r=this.format;r=ef(r,t,"x"),r=ef(r,t,"y"),this.format=r;for(const i in r){const o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{const a=po(t,i);a&&(n[i]=a)}}for(const i in t){if(i in n||i in r||hw.has(i)||(i==="x"||i==="y")&&t.geometry)continue;const o=po(t,i);if(o){if(o.scale==null&&o.defaultScale==="color")continue;n[i]=o}}this.facet&&(e.fx&&!("fx"in r)&&(n.fx=!0),e.fy&&!("fy"in r)&&(n.fy=!0));for(const i in n){const o=this.format[i];if(typeof o=="string"){const a=n[i]?.value??e[i]?.domain()??[];this.format[i]=(St(a)?Si:Ii)(o)}else if(o===void 0||o===!0){const a=e[i];this.format[i]=a?.bandwidth?ta(a,a.domain()):on}}return n}function ef(t,e,n){if(!(n in t))return t;const r=`${n}1`,i=`${n}2`;if((r in t||!(r in e))&&(i in t||!(i in e)))return t;const o=Object.entries(t),a=t[n];return o.splice(o.findIndex(([u])=>u===n)+1,0,[r,a],[i,a]),Object.fromEntries(o)}function gw(t,e,{title:n}){return this.format.title(n.value[t],t)}function*bw(t,e,n,r,i){for(const o in n){if(o==="fx"||o==="fy"){yield{label:ai(r,n,o),value:this.format[o](e[o],t)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;const a=n[o];if(o==="x2"&&"x1"in n)yield{label:rf(r,n,"x"),value:nf(this.format.x2,n.x1,a,t)};else if(o==="y2"&&"y1"in n)yield{label:rf(r,n,"y"),value:nf(this.format.y2,n.y1,a,t)};else{const u=a.value[t],s=a.scale;if(!wt(u)&&s==null)continue;yield{label:ai(r,n,o),value:this.format[o](u,t),color:s==="color"?i[o][t]:null,opacity:s==="opacity"?i[o][t]:null}}}}function nf(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 rf(t,e,n){const r=ai(t,e,`${n}1`,n),i=ai(t,e,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function ai(t,e,n,r=n){const i=e[n],o=t[i?.scale??n];return String(o?.label??i?.label??r)}function of(t={}){const{facet:e,style:n,title:r,subtitle:i,caption:o,ariaLabel:a,ariaDescription:u}=t,s=Yo(t.className),l=t.marks===void 0?[]:uf(t.marks);l.push(...Cw(l));const c=Mw(e,t),f=new Map;for(const R of l){const B=lf(R,c,t);B&&f.set(R,B)}const d=new Map;c&&Jn(d,[c],t),Jn(d,f,t);const h=uf(Sw(l,d,t));for(const R of h){const B=lf(R,c,t);B&&f.set(R,B)}l.unshift(...h);let m=wg(d,t);if(m!==void 0){const R=c?Io(m,c):void 0;for(const F of l){if(F.facet===null||F.facet==="super")continue;const D=f.get(F);D!==void 0&&(D.facetsIndex=F.fx!=null||F.fy!=null?Io(m,D):R)}const B=new Set;for(const{facetsIndex:F}of f.values())F?.forEach((D,Y)=>{D?.length>0&&B.add(Y)});m.forEach(0F.empty=!B.has(D):F=>F.empty=!1);for(const F of l)if(F.facet==="exclude"){const D=f.get(F);D!==void 0&&(D.facetsIndex=$g(D.facetsIndex))}}for(const R of st.keys())Ie(t[R])&&R!=="fx"&&R!=="fy"&&d.set(R,[]);const y=new Map;for(const R of l){if(y.has(R))throw new Error("duplicate mark; each mark must be unique");const{facetsIndex:B,channels:F}=f.get(R)??{},{data:D,facets:Y,channels:_}=R.initialize(B,F,t);la(_,t),y.set(R,{data:D,facets:Y,channels:_})}const w=Mo(Jn(d,y,t),t),p=lb(w,l,t);fg(w,p);const g=cl(w),{fx:v,fy:b}=g,M=v||b?dl(w,p):p,x=v||b?Iw(g,p):p,$=jr(t),A=$.document,C=Uu("svg").call(A.documentElement);let S=C;$.ownerSVGElement=C,$.className=s,$.projection=zg(t,M),$.path=function(){return kn(this.projection??Fg(g))},$.filterFacets=(R,B)=>Io(m,{channels:B,groups:ko(R,B)}),$.getMarkState=R=>{const B=y.get(R),F=f.get(R);return{...B,channels:{...B.channels,...F?.channels}}},$.dispatchValue=R=>{S.value!==R&&(S.value=R,S.dispatchEvent(new $.document.defaultView.Event("input",{bubbles:!0})))};const E=new Set;for(const[R,B]of y)if(R.initializer!=null){const F=R.facet==="super"?x:M,D=R.initializer(B.data,B.facets,B.channels,g,F,$);if(D.data!==void 0&&(B.data=D.data),D.facets!==void 0&&(B.facets=D.facets),D.channels!==void 0){const{fx:Y,fy:_,...V}=D.channels;$w(V),Object.assign(B.channels,V);for(const W of Object.values(V)){const{scale:O}=W;O!=null&&!op(st.get(O))&&(sf(W,t),E.add(O))}(Y!=null||_!=null)&&f.set(R,!0)}}if(E.size){const R=new Map;Jn(R,y,t,Y=>E.has(Y)),Jn(d,y,t,Y=>E.has(Y));const B=Nw(Mo(R,t),w),{scales:F,...D}=cl(B);Object.assign(w,B),Object.assign(g,D),Object.assign(g.scales,F)}let k,T;m!==void 0&&(k={x:v?.domain(),y:b?.domain()},m=xg(m,k),T=vg(v,b,p));for(const[R,B]of y)B.values=R.scale(B.channels,g,$);const{width:L,height:z}=p;Kt(C).attr("class",s).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",L).attr("height",z).attr("viewBox",`0 0 ${L} ${z}`).attr("aria-label",a).attr("aria-description",u).call(R=>R.append("style").text(`:where(.${s}) { --plot-background: white; display: block; height: auto; height: intrinsic; max-width: 100%; } :where(.${s} text), :where(.${s} tspan) { white-space: pre; }`)).call(Go,n);for(const R of l){const{channels:B,values:F,facets:D}=y.get(R);if(m===void 0||R.facet==="super"){let Y=null;if(D&&(Y=D[0],Y=R.filter(Y,B,F),Y.length===0))continue;const _=R.render(Y,g,F,x,$);if(_==null)continue;C.appendChild(_)}else{let Y;for(const _ of m){if(!(R.facetAnchor?.(m,k,_)??!_.empty))continue;let V=null;if(D){const O=f.has(R);if(V=D[O?_.i:0],V=R.filter(V,B,F),V.length===0)continue;!O&&V===D[0]&&(V=Re(V)),V.fx=_.x,V.fy=_.y,V.fi=_.i}const W=R.render(V,g,F,M,$);if(W!=null){(Y??=Kt(C).append("g")).append(()=>W).datum(_);for(const O of["aria-label","aria-description","aria-hidden","transform"])W.hasAttribute(O)&&(Y.attr(O,W.getAttribute(O)),W.removeAttribute(O))}}Y?.selectChildren().each(T)}}const N=Hb(w,$,t),{figure:I=r!=null||i!=null||o!=null||N.length>0}=t;I&&(S=A.createElement("figure"),S.className=`${s}-figure`,S.style.maxWidth="initial",r!=null&&S.append(af(A,r,"h2")),i!=null&&S.append(af(A,i,"h3")),S.append(...N,C),o!=null&&S.append(ww(A,o)),"value"in C&&(S.value=C.value,delete C.value)),S.scale=bg(g.scales),S.legend=Xb(w,$,t);const G=Hp();return G>0&&Kt(C).append("text").attr("x",L).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${G.toLocaleString("en-US")} warning${G===1?"":"s"}. Please check the console.`),S}function af(t,e,n){if(e.ownerDocument)return e;const r=t.createElement(n);return r.append(e),r}function ww(t,e){const n=t.createElement("figcaption");return n.append(e),n}function uf(t){return t.flat(1/0).filter(e=>e!=null).map(xw)}function xw(t){return typeof t.render=="function"?t:new vw(t)}class vw extends et{constructor(e){if(typeof e!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=e}render(){}}function la(t,e){for(const n in t)sf(t[n],e);return t}function sf(t,e){const{scale:n,transform:r=!0}=t;if(n==null||!r)return;const{type:i,percent:o,interval:a,transform:u=o?s=>s==null?NaN:s*100:vs(a,i)}=e[n]??{};u!=null&&(t.value=J(t.value,u),t.transform=!1)}function $w(t){for(const e in t)qs(e,t[e])}function Jn(t,e,n,r=Xy){for(const{channels:i}of e.values())for(const o in i){const a=i[o],{scale:u}=a;if(u!=null&&r(u))if(u==="projection"){if(!Rg(n)){const s=n.x?.domain===void 0,l=n.y?.domain===void 0;if(s||l){const[c,f]=Og(a);s&&ca(t,"x",c),l&&ca(t,"y",f)}}}else ca(t,u,a)}return t}function ca(t,e,n){const r=t.get(e);r!==void 0?r.push(n):t.set(e,[n])}function Mw(t,e){if(t==null)return;const{x:n,y:r}=t;if(n==null&&r==null)return;const i=Ze(t.data);if(i==null)throw new Error("missing facet data");const o={};n!=null&&(o.fx=qn(i,{value:n,scale:"fx"})),r!=null&&(o.fy=qn(i,{value:r,scale:"fy"})),la(o,e);const a=ko(i,o);return{channels:o,groups:a,data:t.data}}function lf(t,e,n){if(t.facet===null||t.facet==="super")return;const{fx:r,fy:i}=t;if(r!=null||i!=null){const s=Ze(t.data??r??i);if(s===void 0)throw new Error(`missing facet data in ${t.ariaLabel}`);if(s===null)return;const l={};return r!=null&&(l.fx=qn(s,{value:r,scale:"fx"})),i!=null&&(l.fy=qn(s,{value:i,scale:"fy"})),la(l,n),{channels:l,groups:ko(s,l)}}if(e===void 0)return;const{channels:o,groups:a,data:u}=e;if(t.facet!=="auto"||t.data===u)return{channels:o,groups:a};u.length>0&&(a.size>1||a.size===1&&o.fx&&o.fy&&[...a][0][1].size>1)&&Rn(Ze(t.data))===Rn(u)&&se(`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 Aw(t,e={}){return At({...e,x:null,y:null},(n,r,i,o,a,u)=>u.getMarkState(t))}function Cw(t){const e=[];for(const n of t){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?Po:/^y$/i.test(i)?Pr:qo,r=i(Aw(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Pr?"left":"bottom");const a=Jc(n.data,r);a.facet=n.facet,a.facetAnchor=n.facetAnchor,e.push(a)}}return e}function Sw(t,e,n){let{projection:r,x:i={},y:o={},fx:a={},fy:u={},axis:s,grid:l,facet:c={},facet:{axis:f=s,grid:d}=c,x:{axis:h=s,grid:m=h===null?null:l}=i,y:{axis:y=s,grid:w=y===null?null:l}=o,fx:{axis:p=f,grid:g=p===null?null:d}=a,fy:{axis:v=f,grid:b=v===null?null:d}=u}=n;(r||!Ie(i)&&!cf("x",t))&&(h=m=null),(r||!Ie(o)&&!cf("y",t))&&(y=w=null),e.has("fx")||(p=g=null),e.has("fy")||(v=b=null),h===void 0&&(h=!li(t,"x")),y===void 0&&(y=!li(t,"y")),p===void 0&&(p=!li(t,"fx")),v===void 0&&(v=!li(t,"fy")),h===!0&&(h="bottom"),y===!0&&(y="left"),p===!0&&(p=h==="top"||h===null?"bottom":"top"),v===!0&&(v=y==="right"||y===null?"left":"right");const M=[];return si(M,b,kc,u),ui(M,v,$c,"right","left",c,u),si(M,g,Ec,a),ui(M,p,Mc,"top","bottom",c,a),si(M,w,Sc,o),ui(M,y,Qo,"left","right",n,o),si(M,m,Lc,i),ui(M,h,Jo,"bottom","top",n,i),M}function ui(t,e,n,r,i,o,a){if(!e)return;const u=kw(e);a=Lw(u?r:e,o,a);const{line:s}=a;(n===Qo||n===Jo)&&s&&!en(s)&&t.push(ua(Ew(a))),t.push(n(a)),u&&t.push(n({...a,anchor:i,label:null}))}function si(t,e,n,r){!e||en(e)||t.push(n(Tw(e,r)))}function kw(t){return/^\s*both\s*$/i.test(t)}function Lw(t,e,{line:n=e.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:a,tickFormat:u,tickRotate:s,fontVariant:l,ariaLabel:c,ariaDescription:f,label:d=e.label,labelAnchor:h,labelArrow:m=e.labelArrow,labelOffset:y}){return{anchor:t,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:a,tickFormat:u,tickRotate:s,fontVariant:l,ariaLabel:c,ariaDescription:f,label:d,labelAnchor:h,labelArrow:m,labelOffset:y}}function Ew(t){const{anchor:e,line:n}=t;return{anchor:e,facetAnchor:e+"-empty",stroke:n===!0?void 0:n}}function Tw(t,{stroke:e=Bn(t)?t:void 0,ticks:n=zw(t)?t:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function zw(t){switch(typeof t){case"number":return!0;case"string":return!Bn(t)}return re(t)||typeof t?.range=="function"}function li(t,e){const n=`${e}-axis `;return t.some(r=>r.ariaLabel?.startsWith(n))}function cf(t,e){for(const n of e)for(const r in n.channels){const{scale:i}=n.channels[r];if(i===t||i==="projection")return!0}return!1}function Nw(t,e){for(const n in t){const r=t[n],i=e[n];r.label===void 0&&i&&(r.label=i.label)}return t}function Iw({fx:t,fy:e},n){const{marginTop:r,marginRight:i,marginBottom:o,marginLeft:a,width:u,height:s}=Ao(n),l=t&&ff(t),c=e&&ff(e);return{marginTop:e?c[0]:r,marginRight:t?u-l[1]:i,marginBottom:e?s-c[1]:o,marginLeft:t?l[0]:a,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:u,height:s}}function ff(t){const e=t.domain();if(e.length===0)return[0,t.bandwidth()];let n=t(e[0]),r=t(e[e.length-1]);return r{const K=kr(H(P,g),U?.[v]),nt=H(P,A),ft=H(P,D),at=H(P,Y),ht=fo(s,{z:nt,fill:ft,stroke:at}),pt=[],Mt=[],Le=K&&M([]),Ee=nt&&F([]),Wd=ft&&V([]),Xd=at&&O([]),_a=t&&f([]),_d=t&&h([]),Va=e&&y([]),Vd=e&&p([]),Hd=Yw(t,e,P);let Zd=0;for(const qe of s)qe.initialize(P);a&&a.initialize(P),o&&o.initialize(P);for(const qe of X){const Ha=[];for(const Pe of s)Pe.scope("facet",qe);a&&a.scope("facet",qe),o&&o.scope("facet",qe);for(const[Pe,Ud]of Be(qe,ht))for(const[Kd,sr]of Be(Ud,K))for(const[Gt,Ut]of Hd(sr))if(ht&&(Ut.z=Pe),!(o&&!o.reduce(Gt,Ut))){Ha.push(Zd++),Mt.push(i.reduceIndex(Gt,P,Ut)),K&&Le.push(Kd),nt&&Ee.push(ht===nt?Pe:nt[(Gt.length>0?Gt:sr)[0]]),ft&&Wd.push(ht===ft?Pe:ft[(Gt.length>0?Gt:sr)[0]]),at&&Xd.push(ht===at?Pe:at[(Gt.length>0?Gt:sr)[0]]),_a&&(_a.push(Ut.x1),_d.push(Ut.x2)),Va&&(Va.push(Ut.y1),Vd.push(Ut.y2));for(const Qd of s)Qd.reduce(Gt,Ut);a&&a.reduce(Gt,Ut)}pt.push(Ha)}return Fs(pt,a,u),{data:Mt,facets:pt}}),...!be(s,"x")&&(c?{x1:c,x2:d,x:Sr(c,d)}:{x,x1:E,x2:k}),...!be(s,"y")&&(m?{y1:m,y2:w,y:Sr(m,w)}:{y:$,y1:T,y2:L}),...b&&{[v]:b},...Object.fromEntries(s.map(({name:P,output:X})=>[P,X]))}}function ya({cumulative:t,domain:e,thresholds:n,interval:r,...i},o){return[i,{cumulative:t,domain:e,thresholds:n,interval:r,...o}]}function ci(t,{cumulative:e,domain:n,thresholds:r,interval:i},o){return t={...Je(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=i),t.value===void 0&&(t.value=o),t.thresholds=yf(t.thresholds,t.interval),t}function Bw(t){let{x:e,y:n}=t;return e=ci(e,t),n=ci(n,t),[e.value,n.value]=Ft(e.value,n.value),{x:e,y:n}}function mf(t){if(t==null)return;const{value:e,cumulative:n,domain:r=gt,thresholds:i}=t,o=a=>{let u=H(a,e),s;if(St(u)||Dw(i)){u=J(u,ms,Float64Array);let[c,f]=typeof r=="function"?r(u):r,d=typeof i=="function"&&!Qe(i)?i(u,c,f):i;typeof d=="number"&&(d=$y(c,f,d)),Qe(d)&&(r===gt&&(c=d.floor(c),f=d.offset(d.floor(f))),d=d.range(c,d.offset(f))),s=d}else{u=Lt(u);let[c,f]=typeof r=="function"?r(u):r,d=typeof i=="function"&&!Qe(i)?i(u,c,f):i;if(typeof d=="number")if(r===gt){let h=My(c,f,d);if(isFinite(h))if(h>0){let m=Math.round(c/h),y=Math.round(f/h);m*h<=c||--m,y*h>f||++y;let w=y-m+1;d=new Float64Array(w);for(let p=0;pf||++y;let w=y-m+1;d=new Float64Array(w);for(let p=0;p0?Gw:pa)(l,s,u),l};return o.label=Xt(e),o}function yf(t,e,n=wf){if(t===void 0)return e===void 0?n:Ke(e);if(typeof t=="string"){switch(t.toLowerCase()){case"freedman-diaconis":return vy;case"scott":return Qu;case"sturges":return Ku;case"auto":return wf}return $r(t)}return t}function Ow(t,e){return Ns(t,e,pf)}function pf(t,e,n){return lo(t,e,n,gf)}function gf(t,e,n){return co(t,e,n,bf)}function bf(t,e){return Nr(t,e,Fw)}function Fw(t){switch(`${t}`.toLowerCase()){case"x":return qw;case"x1":return Ww;case"x2":return Xw;case"y":return Pw;case"y1":return _w;case"y2":return Vw;case"z":return Gs}throw new Error(`invalid bin reduce: ${t}`)}function wf(t,e,n){return Math.min(200,Qu(t,e,n))}function Dw(t){return Hy(t)||re(t)&&St(t)}function Yw(t,e,n){const r=t?.(n),i=e?.(n);return r&&i?function*(o){const a=r.bin(o);for(const[u,[s,l]]of r.entries()){const c=i.bin(a[u]);for(const[f,[d,h]]of i.entries())yield[c[f],{data:n,x1:s,y1:d,x2:l,y2:h}]}}:r?function*(o){const a=r.bin(o);for(const[u,[s,l]]of r.entries())yield[a[u],{data:n,x1:s,x2:l}]}:function*(o){const a=i.bin(o);for(const[u,[s,l]]of i.entries())yield[a[u],{data:n,y1:s,y2:l}]}}function pa(t,e,n){return e=Lt(e),r=>{const i=t.map(()=>[]);for(const o of r)i[Ay(e,n[o])-1]?.push(o);return i}}function Gw(t,e,n){const r=pa(t,e,n);return i=>{const o=r(i);for(let a=1,u=o.length;a{const o=r(i);for(let a=o.length-2;a>=0;--a){const u=o[a+1],s=o[a];for(const l of u)s.push(l)}return o}}function xf(t,e){const n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}const qw={reduceIndex(t,e,{x1:n,x2:r}){return xf(n,r)}},Pw={reduceIndex(t,e,{y1:n,y2:r}){return xf(n,r)}},Ww={reduceIndex(t,e,{x1:n}){return n}},Xw={reduceIndex(t,e,{x2:n}){return n}},_w={reduceIndex(t,e,{y1:n}){return n}},Vw={reduceIndex(t,e,{y2:n}){return n}},Hw={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class fi extends et{constructor(e,n={}){const{x1:r,y1:i,x2:o,y2:a,z:u,curve:s,tension:l}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0},z:{value:ge(n),optional:!0}},n,Hw),this.z=u,this.curve=fa(s,l)}filter(e){return e}render(e,n,r,i,o){const{x1:a,y1:u,x2:s=a,y2:l=u}=r;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,n,0,0).call(c=>c.selectAll().data(El(e,[a,u,s,l],this,r)).enter().append("path").call(Q,this).call(qr,this,r).attr("d",Fi().curve(this.curve).defined(f=>f>=0).x0(f=>a[f]).y0(f=>u[f]).x1(f=>s[f]).y1(f=>l[f]))).node()}}function ga(t,e){return e===void 0?yn(t,{x:Ar,y:Nn}):new fi(t,e)}function tr(t,e){const{y:n=mt,...r}=ha(e);return new fi(t,Qr(Ur({...r,y1:n,y2:void 0},n===mt?"x2":"x")))}function yn(t,e){const{x:n=mt,...r}=da(e);return new fi(t,Jr(Kr({...r,x1:n,x2:void 0},n===mt?"y2":"y")))}const Zw={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class vf extends et{constructor(e,n={}){const{x1:r,y1:i,x2:o,y2:a,curve:u,tension:s}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0}},n,Zw),this.curve=df(u,s),an(this,n)}project(e,n,r){this.curve!==mn&&super.project(e,n,r)}render(e,n,r,i,o){const{x1:a,y1:u,x2:s=a,y2:l=u}=r,{curve:c}=this;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,n).call(f=>f.selectAll().data(e).enter().append("path").call(Q,this).attr("d",c===mn&&o.projection?Uw(o.path(),a,u,s,l):d=>{const h=Qt(),m=c(h);return m.lineStart(),m.point(a[d],u[d]),m.point(s[d],l[d]),m.lineEnd(),h}).call(lt,this,r).call(Zn,this,r,o)).node()}}function Uw(t,e,n,r,i){return e=Lt(e),n=Lt(n),r=Lt(r),i=Lt(i),o=>t({type:"LineString",coordinates:[[e[o],n[o]],[r[o],i[o]]]})}function $f(t,{x:e,x1:n,x2:r,y:i,y1:o,y2:a,...u}={}){return[n,r]=di(e,n,r),[o,a]=di(i,o,a),new vf(t,{...u,x1:n,x2:r,y1:o,y2:a})}function di(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]}const Kw={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5};class Mf extends et{constructor(e,n={}){const{x1:r,y1:i,x2:o,y2:a,bend:u=0,headAngle:s=60,headLength:l=8,inset:c=0,insetStart:f=c,insetEnd:d=c,sweep:h}=n;super(e,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0}},n,Kw),this.bend=u===!0?22.5:Math.max(-90,Math.min(90,u)),this.headAngle=+s,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=Qw(h)}render(e,n,r,i,o){const{x1:a,y1:u,x2:s=a,y2:l=u,SW:c}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:m,insetStart:y,insetEnd:w}=this,p=c?b=>c[b]:vt(f===void 0?1:f),g=h*Wr/2,v=m/1.5;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,n).call(b=>b.selectAll().data(e).enter().append("path").call(Q,this).attr("d",M=>{let x=a[M],$=u[M],A=s[M],C=l[M];const S=Math.hypot(A-x,C-$);if(S<=y+w)return null;let E=Math.atan2(C-$,A-x);const k=Math.min(v*p(M),S/3),T=this.sweep(x,$,A,C)*d*Wr,L=Math.hypot(S/Math.tan(T),S)/2;if(y||w)if(L<1e5){const _=Math.sign(T),[V,W]=Jw([x,$],[A,C],L,_);if(y&&([x,$]=Af([V,W,L],[x,$,y],-_*Math.sign(y))),w){const[O,P]=Af([V,W,L],[A,C,w],_*Math.sign(w));E+=Math.atan2(P-W,O-V)-Math.atan2(C-W,A-V),A=O,C=P}}else{const _=A-x,V=C-$,W=Math.hypot(_,V);y&&(x+=_/W*y,$+=V/W*y),w&&(A-=_/W*w,C-=V/W*w)}const z=E+T,N=z+g,I=z-g,G=A-k*Math.cos(N),R=C-k*Math.sin(N),B=A-k*Math.cos(I),F=C-k*Math.sin(I),D=L<1e5?`A${L},${L} 0,0,${T>0?1:0} `:"L",Y=k?`M${G},${R}L${A},${C}L${B},${F}`:"";return`M${x},${$}${D}${A},${C}${Y}`}).call(lt,this,r)).node()}}function Qw(t=1){if(typeof t=="number")return vt(Math.sign(t));if(typeof t=="function")return(e,n,r,i)=>Math.sign(t(e,n,r,i));switch(Tt(t,"sweep",["+x","-x","+y","-y"])){case"+x":return(e,n,r)=>lr(e,r);case"-x":return(e,n,r)=>We(e,r);case"+y":return(e,n,r,i)=>lr(n,i);case"-y":return(e,n,r,i)=>We(n,i)}}function Jw([t,e],[n,r],i,o){const a=n-t,u=r-e,s=Math.hypot(a,u),l=o*Math.sqrt(i*i-s*s/4)/s;return[(t+n)/2-u*l,(e+r)/2+a*l]}function Af([t,e,n],[r,i,o],a){const u=r-t,s=i-e,l=Math.hypot(u,s),c=(u*u+s*s-o*o+n*n)/(2*l),f=a*Math.sqrt(n*n-c*c);return[t+(u*c+s*f)/l,e+(s*c-u*f)/l]}function t0(t,{x:e,x1:n,x2:r,y:i,y1:o,y2:a,...u}={}){return[n,r]=di(e,n,r),[o,a]=di(i,o,a),new Mf(t,{...u,x1:n,x2:r,y1:o,y2:a})}const e0={ariaLabel:"bar"};class ba extends et{constructor(e,n,r={},i=e0){super(e,n,r,i),ra(this,r),ia(this,r)}render(e,n,r,i,o){const{rx:a,ry:u,rx1y1:s,rx1y2:l,rx2y1:c,rx2y2:f}=this,d=this._x(n,r,i),h=this._y(n,r,i),m=this._width(n,r,i),y=this._height(n,r,i);return Z("svg:g",o).call(ot,this,i,o).call(this._transform,this,n).call(w=>w.selectAll().data(e).enter().call(s||l||c||f?p=>p.append("path").call(Q,this).call(oa,d,h,Cf(d,m),Cf(h,y),this).call(lt,this,r):p=>p.append("rect").call(Q,this).attr("x",d).attr("width",m).attr("y",h).attr("height",y).call(q,"rx",a).call(q,"ry",u).call(lt,this,r))).node()}_x(e,{x:n},{marginLeft:r}){const{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(e,{y:n},{marginTop:r}){const{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:e},{x:n},{marginRight:r,marginLeft:i,width:o}){const{insetLeft:a,insetRight:u}=this,s=n&&e?e.bandwidth():o-r-i;return Math.max(0,s-a-u)}_height({y:e},{y:n},{marginTop:r,marginBottom:i,height:o}){const{insetTop:a,insetBottom:u}=this,s=n&&e?e.bandwidth():o-r-i;return Math.max(0,s-a-u)}}function Cf(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}class wa extends ba{constructor(e,n={},r){const{x1:i,x2:o,y:a}=n;super(e,{x1:{value:i,scale:"x"},x2:{value:o,scale:"x"},y:{value:a,scale:"y",type:"band",optional:!0}},n,r)}_transform(e,n,{x:r}){e.call(tt,n,{x:r},0,0)}_x({x:e},{x1:n,x2:r},{marginLeft:i}){const{insetLeft:o}=this;return Vt(e)?i+o:a=>Math.min(n[a],r[a])+o}_width({x:e},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:a}){const{insetLeft:u,insetRight:s}=this;return Vt(e)?a-i-o-u-s:l=>Math.max(0,Math.abs(r[l]-n[l])-u-s)}}class xa extends ba{constructor(e,n={},r){const{x:i,y1:o,y2:a}=n;super(e,{y1:{value:o,scale:"y"},y2:{value:a,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},n,r)}_transform(e,n,{y:r}){e.call(tt,n,{y:r},0,0)}_y({y:e},{y1:n,y2:r},{marginTop:i}){const{insetTop:o}=this;return Vt(e)?i+o:a=>Math.min(n[a],r[a])+o}_height({y:e},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:a}){const{insetTop:u,insetBottom:s}=this;return Vt(e)?a-i-o-u-s:l=>Math.max(0,Math.abs(r[l]-n[l])-u-s)}}function Ye(t,e={}){return Ue(e)||(e={...e,y:mt,x2:j}),new wa(t,Qr(Vo(Ur(e))))}function Ge(t,e={}){return Ue(e)||(e={...e,x:mt,y2:j}),new xa(t,Jr(Ho(Kr(e))))}const n0={ariaLabel:"cell"};class hi extends ba{constructor(e,{x:n,y:r,...i}={}){super(e,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,n0)}_transform(e,n){e.call(tt,n,{},0,0)}}function pn(t,{x:e,y:n,...r}={}){return[e,n]=Ft(e,n),new hi(t,{...r,x:e,y:n})}function r0(t,{x:e=mt,fill:n,stroke:r,...i}={}){return n===void 0&&Ct(r)[0]===void 0&&(n=j),new hi(t,{...i,x:e,fill:n,stroke:r})}function i0(t,{y:e=mt,fill:n,stroke:r,...i}={}){return n===void 0&&Ct(r)[0]===void 0&&(n=j),new hi(t,{...i,y:e,fill:n,stroke:r})}const o0={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function va(t){return t.sort===void 0&&t.reverse===void 0?Ts({channel:"-r"},t):t}class mi extends et{constructor(e,n={}){const{x:r,y:i,r:o,rotate:a,symbol:u=ki,frameAnchor:s}=n,[l,c]=dt(a,0),[f,d]=lp(u),[h,m]=dt(o,f==null?3:4.5);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:Jt,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},va(n),o0),this.r=m,this.rotate=c,this.symbol=d,this.frameAnchor=On(s);const{channels:y}=this,{symbol:w}=y;if(w){const{fill:p,stroke:g}=y;w.hint={fill:p?p.value===w.value?"color":"currentColor":this.fill??"currentColor",stroke:g?g.value===w.value?"color":"currentColor":this.stroke??"none"}}}render(e,n,r,i,o){const{x:a,y:u}=n,{x:s,y:l,r:c,rotate:f,symbol:d}=r,{r:h,rotate:m,symbol:y}=this,[w,p]=Ht(this,i),g=y===ki,v=c?void 0:h*h*Math.PI;return wr(h)&&(e=[]),Z("svg:g",o).call(ot,this,i,o).call(tt,this,{x:s&&a,y:l&&u}).call(b=>b.selectAll().data(e).enter().append(g?"circle":"path").call(Q,this).call(g?M=>{M.attr("cx",s?x=>s[x]:w).attr("cy",l?x=>l[x]:p).attr("r",c?x=>c[x]:h)}:M=>{M.attr("transform",Qn`translate(${s?x=>s[x]:w},${l?x=>l[x]:p})${f?x=>` rotate(${f[x]})`:m?` rotate(${m})`:""}`).attr("d",c&&d?x=>{const $=Qt();return d[x].draw($,c[x]*c[x]*Math.PI),$}:c?x=>{const $=Qt();return y.draw($,c[x]*c[x]*Math.PI),$}:d?x=>{const $=Qt();return d[x].draw($,v),$}:(()=>{const x=Qt();return y.draw(x,v),x})())}).call(lt,this,r)).node()}}function Ce(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=Ft(e,n)),new mi(t,{...r,x:e,y:n})}function a0(t,{x:e=j,...n}={}){return new mi(t,Vl({...n,x:e}))}function u0(t,{y:e=j,...n}={}){return new mi(t,_l({...n,y:e}))}function s0(t,e){return Ce(t,{...e,symbol:"circle"})}function l0(t,e){return Ce(t,{...e,symbol:"hexagon"})}const c0={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class yi extends et{constructor(e,n={}){const{x:r,y:i,z:o,curve:a,tension:u}=n;super(e,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:ge(n),optional:!0}},n,c0),this.z=o,this.curve=df(a,u),an(this,n)}filter(e){return e}project(e,n,r){this.curve!==mn&&super.project(e,n,r)}render(e,n,r,i,o){const{x:a,y:u}=r,{curve:s}=this;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,n).call(l=>l.selectAll().data(El(e,[a,u],this,r)).enter().append("path").call(Q,this).call(qr,this,r).call(yb,this,r,o).attr("d",s===mn&&o.projection?f0(o.path(),a,u):Cy().curve(s).defined(c=>c>=0).x(c=>a[c]).y(c=>u[c]))).node()}}function f0(t,e,n){return e=Lt(e),n=Lt(n),r=>{let i=[];const o=[i];for(const a of r)a===-1?(i=[],o.push(i)):i.push([e[a],n[a]]);return t({type:"MultiLineString",coordinates:o})}}function pi(t,{x:e,y:n,...r}={}){return[e,n]=Ft(e,n),new yi(t,{...r,x:e,y:n})}function er(t,{x:e=j,y:n=mt,...r}={}){return new yi(t,ha({...r,x:e,y:n}))}function nr(t,{x:e=mt,y:n=j,...r}={}){return new yi(t,da({...r,x:e,y:n}))}function Sf(t,e){e=h0(e);const{x:n,y:r,color:i,size:o}=e,a=gi(t,n),u=gi(t,r),s=gi(t,i),l=gi(t,o);let{fx:c,fy:f,x:{value:d,reduce:h,zero:m,...y},y:{value:w,reduce:p,zero:g,...v},color:{value:b,color:M,reduce:x},size:{value:$,reduce:A},mark:C}=e;if(h===void 0&&(h=p==null&&d==null&&$==null&&w!=null?"count":null),p===void 0&&(p=h==null&&w==null&&$==null&&d!=null?"count":null),A===void 0&&$==null&&x==null&&h==null&&p==null&&(d==null||ct(a))&&(w==null||ct(u))&&(A="count"),m===void 0&&(m=bi(h)?!0:void 0),g===void 0&&(g=bi(p)?!0:void 0),d==null&&w==null)throw new Error("must specify x or y");if(h!=null&&w==null)throw new Error("reducing x requires y");if(p!=null&&d==null)throw new Error("reducing y requires x");C===void 0&&(C=$!=null||A!=null?"dot":bi(h)||bi(p)||x!=null?"bar":d!=null&&w!=null?ct(a)||ct(u)||h==null&&p==null&&!rr(a)&&!rr(u)?"dot":"line":d!=null||w!=null?"rule":null);let S,E,k;switch(C){case"dot":k=Ce,E="stroke";break;case"line":k=a&&u||h!=null||p!=null?g||p!=null||a&&rr(a)?nr:m||h!=null||u&&rr(u)?er:pi:a?er:nr,E="stroke",Lf(s)&&(S=null);break;case"area":k=!(g||p!=null)&&(m||h!=null||u&&rr(u))?tr:yn,E="fill",Lf(s)&&(S=null);break;case"rule":k=a?xe:ve,E="stroke";break;case"bar":k=h!=null?ct(u)?kf(h)&&a&&ct(a)?pn:Ye:ii:p!=null?ct(a)?kf(p)&&u&&ct(u)?pn:Ge:oi:x!=null||A!=null?a&&ct(a)&&u&&ct(u)?pn:a&&ct(a)?Ge:u&&ct(u)?Ye:aa:a&&tn(a)&&!(u&&tn(u))?Ye:u&&tn(u)&&!(a&&tn(a))?Ge:pn,E="fill";break;default:throw new Error(`invalid mark: ${C}`)}let T={fx:c,fy:f,x:a??void 0,y:u??void 0,[E]:s??M,z:S,r:l??void 0,tip:!0},L,z={[E]:x??void 0,r:A??void 0};if(h!=null&&p!=null)throw new Error("cannot reduce both x and y");return p!=null?(z.y=p,L=ct(a)?Gn:Me):h!=null?(z.x=h,L=ct(u)?jn:Ae):(x!=null||A!=null)&&(a&&u?L=ct(a)&&ct(u)?so:ct(a)?Ae:ct(u)?Me:De:a?L=ct(a)?Gn:Me:u&&(L=ct(u)?jn:Ae)),(L===De||L===Me)&&(T.x={value:a,...y}),(L===De||L===Ae)&&(T.y={value:u,...v}),m===void 0&&(m=a&&!(L===De||L===Me)&&(k===Ye||k===tr||k===ii||k===ve)),g===void 0&&(g=u&&!(L===De||L===Ae)&&(k===Ge||k===yn||k===oi||k===xe)),{fx:c??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!m,...y},y:{value:w??null,reduce:p??null,zero:!!g,...v},color:{value:b??null,reduce:x??null,...M!==void 0&&{color:M}},size:{value:$??null,reduce:A??null},mark:C,markImpl:Ef[k],markOptions:T,transformImpl:Ef[L],transformOptions:z,colorMode:E}}function d0(t,e){const n=Sf(t,e),{fx:r,fy:i,x:{zero:o},y:{zero:a},markOptions:u,transformOptions:s,colorMode:l}=n,c=$a[n.markImpl],f=$a[n.transformImpl],d=r!=null||i!=null?ua({strokeOpacity:.1}):null,h=[o?xe([0]):null,a?ve([0]):null],m=c(t,f?f(s,u):u);return l==="stroke"?Bt(d,h,m):Bt(d,m,h)}function rr(t){let e,n;for(const r of t){if(r==null)continue;if(e===void 0){e=r;continue}const i=Math.sign(lr(e,r));if(i){if(n!==void 0&&i!==n)return!1;e=r,n=i}}return!0}function h0({x:t,y:e,color:n,size:r,fx:i,fy:o,mark:a}={}){return Wt(t)||(t=gn(t)),Wt(e)||(e=gn(e)),Wt(n)||(n=Bn(n)?{color:n}:gn(n)),Wt(r)||(r=gn(r)),Wt(i)&&({value:i}=gn(i)),Wt(o)&&({value:o}=gn(o)),a!=null&&(a=`${a}`.toLowerCase()),{x:t,y:e,color:n,size:r,fx:i,fy:o,mark:a}}function gi(t,e){const n=H(t,e.value);return n&&(n.label=Xt(e.value)),n}function gn(t){return m0(t)?{reduce:t}:{value:t}}function bi(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function kf(t){return/^(?:first|last|mode)$/i.test(t)}function m0(t){if(t==null)return!1;if(typeof t.reduceIndex=="function"||typeof t.reduce=="function"&&zt(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 Lf(t){return t?new An(t).size>t.length>>1:!1}const $a={dot:Ce,line:pi,lineX:er,lineY:nr,areaX:tr,areaY:yn,ruleX:xe,ruleY:ve,barX:Ye,barY:Ge,rect:aa,rectX:ii,rectY:oi,cell:pn,bin:De,binX:Me,binY:Ae,group:so,groupX:Gn,groupY:jn},Ef=Object.fromEntries(Object.entries($a).map(([t,e])=>[e,t]));function Ma(t,e={}){let{x:n,x1:r,x2:i}=e;n===void 0&&r===void 0&&i===void 0&&(e={...e,x:n=j});const o={};return n!=null&&(o.x=t),r!=null&&(o.x1=t),i!=null&&(o.x2=t),Zt(o,e)}function Aa(t,e={}){let{y:n,y1:r,y2:i}=e;n===void 0&&r===void 0&&i===void 0&&(e={...e,y:n=j});const o={};return n!=null&&(o.y=t),r!=null&&(o.y1=t),i!=null&&(o.y2=t),Zt(o,e)}function Zt(t={},e={}){const n=ge(e),r=Object.entries(t).map(([i,o])=>{const a=xs(i,e);if(a==null)throw new Error(`missing channel: ${i}`);const[u,s]=Nt(a);return{key:i,input:a,output:u,setOutput:s,map:y0(o)}});return{...Dt(e,(i,o)=>{const a=H(i,n),u=r.map(({input:l})=>H(i,l)),s=r.map(({setOutput:l})=>l(new Array(i.length)));for(const l of o)for(const c of a?Te(l,f=>a[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(c,u[d],s[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function y0(t){if(t==null)throw new Error("missing map");if(typeof t.mapIndex=="function")return t;if(typeof t.map=="function"&&zt(t))return p0(t);if(typeof t=="function")return Ca(Zi(t));switch(`${t}`.toLowerCase()){case"cumsum":return b0;case"rank":return Ca((e,n)=>Ju(e,r=>n[r]));case"quantile":return Ca((e,n)=>g0(e,r=>n[r]))}throw new Error(`invalid map: ${t}`)}function p0(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}function g0(t,e){const n=Sy(t,e)-1;return Ju(t,e).map(r=>r/n)}function Ca(t){return{mapIndex(e,n,r){const i=t(e,n);if(i.length!==e.length)throw new Error("map function returned a mismatched length");for(let o=0,a=e.length;o0))throw new Error(`invalid k: ${e}`);return M0(n)(e,v0(i,e),o)}function v0(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 $0(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}function M0(t="mean"){if(typeof t=="string"){if(/^p\d{2}$/i.test(t))return xi(Vi(t));switch(t.toLowerCase()){case"deviation":return xi(fr);case"max":return vi((e,n)=>kt(e,r=>n[r]));case"mean":return A0;case"median":return xi(Cn);case"min":return vi((e,n)=>It(e,r=>n[r]));case"mode":return vi((e,n)=>su(e,r=>n[r]));case"sum":return Tf;case"variance":return xi(lu);case"difference":return k0;case"ratio":return L0;case"first":return E0;case"last":return T0}}if(typeof t!="function")throw new Error(`invalid reduce: ${t}`);return vi(Zi(t))}function xi(t){return(e,n,r)=>r?{mapIndex(i,o,a){const u=l=>o[l]==null?NaN:+o[l];let s=0;for(let l=0;lo[s]==null?NaN:+o[s];for(let s=-n;s<0;++s)a[i[s+n]]=t(Re(i,0,s+e),u);for(let s=0,l=i.length-n;sr?{mapIndex(i,o,a){let u=0;for(let s=0;s=n;--i){const o=t[e[i]];if(wt(o))return o}}function zf(t,e,n,r){for(let i=n+r;n=n;--i){let o=t[e[i]];if(o!==null&&!isNaN(o=+o))return o}}function k0(t,e,n){return n?{mapIndex(r,i,o){for(let a=0,u=r.length-t;acr(i)+e*(fr(i)||0),strict:n,anchor:r})}const I0={ariaLabel:"tick",fill:null,stroke:"currentColor"};class If extends et{constructor(e,n,r){super(e,n,r,I0),an(this,r)}render(e,n,r,i,o){return Z("svg:g",o).call(ot,this,i,o).call(this._transform,this,n).call(a=>a.selectAll().data(e).enter().append("line").call(Q,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(lt,this,r).call(Zn,this,r,o)).node()}}class Rf extends If{constructor(e,n={}){const{x:r,y:i,inset:o=0,insetTop:a=o,insetBottom:u=o}=n;super(e,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=rt(a),this.insetBottom=rt(u)}_transform(e,n,{x:r}){e.call(tt,n,{x:r},$t,0)}_x1(e,{x:n}){return r=>n[r]}_x2(e,{x:n}){return r=>n[r]}_y1({y:e},{y:n},{marginTop:r}){const{insetTop:i}=this;return n&&e?o=>n[o]+i:r+i}_y2({y:e},{y:n},{height:r,marginBottom:i}){const{insetBottom:o}=this;return n&&e?a=>n[a]+e.bandwidth()-o:r-i-o}}class Bf extends If{constructor(e,n={}){const{x:r,y:i,inset:o=0,insetRight:a=o,insetLeft:u=o}=n;super(e,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=rt(a),this.insetLeft=rt(u)}_transform(e,n,{y:r}){e.call(tt,n,{y:r},0,$t)}_x1({x:e},{x:n},{marginLeft:r}){const{insetLeft:i}=this;return n&&e?o=>n[o]+i:r+i}_x2({x:e},{x:n},{width:r,marginRight:i}){const{insetRight:o}=this;return n&&e?a=>n[a]+e.bandwidth()-o:r-i-o}_y1(e,{y:n}){return r=>n[r]}_y2(e,{y:n}){return r=>n[r]}}function Of(t,{x:e=j,...n}={}){return new Rf(t,{...n,x:e})}function Ff(t,{y:e=j,...n}={}){return new Bf(t,{...n,y:e})}function R0(t,{x:e=j,y:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:a="currentColor",strokeOpacity:u,strokeWidth:s=2,sort:l,...c}={}){const f=n!=null?jn:uo;return Bt(ve(t,f({x1:Sa,x2:ka},{x:e,y:n,stroke:a,strokeOpacity:u,...c})),Ye(t,f({x1:"p25",x2:"p75"},{x:e,y:n,fill:i,fillOpacity:o,...c})),Of(t,f({x:"p50"},{x:e,y:n,stroke:a,strokeOpacity:u,strokeWidth:s,sort:l,...c})),Ce(t,Zt({x:Df},{x:e,y:n,z:n,r,stroke:a,strokeOpacity:u,...c})))}function B0(t,{y:e=j,x:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:a="currentColor",strokeOpacity:u,strokeWidth:s=2,sort:l,...c}={}){const f=n!=null?Gn:uo;return Bt(xe(t,f({y1:Sa,y2:ka},{x:n,y:e,stroke:a,strokeOpacity:u,...c})),Ge(t,f({y1:"p25",y2:"p75"},{x:n,y:e,fill:i,fillOpacity:o,...c})),Ff(t,f({y:"p50"},{x:n,y:e,stroke:a,strokeOpacity:u,strokeWidth:s,sort:l,...c})),Ce(t,Zt({y:Df},{x:n,y:e,z:n,r,stroke:a,strokeOpacity:u,...c})))}function Df(t){const e=Sa(t),n=ka(t);return t.map(r=>rn?r:NaN)}function Sa(t){const e=Yf(t)*2.5-Gf(t)*1.5;return It(t,n=>n>=e?n:NaN)}function ka(t){const e=Gf(t)*2.5-Yf(t)*1.5;return kt(t,n=>n<=e?n:NaN)}function Yf(t){return $n(t,.25)}function Gf(t){return $n(t,.75)}const O0={ariaLabel:"raster",stroke:null,pixelSize:1};function bn(t,e){const n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function jf(t,e){const n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}class qf extends et{constructor(e,n,r={},i){let{width:o,height:a,x:u,y:s,x1:l=u==null?0:void 0,y1:c=s==null?0:void 0,x2:f=u==null?o:void 0,y2:d=s==null?a:void 0,pixelSize:h=i.pixelSize,blur:m=0,interpolate:y}=r;if(o!=null&&(o=jf(o,"width")),a!=null&&(a=jf(a,"height")),l!=null&&(l=bn(l,"x1")),c!=null&&(c=bn(c,"y1")),f!=null&&(f=bn(f,"x2")),d!=null&&(d=bn(d,"y2")),u==null&&(l==null||f==null))throw new Error("missing x");if(s==null&&(c==null||d==null))throw new Error("missing y");e!=null&&o!=null&&a!=null&&(u===void 0&&l!=null&&f!=null&&(u=X0(l,f,o)),s===void 0&&c!=null&&d!=null&&(s=_0(c,d,o,a))),super(e,{x:{value:u,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:c==null?null:[c],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=a,this.pixelSize=bn(h,"pixelSize"),this.blur=bn(m,"blur"),this.interpolate=u==null||s==null?null:D0(y)}}class Pf extends qf{constructor(e,n={}){const{imageRendering:r}=n;if(e==null){const{fill:i,fillOpacity:o}=n;dt(o)[0]!==void 0&&(n=La("fillOpacity",n)),Ct(i)[0]!==void 0&&(n=La("fill",n))}super(e,void 0,n,O0),this.imageRendering=yt(r,"auto")}scale(e,{color:n,...r},i){return super.scale(e,r,i)}render(e,n,r,i,o){const a=n[r.channels.fill?.scale]??(z=>z),{x:u,y:s}=r,{document:l}=o,[c,f,d,h]=Xf(r,i,o),m=d-c,y=h-f,{pixelSize:w,width:p=Math.round(Math.abs(m)/w),height:g=Math.round(Math.abs(y)/w)}=this,v=p*g;let{fill:b,fillOpacity:M}=r,x=0;if(this.interpolate){const z=p/m,N=g/y,I=J(u,R=>(R-c)*z,Float64Array),G=J(s,R=>(R-f)*N,Float64Array);b&&(b=this.interpolate(e,p,g,I,G,b)),M&&(M=this.interpolate(e,p,g,I,G,M))}else this.data==null&&e&&(x=e.fi*v);const $=l.createElement("canvas");$.width=p,$.height=g;const A=$.getContext("2d"),C=A.createImageData(p,g),S=C.data;let{r:E,g:k,b:T}=Ln(this.fill)??{r:0,g:0,b:0},L=(this.fillOpacity??1)*255;for(let z=0;z0&&ky(C,this.blur),A.putImageData(C,0,0),Z("svg:g",o).call(ot,this,i,o).call(tt,this,n).call(z=>z.append("image").attr("transform",`translate(${c},${f}) scale(${Math.sign(d-c)},${Math.sign(h-f)})`).attr("width",Math.abs(m)).attr("height",Math.abs(y)).attr("preserveAspectRatio","none").call(q,"image-rendering",this.imageRendering).call(Q,this).attr("xlink:href",$.toDataURL())).node()}}function Wf(t,e,n){arguments.length<3&&(n=e,e=null);let{x:r,y:i,[t]:o,...a}=n;return r===void 0&&i===void 0&&Uy(e)&&(r=Ar,i=Nn,o===void 0&&(o=_y)),[e,{...a,x:r,y:i,[t]:o}]}function F0(){const[t,e]=Wf("fill",...arguments);return new Pf(t,t==null||e.fill!==void 0||e.fillOpacity!==void 0?e:{...e,fill:j})}function Xf({x1:t,y1:e,x2:n,y2:r},i,{projection:o}){const{width:a,height:u,marginTop:s,marginRight:l,marginBottom:c,marginLeft:f}=i;return[t&&o==null?t[0]:f,e&&o==null?e[0]:s,n&&o==null?n[0]:a-l,r&&o==null?r[0]:u-c]}function _f({x1:t,y1:e,x2:n,y2:r},i,o,a){const u={};return t&&(u.x1=t),e&&(u.y1=e),n&&(u.x2=n),r&&(u.y2=r),Xf(Rr(u,i),o,a)}function La(t,e={}){const{[t]:n}=e;if(typeof n!="function")throw new Error(`invalid ${t}: not a function`);return At({...e,[t]:void 0},function(r,i,o,a,u,s){const{x:l,y:c}=a;if(!l)throw new Error("missing scale: x");if(!c)throw new Error("missing scale: y");const[f,d,h,m]=_f(o,a,u,s),y=h-f,w=m-d,{pixelSize:p}=this,{width:g=Math.round(Math.abs(y)/p),height:v=Math.round(Math.abs(w)/p)}=e,b=new Array(g*v*(i?i.length:1)),M=y/g,x=w/v;let $=0;for(const A of i??[void 0])for(let C=.5;C=e||i[u]<0||i[u]>=n||(a[Math.floor(i[u])*e+Math.floor(r[u])]=o[u]);return a}function Vf({random:t=Li(42)}={}){return(e,n,r,i,o,a)=>{const{points:u,triangles:s,hull:l}=Xe.from(e,h=>i[h],h=>o[h]),c=new a.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=W0(a,t);for(let h=0;h=n||N<0||N>=r)continue;const I=z+.5,G=N+.5,R=Math.sign(E),B=(M-x)*(I-v)+(G-x)*(v-g);if(B*R<0)continue;const F=(x-b)*(I-v)+(G-x)*(p-v);if(F*R<0)continue;const D=E-(B+F);if(D*R<0)continue;const Y=z+n*N;c[Y]=d(k,B/E,T,F/E,L,D/E,z,N),f[Y]=1}}return Y0(c,f,i,o,a,n,r,l,e,d),c}}function Y0(t,e,n,r,i,o,a,u,s,l){n=Float64Array.from(u,h=>n[s[h]]),r=Float64Array.from(u,h=>r[s[h]]),i=Array.from(u,h=>i[s[h]]);const c=n.length,f=Array.from({length:c},(h,m)=>j0(m,n,r));let d=0;for(let h=0;h0&&l>0?s/(s+l):+(s>l)}function ir(t,e,n,r){return t*r-n*e}function j0(t,e,n){const r=e.length,i=e.at(t-2),o=n.at(t-2),a=e.at(t-1),u=n.at(t-1),s=e[t],l=n[t],c=e.at(t+1-r),f=n.at(t+1-r),d=a-s,h=u-l,m=i-a,y=o-u,w=s-c,p=l-f,g=Math.hypot(d,h),v=Math.hypot(m,y),b=Math.hypot(w,p);return(M,x)=>{const $=M-a,A=x-u,C=M-s,S=x-l;return ir($,A,C,S)>-1e-6&&ir($,A,d,h)*v-ir($,A,m,y)*g>-1e-6&&ir(C,S,w,p)*g-ir(C,S,d,h)*b<=0}}function Hf(t,e,n,r,i,o){const a=new o.constructor(e*n),u=Xe.from(t,c=>r[c],c=>i[c]);let s,l;for(let c=.5,f=0;c{const l=new s.constructor(i*o),c=Xe.from(r,m=>a[m],m=>u[m]);let f,d,h;for(let m=.5,y=0;me&&b{const l=t(u,s);return ls.map(l=>l.value),label:Xt(r)};for(const s in o)i[s]==="value"&&(i[s]=u)}if(e==null){if(r==null)throw new Error("missing contour value");i=La("value",{value:r,...i}),r=null}else{let{interpolate:u}=i;r===void 0&&(r=j),u===void 0&&(i.interpolate="nearest")}super(e,{value:{value:r,optional:!0}},V0(i),Uf);const a={geometry:{value:j}};for(const u in this.channels){const s=this.channels[u],{scale:l}=s;l==="x"||l==="y"||u==="value"||(a[u]=s,delete this.channels[u])}this.contourChannels=a,this.smooth=!!n}filter(e,{x:n,y:r,value:i,...o},a){return super.filter(e,o,a)}render(e,n,r,i,o){const{geometry:a}=r,u=kn();return Z("svg:g",o).call(ot,this,i,o).call(tt,this,n).call(s=>{s.selectAll().data(e).enter().append("path").call(Q,this).attr("d",l=>u(a[l])).call(lt,this,r)}).node()}}function V0({thresholds:t,interval:e,...n}){return t=yf(t,e,Ku),At(n,function(r,i,o,a,u,s){const[l,c,f,d]=_f(o,a,u,s),h=f-l,m=d-c,{pixelSize:y,width:w=Math.round(Math.abs(h)/y),height:p=Math.round(Math.abs(m)/y)}=this,g=w/h,v=p/m,b=o.value.value,M=[];if(this.interpolate){const{x:S,y:E}=_n(o,a,s),k=J(S,N=>(N-l)*g,Float64Array),T=J(E,N=>(N-c)*v,Float64Array),L=[o.x,o.y,o.value],z=[k,T,b];for(const N of i){const I=this.filter(N,L,z);M.push(this.interpolate(I,w,p,k,T,b))}}else if(i){const S=w*p,E=i.length;for(let k=0;k0)for(const S of M)Ly({data:S,width:w,height:p},this.blur);const x=H0(t,b,...U0(M));if(x===null)throw new Error(`unsupported thresholds: ${t}`);const{contour:$}=Ey().size([w,p]).smooth(this.smooth),A=[],C=[];for(const S of M)C.push(vn(A.length,A.push(...J(x,E=>$(S,E)))));for(const{coordinates:S}of A)for(const E of S)for(const k of E)for(const T of k)T[0]=T[0]/g+l,T[1]=T[1]/v+c;return{data:A,facets:C,channels:js(this.contourChannels,A)}})}function H0(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 ye(t);const i=Ei(...Ty(n,r,t),t);for(;i[i.length-1]>=r;)i.pop();for(;i[1]It(e,Qf)),kt(t,e=>kt(e,Qf))]}function Qf(t){return isFinite(t)?t:NaN}function K0(t,e){return Ta(qo,t,e)}function Q0(t,e={}){return Ta(Po,t,e)}function J0(t,e={}){return Ta(Pr,t,e)}function Ta(t,e,n={}){const{x:r,y:i,maxRadius:o}=n,a=t({px:r,py:i,maxRadius:o}),u=[];r!=null&&u.push(xe(e,td("x",{...a,inset:-6},n))),i!=null&&u.push(ve(e,td("y",{...a,inset:-6},n))),r!=null&&u.push(un(e,ed("x",{...a,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&u.push(un(e,ed("y",{...a,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(const s of u)s.ariaLabel=`crosshair ${s.ariaLabel}`;return Bt(...u)}function Jf(t,{channels:e,...n},{facet:r,facetAnchor:i,fx:o,fy:a,[t]:u,channels:s,transform:l,initializer:c}){return{...n,facet:r,facetAnchor:i,fx:o,fy:a,[t]:u,channels:{...e,...s},transform:l,initializer:tx(t,c)}}function tx(t,e){return e==null?e:function(n,r,{x:i,y:o,px:a,py:u,...s},...l){const{channels:{x:c,y:f,...d}={},...h}=e.call(this,n,r,{...s,x:a,y:u},...l);return{channels:{...d,...c&&{px:c,...t==="x"&&{x:c}},...f&&{py:f,...t==="y"&&{y:f}}},...h}}}function td(t,e,n){const{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:a=i,ruleStrokeWidth:u}=n;return{...Jf(t,e,n),stroke:o,strokeOpacity:a,strokeWidth:u}}function ed(t,e,n){const{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:a="var(--plot-background)",textStrokeOpacity:u,textStrokeWidth:s=5}=n;return{...Jf(t,e,ex(t,n)),fill:i,fillOpacity:o,stroke:a,strokeOpacity:u,strokeWidth:s}}function ex(t,e){return At(e,(n,r,i)=>({channels:{text:{value:po(i,t)?.value}}}))}const nx={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},rx={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},ix={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},ox={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ax={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2};class ux extends et{constructor(e,n={}){const{x:r,y:i,z:o,curve:a,tension:u}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,nx),this.curve=fa(a,u),an(this,n)}render(e,n,r,i,o){const{x:a,y:u}=n,{x:s,y:l,z:c}=r,{curve:f}=this,[d,h]=Ht(this,i),m=s?g=>s[g]:vt(d),y=l?g=>l[g]:vt(h),w=this;function p(g){let v=-1;const b=[],M={};for(const L in r)M[L]=[];const x=[],$=[],A=[],C=[];function S(L,z){L=g[L],z=g[z],b.push(++v),x[v]=m(L),A[v]=y(L),$[v]=m(z),C[v]=y(z);for(const N in r)M[N].push(r[N][z])}const{halfedges:E,hull:k,triangles:T}=Xe.from(g,m,y);for(let L=0;LL&&S(T[L],T[z])}for(let L=0;L{const z=Qt(),N=f(z);return N.lineStart(),N.point(x[L],A[L]),N.point($[L],C[L]),N.lineEnd(),z}).call(lt,w,M).call(Zn,w,M,o)}return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{x:s&&a,y:l&&u}).call(c?g=>g.selectAll().data(Te(e,v=>c[v]).values()).enter().append("g").each(p):g=>g.datum(e).each(p)).node()}}class za extends et{constructor(e,n={},r,i=({z:o})=>o){const{x:o,y:a}=n;super(e,{x:{value:o,scale:"x",optional:!0},y:{value:a,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(e,n,r,i,o){const{x:a,y:u}=n,{x:s,y:l,z:c}=r,[f,d]=Ht(this,i),h=s?p=>s[p]:vt(f),m=l?p=>l[p]:vt(d),y=this;function w(p){const g=Xe.from(p,h,m);Kt(this).append("path").datum(p[0]).call(Q,y).attr("d",y._render(g,i)).call(lt,y,r)}return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{x:s&&a,y:l&&u}).call(c?p=>p.selectAll().data(Te(e,g=>c[g]).values()).enter().append("g").each(w):p=>p.datum(e).each(w)).node()}}class sx extends za{constructor(e,n={}){super(e,n,rx),this.fill="none"}_render(e){return e.render()}}class lx extends za{constructor(e,n={}){super(e,n,ix,ge)}_render(e){return e.renderHull()}}class cx extends et{constructor(e,n={}){const{x:r,y:i,z:o}=n;super(e,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},At(n,function(a,u,s,l,c,f){let{x:d,y:h,z:m}=s;({x:d,y:h}=_n(s,l,f)),m=m?.value;const y=new Array((d??h).length).fill(null),[w,p]=Ht(this,c),g=d?b=>d[b]:vt(w),v=h?b=>h[b]:vt(p);for(let b of u){d&&(b=b.filter(M=>wt(g(M)))),h&&(b=b.filter(M=>wt(v(M))));for(const[,M]of Be(b,m)){const x=Xe.from(M,g,v),$=nd(x,c);for(let A=0,C=M.length;A{f.selectAll().data(e).enter().append("path").call(Q,this).attr("d",d=>c[d]).call(lt,this,r)}).node()}}class fx extends za{constructor(e,n){super(e,n,ax),this.fill="none"}_render(e,n){return nd(e,n).render()}}function nd(t,e){const{width:n,height:r,marginTop:i,marginRight:o,marginBottom:a,marginLeft:u}=e;return t.voronoi([u,i,n-o,r-a])}function or(t,e,{x:n,y:r,...i}={}){return[n,r]=Ft(n,r),new t(e,{...i,x:n,y:r})}function dx(t,e){return or(ux,t,e)}function hx(t,e){return or(sx,t,e)}function mx(t,e){return or(lx,t,e)}function yx(t,{x:e,y:n,initializer:r,...i}={}){return or(cx,t,{...Dt({...i,x:e,y:n},qc),initializer:r})}function px(t,e){return or(fx,t,e)}const gx={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class rd extends et{constructor(e,{x:n,y:r,z:i,weight:o,fill:a,stroke:u,...s}={}){const l=id(a)&&(a="currentColor",!0),c=id(u)&&(u="currentColor",!0);super(e,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:ge({z:i,fill:a,stroke:u}),optional:!0},weight:{value:o,optional:!0}},xx({...s,fill:a,stroke:u},l,c),gx),l&&(this.fill=void 0),c&&(this.stroke=void 0),this.z=i}filter(e){return e}render(e,n,r,i,o){const{contours:a}=r,u=kn();return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{}).call(s=>s.selectAll().data(e).enter().append("path").call(Q,this).call(lt,this,r).attr("d",l=>u(a[l]))).node()}}function bx(t,{x:e,y:n,...r}={}){return[e,n]=Ft(e,n),new rd(t,{...r,x:e,y:n})}const wx=new Set(["x","y","z","weight"]);function xx(t,e,n){let{bandwidth:i,thresholds:o}=t;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Lt(o):+o,At(t,function(a,u,s,l,c,f){const d=s.weight?Lt(s.weight.value):null,h=s.z?.value,{z:m}=this,[y,w]=Ht(this,c),{width:p,height:g}=c,{x:v,y:b}=_n(s,l,f),M=Object.fromEntries(Object.entries(s).filter(([T])=>!wx.has(T)).map(([T,L])=>[T,{...L,value:[]}])),x=e&&[],$=n&&[],A=zy().x(v?T=>v[T]:y).y(b?T=>b[T]:w).weight(d?T=>d[T]:1).size([p,g]).bandwidth(i),C=[];for(const T of u){const L=[];C.push(L);for(const z of h?Do(T,h,m):[T]){const N=A.contours(z);L.push([z,N])}}let S=o;if(!(S instanceof Mr)){let T=0;for(const L of C)for(const[,z]of L){const N=z.max;N>T&&(T=N)}S=Float64Array.from({length:o-1},(L,z)=>T*100*(z+1)/o)}const E=[],k=[];for(const T of C){const L=[];E.push(L);for(const[z,N]of T)for(const I of S){L.push(k.length),k.push(N(I/100)),x&&x.push(I),$&&$.push(I);for(const G in M)M[G].value.push(s[G].value[z[0]])}}return x&&x.push(0),$&&$.push(0),{data:a,facets:E,channels:{...M,...x&&{fill:{value:x,scale:"color"}},...$&&{stroke:{value:$,scale:"color"}},contours:{value:k}}}})}function id(t){return/^density$/i.test(t)}function vx(t,e){return od("x",t,e)}function $x(t,e){return od("y",t,e)}function od(t,e,{x1:n,x2:r,y1:i,y2:o,x:a=n===void 0&&r===void 0?t==="y"?mt:j:void 0,y:u=i===void 0&&o===void 0?t==="x"?mt:j:void 0,fill:s,positiveFill:l="#3ca951",negativeFill:c="#4269d0",fillOpacity:f=1,positiveFillOpacity:d=f,negativeFillOpacity:h=f,stroke:m,strokeOpacity:y,z:w=Ct(m)[0],clip:p,tip:g,render:v,...b}={}){return[n,r]=ad(a,n,r),[i,o]=ad(u,i,o),n===r&&i===o&&(t==="y"?i=fe(0):n=fe(0)),{tip:g}=Fe({tip:g},t==="y"?"x":"y"),Bt(ut(l)?null:Object.assign(ga(e,{x1:n,x2:r,y1:i,y2:o,z:w,fill:l,fillOpacity:d,render:Hn(v,ud(t,!0)),clip:p,...b}),{ariaLabel:"positive difference"}),ut(c)?null:Object.assign(ga(e,{x1:n,x2:r,y1:i,y2:o,z:w,fill:c,fillOpacity:h,render:Hn(v,ud(t,!1)),clip:p,...b}),{ariaLabel:"negative difference"}),pi(e,{x:r,y:o,z:w,stroke:m,strokeOpacity:y,tip:g,clip:!0,...b}))}function ad(t,e,n){return e===void 0&&n===void 0?e=n=fe(t):e===void 0?(n=fe(n),e=t===void 0?n:fe(t)):n===void 0?(e=fe(e),n=t===void 0?e:fe(t)):(e=fe(e),n=fe(n)),[e,n]}function fe(t){let e;const{value:n,label:r=Xt(n)}=Je(t);return{transform:i=>e||(e=H(i,n)),label:r}}function ud(t,e){const n=t==="x"?"y":"x",r=`${n}1`,i=`${n}2`,o=`${t}1`,a=`${t}2`;return(u,s,l,c,f,d)=>{const{[r]:h,[i]:m}=l,y=new Float32Array(h.length),w=new Float32Array(m.length),p=c[t==="y"?"height":"width"];(e===fl(s[t])<0?y:w).fill(p);const g=d(u,s,{...l,[i]:h,[a]:w},c,f),v=d(u,s,{...l,[r]:m,[o]:y},c,f),b=g.querySelector("g")??g,M=v.querySelector("g")??v;for(let x=0;b.firstChild;x+=2){const $=Fo(),A=Z("svg:clipPath",f).attr("id",$).node();A.appendChild(b.firstChild),M.childNodes[x].setAttribute("clip-path",`url(#${$})`),M.insertBefore(A,M.childNodes[x])}return v}}function sd({geometry:t=j,...e}={}){const n=rn(r=>H(r,t));return At({...e,x:null,y:null,geometry:{transform:n}},(r,i,o,a,u,s)=>{const l=n(r),c=l.length,f=new Float64Array(c),d=new Float64Array(c),{centroid:h}=s.path();for(let m=0;mH(i,t)),r=rn(i=>H(n(i),Ny));return{...e,x:{transform:i=>Float64Array.from(r(i),([o])=>o)},y:{transform:i=>Float64Array.from(r(i),([,o])=>o)},geometry:{transform:n}}}const Ax={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class ld extends et{constructor(e,n={}){const[r,i]=dt(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:Jt,optional:!0},geometry:{value:n.geometry,scale:"projection"}},va(n),Ax),this.r=i}render(e,n,r,i,o){const{geometry:a,r:u}=r,s=o.path(),{r:l}=this;return wr(l)?e=[]:l!==void 0&&s.pointRadius(l),Z("svg:g",o).call(ot,this,i,o).call(tt,this,n).call(c=>{c.selectAll().data(e).enter().append("path").call(Q,this).attr("d",u?f=>s.pointRadius(u[f])(a[f]):f=>s(a[f])).call(lt,this,r)}).node()}}function Na(t,e={}){return e.tip&&e.x===void 0&&e.y===void 0?e=sd(e):e.geometry===void 0&&(e={...e,geometry:j}),new ld(t,e)}function Cx({strokeWidth:t=1.5,...e}={}){return Na({type:"Sphere"},{strokeWidth:t,...e})}function Sx({strokeOpacity:t=.1,...e}={}){return Na(Iy(),{strokeOpacity:t,...e})}const ar=.5,ur=0;function kx(t={fill:"count"},{binWidth:e,...n}={}){const{z:r}=n;return e=e===void 0?20:rt(e),t=Is(t,n),be(t,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!be(t,"r")&&(n.r=e/2),At(n,(i,o,a,u,s,l)=>{let{x:c,y:f,z:d,fill:h,stroke:m,symbol:y}=a;if(c===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:c,y:f}=_n(a,u,l)),d=d?d.value:H(i,r),h=h?.value,m=m?.value,y=y?.value;const w=fo(t,{z:d,fill:h,stroke:m,symbol:y}),p=d&&[],g=h&&[],v=m&&[],b=y&&[],M=[],x=[],$=[];let A=-1;for(const k of t)k.initialize(i);for(const k of o){const T=[];for(const L of t)L.scope("facet",k);for(const[L,z]of Be(k,w))for(const{index:N,extent:I}of Lx(i,z,c,f,e)){T.push(++A),x.push(I.x),$.push(I.y),d&&p.push(w===d?L:d[N[0]]),h&&g.push(w===h?L:h[N[0]]),m&&v.push(w===m?L:m[N[0]]),y&&b.push(w===y?L:y[N[0]]);for(const G of t)G.reduce(N,I)}M.push(T)}const C=a.x.scale,S=a.y.scale,E={x:{value:x,source:u[C]?{value:J(x,u[C].invert),scale:C}:null},y:{value:$,source:u[S]?{value:J($,u[S].invert),scale:S}:null},...d&&{z:{value:p}},...h&&{fill:{value:g,scale:"auto"}},...m&&{stroke:{value:v,scale:"auto"}},...y&&{symbol:{value:b,scale:"auto"}},...Object.fromEntries(t.map(({name:k,output:T})=>[k,{scale:"auto",label:T.label,radius:k==="r"?e/2:void 0,value:T.transform()}]))};return{data:i,facets:M,channels:E}})}function Lx(t,e,n,r,i){const o=i*(1.5/Ls),a=new Map;for(const u of e){let s=n[u],l=r[u];if(isNaN(s)||isNaN(l))continue;let c=Math.round(l=(l-ur)/o),f=Math.round(s=(s-ar)/i-(c&1)/2),d=l-c;if(Math.abs(d)*3>1){let y=s-f,w=f+(sg*g+v*v&&(f=w+(c&1?1:-1)/2,c=p)}const h=`${f},${c}`;let m=a.get(h);m===void 0&&(m={index:[],extent:{data:t,x:(f+(c&1)/2)*i+ar,y:c*o+ur}},a.set(h,m)),m.index.push(u)}return a.values()}const Ex={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function Tx(t){return new cd(t)}class cd extends et{constructor({binWidth:e=20,clip:n=!0,...r}={}){super(zn,void 0,{clip:n,...r},Ex),this.binWidth=rt(e)}render(e,n,r,i,o){const{binWidth:a}=this,{marginTop:u,marginRight:s,marginBottom:l,marginLeft:c,width:f,height:d}=i,h=c-ar,m=f-s-ar,y=u-ur,w=d-l-ur,p=a/2,g=p*Es,v=g/2,b=p*2,M=g*1.5,x=Math.floor(h/b),$=Math.ceil(m/b),A=Math.floor((y+v)/M),C=Math.ceil((w-v)/M)+1,S=`m0,${Se(-g)}l${Se(p)},${Se(v)}v${Se(g)}l${Se(-p)},${Se(v)}`;let E=S;for(let k=A;kk.append("path").call(Q,this).call(lt,this,r).attr("d",E)).node()}}function Se(t){return Math.round(t*1e3)/1e3}const zx={ariaLabel:"image",fill:null,stroke:null};function Nx(t){return/^\.*\//.test(t)}function Ix(t){return/^(blob|data|file|http|https):/i.test(t)}function Rx(t){return typeof t=="string"&&(Nx(t)||Ix(t))?[void 0,t]:[t,void 0]}class fd extends et{constructor(e,n={}){let{x:r,y:i,r:o,width:a,height:u,rotate:s,src:l,preserveAspectRatio:c,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&a===void 0&&u===void 0?a=u=16:a===void 0&&u!==void 0?a=u:u===void 0&&a!==void 0&&(u=a);const[m,y]=Rx(l),[w,p]=dt(o),[g,v]=dt(a,p!==void 0?p*2:void 0),[b,M]=dt(u,p!==void 0?p*2:void 0),[x,$]=dt(s,0);super(e,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:w,scale:"r",filter:Jt,optional:!0},width:{value:g,filter:Jt,optional:!0},height:{value:b,filter:Jt,optional:!0},rotate:{value:x,optional:!0},src:{value:m,optional:!0}},va(n),zx),this.src=y,this.width=v,this.rotate=$,this.height=M,this.r=p,this.preserveAspectRatio=yt(c,"xMidYMid"),this.crossOrigin=xt(f),this.frameAnchor=On(d),this.imageRendering=yt(h,"auto")}render(e,n,r,i,o){const{x:a,y:u}=n,{x:s,y:l,width:c,height:f,r:d,rotate:h,src:m}=r,{r:y,width:w,height:p,rotate:g}=this,[v,b]=Ht(this,i);return Z("svg:g",o).call(ot,this,i,o).call(tt,this,{x:s&&a,y:l&&u}).call(M=>M.selectAll().data(e).enter().append("image").call(Q,this).attr("x",dd(s,c,d,v,w,y)).attr("y",dd(l,f,d,b,p,y)).attr("width",c?x=>c[x]:w!==void 0?w:d?x=>d[x]*2:y*2).attr("height",f?x=>f[x]:p!==void 0?p:d?x=>d[x]*2:y*2).attr("transform",h?x=>`rotate(${h[x]})`:g?`rotate(${g})`:null).attr("transform-origin",h||g?Qn`${s?x=>s[x]:v}px ${l?x=>l[x]:b}px`:null).call(q,"href",m?x=>m[x]:this.src).call(q,"preserveAspectRatio",this.preserveAspectRatio).call(q,"crossorigin",this.crossOrigin).call(q,"image-rendering",this.imageRendering).call(q,"clip-path",d?x=>`circle(${d[x]}px)`:y!==void 0?`circle(${y}px)`:null).call(lt,this,r)).node()}}function dd(t,e,n,r,i,o){return e&&t?a=>t[a]-e[a]/2:e?a=>r-e[a]/2:t&&i!==void 0?a=>t[a]-i/2:i!==void 0?r-i/2:n&&t?a=>t[a]-n[a]:n?a=>r-n[a]:t?a=>t[a]-o:r-o}function Bx(t,{x:e,y:n,...r}={}){return r.frameAnchor===void 0&&([e,n]=Ft(e,n)),new fd(t,{...r,x:e,y:n})}function Ox(t,e,n){var r=1e-8,i=e-1,o=n-1,a=0,u,s,l,c,f,d,h,m;if(t<=0)return 0;if(t>=1)return 1;for(u=Math.log(e/(e+n)),s=Math.log(n/(e+n)),l=Math.exp(e*u)/e,c=Math.exp(n*s)/n,h=l+c,t=1&&(d=.5*(d+l+1)),Math.abs(l)0)break}return d}function Fx(t,e,n){var r=t===0||t===1?0:Math.exp(wn(e+n)-wn(e)-wn(n)+e*Math.log(t)+n*Math.log(1-t));return t<0||t>1?!1:t<(e+1)/(e+n+2)?r*hd(t,e,n)/e:1-r*hd(1-t,n,e)/n}function hd(t,e,n){var r=1e-30,i=1,o=e+n,a=e+1,u=e-1,s=1,l=1-o*t/a,c,f,d,h;for(Math.abs(l).5?n:-n}const Yx={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class md extends et{constructor(e,n={}){const{x:r,y:i,z:o,ci:a=.95,precision:u=4}=n;if(super(e,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:ge(n),optional:!0}},n,Yx),this.z=o,this.ci=+a,this.precision=+u,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${a}`);if(!(this.precision>0))throw new Error(`invalid precision: ${u}`)}render(e,n,r,i,o){const{x:a,y:u,z:s}=r,{ci:l}=this;return Z("svg:g",o).call(ot,this,i,o).call(tt,this,n).call(c=>c.selectAll().data(s?Do(e,s,this.z):[e]).enter().call(f=>f.append("path").attr("fill","none").call(Q,this).call(qr,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,a,u)).call(l&&!en(this.fill)?d=>d.select(Gx).attr("stroke","none").call(Q,this).call(qr,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,a,u)):()=>{}))).node()}}function Gx(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ze.svg,"path"),this)}class jx extends md{constructor(e,n){super(e,n)}_renderBand(e,n,r){const{ci:i,precision:o}=this,[a,u]=gt(e,c=>r[c]),s=$i(e,r,n),l=yd(e,r,n,(1-i)/2,s);return Fi().y(c=>c).x0(c=>l(c,-1)).x1(c=>l(c,1))(vn(a,u-o/2,o).concat(u))}_renderLine(e,n,r){const[i,o]=gt(e,u=>r[u]),a=$i(e,r,n);return`M${a(i)},${i}L${a(o)},${o}`}}class qx extends md{constructor(e,n){super(e,n)}_renderBand(e,n,r){const{ci:i,precision:o}=this,[a,u]=gt(e,c=>n[c]),s=$i(e,n,r),l=yd(e,n,r,(1-i)/2,s);return Fi().x(c=>c).y0(c=>l(c,-1)).y1(c=>l(c,1))(vn(a,u-o/2,o).concat(u))}_renderLine(e,n,r){const[i,o]=gt(e,u=>n[u]),a=$i(e,n,r);return`M${i},${a(i)}L${o},${a(o)}`}}function Px(t,{y:e=mt,x:n=j,stroke:r,fill:i=ut(r)?"currentColor":r,...o}={}){return new jx(t,ha({...o,x:n,y:e,fill:i,stroke:r}))}function Wx(t,{x:e=mt,y:n=j,stroke:r,fill:i=ut(r)?"currentColor":r,...o}={}){return new qx(t,da({...o,x:e,y:n,fill:i,stroke:r}))}function $i(t,e,n){let r=0,i=0,o=0,a=0;for(const c of t){const f=e[c],d=n[c];r+=f,i+=d,o+=f*d,a+=f*f}const u=t.length,s=(u*o-r*i)/(u*a-r*r),l=(i-s*r)/u;return c=>s*c+l}function yd(t,e,n,r,i){const o=jt(t,c=>e[c])/t.length;let a=0,u=0;for(const c of t)a+=(e[c]-o)**2,u+=(n[c]-i(e[c]))**2;const s=Math.sqrt(u/(t.length-2)),l=Dx(r,t.length-2);return(c,f)=>{const d=i(c),h=s*Math.sqrt(1/t.length+(c-o)**2/a);return d+f*l*h}}function Ia({path:t=j,delimiter:e,frameAnchor:n,treeLayout:r=pr,treeSort:i,treeSeparation:o,treeAnchor:a,treeFilter:u,...s}={}){a=Ra(a),i=gd(i),u!=null&&(u=Oa(u)),n===void 0&&(n=a.frameAnchor);const l=wd(e),c=kd(s,Oa),[f,d]=Nt(),[h,m]=Nt();return{x:f,y:h,frameAnchor:n,...Dt(s,(y,w)=>{const p=l(H(y,t)),g=d([]),v=m([]);let b=-1;const M=[],x=[],$=ts().path(S=>p[S]),A=te(y)?S=>S.data=y[S.data]:S=>S.data=y.get(S.data),C=r();C.nodeSize&&C.nodeSize([1,1]),C.separation&&o!==void 0&&C.separation(o??_i);for(const S of c)S[Ai]=S[Cd]([]);for(const S of w){const E=[],k=$(S.filter(T=>p[T]!=null)).each(A);i!=null&&k.sort(i),C(k);for(const T of k.descendants())if(!(u!=null&&!u(T))){E.push(++b),M[b]=T.data,a.position(T,b,g,v);for(const L of c)L[Ai][b]=L[Sd](T)}x.push(E)}return{data:M,facets:x}}),...Object.fromEntries(c)}}function pd({path:t=j,delimiter:e,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:a=pr,treeSort:u,treeSeparation:s,treeAnchor:l,treeFilter:c,...f}={}){l=Ra(l),u=gd(u),c!=null&&(c=$d(c)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};const d=wd(e),h=kd(f,$d),[m,y]=Nt(),[w,p]=Nt(),[g,v]=Nt(),[b,M]=Nt();return{x1:m,x2:w,y1:g,y2:b,...Dt(f,(x,$)=>{const A=d(H(x,t)),C=y([]),S=p([]),E=v([]),k=M([]);let T=-1;const L=[],z=[],N=ts().path(G=>A[G]),I=a();I.nodeSize&&I.nodeSize([1,1]),I.separation&&s!==void 0&&I.separation(s??_i);for(const G of h)G[Ai]=G[Cd]([]);for(const G of $){const R=[],B=N(G.filter(F=>A[F]!=null)).each(F=>F.data=x[F.data]);u!=null&&B.sort(u),I(B);for(const{source:F,target:D}of B.links())if(!(c!=null&&!c(D,F))){R.push(++T),L[T]=D.data,l.position(F,T,C,E),l.position(D,T,S,k);for(const Y of h)Y[Ai][T]=Y[Sd](D,F)}z.push(R)}return{data:L,facets:z}}),...Object.fromEntries(h)}}function Ra(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return Xx;case"right":return _x}throw new Error(`invalid tree anchor: ${t}`)}const Xx={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,i){r[n]=e,i[n]=-t}},_x={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,i){r[n]=-e,i[n]=-t}};function gd(t){return t==null||typeof t=="function"?t:`${t}`.trim().toLowerCase().startsWith("node:")?bd(Oa(t)):bd(Vx(t))}function bd(t){return(e,n)=>Rt(t(e),t(n))}function Vx(t){return e=>e.data?.[t]}function wd(t="/"){if(t=`${t}`,t==="/")return n=>n;if(t.length!==1)throw new Error("delimiter must be exactly one character");const e=t.charCodeAt(0);return n=>n.map(r=>Hx(r,e))}const Ba=92,xd=47;function Hx(t,e){if(e===Ba)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=t.length;rn==null?void 0:t(n)}function Kx(t){let e=t.length;for(;--e>0&&!Qx(t,e););return Zx(t.slice(e+1))}function Qx(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if((n&1)===0)return!0}return!1}const Cd=2,Sd=3,Ai=4;function kd(t,e){const n=[];for(const r in t){const i=t[r],o=e(i);o!==void 0&&n.push([r,...Nt(i),o])}return n}function Ld(t,{fill:e,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:a,strokeMiterlimit:u,strokeDasharray:s,strokeDashoffset:l,marker:c,markerStart:f=c,markerEnd:d=c,dot:h=ut(f)&&ut(d),text:m="node:name",textStroke:y="var(--plot-background)",title:w="node:path",dx:p,dy:g,textAnchor:v,treeLayout:b=pr,textLayout:M=b===pr||b===es?"mirrored":"normal",tip:x,...$}={}){if(p===void 0&&(p=Ra($.treeAnchor).dx),v!==void 0)throw new Error("textAnchor is not a configurable tree option");M=Tt(M,"textLayout",["mirrored","normal"]);function A(C){return un(t,Ia({treeLayout:b,text:m,fill:e===void 0?"currentColor":e,stroke:y,dx:p,dy:g,title:w,...C,...$}))}return Bt($f(t,pd({treeLayout:b,markerStart:f,markerEnd:d,stroke:n!==void 0?n:e===void 0?"node:internal":e,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:a,strokeMiterlimit:u,strokeDasharray:s,strokeDashoffset:l,...$})),h?Ce(t,Ia({treeLayout:b,fill:e===void 0?"node:internal":e,title:w,tip:x,...$})):null,m!=null?M==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-p})]:A():null)}function Jx(t,e){return Ld(t,{...e,treeLayout:es})}const Ed={ariaLabel:"waffle"};class Td extends wa{constructor(e,{unit:n=1,gap:r=1,round:i,multiple:o,...a}={}){super(e,Nd("x",a),Ed),this.unit=Math.max(0,n),this.gap=+r,this.round=Id(i),this.multiple=Rd(o)}}class zd extends xa{constructor(e,{unit:n=1,gap:r=1,round:i,multiple:o,...a}={}){super(e,Nd("y",a),Ed),this.unit=Math.max(0,n),this.gap=+r,this.round=Id(i),this.multiple=Rd(o)}}function Nd(t,e){const n=t==="y"?"x":"y",r=`${t}1`,i=`${t}2`;return At(t1(e),function(o,a,u,s,l){const{round:c,unit:f}=this,d=u[r].value,h=u[i].value,m=Rr({...n in u&&{[n]:u[n]},[r]:u[r],[i]:u[i]},s),y=this[t==="y"?"_width":"_height"](s,m,l),w=this[t==="y"?"_x":"_y"](s,m,l),p=f*r1(s.scales[t]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(y/p)))}=this,v=Math.min(y/g,p*g),b=p*g,M=(y-g*v)/2,x=typeof w=="function"?N=>w(N)+M:w+M,$=s[t](0),A=t==="y"?([N,I])=>[N*v,-I*b]:([N,I])=>[I*b,N*v],C=typeof x=="function"?N=>x(N)-y/2:()=>x,[S,E]=t==="y"?[0,1]:[1,0],k=h.length,T=new Array(k),L=new Float64Array(k),z=new Float64Array(k);for(let N=0;NA.selectAll().data(n).enter().append(()=>x.cloneNode(!0)).attr("id",C=>`${M}-${C}`).select("rect").call(Q,this).call(lt,this,m)).call(A=>A.selectAll().data(n).enter().append("path").attr("transform",Qn`translate(${g},${b})`).attr("d",C=>`M${w[C].join("L")}Z`).attr("fill",C=>`url(#${M}-${C})`).attr("stroke",this.stroke==null?null:"none").call(lt,this,{ariaLabel:f,href:d,title:h})).node()})}}function ja(t,e,n){if(es&&f.push([0,s]),f.push([r,s],[r,u+t%1],[i,u+t%1]),t%n>n-1||(f.push([i,u]),l>u&&f.push([n,u])),l>u&&f.push([n,l]),f.push([a,l],[a,l+e%1],[o,l+e%1]),e%n<1||(f.push([o,c]),c>s&&f.push([0,c])),f.push(n1(t,e,n)),f}function e1(t,e,n,r){return ja(t+r*n,e+r*n,n).map(([i,o])=>[i,o-r])}function n1(t,e,n){const r=Math.floor(e/n)-Math.floor(t/n);return r===0?qa(t,e,n):r===1?Math.floor(e%n)>Math.ceil(t%n)?[(Math.floor(e%n)+Math.ceil(t%n))/2,Math.floor(e/n)]:e%n>n-t%n?qa(e-e%n,e,n):qa(t,n*Math.ceil(t/n),n):[n/2,(Math.round(t/n)+Math.round(e/n))/2]}function qa(t,e,n){const r=Math.floor(e)-Math.floor(t);return r===0?[Math.floor(t%n)+.5,Math.floor(t/n)+(t+e)/2%1]:r===1?e%1-t%1>.5?[Math.ceil(t%n),Math.floor(e/n)+(t%1+e%1)/2]:e%1>1-t%1?[Math.floor(e%n)+.5,Math.floor(e/n)+e%1/2]:[Math.floor(t%n)+.5,Math.floor(t/n)+(1+t%1)/2]:[Math.ceil(t%n)+Math.ceil(Math.floor(e)-Math.ceil(t))/2,Math.floor(t/n)+(e>=1+t?.5:(t+e)/2%1)]}function Id(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 Rd(t){return t===void 0?void 0:Math.max(1,Math.floor(t))}function r1({domain:t,range:e}){return Bd(e)/Bd(t)}function Bd(t){const[e,n]=gt(t);return n-e}function i1(t,{tip:e,...n}={}){return Ue(n)||(n={...n,y:mt,x2:j}),new Td(t,{tip:Od(e),...Qr(Vo(Ur(n)))})}function o1(t,{tip:e,...n}={}){return Ue(n)||(n={...n,x:mt,y2:j}),new zd(t,{tip:Od(e),...Jr(Ho(Kr(n)))})}function Od(t){return t===!0?{maxRadius:1/0}:zt(t)&&t.maxRadius===void 0?{...t,maxRadius:1/0}:void 0}const a1=({marginLeft:t})=>[1,t],u1=({width:t,marginRight:e})=>[-1,t-e],s1=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],l1=({marginTop:t})=>[1,t],c1=({height:t,marginBottom:e})=>[-1,t-e],f1=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function Fd(t){return typeof t=="string"?{anchor:t}:t}function d1(t={},e={}){arguments.length===1&&([t,e]=Dd(t));let{anchor:n="left",padding:r=1,r:i=e.r}=Fd(t);switch(`${n}`.toLowerCase()){case"left":n=a1;break;case"right":n=u1;break;case"middle":n=s1;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Yd("x","y",n,rt(r),i,e)}function h1(t={},e={}){arguments.length===1&&([t,e]=Dd(t));let{anchor:n="bottom",padding:r=1,r:i=e.r}=Fd(t);switch(`${n}`.toLowerCase()){case"top":n=l1;break;case"bottom":n=c1;break;case"middle":n=f1;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Yd("y","x",n,rt(r),i,e)}function Dd(t){const{anchor:e,padding:n,...r}=t,{r:i}=r;return[{anchor:e,padding:n,r:i},r]}function Yd(t,e,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:a,sort:u,reverse:s}=o;a=Qi(a),a?.r===void 0&&(o={...o,channels:{...a,r:{value:i,scale:"r"}}}),u===void 0&&s===void 0&&(o.sort={channel:"-r"})}return At(o,function(a,u,s,l,c,f){let{[e]:d,r:h}=s;if(!s[e])throw new Error(`missing channel: ${e}`);({[e]:d}=_n(s,l,f));const m=h?void 0:i!==void 0?rt(i):this.r!==void 0?this.r:3;h&&(h=H(h.value,l[h.scale]||j,Float64Array));let[y,w]=n(c);const p=y?y1:m1,g=new Float64Array(d.length),v=h?b=>h[b]:()=>m;for(let b of u){const M=Oy();b=b.filter(h?$=>br(d[$])&&Jt(h[$]):$=>br(d[$]));const x=new Float64Array(2*b.length+2);for(const $ of b){const A=v($),C=y?A+r:0,S=d[$]-A,E=d[$]+A;let k=2;M.queryInterval(S-r,E+r,([,,L])=>{const z=g[L]-C,N=d[$]-d[L],I=r+(h?h[$]+h[L]:2*m),G=Math.sqrt(I*I-N*N);x[k++]=z-G,x[k++]=z+G});let T=x.slice(0,k);y&&(T=T.filter(L=>L>=0));t:for(const L of T.sort(p)){for(let z=0;zt(e,r=>n[r]))}const b1={mapIndex(t,e,n){const[r,i]=gt(t,a=>e[a]),o=i-r;for(const a of t)n[a]=e[a]===null?NaN:(e[a]-r)/o}},Gd=Ci((t,e)=>{for(let n=0;n{for(let n=t.length-1;n>=0;--n){const r=e[t[n]];if(wt(r))return r}}),x1={mapIndex(t,e,n){const r=cr(t,o=>e[o]),i=fr(t,o=>e[o]);for(const o of t)n[o]=e[o]===null?NaN:i?(e[o]-r)/i:0}},v1=xn(kt),$1=xn(cr),M1=xn(Cn),A1=xn(It),C1=xn(jt);function S1(t,e){return jd("x",t,e)}function k1(t,e){return jd("y",t,e)}function jd(t,e,n={}){let r,i=1;if(typeof e=="number")i=e,r=(l,c)=>+l+c;else{if(typeof e=="string"){const l=e.startsWith("-")?-1:1;[e,i]=qi(e.replace(/^[+-]/,"")),i*=l}e=Lr(e),r=(l,c)=>e.offset(l,c)}const o=`${t}1`,a=`${t}2`,u=Zt({[o]:l=>l.map(c=>r(c,i)),[a]:l=>l},n),s=u[a].transform;return u[a].transform=()=>{const l=s(),[c,f]=gt(l);return l.domain=i<0?[c,r(f,i)]:[r(c,i),f],l},u}function L1(t,e={}){if(typeof t=="string")switch(t.toLowerCase()){case"first":return qd(e);case"last":return Pd(e)}if(typeof t=="function")return ke(null,t,e);let n,r;for(n in t){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=E1(t[n])}if(r===void 0)throw new Error(`invalid selector: ${t}`);return ke(n,r,e)}function E1(t){if(typeof t=="function")return t;switch(`${t}`.toLowerCase()){case"min":return Wa;case"max":return Xa}throw new Error(`unknown selector: ${t}`)}function qd(t){return ke(null,R1,t)}function Pd(t){return ke(null,B1,t)}function T1(t){return ke("x",Wa,t)}function z1(t){return ke("y",Wa,t)}function N1(t){return ke("x",Xa,t)}function I1(t){return ke("y",Xa,t)}function*R1(t){yield t[0]}function*B1(t){yield t[t.length-1]}function*Wa(t,e){yield Ry(t,n=>e[n])}function*Xa(t,e){yield Bi(t,n=>e[n])}function ke(t,e,n){if(t!=null){if(n[t]==null)throw new Error(`missing channel: ${t}`);t=n[t]}const r=ge(n);return Dt(n,(i,o)=>{const a=H(i,r),u=H(i,t),s=[];for(const l of o){const c=[];for(const f of a?Te(l,d=>a[d]).values():[l])for(const d of e(f,u))c.push(d);s.push(c)}return{data:i,facets:s}})}et.prototype.plot=function({marks:t=[],...e}={}){return of({...e,marks:[...t,this]})};export{fi as Area,Mf as Arrow,wa as BarX,xa as BarY,hi as Cell,Kf as Contour,rd as Density,mi as Dot,Kc as Frame,ld as Geo,cd as Hexgrid,fd as Image,yi as Line,vf as Link,et as Mark,Pf as Raster,ei as Rect,Zl as RuleX,Ul as RuleY,_r as Text,Rf as TickX,Bf as TickY,Qc as Tip,Vr as Vector,Td as WaffleX,zd as WaffleY,ga as area,tr as areaX,yn as areaY,t0 as arrow,d0 as auto,Sf as autoSpec,Mc as axisFx,$c as axisFy,Jo as axisX,Qo as axisY,Ye as barX,Ge as barY,De as bin,Me as binX,Ae as binY,je as bollinger,z0 as bollingerX,N0 as bollingerY,R0 as boxX,B0 as boxY,pn as cell,r0 as cellX,i0 as cellY,sd as centroid,s0 as circle,Jx as cluster,Nt as column,Z0 as contour,K0 as crosshair,Q0 as crosshairX,J0 as crosshairY,dx as delaunayLink,hx as delaunayMesh,bx as density,vx as differenceX,$x as differenceY,d1 as dodgeX,h1 as dodgeY,Ce as dot,a0 as dotX,u0 as dotY,cp as filter,Cp as find,kl as formatIsoDate,Pg as formatMonth,Sl as formatNumber,Wg as formatWeekday,ua as frame,Na as geo,Mx as geoCentroid,Sx as graticule,Ec as gridFx,kc as gridFy,Lc as gridX,Sc as gridY,so as group,Gn as groupX,jn as groupY,uo as groupZ,l0 as hexagon,kx as hexbin,Tx as hexgrid,mx as hull,j as identity,Bx as image,mt as indexOf,At as initializer,Hf as interpolateNearest,Ea as interpolateNone,Vf as interpolatorBarycentric,Zf as interpolatorRandomWalk,Wb as legend,pi as line,er as lineX,nr as lineY,Px as linearRegressionX,Wx as linearRegressionY,$f as link,Zt as map,Ma as mapX,Aa as mapY,Bt as marks,Pa as normalize,p1 as normalizeX,g1 as normalizeY,$s as numberInterval,of as plot,qo as pointer,Po as pointerX,Pr as pointerY,F0 as raster,aa as rect,ii as rectX,oi as rectY,fp as reverse,xe as ruleX,ve as ruleY,gg as scale,L1 as select,qd as selectFirst,Pd as selectLast,N1 as selectMaxX,I1 as selectMaxY,T1 as selectMinX,z1 as selectMinY,S1 as shiftX,k1 as shiftY,dp as shuffle,Ts as sort,Cx as sphere,Nb as spike,Pc as stackX,Zb as stackX1,Ub as stackX2,Wc as stackY,Kb as stackY1,Qb as stackY2,un as text,tc as textX,ec as textY,Of as tickX,Ff as tickY,Pi as timeInterval,Jc as tip,Dt as transform,Ld as tree,pd as treeLink,Ia as treeNode,$r as utcInterval,H as valueof,yc as vector,pc as vectorX,gc as vectorY,yx as voronoi,px as voronoiMesh,i1 as waffleX,o1 as waffleY,wi as window,w0 as windowX,x0 as windowY};