UNPKG

@equinor/esv-intersection

Version:

Intersection component package with testing and automatic documentation.

14 lines (12 loc) 225 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("pixi.js");function Ms(e){return e}var Ve=1,he=2,nn=3,ne=4,jn=1e-6;function As(e){return"translate("+e+",0)"}function Ps(e){return"translate(0,"+e+")"}function Cs(e){return t=>+e(t)}function Ls(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function ks(){return!this.__axis}function Ui(e,t){var n=[],i=null,r=null,s=6,o=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,h=e===Ve||e===ne?-1:1,l=e===ne||e===he?"x":"y",u=e===Ve||e===nn?As:Ps;function f(d){var p=i??(t.ticks?t.ticks.apply(t,n):t.domain()),g=r??(t.tickFormat?t.tickFormat.apply(t,n):Ms),y=Math.max(s,0)+a,m=t.range(),_=+m[0]+c,v=+m[m.length-1]+c,M=(t.bandwidth?Ls:Cs)(t.copy(),c),b=d.selection?d.selection():d,T=b.selectAll(".domain").data([null]),S=b.selectAll(".tick").data(p,t).order(),C=S.exit(),k=S.enter().append("g").attr("class","tick"),I=S.select("line"),P=S.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(k),I=I.merge(k.append("line").attr("stroke","currentColor").attr(l+"2",h*s)),P=P.merge(k.append("text").attr("fill","currentColor").attr(l,h*y).attr("dy",e===Ve?"0em":e===nn?"0.71em":"0.32em")),d!==b&&(T=T.transition(d),S=S.transition(d),I=I.transition(d),P=P.transition(d),C=C.transition(d).attr("opacity",jn).attr("transform",function(O){return isFinite(O=M(O))?u(O+c):this.getAttribute("transform")}),k.attr("opacity",jn).attr("transform",function(O){var $=this.parentNode.__axis;return u(($&&isFinite($=$(O))?$:M(O))+c)})),C.remove(),T.attr("d",e===ne||e===he?o?"M"+h*o+","+_+"H"+c+"V"+v+"H"+h*o:"M"+c+","+_+"V"+v:o?"M"+_+","+h*o+"V"+c+"H"+v+"V"+h*o:"M"+_+","+c+"H"+v),S.attr("opacity",1).attr("transform",function(O){return u(M(O)+c)}),I.attr(l+"2",h*s),P.attr(l,h*y).text(g),b.filter(ks).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===he?"start":e===ne?"end":"middle"),b.each(function(){this.__axis=M})}return f.scale=function(d){return arguments.length?(t=d,f):t},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),f):n.slice()},f.tickValues=function(d){return arguments.length?(i=d==null?null:Array.from(d),f):i&&i.slice()},f.tickFormat=function(d){return arguments.length?(r=d,f):r},f.tickSize=function(d){return arguments.length?(s=o=+d,f):s},f.tickSizeInner=function(d){return arguments.length?(s=+d,f):s},f.tickSizeOuter=function(d){return arguments.length?(o=+d,f):o},f.tickPadding=function(d){return arguments.length?(a=+d,f):a},f.offset=function(d){return arguments.length?(c=+d,f):c},f}function Es(e){return Ui(he,e)}function Fs(e){return Ui(nn,e)}function le(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Rs(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Vi(e){let t,n,i;e.length!==2?(t=le,n=(a,c)=>le(e(a),c),i=(a,c)=>e(a)-c):(t=e===le||e===Rs?e:Is,n=e,i=e);function r(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<0?h=u+1:l=u}while(h<l)}return h}function s(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<=0?h=u+1:l=u}while(h<l)}return h}function o(a,c,h=0,l=a.length){const u=r(a,c,h,l-1);return u>h&&i(a[u-1],c)>-i(a[u],c)?u-1:u}return{left:r,center:o,right:s}}function Is(){return 0}function Os(e){return e===null?NaN:+e}const zs=Vi(le),Ds=zs.right;Vi(Os).center;class Zn extends Map{constructor(t,n=Bs){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[i,r]of t)this.set(i,r)}get(t){return super.get(Kn(this,t))}has(t){return super.has(Kn(this,t))}set(t,n){return super.set(Ns(this,t),n)}delete(t){return super.delete($s(this,t))}}function Kn({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function Ns({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function $s({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(n),e.delete(i)),n}function Bs(e){return e!==null&&typeof e=="object"?e.valueOf():e}const Hs=Math.sqrt(50),Xs=Math.sqrt(10),Us=Math.sqrt(2);function _e(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=Hs?10:s>=Xs?5:s>=Us?2:1;let a,c,h;return r<0?(h=Math.pow(10,-r)/o,a=Math.round(e*h),c=Math.round(t*h),a/h<e&&++a,c/h>t&&--c,h=-h):(h=Math.pow(10,r)*o,a=Math.round(e/h),c=Math.round(t/h),a*h<e&&++a,c*h>t&&--c),c<a&&.5<=n&&n<2?_e(e,t,n*2):[a,c,h]}function Vs(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const i=t<e,[r,s,o]=i?_e(t,e,n):_e(e,t,n);if(!(s>=r))return[];const a=s-r+1,c=new Array(a);if(i)if(o<0)for(let h=0;h<a;++h)c[h]=(s-h)/-o;else for(let h=0;h<a;++h)c[h]=(s-h)*o;else if(o<0)for(let h=0;h<a;++h)c[h]=(r+h)/-o;else for(let h=0;h<a;++h)c[h]=(r+h)*o;return c}function rn(e,t,n){return t=+t,e=+e,n=+n,_e(e,t,n)[2]}function Ws(e,t,n){t=+t,e=+e,n=+n;const i=t<e,r=i?rn(t,e,n):rn(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}function sn(e,t){let n;if(t===void 0)for(const i of e)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of e)(r=t(r,++i,e))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function We(e,t){let n=0;if(t===void 0)for(let i of e)(i=+i)&&(n+=i);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function Wi(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const Qn=Symbol("implicit");function Yi(){var e=new Zn,t=[],n=[],i=Qn;function r(s){let o=e.get(s);if(o===void 0){if(i!==Qn)return i;e.set(s,o=t.push(s)-1)}return n[o%n.length]}return r.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new Zn;for(const o of s)e.has(o)||e.set(o,t.push(o)-1);return r},r.range=function(s){return arguments.length?(n=Array.from(s),r):n.slice()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return Yi(t,n).unknown(i)},Wi.apply(r,arguments),r}function Cn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Gi(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Qt(){}var qt=.7,xe=1/qt,Ot="\\s*([+-]?\\d+)\\s*",jt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ct="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ys=/^#([0-9a-f]{3,8})$/,Gs=new RegExp(`^rgb\\(${Ot},${Ot},${Ot}\\)$`),qs=new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`),js=new RegExp(`^rgba\\(${Ot},${Ot},${Ot},${jt}\\)$`),Zs=new RegExp(`^rgba\\(${ct},${ct},${ct},${jt}\\)$`),Ks=new RegExp(`^hsl\\(${jt},${ct},${ct}\\)$`),Qs=new RegExp(`^hsla\\(${jt},${ct},${ct},${jt}\\)$`),Jn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Cn(Qt,gt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ti,formatHex:ti,formatHex8:Js,formatHsl:to,formatRgb:ei,toString:ei});function ti(){return this.rgb().formatHex()}function Js(){return this.rgb().formatHex8()}function to(){return qi(this).formatHsl()}function ei(){return this.rgb().formatRgb()}function gt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ys.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ni(t):n===3?new q(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ie(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ie(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Gs.exec(e))?new q(t[1],t[2],t[3],1):(t=qs.exec(e))?new q(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=js.exec(e))?ie(t[1],t[2],t[3],t[4]):(t=Zs.exec(e))?ie(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ks.exec(e))?si(t[1],t[2]/100,t[3]/100,1):(t=Qs.exec(e))?si(t[1],t[2]/100,t[3]/100,t[4]):Jn.hasOwnProperty(e)?ni(Jn[e]):e==="transparent"?new q(NaN,NaN,NaN,0):null}function ni(e){return new q(e>>16&255,e>>8&255,e&255,1)}function ie(e,t,n,i){return i<=0&&(e=t=n=NaN),new q(e,t,n,i)}function eo(e){return e instanceof Qt||(e=gt(e)),e?(e=e.rgb(),new q(e.r,e.g,e.b,e.opacity)):new q}function on(e,t,n,i){return arguments.length===1?eo(e):new q(e,t,n,i??1)}function q(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}Cn(q,on,Gi(Qt,{brighter(e){return e=e==null?xe:Math.pow(xe,e),new q(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?qt:Math.pow(qt,e),new q(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new q(Ct(this.r),Ct(this.g),Ct(this.b),ve(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ii,formatHex:ii,formatHex8:no,formatRgb:ri,toString:ri}));function ii(){return`#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}`}function no(){return`#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}${Pt((isNaN(this.opacity)?1:this.opacity)*255)}`}function ri(){const e=ve(this.opacity);return`${e===1?"rgb(":"rgba("}${Ct(this.r)}, ${Ct(this.g)}, ${Ct(this.b)}${e===1?")":`, ${e})`}`}function ve(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ct(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pt(e){return e=Ct(e),(e<16?"0":"")+e.toString(16)}function si(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new rt(e,t,n,i)}function qi(e){if(e instanceof rt)return new rt(e.h,e.s,e.l,e.opacity);if(e instanceof Qt||(e=gt(e)),!e)return new rt;if(e instanceof rt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,a=s-r,c=(s+r)/2;return a?(t===s?o=(n-i)/a+(n<i)*6:n===s?o=(i-t)/a+2:o=(t-n)/a+4,a/=c<.5?s+r:2-s-r,o*=60):a=c>0&&c<1?0:o,new rt(o,a,c,e.opacity)}function io(e,t,n,i){return arguments.length===1?qi(e):new rt(e,t,n,i??1)}function rt(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}Cn(rt,io,Gi(Qt,{brighter(e){return e=e==null?xe:Math.pow(xe,e),new rt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qt:Math.pow(qt,e),new rt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new q(Ye(e>=240?e-240:e+120,r,i),Ye(e,r,i),Ye(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new rt(oi(this.h),re(this.s),re(this.l),ve(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ve(this.opacity);return`${e===1?"hsl(":"hsla("}${oi(this.h)}, ${re(this.s)*100}%, ${re(this.l)*100}%${e===1?")":`, ${e})`}`}}));function oi(e){return e=(e||0)%360,e<0?e+360:e}function re(e){return Math.max(0,Math.min(1,e||0))}function Ye(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ln=e=>()=>e;function ro(e,t){return function(n){return e+n*t}}function so(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function oo(e){return(e=+e)==1?ji:function(t,n){return n-t?so(t,n,e):Ln(isNaN(t)?n:t)}}function ji(e,t){var n=t-e;return n?ro(e,n):Ln(isNaN(e)?t:e)}const Zt=(function e(t){var n=oo(t);function i(r,s){var o=n((r=on(r)).r,(s=on(s)).r),a=n(r.g,s.g),c=n(r.b,s.b),h=ji(r.opacity,s.opacity);return function(l){return r.r=o(l),r.g=a(l),r.b=c(l),r.opacity=h(l),r+""}}return i.gamma=e,i})(1);function ao(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;r<n;++r)i[r]=e[r]*(1-s)+t[r]*s;return i}}function co(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ho(e,t){var n=t?t.length:0,i=e?Math.min(n,e.length):0,r=new Array(i),s=new Array(n),o;for(o=0;o<i;++o)r[o]=kn(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(a){for(o=0;o<i;++o)s[o]=r[o](a);return s}}function lo(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function it(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function uo(e,t){var n={},i={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=kn(e[r],t[r]):i[r]=t[r];return function(s){for(r in n)i[r]=n[r](s);return i}}var an=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ge=new RegExp(an.source,"g");function fo(e){return function(){return e}}function po(e){return function(t){return e(t)+""}}function Zi(e,t){var n=an.lastIndex=Ge.lastIndex=0,i,r,s,o=-1,a=[],c=[];for(e=e+"",t=t+"";(i=an.exec(e))&&(r=Ge.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(i=i[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:it(i,r)})),n=Ge.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?po(c[0].x):fo(t):(t=c.length,function(h){for(var l=0,u;l<t;++l)a[(u=c[l]).i]=u.x(h);return a.join("")})}function kn(e,t){var n=typeof t,i;return t==null||n==="boolean"?Ln(t):(n==="number"?it:n==="string"?(i=gt(t))?(t=i,Zt):Zi:t instanceof gt?Zt:t instanceof Date?lo:co(t)?ao:Array.isArray(t)?ho:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?uo:it)(e,t)}function go(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var ai=180/Math.PI,cn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ki(e,t,n,i,r,s){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*i)&&(n-=e*c,i-=t*c),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,c/=a),e*i<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*ai,skewX:Math.atan(c)*ai,scaleX:o,scaleY:a}}var se;function mo(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?cn:Ki(t.a,t.b,t.c,t.d,t.e,t.f)}function yo(e){return e==null||(se||(se=document.createElementNS("http://www.w3.org/2000/svg","g")),se.setAttribute("transform",e),!(e=se.transform.baseVal.consolidate()))?cn:(e=e.matrix,Ki(e.a,e.b,e.c,e.d,e.e,e.f))}function Qi(e,t,n,i){function r(h){return h.length?h.pop()+" ":""}function s(h,l,u,f,d,p){if(h!==u||l!==f){var g=d.push("translate(",null,t,null,n);p.push({i:g-4,x:it(h,u)},{i:g-2,x:it(l,f)})}else(u||f)&&d.push("translate("+u+t+f+n)}function o(h,l,u,f){h!==l?(h-l>180?l+=360:l-h>180&&(h+=360),f.push({i:u.push(r(u)+"rotate(",null,i)-2,x:it(h,l)})):l&&u.push(r(u)+"rotate("+l+i)}function a(h,l,u,f){h!==l?f.push({i:u.push(r(u)+"skewX(",null,i)-2,x:it(h,l)}):l&&u.push(r(u)+"skewX("+l+i)}function c(h,l,u,f,d,p){if(h!==u||l!==f){var g=d.push(r(d)+"scale(",null,",",null,")");p.push({i:g-4,x:it(h,u)},{i:g-2,x:it(l,f)})}else(u!==1||f!==1)&&d.push(r(d)+"scale("+u+","+f+")")}return function(h,l){var u=[],f=[];return h=e(h),l=e(l),s(h.translateX,h.translateY,l.translateX,l.translateY,u,f),o(h.rotate,l.rotate,u,f),a(h.skewX,l.skewX,u,f),c(h.scaleX,h.scaleY,l.scaleX,l.scaleY,u,f),h=l=null,function(d){for(var p=-1,g=f.length,y;++p<g;)u[(y=f[p]).i]=y.x(d);return u.join("")}}}var _o=Qi(mo,"px, ","px)","deg)"),xo=Qi(yo,", ",")",")"),vo=1e-12;function ci(e){return((e=Math.exp(e))+1/e)/2}function wo(e){return((e=Math.exp(e))-1/e)/2}function bo(e){return((e=Math.exp(2*e))-1)/(e+1)}const So=(function e(t,n,i){function r(s,o){var a=s[0],c=s[1],h=s[2],l=o[0],u=o[1],f=o[2],d=l-a,p=u-c,g=d*d+p*p,y,m;if(g<vo)m=Math.log(f/h)/t,y=function(S){return[a+S*d,c+S*p,h*Math.exp(t*S*m)]};else{var _=Math.sqrt(g),v=(f*f-h*h+i*g)/(2*h*n*_),M=(f*f-h*h-i*g)/(2*f*n*_),b=Math.log(Math.sqrt(v*v+1)-v),T=Math.log(Math.sqrt(M*M+1)-M);m=(T-b)/t,y=function(S){var C=S*m,k=ci(b),I=h/(n*_)*(k*bo(t*C+b)-wo(b));return[a+I*d,c+I*p,h*k/ci(t*C+b)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(s){var o=Math.max(.001,+s),a=o*o,c=a*a;return e(o,a,c)},r})(Math.SQRT2,2,4);function To(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function Mo(e){return function(){return e}}function Ao(e){return+e}var hi=[0,1];function Ft(e){return e}function hn(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Mo(isNaN(t)?NaN:.5)}function Po(e,t){var n;return e>t&&(n=e,e=t,t=n),function(i){return Math.max(e,Math.min(t,i))}}function Co(e,t,n){var i=e[0],r=e[1],s=t[0],o=t[1];return r<i?(i=hn(r,i),s=n(o,s)):(i=hn(i,r),s=n(s,o)),function(a){return s(i(a))}}function Lo(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),o=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)r[o]=hn(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(a){var c=Ds(e,a,1,i)-1;return s[c](r[c](a))}}function ko(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Eo(){var e=hi,t=hi,n=kn,i,r,s,o=Ft,a,c,h;function l(){var f=Math.min(e.length,t.length);return o!==Ft&&(o=Po(e[0],e[f-1])),a=f>2?Lo:Co,c=h=null,u}function u(f){return f==null||isNaN(f=+f)?s:(c||(c=a(e.map(i),t,n)))(i(o(f)))}return u.invert=function(f){return o(r((h||(h=a(t,e.map(i),it)))(f)))},u.domain=function(f){return arguments.length?(e=Array.from(f,Ao),l()):e.slice()},u.range=function(f){return arguments.length?(t=Array.from(f),l()):t.slice()},u.rangeRound=function(f){return t=Array.from(f),n=go,l()},u.clamp=function(f){return arguments.length?(o=f?!0:Ft,l()):o!==Ft},u.interpolate=function(f){return arguments.length?(n=f,l()):n},u.unknown=function(f){return arguments.length?(s=f,u):s},function(f,d){return i=f,r=d,l()}}function Fo(){return Eo()(Ft,Ft)}function Ro(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function we(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function zt(e){return e=we(Math.abs(e)),e?e[1]:NaN}function Io(e,t){return function(n,i){for(var r=n.length,s=[],o=0,a=e[0],c=0;r>0&&a>0&&(c+a+1>i&&(a=Math.max(1,i-c)),s.push(n.substring(r-=a,r+a)),!((c+=a+1)>i));)a=e[o=(o+1)%e.length];return s.reverse().join(t)}}function Oo(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var zo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function be(e){if(!(t=zo.exec(e)))throw new Error("invalid format: "+e);var t;return new En({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}be.prototype=En.prototype;function En(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}En.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Do(e){t:for(var t=e.length,n=1,i=-1,r;n<t;++n)switch(e[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+e[n])break t;i>0&&(i=0);break}return i>0?e.slice(0,i)+e.slice(r+1):e}var Ji;function No(e,t){var n=we(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(Ji=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+we(e,Math.max(0,t+s-1))[0]}function li(e,t){var n=we(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const ui={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ro,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>li(e*100,t),r:li,s:No,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function fi(e){return e}var di=Array.prototype.map,pi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function $o(e){var t=e.grouping===void 0||e.thousands===void 0?fi:Io(di.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",r=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?fi:Oo(di.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function h(u){u=be(u);var f=u.fill,d=u.align,p=u.sign,g=u.symbol,y=u.zero,m=u.width,_=u.comma,v=u.precision,M=u.trim,b=u.type;b==="n"?(_=!0,b="g"):ui[b]||(v===void 0&&(v=12),M=!0,b="g"),(y||f==="0"&&d==="=")&&(y=!0,f="0",d="=");var T=g==="$"?n:g==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",S=g==="$"?i:/[%p]/.test(b)?o:"",C=ui[b],k=/[defgprs%]/.test(b);v=v===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function I(P){var O=T,$=S,x,A,w;if(b==="c")$=C(P)+$,P="";else{P=+P;var L=P<0||1/P<0;if(P=isNaN(P)?c:C(Math.abs(P),v),M&&(P=Do(P)),L&&+P==0&&p!=="+"&&(L=!1),O=(L?p==="("?p:a:p==="-"||p==="("?"":p)+O,$=(b==="s"?pi[8+Ji/3]:"")+$+(L&&p==="("?")":""),k){for(x=-1,A=P.length;++x<A;)if(w=P.charCodeAt(x),48>w||w>57){$=(w===46?r+P.slice(x+1):P.slice(x))+$,P=P.slice(0,x);break}}}_&&!y&&(P=t(P,1/0));var E=O.length+P.length+$.length,F=E<m?new Array(m-E+1).join(f):"";switch(_&&y&&(P=t(F+P,F.length?m-$.length:1/0),F=""),d){case"<":P=O+P+$+F;break;case"=":P=O+F+P+$;break;case"^":P=F.slice(0,E=F.length>>1)+O+P+$+F.slice(E);break;default:P=F+O+P+$;break}return s(P)}return I.toString=function(){return u+""},I}function l(u,f){var d=h((u=be(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(zt(f)/3)))*3,g=Math.pow(10,-p),y=pi[8+p/3];return function(m){return d(g*m)+y}}return{format:h,formatPrefix:l}}var oe,tr,er;Bo({thousands:",",grouping:[3],currency:["$",""]});function Bo(e){return oe=$o(e),tr=oe.format,er=oe.formatPrefix,oe}function Ho(e){return Math.max(0,-zt(Math.abs(e)))}function Xo(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(zt(t)/3)))*3-zt(Math.abs(e)))}function Uo(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,zt(t)-zt(e))+1}function Vo(e,t,n,i){var r=Ws(e,t,n),s;switch(i=be(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return i.precision==null&&!isNaN(s=Xo(r,o))&&(i.precision=s),er(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=Uo(r,Math.max(Math.abs(e),Math.abs(t))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=Ho(r))&&(i.precision=s-(i.type==="%")*2);break}}return tr(i)}function Wo(e){var t=e.domain;return e.ticks=function(n){var i=t();return Vs(i[0],i[i.length-1],n??10)},e.tickFormat=function(n,i){var r=t();return Vo(r[0],r[r.length-1],n??10,i)},e.nice=function(n){n==null&&(n=10);var i=t(),r=0,s=i.length-1,o=i[r],a=i[s],c,h,l=10;for(a<o&&(h=o,o=a,a=h,h=r,r=s,s=h);l-- >0;){if(h=rn(o,a,n),h===c)return i[r]=o,i[s]=a,t(i);if(h>0)o=Math.floor(o/h)*h,a=Math.ceil(a/h)*h;else if(h<0)o=Math.ceil(o*h)/h,a=Math.floor(a*h)/h;else break;c=h}return e},e}function Lt(){var e=Fo();return e.copy=function(){return ko(e,Lt())},Wi.apply(e,arguments),Wo(e)}class nr{constructor(t,n=!0,i,r,s,o){this._showLabels=!0,this._offsetX=0,this._offsetY=0,this._flipX=!1,this._flipY=!1,this.visible=!0,this.createOrGet=a=>{const{mainGroup:c}=this;let h=c.select(`g.${a}`);return h.empty()&&(h=c.append("g").attr("class",a)),h},this.mainGroup=t,this._showLabels=n,this._labelXDesc=i,this._labelYDesc=r,this._unitOfMeasure=s,o&&o.offsetX&&(this._offsetX=o.offsetX),o&&o.offsetX&&(this._offsetY=o.offsetY),o&&o.visible&&(this.visible=o.visible),this.mainGroup.style("pointer-events","none"),this._scaleX=Lt().domain([0,1]).range([0,1]),this._scaleY=Lt().domain([0,1]).range([0,1])}renderLabelx(){const{_labelXDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleX:r}=this,[,s]=r.range(),o=this.renderGx();let a=o.select("text.axis-labelx");return i?a.empty()&&(a=o.append("text").attr("class","axis-labelx").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)):a.remove(),a.attr("transform",`translate(${s/2},-4)`),a}renderLabely(){const{_labelYDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleY:r}=this,[,s]=r.range(),o=this.renderGy();let a=o.select("text.axis-labely");return i?(a.empty()&&(a=o.append("text").attr("class","axis-labely").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)),a.attr("transform",`translate(-10,${s/2})rotate(90)`)):a.remove(),a}renderGy(){const{_scaleX:t,_scaleY:n}=this,i=Es(n),[,r]=t.range(),s=this.createOrGet("y-axis");return s.call(i),s.attr("transform",`translate(${r},0)`),s}renderGx(){const{_scaleX:t,_scaleY:n}=this,i=Fs(t),[,r]=n.range(),s=this.createOrGet("x-axis");return s.attr("transform",`translate(0 ${r})`),s.call(i),s}render(){this.renderLabelx(),this.renderLabely()}onResize(t){this.mainGroup.attr("height",`${t.height}px`).attr("width",`${t.width}px`)}onRescale(t){const{_scaleX:n,_scaleY:i,offsetX:r,offsetY:s}=this,{xScale:o,yScale:a}=t,c=o.domain(),h=a.domain(),l=o.range(),u=a.range();n.domain([c[0]-r,c[1]-r]).range(l),i.domain([h[0]-s,h[1]-s]).range(u),this.flipX(this._flipX),this.flipY(this._flipY),this.visible&&this.render()}show(){return this.visible=!0,this.mainGroup.attr("visibility","visible"),this.render(),this}hide(){return this.visible=!1,this.mainGroup.attr("visibility","hidden"),this}flipX(t){this._flipX=t;const n=this._scaleX.domain(),i=t?-1:1;return this._scaleX.domain([i*n[0],i*n[1]]),this}flipY(t){this._flipY=t;const n=this._scaleY.domain(),i=t?-1:1;return this._scaleY.domain([i*n[0],i*n[1]]),this}showLabels(){return this._showLabels=!0,this.render(),this}hideLabels(){return this._showLabels=!1,this.render(),this}setLabelX(t){return this._labelXDesc=t,this}setLabelY(t){return this._labelYDesc=t,this}setUnitOfMeasure(t){return this._unitOfMeasure=t,this}setLabels(t,n,i){return this._labelXDesc=t,this._labelYDesc=n,this._unitOfMeasure=i,this}get offsetX(){return this._offsetX}set offsetX(t){this._offsetX=t}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY=t}get scaleX(){return this._scaleX.copy()}get scaleY(){return this._scaleY.copy()}}const Yo=Math.PI/180;function xt(e,t=0,n=1){return e<t?t:e>n?n:e}function Go(e){return e*Yo}function gi(e){const t=new Array(e),n=1/(e-1);t[0]=0;for(let i=1;i<e-1;i++)t[i]=i*n;return t[e-1]=1,t}function Bt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]+t[i];return n}function Ht(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]-t[i];return n}function Tt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]*t;return n}function qo(e){for(var t=0,n=0;n<e.length;n++)t+=Math.pow(e[n],2);return t}function Wt(e){var t=qo(e);return t===0?t:Math.sqrt(t)}function mi(e,t){t===void 0&&(t=e);var n=Wt(e);return n===0?jo(0,t):Tt(e,1/n,t)}function jo(e,t){for(var n=0;n<t.length;n++)t[n]=e;return t}function Zo(e,t){for(var n=0,i=0;i<e.length;i++)n+=Math.pow(t[i]-e[i],2);return n===0?n:Math.sqrt(n)}function Ko(e,t){for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function Qo(e,t,n,i){i===void 0&&(i=e);for(var r=xt(n,0,1),s=1-r,o=0;o<e.length;o++)i[o]=e[o]*s+t[o]*r;return i}function Jo(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function yi(e,t){t===void 0&&(t=0),t===void 0&&(t=0);for(var n=0;n<e.length;n++)if(Math.abs(e[n])>t)return!1;return!0}var qe=180/Math.PI,ta=Math.PI/180;function je(e,t,n){var i=Math.cos(t),r=Math.sin(t),s=e[0];return n[0]=i*s-r*e[1],n[1]=r*s+i*e[1],n}function _i(e){return Math.atan2(e[1],e[0])}function Xt(e,t){var n=Math.atan2(t[1],t[0])-Math.atan2(e[1],e[0]);return n>Math.PI?n-=2*Math.PI:n<=-Math.PI&&(n+=2*Math.PI),n}var D=(function(){function e(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.isMutating=!1,this.length=2,typeof t=="number"?typeof n[0]=="number"?(this[0]=t,this[1]=n[0]):(this[0]=t,this[1]=t):"x"in t&&"y"in t?(this[0]=t.x,this[1]=t.y):(this[0]=t[0],this[1]=t[1])}return Object.defineProperty(e.prototype,"x",{get:function(){return this[0]},set:function(t){this[0]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this[1]},set:function(t){this[1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"magnitude",{get:function(){return Wt(this)},set:function(t){var n=Wt(this);Tt(this,t/n,this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mutable",{get:function(){return this.isMutating=!0,this},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"immutable",{get:function(){return this.isMutating=!1,this},enumerable:!1,configurable:!0}),e.prototype.set=function(t,n){return typeof t=="number"?typeof n=="number"?(this[0]=t,this[1]=n):(this[0]=t,this[1]=t):(this[0]=t[0],this[1]=t[1]),this},e.prototype.add=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Bt(this,[t,n]):Bt(this.clone(),[t,n]):this.isMutating?Bt(this,t):Bt(this.clone(),t)},e.add=function(t,n){var i=new e(t);return Bt(i,n)},e.prototype.sub=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Ht(this,[t,n]):Ht(this.clone(),[t,n]):this.isMutating?Ht(this,t):Ht(this.clone(),t)},e.sub=function(t,n){var i=new e(t);return Ht(i,n)},e.prototype.subFrom=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?(this[0]=t-this[0],this[1]=n-this[1],this):new e(t-this[0],n-this[1]):this.isMutating?(this[0]=t[0]-this[0],this[1]=t[1]-this[1],this):new e(t[0]-this[0],t[1]-this[1])},e.divide=function(t,n){var i=new e(t);return Tt(i,1/n)},e.multiply=function(t,n){var i=new e(t);return Tt(i,n)},e.prototype.scale=function(t){return Tt(this,t,this.isMutating?this:e.zero)},e.prototype.rescale=function(t){var n=Wt(this);return n<=0?this.isMutating?this:e.zero:Tt(this,t/n,this.isMutating?this:e.zero)},e.prototype.clampMagnitude=function(t){var n=Wt(this);return n>t?Tt(this,t/n,this.isMutating?this:e.zero):this.isMutating?this:this.clone()},e.prototype.rotate=function(t){return je(this,t,this.isMutating?this:e.zero)},e.prototype.rotateDeg=function(t){return je(this,t*ta,this.isMutating?this:e.zero)},e.prototype.rotate90=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=-t[1],n[1]=i,n;var t,n,i},e.prototype.rotate180=function(){return t=this,(n=this.isMutating?this:e.zero)[0]=-t[0],n[1]=-t[1],n;var t,n},e.prototype.rotate270=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=t[1],n[1]=-i,n;var t,n,i},e.prototype.normalize=function(){return mi(this)},e.prototype.normalized=function(){return mi(this,e.zero)},e.distance=function(t,n){return Zo(t,n)},e.dot=function(t,n){return Ko(t,n)},e.cross=function(t,n){return(function(i,r){return i[0]*r[1]-i[1]*r[0]})(t,n)},e.angleRight=function(t){return _i(t)},e.angleRightDeg=function(t){return _i(t)*qe},e.angle=function(t,n){return Math.abs(Xt(t,n))},e.angleDeg=function(t,n){return Math.abs(Xt(t,n))*qe},e.signedAngle=function(t,n){return Xt(t,n)},e.signedAngleDeg=function(t,n){return Xt(t,n)*qe},e.lerp=function(t,n,i){var r=new e(t);return Qo(r,n,i)},e.lerpRot=function(t,n,i){return(function(r,s,o,a){return a===void 0&&(a=r),je(r,o*Xt(r,s),a)})(t,n,i,e.zero)},e.prototype.clone=function(){return new e(this[0],this[1])},e.equals=function(t,n,i){return i===void 0&&(i=0),!(Math.abs(t[0]-n[0])>i)&&!(Math.abs(t[1]-n[1])>i)},e.prototype.equals=function(t,n){return n===void 0&&(n=0),e.equals(this,t,n)},e.isZeroVector=function(t,n){return n===void 0&&(n=0),yi(t,n)},e.prototype.isZeroVector=function(t){return t===void 0&&(t=0),yi(this,t)},e.prototype.toArray=function(){return[this[0],this[1]]},e.prototype.modify=function(t){return Jo(this,t)},e.prototype[Symbol.iterator]=function(){var t=this,n=0;return{next:function(){switch(n++){case 0:return{value:t[0],done:!1};case 1:return{value:t[1],done:!1};default:return{value:-1,done:!0}}}}},Object.defineProperty(e,"zero",{get:function(){return new e(0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return new e(1,1)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"positiveInfinity",{get:function(){return new e(1/0,1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"negativeInfinity",{get:function(){return new e(-1/0,-1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"up",{get:function(){return new e(0,1)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"right",{get:function(){return new e(1,0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"down",{get:function(){return new e(0,-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"left",{get:function(){return new e(-1,0)},enumerable:!1,configurable:!0}),e})();/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var ln=function(e,t){return ln=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)i.hasOwnProperty(r)&&(n[r]=i[r])},ln(e,t)};function ir(e,t){function n(){this.constructor=e}ln(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Se=function(){return Se=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Se.apply(this,arguments)};function xi(e,t){for(var n=new Array(e.length),i=0;i<e.length;i++)n[i]=2*e[i]-t[i];return n}function un(e,t,n){var i,r,s,o,a=t.length-1;if(n)i=t[e-1<0?a:e-1],r=t[e%t.length],s=t[(e+1)%t.length],o=t[(e+2)%t.length];else{if(e===a)throw Error("There is no spline segment at this index for a closed curve!");r=t[e],s=t[e+1],i=e>0?t[e-1]:xi(r,s),o=e<a-1?t[e+2]:xi(s,r)}return[i,r,s,o]}function ea(e,t,n){n===void 0&&(n=!1);var i=n?t.length:t.length-1;if(e===1)return{index:i-1,weight:1};var r=i*e,s=Math.floor(r);return{index:s,weight:r-s}}function na(e,t){for(var n=0;n<e.length;n++)e[n]=t;return e}function ia(e,t){for(var n=0;n<e.length;n++)e[n]=t(e[n],n);return e}function ra(e,t,n){n===void 0&&(n=0);for(var i=0;i<e.length;i++)n=t(n,e[i],i);return n}function ue(e,t){t=t||new Array(e.length);for(var n=0;n<e.length;n++)t[n]=e[n];return t}function G(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e<t?t:e>n?n:e}function fn(e,t){var n=t[0];if(e>=t[t.length-1])return t.length-1;if(e<=n)return 0;for(var i=0,r=t.length-1;i<=r;){var s=Math.floor((i+r)/2),o=t[s];if(o<e)i=s+1;else{if(!(o>e))return s;r=s-1}}return Math.max(0,r)}var tt=Math.pow(2,-42);function vi(e){var t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}function rr(e,t,n){if(Math.abs(e)<tt)return Math.abs(t)<tt?[]:[-n/t];var i=t*t-4*e*n;return Math.abs(i)<tt?[-t/(2*e)]:i>0?[(-t+Math.sqrt(i))/(2*e),(-t-Math.sqrt(i))/(2*e)]:[]}function sa(e,t,n,i){if(Math.abs(e)<tt)return rr(t,n,i);var r,s=(3*e*n-t*t)/(3*e*e),o=(2*t*t*t-9*e*t*n+27*e*e*i)/(27*e*e*e);if(Math.abs(s)<tt)r=[vi(-o)];else if(Math.abs(o)<tt)r=[0].concat(s<0?[Math.sqrt(-s),-Math.sqrt(-s)]:[]);else{var a=o*o/4+s*s*s/27;if(Math.abs(a)<tt)r=[-1.5*o/s,3*o/s];else if(a>0)r=[(c=vi(-o/2-Math.sqrt(a)))-s/(3*c)];else{var c=2*Math.sqrt(-s/3),h=Math.acos(3*o/s/c)/3,l=2*Math.PI/3;r=[c*Math.cos(h),c*Math.cos(h-l),c*Math.cos(h-2*l)]}}for(var u=0;u<r.length;u++)r[u]-=t/(3*e);return r}function ae(e,t){if(e.length!==t.length)throw Error("Vectors must be of equal length!");for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function et(e,t,n){if(!(e.length>3)){n=n||new Array(3);var i=e[0],r=e[1],s=e[2]||0,o=t[0],a=t[1],c=t[2]||0;return n[0]=r*c-s*a,n[1]=s*o-i*c,n[2]=i*a-r*o,n}}function sr(e,t){for(var n=0,i=0;i<e.length;i++)n+=(e[i]-t[i])*(e[i]-t[i]);return n}function At(e){for(var t=0,n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function Te(e,t){var n=sr(e,t);return n===0?0:Math.sqrt(n)}function ft(e,t){var n=t?ue(e,t):e,i=ra(n,(function(s,o){return s+Math.pow(o,2)})),r=Math.sqrt(i);return r===0?na(n,0):ia(n,(function(s){return s/r}))}function wi(e,t,n,i){t===void 0&&(t=[0,1,0]),n===void 0&&(n=0);var r=Math.cos(n),s=Math.sin(n),o=1-r,a=e[0],c=e[1],h=e[2],l=t[0],u=t[1],f=t[2],d=o*l,p=o*u;return(i=i||e)[0]=(d*l+r)*a+(d*u-s*f)*c+(d*f+s*u)*h,i[1]=(d*u+s*f)*a+(p*u+r)*c+(p*f-s*l)*h,i[2]=(d*f-s*u)*a+(p*f+s*l)*c+(o*f*f+r)*h,i}function oa(e,t,n,i,r){if(r===void 0&&(r=0),r===0)return[0,1,2,3];var s=function(c,h){return Math.pow(sr(c,h),.5*r)},o=s(t,e),a=s(n,t)+o;return[0,o,a,s(i,n)+a]}function aa(e,t,n,i,r){for(var s=Number.isFinite(r.tension)?r.tension:.5,o=Number.isFinite(r.alpha)?r.alpha:null,a=o>0?oa(e,t,n,i,o):null,c=new Array(e.length),h=0;h<e.length;h++){var l=0,u=0,f=e[h],d=t[h],p=n[h],g=i[h];if(a){var y=a[0],m=a[1],_=a[2],v=a[3];m-_!=0&&(y-m!=0&&y-_!=0&&(l=(1-s)*(_-m)*((f-d)/(y-m)-(f-p)/(y-_)+(d-p)/(m-_))),m-v!=0&&_-v!=0&&(u=(1-s)*(_-m)*((d-p)/(m-_)-(d-g)/(m-v)+(p-g)/(_-v))))}else l=(1-s)*(p-f)*.5,u=(1-s)*(g-d)*.5;var M=2*d-2*p+l+u,b=-3*d+3*p-2*l-u,T=l,S=d;c[h]=[M,b,T,S]}return c}function Rt(e,t){var n=e*e,i=e*n;return t[0]*i+t[1]*n+t[2]*e+t[3]}function It(e,t){var n=e*e;return 3*t[0]*n+2*t[1]*e+t[2]}function Ze(e,t){return 6*t[0]*e+2*t[1]}function ca(e,t){var n=t[0],i=t[1],r=t[2],s=t[3]-e;return n===0&&i===0&&r===0&&s===0?[0]:sa(n,i,r,s).filter((function(o){return o>-tt&&o<=1+tt})).map((function(o){return G(o,0,1)}))}function dn(e,t,n,i){i===void 0&&(i=null),i=i||new Array(n.length);for(var r=0;r<n.length;r++)i[r]=e(t,n[r]);return i}var or=(function(){function e(t){t===void 0&&(t=null),this._alpha=0,this._tension=.5,this._closed=!1,this._onInvalidateCache=null,this._onInvalidateCache=t,this._cache={arcLengths:null,coefficients:null}}return e.prototype._invalidateCache=function(){this.points&&(this._cache={arcLengths:null,coefficients:null},this._onInvalidateCache&&this._onInvalidateCache())},Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){Number.isFinite(t)&&t!==this._alpha&&(this._invalidateCache(),this._alpha=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._tension},set:function(t){Number.isFinite(t)&&t!==this._tension&&(this._invalidateCache(),this._tension=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"points",{get:function(){return this._points},set:function(t){if(!t||t.length<2)throw Error("At least 2 control points are required!");this._points=t,this._invalidateCache()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){t=!!t,this._closed!==t&&(this._invalidateCache(),this._closed=t)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._invalidateCache()},e.prototype.evaluateForT=function(t,n,i){var r=ea(n,this.points,this.closed),s=r.index;return dn(t,r.weight,this.getCoefficients(s),i)},e.prototype.getCoefficients=function(t){if(this.points){if(this._cache.coefficients||(this._cache.coefficients=new Map),!this._cache.coefficients.has(t)){var n=un(t,this.points,this.closed),i=aa(n[0],n[1],n[2],n[3],{tension:this.tension,alpha:this.alpha});this._cache.coefficients.set(t,i)}return this._cache.coefficients.get(t)}},e})(),ha=(function(e){function t(n,i){n===void 0&&(n=300),i===void 0&&(i=null);var r=e.call(this,i)||this;return r._subDivisions=n,r}return ir(t,e),Object.defineProperty(t.prototype,"arcLengths",{get:function(){return this._cache.arcLengths||(this._cache.arcLengths=this.computeArcLengths()),this._cache.arcLengths},enumerable:!1,configurable:!0}),t.prototype._invalidateCache=function(){e.prototype._invalidateCache.call(this),this._cache.arcLengths=null},t.prototype.computeArcLengths=function(){var n,i=[],r=this.evaluateForT(Rt,0),s=0;i.push(0);for(var o=1;o<=this._subDivisions;o++)s+=Te(n=this.evaluateForT(Rt,o/this._subDivisions),r),i.push(s),r=n;return i},t.prototype.lengthAt=function(n){var i=this.arcLengths;return n*i[i.length-1]},t.prototype.getT=function(n){var i=this.arcLengths,r=i.length,s=n*i[r-1],o=fn(s,i);if(i[o]===s)return o/(r-1);var a=i[o];return(o+(s-a)/(i[o+1]-a))/(r-1)},t.prototype.getU=function(n){if(n===0)return 0;if(n===1)return 1;var i=this.arcLengths,r=i.length-1,s=i[r],o=n*r,a=Math.floor(o),c=i[a];if(o===a)return c/s;var h=a/r;return(c+Te(this.evaluateForT(Rt,h),this.evaluateForT(Rt,n)))/s},t})(or),ar=[[[-.906179845938664,.23692688505618908],[-.5384693101056831,.47862867049936647],[0,.5688888888888889],[.5384693101056831,.47862867049936647],[.906179845938664,.23692688505618908]],[[-.932469514203152,.17132449237917036],[-.6612093864662645,.3607615730481386],[-.2386191860831969,.46791393457269104],[.2386191860831969,.46791393457269104],[.6612093864662645,.3607615730481386],[.932469514203152,.17132449237917036]],[[-.9491079123427585,.1294849661688697],[-.7415311855993945,.27970539148927664],[-.4058451513773972,.3818300505051189],[0,.4179591836734694],[.4058451513773972,.3818300505051189],[.7415311855993945,.27970539148927664],[.9491079123427585,.1294849661688697]],[[-.9602898564975363,.10122853629037626],[-.7966664774136267,.22238103445337448],[-.525532409916329,.31370664587788727],[-.1834346424956498,.362683783378362],[.1834346424956498,.362683783378362],[.525532409916329,.31370664587788727],[.7966664774136267,.22238103445337448],[.9602898564975363,.10122853629037626]],[[-.9681602395076261,.08127438836157441],[-.8360311073266358,.1806481606948574],[-.6133714327005904,.26061069640293544],[-.3242534234038089,.31234707704000286],[0,.3302393550012598],[.3242534234038089,.31234707704000286],[.6133714327005904,.26061069640293544],[.8360311073266358,.1806481606948574],[.9681602395076261,.08127438836157441]],[[-.9739065285171717,.06667134430868814],[-.8650633666889845,.1494513491505806],[-.6794095682990244,.21908636251598204],[-.4333953941292472,.26926671930999635],[-.14887433898163122,.29552422471475287],[.14887433898163122,.29552422471475287],[.4333953941292472,.26926671930999635],[.6794095682990244,.21908636251598204],[.8650633666889845,.1494513491505806],[.9739065285171717,.06667134430868814]],[[-.978228658146056,.0556685671161736],[-.887062599768095,.125580369464904],[-.730152005574049,.186290210927734],[-.519096129206811,.23319376459199],[-.269543155952344,.262804544510246],[0,.2729250867779],[.269543155952344,.262804544510246],[.519096129206811,.23319376459199],[.730152005574049,.186290210927734],[.887062599768095,.125580369464904],[.978228658146056,.0556685671161736]],[[-.981560634246719,.0471753363865118],[-.904117256370474,.106939325995318],[-.769902674194304,.160078328543346],[-.587317954286617,.203167426723065],[-.36783149899818,.233492536538354],[-.125233408511468,.249147045813402],[.125233408511468,.249147045813402],[.36783149899818,.233492536538354],[.587317954286617,.203167426723065],[.769902674194304,.160078328543346],[.904117256370474,.106939325995318],[.981560634246719,.0471753363865118]],[[-.984183054718588,.0404840047653158],[-.917598399222977,.0921214998377284],[-.801578090733309,.138873510219787],[-.64234933944034,.178145980761945],[-.448492751036446,.207816047536888],[-.230458315955134,.226283180262897],[0,.232551553230873],[.230458315955134,.226283180262897],[.448492751036446,.207816047536888],[.64234933944034,.178145980761945],[.801578090733309,.138873510219787],[.917598399222977,.0921214998377284],[.984183054718588,.0404840047653158]],[[-.986283808696812,.0351194603317518],[-.928434883663573,.0801580871597602],[-.827201315069764,.121518570687903],[-.687292904811685,.157203167158193],[-.515248636358154,.185538397477937],[-.319112368927889,.205198463721295],[-.108054948707343,.215263853463157],[.108054948707343,.215263853463157],[.319112368927889,.205198463721295],[.515248636358154,.185538397477937],[.687292904811685,.157203167158193],[.827201315069764,.121518570687903],[.928434883663573,.0801580871597602],[.986283808696812,.0351194603317518]],[[-.987992518020485,.0307532419961172],[-.937273392400705,.0703660474881081],[-.848206583410427,.107159220467171],[-.72441773136017,.139570677926154],[-.570972172608538,.166269205816993],[-.394151347077563,.186161000015562],[-.201194093997434,.198431485327111],[0,.202578241925561],[.201194093997434,.198431485327111],[.394151347077563,.186161000015562],[.570972172608538,.166269205816993],[.72441773136017,.139570677926154],[.848206583410427,.107159220467171],[.937273392400705,.0703660474881081],[.987992518020485,.0307532419961172]],[[-.989400934991649,.027152459411754],[-.944575023073232,.0622535239386478],[-.865631202387831,.0951585116824927],[-.755404408355003,.124628971255533],[-.617876244402643,.149595988816576],[-.458016777657227,.169156519395002],[-.281603550779258,.182603415044923],[-.0950125098376374,.189450610455068],[.0950125098376374,.189450610455068],[.281603550779258,.182603415044923],[.458016777657227,.169156519395002],[.617876244402643,.149595988816576],[.755404408355003,.124628971255533],[.865631202387831,.0951585116824927],[.944575023073232,.0622535239386478],[.989400934991649,.027152459411754]],[[-.990575475314417,.0241483028685479],[-.950675521768767,.0554595293739872],[-.880239153726985,.0850361483171791],[-.781514003896801,.111883847193403],[-.65767115921669,.135136368468525],[-.512690537086476,.15404576107681],[-.351231763453876,.16800410215645],[-.178484181495847,.176562705366992],[0,.179446470356206],[.178484181495847,.176562705366992],[.351231763453876,.16800410215645],[.512690537086476,.15404576107681],[.65767115921669,.135136368468525],[.781514003896801,.111883847193403],[.880239153726985,.0850361483171791],[.950675521768767,.0554595293739872],[.990575475314417,.0241483028685479]],[[-.99156516842093,.0216160135264833],[-.955823949571397,.0497145488949698],[-.892602466497555,.076425730254889],[-.803704958972523,.100942044106287],[-.691687043060353,.122555206711478],[-.559770831073947,.14064291467065],[-.411751161462842,.154684675126265],[-.251886225691505,.164276483745832],[-.0847750130417353,.169142382963143],[.0847750130417353,.169142382963143],[.251886225691505,.164276483745832],[.411751161462842,.154684675126265],[.559770831073947,.14064291467065],[.691687043060353,.122555206711478],[.803704958972523,.100942044106287],[.892602466497555,.076425730254889],[.955823949571397,.0497145488949697],[.99156516842093,.0216160135264833]],[[-.992406843843584,.0194617882297264],[-.96020815213483,.0448142267656996],[-.903155903614817,.0690445427376412],[-.822714656537142,.0914900216224499],[-.720966177335229,.111566645547333],[-.600545304661681,.128753962539336],[-.46457074137596,.142606702173606],[-.316564099963629,.152766042065859],[-.160358645640225,.158968843393954],[0,.161054449848783],[.160358645640225,.158968843393954],[.316564099963629,.152766042065859],[.46457074137596,.142606702173606],[.600545304661681,.128753962539336],[.720966177335229,.111566645547333],[.822714656537142,.0914900216224499],[.903155903614817,.0690445427376412],[.96020815213483,.0448142267656996],[.992406843843584,.0194617882297264]],[[-.99312