import{a as e,i as t,n,o as r,t as i}from"./continuous.B5CmSvrf.js";import{t as a}from"./init.BlxQvxT-.js";import{i as o,n as s,r as c,t as l}from"./defaultLocale.OMyv9moG.js";function u(e){return Math.max(0,-o(Math.abs(e)))}function d(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(o(t)/3)))*3-o(Math.abs(e)))}function f(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,o(t)-o(e))+1}function p(t,n,r,i){var a=e(t,n,r),o;switch(i=c(i??`,f`),i.type){case`s`:var p=Math.max(Math.abs(t),Math.abs(n));return i.precision==null&&!isNaN(o=d(a,p))&&(i.precision=o),s(i,p);case``:case`e`:case`g`:case`p`:case`r`:i.precision==null&&!isNaN(o=f(a,Math.max(Math.abs(t),Math.abs(n))))&&(i.precision=o-(i.type===`e`));break;case`f`:case`%`:i.precision==null&&!isNaN(o=u(a))&&(i.precision=o-(i.type===`%`)*2);break}return l(i)}function m(e){var n=e.domain;return e.ticks=function(e){var t=n();return r(t[0],t[t.length-1],e??10)},e.tickFormat=function(e,t){var r=n();return p(r[0],r[r.length-1],e??10,t)},e.nice=function(r){r??=10;var i=n(),a=0,o=i.length-1,s=i[a],c=i[o],l,u,d=10;for(c<s&&(u=s,s=c,c=u,u=a,a=o,o=u);d-- >0;){if(u=t(s,c,r),u===l)return i[a]=s,i[o]=c,n(i);if(u>0)s=Math.floor(s/u)*u,c=Math.ceil(c/u)*u;else if(u<0)s=Math.ceil(s*u)/u,c=Math.floor(c*u)/u;else break;l=u}return e},e}function h(){var e=i();return e.copy=function(){return n(e,h())},a.apply(e,arguments),m(e)}export{h as t};