@rubin-epo/epo-widget-lib 2.0.11 → 2.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),r=require("react"),o=require("../../../node_modules/prop-types/index.cjs"),ge=require("three"),fe=require("@react-three/fiber"),m=require("@react-three/drei"),t=require("../orbitalUtilities.cjs"),xe=require("../chartColors.module.css.cjs"),pe=require("../Context/index.cjs"),je=require("react-i18next"),g=require("./styles.cjs");function ye(i){if(i&&i.__esModule)return i;const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const a in i)if(a!=="default"){const j=Object.getOwnPropertyDescriptor(i,a);Object.defineProperty(f,a,j.get?j:{enumerable:!0,get:()=>i[a]})}}return f.default=i,Object.freeze(f)}const O=ye(ge),_=({data:i,selectionCallback:f,active:a,playing:j,dayPerVizSec:G,stepDirection:k,frameOverride:R,orbitColor:w,objectColor:C,objectRadius:D,initialized:N,initCallback:v,devMode:Z,zoomMod:U,defaultZoom:K,type:A,reset:z})=>{const{t:Y}=je.useTranslation(),{orbits:$}=pe.useOrbitalSimContext(),{activeVelocityCallback:J}=$,Q=r.useRef(),{a:B,e:W,i:X,M:ee,Node:V,Peri:q,Principal_desig:te,Translated_desig_key:H,name:oe}=i||{},[se]=r.useState(()=>[0,t.degsToRads(X),V?t.degsToRads(V):0]),[n]=r.useState(()=>t.auToUnit(B)),[y]=r.useState(()=>t.getMinorAxis(B,W)),[re]=r.useState(()=>t.getFocus(n,y)),[s]=r.useState(new O.Vector3(re,0,0)),[d]=r.useState(new O.Vector3(0,0,0)),[ie,ae]=r.useState(!1),[u]=r.useState(()=>t.getCurve(n,y,s.x,s.y)),[ne]=r.useState(()=>t.getLineGeometry(u.getPoints(360))),b=t.getPosFromArcLength(0,u),[x,T]=r.useState({position:b,rotation:[0,0,0],progress:0,velocity:t.getVelocity(b.distanceTo(d),n),period:0});r.useEffect(()=>{z>0&&T({position:b,rotation:[0,0,0],progress:0,velocity:t.getVelocity(b.distanceTo(d),n),period:0})},[z]);function le(h){let l=0,c=t.getPosFromArcLength(l,u);if(h){const P=h>180,M=P?h-180:h;let p=t.getAngleFromPos(c,d);for(;p<M;)l+=.01,c=t.getPosFromArcLength(l,u),p=t.getAngleFromPos(c,d);P&&(l+=.5,c=t.getPosFromArcLength(l,u))}return v?v():ae(!0),{position:c,rotation:[0,0,0],progress:l,velocity:t.getVelocity(c.distanceTo(d),n),period:0}}function E(h,L){const{progress:l,position:c,velocity:P,period:M}=x,p=h?0:L*(G||t.DAY_PER_VIZ_SEC),ce=P*p*k,S=l+ce/u.getLength(),F=S>1?1-S:S,{x:de,y:ue}=u.getPoint(F),he=new O.Vector3(de,ue,0),me=t.getVelocity(c.distanceTo(d),n);let I=p+M;S>1&&(I=0),T({...x,position:he,progress:F,velocity:me,period:I})}return r.useEffect(()=>{T(le(ee||Math.floor(Math.random()*Math.floor(180))))},[]),r.useEffect(()=>{R&&E(!1,1/60)},[R]),r.useEffect(()=>{a&&J(t.auToMeters(t.unitToAu(x.velocity/1e5)))},[x]),fe.useFrame((h,L)=>{(N||ie)&&E(!j,L)}),e.jsx("group",{rotation:se,children:e.jsxs("group",{rotation:[0,0,q?t.degsToRads(q+90):0],children:[e.jsx("line",{ref:Q,geometry:ne,children:e.jsx("lineBasicMaterial",{attach:"material",color:a?t.ORBITAL_COLORS.asteroid.orbitHighlight:w||t.ORBITAL_COLORS.asteroid.orbitColor})}),e.jsxs("mesh",{position:x.position,onClick:()=>f(i,"neo"),children:[(A==="planet"||A==="neo"||a)&&e.jsx(m.Html,{children:e.jsx(g.Label,{children:e.jsx("button",{type:"button",style:{fontSize:t.getLabelSize(U,K)},onClick:()=>f(i,"neo"),children:H?Y(H):oe||te})})}),e.jsx("sphereGeometry",{attach:"geometry",args:[D||4,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:a?t.ORBITAL_COLORS.asteroid.objectHighlight:C||t.ORBITAL_COLORS.asteroid.objectColor})]}),Z&&e.jsxs(e.Fragment,{children:[e.jsxs("mesh",{position:s,children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:xe.default.chart1}),e.jsx(m.Html,{children:e.jsx(g.Label,{children:"center"})})]}),e.jsxs("mesh",{position:d,children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:C||"blue"}),e.jsx(m.Html,{children:e.jsx(g.Label,{children:"sun"})})]}),e.jsxs("mesh",{position:[s.x,-y+s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(m.Html,{children:e.jsx(g.Label,{children:"minor axis vertex"})})]}),e.jsxs("mesh",{position:[s.x,y+s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(m.Html,{children:e.jsx(g.Label,{children:"minor axis vertex"})})]}),e.jsxs("mesh",{position:[n+s.x,s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(m.Html,{children:e.jsx(g.Label,{children:"major axis vertex"})})]}),e.jsxs("mesh",{position:[-n+s.x,s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(m.Html,{children:e.jsx(g.Label,{children:"major axis vertex"})})]})]})]})})};_.defaultProps={type:"object"};_.propTypes={data:o.default.object,selectionCallback:o.default.func,active:o.default.bool,playing:o.default.bool,dayPerVizSec:o.default.number,stepDirection:o.default.number,frameOverride:o.default.number,orbitColor:o.default.string,objectColor:o.default.string,objectRadius:o.default.number,initCallback:o.default.func,initialized:o.default.bool,devMode:o.default.bool,activeVelocityCallback:o.default.func,zoomMod:o.default.number,defaultZoom:o.default.number,type:o.default.string,reset:o.default.number};exports.default=_;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),r=require("react"),o=require("../../../node_modules/prop-types/index.cjs"),ge=require("three"),fe=require("@react-three/fiber"),d=require("@react-three/drei"),t=require("../orbitalUtilities.cjs"),xe=require("../chartColors.module.css.cjs"),pe=require("../Context/index.cjs"),je=require("react-i18next"),g=require("./styles.cjs");function ye(i){if(i&&i.__esModule)return i;const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const a in i)if(a!=="default"){const j=Object.getOwnPropertyDescriptor(i,a);Object.defineProperty(f,a,j.get?j:{enumerable:!0,get:()=>i[a]})}}return f.default=i,Object.freeze(f)}const M=ye(ge),_=({data:i,selectionCallback:f,active:a,playing:j,dayPerVizSec:w,stepDirection:G,frameOverride:R,orbitColor:k,objectColor:C,objectRadius:D,initialized:N,initCallback:v,devMode:Z,zoomMod:U,defaultZoom:K,type:A,reset:z})=>{const{t:Y}=je.useTranslation(),{orbits:$}=pe.useOrbitalSimContext(),{activeVelocityCallback:J}=$,Q=r.useRef(),{a:V,e:W,i:X,M:ee,Node:q,Peri:B,Principal_desig:te,Translated_desig_key:H,name:oe}=i||{},[se]=r.useState(()=>[0,t.degsToRads(X),q?t.degsToRads(q):0]),[n]=r.useState(()=>t.auToUnit(V)),[y]=r.useState(()=>t.getMinorAxis(V,W)),[re]=r.useState(()=>t.getFocus(n,y)),[s]=r.useState(new M.Vector3(re,0,0)),[u]=r.useState(new M.Vector3(0,0,0)),[ie,ae]=r.useState(!1),[h]=r.useState(()=>t.getCurve(n,y,s.x,s.y)),[ne]=r.useState(h.getPoints(360)),b=t.getPosFromArcLength(0,h),[x,T]=r.useState({position:b,rotation:[0,0,0],progress:0,velocity:t.getVelocity(b.distanceTo(u),n),period:0});r.useEffect(()=>{z>0&&T({position:b,rotation:[0,0,0],progress:0,velocity:t.getVelocity(b.distanceTo(u),n),period:0})},[z]);function le(m){let l=0,c=t.getPosFromArcLength(l,h);if(m){const P=m>180,O=P?m-180:m;let p=t.getAngleFromPos(c,u);for(;p<O;)l+=.01,c=t.getPosFromArcLength(l,h),p=t.getAngleFromPos(c,u);P&&(l+=.5,c=t.getPosFromArcLength(l,h))}return v?v():ae(!0),{position:c,rotation:[0,0,0],progress:l,velocity:t.getVelocity(c.distanceTo(u),n),period:0}}function E(m,L){const{progress:l,position:c,velocity:P,period:O}=x,p=m?0:L*(w||t.DAY_PER_VIZ_SEC),ce=P*p*G,S=l+ce/h.getLength(),F=S>1?1-S:S,{x:de,y:ue}=h.getPoint(F),he=new M.Vector3(de,ue,0),me=t.getVelocity(c.distanceTo(u),n);let I=p+O;S>1&&(I=0),T({...x,position:he,progress:F,velocity:me,period:I})}return r.useEffect(()=>{T(le(ee||Math.floor(Math.random()*Math.floor(180))))},[]),r.useEffect(()=>{R&&E(!1,1/60)},[R]),r.useEffect(()=>{a&&J(t.auToMeters(t.unitToAu(x.velocity/1e5)))},[x]),fe.useFrame((m,L)=>{(N||ie)&&E(!j,L)}),e.jsx("group",{rotation:se,children:e.jsxs("group",{rotation:[0,0,B?t.degsToRads(B+90):0],children:[e.jsx(d.Line,{ref:Q,points:ne,linewidth:2,color:a?t.ORBITAL_COLORS.asteroid.orbitHighlight:k||t.ORBITAL_COLORS.asteroid.orbitColor}),e.jsxs("mesh",{position:x.position,onClick:()=>f(i,"neo"),children:[(A==="planet"||A==="neo"||a)&&e.jsx(d.Html,{children:e.jsx(g.Label,{style:{fontSize:t.getLabelSize(U,K)},children:H?Y(H):oe||te})}),e.jsx("sphereGeometry",{attach:"geometry",args:[D||4,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:a?t.ORBITAL_COLORS.asteroid.objectHighlight:C||t.ORBITAL_COLORS.asteroid.objectColor})]}),Z&&e.jsxs(e.Fragment,{children:[e.jsxs("mesh",{position:s,children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:xe.default.chart1}),e.jsx(d.Html,{children:e.jsx(g.Label,{children:"center"})})]}),e.jsxs("mesh",{position:u,children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:C||"blue"}),e.jsx(d.Html,{children:e.jsx(g.Label,{children:"sun"})})]}),e.jsxs("mesh",{position:[s.x,-y+s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(d.Html,{children:e.jsx(g.Label,{children:"minor axis vertex"})})]}),e.jsxs("mesh",{position:[s.x,y+s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(d.Html,{children:e.jsx(g.Label,{children:"minor axis vertex"})})]}),e.jsxs("mesh",{position:[n+s.x,s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(d.Html,{children:e.jsx(g.Label,{children:"major axis vertex"})})]}),e.jsxs("mesh",{position:[-n+s.x,s.y,s.z],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[2,10,10]}),e.jsx("meshBasicMaterial",{attach:"material",color:"green"}),e.jsx(d.Html,{children:e.jsx(g.Label,{children:"major axis vertex"})})]})]})]})})};_.defaultProps={type:"object"};_.propTypes={data:o.default.object,selectionCallback:o.default.func,active:o.default.bool,playing:o.default.bool,dayPerVizSec:o.default.number,stepDirection:o.default.number,frameOverride:o.default.number,orbitColor:o.default.string,objectColor:o.default.string,objectRadius:o.default.number,initCallback:o.default.func,initialized:o.default.bool,devMode:o.default.bool,activeVelocityCallback:o.default.func,zoomMod:o.default.number,defaultZoom:o.default.number,type:o.default.string,reset:o.default.number};exports.default=_;
@@ -1,133 +1,133 @@
1
1
  "use client";
