You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hy-screen-2.0/docs/assets/three.interactive-b0c27e96-...

458 lines
66 KiB

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-3427eaf8-1786725044461.js";import{E as ot,q as Ft}from"./TopicSwitcher-06eba150-1786725044461.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;s<n;s++)i[s]=t[0|Math.random()*e];else{var o;for(i[8]=i[13]=i[18]=i[23]="-",i[14]="4",s=0;s<36;s++)i[s]||(o=0|Math.random()*16,i[s]=t[s==19?o&3|8:o])}return i.join("")}const rt=n=>Gn(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<e.length;c++){const a=e[c],d=(t=a.geometry)==null?void 0:t.coordinates,p=Array.isArray(d)&&typeof((s=(i=d==null?void 0:d[0])==null?void 0:i[0])==null?void 0:s[0])=="number";((o=a.geometry)==null?void 0:o.type)==="Polygon"&&p&&(a.geometry.coordinates=[a.geometry.coordinates])}return n}class jn{constructor({canvas:e,sizes:t,scene:i,camera:s,config:o={},postprocessing:c=!1,composer:a=null}){this.canvas=e,this.sizes=t,this.scene=i,this.camera=s,this.config=o||{},this.postprocessing=c,this.composer=a,this.setInstance()}setInstance(){this.instance=new cn({alpha:!1,antialias:this.config.antialias!==!1,powerPreference:this.config.powerPreference||"high-performance",canvas:this.canvas}),this.instance.outputColorSpace=un,this.instance.setSize(this.sizes.width,this.sizes.height),this.instance.setPixelRatio(this.sizes.pixelRatio)}resize(){this.instance.setSize(this.sizes.width,this.sizes.height),this.instance.setPixelRatio(this.sizes.pixelRatio)}update(){this.postprocessing&&this.composer?this.composer.render():this.instance.render(this.scene,this.camera.instance)}destroy(){this.instance.dispose(),this.instance.forceContextLoss()}}class Nn{constructor({sizes:e,scene:t,canvas:i},s={isOrthographic:!1}){this.sizes=e,this.scene=t,this.canvas=i,this.options=Object.assign({isOrthographic:!1},s),this.setInstance()}setInstance(){this.instance=null,this.setCamera(this.options.isOrthographic),this.instance.position.set(10,10,10),this.scene.add(this.instance)}setCamera(e=!0){let t=this.sizes.width/this.sizes.height;if(e){let i=120;this.instance=new hn(-i*t,i*t,i,-i,1,1e4)}else this.instance=new dn(45,t,1,1e4);this.setControls()}setControls(){this.controls=new fn(this.instance,this.canvas),this.controls.enableDamping=!0,this.controls.dampingFactor=.08,this.controls.enablePan=!0,this.controls.enableRotate=!0,this.controls.enableZoom=!0,this.controls.screenSpacePanning=!0,this.controls.minDistance=7,this.controls.maxDistance=72,this.controls.minPolarAngle=Math.PI*.08,this.controls.maxPolarAngle=Math.PI*.49,this.controls.mouseButtons.LEFT=We.PAN,this.controls.mouseButtons.MIDDLE=We.DOLLY,this.controls.mouseButtons.RIGHT=We.ROTATE,this.setCanvasInteractionStyle(),this.controls.update()}setCanvasInteractionStyle(){var e;(e=this.canvas)!=null&&e.style&&(this.handlePointerDown=()=>{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;s<this._n&&s<32;s++){const o=t[s],c=e+o,a=Math.abs(e)<Math.abs(o)?e-(c-o):o-(c-e);a&&(t[i++]=a),e=c}return t[i]=e,this._n=i+1,this}valueOf(){const e=this._partials;let t=this._n,i,s,o,c=0;if(t>0){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;++i<s;)De(t[i].geometry,e)}},vt={Sphere:function(n,e){e.sphere()},Point:function(n,e){n=n.coordinates,e.point(n[0],n[1],n[2])},MultiPoint:function(n,e){for(var t=n.coordinates,i=-1,s=t.length;++i<s;)n=t[i],e.point(n[0],n[1],n[2])},LineString:function(n,e){Xe(n.coordinates,e,0)},MultiLineString:function(n,e){for(var t=n.coordinates,i=-1,s=t.length;++i<s;)Xe(t[i],e,0)},Polygon:function(n,e){gt(n.coordinates,e)},MultiPolygon:function(n,e){for(var t=n.coordinates,i=-1,s=t.length;++i<s;)gt(t[i],e)},GeometryCollection:function(n,e){for(var t=n.geometries,i=-1,s=t.length;++i<s;)De(t[i],e)}};function Xe(n,e,t){var i=-1,s=n.length-t,o;for(e.lineStart();++i<s;)o=n[i],e.point(o[0],o[1],o[2]);e.lineEnd()}function gt(n,e){var t=-1,i=n.length;for(e.polygonStart();++t<i;)Xe(n[t],e,1);e.polygonEnd()}function qn(n,e){n&&mt.hasOwnProperty(n.type)?mt[n.type](n,e):De(n,e)}function qe(n){return[ve(n[1],n[0]),ge(n[2])]}function ce(n){var e=n[0],t=n[1],i=_(t);return[i*_(e),i*R(e),R(t)]}function Se(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function Be(n,e){return[n[1]*e[2]-n[2]*e[1],n[2]*e[0]-n[0]*e[2],n[0]*e[1]-n[1]*e[0]]}function Fe(n,e){n[0]+=e[0],n[1]+=e[1],n[2]+=e[2]}function Ee(n,e){return[n[0]*e,n[1]*e,n[2]*e]}function Qe(n){var e=_e(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=e,n[1]/=e,n[2]/=e}function Ke(n,e){function t(i,s){return i=n(i,s),e(i[0],i[1])}return n.invert&&e.invert&&(t.invert=function(i,s){return i=e.invert(i,s),i&&n.invert(i[0],i[1])}),t}function Ze(n,e){return T(n)>b&&(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?s<o:s>o)&&(s+=i*K));for(var p,r=s;i>0?r>o:r<o;r-=d)p=qe([c,-a*_(r),-a*R(r)]),n.point(p[0],p[1])}}function Et(n,e){e=ce(e),e[0]-=n,Qe(e);var t=Xn(-e[1]);return((-e[2]<0?-t:t)+K-B)%K}function Jt(){var n=[],e;return{point:function(t,i,s){e.push([t,i,s])},lineStart:function(){n.push(e=[])},lineEnd:de,rejoin:function(){n.length>1&&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])<B&&T(n[1]-e[1])<B}function xe(n,e,t,i){this.x=n,this.z=e,this.o=t,this.e=i,this.v=!1,this.n=this.p=null}function kt(n,e,t,i,s){var o=[],c=[],a,d;if(n.forEach(function(m){if(!((g=m.length-1)<=0)){var g,h=m[0],E=m[g],S;if(ze(h,E)){if(!h[2]&&!E[2]){for(s.lineStart(),a=0;a<g;++a)s.point((h=m[a])[0],h[1]);s.lineEnd();return}E[0]+=2*B}o.push(S=new xe(h,m,null,!0)),c.push(S.o=new xe(h,null,S,!1)),o.push(S=new xe(E,m,null,!1)),c.push(S.o=new xe(E,null,S,!0))}}),!!o.length){for(c.sort(e),xt(o),xt(c),a=0,d=c.length;a<d;++a)c[a].e=t=!t;for(var p=o[0],r,l;;){for(var u=p,f=!0;u.v;)if((u=u.n)===p)return;r=u.z,s.lineStart();do{if(u.v=u.o.v=!0,u.e){if(f)for(a=0,d=r.length;a<d;++a)s.point((l=r[a])[0],l[1]);else i(u.x,u.n.x,1,s);u=u.n}else{if(f)for(r=u.p.z,a=r.length-1;a>=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<e;)i.n=s=n[t],s.p=i,i=s;i.n=s=n[0],s.p=i}}function He(n){return T(n[0])<=b?n[0]:Jn(n[0])*((T(n[0])+b)%K-b)}function Zn(n,e){var t=He(e),i=e[1],s=R(i),o=[R(t),-_(t),0],c=0,a=0,d=new Wn;s===1?i=X+B:s===-1&&(i=-X-B);for(var p=0,r=n.length;p<r;++p)if(u=(l=n[p]).length)for(var l,u,f=l[u-1],m=He(f),g=f[1]/2+pt,h=R(g),E=_(g),S=0;S<u;++S,m=w,h=P,E=L,f=y){var y=l[S],w=He(y),x=y[1]/2+pt,P=R(x),L=_(x),O=w-m,z=O>=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||c<B&&d<-Hn)^a&1}function Xt(n,e,t,i){return function(s){var o=e(s),c=Jt(),a=e(c),d=!1,p,r,l,u={point:f,lineStart:g,lineEnd:h,polygonStart:function(){u.point=E,u.lineStart=S,u.lineEnd=y,r=[],p=[]},polygonEnd:function(){u.point=f,u.lineStart=g,u.lineEnd=h,r=Ht(r);var w=Zn(p,i);r.length?(d||(s.polygonStart(),d=!0),kt(r,ei,w,t,s)):w&&(d||(s.polygonStart(),d=!0),s.lineStart(),t(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),r=p=null},sphere:function(){s.polygonStart(),s.lineStart(),t(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function f(w,x){n(w,x)&&s.point(w,x)}function m(w,x){o.point(w,x)}function g(){u.point=m,o.lineStart()}function h(){u.point=f,o.lineEnd()}function E(w,x){l.push([w,x]),a.point(w,x)}function S(){a.lineStart(),l=[]}function y(){E(l[0][0],l[0][1]),a.lineEnd();var w=a.clean(),x=c.result(),P,L=x.length,O,z,U;if(l.pop(),p.push(l),l=null,!!L){if(w&1){if(z=x[0],(O=z.length-1)>0){for(d||(s.polygonStart(),d=!0),s.lineStart(),P=0;P<O;++P)s.point((U=z[P])[0],U[1]);s.lineEnd()}return}L>1&&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)<B?(n.point(e,t=(t+c)/2>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&&(e-=i*B),T(o-a)<B&&(o-=a*B),t=ni(e,t,o,c),n.point(i,t),n.lineEnd(),n.lineStart(),n.point(a,t),s=0),n.point(e=o,t=c),i=a},lineEnd:function(){n.lineEnd(),e=t=NaN},clean:function(){return 2-s}}}function ni(n,e,t,i){var s,o,c=R(n-t);return T(c)>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]<e[0]?b:-b;s=t*o/2,i.point(-o,s),i.point(0,s),i.point(o,s)}else i.point(e[0],e[1])}function si(n){var e=_(n),t=2*G,i=e>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;C<v&&(Q=v,v=C,C=Q);var he=C-v,ne=T(he-b)<B,oe=ne||he<B;if(!ne&&J<j&&(Q=j,j=J,J=Q),oe?ne?j+J>0^D[1]<(T(D[0]-v)<B?j:J):j<=D[1]&&D[1]<=J:he>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(m<r)return;m<l&&(l=m)}else if(u>0){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(m<r)return;m<l&&(l=m)}if(m=i-a,!(!f&&m>0)){if(m/=f,f<0){if(m<r)return;m<l&&(l=m)}else if(f>0){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(m<r)return;m<l&&(l=m)}return r>0&&(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)<B?r>0?0:3:T(p[0]-t)<B?r>0?2:1:T(p[1]-e)<B?r>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;C<j;++C)for(var J=f[C],Q=1,he=J.length,ne=J[0],oe,ie,ye=ne[0],ae=ne[1];Q<he;++Q)oe=ye,ie=ae,ne=J[Q],ye=ne[0],ae=ne[1],ie<=i?ae>i&&(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){n<ue&&(ue=n),n>we&&(we=n),e<Ue&&(Ue=e),e>Te&&(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)<B||T(o-l)<B?(o+l)/2:ve(x,w),U=n(z,O),M=U[0],V=U[1],I=M-i,D=V-s,v=S*I-E*D;(v*v/y>e||T((E*I+S*D)/y-.5)>.3||c*u+a*f+d*m<di)&&(t(i,s,o,c,a,d,M,V,z,w/=L,x/=L,P,g,h),h.point(M,V),t(M,V,z,w,x,P,p,r,l,u,f,m,g,h))}}return function(i){var s,o,c,a,d,p,r,l,u,f,m,g,h={point:E,lineStart:S,lineEnd:w,polygonStart:function(){i.polygonStart(),h.lineStart=x},polygonEnd:function(){i.polygonEnd(),h.lineStart=S}};function E(O,z){O=n(O,z),i.point(O[0],O[1])}function S(){l=NaN,h.point=y,i.lineStart()}function y(O,z){var U=ce([O,z]),M=n(O,z);t(l,u,r,f,m,g,l=M[0],u=M[1],r=O,f=U[0],m=U[1],g=U[2],Ct,i),i.point(l,u)}function w(){h.point=E,i.lineEnd()}function x(){S(),h.point=P,h.lineEnd=L}function P(O,z){y(s=O,z),o=l,c=u,a=f,d=m,p=g,h.point=y}function L(){t(l,u,r,f,m,g,o,c,s,a,d,p,Ct,i),h.lineEnd=w,w()}return h}}var mi=at({point:function(n,e){this.stream.point(n*G,e*G)}});function vi(n){return at({point:function(e,t){var i=n(e,t);return this.stream.point(i[0],i[1])}})}function gi(n,e,t,i,s){function o(c,a){return c*=i,a*=s,[e+n*c,t-n*a]}return o.invert=function(c,a){return[(c-e)/n*i,(t-a)/n*s]},o}function Lt(n,e,t,i,s,o){if(!o)return gi(n,e,t,i,s);var c=_(o),a=R(o),d=c*n,p=a*n,r=c/n,l=a/n,u=(a*t-c*e)/n,f=(a*e+c*t)/n;function m(g,h){return g*=i,h*=s,[d*g-p*h+e,t-p*g-d*h]}return m.invert=function(g,h){return[i*(r*g-l*h+u),s*(f-l*g-r*h)]},m}function wi(n){return yi(function(){return n})()}function yi(n){var e,t=150,i=480,s=250,o=0,c=0,a=0,d=0,p=0,r,l=0,u=1,f=1,m=null,g=At,h=null,E,S,y,w=Mt,x=.5,P,L,O,z,U;function M(v){return O(v[0]*G,v[1]*G)}function V(v){return v=O.invert(v[0],v[1]),v&&[v[0]*q,v[1]*q]}M.stream=function(v){return z&&U===v?z:z=mi(vi(r)(g(P(w(U=v)))))},M.preclip=function(v){return arguments.length?(g=v,m=void 0,D()):g},M.postclip=function(v){return arguments.length?(w=v,h=E=S=y=null,D()):w},M.clipAngle=function(v){return arguments.length?(g=+v?si(m=v*G):(m=null,At),D()):m*q},M.clipExtent=function(v){return arguments.length?(w=v==null?(h=E=S=y=null,Mt):ri(h=+v[0][0],E=+v[0][1],S=+v[1][0],y=+v[1][1]),D()):h==null?null:[[h,E],[S,y]]},M.scale=function(v){return arguments.length?(t=+v,I()):t},M.translate=function(v){return arguments.length?(i=+v[0],s=+v[1],I()):[i,s]},M.center=function(v){return arguments.length?(o=v[0]%360*G,c=v[1]%360*G,I()):[o*q,c*q]},M.rotate=function(v){return arguments.length?(a=v[0]%360*G,d=v[1]%360*G,p=v.length>2?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 <opaque_fragment>",`
#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<t+1;l++)for(let u=0;u<t+1;u++){let f=this.createPlus(i);f.translate(-c+l*o,-c+u*o,0),d.push(f)}let p=Ft(d),r=new se(p,a);return r.renderOrder=-1,r.rotateX(-Math.PI/2),r.position.y+=.01,r}createGridHelp(){let{gridSize:e,gridDivision:t,gridColor:i}=this.options;return new wn(e,t,i,i)}createPoint(){let{gridSize:e,pointSize:t,pointColor:i,pointBlending:s,pointLayout:o}=this.options;const c=o.row,a=o.col,d=new Float32Array(c*a*3);for(let u=0;u<c;u++)for(let f=0;f<a;f++){let m=u/(c-1)*e-e/2,g=0,h=f/(a-1)*e-e/2,E=(u*a+f)*3;d[E]=m,d[E+1]=g,d[E+2]=h}var p=new et;p.setAttribute("position",new be(d,3));let r=new Rt({size:t,sizeAttenuation:!0,color:i,blending:s});return new Gt(p,r)}setPointMode(){}createPlus(e=50){let t=e/6/3,i=e/3,s=[new N(-i,-t),new N(-t,-t),new N(-t,-i),new N(t,-i),new N(t,-i),new N(t,-t),new N(i,-t),new N(i,t),new N(t,t),new N(t,i),new N(-t,i),new N(-t,t),new N(-i,t)],o=new tt(s);return new jt(o,24)}}const Ot=new W,Ei=new yn,zt=new W;class Qt extends nt{constructor(e=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}class xi extends Qt{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Z=new it,Ai=new it;class Mi{constructor(e={}){const t=this;let i,s,o,c;const a={camera:{style:""},objects:new WeakMap},d=e.element!==void 0?e.element:document.createElement("div");d.style.overflow="hidden",this.domElement=d;const p=document.createElement("div");p.style.transformOrigin="0 0",p.style.pointerEvents="none",d.appendChild(p);const r=document.createElement("div");r.style.transformStyle="preserve-3d",p.appendChild(r),this.getSize=function(){return{width:i,height:s}},this.render=function(g,h){const E=h.projectionMatrix.elements[5]*c;h.view&&h.view.enabled?(p.style.transform=`translate( ${-h.view.offsetX*(i/h.view.width)}px, ${-h.view.offsetY*(s/h.view.height)}px )`,p.style.transform+=`scale( ${h.view.fullWidth/h.view.width}, ${h.view.fullHeight/h.view.height} )`):p.style.transform="",g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),h.parent===null&&h.matrixWorldAutoUpdate===!0&&h.updateMatrixWorld();let S,y;h.isOrthographicCamera&&(S=-(h.right+h.left)/2,y=(h.top+h.bottom)/2);const w=h.view&&h.view.enabled?h.view.height/h.view.fullHeight:1,x=h.isOrthographicCamera?`scale( ${w} )scale(`+E+")translate("+l(S)+"px,"+l(y)+"px)"+u(h.matrixWorldInverse):`scale( ${w} )translateZ(`+E+"px)"+u(h.matrixWorldInverse),L=(h.isPerspectiveCamera?"perspective("+E+"px) ":"")+x+"translate("+o+"px,"+c+"px)";a.camera.style!==L&&(r.style.transform=L,a.camera.style=L),m(g,g,h)},this.setSize=function(g,h){i=g,s=h,o=i/2,c=s/2,d.style.width=g+"px",d.style.height=h+"px",p.style.width=g+"px",p.style.height=h+"px",r.style.width=g+"px",r.style.height=h+"px"};function l(g){return Math.abs(g)<1e-10?0:g}function u(g){const h=g.elements;return"matrix3d("+l(h[0])+","+l(-h[1])+","+l(h[2])+","+l(h[3])+","+l(h[4])+","+l(-h[5])+","+l(h[6])+","+l(h[7])+","+l(h[8])+","+l(-h[9])+","+l(h[10])+","+l(h[11])+","+l(h[12])+","+l(-h[13])+","+l(h[14])+","+l(h[15])+")"}function f(g){const h=g.elements;return"translate(-50%,-50%)"+("matrix3d("+l(h[0])+","+l(h[1])+","+l(h[2])+","+l(h[3])+","+l(-h[4])+","+l(-h[5])+","+l(-h[6])+","+l(-h[7])+","+l(h[8])+","+l(h[9])+","+l(h[10])+","+l(h[11])+","+l(h[12])+","+l(h[13])+","+l(h[14])+","+l(h[15])+")")}function m(g,h,E,S){if(g.isCSS3DObject){const y=g.visible===!0&&g.layers.test(E.layers)===!0;if(g.element.style.display=y===!0?"":"none",y===!0){g.onBeforeRender(t,h,E);let w;g.isCSS3DSprite?(Z.copy(E.matrixWorldInverse),Z.transpose(),g.rotation2D!==0&&Z.multiply(Ai.makeRotationZ(g.rotation2D)),g.matrixWorld.decompose(Ot,Ei,zt),Z.setPosition(Ot),Z.scale(zt),Z.elements[3]=0,Z.elements[7]=0,Z.elements[11]=0,Z.elements[15]=1,w=f(Z)):w=f(g.matrixWorld);const x=g.element,P=a.objects.get(g);if(P===void 0||P.style!==w){x.style.transform=w;const L={style:w};a.objects.set(g,L)}x.parentNode!==r&&r.appendChild(x),g.onAfterRender(t,h,E)}}for(let y=0,w=g.children.length;y<w;y++)m(g.children[y],h,E)}}}class Ii{constructor({scene:e,camera:t,time:i,sizes:s,canvas:o}){this.scene=e,this.camera=t,this.time=i,this.sizes=s,this.canvas=o,this.parent=null;let{width:c,height:a}=this.sizes,d=new Mi;this.css3dRender=d,d.setSize(c,a),d.domElement.style.position="absolute",d.domElement.style.left="0px",d.domElement.style.top="0px",d.domElement.style.pointerEvents="none",d.domElement.className="label3d-"+Rn(),this.canvas.parentNode.appendChild(d.domElement),this.time.on("tick",()=>{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;l<o;l++){a.push(Math.random()*e-e/2,Math.random()*e-e/2,Math.random()*e-e/2);let u=i==="up"?1:-1;p.push(Math.random()*u,(.1+Math.random())*u,.1+Math.random()*u);const f=s.color.clone();let m={};f.getHSL(m),f.setHSL(m.h,m.s,m.l*Math.random()),d.push(f.r,f.g,f.b)}const r=new et;r.setAttribute("position",new be(new Float32Array(a),3)),r.setAttribute("velocities",new be(new Float32Array(p),3)),r.setAttribute("color",new be(new Float32Array(d),3)),this.instance=new Gt(r,s),this.instance.renderOrder=c}static createTexture(){let e=document.createElement("canvas");e.width=1024,e.height=1024;let t=e.getContext("2d"),i=t.createRadialGradient(512,512,0,512,512,512);return i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=i,t.fillRect(0,0,1024,1024),new xn(e)}update(e,t){if(!this.instance)return!1;const{range:i,speed:s,dir:o}=this.config;let c=o==="up"?1:-1,a=this.instance.geometry.getAttribute("position"),d=this.instance.geometry.getAttribute("velocities");const p=a.count;for(let r=0;r<p;r++){let l=a.getX(r);a.getY(r);let u=a.getZ(r),f=d.getX(r),m=d.getY(r);d.getZ(r),l+=Math.sin(f*t)*e,u+=s*c,u>i/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<r.length;f++){if(!r[f][0]||!r[f][1])return!1;const[m,g]=this.geoProjection(r[f]);f===0&&l.moveTo(m,-g),l.lineTo(m,-g)}const u=new jt(l);if(t)i.push(u);else{const f=new se(u,this.config.material);f.renderOrder=this.config.renderOrder,f.userData.name=c,o.add(f)}})}),t||this.mapGroup.add(o)}),t){let s=Ft(i);const o=new se(s,this.config.material);o.renderOrder=this.config.renderOrder,this.mapGroup.add(o)}}getCoordinates(){return this.coordinates}setParent(e){e.add(this.mapGroup)}}class Gi{constructor({assets:e,time:t},i={}){this.mapGroup=new pe,this.assets=e,this.time=t,this.coordinates=[],this.config=Object.assign({position:new W(0,0,0),geoProjectionCenter:new N(0,0),geoProjectionScale:120,data:"",renderOrder:1,topFaceMaterial:new me({color:1582651,transparent:!0,opacity:1}),sideMaterial:new me({color:464171,transparent:!0,opacity:1}),depth:.1},i),this.mapGroup.position.copy(this.config.position);let s=rt(this.config.data);this.create(s)}geoProjection(e){return ut().center(this.config.geoProjectionCenter).scale(this.config.geoProjectionScale).translate([0,0])(e)}create(e){e.features.forEach(t=>{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<f.length;S++){if(!f[S][0]||!f[S][1])return!1;const[y,w]=this.geoProjection(f[S]);S===0&&g.moveTo(y,-w),g.lineTo(y,-w)}const h=new An(g,a),E=new se(h,d);i.add(E)})}),this.mapGroup.add(i)})}getCoordinates(){return this.coordinates}setParent(e){e.add(this.mapGroup)}}const Dt=new st,Me=new W;class Zt extends Mn{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new ft(e,3)),this.setAttribute("uv",new ft(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new ke(t,6,1);return this.setAttribute("instanceStart",new le(i,3,0)),this.setAttribute("instanceEnd",new le(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new ke(t,6,1);return this.setAttribute("instanceColorStart",new le(i,3,0)),this.setAttribute("instanceColorEnd",new le(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Pn(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new st);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Dt.setFromBufferAttribute(t),this.boundingBox.union(Dt))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Nt),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let o=0,c=e.count;o<c;o++)Me.fromBufferAttribute(e,o),s=Math.max(s,i.distanceToSquared(Me)),Me.fromBufferAttribute(t,o),s=Math.max(s,i.distanceToSquared(Me));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}Le.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new N(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Oe.line={uniforms:Wt.merge([Le.common,Le.fog,Le.line]),vertexShader:`
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
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 <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}
`,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 <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
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 <clipping_planes_fragment>
#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 <logdepthbuf_fragment>
#include <color_fragment>
gl_FragColor = vec4( diffuseColor.rgb, alpha );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}
`};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;a<d;a++){Y.start.fromBufferAttribute(s,a),Y.end.fromBufferAttribute(o,a),Y.applyMatrix4(t);const p=new W,r=new W;te.distanceSqToSegment(Y.start,Y.end,r,p),r.distanceTo(p)<re*.5&&e.push({point:r,pointOnLine:p,distance:te.origin.distanceTo(r),object:n,face:null,faceIndex:a,uv:null,uv1:null})}}function Ci(n,e,t){const i=e.projectionMatrix,o=n.material.resolution,c=n.matrixWorld,a=n.geometry,d=a.attributes.instanceStart,p=a.attributes.instanceEnd,r=Math.min(a.instanceCount,d.count),l=-e.near;te.at(1,$),$.w=1,$.applyMatrix4(e.matrixWorldInverse),$.applyMatrix4(i),$.multiplyScalar(1/$.w),$.x*=o.x/2,$.y*=o.y/2,$.z=0,Ye.copy($),Ve.multiplyMatrices(e.matrixWorldInverse,c);for(let u=0,f=r;u<f;u++){if(F.fromBufferAttribute(d,u),H.fromBufferAttribute(p,u),F.w=1,H.w=1,F.applyMatrix4(Ve),H.applyMatrix4(Ve),F.z>l&&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)<re*.5;if(E&&S){Y.start.fromBufferAttribute(d,u),Y.end.fromBufferAttribute(p,u),Y.start.applyMatrix4(c),Y.end.applyMatrix4(c);const y=new W,w=new W;te.distanceSqToSegment(Y.start,Y.end,w,y),t.push({point:w,pointOnLine:y,distance:te.origin.distanceTo(w),object:n,face:null,faceIndex:u,uv:null,uv1:null})}}}class bi extends se{constructor(e=new Zt,t=new $t({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let c=0,a=0,d=t.count;c<d;c++,a+=2)Bt.fromBufferAttribute(t,c),Ut.fromBufferAttribute(i,c),s[a]=a===0?0:s[a-1],s[a+1]=s[a]+Bt.distanceTo(Ut);const o=new ke(s,2,1);return e.setAttribute("instanceDistanceStart",new le(o,1,0)),e.setAttribute("instanceDistanceEnd",new le(o,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;te=e.ray;const c=this.matrixWorld,a=this.geometry,d=this.material;re=d.linewidth+o,a.boundingSphere===null&&a.computeBoundingSphere(),Ce.copy(a.boundingSphere).applyMatrix4(c);let p;if(i)p=re*.5;else{const l=Math.max(s.near,Ce.distanceToPoint(te.origin));p=It(s,l,d.resolution)}if(Ce.radius+=p,te.intersectsSphere(Ce)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),Pe.copy(a.boundingBox).applyMatrix4(c);let r;if(i)r=re*.5;else{const l=Math.max(s.near,Pe.distanceToPoint(te.origin));r=It(s,l,d.resolution)}Pe.expandByScalar(r),te.intersectsBox(Pe)!==!1&&(i?Pi(this,t):Ci(this,s,t))}}class en extends Zt{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let s=0;s<t;s+=3)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];return super.setPositions(i),this}setColors(e){const t=e.length-3,i=new Float32Array(2*t);for(let s=0;s<t;s+=3)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];return super.setColors(i),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Li extends bi{constructor(e=new en,t=new $t({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}class ji{constructor({},e={}){this.config=Object.assign({visibelProvince:"",geoProjectionCenter:[0,0],geoProjectionScale:120,position:new W(0,0,0),data:"",material:new On({color:16777215}),type:"LineLoop",renderOrder:1,tubeRadius:.2},e);let t=rt(this.config.data),i=this.create(t);this.lineGroup=i,this.lineGroup.position.copy(this.config.position)}geoProjection(e){return ut().center(this.config.geoProjectionCenter).scale(this.config.geoProjectionScale).translate([0,0])(e)}create(e){const{type:t,visibelProvince:i}=this.config;let s=e.features,o=new pe;for(let c=0;c<s.length;c++){const a=s[c];let d=new pe;d.name="meshLineGroup"+c,a.properties.name!==i&&(a.geometry.coordinates.forEach(p=>{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 <opaque_fragment>",`
#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<t&&(t=i.distance)}),n.intersected=!0,n.distance=t}else n.intersected=!1});A(this,"onDocumentMouseMove",n=>{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};