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