2
2
  import { jsx as e, jsxs as i, Fragment as Pe } from "react/jsx-runtime";
3
- import { useRef as Me, useState as r, useEffect as M } from "react";
3
+ import { useRef as Te, useState as r, useEffect as T } from "react";
4
4
  import t from "../../../node_modules/prop-types/index.js";
5
5
  import * as L from "three";
6
- import { useFrame as Te } from "@react-three/fiber";
7
- import { Html as h } from "@react-three/drei";
8
- import { degsToRads as V, auToUnit as Ce, getMinorAxis as ve, getFocus as ze, getCurve as je, getLineGeometry as Be, getPosFromArcLength as T, getVelocity as C, auToMeters as Le, unitToAu as Ve, ORBITAL_COLORS as v, getLabelSize as Ge, getAngleFromPos as Z, DAY_PER_VIZ_SEC as Re } from "../orbitalUtilities.js";
6
+ import { useFrame as Me } from "@react-three/fiber";
7
+ import { Line as Ce, Html as h } from "@react-three/drei";
8
+ import { degsToRads as V, auToUnit as ve, getMinorAxis as ze, getFocus as je, getCurve as Le, getPosFromArcLength as M, getVelocity as C, auToMeters as Ve, unitToAu as Be, ORBITAL_COLORS as v, getLabelSize as Ge, getAngleFromPos as H, DAY_PER_VIZ_SEC as Re } from "../orbitalUtilities.js";
9
9
  import Se from "../chartColors.module.css.js";
10
10
  import { useOrbitalSimContext as _e } from "../Context/index.js";
11
- import { useTranslation as Ae } from "react-i18next";
11
+ import { useTranslation as we } from "react-i18next";
12
12
  import { Label as d } from "./styles.js";
