@cos-design/weather-background 3.5.5 → 4.0.0
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.
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1527 -0
- package/dist/core/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/core/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/{packages → core/packages}/shared/src/index.d.ts +4 -3
- package/dist/{packages → core/packages}/shared/src/math.d.ts +1 -0
- package/dist/{packages/shared/src/use-element-size.d.ts → core/packages/shared/src/react/index.d.ts} +4 -19
- package/dist/core/packages/weatherBackground/src/core.d.ts +1 -0
- package/dist/core/packages/weatherBackground/src/element.d.ts +1 -0
- package/dist/{packages → core/packages}/weatherBackground/src/index.d.ts +8 -8
- package/dist/core/packages/weatherBackground/src/react.d.ts +15 -0
- package/dist/core/packages/weatherBackground/src/vue.d.ts +2 -0
- package/dist/core/src/components/weatherBackground/core/engine.d.ts +2 -0
- package/dist/core/src/components/weatherBackground/core/index.d.ts +14 -0
- package/dist/core/src/components/weatherBackground/core/types.d.ts +7 -0
- package/dist/core/src/components/weatherBackground/element/index.d.ts +13 -0
- package/dist/core/src/components/weatherBackground/index.d.ts +5 -0
- package/dist/{src/components/weatherBackground/live-weather.d.ts → core/src/components/weatherBackground/live-weather-core.d.ts} +8 -10
- package/dist/core/src/components/weatherBackground/live-weather.d.ts +15 -0
- package/dist/core/src/components/weatherBackground/react/index.d.ts +3 -0
- package/dist/{src → core/src}/vite-env.d.ts +6 -0
- package/dist/element/element.css +1 -0
- package/dist/element/index.d.ts +1 -0
- package/dist/element/index.js +1541 -0
- package/dist/element/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/element/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/element/packages/shared/src/index.d.ts +11 -0
- package/dist/element/packages/shared/src/math.d.ts +2 -0
- package/dist/element/packages/shared/src/photo.d.ts +15 -0
- package/dist/element/packages/shared/src/pointer.d.ts +14 -0
- package/dist/element/packages/shared/src/react/index.d.ts +30 -0
- package/dist/element/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/element/packages/shared/src/size.d.ts +8 -0
- package/dist/element/packages/shared/src/visibility.d.ts +2 -0
- package/dist/element/packages/weatherBackground/src/core.d.ts +1 -0
- package/dist/element/packages/weatherBackground/src/element.d.ts +1 -0
- package/dist/element/packages/weatherBackground/src/index.d.ts +15 -0
- package/dist/element/packages/weatherBackground/src/react.d.ts +15 -0
- package/dist/element/packages/weatherBackground/src/vue.d.ts +2 -0
- package/dist/element/src/components/weatherBackground/configs.d.ts +9 -0
- package/dist/element/src/components/weatherBackground/core/engine.d.ts +2 -0
- package/dist/element/src/components/weatherBackground/core/index.d.ts +14 -0
- package/dist/element/src/components/weatherBackground/core/types.d.ts +7 -0
- package/dist/element/src/components/weatherBackground/day-cycle.d.ts +53 -0
- package/dist/element/src/components/weatherBackground/element/index.d.ts +13 -0
- package/dist/element/src/components/weatherBackground/fog.d.ts +25 -0
- package/dist/element/src/components/weatherBackground/hail-level.d.ts +24 -0
- package/dist/element/src/components/weatherBackground/index.d.ts +5 -0
- package/dist/element/src/components/weatherBackground/lightning.d.ts +1 -0
- package/dist/element/src/components/weatherBackground/live-weather-core.d.ts +79 -0
- package/dist/element/src/components/weatherBackground/live-weather.d.ts +15 -0
- package/dist/element/src/components/weatherBackground/precipitation.d.ts +51 -0
- package/dist/element/src/components/weatherBackground/react/index.d.ts +3 -0
- package/dist/element/src/components/weatherBackground/scene/create-weather-scene.d.ts +2 -0
- package/dist/element/src/components/weatherBackground/scene/draw-atmosphere.d.ts +4 -0
- package/dist/element/src/components/weatherBackground/scene/draw-effects.d.ts +3 -0
- package/dist/element/src/components/weatherBackground/scene/draw-precipitation.d.ts +4 -0
- package/dist/element/src/components/weatherBackground/scene/draw-sky.d.ts +4 -0
- package/dist/element/src/components/weatherBackground/scene/init-state.d.ts +44 -0
- package/dist/element/src/components/weatherBackground/scene/runtime.d.ts +38 -0
- package/dist/element/src/components/weatherBackground/smog.d.ts +17 -0
- package/dist/element/src/components/weatherBackground/sprites/celestial.d.ts +11 -0
- package/dist/element/src/components/weatherBackground/sprites/cloud.d.ts +20 -0
- package/dist/element/src/components/weatherBackground/sprites/hail.d.ts +11 -0
- package/dist/element/src/components/weatherBackground/sprites/snow.d.ts +8 -0
- package/dist/element/src/components/weatherBackground/types.d.ts +230 -0
- package/dist/element/src/components/weatherBackground/wind.d.ts +68 -0
- package/dist/element/src/vite-env.d.ts +45 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +89 -0
- package/dist/{index.js → react/index.js} +444 -424
- package/dist/react/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/react/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/react/packages/shared/src/index.d.ts +11 -0
- package/dist/react/packages/shared/src/math.d.ts +2 -0
- package/dist/react/packages/shared/src/photo.d.ts +15 -0
- package/dist/react/packages/shared/src/pointer.d.ts +14 -0
- package/dist/react/packages/shared/src/react/index.d.ts +30 -0
- package/dist/react/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/react/packages/shared/src/size.d.ts +8 -0
- package/dist/react/packages/shared/src/visibility.d.ts +2 -0
- package/dist/react/packages/weatherBackground/src/core.d.ts +1 -0
- package/dist/react/packages/weatherBackground/src/element.d.ts +1 -0
- package/dist/react/packages/weatherBackground/src/index.d.ts +15 -0
- package/dist/react/packages/weatherBackground/src/react.d.ts +15 -0
- package/dist/react/packages/weatherBackground/src/vue.d.ts +2 -0
- package/dist/react/react.css +1 -0
- package/dist/react/src/components/weatherBackground/configs.d.ts +9 -0
- package/dist/react/src/components/weatherBackground/core/engine.d.ts +2 -0
- package/dist/react/src/components/weatherBackground/core/index.d.ts +14 -0
- package/dist/react/src/components/weatherBackground/core/types.d.ts +7 -0
- package/dist/react/src/components/weatherBackground/day-cycle.d.ts +53 -0
- package/dist/react/src/components/weatherBackground/element/index.d.ts +13 -0
- package/dist/react/src/components/weatherBackground/fog.d.ts +25 -0
- package/dist/react/src/components/weatherBackground/hail-level.d.ts +24 -0
- package/dist/react/src/components/weatherBackground/index.d.ts +5 -0
- package/dist/react/src/components/weatherBackground/lightning.d.ts +1 -0
- package/dist/react/src/components/weatherBackground/live-weather-core.d.ts +79 -0
- package/dist/react/src/components/weatherBackground/live-weather.d.ts +15 -0
- package/dist/react/src/components/weatherBackground/precipitation.d.ts +51 -0
- package/dist/react/src/components/weatherBackground/react/index.d.ts +3 -0
- package/dist/react/src/components/weatherBackground/scene/create-weather-scene.d.ts +2 -0
- package/dist/react/src/components/weatherBackground/scene/draw-atmosphere.d.ts +4 -0
- package/dist/react/src/components/weatherBackground/scene/draw-effects.d.ts +3 -0
- package/dist/react/src/components/weatherBackground/scene/draw-precipitation.d.ts +4 -0
- package/dist/react/src/components/weatherBackground/scene/draw-sky.d.ts +4 -0
- package/dist/react/src/components/weatherBackground/scene/init-state.d.ts +44 -0
- package/dist/react/src/components/weatherBackground/scene/runtime.d.ts +38 -0
- package/dist/react/src/components/weatherBackground/smog.d.ts +17 -0
- package/dist/react/src/components/weatherBackground/sprites/celestial.d.ts +11 -0
- package/dist/react/src/components/weatherBackground/sprites/cloud.d.ts +20 -0
- package/dist/react/src/components/weatherBackground/sprites/hail.d.ts +11 -0
- package/dist/react/src/components/weatherBackground/sprites/snow.d.ts +8 -0
- package/dist/react/src/components/weatherBackground/types.d.ts +230 -0
- package/dist/react/src/components/weatherBackground/wind.d.ts +68 -0
- package/dist/react/src/vite-env.d.ts +45 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +1517 -0
- package/dist/vue/packages/shared/src/canvas-box.d.ts +18 -0
- package/dist/vue/packages/shared/src/host-layout.d.ts +22 -0
- package/dist/vue/packages/shared/src/index.d.ts +11 -0
- package/dist/vue/packages/shared/src/math.d.ts +2 -0
- package/dist/vue/packages/shared/src/photo.d.ts +15 -0
- package/dist/vue/packages/shared/src/pointer.d.ts +14 -0
- package/dist/vue/packages/shared/src/react/index.d.ts +30 -0
- package/dist/vue/packages/shared/src/reduced-motion.d.ts +4 -0
- package/dist/vue/packages/shared/src/size.d.ts +8 -0
- package/dist/vue/packages/shared/src/visibility.d.ts +2 -0
- package/dist/vue/packages/weatherBackground/src/core.d.ts +1 -0
- package/dist/vue/packages/weatherBackground/src/element.d.ts +1 -0
- package/dist/vue/packages/weatherBackground/src/index.d.ts +15 -0
- package/dist/vue/packages/weatherBackground/src/react.d.ts +15 -0
- package/dist/vue/packages/weatherBackground/src/vue.d.ts +2 -0
- package/dist/vue/src/components/weatherBackground/configs.d.ts +9 -0
- package/dist/vue/src/components/weatherBackground/core/engine.d.ts +2 -0
- package/dist/vue/src/components/weatherBackground/core/index.d.ts +14 -0
- package/dist/vue/src/components/weatherBackground/core/types.d.ts +7 -0
- package/dist/vue/src/components/weatherBackground/day-cycle.d.ts +53 -0
- package/dist/vue/src/components/weatherBackground/element/index.d.ts +13 -0
- package/dist/vue/src/components/weatherBackground/fog.d.ts +25 -0
- package/dist/vue/src/components/weatherBackground/hail-level.d.ts +24 -0
- package/dist/vue/src/components/weatherBackground/index.d.ts +5 -0
- package/dist/vue/src/components/weatherBackground/lightning.d.ts +1 -0
- package/dist/vue/src/components/weatherBackground/live-weather-core.d.ts +79 -0
- package/dist/vue/src/components/weatherBackground/live-weather.d.ts +15 -0
- package/dist/vue/src/components/weatherBackground/precipitation.d.ts +51 -0
- package/dist/vue/src/components/weatherBackground/react/index.d.ts +3 -0
- package/dist/vue/src/components/weatherBackground/scene/create-weather-scene.d.ts +2 -0
- package/dist/vue/src/components/weatherBackground/scene/draw-atmosphere.d.ts +4 -0
- package/dist/vue/src/components/weatherBackground/scene/draw-effects.d.ts +3 -0
- package/dist/vue/src/components/weatherBackground/scene/draw-precipitation.d.ts +4 -0
- package/dist/vue/src/components/weatherBackground/scene/draw-sky.d.ts +4 -0
- package/dist/vue/src/components/weatherBackground/scene/init-state.d.ts +44 -0
- package/dist/vue/src/components/weatherBackground/scene/runtime.d.ts +38 -0
- package/dist/vue/src/components/weatherBackground/smog.d.ts +17 -0
- package/dist/vue/src/components/weatherBackground/sprites/celestial.d.ts +11 -0
- package/dist/vue/src/components/weatherBackground/sprites/cloud.d.ts +20 -0
- package/dist/vue/src/components/weatherBackground/sprites/hail.d.ts +11 -0
- package/dist/vue/src/components/weatherBackground/sprites/snow.d.ts +8 -0
- package/dist/vue/src/components/weatherBackground/types.d.ts +230 -0
- package/dist/vue/src/components/weatherBackground/wind.d.ts +68 -0
- package/dist/vue/src/vite-env.d.ts +45 -0
- package/dist/vue/vue.css +1 -0
- package/package.json +43 -11
- package/dist/index.cjs +0 -1
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/src/components/weatherBackground/index.d.ts +0 -5
- /package/dist/{packages → core/packages}/shared/src/photo.d.ts +0 -0
- /package/dist/{packages → core/packages}/shared/src/pointer.d.ts +0 -0
- /package/dist/{packages → core/packages}/shared/src/reduced-motion.d.ts +0 -0
- /package/dist/{packages → core/packages}/shared/src/size.d.ts +0 -0
- /package/dist/{packages → core/packages}/shared/src/visibility.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/configs.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/day-cycle.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/fog.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/hail-level.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/lightning.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/precipitation.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/scene/create-weather-scene.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/scene/draw-atmosphere.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/scene/draw-effects.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/scene/draw-precipitation.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/scene/draw-sky.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/scene/init-state.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/scene/runtime.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/smog.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/sprites/celestial.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/sprites/cloud.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/sprites/hail.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/sprites/snow.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/types.d.ts +0 -0
- /package/dist/{src → core/src}/components/weatherBackground/wind.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { bindVisibilityPause as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import './
|
|
5
|
-
var
|
|
1
|
+
import { forwardRef as e, useEffect as t, useImperativeHandle as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
2
|
+
import { applyCanvasHostBox as o, bindPrefersReducedMotion as s, bindVisibilityPause as c, observeElementSize as l, optionsFingerprint as u, prefersReducedMotion as d, resolveCanvasBoxSize as f } from "@cos-design/shared";
|
|
3
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
4
|
+
import './react.css';//#region src/components/weatherBackground/day-cycle.ts
|
|
5
|
+
var m = (e) => Math.min(1, Math.max(0, e)), h = (e) => {
|
|
6
6
|
let t = e.replace("#", "").trim(), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
|
|
7
7
|
if (n.length !== 6) return [
|
|
8
8
|
80,
|
|
@@ -19,17 +19,17 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
19
19
|
r >> 8 & 255,
|
|
20
20
|
r & 255
|
|
21
21
|
];
|
|
22
|
-
},
|
|
22
|
+
}, g = ([e, t, n]) => {
|
|
23
23
|
let r = (e) => Math.min(255, Math.max(0, Math.round(e))).toString(16).padStart(2, "0");
|
|
24
24
|
return `#${r(e)}${r(t)}${r(n)}`;
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
],
|
|
30
|
-
let t =
|
|
25
|
+
}, _ = (e, t, n) => e + (t - e) * n, v = (e, t, n) => [
|
|
26
|
+
_(e[0], t[0], n),
|
|
27
|
+
_(e[1], t[1], n),
|
|
28
|
+
_(e[2], t[2], n)
|
|
29
|
+
], y = (e, t, n) => g(v(h(e), h(t), m(n))), b = (e) => {
|
|
30
|
+
let t = m(e);
|
|
31
31
|
return t * t * (3 - 2 * t);
|
|
32
|
-
},
|
|
32
|
+
}, x = (e = Date.now()) => {
|
|
33
33
|
let t = new Date(e), n = new Date(t);
|
|
34
34
|
n.setHours(6, 0, 0, 0);
|
|
35
35
|
let r = new Date(t);
|
|
@@ -37,52 +37,52 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
37
37
|
sunrise: n.getTime(),
|
|
38
38
|
sunset: r.getTime()
|
|
39
39
|
};
|
|
40
|
-
},
|
|
40
|
+
}, S = (e, t = /* @__PURE__ */ new Date()) => {
|
|
41
41
|
let n = e.trim().match(/^(\d{1,2}):(\d{2})$/);
|
|
42
42
|
if (!n) return null;
|
|
43
43
|
let r = Number(n[1]), i = Number(n[2]);
|
|
44
44
|
if (r < 0 || r > 23 || i < 0 || i > 59) return null;
|
|
45
45
|
let a = new Date(t);
|
|
46
46
|
return a.setHours(r, i, 0, 0), a.getTime();
|
|
47
|
-
},
|
|
47
|
+
}, C = (e, t = /* @__PURE__ */ new Date()) => S(e ?? "14:00", t) ?? S("14:00", t), w = (e, t) => {
|
|
48
48
|
let { sunrise: n, sunset: r } = t;
|
|
49
49
|
if (!(r > n)) {
|
|
50
|
-
let t =
|
|
50
|
+
let t = x(e);
|
|
51
51
|
n = t.sunrise, r = t.sunset;
|
|
52
52
|
}
|
|
53
|
-
let i = Math.max(1, r - n), a = n + 1440 * 60 * 1e3, o = r - 1440 * 60 * 1e3, s = e >= n && e < r,
|
|
54
|
-
if (s)
|
|
53
|
+
let i = Math.max(1, r - n), a = n + 1440 * 60 * 1e3, o = r - 1440 * 60 * 1e3, s = e >= n && e < r, c;
|
|
54
|
+
if (s) c = m((e - n) / i);
|
|
55
55
|
else if (e >= r) {
|
|
56
56
|
let t = Math.max(1, a - r);
|
|
57
|
-
|
|
57
|
+
c = m((e - r) / t);
|
|
58
58
|
} else {
|
|
59
59
|
let t = Math.max(1, n - o);
|
|
60
|
-
|
|
60
|
+
c = m((e - o) / t);
|
|
61
61
|
}
|
|
62
|
-
let
|
|
62
|
+
let l = s ? Math.sin(Math.PI * c) : 0, u = Math.abs(e - n), d = Math.abs(e - r), f = m(1 - Math.min(u, d) / 45e5);
|
|
63
63
|
return {
|
|
64
64
|
isDay: s,
|
|
65
|
-
arcProgress:
|
|
66
|
-
elevation:
|
|
67
|
-
twilight:
|
|
65
|
+
arcProgress: c,
|
|
66
|
+
elevation: l,
|
|
67
|
+
twilight: f
|
|
68
68
|
};
|
|
69
|
-
},
|
|
70
|
-
let r =
|
|
69
|
+
}, T = (e, t, n) => {
|
|
70
|
+
let r = m(n), i = Math.sin(Math.PI * r);
|
|
71
71
|
return {
|
|
72
72
|
x: e * (.1 + .8 * r),
|
|
73
73
|
y: t * (.58 - .4 * i)
|
|
74
74
|
};
|
|
75
|
-
},
|
|
75
|
+
}, E = "#e8895c", D = "#f3c98a", O = "#2a1f4a", k = "#c4784a", ee = (e, t, n) => {
|
|
76
76
|
if (n.isDay) {
|
|
77
|
-
let t =
|
|
78
|
-
return [
|
|
77
|
+
let t = b(n.elevation), r = (1 - t) * .72;
|
|
78
|
+
return [y(y(e[0], E, r), "#1a2438", (1 - t) * .12), y(y(e[1], D, r * .85), "#3a4558", (1 - t) * .08)];
|
|
79
79
|
}
|
|
80
80
|
let r = n.twilight;
|
|
81
|
-
return [
|
|
82
|
-
},
|
|
81
|
+
return [y(t[0], y(O, E, .35), r * .55), y(t[1], y(k, D, .4), r * .7)];
|
|
82
|
+
}, te = (e, t, n) => {
|
|
83
83
|
let r = e.createLinearGradient(0, 0, 0, t);
|
|
84
84
|
return r.addColorStop(0, n[0]), r.addColorStop(1, n[1]), r;
|
|
85
|
-
},
|
|
85
|
+
}, A = (e) => {
|
|
86
86
|
if (!e.isDay) return {
|
|
87
87
|
scale: .92 + e.twilight * .06,
|
|
88
88
|
alpha: .75 + e.twilight * .2
|
|
@@ -92,16 +92,16 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
92
92
|
scale: .82 + t * .22,
|
|
93
93
|
alpha: .65 + t * .35
|
|
94
94
|
};
|
|
95
|
-
},
|
|
95
|
+
}, ne = 2, j = [
|
|
96
96
|
"",
|
|
97
97
|
"薄雾",
|
|
98
98
|
"中雾",
|
|
99
99
|
"浓雾"
|
|
100
|
-
],
|
|
101
|
-
let t =
|
|
102
|
-
return `${t} · ${
|
|
103
|
-
},
|
|
104
|
-
let n =
|
|
100
|
+
], M = (e) => Math.min(3, Math.max(1, Math.round(e))), re = (e) => {
|
|
101
|
+
let t = M(e);
|
|
102
|
+
return `${t} · ${j[t]}`;
|
|
103
|
+
}, N = (e) => e === "fog", ie = (e, t) => {
|
|
104
|
+
let n = M(t);
|
|
105
105
|
return n === 1 ? {
|
|
106
106
|
...e,
|
|
107
107
|
fogBanks: 3,
|
|
@@ -121,10 +121,10 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
121
121
|
cloudAlpha: .32,
|
|
122
122
|
sun: "dim"
|
|
123
123
|
};
|
|
124
|
-
},
|
|
125
|
-
let t =
|
|
124
|
+
}, ae = (e) => {
|
|
125
|
+
let t = M(e);
|
|
126
126
|
return t === 1 ? .45 : t === 3 ? .95 : .65;
|
|
127
|
-
},
|
|
127
|
+
}, P = (e) => e === 45 ? 2 : e === 48 ? 3 : null, F = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, oe = 2, I = [
|
|
128
128
|
"",
|
|
129
129
|
"细雹",
|
|
130
130
|
"密雹",
|
|
@@ -132,7 +132,7 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
132
132
|
], L = (e) => Math.min(3, Math.max(1, Math.round(e))), R = (e) => {
|
|
133
133
|
let t = L(e);
|
|
134
134
|
return `${t} · ${I[t]}`;
|
|
135
|
-
},
|
|
135
|
+
}, se = (e) => e === "hail", ce = (e) => {
|
|
136
136
|
let t = L(e);
|
|
137
137
|
return t === 1 ? {
|
|
138
138
|
count: 75,
|
|
@@ -150,37 +150,37 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
150
150
|
sizeMax: 3.8,
|
|
151
151
|
speedMul: 1
|
|
152
152
|
};
|
|
153
|
-
},
|
|
154
|
-
let t =
|
|
153
|
+
}, z = (e) => e === 96 ? 2 : e === 99 ? 3 : null, le = 1, ue = 10, de = 5, fe = 5, B = (e) => Math.min(10, Math.max(1, Math.round(e))), V = (e, t, n) => e + (t - e) * n, H = (e) => {
|
|
154
|
+
let t = B(e);
|
|
155
155
|
return t <= 2 ? 1 : t <= 4 ? 2 : t <= 6 ? 3 : t <= 8 ? 4 : 5;
|
|
156
|
-
},
|
|
156
|
+
}, pe = [
|
|
157
157
|
"毛毛雨",
|
|
158
158
|
"小雨",
|
|
159
159
|
"中雨",
|
|
160
160
|
"暴雨",
|
|
161
161
|
"特大暴雨"
|
|
162
|
-
],
|
|
162
|
+
], me = [
|
|
163
163
|
"毛毛雪",
|
|
164
164
|
"小雪",
|
|
165
165
|
"中雪",
|
|
166
166
|
"暴雪",
|
|
167
167
|
"特大暴雪"
|
|
168
|
-
],
|
|
169
|
-
let n =
|
|
170
|
-
return (t === "rain" ?
|
|
171
|
-
},
|
|
172
|
-
let n = (
|
|
168
|
+
], he = (e, t) => {
|
|
169
|
+
let n = H(e);
|
|
170
|
+
return (t === "rain" ? pe : me)[n - 1];
|
|
171
|
+
}, ge = (e, t) => `${B(e)} · ${he(e, t)}`, _e = ["", ...pe], ve = ["", ...me], U = (e) => e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? "rain" : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? "snow" : e, ye = (e) => e === "rain" || e === "lightRain" || e === "moderateRain" || e === "heavyRain", be = (e) => e === "snow" || e === "lightSnow" || e === "moderateSnow" || e === "heavySnow", xe = (e) => ye(e) || e === "thunderstorm" || e === "sleet", Se = (e) => be(e) || e === "sleet", Ce = (e, t = 5) => e === "lightRain" ? 3 : e === "moderateRain" ? 5 : e === "heavyRain" ? 8 : B(t), we = (e, t = 5) => e === "lightSnow" ? 3 : e === "moderateSnow" ? 5 : e === "heavySnow" ? 8 : B(t), W = (e, t) => t === "rain" ? e <= 2 ? "lightRain" : e === 3 ? "moderateRain" : "heavyRain" : e <= 2 ? "lightSnow" : e === 3 ? "moderateSnow" : "heavySnow", Te = (e, t = 5, n = 5) => e === "rain" ? W(H(t), "rain") : e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? W(H(Ce(e)), "rain") : e === "snow" ? W(H(n), "snow") : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? W(H(we(e)), "snow") : e, Ee = (e, t) => {
|
|
172
|
+
let n = (B(t) - 1) / 9;
|
|
173
173
|
return {
|
|
174
|
-
count: Math.round(
|
|
175
|
-
speed:
|
|
176
|
-
wind:
|
|
177
|
-
alpha:
|
|
178
|
-
splash:
|
|
174
|
+
count: Math.round(V(35, 340, n)),
|
|
175
|
+
speed: V(5.5, 16, n),
|
|
176
|
+
wind: V(-.4, -3.2, n),
|
|
177
|
+
alpha: V(.28, .62, n),
|
|
178
|
+
splash: B(t) >= 5
|
|
179
179
|
};
|
|
180
|
-
},
|
|
181
|
-
let t = (
|
|
182
|
-
return Math.round(
|
|
183
|
-
},
|
|
180
|
+
}, De = (e) => {
|
|
181
|
+
let t = (B(e) - 1) / 9;
|
|
182
|
+
return Math.round(V(30, 360, t));
|
|
183
|
+
}, Oe = (e) => [51, 56].includes(e) ? 2 : [
|
|
184
184
|
61,
|
|
185
185
|
66,
|
|
186
186
|
80
|
|
@@ -190,16 +190,16 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
190
190
|
57,
|
|
191
191
|
63,
|
|
192
192
|
81
|
|
193
|
-
].includes(e) ? 5 : [65, 67].includes(e) ? 8 : [82].includes(e) ? 10 : [95].includes(e) ? 7 : null,
|
|
193
|
+
].includes(e) ? 5 : [65, 67].includes(e) ? 8 : [82].includes(e) ? 10 : [95].includes(e) ? 7 : null, ke = (e) => [77].includes(e) ? 2 : [71, 85].includes(e) ? 3 : [73].includes(e) ? 5 : [75].includes(e) ? 8 : [86].includes(e) ? 10 : null, Ae = 2, je = [
|
|
194
194
|
"",
|
|
195
195
|
"轻霾",
|
|
196
196
|
"中霾",
|
|
197
197
|
"重霾"
|
|
198
|
-
],
|
|
199
|
-
let t =
|
|
200
|
-
return `${t} · ${
|
|
201
|
-
},
|
|
202
|
-
let n =
|
|
198
|
+
], G = (e) => Math.min(3, Math.max(1, Math.round(e))), Me = (e) => {
|
|
199
|
+
let t = G(e);
|
|
200
|
+
return `${t} · ${je[t]}`;
|
|
201
|
+
}, K = (e) => e === "smog", Ne = (e, t) => {
|
|
202
|
+
let n = G(t);
|
|
203
203
|
return n === 1 ? {
|
|
204
204
|
...e,
|
|
205
205
|
fogBanks: 5,
|
|
@@ -219,10 +219,10 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
219
219
|
cloudAlpha: .35,
|
|
220
220
|
sun: "dim"
|
|
221
221
|
};
|
|
222
|
-
},
|
|
223
|
-
let t =
|
|
222
|
+
}, Pe = (e) => {
|
|
223
|
+
let t = G(e);
|
|
224
224
|
return t === 1 ? .55 : t === 3 ? 1.05 : .85;
|
|
225
|
-
},
|
|
225
|
+
}, Fe = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, Ie = {
|
|
226
226
|
0: "sunny",
|
|
227
227
|
1: "sunny",
|
|
228
228
|
2: "partlyCloudy",
|
|
@@ -251,7 +251,7 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
251
251
|
95: "thunderstorm",
|
|
252
252
|
96: "hail",
|
|
253
253
|
99: "hail"
|
|
254
|
-
},
|
|
254
|
+
}, Le = (e) => U(Ie[e] ?? "overcast"), q = {
|
|
255
255
|
weather: null,
|
|
256
256
|
rainLevel: null,
|
|
257
257
|
snowLevel: null,
|
|
@@ -261,35 +261,21 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
261
261
|
status: "idle",
|
|
262
262
|
error: null,
|
|
263
263
|
current: null
|
|
264
|
-
},
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
status: "locating",
|
|
272
|
-
error: null,
|
|
273
|
-
current: null
|
|
274
|
-
}, Ae = {
|
|
275
|
-
weather: null,
|
|
276
|
-
rainLevel: null,
|
|
277
|
-
snowLevel: null,
|
|
278
|
-
fogLevel: null,
|
|
279
|
-
hailLevel: null,
|
|
280
|
-
smogLevel: null,
|
|
281
|
-
status: "fetching",
|
|
282
|
-
error: null,
|
|
283
|
-
current: null
|
|
284
|
-
}, je = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), Z = (e) => {
|
|
264
|
+
}, Re = {
|
|
265
|
+
...q,
|
|
266
|
+
status: "locating"
|
|
267
|
+
}, ze = {
|
|
268
|
+
...q,
|
|
269
|
+
status: "fetching"
|
|
270
|
+
}, J = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), Y = (e) => {
|
|
285
271
|
if (typeof e != "string" || !e) return null;
|
|
286
272
|
let t = Date.parse(e);
|
|
287
273
|
return Number.isFinite(t) ? t : null;
|
|
288
|
-
},
|
|
274
|
+
}, Be = (e) => {
|
|
289
275
|
if (typeof e != "string" || !e) return null;
|
|
290
276
|
let t = e.match(/T(\d{2}):(\d{2})/);
|
|
291
277
|
return t ? `${t[1]}:${t[2]}` : null;
|
|
292
|
-
},
|
|
278
|
+
}, Ve = (e, t) => {
|
|
293
279
|
if (e) try {
|
|
294
280
|
let t = new Intl.DateTimeFormat("en-GB", {
|
|
295
281
|
timeZone: e,
|
|
@@ -300,116 +286,80 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
300
286
|
if (n != null && r != null) return `${n.padStart(2, "0")}:${r.padStart(2, "0")}`;
|
|
301
287
|
} catch {}
|
|
302
288
|
return t ?? null;
|
|
303
|
-
},
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
smogLevel: null,
|
|
378
|
-
status: "error",
|
|
379
|
-
error: "当前环境不支持定位",
|
|
380
|
-
current: null
|
|
381
|
-
});
|
|
382
|
-
}), () => {
|
|
383
|
-
e = !0;
|
|
384
|
-
}) : (navigator.geolocation.getCurrentPosition(({ coords: t }) => {
|
|
385
|
-
e || (u((e) => ({
|
|
386
|
-
...e,
|
|
387
|
-
status: "fetching"
|
|
388
|
-
})), r(t.latitude, t.longitude));
|
|
389
|
-
}, (t) => {
|
|
390
|
-
e || u({
|
|
391
|
-
weather: null,
|
|
392
|
-
rainLevel: null,
|
|
393
|
-
snowLevel: null,
|
|
394
|
-
fogLevel: null,
|
|
395
|
-
hailLevel: null,
|
|
396
|
-
smogLevel: null,
|
|
397
|
-
status: "error",
|
|
398
|
-
error: t.message || "定位失败",
|
|
399
|
-
current: null
|
|
400
|
-
});
|
|
401
|
-
}, {
|
|
402
|
-
timeout: 1e4,
|
|
403
|
-
maximumAge: 600 * 1e3
|
|
404
|
-
}), () => {
|
|
405
|
-
e = !0, n.abort();
|
|
406
|
-
});
|
|
407
|
-
}, [
|
|
408
|
-
t,
|
|
409
|
-
a,
|
|
410
|
-
o
|
|
411
|
-
]), l;
|
|
412
|
-
}, Fe = async (e, t, n) => {
|
|
289
|
+
}, X = (e) => ({
|
|
290
|
+
...q,
|
|
291
|
+
status: "error",
|
|
292
|
+
error: e
|
|
293
|
+
}), He = async (e, t, n) => {
|
|
294
|
+
let r = new URLSearchParams({
|
|
295
|
+
latitude: String(e),
|
|
296
|
+
longitude: String(t),
|
|
297
|
+
current: "weather_code,wind_speed_10m,is_day,visibility",
|
|
298
|
+
daily: "sunrise,sunset",
|
|
299
|
+
timezone: "auto",
|
|
300
|
+
forecast_days: "1"
|
|
301
|
+
}), i = await fetch(`https://api.open-meteo.com/v1/forecast?${r}`, { signal: n });
|
|
302
|
+
if (!i.ok) throw Error(`Open-Meteo 请求失败(HTTP ${i.status})`);
|
|
303
|
+
let a = await i.json(), o = Number(a?.current?.weather_code);
|
|
304
|
+
if (Number.isNaN(o)) throw Error("Open-Meteo 返回数据缺少 weather_code");
|
|
305
|
+
let s = Number(a?.current?.wind_speed_10m ?? 0), c = Y(a?.daily?.sunrise?.[0]), l = Y(a?.daily?.sunset?.[0]), u = typeof a?.timezone == "string" ? a.timezone : null, d = Be(a?.current?.time) ?? Ve(u), f = Le(o), p = Oe(o), m = ke(o), h = a?.current?.visibility, g = h != null && Number.isFinite(Number(h)) ? Number(h) : null, _ = f === "fog" ? F(g) ?? P(o) ?? 2 : null, v = f === "hail" ? z(o) ?? 2 : null, y = f === "smog" ? Fe(g) ?? 2 : null;
|
|
306
|
+
return {
|
|
307
|
+
weather: f,
|
|
308
|
+
rainLevel: p,
|
|
309
|
+
snowLevel: m,
|
|
310
|
+
fogLevel: _,
|
|
311
|
+
hailLevel: v,
|
|
312
|
+
smogLevel: y,
|
|
313
|
+
status: "success",
|
|
314
|
+
error: null,
|
|
315
|
+
current: {
|
|
316
|
+
weatherCode: o,
|
|
317
|
+
windSpeed: s,
|
|
318
|
+
isDay: a?.current?.is_day === 1,
|
|
319
|
+
latitude: e,
|
|
320
|
+
longitude: t,
|
|
321
|
+
timezone: u,
|
|
322
|
+
localTime: d,
|
|
323
|
+
visibility: g,
|
|
324
|
+
rainLevel: p,
|
|
325
|
+
snowLevel: m,
|
|
326
|
+
fogLevel: _,
|
|
327
|
+
hailLevel: v,
|
|
328
|
+
smogLevel: y,
|
|
329
|
+
sunrise: c,
|
|
330
|
+
sunset: l
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}, Ue = (e, t, n) => {
|
|
334
|
+
if (!e) return n(q), () => {};
|
|
335
|
+
let r = !1, i = new AbortController(), a = J(t);
|
|
336
|
+
n(a ? ze : Re);
|
|
337
|
+
let o = async (e, t) => {
|
|
338
|
+
try {
|
|
339
|
+
let a = await He(e, t, i.signal);
|
|
340
|
+
r || n(a);
|
|
341
|
+
} catch (e) {
|
|
342
|
+
if (r || e instanceof DOMException && e.name === "AbortError") return;
|
|
343
|
+
n(X(e instanceof Error ? e.message : "天气获取失败"));
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
return a ? (o(t.latitude, t.longitude), () => {
|
|
347
|
+
r = !0, i.abort();
|
|
348
|
+
}) : typeof navigator > "u" || !navigator.geolocation ? (Promise.resolve().then(() => {
|
|
349
|
+
r || n(X("当前环境不支持定位"));
|
|
350
|
+
}), () => {
|
|
351
|
+
r = !0;
|
|
352
|
+
}) : (navigator.geolocation.getCurrentPosition(({ coords: e }) => {
|
|
353
|
+
r || (n(ze), o(e.latitude, e.longitude));
|
|
354
|
+
}, (e) => {
|
|
355
|
+
r || n(X(e.message || "定位失败"));
|
|
356
|
+
}, {
|
|
357
|
+
timeout: 1e4,
|
|
358
|
+
maximumAge: 600 * 1e3
|
|
359
|
+
}), () => {
|
|
360
|
+
r = !0, i.abort();
|
|
361
|
+
});
|
|
362
|
+
}, We = async (e, t, n) => {
|
|
413
363
|
let r = new URLSearchParams({
|
|
414
364
|
latitude: String(e),
|
|
415
365
|
longitude: String(t),
|
|
@@ -418,25 +368,12 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
418
368
|
forecast_days: "1"
|
|
419
369
|
}), i = await fetch(`https://api.open-meteo.com/v1/forecast?${r}`, { signal: n });
|
|
420
370
|
if (!i.ok) return null;
|
|
421
|
-
let a = await i.json(), o =
|
|
371
|
+
let a = await i.json(), o = Y(a?.daily?.sunrise?.[0]), s = Y(a?.daily?.sunset?.[0]);
|
|
422
372
|
return o == null || s == null ? null : {
|
|
423
373
|
sunrise: o,
|
|
424
374
|
sunset: s
|
|
425
375
|
};
|
|
426
|
-
},
|
|
427
|
-
let n = je(t), i = n ? t.latitude : null, a = n ? t.longitude : null, o = `${i},${a}`, [s, c] = r(null), [l, u] = r(o);
|
|
428
|
-
return l !== o && (u(o), c(null)), e(() => {
|
|
429
|
-
if (i == null || a == null) return;
|
|
430
|
-
let e = !1, t = new AbortController();
|
|
431
|
-
return Fe(i, a, t.signal).then((t) => {
|
|
432
|
-
e || c(t);
|
|
433
|
-
}).catch(() => {
|
|
434
|
-
e || c(null);
|
|
435
|
-
}), () => {
|
|
436
|
-
e = !0, t.abort();
|
|
437
|
-
};
|
|
438
|
-
}, [i, a]), n ? s : null;
|
|
439
|
-
}, Le = 3, Re = (e) => Math.min(12, Math.max(0, Math.round(e))), ze = (e) => Math.max(0, Re(e) - 2), Be = .55, Ve = [
|
|
376
|
+
}, Ge = 3, Z = (e) => Math.min(12, Math.max(0, Math.round(e))), Ke = (e) => Math.max(0, Z(e) - 2), qe = .55, Je = [
|
|
440
377
|
0,
|
|
441
378
|
3,
|
|
442
379
|
8,
|
|
@@ -450,7 +387,7 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
450
387
|
95,
|
|
451
388
|
110,
|
|
452
389
|
125
|
|
453
|
-
],
|
|
390
|
+
], Ye = [
|
|
454
391
|
1,
|
|
455
392
|
5,
|
|
456
393
|
11,
|
|
@@ -465,7 +402,7 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
465
402
|
117,
|
|
466
403
|
Infinity
|
|
467
404
|
], Q = (e, t, n = 0, r = 0) => {
|
|
468
|
-
let i = t.gustiness, a = t.wander, o = n * .0017 + r * .0024, s = e *
|
|
405
|
+
let i = t.gustiness, a = t.wander, o = n * .0017 + r * .0024, s = e * qe, c = Math.sin(s * .007 + o), l = Math.sin(s * .021 + 1.37 + o * 1.4), u = Math.sin(s * .055 + 2.8 + o * .6), d = 1 + (.5 * c + .35 * l + .15 * u) * (.25 + i * .75), f = Math.sin(s * .012 + o * .8);
|
|
469
406
|
f > .72 && (d += (f - .72) * (.8 + i * 2.4)), Math.sin(s * .0095 + .6 + o) < -.55 && (d *= .45 + i * .2), d = Math.max(.12, Math.min(2.25, d));
|
|
470
407
|
let p = a * (.55 * Math.sin(s * .0088 + o) + .3 * Math.sin(s * .026 + 1.9 + o * 1.1) + .15 * Math.sin(s * .063 + .4));
|
|
471
408
|
return {
|
|
@@ -474,8 +411,8 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
474
411
|
ux: Math.cos(p),
|
|
475
412
|
uy: Math.sin(p)
|
|
476
413
|
};
|
|
477
|
-
},
|
|
478
|
-
let t =
|
|
414
|
+
}, Xe = (e) => {
|
|
415
|
+
let t = Z(e);
|
|
479
416
|
if (t <= 0) return {
|
|
480
417
|
count: 0,
|
|
481
418
|
alphaMul: 0
|
|
@@ -485,12 +422,12 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
485
422
|
count: Math.floor(3 + n * n * 50),
|
|
486
423
|
alphaMul: .1 + n * .9
|
|
487
424
|
};
|
|
488
|
-
},
|
|
425
|
+
}, Ze = (e) => Je[Z(e)] ?? 16, Qe = (e) => {
|
|
489
426
|
let t = Math.max(0, e);
|
|
490
|
-
for (let e = 0; e <
|
|
427
|
+
for (let e = 0; e < Ye.length; e++) if (t <= Ye[e]) return e;
|
|
491
428
|
return 12;
|
|
492
|
-
},
|
|
493
|
-
let t =
|
|
429
|
+
}, $e = (e) => {
|
|
430
|
+
let t = Qe(e), n = Ke(t), r = Ze(n), i = Math.max(.04, Math.min(r / 16, 4.2)), { alphaMul: a } = Xe(n), o = i ** .82, s = Math.min(1, (n / 8) ** 1.1), c = (.04 + s * .32) * Math.PI;
|
|
494
431
|
return {
|
|
495
432
|
speedKmh: e,
|
|
496
433
|
level: t,
|
|
@@ -506,17 +443,17 @@ var c = (e) => Math.min(1, Math.max(0, e)), l = (e) => {
|
|
|
506
443
|
gustiness: s,
|
|
507
444
|
wander: c
|
|
508
445
|
};
|
|
509
|
-
},
|
|
446
|
+
}, et = (e) => e.live && e.liveWindKmh != null && Number.isFinite(e.liveWindKmh) ? Math.max(0, e.liveWindKmh) : Ze(e.windLevel);
|
|
510
447
|
//#endregion
|
|
511
448
|
//#region src/components/weatherBackground/scene/draw-atmosphere.ts
|
|
512
|
-
function
|
|
449
|
+
function tt(e) {
|
|
513
450
|
let t = e.windMotion.cloud, { intensity: n, angle: r, uy: i } = e.windField, a = -Math.cos(r);
|
|
514
451
|
for (let r of e.state.clouds) {
|
|
515
452
|
let o = Math.abs(r.speed) * t * n;
|
|
516
453
|
r.x += o * a, r.y += o * i * .12, r.y < -80 && (r.y = -80), r.y > e.height * .55 && (r.y = e.height * .55), r.x - 140 * r.scale > e.width && (r.x = -160 * r.scale), r.x + 180 * r.scale < 0 && (r.x = e.width + 40 * r.scale), e.ctx.drawImage(r.sprite, r.x + r.ox, r.y + r.oy);
|
|
517
454
|
}
|
|
518
455
|
}
|
|
519
|
-
function
|
|
456
|
+
function nt(e) {
|
|
520
457
|
let t = e.fogSprite;
|
|
521
458
|
if (!t || e.state.fogBanks.length === 0) return;
|
|
522
459
|
let { canvas: n, baseR: r } = t, i = e.windMotion.fog, { intensity: a, angle: o, uy: s } = e.windField, c = -Math.cos(o);
|
|
@@ -525,21 +462,21 @@ function Ye(e) {
|
|
|
525
462
|
t.x += o * c, t.y += o * s * .1, t.y < e.height * .02 && (t.y = e.height * .02), t.y > e.height * .95 && (t.y = e.height * .95), c < 0 && t.x + t.rw < 0 && (t.x = e.width + t.rw), c > 0 && t.x - t.rw > e.width && (t.x = -t.rw), e.ctx.save(), e.ctx.translate(t.x, t.y), e.ctx.scale(t.rw / r, t.rh / r), e.ctx.globalAlpha = t.alpha, e.ctx.drawImage(n, -r, -r), e.ctx.restore();
|
|
526
463
|
}
|
|
527
464
|
}
|
|
528
|
-
function
|
|
465
|
+
function rt(e) {
|
|
529
466
|
if (e.cfg.haze <= 0) return;
|
|
530
467
|
let t = e.activeWeather === "smog" ? "177, 164, 135" : "220, 226, 232";
|
|
531
468
|
e.activeNight && (t = e.activeWeather === "smog" ? "82, 74, 54" : "116, 128, 145"), e.ctx.fillStyle = `rgba(${t}, ${e.cfg.haze})`, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
532
469
|
}
|
|
533
470
|
//#endregion
|
|
534
471
|
//#region src/components/weatherBackground/lightning.ts
|
|
535
|
-
function
|
|
472
|
+
function it(e, t, n, r, i, a) {
|
|
536
473
|
if (a <= 0) return [[e, t], [n, r]];
|
|
537
|
-
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c =
|
|
474
|
+
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = it(e, t, o, s, i * .55, a - 1), l = it(o, s, n, r, i * .55, a - 1);
|
|
538
475
|
return [...c.slice(0, -1), ...l];
|
|
539
476
|
}
|
|
540
477
|
//#endregion
|
|
541
478
|
//#region src/components/weatherBackground/scene/draw-effects.ts
|
|
542
|
-
function
|
|
479
|
+
function at(e) {
|
|
543
480
|
if (e.state.windStreaks.length === 0) return;
|
|
544
481
|
let t = e.windMotion.streak, n = e.windMotion.streakVisibility;
|
|
545
482
|
if (n <= .02) return;
|
|
@@ -554,12 +491,12 @@ function Qe(e) {
|
|
|
554
491
|
}
|
|
555
492
|
}
|
|
556
493
|
}
|
|
557
|
-
function
|
|
494
|
+
function ot(e) {
|
|
558
495
|
if (e.cfg.lightning) {
|
|
559
496
|
if (e.state.t >= e.state.nextStrike) {
|
|
560
497
|
e.state.nextStrike = e.state.t + 150 + Math.random() * 300, e.state.flashAlpha = .5, e.state.boltLife = 9;
|
|
561
498
|
let t = e.width * (.15 + Math.random() * .7);
|
|
562
|
-
e.state.boltPoints =
|
|
499
|
+
e.state.boltPoints = it(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
|
|
563
500
|
}
|
|
564
501
|
if (e.state.boltLife > 0) {
|
|
565
502
|
--e.state.boltLife;
|
|
@@ -571,7 +508,7 @@ function $e(e) {
|
|
|
571
508
|
}
|
|
572
509
|
//#endregion
|
|
573
510
|
//#region src/components/weatherBackground/sprites/hail.ts
|
|
574
|
-
var
|
|
511
|
+
var st = 3.2, ct = (e) => {
|
|
575
512
|
let t = Math.ceil(e * 2.8 + 4), n = document.createElement("canvas");
|
|
576
513
|
n.width = t, n.height = t;
|
|
577
514
|
let r = n.getContext("2d"), i = t / 2, a = t / 2, o = 9 + Math.floor(Math.random() * 5), s = Array.from({ length: o }, (t, n) => {
|
|
@@ -604,10 +541,10 @@ var et = 3.2, tt = (e) => {
|
|
|
604
541
|
r.beginPath(), r.arc(n, o, e * (.1 + Math.random() * .08), 0, Math.PI * 2), r.fillStyle = "rgba(255, 255, 255, 0.55)", r.fill();
|
|
605
542
|
}
|
|
606
543
|
return r.beginPath(), r.ellipse(i - e * .34, a - e * .36, e * .24, e * .17, -.35, 0, Math.PI * 2), r.fillStyle = "rgba(255, 255, 255, 0.78)", r.fill(), n;
|
|
607
|
-
},
|
|
544
|
+
}, lt = (e = 16) => Array.from({ length: e }, () => ct(st)), ut = (e) => e[Math.floor(Math.random() * e.length)], dt = (e, t, n, r, i = !0, a, o = 1) => {
|
|
608
545
|
let s = a?.min ?? 1.4, c = a?.max ?? 4.8;
|
|
609
|
-
e.r = s + Math.random() ** 1.35 * (c - s), e.x = Math.random() * (t + 260) - 130 + (Math.random() - .5) * 40, e.y = i ? -e.r - Math.random() * n * .55 : Math.random() * n, e.vx = (-1.2 - Math.random() * 4.8 + (Math.random() - .5) * 1.2) * o, e.vy = (5.5 + Math.random() * 11) * o, e.bounces = 0, e.opacity = .45 + Math.random() * .55, e.delay = Math.floor(Math.random() * (i ? 110 : 45)), e.gravity = (.11 + Math.random() * .14) * (.9 + o * .1), e.phase = Math.random() * Math.PI * 2, e.gust = (Math.random() - .5) * 1.4, e.maxBounces = +(Math.random() < .62), e.sprite =
|
|
610
|
-
},
|
|
546
|
+
e.r = s + Math.random() ** 1.35 * (c - s), e.x = Math.random() * (t + 260) - 130 + (Math.random() - .5) * 40, e.y = i ? -e.r - Math.random() * n * .55 : Math.random() * n, e.vx = (-1.2 - Math.random() * 4.8 + (Math.random() - .5) * 1.2) * o, e.vy = (5.5 + Math.random() * 11) * o, e.bounces = 0, e.opacity = .45 + Math.random() * .55, e.delay = Math.floor(Math.random() * (i ? 110 : 45)), e.gravity = (.11 + Math.random() * .14) * (.9 + o * .1), e.phase = Math.random() * Math.PI * 2, e.gust = (Math.random() - .5) * 1.4, e.maxBounces = +(Math.random() < .62), e.sprite = ut(r), e.drawSize = e.r * 2.8 + 4, e.rotation = Math.random() * Math.PI * 2, e.rotationSpeed = (Math.random() - .5) * .06;
|
|
547
|
+
}, ft = (e, t, n, r, i = 1) => {
|
|
611
548
|
let a = {
|
|
612
549
|
x: 0,
|
|
613
550
|
y: 0,
|
|
@@ -626,11 +563,11 @@ var et = 3.2, tt = (e) => {
|
|
|
626
563
|
rotation: 0,
|
|
627
564
|
rotationSpeed: 0
|
|
628
565
|
};
|
|
629
|
-
return
|
|
566
|
+
return dt(a, e, t, n, Math.random() < .72, r, i), a;
|
|
630
567
|
};
|
|
631
568
|
//#endregion
|
|
632
569
|
//#region src/components/weatherBackground/scene/draw-precipitation.ts
|
|
633
|
-
function
|
|
570
|
+
function pt(e) {
|
|
634
571
|
if (!e.cfg.rain) return;
|
|
635
572
|
let { alpha: t, splash: n } = e.cfg.rain, r = e.cfg.rain.wind * e.windMotion.rain, { intensity: i, angle: a, uy: o } = e.windField, s = r * i * Math.cos(a), c = Math.abs(r) * i * o * .35;
|
|
636
573
|
e.ctx.strokeStyle = `rgba(214, 228, 240, ${t})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
|
|
@@ -652,7 +589,7 @@ function ot(e) {
|
|
|
652
589
|
e.ctx.beginPath(), e.ctx.ellipse(n.x, e.height - 3, n.r, n.r * .35, 0, Math.PI, Math.PI * 2), e.ctx.strokeStyle = `rgba(214, 228, 240, ${n.alpha})`, e.ctx.lineWidth = 1, e.ctx.stroke();
|
|
653
590
|
}
|
|
654
591
|
}
|
|
655
|
-
function
|
|
592
|
+
function mt(e) {
|
|
656
593
|
let t = e.windMotion.snowDrift, { intensity: n, angle: r, uy: i } = e.windField, a = t * n * Math.cos(r), o = Math.abs(t) * n * i * .4;
|
|
657
594
|
for (let t of e.state.flakes) {
|
|
658
595
|
t.y += t.speed + o, t.x += Math.sin(e.state.t * .02 + t.phase) * (.3 + t.size * .08) + t.drift + a, t.rotation += t.rotationSpeed, t.y - t.drawSize > e.height && (t.y = -t.drawSize, t.x = Math.random() * e.width, t.phase = Math.random() * Math.PI * 2, t.drift = (Math.random() - .5) * .4, t.opacity = .55 + Math.random() * .45), t.x > e.width + 20 && (t.x = -20), t.x < -20 && (t.x = e.width + 20);
|
|
@@ -660,7 +597,7 @@ function st(e) {
|
|
|
660
597
|
e.ctx.save(), e.ctx.globalAlpha = t.opacity, e.ctx.translate(t.x, t.y), e.ctx.rotate(t.rotation), e.ctx.drawImage(t.sprite, -n, -n, t.drawSize, t.drawSize), e.ctx.restore();
|
|
661
598
|
}
|
|
662
599
|
}
|
|
663
|
-
function
|
|
600
|
+
function ht(e) {
|
|
664
601
|
if (e.state.hailstones.length === 0) return;
|
|
665
602
|
let t = e.state.hailPool, n = e.windMotion.hail, r = e.state.t, i = e.windField;
|
|
666
603
|
for (let a of e.state.hailstones) {
|
|
@@ -671,7 +608,7 @@ function ct(e) {
|
|
|
671
608
|
let o = Q(r + a.phase * 12, e.windMotion, a.x, a.y), s = o.intensity * (.4 + .6 * i.intensity), c = o.angle * .5 + i.angle * .5, l = e.windMotion.snowDrift * .45 * s * Math.cos(c), u = Math.abs(e.windMotion.snowDrift) * s * Math.sin(c) * .2, d = a.x, f = a.y;
|
|
672
609
|
if (a.vy += a.gravity + u * .02, a.vx += a.gust * .004 * n * s + l + (Math.random() - .5) * .08 * n * s, a.x += a.vx + Math.sin(r * .028 + a.phase) * .35, a.y += a.vy, e.ctx.beginPath(), e.ctx.moveTo(d, f), e.ctx.lineTo(a.x, a.y), e.ctx.strokeStyle = `rgba(225, 239, 250, ${a.opacity * .18})`, e.ctx.lineWidth = a.r * .35, e.ctx.stroke(), a.y + a.r >= e.height) if (a.bounces < a.maxBounces) a.y = e.height - a.r, a.vy *= -(.22 + Math.random() * .28), a.vx = a.vx * (.55 + Math.random() * .25) + (Math.random() - .5) * 1.6, a.bounces += 1;
|
|
673
610
|
else {
|
|
674
|
-
|
|
611
|
+
dt(a, e.width, e.height, t, !0, e.hailSpec ? {
|
|
675
612
|
min: e.hailSpec.sizeMin,
|
|
676
613
|
max: e.hailSpec.sizeMax
|
|
677
614
|
} : void 0, e.hailSpec?.speedMul ?? 1);
|
|
@@ -683,10 +620,10 @@ function ct(e) {
|
|
|
683
620
|
}
|
|
684
621
|
//#endregion
|
|
685
622
|
//#region src/components/weatherBackground/scene/draw-sky.ts
|
|
686
|
-
function
|
|
623
|
+
function gt(e) {
|
|
687
624
|
e.ctx.fillStyle = e.skyGradient, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
688
625
|
}
|
|
689
|
-
function
|
|
626
|
+
function _t(e) {
|
|
690
627
|
if (e.state.stars.length === 0) return;
|
|
691
628
|
let t = 1;
|
|
692
629
|
if (e.dayCycle) {
|
|
@@ -698,25 +635,25 @@ function ut(e) {
|
|
|
698
635
|
e.ctx.beginPath(), e.ctx.arc(n.x, n.y, n.r, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(226, 235, 255, ${r * t})`, e.ctx.fill();
|
|
699
636
|
}
|
|
700
637
|
}
|
|
701
|
-
function
|
|
638
|
+
function vt(e) {
|
|
702
639
|
let t = e.celestial;
|
|
703
640
|
if (!t) return;
|
|
704
|
-
let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s = e.dayCycle ?
|
|
641
|
+
let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s = e.dayCycle ? A(e.dayCycle) : {
|
|
705
642
|
scale: 1,
|
|
706
643
|
alpha: 1
|
|
707
644
|
}, c = t.half * o * s.scale, l = c * 2;
|
|
708
645
|
n.save(), n.globalAlpha = s.alpha, n.drawImage(t.canvas, r - c, i - c, l, l), n.restore();
|
|
709
646
|
}
|
|
710
|
-
function
|
|
647
|
+
function yt(e) {
|
|
711
648
|
if (e.activeNight) {
|
|
712
|
-
|
|
649
|
+
_t(e), vt(e);
|
|
713
650
|
return;
|
|
714
651
|
}
|
|
715
|
-
|
|
652
|
+
vt(e);
|
|
716
653
|
}
|
|
717
654
|
//#endregion
|
|
718
655
|
//#region src/components/weatherBackground/configs.ts
|
|
719
|
-
var
|
|
656
|
+
var bt = {
|
|
720
657
|
sunny: {
|
|
721
658
|
sky: ["#4a9fe0", "#c8e8fb"],
|
|
722
659
|
sun: "full",
|
|
@@ -1048,7 +985,7 @@ var pt = {
|
|
|
1048
985
|
snowCount: 160,
|
|
1049
986
|
lightning: !1
|
|
1050
987
|
}
|
|
1051
|
-
},
|
|
988
|
+
}, xt = {
|
|
1052
989
|
sunny: {
|
|
1053
990
|
sky: ["#0b1a33", "#27476e"],
|
|
1054
991
|
stars: 110
|
|
@@ -1117,14 +1054,14 @@ var pt = {
|
|
|
1117
1054
|
sky: ["#101a26", "#2e3d4d"],
|
|
1118
1055
|
stars: 30
|
|
1119
1056
|
}
|
|
1120
|
-
},
|
|
1057
|
+
}, St = ([e, t, n]) => [
|
|
1121
1058
|
Math.round(e * .3 + 18),
|
|
1122
1059
|
Math.round(t * .3 + 24),
|
|
1123
1060
|
Math.round(n * .3 + 42)
|
|
1124
1061
|
];
|
|
1125
1062
|
//#endregion
|
|
1126
1063
|
//#region src/components/weatherBackground/sprites/cloud.ts
|
|
1127
|
-
function
|
|
1064
|
+
function Ct(e, t, n, r) {
|
|
1128
1065
|
let [i, a, o] = n, s = Infinity, c = Infinity, l = -Infinity, u = -Infinity;
|
|
1129
1066
|
for (let n of t) {
|
|
1130
1067
|
let t = n.dx * e, r = n.dy * e, i = n.r * e;
|
|
@@ -1143,12 +1080,12 @@ function gt(e, t, n, r) {
|
|
|
1143
1080
|
oy: f
|
|
1144
1081
|
};
|
|
1145
1082
|
}
|
|
1146
|
-
function
|
|
1083
|
+
function wt(e, t, n, r, i) {
|
|
1147
1084
|
let a = .7 + Math.random() * .9, o = 4 + Math.floor(Math.random() * 3), s = Array.from({ length: o }, (e, t) => ({
|
|
1148
1085
|
dx: (t - o / 2) * 26 + (Math.random() - .5) * 14,
|
|
1149
1086
|
dy: (Math.random() - .5) * 14,
|
|
1150
1087
|
r: 22 + Math.random() * 20
|
|
1151
|
-
})), { sprite: c, ox: l, oy: u } =
|
|
1088
|
+
})), { sprite: c, ox: l, oy: u } = Ct(a, s, r, i);
|
|
1152
1089
|
return {
|
|
1153
1090
|
x: Math.random() * (e + 240) - 120,
|
|
1154
1091
|
y: t * .06 + Math.random() * t * n,
|
|
@@ -1160,7 +1097,7 @@ function _t(e, t, n, r, i) {
|
|
|
1160
1097
|
oy: u
|
|
1161
1098
|
};
|
|
1162
1099
|
}
|
|
1163
|
-
function
|
|
1100
|
+
function Tt(e, t = 120) {
|
|
1164
1101
|
let n = t * 2, r = document.createElement("canvas");
|
|
1165
1102
|
r.width = n, r.height = n;
|
|
1166
1103
|
let i = r.getContext("2d"), a = i.createRadialGradient(t, t, 0, t, t, t);
|
|
@@ -1171,7 +1108,7 @@ function vt(e, t = 120) {
|
|
|
1171
1108
|
}
|
|
1172
1109
|
//#endregion
|
|
1173
1110
|
//#region src/components/weatherBackground/sprites/celestial.ts
|
|
1174
|
-
function
|
|
1111
|
+
function Et(e, t) {
|
|
1175
1112
|
let n = e.sun;
|
|
1176
1113
|
if (n === "none") return null;
|
|
1177
1114
|
let r = n === "full" ? 1 : n === "soft" ? .62 : .32, i = t * (n === "full" ? .72 : n === "soft" ? .62 : .5), a = t * (n === "full" ? 7.2 : n === "soft" ? 5.2 : 3.6), o = a;
|
|
@@ -1199,7 +1136,7 @@ function yt(e, t) {
|
|
|
1199
1136
|
breathAmp: .018
|
|
1200
1137
|
};
|
|
1201
1138
|
}
|
|
1202
|
-
function
|
|
1139
|
+
function Dt(e, t, n) {
|
|
1203
1140
|
if (e.sun === "none") return null;
|
|
1204
1141
|
let r = t * .82, i = e.sun === "dim", a = i ? .45 : 1, o = r * (i ? 4.2 : 6.2), s = Math.ceil(Math.max(o, r * 2.6, r * 1.35) + 2), c = s * 2, l = document.createElement("canvas");
|
|
1205
1142
|
l.width = c, l.height = c;
|
|
@@ -1253,12 +1190,12 @@ function bt(e, t, n) {
|
|
|
1253
1190
|
}
|
|
1254
1191
|
//#endregion
|
|
1255
1192
|
//#region src/components/weatherBackground/sprites/snow.ts
|
|
1256
|
-
var
|
|
1193
|
+
var Ot = (e) => {
|
|
1257
1194
|
let t = Math.ceil(e * 2 + 4), n = document.createElement("canvas");
|
|
1258
1195
|
n.width = t, n.height = t;
|
|
1259
1196
|
let r = n.getContext("2d"), i = r.createRadialGradient(t / 2, t / 2, 0, t / 2, t / 2, e + 1);
|
|
1260
1197
|
return i.addColorStop(0, "rgba(255, 255, 255, 1)"), i.addColorStop(.6, "rgba(255, 255, 255, 0.85)"), i.addColorStop(1, "rgba(255, 255, 255, 0)"), r.fillStyle = i, r.fillRect(0, 0, t, t), n;
|
|
1261
|
-
},
|
|
1198
|
+
}, kt = (e) => {
|
|
1262
1199
|
let t = Math.ceil(e * 2 + 6), n = document.createElement("canvas");
|
|
1263
1200
|
n.width = t, n.height = t;
|
|
1264
1201
|
let r = n.getContext("2d");
|
|
@@ -1285,22 +1222,22 @@ var xt = (e) => {
|
|
|
1285
1222
|
r.closePath(), r.stroke();
|
|
1286
1223
|
}
|
|
1287
1224
|
return n;
|
|
1288
|
-
},
|
|
1225
|
+
}, At = () => ({
|
|
1289
1226
|
dots: [
|
|
1290
1227
|
1.2,
|
|
1291
1228
|
1.6,
|
|
1292
1229
|
2,
|
|
1293
1230
|
2.3
|
|
1294
|
-
].map((e) =>
|
|
1231
|
+
].map((e) => Ot(e)),
|
|
1295
1232
|
crystals: [
|
|
1296
1233
|
2.6,
|
|
1297
1234
|
3.2,
|
|
1298
1235
|
3.8,
|
|
1299
1236
|
4.4,
|
|
1300
1237
|
5
|
|
1301
|
-
].map((e) =>
|
|
1302
|
-
}),
|
|
1303
|
-
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o =
|
|
1238
|
+
].map((e) => kt(e * 2.4))
|
|
1239
|
+
}), jt = (e) => e[Math.floor(Math.random() * e.length)], Mt = (e, t, n, r) => {
|
|
1240
|
+
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = jt(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
|
|
1304
1241
|
return {
|
|
1305
1242
|
x: Math.random() * e,
|
|
1306
1243
|
y: r ?? Math.random() * t,
|
|
@@ -1314,25 +1251,25 @@ var xt = (e) => {
|
|
|
1314
1251
|
sprite: o,
|
|
1315
1252
|
drawSize: s
|
|
1316
1253
|
};
|
|
1317
|
-
},
|
|
1318
|
-
function
|
|
1319
|
-
let { ctx: t, width: n, height: r, activeWeather: i, dayCycleTimes: a = null, sceneTimeMs: o, liveClock: s = !1, windMotion: c, rainLevel: l = 5, snowLevel: u = 5, hailLevel: d = 2, fogLevel: f = 2, smogLevel: p = 2 } = e, m =
|
|
1254
|
+
}, Nt = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
|
|
1255
|
+
function Pt(e) {
|
|
1256
|
+
let { ctx: t, width: n, height: r, activeWeather: i, dayCycleTimes: a = null, sceneTimeMs: o, liveClock: s = !1, windMotion: c, rainLevel: l = 5, snowLevel: u = 5, hailLevel: d = 2, fogLevel: f = 2, smogLevel: p = 2 } = e, m = bt[i], h = (() => {
|
|
1320
1257
|
let e = m;
|
|
1321
|
-
return
|
|
1258
|
+
return xe(i) && e.rain && (e = {
|
|
1322
1259
|
...e,
|
|
1323
|
-
rain:
|
|
1324
|
-
}),
|
|
1260
|
+
rain: Ee(e.rain, l)
|
|
1261
|
+
}), Se(i) && (e = {
|
|
1325
1262
|
...e,
|
|
1326
|
-
snowCount:
|
|
1263
|
+
snowCount: De(u),
|
|
1327
1264
|
fogBanks: u >= 7 ? Math.max(e.fogBanks, 3) : e.fogBanks,
|
|
1328
1265
|
haze: u >= 7 ? Math.max(e.haze, .12) : e.haze
|
|
1329
|
-
}),
|
|
1330
|
-
})(), g =
|
|
1331
|
-
if (
|
|
1332
|
-
let e =
|
|
1333
|
-
|
|
1266
|
+
}), N(i) && (e = ie(e, f)), K(i) && (e = Ne(e, p)), e;
|
|
1267
|
+
})(), g = xt[i], _ = a ?? null, v = _ ? w(s ? Date.now() : o, _) : null, y = v ? !v.isDay : !1, b = v ? ee(h.sky, g.sky, v) : y ? g.sky : h.sky, x = y ? St(h.cloudColor) : h.cloudColor, S = Math.min(n, r) * .09, C = n * .72, E = r * .26;
|
|
1268
|
+
if (v) {
|
|
1269
|
+
let e = T(n, r, v.arcProgress);
|
|
1270
|
+
C = e.x, E = e.y;
|
|
1334
1271
|
}
|
|
1335
|
-
let
|
|
1272
|
+
let D = te(t, r, b), O = [
|
|
1336
1273
|
{
|
|
1337
1274
|
dx: -.32,
|
|
1338
1275
|
dy: .08,
|
|
@@ -1353,29 +1290,29 @@ function Dt(e) {
|
|
|
1353
1290
|
dy: .24,
|
|
1354
1291
|
r: .07
|
|
1355
1292
|
}
|
|
1356
|
-
],
|
|
1293
|
+
], k = Et(h, S), A = Dt(h, S, O), ne = y ? A : k, j = y || _ != null ? Array.from({ length: g.stars }, () => ({
|
|
1357
1294
|
x: Math.random() * n,
|
|
1358
1295
|
y: Math.random() * r * .72,
|
|
1359
1296
|
r: .4 + Math.random() * 1.1,
|
|
1360
1297
|
phase: Math.random() * Math.PI * 2,
|
|
1361
1298
|
speed: .015 + Math.random() * .035
|
|
1362
|
-
})) : [],
|
|
1299
|
+
})) : [], M = Array.from({ length: h.cloudCount }, () => wt(n, r, h.cloudSpread, x, h.cloudAlpha)), re = h.rain ? Array.from({ length: h.rain.count }, () => ({
|
|
1363
1300
|
x: Math.random() * (n + 160) - 80,
|
|
1364
1301
|
y: Math.random() * r,
|
|
1365
1302
|
len: 8 + Math.random() * 10,
|
|
1366
1303
|
speed: h.rain.speed * (.75 + Math.random() * .5)
|
|
1367
|
-
})) : [],
|
|
1304
|
+
})) : [], P = [], F = Array.from({ length: h.fogBanks }, (e, t) => ({
|
|
1368
1305
|
x: Math.random() * n,
|
|
1369
1306
|
y: t / Math.max(h.fogBanks - 1, 1) * r * .9 + r * .05,
|
|
1370
1307
|
rw: n * (.25 + Math.random() * .3),
|
|
1371
1308
|
rh: r * (.08 + Math.random() * .08),
|
|
1372
1309
|
speed: (.1 + Math.random() * .25) * (t % 2 == 0 ? 1 : -1),
|
|
1373
|
-
alpha: (.1 + Math.random() * .1) * (
|
|
1374
|
-
})),
|
|
1375
|
-
min:
|
|
1376
|
-
max:
|
|
1377
|
-
},
|
|
1378
|
-
let { count: e } =
|
|
1310
|
+
alpha: (.1 + Math.random() * .1) * (N(i) ? ae(f) : K(i) ? Pe(p) : 1)
|
|
1311
|
+
})), oe = h.fogBanks > 0 ? Tt(Nt(i, y)) : null, I = h.snowCount > 0 ? At() : null, L = I == null ? [] : Array.from({ length: h.snowCount }, () => Mt(n, r, I)), R = se(i) ? ce(d) : null, z = R == null ? null : lt(), le = z != null && R != null ? Array.from({ length: R.count }, () => ft(n, r, z, {
|
|
1312
|
+
min: R.sizeMin,
|
|
1313
|
+
max: R.sizeMax
|
|
1314
|
+
}, R.speedMul)) : [], ue = (() => {
|
|
1315
|
+
let { count: e } = Xe(c.visualLevel);
|
|
1379
1316
|
return e <= 0 ? [] : Array.from({ length: e }, () => ({
|
|
1380
1317
|
x: Math.random() * n,
|
|
1381
1318
|
y: Math.random() * r,
|
|
@@ -1386,166 +1323,249 @@ function Dt(e) {
|
|
|
1386
1323
|
width: .5 + Math.random() * 1.1,
|
|
1387
1324
|
phase: Math.random() * Math.PI * 2
|
|
1388
1325
|
}));
|
|
1389
|
-
})(),
|
|
1326
|
+
})(), de = [], fe = 120 + Math.random() * 240;
|
|
1390
1327
|
return {
|
|
1391
|
-
sky:
|
|
1392
|
-
cloudRgb:
|
|
1328
|
+
sky: b,
|
|
1329
|
+
cloudRgb: x,
|
|
1393
1330
|
cfg: h,
|
|
1394
|
-
sunX:
|
|
1395
|
-
sunY:
|
|
1396
|
-
sunR:
|
|
1397
|
-
skyGradient:
|
|
1398
|
-
celestial:
|
|
1399
|
-
sunSprite:
|
|
1400
|
-
moonSprite:
|
|
1401
|
-
fogSprite:
|
|
1331
|
+
sunX: C,
|
|
1332
|
+
sunY: E,
|
|
1333
|
+
sunR: S,
|
|
1334
|
+
skyGradient: D,
|
|
1335
|
+
celestial: ne,
|
|
1336
|
+
sunSprite: k,
|
|
1337
|
+
moonSprite: A,
|
|
1338
|
+
fogSprite: oe,
|
|
1402
1339
|
dayCycleTimes: _,
|
|
1403
|
-
dayCycle:
|
|
1340
|
+
dayCycle: v,
|
|
1404
1341
|
sceneTimeMs: o,
|
|
1405
1342
|
liveClock: s,
|
|
1406
|
-
hailSpec:
|
|
1343
|
+
hailSpec: R,
|
|
1407
1344
|
state: {
|
|
1408
|
-
stars:
|
|
1409
|
-
moonCraters:
|
|
1410
|
-
clouds:
|
|
1411
|
-
drops:
|
|
1412
|
-
splashes:
|
|
1413
|
-
fogBanks:
|
|
1414
|
-
flakes:
|
|
1415
|
-
hailstones:
|
|
1416
|
-
hailPool:
|
|
1417
|
-
windStreaks:
|
|
1345
|
+
stars: j,
|
|
1346
|
+
moonCraters: O,
|
|
1347
|
+
clouds: M,
|
|
1348
|
+
drops: re,
|
|
1349
|
+
splashes: P,
|
|
1350
|
+
fogBanks: F,
|
|
1351
|
+
flakes: L,
|
|
1352
|
+
hailstones: le,
|
|
1353
|
+
hailPool: z ?? [],
|
|
1354
|
+
windStreaks: ue,
|
|
1418
1355
|
t: 0,
|
|
1419
1356
|
flashAlpha: 0,
|
|
1420
1357
|
boltLife: 0,
|
|
1421
|
-
boltPoints:
|
|
1422
|
-
nextStrike:
|
|
1358
|
+
boltPoints: de,
|
|
1359
|
+
nextStrike: fe
|
|
1423
1360
|
}
|
|
1424
1361
|
};
|
|
1425
1362
|
}
|
|
1426
|
-
function
|
|
1363
|
+
function Ft(e, t) {
|
|
1427
1364
|
if (!e.dayCycleTimes) return;
|
|
1428
|
-
let n =
|
|
1429
|
-
e.dayCycle = n, e.activeNight = !n.isDay, e.sky = i, e.skyGradient =
|
|
1365
|
+
let n = w(e.liveClock ? t ?? Date.now() : e.sceneTimeMs, e.dayCycleTimes), r = xt[e.activeWeather], i = ee(e.cfg.sky, r.sky, n), a = T(e.width, e.height, n.arcProgress);
|
|
1366
|
+
e.dayCycle = n, e.activeNight = !n.isDay, e.sky = i, e.skyGradient = te(e.ctx, e.height, i), e.sunX = a.x, e.sunY = a.y, e.celestial = n.isDay ? e.sunSprite : e.moonSprite;
|
|
1430
1367
|
}
|
|
1431
1368
|
//#endregion
|
|
1432
1369
|
//#region src/components/weatherBackground/scene/create-weather-scene.ts
|
|
1433
|
-
function
|
|
1434
|
-
t && (e.state.t += 1), e.windField = Q(e.state.t, e.windMotion), e.dayCycleTimes &&
|
|
1370
|
+
function It(e, t) {
|
|
1371
|
+
t && (e.state.t += 1), e.windField = Q(e.state.t, e.windMotion), e.dayCycleTimes && Ft(e, e.liveClock ? Date.now() : e.sceneTimeMs), gt(e), yt(e), tt(e), nt(e), rt(e), pt(e), mt(e), ht(e), at(e), ot(e);
|
|
1435
1372
|
}
|
|
1436
|
-
function
|
|
1437
|
-
let { ctx: t, width: n, height: r, activeWeather:
|
|
1373
|
+
function Lt(e) {
|
|
1374
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a, windMotion: o } = e, l = Pt(e), u = {
|
|
1438
1375
|
ctx: t,
|
|
1439
1376
|
width: n,
|
|
1440
1377
|
height: r,
|
|
1441
|
-
activeWeather:
|
|
1442
|
-
activeNight:
|
|
1443
|
-
windMotion:
|
|
1444
|
-
windField: Q(0,
|
|
1445
|
-
...
|
|
1378
|
+
activeWeather: i,
|
|
1379
|
+
activeNight: l.dayCycle ? !l.dayCycle.isDay : a,
|
|
1380
|
+
windMotion: o,
|
|
1381
|
+
windField: Q(0, o),
|
|
1382
|
+
...l
|
|
1446
1383
|
};
|
|
1447
|
-
|
|
1448
|
-
let
|
|
1449
|
-
|
|
1450
|
-
}),
|
|
1451
|
-
|
|
1384
|
+
u.dayCycleTimes && Ft(u, u.liveClock ? Date.now() : u.sceneTimeMs);
|
|
1385
|
+
let f = document.hidden, p = d(), m = c((e) => {
|
|
1386
|
+
f = e;
|
|
1387
|
+
}), h = s((e) => {
|
|
1388
|
+
p = e;
|
|
1389
|
+
});
|
|
1390
|
+
if (p) return It(u, !1), () => {
|
|
1391
|
+
m(), h();
|
|
1392
|
+
};
|
|
1393
|
+
let g = 0, _ = () => {
|
|
1394
|
+
g = requestAnimationFrame(_), !f && (p || It(u, !0));
|
|
1452
1395
|
};
|
|
1453
|
-
return
|
|
1454
|
-
cancelAnimationFrame(
|
|
1396
|
+
return _(), () => {
|
|
1397
|
+
cancelAnimationFrame(g), m(), h();
|
|
1455
1398
|
};
|
|
1456
1399
|
}
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
let
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1400
|
+
//#endregion
|
|
1401
|
+
//#region src/components/weatherBackground/core/engine.ts
|
|
1402
|
+
var $ = "cos-weather-background", Rt = 800, zt = 450;
|
|
1403
|
+
function Bt(e, t = {}) {
|
|
1404
|
+
let n = {
|
|
1405
|
+
fill: !1,
|
|
1406
|
+
weather: "partlyCloudy",
|
|
1407
|
+
time: "14:00",
|
|
1408
|
+
live: !1,
|
|
1409
|
+
windLevel: 3,
|
|
1410
|
+
rainLevel: 5,
|
|
1411
|
+
snowLevel: 5,
|
|
1412
|
+
hailLevel: 2,
|
|
1413
|
+
fogLevel: 2,
|
|
1414
|
+
smogLevel: 2,
|
|
1415
|
+
loading: !1,
|
|
1416
|
+
loadingText: "天气加载中…",
|
|
1417
|
+
...t
|
|
1418
|
+
}, r = !1, i = n.width ?? Rt, a = n.height ?? zt, s = null, c = null, u = null, d = q, p = { current: n.onLiveWeather }, m = document.createElement("div");
|
|
1419
|
+
m.className = $;
|
|
1420
|
+
let h = document.createElement("canvas");
|
|
1421
|
+
h.className = `${$}__canvas`, h.setAttribute("role", "img");
|
|
1422
|
+
let g = document.createElement("div");
|
|
1423
|
+
g.className = `${$}__loading-overlay`, g.setAttribute("role", "status"), g.setAttribute("aria-live", "polite");
|
|
1424
|
+
let _ = document.createElement("div");
|
|
1425
|
+
_.className = `${$}__loading-spinner`, _.setAttribute("aria-hidden", "true");
|
|
1426
|
+
let v = document.createElement("span");
|
|
1427
|
+
g.append(_, v), m.append(h, g), e.appendChild(m), g.hidden = !0;
|
|
1428
|
+
let y = () => {
|
|
1429
|
+
o(e, m, {
|
|
1430
|
+
fill: !!n.fill,
|
|
1431
|
+
width: i,
|
|
1432
|
+
height: a
|
|
1433
|
+
}), h.style.width = `${i}px`, h.style.height = `${a}px`;
|
|
1434
|
+
}, b = (e, t, r) => {
|
|
1435
|
+
g.hidden = !(n.loading || n.live && (d.status === "locating" || d.status === "fetching")), v.textContent = n.loadingText ?? "天气加载中…", h.setAttribute("aria-label", n.ariaLabel ?? `天气背景:${e}${t ? "(夜间)" : ""},${r}级风`);
|
|
1436
|
+
}, S = () => {
|
|
1437
|
+
c?.(), c = null;
|
|
1438
|
+
let e = window.devicePixelRatio || 1;
|
|
1439
|
+
h.width = i * e, h.height = a * e;
|
|
1440
|
+
let t = h.getContext("2d");
|
|
1441
|
+
if (!t) return;
|
|
1442
|
+
t.setTransform(e, 0, 0, e, 0, 0);
|
|
1443
|
+
let r = !!n.live, o = U(r && d.weather ? d.weather : n.weather ?? "partlyCloudy"), s = r && d.rainLevel != null ? d.rainLevel : n.rainLevel ?? 5, l = r && d.snowLevel != null ? d.snowLevel : n.snowLevel ?? 5, u = r && d.fogLevel != null ? d.fogLevel : n.fogLevel ?? 2, f = r && d.hailLevel != null ? d.hailLevel : n.hailLevel ?? 2, p = r && d.smogLevel != null ? d.smogLevel : n.smogLevel ?? 2, m = Te(o, s, l), g = C(n.time), _ = d.current?.sunrise ?? null, v = d.current?.sunset ?? null, y = d.current?.windSpeed ?? null, S = r && _ != null && v != null ? {
|
|
1444
|
+
sunrise: _,
|
|
1445
|
+
sunset: v
|
|
1446
|
+
} : x(g), T = $e(et({
|
|
1447
|
+
live: r,
|
|
1448
|
+
windLevel: n.windLevel ?? 3,
|
|
1449
|
+
liveWindKmh: y
|
|
1450
|
+
})), E = r && d.current ? !d.current.isDay : !w(g, S).isDay;
|
|
1451
|
+
b(o, E, T.level), c = Lt({
|
|
1452
|
+
ctx: t,
|
|
1453
|
+
width: i,
|
|
1454
|
+
height: a,
|
|
1455
|
+
activeWeather: m,
|
|
1456
|
+
activeNight: E,
|
|
1457
|
+
dayCycleTimes: S,
|
|
1458
|
+
sceneTimeMs: g,
|
|
1459
|
+
liveClock: r,
|
|
1460
|
+
windMotion: T,
|
|
1461
|
+
rainLevel: s,
|
|
1462
|
+
snowLevel: l,
|
|
1463
|
+
fogLevel: u,
|
|
1464
|
+
hailLevel: f,
|
|
1465
|
+
smogLevel: p
|
|
1466
|
+
});
|
|
1467
|
+
}, T = () => {
|
|
1468
|
+
if (u?.(), u = null, !n.live) {
|
|
1469
|
+
d = q, S();
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
u = Ue(!0, n.latitude != null && n.longitude != null ? {
|
|
1473
|
+
latitude: n.latitude,
|
|
1474
|
+
longitude: n.longitude
|
|
1475
|
+
} : void 0, (e) => {
|
|
1476
|
+
d = e, e.weather && p.current?.(U(e.weather)), S();
|
|
1477
|
+
});
|
|
1478
|
+
}, E = () => {
|
|
1479
|
+
if (s?.(), s = null, !(n.fill ?? !1)) {
|
|
1480
|
+
i = n.width ?? Rt, a = n.height ?? zt, y(), S();
|
|
1481
|
+
return;
|
|
1482
|
+
}
|
|
1483
|
+
s = l(e, (e) => {
|
|
1484
|
+
let t = f({
|
|
1485
|
+
fill: !0,
|
|
1486
|
+
width: n.width,
|
|
1487
|
+
height: n.height,
|
|
1488
|
+
defaultWidth: Rt,
|
|
1489
|
+
defaultHeight: zt,
|
|
1490
|
+
measured: e
|
|
1491
|
+
});
|
|
1492
|
+
i = t.width, a = t.height, y(), S();
|
|
1511
1493
|
});
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1494
|
+
};
|
|
1495
|
+
return E(), T(), {
|
|
1496
|
+
update(e) {
|
|
1497
|
+
let t = n;
|
|
1498
|
+
n = {
|
|
1499
|
+
...n,
|
|
1500
|
+
...e
|
|
1501
|
+
}, p.current = n.onLiveWeather;
|
|
1502
|
+
let r = t.live !== n.live || t.latitude !== n.latitude || t.longitude !== n.longitude;
|
|
1503
|
+
if (t.fill !== n.fill || t.width !== n.width || t.height !== n.height) E();
|
|
1504
|
+
else if (r) T();
|
|
1505
|
+
else {
|
|
1506
|
+
let e = (e) => JSON.stringify(e, (e, t) => typeof t == "function" ? void 0 : t);
|
|
1507
|
+
e(t) !== e(n) && S();
|
|
1508
|
+
}
|
|
1509
|
+
},
|
|
1510
|
+
destroy() {
|
|
1511
|
+
r || (r = !0, c?.(), u?.(), s?.(), m.remove());
|
|
1512
|
+
}
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
//#endregion
|
|
1516
|
+
//#region src/components/weatherBackground/react/index.tsx
|
|
1517
|
+
var Vt = e((e, a) => {
|
|
1518
|
+
let o = i(null), s = i(null), c = i(e);
|
|
1519
|
+
c.current = e;
|
|
1520
|
+
let l = r(() => u(e), [e]);
|
|
1521
|
+
return n(a, () => ({})), t(() => {
|
|
1522
|
+
let e = o.current;
|
|
1523
|
+
if (!e) return;
|
|
1524
|
+
let t = Bt(e, c.current);
|
|
1525
|
+
return s.current = t, () => {
|
|
1526
|
+
t.destroy(), s.current = null;
|
|
1527
|
+
};
|
|
1528
|
+
}, []), t(() => {
|
|
1529
|
+
s.current?.update(c.current);
|
|
1530
|
+
}, [l]), /* @__PURE__ */ p("div", {
|
|
1531
|
+
ref: o,
|
|
1532
|
+
className: "cos-weatherBackground-host"
|
|
1548
1533
|
});
|
|
1534
|
+
});
|
|
1535
|
+
Vt.displayName = "WeatherBackground";
|
|
1536
|
+
//#endregion
|
|
1537
|
+
//#region src/components/weatherBackground/live-weather.ts
|
|
1538
|
+
var Ht = (e = !0, n) => {
|
|
1539
|
+
let r = J(n), i = r ? n.latitude : null, o = r ? n.longitude : null, s = `${e}:${i},${o}`, c = e ? r ? {
|
|
1540
|
+
...q,
|
|
1541
|
+
status: "fetching"
|
|
1542
|
+
} : {
|
|
1543
|
+
...q,
|
|
1544
|
+
status: "locating"
|
|
1545
|
+
} : q, [l, u] = a(c), [d, f] = a(s);
|
|
1546
|
+
return d !== s && (f(s), u((t) => e && t.weather ? {
|
|
1547
|
+
...c,
|
|
1548
|
+
weather: t.weather,
|
|
1549
|
+
current: t.current
|
|
1550
|
+
} : c)), t(() => Ue(e, n, u), [
|
|
1551
|
+
n,
|
|
1552
|
+
e,
|
|
1553
|
+
i,
|
|
1554
|
+
o
|
|
1555
|
+
]), l;
|
|
1556
|
+
}, Ut = (e) => {
|
|
1557
|
+
let n = J(e), r = n ? e.latitude : null, i = n ? e.longitude : null, o = `${r},${i}`, [s, c] = a(null), [l, u] = a(o);
|
|
1558
|
+
return l !== o && (u(o), c(null)), t(() => {
|
|
1559
|
+
if (r == null || i == null) return;
|
|
1560
|
+
let e = !1, t = new AbortController();
|
|
1561
|
+
return We(r, i, t.signal).then((t) => {
|
|
1562
|
+
e || c(t);
|
|
1563
|
+
}).catch(() => {
|
|
1564
|
+
e || c(null);
|
|
1565
|
+
}), () => {
|
|
1566
|
+
e = !0, t.abort();
|
|
1567
|
+
};
|
|
1568
|
+
}, [r, i]), n ? s : null;
|
|
1549
1569
|
};
|
|
1550
1570
|
//#endregion
|
|
1551
|
-
export {
|
|
1571
|
+
export { ne as DEFAULT_FOG_LEVEL, oe as DEFAULT_HAIL_LEVEL, de as DEFAULT_RAIN_LEVEL, Ae as DEFAULT_SMOG_LEVEL, fe as DEFAULT_SNOW_LEVEL, Ge as DEFAULT_WIND_LEVEL, j as FOG_LEVEL_LABELS, I as HAIL_LEVEL_LABELS, ue as MAX_PRECIP_LEVEL, le as MIN_PRECIP_LEVEL, _e as RAIN_LEVEL_LABELS, je as SMOG_LEVEL_LABELS, ve as SNOW_LEVEL_LABELS, Vt as WeatherBackground, Vt as default, $e as buildWindMotion, M as clampFogLevel, L as clampHailLevel, B as clampPrecipLevel, G as clampSmogLevel, ae as fogBankAlphaScale, F as fogLevelFromVisibility, P as fogLevelFromWmo, re as formatFogLevel, R as formatHailLevel, Ve as formatLocalHm, ge as formatPrecipLevel, Me as formatSmogLevel, z as hailLevelFromWmo, ce as hailSpec, ie as intensifyFogConfig, Ee as intensifyRainConfig, Ne as intensifySmogConfig, De as intensifySnowCount, ye as isRainWeather, be as isSnowWeather, Qe as kmhToWindLevel, Le as mapWmoCodeToWeatherType, U as normalizeWeatherType, H as precipBand, he as precipLabel, Ce as rainLevelFromWeather, Oe as rainLevelFromWmo, Te as resolveSceneWeather, Q as sampleWindField, Pe as smogBankAlphaScale, Fe as smogLevelFromVisibility, we as snowLevelFromWeather, ke as snowLevelFromWmo, N as supportsFogLevel, se as supportsHailLevel, xe as supportsRainLevel, K as supportsSmogLevel, Se as supportsSnowLevel, Ht as useLiveWeather, Ut as useSunTimes, Ke as visualWindLevel, Ze as windLevelToKmh, Xe as windStreakSpec };
|