import{P as A}from"./d3-path.js";function c(n){return function(){return n}}function T(n){let t=3;return n.digits=function(o){if(!arguments.length)return t;if(o==null)t=null;else{const f=Math.floor(o);if(!(f>=0))throw new RangeError(`invalid digits: ${o}`);t=f}return n},()=>new A(t)}function M(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function P(n){this._context=n}P.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(n,t){switch(n=+n,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(n,t):this._context.moveTo(n,t);break;case 1:this._point=2;default:this._context.lineTo(n,t);break}}};function X(n){return new P(n)}function j(n){return n[0]}function z(n){return n[1]}function L(n,t){var o=c(!0),f=null,h=X,l=null,a=T(i);n=typeof n=="function"?n:n===void 0?j:c(n),t=typeof t=="function"?t:t===void 0?z:c(t);function i(r){var u,p=(r=M(r)).length,e,s=!1,_;for(f==null&&(l=h(_=a())),u=0;u<=p;++u)!(u<p&&o(e=r[u],u,r))===s&&((s=!s)?l.lineStart():l.lineEnd()),s&&l.point(+n(e,u,r),+t(e,u,r));if(_)return l=null,_+""||null}return i.x=function(r){return arguments.length?(n=typeof r=="function"?r:c(+r),i):n},i.y=function(r){return arguments.length?(t=typeof r=="function"?r:c(+r),i):t},i.defined=function(r){return arguments.length?(o=typeof r=="function"?r:c(!!r),i):o},i.curve=function(r){return arguments.length?(h=r,f!=null&&(l=h(f)),i):h},i.context=function(r){return arguments.length?(r==null?f=l=null:l=h(f=r),i):f},i}function C(n,t,o){var f=null,h=c(!0),l=null,a=X,i=null,r=T(u);n=typeof n=="function"?n:n===void 0?j:c(+n),t=typeof t=="function"?t:c(t===void 0?0:+t),o=typeof o=="function"?o:o===void 0?z:c(+o);function u(e){var s,_,g,m=(e=M(e)).length,d,v=!1,x,w=new Array(m),y=new Array(m);for(l==null&&(i=a(x=r())),s=0;s<=m;++s){if(!(s<m&&h(d=e[s],s,e))===v)if(v=!v)_=s,i.areaStart(),i.lineStart();else{for(i.lineEnd(),i.lineStart(),g=s-1;g>=_;--g)i.point(w[g],y[g]);i.lineEnd(),i.areaEnd()}v&&(w[s]=+n(d,s,e),y[s]=+t(d,s,e),i.point(f?+f(d,s,e):w[s],o?+o(d,s,e):y[s]))}if(x)return i=null,x+""||null}function p(){return L().defined(h).curve(a).context(l)}return u.x=function(e){return arguments.length?(n=typeof e=="function"?e:c(+e),f=null,u):n},u.x0=function(e){return arguments.length?(n=typeof e=="function"?e:c(+e),u):n},u.x1=function(e){return arguments.length?(f=e==null?null:typeof e=="function"?e:c(+e),u):f},u.y=function(e){return arguments.length?(t=typeof e=="function"?e:c(+e),o=null,u):t},u.y0=function(e){return arguments.length?(t=typeof e=="function"?e:c(+e),u):t},u.y1=function(e){return arguments.length?(o=e==null?null:typeof e=="function"?e:c(+e),u):o},u.lineX0=u.lineY0=function(){return p().x(n).y(t)},u.lineY1=function(){return p().x(n).y(o)},u.lineX1=function(){return p().x(f).y(t)},u.defined=function(e){return arguments.length?(h=typeof e=="function"?e:c(!!e),u):h},u.curve=function(e){return arguments.length?(a=e,l!=null&&(i=a(l)),u):a},u.context=function(e){return arguments.length?(e==null?l=i=null:i=a(l=e),u):l},u}function E(n){return n<0?-1:1}function N(n,t,o){var f=n._x1-n._x0,h=t-n._x1,l=(n._y1-n._y0)/(f||h<0&&-0),a=(o-n._y1)/(h||f<0&&-0),i=(l*h+a*f)/(f+h);return(E(l)+E(a))*Math.min(Math.abs(l),Math.abs(a),.5*Math.abs(i))||0}function S(n,t){var o=n._x1-n._x0;return o?(3*(n._y1-n._y0)/o-t)/2:t}function k(n,t,o){var f=n._x0,h=n._y0,l=n._x1,a=n._y1,i=(l-f)/3;n._context.bezierCurveTo(f+i,h+i*t,l-i,a-i*o,l,a)}function b(n){this._context=n}b.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:k(this,this._t0,S(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(n,t){var o=NaN;if(n=+n,t=+t,!(n===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(n,t):this._context.moveTo(n,t);break;case 1:this._point=2;break;case 2:this._point=3,k(this,S(this,o=N(this,n,t)),o);break;default:k(this,this._t0,o=N(this,n,t));break}this._x0=this._x1,this._x1=n,this._y0=this._y1,this._y1=t,this._t0=o}}};Object.create(b.prototype).point=function(n,t){b.prototype.point.call(this,t,n)};function O(n){return new b(n)}export{C as a,L as l,O as m};