13
- const N = ({
14
- data: z,
15
- selectionCallback: G,
16
- active: y,
13
+ const Z = ({
14
+ data: B,
15
+ selectionCallback: N,
16
+ active: f,
17
17
  playing: K,
18
18
  dayPerVizSec: U,
19
19
  stepDirection: Y,
20
- frameOverride: R,
20
+ frameOverride: G,
21
21
  orbitColor: q,
22
- objectColor: S,
22
+ objectColor: R,
23
23
  objectRadius: J,
24
24
  initialized: Q,
25
- initCallback: _,
25
+ initCallback: S,
26
26
  devMode: W,
27
27
  zoomMod: X,
28
28
  defaultZoom: $,
29
- type: A,
29
+ type: _,
30
30
  // noLabels,
31
- reset: k
31
+ reset: w
32
32
  }) => {
33
- const { t: ee } = Ae(), { orbits: te } = _e(), { activeVelocityCallback: oe } = te, re = Me(), {
34
- a: w,
33
+ const { t: ee } = we(), { orbits: te } = _e(), { activeVelocityCallback: oe } = te, re = Te(), {
34
+ a: A,
35
35
  e: ie,
36
- i: ne,
37
- M: se,
38
- Node: E,
39
- Peri: F,
36
+ i: se,
37
+ M: ne,
38
+ Node: k,
39
+ Peri: E,
40
40
  Principal_desig: ae,
41
- Translated_desig_key: I,
41
+ Translated_desig_key: F,
42
42
  name: ce
43
- } = z || {}, [le] = r(() => [
43
+ } = B || {}, [le] = r(() => [
44
44
  0,
45
- V(ne),
46
- E ? V(E) : 0
47
- ]), [n] = r(() => Ce(w)), [u] = r(() => ve(w, ie)), [me] = r(() => ze(n, u)), [o] = r(new L.Vector3(me, 0, 0)), [c] = r(new L.Vector3(0, 0, 0)), [he, de] = r(!1), [l] = r(
48
- () => je(n, u, o.x, o.y)
49
- ), [pe] = r(() => Be(l.getPoints(360))), f = T(0, l), [p, j] = r({
50
- position: f,
45
+ V(se),
46
+ k ? V(k) : 0
47
+ ]), [s] = r(() => ve(A)), [u] = r(() => ze(A, ie)), [me] = r(() => je(s, u)), [o] = r(new L.Vector3(me, 0, 0)), [c] = r(new L.Vector3(0, 0, 0)), [he, de] = r(!1), [l] = r(
48
+ () => Le(s, u, o.x, o.y)
49
+ ), [pe] = r(l.getPoints(360)), y = M(0, l), [p, z] = r({
50
+ position: y,
51
51
  rotation: [0, 0, 0],
52
52
  progress: 0,
53
- velocity: C(f.distanceTo(c), n),
53
+ velocity: C(y.distanceTo(c), s),
54
54
  period: 0
55
55
  });
56
- M(() => {
57
- k > 0 && j({
58
- position: f,
56
+ T(() => {
57
+ w > 0 && z({
58
+ position: y,
59
59
  rotation: [0, 0, 0],
60
60
  progress: 0,
61
- velocity: C(f.distanceTo(c), n),
61
+ velocity: C(y.distanceTo(c), s),
62
62
  period: 0
63
63
  });
64
- }, [k]);
64
+ }, [w]);
65
65
  function ge(m) {
66
- let s = 0, a = T(s, l);
66
+ let n = 0, a = M(n, l);
67
67
  if (m) {
68
- const x = m > 180, B = x ? m - 180 : m;
69
- let g = Z(a, c);
70
- for (; g < B; )
71
- s += 0.01, a = T(s, l), g = Z(a, c);
72
- x && (s += 0.5, a = T(s, l));
68
+ const x = m > 180, j = x ? m - 180 : m;
69
+ let g = H(a, c);
70
+ for (; g < j; )
71
+ n += 0.01, a = M(n, l), g = H(a, c);
72
+ x && (n += 0.5, a = M(n, l));
73
73
  }
74
- return _ ? _() : de(!0), {
74
+ return S ? S() : de(!0), {
75
75
  position: a,
76
76
  rotation: [0, 0, 0],
77
- progress: s,
78
- velocity: C(a.distanceTo(c), n),
77
+ progress: n,
78
+ velocity: C(a.distanceTo(c), s),
79
79
  period: 0
80
80
  };
81
81
  }
82
- function O(m, b) {
82
+ function I(m, b) {
83
83
  const {
84
- progress: s,
84
+ progress: n,
85
85
  position: a,
86
86
  velocity: x,
87
- period: B
88
- } = p, g = m ? 0 : b * (U || Re), ye = x * g * Y, P = s + ye / l.getLength(), D = P > 1 ? 1 - P : P, { x: ue, y: fe } = l.getPoint(D), be = new L.Vector3(ue, fe, 0), xe = C(a.distanceTo(c), n);
89
- let H = g + B;
90
- P > 1 && (H = 0), j({
87
+ period: j
88
+ } = p, g = m ? 0 : b * (U || Re), fe = x * g * Y, P = n + fe / l.getLength(), O = P > 1 ? 1 - P : P, { x: ue, y: ye } = l.getPoint(O), be = new L.Vector3(ue, ye, 0), xe = C(a.distanceTo(c), s);
89
+ let D = g + j;
90
+ P > 1 && (D = 0), z({
91
91
  ...p,
92
92
  position: be,
93
- progress: D,
93
+ progress: O,
94
94
  velocity: xe,
95
- period: H
95
+ period: D
96
96
  });
97
97
  }
98
- return M(() => {
99
- j(ge(se || Math.floor(Math.random() * Math.floor(180))));
100
- }, []), M(() => {
101
- R && O(!1, 1 / 60);
102
- }, [R]), M(() => {
103
- y && oe(Le(Ve(p.velocity / 1e5)));
104
- }, [p]), Te((m, b) => {
105
- (Q || he) && O(!K, b);
106
- }), /* @__PURE__ */ e("group", { rotation: le, children: /* @__PURE__ */ i("group", { rotation: [0, 0, F ? V(F + 90) : 0], children: [
107
- /* @__PURE__ */ e("line", { ref: re, geometry: pe, children: /* @__PURE__ */ e(
108
- "lineBasicMaterial",
98
+ return T(() => {
99
+ z(ge(ne || Math.floor(Math.random() * Math.floor(180))));
100
+ }, []), T(() => {
101
+ G && I(!1, 1 / 60);
102
+ }, [G]), T(() => {
103
+ f && oe(Ve(Be(p.velocity / 1e5)));
104
+ }, [p]), Me((m, b) => {
105
+ (Q || he) && I(!K, b);
106
+ }), /* @__PURE__ */ e("group", { rotation: le, children: /* @__PURE__ */ i("group", { rotation: [0, 0, E ? V(E + 90) : 0], children: [
107
+ /* @__PURE__ */ e(
108
+ Ce,
109
109
  {
110
- attach: "material",
111
- color: y ? v.asteroid.orbitHighlight : q || v.asteroid.orbitColor
110
+ ref: re,
111
+ points: pe,
112
+ linewidth: 2,
113
+ color: f ? v.asteroid.orbitHighlight : q || v.asteroid.orbitColor
112
114
  }
113
- ) }),
115
+ ),
114
116
  /* @__PURE__ */ i(
115
117
  "mesh",
116
118
  {
117
119
  position: p.position,
118
- onClick: () => G(z, "neo"),
120
+ onClick: () => N(B, "neo"),
119
121
  children: [
120
- (A === "planet" || A === "neo" || y) && /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(
121
- "button",
122
+ (_ === "planet" || _ === "neo" || f) && /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
123
+ d,
122
124
  {
123
- type: "button",
124
125
  style: {
125
126
  fontSize: Ge(X, $)
126
127
  },
127
- onClick: () => G(z, "neo"),
128
- children: I ? ee(I) : ce || ae
128
+ children: F ? ee(F) : ce || ae
129
129
  }
130
- ) }) }),
130
+ ) }),
131
131
  /* @__PURE__ */ e(
132
132
  "sphereGeometry",
133
133
  {
@@ -139,7 +139,7 @@ const N = ({
139
139
  "meshBasicMaterial",
140
140
  {
141
141
  attach: "material",
142
- color: y ? v.asteroid.objectHighlight : S || v.asteroid.objectColor
142
+ color: f ? v.asteroid.objectHighlight : R || v.asteroid.objectColor
143
143
  }
144
144
  )
145
145
  ]
@@ -157,7 +157,7 @@ const N = ({
157
157
  "meshBasicMaterial",
158
158
  {
159
159
  attach: "material",
160
- color: S || "blue"
160
+ color: R || "blue"
161
161
  }
162
162
  ),
163
163
  /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(d, { children: "sun" }) })
@@ -196,7 +196,7 @@ const N = ({
196
196
  "mesh",
197
197
  {
198
198
  position: [
199
- n + o.x,
199
+ s + o.x,
200
200
  o.y,
201
201
  o.z
202
202
  ],
@@ -211,7 +211,7 @@ const N = ({
211
211
  "mesh",
212
212
  {
213
213
  position: [
214
- -n + o.x,
214
+ -s + o.x,
215
215
  o.y,
216
216
  o.z
217
217
  ],
@@ -225,10 +225,10 @@ const N = ({
225
225
  ] })
226
226
  ] }) });
227
227
  };
228
- N.defaultProps = {
228
+ Z.defaultProps = {
229
229
  type: "object"
230
230
  };
231
- N.propTypes = {
231
+ Z.propTypes = {
232
232
  data: t.object,
233
233
  selectionCallback: t.func,
234
234
  active: t.bool,
@@ -250,5 +250,5 @@ N.propTypes = {
250
250
  reset: t.number
251
251
  };
252
252
  export {
253
- N as default
253
+ Z as default
254
254
  };
@@ -5,7 +5,7 @@
5
5
  display: none;
6
6
  }
7
7
  `,c=t.default.div`
8
- padding: 2px 4px;
8
+ padding: 0px 4px;
9
9
  margin-top: 4px;
10
10
  font-weight: var(--medium);
11
11
  color: var(--black);
@@ -9,7 +9,7 @@ const a = o(t)`
9
9
  display: none;
10
10
  }
11
11
  `, d = o.div`
12
- padding: 2px 4px;
12
+ padding: 0px 4px;
13
13
  margin-top: 4px;
14
14
  font-weight: var(--medium);
15
15
  color: var(--black);
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),o=require("@react-three/drei"),t=require("./orbitalUtilities.cjs"),n=require("react-i18next"),l=require("./styles.cjs"),a=({defaultZoom:s,zoomLevel:r})=>{const{t:i}=n.useTranslation();return e.jsxs("mesh",{position:[0,0,0],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[9,16,8]}),e.jsx("meshBasicMaterial",{attach:"material",color:t.ORBITAL_COLORS.sun.objectColor}),e.jsx(o.Html,{children:e.jsx(l.SunLabel,{children:e.jsx("span",{style:{fontSize:t.getLabelSize(r,s)},children:i("orbital_sim.astronomy.orbital_bodies.sun")})})})]})};exports.default=a;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),o=require("@react-three/drei"),t=require("./orbitalUtilities.cjs"),n=require("react-i18next"),l=require("./styles.cjs"),a=({defaultZoom:s,zoomLevel:r})=>{const{t:i}=n.useTranslation();return e.jsxs("mesh",{position:[0,0,0],children:[e.jsx("sphereGeometry",{attach:"geometry",args:[9,16,8]}),e.jsx("meshBasicMaterial",{attach:"material",color:t.ORBITAL_COLORS.sun.objectColor}),e.jsx(o.Html,{children:e.jsx(l.SunLabel,{style:{fontSize:t.getLabelSize(r,s)},children:i("orbital_sim.astronomy.orbital_bodies.sun")})})]})};exports.default=a;
@@ -2,10 +2,10 @@
2
2
  import { jsxs as i, jsx as t } from "react/jsx-runtime";
3
3
  import { Html as s } from "@react-three/drei";
4
4
  import { ORBITAL_COLORS as a, getLabelSize as m } from "./orbitalUtilities.js";
5
- import { useTranslation as n } from "react-i18next";
6
- import { SunLabel as l } from "./styles.js";
5
+ import { useTranslation as l } from "react-i18next";
6
+ import { SunLabel as n } from "./styles.js";
7
7
  const b = ({ defaultZoom: o, zoomLevel: r }) => {
8
- const { t: e } = n();
8
+ const { t: e } = l();
9
9
  return /* @__PURE__ */ i("mesh", { position: [0, 0, 0], children: [
10
10
  /* @__PURE__ */ t("sphereGeometry", { attach: "geometry", args: [9, 16, 8] }),
11
11
  /* @__PURE__ */ t(
@@ -15,15 +15,15 @@ const b = ({ defaultZoom: o, zoomLevel: r }) => {
15
15
  color: a.sun.objectColor
16
16
  }
17
17
  ),
18
- /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(
19
- "span",
18
+ /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
19
+ n,
20
20
  {
21
21
  style: {
22
22
  fontSize: m(r, o)
23
23
  },
24
24
  children: e("orbital_sim.astronomy.orbital_bodies.sun")
25
25
  }
26
- ) }) })
26
+ ) })
27
27
  ] });
28
28
  };
29
29
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("three");function p(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const s=p(C),c=100,j=1,r={sun:{objectColor:"#f8da86"},earth:{objectColor:"#3f9ef0",orbitColor:"#3079b8"},mars:{objectColor:"#ed4c4c",orbitColor:"#b53a3a"},jupiter:{objectColor:"#f1b571",orbitColor:"#b98b57"},neptune:{objectColor:"#3cae3f",orbitColor:"#29762b"},asteroid:{objectColor:"#b1f2ef",orbitColor:"#6a6e6e",objectHighlight:"#00ffff",orbitHighlight:"#ffffff"},neos:{objectColor:"#0ff",orbitColor:"#b2ffff"}},b={a:1.4700451,e:.5598234,i:6.35515,H:16.25,Ref:"Apollo",name:"Apollo",Principal_desig:"1932 HA",Translated_desig_key:"neo.apollo",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},d={a:.740919,e:.3221221,i:25.62023,H:16.3,Ref:"Atira",Principal_desig:"2003 CP20",Translated_desig_key:"neo.atira",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},g={a:1.9194158,e:.4353207,i:11.87658,H:17.7,Ref:"Amor",Principal_desig:"1932 EA1",Translated_desig_key:"neo.amor",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},_={a:1,e:.01671022,i:0,H:-3.9,Ref:"Earth",Principal_desig:"Earth",Translated_desig_key:"planets.earth",orbitColor:r.earth.orbitColor,objectColor:r.earth.objectColor,objectRadius:5},m={a:1.52366231,e:.09341233,i:1.85061,H:-1.52,Ref:"Mars",Principal_desig:"Mars",Translated_desig_key:"planets.mars",orbitColor:r.mars.orbitColor,objectColor:r.mars.objectColor,objectRadius:4},A={a:5.2028,e:.048,i:1.31,H:-25.9,Ref:"Jupiter",Principal_desig:"Jupiter",Translated_desig_key:"planets.jupiter",orbitColor:r.jupiter.orbitColor,objectColor:r.jupiter.objectColor,objectRadius:7},R={a:30.06896348,e:.00858587,i:1.76917,H:-25.9,Ref:"Neptune",Principal_desig:"Neptune",Translated_desig_key:"planets.neptune",orbitColor:r.neptune.orbitColor,objectColor:r.neptune.objectColor,objectRadius:6},T=e=>({neptune:R,earth:_,mars:m,jupiter:A,atira:d,apollo:b,amor:g})[e]||null,P=function(e,o){return Number.parseFloat(Number.parseFloat(e).toFixed(o))},y=(e,o,t=0,n=0)=>new s.EllipseCurve(t,n,e,o,0,2*Math.PI,!1,0),h=e=>new s.BufferGeometry().setFromPoints(e),S=(e,o)=>{const t=e.distanceTo(o),{x:n,y:i}=e;return Math.acos((t**2+n**2-i**2)/(2*t*n))*180/Math.PI},O=(e,o)=>{const{x:t,y:n}=o.getPoint(e);return new s.Vector3(t,n,0)},f=e=>e*c,M=e=>e/c,x=(e,o)=>f(e*Math.sqrt(1-o**2)),E=e=>1496e8*e,a=e=>e*(Math.PI/180),z=(e,o)=>{const t=.000296005155*c**3;return Math.sqrt(t*(2/e-1/o))},L=(e,o)=>Math.sqrt(e**2-o**2),H=(e,o)=>{const{i:t,Peri:n,Node:i}=o,l=new s.Vector3(0,1,0),u=new s.Vector3(0,0,1);return new s.Vector3(e.x,e.y,0).applyAxisAngle(u,n?a(n+90):0).applyAxisAngle(l,a(t)).applyAxisAngle(u,i?a(i):0)},V=(e,o)=>{const i=15*(e/o);return i<=4?4:i>=15?15:i};exports.AU_TO_VIZ_SCALER=c;exports.DAY_PER_VIZ_SEC=j;exports.ORBITAL_COLORS=r;exports.amor=g;exports.apollo=b;exports.atira=d;exports.auToMeters=E;exports.auToUnit=f;exports.convert2dTo3d=H;exports.degsToRads=a;exports.formatValue=P;exports.getAngleFromPos=S;exports.getCurve=y;exports.getFocus=L;exports.getLabelSize=V;exports.getLineGeometry=h;exports.getMinorAxis=x;exports.getPosFromArcLength=O;exports.getRefObjProps=T;exports.getVelocity=z;exports.unitToAu=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("three");function p(o){if(o&&o.__esModule)return o;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const s=p(f),c=100,j=1,r={sun:{objectColor:"#f8da86"},earth:{objectColor:"#3f9ef0",orbitColor:"#3079b8"},mars:{objectColor:"#ed4c4c",orbitColor:"#b53a3a"},jupiter:{objectColor:"#f1b571",orbitColor:"#b98b57"},neptune:{objectColor:"#3cae3f",orbitColor:"#29762b"},asteroid:{objectColor:"#b1f2ef",orbitColor:"#6a6e6e",objectHighlight:"#00ffff",orbitHighlight:"#ffffff"},neos:{objectColor:"#0ff",orbitColor:"#b2ffff"}},u={a:1.4700451,e:.5598234,i:6.35515,H:16.25,Ref:"Apollo",name:"Apollo",Principal_desig:"1932 HA",Translated_desig_key:"neo.apollo",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},d={a:.740919,e:.3221221,i:25.62023,H:16.3,Ref:"Atira",Principal_desig:"2003 CP20",Translated_desig_key:"neo.atira",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},g={a:1.9194158,e:.4353207,i:11.87658,H:17.7,Ref:"Amor",Principal_desig:"1932 EA1",Translated_desig_key:"neo.amor",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},_={a:1,e:.01671022,i:0,H:-3.9,Ref:"Earth",Principal_desig:"Earth",Translated_desig_key:"planets.earth",orbitColor:r.earth.orbitColor,objectColor:r.earth.objectColor,objectRadius:5},m={a:1.52366231,e:.09341233,i:1.85061,H:-1.52,Ref:"Mars",Principal_desig:"Mars",Translated_desig_key:"planets.mars",orbitColor:r.mars.orbitColor,objectColor:r.mars.objectColor,objectRadius:4},A={a:5.2028,e:.048,i:1.31,H:-25.9,Ref:"Jupiter",Principal_desig:"Jupiter",Translated_desig_key:"planets.jupiter",orbitColor:r.jupiter.orbitColor,objectColor:r.jupiter.objectColor,objectRadius:7},R={a:30.06896348,e:.00858587,i:1.76917,H:-25.9,Ref:"Neptune",Principal_desig:"Neptune",Translated_desig_key:"planets.neptune",orbitColor:r.neptune.orbitColor,objectColor:r.neptune.objectColor,objectRadius:6},T=o=>({neptune:R,earth:_,mars:m,jupiter:A,atira:d,apollo:u,amor:g})[o]||null,P=function(o,e){return Number.parseFloat(Number.parseFloat(o).toFixed(e))},y=(o,e,t=0,n=0)=>new s.EllipseCurve(t,n,o,e,0,2*Math.PI,!1,0),h=(o,e)=>{const t=o.distanceTo(e),{x:n,y:i}=o;return Math.acos((t**2+n**2-i**2)/(2*t*n))*180/Math.PI},S=(o,e)=>{const{x:t,y:n}=e.getPoint(o);return new s.Vector3(t,n,0)},C=o=>o*c,O=o=>o/c,M=(o,e)=>C(o*Math.sqrt(1-e**2)),x=o=>1496e8*o,a=o=>o*(Math.PI/180),E=(o,e)=>{const t=.000296005155*c**3;return Math.sqrt(t*(2/o-1/e))},z=(o,e)=>Math.sqrt(o**2-e**2),H=(o,e)=>{const{i:t,Peri:n,Node:i}=e,l=new s.Vector3(0,1,0),b=new s.Vector3(0,0,1);return new s.Vector3(o.x,o.y,0).applyAxisAngle(b,n?a(n+90):0).applyAxisAngle(l,a(t)).applyAxisAngle(b,i?a(i):0)},V=(o,e)=>{const i=15*(o/e);return i<=12?12:i>=15?15:i};exports.AU_TO_VIZ_SCALER=c;exports.DAY_PER_VIZ_SEC=j;exports.ORBITAL_COLORS=r;exports.amor=g;exports.apollo=u;exports.atira=d;exports.auToMeters=x;exports.auToUnit=C;exports.convert2dTo3d=H;exports.degsToRads=a;exports.formatValue=P;exports.getAngleFromPos=h;exports.getCurve=y;exports.getFocus=z;exports.getLabelSize=V;exports.getMinorAxis=M;exports.getPosFromArcLength=S;exports.getRefObjProps=T;exports.getVelocity=E;exports.unitToAu=O;
@@ -63,7 +63,7 @@ const l = 100, m = 1, t = {
63
63
  orbitColor: t.neos.orbitColor,
64
64
  objectColor: t.neos.objectColor,
65
65
  objectRadius: 5
66
- }, f = {
66
+ }, p = {
67
67
  a: 1,
68
68
  e: 0.01671022,
69
69
  i: 0,
@@ -74,7 +74,7 @@ const l = 100, m = 1, t = {
74
74
  orbitColor: t.earth.orbitColor,
75
75
  objectColor: t.earth.objectColor,
76
76
  objectRadius: 5
77
- }, p = {
77
+ }, f = {
78
78
  a: 1.52366231,
79
79
  e: 0.09341233,
80
80
  i: 1.85061,
@@ -85,7 +85,7 @@ const l = 100, m = 1, t = {
85
85
  orbitColor: t.mars.orbitColor,
86
86
  objectColor: t.mars.objectColor,
87
87
  objectRadius: 4
88
- }, g = {
88
+ }, j = {
89
89
  a: 5.2028,
90
90
  e: 0.048,
91
91
  i: 1.31,
@@ -97,7 +97,7 @@ const l = 100, m = 1, t = {
97
97
  objectColor: t.jupiter.objectColor,
98
98
  // objectRadius: 69911000,
99
99
  objectRadius: 7
100
- }, j = {
100
+ }, g = {
101
101
  a: 30.06896348,
102
102
  e: 858587e-8,
103
103
  i: 1.76917,
@@ -110,10 +110,10 @@ const l = 100, m = 1, t = {
110
110
  // objectRadius: 24622000,
111
111
  objectRadius: 6
112
112
  }, R = (o) => ({
113
- neptune: j,
114
- earth: f,
115
- mars: p,
116
- jupiter: g,
113
+ neptune: g,
114
+ earth: p,
115
+ mars: f,
116
+ jupiter: j,
117
117
  atira: C,
118
118
  apollo: u,
119
119
  amor: d
@@ -136,24 +136,24 @@ const l = 100, m = 1, t = {
136
136
  // aClockwise
137
137
  0
138
138
  // aRotation
139
- ), P = (o) => new s.BufferGeometry().setFromPoints(o), y = (o, e) => {
139
+ ), P = (o, e) => {
140
140
  const r = o.distanceTo(e), { x: n, y: i } = o;
141
141
  return Math.acos((r ** 2 + n ** 2 - i ** 2) / (2 * r * n)) * 180 / Math.PI;
142
142
  }, T = (o, e) => {
143
143
  const { x: r, y: n } = e.getPoint(o);
144
144
  return new s.Vector3(r, n, 0);
145
- }, _ = (o) => o * l, x = (o) => o / l, M = (o, e) => _(o * Math.sqrt(1 - e ** 2)), S = (o) => 1496e8 * o, a = (o) => o * (Math.PI / 180), z = (o, e) => {
145
+ }, _ = (o) => o * l, x = (o) => o / l, y = (o, e) => _(o * Math.sqrt(1 - e ** 2)), M = (o) => 1496e8 * o, a = (o) => o * (Math.PI / 180), S = (o, e) => {
146
146
  const r = 296005155e-12 * l ** 3;
147
147
  return Math.sqrt(r * (2 / o - 1 / e));
148
- }, H = (o, e) => Math.sqrt(o ** 2 - e ** 2), E = (o, e) => {
148
+ }, z = (o, e) => Math.sqrt(o ** 2 - e ** 2), H = (o, e) => {
149
149
  const { i: r, Peri: n, Node: i } = e, c = new s.Vector3(0, 1, 0), b = new s.Vector3(0, 0, 1);
150
150
  return new s.Vector3(o.x, o.y, 0).applyAxisAngle(b, n ? a(n + 90) : 0).applyAxisAngle(c, a(r)).applyAxisAngle(
151
151
  b,
152
152
  i ? a(i) : 0
153
153
  );
154
- }, V = (o, e) => {
154
+ }, E = (o, e) => {
155
155
  const i = 15 * (o / e);
156
- return i <= 4 ? 4 : i >= 15 ? 15 : i;
156
+ return i <= 12 ? 12 : i >= 15 ? 15 : i;
157
157
  };
158
158
  export {
159
159
  l as AU_TO_VIZ_SCALER,
@@ -162,19 +162,18 @@ export {
162
162
  d as amor,
163
163
  u as apollo,
164
164
  C as atira,
165
- S as auToMeters,
165
+ M as auToMeters,
166
166
  _ as auToUnit,
167
- E as convert2dTo3d,
167
+ H as convert2dTo3d,
168
168
  a as degsToRads,
169
169
  A as formatValue,
170
- y as getAngleFromPos,
170
+ P as getAngleFromPos,
171
171
  h as getCurve,
172
- H as getFocus,
173
- V as getLabelSize,
174
- P as getLineGeometry,
175
- M as getMinorAxis,
172
+ z as getFocus,
173
+ E as getLabelSize,
174
+ y as getMinorAxis,
176
175
  T as getPosFromArcLength,
177
176
  R as getRefObjProps,
178
- z as getVelocity,
177
+ S as getVelocity,
179
178
  x as unitToAu
180
179
  };
@@ -45,7 +45,7 @@
45
45
  position: relative;
46
46
  z-index: 1;
47
47
  `,d=e.default.div`
48
- padding: 2px 4px;
48
+ padding: 0px 4px;
49
49
  margin-top: 4px;
50
50
  font-weight: var(--medium);
51
51
  color: var(--black);
@@ -48,7 +48,7 @@ const o = t`
48
48
  position: relative;
49
49
  z-index: 1;
50
50
  `, d = e.div`
51
- padding: 2px 4px;
51
+ padding: 0px 4px;
52
52
  margin-top: 4px;
53
53
  font-weight: var(--medium);
54
54
  color: var(--black);
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),l=require("react"),G=require("react-i18next"),J=require("../../layout/AspectRatio/index.cjs"),K=require("../../atomic/Loader/index.cjs"),Q=require("@rubin-epo/epo-react-lib/IconComposer"),U=require("./MovingSourceMap/index.cjs"),k=require("./utils.cjs"),Z=require("./styles.cjs"),O=require("../../hooks/useInterval.cjs"),ee=require("./Message/Message.cjs"),te=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),se=e=>e&&e.__esModule?e:{default:e},ne=se(Q),oe=(e,n)=>{var d;const t={day:0,hour:0},s=e[n];if(!s)return t;const c=(s==null?void 0:s.date)-((d=e[0])==null?void 0:d.date);return c?{day:Math.round(c)||0,hour:Math.round(24/c%24)||0}:t},re=(e,n,t)=>Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2)<=Math.pow(t,2),ce=(e,n,t)=>t?e[n]?[e[n].image]:[]:e.map(({image:s})=>s),y=({width:e=600,height:n=600,selectedSource:t=[],alerts:s=[],activeAlertIndex:c=0,alertChangeCallback:d,selectionCallback:q,blinkConfig:_,isDisplayOnly:i=!1,isLoading:P,className:w,movingSources:u=[]})=>{const[f,b]=l.useState(0),[B,F]=l.useState(!0),[p,L]=l.useState(!i),[R,I]=l.useState(),[T,m]=l.useState(!1),{t:S}=G.useTranslation(),j=!B&&!P,V=(r,g,h)=>{if(u)for(let a of u){const x=a.sources[f];if(re(r,{x:k.toDecimalPercent(x.x)*g,y:k.toDecimalPercent(x.y)*h},k.getRadius(a.type,a.radius)*g))return a.id}},v=()=>{I(S("source_selector.messages.failure")),m(!0)},N=()=>{L(r=>!r)},W=()=>{I(o.jsxs(o.Fragment,{children:[o.jsx(ne.default,{icon:"checkmark"}),S("source_selector.messages.success")]})),m(!0)},$=({clientX:r,clientY:g,target:h})=>{if(!j||i)return;const{tagName:a,clientWidth:x,clientHeight:C}=h;if(a.toLowerCase()!=="img")return;const{left:Y,top:A}=h.getBoundingClientRect(),M=V({x:r-Y,y:C-g+A},x,C);if(M){if(t.includes(M))return;q&&q(t.concat(M)),W()}else v()},z=()=>{m(!1)},{day:D,hour:E}=oe(s,c),H=ce(s,c,i),X=()=>{p&&(f>u[0].sources.length-2?b(0):b(r=>r+1))};return O.default(X,500),o.jsxs(J.default,{ratio:1,className:w,children:[!i&&o.jsx(ee.default,{onMessageChangeCallback:z,isVisible:T,children:R}),u&&o.jsx(Z.BackgroundBlinker,{images:H,activeIndex:f,blinkCallback:d,loadedCallback:()=>F(!1),onClickCallback:$,extraControls:s.length>0&&!i&&o.jsx(te.default,{day:D,hour:E}),interval:400,pauseCallback:N,..._,children:o.jsx(U.default,{width:e,height:n,isPlaying:p,currentIndex:f,movingSources:u,selectedSource:t})}),!j&&o.jsx(K.default,{})]})};y.displayName="Widgets.MovingSourceSelector";exports.default=y;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),h=require("react"),Y=require("react-i18next"),G=require("../../layout/AspectRatio/index.cjs"),J=require("../../atomic/Loader/index.cjs"),K=require("@rubin-epo/epo-react-lib/IconComposer"),Q=require("./MovingSourceMap/index.cjs"),C=require("./utils.cjs"),U=require("./styles.cjs"),Z=require("./Message/Message.cjs"),v=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),A=e=>e&&e.__esModule?e:{default:e},O=A(K),ee=(e,n)=>{var u;const t={day:0,hour:0},s=e[n];if(!s)return t;const o=(s==null?void 0:s.date)-((u=e[0])==null?void 0:u.date);return o?{day:Math.round(o)||0,hour:Math.round(24/o%24)||0}:t},te=(e,n,t)=>Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2)<=Math.pow(t,2),se=(e,n,t)=>t?e[n]?[e[n].image]:[]:e.map(({image:s})=>s),S=({width:e=600,height:n=600,selectedSource:t=[],alerts:s=[],activeAlertIndex:o=0,alertChangeCallback:u,selectionCallback:k,blinkConfig:j,isDisplayOnly:a=!1,isLoading:y,className:_,movingSources:l=[]})=>{const[P,I]=h.useState(!0),[w,F]=h.useState(!a),[L,b]=h.useState(),[B,m]=h.useState(!1),{t:p}=Y.useTranslation(),q=!P&&!y,R=(i,d,f)=>{if(l)for(let c of l){const g=c.sources[o];if(te(i,{x:C.toDecimalPercent(g.x)*d,y:C.toDecimalPercent(g.y)*f},C.getRadius(c.type,c.radius)*d))return c.id}},T=()=>{b(p("source_selector.messages.failure")),m(!0)},V=()=>{F(i=>!i)},N=()=>{b(r.jsxs(r.Fragment,{children:[r.jsx(O.default,{icon:"checkmark"}),p("source_selector.messages.success")]})),m(!0)},W=({clientX:i,clientY:d,target:f})=>{if(!q||a)return;const{tagName:c,clientWidth:g,clientHeight:x}=f;if(c.toLowerCase()!=="img")return;const{left:H,top:X}=f.getBoundingClientRect(),M=R({x:i-H,y:x-d+X},g,x);if(M){if(t.includes(M))return;k&&k(t.concat(M)),N()}else T()},$=()=>{m(!1)},{day:z,hour:D}=ee(s,o),E=se(s,o,a);return r.jsxs(G.default,{ratio:1,className:_,children:[!a&&r.jsx(Z.default,{onMessageChangeCallback:$,isVisible:B,children:L}),l&&r.jsx(U.BackgroundBlinker,{images:E,activeIndex:o,blinkCallback:u,loadedCallback:()=>I(!1),onClickCallback:W,extraControls:s.length>0&&!a&&r.jsx(v.default,{day:z,hour:D}),interval:400,pauseCallback:V,...j,children:r.jsx(Q.default,{width:e,height:n,isPlaying:w,currentIndex:o,movingSources:l,selectedSource:t})}),!q&&r.jsx(J.default,{})]})};S.displayName="Widgets.MovingSourceSelector";exports.default=S;
@@ -1,129 +1,126 @@
1
1
  "use client";
2
- import { jsxs as B, jsx as a, Fragment as J } from "react/jsx-runtime";
3
- import { useState as u } from "react";
2
+ import { jsxs as S, jsx as i, Fragment as J } from "react/jsx-runtime";
3
+ import { useState as g } from "react";
4
4
  import { useTranslation as K } from "react-i18next";
5
5
  import Q from "../../layout/AspectRatio/index.js";
6
6
  import U from "../../atomic/Loader/index.js";
7
7
  import Z from "@rubin-epo/epo-react-lib/IconComposer";
8
8
  import $ from "./MovingSourceMap/index.js";
9
- import { getRadius as D, toDecimalPercent as L } from "./utils.js";
10
- import { BackgroundBlinker as O } from "./styles.js";
11
- import ee from "../../hooks/useInterval.js";
12
- import te from "./Message/Message.js";
13
- import oe from "../../atomic/ElapsedTime/ElapsedTime.js";
14
- const ne = (e, n) => {
15
- var d;
16
- const t = { day: 0, hour: 0 }, o = e[n];
17
- if (!o) return t;
18
- const r = (o == null ? void 0 : o.date) - ((d = e[0]) == null ? void 0 : d.date);
9
+ import { getRadius as D, toDecimalPercent as x } from "./utils.js";
10
+ import { BackgroundBlinker as v } from "./styles.js";
11
+ import A from "./Message/Message.js";
12
+ import O from "../../atomic/ElapsedTime/ElapsedTime.js";
13
+ const ee = (e, s) => {
14
+ var u;
15
+ const o = { day: 0, hour: 0 }, t = e[s];
16
+ if (!t) return o;
17
+ const r = (t == null ? void 0 : t.date) - ((u = e[0]) == null ? void 0 : u.date);
19
18
  return r ? {
20
19
  day: Math.round(r) || 0,
21
20
  hour: Math.round(24 / r % 24) || 0
22
- } : t;
23
- }, se = (e, n, t) => Math.pow(e.x - n.x, 2) + Math.pow(e.y - n.y, 2) <= Math.pow(t, 2), re = (e, n, t) => t ? e[n] ? [e[n].image] : [] : e.map(({ image: o }) => o), ie = ({
21
+ } : o;
22
+ }, oe = (e, s, o) => Math.pow(e.x - s.x, 2) + Math.pow(e.y - s.y, 2) <= Math.pow(o, 2), te = (e, s, o) => o ? e[s] ? [e[s].image] : [] : e.map(({ image: t }) => t), se = ({
24
23
  width: e = 600,
25
- height: n = 600,
26
- selectedSource: t = [],
27
- alerts: o = [],
24
+ height: s = 600,
25
+ selectedSource: o = [],
26
+ alerts: t = [],
28
27
  activeAlertIndex: r = 0,
29
- alertChangeCallback: d,
30
- selectionCallback: M,
31
- blinkConfig: P,
32
- isDisplayOnly: c = !1,
33
- isLoading: w,
34
- className: F,
28
+ alertChangeCallback: u,
29
+ selectionCallback: C,
30
+ blinkConfig: L,
31
+ isDisplayOnly: a = !1,
32
+ isLoading: P,
33
+ className: w,
35
34
  movingSources: l = []
36
35
  }) => {
37
- const [f, x] = u(0), [R, V] = u(!0), [b, j] = u(!c), [N, I] = u(), [T, p] = u(!1), { t: y } = K(), S = !R && !w, W = (s, m, g) => {
36
+ const [F, I] = g(!0), [B, R] = g(!a), [V, k] = g(), [j, h] = g(!1), { t: b } = K(), y = !F && !P, N = (c, d, f) => {
38
37
  if (l)
39
- for (let i of l) {
40
- const h = i.sources[f];
41
- if (se(
42
- s,
38
+ for (let n of l) {
39
+ const m = n.sources[r];
40
+ if (oe(
41
+ c,
43
42
  {
44
- x: L(h.x) * m,
45
- y: L(h.y) * g
43
+ x: x(m.x) * d,
44
+ y: x(m.y) * f
46
45
  },
47
- D(i.type, i.radius) * m
46
+ D(n.type, n.radius) * d
48
47
  ))
49
- return i.id;
48
+ return n.id;
50
49
  }
50
+ }, T = () => {
51
+ k(b("source_selector.messages.failure")), h(!0);
52
+ }, W = () => {
53
+ R((c) => !c);
51
54
  }, _ = () => {
52
- I(y("source_selector.messages.failure")), p(!0);
53
- }, v = () => {
54
- j((s) => !s);
55
- }, z = () => {
56
- I(
57
- /* @__PURE__ */ B(J, { children: [
58
- /* @__PURE__ */ a(Z, { icon: "checkmark" }),
59
- y("source_selector.messages.success")
55
+ k(
56
+ /* @__PURE__ */ S(J, { children: [
57
+ /* @__PURE__ */ i(Z, { icon: "checkmark" }),
58
+ b("source_selector.messages.success")
60
59
  ] })
61
- ), p(!0);
62
- }, A = ({
63
- clientX: s,
64
- clientY: m,
65
- target: g
60
+ ), h(!0);
61
+ }, z = ({
62
+ clientX: c,
63
+ clientY: d,
64
+ target: f
66
65
  }) => {
67
- if (!S || c) return;
66
+ if (!y || a) return;
68
67
  const {
69
- tagName: i,
70
- clientWidth: h,
71
- clientHeight: k
72
- } = g;
73
- if (i.toLowerCase() !== "img") return;
74
- const { left: q, top: G } = g.getBoundingClientRect(), C = W(
75
- { x: s - q, y: k - m + G },
76
- h,
77
- k
68
+ tagName: n,
69
+ clientWidth: m,
70
+ clientHeight: p
71
+ } = f;
72
+ if (n.toLowerCase() !== "img") return;
73
+ const { left: q, top: G } = f.getBoundingClientRect(), M = N(
74
+ { x: c - q, y: p - d + G },
75
+ m,
76
+ p
78
77
  );
79
- if (C) {
80
- if (t.includes(C)) return;
81
- M && M(t.concat(C)), z();
78
+ if (M) {
79
+ if (o.includes(M)) return;
80
+ C && C(o.concat(M)), _();
82
81
  } else
83
- _();
82
+ T();
84
83
  }, E = () => {
85
- p(!1);
86
- }, { day: H, hour: X } = ne(o, r), Y = re(o, r, c);
87
- return ee(() => {
88
- b && (f > l[0].sources.length - 2 ? x(0) : x((s) => s + 1));
89
- }, 500), /* @__PURE__ */ B(Q, { ratio: 1, className: F, children: [
90
- !c && /* @__PURE__ */ a(
91
- te,
84
+ h(!1);
85
+ }, { day: H, hour: X } = ee(t, r), Y = te(t, r, a);
86
+ return /* @__PURE__ */ S(Q, { ratio: 1, className: w, children: [
87
+ !a && /* @__PURE__ */ i(
88
+ A,
92
89
  {
93
90
  onMessageChangeCallback: E,
94
- isVisible: T,
95
- children: N
91
+ isVisible: j,
92
+ children: V
96
93
  }
97
94
  ),
98
- l && /* @__PURE__ */ a(
99
- O,
95
+ l && /* @__PURE__ */ i(
96
+ v,
100
97
  {
101
98
  images: Y,
102
- activeIndex: f,
103
- blinkCallback: d,
104
- loadedCallback: () => V(!1),
105
- onClickCallback: A,
106
- extraControls: o.length > 0 && !c && /* @__PURE__ */ a(oe, { day: H, hour: X }),
99
+ activeIndex: r,
100
+ blinkCallback: u,
101
+ loadedCallback: () => I(!1),
102
+ onClickCallback: z,
103
+ extraControls: t.length > 0 && !a && /* @__PURE__ */ i(O, { day: H, hour: X }),
107
104
  interval: 400,
108
- pauseCallback: v,
109
- ...P,
110
- children: /* @__PURE__ */ a(
105
+ pauseCallback: W,
106
+ ...L,
107
+ children: /* @__PURE__ */ i(
111
108
  $,
112
109
  {
113
110
  width: e,
114
- height: n,
115
- isPlaying: b,
116
- currentIndex: f,
111
+ height: s,
112
+ isPlaying: B,
113
+ currentIndex: r,
117
114
  movingSources: l,
118
- selectedSource: t
115
+ selectedSource: o
119
116
  }
120
117
  )
121
118
  }
122
119
  ),
123
- !S && /* @__PURE__ */ a(U, {})
120
+ !y && /* @__PURE__ */ i(U, {})
124
121
  ] });
125
122
  };
126
- ie.displayName = "Widgets.MovingSourceSelector";
123
+ se.displayName = "Widgets.MovingSourceSelector";
127
124
  export {
128
- ie as default
125
+ se as default
129
126
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",
@@ -102,8 +102,7 @@
102
102
  "dependencies": {
103
103
  "@react-three/drei": "^10.7.6",
104
104
  "@react-three/fiber": "9",
105
- "@rubin-epo/epo-react-lib": "3.0.2",
106
- "@rubin-epo/epo-widget-lib": "2.0.2",
105
+ "@rubin-epo/epo-react-lib": "3.0.3",
107
106
  "context-filter-polyfill": "^0.3.6",
108
107
  "d3-array": "^3.2.4",
109
108
  "d3-geo": "^3.1.1",