1;r--)n*=r;return i[e]=n,n}),CatmullRom:function(e,n,r,i,o){var a=(r-e)*.5,s=(i-n)*.5,u=o*o;return o*u*(2*n-2*r+a+s)+(-3*n+3*r-2*a-s)*u+a*o+n}}},D=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),I=new R,U=function(){function e(e,n){void 0===n&&(n=I),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=N.Linear.None,this._interpolationFunction=T.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=D.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,n){if(void 0===n&&(n=1e3),this._isPlaying)throw Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=n,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,n){if(void 0===e&&(e=j()),void 0===n&&(n=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var r in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,n,r,i,o){for(var a in r){var s=e[a],u=Array.isArray(s),l=u?"array":typeof s,h=!u&&Array.isArray(r[a]);if("undefined"!==l&&"function"!==l){if(h){var c=r[a];if(0===c.length)continue;for(var f=[s],d=0,p=c.length;do)return!1;n&&this.start(e,!0)}if(this._goToEnd=!1,e1?1:i;var a=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(r in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[r]||(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(this._valuesEnd[r])),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,u=this._chainedTweens.length;se.length)&&(n=e.length);for(var r=0,i=Array(n);r0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign({},r instanceof Function?r(e):r,{initialised:!1}),i={};function o(n){return a(n,e),u(),o}var a=function(e,r){c.call(o,e,n,r),n.initialised=!0},u=P(function(){n.initialised&&(d.call(o,n,i),i={})},1);return p.forEach(function(e){var r,a,s,l,h,c,f;o[e.name]=(r=e.name,s=void 0!==(a=e.triggerUpdate)&&a,h=void 0===(l=e.onChange)?function(e,n){}:l,f=void 0===(c=e.defaultVal)?null:c,function(e){var a=n[r];if(!arguments.length)return a;var l=void 0===e?f:e;return n[r]=l,h.call(o,l,n,a),i.hasOwnProperty(r)||(i[r]=a),s&&u(),o})}),Object.keys(s).forEach(function(e){o[e]=function(){for(var r,i=arguments.length,a=Array(i),u=0;u1&&(r-=1),r<1/6)?e+(n-e)*6*r:r<.5?n:r<2/3?e+(n-e)*(2/3-r)*6:e}if(e=tp(e,360),n=tp(n,100),r=tp(r,100),0===n)i=o=a=r;else{var u=r<.5?r*(1+n):r+n-r*n,l=2*r-u;i=s(l,u,e+1/3),o=s(l,u,e),a=s(l,u,e-1/3)}return{r:255*i,g:255*o,b:255*a}}(r.h,a,u),l=!0,h="hsl"),r.hasOwnProperty("a")&&(o=r.a)),o=td(o),{ok:l,format:r.format||h,r:Math.min(255,Math.max(i.r,0)),g:Math.min(255,Math.max(i.g,0)),b:Math.min(255,Math.max(i.b,0)),a:o});this._originalInput=e,this._r=k.r,this._g=k.g,this._b=k.b,this._a=k.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||k.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=k.ok}function X(e,n,r){var i,o,a=Math.max(e=tp(e,255),n=tp(n,255),r=tp(r,255)),s=Math.min(e,n,r),u=(a+s)/2;if(a==s)i=o=0;else{var l=a-s;switch(o=u>.5?l/(2-a-s):l/(a+s),a){case e:i=(n-r)/l+(n>1)+720)%360;--n;)i.h=(i.h+o)%360,a.push($(i));return a}function th(e,n){n=n||6;for(var r=$(e).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/n;n--;)s.push($({h:i,s:o,v:a})),a=(a+u)%1;return s}$.prototype={isDark:function(){return 128>this.getBrightness()},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,n,r,i=this.toRgb();return e=i.r/255,.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*((n=i.g/255)<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*((r=i.b/255)<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=td(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=Q(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=Q(this._r,this._g,this._b),n=Math.round(360*e.h),r=Math.round(100*e.s),i=Math.round(100*e.v);return 1==this._a?"hsv("+n+", "+r+"%, "+i+"%)":"hsva("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=X(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=X(this._r,this._g,this._b),n=Math.round(360*e.h),r=Math.round(100*e.s),i=Math.round(100*e.l);return 1==this._a?"hsl("+n+", "+r+"%, "+i+"%)":"hsla("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return Y(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){var n,r,i,o,a;return n=this._r,r=this._g,i=this._b,o=this._a,a=[tv(Math.round(n).toString(16)),tv(Math.round(r).toString(16)),tv(Math.round(i).toString(16)),tv(tx(o))],e&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*tp(this._r,255))+"%",g:Math.round(100*tp(this._g,255))+"%",b:Math.round(100*tp(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*tp(this._r,255))+"%, "+Math.round(100*tp(this._g,255))+"%, "+Math.round(100*tp(this._b,255))+"%)":"rgba("+Math.round(100*tp(this._r,255))+"%, "+Math.round(100*tp(this._g,255))+"%, "+Math.round(100*tp(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(tf[Y(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var n="#"+J(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(e){var o=$(e);r="#"+J(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(e){var n=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0;return!n&&i&&("hex"===e||"hex6"===e||"hex3"===e||"hex4"===e||"hex8"===e||"name"===e)?"name"===e&&0===this._a?this.toName():this.toRgbString():("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),("hex"===e||"hex6"===e)&&(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return $(this.toString())},_applyModification:function(e,n){var r=e.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(tn,arguments)},brighten:function(){return this._applyModification(tr,arguments)},darken:function(){return this._applyModification(ti,arguments)},desaturate:function(){return this._applyModification(K,arguments)},saturate:function(){return this._applyModification(tt,arguments)},greyscale:function(){return this._applyModification(te,arguments)},spin:function(){return this._applyModification(to,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(tl,arguments)},complement:function(){return this._applyCombination(ta,arguments)},monochromatic:function(){return this._applyCombination(th,arguments)},splitcomplement:function(){return this._applyCombination(tu,arguments)},triad:function(){return this._applyCombination(ts,[3])},tetrad:function(){return this._applyCombination(ts,[4])}},$.fromRatio=function(e,n){if("object"==G(e)){var r={};for(var i in e)e.hasOwnProperty(i)&&("a"===i?r[i]=e[i]:r[i]=t_(e[i]));e=r}return $(e,n)},$.equals=function(e,n){return!!e&&!!n&&$(e).toRgbString()==$(n).toRgbString()},$.random=function(){return $.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},$.mix=function(e,n,r){r=0===r?0:r||50;var i=$(e).toRgb(),o=$(n).toRgb(),a=r/100;return $({r:(o.r-i.r)*a+i.r,g:(o.g-i.g)*a+i.g,b:(o.b-i.b)*a+i.b,a:(o.a-i.a)*a+i.a})},$.readability=function(e,n){var r=$(e),i=$(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},$.isReadable=function(e,n,r){var i,o,a,s,u,l=$.readability(e,n);switch(u=!1,(o=((i=(i=r)||{level:"AA",size:"small"}).level||"AA").toUpperCase(),a=(i.size||"small").toLowerCase(),"AA"!==o&&"AAA"!==o&&(o="AA"),"small"!==a&&"large"!==a&&(a="small"),s={level:o,size:a}).level+s.size){case"AAsmall":case"AAAlarge":u=l>=4.5;break;case"AAlarge":u=l>=3;break;case"AAAsmall":u=l>=7}return u},$.mostReadable=function(e,n,r){var i,o,a,s,u=null,l=0;o=(r=r||{}).includeFallbackColors,a=r.level,s=r.size;for(var h=0;hl&&(l=i,u=$(n[h]));return $.isReadable(e,u,{level:a,size:s})||!o?u:(r.includeFallbackColors=!1,$.mostReadable(e,["#fff","#000"],r))};var tc=$.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},tf=$.hexNames=function(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}(tc);function td(e){return(isNaN(e=parseFloat(e))||e<0||e>1)&&(e=1),e}function tp(e,n){"string"==typeof(r=e)&&-1!=r.indexOf(".")&&1===parseFloat(r)&&(e="100%");var r,i,o="string"==typeof(i=e)&&-1!=i.indexOf("%");return(e=Math.min(n,Math.max(0,parseFloat(e))),o&&(e=parseInt(e*n,10)/100),1e-6>Math.abs(e-n))?1:e%n/parseFloat(n)}function tg(e){return Math.min(1,Math.max(0,e))}function ty(e){return parseInt(e,16)}function tv(e){return 1==e.length?"0"+e:""+e}function t_(e){return e<=1&&(e=100*e+"%"),e}function tx(e){return Math.round(255*parseFloat(e)).toString(16)}var tb=(l="[\\s|\\(]+("+(u="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+u+")[,|\\s]+("+u+")\\s*\\)?",h="[\\s|\\(]+("+u+")[,|\\s]+("+u+")[,|\\s]+("+u+")[,|\\s]+("+u+")\\s*\\)?",{CSS_UNIT:new RegExp(u),rgb:RegExp("rgb"+l),rgba:RegExp("rgba"+h),hsl:RegExp("hsl"+l),hsla:RegExp("hsla"+h),hsv:RegExp("hsv"+l),hsva:RegExp("hsva"+h),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function tm(e){return!!tb.CSS_UNIT.exec(e)}function tw(e,n){for(var r=0;re.length)&&(n=e.length);for(var r=0,i=Array(n);r0&&void 0!==arguments[0]?arguments[0]:6;!function(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}(this,r),this.csBits=e,this.registry=["__reserved for background__"]}return e=[{key:"register",value:function(e){if(this.registry.length>=Math.pow(2,24-this.csBits))return null;var n,r=this.registry.length,i=tA(r,this.csBits),o=(n=r+(i<<24-this.csBits),"#".concat(Math.min(n,16777216).toString(16).padStart(6,"0")));return this.registry.push(e),o}},{key:"lookup",value:function(e){var n="string"==typeof e?tM(e):tz.apply(void 0,function(e){if(Array.isArray(e))return tk(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return tk(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tk(e,n)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());if(!n)return null;var r=n&Math.pow(2,24-this.csBits)-1,i=n>>24-this.csBits&Math.pow(2,this.csBits)-1;return tA(r,this.csBits)!==i||r>=this.registry.length?null:this.registry[r]}}],tw(r.prototype,e),n&&tw(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(),tS=r(5881);function tO(e){return e.x}function tP(e){return e.y}function tE(e){return e.z}var tN=Math.PI*(3-Math.sqrt(5)),tj=20*Math.PI/(9+Math.sqrt(221));function tR(e){return function(){return e}}function tT(e){return(e()-.5)*1e-6}function tD(e){return e.index}function tI(e,n){var r=e.get(n);if(!r)throw Error("node not found: "+n);return r}function tU(e,n,r){if(isNaN(n))return e;var i,o,a,s,u,l,h=e._root,c={data:r},f=e._x0,d=e._x1;if(!h)return e._root=c,e;for(;h.length;)if((s=n>=(o=(f+d)/2))?f=o:d=o,i=h,!(h=h[u=+s]))return i[u]=c,e;if(n===(a=+e._x.call(null,h.data)))return c.next=h,i?i[u]=c:e._root=c,e;do i=i?i[u]=[,,]:e._root=[,,],(s=n>=(o=(f+d)/2))?f=o:d=o;while((u=+s)==(l=+(a>=o)));return i[l]=h,i[u]=c,e}function tF(e,n,r){this.node=e,this.x0=n,this.x1=r}function tL(e){return e[0]}function tB(e,n){var r=new tZ(null==n?tL:n,NaN,NaN);return null==e?r:r.addAll(e)}function tZ(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function tq(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var tH=tB.prototype=tZ.prototype;function tG(e,n,r,i){if(isNaN(n)||isNaN(r))return e;var o,a,s,u,l,h,c,f,d,p=e._root,g={data:i},y=e._x0,v=e._y0,_=e._x1,x=e._y1;if(!p)return e._root=g,e;for(;p.length;)if((h=n>=(a=(y+_)/2))?y=a:_=a,(c=r>=(s=(v+x)/2))?v=s:x=s,o=p,!(p=p[f=c<<1|h]))return o[f]=g,e;if(u=+e._x.call(null,p.data),l=+e._y.call(null,p.data),n===u&&r===l)return g.next=p,o?o[f]=g:e._root=g,e;do o=o?o[f]=[,,,,]:e._root=[,,,,],(h=n>=(a=(y+_)/2))?y=a:_=a,(c=r>=(s=(v+x)/2))?v=s:x=s;while((f=c<<1|h)==(d=(l>=s)<<1|u>=a));return o[d]=p,o[f]=g,e}function tV(e,n,r,i,o){this.node=e,this.x0=n,this.y0=r,this.x1=i,this.y1=o}function tW(e){return e[0]}function t$(e){return e[1]}function tX(e,n,r){var i=new tQ(null==n?tW:n,null==r?t$:r,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function tQ(e,n,r,i,o,a){this._x=e,this._y=n,this._x0=r,this._y0=i,this._x1=o,this._y1=a,this._root=void 0}function tY(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}tH.copy=function(){var e,n,r=new tZ(this._x,this._x0,this._x1),i=this._root;if(!i)return r;if(!i.length)return r._root=tq(i),r;for(e=[{source:i,target:r._root=[,,]}];i=e.pop();)for(var o=0;o<2;++o)(n=i.source[o])&&(n.length?e.push({source:n,target:i.target[o]=[,,]}):i.target[o]=tq(n));return r},tH.add=function(e){let n=+this._x.call(null,e);return tU(this.cover(n),n,e)},tH.addAll=function(e){Array.isArray(e)||(e=Array.from(e));let n=e.length,r=new Float64Array(n),i=1/0,o=-1/0;for(let a=0,s;ao&&(o=s));if(i>o)return this;this.cover(i).cover(o);for(let i=0;ie||e>=r;)switch(o=+(el)&&!((o=a.x1)=f))&&(a=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=a)}else{var d=Math.abs(e-+this._x.call(null,c.data));d=(s=(f+d)/2))?f=s:d=s,n=c,!(c=c[l=+u]))return this;if(!c.length)break;n[l+1&1]&&(r=n,h=l)}for(;c.data!==e;)if(i=c,!(c=c.next))return this;return((o=c.next)&&delete c.next,i)?o?i.next=o:delete i.next:n?(o?n[l]=o:delete n[l],(c=n[0]||n[1])&&c===(n[1]||n[0])&&!c.length&&(r?r[h]=c:this._root=c)):this._root=o,this},tH.removeAll=function(e){for(var n=0,r=e.length;n=(s=(b+k)/2))?b=s:k=s,(p=r>=(u=(m+z)/2))?m=u:z=u,(g=i>=(l=(w+M)/2))?w=l:M=l,a=_,!(_=_[y=g<<2|p<<1|d]))return a[y]=x,e;if(h=+e._x.call(null,_.data),c=+e._y.call(null,_.data),f=+e._z.call(null,_.data),n===h&&r===c&&i===f)return x.next=_,a?a[y]=x:e._root=x,e;do a=a?a[y]=Array(8):e._root=Array(8),(d=n>=(s=(b+k)/2))?b=s:k=s,(p=r>=(u=(m+z)/2))?m=u:z=u,(g=i>=(l=(w+M)/2))?w=l:M=l;while((y=g<<2|p<<1|d)==(v=(f>=l)<<2|(c>=u)<<1|h>=s));return a[v]=_,a[y]=x,e}function t0(e,n,r,i,o,a,s){this.node=e,this.x0=n,this.y0=r,this.z0=i,this.x1=o,this.y1=a,this.z1=s}function t1(e){return e[0]}function t2(e){return e[1]}function t5(e){return e[2]}function t3(e,n,r,i){var o=new t6(null==n?t1:n,null==r?t2:r,null==i?t5:i,NaN,NaN,NaN,NaN,NaN,NaN);return null==e?o:o.addAll(e)}function t6(e,n,r,i,o,a,s,u,l){this._x=e,this._y=n,this._z=r,this._x0=i,this._y0=o,this._z0=a,this._x1=s,this._y1=u,this._z1=l,this._root=void 0}function t8(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}tJ.copy=function(){var e,n,r=new tQ(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return r;if(!i.length)return r._root=tY(i),r;for(e=[{source:i,target:r._root=[,,,,]}];i=e.pop();)for(var o=0;o<4;++o)(n=i.source[o])&&(n.length?e.push({source:n,target:i.target[o]=[,,,,]}):i.target[o]=tY(n));return r},tJ.add=function(e){let n=+this._x.call(null,e),r=+this._y.call(null,e);return tG(this.cover(n,r),n,r,e)},tJ.addAll=function(e){var n,r,i,o,a=e.length,s=Array(a),u=Array(a),l=1/0,h=1/0,c=-1/0,f=-1/0;for(r=0;rc&&(c=i),of&&(f=o));if(l>c||h>f)return this;for(this.cover(l,h).cover(c,f),r=0;re||e>=o||i>n||n>=a;)switch(u=(nd)&&!((a=l.y0)>p)&&!((s=l.x1)=_)<<1|e>=v)&&(l=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=l)}else{var x=e-+this._x.call(null,y.data),b=n-+this._y.call(null,y.data),m=x*x+b*b;if(m=(u=(g+v)/2))?g=u:v=u,(c=s>=(l=(y+_)/2))?y=l:_=l,n=p,!(p=p[f=c<<1|h]))return this;if(!p.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(r=n,d=f)}for(;p.data!==e;)if(i=p,!(p=p.next))return this;return((o=p.next)&&delete p.next,i)?o?i.next=o:delete i.next:n?(o?n[f]=o:delete n[f],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(r?r[d]=p:this._root=p)):this._root=o,this},tJ.removeAll=function(e){for(var n=0,r=e.length;nl&&(l=p),gh&&(h=g),y