(()=>{var n={490:t=>{!function n(e,i,r){var s=function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,n){if(!(this instanceof o))return new o(t,n);s(t)?(n=t[1],t=t[0]):"object"==typeof t&&t&&(n=t.y,t=t.x),this.x=o.clean(t||0),this.y=o.clean(n||0)}o.prototype={change:function(t){if("function"==typeof t)this.observers?this.observers.push(t):this.observers=[t];else if(this.observers&&this.observers.length)for(var n=this.observers.length-1;n>=0;n--)this.observers[n](this,t);return this},ignore:function(t){if(this.observers)if(t)for(var n=this.observers,e=n.length;e--;)n[e]===t&&n.splice(e,1);else this.observers=[];return this},set:function(t,n,e){if("number"!=typeof t&&(e=n,n=t.y,t=t.x),this.x===t&&this.y===n)return this;var i=null;return!1!==e&&this.observers&&this.observers.length&&(i=this.clone()),this.x=o.clean(t),this.y=o.clean(n),!1!==e?this.change(i):void 0},zero:function(){return this.set(0,0)},clone:function(){return new this.constructor(this.x,this.y)},negate:function(t){return t?new this.constructor(-this.x,-this.y):this.set(-this.x,-this.y)},add:function(t,n,e){return"number"!=typeof t&&(e=n,s(t)?(n=t[1],t=t[0]):(n=t.y,t=t.x)),t+=this.x,n+=this.y,e?new this.constructor(t,n):this.set(t,n)},subtract:function(t,n,e){return"number"!=typeof t&&(e=n,s(t)?(n=t[1],t=t[0]):(n=t.y,t=t.x)),t=this.x-t,n=this.y-n,e?new this.constructor(t,n):this.set(t,n)},multiply:function(t,n,e){return"number"!=typeof t?(e=n,s(t)?(n=t[1],t=t[0]):(n=t.y,t=t.x)):"number"!=typeof n&&(e=n,n=t),t*=this.x,n*=this.y,e?new this.constructor(t,n):this.set(t,n)},rotate:function(t,n,e){var i,r,s=this.x,o=this.y,c=Math.cos(t),u=Math.sin(t);return i=c*s-(n=n?-1:1)*u*o,r=n*u*s+c*o,e?new this.constructor(i,r):this.set(i,r)},length:function(){var t=this.x,n=this.y;return Math.sqrt(t*t+n*n)},lengthSquared:function(){var t=this.x,n=this.y;return t*t+n*n},distance:function(t){var n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)},nearest:function(t){for(var n,e=Number.MAX_VALUE,i=null,r=t.length-1;r>=0;r--)(n=this.distance(t[r]))<=e&&(e=n,i=t[r]);return i},normalize:function(t){var n=this.length(),e=n<Number.MIN_VALUE?0:1/n;return t?new this.constructor(this.x*e,this.y*e):this.set(this.x*e,this.y*e)},equal:function(t,n){return"number"!=typeof t&&(s(t)?(n=t[1],t=t[0]):(n=t.y,t=t.x)),o.clean(t)===this.x&&o.clean(n)===this.y},abs:function(t){var n=Math.abs(this.x),e=Math.abs(this.y);return t?new this.constructor(n,e):this.set(n,e)},min:function(t,n){var e=this.x,i=this.y,r=t.x,s=t.y,o=e<r?e:r,c=i<s?i:s;return n?new this.constructor(o,c):this.set(o,c)},max:function(t,n){var e=this.x,i=this.y,r=t.x,s=t.y,o=e>r?e:r,c=i>s?i:s;return n?new this.constructor(o,c):this.set(o,c)},clamp:function(t,n,e){var i=this.min(n,!0).max(t);return e?i:this.set(i.x,i.y)},lerp:function(t,n,e){return this.add(t.subtract(this,!0).multiply(n),e)},skew:function(t){return t?new this.constructor(-this.y,this.x):this.set(-this.y,this.x)},dot:function(t){return o.clean(this.x*t.x+t.y*this.y)},perpDot:function(t){return o.clean(this.x*t.y-this.y*t.x)},angleTo:function(t){return Math.atan2(this.perpDot(t),this.dot(t))},divide:function(t,n,e){if("number"!=typeof t?(e=n,s(t)?(n=t[1],t=t[0]):(n=t.y,t=t.x)):"number"!=typeof n&&(e=n,n=t),0===t||0===n)throw new Error("division by zero");if(isNaN(t)||isNaN(n))throw new Error("NaN detected");return e?new this.constructor(this.x/t,this.y/n):this.set(this.x/t,this.y/n)},isPointOnLine:function(t,n){return(t.y-this.y)*(t.x-n.x)==(t.y-n.y)*(t.x-this.x)},toArray:function(){return[this.x,this.y]},fromArray:function(t){return this.set(t[0],t[1])},toJSON:function(){return{x:this.x,y:this.y}},toString:function(){return"("+this.x+", "+this.y+")"},constructor:o},o.fromArray=function(t,n){return new(n||o)(t[0],t[1])},o.precision=i||8;var c=Math.pow(10,o.precision);return o.clean=e||function(t){if(isNaN(t))throw new Error("NaN detected");if(!isFinite(t))throw new Error("Infinity detected");return Math.round(t)===t?t:Math.round(t*c)/c},o.inject=n,e||(o.fast=n((function(t){return t})),"object"==typeof t.exports?t.exports=o:window.Vec2=window.Vec2||o),o}()}},e={};function i(t){var r=e[t];if(void 0!==r)return r.exports;var s=e[t]={exports:{}};return n[t](s,s.exports,i),s.exports}i.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return i.d(n,{a:n}),n},i.d=(t,n)=>{for(var e in n)i.o(n,e)&&!i.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},i.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),(()=>{"use strict";let n,e,r=!1;function s(t=0,i=1){return t+(i-t)*(r=!r,r?n():e())}function o(t,n){return Math.floor(s(t,n+1))}function c(t=.5){return s()<t}const u=(t=0,n=1)=>{const e=1-s(),i=s();return t+Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*i)*n};var h=i(490),a=i.n(h);const l="http://www.w3.org/2000/svg";function x(t){const n=document.createElementNS(l,"g");return t.appendChild(n),n}function f(t,n){for(let e in n)n.hasOwnProperty(e)&&t.setAttribute(e,n[e])}function y(t,n,e){const i=document.createElementNS(l,"path");return f(i,{d:n}),f(i,e),t.appendChild(i),i}function p(t,n){const e=document.createElementNS(l,"animate");f(e,n),t.appendChild(e)}const{abs:d,cos:m,sin:g,acos:b,atan2:v,sqrt:z,pow:w}=Math;function _(t){return t<0?-w(-t,1/3):w(t,1/3)}const k=Math.PI,E=2*k,M=k/2,S=Number.MAX_SAFE_INTEGER||9007199254740991,N=Number.MIN_SAFE_INTEGER||-9007199254740991,A={x:0,y:0,z:0},I={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(t,n){const e=n(t);let i=e.x*e.x+e.y*e.y;return void 0!==e.z&&(i+=e.z*e.z),z(i)},compute:function(t,n,e){if(0===t)return n[0].t=0,n[0];const i=n.length-1;if(1===t)return n[i].t=1,n[i];const r=1-t;let s=n;if(0===i)return n[0].t=t,n[0];if(1===i){const n={x:r*s[0].x+t*s[1].x,y:r*s[0].y+t*s[1].y,t};return e&&(n.z=r*s[0].z+t*s[1].z),n}if(i<4){let n,o,c,u=r*r,h=t*t,a=0;2===i?(s=[s[0],s[1],s[2],A],n=u,o=r*t*2,c=h):3===i&&(n=u*r,o=u*t*3,c=r*h*3,a=t*h);const l={x:n*s[0].x+o*s[1].x+c*s[2].x+a*s[3].x,y:n*s[0].y+o*s[1].y+c*s[2].y+a*s[3].y,t};return e&&(l.z=n*s[0].z+o*s[1].z+c*s[2].z+a*s[3].z),l}const o=JSON.parse(JSON.stringify(n));for(;o.length>1;){for(let n=0;n<o.length-1;n++)o[n]={x:o[n].x+(o[n+1].x-o[n].x)*t,y:o[n].y+(o[n+1].y-o[n].y)*t},void 0!==o[n].z&&(o[n]=o[n].z+(o[n+1].z-o[n].z)*t);o.splice(o.length-1,1)}return o[0].t=t,o[0]},computeWithRatios:function(t,n,e,i){const r=1-t,s=e,o=n;let c,u=s[0],h=s[1],a=s[2],l=s[3];return u*=r,h*=t,2===o.length?(c=u+h,{x:(u*o[0].x+h*o[1].x)/c,y:(u*o[0].y+h*o[1].y)/c,z:!!i&&(u*o[0].z+h*o[1].z)/c,t}):(u*=r,h*=2*r,a*=t*t,3===o.length?(c=u+h+a,{x:(u*o[0].x+h*o[1].x+a*o[2].x)/c,y:(u*o[0].y+h*o[1].y+a*o[2].y)/c,z:!!i&&(u*o[0].z+h*o[1].z+a*o[2].z)/c,t}):(u*=r,h*=1.5*r,a*=3*r,l*=t*t*t,4===o.length?(c=u+h+a+l,{x:(u*o[0].x+h*o[1].x+a*o[2].x+l*o[3].x)/c,y:(u*o[0].y+h*o[1].y+a*o[2].y+l*o[3].y)/c,z:!!i&&(u*o[0].z+h*o[1].z+a*o[2].z+l*o[3].z)/c,t}):void 0))},derive:function(t,n){const e=[];for(let i=t,r=i.length,s=r-1;r>1;r--,s--){const t=[];for(let e,r=0;r<s;r++)e={x:s*(i[r+1].x-i[r].x),y:s*(i[r+1].y-i[r].y)},n&&(e.z=s*(i[r+1].z-i[r].z)),t.push(e);e.push(t),i=t}return e},between:function(t,n,e){return n<=t&&t<=e||I.approximately(t,n)||I.approximately(t,e)},approximately:function(t,n,e){return d(t-n)<=(e||1e-6)},length:function(t){const n=I.Tvalues.length;let e=0;for(let i,r=0;r<n;r++)i=.5*I.Tvalues[r]+.5,e+=I.Cvalues[r]*I.arcfn(i,t);return.5*e},map:function(t,n,e,i,r){return i+(t-n)/(e-n)*(r-i)},lerp:function(t,n,e){const i={x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)};return void 0!==n.z&&void 0!==e.z&&(i.z=n.z+t*(e.z-n.z)),i},pointToString:function(t){let n=t.x+"/"+t.y;return void 0!==t.z&&(n+="/"+t.z),n},pointsToString:function(t){return"["+t.map(I.pointToString).join(", ")+"]"},copy:function(t){return JSON.parse(JSON.stringify(t))},angle:function(t,n,e){const i=n.x-t.x,r=n.y-t.y,s=e.x-t.x,o=e.y-t.y;return v(i*o-r*s,i*s+r*o)},round:function(t,n){const e=""+t,i=e.indexOf(".");return parseFloat(e.substring(0,i+1+n))},dist:function(t,n){const e=t.x-n.x,i=t.y-n.y;return z(e*e+i*i)},closest:function(t,n){let e,i,r=w(2,63);return t.forEach((function(t,s){i=I.dist(n,t),i<r&&(r=i,e=s)})),{mdist:r,mpos:e}},abcratio:function(t,n){if(2!==n&&3!==n)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const e=w(t,n)+w(1-t,n);return d((e-1)/e)},projectionratio:function(t,n){if(2!==n&&3!==n)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const e=w(1-t,n);return e/(w(t,n)+e)},lli8:function(t,n,e,i,r,s,o,c){const u=(t-e)*(s-c)-(n-i)*(r-o);return 0!=u&&{x:((t*i-n*e)*(r-o)-(t-e)*(r*c-s*o))/u,y:((t*i-n*e)*(s-c)-(n-i)*(r*c-s*o))/u}},lli4:function(t,n,e,i){const r=t.x,s=t.y,o=n.x,c=n.y,u=e.x,h=e.y,a=i.x,l=i.y;return I.lli8(r,s,o,c,u,h,a,l)},lli:function(t,n){return I.lli4(t,t.c,n,n.c)},makeline:function(t,n){return new q(t.x,t.y,(t.x+n.x)/2,(t.y+n.y)/2,n.x,n.y)},findbbox:function(t){let n=S,e=S,i=N,r=N;return t.forEach((function(t){const s=t.bbox();n>s.x.min&&(n=s.x.min),e>s.y.min&&(e=s.y.min),i<s.x.max&&(i=s.x.max),r<s.y.max&&(r=s.y.max)})),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:e,mid:(e+r)/2,max:r,size:r-e}}},shapeintersections:function(t,n,e,i,r){if(!I.bboxoverlap(n,i))return[];const s=[],o=[t.startcap,t.forward,t.back,t.endcap],c=[e.startcap,e.forward,e.back,e.endcap];return o.forEach((function(n){n.virtual||c.forEach((function(i){if(i.virtual)return;const o=n.intersects(i,r);o.length>0&&(o.c1=n,o.c2=i,o.s1=t,o.s2=e,s.push(o))}))})),s},makeshape:function(t,n,e){const i=n.points.length,r=t.points.length,s=I.makeline(n.points[i-1],t.points[0]),o=I.makeline(t.points[r-1],n.points[0]),c={startcap:s,forward:t,back:n,endcap:o,bbox:I.findbbox([s,t,n,o]),intersections:function(t){return I.shapeintersections(c,c.bbox,t,t.bbox,e)}};return c},getminmax:function(t,n,e){if(!e)return{min:0,max:0};let i,r,s=S,o=N;-1===e.indexOf(0)&&(e=[0].concat(e)),-1===e.indexOf(1)&&e.push(1);for(let c=0,u=e.length;c<u;c++)i=e[c],r=t.get(i),r[n]<s&&(s=r[n]),r[n]>o&&(o=r[n]);return{min:s,mid:(s+o)/2,max:o,size:o-s}},align:function(t,n){const e=n.p1.x,i=n.p1.y,r=-v(n.p2.y-i,n.p2.x-e);return t.map((function(t){return{x:(t.x-e)*m(r)-(t.y-i)*g(r),y:(t.x-e)*g(r)+(t.y-i)*m(r)}}))},roots:function(t,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const e=t.length-1,i=I.align(t,n),r=function(t){return 0<=t&&t<=1};if(2===e){const t=i[0].y,n=i[1].y,e=i[2].y,s=t-2*n+e;if(0!==s){const i=-z(n*n-t*e),o=-t+n;return[-(i+o)/s,-(-i+o)/s].filter(r)}return n!==e&&0===s?[(2*n-e)/(2*n-2*e)].filter(r):[]}const s=i[0].y,o=i[1].y,c=i[2].y;let u=3*o-s-3*c+i[3].y,h=3*s-6*o+3*c,a=-3*s+3*o,l=s;if(I.approximately(u,0)){if(I.approximately(h,0))return I.approximately(a,0)?[]:[-l/a].filter(r);const t=z(a*a-4*h*l),n=2*h;return[(t-a)/n,(-a-t)/n].filter(r)}h/=u,a/=u,l/=u;const x=(3*a-h*h)/3,f=x/3,y=(2*h*h*h-9*h*a+27*l)/27,p=y/2,d=p*p+f*f*f;let g,v,w,k,M;if(d<0){const t=-x/3,n=z(t*t*t),e=-y/(2*n),i=b(e<-1?-1:e>1?1:e),s=2*_(n);return w=s*m(i/3)-h/3,k=s*m((i+E)/3)-h/3,M=s*m((i+2*E)/3)-h/3,[w,k,M].filter(r)}if(0===d)return g=p<0?_(-p):-_(p),w=2*g-h/3,k=-g-h/3,[w,k].filter(r);{const t=z(d);return g=_(-p+t),v=_(p+t),[g-v-h/3].filter(r)}},droots:function(t){if(3===t.length){const n=t[0],e=t[1],i=t[2],r=n-2*e+i;if(0!==r){const t=-z(e*e-n*i),s=-n+e;return[-(t+s)/r,-(-t+s)/r]}return e!==i&&0===r?[(2*e-i)/(2*(e-i))]:[]}if(2===t.length){const n=t[0],e=t[1];return n!==e?[n/(n-e)]:[]}return[]},curvature:function(t,n,e,i,r){let s,o,c,u,h=0,a=0;const l=I.compute(t,n),x=I.compute(t,e),f=l.x*l.x+l.y*l.y;if(i?(s=z(w(l.y*x.z-x.y*l.z,2)+w(l.z*x.x-x.z*l.x,2)+w(l.x*x.y-x.x*l.y,2)),o=w(f+l.z*l.z,1.5)):(s=l.x*x.y-l.y*x.x,o=w(f,1.5)),0===s||0===o)return{k:0,r:0};if(h=s/o,a=o/s,!r){const r=I.curvature(t-.001,n,e,i,!0).k,s=I.curvature(t+.001,n,e,i,!0).k;u=(s-h+(h-r))/2,c=(d(s-h)+d(h-r))/2}return{k:h,r:a,dk:u,adk:c}},inflections:function(t){if(t.length<4)return[];const n=I.align(t,{p1:t[0],p2:t.slice(-1)[0]}),e=n[2].x*n[1].y,i=n[3].x*n[1].y,r=n[1].x*n[2].y,s=18*(-3*e+2*i+3*r-n[3].x*n[2].y),o=18*(3*e-i-3*r),c=18*(r-e);if(I.approximately(s,0)){if(!I.approximately(o,0)){let t=-c/o;if(0<=t&&t<=1)return[t]}return[]}const u=2*s;if(I.approximately(u,0))return[];const h=o*o-4*s*c;if(h<0)return[];const a=Math.sqrt(h);return[(a-o)/u,-(o+a)/u].filter((function(t){return 0<=t&&t<=1}))},bboxoverlap:function(t,n){const e=["x","y"],i=e.length;for(let r,s,o,c,u=0;u<i;u++)if(r=e[u],s=t[r].mid,o=n[r].mid,c=(t[r].size+n[r].size)/2,d(s-o)>=c)return!1;return!0},expandbox:function(t,n){n.x.min<t.x.min&&(t.x.min=n.x.min),n.y.min<t.y.min&&(t.y.min=n.y.min),n.z&&n.z.min<t.z.min&&(t.z.min=n.z.min),n.x.max>t.x.max&&(t.x.max=n.x.max),n.y.max>t.y.max&&(t.y.max=n.y.max),n.z&&n.z.max>t.z.max&&(t.z.max=n.z.max),t.x.mid=(t.x.min+t.x.max)/2,t.y.mid=(t.y.min+t.y.max)/2,t.z&&(t.z.mid=(t.z.min+t.z.max)/2),t.x.size=t.x.max-t.x.min,t.y.size=t.y.max-t.y.min,t.z&&(t.z.size=t.z.max-t.z.min)},pairiteration:function(t,n,e){const i=t.bbox(),r=n.bbox(),s=1e5,o=e||.5;if(i.x.size+i.y.size<o&&r.x.size+r.y.size<o)return[(s*(t._t1+t._t2)/2|0)/s+"/"+(s*(n._t1+n._t2)/2|0)/s];let c=t.split(.5),u=n.split(.5),h=[{left:c.left,right:u.left},{left:c.left,right:u.right},{left:c.right,right:u.right},{left:c.right,right:u.left}];h=h.filter((function(t){return I.bboxoverlap(t.left.bbox(),t.right.bbox())}));let a=[];return 0===h.length||(h.forEach((function(t){a=a.concat(I.pairiteration(t.left,t.right,o))})),a=a.filter((function(t,n){return a.indexOf(t)===n}))),a},getccenter:function(t,n,e){const i=n.x-t.x,r=n.y-t.y,s=e.x-n.x,o=e.y-n.y,c=i*m(M)-r*g(M),u=i*g(M)+r*m(M),h=s*m(M)-o*g(M),a=s*g(M)+o*m(M),l=(t.x+n.x)/2,x=(t.y+n.y)/2,f=(n.x+e.x)/2,y=(n.y+e.y)/2,p=l+c,d=x+u,b=f+h,z=y+a,w=I.lli8(l,x,p,d,f,y,b,z),_=I.dist(w,t);let k,S=v(t.y-w.y,t.x-w.x),N=v(n.y-w.y,n.x-w.x),A=v(e.y-w.y,e.x-w.x);return S<A?((S>N||N>A)&&(S+=E),S>A&&(k=A,A=S,S=k)):A<N&&N<S?(k=A,A=S,S=k):A+=E,w.s=S,w.e=A,w.r=_,w},numberSort:function(t,n){return t-n}};class O{constructor(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(t){return I.pointsToString(t.points)})).join(", ")+"]"}addCurve(t){this.curves.push(t),this._3d=this._3d||t._3d}length(){return this.curves.map((function(t){return t.length()})).reduce((function(t,n){return t+n}))}curve(t){return this.curves[t]}bbox(){const t=this.curves;for(var n=t[0].bbox(),e=1;e<t.length;e++)I.expandbox(n,t[e].bbox());return n}offset(t){const n=[];return this.curves.forEach((function(e){n.push(...e.offset(t))})),new O(n)}}const{abs:C,min:j,max:T,cos:$,sin:B,acos:D,sqrt:P}=Math,F=Math.PI;class q{constructor(t){let n=t&&t.forEach?t:Array.from(arguments).slice(),e=!1;if("object"==typeof n[0]){e=n.length;const t=[];n.forEach((function(n){["x","y","z"].forEach((function(e){void 0!==n[e]&&t.push(n[e])}))})),n=t}let i=!1;const r=n.length;if(e){if(e>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(6!==r&&8!==r&&9!==r&&12!==r&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const s=this._3d=!i&&(9===r||12===r)||t&&t[0]&&void 0!==t[0].z,o=this.points=[];for(let t=0,e=s?3:2;t<r;t+=e){var c={x:n[t],y:n[t+1]};s&&(c.z=n[t+2]),o.push(c)}const u=this.order=o.length-1,h=this.dims=["x","y"];s&&h.push("z"),this.dimlen=h.length;const a=I.align(o,{p1:o[0],p2:o[u]}),l=I.dist(o[0],o[u]);this._linear=a.reduce(((t,n)=>t+C(n.y)),0)<l/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(t,n,e,i){if(void 0===i&&(i=.5),0===i)return new q(n,n,e);if(1===i)return new q(t,n,n);const r=q.getABC(2,t,n,e,i);return new q(t,r.A,e)}static cubicFromPoints(t,n,e,i,r){void 0===i&&(i=.5);const s=q.getABC(3,t,n,e,i);void 0===r&&(r=I.dist(n,s.C));const o=r*(1-i)/i,c=I.dist(t,e),u=(e.x-t.x)/c,h=(e.y-t.y)/c,a=r*u,l=r*h,x=o*u,f=o*h,y=n.x-a,p=n.y-l,d=n.x+x,m=n.y+f,g=s.A,b=g.x+(y-g.x)/(1-i),v=g.y+(p-g.y)/(1-i),z=g.x+(d-g.x)/i,w=g.y+(m-g.y)/i,_={x:t.x+(b-t.x)/i,y:t.y+(v-t.y)/i},k={x:e.x+(z-e.x)/(1-i),y:e.y+(w-e.y)/(1-i)};return new q(t,_,k,e)}static getUtils(){return I}getUtils(){return q.getUtils()}static get PolyBezier(){return O}valueOf(){return this.toString()}toString(){return I.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const t=this.points,n=["M",t[0].x,t[0].y,2===this.order?"Q":"C"];for(let e=1,i=t.length;e<i;e++)n.push(t[e].x),n.push(t[e].y);return n.join(" ")}setRatios(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]}verify(){const t=this.coordDigest();t!==this._print&&(this._print=t,this.update())}coordDigest(){return this.points.map((function(t,n){return""+n+t.x+t.y+(t.z?t.z:0)})).join("")}update(){this._lut=[],this.dpoints=I.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,n=I.angle(t[0],t[this.order],t[1]);this.clockwise=n>0}length(){return I.length(this.derivative.bind(this))}static getABC(t=2,n,e,i,r=.5){const s=I.projectionratio(r,t),o=1-s,c={x:s*n.x+o*i.x,y:s*n.y+o*i.y},u=I.abcratio(r,t);return{A:{x:e.x+(e.x-c.x)/u,y:e.y+(e.y-c.y)/u},B:e,C:c,S:n,E:i}}getABC(t,n){n=n||this.get(t);let e=this.points[0],i=this.points[this.order];return q.getABC(this.order,e,n,i,t)}getLUT(t){if(this.verify(),t=t||100,this._lut.length===t)return this._lut;this._lut=[],t++,this._lut=[];for(let n,e,i=0;i<t;i++)e=i/(t-1),n=this.compute(e),n.t=e,this._lut.push(n);return this._lut}on(n,e){e=e||5;const i=this.getLUT(),r=[];for(let t,s=0,o=0;s<i.length;s++)t=i[s],I.dist(t,n)<e&&(r.push(t),o+=s/i.length);return!!r.length&&(t/=r.length)}project(t){const n=this.getLUT(),e=n.length-1,i=I.closest(n,t),r=i.mpos,s=(r-1)/e,o=(r+1)/e,c=.1/e;let u,h,a=i.mdist,l=s,x=l;for(a+=1;l<o+c;l+=c)u=this.compute(l),h=I.dist(t,u),h<a&&(a=h,x=l);return x=x<0?0:x>1?1:x,u=this.compute(x),u.t=x,u.d=a,u}get(t){return this.compute(t)}point(t){return this.points[t]}compute(t){return this.ratios?I.computeWithRatios(t,this.points,this.ratios,this._3d):I.compute(t,this.points,this._3d,this.ratios)}raise(){const t=this.points,n=[t[0]],e=t.length;for(let i,r,s=1;s<e;s++)i=t[s],r=t[s-1],n[s]={x:(e-s)/e*i.x+s/e*r.x,y:(e-s)/e*i.y+s/e*r.y};return n[e]=t[e-1],new q(n)}derivative(t){return I.compute(t,this.dpoints[0],this._3d)}dderivative(t){return I.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new q(I.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return I.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return I.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const n=this.derivative(t),e=P(n.x*n.x+n.y*n.y);return{t,x:-n.y/e,y:n.x/e}}__normal3(t){const n=this.derivative(t),e=this.derivative(t+.01),i=P(n.x*n.x+n.y*n.y+n.z*n.z),r=P(e.x*e.x+e.y*e.y+e.z*e.z);n.x/=i,n.y/=i,n.z/=i,e.x/=r,e.y/=r,e.z/=r;const s={x:e.y*n.z-e.z*n.y,y:e.z*n.x-e.x*n.z,z:e.x*n.y-e.y*n.x},o=P(s.x*s.x+s.y*s.y+s.z*s.z);s.x/=o,s.y/=o,s.z/=o;const c=[s.x*s.x,s.x*s.y-s.z,s.x*s.z+s.y,s.x*s.y+s.z,s.y*s.y,s.y*s.z-s.x,s.x*s.z-s.y,s.y*s.z+s.x,s.z*s.z];return{t,x:c[0]*n.x+c[1]*n.y+c[2]*n.z,y:c[3]*n.x+c[4]*n.y+c[5]*n.z,z:c[6]*n.x+c[7]*n.y+c[8]*n.z}}hull(t){let n=this.points,e=[],i=[],r=0;for(i[r++]=n[0],i[r++]=n[1],i[r++]=n[2],3===this.order&&(i[r++]=n[3]);n.length>1;){e=[];for(let s,o=0,c=n.length-1;o<c;o++)s=I.lerp(t,n[o],n[o+1]),i[r++]=s,e.push(s);n=e}return i}split(t,n){if(0===t&&n)return this.split(n).left;if(1===n)return this.split(t).right;const e=this.hull(t),i={left:2===this.order?new q([e[0],e[3],e[5]]):new q([e[0],e[4],e[7],e[9]]),right:2===this.order?new q([e[5],e[4],e[2]]):new q([e[9],e[8],e[6],e[3]]),span:e};return i.left._t1=I.map(0,0,1,this._t1,this._t2),i.left._t2=I.map(t,0,1,this._t1,this._t2),i.right._t1=I.map(t,0,1,this._t1,this._t2),i.right._t2=I.map(1,0,1,this._t1,this._t2),n?(n=I.map(n,t,1,0,1),i.right.split(n).left):i}extrema(){const t={};let n=[];return this.dims.forEach(function(e){let i=function(t){return t[e]},r=this.dpoints[0].map(i);t[e]=I.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[e]=t[e].concat(I.droots(r))),t[e]=t[e].filter((function(t){return t>=0&&t<=1})),n=n.concat(t[e].sort(I.numberSort))}.bind(this)),t.values=n.sort(I.numberSort).filter((function(t,e){return n.indexOf(t)===e})),t}bbox(){const t=this.extrema(),n={};return this.dims.forEach(function(e){n[e]=I.getminmax(this,e,t[e])}.bind(this)),n}overlaps(t){const n=this.bbox(),e=t.bbox();return I.bboxoverlap(n,e)}offset(t,n){if(void 0!==n){const e=this.get(t),i=this.normal(t),r={c:e,n:i,x:e.x+i.x*n,y:e.y+i.y*n};return this._3d&&(r.z=e.z+i.z*n),r}if(this._linear){const n=this.normal(0),e=this.points.map((function(e){const i={x:e.x+t*n.x,y:e.y+t*n.y};return e.z&&n.z&&(i.z=e.z+t*n.z),i}));return[new q(e)]}return this.reduce().map((function(n){return n._linear?n.offset(t)[0]:n.scale(t)}))}simple(){if(3===this.order){const t=I.angle(this.points[0],this.points[3],this.points[1]),n=I.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&n<0||t<0&&n>0)return!1}const t=this.normal(0),n=this.normal(1);let e=t.x*n.x+t.y*n.y;return this._3d&&(e+=t.z*n.z),C(D(e))<F/3}reduce(){let t,n,e=0,i=0,r=.01,s=[],o=[],c=this.extrema().values;for(-1===c.indexOf(0)&&(c=[0].concat(c)),-1===c.indexOf(1)&&c.push(1),e=c[0],t=1;t<c.length;t++)i=c[t],n=this.split(e,i),n._t1=e,n._t2=i,s.push(n),e=i;return s.forEach((function(t){for(e=0,i=0;i<=1;)for(i=e+r;i<=1.01;i+=r)if(n=t.split(e,i),!n.simple()){if(i-=r,C(e-i)<r)return[];n=t.split(e,i),n._t1=I.map(e,0,1,t._t1,t._t2),n._t2=I.map(i,0,1,t._t1,t._t2),o.push(n),e=i;break}e<1&&(n=t.split(e,1),n._t1=I.map(e,0,1,t._t1,t._t2),n._t2=t._t2,o.push(n))})),o}translate(t,n,e){e="number"==typeof e?e:n;const i=this.order;let r=this.points.map(((t,r)=>(1-r/i)*n+r/i*e));return new q(this.points.map(((n,e)=>({x:n.x+t.x*r[e],y:n.y+t.y*r[e]}))))}scale(t){const n=this.order;let e=!1;if("function"==typeof t&&(e=t),e&&2===n)return this.raise().scale(e);const i=this.clockwise,r=this.points;if(this._linear)return this.translate(this.normal(0),e?e(0):t,e?e(1):t);const s=e?e(0):t,o=e?e(1):t,c=[this.offset(0,10),this.offset(1,10)],u=[],h=I.lli4(c[0],c[0].c,c[1],c[1].c);if(!h)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach((function(t){const e=u[t*n]=I.copy(r[t*n]);e.x+=(t?o:s)*c[t].n.x,e.y+=(t?o:s)*c[t].n.y})),e?([0,1].forEach((function(s){if(2!==n||!s){var o=r[s+1],c={x:o.x-h.x,y:o.y-h.y},a=e?e((s+1)/n):t;e&&!i&&(a=-a);var l=P(c.x*c.x+c.y*c.y);c.x/=l,c.y/=l,u[s+1]={x:o.x+a*c.x,y:o.y+a*c.y}}})),new q(u)):([0,1].forEach((t=>{if(2===n&&t)return;const e=u[t*n],i=this.derivative(t),s={x:e.x+i.x,y:e.y+i.y};u[t+1]=I.lli4(e,s,h,r[t+1])})),new q(u))}outline(t,n,e,i){if(n=void 0===n?t:n,this._linear){const r=this.normal(0),s=this.points[0],o=this.points[this.points.length-1];let c,u,h;void 0===e&&(e=t,i=n),c={x:s.x+r.x*t,y:s.y+r.y*t},h={x:o.x+r.x*e,y:o.y+r.y*e},u={x:(c.x+h.x)/2,y:(c.y+h.y)/2};const a=[c,u,h];c={x:s.x-r.x*n,y:s.y-r.y*n},h={x:o.x-r.x*i,y:o.y-r.y*i},u={x:(c.x+h.x)/2,y:(c.y+h.y)/2};const l=[h,u,c],x=I.makeline(l[2],a[0]),f=I.makeline(a[2],l[0]),y=[x,new q(a),f,new q(l)];return new O(y)}const r=this.reduce(),s=r.length,o=[];let c,u=[],h=0,a=this.length();const l=void 0!==e&&void 0!==i;function x(t,n,e,i,r){return function(s){const o=i/e,c=
↓ show full (24,000 bytes)