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