import{l as y,k as b}from"./index-Cirud96V.js";import{a as A}from"./init-BFKUnIhM.js";import{e as M,b as R,a as q,f as F}from"./defaultLocale-CrowFXzY.js";function S(n,r){return n=+n,r=+r,function(i){return Math.round(n*(1-i)+r*i)}}function g(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function j(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function k(n){let r,i,t;n.length!==2?(r=g,i=(u,o)=>g(n(u),o),t=(u,o)=>n(u)-o):(r=n===g||n===j?n:z,i=n,t=n);function f(u,o,e=0,h=u.length){if(e<h){if(r(o,o)!==0)return h;do{const c=e+h>>>1;i(u[c],o)<0?e=c+1:h=c}while(e<h)}return e}function l(u,o,e=0,h=u.length){if(e<h){if(r(o,o)!==0)return h;do{const c=e+h>>>1;i(u[c],o)<=0?e=c+1:h=c}while(e<h)}return e}function a(u,o,e=0,h=u.length){const c=f(u,o,e,h-1);return c>e&&t(u[c-1],o)>-t(u[c],o)?c-1:c}return{left:f,center:a,right:l}}function z(){return 0}function I(n){return n===null?NaN:+n}function*en(n,r){for(let i of n)i!=null&&(i=+i)>=i&&(yield i)}const P=k(g),$=P.right;k(I).center;const x=Math.sqrt(50),B=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,i){const t=(r-n)/Math.max(0,i),f=Math.floor(Math.log10(t)),l=t/Math.pow(10,f),a=l>=x?10:l>=B?5:l>=C?2:1;let u,o,e;return f<0?(e=Math.pow(10,-f)/a,u=Math.round(n*e),o=Math.round(r*e),u/e<n&&++u,o/e>r&&--o,e=-e):(e=Math.pow(10,f)*a,u=Math.round(n/e),o=Math.round(r/e),u*e<n&&++u,o*e>r&&--o),o<u&&.5<=i&&i<2?v(n,r,i*2):[u,o,e]}function D(n,r,i){if(r=+r,n=+n,i=+i,!(i>0))return[];if(n===r)return[n];const t=r<n,[f,l,a]=t?v(r,n,i):v(n,r,i);if(!(l>=f))return[];const u=l-f+1,o=new Array(u);if(t)if(a<0)for(let e=0;e<u;++e)o[e]=(l-e)/-a;else for(let e=0;e<u;++e)o[e]=(l-e)*a;else if(a<0)for(let e=0;e<u;++e)o[e]=(f+e)/-a;else for(let e=0;e<u;++e)o[e]=(f+e)*a;return o}function d(n,r,i){return r=+r,n=+n,i=+i,v(n,r,i)[2]}function E(n,r,i){r=+r,n=+n,i=+i;const t=r<n,f=t?d(r,n,i):d(n,r,i);return(t?-1:1)*(f<0?1/-f:f)}function G(n){return function(){return n}}function H(n){return+n}var N=[0,1];function m(n){return n}function p(n,r){return(r-=n=+n)?function(i){return(i-n)/r}:G(isNaN(r)?NaN:.5)}function J(n,r){var i;return n>r&&(i=n,n=r,r=i),function(t){return Math.max(n,Math.min(r,t))}}function K(n,r,i){var t=n[0],f=n[1],l=r[0],a=r[1];return f<t?(t=p(f,t),l=i(a,l)):(t=p(t,f),l=i(l,a)),function(u){return l(t(u))}}function L(n,r,i){var t=Math.min(n.length,r.length)-1,f=new Array(t),l=new Array(t),a=-1;for(n[t]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<t;)f[a]=p(n[a],n[a+1]),l[a]=i(r[a],r[a+1]);return function(u){var o=$(n,u,1,t)-1;return l[o](f[o](u))}}function O(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function Q(){var n=N,r=N,i=b,t,f,l,a=m,u,o,e;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=J(n[0],n[s-1])),u=s>2?L:K,o=e=null,c}function c(s){return s==null||isNaN(s=+s)?l:(o||(o=u(n.map(t),r,i)))(t(a(s)))}return c.invert=function(s){return a(f((e||(e=u(r,n.map(t),y)))(s)))},c.domain=function(s){return arguments.length?(n=Array.from(s,H),h()):n.slice()},c.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},c.rangeRound=function(s){return r=Array.from(s),i=S,h()},c.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},c.interpolate=function(s){return arguments.length?(i=s,h()):i},c.unknown=function(s){return arguments.length?(l=s,c):l},function(s,w){return t=s,f=w,h()}}function T(){return Q()(m,m)}function U(n){return Math.max(0,-M(Math.abs(n)))}function V(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(M(r)/3)))*3-M(Math.abs(n)))}function W(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,M(r)-M(n))+1}function X(n,r,i,t){var f=E(n,r,i),l;switch(t=R(t??",f"),t.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return t.precision==null&&!isNaN(l=V(f,a))&&(t.precision=l),q(t,a)}case"":case"e":case"g":case"p":case"r":{t.precision==null&&!isNaN(l=W(f,Math.max(Math.abs(n),Math.abs(r))))&&(t.precision=l-(t.type==="e"));break}case"f":case"%":{t.precision==null&&!isNaN(l=U(f))&&(t.precision=l-(t.type==="%")*2);break}}return F(t)}function Y(n){var r=n.domain;return n.ticks=function(i){var t=r();return D(t[0],t[t.length-1],i??10)},n.tickFormat=function(i,t){var f=r();return X(f[0],f[f.length-1],i??10,t)},n.nice=function(i){i==null&&(i=10);var t=r(),f=0,l=t.length-1,a=t[f],u=t[l],o,e,h=10;for(u<a&&(e=a,a=u,u=e,e=f,f=l,l=e);h-- >0;){if(e=d(a,u,i),e===o)return t[f]=a,t[l]=u,r(t);if(e>0)a=Math.floor(a/e)*e,u=Math.ceil(u/e)*e;else if(e<0)a=Math.ceil(a*e)/e,u=Math.floor(u*e)/e;else break;o=e}return n},n}function Z(){var n=T();return n.copy=function(){return O(n,Z())},A.apply(n,arguments),Y(n)}export{g as a,$ as b,k as c,T as d,O as e,S as f,Y as g,H as h,m as i,en as j,E as k,Z as l,D as m,I as n,Q as o,X as t};
