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