var tn=Object.defineProperty,nn=Object.defineProperties;var sn=Object.getOwnPropertyDescriptors;var ht=Object.getOwnPropertySymbols;var on=Object.prototype.hasOwnProperty,rn=Object.prototype.propertyIsEnumerable;var Re=(n,e)=>{if(e=Symbol[n])return e;throw Error("Symbol."+n+" is not defined")};var Ge=(n,e,t)=>e in n?tn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,je=(n,e)=>{for(var t in e||(e={}))on.call(e,t)&&Ge(n,t,e[t]);if(ht)for(var t of ht(e))rn.call(e,t)&&Ge(n,t,e[t]);return n},Ne=(n,e)=>nn(n,sn(e));var A=(n,e,t)=>(Ge(n,typeof e!="symbol"?e+"":e,t),t);var an=function(n,e){this[0]=n,this[1]=e};var dt=n=>{var e=n[Re("asyncIterator")],t=!1,i,s={};return e==null?(e=n[Re("iterator")](),i=o=>s[o]=c=>e[o](c)):(e=e.call(n),i=o=>s[o]=c=>{if(t){if(t=!1,o==="throw")throw c;return c}return t=!0,{done:!1,value:new an(new Promise(a=>{var d=e[o](c);if(!(d instanceof Object))throw TypeError("Object expected");a(d)}),1)}}),s[Re("iterator")]=()=>s,i("next"),"throw"in e?i("throw"):s.throw=o=>{throw o},"return"in e&&i("return"),s};import{X as ln,Y as cn,S as un,Z as hn,_ as dn,$ as fn,a0 as We,a1 as pn,a2 as mn,b as se,C as Je,V as W,a3 as vn,G as pe,a as me,D as gn,a4 as wn,z as et,w as be,m as Rt,a5 as Gt,a6 as N,J as tt,y as jt,O as nt,a7 as it,a8 as yn,P as Sn,A as En,t as xn,a9 as An,aa as st,ab as Mn,I as ft,ac as ke,ad as le,ae as Pn,af as Nt,ag as Le,ah as Oe,ai as Wt,aj as Cn,ak as Ie,al as bn,am as Ln,L as On,x as zn,T as Dn,E as Bn,an as Un}from"./screen2Standard-a1d50517-1786527543390.js";import{E as ot,q as Ft}from"./TopicSwitcher-23495f80-1786527543390.js";function Tn(n){let e=null,t=!1,i=!1;function s(){!t||i||(n(),e=requestAnimationFrame(s))}function o(){t||(t=!0,s())}function c(){t&&(t=!1,i=!0,cancelAnimationFrame(e))}function a(){!t&&i&&(t=!0,i=!1,s())}return{start:o,pause:c,resume:a,isActive:()=>t}}class In extends ot{constructor({canvas:e,config:t={}}){super(),this.canvas=e,this.config=t||{},this.maxPixelRatio=Number(this.config.maxPixelRatio)||2,this.handleResize=()=>{this.init(),this.emit("resize")},this.init(),window.addEventListener("resize",this.handleResize)}init(){var i;const e=((i=this.canvas)==null?void 0:i.parentNode)||this.canvas||document.documentElement;this.width=e.offsetWidth||window.innerWidth||1,this.height=e.offsetHeight||window.innerHeight||1;const t=Number(this.config.maxPixelRatio)||this.maxPixelRatio||2;this.maxPixelRatio=t,this.pixelRatio=Math.min(window.devicePixelRatio||1,t)}destroy(){window.removeEventListener("resize",this.handleResize),this.off("resize")}}class _n extends ot{constructor(){super(),this.start=Date.now(),this.current=this.start,this.elapsed=0,this.delta=16,this.clock=new ln,this.raf=Tn(()=>this.tick()),this.raf.start()}tick(){const e=Date.now();this.delta=e-this.current,this.current=e,this.elapsed=this.current-this.start;const t=this.clock.getDelta(),i=this.clock.getElapsedTime();this.emit("tick",t,i)}destroy(){this.pause(),this.off("tick")}pause(){this.raf.pause()}resume(){this.raf.resume()}isActive(){this.raf.isActive()}}function Rn(n=10,e=62){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[],s;if(e=e||t.length,n)for(s=0;sGn(typeof n=="string"?JSON.parse(n):n);function Gn(n){var t,i,s,o;let e=(n==null?void 0:n.features)||[];for(let c=0;c{this.canvas.style.cursor="grabbing"},this.handlePointerUp=()=>{this.canvas.style.cursor="grab"},this.canvas.style.cursor="grab",this.canvas.style.touchAction="none",this.canvas.addEventListener("pointerdown",this.handlePointerDown),window.addEventListener("pointerup",this.handlePointerUp),this.canvas.addEventListener("pointerleave",this.handlePointerUp))}resize(){let e=this.sizes.width/this.sizes.height;if(this.options.isOrthographic){let t=120;this.instance.left=-t*e,this.instance.right=t*e,this.instance.top=t,this.instance.bottom=-t}else this.instance.aspect=e;this.instance.updateProjectionMatrix()}update(){this.controls.update()}destroy(){var e,t,i,s;(t=(e=this.canvas)==null?void 0:e.removeEventListener)==null||t.call(e,"pointerdown",this.handlePointerDown),(s=(i=this.canvas)==null?void 0:i.removeEventListener)==null||s.call(i,"pointerleave",this.handlePointerUp),window.removeEventListener("pointerup",this.handlePointerUp),this.controls.dispose()}}class Wn{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let i=0;for(let s=0;s0){for(c=e[--t];t>0&&(i=c,s=e[--t],c=i+s,o=s-(c-i),!o););t>0&&(o<0&&e[t-1]<0||o>0&&e[t-1]>0)&&(s=o*2,i=c+s,s==i-c&&(c=i))}return c}}function*Fn(n){for(const e of n)yield*dt(e)}function Ht(n){return Array.from(Fn(n))}var B=1e-6,Hn=1e-12,b=Math.PI,X=b/2,pt=b/4,K=b*2,q=180/b,G=b/180,T=Math.abs,Yt=Math.atan,ve=Math.atan2,_=Math.cos,Yn=Math.exp,Vn=Math.log,R=Math.sin,Jn=Math.sign||function(n){return n>0?1:n<0?-1:0},_e=Math.sqrt,kn=Math.tan;function Xn(n){return n>1?0:n<-1?b:Math.acos(n)}function ge(n){return n>1?X:n<-1?-X:Math.asin(n)}function de(){}function De(n,e){n&&vt.hasOwnProperty(n.type)&&vt[n.type](n,e)}var mt={Feature:function(n,e){De(n.geometry,e)},FeatureCollection:function(n,e){for(var t=n.features,i=-1,s=t.length;++ib&&(n-=Math.round(n/K)*K),[n,e]}Ze.invert=Ze;function Vt(n,e,t){return(n%=K)?e||t?Ke(yt(n),St(e,t)):yt(n):e||t?St(e,t):Ze}function wt(n){return function(e,t){return e+=n,T(e)>b&&(e-=Math.round(e/K)*K),[e,t]}}function yt(n){var e=wt(n);return e.invert=wt(-n),e}function St(n,e){var t=_(n),i=R(n),s=_(e),o=R(e);function c(a,d){var p=_(d),r=_(a)*p,l=R(a)*p,u=R(d),f=u*t+r*i;return[ve(l*s-f*o,r*t-u*i),ge(f*s+l*o)]}return c.invert=function(a,d){var p=_(d),r=_(a)*p,l=R(a)*p,u=R(d),f=u*s-l*o;return[ve(l*s+u*o,r*t+f*i),ge(f*t-r*i)]},c}function Qn(n){n=Vt(n[0]*G,n[1]*G,n.length>2?n[2]*G:0);function e(t){return t=n(t[0]*G,t[1]*G),t[0]*=q,t[1]*=q,t}return e.invert=function(t){return t=n.invert(t[0]*G,t[1]*G),t[0]*=q,t[1]*=q,t},e}function Kn(n,e,t,i,s,o){if(t){var c=_(e),a=R(e),d=i*t;s==null?(s=e+i*K,o=e-d/2):(s=Et(c,s),o=Et(c,o),(i>0?so)&&(s+=i*K));for(var p,r=s;i>0?r>o:r1&&n.push(n.pop().concat(n.shift()))},result:function(){var t=n;return n=[],e=null,t}}}function ze(n,e){return T(n[0]-e[0])=0;--a)s.point((l=r[a])[0],l[1]);else i(u.x,u.p.x,-1,s);u=u.p}u=u.o,r=u.z,f=!f}while(!u.v);s.lineEnd()}}}function xt(n){if(e=n.length){for(var e,t=0,i=n[0],s;++t=0?1:-1,U=z*O,M=U>b,V=h*P;if(d.add(ve(V*z*R(U),E*L+V*_(U))),c+=M?O+z*K:O,M^m>=t^w>=t){var I=Be(ce(f),ce(y));Qe(I);var D=Be(o,I);Qe(D);var v=(M^O>=0?-1:1)*ge(D[2]);(i>v||i===v&&(I[0]||I[1]))&&(a+=M^O>=0?1:-1)}}return(c<-B||c0){for(d||(s.polygonStart(),d=!0),s.lineStart(),P=0;P1&&w&2&&x.push(x.pop().concat(x.shift())),r.push(x.filter($n))}}return u}}function $n(n){return n.length>1}function ei(n,e){return((n=n.x)[0]<0?n[1]-X-B:X-n[1])-((e=e.x)[0]<0?e[1]-X-B:X-e[1])}const At=Xt(function(){return!0},ti,ii,[-b,-X]);function ti(n){var e=NaN,t=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(o,c){var a=o>0?b:-b,d=T(o-e);T(d-b)0?X:-X),n.point(i,t),n.lineEnd(),n.lineStart(),n.point(a,t),n.point(o,t),s=0):i!==a&&d>=b&&(T(e-i)B?Yt((R(e)*(o=_(i))*R(t)-R(i)*(s=_(e))*R(n))/(s*o*c)):(e+i)/2}function ii(n,e,t,i){var s;if(n==null)s=t*X,i.point(-b,s),i.point(0,s),i.point(b,s),i.point(b,0),i.point(b,-s),i.point(0,-s),i.point(-b,-s),i.point(-b,0),i.point(-b,s);else if(T(n[0]-e[0])>B){var o=n[0]0,s=T(e)>B;function o(r,l,u,f){Kn(f,n,t,u,r,l)}function c(r,l){return _(r)*_(l)>e}function a(r){var l,u,f,m,g;return{lineStart:function(){m=f=!1,g=1},point:function(h,E){var S=[h,E],y,w=c(h,E),x=i?w?0:p(h,E):w?p(h+(h<0?b:-b),E):0;if(!l&&(m=f=w)&&r.lineStart(),w!==f&&(y=d(l,S),(!y||ze(l,y)||ze(S,y))&&(S[2]=1)),w!==f)g=0,w?(r.lineStart(),y=d(S,l),r.point(y[0],y[1])):(y=d(l,S),r.point(y[0],y[1],2),r.lineEnd()),l=y;else if(s&&l&&i^w){var P;!(x&u)&&(P=d(S,l,!0))&&(g=0,i?(r.lineStart(),r.point(P[0][0],P[0][1]),r.point(P[1][0],P[1][1]),r.lineEnd()):(r.point(P[1][0],P[1][1]),r.lineEnd(),r.lineStart(),r.point(P[0][0],P[0][1],3)))}w&&(!l||!ze(l,S))&&r.point(S[0],S[1]),l=S,f=w,u=x},lineEnd:function(){f&&r.lineEnd(),l=null},clean:function(){return g|(m&&f)<<1}}}function d(r,l,u){var f=ce(r),m=ce(l),g=[1,0,0],h=Be(f,m),E=Se(h,h),S=h[0],y=E-S*S;if(!y)return!u&&r;var w=e*E/y,x=-e*S/y,P=Be(g,h),L=Ee(g,w),O=Ee(h,x);Fe(L,O);var z=P,U=Se(L,z),M=Se(z,z),V=U*U-M*(Se(L,L)-1);if(!(V<0)){var I=_e(V),D=Ee(z,(-U-I)/M);if(Fe(D,L),D=qe(D),!u)return D;var v=r[0],C=l[0],j=r[1],J=l[1],Q;C0^D[1]<(T(D[0]-v)b^(v<=D[0]&&D[0]<=C)){var ie=Ee(z,(-U+I)/M);return Fe(ie,L),[D,qe(ie)]}}}function p(r,l){var u=i?n:b-n,f=0;return r<-u?f|=1:r>u&&(f|=2),l<-u?f|=4:l>u&&(f|=8),f}return Xt(c,a,o,i?[0,-n]:[-b,n-b])}function oi(n,e,t,i,s,o){var c=n[0],a=n[1],d=e[0],p=e[1],r=0,l=1,u=d-c,f=p-a,m;if(m=t-c,!(!u&&m>0)){if(m/=u,u<0){if(m0){if(m>l)return;m>r&&(r=m)}if(m=s-c,!(!u&&m<0)){if(m/=u,u<0){if(m>l)return;m>r&&(r=m)}else if(u>0){if(m0)){if(m/=f,f<0){if(m0){if(m>l)return;m>r&&(r=m)}if(m=o-a,!(!f&&m<0)){if(m/=f,f<0){if(m>l)return;m>r&&(r=m)}else if(f>0){if(m0&&(n[0]=c+r*u,n[1]=a+r*f),l<1&&(e[0]=c+l*u,e[1]=a+l*f),!0}}}}}var fe=1e9,Ae=-fe;function ri(n,e,t,i){function s(p,r){return n<=p&&p<=t&&e<=r&&r<=i}function o(p,r,l,u){var f=0,m=0;if(p==null||(f=c(p,l))!==(m=c(r,l))||d(p,r)<0^l>0)do u.point(f===0||f===3?n:t,f>1?i:e);while((f=(f+l+4)%4)!==m);else u.point(r[0],r[1])}function c(p,r){return T(p[0]-n)0?0:3:T(p[0]-t)0?2:1:T(p[1]-e)0?1:0:r>0?3:2}function a(p,r){return d(p.x,r.x)}function d(p,r){var l=c(p,1),u=c(r,1);return l!==u?l-u:l===0?r[1]-p[1]:l===1?p[0]-r[0]:l===2?p[1]-r[1]:r[0]-p[0]}return function(p){var r=p,l=Jt(),u,f,m,g,h,E,S,y,w,x,P,L={point:O,lineStart:V,lineEnd:I,polygonStart:U,polygonEnd:M};function O(v,C){s(v,C)&&r.point(v,C)}function z(){for(var v=0,C=0,j=f.length;Ci&&(ye-oe)*(i-ie)>(ae-ie)*(n-oe)&&++v:ae<=i&&(ye-oe)*(i-ie)<(ae-ie)*(n-oe)&&--v;return v}function U(){r=l,u=[],f=[],P=!0}function M(){var v=z(),C=P&&v,j=(u=Ht(u)).length;(C||j)&&(p.polygonStart(),C&&(p.lineStart(),o(null,null,1,p),p.lineEnd()),j&&kt(u,a,v,o,p),p.polygonEnd()),r=p,u=f=m=null}function V(){L.point=D,f&&f.push(m=[]),x=!0,w=!1,S=y=NaN}function I(){u&&(D(g,h),E&&w&&l.rejoin(),u.push(l.result())),L.point=O,w&&r.lineEnd()}function D(v,C){var j=s(v,C);if(f&&m.push([v,C]),x)g=v,h=C,E=j,x=!1,j&&(r.lineStart(),r.point(v,C));else if(j&&w)r.point(v,C);else{var J=[S=Math.max(Ae,Math.min(fe,S)),y=Math.max(Ae,Math.min(fe,y))],Q=[v=Math.max(Ae,Math.min(fe,v)),C=Math.max(Ae,Math.min(fe,C))];oi(J,Q,n,e,t,i)?(w||(r.lineStart(),r.point(J[0],J[1])),r.point(Q[0],Q[1]),j||r.lineEnd(),P=!1):j&&(r.lineStart(),r.point(v,C),P=!1)}S=v,y=C,w=j}return L}}const Mt=n=>n;var ue=1/0,Ue=ue,we=-ue,Te=we,ai={point:li,lineStart:de,lineEnd:de,polygonStart:de,polygonEnd:de,result:function(){var n=[[ue,Ue],[we,Te]];return we=Te=-(Ue=ue=1/0),n}};function li(n,e){nwe&&(we=n),eTe&&(Te=e)}const Pt=ai;function at(n){return function(e){var t=new $e;for(var i in n)t[i]=n[i];return t.stream=e,t}}function $e(){}$e.prototype={constructor:$e,point:function(n,e){this.stream.point(n,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function lt(n,e,t){var i=n.clipExtent&&n.clipExtent();return n.scale(150).translate([0,0]),i!=null&&n.clipExtent(null),qn(t,n.stream(Pt)),e(Pt.result()),i!=null&&n.clipExtent(i),n}function qt(n,e,t){return lt(n,function(i){var s=e[1][0]-e[0][0],o=e[1][1]-e[0][1],c=Math.min(s/(i[1][0]-i[0][0]),o/(i[1][1]-i[0][1])),a=+e[0][0]+(s-c*(i[1][0]+i[0][0]))/2,d=+e[0][1]+(o-c*(i[1][1]+i[0][1]))/2;n.scale(150*c).translate([a,d])},t)}function ci(n,e,t){return qt(n,[[0,0],e],t)}function ui(n,e,t){return lt(n,function(i){var s=+e,o=s/(i[1][0]-i[0][0]),c=(s-o*(i[1][0]+i[0][0]))/2,a=-o*i[0][1];n.scale(150*o).translate([c,a])},t)}function hi(n,e,t){return lt(n,function(i){var s=+e,o=s/(i[1][1]-i[0][1]),c=-o*i[0][0],a=(s-o*(i[1][1]+i[0][1]))/2;n.scale(150*o).translate([c,a])},t)}var Ct=16,di=_(30*G);function bt(n,e){return+e?pi(n,e):fi(n)}function fi(n){return at({point:function(e,t){e=n(e,t),this.stream.point(e[0],e[1])}})}function pi(n,e){function t(i,s,o,c,a,d,p,r,l,u,f,m,g,h){var E=p-i,S=r-s,y=E*E+S*S;if(y>4*e&&g--){var w=c+u,x=a+f,P=d+m,L=_e(w*w+x*x+P*P),O=ge(P/=L),z=T(T(P)-1)e||T((E*I+S*D)/y-.5)>.3||c*u+a*f+d*m2?v[2]%360*G:0,I()):[a*q,d*q,p*q]},M.angle=function(v){return arguments.length?(l=v%360*G,I()):l*q},M.reflectX=function(v){return arguments.length?(u=v?-1:1,I()):u<0},M.reflectY=function(v){return arguments.length?(f=v?-1:1,I()):f<0},M.precision=function(v){return arguments.length?(P=bt(L,x=v*v),D()):_e(x)},M.fitExtent=function(v,C){return qt(M,v,C)},M.fitSize=function(v,C){return ci(M,v,C)},M.fitWidth=function(v,C){return ui(M,v,C)},M.fitHeight=function(v,C){return hi(M,v,C)};function I(){var v=Lt(t,0,0,u,f,l).apply(null,e(o,c)),C=Lt(t,i-v[0],s-v[1],u,f,l);return r=Vt(a,d,p),L=Ke(e,C),O=Ke(r,L),P=bt(L,x),D()}function D(){return z=U=null,M}return function(){return e=n.apply(this,arguments),M.invert=e.invert&&V,I()}}function ct(n,e){return[n,Vn(kn((X+e)/2))]}ct.invert=function(n,e){return[n,2*Yt(Yn(e))-X]};function ut(){return Si(ct).scale(961/K)}function Si(n){var e=wi(n),t=e.center,i=e.scale,s=e.translate,o=e.clipExtent,c=null,a,d,p;e.scale=function(l){return arguments.length?(i(l),r()):i()},e.translate=function(l){return arguments.length?(s(l),r()):s()},e.center=function(l){return arguments.length?(t(l),r()):t()},e.clipExtent=function(l){return arguments.length?(l==null?c=a=d=p=null:(c=+l[0][0],a=+l[0][1],d=+l[1][0],p=+l[1][1]),r()):c==null?null:[[c,a],[d,p]]};function r(){var l=b*i(),u=e(Qn(e.rotate()).invert([0,0]));return o(c==null?[[u[0]-l,u[1]-l],[u[0]+l,u[1]+l]]:n===ct?[[Math.max(u[0]-l,c),a],[Math.min(u[0]+l,d),p]]:[[c,Math.max(u[1]-l,a)],[d,Math.min(u[1]+l,p)]])}return r()}class Bi extends ot{constructor(e,t={}){var s,o;super();let i={isOrthographic:!1};this.config=Object.assign({},i,t),this.canvas=e,this.scene=new pn,this.sizes=new In(this),this.time=new _n(this),this.camera=new Nn(this,{isOrthographic:this.config.isOrthographic}),this.renderer=new jn(this),this.handleControlsChange=()=>{var c,a,d;this.renderer.update(),(a=(c=this.label3d)==null?void 0:c.update)==null||a.call(c),(d=this.updateTownLabelScale)==null||d.call(this)},(o=(s=this.camera.controls)==null?void 0:s.addEventListener)==null||o.call(s,"change",this.handleControlsChange),this.sizes.on("resize",()=>{this.resize()}),this.time.on("tick",c=>{this.update(c)})}setAxesHelper(e=250){if(!e)return!1;let t=new mn(e);this.scene.add(t)}resize(){this.camera.resize(),this.renderer.resize()}update(e){this.camera.update(e),this.renderer.update(e)}destroy(){var e,t,i,s;(t=(e=this.camera.controls)==null?void 0:e.removeEventListener)==null||t.call(e,"change",this.handleControlsChange),this.sizes.destroy(),this.time.destroy(),this.camera.destroy(),this.renderer.destroy(),this.scene.traverse(o=>{if(o instanceof se){o.geometry.dispose();for(const c in o.material){const a=o.material[c];a&&typeof a.dispose=="function"&&a.dispose()}}}),(s=(i=this.canvas)==null?void 0:i.parentNode)==null||s.removeChild(this.canvas)}}class Ui{constructor({material:e,time:t,size:i,diffuseColor:s,diffuseSpeed:o,diffuseWidth:c,callback:a=()=>{}}){this.time=t,this.pointShader=null,this.callback=a;let d={size:100,diffuseSpeed:15,diffuseColor:9345950,diffuseWidth:10};this.options=Object.assign({},d,{material:e,size:i,diffuseColor:s,diffuseSpeed:o,diffuseWidth:c}),this.init()}init(){let{material:e,size:t,diffuseColor:i,diffuseSpeed:s,diffuseWidth:o}=this.options,c=t/s;e.onBeforeCompile=a=>{this.pointShader=a,this.callback(a,c),a.uniforms=Ne(je({},a.uniforms),{uTime:{value:0},uSpeed:{value:s},uWidth:{value:o},uColor:{value:new Je(i)}}),a.vertexShader=a.vertexShader.replace("void main() {",` varying vec3 vPosition; void main(){ vPosition = position; `),a.fragmentShader=a.fragmentShader.replace("void main() {",` uniform float uTime; uniform float uSpeed; uniform float uWidth; uniform vec3 uColor; varying vec3 vPosition; void main(){ `),a.fragmentShader=a.fragmentShader.replace("#include ",` #ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif float r = uTime * uSpeed; float w = uWidth; // if(w>uWidth){ // w = uWidth; // }else{ // w = uTime * 1.5; // } vec2 center = vec2(0.0, 0.0); float rDistance = distance(vPosition.xy, center); if(rDistance > r && rDistance < r + 2.0 * w) { float per = 0.0; if(rDistance < r + w) { float p = smoothstep(0.0,1.0,(rDistance - r) / w); p*=p; outgoingLight = mix(outgoingLight, uColor, p); } else { float p = smoothstep(0.0,1.0,(rDistance - r - w) / w); outgoingLight = mix(uColor, outgoingLight, p); } gl_FragColor = vec4(outgoingLight, diffuseColor.a); } else { gl_FragColor = vec4(outgoingLight, 0.0); } `)}}}class Ti{constructor({scene:e,time:t},i){this.scene=e,this.time=t,this.instance=null;let s={position:new W(0,0,0),gridSize:100,gridDivision:20,gridColor:2635578,shapeSize:1,shapeColor:9345950,pointSize:.2,pointColor:2635578,pointLayout:{row:200,col:200},pointBlending:vn};this.options=Object.assign({},s,i),this.init()}init(){let e=new pe;e.name="Grid";let t=this.createGridHelp(),i=this.createShapes(),s=this.createPoint();e.add(t,i,s),e.position.copy(this.options.position),this.instance=e,this.scene.add(e)}createShapes(){let{gridSize:e,gridDivision:t,shapeSize:i,shapeColor:s}=this.options,o=e/t,c=e/2,a=new me({color:s,side:gn}),d=[];for(let l=0;l{this.update()}),this.sizes.on("resize",()=>{this.resize()})}create(e="",t="",i=!1){let s=document.createElement("div");s.innerHTML=e,s.className=t,s.style.visibility="hidden",s.style.position="absolute",t||(s.style.padding="10px",s.style.color="#fff",s.style.fontSize="12px",s.style.textAlign="center",s.style.background="rgba(0,0,0,0.6)",s.style.borderRadius="4px");let o=null;return i?o=new xi(s):o=new Qt(s),o.init=(c,a)=>{o.element.innerHTML=c,o.element.style.visibility="visible",o.position.copy(a)},o.hide=()=>{o.element.style.visibility="hidden"},o.scaleHide=()=>{o.element.classList.add("scale-hidden")},o.show=()=>{o.element.style.visibility="visible",o.element.classList.remove("scale-hidden")},o.setParent=c=>{this.parent=c,c.add(o)},o.remove=()=>{this.parent.remove(o)},o}setLabelStyle(e,t=.1,i="x",s=Math.PI/2,o="none"){e.element.style.pointerEvents=o,e.scale.set(t,t,t),e.rotation[i]=s}setRenderLevel(e){this.css3dRender.domElement.style.zIndex=e}update(){this.css3dRender.render(this.scene,this.camera.instance)}destroy(){if(this.css3dRender){let e=this.css3dRender.domElement;e.parentNode.removeChild(e)}}resize(){let{width:e,height:t}=this.sizes;this.css3dRender.setSize(e,t)}}class _i{constructor({time:e},t){this.time=e,this.options=Object.assign({},{width:10,scale:1,position:new W(0,0,0),needRotate:!1,rotateSpeed:.001,material:new me({transparent:!0,opacity:1,depthTest:!0})},t);let i=new Sn(this.options.width,this.options.width),s=new se(i,this.options.material);s.position.copy(this.options.position),s.scale.set(this.options.scale,this.options.scale,this.options.scale),this.instance=s}setParent(e){e.add(this.instance),this.time.on("tick",()=>{this.update()})}update(){this.options.needRotate&&(this.instance.rotation.z+=this.options.rotateSpeed)}}class Kt{constructor({time:e},t={}){this.instance=null,this.time=e,this.enable=!0,this.config=Object.assign({num:100,range:500,speed:.01,renderOrder:99,dir:"up",material:new Rt({map:Kt.createTexture(),size:20,color:16777215,transparent:!0,opacity:1,depthTest:!1,vertexColors:!0,blending:En,sizeAttenuation:!0})},t),this.create()}create(){const{range:e,speed:t,dir:i,material:s,num:o,renderOrder:c}=this.config,a=[],d=[],p=[];for(let l=0;li/2&&c===1&&(u=-i/2),u<-i/2&&c==-1&&(u=i/2),a.setX(r,l),a.setZ(r,u),d.setX(r,f),d.setY(r,m)}a.needsUpdate=!0,d.needsUpdate=!0}setParent(e){e.add(this.instance),this.time.on("tick",(t,i)=>{this.enable&&this.update(t,i)})}}class Ri{constructor({},e={}){this.mapGroup=new pe,this.coordinates=[],this.config=Object.assign({position:new W(0,0,0),geoProjectionCenter:new N(0,0),geoProjectionScale:120,data:"",renderOrder:1,merge:!1,material:new me({color:1582651,transparent:!0,opacity:1})},e),this.mapGroup.position.copy(this.config.position);let t=rt(this.config.data);this.create(t)}geoProjection(e){return ut().center(this.config.geoProjectionCenter).scale(this.config.geoProjectionScale).translate([0,0])(e)}create(e){let{merge:t}=this.config,i=[];if(e.features.forEach(s=>{const o=new nt;let{name:c,center:a=[],centroid:d=[]}=s.properties;this.coordinates.push({name:c,center:a,centroid:d}),o.userData.name=c,s.geometry.coordinates.forEach(p=>{p.forEach(r=>{const l=new tt;for(let f=0;f{var p,r,l;const i=new nt;let{name:s,center:o=[],centroid:c=[]}=t.properties;this.coordinates.push({name:s,center:o,centroid:c});const a={depth:this.config.depth,bevelEnabled:(p=this.config.bevelEnabled)!=null?p:!0,bevelSegments:(r=this.config.bevelSegments)!=null?r:1,bevelThickness:(l=this.config.bevelThickness)!=null?l:.1};let d=[this.config.topFaceMaterial,this.config.sideMaterial];t.geometry.coordinates.forEach(u=>{u.forEach((f,m)=>{const g=new tt;for(let S=0;S #include #include #include #include uniform float linewidth; uniform vec2 resolution; attribute vec3 instanceStart; attribute vec3 instanceEnd; attribute vec3 instanceColorStart; attribute vec3 instanceColorEnd; #ifdef WORLD_UNITS varying vec4 worldPos; varying vec3 worldStart; varying vec3 worldEnd; #ifdef USE_DASH varying vec2 vUv; #endif #else varying vec2 vUv; #endif #ifdef USE_DASH uniform float dashScale; attribute float instanceDistanceStart; attribute float instanceDistanceEnd; varying float vLineDistance; #endif void trimSegment( const in vec4 start, inout vec4 end ) { // trim end segment so it terminates between the camera plane and the near plane // conservative estimate of the near plane float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column float nearEstimate = - 0.5 * b / a; float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); end.xyz = mix( start.xyz, end.xyz, alpha ); } void main() { #ifdef USE_COLOR vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; #endif #ifdef USE_DASH vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; vUv = uv; #endif float aspect = resolution.x / resolution.y; // camera space vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); #ifdef WORLD_UNITS worldStart = start.xyz; worldEnd = end.xyz; #else vUv = uv; #endif // special case for perspective projection, and segments that terminate either in, or behind, the camera plane // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space // but we need to perform ndc-space calculations in the shader, so we must address this issue directly // perhaps there is a more elegant solution -- WestLangley bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column if ( perspective ) { if ( start.z < 0.0 && end.z >= 0.0 ) { trimSegment( start, end ); } else if ( end.z < 0.0 && start.z >= 0.0 ) { trimSegment( end, start ); } } // clip space vec4 clipStart = projectionMatrix * start; vec4 clipEnd = projectionMatrix * end; // ndc space vec3 ndcStart = clipStart.xyz / clipStart.w; vec3 ndcEnd = clipEnd.xyz / clipEnd.w; // direction vec2 dir = ndcEnd.xy - ndcStart.xy; // account for clip-space aspect ratio dir.x *= aspect; dir = normalize( dir ); #ifdef WORLD_UNITS vec3 worldDir = normalize( end.xyz - start.xyz ); vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) ); vec3 worldUp = normalize( cross( worldDir, tmpFwd ) ); vec3 worldFwd = cross( worldDir, worldUp ); worldPos = position.y < 0.5 ? start: end; // height offset float hw = linewidth * 0.5; worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp; // don't extend the line if we're rendering dashes because we // won't be rendering the endcaps #ifndef USE_DASH // cap extension worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir; // add width to the box worldPos.xyz += worldFwd * hw; // endcaps if ( position.y > 1.0 || position.y < 0.0 ) { worldPos.xyz -= worldFwd * 2.0 * hw; } #endif // project the worldpos vec4 clip = projectionMatrix * worldPos; // shift the depth of the projected points so the line // segments overlap neatly vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; clip.z = clipPose.z * clip.w; #else vec2 offset = vec2( dir.y, - dir.x ); // undo aspect ratio adjustment dir.x /= aspect; offset.x /= aspect; // sign flip if ( position.x < 0.0 ) offset *= - 1.0; // endcaps if ( position.y < 0.0 ) { offset += - dir; } else if ( position.y > 1.0 ) { offset += dir; } // adjust for linewidth offset *= linewidth; // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... offset /= resolution.y; // select end vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; // back to clip space offset *= clip.w; clip.xy += offset; #endif gl_Position = clip; vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation #include #include #include } `,fragmentShader:` uniform vec3 diffuse; uniform float opacity; uniform float linewidth; #ifdef USE_DASH uniform float dashOffset; uniform float dashSize; uniform float gapSize; #endif varying float vLineDistance; #ifdef WORLD_UNITS varying vec4 worldPos; varying vec3 worldStart; varying vec3 worldEnd; #ifdef USE_DASH varying vec2 vUv; #endif #else varying vec2 vUv; #endif #include #include #include #include #include vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { float mua; float mub; vec3 p13 = p1 - p3; vec3 p43 = p4 - p3; vec3 p21 = p2 - p1; float d1343 = dot( p13, p43 ); float d4321 = dot( p43, p21 ); float d1321 = dot( p13, p21 ); float d4343 = dot( p43, p43 ); float d2121 = dot( p21, p21 ); float denom = d2121 * d4343 - d4321 * d4321; float numer = d1343 * d4321 - d1321 * d4343; mua = numer / denom; mua = clamp( mua, 0.0, 1.0 ); mub = ( d1343 + d4321 * ( mua ) ) / d4343; mub = clamp( mub, 0.0, 1.0 ); return vec2( mua, mub ); } void main() { #include #ifdef USE_DASH if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX #endif float alpha = opacity; #ifdef WORLD_UNITS // Find the closest points on the view ray and the line segment vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; vec3 lineDir = worldEnd - worldStart; vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); vec3 p1 = worldStart + lineDir * params.x; vec3 p2 = rayEnd * params.y; vec3 delta = p1 - p2; float len = length( delta ); float norm = len / linewidth; #ifndef USE_DASH #ifdef USE_ALPHA_TO_COVERAGE float dnorm = fwidth( norm ); alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); #else if ( norm > 0.5 ) { discard; } #endif #endif #else #ifdef USE_ALPHA_TO_COVERAGE // artifacts appear on some hardware if a derivative is taken within a conditional float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; float dlen = fwidth( len2 ); if ( abs( vUv.y ) > 1.0 ) { alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); } #else if ( abs( vUv.y ) > 1.0 ) { float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; if ( len2 > 1.0 ) discard; } #endif #endif vec4 diffuseColor = vec4( diffuse, alpha ); #include #include gl_FragColor = vec4( diffuseColor.rgb, alpha ); #include #include #include #include } `};class $t extends Cn{constructor(e){super({type:"LineMaterial",uniforms:Wt.clone(Oe.line.uniforms),vertexShader:Oe.line.vertexShader,fragmentShader:Oe.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}const Bt=new W,Ut=new W,F=new Ie,H=new Ie,$=new Ie,Ye=new W,Ve=new it,Y=new bn,Tt=new W,Pe=new st,Ce=new Nt,ee=new Ie;let te,re;function It(n,e,t){return ee.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),ee.multiplyScalar(1/ee.w),ee.x=re/t.width,ee.y=re/t.height,ee.applyMatrix4(n.projectionMatrixInverse),ee.multiplyScalar(1/ee.w),Math.abs(Math.max(ee.x,ee.y))}function Pi(n,e){const t=n.matrixWorld,i=n.geometry,s=i.attributes.instanceStart,o=i.attributes.instanceEnd,c=Math.min(i.instanceCount,s.count);for(let a=0,d=c;al&&H.z>l)continue;if(F.z>l){const y=F.z-H.z,w=(F.z-l)/y;F.lerp(H,w)}else if(H.z>l){const y=H.z-F.z,w=(H.z-l)/y;H.lerp(F,w)}F.applyMatrix4(i),H.applyMatrix4(i),F.multiplyScalar(1/F.w),H.multiplyScalar(1/H.w),F.x*=o.x/2,F.y*=o.y/2,H.x*=o.x/2,H.y*=o.y/2,Y.start.copy(F),Y.start.z=0,Y.end.copy(H),Y.end.z=0;const g=Y.closestPointToPointParameter(Ye,!0);Y.at(g,Tt);const h=Ln.lerp(F.z,H.z,g),E=h>=-1&&h<=1,S=Ye.distanceTo(Tt){const r=[];let l=null;t==="Line2"?(p[0].forEach(u=>{const[f,m]=this.geoProjection(u);r.push(f,-m,0)}),l=this.createLine2(r)):t==="Line3"?(p[0].forEach(u=>{const[f,m]=this.geoProjection(u);r.push(new W(f,-m,0))}),l=this.createLine3(r)):p[0].forEach(u=>{const[f,m]=this.geoProjection(u);r.push(new W(f,-m,0)),l=this.createLine(r)}),d.add(l)}),o.add(d))}return o}createLine3(e){const t=this.config.tubeRadius,i=256*10,s=4,o=!1,{material:c,renderOrder:a}=this.config,d=new zn(e),p=new Dn(d,i,t,s,o),r=new se(p,c);return r.name="mapLine3",r.renderOrder=a,r}createLine2(e){const{material:t,renderOrder:i}=this.config,s=new en;s.setPositions(e);let o=new Li(s,t);return o.name="mapLine2",o.renderOrder=i,o.computeLineDistances(),o}createLine(e){const{material:t,renderOrder:i,type:s}=this.config,o=new et;o.setFromPoints(e);let c=new Bn(o,t);return c.renderOrder=i,c.name="mapLine",c}setParent(e){e.add(this.lineGroup)}}class Ni{constructor(e,t){this.shader=null,this.config=Object.assign({uColor1:2781042,uColor2:860197,size:15,dir:"x"},t),this.init(e)}init(e){let{uColor1:t,uColor2:i,dir:s,size:o}=this.config,c={x:1,y:2,z:3};e.onBeforeCompile=a=>{this.shader=a,a.uniforms=Ne(je({},a.uniforms),{uColor1:{value:new Je(t)},uColor2:{value:new Je(i)},uDir:{value:c[s]},uSize:{value:o}}),a.vertexShader=a.vertexShader.replace("void main() {",` attribute float alpha; varying vec3 vPosition; varying float vAlpha; void main() { vAlpha = alpha; vPosition = position; `),a.fragmentShader=a.fragmentShader.replace("void main() {",` varying vec3 vPosition; varying float vAlpha; uniform vec3 uColor1; uniform vec3 uColor2; uniform float uDir; uniform float uSize; void main() { `),a.fragmentShader=a.fragmentShader.replace("#include ",` #ifdef OPAQUE diffuseColor.a = 1.0; #endif // https://github.com/mrdoob/three.js/pull/22425 #ifdef USE_TRANSMISSION diffuseColor.a *= transmissionAlpha + 0.1; #endif // vec3 gradient = mix(uColor1, uColor2, vPosition.x / 15.0); vec3 gradient = vec3(0.0,0.0,0.0); if(uDir==1.0){ gradient = mix(uColor1, uColor2, vPosition.x/ uSize); }else if(uDir==2.0){ gradient = mix(uColor1, uColor2, vPosition.z/ uSize); }else if(uDir==3.0){ gradient = mix(uColor1, uColor2, vPosition.y/ uSize); } outgoingLight = outgoingLight * gradient; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); `)}}}const Wi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK+SURBVHgB7dzNbdswGIdxSugCRtGBuklWSO17nXs/J0hHywA11AEMu3wDsLFT5WCJ5PtI/D8nQ5cA/FmxJJLqtofhHBSmPihUAoElEFgCgfVu7ODX95suqOKNXVDpDIElEFgCgSUQWAKBJRBYAoE1G2Q3DJ/j9fRjUGE7DI+f4niEGc0CMYzzKezjx7vWUQwjnMJdF8djDsq8M+QYLu/om0VJGP8OXI/LTc0C+fJhs4/fiIeLQ82hvMaI/zEevsVxCROb/RvSMkpuDCvLVVaLKCUwrGyXvS2hlMKwst6HtIBSEsPKfmO4ZpTSGFaRO/U1otTAsIo9OlkTSi0Mq+izrDWg1MSwij9cXDJKbQyrytPeJaJ4YFjVHr8vCcULw6o6H7IEFE8Mq/oEFRnFG8NymTEkohAwLLcpXBIKBcNynVMnoJAwLPdFDp4oNAwLserEA4WIYXVjK7C9Vr+fY8Gh7e8/Lhha/f5GhDMjJRBYAoElEFgCgSUQWAKBJRBYAoElEFgCgSUQWAKBJRBYAoElEFgCgSUQWAKBJRBYAoElEFgCgSUQWAKBJZDwvIIQs2kIA/K81tYvzKYhBMh/75vyCYHiDgLBSLmjuIK8xrBV6J1HoO11biCk/Rmk7XUuIMTNMhSU6iDUnUsWAaUqCBkj5Y1SDWQJGClPlCogS8JIeaEUB1kiRsoDpSjIkjFStVGKgawBI1UTpQjImjBStVCyg6wRI1UDJSvImjFSpVGygbSAkSqJkgWkJYxUKZTZIC1ipEqgzAJpGSOVG2UyiDBeyokyCWR3OOyFcd0Yyu4wfA83Ngnk2Pe/ziE82WdhvHSJYuNz7MPPcGOTQH5sNk+nPnyMf/xeGNcZSvyS3tv42DiFG0O94q+19Iq/BSQQWAKBJRBYAoElEFgCgSUQWKM3hsovnSGwBAJLILAEAusvLK6Na4P/Au0AAAAASUVORK5CYII=";var _t=class{constructor(n,e){A(this,"target");A(this,"name");A(this,"intersected");A(this,"wasIntersected",!1);A(this,"wasIntersectedOnMouseDown",!1);A(this,"distance");this.target=n,this.name=e,this.intersected=!1,this.distance=0}},k=class{constructor(n,e=null){A(this,"type");A(this,"cancelBubble");A(this,"originalEvent");A(this,"coords",new N(0,0));A(this,"distance",0);A(this,"intersected",!1);A(this,"wasIntersected",!1);A(this,"wasIntersectedOnMouseDown",!1);this.cancelBubble=!1,this.type=n,this.originalEvent=e}stopPropagation(){this.cancelBubble=!0}},Fi=class{constructor(n,e,t,i){A(this,"renderer");A(this,"camera");A(this,"domElement");A(this,"bindEventsOnBodyElement");A(this,"autoAdd");A(this,"scene");A(this,"mouse");A(this,"supportsPointerEvents");A(this,"interactiveObjects");A(this,"closestObject");A(this,"raycaster");A(this,"treatTouchEventsAsMouseEvents");A(this,"dispose",()=>{this.domElement.removeEventListener("click",this.onMouseClick),this.supportsPointerEvents&&(this.bindEventsOnBodyElement?this.domElement.ownerDocument.removeEventListener("pointermove",this.onDocumentPointerMove):this.domElement.removeEventListener("pointermove",this.onDocumentPointerMove),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointerup",this.onPointerUp)),this.bindEventsOnBodyElement?this.domElement.ownerDocument.removeEventListener("mousemove",this.onDocumentMouseMove):this.domElement.removeEventListener("mousemove",this.onDocumentMouseMove),this.domElement.removeEventListener("mousedown",this.onMouseDown),this.domElement.removeEventListener("mouseup",this.onMouseUp),this.domElement.removeEventListener("touchstart",this.onTouchStart),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd)});A(this,"add",(n,e=[])=>{if(n&&!this.interactiveObjects.find(t=>t.target===n))if(e.length>0)e.forEach(t=>{let i=n.getObjectByName(t);if(i){let s=new _t(i,t);this.interactiveObjects.push(s)}});else{let t=new _t(n,n.name);this.interactiveObjects.push(t)}});A(this,"remove",(n,e=[])=>{!n||(e.length>0?e.forEach(t=>{let i=n.getObjectByName(t);i&&(this.interactiveObjects=this.interactiveObjects.filter(s=>s.target!==i))}):this.interactiveObjects=this.interactiveObjects.filter(t=>t.target!==n))});A(this,"update",()=>{var i;this.raycaster.setFromCamera(this.mouse,this.camera),this.interactiveObjects.forEach(s=>{s.target&&this.checkIntersection(s)}),this.interactiveObjects.sort(function(s,o){return s.distance-o.distance});let n=(i=this.interactiveObjects.find(s=>s.intersected))!=null?i:null;if(n!=this.closestObject){if(this.closestObject){let s=new k("mouseout");this.dispatch(this.closestObject,s)}if(n){let s=new k("mouseover");this.dispatch(n,s)}this.closestObject=n}let e;this.interactiveObjects.forEach(s=>{!s.intersected&&s.wasIntersected&&(e||(e=new k("mouseleave")),this.dispatch(s,e))});let t;this.interactiveObjects.forEach(s=>{s.intersected&&!s.wasIntersected&&(t||(t=new k("mouseenter")),this.dispatch(s,t))})});A(this,"checkIntersection",n=>{let e=this.raycaster.intersectObjects([n.target],!0);if(n.wasIntersected=n.intersected,e.length>0){let t=e[0].distance;e.forEach(i=>{i.distance{this.mapPositionToPoint(this.mouse,n.clientX,n.clientY);let e=new k("mousemove",n);this.interactiveObjects.forEach(t=>{this.dispatch(t,e)})});A(this,"onDocumentPointerMove",n=>{this.mapPositionToPoint(this.mouse,n.clientX,n.clientY);let e=new k("pointermove",n);this.interactiveObjects.forEach(t=>{this.dispatch(t,e)})});A(this,"onTouchMove",n=>{n.touches.length>0&&this.mapPositionToPoint(this.mouse,n.touches[0].clientX,n.touches[0].clientY);let e=new k(this.treatTouchEventsAsMouseEvents?"mousemove":"touchmove",n);this.interactiveObjects.forEach(t=>{this.dispatch(t,e)})});A(this,"onMouseClick",n=>{this.update();let e=new k("click",n);this.interactiveObjects.forEach(t=>{t.intersected&&this.dispatch(t,e)})});A(this,"onMouseDown",n=>{this.mapPositionToPoint(this.mouse,n.clientX,n.clientY),this.update();let e=new k("mousedown",n);this.interactiveObjects.forEach(t=>{t.intersected?(t.wasIntersectedOnMouseDown=!0,this.dispatch(t,e)):t.wasIntersectedOnMouseDown=!1})});A(this,"onPointerDown",n=>{this.mapPositionToPoint(this.mouse,n.clientX,n.clientY),this.update();let e=new k("pointerdown",n);this.interactiveObjects.forEach(t=>{t.intersected&&this.dispatch(t,e)})});A(this,"onTouchStart",n=>{n.touches.length>0&&this.mapPositionToPoint(this.mouse,n.touches[0].clientX,n.touches[0].clientY),this.update();let e=new k(this.treatTouchEventsAsMouseEvents?"mousedown":"touchstart",n);this.interactiveObjects.forEach(t=>{t.intersected&&this.dispatch(t,e)})});A(this,"onMouseUp",n=>{let e=new k("mouseup",n);this.interactiveObjects.forEach(t=>{this.dispatch(t,e)})});A(this,"onPointerUp",n=>{let e=new k("pointerup",n);this.interactiveObjects.forEach(t=>{this.dispatch(t,e)})});A(this,"onTouchEnd",n=>{n.touches.length>0&&this.mapPositionToPoint(this.mouse,n.touches[0].clientX,n.touches[0].clientY),this.update();let e=new k(this.treatTouchEventsAsMouseEvents?"mouseup":"touchend",n);this.interactiveObjects.forEach(t=>{this.dispatch(t,e)})});A(this,"dispatch",(n,e)=>{n.target&&!e.cancelBubble&&(e.coords=this.mouse,e.distance=n.distance,e.intersected=n.intersected,e.wasIntersected=n.wasIntersected,e.wasIntersectedOnMouseDown=n.wasIntersectedOnMouseDown,n.target.dispatchEvent(e))});A(this,"mapPositionToPoint",(n,e,t)=>{let i=this.renderer.domElement.getBoundingClientRect();n.x=(e-i.left)/i.width*2-1,n.y=-((t-i.top)/i.height)*2+1});this.renderer=n,this.camera=e,this.domElement=t,this.bindEventsOnBodyElement=i&&typeof i.bindEventsOnBodyElement<"u"?i.bindEventsOnBodyElement:!0,this.scene=i&&typeof i.scene<"u"?i.scene:null,this.scene&&(this.scene.onBeforeRender=()=>{this.autoAdd&&this.scene!==null&&this.scene.traverse(s=>{this.add(s),s.addEventListener("removed",o=>{this.remove(o.target)})}),this.update()}),this.autoAdd=i&&typeof i.autoAdd<"u"?i.autoAdd:!1,this.autoAdd&&this.scene===null&&console.error("Attention: Options.scene needs to be set when using options.autoAdd"),this.mouse=new N(-1,1),this.supportsPointerEvents=!!window.PointerEvent,this.interactiveObjects=[],this.closestObject=null,this.raycaster=new Un,t.addEventListener("click",this.onMouseClick),this.supportsPointerEvents&&(this.bindEventsOnBodyElement?t.ownerDocument.addEventListener("pointermove",this.onDocumentPointerMove):t.addEventListener("pointermove",this.onDocumentPointerMove),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointerup",this.onPointerUp)),this.bindEventsOnBodyElement?t.ownerDocument.addEventListener("mousemove",this.onDocumentMouseMove):t.addEventListener("mousemove",this.onDocumentMouseMove),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("touchstart",this.onTouchStart,{passive:!0}),t.addEventListener("touchmove",this.onTouchMove,{passive:!0}),t.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this.treatTouchEventsAsMouseEvents=!0}};export{Ri as B,Ui as D,Gi as E,Ni as G,Ii as L,Bi as M,_i as P,ji as a,Ti as b,Kt as c,ut as g,Fi as h,Wi as l};