@idmui/spot 0.1.8 → 0.2.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/index.js +47 -47
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,8 +7,8 @@ import { markRaw as Ct, resolveComponent as gt, openBlock as o, createElementBlo
|
|
|
7
7
|
import kt from "axios";
|
|
8
8
|
class Dt {
|
|
9
9
|
static pickHourly(t, e) {
|
|
10
|
-
var h, s, v,
|
|
11
|
-
const ft = typeof e == "string" ? X(e) : e, $ = t == null ? void 0 : t.weather, yt = t == null ? void 0 : t.marine, _t = X((s = (h = $ == null ? void 0 : $[0]) == null ? void 0 : h.hourly) == null ? void 0 : s.date).utc(), pt = _t.clone().add((
|
|
10
|
+
var h, s, v, C, P, L, N, I, M, H, a, n, Q, K, S, T, R, E, A, G, F, O, B, V, U, Z, J, Y, w, k, p, y, D, g, j, et, at, rt, ot, W, st, m, it, u, lt, ht, dt, xt;
|
|
11
|
+
const ft = typeof e == "string" ? X(e) : e, $ = t == null ? void 0 : t.weather, yt = t == null ? void 0 : t.marine, _t = X((s = (h = $ == null ? void 0 : $[0]) == null ? void 0 : h.hourly) == null ? void 0 : s.date).utc(), pt = _t.clone().add((P = (C = (v = $ == null ? void 0 : $[0]) == null ? void 0 : v.hourly) == null ? void 0 : C.time) == null ? void 0 : P.at(0), "h"), St = _t.clone().add((I = (N = (L = $ == null ? void 0 : $[0]) == null ? void 0 : L.hourly) == null ? void 0 : N.time) == null ? void 0 : I.at(-1), "h"), zt = [];
|
|
12
12
|
if (ft.isBetween(pt, St, "millisecond", "[]")) {
|
|
13
13
|
const d = ft.utc().diff(pt, "h", !1);
|
|
14
14
|
let q, nt;
|
|
@@ -16,15 +16,15 @@ class Dt {
|
|
|
16
16
|
for (const mt of $) {
|
|
17
17
|
const c = mt.hourly;
|
|
18
18
|
q = {
|
|
19
|
-
temp: (
|
|
20
|
-
apparentTemp: (
|
|
19
|
+
temp: (M = c.temperature_2m) == null ? void 0 : M.at(d),
|
|
20
|
+
apparentTemp: (H = c.apparent_temperature) == null ? void 0 : H.at(d),
|
|
21
21
|
rh: (a = c.relative_humidity_2m) == null ? void 0 : a.at(d),
|
|
22
22
|
dp: (n = c.dew_point_2m) == null ? void 0 : n.at(d),
|
|
23
23
|
precip: {
|
|
24
24
|
probability: (Q = c.precipitation_probability) == null ? void 0 : Q.at(d),
|
|
25
25
|
sum: (K = c.precipitation) == null ? void 0 : K.at(d)
|
|
26
26
|
},
|
|
27
|
-
pmsl: (
|
|
27
|
+
pmsl: (S = c.pressure_msl) == null ? void 0 : S.at(d),
|
|
28
28
|
psurf: (T = c.surface_pressure) == null ? void 0 : T.at(d),
|
|
29
29
|
code: (R = c.weather_code) == null ? void 0 : R.at(d),
|
|
30
30
|
visibility: this.m2nm((E = c.visibility) == null ? void 0 : E.at(d)),
|
|
@@ -54,7 +54,7 @@ class Dt {
|
|
|
54
54
|
swell: {
|
|
55
55
|
height: (p = c.swell_wave_height) == null ? void 0 : p.at(d),
|
|
56
56
|
degree: (y = c.swell_wave_direction) == null ? void 0 : y.at(d),
|
|
57
|
-
bearing: ((
|
|
57
|
+
bearing: ((D = c.swell_wave_direction) == null ? void 0 : D.at(d)) !== null ? (((g = c.swell_wave_direction) == null ? void 0 : g.at(d)) + 180) % 360 : null,
|
|
58
58
|
period: (j = c.swell_wave_period) == null ? void 0 : j.at(d),
|
|
59
59
|
peakPeriod: (et = c.swell_wave_peak_period) == null ? void 0 : et.at(d)
|
|
60
60
|
},
|
|
@@ -105,8 +105,8 @@ class Dt {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
static pickDaily(t, e) {
|
|
108
|
-
var h, s, v,
|
|
109
|
-
const g = typeof e == "string" ? X(e) : e, j = t == null ? void 0 : t.weather, et = t == null ? void 0 : t.marine, at = X((v = (s = (h = j == null ? void 0 : j[0]) == null ? void 0 : h.daily) == null ? void 0 : s.time) == null ? void 0 : v.at(0)), rt = X((
|
|
108
|
+
var h, s, v, C, P, L, N, I, M, H, a, n, Q, K, S, T, R, E, A, G, F, O, B, V, U, Z, J, Y, w, k, p, y, D;
|
|
109
|
+
const g = typeof e == "string" ? X(e) : e, j = t == null ? void 0 : t.weather, et = t == null ? void 0 : t.marine, at = X((v = (s = (h = j == null ? void 0 : j[0]) == null ? void 0 : h.daily) == null ? void 0 : s.time) == null ? void 0 : v.at(0)), rt = X((L = (P = (C = j == null ? void 0 : j[0]) == null ? void 0 : C.daily) == null ? void 0 : P.time) == null ? void 0 : L.at(-1)), ot = [];
|
|
110
110
|
if (g.isBetween(at, rt, "millisecond", "[]")) {
|
|
111
111
|
let W, st;
|
|
112
112
|
const m = g.diff(at, "d", !1);
|
|
@@ -114,11 +114,11 @@ class Dt {
|
|
|
114
114
|
for (const it of j) {
|
|
115
115
|
const u = it.daily;
|
|
116
116
|
W = {
|
|
117
|
-
code: (
|
|
117
|
+
code: (N = u.weather_code) == null ? void 0 : N.at(m),
|
|
118
118
|
temp: {
|
|
119
|
-
max: (
|
|
120
|
-
min: (
|
|
121
|
-
mean: (
|
|
119
|
+
max: (I = u.temperature_2m_max) == null ? void 0 : I.at(m),
|
|
120
|
+
min: (M = u.temperature_2m_min) == null ? void 0 : M.at(m),
|
|
121
|
+
mean: (H = u.temperature_2m_mean) == null ? void 0 : H.at(m)
|
|
122
122
|
},
|
|
123
123
|
apparentTemp: {
|
|
124
124
|
max: (a = u.apparent_temperature_max) == null ? void 0 : a.at(m),
|
|
@@ -127,7 +127,7 @@ class Dt {
|
|
|
127
127
|
precip: {
|
|
128
128
|
sum: (Q = u.precipitation_sum) == null ? void 0 : Q.at(m),
|
|
129
129
|
hours: (K = u.precipitation_hours) == null ? void 0 : K.at(m),
|
|
130
|
-
probability: (
|
|
130
|
+
probability: (S = u.precipitation_probability_max) == null ? void 0 : S.at(m)
|
|
131
131
|
},
|
|
132
132
|
rh: {
|
|
133
133
|
max: (T = u.relative_humidity_2m_max) == null ? void 0 : T.at(m),
|
|
@@ -164,7 +164,7 @@ class Dt {
|
|
|
164
164
|
height: (k = u.wind_wave_height_max) == null ? void 0 : k.at(m),
|
|
165
165
|
degree: (p = u.wind_wave_direction_dominant) == null ? void 0 : p.at(m),
|
|
166
166
|
period: (y = u.wind_wave_period_max) == null ? void 0 : y.at(m),
|
|
167
|
-
peakPeriod: (
|
|
167
|
+
peakPeriod: (D = u.wind_wave_peak_period_max) == null ? void 0 : D.at(m)
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
}, st.wave = this.parseWave(st.wave);
|
|
@@ -668,7 +668,7 @@ const Wt = (l, t) => {
|
|
|
668
668
|
});
|
|
669
669
|
},
|
|
670
670
|
initTableData() {
|
|
671
|
-
var l, t, e, h, s, v,
|
|
671
|
+
var l, t, e, h, s, v, C, P, L, N, I, M, H, a, n, Q, K, S, T, R, E, A, G, F, O, B, V, U, Z, J, Y, w, k, p;
|
|
672
672
|
this.tableData = {
|
|
673
673
|
hours: [],
|
|
674
674
|
utcHours: [],
|
|
@@ -696,22 +696,22 @@ const Wt = (l, t) => {
|
|
|
696
696
|
seaTemp: []
|
|
697
697
|
};
|
|
698
698
|
for (let y = 0; y < 24; y++) {
|
|
699
|
-
const
|
|
700
|
-
this.tableData.hours.push(
|
|
701
|
-
const g = ((l = Dt.pickHourly(this.meteoData,
|
|
702
|
-
this.tableData.weatherUrls.push((t = g.weather) == null ? void 0 : t.url), this.tableData.weatherNames.push(((e = g.weather) == null ? void 0 : e.name) ?? "-"), this.tableData.temp.push(this.roundPrecision((h = g.weather) == null ? void 0 : h.temp, 0) ?? "-"), this.tableData.precipProbability.push(this.roundPrecision((v = (s = g.weather) == null ? void 0 : s.precip) == null ? void 0 : v.probability, 0) ?? "-"), this.tableData.precip1h.push(this.roundPrecision((
|
|
699
|
+
const D = X(this.pickedDate).clone().add(y, "h").format();
|
|
700
|
+
this.tableData.hours.push(D);
|
|
701
|
+
const g = ((l = Dt.pickHourly(this.meteoData, D)) == null ? void 0 : l[0]) || {};
|
|
702
|
+
this.tableData.weatherUrls.push((t = g.weather) == null ? void 0 : t.url), this.tableData.weatherNames.push(((e = g.weather) == null ? void 0 : e.name) ?? "-"), this.tableData.temp.push(this.roundPrecision((h = g.weather) == null ? void 0 : h.temp, 0) ?? "-"), this.tableData.precipProbability.push(this.roundPrecision((v = (s = g.weather) == null ? void 0 : s.precip) == null ? void 0 : v.probability, 0) ?? "-"), this.tableData.precip1h.push(this.roundPrecision((P = (C = g.weather) == null ? void 0 : C.precip) == null ? void 0 : P.sum, 0) ?? "-"), this.tableData.visibility.push(this.roundPrecision((L = g.weather) == null ? void 0 : L.visibility, 0) ?? "-"), this.tableData.humidity.push(this.roundPrecision((N = g.weather) == null ? void 0 : N.rh, 0) ?? "-"), this.tableData.windSpeed.push(this.roundPrecision((M = (I = g.weather) == null ? void 0 : I.wind) == null ? void 0 : M.kts, 1)), this.tableData.windDir.push((a = (H = g.weather) == null ? void 0 : H.wind) == null ? void 0 : a.bearing), this.tableData.windGust.push(this.roundPrecision((Q = (n = g.weather) == null ? void 0 : n.wind) == null ? void 0 : Q.gusts, 1) ?? "-"), this.tableData.sigwaveHeight.push(this.roundPrecision((S = (K = g.wave) == null ? void 0 : K.sig) == null ? void 0 : S.height, 1) ?? "-"), this.tableData.sigwaveDir.push((R = (T = g.wave) == null ? void 0 : T.sig) == null ? void 0 : R.bearing), this.tableData.windwaveHeight.push(this.roundPrecision((A = (E = g.wave) == null ? void 0 : E.wd) == null ? void 0 : A.height, 1) ?? "-"), this.tableData.windwaveDir.push((F = (G = g.wave) == null ? void 0 : G.wd) == null ? void 0 : F.bearing), this.tableData.windwavePeriod.push(this.roundPrecision((B = (O = g.wave) == null ? void 0 : O.wd) == null ? void 0 : B.period, 1) ?? "-"), this.tableData.swellHeight.push(this.roundPrecision((U = (V = g.wave) == null ? void 0 : V.swell) == null ? void 0 : U.height, 1) ?? "-"), this.tableData.swellDir.push((J = (Z = g.wave) == null ? void 0 : Z.swell) == null ? void 0 : J.bearing), this.tableData.swellPeriod.push(this.roundPrecision((w = (Y = g.wave) == null ? void 0 : Y.swell) == null ? void 0 : w.period, 1) ?? "-"), this.tableData.currentSpeed.push(this.roundPrecision((k = g.current) == null ? void 0 : k.speed, 1) ?? "-"), this.tableData.currentDir.push((p = g.current) == null ? void 0 : p.bearing), this.tableData.seaLevel.push(this.roundPrecision(g.height, 1) ?? "-"), this.tableData.seaTemp.push(this.roundPrecision(g.sst, 0) ?? "-");
|
|
703
703
|
}
|
|
704
704
|
},
|
|
705
705
|
initEchart() {
|
|
706
706
|
var T, R, E, A, G, F, O, B, V, U, Z, J, Y;
|
|
707
|
-
const l = [], t = [], e = [], h = [], s = [], v = [],
|
|
707
|
+
const l = [], t = [], e = [], h = [], s = [], v = [], C = [], P = [], L = [], N = [], I = {};
|
|
708
708
|
for (let w = 0; w < 7; w++) {
|
|
709
709
|
const k = X(this.pickedDate).clone().add(w, "d");
|
|
710
710
|
l.push(tt(k).tz(this.positionGmt).format("yyyy-MM-DD")), t.push(this.computeMMMDD(k)), e.push(w === 0 ? "Today" : this.computeWeek(k));
|
|
711
711
|
const p = ((T = Dt.pickDaily(this.meteoData, k)) == null ? void 0 : T[0]) || {};
|
|
712
|
-
h.push(this.roundPrecision((E = (R = p.weather) == null ? void 0 : R.temp) == null ? void 0 : E.min, 0)), s.push(this.roundPrecision((G = (A = p.weather) == null ? void 0 : A.temp) == null ? void 0 : G.max, 0)),
|
|
712
|
+
h.push(this.roundPrecision((E = (R = p.weather) == null ? void 0 : R.temp) == null ? void 0 : E.min, 0)), s.push(this.roundPrecision((G = (A = p.weather) == null ? void 0 : A.temp) == null ? void 0 : G.max, 0)), P.push(this.roundPrecision((O = (F = p.weather) == null ? void 0 : F.wind) == null ? void 0 : O.kts, 1) ?? "- kts"), N.push(this.roundPrecision((V = (B = p.weather) == null ? void 0 : B.precip) == null ? void 0 : V.sum, 0) ?? "- mm"), v.push({ symbol: "image://" + ((U = p.weather) == null ? void 0 : U.url) }), C.push((Z = p.weather) == null ? void 0 : Z.name), L.push((Y = (J = p.weather) == null ? void 0 : J.wind) == null ? void 0 : Y.degree);
|
|
713
713
|
}
|
|
714
|
-
const
|
|
714
|
+
const M = Math.max(...s.filter((w) => typeof w == "number" && !isNaN(w))) - Math.min(...h.filter((w) => typeof w == "number" && !isNaN(w))), H = Math.min(...h.filter((w) => typeof w == "number" && !isNaN(w))) - 1.5 * M, a = Math.max(...s.filter((w) => typeof w == "number" && !isNaN(w))) + 2 * M, n = 4 + 0.5 / l.length * 92 + "%", Q = "data:image/svg+xml;base64," + window.btoa(
|
|
715
715
|
unescape(
|
|
716
716
|
encodeURIComponent(
|
|
717
717
|
'<svg t="1740385441519" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10951" width="200" height="200"><path d="M512 804.83593751A276.87183211 276.87183211 0 0 1 235.12816789 527.9641054Q235.12816789 375.21005376 512 13.82031251q276.87183211 361.30792288 276.87183211 514.14379289a276.87183211 276.87183211 0 0 1-276.87183211 276.87183211zM294.4461577 527.9641054a217.47202472 217.47202472 0 0 0 217.5538423 217.55384231 19.79993605 19.79993605 0 1 0 0-39.51805453 177.9539702 177.9539702 0 0 1-177.9539702-178.03578778 19.79993605 19.79993605 0 0 0-39.5998721 0z" fill="#0c73a8" p-id="10952"></path></svg>'
|
|
@@ -723,15 +723,15 @@ const Wt = (l, t) => {
|
|
|
723
723
|
'<svg t="1740383449285" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10797" width="200" height="200"><path d="M133.8 579l-44.4-44.4c-18.8-18.8-18.8-49.2 0-67.8L478 78c18.8-18.8 49.2-18.8 67.8 0l388.6 388.6c18.8 18.8 18.8 49.2 0 67.8L890 578.8c-19 19-50 18.6-68.6-0.8L592 337.2V912c0 26.6-21.4 48-48 48h-64c-26.6 0-48-21.4-48-48V337.2L202.4 578.2c-18.6 19.6-49.6 20-68.6 0.8z" fill="#ffffff" p-id="10798"></path></svg>'
|
|
724
724
|
)
|
|
725
725
|
)
|
|
726
|
-
),
|
|
727
|
-
|
|
726
|
+
), S = new Image(64, 64);
|
|
727
|
+
S.src = K, S.onload = () => {
|
|
728
728
|
for (let p = 0; p < 7; p++) {
|
|
729
|
-
const y = document.createElement("canvas"),
|
|
730
|
-
y.width =
|
|
731
|
-
const j =
|
|
732
|
-
|
|
729
|
+
const y = document.createElement("canvas"), D = y.getContext("2d");
|
|
730
|
+
y.width = S.width, y.height = S.height;
|
|
731
|
+
const j = L[p] * (Math.PI / 180);
|
|
732
|
+
D.translate(y.width / 2, y.height / 2), D.rotate(j), D.translate(-S.width / 2, -S.height / 2), D.drawImage(S, 0, 0, 64, 64);
|
|
733
733
|
const et = y.toDataURL();
|
|
734
|
-
|
|
734
|
+
I[`WindIcon${p}`] = {
|
|
735
735
|
height: 12,
|
|
736
736
|
width: 12,
|
|
737
737
|
align: "left",
|
|
@@ -752,7 +752,7 @@ const Wt = (l, t) => {
|
|
|
752
752
|
show: !0,
|
|
753
753
|
position: "right",
|
|
754
754
|
formatter: function(p) {
|
|
755
|
-
return p.seriesName === "Weather Icon" ?
|
|
755
|
+
return p.seriesName === "Weather Icon" ? C[p.dataIndex] : !1;
|
|
756
756
|
}
|
|
757
757
|
},
|
|
758
758
|
legend: {
|
|
@@ -903,7 +903,7 @@ const Wt = (l, t) => {
|
|
|
903
903
|
type: "value",
|
|
904
904
|
name: "温度(℃)",
|
|
905
905
|
show: !1,
|
|
906
|
-
min:
|
|
906
|
+
min: H,
|
|
907
907
|
max: a,
|
|
908
908
|
axisLabel: {
|
|
909
909
|
formatter: "{value} °C"
|
|
@@ -994,13 +994,13 @@ const Wt = (l, t) => {
|
|
|
994
994
|
singleAxisIndex: 3,
|
|
995
995
|
coordinateSystem: "singleAxis",
|
|
996
996
|
type: "scatter",
|
|
997
|
-
data:
|
|
997
|
+
data: P,
|
|
998
998
|
label: {
|
|
999
999
|
show: !0,
|
|
1000
1000
|
color: "#fff",
|
|
1001
1001
|
// formatter: '{c}'
|
|
1002
1002
|
rich: {
|
|
1003
|
-
...
|
|
1003
|
+
...I,
|
|
1004
1004
|
title: {
|
|
1005
1005
|
align: "center",
|
|
1006
1006
|
vertical: "center"
|
|
@@ -1016,7 +1016,7 @@ const Wt = (l, t) => {
|
|
|
1016
1016
|
singleAxisIndex: 4,
|
|
1017
1017
|
coordinateSystem: "singleAxis",
|
|
1018
1018
|
type: "scatter",
|
|
1019
|
-
data:
|
|
1019
|
+
data: N,
|
|
1020
1020
|
label: {
|
|
1021
1021
|
show: !0,
|
|
1022
1022
|
color: "#fff",
|
|
@@ -1044,8 +1044,8 @@ const Wt = (l, t) => {
|
|
|
1044
1044
|
]
|
|
1045
1045
|
};
|
|
1046
1046
|
w.setOption(k), w.on("click", (p) => {
|
|
1047
|
-
const y = p.dataIndex;
|
|
1048
|
-
this.pickedDate = tt(
|
|
1047
|
+
const y = p.dataIndex, D = l[y].split("-");
|
|
1048
|
+
this.pickedDate = tt().tz(this.positionGmt).set({ year: D[0], month: Number(D[1] - 1), date: Number(D[2]), hour: 0, minute: 0, second: 0, millisecond: 0 }).format(), this.pickedWeek = y === 0 ? "Today" : this.computeWeek(this.pickedDate), this.activeIndex = y === 0 ? tt(this.ts).tz(this.positionGmt).hour() : void 0, this.initTableData(), k.series[3].markArea = {
|
|
1049
1049
|
itemStyle: {
|
|
1050
1050
|
color: "rgb(71,143,206)"
|
|
1051
1051
|
},
|
|
@@ -1129,13 +1129,13 @@ const Wt = (l, t) => {
|
|
|
1129
1129
|
class: "card-box flex-center"
|
|
1130
1130
|
};
|
|
1131
1131
|
function Ne(l, t, e, h, s, v) {
|
|
1132
|
-
var
|
|
1133
|
-
const
|
|
1132
|
+
var N, I, M, H;
|
|
1133
|
+
const C = gt("ElOption"), P = gt("ElSelect"), L = gt("ElTooltip");
|
|
1134
1134
|
return o(), r("div", Rt, [
|
|
1135
1135
|
i("div", Et, [
|
|
1136
1136
|
i("div", At, [
|
|
1137
1137
|
i("div", Gt, [
|
|
1138
|
-
vt(
|
|
1138
|
+
vt(P, {
|
|
1139
1139
|
modelValue: s.searchName,
|
|
1140
1140
|
"onUpdate:modelValue": t[0] || (t[0] = (a) => s.searchName = a),
|
|
1141
1141
|
filterable: "",
|
|
@@ -1151,7 +1151,7 @@ function Ne(l, t, e, h, s, v) {
|
|
|
1151
1151
|
onChange: v.handleSearch
|
|
1152
1152
|
}, {
|
|
1153
1153
|
default: bt(() => [
|
|
1154
|
-
(o(!0), r(b, null, x(s.positionList, (a) => (o(), Pt(
|
|
1154
|
+
(o(!0), r(b, null, x(s.positionList, (a) => (o(), Pt(C, {
|
|
1155
1155
|
key: a.name,
|
|
1156
1156
|
label: a.name,
|
|
1157
1157
|
value: a.name
|
|
@@ -1165,11 +1165,11 @@ function Ne(l, t, e, h, s, v) {
|
|
|
1165
1165
|
i("div", Ft, [
|
|
1166
1166
|
i("div", Ot, [
|
|
1167
1167
|
i("div", null, [
|
|
1168
|
-
i("div", Bt, "Weather forecast for " + f(((
|
|
1169
|
-
i("div", Vt, "At " + f((
|
|
1168
|
+
i("div", Bt, "Weather forecast for " + f(((N = s.position) == null ? void 0 : N.name) || "-") + " ( " + f(s.positionOffset) + " )", 1),
|
|
1169
|
+
i("div", Vt, "At " + f((I = s.position) != null && I.portId ? "port" : "coordinates") + ", issued " + f(s.issuedDate), 1)
|
|
1170
1170
|
]),
|
|
1171
1171
|
i("div", Ut, [
|
|
1172
|
-
vt(
|
|
1172
|
+
vt(L, {
|
|
1173
1173
|
placement: "left",
|
|
1174
1174
|
effect: "light",
|
|
1175
1175
|
content: s.isCollected ? "remove the port/coordinate from the search list" : "add the port/coordinate to the search list",
|
|
@@ -1190,8 +1190,8 @@ function Ne(l, t, e, h, s, v) {
|
|
|
1190
1190
|
}, 8, ["content"])
|
|
1191
1191
|
])
|
|
1192
1192
|
]),
|
|
1193
|
-
(
|
|
1194
|
-
(
|
|
1193
|
+
(M = s.position) != null && M.name && e.token && !s.loading ? (o(), r("div", Zt)) : s.loading ? (o(), r("div", Jt, "Loading....")) : (o(), r("div", Yt, "No Data")),
|
|
1194
|
+
(H = s.position) != null && H.name && e.token && !s.loading ? (o(), r("div", jt, [
|
|
1195
1195
|
i("div", qt, f(s.pickedWeek) + " " + f(v.computeMMMDD(s.pickedDate)), 1),
|
|
1196
1196
|
i("table", Qt, [
|
|
1197
1197
|
i("tr", Kt, [
|
|
@@ -1241,7 +1241,7 @@ function Ne(l, t, e, h, s, v) {
|
|
|
1241
1241
|
class: z(s.activeIndex === n ? "active" : ""),
|
|
1242
1242
|
key: Math.random() + "url"
|
|
1243
1243
|
}, [
|
|
1244
|
-
vt(
|
|
1244
|
+
vt(L, {
|
|
1245
1245
|
placement: "top",
|
|
1246
1246
|
effect: "light",
|
|
1247
1247
|
content: s.tableData.weatherNames[n],
|
|
@@ -1597,7 +1597,7 @@ function Ne(l, t, e, h, s, v) {
|
|
|
1597
1597
|
])
|
|
1598
1598
|
]);
|
|
1599
1599
|
}
|
|
1600
|
-
const Ie = /* @__PURE__ */ Wt(Tt, [["render", Ne], ["__scopeId", "data-v-
|
|
1600
|
+
const Ie = /* @__PURE__ */ Wt(Tt, [["render", Ne], ["__scopeId", "data-v-969b448f"]]), Re = {
|
|
1601
1601
|
install(l) {
|
|
1602
1602
|
l.component("SpotReport", Ie);
|
|
1603
1603
|
}
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("moment"),require("moment-timezone"),require("@element-plus/icons-vue"),require("@idm-plugin/geo"),require("echarts"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","moment","moment-timezone","@element-plus/icons-vue","@idm-plugin/geo","echarts","vue","axios"],f):(k=typeof globalThis<"u"?globalThis:k||self,f(k["idmui-spot"]={},k.moment,k["moment-timezone"],k["@element-plus/icons-vue"],k["@idm-plugin/geo"],k.echarts,k.Vue,k.axios))})(this,function(k,f,J,ue,oe,xe,e,ce){"use strict";function ke(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const s in i)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>i[s]})}}return t.default=i,Object.freeze(t)}const ie=ke(xe);class de{static pickHourly(t,s){var r,a,w,E,D,y,_,z,N,B,n,o,j,Z,x,L,C,I,M,P,T,H,F,W,R,A,O,G,p,u,d,b,S,g,v,Q,X,te,ee,V,K,h,U,m,se,ae,ne,me;const pe=typeof s=="string"?f(s):s,Y=t==null?void 0:t.weather,ge=t==null?void 0:t.marine,we=f((a=(r=Y==null?void 0:Y[0])==null?void 0:r.hourly)==null?void 0:a.date).utc(),re=we.clone().add((D=(E=(w=Y==null?void 0:Y[0])==null?void 0:w.hourly)==null?void 0:E.time)==null?void 0:D.at(0),"h"),bt=we.clone().add((z=(_=(y=Y==null?void 0:Y[0])==null?void 0:y.hourly)==null?void 0:_.time)==null?void 0:z.at(-1),"h"),be=[];if(pe.isBetween(re,bt,"millisecond","[]")){const l=pe.utc().diff(re,"h",!1);let q,$;if(Y)for(const le of Y){const c=le.hourly;q={temp:(N=c.temperature_2m)==null?void 0:N.at(l),apparentTemp:(B=c.apparent_temperature)==null?void 0:B.at(l),rh:(n=c.relative_humidity_2m)==null?void 0:n.at(l),dp:(o=c.dew_point_2m)==null?void 0:o.at(l),precip:{probability:(j=c.precipitation_probability)==null?void 0:j.at(l),sum:(Z=c.precipitation)==null?void 0:Z.at(l)},pmsl:(x=c.pressure_msl)==null?void 0:x.at(l),psurf:(L=c.surface_pressure)==null?void 0:L.at(l),code:(C=c.weather_code)==null?void 0:C.at(l),visibility:this.m2nm((I=c.visibility)==null?void 0:I.at(l)),wind:{speed:(M=c.wind_speed_10m)==null?void 0:M.at(l),kts:(P=c.wind_speed_10m)==null?void 0:P.at(l),degree:(T=c.wind_direction_10m)==null?void 0:T.at(l),bearing:((H=c.wind_direction_10m)==null?void 0:H.at(l))!==null?(((F=c.wind_direction_10m)==null?void 0:F.at(l))+180)%360:null,gusts:(W=c.wind_gusts_10m)==null?void 0:W.at(l)},isDay:(R=c.is_day)==null?void 0:R.at(l)};const{name:ut,url:xt,bg:kt}=this.parseWeatherCode(q.code,q.isDay);q.name=ut,q.url=xt,q.bg=kt,q.wind.scale=this.beaufort(this.kts2ms(q.wind.kts)),q.wind.direction=this.degree2Direction(q.wind.degree)}if(ge)for(const le of ge){const c=le.hourly;$={wave:{sig:{height:(A=c.wave_height)==null?void 0:A.at(l),degree:(O=c.wave_direction)==null?void 0:O.at(l),bearing:((G=c.wave_direction)==null?void 0:G.at(l))!==null?(((p=c.wave_direction)==null?void 0:p.at(l))+180)%360:null,period:(u=c.wave_period)==null?void 0:u.at(l)},swell:{height:(d=c.swell_wave_height)==null?void 0:d.at(l),degree:(b=c.swell_wave_direction)==null?void 0:b.at(l),bearing:((S=c.swell_wave_direction)==null?void 0:S.at(l))!==null?(((g=c.swell_wave_direction)==null?void 0:g.at(l))+180)%360:null,period:(v=c.swell_wave_period)==null?void 0:v.at(l),peakPeriod:(Q=c.swell_wave_peak_period)==null?void 0:Q.at(l)},wd:{height:(X=c.wind_wave_height)==null?void 0:X.at(l),degree:(te=c.wind_wave_direction)==null?void 0:te.at(l),bearing:((ee=c.wind_wave_direction)==null?void 0:ee.at(l))!==null?(((V=c.wind_wave_direction)==null?void 0:V.at(l))+180)%360:null,period:(K=c.wind_wave_period)==null?void 0:K.at(l),peakPeriod:(h=c.wind_wave_peak_period)==null?void 0:h.at(l)}},current:{speed:(U=c.ocean_current_velocity)==null?void 0:U.at(l),kts:(m=c.ocean_current_velocity)==null?void 0:m.at(l),degree:(se=c.ocean_current_direction)==null?void 0:se.at(l),bearing:((ae=c.ocean_current_direction)==null?void 0:ae.at(l))??null},sst:(ne=c.sea_surface_temperature)==null?void 0:ne.at(l),height:(me=c.sea_level_height_msl)==null?void 0:me.at(l)},$.wave=this.parseWave($.wave),$.current.direction=this.degree2Direction($.current.degree)}be.push({utc:re.add(l,"h").format(),weather:{...q},...$})}return be}static toLegacy(t){return{wind:t.weather.wind,visibility:t.weather.visibility,temp:t.weather.temp,prmsl:t.weather.pmsl,gusts:{kts:t.weather.wind.gusts},precip:t.weather.precip,code:t.weather.code,name:t.weather.name,url:t.weather.url,wave:t.wave,current:t.current,sst:t.sst,height:t.height,utc:t.utc}}static pickDaily(t,s){var r,a,w,E,D,y,_,z,N,B,n,o,j,Z,x,L,C,I,M,P,T,H,F,W,R,A,O,G,p,u,d,b,S;const g=typeof s=="string"?f(s):s,v=t==null?void 0:t.weather,Q=t==null?void 0:t.marine,X=f((w=(a=(r=v==null?void 0:v[0])==null?void 0:r.daily)==null?void 0:a.time)==null?void 0:w.at(0)),te=f((y=(D=(E=v==null?void 0:v[0])==null?void 0:E.daily)==null?void 0:D.time)==null?void 0:y.at(-1)),ee=[];if(g.isBetween(X,te,"millisecond","[]")){let V,K;const h=g.diff(X,"d",!1);if(v)for(const U of v){const m=U.daily;V={code:(_=m.weather_code)==null?void 0:_.at(h),temp:{max:(z=m.temperature_2m_max)==null?void 0:z.at(h),min:(N=m.temperature_2m_min)==null?void 0:N.at(h),mean:(B=m.temperature_2m_mean)==null?void 0:B.at(h)},apparentTemp:{max:(n=m.apparent_temperature_max)==null?void 0:n.at(h),min:(o=m.apparent_temperature_min)==null?void 0:o.at(h)},precip:{sum:(j=m.precipitation_sum)==null?void 0:j.at(h),hours:(Z=m.precipitation_hours)==null?void 0:Z.at(h),probability:(x=m.precipitation_probability_max)==null?void 0:x.at(h)},rh:{max:(L=m.relative_humidity_2m_max)==null?void 0:L.at(h),min:(C=m.relative_humidity_2m_min)==null?void 0:C.at(h),mean:(I=m.relative_humidity_2m_mean)==null?void 0:I.at(h)},wind:{speed:(M=m.wind_speed_10m_max)==null?void 0:M.at(h),kts:(P=m.wind_speed_10m_max)==null?void 0:P.at(h),degree:(T=m.wind_direction_10m_dominant)==null?void 0:T.at(h),gusts:(H=m.wind_gusts_10m_max)==null?void 0:H.at(h)}};const{name:se,url:ae,bg:ne}=this.parseWeatherCode(V.code,!0);V.name=se,V.url=ae,V.bg=ne,V.wind.scale=this.beaufort(this.kts2ms(V.wind.kts)),V.wind.direction=this.degree2Direction(V.wind.degree)}if(Q)for(const U of Q){const m=U.daily;K={wave:{sig:{height:(F=m.wave_height_max)==null?void 0:F.at(h),degree:(W=m.wave_direction_dominant)==null?void 0:W.at(h),period:(R=m.wave_period_max)==null?void 0:R.at(h)},swell:{height:(A=m.swell_wave_height_max)==null?void 0:A.at(h),degree:(O=m.wave_direction_dominant)==null?void 0:O.at(h),period:(G=m.swell_wave_period_max)==null?void 0:G.at(h),peakPeriod:(p=m.swell_wave_peak_period_max)==null?void 0:p.at(h)},wd:{height:(u=m.wind_wave_height_max)==null?void 0:u.at(h),degree:(d=m.wind_wave_direction_dominant)==null?void 0:d.at(h),period:(b=m.wind_wave_period_max)==null?void 0:b.at(h),peakPeriod:(S=m.wind_wave_peak_period_max)==null?void 0:S.at(h)}}},K.wave=this.parseWave(K.wave)}ee.push({utc:X.add(h,"d").utc().format(),weather:{...V},...K})}return ee}static parseWave(t){return t.sig.direction=this.degree2Direction(t.sig.degree),t.swell.direction=this.degree2Direction(t.swell.degree),t.wd.direction=this.degree2Direction(t.wd.degree),t.sig.scale=this.douglas(t.sig.height),t.swell.scale=this.douglas(t.swell.height),t.wd.scale=this.douglas(t.wd.height),t}static parseWeatherCode(t,s){const r=this.weatherCode(t);return(s?r.day:r.night)||{}}static weatherCode(t){const s={code:t};switch(t){case 0:s.day={name:"Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"},s.night={name:"Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"};break;case 1:s.day={name:"Mainly Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"},s.night={name:"Mainly Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"};break;case 2:s.day={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg2.png"},s.night={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg2.png"};break;case 3:s.day={name:"Overcast",url:"https://osshz.idmwx.com/asset/weather/04d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg3.png"},s.night={name:"Overcast",url:"https://osshz.idmwx.com/asset/weather/04n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg3.png"};break;case 45:s.day={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"},s.night={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"};break;case 48:s.day={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"},s.night={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"};break;case 51:s.day={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 53:s.day={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 55:s.day={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/15d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/15n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 56:s.day={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 57:s.day={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 61:s.day={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 63:s.day={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 65:s.day={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 66:s.day={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 67:s.day={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 71:s.day={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 73:s.day={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 75:s.day={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 77:s.day={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 80:s.day={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 81:s.day={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 82:s.day={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 85:s.day={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 86:s.day={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 95:s.day={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 96:s.day={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 99:s.day={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break}return s}static kts2ms(t){return isNaN(t)||t===null?t:Math.round(t*1852/3600*1e4)/1e4}static kts2kmh(t){return isNaN(t)||t===null?t:t*1.852}static m2nm(t){return isNaN(t)||t===null?t:Math.round(t/1e3/1.852*1e4)/1e4}static kmh2kts(t){return isNaN(t)||t===null?t:this.ms2kts(t*1e3/3600)}static ms2kts(t){return isNaN(t)||t===null?t:Math.round(t*3600/1852*1e4)/1e4}static degree2Radian(t){if(isNaN(t)||t===null)return t;let s=t%360/360*2*Math.PI;return s=s<0?s+2*Math.PI:s,s}static degree2Direction(t){const s=this.degree2Radian(t);if(isNaN(s)||s===null)return null;let r="N/A";const a=Math.PI/16;return s<a?r="N":s>=a&&s<3*a?r="NNE":s>=3*a&&s<5*a?r="NE":s>=5*a&&s<7*a?r="ENE":s>=7*a&&s<9*a?r="E":s>=9*a&&s<11*a?r="ESE":s>=11*a&&s<13*a?r="SE":s>=13*a&&s<15*a?r="SSE":s>=15*a&&s<17*a?r="S":s>=17*a&&s<19*a?r="SSW":s>=19*a&&s<21*a?r="SW":s>=21*a&&s<23*a?r="WSW":s>=23*a&&s<25*a?r="W":s>=25*a&&s<27*a?r="WNW":s>=27*a&&s<29*a?r="NW":s>=29*a&&s<31*a?r="NNW":s>=31*a&&s<32*a&&(r="N"),r}static beaufort(t){let s=0;return isNaN(t)||(t=Math.round(t*10)/10,t<=.2?s=0:t<=1.5?s=1:t<=3.3?s=2:t<=5.4?s=3:t<=7.9?s=4:t<=10.7?s=5:t<=13.8?s=6:t<=17.1?s=7:t<=20.7?s=8:t<=22.4?s=9:t<=28.4?s=10:t<=32.6?s=11:t>32.6&&(s=12)),s}static douglas(t){let s="Calm";return isNaN(t)||t<=.1?s="Calm":t<=.5?s="Smooth":t<=1.25?s="Slight":t<=2.5?s="Moderate":t<=4?s="Rough":t<=6?s="VeryRough":t<=9?s="High":t<=14?s="VeryHigh":s="Precipitous",s}}const ft="",fe=(i,t)=>{const s=i.__vccOpts||i;for(const[r,a]of t)s[r]=a;return s},ye={name:"SpotReport",props:{token:{type:String,default:""},ts:{type:String,default:f().utc().format()},timeZone:{type:Number,default:8},point:{type:Object,default:()=>({})}},emits:["url"],data(){return{placeholder:"search for port name or coordinates",searchName:void 0,rawSearchIcon:e.markRaw(ue.Search),positionOffset:void 0,positionGmt:void 0,issuedDate:void 0,meteoData:{},positionList:[],position:void 0,loading:!1,activeIndex:void 0,tableData:{},pickedDate:void 0,pickedWeek:"Today",collectList:[],isCollected:!1}},computed:{computeHourL(){return function(i){return i?`${J(i).tz(this.positionGmt).format("HH")}`:"-"}},computeHourZ(){return function(i){return i?`${f(i).utc().format("HH")}Z`:"-"}},computeWeek(){return function(i){return i?`${J(i).tz(this.positionGmt).format("dddd")}`:"-"}},computeMMMDD(){return function(i){return i?`${J(i).tz(this.positionGmt).format("MMM-DD")}`:"-"}},computeLat(){return function(i,t=4){return oe.LngLatHelper.lat2pretty(i,t).pretty}},computeLng(){return function(i,t=4){return oe.LngLatHelper.lng2pretty(i,t).pretty}},roundPrecision(){return function(i,t=4){return isNaN(i)?"-":oe.LngLatHelper.roundPrecision(i,t)}}},watch:{point:{handler(){var i,t;this.point&&(this.position={lat:(i=this.point)==null?void 0:i.lat,lng:(t=this.point)==null?void 0:t.lng,name:this.computeLat(this.point.lat)+","+this.computeLng(this.point.lng)},this.handleFetchMeteo())},deep:!0,immediate:!0}},methods:{handleRender(){this.initInfo(),this.initTableData(),this.$nextTick(()=>{this.initEchart()})},initInfo(){var i,t,s,r;this.loading=!1,this.positionGmt=(t=(i=this.meteoData.weather)==null?void 0:i[0])==null?void 0:t.timezone,this.positionOffset=(r=(s=this.meteoData.weather)==null?void 0:s[0])==null?void 0:r.offset,this.issuedDate=f(this.ts).utc().format("MMM-DD/HHmm[Z], YYYY"),this.activeIndex=J(this.ts).tz(this.positionGmt).hour(),this.pickedDate=J(this.ts).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.collectList=JSON.parse(localStorage.getItem("idmCollectList")||"[]"),this.positionList=JSON.parse(JSON.stringify(this.collectList)),this.isCollected=this.collectList.some(a=>{var w;return a.name===((w=this.position)==null?void 0:w.name)})},initTableData(){var i,t,s,r,a,w,E,D,y,_,z,N,B,n,o,j,Z,x,L,C,I,M,P,T,H,F,W,R,A,O,G,p,u,d;this.tableData={hours:[],utcHours:[],weatherUrls:[],weatherNames:[],temp:[],precipProbability:[],precip1h:[],visibility:[],humidity:[],windSpeed:[],windDir:[],windGust:[],sigwaveHeight:[],sigwaveDir:[],windwaveHeight:[],windwaveDir:[],windwavePeriod:[],swellHeight:[],swellDir:[],swellPeriod:[],currentSpeed:[],currentDir:[],seaLevel:[],seaTemp:[]};for(let b=0;b<24;b++){const S=f(this.pickedDate).clone().add(b,"h").format();this.tableData.hours.push(S);const g=((i=de.pickHourly(this.meteoData,S))==null?void 0:i[0])||{};this.tableData.weatherUrls.push((t=g.weather)==null?void 0:t.url),this.tableData.weatherNames.push(((s=g.weather)==null?void 0:s.name)??"-"),this.tableData.temp.push(this.roundPrecision((r=g.weather)==null?void 0:r.temp,0)??"-"),this.tableData.precipProbability.push(this.roundPrecision((w=(a=g.weather)==null?void 0:a.precip)==null?void 0:w.probability,0)??"-"),this.tableData.precip1h.push(this.roundPrecision((D=(E=g.weather)==null?void 0:E.precip)==null?void 0:D.sum,0)??"-"),this.tableData.visibility.push(this.roundPrecision((y=g.weather)==null?void 0:y.visibility,0)??"-"),this.tableData.humidity.push(this.roundPrecision((_=g.weather)==null?void 0:_.rh,0)??"-"),this.tableData.windSpeed.push(this.roundPrecision((N=(z=g.weather)==null?void 0:z.wind)==null?void 0:N.kts,1)),this.tableData.windDir.push((n=(B=g.weather)==null?void 0:B.wind)==null?void 0:n.bearing),this.tableData.windGust.push(this.roundPrecision((j=(o=g.weather)==null?void 0:o.wind)==null?void 0:j.gusts,1)??"-"),this.tableData.sigwaveHeight.push(this.roundPrecision((x=(Z=g.wave)==null?void 0:Z.sig)==null?void 0:x.height,1)??"-"),this.tableData.sigwaveDir.push((C=(L=g.wave)==null?void 0:L.sig)==null?void 0:C.bearing),this.tableData.windwaveHeight.push(this.roundPrecision((M=(I=g.wave)==null?void 0:I.wd)==null?void 0:M.height,1)??"-"),this.tableData.windwaveDir.push((T=(P=g.wave)==null?void 0:P.wd)==null?void 0:T.bearing),this.tableData.windwavePeriod.push(this.roundPrecision((F=(H=g.wave)==null?void 0:H.wd)==null?void 0:F.period,1)??"-"),this.tableData.swellHeight.push(this.roundPrecision((R=(W=g.wave)==null?void 0:W.swell)==null?void 0:R.height,1)??"-"),this.tableData.swellDir.push((O=(A=g.wave)==null?void 0:A.swell)==null?void 0:O.bearing),this.tableData.swellPeriod.push(this.roundPrecision((p=(G=g.wave)==null?void 0:G.swell)==null?void 0:p.period,1)??"-"),this.tableData.currentSpeed.push(this.roundPrecision((u=g.current)==null?void 0:u.speed,1)??"-"),this.tableData.currentDir.push((d=g.current)==null?void 0:d.bearing),this.tableData.seaLevel.push(this.roundPrecision(g.height,1)??"-"),this.tableData.seaTemp.push(this.roundPrecision(g.sst,0)??"-")}},initEchart(){var L,C,I,M,P,T,H,F,W,R,A,O,G;const i=[],t=[],s=[],r=[],a=[],w=[],E=[],D=[],y=[],_=[],z={};for(let p=0;p<7;p++){const u=f(this.pickedDate).clone().add(p,"d");i.push(J(u).tz(this.positionGmt).format("yyyy-MM-DD")),t.push(this.computeMMMDD(u)),s.push(p===0?"Today":this.computeWeek(u));const d=((L=de.pickDaily(this.meteoData,u))==null?void 0:L[0])||{};r.push(this.roundPrecision((I=(C=d.weather)==null?void 0:C.temp)==null?void 0:I.min,0)),a.push(this.roundPrecision((P=(M=d.weather)==null?void 0:M.temp)==null?void 0:P.max,0)),D.push(this.roundPrecision((H=(T=d.weather)==null?void 0:T.wind)==null?void 0:H.kts,1)??"- kts"),_.push(this.roundPrecision((W=(F=d.weather)==null?void 0:F.precip)==null?void 0:W.sum,0)??"- mm"),w.push({symbol:"image://"+((R=d.weather)==null?void 0:R.url)}),E.push((A=d.weather)==null?void 0:A.name),y.push((G=(O=d.weather)==null?void 0:O.wind)==null?void 0:G.degree)}const N=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))-Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p))),B=Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p)))-1.5*N,n=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))+2*N,o=4+.5/i.length*92+"%",j="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740385441519" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10951" width="200" height="200"><path d="M512 804.83593751A276.87183211 276.87183211 0 0 1 235.12816789 527.9641054Q235.12816789 375.21005376 512 13.82031251q276.87183211 361.30792288 276.87183211 514.14379289a276.87183211 276.87183211 0 0 1-276.87183211 276.87183211zM294.4461577 527.9641054a217.47202472 217.47202472 0 0 0 217.5538423 217.55384231 19.79993605 19.79993605 0 1 0 0-39.51805453 177.9539702 177.9539702 0 0 1-177.9539702-178.03578778 19.79993605 19.79993605 0 0 0-39.5998721 0z" fill="#0c73a8" p-id="10952"></path></svg>'))),Z="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740383449285" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10797" width="200" height="200"><path d="M133.8 579l-44.4-44.4c-18.8-18.8-18.8-49.2 0-67.8L478 78c18.8-18.8 49.2-18.8 67.8 0l388.6 388.6c18.8 18.8 18.8 49.2 0 67.8L890 578.8c-19 19-50 18.6-68.6-0.8L592 337.2V912c0 26.6-21.4 48-48 48h-64c-26.6 0-48-21.4-48-48V337.2L202.4 578.2c-18.6 19.6-49.6 20-68.6 0.8z" fill="#ffffff" p-id="10798"></path></svg>'))),x=new Image(64,64);x.src=Z,x.onload=()=>{for(let d=0;d<7;d++){const b=document.createElement("canvas"),S=b.getContext("2d");b.width=x.width,b.height=x.height;const v=y[d]*(Math.PI/180);S.translate(b.width/2,b.height/2),S.rotate(v),S.translate(-x.width/2,-x.height/2),S.drawImage(x,0,0,64,64);const Q=b.toDataURL();z[`WindIcon${d}`]={height:12,width:12,align:"left",backgroundColor:{image:Q}}}const p=ie.init(document.getElementById("weather-chart")),u={grid:{bottom:0,top:0,left:"4%",right:"4%"},tooltip:{trigger:"item",show:!0,position:"right",formatter:function(d){return d.seriesName==="Weather Icon"?E[d.dataIndex]:!1}},legend:{show:!1},xAxis:{left:0,right:0,top:"50%",height:"50%",type:"category",data:i,show:!1},singleAxis:[{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"7%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"16%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"27%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"84%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"93%",height:"2%"}],yAxis:{type:"value",name:"温度(℃)",show:!1,min:B,max:n,axisLabel:{formatter:"{value} °C"}},series:[{singleAxisIndex:0,coordinateSystem:"singleAxis",type:"scatter",data:s,label:{show:!0,color:"#fff",fontSize:14,formatter:"{c}"},symbolSize:0},{singleAxisIndex:1,coordinateSystem:"singleAxis",type:"scatter",data:t,label:{show:!0,color:"#fff",formatter:"{c}"},symbolSize:0},{name:"Weather Icon",singleAxisIndex:2,coordinateSystem:"singleAxis",type:"scatter",data:w,symbolSize:36},{name:"温度(℃)",type:"line",data:r,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,12],formatter:"{c} °C",fontSize:12},markArea:{itemStyle:{color:"rgb(71,143,206)"},data:[[{x:"4%"},{x:4+1/i.length*92+"%"}]]}},{name:"温度(℃)",type:"line",data:a,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,-12],formatter:"{c} °C",fontSize:12}},{singleAxisIndex:3,coordinateSystem:"singleAxis",type:"scatter",data:D,label:{show:!0,color:"#fff",rich:{...z,title:{align:"center",vertical:"center"}},formatter:function(d){return`{WindIcon${d.dataIndex}|}{title|${d.value}} kts`}},symbolSize:0},{singleAxisIndex:4,coordinateSystem:"singleAxis",type:"scatter",data:_,label:{show:!0,color:"#fff",rich:{dIcon:{height:16,width:16,align:"left",backgroundColor:{image:j}},title:{align:"center",vertical:"center"}},formatter:function(d){return`{dIcon|}{title|${d.value}} mm`}},symbolSize:0}]};p.setOption(u),p.on("click",d=>{const b=d.dataIndex;this.pickedDate=J(i[b]).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.pickedWeek=b===0?"Today":this.computeWeek(this.pickedDate),this.activeIndex=b===0?J(this.ts).tz(this.positionGmt).hour():void 0,this.initTableData(),u.series[3].markArea={itemStyle:{color:"rgb(71,143,206)"},data:[[{x:4+b/i.length*92+"%"},{x:4+(b+1)/i.length*92+"%"}]]},p.setOption(u)})}},handleCollect(){this.isCollected=!this.isCollected,this.isCollected?this.collectList.push({name:this.position.name,lat:this.position.lat,lng:this.position.lng}):this.collectList=this.collectList.filter(i=>i.name!==this.position.name),localStorage.setItem("idmCollectList",JSON.stringify(this.collectList))},async fetchSuggestPosition(i){var r;const t=i.replaceAll(",",",");if(!t)return this.positionList=this.collectList,!1;const s=await ce.get(`https://cbe.idmwx.com/api/arc/ports/suggest?n=${t}`,{headers:{Authorization:this.token}});(s==null?void 0:s.data.code)===0&&(this.positionList=(r=s==null?void 0:s.data.data)==null?void 0:r.map(a=>(a.name=a.id?a.name:this.computeLat(a.lat)+", "+this.computeLng(a.lng),a)))},handleSearch(){var i,t,s;this.searchName&&(this.handleClear(),this.position={portId:(i=this.positionList.find(r=>r.name===this.searchName))==null?void 0:i.id,lat:(t=this.positionList.find(r=>r.name===this.searchName))==null?void 0:t.lat,lng:(s=this.positionList.find(r=>r.name===this.searchName))==null?void 0:s.lng,name:this.searchName},this.$emit("url",this.position),this.handleFetchMeteo())},async handleFetchMeteo(){if(!this.token)return!1;this.loading=!0;const i={lat:this.position.lat,lng:this.position.lng,forecastDays:8,selfHosted:!1},t=await ce.post("https://cbe.idmwx.com/api/arc/meteo2/spot/forecast",i,{headers:{Authorization:this.token}});(t==null?void 0:t.data.code)===0&&(this.meteoData={...t==null?void 0:t.data.data}),this.loading=!1,this.handleRender()},handleClear(){this.position={},this.meteoData={},this.isCollected=!1,ie&&document.getElementById("weather-chart")&&ie.dispose(document.getElementById("weather-chart"))}}},_e={class:"spot-report"},ze={class:"header-box flex-between"},Ne={class:"bg"},Ee={class:"search-box flex-start"},De={class:"content-box"},Be={class:"title-box flex-between"},Se={class:"main-title"},Ve={class:"sub-title"},Le={class:"flex-end"},Ce={key:0,id:"weather-chart"},Ie={key:1,class:"weather-chart flex-center"},Me={key:2,class:"weather-chart flex-center"},Pe={key:3,class:"card-box"},Te={class:"date"},He={class:"basic-table"},Fe={class:"day"},We={class:"hour"},Re={class:"icon"},Ae=["src"],Oe={class:"text"},Ge={class:"text"},ve={class:"text"},qe={class:"text"},je={class:"text"},Ze={class:"text"},Je={key:1},Ye={class:"text"},Qe={class:"text"},Ke={class:"wave-current-table"},Xe={class:"text"},Ue={class:"text"},$e={key:1},et={class:"text"},tt={class:"text"},st={class:"text"},at={key:1},nt={class:"text"},ot={class:"text"},it={class:"text"},rt={key:1},lt={class:"text"},ct={class:"sea-table"},dt={class:"text"},ht={class:"text"},mt={key:4,class:"card-box flex-center"},pt={key:5,class:"card-box flex-center"};function gt(i,t,s,r,a,w){var _,z,N,B;const E=e.resolveComponent("ElOption"),D=e.resolveComponent("ElSelect"),y=e.resolveComponent("ElTooltip");return e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("div",Ne,[e.createElementVNode("div",Ee,[e.createVNode(D,{modelValue:a.searchName,"onUpdate:modelValue":t[0]||(t[0]=n=>a.searchName=n),filterable:"",class:"input",clearable:"",remote:"",placeholder:a.placeholder,autocomplete:"","remote-show-suffix":"",onFocus:t[1]||(t[1]=n=>a.placeholder=""),onBlur:t[2]||(t[2]=n=>a.placeholder="search for port name or coordinates"),"remote-method":w.fetchSuggestPosition,onChange:w.handleSearch},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.positionList,n=>(e.openBlock(),e.createBlock(E,{key:n.name,label:n.name,value:n.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","onChange"])])])]),e.createElementVNode("div",De,[e.createElementVNode("div",Be,[e.createElementVNode("div",null,[e.createElementVNode("div",Se,"Weather forecast for "+e.toDisplayString(((_=a.position)==null?void 0:_.name)||"-")+" ( "+e.toDisplayString(a.positionOffset)+" )",1),e.createElementVNode("div",Ve,"At "+e.toDisplayString((z=a.position)!=null&&z.portId?"port":"coordinates")+", issued "+e.toDisplayString(a.issuedDate),1)]),e.createElementVNode("div",Le,[e.createVNode(y,{placement:"left",effect:"light",content:a.isCollected?"remove the port/coordinate from the search list":"add the port/coordinate to the search list","show-after":1e3},{default:e.withCtx(()=>[a.isCollected?(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon active",onClick:t[3]||(t[3]=(...n)=>w.handleCollect&&w.handleCollect(...n))},"")):(e.openBlock(),e.createElementBlock("span",{key:1,class:"iconfont icon",onClick:t[4]||(t[4]=(...n)=>w.handleCollect&&w.handleCollect(...n))},""))]),_:1},8,["content"])])]),(N=a.position)!=null&&N.name&&s.token&&!a.loading?(e.openBlock(),e.createElementBlock("div",Ce)):a.loading?(e.openBlock(),e.createElementBlock("div",Ie,"Loading....")):(e.openBlock(),e.createElementBlock("div",Me,"No Data")),(B=a.position)!=null&&B.name&&s.token&&!a.loading?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("div",Te,e.toDisplayString(a.pickedWeek)+" "+e.toDisplayString(w.computeMMMDD(a.pickedDate)),1),e.createElementVNode("table",He,[e.createElementVNode("tr",Fe,[t[5]||(t[5]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Local time"),e.createElementVNode("span",{class:"unit"},"(LT)")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(n,o)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+"local"},e.toDisplayString(w.computeHourL(n)),3))),128))]),e.createElementVNode("tr",We,[t[6]||(t[6]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("UTC"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(n,o)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+"z"},e.toDisplayString(w.computeHourZ(n)),3))),128))]),e.createElementVNode("tr",Re,[t[7]||(t[7]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Weather"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.weatherUrls,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+"url"},[e.createVNode(y,{placement:"top",effect:"light",content:a.tableData.weatherNames[o],"show-after":500},{default:e.withCtx(()=>[n?(e.openBlock(),e.createElementBlock("img",{key:0,class:"iconfont weather-icon",src:n},null,8,Ae)):e.createCommentVNode("",!0)]),_:2},1032,["content"])],2))),128))]),e.createElementVNode("tr",Oe,[t[8]||(t[8]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.temp,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ge,[t[9]||(t[9]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation Probability"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precipProbability,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",ve,[t[10]||(t[10]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation 1h"),e.createElementVNode("span",{class:"unit"},"mm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precip1h,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",qe,[t[11]||(t[11]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Visibility"),e.createElementVNode("span",{class:"unit"},"nm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.visibility,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",je,[t[12]||(t[12]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Relative Humidity"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.humidity,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ze,[t[13]||(t[13]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",Je,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Ye,[t[14]||(t[14]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windSpeed,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Qe,[t[15]||(t[15]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind gust"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windGust,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])]),t[27]||(t[27]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",Ke,[e.createElementVNode("tr",Xe,[t[16]||(t[16]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveHeight,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ue,[t[17]||(t[17]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",$e,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",et,[t[18]||(t[18]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwavePeriod,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",tt,[t[19]||(t[19]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellHeight,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",st,[t[20]||(t[20]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",at,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",nt,[t[21]||(t[21]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellPeriod,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",ot,[t[22]||(t[22]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sig wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.sigwaveHeight,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",it,[t[23]||(t[23]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",rt,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",lt,[t[24]||(t[24]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentSpeed,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])]),t[28]||(t[28]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",ct,[e.createElementVNode("tr",dt,[t[25]||(t[25]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea level height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaLevel,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",ht,[t[26]||(t[26]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea surface temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaTemp,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])])])):a.loading?(e.openBlock(),e.createElementBlock("div",mt,"Loading....")):(e.openBlock(),e.createElementBlock("div",pt,"No Data"))])])}const he=fe(ye,[["render",gt],["__scopeId","data-v-fa64778b"]]),wt={install(i){i.component("SpotReport",he)}};k.SpotReport=he,k.SpotReportPlugin=wt,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(f,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("moment"),require("moment-timezone"),require("@element-plus/icons-vue"),require("@idm-plugin/geo"),require("echarts"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","moment","moment-timezone","@element-plus/icons-vue","@idm-plugin/geo","echarts","vue","axios"],y):(f=typeof globalThis<"u"?globalThis:f||self,y(f["idmui-spot"]={},f.moment,f["moment-timezone"],f["@element-plus/icons-vue"],f["@idm-plugin/geo"],f.echarts,f.Vue,f.axios))})(this,function(f,y,J,ue,oe,xe,e,ce){"use strict";function ke(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const s in i)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>i[s]})}}return t.default=i,Object.freeze(t)}const ie=ke(xe);class de{static pickHourly(t,s){var r,a,w,D,B,_,z,N,E,S,n,o,j,Z,k,L,C,I,M,P,T,H,F,W,R,A,O,G,p,u,d,b,x,g,v,Q,X,te,ee,V,K,h,U,m,se,ae,ne,me;const pe=typeof s=="string"?y(s):s,Y=t==null?void 0:t.weather,ge=t==null?void 0:t.marine,we=y((a=(r=Y==null?void 0:Y[0])==null?void 0:r.hourly)==null?void 0:a.date).utc(),re=we.clone().add((B=(D=(w=Y==null?void 0:Y[0])==null?void 0:w.hourly)==null?void 0:D.time)==null?void 0:B.at(0),"h"),bt=we.clone().add((N=(z=(_=Y==null?void 0:Y[0])==null?void 0:_.hourly)==null?void 0:z.time)==null?void 0:N.at(-1),"h"),be=[];if(pe.isBetween(re,bt,"millisecond","[]")){const l=pe.utc().diff(re,"h",!1);let q,$;if(Y)for(const le of Y){const c=le.hourly;q={temp:(E=c.temperature_2m)==null?void 0:E.at(l),apparentTemp:(S=c.apparent_temperature)==null?void 0:S.at(l),rh:(n=c.relative_humidity_2m)==null?void 0:n.at(l),dp:(o=c.dew_point_2m)==null?void 0:o.at(l),precip:{probability:(j=c.precipitation_probability)==null?void 0:j.at(l),sum:(Z=c.precipitation)==null?void 0:Z.at(l)},pmsl:(k=c.pressure_msl)==null?void 0:k.at(l),psurf:(L=c.surface_pressure)==null?void 0:L.at(l),code:(C=c.weather_code)==null?void 0:C.at(l),visibility:this.m2nm((I=c.visibility)==null?void 0:I.at(l)),wind:{speed:(M=c.wind_speed_10m)==null?void 0:M.at(l),kts:(P=c.wind_speed_10m)==null?void 0:P.at(l),degree:(T=c.wind_direction_10m)==null?void 0:T.at(l),bearing:((H=c.wind_direction_10m)==null?void 0:H.at(l))!==null?(((F=c.wind_direction_10m)==null?void 0:F.at(l))+180)%360:null,gusts:(W=c.wind_gusts_10m)==null?void 0:W.at(l)},isDay:(R=c.is_day)==null?void 0:R.at(l)};const{name:ut,url:xt,bg:kt}=this.parseWeatherCode(q.code,q.isDay);q.name=ut,q.url=xt,q.bg=kt,q.wind.scale=this.beaufort(this.kts2ms(q.wind.kts)),q.wind.direction=this.degree2Direction(q.wind.degree)}if(ge)for(const le of ge){const c=le.hourly;$={wave:{sig:{height:(A=c.wave_height)==null?void 0:A.at(l),degree:(O=c.wave_direction)==null?void 0:O.at(l),bearing:((G=c.wave_direction)==null?void 0:G.at(l))!==null?(((p=c.wave_direction)==null?void 0:p.at(l))+180)%360:null,period:(u=c.wave_period)==null?void 0:u.at(l)},swell:{height:(d=c.swell_wave_height)==null?void 0:d.at(l),degree:(b=c.swell_wave_direction)==null?void 0:b.at(l),bearing:((x=c.swell_wave_direction)==null?void 0:x.at(l))!==null?(((g=c.swell_wave_direction)==null?void 0:g.at(l))+180)%360:null,period:(v=c.swell_wave_period)==null?void 0:v.at(l),peakPeriod:(Q=c.swell_wave_peak_period)==null?void 0:Q.at(l)},wd:{height:(X=c.wind_wave_height)==null?void 0:X.at(l),degree:(te=c.wind_wave_direction)==null?void 0:te.at(l),bearing:((ee=c.wind_wave_direction)==null?void 0:ee.at(l))!==null?(((V=c.wind_wave_direction)==null?void 0:V.at(l))+180)%360:null,period:(K=c.wind_wave_period)==null?void 0:K.at(l),peakPeriod:(h=c.wind_wave_peak_period)==null?void 0:h.at(l)}},current:{speed:(U=c.ocean_current_velocity)==null?void 0:U.at(l),kts:(m=c.ocean_current_velocity)==null?void 0:m.at(l),degree:(se=c.ocean_current_direction)==null?void 0:se.at(l),bearing:((ae=c.ocean_current_direction)==null?void 0:ae.at(l))??null},sst:(ne=c.sea_surface_temperature)==null?void 0:ne.at(l),height:(me=c.sea_level_height_msl)==null?void 0:me.at(l)},$.wave=this.parseWave($.wave),$.current.direction=this.degree2Direction($.current.degree)}be.push({utc:re.add(l,"h").format(),weather:{...q},...$})}return be}static toLegacy(t){return{wind:t.weather.wind,visibility:t.weather.visibility,temp:t.weather.temp,prmsl:t.weather.pmsl,gusts:{kts:t.weather.wind.gusts},precip:t.weather.precip,code:t.weather.code,name:t.weather.name,url:t.weather.url,wave:t.wave,current:t.current,sst:t.sst,height:t.height,utc:t.utc}}static pickDaily(t,s){var r,a,w,D,B,_,z,N,E,S,n,o,j,Z,k,L,C,I,M,P,T,H,F,W,R,A,O,G,p,u,d,b,x;const g=typeof s=="string"?y(s):s,v=t==null?void 0:t.weather,Q=t==null?void 0:t.marine,X=y((w=(a=(r=v==null?void 0:v[0])==null?void 0:r.daily)==null?void 0:a.time)==null?void 0:w.at(0)),te=y((_=(B=(D=v==null?void 0:v[0])==null?void 0:D.daily)==null?void 0:B.time)==null?void 0:_.at(-1)),ee=[];if(g.isBetween(X,te,"millisecond","[]")){let V,K;const h=g.diff(X,"d",!1);if(v)for(const U of v){const m=U.daily;V={code:(z=m.weather_code)==null?void 0:z.at(h),temp:{max:(N=m.temperature_2m_max)==null?void 0:N.at(h),min:(E=m.temperature_2m_min)==null?void 0:E.at(h),mean:(S=m.temperature_2m_mean)==null?void 0:S.at(h)},apparentTemp:{max:(n=m.apparent_temperature_max)==null?void 0:n.at(h),min:(o=m.apparent_temperature_min)==null?void 0:o.at(h)},precip:{sum:(j=m.precipitation_sum)==null?void 0:j.at(h),hours:(Z=m.precipitation_hours)==null?void 0:Z.at(h),probability:(k=m.precipitation_probability_max)==null?void 0:k.at(h)},rh:{max:(L=m.relative_humidity_2m_max)==null?void 0:L.at(h),min:(C=m.relative_humidity_2m_min)==null?void 0:C.at(h),mean:(I=m.relative_humidity_2m_mean)==null?void 0:I.at(h)},wind:{speed:(M=m.wind_speed_10m_max)==null?void 0:M.at(h),kts:(P=m.wind_speed_10m_max)==null?void 0:P.at(h),degree:(T=m.wind_direction_10m_dominant)==null?void 0:T.at(h),gusts:(H=m.wind_gusts_10m_max)==null?void 0:H.at(h)}};const{name:se,url:ae,bg:ne}=this.parseWeatherCode(V.code,!0);V.name=se,V.url=ae,V.bg=ne,V.wind.scale=this.beaufort(this.kts2ms(V.wind.kts)),V.wind.direction=this.degree2Direction(V.wind.degree)}if(Q)for(const U of Q){const m=U.daily;K={wave:{sig:{height:(F=m.wave_height_max)==null?void 0:F.at(h),degree:(W=m.wave_direction_dominant)==null?void 0:W.at(h),period:(R=m.wave_period_max)==null?void 0:R.at(h)},swell:{height:(A=m.swell_wave_height_max)==null?void 0:A.at(h),degree:(O=m.wave_direction_dominant)==null?void 0:O.at(h),period:(G=m.swell_wave_period_max)==null?void 0:G.at(h),peakPeriod:(p=m.swell_wave_peak_period_max)==null?void 0:p.at(h)},wd:{height:(u=m.wind_wave_height_max)==null?void 0:u.at(h),degree:(d=m.wind_wave_direction_dominant)==null?void 0:d.at(h),period:(b=m.wind_wave_period_max)==null?void 0:b.at(h),peakPeriod:(x=m.wind_wave_peak_period_max)==null?void 0:x.at(h)}}},K.wave=this.parseWave(K.wave)}ee.push({utc:X.add(h,"d").utc().format(),weather:{...V},...K})}return ee}static parseWave(t){return t.sig.direction=this.degree2Direction(t.sig.degree),t.swell.direction=this.degree2Direction(t.swell.degree),t.wd.direction=this.degree2Direction(t.wd.degree),t.sig.scale=this.douglas(t.sig.height),t.swell.scale=this.douglas(t.swell.height),t.wd.scale=this.douglas(t.wd.height),t}static parseWeatherCode(t,s){const r=this.weatherCode(t);return(s?r.day:r.night)||{}}static weatherCode(t){const s={code:t};switch(t){case 0:s.day={name:"Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"},s.night={name:"Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"};break;case 1:s.day={name:"Mainly Sunny",url:"https://osshz.idmwx.com/asset/weather/01d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"},s.night={name:"Mainly Clear",url:"https://osshz.idmwx.com/asset/weather/01n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg1.png"};break;case 2:s.day={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg2.png"},s.night={name:"Partly Cloudy",url:"https://osshz.idmwx.com/asset/weather/02n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg2.png"};break;case 3:s.day={name:"Overcast",url:"https://osshz.idmwx.com/asset/weather/04d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg3.png"},s.night={name:"Overcast",url:"https://osshz.idmwx.com/asset/weather/04n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg3.png"};break;case 45:s.day={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"},s.night={name:"Foggy",url:"https://osshz.idmwx.com/asset/weather/50n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"};break;case 48:s.day={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"},s.night={name:"Rime Fog",url:"https://osshz.idmwx.com/asset/weather/50n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg4.png"};break;case 51:s.day={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 53:s.day={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 55:s.day={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/15d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Drizzle",url:"https://osshz.idmwx.com/asset/weather/15n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 56:s.day={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 57:s.day={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/14d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Freezing Drizzle",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 61:s.day={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 63:s.day={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 65:s.day={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 66:s.day={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 67:s.day={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/16d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Freezing Rain",url:"https://osshz.idmwx.com/asset/weather/10n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 71:s.day={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Light Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 73:s.day={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 75:s.day={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Heavy Snow",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 77:s.day={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/17d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow Grains",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 80:s.day={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 81:s.day={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 82:s.day={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Heavy Showers",url:"https://osshz.idmwx.com/asset/weather/09n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 85:s.day={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Light Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 86:s.day={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"},s.night={name:"Snow Showers",url:"https://osshz.idmwx.com/asset/weather/13n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg6.png"};break;case 95:s.day={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Thunderstorm",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 96:s.day={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Light Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break;case 99:s.day={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11d.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"},s.night={name:"Thunderstorms With Hail",url:"https://osshz.idmwx.com/asset/weather/11n.svg",bg:"https://osshz.idmwx.com/asset/weather/bg5.png"};break}return s}static kts2ms(t){return isNaN(t)||t===null?t:Math.round(t*1852/3600*1e4)/1e4}static kts2kmh(t){return isNaN(t)||t===null?t:t*1.852}static m2nm(t){return isNaN(t)||t===null?t:Math.round(t/1e3/1.852*1e4)/1e4}static kmh2kts(t){return isNaN(t)||t===null?t:this.ms2kts(t*1e3/3600)}static ms2kts(t){return isNaN(t)||t===null?t:Math.round(t*3600/1852*1e4)/1e4}static degree2Radian(t){if(isNaN(t)||t===null)return t;let s=t%360/360*2*Math.PI;return s=s<0?s+2*Math.PI:s,s}static degree2Direction(t){const s=this.degree2Radian(t);if(isNaN(s)||s===null)return null;let r="N/A";const a=Math.PI/16;return s<a?r="N":s>=a&&s<3*a?r="NNE":s>=3*a&&s<5*a?r="NE":s>=5*a&&s<7*a?r="ENE":s>=7*a&&s<9*a?r="E":s>=9*a&&s<11*a?r="ESE":s>=11*a&&s<13*a?r="SE":s>=13*a&&s<15*a?r="SSE":s>=15*a&&s<17*a?r="S":s>=17*a&&s<19*a?r="SSW":s>=19*a&&s<21*a?r="SW":s>=21*a&&s<23*a?r="WSW":s>=23*a&&s<25*a?r="W":s>=25*a&&s<27*a?r="WNW":s>=27*a&&s<29*a?r="NW":s>=29*a&&s<31*a?r="NNW":s>=31*a&&s<32*a&&(r="N"),r}static beaufort(t){let s=0;return isNaN(t)||(t=Math.round(t*10)/10,t<=.2?s=0:t<=1.5?s=1:t<=3.3?s=2:t<=5.4?s=3:t<=7.9?s=4:t<=10.7?s=5:t<=13.8?s=6:t<=17.1?s=7:t<=20.7?s=8:t<=22.4?s=9:t<=28.4?s=10:t<=32.6?s=11:t>32.6&&(s=12)),s}static douglas(t){let s="Calm";return isNaN(t)||t<=.1?s="Calm":t<=.5?s="Smooth":t<=1.25?s="Slight":t<=2.5?s="Moderate":t<=4?s="Rough":t<=6?s="VeryRough":t<=9?s="High":t<=14?s="VeryHigh":s="Precipitous",s}}const ft="",fe=(i,t)=>{const s=i.__vccOpts||i;for(const[r,a]of t)s[r]=a;return s},ye={name:"SpotReport",props:{token:{type:String,default:""},ts:{type:String,default:y().utc().format()},timeZone:{type:Number,default:8},point:{type:Object,default:()=>({})}},emits:["url"],data(){return{placeholder:"search for port name or coordinates",searchName:void 0,rawSearchIcon:e.markRaw(ue.Search),positionOffset:void 0,positionGmt:void 0,issuedDate:void 0,meteoData:{},positionList:[],position:void 0,loading:!1,activeIndex:void 0,tableData:{},pickedDate:void 0,pickedWeek:"Today",collectList:[],isCollected:!1}},computed:{computeHourL(){return function(i){return i?`${J(i).tz(this.positionGmt).format("HH")}`:"-"}},computeHourZ(){return function(i){return i?`${y(i).utc().format("HH")}Z`:"-"}},computeWeek(){return function(i){return i?`${J(i).tz(this.positionGmt).format("dddd")}`:"-"}},computeMMMDD(){return function(i){return i?`${J(i).tz(this.positionGmt).format("MMM-DD")}`:"-"}},computeLat(){return function(i,t=4){return oe.LngLatHelper.lat2pretty(i,t).pretty}},computeLng(){return function(i,t=4){return oe.LngLatHelper.lng2pretty(i,t).pretty}},roundPrecision(){return function(i,t=4){return isNaN(i)?"-":oe.LngLatHelper.roundPrecision(i,t)}}},watch:{point:{handler(){var i,t;this.point&&(this.position={lat:(i=this.point)==null?void 0:i.lat,lng:(t=this.point)==null?void 0:t.lng,name:this.computeLat(this.point.lat)+","+this.computeLng(this.point.lng)},this.handleFetchMeteo())},deep:!0,immediate:!0}},methods:{handleRender(){this.initInfo(),this.initTableData(),this.$nextTick(()=>{this.initEchart()})},initInfo(){var i,t,s,r;this.loading=!1,this.positionGmt=(t=(i=this.meteoData.weather)==null?void 0:i[0])==null?void 0:t.timezone,this.positionOffset=(r=(s=this.meteoData.weather)==null?void 0:s[0])==null?void 0:r.offset,this.issuedDate=y(this.ts).utc().format("MMM-DD/HHmm[Z], YYYY"),this.activeIndex=J(this.ts).tz(this.positionGmt).hour(),this.pickedDate=J(this.ts).tz(this.positionGmt).set({hour:0,minute:0,second:0,millisecond:0}).format(),this.collectList=JSON.parse(localStorage.getItem("idmCollectList")||"[]"),this.positionList=JSON.parse(JSON.stringify(this.collectList)),this.isCollected=this.collectList.some(a=>{var w;return a.name===((w=this.position)==null?void 0:w.name)})},initTableData(){var i,t,s,r,a,w,D,B,_,z,N,E,S,n,o,j,Z,k,L,C,I,M,P,T,H,F,W,R,A,O,G,p,u,d;this.tableData={hours:[],utcHours:[],weatherUrls:[],weatherNames:[],temp:[],precipProbability:[],precip1h:[],visibility:[],humidity:[],windSpeed:[],windDir:[],windGust:[],sigwaveHeight:[],sigwaveDir:[],windwaveHeight:[],windwaveDir:[],windwavePeriod:[],swellHeight:[],swellDir:[],swellPeriod:[],currentSpeed:[],currentDir:[],seaLevel:[],seaTemp:[]};for(let b=0;b<24;b++){const x=y(this.pickedDate).clone().add(b,"h").format();this.tableData.hours.push(x);const g=((i=de.pickHourly(this.meteoData,x))==null?void 0:i[0])||{};this.tableData.weatherUrls.push((t=g.weather)==null?void 0:t.url),this.tableData.weatherNames.push(((s=g.weather)==null?void 0:s.name)??"-"),this.tableData.temp.push(this.roundPrecision((r=g.weather)==null?void 0:r.temp,0)??"-"),this.tableData.precipProbability.push(this.roundPrecision((w=(a=g.weather)==null?void 0:a.precip)==null?void 0:w.probability,0)??"-"),this.tableData.precip1h.push(this.roundPrecision((B=(D=g.weather)==null?void 0:D.precip)==null?void 0:B.sum,0)??"-"),this.tableData.visibility.push(this.roundPrecision((_=g.weather)==null?void 0:_.visibility,0)??"-"),this.tableData.humidity.push(this.roundPrecision((z=g.weather)==null?void 0:z.rh,0)??"-"),this.tableData.windSpeed.push(this.roundPrecision((E=(N=g.weather)==null?void 0:N.wind)==null?void 0:E.kts,1)),this.tableData.windDir.push((n=(S=g.weather)==null?void 0:S.wind)==null?void 0:n.bearing),this.tableData.windGust.push(this.roundPrecision((j=(o=g.weather)==null?void 0:o.wind)==null?void 0:j.gusts,1)??"-"),this.tableData.sigwaveHeight.push(this.roundPrecision((k=(Z=g.wave)==null?void 0:Z.sig)==null?void 0:k.height,1)??"-"),this.tableData.sigwaveDir.push((C=(L=g.wave)==null?void 0:L.sig)==null?void 0:C.bearing),this.tableData.windwaveHeight.push(this.roundPrecision((M=(I=g.wave)==null?void 0:I.wd)==null?void 0:M.height,1)??"-"),this.tableData.windwaveDir.push((T=(P=g.wave)==null?void 0:P.wd)==null?void 0:T.bearing),this.tableData.windwavePeriod.push(this.roundPrecision((F=(H=g.wave)==null?void 0:H.wd)==null?void 0:F.period,1)??"-"),this.tableData.swellHeight.push(this.roundPrecision((R=(W=g.wave)==null?void 0:W.swell)==null?void 0:R.height,1)??"-"),this.tableData.swellDir.push((O=(A=g.wave)==null?void 0:A.swell)==null?void 0:O.bearing),this.tableData.swellPeriod.push(this.roundPrecision((p=(G=g.wave)==null?void 0:G.swell)==null?void 0:p.period,1)??"-"),this.tableData.currentSpeed.push(this.roundPrecision((u=g.current)==null?void 0:u.speed,1)??"-"),this.tableData.currentDir.push((d=g.current)==null?void 0:d.bearing),this.tableData.seaLevel.push(this.roundPrecision(g.height,1)??"-"),this.tableData.seaTemp.push(this.roundPrecision(g.sst,0)??"-")}},initEchart(){var L,C,I,M,P,T,H,F,W,R,A,O,G;const i=[],t=[],s=[],r=[],a=[],w=[],D=[],B=[],_=[],z=[],N={};for(let p=0;p<7;p++){const u=y(this.pickedDate).clone().add(p,"d");i.push(J(u).tz(this.positionGmt).format("yyyy-MM-DD")),t.push(this.computeMMMDD(u)),s.push(p===0?"Today":this.computeWeek(u));const d=((L=de.pickDaily(this.meteoData,u))==null?void 0:L[0])||{};r.push(this.roundPrecision((I=(C=d.weather)==null?void 0:C.temp)==null?void 0:I.min,0)),a.push(this.roundPrecision((P=(M=d.weather)==null?void 0:M.temp)==null?void 0:P.max,0)),B.push(this.roundPrecision((H=(T=d.weather)==null?void 0:T.wind)==null?void 0:H.kts,1)??"- kts"),z.push(this.roundPrecision((W=(F=d.weather)==null?void 0:F.precip)==null?void 0:W.sum,0)??"- mm"),w.push({symbol:"image://"+((R=d.weather)==null?void 0:R.url)}),D.push((A=d.weather)==null?void 0:A.name),_.push((G=(O=d.weather)==null?void 0:O.wind)==null?void 0:G.degree)}const E=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))-Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p))),S=Math.min(...r.filter(p=>typeof p=="number"&&!isNaN(p)))-1.5*E,n=Math.max(...a.filter(p=>typeof p=="number"&&!isNaN(p)))+2*E,o=4+.5/i.length*92+"%",j="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740385441519" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10951" width="200" height="200"><path d="M512 804.83593751A276.87183211 276.87183211 0 0 1 235.12816789 527.9641054Q235.12816789 375.21005376 512 13.82031251q276.87183211 361.30792288 276.87183211 514.14379289a276.87183211 276.87183211 0 0 1-276.87183211 276.87183211zM294.4461577 527.9641054a217.47202472 217.47202472 0 0 0 217.5538423 217.55384231 19.79993605 19.79993605 0 1 0 0-39.51805453 177.9539702 177.9539702 0 0 1-177.9539702-178.03578778 19.79993605 19.79993605 0 0 0-39.5998721 0z" fill="#0c73a8" p-id="10952"></path></svg>'))),Z="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent('<svg t="1740383449285" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10797" width="200" height="200"><path d="M133.8 579l-44.4-44.4c-18.8-18.8-18.8-49.2 0-67.8L478 78c18.8-18.8 49.2-18.8 67.8 0l388.6 388.6c18.8 18.8 18.8 49.2 0 67.8L890 578.8c-19 19-50 18.6-68.6-0.8L592 337.2V912c0 26.6-21.4 48-48 48h-64c-26.6 0-48-21.4-48-48V337.2L202.4 578.2c-18.6 19.6-49.6 20-68.6 0.8z" fill="#ffffff" p-id="10798"></path></svg>'))),k=new Image(64,64);k.src=Z,k.onload=()=>{for(let d=0;d<7;d++){const b=document.createElement("canvas"),x=b.getContext("2d");b.width=k.width,b.height=k.height;const v=_[d]*(Math.PI/180);x.translate(b.width/2,b.height/2),x.rotate(v),x.translate(-k.width/2,-k.height/2),x.drawImage(k,0,0,64,64);const Q=b.toDataURL();N[`WindIcon${d}`]={height:12,width:12,align:"left",backgroundColor:{image:Q}}}const p=ie.init(document.getElementById("weather-chart")),u={grid:{bottom:0,top:0,left:"4%",right:"4%"},tooltip:{trigger:"item",show:!0,position:"right",formatter:function(d){return d.seriesName==="Weather Icon"?D[d.dataIndex]:!1}},legend:{show:!1},xAxis:{left:0,right:0,top:"50%",height:"50%",type:"category",data:i,show:!1},singleAxis:[{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"7%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"16%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"27%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"84%",height:"2%"},{left:o,right:o,type:"category",show:!1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1},boundaryGap:!1,data:i,top:"93%",height:"2%"}],yAxis:{type:"value",name:"温度(℃)",show:!1,min:S,max:n,axisLabel:{formatter:"{value} °C"}},series:[{singleAxisIndex:0,coordinateSystem:"singleAxis",type:"scatter",data:s,label:{show:!0,color:"#fff",fontSize:14,formatter:"{c}"},symbolSize:0},{singleAxisIndex:1,coordinateSystem:"singleAxis",type:"scatter",data:t,label:{show:!0,color:"#fff",formatter:"{c}"},symbolSize:0},{name:"Weather Icon",singleAxisIndex:2,coordinateSystem:"singleAxis",type:"scatter",data:w,symbolSize:36},{name:"温度(℃)",type:"line",data:r,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,12],formatter:"{c} °C",fontSize:12},markArea:{itemStyle:{color:"rgb(71,143,206)"},data:[[{x:"4%"},{x:4+1/i.length*92+"%"}]]}},{name:"温度(℃)",type:"line",data:a,smooth:!0,itemStyle:{color:"rgba(255,255,255,0.7)"},label:{show:!0,color:"rgba(255,255,255,1)",position:[-10,-12],formatter:"{c} °C",fontSize:12}},{singleAxisIndex:3,coordinateSystem:"singleAxis",type:"scatter",data:B,label:{show:!0,color:"#fff",rich:{...N,title:{align:"center",vertical:"center"}},formatter:function(d){return`{WindIcon${d.dataIndex}|}{title|${d.value}} kts`}},symbolSize:0},{singleAxisIndex:4,coordinateSystem:"singleAxis",type:"scatter",data:z,label:{show:!0,color:"#fff",rich:{dIcon:{height:16,width:16,align:"left",backgroundColor:{image:j}},title:{align:"center",vertical:"center"}},formatter:function(d){return`{dIcon|}{title|${d.value}} mm`}},symbolSize:0}]};p.setOption(u),p.on("click",d=>{const b=d.dataIndex,x=i[b].split("-");this.pickedDate=J().tz(this.positionGmt).set({year:x[0],month:Number(x[1]-1),date:Number(x[2]),hour:0,minute:0,second:0,millisecond:0}).format(),this.pickedWeek=b===0?"Today":this.computeWeek(this.pickedDate),this.activeIndex=b===0?J(this.ts).tz(this.positionGmt).hour():void 0,this.initTableData(),u.series[3].markArea={itemStyle:{color:"rgb(71,143,206)"},data:[[{x:4+b/i.length*92+"%"},{x:4+(b+1)/i.length*92+"%"}]]},p.setOption(u)})}},handleCollect(){this.isCollected=!this.isCollected,this.isCollected?this.collectList.push({name:this.position.name,lat:this.position.lat,lng:this.position.lng}):this.collectList=this.collectList.filter(i=>i.name!==this.position.name),localStorage.setItem("idmCollectList",JSON.stringify(this.collectList))},async fetchSuggestPosition(i){var r;const t=i.replaceAll(",",",");if(!t)return this.positionList=this.collectList,!1;const s=await ce.get(`https://cbe.idmwx.com/api/arc/ports/suggest?n=${t}`,{headers:{Authorization:this.token}});(s==null?void 0:s.data.code)===0&&(this.positionList=(r=s==null?void 0:s.data.data)==null?void 0:r.map(a=>(a.name=a.id?a.name:this.computeLat(a.lat)+", "+this.computeLng(a.lng),a)))},handleSearch(){var i,t,s;this.searchName&&(this.handleClear(),this.position={portId:(i=this.positionList.find(r=>r.name===this.searchName))==null?void 0:i.id,lat:(t=this.positionList.find(r=>r.name===this.searchName))==null?void 0:t.lat,lng:(s=this.positionList.find(r=>r.name===this.searchName))==null?void 0:s.lng,name:this.searchName},this.$emit("url",this.position),this.handleFetchMeteo())},async handleFetchMeteo(){if(!this.token)return!1;this.loading=!0;const i={lat:this.position.lat,lng:this.position.lng,forecastDays:8,selfHosted:!1},t=await ce.post("https://cbe.idmwx.com/api/arc/meteo2/spot/forecast",i,{headers:{Authorization:this.token}});(t==null?void 0:t.data.code)===0&&(this.meteoData={...t==null?void 0:t.data.data}),this.loading=!1,this.handleRender()},handleClear(){this.position={},this.meteoData={},this.isCollected=!1,ie&&document.getElementById("weather-chart")&&ie.dispose(document.getElementById("weather-chart"))}}},_e={class:"spot-report"},ze={class:"header-box flex-between"},Ne={class:"bg"},Ee={class:"search-box flex-start"},De={class:"content-box"},Be={class:"title-box flex-between"},Se={class:"main-title"},Ve={class:"sub-title"},Le={class:"flex-end"},Ce={key:0,id:"weather-chart"},Ie={key:1,class:"weather-chart flex-center"},Me={key:2,class:"weather-chart flex-center"},Pe={key:3,class:"card-box"},Te={class:"date"},He={class:"basic-table"},Fe={class:"day"},We={class:"hour"},Re={class:"icon"},Ae=["src"],Oe={class:"text"},Ge={class:"text"},ve={class:"text"},qe={class:"text"},je={class:"text"},Ze={class:"text"},Je={key:1},Ye={class:"text"},Qe={class:"text"},Ke={class:"wave-current-table"},Xe={class:"text"},Ue={class:"text"},$e={key:1},et={class:"text"},tt={class:"text"},st={class:"text"},at={key:1},nt={class:"text"},ot={class:"text"},it={class:"text"},rt={key:1},lt={class:"text"},ct={class:"sea-table"},dt={class:"text"},ht={class:"text"},mt={key:4,class:"card-box flex-center"},pt={key:5,class:"card-box flex-center"};function gt(i,t,s,r,a,w){var z,N,E,S;const D=e.resolveComponent("ElOption"),B=e.resolveComponent("ElSelect"),_=e.resolveComponent("ElTooltip");return e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("div",Ne,[e.createElementVNode("div",Ee,[e.createVNode(B,{modelValue:a.searchName,"onUpdate:modelValue":t[0]||(t[0]=n=>a.searchName=n),filterable:"",class:"input",clearable:"",remote:"",placeholder:a.placeholder,autocomplete:"","remote-show-suffix":"",onFocus:t[1]||(t[1]=n=>a.placeholder=""),onBlur:t[2]||(t[2]=n=>a.placeholder="search for port name or coordinates"),"remote-method":w.fetchSuggestPosition,onChange:w.handleSearch},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.positionList,n=>(e.openBlock(),e.createBlock(D,{key:n.name,label:n.name,value:n.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","onChange"])])])]),e.createElementVNode("div",De,[e.createElementVNode("div",Be,[e.createElementVNode("div",null,[e.createElementVNode("div",Se,"Weather forecast for "+e.toDisplayString(((z=a.position)==null?void 0:z.name)||"-")+" ( "+e.toDisplayString(a.positionOffset)+" )",1),e.createElementVNode("div",Ve,"At "+e.toDisplayString((N=a.position)!=null&&N.portId?"port":"coordinates")+", issued "+e.toDisplayString(a.issuedDate),1)]),e.createElementVNode("div",Le,[e.createVNode(_,{placement:"left",effect:"light",content:a.isCollected?"remove the port/coordinate from the search list":"add the port/coordinate to the search list","show-after":1e3},{default:e.withCtx(()=>[a.isCollected?(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon active",onClick:t[3]||(t[3]=(...n)=>w.handleCollect&&w.handleCollect(...n))},"")):(e.openBlock(),e.createElementBlock("span",{key:1,class:"iconfont icon",onClick:t[4]||(t[4]=(...n)=>w.handleCollect&&w.handleCollect(...n))},""))]),_:1},8,["content"])])]),(E=a.position)!=null&&E.name&&s.token&&!a.loading?(e.openBlock(),e.createElementBlock("div",Ce)):a.loading?(e.openBlock(),e.createElementBlock("div",Ie,"Loading....")):(e.openBlock(),e.createElementBlock("div",Me,"No Data")),(S=a.position)!=null&&S.name&&s.token&&!a.loading?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("div",Te,e.toDisplayString(a.pickedWeek)+" "+e.toDisplayString(w.computeMMMDD(a.pickedDate)),1),e.createElementVNode("table",He,[e.createElementVNode("tr",Fe,[t[5]||(t[5]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Local time"),e.createElementVNode("span",{class:"unit"},"(LT)")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(n,o)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+"local"},e.toDisplayString(w.computeHourL(n)),3))),128))]),e.createElementVNode("tr",We,[t[6]||(t[6]=e.createElementVNode("th",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("UTC"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.hours,(n,o)=>(e.openBlock(),e.createElementBlock("th",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+"z"},e.toDisplayString(w.computeHourZ(n)),3))),128))]),e.createElementVNode("tr",Re,[t[7]||(t[7]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Weather"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.weatherUrls,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+"url"},[e.createVNode(_,{placement:"top",effect:"light",content:a.tableData.weatherNames[o],"show-after":500},{default:e.withCtx(()=>[n?(e.openBlock(),e.createElementBlock("img",{key:0,class:"iconfont weather-icon",src:n},null,8,Ae)):e.createCommentVNode("",!0)]),_:2},1032,["content"])],2))),128))]),e.createElementVNode("tr",Oe,[t[8]||(t[8]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.temp,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ge,[t[9]||(t[9]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation Probability"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precipProbability,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",ve,[t[10]||(t[10]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Precipitation 1h"),e.createElementVNode("span",{class:"unit"},"mm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.precip1h,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",qe,[t[11]||(t[11]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Visibility"),e.createElementVNode("span",{class:"unit"},"nm")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.visibility,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",je,[t[12]||(t[12]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Relative Humidity"),e.createElementVNode("span",{class:"unit"},"%")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.humidity,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ze,[t[13]||(t[13]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",Je,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",Ye,[t[14]||(t[14]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windSpeed,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Qe,[t[15]||(t[15]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind gust"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windGust,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])]),t[27]||(t[27]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",Ke,[e.createElementVNode("tr",Xe,[t[16]||(t[16]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveHeight,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",Ue,[t[17]||(t[17]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwaveDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",$e,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",et,[t[18]||(t[18]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Wind wave period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.windwavePeriod,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",tt,[t[19]||(t[19]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellHeight,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",st,[t[20]||(t[20]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",at,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",nt,[t[21]||(t[21]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Swell period"),e.createElementVNode("span",{class:"unit"},"s")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.swellPeriod,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",ot,[t[22]||(t[22]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sig wave height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.sigwaveHeight,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",it,[t[23]||(t[23]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current direction"),e.createElementVNode("span",{class:"unit"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentDir,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},[isNaN(n)?(e.openBlock(),e.createElementBlock("span",rt,"-")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont icon",style:e.normalizeStyle({display:"inline-block",transform:`rotate(${n}deg)`})},"",4))],2))),128))]),e.createElementVNode("tr",lt,[t[24]||(t[24]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Current speed"),e.createElementVNode("span",{class:"unit"},"kts")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.currentSpeed,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])]),t[28]||(t[28]=e.createElementVNode("div",{style:{"text-align":"center",padding:"3px"}},null,-1)),e.createElementVNode("table",ct,[e.createElementVNode("tr",dt,[t[25]||(t[25]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea level height"),e.createElementVNode("span",{class:"unit"},"m")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaLevel,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))]),e.createElementVNode("tr",ht,[t[26]||(t[26]=e.createElementVNode("td",{rowspan:"1",colspan:"1",class:"tr-title"},[e.createTextVNode("Sea surface temperature"),e.createElementVNode("span",{class:"unit"},"°C")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableData.seaTemp,(n,o)=>(e.openBlock(),e.createElementBlock("td",{rowspan:"1",colspan:"1",class:e.normalizeClass(a.activeIndex===o?"active":""),key:Math.random()+n},e.toDisplayString(n),3))),128))])])])):a.loading?(e.openBlock(),e.createElementBlock("div",mt,"Loading....")):(e.openBlock(),e.createElementBlock("div",pt,"No Data"))])])}const he=fe(ye,[["render",gt],["__scopeId","data-v-969b448f"]]),wt={install(i){i.component("SpotReport",he)}};f.SpotReport=he,f.SpotReportPlugin=wt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@page{size:1200px;margin:20px auto 40px}.spot-report[data-v-
|
|
1
|
+
@page{size:1200px;margin:20px auto 40px}.spot-report[data-v-969b448f]{height:100%;width:1160px;margin:0 auto;padding:0;display:flex;flex-direction:column;color:var(--idm-black-8)}.spot-report .header-box[data-v-969b448f]{width:100%;padding:10px 0}.spot-report .header-box .search-box .input[data-v-969b448f]{width:300px}.spot-report .header-box .search-box .info[data-v-969b448f]{margin:0 10px;color:var(--idm-info-color);font-size:12px}.spot-report .content-box[data-v-969b448f]{flex:1;width:100%;box-sizing:border-box}.spot-report .content-box .title-box .main-title[data-v-969b448f]{font-size:16px;font-weight:700}.spot-report .content-box .title-box .sub-title[data-v-969b448f]{font-size:13px;padding:2px 0}.spot-report .content-box .title-box .icon[data-v-969b448f]{cursor:pointer;margin-left:10px;font-size:16px}.spot-report .content-box .title-box .icon[data-v-969b448f]:hover{color:var(--idm-primary-color)}.spot-report .content-box .title-box .icon.active[data-v-969b448f]{color:var(--idm-warning-color)}.spot-report .content-box #weather-chart[data-v-969b448f],.spot-report .content-box .weather-chart[data-v-969b448f]{height:225px;width:100%;font-size:14px;color:#fff;border:1px solid var(--idm-gray-light);border-radius:5px;box-sizing:border-box;background:rgb(104,184,251)}.spot-report .content-box .card-box[data-v-969b448f]{min-height:500px;margin:5px 0;background:var(--idm-gray-light);border-radius:4px;font-size:14px;color:var(--idm-black-8);line-height:26px}.spot-report .content-box .card-box .date[data-v-969b448f]{font-weight:700;padding:2px 10px;background:var(--idm-white)}.spot-report .content-box .card-box .basic-table[data-v-969b448f],.spot-report .content-box .card-box .wave-current-table[data-v-969b448f],.spot-report .content-box .card-box .sea-table[data-v-969b448f]{width:100%;font-size:12px;padding:5px;border-collapse:collapse;border:1px solid var(--idm-gray-light)}.spot-report .content-box .card-box .basic-table .tr-title[data-v-969b448f],.spot-report .content-box .card-box .wave-current-table .tr-title[data-v-969b448f],.spot-report .content-box .card-box .sea-table .tr-title[data-v-969b448f]{width:200px;padding-right:10px;text-align:right!important;background:none}.spot-report .content-box .card-box .basic-table .tr-title .unit[data-v-969b448f],.spot-report .content-box .card-box .wave-current-table .tr-title .unit[data-v-969b448f],.spot-report .content-box .card-box .sea-table .tr-title .unit[data-v-969b448f]{width:20px;padding:0 5px;text-align:left;display:inline-block;color:var(--idm-info-color)}.spot-report .content-box .card-box .basic-table td[data-v-969b448f],.spot-report .content-box .card-box .wave-current-table td[data-v-969b448f],.spot-report .content-box .card-box .sea-table td[data-v-969b448f]{text-align:center;line-height:20px;width:40px;background:var(--idm-white)}.spot-report .content-box .card-box .basic-table td.active[data-v-969b448f],.spot-report .content-box .card-box .wave-current-table td.active[data-v-969b448f],.spot-report .content-box .card-box .sea-table td.active[data-v-969b448f]{color:#fff;background:rgb(71,143,206)}.spot-report .content-box .card-box .basic-table th[data-v-969b448f],.spot-report .content-box .card-box .wave-current-table th[data-v-969b448f],.spot-report .content-box .card-box .sea-table th[data-v-969b448f]{color:var(--idm-info-color);font-weight:400;text-align:center;line-height:20px;width:40px}.spot-report .content-box .card-box .basic-table .weather-icon[data-v-969b448f],.spot-report .content-box .card-box .wave-current-table .weather-icon[data-v-969b448f],.spot-report .content-box .card-box .sea-table .weather-icon[data-v-969b448f]{width:24px;height:24px;cursor:pointer}
|