function E(t){return function(){return t}}var o=Math.PI,y=2*o,u=1e-6,L=y-u;function w(t){this._+=t[0];for(let i=1,h=t.length;i<h;++i)this._+=arguments[i]+t[i]}function q(t){let i=Math.floor(t);if(!(i>=0))throw Error(`invalid digits: ${t}`);if(i>15)return w;let h=10**i;return function(s){this._+=s[0];for(let r=1,_=s.length;r<_;++r)this._+=Math.round(arguments[r]*h)/h+s[r]}}var M=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?w:q(t)}moveTo(t,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,i){this._append`L${this._x1=+t},${this._y1=+i}`}quadraticCurveTo(t,i,h,s){this._append`Q${+t},${+i},${this._x1=+h},${this._y1=+s}`}bezierCurveTo(t,i,h,s,r,_){this._append`C${+t},${+i},${+h},${+s},${this._x1=+r},${this._y1=+_}`}arcTo(t,i,h,s,r){if(t=+t,i=+i,h=+h,s=+s,r=+r,r<0)throw Error(`negative radius: ${r}`);let _=this._x1,l=this._y1,p=h-t,a=s-i,n=_-t,e=l-i,$=n*n+e*e;if(this._x1===null)this._append`M${this._x1=t},${this._y1=i}`;else if($>u)if(!(Math.abs(e*p-a*n)>u)||!r)this._append`L${this._x1=t},${this._y1=i}`;else{let d=h-_,f=s-l,c=p*p+a*a,A=d*d+f*f,g=Math.sqrt(c),v=Math.sqrt($),b=r*Math.tan((o-Math.acos((c+$-A)/(2*g*v)))/2),x=b/v,m=b/g;Math.abs(x-1)>u&&this._append`L${t+x*n},${i+x*e}`,this._append`A${r},${r},0,0,${+(e*d>n*f)},${this._x1=t+m*p},${this._y1=i+m*a}`}}arc(t,i,h,s,r,_){if(t=+t,i=+i,h=+h,_=!!_,h<0)throw Error(`negative radius: ${h}`);let l=h*Math.cos(s),p=h*Math.sin(s),a=t+l,n=i+p,e=1^_,$=_?s-r:r-s;this._x1===null?this._append`M${a},${n}`:(Math.abs(this._x1-a)>u||Math.abs(this._y1-n)>u)&&this._append`L${a},${n}`,h&&($<0&&($=$%y+y),$>L?this._append`A${h},${h},0,1,${e},${t-l},${i-p}A${h},${h},0,1,${e},${this._x1=a},${this._y1=n}`:$>u&&this._append`A${h},${h},0,${+($>=o)},${e},${this._x1=t+h*Math.cos(r)},${this._y1=i+h*Math.sin(r)}`)}rect(t,i,h,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}h${h=+h}v${+s}h${-h}Z`}toString(){return this._}};function T(){return new M}T.prototype=M.prototype;function C(t){let i=3;return t.digits=function(h){if(!arguments.length)return i;if(h==null)i=null;else{let s=Math.floor(h);if(!(s>=0))throw RangeError(`invalid digits: ${h}`);i=s}return t},()=>new M(i)}export{T as n,E as r,C as t};
