var fn=Object.defineProperty,dn=Object.defineProperties;var pn=Object.getOwnPropertyDescriptors;var Me=Object.getOwnPropertySymbols;var pt=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable;var Fe=(t,e)=>{if(e=Symbol[t])return e;throw Error("Symbol."+t+" is not defined")};var We=(t,e,n)=>e in t?fn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Q=(t,e)=>{for(var n in e||(e={}))pt.call(e,n)&&We(t,n,e[n]);if(Me)for(var n of Me(e))mt.call(e,n)&&We(t,n,e[n]);return t},Z=(t,e)=>dn(t,pn(e));var vt=(t,e)=>{var n={};for(var i in t)pt.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&Me)for(var i of Me(t))e.indexOf(i)<0&&mt.call(t,i)&&(n[i]=t[i]);return n};var M=(t,e,n)=>(We(t,typeof e!="symbol"?e+"":e,n),n);var mn=function(t,e){this[0]=t,this[1]=e};var gt=t=>{var e=t[Fe("asyncIterator")],n=!1,i,s={};return e==null?(e=t[Fe("iterator")](),i=o=>s[o]=r=>e[o](r)):(e=e.call(t),i=o=>s[o]=r=>{if(n){if(n=!1,o==="throw")throw r;return r}return n=!0,{done:!1,value:new mn(new Promise(a=>{var h=e[o](r);if(!(h instanceof Object))throw TypeError("Object expected");a(h)}),1)}}),s[Fe("iterator")]=()=>s,i("next"),"throw"in e?i("throw"):s.throw=o=>{throw o},"return"in e&&i("return"),s};import{X as vn,Y as gn,S as wn,Z as yn,_ as Sn,$ as En,a0 as ke,a1 as xn,a2 as Mn,b as re,C as Ke,V as F,a3 as An,G as ve,a as ge,D as Cn,a4 as bn,z as it,w as De,m as kt,a5 as Ht,a6 as N,J as st,y as Yt,O as ot,a7 as rt,a8 as Pn,P as Ln,A as On,t as zn,a9 as Dn,aa as at,ab as Tn,I as wt,ac as qe,ad as ue,ae as Rn,af as Vt,ag as Te,ah as Re,ai as Jt,aj as Bn,ak as Ge,al as _n,am as Un,L as In,x as jn,T as Gn,E as Nn,an as Fn}from"./screen2Standard-f85af2d3-1784378651390.js";import{E as lt,q as Xt}from"./TopicSwitcher-c2a18053-1784378651390.js";import{t as Wn,Y as kn,a as Hn,b as Kt,c as Yn}from"./livestockData-36ec0ae2-1784378651390.js";function Vn(t){let e=null,n=!1,i=!1;function s(){!n||i||(t(),e=requestAnimationFrame(s))}function o(){n||(n=!0,s())}function r(){n&&(n=!1,i=!0,cancelAnimationFrame(e))}function a(){!n&&i&&(n=!0,i=!1,s())}return{start:o,pause:r,resume:a,isActive:()=>n}}class Jn extends lt{constructor({canvas:e,config:n={}}){super(),this.canvas=e,this.config=n||{},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 n=Number(this.config.maxPixelRatio)||this.maxPixelRatio||2;this.maxPixelRatio=n,this.pixelRatio=Math.min(window.devicePixelRatio||1,n)}destroy(){window.removeEventListener("resize",this.handleResize),this.off("resize")}}class Xn extends lt{constructor(){super(),this.start=Date.now(),this.current=this.start,this.elapsed=0,this.delta=16,this.clock=new vn,this.raf=Vn(()=>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 n=this.clock.getDelta(),i=this.clock.getElapsedTime();this.emit("tick",n,i)}destroy(){this.pause(),this.off("tick")}pause(){this.raf.pause()}resume(){this.raf.resume()}isActive(){this.raf.isActive()}}function Kn(t=10,e=62){var n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[],s;if(e=e||n.length,t)for(s=0;sqn(typeof t=="string"?JSON.parse(t):t);function qn(t){var n,i,s,o;let e=(t==null?void 0:t.features)||[];for(let r=0;r{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 n=120;this.instance.left=-n*e,this.instance.right=n*e,this.instance.top=n,this.instance.bottom=-n}else this.instance.aspect=e;this.instance.updateProjectionMatrix()}update(){this.controls.update()}destroy(){var e,n,i,s;(n=(e=this.canvas)==null?void 0:e.removeEventListener)==null||n.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 $n{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const n=this._partials;let i=0;for(let s=0;s0){for(r=e[--n];n>0&&(i=r,s=e[--n],r=i+s,o=s-(r-i),!o););n>0&&(o<0&&e[n-1]<0||o>0&&e[n-1]>0)&&(s=o*2,i=r+s,s==i-r&&(r=i))}return r}}function*ei(t){for(const e of t)yield*gt(e)}function qt(t){return Array.from(ei(t))}var T=1e-6,ti=1e-12,P=Math.PI,X=P/2,yt=P/4,$=P*2,K=180/P,j=P/180,B=Math.abs,Qt=Math.atan,we=Math.atan2,U=Math.cos,ni=Math.exp,ii=Math.log,I=Math.sin,si=Math.sign||function(t){return t>0?1:t<0?-1:0},Ne=Math.sqrt,oi=Math.tan;function ri(t){return t>1?0:t<-1?P:Math.acos(t)}function ye(t){return t>1?X:t<-1?-X:Math.asin(t)}function pe(){}function _e(t,e){t&&Et.hasOwnProperty(t.type)&&Et[t.type](t,e)}var St={Feature:function(t,e){_e(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,s=n.length;++iP&&(t-=Math.round(t/$)*$),[t,e]}tt.invert=tt;function Zt(t,e,n){return(t%=$)?e||n?et(At(t),Ct(e,n)):At(t):e||n?Ct(e,n):tt}function Mt(t){return function(e,n){return e+=t,B(e)>P&&(e-=Math.round(e/$)*$),[e,n]}}function At(t){var e=Mt(t);return e.invert=Mt(-t),e}function Ct(t,e){var n=U(t),i=I(t),s=U(e),o=I(e);function r(a,h){var d=U(h),l=U(a)*d,c=I(a)*d,u=I(h),p=u*n+l*i;return[we(c*s-p*o,l*n-u*i),ye(p*s+c*o)]}return r.invert=function(a,h){var d=U(h),l=U(a)*d,c=I(a)*d,u=I(h),p=u*s-c*o;return[we(c*s+u*o,l*n+p*i),ye(p*n-l*i)]},r}function li(t){t=Zt(t[0]*j,t[1]*j,t.length>2?t[2]*j:0);function e(n){return n=t(n[0]*j,n[1]*j),n[0]*=K,n[1]*=K,n}return e.invert=function(n){return n=t.invert(n[0]*j,n[1]*j),n[0]*=K,n[1]*=K,n},e}function ci(t,e,n,i,s,o){if(n){var r=U(e),a=I(e),h=i*n;s==null?(s=e+i*$,o=e-h/2):(s=bt(r,s),o=bt(r,o),(i>0?so)&&(s+=i*$));for(var d,l=s;i>0?l>o:l1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Be(t,e){return B(t[0]-e[0])=0;--a)s.point((c=l[a])[0],c[1]);else i(u.x,u.p.x,-1,s);u=u.p}u=u.o,l=u.z,p=!p}while(!u.v);s.lineEnd()}}}function Pt(t){if(e=t.length){for(var e,n=0,i=t[0],s;++n=0?1:-1,R=z*O,A=R>P,Y=f*C;if(h.add(we(Y*z*I(R),E*L+Y*U(R))),r+=A?O+z*$:O,A^m>=n^w>=n){var _=Ue(he(p),he(y));$e(_);var D=Ue(o,_);$e(D);var v=(A^O>=0?-1:1)*ye(D[2]);(i>v||i===v&&(_[0]||_[1]))&&(a+=A^O>=0?1:-1)}}return(r<-T||r0){for(h||(s.polygonStart(),h=!0),s.lineStart(),C=0;C1&&w&2&&x.push(x.pop().concat(x.shift())),l.push(x.filter(hi))}}return u}}function hi(t){return t.length>1}function fi(t,e){return((t=t.x)[0]<0?t[1]-X-T:X-t[1])-((e=e.x)[0]<0?e[1]-X-T:X-e[1])}const Lt=tn(function(){return!0},di,mi,[-P,-X]);function di(t){var e=NaN,n=NaN,i=NaN,s;return{lineStart:function(){t.lineStart(),s=1},point:function(o,r){var a=o>0?P:-P,h=B(o-e);B(h-P)0?X:-X),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),s=0):i!==a&&h>=P&&(B(e-i)T?Qt((I(e)*(o=U(i))*I(n)-I(i)*(s=U(e))*I(t))/(s*o*r)):(e+i)/2}function mi(t,e,n,i){var s;if(t==null)s=n*X,i.point(-P,s),i.point(0,s),i.point(P,s),i.point(P,0),i.point(P,-s),i.point(0,-s),i.point(-P,-s),i.point(-P,0),i.point(-P,s);else if(B(t[0]-e[0])>T){var o=t[0]0,s=B(e)>T;function o(l,c,u,p){ci(p,t,n,u,l,c)}function r(l,c){return U(l)*U(c)>e}function a(l){var c,u,p,m,g;return{lineStart:function(){m=p=!1,g=1},point:function(f,E){var S=[f,E],y,w=r(f,E),x=i?w?0:d(f,E):w?d(f+(f<0?P:-P),E):0;if(!c&&(m=p=w)&&l.lineStart(),w!==p&&(y=h(c,S),(!y||Be(c,y)||Be(S,y))&&(S[2]=1)),w!==p)g=0,w?(l.lineStart(),y=h(S,c),l.point(y[0],y[1])):(y=h(c,S),l.point(y[0],y[1],2),l.lineEnd()),c=y;else if(s&&c&&i^w){var C;!(x&u)&&(C=h(S,c,!0))&&(g=0,i?(l.lineStart(),l.point(C[0][0],C[0][1]),l.point(C[1][0],C[1][1]),l.lineEnd()):(l.point(C[1][0],C[1][1]),l.lineEnd(),l.lineStart(),l.point(C[0][0],C[0][1],3)))}w&&(!c||!Be(c,S))&&l.point(S[0],S[1]),c=S,p=w,u=x},lineEnd:function(){p&&l.lineEnd(),c=null},clean:function(){return g|(m&&p)<<1}}}function h(l,c,u){var p=he(l),m=he(c),g=[1,0,0],f=Ue(p,m),E=Ae(f,f),S=f[0],y=E-S*S;if(!y)return!u&&l;var w=e*E/y,x=-e*S/y,C=Ue(g,f),L=Ce(g,w),O=Ce(f,x);He(L,O);var z=C,R=Ae(L,z),A=Ae(z,z),Y=R*R-A*(Ae(L,L)-1);if(!(Y<0)){var _=Ne(Y),D=Ce(z,(-R-_)/A);if(He(D,L),D=Ze(D),!u)return D;var v=l[0],b=c[0],G=l[1],V=c[1],q;b0^D[1]<(B(D[0]-v)P^(v<=D[0]&&D[0]<=b)){var oe=Ce(z,(-R+_)/A);return He(oe,L),[D,Ze(oe)]}}}function d(l,c){var u=i?t:P-t,p=0;return l<-u?p|=1:l>u&&(p|=2),c<-u?p|=4:c>u&&(p|=8),p}return tn(r,a,o,i?[0,-t]:[-P,t-P])}function gi(t,e,n,i,s,o){var r=t[0],a=t[1],h=e[0],d=e[1],l=0,c=1,u=h-r,p=d-a,m;if(m=n-r,!(!u&&m>0)){if(m/=u,u<0){if(m0){if(m>c)return;m>l&&(l=m)}if(m=s-r,!(!u&&m<0)){if(m/=u,u<0){if(m>c)return;m>l&&(l=m)}else if(u>0){if(m0)){if(m/=p,p<0){if(m0){if(m>c)return;m>l&&(l=m)}if(m=o-a,!(!p&&m<0)){if(m/=p,p<0){if(m>c)return;m>l&&(l=m)}else if(p>0){if(m0&&(t[0]=r+l*u,t[1]=a+l*p),c<1&&(e[0]=r+c*u,e[1]=a+c*p),!0}}}}}var me=1e9,Pe=-me;function wi(t,e,n,i){function s(d,l){return t<=d&&d<=n&&e<=l&&l<=i}function o(d,l,c,u){var p=0,m=0;if(d==null||(p=r(d,c))!==(m=r(l,c))||h(d,l)<0^c>0)do u.point(p===0||p===3?t:n,p>1?i:e);while((p=(p+c+4)%4)!==m);else u.point(l[0],l[1])}function r(d,l){return B(d[0]-t)0?0:3:B(d[0]-n)0?2:1:B(d[1]-e)0?1:0:l>0?3:2}function a(d,l){return h(d.x,l.x)}function h(d,l){var c=r(d,1),u=r(l,1);return c!==u?c-u:c===0?l[1]-d[1]:c===1?d[0]-l[0]:c===2?d[1]-l[1]:l[0]-d[0]}return function(d){var l=d,c=$t(),u,p,m,g,f,E,S,y,w,x,C,L={point:O,lineStart:Y,lineEnd:_,polygonStart:R,polygonEnd:A};function O(v,b){s(v,b)&&l.point(v,b)}function z(){for(var v=0,b=0,G=p.length;bi&&(xe-ae)*(i-oe)>(ce-oe)*(t-ae)&&++v:ce<=i&&(xe-ae)*(i-oe)<(ce-oe)*(t-ae)&&--v;return v}function R(){l=c,u=[],p=[],C=!0}function A(){var v=z(),b=C&&v,G=(u=qt(u)).length;(b||G)&&(d.polygonStart(),b&&(d.lineStart(),o(null,null,1,d),d.lineEnd()),G&&en(u,a,v,o,d),d.polygonEnd()),l=d,u=p=m=null}function Y(){L.point=D,p&&p.push(m=[]),x=!0,w=!1,S=y=NaN}function _(){u&&(D(g,f),E&&w&&c.rejoin(),u.push(c.result())),L.point=O,w&&l.lineEnd()}function D(v,b){var G=s(v,b);if(p&&m.push([v,b]),x)g=v,f=b,E=G,x=!1,G&&(l.lineStart(),l.point(v,b));else if(G&&w)l.point(v,b);else{var V=[S=Math.max(Pe,Math.min(me,S)),y=Math.max(Pe,Math.min(me,y))],q=[v=Math.max(Pe,Math.min(me,v)),b=Math.max(Pe,Math.min(me,b))];gi(V,q,t,e,n,i)?(w||(l.lineStart(),l.point(V[0],V[1])),l.point(q[0],q[1]),G||l.lineEnd(),C=!1):G&&(l.lineStart(),l.point(v,b),C=!1)}S=v,y=b,w=G}return L}}const Ot=t=>t;var fe=1/0,Ie=fe,Se=-fe,je=Se,yi={point:Si,lineStart:pe,lineEnd:pe,polygonStart:pe,polygonEnd:pe,result:function(){var t=[[fe,Ie],[Se,je]];return Se=je=-(Ie=fe=1/0),t}};function Si(t,e){tSe&&(Se=t),eje&&(je=e)}const zt=yi;function ut(t){return function(e){var n=new nt;for(var i in t)n[i]=t[i];return n.stream=e,n}}function nt(){}nt.prototype={constructor:nt,point:function(t,e){this.stream.point(t,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 ht(t,e,n){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),i!=null&&t.clipExtent(null),ai(n,t.stream(zt)),e(zt.result()),i!=null&&t.clipExtent(i),t}function nn(t,e,n){return ht(t,function(i){var s=e[1][0]-e[0][0],o=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),o/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,h=+e[0][1]+(o-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,h])},n)}function Ei(t,e,n){return nn(t,[[0,0],e],n)}function xi(t,e,n){return ht(t,function(i){var s=+e,o=s/(i[1][0]-i[0][0]),r=(s-o*(i[1][0]+i[0][0]))/2,a=-o*i[0][1];t.scale(150*o).translate([r,a])},n)}function Mi(t,e,n){return ht(t,function(i){var s=+e,o=s/(i[1][1]-i[0][1]),r=-o*i[0][0],a=(s-o*(i[1][1]+i[0][1]))/2;t.scale(150*o).translate([r,a])},n)}var Dt=16,Ai=U(30*j);function Tt(t,e){return+e?bi(t,e):Ci(t)}function Ci(t){return ut({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function bi(t,e){function n(i,s,o,r,a,h,d,l,c,u,p,m,g,f){var E=d-i,S=l-s,y=E*E+S*S;if(y>4*e&&g--){var w=r+u,x=a+p,C=h+m,L=Ne(w*w+x*x+C*C),O=ye(C/=L),z=B(B(C)-1)e||B((E*_+S*D)/y-.5)>.3||r*u+a*p+h*m2?v[2]%360*j:0,_()):[a*K,h*K,d*K]},A.angle=function(v){return arguments.length?(c=v%360*j,_()):c*K},A.reflectX=function(v){return arguments.length?(u=v?-1:1,_()):u<0},A.reflectY=function(v){return arguments.length?(p=v?-1:1,_()):p<0},A.precision=function(v){return arguments.length?(C=Tt(L,x=v*v),D()):Ne(x)},A.fitExtent=function(v,b){return nn(A,v,b)},A.fitSize=function(v,b){return Ei(A,v,b)},A.fitWidth=function(v,b){return xi(A,v,b)},A.fitHeight=function(v,b){return Mi(A,v,b)};function _(){var v=Rt(n,0,0,u,p,c).apply(null,e(o,r)),b=Rt(n,i-v[0],s-v[1],u,p,c);return l=Zt(a,h,d),L=et(e,b),O=et(l,L),C=Tt(L,x),D()}function D(){return z=R=null,A}return function(){return e=t.apply(this,arguments),A.invert=e.invert&&Y,_()}}function ft(t,e){return[t,ii(oi((X+e)/2))]}ft.invert=function(t,e){return[t,2*Qt(ni(e))-X]};function dt(){return Ti(ft).scale(961/$)}function Ti(t){var e=zi(t),n=e.center,i=e.scale,s=e.translate,o=e.clipExtent,r=null,a,h,d;e.scale=function(c){return arguments.length?(i(c),l()):i()},e.translate=function(c){return arguments.length?(s(c),l()):s()},e.center=function(c){return arguments.length?(n(c),l()):n()},e.clipExtent=function(c){return arguments.length?(c==null?r=a=h=d=null:(r=+c[0][0],a=+c[0][1],h=+c[1][0],d=+c[1][1]),l()):r==null?null:[[r,a],[h,d]]};function l(){var c=P*i(),u=e(li(e.rotate()).invert([0,0]));return o(r==null?[[u[0]-c,u[1]-c],[u[0]+c,u[1]+c]]:t===ft?[[Math.max(u[0]-c,r),a],[Math.min(u[0]+c,h),d]]:[[r,Math.max(u[1]-c,a)],[h,Math.min(u[1]+c,d)]])}return l()}class Qi extends lt{constructor(e,n={}){var s,o;super();let i={isOrthographic:!1};this.config=Object.assign({},i,n),this.canvas=e,this.scene=new xn,this.sizes=new Jn(this),this.time=new Xn(this),this.camera=new Zn(this,{isOrthographic:this.config.isOrthographic}),this.renderer=new Qn(this),this.handleControlsChange=()=>{var r,a,h;this.renderer.update(),(a=(r=this.label3d)==null?void 0:r.update)==null||a.call(r),(h=this.updateTownLabelScale)==null||h.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",r=>{this.update(r)})}setAxesHelper(e=250){if(!e)return!1;let n=new Mn(e);this.scene.add(n)}resize(){this.camera.resize(),this.renderer.resize()}update(e){this.camera.update(e),this.renderer.update(e)}destroy(){var e,n,i,s;(n=(e=this.camera.controls)==null?void 0:e.removeEventListener)==null||n.call(e,"change",this.handleControlsChange),this.sizes.destroy(),this.time.destroy(),this.camera.destroy(),this.renderer.destroy(),this.scene.traverse(o=>{if(o instanceof re){o.geometry.dispose();for(const r in o.material){const a=o.material[r];a&&typeof a.dispose=="function"&&a.dispose()}}}),(s=(i=this.canvas)==null?void 0:i.parentNode)==null||s.removeChild(this.canvas)}}class Zi{constructor({material:e,time:n,size:i,diffuseColor:s,diffuseSpeed:o,diffuseWidth:r,callback:a=()=>{}}){this.time=n,this.pointShader=null,this.callback=a;let h={size:100,diffuseSpeed:15,diffuseColor:9345950,diffuseWidth:10};this.options=Object.assign({},h,{material:e,size:i,diffuseColor:s,diffuseSpeed:o,diffuseWidth:r}),this.init()}init(){let{material:e,size:n,diffuseColor:i,diffuseSpeed:s,diffuseWidth:o}=this.options,r=n/s;e.onBeforeCompile=a=>{this.pointShader=a,this.callback(a,r),a.uniforms=Z(Q({},a.uniforms),{uTime:{value:0},uSpeed:{value:s},uWidth:{value:o},uColor:{value:new Ke(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 $i{constructor({scene:e,time:n},i){this.scene=e,this.time=n,this.instance=null;let s={position:new F(0,0,0),gridSize:100,gridDivision:20,gridColor:2635578,shapeSize:1,shapeColor:9345950,pointSize:.2,pointColor:2635578,pointLayout:{row:200,col:200},pointBlending:An};this.options=Object.assign({},s,i),this.init()}init(){let e=new ve;e.name="Grid";let n=this.createGridHelp(),i=this.createShapes(),s=this.createPoint();e.add(n,i,s),e.position.copy(this.options.position),this.instance=e,this.scene.add(e)}createShapes(){let{gridSize:e,gridDivision:n,shapeSize:i,shapeColor:s}=this.options,o=e/n,r=e/2,a=new ge({color:s,side:Cn}),h=[];for(let c=0;c{this.update()}),this.sizes.on("resize",()=>{this.resize()})}create(e="",n="",i=!1){let s=document.createElement("div");s.innerHTML=e,s.className=n,s.style.visibility="hidden",s.style.position="absolute",n||(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 Bi(s):o=new sn(s),o.init=(r,a)=>{o.element.innerHTML=r,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=r=>{this.parent=r,r.add(o)},o.remove=()=>{this.parent.remove(o)},o}setLabelStyle(e,n=.1,i="x",s=Math.PI/2,o="none"){e.element.style.pointerEvents=o,e.scale.set(n,n,n),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:n}=this.sizes;this.css3dRender.setSize(e,n)}}class ts{constructor({time:e},n){this.time=e,this.options=Object.assign({},{width:10,scale:1,position:new F(0,0,0),needRotate:!1,rotateSpeed:.001,material:new ge({transparent:!0,opacity:1,depthTest:!0})},n);let i=new Ln(this.options.width,this.options.width),s=new re(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 on{constructor({time:e},n={}){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 kt({map:on.createTexture(),size:20,color:16777215,transparent:!0,opacity:1,depthTest:!1,vertexColors:!0,blending:On,sizeAttenuation:!0})},n),this.create()}create(){const{range:e,speed:n,dir:i,material:s,num:o,renderOrder:r}=this.config,a=[],h=[],d=[];for(let c=0;ci/2&&r===1&&(u=-i/2),u<-i/2&&r==-1&&(u=i/2),a.setX(l,c),a.setZ(l,u),h.setX(l,p),h.setY(l,m)}a.needsUpdate=!0,h.needsUpdate=!0}setParent(e){e.add(this.instance),this.time.on("tick",(n,i)=>{this.enable&&this.update(n,i)})}}class ns{constructor({},e={}){this.mapGroup=new ve,this.coordinates=[],this.config=Object.assign({position:new F(0,0,0),geoProjectionCenter:new N(0,0),geoProjectionScale:120,data:"",renderOrder:1,merge:!1,material:new ge({color:1582651,transparent:!0,opacity:1})},e),this.mapGroup.position.copy(this.config.position);let n=ct(this.config.data);this.create(n)}geoProjection(e){return dt().center(this.config.geoProjectionCenter).scale(this.config.geoProjectionScale).translate([0,0])(e)}create(e){let{merge:n}=this.config,i=[];if(e.features.forEach(s=>{const o=new ot;let{name:r,center:a=[],centroid:h=[]}=s.properties;this.coordinates.push({name:r,center:a,centroid:h}),o.userData.name=r,s.geometry.coordinates.forEach(d=>{d.forEach(l=>{const c=new st;for(let p=0;p{var d,l,c;const i=new ot;let{name:s,center:o=[],centroid:r=[]}=n.properties;this.coordinates.push({name:s,center:o,centroid:r});const a={depth:this.config.depth,bevelEnabled:(d=this.config.bevelEnabled)!=null?d:!0,bevelSegments:(l=this.config.bevelSegments)!=null?l:1,bevelThickness:(c=this.config.bevelThickness)!=null?c:.1};let h=[this.config.topFaceMaterial,this.config.sideMaterial];n.geometry.coordinates.forEach(u=>{u.forEach((p,m)=>{const g=new st;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 an extends Bn{constructor(e){super({type:"LineMaterial",uniforms:Jt.clone(Re.line.uniforms),vertexShader:Re.line.vertexShader,fragmentShader:Re.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 It=new F,jt=new F,W=new Ge,k=new Ge,te=new Ge,Ve=new F,Je=new rt,H=new _n,Gt=new F,Oe=new at,ze=new Vt,ne=new Ge;let ie,le;function Nt(t,e,n){return ne.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),ne.multiplyScalar(1/ne.w),ne.x=le/n.width,ne.y=le/n.height,ne.applyMatrix4(t.projectionMatrixInverse),ne.multiplyScalar(1/ne.w),Math.abs(Math.max(ne.x,ne.y))}function Ii(t,e){const n=t.matrixWorld,i=t.geometry,s=i.attributes.instanceStart,o=i.attributes.instanceEnd,r=Math.min(i.instanceCount,s.count);for(let a=0,h=r;ac&&k.z>c)continue;if(W.z>c){const y=W.z-k.z,w=(W.z-c)/y;W.lerp(k,w)}else if(k.z>c){const y=k.z-W.z,w=(k.z-c)/y;k.lerp(W,w)}W.applyMatrix4(i),k.applyMatrix4(i),W.multiplyScalar(1/W.w),k.multiplyScalar(1/k.w),W.x*=o.x/2,W.y*=o.y/2,k.x*=o.x/2,k.y*=o.y/2,H.start.copy(W),H.start.z=0,H.end.copy(k),H.end.z=0;const g=H.closestPointToPointParameter(Ve,!0);H.at(g,Gt);const f=Un.lerp(W.z,k.z,g),E=f>=-1&&f<=1,S=Ve.distanceTo(Gt){const l=[];let c=null;n==="Line2"?(d[0].forEach(u=>{const[p,m]=this.geoProjection(u);l.push(p,-m,0)}),c=this.createLine2(l)):n==="Line3"?(d[0].forEach(u=>{const[p,m]=this.geoProjection(u);l.push(new F(p,-m,0))}),c=this.createLine3(l)):d[0].forEach(u=>{const[p,m]=this.geoProjection(u);l.push(new F(p,-m,0)),c=this.createLine(l)}),h.add(c)}),o.add(h))}return o}createLine3(e){const n=this.config.tubeRadius,i=256*10,s=4,o=!1,{material:r,renderOrder:a}=this.config,h=new jn(e),d=new Gn(h,i,n,s,o),l=new re(d,r);return l.name="mapLine3",l.renderOrder=a,l}createLine2(e){const{material:n,renderOrder:i}=this.config,s=new ln;s.setPositions(e);let o=new Ni(s,n);return o.name="mapLine2",o.renderOrder=i,o.computeLineDistances(),o}createLine(e){const{material:n,renderOrder:i,type:s}=this.config,o=new it;o.setFromPoints(e);let r=new Nn(o,n);return r.renderOrder=i,r.name="mapLine",r}setParent(e){e.add(this.lineGroup)}}class os{constructor(e,n){this.shader=null,this.config=Object.assign({uColor1:2781042,uColor2:860197,size:15,dir:"x"},n),this.init(e)}init(e){let{uColor1:n,uColor2:i,dir:s,size:o}=this.config,r={x:1,y:2,z:3};e.onBeforeCompile=a=>{this.shader=a,a.uniforms=Z(Q({},a.uniforms),{uColor1:{value:new Ke(n)},uColor2:{value:new Ke(i)},uDir:{value:r[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 rs="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 Ft=class{constructor(t,e){M(this,"target");M(this,"name");M(this,"intersected");M(this,"wasIntersected",!1);M(this,"wasIntersectedOnMouseDown",!1);M(this,"distance");this.target=t,this.name=e,this.intersected=!1,this.distance=0}},J=class{constructor(t,e=null){M(this,"type");M(this,"cancelBubble");M(this,"originalEvent");M(this,"coords",new N(0,0));M(this,"distance",0);M(this,"intersected",!1);M(this,"wasIntersected",!1);M(this,"wasIntersectedOnMouseDown",!1);this.cancelBubble=!1,this.type=t,this.originalEvent=e}stopPropagation(){this.cancelBubble=!0}},as=class{constructor(t,e,n,i){M(this,"renderer");M(this,"camera");M(this,"domElement");M(this,"bindEventsOnBodyElement");M(this,"autoAdd");M(this,"scene");M(this,"mouse");M(this,"supportsPointerEvents");M(this,"interactiveObjects");M(this,"closestObject");M(this,"raycaster");M(this,"treatTouchEventsAsMouseEvents");M(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)});M(this,"add",(t,e=[])=>{if(t&&!this.interactiveObjects.find(n=>n.target===t))if(e.length>0)e.forEach(n=>{let i=t.getObjectByName(n);if(i){let s=new Ft(i,n);this.interactiveObjects.push(s)}});else{let n=new Ft(t,t.name);this.interactiveObjects.push(n)}});M(this,"remove",(t,e=[])=>{!t||(e.length>0?e.forEach(n=>{let i=t.getObjectByName(n);i&&(this.interactiveObjects=this.interactiveObjects.filter(s=>s.target!==i))}):this.interactiveObjects=this.interactiveObjects.filter(n=>n.target!==t))});M(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 t=(i=this.interactiveObjects.find(s=>s.intersected))!=null?i:null;if(t!=this.closestObject){if(this.closestObject){let s=new J("mouseout");this.dispatch(this.closestObject,s)}if(t){let s=new J("mouseover");this.dispatch(t,s)}this.closestObject=t}let e;this.interactiveObjects.forEach(s=>{!s.intersected&&s.wasIntersected&&(e||(e=new J("mouseleave")),this.dispatch(s,e))});let n;this.interactiveObjects.forEach(s=>{s.intersected&&!s.wasIntersected&&(n||(n=new J("mouseenter")),this.dispatch(s,n))})});M(this,"checkIntersection",t=>{let e=this.raycaster.intersectObjects([t.target],!0);if(t.wasIntersected=t.intersected,e.length>0){let n=e[0].distance;e.forEach(i=>{i.distance{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY);let e=new J("mousemove",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});M(this,"onDocumentPointerMove",t=>{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY);let e=new J("pointermove",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});M(this,"onTouchMove",t=>{t.touches.length>0&&this.mapPositionToPoint(this.mouse,t.touches[0].clientX,t.touches[0].clientY);let e=new J(this.treatTouchEventsAsMouseEvents?"mousemove":"touchmove",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});M(this,"onMouseClick",t=>{this.update();let e=new J("click",t);this.interactiveObjects.forEach(n=>{n.intersected&&this.dispatch(n,e)})});M(this,"onMouseDown",t=>{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY),this.update();let e=new J("mousedown",t);this.interactiveObjects.forEach(n=>{n.intersected?(n.wasIntersectedOnMouseDown=!0,this.dispatch(n,e)):n.wasIntersectedOnMouseDown=!1})});M(this,"onPointerDown",t=>{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY),this.update();let e=new J("pointerdown",t);this.interactiveObjects.forEach(n=>{n.intersected&&this.dispatch(n,e)})});M(this,"onTouchStart",t=>{t.touches.length>0&&this.mapPositionToPoint(this.mouse,t.touches[0].clientX,t.touches[0].clientY),this.update();let e=new J(this.treatTouchEventsAsMouseEvents?"mousedown":"touchstart",t);this.interactiveObjects.forEach(n=>{n.intersected&&this.dispatch(n,e)})});M(this,"onMouseUp",t=>{let e=new J("mouseup",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});M(this,"onPointerUp",t=>{let e=new J("pointerup",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});M(this,"onTouchEnd",t=>{t.touches.length>0&&this.mapPositionToPoint(this.mouse,t.touches[0].clientX,t.touches[0].clientY),this.update();let e=new J(this.treatTouchEventsAsMouseEvents?"mouseup":"touchend",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});M(this,"dispatch",(t,e)=>{t.target&&!e.cancelBubble&&(e.coords=this.mouse,e.distance=t.distance,e.intersected=t.intersected,e.wasIntersected=t.wasIntersected,e.wasIntersectedOnMouseDown=t.wasIntersectedOnMouseDown,t.target.dispatchEvent(e))});M(this,"mapPositionToPoint",(t,e,n)=>{let i=this.renderer.domElement.getBoundingClientRect();t.x=(e-i.left)/i.width*2-1,t.y=-((n-i.top)/i.height)*2+1});this.renderer=t,this.camera=e,this.domElement=n,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 Fn,n.addEventListener("click",this.onMouseClick),this.supportsPointerEvents&&(this.bindEventsOnBodyElement?n.ownerDocument.addEventListener("pointermove",this.onDocumentPointerMove):n.addEventListener("pointermove",this.onDocumentPointerMove),n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointerup",this.onPointerUp)),this.bindEventsOnBodyElement?n.ownerDocument.addEventListener("mousemove",this.onDocumentMouseMove):n.addEventListener("mousemove",this.onDocumentMouseMove),n.addEventListener("mousedown",this.onMouseDown),n.addEventListener("mouseup",this.onMouseUp),n.addEventListener("touchstart",this.onTouchStart,{passive:!0}),n.addEventListener("touchmove",this.onTouchMove,{passive:!0}),n.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this.treatTouchEventsAsMouseEvents=!0}};const ls=kn,cs=Hn,us=0,Ee=Kt;function hs(t){return t}function Fi(t=[],e=Kt){const n=t.map(r=>{var a,h,d;return Z(Q({},r),{name:r.name||r.label||r.town||"",count:Number((d=(h=(a=r.count)!=null?a:r.value)!=null?h:r.total)!=null?d:0)})}).filter(r=>r.name&&Number.isFinite(r.count)&&r.count>=0),i=n.reduce((r,a)=>r+a.count,0);if(!i||!e)return n.map(r=>Z(Q({},r),{count:0}));const s=n.map(r=>Z(Q({},r),{count:Math.round(r.count/i*e)})),o=e-s.reduce((r,a)=>r+a.count,0);return o&&s[0]&&(s[0].count+=o),s}const Wi=Fi(Yn,Ee).sort((t,e)=>e.count-t.count),ki=[{key:"fertileCow",name:"适龄能繁母牛",ratio:45,source:"畜群结构比例表"},{key:"meatBull",name:"麦洼公牦牛",ratio:15,source:"畜群结构比例表"},{key:"breedingBull",name:"种公牛",ratio:3,source:"畜群结构比例表"},{key:"femaleCalf",name:"母犊牛",ratio:15,source:"畜群结构比例表"},{key:"maleCalf",name:"公犊牛",ratio:15,source:"畜群结构比例表"},{key:"overageCow",name:"过龄能繁母牛",ratio:7,source:"畜群结构比例表"}],Hi=[{key:"fertileCow",name:"适龄能繁母牛",ratio:44.8,source:"畜群结构比例表"},{key:"meatBull",name:"麦洼公牦牛",ratio:15.2,source:"畜群结构比例表"},{key:"breedingBull",name:"种公牛",ratio:3.1,source:"畜群结构比例表"},{key:"femaleCalf",name:"母犊牛",ratio:14.9,source:"畜群结构比例表"},{key:"maleCalf",name:"公犊牛",ratio:15.1,source:"畜群结构比例表"},{key:"overageCow",name:"过龄能繁母牛",ratio:6.9,source:"畜群结构比例表"}],fs=hn(Hi,Ee),ds=Wn.map((t,e)=>Z(Q({},t),{color:["#48cfff","#30dcff","#8bf7ff","#48cfff"][e%4]})),ps=[{age:"≤1岁",cow:38586,bull:40861},{age:"1-2岁",cow:27124,bull:27549},{age:"2-4岁",cow:93355,bull:49265},{age:"4-8岁",cow:106679,bull:32655},{age:"8岁以上",cow:28671,bull:13485}],Wt=[{key:"2026",label:"2026年底",shortLabel:"2026",months:7,stock:462850,births:24680,outflow:19020,correction:-1040,structure:{fertileCow:45.1,meatBull:15,breedingBull:3,femaleCalf:15.2,maleCalf:14.9,overageCow:6.8}},{key:"2027",label:"2027年底",shortLabel:"2027",months:19,stock:468920,births:67420,outflow:55180,correction:-1550,structure:{fertileCow:45.5,meatBull:14.8,breedingBull:3.1,femaleCalf:15.1,maleCalf:14.8,overageCow:6.7}},{key:"2028",label:"2028年底",shortLabel:"2028",months:31,stock:475360,births:109680,outflow:90140,correction:-2410,structure:{fertileCow:45.9,meatBull:14.5,breedingBull:3.1,femaleCalf:15.3,maleCalf:14.7,overageCow:6.5}}],ms=[{name:"新生牛犊",value:86},{name:"出栏周转",value:62},{name:"死亡淘汰",value:48},{name:"母牛基础",value:91},{name:"幼畜存活",value:73}],cn=2026,un=6;function vs(t){return Wt.find(e=>e.key===t)||Wt[1]}function gs(t){const e=(t==null?void 0:t.structure)||{};return hn(ki.map(n=>{var i;return Z(Q({},n),{ratio:(i=e[n.key])!=null?i:n.ratio,source:"预测模型"})}),t.stock)}function ws(t){const e=t.stock/Ee,n=Wi.map((s,o)=>Z(Q({},s),{forecast:Math.round(s.count*e+(o%3-1)*t.months*18)})),i=t.stock-n.reduce((s,o)=>s+o.forecast,0);if(i){const s=n.reduce((o,r)=>r.count>o.count?r:o,n[0]);s.forecast+=i}return n.map(s=>Z(Q({},s),{change:s.forecast-s.count})).sort((s,o)=>o.forecast-s.forecast)}function ys(t){const e=Yi(t),n=Array.from({length:e},(r,a)=>Vi(a)),i=n.map((r,a)=>{const h=Xe(a,e),d=Math.sin(a/2.6)*Math.sin(Math.PI*h)*Math.min(360,t.months*18);return Math.round(Ee+(t.stock-Ee)*h+d)}),s=n.map((r,a)=>Math.round(t.births*Xe(a,e))),o=n.map((r,a)=>Math.round(t.outflow*Xe(a,e)));return{labels:n,stock:i,births:s,outflow:o}}function Yi(t={}){return Math.max(1,Math.round(Number(t.months||1)))}function Xe(t,e){return e<=1?1:Math.min(1,Math.max(0,t/(e-1)))}function Vi(t=0){const e=new Date(Date.UTC(cn,un-1+t,1));return`${String(e.getUTCFullYear()).slice(-2)}-${String(e.getUTCMonth()+1).padStart(2,"0")}`}function Ss(t=0){const e=new Date(Date.UTC(cn,un-1,1+t));return[String(e.getUTCFullYear()).slice(-2),String(e.getUTCMonth()+1).padStart(2,"0"),String(e.getUTCDate()).padStart(2,"0")].join("-")}function hn(t,e){const n=t.map((s,o)=>{const r=e*s.ratio/100;return Z(Q({},s),{index:o,exact:r,count:Math.floor(r),remainder:r-Math.floor(r)})});let i=e-n.reduce((s,o)=>s+o.count,0);return n.slice().sort((s,o)=>o.remainder-s.remainder||s.index-o.index).forEach(s=>{i<=0||(s.count+=1,i-=1)}),n.map(h=>{var d=h,{index:s,exact:o,remainder:r}=d,a=vt(d,["index","exact","remainder"]);return Z(Q({},a),{count:Math.round(a.count)})})}function Es(t){const e=new Map;return t.forEach(n=>{const i=n.name,s=e.get(i)||{name:i,count:0};s.count+=Number(n.count||0),e.set(i,s)}),[...e.values()].sort((n,i)=>i.count-n.count)}export{ns as B,Zi as D,is as E,os as G,es as L,Qi as M,ts as P,ss as a,$i as b,on as c,vs as d,ys as e,Wt as f,dt as g,as as h,Yi as i,Ss as j,Ee as k,rs as l,cs as m,Fi as n,Wi as o,ws as p,gs as q,ps as r,fs as s,us as t,ds as u,ms as v,hs as w,ls as x,Es as y};