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