import{a4 as rn,a5 as en}from"./index-BPCszWWQ.js";import{i as an}from"./init-Gi6I4Gst.js";function F(n,t){return n==null||t==null?NaN:nt?1:n>=t?0:NaN}function on(n,t){return n==null||t==null?NaN:tn?1:t>=n?0:NaN}function K(n){let t,e,r;n.length!==2?(t=F,e=(o,c)=>F(n(o),c),r=(o,c)=>n(o)-c):(t=n===F||n===on?n:un,e=n,r=n);function a(o,c,i=0,l=o.length){if(i>>1;e(o[h],c)<0?i=h+1:l=h}while(i>>1;e(o[h],c)<=0?i=h+1:l=h}while(ii&&r(o[h-1],c)>-r(o[h],c)?h-1:h}return{left:a,center:u,right:f}}function un(){return 0}function fn(n){return n===null?NaN:+n}const cn=K(F),hn=cn.right;K(fn).center;const mn=Math.sqrt(50),sn=Math.sqrt(10),ln=Math.sqrt(2);function E(n,t,e){const r=(t-n)/Math.max(0,e),a=Math.floor(Math.log10(r)),f=r/Math.pow(10,a),u=f>=mn?10:f>=sn?5:f>=ln?2:1;let o,c,i;return a<0?(i=Math.pow(10,-a)/u,o=Math.round(n*i),c=Math.round(t*i),o/it&&--c,i=-i):(i=Math.pow(10,a)*u,o=Math.round(n/i),c=Math.round(t/i),o*it&&--c),c0))return[];if(n===t)return[n];const r=t=a))return[];const o=f-a+1,c=new Array(o);if(r)if(u<0)for(let i=0;i=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function R(n,t){if((e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"))<0)return null;var e,r=n.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+n.slice(e+1)]}function S(n){return n=R(Math.abs(n)),n?n[1]:NaN}function pn(n,t){return function(e,r){for(var a=e.length,f=[],u=0,o=n[0],c=0;a>0&&o>0&&(c+o+1>r&&(o=Math.max(1,r-c)),f.push(e.substring(a-=o,a+o)),!((c+=o+1)>r));)o=n[u=(u+1)%n.length];return f.reverse().join(t)}}function wn(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var bn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function I(n){if(!(t=bn.exec(n)))throw new Error("invalid format: "+n);var t;return new C({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}I.prototype=C.prototype;function C(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}C.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Nn(n){n:for(var t=n.length,e=1,r=-1,a;e0&&(r=0);break}return r>0?n.slice(0,r)+n.slice(a+1):n}var Q;function kn(n,t){var e=R(n,t);if(!e)return n+"";var r=e[0],a=e[1],f=a-(Q=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,u=r.length;return f===u?r:f>u?r+new Array(f-u+1).join("0"):f>0?r.slice(0,f)+"."+r.slice(f):"0."+new Array(1-f).join("0")+R(n,Math.max(0,t+f-1))[0]}function O(n,t){var e=R(n,t);if(!e)return n+"";var r=e[0],a=e[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const U={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:yn,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>O(n*100,t),r:O,s:kn,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function Y(n){return n}var Z=Array.prototype.map,H=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function xn(n){var t=n.grouping===void 0||n.thousands===void 0?Y:pn(Z.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",r=n.currency===void 0?"":n.currency[1]+"",a=n.decimal===void 0?".":n.decimal+"",f=n.numerals===void 0?Y:wn(Z.call(n.numerals,String)),u=n.percent===void 0?"%":n.percent+"",o=n.minus===void 0?"−":n.minus+"",c=n.nan===void 0?"NaN":n.nan+"";function i(h){h=I(h);var s=h.fill,p=h.align,M=h.sign,A=h.symbol,N=h.zero,v=h.width,L=h.comma,w=h.precision,D=h.trim,d=h.type;d==="n"?(L=!0,d="g"):U[d]||(w===void 0&&(w=12),D=!0,d="g"),(N||s==="0"&&p==="=")&&(N=!0,s="0",p="=");var _=A==="$"?e:A==="#"&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",nn=A==="$"?r:/[%p]/.test(d)?u:"",G=U[d],tn=/[defgprs%]/.test(d);w=w===void 0?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function X(m){var b=_,g=nn,k,B,P;if(d==="c")g=G(m)+g,m="";else{m=+m;var z=m<0||1/m<0;if(m=isNaN(m)?c:G(Math.abs(m),w),D&&(m=Nn(m)),z&&+m==0&&M!=="+"&&(z=!1),b=(z?M==="("?M:o:M==="-"||M==="("?"":M)+b,g=(d==="s"?H[8+Q/3]:"")+g+(z&&M==="("?")":""),tn){for(k=-1,B=m.length;++kP||P>57){g=(P===46?a+m.slice(k+1):m.slice(k))+g,m=m.slice(0,k);break}}}L&&!N&&(m=t(m,1/0));var j=b.length+m.length+g.length,y=j>1)+b+m+g+y.slice(j);break;default:m=y+b+m+g;break}return f(m)}return X.toString=function(){return h+""},X}function l(h,s){var p=i((h=I(h),h.type="f",h)),M=Math.max(-8,Math.min(8,Math.floor(S(s)/3)))*3,A=Math.pow(10,-M),N=H[8+M/3];return function(v){return p(A*v)+N}}return{format:i,formatPrefix:l}}var $,V,W;Sn({thousands:",",grouping:[3],currency:["$",""]});function Sn(n){return $=xn(n),V=$.format,W=$.formatPrefix,$}function An(n){return Math.max(0,-S(Math.abs(n)))}function vn(n,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(S(t)/3)))*3-S(Math.abs(n)))}function Pn(n,t){return n=Math.abs(n),t=Math.abs(t)-n,Math.max(0,S(t)-S(n))+1}function zn(n){return function(){return n}}function jn(n){return+n}var J=[0,1];function x(n){return n}function q(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:zn(isNaN(t)?NaN:.5)}function $n(n,t){var e;return n>t&&(e=n,n=t,t=e),function(r){return Math.max(n,Math.min(t,r))}}function Fn(n,t,e){var r=n[0],a=n[1],f=t[0],u=t[1];return a2?En:Fn,c=i=null,h}function h(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(r),t,e)))(r(u(s)))}return h.invert=function(s){return u(a((i||(i=o(t,n.map(r),rn)))(s)))},h.domain=function(s){return arguments.length?(n=Array.from(s,jn),l()):n.slice()},h.range=function(s){return arguments.length?(t=Array.from(s),l()):t.slice()},h.rangeRound=function(s){return t=Array.from(s),e=Mn,l()},h.clamp=function(s){return arguments.length?(u=s?!0:x,l()):u!==x},h.interpolate=function(s){return arguments.length?(e=s,l()):e},h.unknown=function(s){return arguments.length?(f=s,h):f},function(s,p){return r=s,a=p,l()}}function Ln(){return In()(x,x)}function Tn(n,t,e,r){var a=gn(n,t,e),f;switch(r=I(r??",f"),r.type){case"s":{var u=Math.max(Math.abs(n),Math.abs(t));return r.precision==null&&!isNaN(f=vn(a,u))&&(r.precision=f),W(r,u)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(f=Pn(a,Math.max(Math.abs(n),Math.abs(t))))&&(r.precision=f-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(f=An(a))&&(r.precision=f-(r.type==="%")*2);break}}return V(r)}function qn(n){var t=n.domain;return n.ticks=function(e){var r=t();return dn(r[0],r[r.length-1],e??10)},n.tickFormat=function(e,r){var a=t();return Tn(a[0],a[a.length-1],e??10,r)},n.nice=function(e){e==null&&(e=10);var r=t(),a=0,f=r.length-1,u=r[a],o=r[f],c,i,l=10;for(o0;){if(i=T(u,o,e),i===c)return r[a]=u,r[f]=o,t(r);if(i>0)u=Math.floor(u/i)*i,o=Math.ceil(o/i)*i;else if(i<0)u=Math.ceil(u*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function Cn(){var n=Ln();return n.copy=function(){return Rn(n,Cn())},an.apply(n,arguments),qn(n)}export{Rn as a,K as b,Ln as c,Cn as l,gn as t};