=x&&(x=m+1);!(b=y[x])&&++x=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=Wt);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?rn:"function"==typeof n?an:on)(t,n,null==e?"":e)):un(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?cn:"function"==typeof n?sn:fn)(t,n)):this.node()[t]},classed:function(t,n){var e=ln(t+"");if(arguments.length<2){for(var r=hn(this.node()),i=-1,o=e.length;++i()=>t;function Jn(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:c,dy:f,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:s}})}function te(t){return!t.ctrlKey&&!t.button}function ne(){return this.parentNode}function ee(t,n){return null==n?{x:t.x,y:t.y}:n}function re(){return navigator.maxTouchPoints||"ontouchstart"in this}function ie(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function oe(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ae(){}Jn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ue=.7,ce=1/ue,fe="\\s*([+-]?\\d+)\\s*",se="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",le="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",he=/^#([0-9a-f]{3,8})$/,de=new RegExp("^rgb\\("+[fe,fe,fe]+"\\)$"),pe=new RegExp("^rgb\\("+[le,le,le]+"\\)$"),ge=new RegExp("^rgba\\("+[fe,fe,fe,se]+"\\)$"),ye=new RegExp("^rgba\\("+[le,le,le,se]+"\\)$"),ve=new RegExp("^hsl\\("+[se,le,le]+"\\)$"),_e=new RegExp("^hsla\\("+[se,le,le,se]+"\\)$"),be={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};function me(){return this.rgb().formatHex()}function xe(){return this.rgb().formatRgb()}function we(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=he.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Me(n):3===e?new Ee(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Ae(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Ae(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=de.exec(t))?new Ee(n[1],n[2],n[3],1):(n=pe.exec(t))?new Ee(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=ge.exec(t))?Ae(n[1],n[2],n[3],n[4]):(n=ye.exec(t))?Ae(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=ve.exec(t))?Pe(n[1],n[2]/100,n[3]/100,1):(n=_e.exec(t))?Pe(n[1],n[2]/100,n[3]/100,n[4]):be.hasOwnProperty(t)?Me(be[t]):"transparent"===t?new Ee(NaN,NaN,NaN,0):null}function Me(t){return new Ee(t>>16&255,t>>8&255,255&t,1)}function Ae(t,n,e,r){return r<=0&&(t=n=e=NaN),new Ee(t,n,e,r)}function Te(t){return t instanceof ae||(t=we(t)),t?new Ee((t=t.rgb()).r,t.g,t.b,t.opacity):new Ee}function Se(t,n,e,r){return 1===arguments.length?Te(t):new Ee(t,n,e,null==r?1:r)}function Ee(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function ke(){return"#"+Ce(this.r)+Ce(this.g)+Ce(this.b)}function Ne(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Ce(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Pe(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new qe(t,n,e,r)}function ze(t){if(t instanceof qe)return new qe(t.h,t.s,t.l,t.opacity);if(t instanceof ae||(t=we(t)),!t)return new qe;if(t instanceof qe)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e0&&c<1?0:a,new qe(a,u,c,t.opacity)}function De(t,n,e,r){return 1===arguments.length?ze(t):new qe(t,n,e,null==r?1:r)}function qe(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Re(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}ie(ae,we,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:me,formatHex:me,formatHsl:function(){return ze(this).formatHsl()},formatRgb:xe,toString:xe}),ie(Ee,Se,oe(ae,{brighter:function(t){return t=null==t?ce:Math.pow(ce,t),new Ee(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?ue:Math.pow(ue,t),new Ee(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:ke,formatHex:ke,formatRgb:Ne,toString:Ne})),ie(qe,De,oe(ae,{brighter:function(t){return t=null==t?ce:Math.pow(ce,t),new qe(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ue:Math.pow(ue,t),new qe(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Ee(Re(t>=240?t-240:t+120,i,r),Re(t,i,r),Re(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const Fe=Math.PI/180,Oe=180/Math.PI,Ie=.96422,Ue=.82521,Be=4/29,Ye=6/29,Le=3*Ye*Ye;function je(t){if(t instanceof Xe)return new Xe(t.l,t.a,t.b,t.opacity);if(t instanceof Qe)return Je(t);t instanceof Ee||(t=Te(t));var n,e,r=We(t.r),i=We(t.g),o=We(t.b),a=Ge((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=a:(n=Ge((.4360747*r+.3850649*i+.1430804*o)/Ie),e=Ge((.0139322*r+.0971045*i+.7141733*o)/Ue)),new Xe(116*a-16,500*(n-a),200*(a-e),t.opacity)}function He(t,n,e,r){return 1===arguments.length?je(t):new Xe(t,n,e,null==r?1:r)}function Xe(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Ge(t){return t>.008856451679035631?Math.pow(t,1/3):t/Le+Be}function Ve(t){return t>Ye?t*t*t:Le*(t-Be)}function $e(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function We(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ze(t){if(t instanceof Qe)return new Qe(t.h,t.c,t.l,t.opacity);if(t instanceof Xe||(t=je(t)),0===t.a&&0===t.b)return new Qe(NaN,0=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r()=>t;function gr(t,n){return function(e){return t+e*n}}function yr(t,n){var e=n-t;return e?gr(t,e>180||e<-180?e-360*Math.round(e/360):e):pr(isNaN(t)?n:t)}function vr(t){return 1==(t=+t)?_r:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):pr(isNaN(n)?e:n)}}function _r(t,n){var e=n-t;return e?gr(t,e):pr(isNaN(t)?n:t)}var br=function t(n){var e=vr(n);function r(t,n){var r=e((t=Se(t)).r,(n=Se(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=_r(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function mr(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;eo&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Er(e,r)})),o=Cr.lastIndex;return o180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Er(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Er(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Er(t,e)},{i:u-2,x:Er(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e=0&&n._call.call(void 0,t),n=n._next;--ni}function pi(){oi=(ii=ui.now())+ai,ni=ei=0;try{di()}finally{ni=0,function(){var t,n,e=Jr,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Jr=n);ti=t,yi(r)}(),oi=0}}function gi(){var t=ui.now(),n=t-ii;n>1e3&&(ai-=n,ii=t)}function yi(t){ni||(ei&&(ei=clearTimeout(ei)),t-oi>24?(t<1/0&&(ei=setTimeout(pi,t-ui.now()-ai)),ri&&(ri=clearInterval(ri))):(ri||(ii=ui.now(),ri=setInterval(gi,1e3)),ni=1,ci(pi)))}function vi(t,n,e){var r=new li;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}li.prototype=hi.prototype={constructor:li,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?fi():+e)+(null==n?0:+n),this._next||ti===this||(ti?ti._next=this:Jr=this,ti=this),this._call=t,this._time=e,yi()},stop:function(){this._call&&(this._call=null,this._time=1/0,yi())}};var _i=mt("start","end","cancel","interrupt"),bi=[];function mi(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(t){e.state=1,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var f,s,l,h;if(1!==e.state)return c();for(f in i)if((h=i[f]).name===e.name){if(3===h.state)return vi(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+f0)throw new Error("too late; already scheduled");return e}function wi(t,n){var e=Mi(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Mi(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Ai(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Ti(t,n){var e,r;return function(){var i=wi(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?xi:wi;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var Xi=Un.prototype.constructor;function Gi(t){return function(){this.style.removeProperty(t)}}function Vi(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function $i(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&Vi(t,o,e)),r}return o._value=n,o}function Wi(t){return function(n){this.textContent=t.call(this,n)}}function Zi(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&Wi(r)),n}return r._value=t,r}var Ki=0;function Qi(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Ji(t){return Un().transition(t)}function to(){return++Ki}var no=Un.prototype;Qi.prototype=Ji.prototype={constructor:Qi,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=zt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>t;function No(t,{sourceEvent:n,target:e,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Co(t){t.stopImmediatePropagation()}function Po(t){t.preventDefault(),t.stopImmediatePropagation()}var zo={name:"drag"},Do={name:"space"},qo={name:"handle"},Ro={name:"center"};const{abs:Fo,max:Oo,min:Io}=Math;function Uo(t){return[+t[0],+t[1]]}function Bo(t){return[Uo(t[0]),Uo(t[1])]}var Yo={name:"x",handles:["w","e"].map(Wo),input:function(t,n){return null==t?null:[[+t[0],n[0][1]],[+t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Lo={name:"y",handles:["n","s"].map(Wo),input:function(t,n){return null==t?null:[[n[0][0],+t[0]],[n[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},jo={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Wo),input:function(t){return null==t?null:Bo(t)},output:function(t){return t}},Ho={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Xo={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Go={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Vo={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},$o={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Wo(t){return{type:t}}function Zo(t){return!t.ctrlKey&&!t.button}function Ko(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Qo(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jo(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function ta(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function na(t){var n,e=Ko,r=Zo,i=Qo,o=!0,a=mt("start","brush","end"),u=6;function c(n){var e=n.property("__brush",g).selectAll(".overlay").data([Wo("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Ho.overlay).merge(e).each((function(){var t=Jo(this).extent;Bn(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),n.selectAll(".selection").data([Wo("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Ho.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=n.selectAll(".handle").data(t.handles,(function(t){return t.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return Ho[t.type]})),n.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(i).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){var t=Bn(this),n=Jo(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?n[1][0]-u/2:n[0][0]-u/2})).attr("y",(function(t){return"s"===t.type[0]?n[1][1]-u/2:n[0][1]-u/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+u:u})).attr("height",(function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+u:u}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(t,n,e){var r=t.__brush.emitter;return!r||e&&r.clean?new l(t,n,e):r}function l(t,n,e){this.that=t,this.args=n,this.state=t.__brush,this.active=0,this.clean=e}function h(e){if((!n||e.touches)&&r.apply(this,arguments)){var i,a,u,c,l,h,d,p,g,y,v,_=this,b=e.target.__data__.type,m="selection"===(o&&e.metaKey?b="overlay":b)?zo:o&&e.altKey?Ro:qo,x=t===Lo?null:Vo[b],w=t===Yo?null:$o[b],M=Jo(_),A=M.extent,T=M.selection,S=A[0][0],E=A[0][1],k=A[1][0],N=A[1][1],C=0,P=0,z=x&&w&&o&&e.shiftKey,D=Array.from(e.touches||[e],(t=>{const n=t.identifier;return(t=Xn(t,_)).point0=t.slice(),t.identifier=n,t}));Ai(_);var q=s(_,arguments,!0).beforestart();if("overlay"===b){T&&(g=!0);const n=[D[0],D[1]||D[0]];M.selection=T=[[i=t===Lo?S:Io(n[0][0],n[1][0]),u=t===Yo?E:Io(n[0][1],n[1][1])],[l=t===Lo?k:Oo(n[0][0],n[1][0]),d=t===Yo?N:Oo(n[0][1],n[1][1])]],D.length>1&&U(e)}else i=T[0][0],u=T[0][1],l=T[1][0],d=T[1][1];a=i,c=u,h=l,p=d;var R=Bn(_).attr("pointer-events","none"),F=R.selectAll(".overlay").attr("cursor",Ho[b]);if(e.touches)q.moved=I,q.ended=B;else{var O=Bn(e.view).on("mousemove.brush",I,!0).on("mouseup.brush",B,!0);o&&O.on("keydown.brush",Y,!0).on("keyup.brush",L,!0),Zn(e.view)}f.call(_),q.start(e,m.name)}function I(t){for(const n of t.changedTouches||[t])for(const t of D)t.identifier===n.identifier&&(t.cur=Xn(n,_));if(z&&!y&&!v&&1===D.length){const t=D[0];Fo(t.cur[0]-t[0])>Fo(t.cur[1]-t[1])?v=!0:y=!0}for(const t of D)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);g=!0,Po(t),U(t)}function U(t){const n=D[0],e=n.point0;var r;switch(C=n[0]-e[0],P=n[1]-e[1],m){case Do:case zo:x&&(C=Oo(S-i,Io(k-l,C)),a=i+C,h=l+C),w&&(P=Oo(E-u,Io(N-d,P)),c=u+P,p=d+P);break;case qo:D[1]?(x&&(a=Oo(S,Io(k,D[0][0])),h=Oo(S,Io(k,D[1][0])),x=1),w&&(c=Oo(E,Io(N,D[0][1])),p=Oo(E,Io(N,D[1][1])),w=1)):(x<0?(C=Oo(S-i,Io(k-i,C)),a=i+C,h=l):x>0&&(C=Oo(S-l,Io(k-l,C)),a=i,h=l+C),w<0?(P=Oo(E-u,Io(N-u,P)),c=u+P,p=d):w>0&&(P=Oo(E-d,Io(N-d,P)),c=u,p=d+P));break;case Ro:x&&(a=Oo(S,Io(k,i-C*x)),h=Oo(S,Io(k,l+C*x))),w&&(c=Oo(E,Io(N,u-P*w)),p=Oo(E,Io(N,d+P*w)))}h0&&(i=a-C),w<0?d=p-P:w>0&&(u=c-P),m=Do,F.attr("cursor",Ho.selection),U(t));break;default:return}Po(t)}function L(t){switch(t.keyCode){case 16:z&&(y=v=z=!1,U(t));break;case 18:m===Ro&&(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=qo,U(t));break;case 32:m===Do&&(t.altKey?(x&&(l=h-C*x,i=a+C*x),w&&(d=p-P*w,u=c+P*w),m=Ro):(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=qo),F.attr("cursor",Ho[b]),U(t));break;default:return}Po(t)}}function d(t){s(this,arguments).moved(t)}function p(t){s(this,arguments).ended(t)}function g(){var n=this.__brush||{selection:null};return n.extent=Bo(e.apply(this,arguments)),n.dim=t,n}return c.move=function(n,e,r){n.tween?n.on("start.brush",(function(t){s(this,arguments).beforestart().start(t)})).on("interrupt.brush end.brush",(function(t){s(this,arguments).end(t)})).tween("brush",(function(){var n=this,r=n.__brush,i=s(n,arguments),o=r.selection,a=t.input("function"==typeof e?e.apply(this,arguments):e,r.extent),u=zr(o,a);function c(t){r.selection=1===t&&null===a?null:u(t),f.call(n),i.brush()}return null!==o&&null!==a?c:c(1)})):n.each((function(){var n=this,i=arguments,o=n.__brush,a=t.input("function"==typeof e?e.apply(n,i):e,o.extent),u=s(n,i).beforestart();Ai(n),o.selection=null===a?null:a,f.call(n),u.start(r).brush(r).end(r)}))},c.clear=function(t,n){c.move(t,null,n)},l.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,n){return this.starting?(this.starting=!1,this.emit("start",t,n)):this.emit("brush",t),this},brush:function(t,n){return this.emit("brush",t,n),this},end:function(t,n){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t,n)),this},emit:function(n,e,r){var i=Bn(this.that).datum();a.call(n,this.that,new No(n,{sourceEvent:e,target:c,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},c.extent=function(t){return arguments.length?(e="function"==typeof t?t:ko(Bo(t)),c):e},c.filter=function(t){return arguments.length?(r="function"==typeof t?t:ko(!!t),c):r},c.touchable=function(t){return arguments.length?(i="function"==typeof t?t:ko(!!t),c):i},c.handleSize=function(t){return arguments.length?(u=+t,c):u},c.keyModifiers=function(t){return arguments.length?(o=!!t,c):o},c.on=function(){var t=a.on.apply(a,arguments);return t===a?c:t},c}var ea=Math.abs,ra=Math.cos,ia=Math.sin,oa=Math.PI,aa=oa/2,ua=2*oa,ca=Math.max,fa=1e-12;function sa(t,n){return Array.from({length:n-t},((n,e)=>t+e))}function la(t){return function(n,e){return t(n.source.value+n.target.value,e.source.value+e.target.value)}}function ha(t,n){var e=0,r=null,i=null,o=null;function a(a){var u,c=a.length,f=new Array(c),s=sa(0,c),l=new Array(c*c),h=new Array(c),d=0;a=Float64Array.from({length:c*c},n?(t,n)=>a[n%c][n/c|0]:(t,n)=>a[n/c|0][n%c]);for(let n=0;nr(f[t],f[n])));for(const e of s){const r=n;if(t){const t=sa(1+~c,c).filter((t=>t<0?a[~t*c+e]:a[e*c+t]));i&&t.sort(((t,n)=>i(t<0?-a[~t*c+e]:a[e*c+t],n<0?-a[~n*c+e]:a[e*c+n])));for(const r of t)if(r<0){(l[~r*c+e]||(l[~r*c+e]={source:null,target:null})).target={index:e,startAngle:n,endAngle:n+=a[~r*c+e]*d,value:a[~r*c+e]}}else{(l[e*c+r]||(l[e*c+r]={source:null,target:null})).source={index:e,startAngle:n,endAngle:n+=a[e*c+r]*d,value:a[e*c+r]}}h[e]={index:e,startAngle:r,endAngle:n,value:f[e]}}else{const t=sa(0,c).filter((t=>a[e*c+t]||a[t*c+e]));i&&t.sort(((t,n)=>i(a[e*c+t],a[e*c+n])));for(const r of t){let t;if(ega)if(Math.abs(s*u-c*f)>ga&&i){var h=e-o,d=r-a,p=u*u+c*c,g=h*h+d*d,y=Math.sqrt(p),v=Math.sqrt(l),_=i*Math.tan((da-Math.acos((p+l-g)/(2*y*v)))/2),b=_/v,m=_/y;Math.abs(b-1)>ga&&(this._+="L"+(t+b*f)+","+(n+b*s)),this._+="A"+i+","+i+",0,0,"+ +(s*h>f*d)+","+(this._x1=t+m*u)+","+(this._y1=n+m*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,o=!!o;var a=(e=+e)*Math.cos(r),u=e*Math.sin(r),c=t+a,f=n+u,s=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+f:(Math.abs(this._x1-c)>ga||Math.abs(this._y1-f)>ga)&&(this._+="L"+c+","+f),e&&(l<0&&(l=l%pa+pa),l>ya?this._+="A"+e+","+e+",0,1,"+s+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+s+","+(this._x1=c)+","+(this._y1=f):l>ga&&(this._+="A"+e+","+e+",0,"+ +(l>=da)+","+s+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var ba=Array.prototype.slice;function ma(t){return function(){return t}}function xa(t){return t.source}function wa(t){return t.target}function Ma(t){return t.radius}function Aa(t){return t.startAngle}function Ta(t){return t.endAngle}function Sa(){return 0}function Ea(){return 10}function ka(t){var n=xa,e=wa,r=Ma,i=Ma,o=Aa,a=Ta,u=Sa,c=null;function f(){var f,s=n.apply(this,arguments),l=e.apply(this,arguments),h=u.apply(this,arguments)/2,d=ba.call(arguments),p=+r.apply(this,(d[0]=s,d)),g=o.apply(this,d)-aa,y=a.apply(this,d)-aa,v=+i.apply(this,(d[0]=l,d)),_=o.apply(this,d)-aa,b=a.apply(this,d)-aa;if(c||(c=f=_a()),h>fa&&(ea(y-g)>2*h+fa?y>g?(g+=h,y-=h):(g-=h,y+=h):g=y=(g+y)/2,ea(b-_)>2*h+fa?b>_?(_+=h,b-=h):(_-=h,b+=h):_=b=(_+b)/2),c.moveTo(p*ra(g),p*ia(g)),c.arc(0,0,p,g,y),g!==_||y!==b)if(t){var m=+t.apply(this,arguments),x=v-m,w=(_+b)/2;c.quadraticCurveTo(0,0,x*ra(_),x*ia(_)),c.lineTo(v*ra(w),v*ia(w)),c.lineTo(x*ra(b),x*ia(b))}else c.quadraticCurveTo(0,0,v*ra(_),v*ia(_)),c.arc(0,0,v,_,b);if(c.quadraticCurveTo(0,0,p*ra(g),p*ia(g)),c.closePath(),f)return c=null,f+""||null}return t&&(f.headRadius=function(n){return arguments.length?(t="function"==typeof n?n:ma(+n),f):t}),f.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:ma(+t),f):r},f.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:ma(+t),f):r},f.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:ma(+t),f):i},f.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:ma(+t),f):o},f.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:ma(+t),f):a},f.padAngle=function(t){return arguments.length?(u="function"==typeof t?t:ma(+t),f):u},f.source=function(t){return arguments.length?(n=t,f):n},f.target=function(t){return arguments.length?(e=t,f):e},f.context=function(t){return arguments.length?(c=null==t?null:t,f):c},f}var Na=Array.prototype.slice;function Ca(t,n){return t-n}var Pa=t=>()=>t;function za(t,n){for(var e,r=-1,i=n.length;++rr!=d>r&&e<(h-f)*(r-s)/(d-s)+f&&(i=-i)}return i}function qa(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function Ra(){}var Fa=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Oa(){var t=1,n=1,e=H,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(Ca);else{const e=g(t),r=L(e[0],e[1],n);n=B(Math.floor(e[0]/r)*r,Math.floor(e[1]/r-1)*r,n)}return n.map((n=>o(t,n)))}function o(e,i){var o=[],u=[];return function(e,r,i){var o,u,c,f,s,l,h=new Array,d=new Array;o=u=-1,f=e[0]>=r,Fa[f<<1].forEach(p);for(;++o=r,Fa[c|f<<1].forEach(p);Fa[f<<0].forEach(p);for(;++u=r,s=e[u*t]>=r,Fa[f<<1|s<<2].forEach(p);++o=r,l=s,s=e[u*t+o+1]>=r,Fa[c|f<<1|s<<2|l<<3].forEach(p);Fa[f|s<<3].forEach(p)}o=-1,s=e[u*t]>=r,Fa[s<<2].forEach(p);for(;++o=r,Fa[s<<2|l<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+o,t[0][1]+u],c=[t[1][0]+o,t[1][1]+u],f=a(r),s=a(c);(n=d[f])?(e=h[s])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(c),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(c),d[n.end=s]=n):(n=h[s])?(e=d[f])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(c),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=f]=n):h[f]=d[s]={start:f,end:s,ring:[r,c]}}Fa[s<<3].forEach(p)}(e,i,(function(t){r(t,e,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n0?o.push([t]):u.push(t)})),u.forEach((function(t){for(var n,e=0,r=o.length;e0&&a0&&u=0&&o>=0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?Pa(Na.call(t)):Pa(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:Ra,i):r===u},i}function Ia(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a=e&&(u>=o&&(c-=t.data[u-o+a*r]),n.data[u-e+a*r]=c/Math.min(u+1,r-1+o-u,o))}function Ua(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a=e&&(u>=o&&(c-=t.data[a+(u-o)*r]),n.data[a+(u-e)*r]=c/Math.min(u+1,i-1+o-u,o))}function Ba(t){return t[0]}function Ya(t){return t[1]}function La(){return 1}const ja=134217729;function Ha(t,n,e,r,i){let o,a,u,c,f=n[0],s=r[0],l=0,h=0;s>f==s>-f?(o=f,f=n[++l]):(o=s,s=r[++h]);let d=0;if(lf==s>-f?(a=f+o,u=o-(a-f),f=n[++l]):(a=s+o,u=o-(a-s),s=r[++h]),o=a,0!==u&&(i[d++]=u);lf==s>-f?(a=o+f,c=a-o,u=o-(a-c)+(f-c),f=n[++l]):(a=o+s,c=a-o,u=o-(a-c)+(s-c),s=r[++h]),o=a,0!==u&&(i[d++]=u);for(;l0!=u>0)return c;const f=Math.abs(a+u);return Math.abs(c)>=33306690738754716e-32*f?c:-function(t,n,e,r,i,o,a){let u,c,f,s,l,h,d,p,g,y,v,_,b,m,x,w,M,A;const T=t-i,S=e-i,E=n-o,k=r-o;m=T*k,h=ja*T,d=h-(h-T),p=T-d,h=ja*k,g=h-(h-k),y=k-g,x=p*y-(m-d*g-p*g-d*y),w=E*S,h=ja*E,d=h-(h-E),p=E-d,h=ja*S,g=h-(h-S),y=S-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,Ga[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,Ga[1]=b-(v+l)+(l-w),A=_+v,l=A-_,Ga[2]=_-(A-l)+(v-l),Ga[3]=A;let N=function(t,n){let e=n[0];for(let r=1;r=C||-N>=C)return N;if(l=t-T,u=t-(T+l)+(l-i),l=e-S,f=e-(S+l)+(l-i),l=n-E,c=n-(E+l)+(l-o),l=r-k,s=r-(k+l)+(l-o),0===u&&0===c&&0===f&&0===s)return N;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(N),N+=T*s+k*u-(E*f+S*c),N>=C||-N>=C)return N;m=u*k,h=ja*u,d=h-(h-u),p=u-d,h=ja*k,g=h-(h-k),y=k-g,x=p*y-(m-d*g-p*g-d*y),w=c*S,h=ja*c,d=h-(h-c),p=c-d,h=ja*S,g=h-(h-S),y=S-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,Za[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,Za[1]=b-(v+l)+(l-w),A=_+v,l=A-_,Za[2]=_-(A-l)+(v-l),Za[3]=A;const P=Ha(4,Ga,4,Za,Va);m=T*s,h=ja*T,d=h-(h-T),p=T-d,h=ja*s,g=h-(h-s),y=s-g,x=p*y-(m-d*g-p*g-d*y),w=E*f,h=ja*E,d=h-(h-E),p=E-d,h=ja*f,g=h-(h-f),y=f-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,Za[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,Za[1]=b-(v+l)+(l-w),A=_+v,l=A-_,Za[2]=_-(A-l)+(v-l),Za[3]=A;const z=Ha(P,Va,4,Za,$a);m=u*s,h=ja*u,d=h-(h-u),p=u-d,h=ja*s,g=h-(h-s),y=s-g,x=p*y-(m-d*g-p*g-d*y),w=c*f,h=ja*c,d=h-(h-c),p=c-d,h=ja*f,g=h-(h-f),y=f-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,Za[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,Za[1]=b-(v+l)+(l-w),A=_+v,l=A-_,Za[2]=_-(A-l)+(v-l),Za[3]=A;const D=Ha(z,$a,4,Za,Wa);return Wa[D-1]}(t,n,e,r,i,o,f)}const Qa=Math.pow(2,-52),Ja=new Uint32Array(512);class tu{static from(t,n=au,e=uu){const r=t.length,i=new Float64Array(2*r);for(let o=0;o>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,c=-1/0,f=-1/0;for(let n=0;nc&&(c=e),r>f&&(f=r),this._ids[n]=n}const s=(a+c)/2,l=(u+f)/2;let h,d,p,g=1/0;for(let n=0;n0&&(d=n,g=e)}let _=t[2*d],b=t[2*d+1],m=1/0;for(let n=0;nr&&(n[e++]=i,r=this._dists[i])}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Ka(y,v,_,b,x,w)<0){const t=d,n=_,e=b;d=p,_=x,b=w,p=t,x=n,w=e}const M=function(t,n,e,r,i,o){const a=e-t,u=r-n,c=i-t,f=o-n,s=a*a+u*u,l=c*c+f*f,h=.5/(a*f-u*c);return{x:t+(f*s-u*l)*h,y:n+(a*l-c*s)*h}}(y,v,_,b,x,w);this._cx=M.x,this._cy=M.y;for(let n=0;n0&&Math.abs(f-o)<=Qa&&Math.abs(s-a)<=Qa)continue;if(o=f,a=s,c===h||c===d||c===p)continue;let l=0;for(let t=0,n=this._hashKey(f,s);t=0;)if(y=g,y===l){y=-1;break}if(-1===y)continue;let v=this._addTriangle(y,c,e[y],-1,-1,r[y]);r[c]=this._legalize(v+2),r[y]=v,A++;let _=e[y];for(;g=e[_],Ka(f,s,t[2*_],t[2*_+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(_,c,g,r[c],-1,r[_]),r[c]=this._legalize(v+2),e[_]=_,A--,_=g;if(y===l)for(;g=n[y],Ka(f,s,t[2*g],t[2*g+1],t[2*y],t[2*y+1])<0;)v=this._addTriangle(g,c,y,-1,r[y],r[g]),this._legalize(v+2),r[g]=v,e[y]=y,A--,y=g;this._hullStart=n[c]=y,e[y]=n[_]=c,e[c]=_,i[this._hashKey(f,s)]=c,i[this._hashKey(t[2*y],t[2*y+1])]=y}this.hull=new Uint32Array(A);for(let t=0,n=this._hullStart;t0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,o=0;for(;;){const a=e[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=Ja[--i];continue}const c=a-a%3,f=u+(t+1)%3,s=c+(a+2)%3,l=n[o],h=n[t],d=n[f],p=n[s];if(eu(r[2*l],r[2*l+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){n[t]=p,n[a]=l;const r=e[s];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===s){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(a,e[o]),this._link(o,s);const u=c+(a+1)%3;i=e&&n[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=e+1,o=r;ou(t,e+r>>1,i),n[t[e]]>n[t[r]]&&ou(t,e,r),n[t[i]]>n[t[r]]&&ou(t,i,r),n[t[e]]>n[t[i]]&&ou(t,e,i);const a=t[i],u=n[a];for(;;){do{i++}while(n[t[i]]