@hema-to/regl-scatterplot 1.14.1-hemato.2 → 1.14.1-hemato.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5467,7 +5467,7 @@ const createSplineCurve = (
5467
5467
  worker$1.postMessage({ points, options });
5468
5468
  });
5469
5469
 
5470
- var version = "1.14.1-hemato.2";
5470
+ var version = "1.14.1-hemato.3";
5471
5471
 
5472
5472
  const deprecations = {
5473
5473
  showRecticle: {
@@ -6186,7 +6186,7 @@ const createScatterplot = (
6186
6186
  setPointConnectionColorState(selectedPoints, 1);
6187
6187
 
6188
6188
  if (!preventEvent) {
6189
- pubSub.publish('select', { points: selectedPoints });
6189
+ pubSub.publish('select', { points: selectedPoints, lassoMode });
6190
6190
  }
6191
6191
 
6192
6192
  draw = true;
@@ -5417,7 +5417,7 @@ void main() {
5417
5417
  });
5418
5418
  };
5419
5419
 
5420
- var version = "1.14.1-hemato.2";
5420
+ var version = "1.14.1-hemato.3";
5421
5421
 
5422
5422
  var deprecations = {
5423
5423
  showRecticle: {
@@ -6118,7 +6118,8 @@ void main() {
6118
6118
  setPointConnectionColorState(selectedPoints, 1);
6119
6119
  if (!preventEvent) {
6120
6120
  pubSub.publish('select', {
6121
- points: selectedPoints
6121
+ points: selectedPoints,
6122
+ lassoMode: lassoMode
6122
6123
  });
6123
6124
  }
6124
6125
  draw = true;
@@ -5,4 +5,4 @@
5
5
  * @copyright Vladimir Agafonkin 2018
6
6
  * @version 4.0.2
7
7
  * @see https://github.com/mourner/kdbush/
8
- */var de,ve=function(){var e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],n=function(){function n(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,i=arguments.length>3?arguments[3]:void 0;if(function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),isNaN(t)||t<0)throw new Error("Unexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;var a=e.indexOf(this.ArrayType),c=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(o,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+c+l+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+a]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}return r=n,i=[{key:"from",value:function(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var r=v(new Uint8Array(t,0,2),2),o=r[0],i=r[1];if(219!==o)throw new Error("Data does not appear to be in a KDBush format.");var a=i>>4;if(1!==a)throw new Error("Got v".concat(a," data when expected v").concat(1,"."));var c=e[15&i];if(!c)throw new Error("Unrecognized array type.");var l=v(new Uint16Array(t,2,1),1)[0];return new n(v(new Uint32Array(t,4,1),1)[0],l,c,t)}}],(o=[{key:"add",value:function(e,n){var t=this._pos>>1;return this.ids[t]=t,this.coords[this._pos++]=e,this.coords[this._pos++]=n,t}},{key:"finish",value:function(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return t(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}},{key:"range",value:function(e,n,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var o=this.ids,i=this.coords,a=this.nodeSize,c=[0,o.length-1,0],l=[];c.length;){var s=c.pop()||0,u=c.pop()||0,f=c.pop()||0;if(u-f<=a)for(var d=f;d<=u;d++){var v=i[2*d],h=i[2*d+1];v>=e&&v<=t&&h>=n&&h<=r&&l.push(o[d])}else{var p=f+u>>1,y=i[2*p],m=i[2*p+1];y>=e&&y<=t&&m>=n&&m<=r&&l.push(o[p]),(0===s?e<=y:n<=m)&&(c.push(f),c.push(p-1),c.push(1-s)),(0===s?t>=y:r>=m)&&(c.push(p+1),c.push(u),c.push(1-s))}}return l}},{key:"within",value:function(e,n,t){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var r=this.ids,o=this.coords,i=this.nodeSize,c=[0,r.length-1,0],l=[],s=t*t;c.length;){var u=c.pop()||0,f=c.pop()||0,d=c.pop()||0;if(f-d<=i)for(var v=d;v<=f;v++)a(o[2*v],o[2*v+1],e,n)<=s&&l.push(r[v]);else{var h=d+f>>1,p=o[2*h],y=o[2*h+1];a(p,y,e,n)<=s&&l.push(r[h]),(0===u?e-t<=p:n-t<=y)&&(c.push(d),c.push(h-1),c.push(1-u)),(0===u?e+t>=p:n+t>=y)&&(c.push(h+1),c.push(f),c.push(1-u))}}return l}}])&&l(r.prototype,o),i&&l(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}();function t(e,n,o,i,a,c){if(!(a-i<=o)){var l=i+a>>1;r(e,n,l,i,a,c),t(e,n,o,i,l-1,1-c),t(e,n,o,l+1,a,1-c)}}function r(e,n,t,i,a,c){for(;a>i;){if(a-i>600){var l=a-i+1,s=t-i+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(s-l/2<0?-1:1);r(e,n,t,Math.max(i,Math.floor(t-s*f/l+d)),Math.min(a,Math.floor(t+(l-s)*f/l+d)),c)}var v=n[2*t+c],h=i,p=a;for(o(e,n,i,t),n[2*a+c]>v&&o(e,n,i,a);h<p;){for(o(e,n,h,p),h++,p--;n[2*h+c]<v;)h++;for(;n[2*p+c]>v;)p--}n[2*i+c]===v?o(e,n,i,p):o(e,n,++p,a),p<=t&&(i=p+1),t<=p&&(a=p-1)}}function o(e,n,t,r){i(e,t,r),i(n,2*t,2*r),i(n,2*t+1,2*r+1)}function i(e,n,t){var r=e[n];e[n]=e[t],e[t]=r}function a(e,n,t,r){var o=e-t,i=n-r;return o*o+i*i}return n},he=function(){addEventListener("message",(function(e){var n=e.data.points;0===n.length&&self.postMessage({error:new Error("Invalid point data")});var t,r=new KDBush(n.length,e.data.nodeSize),o=s(n);try{for(o.s();!(t=o.n()).done;){var i=v(t.value,2),a=i[0],c=i[1];r.add(a,c)}}catch(e){o.e(e)}finally{o.f()}r.finish(),postMessage(r.data,[r.data])}))},pe=ve(),ye=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{nodeSize:16,useWorker:void 0};return new Promise((function(t,r){if(e instanceof ArrayBuffer)t(pe.from(e));else if((e.length<1e6||!1===n.useWorker)&&!0!==n.useWorker){var o,i=new pe(e.length,n.nodeSize),a=s(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;i.add(c[0],c[1])}}catch(e){a.e(e)}finally{a.f()}i.finish(),t(i)}else{var l=function(e){var n=ve.toString(),t=e.toString(),r="const createKDBushClass = ".concat(n,";")+"KDBush = createKDBushClass();"+"const createWorker = ".concat(t,";")+"createWorker();",o=new Blob([r],{type:"text/javascript"}),i=URL.createObjectURL(o),a=new Worker(i,{name:"KDBush"});return URL.revokeObjectURL(i),a}(he);l.onmessage=function(e){e.data.error?r(e.data.error):t(pe.from(e.data)),l.terminate()},l.postMessage({points:e,nodeSize:n.nodeSize})}}))},me="auto",ge=Float32Array.BYTES_PER_ELEMENT,we=["OES_texture_float","OES_element_index_uint","WEBGL_color_buffer_float","EXT_float_blend"],xe={color:[0,0,0,0],depth:1},be="panZoom",Pe="lasso",Se="rotate",Ae=[be,Pe,Se],Ee=be,Me={cubicIn:e=>e*e*e,cubicInOut:m,cubicOut:e=>--e*e*e+1,linear:e=>e,quadIn:e=>e*e,quadInOut:e=>e<.5?2*e*e:(4-2*e)*e-1,quadOut:e=>e*(2-e)},Ie=m,Ce="continuous",Te="categorical",Le=[Ce,Te],Oe="deselect",Re="lassoEnd",Be=[Oe,Re],De=[0,.666666667,1,1],ze=Re,Ne=750,ke=500,je=100,Fe=250,_e="intersect",Ve="lasso",We="rotate",Ze="merge",Ge="remove",Ue=[Ve,We,_e,Ze,Ge],Ke="alt",qe="cmd",Ye="ctrl",He="meta",Xe="shift",$e=[Ke,qe,Ye,He,Xe],Je=u(u(u(u({},Ge,Ke),We,Ke),Ve,Xe),Ze,qe),Qe=me,en=me,nn=null,tn=null,rn=null,on=null,an=null,cn=[.66,.66,.66,1],ln=[0,.55,1,1],sn=[1,1,1,1],un=[0,0,0,1],fn=null,dn=[.66,.66,.66,.2],vn=[0,.55,1,1],hn=[1,1,1,1],pn=[1,1,1,.5],yn=[0,0],mn=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),gn=[1,1,1,.5],wn=new Set(["z","valueZ","valueA","value1","category"]),xn=new Set(["w","valueW","valueB","value2","value"]),bn=15e3,Pn=Symbol("SKIP_DEPRECATION_VALUE_TRANSLATION"),Sn="Points have not been drawn",An="The instance was already destroyed",En=function(e,n){return"".concat(e,"ms ease-out effectIn ").concat(n,"ms 1 normal forwards")},Mn=function(e,n){return"".concat(e,"ms linear leftSpinIn ").concat(n,"ms 1 normal forwards")},In=function(e,n){return"".concat(e,"ms linear rightSpinIn ").concat(n,"ms 1 normal forwards")},Cn=function(e,n){return"".concat(e,"ms linear circleIn ").concat(n,"ms 1 normal forwards")},Tn=function(e,n,t){return"\n @keyframes mainIn {\n 0% {\n color: ".concat(n,";\n opacity: 0;\n }\n 0%, ").concat(e,"% {\n color: ").concat(n,";\n opacity: 1;\n }\n 100% {\n color: ").concat(t,";\n opacity: 0.8;\n }\n }\n")},Ln=function(e,n,t,r){return"\n @keyframes effectIn {\n 0%, ".concat(e,"% {\n opacity: ").concat(t,";\n transform: scale(").concat(r,");\n }\n ").concat(n,"% {\n opacity: 0.66;\n transform: scale(1.5);\n }\n 99% {\n opacity: 0;\n transform: scale(2);\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")},On=function(e,n){return"\n @keyframes leftSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(360deg);\n }\n }\n")},Rn=function(e,n){return"\n @keyframes rightSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(180deg);\n }\n }\n")},Bn=function(e){return"".concat(e,"ms linear effectOut 0s 1 normal forwards")},Dn=function(e){return"".concat(e,"ms linear leftSpinOut 0s 1 normal forwards")},zn=function(e){return"".concat(e,"ms linear rightSpinOut 0s 1 normal forwards")},Nn=function(e){return"".concat(e,"ms linear circleOut 0s 1 normal forwards")},kn=function(e,n){return"\n @keyframes mainOut {\n 0% {\n color: ".concat(e,";\n }\n 100% {\n color: ").concat(n,";\n }\n }\n")},jn=function(e,n){return"\n @keyframes rightSpinOut {\n 0%, ".concat(e,"% {\n transform: rotate(").concat(n,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n")},Fn=function(e){return"\n @keyframes leftSpinOut {\n 0% {\n transform: rotate(".concat(e,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n }\n")},_n=function(e,n,t){return"\n @keyframes circleOut {\n 0%, ".concat(e,"% {\n clip-path: ").concat(n,";\n opacity: ").concat(t,";\n }\n ").concat(e+.01,"% {\n clip-path: inset(0 0 0 50%);\n opacity: ").concat(t,";\n }\n 100% {\n clip-path: inset(0 0 0 50%);\n opacity: 0;\n }\n }\n")},Vn=function(e){return null===e?arguments.length>1&&void 0!==arguments[1]?arguments[1]:null:e},Wn=function(){if(!de){var e=document.createElement("style");document.head.appendChild(e),de=e.sheet}return de},Zn=function(e){var n=Wn(),t=n.rules.length;return n.insertRule(e,t),t},Gn=function(e){Wn().deleteRule(e)},Un="".concat(2500,"ms ease scaleInFadeOut 0s 1 normal backwards"),Kn=null,qn="".concat(250,"ms ease fadeScaleOut 0s 1 normal backwards"),Yn=null,Hn=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.onDraw,r=void 0===t?g:t,o=n.onStart,i=void 0===o?g:o,a=n.onEnd,c=void 0===a?g:a,l=n.enableInitiator,s=void 0===l||l,u=n.initiatorParentElement,f=void 0===u?document.body:u,d=n.longPressIndicatorParentElement,p=void 0===d?document.body:d,y=n.minDelay,m=void 0===y?8:y,w=n.minDist,x=void 0===w?2:w,E=n.pointNorm,M=void 0===E?g:E,I=n.type,C=void 0===I?"freeform":I,T=n.brushSize,L=s,O=f,R=p,B=r,D=i,z=c,N=m,k=x,j=M,F=C,_=void 0===T?24:T,V=document.createElement("div"),W=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);V.id="lasso-initiator-".concat(W),V.style.position="fixed",V.style.display="flex",V.style.justifyContent="center",V.style.alignItems="center",V.style.zIndex=99,V.style.width="4rem",V.style.height="4rem",V.style.borderRadius="4rem",V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)";var Z,G=function(){var e=document.createElement("div"),n=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);e.id="lasso-long-press-".concat(n),e.style.position="fixed",e.style.width="1.25rem",e.style.height="1.25rem",e.style.pointerEvents="none",e.style.transform="translate(-50%,-50%)";var t=document.createElement("div");t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.width="1.25rem",t.style.height="1.25rem",t.style.clipPath="inset(0px 0px 0px 50%)",t.style.opacity=0,e.appendChild(t);var r=document.createElement("div");r.style.position="absolute",r.style.top=0,r.style.left=0,r.style.width="0.8rem",r.style.height="0.8rem",r.style.border="0.2rem solid currentcolor",r.style.borderRadius="0.8rem",r.style.clipPath="inset(0px 50% 0px 0px)",r.style.transform="rotate(0deg)",t.appendChild(r);var o=document.createElement("div");o.style.position="absolute",o.style.top=0,o.style.left=0,o.style.width="0.8rem",o.style.height="0.8rem",o.style.border="0.2rem solid currentcolor",o.style.borderRadius="0.8rem",o.style.clipPath="inset(0px 50% 0px 0px)",o.style.transform="rotate(0deg)",t.appendChild(o);var i=document.createElement("div");return i.style.position="absolute",i.style.top=0,i.style.left=0,i.style.width="1.25rem",i.style.height="1.25rem",i.style.borderRadius="1.25rem",i.style.background="currentcolor",i.style.transform="scale(0)",i.style.opacity=0,e.appendChild(i),{longPress:e,longPressCircle:t,longPressCircleLeft:r,longPressCircleRight:o,longPressEffect:i}}(),U=G.longPress,K=G.longPressCircle,q=G.longPressCircleLeft,Y=G.longPressCircleRight,H=G.longPressEffect,X=!1,$=!1,J=[],Q=[],ee=[],ne=[],te=!1,re=null,oe=null,ie=null,ae=null,ce=null,le=null,se=null,ue=null,fe=null,de=null,ve=function(){X=!1};window.addEventListener("mouseup",ve);var he,pe=function(){V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)"},ye=function(e,n){var t=getComputedStyle(e),r=+t.opacity,o=t.transform.match(/([0-9.-]+)+/g),i=+o[0],a=+o[1],c=Math.sqrt(i*i+a*a),l=Math.atan2(a,i)*(180/Math.PI);return{opacity:r,scale:c,rotate:l=n&&l<=0?360+l:l}},me=function(e){if(L&&!X){var n=e.clientX,t=e.clientY;V.style.top="".concat(t,"px"),V.style.left="".concat(n,"px");var r=ye(V),o=r.opacity,i=r.scale,a=r.rotate;V.style.opacity=o,V.style.transform="translate(-50%,-50%) scale(".concat(i,") rotate(").concat(a,"deg)"),V.style.animation="none",S().then((function(){null!==Kn&&Gn(Kn),Kn=Zn(function(e,n,t){return"\n@keyframes scaleInFadeOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 10% {\n opacity: 1;\n transform: translate(-50%,-50%) scale(1) rotate(").concat(t+20,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0.9) rotate(").concat(t+60,"deg);\n }\n}\n")}(o,i,a)),V.style.animation=Un,S().then((function(){pe()}))}))}},ge=function(){var e=ye(V),n=e.opacity,t=e.scale,r=e.rotate;V.style.opacity=n,V.style.transform="translate(-50%,-50%) scale(".concat(t,") rotate(").concat(r,"deg)"),V.style.animation="none",S(2).then((function(){null!==Yn&&Gn(Yn),Yn=Zn(function(e,n,t){return"\n@keyframes fadeScaleOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0) rotate(").concat(t,"deg);\n }\n}\n")}(n,t,r)),V.style.animation=qn,S().then((function(){pe()}))}))},we=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{time:Ne,extraTime:ke,delay:je},r=t.time,o=void 0===r?Ne:r,i=t.extraTime,a=void 0===i?ke:i,c=t.delay,l=void 0===c?je:c;te=!0;var s=getComputedStyle(U);U.style.color=s.color,U.style.top="".concat(n,"px"),U.style.left="".concat(e,"px"),U.style.animation="none";var u=getComputedStyle(K);K.style.clipPath=u.clipPath,K.style.opacity=u.opacity,K.style.animation="none";var f=ye(H);H.style.opacity=f.opacity,H.style.transform="scale(".concat(f.scale,")"),H.style.animation="none";var d=ye(q);q.style.transform="rotate(".concat(d.rotate,"deg)"),q.style.animation="none";var v=ye(Y);Y.style.transform="rotate(".concat(v.rotate,"deg)"),Y.style.animation="none",S().then((function(){if(te){null!==ce&&Gn(ce),null!==ae&&Gn(ae),null!==ie&&Gn(ie),null!==oe&&Gn(oe),null!==re&&Gn(re);var e=function(e){var n,t,r,o,i,a=e.time,c=void 0===a?Ne:a,l=e.extraTime,s=void 0===l?ke:l,u=e.delay,f=void 0===u?je:u,d=e.currentColor,v=e.targetColor,h=e.effectOpacity,p=e.effectScale,y=e.circleLeftRotation,m=e.circleRightRotation,g=e.circleClipPath,w=e.circleOpacity,x=y/360,b=function(e,n,t){return(1-e)*n+t}(x,c,s),P=Math.round((1-x)*c/b*100),S=Math.round(P/2),A=P+(100-P)/4;return{rules:{main:Tn(P,d,v),effect:Ln(P,A,h,p),circleRight:Rn(S,m),circleLeft:On(P,y),circle:(r=S,o=g,i=w,"\n @keyframes circleIn {\n 0% {\n clip-path: ".concat(o,";\n opacity: ").concat(i,";\n }\n ").concat(r,"% {\n clip-path: ").concat(o,";\n opacity: 1;\n }\n ").concat(r+.01,"%, 100% {\n clip-path: inset(0);\n opacity: 1;\n }\n }\n"))},names:{main:(n=b,t=f,"".concat(n,"ms ease-out mainIn ").concat(t,"ms 1 normal forwards")),effect:En(b,f),circleLeft:Mn(b,f),circleRight:In(b,f),circle:Cn(b,f)}}}({time:o,extraTime:a,delay:l,currentColor:s.color||"currentcolor",targetColor:U.dataset.activeColor,effectOpacity:f.opacity||0,effectScale:f.scale||0,circleLeftRotation:d.rotate||0,circleRightRotation:v.rotate||0,circleClipPath:u.clipPath||"inset(0 0 0 50%)",circleOpacity:u.opacity||0}),n=e.rules,t=e.names;re=Zn(n.main),oe=Zn(n.effect),ie=Zn(n.circleLeft),ae=Zn(n.circleRight),ce=Zn(n.circle),U.style.animation=t.main,H.style.animation=t.effect,q.style.animation=t.circleLeft,Y.style.animation=t.circleRight,K.style.animation=t.circle}}))},xe=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{time:Fe}).time,n=void 0===e?Fe:e;if(te){te=!1;var t=getComputedStyle(U);U.style.color=t.color,U.style.animation="none";var r=getComputedStyle(K);K.style.clipPath=r.clipPath,K.style.opacity=r.opacity,K.style.animation="none";var o=ye(H);H.style.opacity=o.opacity,H.style.transform="scale(".concat(o.scale,")"),H.style.animation="none";var i="x"===r.clipPath.slice(-2,-1),a=ye(q,i);q.style.transform="rotate(".concat(a.rotate,"deg)"),q.style.animation="none";var c=ye(Y);Y.style.transform="rotate(".concat(c.rotate,"deg)"),Y.style.animation="none",S().then((function(){null!==de&&Gn(de),null!==fe&&Gn(fe),null!==ue&&Gn(ue),null!==se&&Gn(se),null!==le&&Gn(le);var e=function(e){var n,t,r,o=e.time,i=void 0===o?Fe:o,a=e.currentColor,c=e.targetColor,l=e.effectOpacity,s=e.effectScale,u=e.circleLeftRotation,f=e.circleRightRotation,d=e.circleClipPath,v=e.circleOpacity,h=u/360,p=h*i,y=Math.min(100,100*h),m=y>50?Math.round(100*(1-50/y)):0;return{rules:{main:kn(a,c),effect:(t=l,r=s,"\n @keyframes effectOut {\n 0% {\n opacity: ".concat(t,";\n transform: scale(").concat(r,");\n }\n 99% {\n opacity: 0;\n transform: scale(").concat(r+.5,");\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")),circleRight:jn(m,f),circleLeft:Fn(u),circle:_n(m,d,v)},names:{main:(n=p,"".concat(n,"ms linear mainOut 0s 1 normal forwards")),effect:Bn(p),circleRight:Dn(p),circleLeft:zn(p),circle:Nn(p)}}}({time:n,currentColor:t.color||"currentcolor",targetColor:U.dataset.color,effectOpacity:o.opacity||0,effectScale:o.scale||0,circleLeftRotation:a.rotate||0,circleRightRotation:c.rotate||0,circleClipPath:r.clipPath||"inset(0px)",circleOpacity:r.opacity||1}),i=e.rules,l=e.names;le=Zn(i.main),se=Zn(i.effect),ue=Zn(i.circleLeft),fe=Zn(i.circleRight),de=Zn(i.circle),U.style.animation=l.main,H.style.animation=l.effect,q.style.animation=l.circleLeft,Y.style.animation=l.circleRight,K.style.animation=l.circle}))}},be=function(){B(J,Q)},Pe=function(e){J.push(e),Q.push(e[0],e[1])},Se=function(e){var n=v(e,2),t=n[0],r=n[1],o=v(J[0],2),i=o[0],a=o[1];J[1]=[t,a],J[2]=[t,r],J[3]=[i,r],J[4]=[i,a],Q[2]=t,Q[3]=a,Q[4]=t,Q[5]=r,Q[6]=i,Q[7]=r,Q[8]=i,Q[9]=a},Ae=function(e){ee.push(e)},Ee=function(e,n,t){var r,o=v(e,2),i=o[0],a=o[1],c=v(n,2),l=i-c[0],s=a-c[1],u=(r=[l,s],Math.sqrt(r.reduce(((e,n)=>e+n**2),0)));return[+s/u*t,-l/u*t]},Me=function(e){var n=ee.at(-1),t=Math.abs(j([0,0])[0]-j([_/2,0])[0]),r=v(Ee(e,n,t),2),o=r[0],i=r[1],a=ee.length;if(1===a){var c=[n[0]+o,n[1]+i],l=[n[0]-o,n[1]-i];J.push(c,l),Q.push(c[0],c[1],l[0],l[1]),ne.push([o,i])}else{var s=v(Ee(e,n,t),2);o=s[0],i=s[1];var u=v(function(e,n,t){if(0===e.length)return 0;if(1===e.length)return e[0];for(var r=Math.pow(2,-1/n),o=Math.max(0,e.length-t),i=e.slice(o),a=0,c=0,l=0,s=i.length-1;s>=0;s--){var u=i.length-1-s,f=Math.pow(r,u);a+=i[s][0]*f,c+=i[s][1]*f,l+=f}return[a/l,c/l]}([].concat(h(ne),[[o,i]]),1,10),2);o=u[0],i=u[1];var f=v(ne.at(-1),2),d=(o+f[0])/2,p=(i+f[1])/2,y=[n[0]+d,n[1]+p],m=[n[0]-d,n[1]-p];J.splice(a-1,2,y,m),Q.splice(2*(a-1),4,y[0],y[1],m[0],m[1]),ne.splice(a,1,[d,p])}var g=[e[0]+o,e[1]+i],w=[e[0]-o,e[1]-i];J.splice(a,0,g,w),Q.splice(2*a,0,g[0],g[1],w[0],w[1]),ee.push(e),ne.push([o,i])},Ie=Pe,Ce=Pe,Te=function(e){if(Z){(t=e[0],r=e[1],o=Z[0],i=Z[1],Math.sqrt((t-o)**2+(r-i)**2))>k&&(Z=e,Ie(j(e)),J.length>1&&be())}else{$||($=!0,D()),Z=e;var n=j(e);Ce(n)}var t,r,o,i},Le=A(Te,N,N),Oe=function(n,t){var r=function(n){var t=e.getBoundingClientRect(),r=t.left,o=t.top;return[n.clientX-r,n.clientY-o]}(n);return t?Le(r):Te(r)},Re=function(){J=[],Q=[],ee=[],ne=[],Z=void 0,be()},Be=function(e){me(e)},De=function(){X=!0,$=!0,Re(),D()},ze=function(){ge()},_e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.intersect,t=void 0!==n&&n,r=e.merge,o=void 0!==r&&r,i=e.remove,a=void 0!==i&&i;$=!1;var c=h(J),l=h(Q);return Le.cancel(),Re(),c.length>0&&z(c,l,{intersect:t,merge:o,remove:a}),c},Ve=function(e){return"onDraw"===e?B:"onStart"===e?D:"onEnd"===e?z:"enableInitiator"===e?L:"minDelay"===e?N:"minDist"===e?k:"pointNorm"===e?j:"type"===e?F:"brushSize"===e?_:void 0},We=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onDraw,t=void 0===n?null:n,r=e.onStart,o=void 0===r?null:r,i=e.onEnd,a=void 0===i?null:i,c=e.enableInitiator,l=void 0===c?null:c,s=e.initiatorParentElement,u=void 0===s?null:s,f=e.longPressIndicatorParentElement,d=void 0===f?null:f,v=e.minDelay,h=void 0===v?null:v,p=e.minDist,y=void 0===p?null:p,m=e.pointNorm,g=void 0===m?null:m,w=e.type,x=void 0===w?null:w,b=e.brushSize,P=void 0===b?null:b;B=Vn(t,B),D=Vn(o,D),z=Vn(a,z),L=Vn(l,L),N=Vn(h,N),k=Vn(y,k),j=Vn(g,j),_=Vn(P,_),null!==u&&u!==O&&(O.removeChild(V),u.appendChild(V),O=u),null!==d&&d!==R&&(R.removeChild(U),d.appendChild(U),R=d),L?(V.addEventListener("click",Be),V.addEventListener("mousedown",De),V.addEventListener("mouseleave",ze)):(V.removeEventListener("mousedown",De),V.removeEventListener("mouseleave",ze)),null!==x&&function(e){switch(e){case"rectangle":F=e,Ie=Se,Ce=Pe;break;case"brush":F=e,Ie=Me,Ce=Ae;break;default:F="freeform",Ie=Pe,Ce=Pe}}(x)},Ze=function(){O.removeChild(V),R.removeChild(U),window.removeEventListener("mouseup",ve),V.removeEventListener("click",Be),V.removeEventListener("mousedown",De),V.removeEventListener("mouseleave",ze)};return O.appendChild(V),R.appendChild(U),We({onDraw:B,onStart:D,onEnd:z,enableInitiator:L,initiatorParentElement:O,type:F,brushSize:_}),((...e)=>n=>e.reduce(((e,n)=>n(e)),n))(P("initiator",V),P("longPressIndicator",U),(function(e){return b(e,{clear:Re,destroy:Ze,end:_e,extend:Oe,get:Ve,set:We,showInitiator:me,hideInitiator:ge,showLongPressIndicator:we,hideLongPressIndicator:xe})}),(he=Hn,e=>b({__proto__:{constructor:he}},e)))({})},Xn=function(e,n){return!!e&&we.reduce((function(t,r){return e.hasExtension(r)?t:(n||console.warn("WebGL: ".concat(r," extension not supported. Scatterplot might not render properly")),!1)}),!0)},$n=function(e){var n,t=e.getContext("webgl",{antialias:!0,preserveDrawingBuffer:!0}),r=[],o=s(we);try{for(o.s();!(n=o.n()).done;){var a=n.value;t.getExtension(a)?r.push(a):console.warn("WebGL: ".concat(a," extension not supported. Scatterplot might not render properly"))}}catch(e){o.e(e)}finally{o.f()}return i.default({gl:t,extensions:r})},Jn=function(e,n,t,r){return Math.sqrt(Math.pow(e-t,2)+Math.pow(n-r,2))},Qn=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,et=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).minLength,r=void 0===t?0:t;return Array.isArray(e)&&e.length>=r&&e.every(n)},nt=function(e){return!Number.isNaN(+e)&&+e>=0},tt=function(e){return!Number.isNaN(+e)&&+e>0},rt=function(e,n){return function(t){return e.indexOf(t)>=0?t:n}},ot=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bn;return new Promise((function(r,o){(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bn;return new Promise((function(r,o){var i=new Image;n&&(i.crossOrigin="anonymous"),i.src=e,i.onload=function(){r(i)};var a=function(){o(new Error("IMAGE_LOAD_ERROR"))};i.onerror=a,setTimeout(a,t)}))})(n,0!==n.indexOf(window.location.origin)&&-1===n.indexOf("base64"),t).then((function(n){r(e.texture(n))})).catch((function(e){o(e)}))}))},it=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return[].concat(h(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.replace(Qn,(function(e,n,t,r){return"#".concat(n).concat(n).concat(t).concat(t).concat(r).concat(r)})).substring(1).match(/.{2}/g).map((function(e){return Number.parseInt(e,16)/Math.pow(255,n)}))}(e,n)),[Math.pow(255,!n)])},at=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,ct=function(e){return e>=0&&e<=1},lt=function(e){return Array.isArray(e)&&e.every(ct)};function st(e,n,t,r,o,i){return(t-e)*(i-n)-(o-e)*(r-n)}var ut=function(e){for(var n=v(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),t=n[0],r=n[1],o=0,i=0,a=e.length-2;i<e.length;i+=2){var c=e[i],l=e[i+1],s=e[a],u=e[a+1];if(l<=r){if(u>r)st(c,l,s,u,t,r)>0&&o++}else if(u<=r){st(c,l,s,u,t,r)<0&&o--}a=i}return 0!==o},ft=function(e){return"string"==typeof e||e instanceof String},dt=function(e){return Number.isInteger(e)&&e>=0&&e<=255},vt=function(e){return Array.isArray(e)&&e.every(dt)},ht=function(e){return Array.isArray(e)&&e.length>0&&(Array.isArray(e[0])||ft(e[0]))},pt=function(e,n){return e>n?e:n},yt=function(e,n){return e<n?e:n},mt=function(e,n){if(4===(r=e).length&&(lt(r)||vt(r))){var t=lt(e);return n&&t||!n&&!t?e:n&&!t?e.map((function(e){return e/255})):e.map((function(e){return 255*e}))}var r,o,i;if(3===(o=e).length&&(lt(o)||vt(o))){var a=Math.pow(255,!n),c=lt(e);return[].concat(n&&c||!n&&!c?h(e):h(n&&!c?e.map((function(e){return e/255})):e.map((function(e){return 255*e}))),[a])}return i=e,at.test(i)?it(e,n):(console.warn("Only HEX, RGB, and RGBA are handled by this function. Returning white instead."),n?[1,1,1,1]:[255,255,255,255])},gt=function(e){return.21*e[0]+.72*e[1]+.07*e[2]},wt=function(e){return new Promise((function(n,t){if(!e||Array.isArray(e))n(e);else{var r=Array.isArray(e.x)||ArrayBuffer.isView(e.x)?e.x.length:0,o=(Array.isArray(e.x)||ArrayBuffer.isView(e.x))&&function(n){return e.x[n]},i=(Array.isArray(e.y)||ArrayBuffer.isView(e.y))&&function(n){return e.y[n]},a=(Array.isArray(e.line)||ArrayBuffer.isView(e.line))&&function(n){return e.line[n]},c=(Array.isArray(e.lineOrder)||ArrayBuffer.isView(e.lineOrder))&&function(n){return e.lineOrder[n]},l=Object.keys(e),s=(d=l.find((function(e){return wn.has(e)})))&&(Array.isArray(e[d])||ArrayBuffer.isView(e[d]))&&function(n){return e[d][n]},u=(f=l.find((function(e){return xn.has(e)})))&&(Array.isArray(e[f])||ArrayBuffer.isView(e[f]))&&function(n){return e[f][n]};o&&i&&s&&u&&a&&c?n(e.x.map((function(e,n){return[e,i(n),s(n),u(n),a(n),c(n)]}))):o&&i&&s&&u&&a?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n),u(n),a(n)]}))):o&&i&&s&&u?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n),u(n)]}))):o&&i&&s?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n)]}))):o&&i?n(Array.from({length:r},(function(e,n){return[o(n),i(n)]}))):t(new Error("You need to specify at least x and y"))}var f,d}))},xt=function(e){return Number.isFinite(e.y)&&!("x"in e)},bt=function(e){return Number.isFinite(e.x)&&!("y"in e)},Pt=function(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height)},St=function(e){return Number.isFinite(e.x1)&&Number.isFinite(e.y1)&&Number.isFinite(e.x2)&&Number.isFinite(e.x2)},At=function(e){return"vertices"in e&&e.vertices.length>1},Et=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.regl,t=e.canvas,r=void 0===t?document.createElement("canvas"):t,o=e.gamma,i=void 0===o?1:o,a=!1;n||(n=$n(r));var c=Xn(n),l=[r.width,r.height],s=n.framebuffer({width:l[0],height:l[1],colorFormat:"rgba",colorType:"float"}),u=n({vert:"\n precision highp float;\n attribute vec2 xy;\n void main () {\n gl_Position = vec4(xy, 0, 1);\n }",frag:"\n precision highp float;\n uniform vec2 srcRes;\n uniform sampler2D src;\n uniform float gamma;\n\n vec3 approxLinearToSRGB (vec3 rgb, float gamma) {\n return pow(clamp(rgb, vec3(0), vec3(1)), vec3(1.0 / gamma));\n }\n\n void main () {\n vec4 color = texture2D(src, gl_FragCoord.xy / srcRes);\n gl_FragColor = vec4(approxLinearToSRGB(color.rgb, gamma), color.a);\n }",attributes:{xy:[-4,-4,4,-4,0,4]},uniforms:{src:function(){return s},srcRes:function(){return l},gamma:function(){return i}},count:3,depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}}}),f=new Set,d=n.frame((function(){for(var e=f.values(),n=e.next();!n.done;)n.value(),n=e.next()})),v=function(e,n){var t=null==e?window.innerWidth:e,o=null==n?window.innerHeight:n;r.width=t*window.devicePixelRatio,r.height=o*window.devicePixelRatio,l[0]=r.width,l[1]=r.height,s.resize.apply(s,l)},h=function(){v()};e.canvas||(window.addEventListener("resize",h),window.addEventListener("orientationchange",h),v());return{get canvas(){return r},get regl(){return n},get gamma(){return i},set gamma(e){i=+e},get isSupported(){return c},get isDestroyed(){return a},render:function(e,t){n.clear(xe),s.use((function(){n.clear(xe),e()})),u(),function(e){var n=e.getContext("2d");n.clearRect(0,0,e.width,e.height),n.drawImage(r,(r.width-e.width)/2,(r.height-e.height)/2,e.width,e.height,0,0,e.width,e.height)}(t)},resize:v,onFrame:function(e){return f.add(e),function(){f.delete(e)}},refresh:function(){n.poll()},destroy:function(){a=!0,window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),d.cancel(),r=void 0,n.destroy(),n=void 0}}};const Mt=e=>`\nprecision highp float;\n\nuniform sampler2D colorTex;\nuniform float colorTexRes;\nuniform float colorTexEps;\nuniform sampler2D stateTex;\nuniform float stateTexRes;\nuniform float stateTexEps;\nuniform float devicePixelRatio;\nuniform sampler2D encodingTex;\nuniform float encodingTexRes;\nuniform float encodingTexEps;\nuniform float pointSizeExtra;\nuniform float pointOpacityMax;\nuniform float pointOpacityScale;\nuniform float numPoints;\nuniform float globalState;\nuniform float isColoredByZ;\nuniform float isColoredByW;\nuniform float isOpacityByZ;\nuniform float isOpacityByW;\nuniform float isOpacityByDensity;\nuniform float isSizedByZ;\nuniform float isSizedByW;\nuniform float isPixelAligned;\nuniform float colorMultiplicator;\nuniform float opacityMultiplicator;\nuniform float opacityDensity;\nuniform float sizeMultiplicator;\nuniform float numColorStates;\nuniform float pointScale;\nuniform float drawingBufferWidth;\nuniform float drawingBufferHeight;\nuniform mat4 modelViewProjection;\n\nattribute vec2 stateIndex;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nvoid main() {\n vec4 state = texture2D(stateTex, stateIndex);\n\n if (isPixelAligned < 0.5) {\n gl_Position = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n } else {\n vec4 clipSpacePosition = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n vec2 ndcPosition = clipSpacePosition.xy / clipSpacePosition.w;\n vec2 pixelPos = 0.5 * (ndcPosition + 1.0) * vec2(drawingBufferWidth, drawingBufferHeight);\n pixelPos = floor(pixelPos + 0.5); // Snap to nearest pixel\n vec2 snappedPosition = (pixelPos / vec2(drawingBufferWidth, drawingBufferHeight)) * 2.0 - 1.0;\n gl_Position = vec4(snappedPosition, 0.0, 1.0);\n }\n\n\n // Determine color index\n float colorIndexZ = isColoredByZ * floor(state.z * colorMultiplicator);\n float colorIndexW = isColoredByW * floor(state.w * colorMultiplicator);\n\n // Multiply by the number of color states per color\n // I.e., normal, active, hover, background, etc.\n float colorIndex = (colorIndexZ + colorIndexW) * numColorStates;\n\n // Half a "pixel" or "texel" in texture coordinates\n float colorLinearIndex = colorIndex + globalState;\n\n // Need to add cEps here to avoid floating point issue that can lead to\n // dramatic changes in which color is loaded as floor(3/2.9999) = 1 but\n // floor(3/3.0001) = 0!\n float colorRowIndex = floor((colorLinearIndex + colorTexEps) / colorTexRes);\n\n vec2 colorTexIndex = vec2(\n (colorLinearIndex / colorTexRes) - colorRowIndex + colorTexEps,\n colorRowIndex / colorTexRes + colorTexEps\n );\n\n color = texture2D(colorTex, colorTexIndex);\n\n // Retrieve point size\n float pointSizeIndexZ = isSizedByZ * floor(state.z * sizeMultiplicator);\n float pointSizeIndexW = isSizedByW * floor(state.w * sizeMultiplicator);\n float pointSizeIndex = pointSizeIndexZ + pointSizeIndexW;\n\n float pointSizeRowIndex = floor((pointSizeIndex + encodingTexEps) / encodingTexRes);\n vec2 pointSizeTexIndex = vec2(\n (pointSizeIndex / encodingTexRes) - pointSizeRowIndex + encodingTexEps,\n pointSizeRowIndex / encodingTexRes + encodingTexEps\n );\n float pointSize = texture2D(encodingTex, pointSizeTexIndex).x;\n\n // Retrieve opacity\n ${3===e?"":`\n if (isOpacityByDensity < 0.5) {\n float opacityIndexZ = isOpacityByZ * floor(state.z * opacityMultiplicator);\n float opacityIndexW = isOpacityByW * floor(state.w * opacityMultiplicator);\n float opacityIndex = opacityIndexZ + opacityIndexW;\n\n float opacityRowIndex = floor((opacityIndex + encodingTexEps) / encodingTexRes);\n vec2 opacityTexIndex = vec2(\n (opacityIndex / encodingTexRes) - opacityRowIndex + encodingTexEps,\n opacityRowIndex / encodingTexRes + encodingTexEps\n );\n color.a = texture2D(encodingTex, opacityTexIndex)[${1+e}];\n } else {\n color.a = min(1.0, opacityDensity + globalState);\n }\n `}\n\n color.a = min(pointOpacityMax, color.a) * pointOpacityScale;\n finalPointSize = (pointSize * pointScale) + pointSizeExtra;\n gl_PointSize = finalPointSize;\n}\n`;var It=function(){var e=function(e,n,t,r,o){var i=.5*(r-n),a=.5*(o-t);return(2*t-2*r+i+a)*e*e*e+(-3*t+3*r-2*i-a)*e*e+i*e+t},n=function(n,t,r){var o=r*n,i=Math.floor(o),a=o-i,c=t[Math.max(0,i-1)],l=t[i],s=t[Math.min(r,i+1)],u=t[Math.min(r,i+2)];return[e(a,c[0],l[0],s[0],u[0]),e(a,c[1],l[1],s[1],u[1])]},t=function(e,n,t){var r=n[0],o=n[1],i=t[0]-r,a=t[1]-o;if(0!==i||0!==a){var c=((e[0]-r)*i+(e[1]-o)*a)/(i*i+a*a);c>1?(r=t[0],o=t[1]):c>0&&(r+=i*c,o+=a*c)}return(i=e[0]-r)*i+(a=e[1]-o)*a},r=function(e,n,o,i,a){for(var c,l=i,s=n+1;s<o;s++){var u=t(e[s],e[n],e[o]);u>l&&(c=s,l=u)}l>i&&(c-n>1&&r(e,n,c,i,a),a.push(e[c]),o-c>1&&r(e,c,o,i,a))},o=function(e,n){var t=e.length-1,o=[e[0]];return r(e,0,t,n,o),o.push(e[t]),o};self.onmessage=function(e){(e.data.points?+e.data.points.length:0)||self.postMessage({error:new Error("No points provided")}),e.data.points;var t=function(e){var n={},t=!Number.isNaN(+e[0][5]);return e.forEach((function(e){var r=e[4];n[r]||(n[r]=[]),t?n[r][e[5]]=e:n[r].push(e)})),Object.entries(n).forEach((function(e){n[e[0]]=e[1].filter((function(e){return e})),n[e[0]].reference=e[1][0]})),n}(e.data.points);self.postMessage({points:Object.entries(t).reduce((function(t,r){return t[r[0]]=function(e){for(var t,r,i,a,c,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=l.maxIntPointsPerSegment,u=void 0===s?100:s,f=l.tolerance,d=void 0===f?.002:f,v=e.length,h=v-1,p=h*u+1,y=Math.pow(d,2),m=[],g=0;g<v-1;g++){var w=[e[g].slice(0,2)];t=e[g];for(var x=1;x<u;x++){var b=n((g*u+x)/p,e,h);r=t[0],i=t[1],a=b[0],c=b[1],Math.pow(r-a,2)+Math.pow(i-c,2)>y&&(w.push(b),t=b)}w.push(e[g+1]),w=o(w,y),m=m.concat(w.slice(0,w.length-1))}return m.push(e[e.length-1].slice(0,2)),m.flat()}(r[1],e.data.options),t[r[0]].reference=r[1].reference,t}),{})})}},Ct=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{tolerance:.002,maxIntPointsPerSegment:100};return new Promise((function(t,r){var o,i=(o=It,new Worker(window.URL.createObjectURL(new Blob([`(${o.toString()})()`],{type:"text/javascript"}))));i.onmessage=function(e){e.data.error?r(e.data.error):t(e.data.points),i.terminate()},i.postMessage({points:e,options:n})}))},Tt={showRecticle:{replacement:"showReticle",removalVersion:"2",translation:g},recticleColor:{replacement:"reticleColor",removalVersion:"2",translation:g},keyMap:{replacement:"actionKeyMap",removalVersion:"2",translation:function(e){return Object.entries(e).reduce((function(e,n){var t=v(n,2),r=t[0],o=t[1];return e[o]?e[o]=[].concat(h(e[o]),[r]):e[o]=r,e}),{})}}},Lt=function(e){var n,t=Object.keys(e).filter((function(e){return Tt[e]})),r=s(t);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=Tt[o],a=i.replacement,c=i.removalVersion,l=i.translation;console.warn('regl-scatterplot: the "'.concat(o,'" property is deprecated and will be removed in v').concat(c,'. Please use "').concat(a,'" instead.')),e[Tt[o].replacement]=e[o]!==Pn?l(e[o]):e[o],delete e[o]}}catch(e){r.e(e)}finally{r.f()}return e},Ot=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.allowSegment,o=void 0!==r&&r,i=t.allowDensity,a=void 0!==i&&i,c=t.allowInherit,l=void 0!==c&&c;return wn.has(e)?"valueZ":xn.has(e)?"valueW":"segment"===e?o?"segment":n:"density"===e?a?"density":n:"inherit"===e&&l?"inherit":n},Rt=function(e){switch(e){case"valueZ":return 2;case"valueW":return 3;default:return null}};e.checkSupport=Xn,e.createRegl=$n,e.createRenderer=Et,e.createSpatialIndex=function(e,n){return wt(e).then((function(e){return ye(e,{useWorker:n})})).then((function(e){return e.data}))},e.createTextureFromUrl=ot,e.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=o.default({async:!e.syncEvents,caseInsensitive:!0}),t=new Float32Array(16),r=new Float32Array(16),i=[0,0];Lt(e);var a=e.renderer,l=e.antiAliasing,p=void 0===l?.5:l,y=e.pixelAligned,m=void 0!==y&&y,b=e.backgroundColor,P=void 0===b?un:b,S=e.backgroundImage,E=void 0===S?null:S,M=e.canvas,I=void 0===M?document.createElement("canvas"):M,O=e.colorBy,D=void 0===O?an:O,z=e.deselectOnDblClick,N=void 0===z||z,F=e.deselectOnEscape,_=void 0===F||F,V=e.lassoColor,W=void 0===V?De:V,Z=e.lassoLineWidth,G=void 0===Z?2:Z,U=e.lassoMinDelay,K=void 0===U?10:U,q=e.lassoMinDist,Y=void 0===q?3:q,H=e.lassoMode,X=void 0===H?null:H,$=e.lassoClearEvent,J=void 0===$?ze:$,Q=e.lassoInitiator,ee=void 0!==Q&&Q,ne=e.lassoInitiatorParentElement,te=void 0===ne?document.body:ne,re=e.lassoLongPressIndicatorParentElement,oe=void 0===re?document.body:re,ie=e.lassoOnLongPress,ae=void 0!==ie&&ie,ce=e.lassoLongPressTime,le=void 0===ce?Ne:ce,se=e.lassoLongPressAfterEffectTime,ue=void 0===se?ke:se,de=e.lassoLongPressEffectDelay,ve=void 0===de?je:de,he=e.lassoLongPressRevertEffectTime,pe=void 0===he?Fe:he,we=e.lassoType,xe=void 0===we?"lasso":we,wn=e.lassoBrushSize,xn=void 0===wn?24:wn,En=e.actionKeyMap,Mn=void 0===En?Je:En,In=e.mouseMode,Cn=void 0===In?Ee:In,Tn=e.showReticle,Ln=void 0!==Tn&&Tn,On=e.reticleColor,Rn=void 0===On?gn:On,Bn=e.pointColor,Dn=void 0===Bn?cn:Bn,zn=e.pointColorActive,Nn=void 0===zn?ln:zn,kn=e.pointColorHover,jn=void 0===kn?sn:kn,Fn=e.showPointConnections,_n=void 0!==Fn&&Fn,Vn=e.pointConnectionColor,Wn=void 0===Vn?dn:Vn,Zn=e.pointConnectionColorActive,Gn=void 0===Zn?vn:Zn,Un=e.pointConnectionColorHover,Kn=void 0===Un?hn:Un,qn=e.pointConnectionColorBy,Yn=void 0===qn?fn:qn,Xn=e.pointConnectionOpacity,$n=void 0===Xn?null:Xn,Qn=e.pointConnectionOpacityBy,it=void 0===Qn?rn:Qn,at=e.pointConnectionOpacityActive,ct=void 0===at?.66:at,lt=e.pointConnectionSize,st=void 0===lt?2:lt,dt=e.pointConnectionSizeActive,vt=void 0===dt?2:dt,It=e.pointConnectionSizeBy,Tt=void 0===It?tn:It,Bt=e.pointConnectionMaxIntPointsPerSegment,Dt=void 0===Bt?100:Bt,zt=e.pointConnectionTolerance,Nt=void 0===zt?.002:zt,kt=e.pointSize,jt=void 0===kt?6:kt,Ft=e.pointSizeSelected,_t=void 0===Ft?2:Ft,Vt=e.pointSizeMouseDetection,Wt=void 0===Vt?"auto":Vt,Zt=e.pointOutlineWidth,Gt=void 0===Zt?2:Zt,Ut=e.opacity,Kt=void 0===Ut?me:Ut,qt=e.opacityBy,Yt=void 0===qt?on:qt,Ht=e.opacityByDensityFill,Xt=void 0===Ht?.15:Ht,$t=e.opacityInactiveMax,Jt=void 0===$t?1:$t,Qt=e.opacityInactiveScale,er=void 0===Qt?1:Qt,nr=e.sizeBy,tr=void 0===nr?nn:nr,rr=e.pointScaleMode,or=void 0===rr?"asinh":rr,ir=e.height,ar=void 0===ir?en:ir,cr=e.width,lr=void 0===cr?Qe:cr,sr=e.annotationLineColor,ur=void 0===sr?pn:sr,fr=e.annotationLineWidth,dr=void 0===fr?1:fr,vr=e.annotationHVLineLimit,hr=void 0===vr?1e3:vr,pr=e.cameraIsFixed,yr=void 0!==pr&&pr,mr=lr===me?1:lr,gr=ar===me?1:ar,wr=e.performanceMode,xr=void 0!==wr&&wr,br=e.opacityByDensityDebounceTime,Pr=void 0===br?25:br,Sr=e.spatialIndexUseWorker,Ar=void 0===Sr?undefined:Sr,Er=Boolean(e.renderPointsAsSquares||xr),Mr=Boolean(e.disableAlphaBlending||xr);Cn=rt(Ae,be)(Cn),a||(a=Et({regl:e.regl,gamma:e.gamma})),P=mt(P,!0),W=mt(W,!0),Rn=mt(Rn,!0);var Ir,Cr,Tr,Lr,Or,Rr,Br,Dr,zr,Nr,kr,jr,Fr,_r,Vr,Wr,Zr,Gr,Ur=!1,Kr=!1,qr=gt(P),Yr=!1,Hr=null,Xr=[0,0],$r=-1,Jr=[],Qr=new Set,eo=new Set,no=!1,to=new Set,ro=[],oo=0,io=0,ao=!1,co=[],lo=e.aspectRatio||1,so=!1,uo=!0,fo=!1;Dn=ht(Dn)?h(Dn):[Dn],Nn=ht(Nn)?h(Nn):[Nn],jn=ht(jn)?h(jn):[jn],Dn=Dn.map((function(e){return mt(e,!0)})),Nn=Nn.map((function(e){return mt(e,!0)})),jn=jn.map((function(e){return mt(e,!0)})),Kt=!Array.isArray(Kt)&&Number.isNaN(+Kt)?Dn[0][3]:Kt,Kt=et(Kt,nt,{minLength:1})?h(Kt):[Kt];var vo,ho,po,yo,mo=1/(jt=et(jt,nt,{minLength:1})?h(jt):[jt])[0];Wn="inherit"===Wn?h(Dn):(Wn=ht(Wn)?h(Wn):[Wn]).map((function(e){return mt(e,!0)})),Gn="inherit"===Gn?h(Nn):(Gn=ht(Gn)?h(Gn):[Gn]).map((function(e){return mt(e,!0)})),Kn="inherit"===Kn?h(jn):(Kn=ht(Kn)?h(Kn):[Kn]).map((function(e){return mt(e,!0)})),$n="inherit"===$n?h(Kt):et($n,nt,{minLength:1})?h($n):[$n],st="inherit"===st?h(jt):et(st,nt,{minLength:1})?h(st):[st],D=Ot(D,an),Yt=Ot(Yt,on,{allowDensity:!0}),tr=Ot(tr,nn),Yn=Ot(Yn,fn,{allowSegment:!0,allowInherit:!0}),it=Ot(it,rn,{allowSegment:!0}),Tt=Ot(Tt,tn,{allowSegment:!0});var go,wo,xo,bo,Po,So,Ao,Eo,Mo,Io,Co,To,Lo=0,Oo=0,Ro=!1,Bo=null,Do=Ln,zo=0,No=0,ko=!1,jo=!1,Fo=!1,_o=!1,Vo=Te,Wo=Te,Zo=!1,Go=e.xScale||null,Uo=e.yScale||null,Ko=0,qo=0,Yo=0,Ho=0;Go&&(Ko=Go.domain()[0],qo=Go.domain()[1]-Go.domain()[0],Go.range([0,mr])),Uo&&(Yo=Uo.domain()[0],Ho=Uo.domain()[1]-Uo.domain()[0],Uo.range([gr,0]));var Xo=function(e){return e/mr*2-1},$o=function(e){return 1+e/gr*-2},Jo=function(e,n){var r=[e,n,1,1];return B(r,r,T(t,L(t,Rr,L(t,Ir.view,Dr)))),r.slice(0,2)},Qo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=ia(),t=(Wr[1]-Zr[1])/I.height;return(_r*n+e)*t},ei=function(){return no?ro.filter((function(e,n){return to.has(n)})):ro},ni=function(e,n,t,r){var o=Lr.range(e,n,t,r);return no?o.filter((function(e){return to.has(e)})):o},ti=function(){var e,n=v([Xo(i[0]),$o(i[1])],2),t=n[0],r=n[1],o=v(Jo(t,r),2),a=o[0],c=o[1],l=Qo(4),u=l,f=-1,d=s(ni(a-l,c-l,a+l,c+l));try{for(d.s();!(e=d.n()).done;){var h=e.value,p=v(ro[h],2),y=p[0],m=p[1],g=Jn(y,m,a,c);g<u&&(u=g,f=h)}}catch(e){d.e(e)}finally{d.f()}return f},ri=function(e){var n,t,r,o,i,a=function(e){for(var n=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=0;i<e.length;i+=2)n=e[i]<n?e[i]:n,t=e[i]>t?e[i]:t,r=e[i+1]<r?e[i+1]:r,o=e[i+1]>o?e[i+1]:o;return[n,r,t,o]}(e);if(n=v(a,4),t=n[0],r=n[1],o=n[2],i=n[3],!(Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(i)&&o-t>0&&i-r>0))return[];var c,l=[],u=s(ni.apply(void 0,h(a)));try{for(u.s();!(c=u.n()).done;){var f=c.value;ut(e,ro[f])&&l.push(f)}}catch(e){u.e(e)}finally{u.f()}return l},oi=function(){co=[],Cr&&Cr.clear()},ii=function(e){return e&&e.length>4},ai=function(e,n){if(!kr&&_n&&ii(ro[e[0]])){var t,r=0===n,o=1===n?function(e){return eo.add(e)}:g,i=Object.keys(e.reduce((function(e,n){var t=ro[n];return e[Array.isArray(t[4])?t[4][0]:t[4]]=!0,e}),{})),a=zr.getData().opacities,c=i.filter((function(e){return!eo.has(+e)})),l=s(c);try{for(l.s();!(t=l.n()).done;){var u=t.value,f=Nr[u][0],d=Nr[u][2],v=4*f+2*Nr[u][3],h=v+2*d+4;void 0===a.__original__&&(a.__original__=a.slice());for(var p=v;p<h;p++)a[p]=r?a.__original__[p]:ct;o(u)}}catch(e){l.e(e)}finally{l.f()}zr.getBuffer().opacities.subdata(a,0)}},ci=function(e){return[e%Lo/Lo+Oo,Math.floor(e/Lo)/Lo+Oo]},li=function(e){return no&&!to.has(e)},si=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;J===Oe&&oi(),Jr.length>0&&(t||n.publish("deselect"),eo.clear(),ai(Jr,0),Jr=[],Qr.clear(),uo=!0)},ui=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.intersect,o=void 0!==r&&r,i=t.merge,a=void 0!==i&&i,c=t.remove,l=void 0!==c&&c,s=t.preventEvent,u=void 0!==s&&s,f=Array.isArray(e)?e:[e],d=h(Jr);if(o){var v=new Set(f);if(Jr=Jr.length>0?Jr.filter((function(e){return v.has(e)})):f,d.length===Jr.length)return void(uo=!0)}else if(a){if(Jr=((e,n)=>{const t=[];return e.forEach((e=>{t[e]=!0})),n.forEach((e=>{t[e]=!0})),t.reduce(((e,n,t)=>(n&&e.push(t),e)),[])})(Jr,f),d.length===Jr.length)return void(uo=!0)}else if(l){var p=new Set(f);if(Jr=Jr.filter((function(e){return!p.has(e)})),d.length===Jr.length)return void(uo=!0)}else{var y;if((null===(y=Jr)||void 0===y?void 0:y.length)>0&&ai(Jr,0),d.length>0&&0===f.length)return void si({preventEvent:u});Jr=f}if(w(d,Jr))uo=!0;else{var m=[];Qr.clear(),eo.clear();for(var g=Jr.length-1;g>=0;g--){var x=Jr[g];x<0||x>=oo||li(x)?Jr.splice(g,1):(Qr.add(x),m.push.apply(m,ci(x)))}wo({usage:"dynamic",type:"float",data:m}),ai(Jr,1),u||n.publish("select",{points:Jr}),uo=!0}},fi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.showReticleOnce,o=void 0!==r&&r,i=t.preventEvent,a=void 0!==i&&i,c=!1;if(!(no&&!to.has(e))&&e>=0&&e<oo){c=!0;var l=To,s=e!==To;+l>=0&&s&&!Qr.has(l)&&ai([l],0),To=e,xo.subdata(ci(e)),Qr.has(e)||ai([e],2),s&&!a&&n.publish("pointover",To)}else(c=+To>=0)&&(Qr.has(To)||ai([To],0),a||n.publish("pointout",To)),To=void 0;c&&(uo=!0,fo=o)},di=function(e){var n=I.getBoundingClientRect();return i[0]=e.clientX-n.left,i[1]=e.clientY-n.top,[].concat(i)},vi=Hn(I,{onStart:function(){Ir.config({isFixed:!0}),Yr=!0,ao=!0,oi(),$r>=0&&(clearTimeout($r),$r=-1),n.publish("lassoStart")},onDraw:function(e,t){co=e,Cr.setPoints(t),n.publish("lassoExtend",{coordinates:e})},onEnd:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.intersect,i=void 0!==o&&o,a=r.merge,c=void 0!==a&&a,l=r.remove,s=void 0!==l&&l;Ir.config({isFixed:yr}),co=h(e);var u=ri(t);ui(u,{intersect:i,merge:c,remove:s}),n.publish("lassoEnd",{coordinates:co}),J===Re&&oi()},enableInitiator:ee,initiatorParentElement:te,longPressIndicatorParentElement:oe,pointNorm:function(e){var n=v(e,2),t=n[0],r=n[1];return Jo(Xo(t),$o(r))},minDelay:K,minDist:"brush"===xe?Math.max(3,Y):Y,type:xe}),hi=function(e,n){switch(Mn[n]){case Ke:return e.altKey;case qe:return e.metaKey;case Ye:return e.ctrlKey;case He:return e.metaKey;case Xe:return e.shiftKey;default:return!1}},pi=function(e){jo&&1===e.buttons&&(Yr=!0,Hr=performance.now(),Xr=di(e),!(ao=Cn===Pe||hi(e,Ve))&&ae&&(vi.showLongPressIndicator(e.clientX,e.clientY,{time:le,extraTime:ue,delay:ve}),$r=setTimeout((function(){$r=-1,ao=!0}),le)))},yi=function(e){if(jo){if(Yr=!1,$r>=0&&(clearTimeout($r),$r=-1),ao){e.preventDefault(),ao=!1;var n=!!X;vi.end({intersect:n?"intersect"===X:hi(e,_e),merge:n?"merge"===X:hi(e,Ze),remove:n?"remove"===X:hi(e,Ge)})}ae&&vi.hideLongPressIndicator({time:pe})}},mi=function(e){if(jo){e.preventDefault();var n=di(e);if(!(Jn.apply(void 0,h(n).concat(h(Xr)))>=Y)){var t=performance.now()-Hr;if(!ee||t<500){var r=ti();r>=0?(Jr.length>0&&J===Oe&&oi(),ui([r],{merge:hi(e,Ze),remove:hi(e,Ge)})):Vr||(Vr=setTimeout((function(){Vr=null,vi.showInitiator(e)}),200))}}}},gi=function(e){vi.hideInitiator(),Vr&&(clearTimeout(Vr),Vr=null),N&&(e.preventDefault(),si())},wi=function(e){if(_o||(Zo=function(e){return document.elementsFromPoint(e.clientX,e.clientY).some((function(e){return e===I}))}(e),_o=!0),jo&&(Zo||Yr)){var n=di(e),t=Jn.apply(void 0,h(n).concat(h(Xr)))>=Y;Zo&&!ao&&fi(ti()),ao?(e.preventDefault(),vi.extend(e,!0)):Yr&&ae&&t&&vi.hideLongPressIndicator({time:pe}),$r>=0&&t&&(clearTimeout($r),$r=-1),Yr&&(uo=!0)}},xi=function(){To=void 0,Zo=!1,_o=!1,jo&&(+To>=0&&!Qr.has(To)&&ai([To],0),yi(),uo=!0)},bi=function(){var e=Math.max(jt.length,Kt.length);No=Math.max(2,Math.ceil(Math.sqrt(e)));for(var n=new Float32Array(4*Math.pow(No,2)),t=0;t<e;t++){n[4*t]=jt[t]||0,n[4*t+1]=Math.min(1,Kt[t]||0);var r=Number((Nn[t]||Nn[0])[3]);n[4*t+2]=Math.min(1,Number.isNaN(r)?1:r);var o=Number((jn[t]||jn[0])[3]);n[4*t+3]=Math.min(1,Number.isNaN(o)?1:o)}return a.regl.texture({data:n,shape:[No,No,4],type:"float"})},Pi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dn,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nn,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jn,r=e.length,o=n.length,i=t.length,a=[];if(r===o&&o===i)for(var c=0;c<r;c++)a.push(e[c],n[c],t[c],P);else for(var l=0;l<r;l++){var s=[e[l][0],e[l][1],e[l][2],1],u=D===an?n[0]:s,f=D===an?t[0]:s;a.push(e[l],u,f,P)}return a},Si=function(){var e=Pi(),n=e.length;zo=Math.max(2,Math.ceil(Math.sqrt(n)));var t=new Float32Array(4*Math.pow(zo,2));return e.forEach((function(e,n){t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),a.regl.texture({data:t,shape:[zo,zo,4],type:"float"})},Ai=function(){Rr=R([],[1/(Or=mr/gr),1,1]),Br=R([],[1/Or,1,1]),Dr=R([],[lo,1,1])},Ei=function(e,n){return function(t){if(t&&0!==t.length){var r=h(e()),o=ht(t)?t:[t];if(o=o.map((function(e){return mt(e,!0)})),i=r,a=o,!(Array.isArray(i)&&Array.isArray(a)&&i.length===a.length&&(0===i.length||Array.isArray(i[0])&&Array.isArray(a[0])&&i.every((function(e,n){var t=v(e,4),r=t[0],o=t[1],i=t[2],c=t[3],l=v(a[n],4),s=l[0],u=l[1],f=l[2],d=l[3];return r===s&&o===u&&i===f&&c===d}))))){var i,a;Io&&Io.destroy();try{n(o),Io=Si()}catch(e){console.error("Invalid colors. Switching back to default colors."),n(r),Io=Si()}}}}},Mi=Ei((function(){return Dn}),(function(e){Dn=e})),Ii=Ei((function(){return Nn}),(function(e){Nn=e})),Ci=Ei((function(){return jn}),(function(e){jn=e})),Ti=function(){if(Go||Uo){var e,n,t,r,o,i,a=v((e=Jo(-1,-1),n=Jo(1,1),t=(e[0]+1)/2,r=(n[0]+1)/2,o=(e[1]+1)/2,i=(n[1]+1)/2,[[Ko+t*qo,Ko+r*qo],[Yo+o*Ho,Yo+i*Ho]]),2),c=a[0],l=a[1];Go&&Go.domain(c),Uo&&Uo.domain(l)}},Li=function(e,n){gr=Math.max(1,e),I.height=Math.floor(gr*window.devicePixelRatio),Uo&&(Uo.range([gr,0]),n||Ti())},Oi=function(e){if(e===me)return ar=e,I.style.height="100%",void window.requestAnimationFrame((function(){I&&Li(I.getBoundingClientRect().height)}));!+e||+e<=0||(Li(ar=+e),I.style.height="".concat(ar,"px"))},Ri=function(){_r=Wt,Wt===me&&(_r=Array.isArray(jt)?jt.reduce(((e,n)=>n>e?n:e),-1/0):jt)},Bi=function(e){var n=Array.isArray(jt)?h(jt):jt;et(e,nt,{minLength:1})?jt=h(e):tt(+e)&&(jt=[+e]),n===jt||w(n,jt)||(Co&&Co.destroy(),mo=1/jt[0],Co=bi(),Ri())},Di=function(e,n){mr=Math.max(1,e),I.width=Math.floor(mr*window.devicePixelRatio),Go&&(Go.range([0,mr]),n||Ti())},zi=function(e){if(e===me)return lr=e,I.style.width="100%",void window.requestAnimationFrame((function(){I&&Di(I.getBoundingClientRect().width)}));!+e||+e<=0||(Di(lr=+e),I.style.width="".concat(mr,"px"))},Ni=function(e){switch(e){case"valueZ":return Vo;case"valueW":return Wo;default:return null}},ki=function(e,n){return e===Ce?function(e){return Math.round(e*(n.length-1))}:g},ji=function(){return p},Fi=function(){return[I.width,I.height]},_i=function(){return Io},Vi=function(){return zo},Wi=function(){return.5/zo},Zi=function(){return window.devicePixelRatio},Gi=function(){return wo},Ui=function(){return Co},Ki=function(){return No},qi=function(){return.5/No},Yi=function(){return 0},Hi=function(){return po||vo},Xi=function(){return Lo},$i=function(){return.5/Lo},Ji=function(){return Br},Qi=function(){return Ir.view},ea=function(){return Dr},na=function(){return L(r,Br,L(r,Ir.view,Dr))},ta=function(){return window.devicePixelRatio},ra=function(){return pt(mo,Ir.scaling[0])*window.devicePixelRatio},oa=function(){return Ir.scaling[0]>1?Math.asinh(pt(1,Ir.scaling[0]))/Math.asinh(1)*window.devicePixelRatio:pt(mo,Ir.scaling[0])*window.devicePixelRatio},ia=oa;"linear"===or?ia=ra:"constant"===or&&(ia=ta);var aa=function(){return no?to.size:oo},ca=function(){return Jr.length},la=function(){return ca()>0?Jt:1},sa=function(){return ca()>0?er:1},ua=function(){return+("valueZ"===D)},fa=function(){return+("valueW"===D)},da=function(){return+("valueZ"===Yt)},va=function(){return+("valueW"===Yt)},ha=function(){return+("density"===Yt)},pa=function(){return+("valueZ"===tr)},ya=function(){return+("valueW"===tr)},ma=function(){return+m},ga=function(){return"valueZ"===D?Vo===Ce?Dn.length-1:1:Wo===Ce?Dn.length-1:1},wa=function(){return"valueZ"===Yt?Vo===Ce?Kt.length-1:1:Wo===Ce?Kt.length-1:1},xa=function(){return"valueZ"===tr?Vo===Ce?jt.length-1:1:Wo===Ce?jt.length-1:1},ba=function(e){if("density"!==Yt)return 1;var n=ia(),t=jt[0]*n,r=2/(2/Ir.view[0])*(2/(2/Ir.view[5])),o=e.viewportHeight,i=e.viewportWidth,a=Xt*i*o/(io*t*t)*yt(1,r);a*=Er?1:1/(.25*Math.PI);var c=pt(1,t)+.5;return a*=Math.pow(t/c,2),yt(1,pt(0,a))},Pa=a.regl({framebuffer:function(){return yo},vert:"precision highp float;\n\nattribute vec2 position;\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // map normalized device coords to texture coords\n particleTextureIndex = 0.5 * (1.0 + position);\n\n gl_Position = vec4(position, 0, 1);\n}",frag:"precision highp float;\n\nuniform sampler2D startStateTex;\nuniform sampler2D endStateTex;\nuniform float t;\n\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // Interpolate x, y, and value\n vec3 start = texture2D(startStateTex, particleTextureIndex).xyw;\n vec3 end = texture2D(endStateTex, particleTextureIndex).xyw;\n vec3 curr = start * (1.0 - t) + end * t;\n\n // The category cannot be interpolated\n float endCategory = texture2D(endStateTex, particleTextureIndex).z;\n\n gl_FragColor = vec4(curr.xy, endCategory, curr.z);\n}",attributes:{position:[-4,0,4,4,4,-4]},uniforms:{startStateTex:function(){return ho},endStateTex:function(){return vo},t:function(e,n){return n.t}},count:3}),Sa=function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:la,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:sa;return a.regl({frag:Er?"precision highp float;\n\nvarying vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n":"\nprecision highp float;\n\nuniform float antiAliasing;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nvoid main() {\n vec2 c = gl_PointCoord * 2.0 - 1.0;\n float sdf = length(c) * finalPointSize;\n float alpha = linearstep(finalPointSize + antiAliasing, finalPointSize - antiAliasing, sdf);\n\n gl_FragColor = vec4(color.rgb, alpha * color.a);\n}\n",vert:Mt(r),blend:{enable:!Mr,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},attributes:{stateIndex:{buffer:t,size:2}},uniforms:{antiAliasing:ji,resolution:Fi,modelViewProjection:na,devicePixelRatio:Zi,pointScale:function(){return ia()},encodingTex:Ui,encodingTexRes:Ki,encodingTexEps:qi,pointOpacityMax:o,pointOpacityScale:i,pointSizeExtra:e,globalState:r,colorTex:_i,colorTexRes:Vi,colorTexEps:Wi,stateTex:Hi,stateTexRes:Xi,stateTexEps:$i,isColoredByZ:ua,isColoredByW:fa,isOpacityByZ:da,isOpacityByW:va,isOpacityByDensity:ha,isSizedByZ:pa,isSizedByW:ya,isPixelAligned:ma,colorMultiplicator:ga,opacityMultiplicator:wa,opacityDensity:ba,sizeMultiplicator:xa,numColorStates:4,drawingBufferWidth:function(e){return e.drawingBufferWidth},drawingBufferHeight:function(e){return e.drawingBufferHeight}},count:n,primitive:"points"})},Aa=Sa(Yi,aa,(function(){return go})),Ea=Sa(Yi,(function(){return 1}),(function(){return xo}),2,(function(){return 1}),(function(){return 1})),Ma=Sa((function(){return(_t+2*Gt)*window.devicePixelRatio}),ca,Gi,1,(function(){return 1}),(function(){return 1})),Ia=Sa((function(){return(_t+Gt)*window.devicePixelRatio}),ca,Gi,3,(function(){return 1}),(function(){return 1})),Ca=Sa((function(){return _t*window.devicePixelRatio}),ca,Gi,1,(function(){return 1}),(function(){return 1})),Ta=a.regl({frag:"\nprecision mediump float;\n\nuniform sampler2D texture;\n\nvarying vec2 uv;\n\nvoid main () {\n gl_FragColor = texture2D(texture, uv);\n}\n",vert:"\nprecision mediump float;\n\nuniform mat4 modelViewProjection;\n\nattribute vec2 position;\n\nvarying vec2 uv;\n\nvoid main () {\n uv = position;\n gl_Position = modelViewProjection * vec4(-1.0 + 2.0 * uv.x, 1.0 - 2.0 * uv.y, 0, 1);\n}\n",attributes:{position:[0,1,0,0,1,0,0,1,1,1,1,0]},uniforms:{modelViewProjection:na,texture:function(){return E}},count:6}),La=a.regl({vert:"\n precision mediump float;\n uniform mat4 modelViewProjection;\n attribute vec2 position;\n void main () {\n gl_Position = modelViewProjection * vec4(position, 0, 1);\n }",frag:"\n precision mediump float;\n uniform vec4 color;\n void main () {\n gl_FragColor = vec4(color.rgb, 0.2);\n }",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},attributes:{position:function(){return co}},uniforms:{modelViewProjection:na,color:function(){return W}},elements:function(){return j(Cr.getPoints())}}),Oa=function(e){for(var n=new Float32Array(2*e),t=0,r=0;r<e;++r){var o=ci(r);n[t]=o[0],n[t+1]=o[1],t+=2}return n},Ra=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.length;Lo=Math.max(2,Math.ceil(Math.sqrt(t))),Oo=.5/Lo;for(var r=new Float32Array(4*Math.pow(Lo,2)),o=!0,i=!0,c=0,l=0,s=0,u=0;u<t;++u)r[c=4*u]=e[u][0],r[c+1]=e[u][1],l=e[u][2]||0,s=e[u][3]||0,r[c+2]=l,r[c+3]=s,o&&(o=Number.isInteger(l)),i&&(i=Number.isInteger(s));return Vo=n.z&&Le.includes(n.z)?n.z:o?Te:Ce,Wo=n.w&&Le.includes(n.w)?n.w:i?Te:Ce,a.regl.texture({data:r,shape:[Lo,Lo,4],type:"float"})},Ba=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(t){jo=!1;var r=(null==n?void 0:n.preventFilterReset)&&e.length===oo;oo=e.length,io=oo,vo&&vo.destroy(),vo=Ra(e,{z:n.zDataType,w:n.wDataType}),r||go({usage:"static",type:"float",data:Oa(oo)}),ye(n.spatialIndex||e,{useWorker:Ar}).then((function(n){Lr=n,ro=e,jo=!0})).then(t)}))},Da=function(e,n){bo=Ir.target,Po=e,So=Ir.distance[0],Ao=n},za=function(e){var n="inherit"===Yn?D:Yn;if("segment"===n){var t=Wn.length-1;return t<1?[]:e.reduce((function(e,n,r){for(var o=0,i=[],a=2;a<n.length;a+=2){var c=Math.sqrt(Math.pow(n[a-2]-n[a],2)+Math.pow(n[a-1]-n[a+1],2));i.push(c),o+=c}e[r]=[0];for(var l=0,s=0;s<n.length/2-1;s++)l+=i[s],e[r].push(4*Math.floor(l/o*t));return e}),[])}if(n){var r=Rt(n),o=ki(Ni(n),"inherit"===Yn?Dn:Wn);return Nr.reduce((function(e,n){var t=v(n,2),i=t[0],a=t[1];return e[i]=4*o(a[r]),e}),[])}return new Array(Nr.length).fill(0)},Na=function(){var e="inherit"===it?Yt:it;if("segment"===e){var n=$n.length-1;return n<1?[]:Nr.reduce((function(e,t){var r=v(t,3),o=r[0];r[1];var i=r[2];return e[o]=x(i,(function(e){return $n[Math.floor(e/(i-1)*n)]})),e}),[])}if(e){var t=Rt(e),r="inherit"===it?Kt:$n,o=ki(Ni(e),r);return Nr.reduce((function(e,n){var i=v(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e}),[])}},ka=function(){var e="inherit"===Tt?tr:Tt;if("segment"===e){var n=st.length-1;return n<1?[]:Nr.reduce((function(e,t){var r=v(t,3),o=r[0];r[1];var i=r[2];return e[o]=x(i,(function(e){return st[Math.floor(e/(i-1)*n)]})),e}),[])}if(e){var t=Rt(e),r="inherit"===Tt?jt:st,o=ki(Ni(e),r);return Nr.reduce((function(e,n){var i=v(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e}),[])}},ja=function(e){return new Promise((function(n){zr.setPoints([]),(null==e?void 0:e.length)>0?(kr=!0,Ct(e,{maxIntPointsPerSegment:Dt,tolerance:Nt}).then((function(e){!function(e){Nr=[];var n=0;Object.keys(e).forEach((function(t,r){Nr[t]=[r,e[t].reference,e[t].length/2,n],n+=e[t].length/2}))}(e);var t=Object.values(e);zr.setPoints(1===t.length?t[0]:t,{colorIndices:za(t),opacities:Na(),widths:ka()}),kr=!1,n()}))):n()}))},Fa=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,r=void 0!==t&&t;no=!0,to.clear();var o,i=Array.isArray(e)?e:[e],a=[],c=[],l=[],u=s(i);try{for(u.s();!(o=u.n()).done;){var f=o.value;!Number.isFinite(f)||f<0||f>=oo||(a.push(f),to.add(f),Qr.has(f)&&l.push(f))}}catch(e){u.e(e)}finally{u.f()}var d,v=s(function(e){for(var n=e.length,t=1;t<n;t++){for(var r=e[t],o=t-1;o>-1&&r<e[o];)e[o+1]=e[o],o--;e[o+1]=r}return e}([].concat(a)));try{for(v.s();!(d=v.n()).done;){var h=d.value;c.push.apply(c,ci(h))}}catch(e){v.e(e)}finally{v.f()}return go.subdata(c),ui(l,{preventEvent:r}),to.has(To)||fi(-1,{preventEvent:r}),new Promise((function(e){var t=function(){n.subscribe("draw",(function(){r||n.publish("filter",{points:a}),e()}),1),uo=!0};_n||ii(ro[0])?ja(ei()).then((function(){r||n.publish("pointConnectionsDraw"),ui(l,{preventEvent:r}),t()})):t()}))},_a=function(){return ni(Zr[0],Zr[1],Wr[0],Wr[1])},Va=A((function(){io=_a().length}),Pr),Wa=function(){return Boolean(ho&&po)},Za=function(){return Boolean(void 0!==bo&&void 0!==Po&&void 0!==So&&void 0!==Ao)},Ga=function(e,n){Bo||(Bo=performance.now());var t,r,o,i=performance.now()-Bo,a=(t=n(i/e),r=0,o=1,Math.min(o,Math.max(r,t)));return Wa()&&Pa({t:a}),Za()&&function(e){var n=v(bo,2),t=n[0],r=n[1],o=v(Po,2),i=1-e,a=t*i+o[0]*e,c=r*i+o[1]*e,l=So*i+Ao*e;Ir.lookAt([a,c],l)}(a),i<e},Ua=function(){Ro=!1,Bo=null,Eo=void 0,Mo=void 0,Ln=Do,ho&&(ho.destroy(),ho=void 0),po&&(po.destroy(),po=void 0),bo=void 0,Po=void 0,So=void 0,Ao=void 0,n.publish("transitionEnd")},Ka=function(e){var t=e.duration,r=void 0===t?500:t,o=e.easing,i=void 0===o?Ie:o;Ro&&n.publish("transitionEnd"),Ro=!0,Bo=null,Eo=r,Mo=ft(i)?Me[i]||Ie:i,Do=Ln,Ln=!1,n.publish("transitionStart")},qa=function(e){return Kr?Promise.reject(new An):(Fo=!1,0===e.length?new Promise((function(e){Tr.clear(),n.subscribe("draw",e,1),Fo=!0,uo=!0})):new Promise((function(t){var r,o=[],i=new Map,a=[],c=[],l=-1,u=function(e){c.push(e.lineWidth||dr);var n=mt(e.lineColor||ur,!0),t="[".concat(n.join(","),"]");if(i.has(t)){var r=i.get(t).idx;a.push(r)}else{var o=++l;i.set(t,{idx:o,color:n}),a.push(o)}},f=s(e);try{for(f.s();!(r=f.n()).done;){var d,v,h,p,y=r.value;if(xt(y))o.push([null!==(d=y.x1)&&void 0!==d?d:-hr,y.y,null!==(v=y.x2)&&void 0!==v?v:hr,y.y]),u(y);else if(bt(y))o.push([y.x,null!==(h=y.y1)&&void 0!==h?h:-hr,y.x,null!==(p=y.y2)&&void 0!==p?p:hr]),u(y);else St(y)?(o.push([y.x1,y.y1,y.x2,y.y1,y.x2,y.y2,y.x1,y.y2,y.x1,y.y1]),u(y)):Pt(y)?(o.push([y.x,y.y,y.x+y.width,y.y,y.x+y.width,y.y+y.height,y.x,y.y+y.height,y.x,y.y]),u(y)):At(y)&&(o.push(y.vertices.flatMap(g)),u(y))}}catch(e){f.e(e)}finally{f.f()}Tr.setStyle({color:Array.from(i.values()).sort((function(e,n){return e.idx>n.idx?1:-1})).map((function(e){return e.color}))}),Tr.setPoints(1===o.length?o.flat():o,{colorIndices:a,widths:c}),n.subscribe("draw",t,1),Fo=!0,uo=!0})))},Ya=function(e){return function(){var t=e.apply(void 0,arguments);return uo=!0,new Promise((function(e){n.subscribe("draw",(function(){return e(t)}),1)}))}},Ha=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r){var o=B([],[e.x+e.width/2,e.y+e.height/2,0,0],Dr).slice(0,2),i=2*Math.atan(1),a=Or/lo,c=e.height*a>=e.width?e.height/2/Math.tan(i/2):e.width/2/Math.tan(i/2)/a;t.transition?(Ir.config({isFixed:!0}),Da(o,c),n.subscribe("transitionEnd",(function(){r(),Ir.config({isFixed:yr})}),1),Ka({duration:t.transitionDuration,easing:t.transitionEasing})):(Ir.lookAt(o,c),n.subscribe("draw",r,1),uo=!0)}))},Xa=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(o){r.transition?(Ir.config({isFixed:!0}),Da(e,t),n.subscribe("transitionEnd",(function(){o(),Ir.config({isFixed:yr})}),1),Ka({duration:r.transitionDuration,easing:r.transitionEasing})):(Ir.lookAt(e,t),n.subscribe("draw",o,1),uo=!0)}))},$a=function(){zr.setStyle({color:Pi(Wn,Gn,Kn),opacity:null===$n?null:$n[0],width:st[0]})},Ja=function(){var e=Math.round(qr)>.5?0:255;vi.initiator.style.border="1px dashed rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.33)"),vi.initiator.style.background="rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.1)")},Qa=function(){var e=Math.round(qr)>.5?0:255;vi.longPressIndicator.style.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")"),vi.longPressIndicator.dataset.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")");var n=W.map((function(e){return Math.round(255*e)}));vi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")},ec=function(e){e&&Ir.setView(e)},nc=function(e){(Mn=Object.entries(e).reduce((function(e,n){var t=v(n,2),r=t[0],o=t[1];return $e.includes(o)&&Ue.includes(r)&&(e[r]=o),e}),{}))[We]?Ir.config({isRotate:!0,mouseDownMoveModKey:Mn[We]}):Ir.config({isRotate:!1})},tc=function(e,n){return function(t){if("inherit"===t)e(h(n()));else{var r=ht(t)?t:[t];e(r.map((function(e){return mt(e,!0)})))}$a()}},rc=tc((function(e){Wn=e}),(function(){return Dn})),oc=tc((function(e){Gn=e}),(function(){return Nn})),ic=tc((function(e){Kn=e}),(function(){return jn})),ac=function(e){p=Number(e)||.5},cc=function(e){m=Boolean(e)},lc=function(){var e,t,r,o,i,c,l,s,u,f,d,v,p,y,m,g,x,b,S,A,M,C,T,L,O,R,B,z,k,j,F,V,Z,U,q,H,$,Q,ne,re,ie,ce,se,fe,de,he,ye=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Kr?Promise.reject(new Error(An)):(Lt(ye),void 0===ye.backgroundColor&&void 0===ye.background||(e=ye.backgroundColor||ye.background)&&(P=mt(e,!0),qr=gt(P),Ja(),Qa()),void 0!==ye.backgroundImage&&((t=ye.backgroundImage)?ft(t)?ot(a.regl,t).then((function(e){E=e,uo=!0,n.publish("backgroundImageReady")})).catch((function(){console.error("Count not create texture from ".concat(t)),E=null})):E="texture2d"===t._reglType?t:null:E=null),void 0!==ye.cameraTarget&&(r=ye.cameraTarget)&&Ir.lookAt(r,Ir.distance[0],Ir.rotation),void 0!==ye.cameraDistance&&(o=ye.cameraDistance)>0&&Ir.lookAt(Ir.target,o,Ir.rotation),void 0!==ye.cameraRotation&&null!==(i=ye.cameraRotation)&&Ir.lookAt(Ir.target,Ir.distance[0],i),void 0!==ye.cameraView&&ec(ye.cameraView),void 0!==ye.cameraIsFixed&&(c=ye.cameraIsFixed,yr=Boolean(c),Ir.config({isFixed:yr})),void 0!==ye.colorBy&&(l=ye.colorBy,D=Ot(l,an)),void 0!==ye.pointColor&&Mi(ye.pointColor),void 0!==ye.pointColorActive&&Ii(ye.pointColorActive),void 0!==ye.pointColorHover&&Ci(ye.pointColorHover),void 0!==ye.pointSize&&Bi(ye.pointSize),void 0!==ye.pointSizeSelected&&(!+(s=ye.pointSizeSelected)||+s<0||(_t=+s)),void 0!==ye.pointSizeMouseDetection&&(u=ye.pointSizeMouseDetection,Wt=u,Ri()),void 0!==ye.sizeBy&&function(e){tr=Ot(e,nn)}(ye.sizeBy),void 0!==ye.opacity&&(f=ye.opacity,d=Array.isArray(Kt)?h(Kt):Kt,et(f,nt,{minLength:1})?Kt=h(f):tt(+f)&&(Kt=[+f]),d===Kt||w(d,Kt)||(Co&&Co.destroy(),Co=bi())),void 0!==ye.showPointConnections&&(v=ye.showPointConnections,(_n=!!v)?jo&&ii(ro[0])&&ja(ei()).then((function(){n.publish("pointConnectionsDraw"),uo=!0})):ja()),void 0!==ye.pointConnectionColor&&rc(ye.pointConnectionColor),void 0!==ye.pointConnectionColorActive&&oc(ye.pointConnectionColorActive),void 0!==ye.pointConnectionColorHover&&ic(ye.pointConnectionColorHover),void 0!==ye.pointConnectionColorBy&&function(e){Yn=Ot(e,fn,{allowSegment:!0,allowInherit:!0})}(ye.pointConnectionColorBy),void 0!==ye.pointConnectionOpacityBy&&function(e){it=Ot(e,rn,{allowSegment:!0})}(ye.pointConnectionOpacityBy),void 0!==ye.pointConnectionOpacity&&function(e){et(e,nt,{minLength:1})&&($n=h(e)),tt(+e)&&($n=[+e]),Wn=Wn.map((function(e){return e[3]=Number.isNaN(+$n[0])?e[3]:+$n[0],e})),$a()}(ye.pointConnectionOpacity),void 0!==ye.pointConnectionOpacityActive&&function(e){!Number.isNaN(+e)&&+e&&(ct=+e)}(ye.pointConnectionOpacityActive),void 0!==ye.pointConnectionSize&&(p=ye.pointConnectionSize,et(p,nt,{minLength:1})&&(st=h(p)),tt(+p)&&(st=[+p]),$a()),void 0!==ye.pointConnectionSizeActive&&(y=ye.pointConnectionSizeActive,!Number.isNaN(+y)&&+y&&(vt=Math.max(0,y))),void 0!==ye.pointConnectionSizeBy&&function(e){Tt=Ot(e,tn,{allowSegment:!0})}(ye.pointConnectionSizeBy),void 0!==ye.pointConnectionMaxIntPointsPerSegment&&(m=ye.pointConnectionMaxIntPointsPerSegment,Dt=Math.max(0,m)),void 0!==ye.pointConnectionTolerance&&(g=ye.pointConnectionTolerance,Nt=Math.max(0,g)),void 0!==ye.pointScaleMode&&function(e){switch(e){case"linear":or=e,ia=ra;break;case"constant":or=e,ia=ta;break;default:or="asinh",ia=oa}}(ye.pointScaleMode),void 0!==ye.opacityBy&&function(e){Yt=Ot(e,on,{allowDensity:!0})}(ye.opacityBy),void 0!==ye.lassoColor&&function(e){if(e){W=mt(e,!0),Cr.setStyle({color:W});var n=W.map((function(e){return Math.round(255*e)}));vi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")}}(ye.lassoColor),void 0!==ye.lassoLineWidth&&(x=ye.lassoLineWidth,Number.isNaN(+x)||+x<1||(G=+x,Cr.setStyle({width:G}))),void 0!==ye.lassoMinDelay&&+(b=ye.lassoMinDelay)&&(K=+b,vi.set({minDelay:K})),void 0!==ye.lassoMinDist&&+(S=ye.lassoMinDist)&&(Y=+S,vi.set({minDist:Y})),void 0!==ye.lassoClearEvent&&(A=ye.lassoClearEvent,J=rt(Be,J)(A)),void 0!==ye.lassoInitiator&&(M=ye.lassoInitiator,ee=Boolean(M),vi.set({enableInitiator:ee})),void 0!==ye.lassoInitiatorParentElement&&(C=ye.lassoInitiatorParentElement,te=C,vi.set({initiatorParentElement:te})),void 0!==ye.lassoLongPressIndicatorParentElement&&(T=ye.lassoLongPressIndicatorParentElement,oe=T,vi.set({longPressIndicatorParentElement:oe})),void 0!==ye.lassoOnLongPress&&(L=ye.lassoOnLongPress,ae=Boolean(L)),void 0!==ye.lassoLongPressTime&&(O=ye.lassoLongPressTime,le=Number(O)),void 0!==ye.lassoLongPressAfterEffectTime&&(R=ye.lassoLongPressAfterEffectTime,ue=Number(R)),void 0!==ye.lassoLongPressEffectDelay&&(B=ye.lassoLongPressEffectDelay,ve=Number(B)),void 0!==ye.lassoLongPressRevertEffectTime&&function(e){pe=Number(e)}(ye.lassoLongPressRevertEffectTime),void 0!==ye.lassoType&&("brush"===(z=ye.lassoType)?vi.set({type:z,minDist:Math.max(3,Y)}):vi.set({type:z,minDist:Y}),xe=vi.get("type")),void 0!==ye.lassoMode&&(k=ye.lassoMode,X=k),void 0!==ye.lassoBrushSize&&(j=ye.lassoBrushSize,xn=Number(j)||xn,vi.set({brushSize:xn})),void 0!==ye.actionKeyMap&&nc(ye.actionKeyMap),void 0!==ye.mouseMode&&(F=ye.mouseMode,Cn=rt(Ae,be)(F),Ir.config({defaultMouseDownMoveAction:Cn===Se?"rotate":"pan"})),void 0!==ye.showReticle&&null!==(V=ye.showReticle)&&(Ln=V),void 0!==ye.reticleColor&&(Z=ye.reticleColor)&&(Rn=mt(Z,!0),jr.setStyle({color:Rn}),Fr.setStyle({color:Rn})),void 0!==ye.pointOutlineWidth&&(!+(U=ye.pointOutlineWidth)||+U<0||(Gt=+U)),void 0!==ye.height&&Oi(ye.height),void 0!==ye.width&&zi(ye.width),void 0!==ye.aspectRatio&&(+(q=ye.aspectRatio)<=0||(lo=q)),void 0!==ye.xScale&&(H=ye.xScale)&&(Go=H,Ko=H.domain()[0],qo=H?H.domain()[1]-H.domain()[0]:0,Go.range([0,mr]),Ti()),void 0!==ye.yScale&&($=ye.yScale)&&(Yo=(Uo=$).domain()[0],Ho=Uo?Uo.domain()[1]-Uo.domain()[0]:0,Uo.range([gr,0]),Ti()),void 0!==ye.deselectOnDblClick&&(Q=ye.deselectOnDblClick,N=!!Q),void 0!==ye.deselectOnEscape&&(ne=ye.deselectOnEscape,_=!!ne),void 0!==ye.opacityByDensityFill&&(re=ye.opacityByDensityFill,Xt=+re),void 0!==ye.opacityInactiveMax&&(ie=ye.opacityInactiveMax,Jt=+ie),void 0!==ye.opacityInactiveScale&&(ce=ye.opacityInactiveScale,er=+ce),void 0!==ye.gamma&&(se=ye.gamma,a.gamma=se),void 0!==ye.annotationLineColor&&(fe=ye.annotationLineColor,ur=mt(fe)),void 0!==ye.annotationLineWidth&&(de=ye.annotationLineWidth,dr=+de),void 0!==ye.annotationHVLineLimit&&(he=ye.annotationHVLineLimit,hr=+he),void 0!==ye.antiAliasing&&ac(ye.antiAliasing),void 0!==ye.pixelAligned&&cc(ye.pixelAligned),new Promise((function(e){window.requestAnimationFrame((function(){!Kr&&I&&(Ai(),Ir.refresh(),a.refresh(),wc(),e())}))})))},sc=function(){Ir||(Ir=k(I,{isFixed:yr,isPanInverted:[!1,!0],defaultMouseDownMoveAction:Cn===Se?"rotate":"pan"})),e.cameraView?Ir.setView(C(e.cameraView)):e.cameraTarget||e.cameraDistance||e.cameraRotation?Ir.lookAt(h(e.cameraTarget||yn),e.cameraDistance||1,e.cameraRotation||0):Ir.setView(C(mn)),Wr=Jo(1,1),Zr=Jo(-1,-1)},uc=function(e){if("Escape"===e.key)_&&si()},fc=function(){Zo=!0,_o=!0},dc=function(){fi(),Zo=!1,_o=!0,uo=!0},vc=function(){uo=!0},hc=function(){Ba([]),zr.clear()},pc=function(){qa([])},yc=function(){var e=lr===me,n=ar===me;if(e||n){var t=I.getBoundingClientRect(),r=t.width,o=t.height;e&&Di(r,!0),n&&Li(o,!0),Ai(),Ti(),uo=!0}Ir.refresh()},mc=function(){var e,t=(e=d().mark((function e(t){var r,o,i,c,l,s,u,f,v,h,y,g,w;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.style.userSelect="none",r=window.devicePixelRatio,o=jt,i=lr,c=ar,l=a.canvas.width/r,s=a.canvas.height/r,u=m,f=p,v=(null==t?void 0:t.scale)||1,h=Array.isArray(jt)?jt.map((function(e){return e*v})):jt*v,y=mr*v,g=gr*v,Bi(h),zi(y),Oi(g),cc((null==t?void 0:t.pixelAligned)||m),ac((null==t?void 0:t.antiAliasing)||p),a.resize(lr,ar),a.refresh(),e.next=22,new Promise((function(e){n.subscribe("draw",e,1),wc()}));case 22:return w=I.getContext("2d").getImageData(0,0,I.width,I.height),a.resize(l,s),a.refresh(),Bi(o),zi(i),Oi(c),cc(u),ac(f),e.next=32,new Promise((function(e){n.subscribe("draw",e,1),wc()}));case 32:return I.style.userSelect=null,e.abrupt("return",w);case 34:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,o){var i=e.apply(n,t);function a(e){c(i,r,o,a,l,"next",e)}function l(e){c(i,r,o,a,l,"throw",e)}a(void 0)}))});return function(e){return t.apply(this,arguments)}}(),gc=a.onFrame((function(){if(ko=Ir.tick(),(jo||Fo)&&(uo||Ro)){Ro&&!Ga(Eo,Mo)&&Ua(),ko&&(Wr=Jo(1,1),Zr=Jo(-1,-1),"density"===Yt&&Va()),a.render((function(){var e;!function(e,n){Br[0]=e/Or,Br[5]=n}(I.width/a.canvas.width,I.height/a.canvas.height),null!==(e=E)&&void 0!==e&&e._reglType&&Ta(),co.length>2&&La(),Ro||zr.draw({projection:Ji(),model:ea(),view:Qi()});var n=aa();jo&&n>0&&Aa(),Yr||!Ln&&!fo||function(){if(To>=0){var e=v(ro[To].slice(0,2),2),n=[e[0],e[1],0,1];L(t,Br,L(t,Ir.view,Dr)),B(n,n,t),jr.setPoints([-1,n[1],1,n[1]]),Fr.setPoints([n[0],1,n[0],-1]),jr.draw(),Fr.draw(),Sa((function(){return(_t+2*Gt)*window.devicePixelRatio}),(function(){return 1}),xo,1)(),Sa((function(){return(_t+Gt)*window.devicePixelRatio}),(function(){return 1}),xo,3)()}}(),To>=0&&Ea(),Jr.length>0&&(Ma(),Ia(),Ca()),Tr.draw({projection:Ji(),model:ea(),view:Qi()}),Cr.draw({projection:Ji(),model:ea(),view:Qi()})}),I);var e={view:Ir.view,isViewChanged:ko,camera:Ir,xScale:Go,yScale:Uo};ko&&(Ti(),so?so=!1:n.publish("view",e)),uo=!1,fo=!1,n.publish("drawing",e,{async:!1}),n.publish("draw",e)}})),wc=function(){uo=!0};return function(){Ai(),sc(),Ti(),Cr=fe(a.regl,{color:W,width:G,is2d:!0}),zr=fe(a.regl,{color:Pi(Wn,Gn,Kn),opacity:null===$n?null:$n[0],width:st[0],is2d:!0}),jr=fe(a.regl,{color:Rn,width:1,is2d:!0}),Fr=fe(a.regl,{color:Rn,width:1,is2d:!0}),Tr=fe(a.regl,{color:ur,width:dr,is2d:!0}),Ri(),I.addEventListener("wheel",vc),go=a.regl.buffer(),wo=a.regl.buffer(),xo=a.regl.buffer({usage:"dynamic",type:"float",length:2*ge}),Io=Si(),Co=bi();var e=lc({backgroundImage:E,width:lr,height:ar,actionKeyMap:Mn});Ja(),Qa(),window.addEventListener("keyup",uc,!1),window.addEventListener("blur",xi,!1),window.addEventListener("mouseup",yi,!1),window.addEventListener("mousemove",wi,!1),I.addEventListener("mousedown",pi,!1),I.addEventListener("mouseenter",fc,!1),I.addEventListener("mouseleave",dc,!1),I.addEventListener("click",mi,!1),I.addEventListener("dblclick",gi,!1),"ResizeObserver"in window?(Gr=new ResizeObserver(yc)).observe(I):(window.addEventListener("resize",yc),window.addEventListener("orientationchange",yc)),e.then((function(){n.publish("init")}))}(),{get isSupported(){return a.isSupported},clear:Ya((function(){hc(),pc()})),clearPoints:Ya(hc),clearPointConnections:Ya((function(){zr.clear()})),clearAnnotations:Ya(pc),createTextureFromUrl:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bn;return ot(a.regl,e,n)},deselect:si,destroy:function(){jo=!1,Fo=!1,Kr=!0,gc(),window.removeEventListener("keyup",uc,!1),window.removeEventListener("blur",xi,!1),window.removeEventListener("mouseup",yi,!1),window.removeEventListener("mousemove",wi,!1),I.removeEventListener("mousedown",pi,!1),I.removeEventListener("mouseenter",fc,!1),I.removeEventListener("mouseleave",dc,!1),I.removeEventListener("click",mi,!1),I.removeEventListener("dblclick",gi,!1),I.removeEventListener("wheel",vc,!1),Gr?Gr.disconnect():(window.removeEventListener("resize",yc),window.removeEventListener("orientationchange",yc)),I=void 0,Ir.dispose(),Ir=void 0,Cr.destroy(),vi.destroy(),zr.destroy(),jr.destroy(),Fr.destroy(),Io&&Io.destroy(),Co&&Co.destroy(),e.renderer||a.isDestroyed||a.destroy(),n.publish("destroy"),n.clear()},draw:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Kr?Promise.reject(new Error(An)):Ur?Promise.reject(new Error("Ignoring draw call as the previous draw call has not yet finished. To avoid this warning `await` the draw call.")):(Ur=!0,wt(e).then((function(e){return new Promise((function(r){if(Kr)r();else{var o=!1;t.preventFilterReset&&(null==e?void 0:e.length)===oo||(no=!1,to.clear());var i=e&&ii(e[0])&&(_n||t.showPointConnectionsOnce),c=t.zDataType,l=t.wDataType;new Promise((function(s){e?(t.transition&&(e.length===oo?o=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!vo)return!1;if(Ro){var t=ho;ho=po,t.destroy()}else ho=vo;return po=Ra(e,n),yo=a.regl.framebuffer({color:po,depth:!1,stencil:!1}),vo=void 0,!0}(e,{z:c,w:l}):console.warn("Cannot transition! The number of points between the previous and current draw call must be identical.")),Ba(e,{zDataType:c,wDataType:l,preventFilterReset:t.preventFilterReset,spatialIndex:t.spatialIndex}).then((function(){void 0!==t.hover&&fi(t.hover,{preventEvent:!0}),void 0!==t.select&&ui(t.select,{preventEvent:!0}),void 0!==t.filter&&Fa(t.filter,{preventEvent:!0}),i?ja(e).then((function(){n.publish("pointConnectionsDraw"),uo=!0,fo=t.showReticleOnce})).then((function(){return r()})):s()}))):s()})).then((function(){t.transition&&o?(i?Promise.all([new Promise((function(e){n.subscribe("transitionEnd",(function(){uo=!0,fo=t.showReticleOnce,e()}),1)})),new Promise((function(e){n.subscribe("pointConnectionsDraw",e,1)}))]).then((function(){return r()})):n.subscribe("transitionEnd",(function(){uo=!0,fo=t.showReticleOnce,r()}),1),Ka({duration:t.transitionDuration,easing:t.transitionEasing})):(i?Promise.all([new Promise((function(e){n.subscribe("draw",e,1)})),new Promise((function(e){n.subscribe("pointConnectionsDraw",e,1)}))]).then((function(){return r()})):n.subscribe("draw",(function(){return r()}),1),uo=!0,fo=t.showReticleOnce)}))}})).finally((function(){Ur=!1}))})))},drawAnnotations:qa,filter:Fa,get:function(e){var n,t=v(Object.keys(Lt(u({},e,Pn))),1)[0];return"aspectRatio"===t?lo:"background"===t||"backgroundColor"===t?P:"backgroundImage"===t?E:"camera"===t?Ir:"cameraTarget"===t?Ir.target:"cameraDistance"===t?Ir.distance[0]:"cameraRotation"===t?Ir.rotation:"cameraView"===t?Ir.view:"cameraIsFixed"===t?yr:"canvas"===t?I:"colorBy"===t?D:"sizeBy"===t?tr:"deselectOnDblClick"===t?N:"deselectOnEscape"===t?_:"height"===t?ar:"lassoColor"===t?W:"lassoLineWidth"===t?G:"lassoMinDelay"===t?K:"lassoMinDist"===t?Y:"lassoClearEvent"===t?J:"lassoInitiator"===t?ee:"lassoInitiatorElement"===t?vi.initiator:"lassoInitiatorParentElement"===t?te:"lassoLongPressIndicatorParentElement"===t?oe:"lassoOnLongPress"===t?ae:"lassoType"===t?xe:"lassoBrushSize"===t?xn:"mouseMode"===t?Cn:"opacity"===t?1===Kt.length?Kt[0]:Kt:"opacityBy"===t?Yt:"opacityByDensityFill"===t?Xt:"opacityByDensityDebounceTime"===t?Pr:"opacityInactiveMax"===t?Jt:"opacityInactiveScale"===t?er:"points"===t?ro:"hoveredPoint"===t?To:"selectedPoints"===t?h(Jr):"filteredPoints"===t?no?Array.from(to):Array.from({length:ro.length},(function(e,n){return n})):"pointsInView"===t?_a():"pointColor"===t?1===Dn.length?Dn[0]:Dn:"pointColorActive"===t?1===Nn.length?Nn[0]:Nn:"pointColorHover"===t?1===jn.length?jn[0]:jn:"pointOutlineWidth"===t?Gt:"pointSize"===t?1===jt.length?jt[0]:jt:"pointSizeSelected"===t?_t:"pointSizeMouseDetection"===t?Wt:"showPointConnections"===t?_n:"pointConnectionColor"===t?1===Wn.length?Wn[0]:Wn:"pointConnectionColorActive"===t?1===Gn.length?Gn[0]:Gn:"pointConnectionColorHover"===t?1===Kn.length?Kn[0]:Kn:"pointConnectionColorBy"===t?Yn:"pointConnectionOpacity"===t?1===$n.length?$n[0]:$n:"pointConnectionOpacityBy"===t?it:"pointConnectionOpacityActive"===t?ct:"pointConnectionSize"===t?1===st.length?st[0]:st:"pointConnectionSizeActive"===t?vt:"pointConnectionSizeBy"===t?Tt:"pointConnectionMaxIntPointsPerSegment"===t?Dt:"pointConnectionTolerance"===t?Nt:"pointScaleMode"===t?or:"reticleColor"===t?Rn:"regl"===t?a.regl:"showReticle"===t?Ln:"version"===t?"1.14.1-hemato.2":"width"===t?lr:"xScale"===t?Go:"yScale"===t?Uo:"performanceMode"===t?xr:"renderPointsAsSquares"===t?Er:"disableAlphaBlending"===t?Mr:"gamma"===t?a.gamma:"renderer"===t?a:"isDestroyed"===t?Kr:"isDrawing"===t?Ur:"isPointsDrawn"===t?jo:"isPointsFiltered"===t?no:"isAnnotationsDrawn"===t?Fo:"zDataType"===t?Vo:"wDataType"===t?Wo:"spatialIndex"===t?null===(n=Lr)||void 0===n?void 0:n.data:"annotationLineColor"===t?ur:"annotationLineWidth"===t?dr:"annotationHVLineLimit"===t?hr:"antiAliasing"===t?p:"pixelAligned"===t?m:"actionKeyMap"===t?function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach((function(n){u(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},Mn):void 0},getScreenPosition:function(e){if(!jo)throw new Error(Sn);var n=ro[e];if(n){var r=[n[0],n[1],0,1];return L(t,Rr,L(t,Ir.view,Dr)),B(r,r,t),[mr*(r[0]+1)/2,gr*(.5-r[1]/2)]}},hover:fi,redraw:wc,refresh:a.refresh,reset:Ya((function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;sc(),Ti(),t||n.publish("view",{view:Ir.view,camera:Ir,xScale:Go,yScale:Uo})})),select:ui,set:lc,export:function(e){return void 0===e?I.getContext("2d").getImageData(0,0,I.width,I.height):mc(e)},subscribe:n.subscribe,unfilter:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;return no=!1,to.clear(),go.subdata(Oa(oo)),new Promise((function(e){var r=function(){n.subscribe("draw",(function(){t||n.publish("unfilter"),e()}),1),uo=!0};_n||ii(ro[0])?ja(ei()).then((function(){t||n.publish("pointConnectionsDraw"),r()})):r()}))},unsubscribe:n.unsubscribe,view:function(e){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,t=void 0!==n&&n;ec(e),uo=!0,so=t},zoomToLocation:Xa,zoomToArea:Ha,zoomToPoints:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!jo)return Promise.reject(new Error(Sn));var t=function(e){var n,t=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=s(e);try{for(a.s();!(n=a.n()).done;){var c=n.value,l=v(ro[c],2),u=l[0],f=l[1];t=Math.min(t,u),r=Math.max(r,u),o=Math.min(o,f),i=Math.max(i,f)}}catch(e){a.e(e)}finally{a.f()}return{x:t,y:o,width:r-t,height:i-o}}(e),r=t.x+t.width/2,o=t.y+t.height/2,i=Qo(),a=1+(n.padding||0),c=Math.max(t.width,i)*a,l=Math.max(t.height,i)*a;return Ha({x:r-c/2,y:o-l/2,width:c,height:l},n)},zoomToOrigin:function(){return Xa([0,0],1,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}}},Object.defineProperty(e,"__esModule",{value:!0})}));
8
+ */var de,ve=function(){var e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],n=function(){function n(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,i=arguments.length>3?arguments[3]:void 0;if(function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),isNaN(t)||t<0)throw new Error("Unexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;var a=e.indexOf(this.ArrayType),c=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(o,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+c+l+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+a]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}return r=n,i=[{key:"from",value:function(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var r=v(new Uint8Array(t,0,2),2),o=r[0],i=r[1];if(219!==o)throw new Error("Data does not appear to be in a KDBush format.");var a=i>>4;if(1!==a)throw new Error("Got v".concat(a," data when expected v").concat(1,"."));var c=e[15&i];if(!c)throw new Error("Unrecognized array type.");var l=v(new Uint16Array(t,2,1),1)[0];return new n(v(new Uint32Array(t,4,1),1)[0],l,c,t)}}],(o=[{key:"add",value:function(e,n){var t=this._pos>>1;return this.ids[t]=t,this.coords[this._pos++]=e,this.coords[this._pos++]=n,t}},{key:"finish",value:function(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return t(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}},{key:"range",value:function(e,n,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var o=this.ids,i=this.coords,a=this.nodeSize,c=[0,o.length-1,0],l=[];c.length;){var s=c.pop()||0,u=c.pop()||0,f=c.pop()||0;if(u-f<=a)for(var d=f;d<=u;d++){var v=i[2*d],h=i[2*d+1];v>=e&&v<=t&&h>=n&&h<=r&&l.push(o[d])}else{var p=f+u>>1,y=i[2*p],m=i[2*p+1];y>=e&&y<=t&&m>=n&&m<=r&&l.push(o[p]),(0===s?e<=y:n<=m)&&(c.push(f),c.push(p-1),c.push(1-s)),(0===s?t>=y:r>=m)&&(c.push(p+1),c.push(u),c.push(1-s))}}return l}},{key:"within",value:function(e,n,t){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var r=this.ids,o=this.coords,i=this.nodeSize,c=[0,r.length-1,0],l=[],s=t*t;c.length;){var u=c.pop()||0,f=c.pop()||0,d=c.pop()||0;if(f-d<=i)for(var v=d;v<=f;v++)a(o[2*v],o[2*v+1],e,n)<=s&&l.push(r[v]);else{var h=d+f>>1,p=o[2*h],y=o[2*h+1];a(p,y,e,n)<=s&&l.push(r[h]),(0===u?e-t<=p:n-t<=y)&&(c.push(d),c.push(h-1),c.push(1-u)),(0===u?e+t>=p:n+t>=y)&&(c.push(h+1),c.push(f),c.push(1-u))}}return l}}])&&l(r.prototype,o),i&&l(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}();function t(e,n,o,i,a,c){if(!(a-i<=o)){var l=i+a>>1;r(e,n,l,i,a,c),t(e,n,o,i,l-1,1-c),t(e,n,o,l+1,a,1-c)}}function r(e,n,t,i,a,c){for(;a>i;){if(a-i>600){var l=a-i+1,s=t-i+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(s-l/2<0?-1:1);r(e,n,t,Math.max(i,Math.floor(t-s*f/l+d)),Math.min(a,Math.floor(t+(l-s)*f/l+d)),c)}var v=n[2*t+c],h=i,p=a;for(o(e,n,i,t),n[2*a+c]>v&&o(e,n,i,a);h<p;){for(o(e,n,h,p),h++,p--;n[2*h+c]<v;)h++;for(;n[2*p+c]>v;)p--}n[2*i+c]===v?o(e,n,i,p):o(e,n,++p,a),p<=t&&(i=p+1),t<=p&&(a=p-1)}}function o(e,n,t,r){i(e,t,r),i(n,2*t,2*r),i(n,2*t+1,2*r+1)}function i(e,n,t){var r=e[n];e[n]=e[t],e[t]=r}function a(e,n,t,r){var o=e-t,i=n-r;return o*o+i*i}return n},he=function(){addEventListener("message",(function(e){var n=e.data.points;0===n.length&&self.postMessage({error:new Error("Invalid point data")});var t,r=new KDBush(n.length,e.data.nodeSize),o=s(n);try{for(o.s();!(t=o.n()).done;){var i=v(t.value,2),a=i[0],c=i[1];r.add(a,c)}}catch(e){o.e(e)}finally{o.f()}r.finish(),postMessage(r.data,[r.data])}))},pe=ve(),ye=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{nodeSize:16,useWorker:void 0};return new Promise((function(t,r){if(e instanceof ArrayBuffer)t(pe.from(e));else if((e.length<1e6||!1===n.useWorker)&&!0!==n.useWorker){var o,i=new pe(e.length,n.nodeSize),a=s(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;i.add(c[0],c[1])}}catch(e){a.e(e)}finally{a.f()}i.finish(),t(i)}else{var l=function(e){var n=ve.toString(),t=e.toString(),r="const createKDBushClass = ".concat(n,";")+"KDBush = createKDBushClass();"+"const createWorker = ".concat(t,";")+"createWorker();",o=new Blob([r],{type:"text/javascript"}),i=URL.createObjectURL(o),a=new Worker(i,{name:"KDBush"});return URL.revokeObjectURL(i),a}(he);l.onmessage=function(e){e.data.error?r(e.data.error):t(pe.from(e.data)),l.terminate()},l.postMessage({points:e,nodeSize:n.nodeSize})}}))},me="auto",ge=Float32Array.BYTES_PER_ELEMENT,we=["OES_texture_float","OES_element_index_uint","WEBGL_color_buffer_float","EXT_float_blend"],xe={color:[0,0,0,0],depth:1},be="panZoom",Pe="lasso",Se="rotate",Ae=[be,Pe,Se],Ee=be,Me={cubicIn:e=>e*e*e,cubicInOut:m,cubicOut:e=>--e*e*e+1,linear:e=>e,quadIn:e=>e*e,quadInOut:e=>e<.5?2*e*e:(4-2*e)*e-1,quadOut:e=>e*(2-e)},Ie=m,Ce="continuous",Te="categorical",Le=[Ce,Te],Oe="deselect",Re="lassoEnd",Be=[Oe,Re],De=[0,.666666667,1,1],ze=Re,Ne=750,ke=500,je=100,Fe=250,_e="intersect",Ve="lasso",We="rotate",Ze="merge",Ge="remove",Ue=[Ve,We,_e,Ze,Ge],Ke="alt",qe="cmd",Ye="ctrl",He="meta",Xe="shift",$e=[Ke,qe,Ye,He,Xe],Je=u(u(u(u({},Ge,Ke),We,Ke),Ve,Xe),Ze,qe),Qe=me,en=me,nn=null,tn=null,rn=null,on=null,an=null,cn=[.66,.66,.66,1],ln=[0,.55,1,1],sn=[1,1,1,1],un=[0,0,0,1],fn=null,dn=[.66,.66,.66,.2],vn=[0,.55,1,1],hn=[1,1,1,1],pn=[1,1,1,.5],yn=[0,0],mn=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),gn=[1,1,1,.5],wn=new Set(["z","valueZ","valueA","value1","category"]),xn=new Set(["w","valueW","valueB","value2","value"]),bn=15e3,Pn=Symbol("SKIP_DEPRECATION_VALUE_TRANSLATION"),Sn="Points have not been drawn",An="The instance was already destroyed",En=function(e,n){return"".concat(e,"ms ease-out effectIn ").concat(n,"ms 1 normal forwards")},Mn=function(e,n){return"".concat(e,"ms linear leftSpinIn ").concat(n,"ms 1 normal forwards")},In=function(e,n){return"".concat(e,"ms linear rightSpinIn ").concat(n,"ms 1 normal forwards")},Cn=function(e,n){return"".concat(e,"ms linear circleIn ").concat(n,"ms 1 normal forwards")},Tn=function(e,n,t){return"\n @keyframes mainIn {\n 0% {\n color: ".concat(n,";\n opacity: 0;\n }\n 0%, ").concat(e,"% {\n color: ").concat(n,";\n opacity: 1;\n }\n 100% {\n color: ").concat(t,";\n opacity: 0.8;\n }\n }\n")},Ln=function(e,n,t,r){return"\n @keyframes effectIn {\n 0%, ".concat(e,"% {\n opacity: ").concat(t,";\n transform: scale(").concat(r,");\n }\n ").concat(n,"% {\n opacity: 0.66;\n transform: scale(1.5);\n }\n 99% {\n opacity: 0;\n transform: scale(2);\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")},On=function(e,n){return"\n @keyframes leftSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(360deg);\n }\n }\n")},Rn=function(e,n){return"\n @keyframes rightSpinIn {\n 0% {\n transform: rotate(".concat(n,"deg);\n }\n ").concat(e,"%, 100% {\n transform: rotate(180deg);\n }\n }\n")},Bn=function(e){return"".concat(e,"ms linear effectOut 0s 1 normal forwards")},Dn=function(e){return"".concat(e,"ms linear leftSpinOut 0s 1 normal forwards")},zn=function(e){return"".concat(e,"ms linear rightSpinOut 0s 1 normal forwards")},Nn=function(e){return"".concat(e,"ms linear circleOut 0s 1 normal forwards")},kn=function(e,n){return"\n @keyframes mainOut {\n 0% {\n color: ".concat(e,";\n }\n 100% {\n color: ").concat(n,";\n }\n }\n")},jn=function(e,n){return"\n @keyframes rightSpinOut {\n 0%, ".concat(e,"% {\n transform: rotate(").concat(n,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n")},Fn=function(e){return"\n @keyframes leftSpinOut {\n 0% {\n transform: rotate(".concat(e,"deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n }\n")},_n=function(e,n,t){return"\n @keyframes circleOut {\n 0%, ".concat(e,"% {\n clip-path: ").concat(n,";\n opacity: ").concat(t,";\n }\n ").concat(e+.01,"% {\n clip-path: inset(0 0 0 50%);\n opacity: ").concat(t,";\n }\n 100% {\n clip-path: inset(0 0 0 50%);\n opacity: 0;\n }\n }\n")},Vn=function(e){return null===e?arguments.length>1&&void 0!==arguments[1]?arguments[1]:null:e},Wn=function(){if(!de){var e=document.createElement("style");document.head.appendChild(e),de=e.sheet}return de},Zn=function(e){var n=Wn(),t=n.rules.length;return n.insertRule(e,t),t},Gn=function(e){Wn().deleteRule(e)},Un="".concat(2500,"ms ease scaleInFadeOut 0s 1 normal backwards"),Kn=null,qn="".concat(250,"ms ease fadeScaleOut 0s 1 normal backwards"),Yn=null,Hn=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.onDraw,r=void 0===t?g:t,o=n.onStart,i=void 0===o?g:o,a=n.onEnd,c=void 0===a?g:a,l=n.enableInitiator,s=void 0===l||l,u=n.initiatorParentElement,f=void 0===u?document.body:u,d=n.longPressIndicatorParentElement,p=void 0===d?document.body:d,y=n.minDelay,m=void 0===y?8:y,w=n.minDist,x=void 0===w?2:w,E=n.pointNorm,M=void 0===E?g:E,I=n.type,C=void 0===I?"freeform":I,T=n.brushSize,L=s,O=f,R=p,B=r,D=i,z=c,N=m,k=x,j=M,F=C,_=void 0===T?24:T,V=document.createElement("div"),W=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);V.id="lasso-initiator-".concat(W),V.style.position="fixed",V.style.display="flex",V.style.justifyContent="center",V.style.alignItems="center",V.style.zIndex=99,V.style.width="4rem",V.style.height="4rem",V.style.borderRadius="4rem",V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)";var Z,G=function(){var e=document.createElement("div"),n=Math.random().toString(36).substring(2,5)+Math.random().toString(36).substring(2,5);e.id="lasso-long-press-".concat(n),e.style.position="fixed",e.style.width="1.25rem",e.style.height="1.25rem",e.style.pointerEvents="none",e.style.transform="translate(-50%,-50%)";var t=document.createElement("div");t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.width="1.25rem",t.style.height="1.25rem",t.style.clipPath="inset(0px 0px 0px 50%)",t.style.opacity=0,e.appendChild(t);var r=document.createElement("div");r.style.position="absolute",r.style.top=0,r.style.left=0,r.style.width="0.8rem",r.style.height="0.8rem",r.style.border="0.2rem solid currentcolor",r.style.borderRadius="0.8rem",r.style.clipPath="inset(0px 50% 0px 0px)",r.style.transform="rotate(0deg)",t.appendChild(r);var o=document.createElement("div");o.style.position="absolute",o.style.top=0,o.style.left=0,o.style.width="0.8rem",o.style.height="0.8rem",o.style.border="0.2rem solid currentcolor",o.style.borderRadius="0.8rem",o.style.clipPath="inset(0px 50% 0px 0px)",o.style.transform="rotate(0deg)",t.appendChild(o);var i=document.createElement("div");return i.style.position="absolute",i.style.top=0,i.style.left=0,i.style.width="1.25rem",i.style.height="1.25rem",i.style.borderRadius="1.25rem",i.style.background="currentcolor",i.style.transform="scale(0)",i.style.opacity=0,e.appendChild(i),{longPress:e,longPressCircle:t,longPressCircleLeft:r,longPressCircleRight:o,longPressEffect:i}}(),U=G.longPress,K=G.longPressCircle,q=G.longPressCircleLeft,Y=G.longPressCircleRight,H=G.longPressEffect,X=!1,$=!1,J=[],Q=[],ee=[],ne=[],te=!1,re=null,oe=null,ie=null,ae=null,ce=null,le=null,se=null,ue=null,fe=null,de=null,ve=function(){X=!1};window.addEventListener("mouseup",ve);var he,pe=function(){V.style.opacity=.5,V.style.transform="translate(-50%,-50%) scale(0) rotate(0deg)"},ye=function(e,n){var t=getComputedStyle(e),r=+t.opacity,o=t.transform.match(/([0-9.-]+)+/g),i=+o[0],a=+o[1],c=Math.sqrt(i*i+a*a),l=Math.atan2(a,i)*(180/Math.PI);return{opacity:r,scale:c,rotate:l=n&&l<=0?360+l:l}},me=function(e){if(L&&!X){var n=e.clientX,t=e.clientY;V.style.top="".concat(t,"px"),V.style.left="".concat(n,"px");var r=ye(V),o=r.opacity,i=r.scale,a=r.rotate;V.style.opacity=o,V.style.transform="translate(-50%,-50%) scale(".concat(i,") rotate(").concat(a,"deg)"),V.style.animation="none",S().then((function(){null!==Kn&&Gn(Kn),Kn=Zn(function(e,n,t){return"\n@keyframes scaleInFadeOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 10% {\n opacity: 1;\n transform: translate(-50%,-50%) scale(1) rotate(").concat(t+20,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0.9) rotate(").concat(t+60,"deg);\n }\n}\n")}(o,i,a)),V.style.animation=Un,S().then((function(){pe()}))}))}},ge=function(){var e=ye(V),n=e.opacity,t=e.scale,r=e.rotate;V.style.opacity=n,V.style.transform="translate(-50%,-50%) scale(".concat(t,") rotate(").concat(r,"deg)"),V.style.animation="none",S(2).then((function(){null!==Yn&&Gn(Yn),Yn=Zn(function(e,n,t){return"\n@keyframes fadeScaleOut {\n 0% {\n opacity: ".concat(e,";\n transform: translate(-50%,-50%) scale(").concat(n,") rotate(").concat(t,"deg);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%,-50%) scale(0) rotate(").concat(t,"deg);\n }\n}\n")}(n,t,r)),V.style.animation=qn,S().then((function(){pe()}))}))},we=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{time:Ne,extraTime:ke,delay:je},r=t.time,o=void 0===r?Ne:r,i=t.extraTime,a=void 0===i?ke:i,c=t.delay,l=void 0===c?je:c;te=!0;var s=getComputedStyle(U);U.style.color=s.color,U.style.top="".concat(n,"px"),U.style.left="".concat(e,"px"),U.style.animation="none";var u=getComputedStyle(K);K.style.clipPath=u.clipPath,K.style.opacity=u.opacity,K.style.animation="none";var f=ye(H);H.style.opacity=f.opacity,H.style.transform="scale(".concat(f.scale,")"),H.style.animation="none";var d=ye(q);q.style.transform="rotate(".concat(d.rotate,"deg)"),q.style.animation="none";var v=ye(Y);Y.style.transform="rotate(".concat(v.rotate,"deg)"),Y.style.animation="none",S().then((function(){if(te){null!==ce&&Gn(ce),null!==ae&&Gn(ae),null!==ie&&Gn(ie),null!==oe&&Gn(oe),null!==re&&Gn(re);var e=function(e){var n,t,r,o,i,a=e.time,c=void 0===a?Ne:a,l=e.extraTime,s=void 0===l?ke:l,u=e.delay,f=void 0===u?je:u,d=e.currentColor,v=e.targetColor,h=e.effectOpacity,p=e.effectScale,y=e.circleLeftRotation,m=e.circleRightRotation,g=e.circleClipPath,w=e.circleOpacity,x=y/360,b=function(e,n,t){return(1-e)*n+t}(x,c,s),P=Math.round((1-x)*c/b*100),S=Math.round(P/2),A=P+(100-P)/4;return{rules:{main:Tn(P,d,v),effect:Ln(P,A,h,p),circleRight:Rn(S,m),circleLeft:On(P,y),circle:(r=S,o=g,i=w,"\n @keyframes circleIn {\n 0% {\n clip-path: ".concat(o,";\n opacity: ").concat(i,";\n }\n ").concat(r,"% {\n clip-path: ").concat(o,";\n opacity: 1;\n }\n ").concat(r+.01,"%, 100% {\n clip-path: inset(0);\n opacity: 1;\n }\n }\n"))},names:{main:(n=b,t=f,"".concat(n,"ms ease-out mainIn ").concat(t,"ms 1 normal forwards")),effect:En(b,f),circleLeft:Mn(b,f),circleRight:In(b,f),circle:Cn(b,f)}}}({time:o,extraTime:a,delay:l,currentColor:s.color||"currentcolor",targetColor:U.dataset.activeColor,effectOpacity:f.opacity||0,effectScale:f.scale||0,circleLeftRotation:d.rotate||0,circleRightRotation:v.rotate||0,circleClipPath:u.clipPath||"inset(0 0 0 50%)",circleOpacity:u.opacity||0}),n=e.rules,t=e.names;re=Zn(n.main),oe=Zn(n.effect),ie=Zn(n.circleLeft),ae=Zn(n.circleRight),ce=Zn(n.circle),U.style.animation=t.main,H.style.animation=t.effect,q.style.animation=t.circleLeft,Y.style.animation=t.circleRight,K.style.animation=t.circle}}))},xe=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{time:Fe}).time,n=void 0===e?Fe:e;if(te){te=!1;var t=getComputedStyle(U);U.style.color=t.color,U.style.animation="none";var r=getComputedStyle(K);K.style.clipPath=r.clipPath,K.style.opacity=r.opacity,K.style.animation="none";var o=ye(H);H.style.opacity=o.opacity,H.style.transform="scale(".concat(o.scale,")"),H.style.animation="none";var i="x"===r.clipPath.slice(-2,-1),a=ye(q,i);q.style.transform="rotate(".concat(a.rotate,"deg)"),q.style.animation="none";var c=ye(Y);Y.style.transform="rotate(".concat(c.rotate,"deg)"),Y.style.animation="none",S().then((function(){null!==de&&Gn(de),null!==fe&&Gn(fe),null!==ue&&Gn(ue),null!==se&&Gn(se),null!==le&&Gn(le);var e=function(e){var n,t,r,o=e.time,i=void 0===o?Fe:o,a=e.currentColor,c=e.targetColor,l=e.effectOpacity,s=e.effectScale,u=e.circleLeftRotation,f=e.circleRightRotation,d=e.circleClipPath,v=e.circleOpacity,h=u/360,p=h*i,y=Math.min(100,100*h),m=y>50?Math.round(100*(1-50/y)):0;return{rules:{main:kn(a,c),effect:(t=l,r=s,"\n @keyframes effectOut {\n 0% {\n opacity: ".concat(t,";\n transform: scale(").concat(r,");\n }\n 99% {\n opacity: 0;\n transform: scale(").concat(r+.5,");\n }\n 100% {\n opacity: 0;\n transform: scale(0);\n }\n }\n")),circleRight:jn(m,f),circleLeft:Fn(u),circle:_n(m,d,v)},names:{main:(n=p,"".concat(n,"ms linear mainOut 0s 1 normal forwards")),effect:Bn(p),circleRight:Dn(p),circleLeft:zn(p),circle:Nn(p)}}}({time:n,currentColor:t.color||"currentcolor",targetColor:U.dataset.color,effectOpacity:o.opacity||0,effectScale:o.scale||0,circleLeftRotation:a.rotate||0,circleRightRotation:c.rotate||0,circleClipPath:r.clipPath||"inset(0px)",circleOpacity:r.opacity||1}),i=e.rules,l=e.names;le=Zn(i.main),se=Zn(i.effect),ue=Zn(i.circleLeft),fe=Zn(i.circleRight),de=Zn(i.circle),U.style.animation=l.main,H.style.animation=l.effect,q.style.animation=l.circleLeft,Y.style.animation=l.circleRight,K.style.animation=l.circle}))}},be=function(){B(J,Q)},Pe=function(e){J.push(e),Q.push(e[0],e[1])},Se=function(e){var n=v(e,2),t=n[0],r=n[1],o=v(J[0],2),i=o[0],a=o[1];J[1]=[t,a],J[2]=[t,r],J[3]=[i,r],J[4]=[i,a],Q[2]=t,Q[3]=a,Q[4]=t,Q[5]=r,Q[6]=i,Q[7]=r,Q[8]=i,Q[9]=a},Ae=function(e){ee.push(e)},Ee=function(e,n,t){var r,o=v(e,2),i=o[0],a=o[1],c=v(n,2),l=i-c[0],s=a-c[1],u=(r=[l,s],Math.sqrt(r.reduce(((e,n)=>e+n**2),0)));return[+s/u*t,-l/u*t]},Me=function(e){var n=ee.at(-1),t=Math.abs(j([0,0])[0]-j([_/2,0])[0]),r=v(Ee(e,n,t),2),o=r[0],i=r[1],a=ee.length;if(1===a){var c=[n[0]+o,n[1]+i],l=[n[0]-o,n[1]-i];J.push(c,l),Q.push(c[0],c[1],l[0],l[1]),ne.push([o,i])}else{var s=v(Ee(e,n,t),2);o=s[0],i=s[1];var u=v(function(e,n,t){if(0===e.length)return 0;if(1===e.length)return e[0];for(var r=Math.pow(2,-1/n),o=Math.max(0,e.length-t),i=e.slice(o),a=0,c=0,l=0,s=i.length-1;s>=0;s--){var u=i.length-1-s,f=Math.pow(r,u);a+=i[s][0]*f,c+=i[s][1]*f,l+=f}return[a/l,c/l]}([].concat(h(ne),[[o,i]]),1,10),2);o=u[0],i=u[1];var f=v(ne.at(-1),2),d=(o+f[0])/2,p=(i+f[1])/2,y=[n[0]+d,n[1]+p],m=[n[0]-d,n[1]-p];J.splice(a-1,2,y,m),Q.splice(2*(a-1),4,y[0],y[1],m[0],m[1]),ne.splice(a,1,[d,p])}var g=[e[0]+o,e[1]+i],w=[e[0]-o,e[1]-i];J.splice(a,0,g,w),Q.splice(2*a,0,g[0],g[1],w[0],w[1]),ee.push(e),ne.push([o,i])},Ie=Pe,Ce=Pe,Te=function(e){if(Z){(t=e[0],r=e[1],o=Z[0],i=Z[1],Math.sqrt((t-o)**2+(r-i)**2))>k&&(Z=e,Ie(j(e)),J.length>1&&be())}else{$||($=!0,D()),Z=e;var n=j(e);Ce(n)}var t,r,o,i},Le=A(Te,N,N),Oe=function(n,t){var r=function(n){var t=e.getBoundingClientRect(),r=t.left,o=t.top;return[n.clientX-r,n.clientY-o]}(n);return t?Le(r):Te(r)},Re=function(){J=[],Q=[],ee=[],ne=[],Z=void 0,be()},Be=function(e){me(e)},De=function(){X=!0,$=!0,Re(),D()},ze=function(){ge()},_e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.intersect,t=void 0!==n&&n,r=e.merge,o=void 0!==r&&r,i=e.remove,a=void 0!==i&&i;$=!1;var c=h(J),l=h(Q);return Le.cancel(),Re(),c.length>0&&z(c,l,{intersect:t,merge:o,remove:a}),c},Ve=function(e){return"onDraw"===e?B:"onStart"===e?D:"onEnd"===e?z:"enableInitiator"===e?L:"minDelay"===e?N:"minDist"===e?k:"pointNorm"===e?j:"type"===e?F:"brushSize"===e?_:void 0},We=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onDraw,t=void 0===n?null:n,r=e.onStart,o=void 0===r?null:r,i=e.onEnd,a=void 0===i?null:i,c=e.enableInitiator,l=void 0===c?null:c,s=e.initiatorParentElement,u=void 0===s?null:s,f=e.longPressIndicatorParentElement,d=void 0===f?null:f,v=e.minDelay,h=void 0===v?null:v,p=e.minDist,y=void 0===p?null:p,m=e.pointNorm,g=void 0===m?null:m,w=e.type,x=void 0===w?null:w,b=e.brushSize,P=void 0===b?null:b;B=Vn(t,B),D=Vn(o,D),z=Vn(a,z),L=Vn(l,L),N=Vn(h,N),k=Vn(y,k),j=Vn(g,j),_=Vn(P,_),null!==u&&u!==O&&(O.removeChild(V),u.appendChild(V),O=u),null!==d&&d!==R&&(R.removeChild(U),d.appendChild(U),R=d),L?(V.addEventListener("click",Be),V.addEventListener("mousedown",De),V.addEventListener("mouseleave",ze)):(V.removeEventListener("mousedown",De),V.removeEventListener("mouseleave",ze)),null!==x&&function(e){switch(e){case"rectangle":F=e,Ie=Se,Ce=Pe;break;case"brush":F=e,Ie=Me,Ce=Ae;break;default:F="freeform",Ie=Pe,Ce=Pe}}(x)},Ze=function(){O.removeChild(V),R.removeChild(U),window.removeEventListener("mouseup",ve),V.removeEventListener("click",Be),V.removeEventListener("mousedown",De),V.removeEventListener("mouseleave",ze)};return O.appendChild(V),R.appendChild(U),We({onDraw:B,onStart:D,onEnd:z,enableInitiator:L,initiatorParentElement:O,type:F,brushSize:_}),((...e)=>n=>e.reduce(((e,n)=>n(e)),n))(P("initiator",V),P("longPressIndicator",U),(function(e){return b(e,{clear:Re,destroy:Ze,end:_e,extend:Oe,get:Ve,set:We,showInitiator:me,hideInitiator:ge,showLongPressIndicator:we,hideLongPressIndicator:xe})}),(he=Hn,e=>b({__proto__:{constructor:he}},e)))({})},Xn=function(e,n){return!!e&&we.reduce((function(t,r){return e.hasExtension(r)?t:(n||console.warn("WebGL: ".concat(r," extension not supported. Scatterplot might not render properly")),!1)}),!0)},$n=function(e){var n,t=e.getContext("webgl",{antialias:!0,preserveDrawingBuffer:!0}),r=[],o=s(we);try{for(o.s();!(n=o.n()).done;){var a=n.value;t.getExtension(a)?r.push(a):console.warn("WebGL: ".concat(a," extension not supported. Scatterplot might not render properly"))}}catch(e){o.e(e)}finally{o.f()}return i.default({gl:t,extensions:r})},Jn=function(e,n,t,r){return Math.sqrt(Math.pow(e-t,2)+Math.pow(n-r,2))},Qn=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,et=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).minLength,r=void 0===t?0:t;return Array.isArray(e)&&e.length>=r&&e.every(n)},nt=function(e){return!Number.isNaN(+e)&&+e>=0},tt=function(e){return!Number.isNaN(+e)&&+e>0},rt=function(e,n){return function(t){return e.indexOf(t)>=0?t:n}},ot=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bn;return new Promise((function(r,o){(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bn;return new Promise((function(r,o){var i=new Image;n&&(i.crossOrigin="anonymous"),i.src=e,i.onload=function(){r(i)};var a=function(){o(new Error("IMAGE_LOAD_ERROR"))};i.onerror=a,setTimeout(a,t)}))})(n,0!==n.indexOf(window.location.origin)&&-1===n.indexOf("base64"),t).then((function(n){r(e.texture(n))})).catch((function(e){o(e)}))}))},it=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return[].concat(h(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.replace(Qn,(function(e,n,t,r){return"#".concat(n).concat(n).concat(t).concat(t).concat(r).concat(r)})).substring(1).match(/.{2}/g).map((function(e){return Number.parseInt(e,16)/Math.pow(255,n)}))}(e,n)),[Math.pow(255,!n)])},at=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,ct=function(e){return e>=0&&e<=1},lt=function(e){return Array.isArray(e)&&e.every(ct)};function st(e,n,t,r,o,i){return(t-e)*(i-n)-(o-e)*(r-n)}var ut=function(e){for(var n=v(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),t=n[0],r=n[1],o=0,i=0,a=e.length-2;i<e.length;i+=2){var c=e[i],l=e[i+1],s=e[a],u=e[a+1];if(l<=r){if(u>r)st(c,l,s,u,t,r)>0&&o++}else if(u<=r){st(c,l,s,u,t,r)<0&&o--}a=i}return 0!==o},ft=function(e){return"string"==typeof e||e instanceof String},dt=function(e){return Number.isInteger(e)&&e>=0&&e<=255},vt=function(e){return Array.isArray(e)&&e.every(dt)},ht=function(e){return Array.isArray(e)&&e.length>0&&(Array.isArray(e[0])||ft(e[0]))},pt=function(e,n){return e>n?e:n},yt=function(e,n){return e<n?e:n},mt=function(e,n){if(4===(r=e).length&&(lt(r)||vt(r))){var t=lt(e);return n&&t||!n&&!t?e:n&&!t?e.map((function(e){return e/255})):e.map((function(e){return 255*e}))}var r,o,i;if(3===(o=e).length&&(lt(o)||vt(o))){var a=Math.pow(255,!n),c=lt(e);return[].concat(n&&c||!n&&!c?h(e):h(n&&!c?e.map((function(e){return e/255})):e.map((function(e){return 255*e}))),[a])}return i=e,at.test(i)?it(e,n):(console.warn("Only HEX, RGB, and RGBA are handled by this function. Returning white instead."),n?[1,1,1,1]:[255,255,255,255])},gt=function(e){return.21*e[0]+.72*e[1]+.07*e[2]},wt=function(e){return new Promise((function(n,t){if(!e||Array.isArray(e))n(e);else{var r=Array.isArray(e.x)||ArrayBuffer.isView(e.x)?e.x.length:0,o=(Array.isArray(e.x)||ArrayBuffer.isView(e.x))&&function(n){return e.x[n]},i=(Array.isArray(e.y)||ArrayBuffer.isView(e.y))&&function(n){return e.y[n]},a=(Array.isArray(e.line)||ArrayBuffer.isView(e.line))&&function(n){return e.line[n]},c=(Array.isArray(e.lineOrder)||ArrayBuffer.isView(e.lineOrder))&&function(n){return e.lineOrder[n]},l=Object.keys(e),s=(d=l.find((function(e){return wn.has(e)})))&&(Array.isArray(e[d])||ArrayBuffer.isView(e[d]))&&function(n){return e[d][n]},u=(f=l.find((function(e){return xn.has(e)})))&&(Array.isArray(e[f])||ArrayBuffer.isView(e[f]))&&function(n){return e[f][n]};o&&i&&s&&u&&a&&c?n(e.x.map((function(e,n){return[e,i(n),s(n),u(n),a(n),c(n)]}))):o&&i&&s&&u&&a?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n),u(n),a(n)]}))):o&&i&&s&&u?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n),u(n)]}))):o&&i&&s?n(Array.from({length:r},(function(e,n){return[o(n),i(n),s(n)]}))):o&&i?n(Array.from({length:r},(function(e,n){return[o(n),i(n)]}))):t(new Error("You need to specify at least x and y"))}var f,d}))},xt=function(e){return Number.isFinite(e.y)&&!("x"in e)},bt=function(e){return Number.isFinite(e.x)&&!("y"in e)},Pt=function(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height)},St=function(e){return Number.isFinite(e.x1)&&Number.isFinite(e.y1)&&Number.isFinite(e.x2)&&Number.isFinite(e.x2)},At=function(e){return"vertices"in e&&e.vertices.length>1},Et=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.regl,t=e.canvas,r=void 0===t?document.createElement("canvas"):t,o=e.gamma,i=void 0===o?1:o,a=!1;n||(n=$n(r));var c=Xn(n),l=[r.width,r.height],s=n.framebuffer({width:l[0],height:l[1],colorFormat:"rgba",colorType:"float"}),u=n({vert:"\n precision highp float;\n attribute vec2 xy;\n void main () {\n gl_Position = vec4(xy, 0, 1);\n }",frag:"\n precision highp float;\n uniform vec2 srcRes;\n uniform sampler2D src;\n uniform float gamma;\n\n vec3 approxLinearToSRGB (vec3 rgb, float gamma) {\n return pow(clamp(rgb, vec3(0), vec3(1)), vec3(1.0 / gamma));\n }\n\n void main () {\n vec4 color = texture2D(src, gl_FragCoord.xy / srcRes);\n gl_FragColor = vec4(approxLinearToSRGB(color.rgb, gamma), color.a);\n }",attributes:{xy:[-4,-4,4,-4,0,4]},uniforms:{src:function(){return s},srcRes:function(){return l},gamma:function(){return i}},count:3,depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"one",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}}}),f=new Set,d=n.frame((function(){for(var e=f.values(),n=e.next();!n.done;)n.value(),n=e.next()})),v=function(e,n){var t=null==e?window.innerWidth:e,o=null==n?window.innerHeight:n;r.width=t*window.devicePixelRatio,r.height=o*window.devicePixelRatio,l[0]=r.width,l[1]=r.height,s.resize.apply(s,l)},h=function(){v()};e.canvas||(window.addEventListener("resize",h),window.addEventListener("orientationchange",h),v());return{get canvas(){return r},get regl(){return n},get gamma(){return i},set gamma(e){i=+e},get isSupported(){return c},get isDestroyed(){return a},render:function(e,t){n.clear(xe),s.use((function(){n.clear(xe),e()})),u(),function(e){var n=e.getContext("2d");n.clearRect(0,0,e.width,e.height),n.drawImage(r,(r.width-e.width)/2,(r.height-e.height)/2,e.width,e.height,0,0,e.width,e.height)}(t)},resize:v,onFrame:function(e){return f.add(e),function(){f.delete(e)}},refresh:function(){n.poll()},destroy:function(){a=!0,window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),d.cancel(),r=void 0,n.destroy(),n=void 0}}};const Mt=e=>`\nprecision highp float;\n\nuniform sampler2D colorTex;\nuniform float colorTexRes;\nuniform float colorTexEps;\nuniform sampler2D stateTex;\nuniform float stateTexRes;\nuniform float stateTexEps;\nuniform float devicePixelRatio;\nuniform sampler2D encodingTex;\nuniform float encodingTexRes;\nuniform float encodingTexEps;\nuniform float pointSizeExtra;\nuniform float pointOpacityMax;\nuniform float pointOpacityScale;\nuniform float numPoints;\nuniform float globalState;\nuniform float isColoredByZ;\nuniform float isColoredByW;\nuniform float isOpacityByZ;\nuniform float isOpacityByW;\nuniform float isOpacityByDensity;\nuniform float isSizedByZ;\nuniform float isSizedByW;\nuniform float isPixelAligned;\nuniform float colorMultiplicator;\nuniform float opacityMultiplicator;\nuniform float opacityDensity;\nuniform float sizeMultiplicator;\nuniform float numColorStates;\nuniform float pointScale;\nuniform float drawingBufferWidth;\nuniform float drawingBufferHeight;\nuniform mat4 modelViewProjection;\n\nattribute vec2 stateIndex;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nvoid main() {\n vec4 state = texture2D(stateTex, stateIndex);\n\n if (isPixelAligned < 0.5) {\n gl_Position = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n } else {\n vec4 clipSpacePosition = modelViewProjection * vec4(state.x, state.y, 0.0, 1.0);\n vec2 ndcPosition = clipSpacePosition.xy / clipSpacePosition.w;\n vec2 pixelPos = 0.5 * (ndcPosition + 1.0) * vec2(drawingBufferWidth, drawingBufferHeight);\n pixelPos = floor(pixelPos + 0.5); // Snap to nearest pixel\n vec2 snappedPosition = (pixelPos / vec2(drawingBufferWidth, drawingBufferHeight)) * 2.0 - 1.0;\n gl_Position = vec4(snappedPosition, 0.0, 1.0);\n }\n\n\n // Determine color index\n float colorIndexZ = isColoredByZ * floor(state.z * colorMultiplicator);\n float colorIndexW = isColoredByW * floor(state.w * colorMultiplicator);\n\n // Multiply by the number of color states per color\n // I.e., normal, active, hover, background, etc.\n float colorIndex = (colorIndexZ + colorIndexW) * numColorStates;\n\n // Half a "pixel" or "texel" in texture coordinates\n float colorLinearIndex = colorIndex + globalState;\n\n // Need to add cEps here to avoid floating point issue that can lead to\n // dramatic changes in which color is loaded as floor(3/2.9999) = 1 but\n // floor(3/3.0001) = 0!\n float colorRowIndex = floor((colorLinearIndex + colorTexEps) / colorTexRes);\n\n vec2 colorTexIndex = vec2(\n (colorLinearIndex / colorTexRes) - colorRowIndex + colorTexEps,\n colorRowIndex / colorTexRes + colorTexEps\n );\n\n color = texture2D(colorTex, colorTexIndex);\n\n // Retrieve point size\n float pointSizeIndexZ = isSizedByZ * floor(state.z * sizeMultiplicator);\n float pointSizeIndexW = isSizedByW * floor(state.w * sizeMultiplicator);\n float pointSizeIndex = pointSizeIndexZ + pointSizeIndexW;\n\n float pointSizeRowIndex = floor((pointSizeIndex + encodingTexEps) / encodingTexRes);\n vec2 pointSizeTexIndex = vec2(\n (pointSizeIndex / encodingTexRes) - pointSizeRowIndex + encodingTexEps,\n pointSizeRowIndex / encodingTexRes + encodingTexEps\n );\n float pointSize = texture2D(encodingTex, pointSizeTexIndex).x;\n\n // Retrieve opacity\n ${3===e?"":`\n if (isOpacityByDensity < 0.5) {\n float opacityIndexZ = isOpacityByZ * floor(state.z * opacityMultiplicator);\n float opacityIndexW = isOpacityByW * floor(state.w * opacityMultiplicator);\n float opacityIndex = opacityIndexZ + opacityIndexW;\n\n float opacityRowIndex = floor((opacityIndex + encodingTexEps) / encodingTexRes);\n vec2 opacityTexIndex = vec2(\n (opacityIndex / encodingTexRes) - opacityRowIndex + encodingTexEps,\n opacityRowIndex / encodingTexRes + encodingTexEps\n );\n color.a = texture2D(encodingTex, opacityTexIndex)[${1+e}];\n } else {\n color.a = min(1.0, opacityDensity + globalState);\n }\n `}\n\n color.a = min(pointOpacityMax, color.a) * pointOpacityScale;\n finalPointSize = (pointSize * pointScale) + pointSizeExtra;\n gl_PointSize = finalPointSize;\n}\n`;var It=function(){var e=function(e,n,t,r,o){var i=.5*(r-n),a=.5*(o-t);return(2*t-2*r+i+a)*e*e*e+(-3*t+3*r-2*i-a)*e*e+i*e+t},n=function(n,t,r){var o=r*n,i=Math.floor(o),a=o-i,c=t[Math.max(0,i-1)],l=t[i],s=t[Math.min(r,i+1)],u=t[Math.min(r,i+2)];return[e(a,c[0],l[0],s[0],u[0]),e(a,c[1],l[1],s[1],u[1])]},t=function(e,n,t){var r=n[0],o=n[1],i=t[0]-r,a=t[1]-o;if(0!==i||0!==a){var c=((e[0]-r)*i+(e[1]-o)*a)/(i*i+a*a);c>1?(r=t[0],o=t[1]):c>0&&(r+=i*c,o+=a*c)}return(i=e[0]-r)*i+(a=e[1]-o)*a},r=function(e,n,o,i,a){for(var c,l=i,s=n+1;s<o;s++){var u=t(e[s],e[n],e[o]);u>l&&(c=s,l=u)}l>i&&(c-n>1&&r(e,n,c,i,a),a.push(e[c]),o-c>1&&r(e,c,o,i,a))},o=function(e,n){var t=e.length-1,o=[e[0]];return r(e,0,t,n,o),o.push(e[t]),o};self.onmessage=function(e){(e.data.points?+e.data.points.length:0)||self.postMessage({error:new Error("No points provided")}),e.data.points;var t=function(e){var n={},t=!Number.isNaN(+e[0][5]);return e.forEach((function(e){var r=e[4];n[r]||(n[r]=[]),t?n[r][e[5]]=e:n[r].push(e)})),Object.entries(n).forEach((function(e){n[e[0]]=e[1].filter((function(e){return e})),n[e[0]].reference=e[1][0]})),n}(e.data.points);self.postMessage({points:Object.entries(t).reduce((function(t,r){return t[r[0]]=function(e){for(var t,r,i,a,c,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=l.maxIntPointsPerSegment,u=void 0===s?100:s,f=l.tolerance,d=void 0===f?.002:f,v=e.length,h=v-1,p=h*u+1,y=Math.pow(d,2),m=[],g=0;g<v-1;g++){var w=[e[g].slice(0,2)];t=e[g];for(var x=1;x<u;x++){var b=n((g*u+x)/p,e,h);r=t[0],i=t[1],a=b[0],c=b[1],Math.pow(r-a,2)+Math.pow(i-c,2)>y&&(w.push(b),t=b)}w.push(e[g+1]),w=o(w,y),m=m.concat(w.slice(0,w.length-1))}return m.push(e[e.length-1].slice(0,2)),m.flat()}(r[1],e.data.options),t[r[0]].reference=r[1].reference,t}),{})})}},Ct=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{tolerance:.002,maxIntPointsPerSegment:100};return new Promise((function(t,r){var o,i=(o=It,new Worker(window.URL.createObjectURL(new Blob([`(${o.toString()})()`],{type:"text/javascript"}))));i.onmessage=function(e){e.data.error?r(e.data.error):t(e.data.points),i.terminate()},i.postMessage({points:e,options:n})}))},Tt={showRecticle:{replacement:"showReticle",removalVersion:"2",translation:g},recticleColor:{replacement:"reticleColor",removalVersion:"2",translation:g},keyMap:{replacement:"actionKeyMap",removalVersion:"2",translation:function(e){return Object.entries(e).reduce((function(e,n){var t=v(n,2),r=t[0],o=t[1];return e[o]?e[o]=[].concat(h(e[o]),[r]):e[o]=r,e}),{})}}},Lt=function(e){var n,t=Object.keys(e).filter((function(e){return Tt[e]})),r=s(t);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=Tt[o],a=i.replacement,c=i.removalVersion,l=i.translation;console.warn('regl-scatterplot: the "'.concat(o,'" property is deprecated and will be removed in v').concat(c,'. Please use "').concat(a,'" instead.')),e[Tt[o].replacement]=e[o]!==Pn?l(e[o]):e[o],delete e[o]}}catch(e){r.e(e)}finally{r.f()}return e},Ot=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.allowSegment,o=void 0!==r&&r,i=t.allowDensity,a=void 0!==i&&i,c=t.allowInherit,l=void 0!==c&&c;return wn.has(e)?"valueZ":xn.has(e)?"valueW":"segment"===e?o?"segment":n:"density"===e?a?"density":n:"inherit"===e&&l?"inherit":n},Rt=function(e){switch(e){case"valueZ":return 2;case"valueW":return 3;default:return null}};e.checkSupport=Xn,e.createRegl=$n,e.createRenderer=Et,e.createSpatialIndex=function(e,n){return wt(e).then((function(e){return ye(e,{useWorker:n})})).then((function(e){return e.data}))},e.createTextureFromUrl=ot,e.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=o.default({async:!e.syncEvents,caseInsensitive:!0}),t=new Float32Array(16),r=new Float32Array(16),i=[0,0];Lt(e);var a=e.renderer,l=e.antiAliasing,p=void 0===l?.5:l,y=e.pixelAligned,m=void 0!==y&&y,b=e.backgroundColor,P=void 0===b?un:b,S=e.backgroundImage,E=void 0===S?null:S,M=e.canvas,I=void 0===M?document.createElement("canvas"):M,O=e.colorBy,D=void 0===O?an:O,z=e.deselectOnDblClick,N=void 0===z||z,F=e.deselectOnEscape,_=void 0===F||F,V=e.lassoColor,W=void 0===V?De:V,Z=e.lassoLineWidth,G=void 0===Z?2:Z,U=e.lassoMinDelay,K=void 0===U?10:U,q=e.lassoMinDist,Y=void 0===q?3:q,H=e.lassoMode,X=void 0===H?null:H,$=e.lassoClearEvent,J=void 0===$?ze:$,Q=e.lassoInitiator,ee=void 0!==Q&&Q,ne=e.lassoInitiatorParentElement,te=void 0===ne?document.body:ne,re=e.lassoLongPressIndicatorParentElement,oe=void 0===re?document.body:re,ie=e.lassoOnLongPress,ae=void 0!==ie&&ie,ce=e.lassoLongPressTime,le=void 0===ce?Ne:ce,se=e.lassoLongPressAfterEffectTime,ue=void 0===se?ke:se,de=e.lassoLongPressEffectDelay,ve=void 0===de?je:de,he=e.lassoLongPressRevertEffectTime,pe=void 0===he?Fe:he,we=e.lassoType,xe=void 0===we?"lasso":we,wn=e.lassoBrushSize,xn=void 0===wn?24:wn,En=e.actionKeyMap,Mn=void 0===En?Je:En,In=e.mouseMode,Cn=void 0===In?Ee:In,Tn=e.showReticle,Ln=void 0!==Tn&&Tn,On=e.reticleColor,Rn=void 0===On?gn:On,Bn=e.pointColor,Dn=void 0===Bn?cn:Bn,zn=e.pointColorActive,Nn=void 0===zn?ln:zn,kn=e.pointColorHover,jn=void 0===kn?sn:kn,Fn=e.showPointConnections,_n=void 0!==Fn&&Fn,Vn=e.pointConnectionColor,Wn=void 0===Vn?dn:Vn,Zn=e.pointConnectionColorActive,Gn=void 0===Zn?vn:Zn,Un=e.pointConnectionColorHover,Kn=void 0===Un?hn:Un,qn=e.pointConnectionColorBy,Yn=void 0===qn?fn:qn,Xn=e.pointConnectionOpacity,$n=void 0===Xn?null:Xn,Qn=e.pointConnectionOpacityBy,it=void 0===Qn?rn:Qn,at=e.pointConnectionOpacityActive,ct=void 0===at?.66:at,lt=e.pointConnectionSize,st=void 0===lt?2:lt,dt=e.pointConnectionSizeActive,vt=void 0===dt?2:dt,It=e.pointConnectionSizeBy,Tt=void 0===It?tn:It,Bt=e.pointConnectionMaxIntPointsPerSegment,Dt=void 0===Bt?100:Bt,zt=e.pointConnectionTolerance,Nt=void 0===zt?.002:zt,kt=e.pointSize,jt=void 0===kt?6:kt,Ft=e.pointSizeSelected,_t=void 0===Ft?2:Ft,Vt=e.pointSizeMouseDetection,Wt=void 0===Vt?"auto":Vt,Zt=e.pointOutlineWidth,Gt=void 0===Zt?2:Zt,Ut=e.opacity,Kt=void 0===Ut?me:Ut,qt=e.opacityBy,Yt=void 0===qt?on:qt,Ht=e.opacityByDensityFill,Xt=void 0===Ht?.15:Ht,$t=e.opacityInactiveMax,Jt=void 0===$t?1:$t,Qt=e.opacityInactiveScale,er=void 0===Qt?1:Qt,nr=e.sizeBy,tr=void 0===nr?nn:nr,rr=e.pointScaleMode,or=void 0===rr?"asinh":rr,ir=e.height,ar=void 0===ir?en:ir,cr=e.width,lr=void 0===cr?Qe:cr,sr=e.annotationLineColor,ur=void 0===sr?pn:sr,fr=e.annotationLineWidth,dr=void 0===fr?1:fr,vr=e.annotationHVLineLimit,hr=void 0===vr?1e3:vr,pr=e.cameraIsFixed,yr=void 0!==pr&&pr,mr=lr===me?1:lr,gr=ar===me?1:ar,wr=e.performanceMode,xr=void 0!==wr&&wr,br=e.opacityByDensityDebounceTime,Pr=void 0===br?25:br,Sr=e.spatialIndexUseWorker,Ar=void 0===Sr?undefined:Sr,Er=Boolean(e.renderPointsAsSquares||xr),Mr=Boolean(e.disableAlphaBlending||xr);Cn=rt(Ae,be)(Cn),a||(a=Et({regl:e.regl,gamma:e.gamma})),P=mt(P,!0),W=mt(W,!0),Rn=mt(Rn,!0);var Ir,Cr,Tr,Lr,Or,Rr,Br,Dr,zr,Nr,kr,jr,Fr,_r,Vr,Wr,Zr,Gr,Ur=!1,Kr=!1,qr=gt(P),Yr=!1,Hr=null,Xr=[0,0],$r=-1,Jr=[],Qr=new Set,eo=new Set,no=!1,to=new Set,ro=[],oo=0,io=0,ao=!1,co=[],lo=e.aspectRatio||1,so=!1,uo=!0,fo=!1;Dn=ht(Dn)?h(Dn):[Dn],Nn=ht(Nn)?h(Nn):[Nn],jn=ht(jn)?h(jn):[jn],Dn=Dn.map((function(e){return mt(e,!0)})),Nn=Nn.map((function(e){return mt(e,!0)})),jn=jn.map((function(e){return mt(e,!0)})),Kt=!Array.isArray(Kt)&&Number.isNaN(+Kt)?Dn[0][3]:Kt,Kt=et(Kt,nt,{minLength:1})?h(Kt):[Kt];var vo,ho,po,yo,mo=1/(jt=et(jt,nt,{minLength:1})?h(jt):[jt])[0];Wn="inherit"===Wn?h(Dn):(Wn=ht(Wn)?h(Wn):[Wn]).map((function(e){return mt(e,!0)})),Gn="inherit"===Gn?h(Nn):(Gn=ht(Gn)?h(Gn):[Gn]).map((function(e){return mt(e,!0)})),Kn="inherit"===Kn?h(jn):(Kn=ht(Kn)?h(Kn):[Kn]).map((function(e){return mt(e,!0)})),$n="inherit"===$n?h(Kt):et($n,nt,{minLength:1})?h($n):[$n],st="inherit"===st?h(jt):et(st,nt,{minLength:1})?h(st):[st],D=Ot(D,an),Yt=Ot(Yt,on,{allowDensity:!0}),tr=Ot(tr,nn),Yn=Ot(Yn,fn,{allowSegment:!0,allowInherit:!0}),it=Ot(it,rn,{allowSegment:!0}),Tt=Ot(Tt,tn,{allowSegment:!0});var go,wo,xo,bo,Po,So,Ao,Eo,Mo,Io,Co,To,Lo=0,Oo=0,Ro=!1,Bo=null,Do=Ln,zo=0,No=0,ko=!1,jo=!1,Fo=!1,_o=!1,Vo=Te,Wo=Te,Zo=!1,Go=e.xScale||null,Uo=e.yScale||null,Ko=0,qo=0,Yo=0,Ho=0;Go&&(Ko=Go.domain()[0],qo=Go.domain()[1]-Go.domain()[0],Go.range([0,mr])),Uo&&(Yo=Uo.domain()[0],Ho=Uo.domain()[1]-Uo.domain()[0],Uo.range([gr,0]));var Xo=function(e){return e/mr*2-1},$o=function(e){return 1+e/gr*-2},Jo=function(e,n){var r=[e,n,1,1];return B(r,r,T(t,L(t,Rr,L(t,Ir.view,Dr)))),r.slice(0,2)},Qo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=ia(),t=(Wr[1]-Zr[1])/I.height;return(_r*n+e)*t},ei=function(){return no?ro.filter((function(e,n){return to.has(n)})):ro},ni=function(e,n,t,r){var o=Lr.range(e,n,t,r);return no?o.filter((function(e){return to.has(e)})):o},ti=function(){var e,n=v([Xo(i[0]),$o(i[1])],2),t=n[0],r=n[1],o=v(Jo(t,r),2),a=o[0],c=o[1],l=Qo(4),u=l,f=-1,d=s(ni(a-l,c-l,a+l,c+l));try{for(d.s();!(e=d.n()).done;){var h=e.value,p=v(ro[h],2),y=p[0],m=p[1],g=Jn(y,m,a,c);g<u&&(u=g,f=h)}}catch(e){d.e(e)}finally{d.f()}return f},ri=function(e){var n,t,r,o,i,a=function(e){for(var n=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=0;i<e.length;i+=2)n=e[i]<n?e[i]:n,t=e[i]>t?e[i]:t,r=e[i+1]<r?e[i+1]:r,o=e[i+1]>o?e[i+1]:o;return[n,r,t,o]}(e);if(n=v(a,4),t=n[0],r=n[1],o=n[2],i=n[3],!(Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(i)&&o-t>0&&i-r>0))return[];var c,l=[],u=s(ni.apply(void 0,h(a)));try{for(u.s();!(c=u.n()).done;){var f=c.value;ut(e,ro[f])&&l.push(f)}}catch(e){u.e(e)}finally{u.f()}return l},oi=function(){co=[],Cr&&Cr.clear()},ii=function(e){return e&&e.length>4},ai=function(e,n){if(!kr&&_n&&ii(ro[e[0]])){var t,r=0===n,o=1===n?function(e){return eo.add(e)}:g,i=Object.keys(e.reduce((function(e,n){var t=ro[n];return e[Array.isArray(t[4])?t[4][0]:t[4]]=!0,e}),{})),a=zr.getData().opacities,c=i.filter((function(e){return!eo.has(+e)})),l=s(c);try{for(l.s();!(t=l.n()).done;){var u=t.value,f=Nr[u][0],d=Nr[u][2],v=4*f+2*Nr[u][3],h=v+2*d+4;void 0===a.__original__&&(a.__original__=a.slice());for(var p=v;p<h;p++)a[p]=r?a.__original__[p]:ct;o(u)}}catch(e){l.e(e)}finally{l.f()}zr.getBuffer().opacities.subdata(a,0)}},ci=function(e){return[e%Lo/Lo+Oo,Math.floor(e/Lo)/Lo+Oo]},li=function(e){return no&&!to.has(e)},si=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;J===Oe&&oi(),Jr.length>0&&(t||n.publish("deselect"),eo.clear(),ai(Jr,0),Jr=[],Qr.clear(),uo=!0)},ui=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.intersect,o=void 0!==r&&r,i=t.merge,a=void 0!==i&&i,c=t.remove,l=void 0!==c&&c,s=t.preventEvent,u=void 0!==s&&s,f=Array.isArray(e)?e:[e],d=h(Jr);if(o){var v=new Set(f);if(Jr=Jr.length>0?Jr.filter((function(e){return v.has(e)})):f,d.length===Jr.length)return void(uo=!0)}else if(a){if(Jr=((e,n)=>{const t=[];return e.forEach((e=>{t[e]=!0})),n.forEach((e=>{t[e]=!0})),t.reduce(((e,n,t)=>(n&&e.push(t),e)),[])})(Jr,f),d.length===Jr.length)return void(uo=!0)}else if(l){var p=new Set(f);if(Jr=Jr.filter((function(e){return!p.has(e)})),d.length===Jr.length)return void(uo=!0)}else{var y;if((null===(y=Jr)||void 0===y?void 0:y.length)>0&&ai(Jr,0),d.length>0&&0===f.length)return void si({preventEvent:u});Jr=f}if(w(d,Jr))uo=!0;else{var m=[];Qr.clear(),eo.clear();for(var g=Jr.length-1;g>=0;g--){var x=Jr[g];x<0||x>=oo||li(x)?Jr.splice(g,1):(Qr.add(x),m.push.apply(m,ci(x)))}wo({usage:"dynamic",type:"float",data:m}),ai(Jr,1),u||n.publish("select",{points:Jr,lassoMode:X}),uo=!0}},fi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.showReticleOnce,o=void 0!==r&&r,i=t.preventEvent,a=void 0!==i&&i,c=!1;if(!(no&&!to.has(e))&&e>=0&&e<oo){c=!0;var l=To,s=e!==To;+l>=0&&s&&!Qr.has(l)&&ai([l],0),To=e,xo.subdata(ci(e)),Qr.has(e)||ai([e],2),s&&!a&&n.publish("pointover",To)}else(c=+To>=0)&&(Qr.has(To)||ai([To],0),a||n.publish("pointout",To)),To=void 0;c&&(uo=!0,fo=o)},di=function(e){var n=I.getBoundingClientRect();return i[0]=e.clientX-n.left,i[1]=e.clientY-n.top,[].concat(i)},vi=Hn(I,{onStart:function(){Ir.config({isFixed:!0}),Yr=!0,ao=!0,oi(),$r>=0&&(clearTimeout($r),$r=-1),n.publish("lassoStart")},onDraw:function(e,t){co=e,Cr.setPoints(t),n.publish("lassoExtend",{coordinates:e})},onEnd:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.intersect,i=void 0!==o&&o,a=r.merge,c=void 0!==a&&a,l=r.remove,s=void 0!==l&&l;Ir.config({isFixed:yr}),co=h(e);var u=ri(t);ui(u,{intersect:i,merge:c,remove:s}),n.publish("lassoEnd",{coordinates:co}),J===Re&&oi()},enableInitiator:ee,initiatorParentElement:te,longPressIndicatorParentElement:oe,pointNorm:function(e){var n=v(e,2),t=n[0],r=n[1];return Jo(Xo(t),$o(r))},minDelay:K,minDist:"brush"===xe?Math.max(3,Y):Y,type:xe}),hi=function(e,n){switch(Mn[n]){case Ke:return e.altKey;case qe:return e.metaKey;case Ye:return e.ctrlKey;case He:return e.metaKey;case Xe:return e.shiftKey;default:return!1}},pi=function(e){jo&&1===e.buttons&&(Yr=!0,Hr=performance.now(),Xr=di(e),!(ao=Cn===Pe||hi(e,Ve))&&ae&&(vi.showLongPressIndicator(e.clientX,e.clientY,{time:le,extraTime:ue,delay:ve}),$r=setTimeout((function(){$r=-1,ao=!0}),le)))},yi=function(e){if(jo){if(Yr=!1,$r>=0&&(clearTimeout($r),$r=-1),ao){e.preventDefault(),ao=!1;var n=!!X;vi.end({intersect:n?"intersect"===X:hi(e,_e),merge:n?"merge"===X:hi(e,Ze),remove:n?"remove"===X:hi(e,Ge)})}ae&&vi.hideLongPressIndicator({time:pe})}},mi=function(e){if(jo){e.preventDefault();var n=di(e);if(!(Jn.apply(void 0,h(n).concat(h(Xr)))>=Y)){var t=performance.now()-Hr;if(!ee||t<500){var r=ti();r>=0?(Jr.length>0&&J===Oe&&oi(),ui([r],{merge:hi(e,Ze),remove:hi(e,Ge)})):Vr||(Vr=setTimeout((function(){Vr=null,vi.showInitiator(e)}),200))}}}},gi=function(e){vi.hideInitiator(),Vr&&(clearTimeout(Vr),Vr=null),N&&(e.preventDefault(),si())},wi=function(e){if(_o||(Zo=function(e){return document.elementsFromPoint(e.clientX,e.clientY).some((function(e){return e===I}))}(e),_o=!0),jo&&(Zo||Yr)){var n=di(e),t=Jn.apply(void 0,h(n).concat(h(Xr)))>=Y;Zo&&!ao&&fi(ti()),ao?(e.preventDefault(),vi.extend(e,!0)):Yr&&ae&&t&&vi.hideLongPressIndicator({time:pe}),$r>=0&&t&&(clearTimeout($r),$r=-1),Yr&&(uo=!0)}},xi=function(){To=void 0,Zo=!1,_o=!1,jo&&(+To>=0&&!Qr.has(To)&&ai([To],0),yi(),uo=!0)},bi=function(){var e=Math.max(jt.length,Kt.length);No=Math.max(2,Math.ceil(Math.sqrt(e)));for(var n=new Float32Array(4*Math.pow(No,2)),t=0;t<e;t++){n[4*t]=jt[t]||0,n[4*t+1]=Math.min(1,Kt[t]||0);var r=Number((Nn[t]||Nn[0])[3]);n[4*t+2]=Math.min(1,Number.isNaN(r)?1:r);var o=Number((jn[t]||jn[0])[3]);n[4*t+3]=Math.min(1,Number.isNaN(o)?1:o)}return a.regl.texture({data:n,shape:[No,No,4],type:"float"})},Pi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dn,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nn,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jn,r=e.length,o=n.length,i=t.length,a=[];if(r===o&&o===i)for(var c=0;c<r;c++)a.push(e[c],n[c],t[c],P);else for(var l=0;l<r;l++){var s=[e[l][0],e[l][1],e[l][2],1],u=D===an?n[0]:s,f=D===an?t[0]:s;a.push(e[l],u,f,P)}return a},Si=function(){var e=Pi(),n=e.length;zo=Math.max(2,Math.ceil(Math.sqrt(n)));var t=new Float32Array(4*Math.pow(zo,2));return e.forEach((function(e,n){t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),a.regl.texture({data:t,shape:[zo,zo,4],type:"float"})},Ai=function(){Rr=R([],[1/(Or=mr/gr),1,1]),Br=R([],[1/Or,1,1]),Dr=R([],[lo,1,1])},Ei=function(e,n){return function(t){if(t&&0!==t.length){var r=h(e()),o=ht(t)?t:[t];if(o=o.map((function(e){return mt(e,!0)})),i=r,a=o,!(Array.isArray(i)&&Array.isArray(a)&&i.length===a.length&&(0===i.length||Array.isArray(i[0])&&Array.isArray(a[0])&&i.every((function(e,n){var t=v(e,4),r=t[0],o=t[1],i=t[2],c=t[3],l=v(a[n],4),s=l[0],u=l[1],f=l[2],d=l[3];return r===s&&o===u&&i===f&&c===d}))))){var i,a;Io&&Io.destroy();try{n(o),Io=Si()}catch(e){console.error("Invalid colors. Switching back to default colors."),n(r),Io=Si()}}}}},Mi=Ei((function(){return Dn}),(function(e){Dn=e})),Ii=Ei((function(){return Nn}),(function(e){Nn=e})),Ci=Ei((function(){return jn}),(function(e){jn=e})),Ti=function(){if(Go||Uo){var e,n,t,r,o,i,a=v((e=Jo(-1,-1),n=Jo(1,1),t=(e[0]+1)/2,r=(n[0]+1)/2,o=(e[1]+1)/2,i=(n[1]+1)/2,[[Ko+t*qo,Ko+r*qo],[Yo+o*Ho,Yo+i*Ho]]),2),c=a[0],l=a[1];Go&&Go.domain(c),Uo&&Uo.domain(l)}},Li=function(e,n){gr=Math.max(1,e),I.height=Math.floor(gr*window.devicePixelRatio),Uo&&(Uo.range([gr,0]),n||Ti())},Oi=function(e){if(e===me)return ar=e,I.style.height="100%",void window.requestAnimationFrame((function(){I&&Li(I.getBoundingClientRect().height)}));!+e||+e<=0||(Li(ar=+e),I.style.height="".concat(ar,"px"))},Ri=function(){_r=Wt,Wt===me&&(_r=Array.isArray(jt)?jt.reduce(((e,n)=>n>e?n:e),-1/0):jt)},Bi=function(e){var n=Array.isArray(jt)?h(jt):jt;et(e,nt,{minLength:1})?jt=h(e):tt(+e)&&(jt=[+e]),n===jt||w(n,jt)||(Co&&Co.destroy(),mo=1/jt[0],Co=bi(),Ri())},Di=function(e,n){mr=Math.max(1,e),I.width=Math.floor(mr*window.devicePixelRatio),Go&&(Go.range([0,mr]),n||Ti())},zi=function(e){if(e===me)return lr=e,I.style.width="100%",void window.requestAnimationFrame((function(){I&&Di(I.getBoundingClientRect().width)}));!+e||+e<=0||(Di(lr=+e),I.style.width="".concat(mr,"px"))},Ni=function(e){switch(e){case"valueZ":return Vo;case"valueW":return Wo;default:return null}},ki=function(e,n){return e===Ce?function(e){return Math.round(e*(n.length-1))}:g},ji=function(){return p},Fi=function(){return[I.width,I.height]},_i=function(){return Io},Vi=function(){return zo},Wi=function(){return.5/zo},Zi=function(){return window.devicePixelRatio},Gi=function(){return wo},Ui=function(){return Co},Ki=function(){return No},qi=function(){return.5/No},Yi=function(){return 0},Hi=function(){return po||vo},Xi=function(){return Lo},$i=function(){return.5/Lo},Ji=function(){return Br},Qi=function(){return Ir.view},ea=function(){return Dr},na=function(){return L(r,Br,L(r,Ir.view,Dr))},ta=function(){return window.devicePixelRatio},ra=function(){return pt(mo,Ir.scaling[0])*window.devicePixelRatio},oa=function(){return Ir.scaling[0]>1?Math.asinh(pt(1,Ir.scaling[0]))/Math.asinh(1)*window.devicePixelRatio:pt(mo,Ir.scaling[0])*window.devicePixelRatio},ia=oa;"linear"===or?ia=ra:"constant"===or&&(ia=ta);var aa=function(){return no?to.size:oo},ca=function(){return Jr.length},la=function(){return ca()>0?Jt:1},sa=function(){return ca()>0?er:1},ua=function(){return+("valueZ"===D)},fa=function(){return+("valueW"===D)},da=function(){return+("valueZ"===Yt)},va=function(){return+("valueW"===Yt)},ha=function(){return+("density"===Yt)},pa=function(){return+("valueZ"===tr)},ya=function(){return+("valueW"===tr)},ma=function(){return+m},ga=function(){return"valueZ"===D?Vo===Ce?Dn.length-1:1:Wo===Ce?Dn.length-1:1},wa=function(){return"valueZ"===Yt?Vo===Ce?Kt.length-1:1:Wo===Ce?Kt.length-1:1},xa=function(){return"valueZ"===tr?Vo===Ce?jt.length-1:1:Wo===Ce?jt.length-1:1},ba=function(e){if("density"!==Yt)return 1;var n=ia(),t=jt[0]*n,r=2/(2/Ir.view[0])*(2/(2/Ir.view[5])),o=e.viewportHeight,i=e.viewportWidth,a=Xt*i*o/(io*t*t)*yt(1,r);a*=Er?1:1/(.25*Math.PI);var c=pt(1,t)+.5;return a*=Math.pow(t/c,2),yt(1,pt(0,a))},Pa=a.regl({framebuffer:function(){return yo},vert:"precision highp float;\n\nattribute vec2 position;\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // map normalized device coords to texture coords\n particleTextureIndex = 0.5 * (1.0 + position);\n\n gl_Position = vec4(position, 0, 1);\n}",frag:"precision highp float;\n\nuniform sampler2D startStateTex;\nuniform sampler2D endStateTex;\nuniform float t;\n\nvarying vec2 particleTextureIndex;\n\nvoid main() {\n // Interpolate x, y, and value\n vec3 start = texture2D(startStateTex, particleTextureIndex).xyw;\n vec3 end = texture2D(endStateTex, particleTextureIndex).xyw;\n vec3 curr = start * (1.0 - t) + end * t;\n\n // The category cannot be interpolated\n float endCategory = texture2D(endStateTex, particleTextureIndex).z;\n\n gl_FragColor = vec4(curr.xy, endCategory, curr.z);\n}",attributes:{position:[-4,0,4,4,4,-4]},uniforms:{startStateTex:function(){return ho},endStateTex:function(){return vo},t:function(e,n){return n.t}},count:3}),Sa=function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:la,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:sa;return a.regl({frag:Er?"precision highp float;\n\nvarying vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n":"\nprecision highp float;\n\nuniform float antiAliasing;\n\nvarying vec4 color;\nvarying float finalPointSize;\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nvoid main() {\n vec2 c = gl_PointCoord * 2.0 - 1.0;\n float sdf = length(c) * finalPointSize;\n float alpha = linearstep(finalPointSize + antiAliasing, finalPointSize - antiAliasing, sdf);\n\n gl_FragColor = vec4(color.rgb, alpha * color.a);\n}\n",vert:Mt(r),blend:{enable:!Mr,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},depth:{enable:!1},attributes:{stateIndex:{buffer:t,size:2}},uniforms:{antiAliasing:ji,resolution:Fi,modelViewProjection:na,devicePixelRatio:Zi,pointScale:function(){return ia()},encodingTex:Ui,encodingTexRes:Ki,encodingTexEps:qi,pointOpacityMax:o,pointOpacityScale:i,pointSizeExtra:e,globalState:r,colorTex:_i,colorTexRes:Vi,colorTexEps:Wi,stateTex:Hi,stateTexRes:Xi,stateTexEps:$i,isColoredByZ:ua,isColoredByW:fa,isOpacityByZ:da,isOpacityByW:va,isOpacityByDensity:ha,isSizedByZ:pa,isSizedByW:ya,isPixelAligned:ma,colorMultiplicator:ga,opacityMultiplicator:wa,opacityDensity:ba,sizeMultiplicator:xa,numColorStates:4,drawingBufferWidth:function(e){return e.drawingBufferWidth},drawingBufferHeight:function(e){return e.drawingBufferHeight}},count:n,primitive:"points"})},Aa=Sa(Yi,aa,(function(){return go})),Ea=Sa(Yi,(function(){return 1}),(function(){return xo}),2,(function(){return 1}),(function(){return 1})),Ma=Sa((function(){return(_t+2*Gt)*window.devicePixelRatio}),ca,Gi,1,(function(){return 1}),(function(){return 1})),Ia=Sa((function(){return(_t+Gt)*window.devicePixelRatio}),ca,Gi,3,(function(){return 1}),(function(){return 1})),Ca=Sa((function(){return _t*window.devicePixelRatio}),ca,Gi,1,(function(){return 1}),(function(){return 1})),Ta=a.regl({frag:"\nprecision mediump float;\n\nuniform sampler2D texture;\n\nvarying vec2 uv;\n\nvoid main () {\n gl_FragColor = texture2D(texture, uv);\n}\n",vert:"\nprecision mediump float;\n\nuniform mat4 modelViewProjection;\n\nattribute vec2 position;\n\nvarying vec2 uv;\n\nvoid main () {\n uv = position;\n gl_Position = modelViewProjection * vec4(-1.0 + 2.0 * uv.x, 1.0 - 2.0 * uv.y, 0, 1);\n}\n",attributes:{position:[0,1,0,0,1,0,0,1,1,1,1,0]},uniforms:{modelViewProjection:na,texture:function(){return E}},count:6}),La=a.regl({vert:"\n precision mediump float;\n uniform mat4 modelViewProjection;\n attribute vec2 position;\n void main () {\n gl_Position = modelViewProjection * vec4(position, 0, 1);\n }",frag:"\n precision mediump float;\n uniform vec4 color;\n void main () {\n gl_FragColor = vec4(color.rgb, 0.2);\n }",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"}},attributes:{position:function(){return co}},uniforms:{modelViewProjection:na,color:function(){return W}},elements:function(){return j(Cr.getPoints())}}),Oa=function(e){for(var n=new Float32Array(2*e),t=0,r=0;r<e;++r){var o=ci(r);n[t]=o[0],n[t+1]=o[1],t+=2}return n},Ra=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.length;Lo=Math.max(2,Math.ceil(Math.sqrt(t))),Oo=.5/Lo;for(var r=new Float32Array(4*Math.pow(Lo,2)),o=!0,i=!0,c=0,l=0,s=0,u=0;u<t;++u)r[c=4*u]=e[u][0],r[c+1]=e[u][1],l=e[u][2]||0,s=e[u][3]||0,r[c+2]=l,r[c+3]=s,o&&(o=Number.isInteger(l)),i&&(i=Number.isInteger(s));return Vo=n.z&&Le.includes(n.z)?n.z:o?Te:Ce,Wo=n.w&&Le.includes(n.w)?n.w:i?Te:Ce,a.regl.texture({data:r,shape:[Lo,Lo,4],type:"float"})},Ba=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(t){jo=!1;var r=(null==n?void 0:n.preventFilterReset)&&e.length===oo;oo=e.length,io=oo,vo&&vo.destroy(),vo=Ra(e,{z:n.zDataType,w:n.wDataType}),r||go({usage:"static",type:"float",data:Oa(oo)}),ye(n.spatialIndex||e,{useWorker:Ar}).then((function(n){Lr=n,ro=e,jo=!0})).then(t)}))},Da=function(e,n){bo=Ir.target,Po=e,So=Ir.distance[0],Ao=n},za=function(e){var n="inherit"===Yn?D:Yn;if("segment"===n){var t=Wn.length-1;return t<1?[]:e.reduce((function(e,n,r){for(var o=0,i=[],a=2;a<n.length;a+=2){var c=Math.sqrt(Math.pow(n[a-2]-n[a],2)+Math.pow(n[a-1]-n[a+1],2));i.push(c),o+=c}e[r]=[0];for(var l=0,s=0;s<n.length/2-1;s++)l+=i[s],e[r].push(4*Math.floor(l/o*t));return e}),[])}if(n){var r=Rt(n),o=ki(Ni(n),"inherit"===Yn?Dn:Wn);return Nr.reduce((function(e,n){var t=v(n,2),i=t[0],a=t[1];return e[i]=4*o(a[r]),e}),[])}return new Array(Nr.length).fill(0)},Na=function(){var e="inherit"===it?Yt:it;if("segment"===e){var n=$n.length-1;return n<1?[]:Nr.reduce((function(e,t){var r=v(t,3),o=r[0];r[1];var i=r[2];return e[o]=x(i,(function(e){return $n[Math.floor(e/(i-1)*n)]})),e}),[])}if(e){var t=Rt(e),r="inherit"===it?Kt:$n,o=ki(Ni(e),r);return Nr.reduce((function(e,n){var i=v(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e}),[])}},ka=function(){var e="inherit"===Tt?tr:Tt;if("segment"===e){var n=st.length-1;return n<1?[]:Nr.reduce((function(e,t){var r=v(t,3),o=r[0];r[1];var i=r[2];return e[o]=x(i,(function(e){return st[Math.floor(e/(i-1)*n)]})),e}),[])}if(e){var t=Rt(e),r="inherit"===Tt?jt:st,o=ki(Ni(e),r);return Nr.reduce((function(e,n){var i=v(n,2),a=i[0],c=i[1];return e[a]=r[o(c[t])],e}),[])}},ja=function(e){return new Promise((function(n){zr.setPoints([]),(null==e?void 0:e.length)>0?(kr=!0,Ct(e,{maxIntPointsPerSegment:Dt,tolerance:Nt}).then((function(e){!function(e){Nr=[];var n=0;Object.keys(e).forEach((function(t,r){Nr[t]=[r,e[t].reference,e[t].length/2,n],n+=e[t].length/2}))}(e);var t=Object.values(e);zr.setPoints(1===t.length?t[0]:t,{colorIndices:za(t),opacities:Na(),widths:ka()}),kr=!1,n()}))):n()}))},Fa=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,r=void 0!==t&&t;no=!0,to.clear();var o,i=Array.isArray(e)?e:[e],a=[],c=[],l=[],u=s(i);try{for(u.s();!(o=u.n()).done;){var f=o.value;!Number.isFinite(f)||f<0||f>=oo||(a.push(f),to.add(f),Qr.has(f)&&l.push(f))}}catch(e){u.e(e)}finally{u.f()}var d,v=s(function(e){for(var n=e.length,t=1;t<n;t++){for(var r=e[t],o=t-1;o>-1&&r<e[o];)e[o+1]=e[o],o--;e[o+1]=r}return e}([].concat(a)));try{for(v.s();!(d=v.n()).done;){var h=d.value;c.push.apply(c,ci(h))}}catch(e){v.e(e)}finally{v.f()}return go.subdata(c),ui(l,{preventEvent:r}),to.has(To)||fi(-1,{preventEvent:r}),new Promise((function(e){var t=function(){n.subscribe("draw",(function(){r||n.publish("filter",{points:a}),e()}),1),uo=!0};_n||ii(ro[0])?ja(ei()).then((function(){r||n.publish("pointConnectionsDraw"),ui(l,{preventEvent:r}),t()})):t()}))},_a=function(){return ni(Zr[0],Zr[1],Wr[0],Wr[1])},Va=A((function(){io=_a().length}),Pr),Wa=function(){return Boolean(ho&&po)},Za=function(){return Boolean(void 0!==bo&&void 0!==Po&&void 0!==So&&void 0!==Ao)},Ga=function(e,n){Bo||(Bo=performance.now());var t,r,o,i=performance.now()-Bo,a=(t=n(i/e),r=0,o=1,Math.min(o,Math.max(r,t)));return Wa()&&Pa({t:a}),Za()&&function(e){var n=v(bo,2),t=n[0],r=n[1],o=v(Po,2),i=1-e,a=t*i+o[0]*e,c=r*i+o[1]*e,l=So*i+Ao*e;Ir.lookAt([a,c],l)}(a),i<e},Ua=function(){Ro=!1,Bo=null,Eo=void 0,Mo=void 0,Ln=Do,ho&&(ho.destroy(),ho=void 0),po&&(po.destroy(),po=void 0),bo=void 0,Po=void 0,So=void 0,Ao=void 0,n.publish("transitionEnd")},Ka=function(e){var t=e.duration,r=void 0===t?500:t,o=e.easing,i=void 0===o?Ie:o;Ro&&n.publish("transitionEnd"),Ro=!0,Bo=null,Eo=r,Mo=ft(i)?Me[i]||Ie:i,Do=Ln,Ln=!1,n.publish("transitionStart")},qa=function(e){return Kr?Promise.reject(new An):(Fo=!1,0===e.length?new Promise((function(e){Tr.clear(),n.subscribe("draw",e,1),Fo=!0,uo=!0})):new Promise((function(t){var r,o=[],i=new Map,a=[],c=[],l=-1,u=function(e){c.push(e.lineWidth||dr);var n=mt(e.lineColor||ur,!0),t="[".concat(n.join(","),"]");if(i.has(t)){var r=i.get(t).idx;a.push(r)}else{var o=++l;i.set(t,{idx:o,color:n}),a.push(o)}},f=s(e);try{for(f.s();!(r=f.n()).done;){var d,v,h,p,y=r.value;if(xt(y))o.push([null!==(d=y.x1)&&void 0!==d?d:-hr,y.y,null!==(v=y.x2)&&void 0!==v?v:hr,y.y]),u(y);else if(bt(y))o.push([y.x,null!==(h=y.y1)&&void 0!==h?h:-hr,y.x,null!==(p=y.y2)&&void 0!==p?p:hr]),u(y);else St(y)?(o.push([y.x1,y.y1,y.x2,y.y1,y.x2,y.y2,y.x1,y.y2,y.x1,y.y1]),u(y)):Pt(y)?(o.push([y.x,y.y,y.x+y.width,y.y,y.x+y.width,y.y+y.height,y.x,y.y+y.height,y.x,y.y]),u(y)):At(y)&&(o.push(y.vertices.flatMap(g)),u(y))}}catch(e){f.e(e)}finally{f.f()}Tr.setStyle({color:Array.from(i.values()).sort((function(e,n){return e.idx>n.idx?1:-1})).map((function(e){return e.color}))}),Tr.setPoints(1===o.length?o.flat():o,{colorIndices:a,widths:c}),n.subscribe("draw",t,1),Fo=!0,uo=!0})))},Ya=function(e){return function(){var t=e.apply(void 0,arguments);return uo=!0,new Promise((function(e){n.subscribe("draw",(function(){return e(t)}),1)}))}},Ha=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r){var o=B([],[e.x+e.width/2,e.y+e.height/2,0,0],Dr).slice(0,2),i=2*Math.atan(1),a=Or/lo,c=e.height*a>=e.width?e.height/2/Math.tan(i/2):e.width/2/Math.tan(i/2)/a;t.transition?(Ir.config({isFixed:!0}),Da(o,c),n.subscribe("transitionEnd",(function(){r(),Ir.config({isFixed:yr})}),1),Ka({duration:t.transitionDuration,easing:t.transitionEasing})):(Ir.lookAt(o,c),n.subscribe("draw",r,1),uo=!0)}))},Xa=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(o){r.transition?(Ir.config({isFixed:!0}),Da(e,t),n.subscribe("transitionEnd",(function(){o(),Ir.config({isFixed:yr})}),1),Ka({duration:r.transitionDuration,easing:r.transitionEasing})):(Ir.lookAt(e,t),n.subscribe("draw",o,1),uo=!0)}))},$a=function(){zr.setStyle({color:Pi(Wn,Gn,Kn),opacity:null===$n?null:$n[0],width:st[0]})},Ja=function(){var e=Math.round(qr)>.5?0:255;vi.initiator.style.border="1px dashed rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.33)"),vi.initiator.style.background="rgba(".concat(e,", ").concat(e,", ").concat(e,", 0.1)")},Qa=function(){var e=Math.round(qr)>.5?0:255;vi.longPressIndicator.style.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")"),vi.longPressIndicator.dataset.color="rgb(".concat(e,", ").concat(e,", ").concat(e,")");var n=W.map((function(e){return Math.round(255*e)}));vi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")},ec=function(e){e&&Ir.setView(e)},nc=function(e){(Mn=Object.entries(e).reduce((function(e,n){var t=v(n,2),r=t[0],o=t[1];return $e.includes(o)&&Ue.includes(r)&&(e[r]=o),e}),{}))[We]?Ir.config({isRotate:!0,mouseDownMoveModKey:Mn[We]}):Ir.config({isRotate:!1})},tc=function(e,n){return function(t){if("inherit"===t)e(h(n()));else{var r=ht(t)?t:[t];e(r.map((function(e){return mt(e,!0)})))}$a()}},rc=tc((function(e){Wn=e}),(function(){return Dn})),oc=tc((function(e){Gn=e}),(function(){return Nn})),ic=tc((function(e){Kn=e}),(function(){return jn})),ac=function(e){p=Number(e)||.5},cc=function(e){m=Boolean(e)},lc=function(){var e,t,r,o,i,c,l,s,u,f,d,v,p,y,m,g,x,b,S,A,M,C,T,L,O,R,B,z,k,j,F,V,Z,U,q,H,$,Q,ne,re,ie,ce,se,fe,de,he,ye=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Kr?Promise.reject(new Error(An)):(Lt(ye),void 0===ye.backgroundColor&&void 0===ye.background||(e=ye.backgroundColor||ye.background)&&(P=mt(e,!0),qr=gt(P),Ja(),Qa()),void 0!==ye.backgroundImage&&((t=ye.backgroundImage)?ft(t)?ot(a.regl,t).then((function(e){E=e,uo=!0,n.publish("backgroundImageReady")})).catch((function(){console.error("Count not create texture from ".concat(t)),E=null})):E="texture2d"===t._reglType?t:null:E=null),void 0!==ye.cameraTarget&&(r=ye.cameraTarget)&&Ir.lookAt(r,Ir.distance[0],Ir.rotation),void 0!==ye.cameraDistance&&(o=ye.cameraDistance)>0&&Ir.lookAt(Ir.target,o,Ir.rotation),void 0!==ye.cameraRotation&&null!==(i=ye.cameraRotation)&&Ir.lookAt(Ir.target,Ir.distance[0],i),void 0!==ye.cameraView&&ec(ye.cameraView),void 0!==ye.cameraIsFixed&&(c=ye.cameraIsFixed,yr=Boolean(c),Ir.config({isFixed:yr})),void 0!==ye.colorBy&&(l=ye.colorBy,D=Ot(l,an)),void 0!==ye.pointColor&&Mi(ye.pointColor),void 0!==ye.pointColorActive&&Ii(ye.pointColorActive),void 0!==ye.pointColorHover&&Ci(ye.pointColorHover),void 0!==ye.pointSize&&Bi(ye.pointSize),void 0!==ye.pointSizeSelected&&(!+(s=ye.pointSizeSelected)||+s<0||(_t=+s)),void 0!==ye.pointSizeMouseDetection&&(u=ye.pointSizeMouseDetection,Wt=u,Ri()),void 0!==ye.sizeBy&&function(e){tr=Ot(e,nn)}(ye.sizeBy),void 0!==ye.opacity&&(f=ye.opacity,d=Array.isArray(Kt)?h(Kt):Kt,et(f,nt,{minLength:1})?Kt=h(f):tt(+f)&&(Kt=[+f]),d===Kt||w(d,Kt)||(Co&&Co.destroy(),Co=bi())),void 0!==ye.showPointConnections&&(v=ye.showPointConnections,(_n=!!v)?jo&&ii(ro[0])&&ja(ei()).then((function(){n.publish("pointConnectionsDraw"),uo=!0})):ja()),void 0!==ye.pointConnectionColor&&rc(ye.pointConnectionColor),void 0!==ye.pointConnectionColorActive&&oc(ye.pointConnectionColorActive),void 0!==ye.pointConnectionColorHover&&ic(ye.pointConnectionColorHover),void 0!==ye.pointConnectionColorBy&&function(e){Yn=Ot(e,fn,{allowSegment:!0,allowInherit:!0})}(ye.pointConnectionColorBy),void 0!==ye.pointConnectionOpacityBy&&function(e){it=Ot(e,rn,{allowSegment:!0})}(ye.pointConnectionOpacityBy),void 0!==ye.pointConnectionOpacity&&function(e){et(e,nt,{minLength:1})&&($n=h(e)),tt(+e)&&($n=[+e]),Wn=Wn.map((function(e){return e[3]=Number.isNaN(+$n[0])?e[3]:+$n[0],e})),$a()}(ye.pointConnectionOpacity),void 0!==ye.pointConnectionOpacityActive&&function(e){!Number.isNaN(+e)&&+e&&(ct=+e)}(ye.pointConnectionOpacityActive),void 0!==ye.pointConnectionSize&&(p=ye.pointConnectionSize,et(p,nt,{minLength:1})&&(st=h(p)),tt(+p)&&(st=[+p]),$a()),void 0!==ye.pointConnectionSizeActive&&(y=ye.pointConnectionSizeActive,!Number.isNaN(+y)&&+y&&(vt=Math.max(0,y))),void 0!==ye.pointConnectionSizeBy&&function(e){Tt=Ot(e,tn,{allowSegment:!0})}(ye.pointConnectionSizeBy),void 0!==ye.pointConnectionMaxIntPointsPerSegment&&(m=ye.pointConnectionMaxIntPointsPerSegment,Dt=Math.max(0,m)),void 0!==ye.pointConnectionTolerance&&(g=ye.pointConnectionTolerance,Nt=Math.max(0,g)),void 0!==ye.pointScaleMode&&function(e){switch(e){case"linear":or=e,ia=ra;break;case"constant":or=e,ia=ta;break;default:or="asinh",ia=oa}}(ye.pointScaleMode),void 0!==ye.opacityBy&&function(e){Yt=Ot(e,on,{allowDensity:!0})}(ye.opacityBy),void 0!==ye.lassoColor&&function(e){if(e){W=mt(e,!0),Cr.setStyle({color:W});var n=W.map((function(e){return Math.round(255*e)}));vi.longPressIndicator.dataset.activeColor="rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")")}}(ye.lassoColor),void 0!==ye.lassoLineWidth&&(x=ye.lassoLineWidth,Number.isNaN(+x)||+x<1||(G=+x,Cr.setStyle({width:G}))),void 0!==ye.lassoMinDelay&&+(b=ye.lassoMinDelay)&&(K=+b,vi.set({minDelay:K})),void 0!==ye.lassoMinDist&&+(S=ye.lassoMinDist)&&(Y=+S,vi.set({minDist:Y})),void 0!==ye.lassoClearEvent&&(A=ye.lassoClearEvent,J=rt(Be,J)(A)),void 0!==ye.lassoInitiator&&(M=ye.lassoInitiator,ee=Boolean(M),vi.set({enableInitiator:ee})),void 0!==ye.lassoInitiatorParentElement&&(C=ye.lassoInitiatorParentElement,te=C,vi.set({initiatorParentElement:te})),void 0!==ye.lassoLongPressIndicatorParentElement&&(T=ye.lassoLongPressIndicatorParentElement,oe=T,vi.set({longPressIndicatorParentElement:oe})),void 0!==ye.lassoOnLongPress&&(L=ye.lassoOnLongPress,ae=Boolean(L)),void 0!==ye.lassoLongPressTime&&(O=ye.lassoLongPressTime,le=Number(O)),void 0!==ye.lassoLongPressAfterEffectTime&&(R=ye.lassoLongPressAfterEffectTime,ue=Number(R)),void 0!==ye.lassoLongPressEffectDelay&&(B=ye.lassoLongPressEffectDelay,ve=Number(B)),void 0!==ye.lassoLongPressRevertEffectTime&&function(e){pe=Number(e)}(ye.lassoLongPressRevertEffectTime),void 0!==ye.lassoType&&("brush"===(z=ye.lassoType)?vi.set({type:z,minDist:Math.max(3,Y)}):vi.set({type:z,minDist:Y}),xe=vi.get("type")),void 0!==ye.lassoMode&&(k=ye.lassoMode,X=k),void 0!==ye.lassoBrushSize&&(j=ye.lassoBrushSize,xn=Number(j)||xn,vi.set({brushSize:xn})),void 0!==ye.actionKeyMap&&nc(ye.actionKeyMap),void 0!==ye.mouseMode&&(F=ye.mouseMode,Cn=rt(Ae,be)(F),Ir.config({defaultMouseDownMoveAction:Cn===Se?"rotate":"pan"})),void 0!==ye.showReticle&&null!==(V=ye.showReticle)&&(Ln=V),void 0!==ye.reticleColor&&(Z=ye.reticleColor)&&(Rn=mt(Z,!0),jr.setStyle({color:Rn}),Fr.setStyle({color:Rn})),void 0!==ye.pointOutlineWidth&&(!+(U=ye.pointOutlineWidth)||+U<0||(Gt=+U)),void 0!==ye.height&&Oi(ye.height),void 0!==ye.width&&zi(ye.width),void 0!==ye.aspectRatio&&(+(q=ye.aspectRatio)<=0||(lo=q)),void 0!==ye.xScale&&(H=ye.xScale)&&(Go=H,Ko=H.domain()[0],qo=H?H.domain()[1]-H.domain()[0]:0,Go.range([0,mr]),Ti()),void 0!==ye.yScale&&($=ye.yScale)&&(Yo=(Uo=$).domain()[0],Ho=Uo?Uo.domain()[1]-Uo.domain()[0]:0,Uo.range([gr,0]),Ti()),void 0!==ye.deselectOnDblClick&&(Q=ye.deselectOnDblClick,N=!!Q),void 0!==ye.deselectOnEscape&&(ne=ye.deselectOnEscape,_=!!ne),void 0!==ye.opacityByDensityFill&&(re=ye.opacityByDensityFill,Xt=+re),void 0!==ye.opacityInactiveMax&&(ie=ye.opacityInactiveMax,Jt=+ie),void 0!==ye.opacityInactiveScale&&(ce=ye.opacityInactiveScale,er=+ce),void 0!==ye.gamma&&(se=ye.gamma,a.gamma=se),void 0!==ye.annotationLineColor&&(fe=ye.annotationLineColor,ur=mt(fe)),void 0!==ye.annotationLineWidth&&(de=ye.annotationLineWidth,dr=+de),void 0!==ye.annotationHVLineLimit&&(he=ye.annotationHVLineLimit,hr=+he),void 0!==ye.antiAliasing&&ac(ye.antiAliasing),void 0!==ye.pixelAligned&&cc(ye.pixelAligned),new Promise((function(e){window.requestAnimationFrame((function(){!Kr&&I&&(Ai(),Ir.refresh(),a.refresh(),wc(),e())}))})))},sc=function(){Ir||(Ir=k(I,{isFixed:yr,isPanInverted:[!1,!0],defaultMouseDownMoveAction:Cn===Se?"rotate":"pan"})),e.cameraView?Ir.setView(C(e.cameraView)):e.cameraTarget||e.cameraDistance||e.cameraRotation?Ir.lookAt(h(e.cameraTarget||yn),e.cameraDistance||1,e.cameraRotation||0):Ir.setView(C(mn)),Wr=Jo(1,1),Zr=Jo(-1,-1)},uc=function(e){if("Escape"===e.key)_&&si()},fc=function(){Zo=!0,_o=!0},dc=function(){fi(),Zo=!1,_o=!0,uo=!0},vc=function(){uo=!0},hc=function(){Ba([]),zr.clear()},pc=function(){qa([])},yc=function(){var e=lr===me,n=ar===me;if(e||n){var t=I.getBoundingClientRect(),r=t.width,o=t.height;e&&Di(r,!0),n&&Li(o,!0),Ai(),Ti(),uo=!0}Ir.refresh()},mc=function(){var e,t=(e=d().mark((function e(t){var r,o,i,c,l,s,u,f,v,h,y,g,w;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.style.userSelect="none",r=window.devicePixelRatio,o=jt,i=lr,c=ar,l=a.canvas.width/r,s=a.canvas.height/r,u=m,f=p,v=(null==t?void 0:t.scale)||1,h=Array.isArray(jt)?jt.map((function(e){return e*v})):jt*v,y=mr*v,g=gr*v,Bi(h),zi(y),Oi(g),cc((null==t?void 0:t.pixelAligned)||m),ac((null==t?void 0:t.antiAliasing)||p),a.resize(lr,ar),a.refresh(),e.next=22,new Promise((function(e){n.subscribe("draw",e,1),wc()}));case 22:return w=I.getContext("2d").getImageData(0,0,I.width,I.height),a.resize(l,s),a.refresh(),Bi(o),zi(i),Oi(c),cc(u),ac(f),e.next=32,new Promise((function(e){n.subscribe("draw",e,1),wc()}));case 32:return I.style.userSelect=null,e.abrupt("return",w);case 34:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,o){var i=e.apply(n,t);function a(e){c(i,r,o,a,l,"next",e)}function l(e){c(i,r,o,a,l,"throw",e)}a(void 0)}))});return function(e){return t.apply(this,arguments)}}(),gc=a.onFrame((function(){if(ko=Ir.tick(),(jo||Fo)&&(uo||Ro)){Ro&&!Ga(Eo,Mo)&&Ua(),ko&&(Wr=Jo(1,1),Zr=Jo(-1,-1),"density"===Yt&&Va()),a.render((function(){var e;!function(e,n){Br[0]=e/Or,Br[5]=n}(I.width/a.canvas.width,I.height/a.canvas.height),null!==(e=E)&&void 0!==e&&e._reglType&&Ta(),co.length>2&&La(),Ro||zr.draw({projection:Ji(),model:ea(),view:Qi()});var n=aa();jo&&n>0&&Aa(),Yr||!Ln&&!fo||function(){if(To>=0){var e=v(ro[To].slice(0,2),2),n=[e[0],e[1],0,1];L(t,Br,L(t,Ir.view,Dr)),B(n,n,t),jr.setPoints([-1,n[1],1,n[1]]),Fr.setPoints([n[0],1,n[0],-1]),jr.draw(),Fr.draw(),Sa((function(){return(_t+2*Gt)*window.devicePixelRatio}),(function(){return 1}),xo,1)(),Sa((function(){return(_t+Gt)*window.devicePixelRatio}),(function(){return 1}),xo,3)()}}(),To>=0&&Ea(),Jr.length>0&&(Ma(),Ia(),Ca()),Tr.draw({projection:Ji(),model:ea(),view:Qi()}),Cr.draw({projection:Ji(),model:ea(),view:Qi()})}),I);var e={view:Ir.view,isViewChanged:ko,camera:Ir,xScale:Go,yScale:Uo};ko&&(Ti(),so?so=!1:n.publish("view",e)),uo=!1,fo=!1,n.publish("drawing",e,{async:!1}),n.publish("draw",e)}})),wc=function(){uo=!0};return function(){Ai(),sc(),Ti(),Cr=fe(a.regl,{color:W,width:G,is2d:!0}),zr=fe(a.regl,{color:Pi(Wn,Gn,Kn),opacity:null===$n?null:$n[0],width:st[0],is2d:!0}),jr=fe(a.regl,{color:Rn,width:1,is2d:!0}),Fr=fe(a.regl,{color:Rn,width:1,is2d:!0}),Tr=fe(a.regl,{color:ur,width:dr,is2d:!0}),Ri(),I.addEventListener("wheel",vc),go=a.regl.buffer(),wo=a.regl.buffer(),xo=a.regl.buffer({usage:"dynamic",type:"float",length:2*ge}),Io=Si(),Co=bi();var e=lc({backgroundImage:E,width:lr,height:ar,actionKeyMap:Mn});Ja(),Qa(),window.addEventListener("keyup",uc,!1),window.addEventListener("blur",xi,!1),window.addEventListener("mouseup",yi,!1),window.addEventListener("mousemove",wi,!1),I.addEventListener("mousedown",pi,!1),I.addEventListener("mouseenter",fc,!1),I.addEventListener("mouseleave",dc,!1),I.addEventListener("click",mi,!1),I.addEventListener("dblclick",gi,!1),"ResizeObserver"in window?(Gr=new ResizeObserver(yc)).observe(I):(window.addEventListener("resize",yc),window.addEventListener("orientationchange",yc)),e.then((function(){n.publish("init")}))}(),{get isSupported(){return a.isSupported},clear:Ya((function(){hc(),pc()})),clearPoints:Ya(hc),clearPointConnections:Ya((function(){zr.clear()})),clearAnnotations:Ya(pc),createTextureFromUrl:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bn;return ot(a.regl,e,n)},deselect:si,destroy:function(){jo=!1,Fo=!1,Kr=!0,gc(),window.removeEventListener("keyup",uc,!1),window.removeEventListener("blur",xi,!1),window.removeEventListener("mouseup",yi,!1),window.removeEventListener("mousemove",wi,!1),I.removeEventListener("mousedown",pi,!1),I.removeEventListener("mouseenter",fc,!1),I.removeEventListener("mouseleave",dc,!1),I.removeEventListener("click",mi,!1),I.removeEventListener("dblclick",gi,!1),I.removeEventListener("wheel",vc,!1),Gr?Gr.disconnect():(window.removeEventListener("resize",yc),window.removeEventListener("orientationchange",yc)),I=void 0,Ir.dispose(),Ir=void 0,Cr.destroy(),vi.destroy(),zr.destroy(),jr.destroy(),Fr.destroy(),Io&&Io.destroy(),Co&&Co.destroy(),e.renderer||a.isDestroyed||a.destroy(),n.publish("destroy"),n.clear()},draw:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Kr?Promise.reject(new Error(An)):Ur?Promise.reject(new Error("Ignoring draw call as the previous draw call has not yet finished. To avoid this warning `await` the draw call.")):(Ur=!0,wt(e).then((function(e){return new Promise((function(r){if(Kr)r();else{var o=!1;t.preventFilterReset&&(null==e?void 0:e.length)===oo||(no=!1,to.clear());var i=e&&ii(e[0])&&(_n||t.showPointConnectionsOnce),c=t.zDataType,l=t.wDataType;new Promise((function(s){e?(t.transition&&(e.length===oo?o=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!vo)return!1;if(Ro){var t=ho;ho=po,t.destroy()}else ho=vo;return po=Ra(e,n),yo=a.regl.framebuffer({color:po,depth:!1,stencil:!1}),vo=void 0,!0}(e,{z:c,w:l}):console.warn("Cannot transition! The number of points between the previous and current draw call must be identical.")),Ba(e,{zDataType:c,wDataType:l,preventFilterReset:t.preventFilterReset,spatialIndex:t.spatialIndex}).then((function(){void 0!==t.hover&&fi(t.hover,{preventEvent:!0}),void 0!==t.select&&ui(t.select,{preventEvent:!0}),void 0!==t.filter&&Fa(t.filter,{preventEvent:!0}),i?ja(e).then((function(){n.publish("pointConnectionsDraw"),uo=!0,fo=t.showReticleOnce})).then((function(){return r()})):s()}))):s()})).then((function(){t.transition&&o?(i?Promise.all([new Promise((function(e){n.subscribe("transitionEnd",(function(){uo=!0,fo=t.showReticleOnce,e()}),1)})),new Promise((function(e){n.subscribe("pointConnectionsDraw",e,1)}))]).then((function(){return r()})):n.subscribe("transitionEnd",(function(){uo=!0,fo=t.showReticleOnce,r()}),1),Ka({duration:t.transitionDuration,easing:t.transitionEasing})):(i?Promise.all([new Promise((function(e){n.subscribe("draw",e,1)})),new Promise((function(e){n.subscribe("pointConnectionsDraw",e,1)}))]).then((function(){return r()})):n.subscribe("draw",(function(){return r()}),1),uo=!0,fo=t.showReticleOnce)}))}})).finally((function(){Ur=!1}))})))},drawAnnotations:qa,filter:Fa,get:function(e){var n,t=v(Object.keys(Lt(u({},e,Pn))),1)[0];return"aspectRatio"===t?lo:"background"===t||"backgroundColor"===t?P:"backgroundImage"===t?E:"camera"===t?Ir:"cameraTarget"===t?Ir.target:"cameraDistance"===t?Ir.distance[0]:"cameraRotation"===t?Ir.rotation:"cameraView"===t?Ir.view:"cameraIsFixed"===t?yr:"canvas"===t?I:"colorBy"===t?D:"sizeBy"===t?tr:"deselectOnDblClick"===t?N:"deselectOnEscape"===t?_:"height"===t?ar:"lassoColor"===t?W:"lassoLineWidth"===t?G:"lassoMinDelay"===t?K:"lassoMinDist"===t?Y:"lassoClearEvent"===t?J:"lassoInitiator"===t?ee:"lassoInitiatorElement"===t?vi.initiator:"lassoInitiatorParentElement"===t?te:"lassoLongPressIndicatorParentElement"===t?oe:"lassoOnLongPress"===t?ae:"lassoType"===t?xe:"lassoBrushSize"===t?xn:"mouseMode"===t?Cn:"opacity"===t?1===Kt.length?Kt[0]:Kt:"opacityBy"===t?Yt:"opacityByDensityFill"===t?Xt:"opacityByDensityDebounceTime"===t?Pr:"opacityInactiveMax"===t?Jt:"opacityInactiveScale"===t?er:"points"===t?ro:"hoveredPoint"===t?To:"selectedPoints"===t?h(Jr):"filteredPoints"===t?no?Array.from(to):Array.from({length:ro.length},(function(e,n){return n})):"pointsInView"===t?_a():"pointColor"===t?1===Dn.length?Dn[0]:Dn:"pointColorActive"===t?1===Nn.length?Nn[0]:Nn:"pointColorHover"===t?1===jn.length?jn[0]:jn:"pointOutlineWidth"===t?Gt:"pointSize"===t?1===jt.length?jt[0]:jt:"pointSizeSelected"===t?_t:"pointSizeMouseDetection"===t?Wt:"showPointConnections"===t?_n:"pointConnectionColor"===t?1===Wn.length?Wn[0]:Wn:"pointConnectionColorActive"===t?1===Gn.length?Gn[0]:Gn:"pointConnectionColorHover"===t?1===Kn.length?Kn[0]:Kn:"pointConnectionColorBy"===t?Yn:"pointConnectionOpacity"===t?1===$n.length?$n[0]:$n:"pointConnectionOpacityBy"===t?it:"pointConnectionOpacityActive"===t?ct:"pointConnectionSize"===t?1===st.length?st[0]:st:"pointConnectionSizeActive"===t?vt:"pointConnectionSizeBy"===t?Tt:"pointConnectionMaxIntPointsPerSegment"===t?Dt:"pointConnectionTolerance"===t?Nt:"pointScaleMode"===t?or:"reticleColor"===t?Rn:"regl"===t?a.regl:"showReticle"===t?Ln:"version"===t?"1.14.1-hemato.3":"width"===t?lr:"xScale"===t?Go:"yScale"===t?Uo:"performanceMode"===t?xr:"renderPointsAsSquares"===t?Er:"disableAlphaBlending"===t?Mr:"gamma"===t?a.gamma:"renderer"===t?a:"isDestroyed"===t?Kr:"isDrawing"===t?Ur:"isPointsDrawn"===t?jo:"isPointsFiltered"===t?no:"isAnnotationsDrawn"===t?Fo:"zDataType"===t?Vo:"wDataType"===t?Wo:"spatialIndex"===t?null===(n=Lr)||void 0===n?void 0:n.data:"annotationLineColor"===t?ur:"annotationLineWidth"===t?dr:"annotationHVLineLimit"===t?hr:"antiAliasing"===t?p:"pixelAligned"===t?m:"actionKeyMap"===t?function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach((function(n){u(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},Mn):void 0},getScreenPosition:function(e){if(!jo)throw new Error(Sn);var n=ro[e];if(n){var r=[n[0],n[1],0,1];return L(t,Rr,L(t,Ir.view,Dr)),B(r,r,t),[mr*(r[0]+1)/2,gr*(.5-r[1]/2)]}},hover:fi,redraw:wc,refresh:a.refresh,reset:Ya((function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;sc(),Ti(),t||n.publish("view",{view:Ir.view,camera:Ir,xScale:Go,yScale:Uo})})),select:ui,set:lc,export:function(e){return void 0===e?I.getContext("2d").getImageData(0,0,I.width,I.height):mc(e)},subscribe:n.subscribe,unfilter:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).preventEvent,t=void 0!==e&&e;return no=!1,to.clear(),go.subdata(Oa(oo)),new Promise((function(e){var r=function(){n.subscribe("draw",(function(){t||n.publish("unfilter"),e()}),1),uo=!0};_n||ii(ro[0])?ja(ei()).then((function(){t||n.publish("pointConnectionsDraw"),r()})):r()}))},unsubscribe:n.unsubscribe,view:function(e){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventEvent,t=void 0!==n&&n;ec(e),uo=!0,so=t},zoomToLocation:Xa,zoomToArea:Ha,zoomToPoints:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!jo)return Promise.reject(new Error(Sn));var t=function(e){var n,t=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=s(e);try{for(a.s();!(n=a.n()).done;){var c=n.value,l=v(ro[c],2),u=l[0],f=l[1];t=Math.min(t,u),r=Math.max(r,u),o=Math.min(o,f),i=Math.max(i,f)}}catch(e){a.e(e)}finally{a.f()}return{x:t,y:o,width:r-t,height:i-o}}(e),r=t.x+t.width/2,o=t.y+t.height/2,i=Qo(),a=1+(n.padding||0),c=Math.max(t.width,i)*a,l=Math.max(t.height,i)*a;return Ha({x:r-c/2,y:o-l/2,width:c,height:l},n)},zoomToOrigin:function(){return Xa([0,0],1,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}}},Object.defineProperty(e,"__esModule",{value:!0})}));
package/dist/types.d.ts CHANGED
@@ -295,7 +295,7 @@ export type Events = import('pub-sub-es').Event<
295
295
  { coordinates: number[] }
296
296
  > &
297
297
  import('pub-sub-es').Event<'pointOver' | 'pointOut', number> &
298
- import('pub-sub-es').Event<'select' | 'focus', { points: number[] }> &
298
+ import('pub-sub-es').Event<'select' | 'focus', { points: number[]; lassoMode: LassoOptions["mode"]; }> &
299
299
  import('pub-sub-es').Event<'points', { points: number[][] }> &
300
300
  import('pub-sub-es').Event<'transitionEnd', import('regl').Regl> &
301
301
  import('pub-sub-es').Event<
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hema-to/regl-scatterplot",
3
- "version": "1.14.1-hemato.2",
3
+ "version": "1.14.1-hemato.3",
4
4
  "description": "A WebGL-Powered Scalable Interactive Scatter Plot Library",
5
5
  "author": "Fritz Lekschas",
6
6
  "keywords": [
@@ -97,4 +97,4 @@
97
97
  "bugs": {
98
98
  "url": "https://github.com/flekschas/regl-scatterplot/issues"
99
99
  }
100
- }
100
+ }
package/src/index.js CHANGED
@@ -885,7 +885,7 @@ const createScatterplot = (
885
885
  setPointConnectionColorState(selectedPoints, 1);
886
886
 
887
887
  if (!preventEvent) {
888
- pubSub.publish('select', { points: selectedPoints });
888
+ pubSub.publish('select', { points: selectedPoints, lassoMode });
889
889
  }
890
890
 
891
891
  draw = true;
package/src/types.d.ts CHANGED
@@ -295,7 +295,7 @@ export type Events = import('pub-sub-es').Event<
295
295
  { coordinates: number[] }
296
296
  > &
297
297
  import('pub-sub-es').Event<'pointOver' | 'pointOut', number> &
298
- import('pub-sub-es').Event<'select' | 'focus', { points: number[] }> &
298
+ import('pub-sub-es').Event<'select' | 'focus', { points: number[]; lassoMode: LassoOptions["mode"]; }> &
299
299
  import('pub-sub-es').Event<'points', { points: number[][] }> &
300
300
  import('pub-sub-es').Event<'transitionEnd', import('regl').Regl> &
301
301
  import('pub-sub-es').Event<