@burdenoff/microfe-healthybowl 2026.709.1 → 2026.709.2
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.
|
@@ -5,57 +5,62 @@ import { geocodePlace as r } from "../utils/geocode.js";
|
|
|
5
5
|
import { useToast as i } from "../hooks/useToast.js";
|
|
6
6
|
import { useCallback as a, useEffect as o, useRef as s, useState as c } from "react";
|
|
7
7
|
import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
8
|
-
import { LocateFixed as u, MapPinned as d } from "lucide-react";
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { Button as
|
|
8
|
+
import { LocateFixed as u, MapPinned as d, Search as f, X as p } from "lucide-react";
|
|
9
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
10
|
+
import { Button as g } from "@burdenoff/fe-libs/ui";
|
|
11
11
|
//#region src/healthybowl/components/WeatherMap.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
12
|
+
var _ = /* @__PURE__ */ e(n(), 1), v = "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css", y = "sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=", b = 7, x = 10, S = 10, C = (e) => !!(e && Number.isFinite(e.lat) && Number.isFinite(e.lng) && e.lat >= -90 && e.lat <= 90 && e.lng >= -180 && e.lng <= 180 && (e.lat !== 0 || e.lng !== 0));
|
|
13
|
+
function w() {
|
|
14
14
|
if (document.getElementById("leaflet-css")) return;
|
|
15
15
|
let e = document.createElement("link");
|
|
16
|
-
e.id = "leaflet-css", e.rel = "stylesheet", e.href =
|
|
16
|
+
e.id = "leaflet-css", e.rel = "stylesheet", e.href = v, e.integrity = y, e.crossOrigin = "anonymous", document.head.appendChild(e);
|
|
17
17
|
}
|
|
18
|
-
var
|
|
19
|
-
let { t:
|
|
20
|
-
let e =
|
|
21
|
-
|
|
22
|
-
}, []),
|
|
23
|
-
let e =
|
|
24
|
-
|
|
25
|
-
}, []),
|
|
26
|
-
|
|
18
|
+
var T = ({ location: e, center: n }) => {
|
|
19
|
+
let { t: v } = l(), { toasts: y, toast: T, dismiss: E } = i(), D = s(null), O = s(null), k = s(null), A = s(null), j = s(null), M = s(null), [N, P] = c("loading"), [F, I] = c(!1), [L, R] = c(!1), [z, B] = c(""), [V, H] = c(!1), [U, W] = c(null), [G, K] = c(null), q = v("healthybowl.weather.map.layers.streets", "Streets"), J = v("healthybowl.weather.map.layers.terrain", "Terrain"), Y = v("healthybowl.weather.map.layers.radar", "Live radar"), X = a(() => {
|
|
20
|
+
let e = O.current;
|
|
21
|
+
A.current && e && e.removeLayer(A.current), j.current && e && e.removeLayer(j.current), A.current = null, j.current = null;
|
|
22
|
+
}, []), Z = a(() => {
|
|
23
|
+
let e = O.current;
|
|
24
|
+
M.current && e && e.removeLayer(M.current), M.current = null;
|
|
25
|
+
}, []), Q = a(() => {
|
|
26
|
+
Z(), W(null);
|
|
27
|
+
}, [Z]), $ = a(() => {
|
|
28
|
+
let e = O.current, t = k.current;
|
|
29
|
+
!e || !t || e.flyTo(t, b, { duration: .6 });
|
|
30
|
+
}, []), ee = a(() => {
|
|
31
|
+
let e = O.current;
|
|
27
32
|
if (e) {
|
|
28
33
|
if (typeof navigator > "u" || !navigator.geolocation) {
|
|
29
|
-
|
|
30
|
-
title:
|
|
31
|
-
description:
|
|
34
|
+
T({
|
|
35
|
+
title: v("healthybowl.weather.map.toast.locationUnsupported.title", "Location unavailable"),
|
|
36
|
+
description: v("healthybowl.weather.map.toast.locationUnsupported.description", "This browser does not support device location."),
|
|
32
37
|
variant: "warning"
|
|
33
38
|
});
|
|
34
39
|
return;
|
|
35
40
|
}
|
|
36
|
-
|
|
41
|
+
R(!0), navigator.geolocation.getCurrentPosition((t) => {
|
|
37
42
|
let n = [t.coords.latitude, t.coords.longitude];
|
|
38
|
-
|
|
43
|
+
X(), j.current = _.default.circle(n, {
|
|
39
44
|
radius: Math.max(10, t.coords.accuracy || 0),
|
|
40
45
|
color: "#2563eb",
|
|
41
46
|
fillColor: "#3b82f6",
|
|
42
47
|
fillOpacity: .12,
|
|
43
48
|
opacity: .45,
|
|
44
49
|
weight: 1
|
|
45
|
-
}).addTo(e),
|
|
50
|
+
}).addTo(e), A.current = _.default.circleMarker(n, {
|
|
46
51
|
radius: 7,
|
|
47
52
|
color: "#ffffff",
|
|
48
53
|
weight: 2,
|
|
49
54
|
fillColor: "#2563eb",
|
|
50
55
|
fillOpacity: 1
|
|
51
|
-
}).addTo(e), e.flyTo(n, Math.max(e.getZoom(),
|
|
56
|
+
}).addTo(e), e.flyTo(n, Math.max(e.getZoom(), x), { duration: .75 }), R(!1);
|
|
52
57
|
}, (e) => {
|
|
53
58
|
let t = e.code === e.PERMISSION_DENIED;
|
|
54
|
-
|
|
55
|
-
title: t ?
|
|
56
|
-
description: t ?
|
|
59
|
+
T({
|
|
60
|
+
title: t ? v("healthybowl.weather.map.toast.locationBlocked.title", "Location blocked") : v("healthybowl.weather.map.toast.locationFailed.title", "Could not get location"),
|
|
61
|
+
description: t ? v("healthybowl.weather.map.toast.locationBlocked.description", "Allow location access in the browser, then try again.") : v("healthybowl.weather.map.toast.locationFailed.description", "Make sure GPS is enabled and the page is open over HTTPS."),
|
|
57
62
|
variant: "warning"
|
|
58
|
-
}),
|
|
63
|
+
}), R(!1);
|
|
59
64
|
}, {
|
|
60
65
|
enableHighAccuracy: !0,
|
|
61
66
|
timeout: 12e3,
|
|
@@ -63,112 +68,230 @@ var S = ({ location: e, center: n }) => {
|
|
|
63
68
|
});
|
|
64
69
|
}
|
|
65
70
|
}, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
X,
|
|
72
|
+
v,
|
|
73
|
+
T
|
|
74
|
+
]), te = a(async (e) => {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
let t = O.current, n = z.trim();
|
|
77
|
+
if (!n) {
|
|
78
|
+
T({
|
|
79
|
+
title: v("healthybowl.weather.map.toast.searchRequired.title", "Place required"),
|
|
80
|
+
description: v("healthybowl.weather.map.toast.searchRequired.description", "Enter a city, village, district, or region to view it on the map."),
|
|
81
|
+
variant: "warning"
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (t) {
|
|
86
|
+
H(!0);
|
|
87
|
+
try {
|
|
88
|
+
let e = await r(n);
|
|
89
|
+
if (!e) {
|
|
90
|
+
T({
|
|
91
|
+
title: v("healthybowl.weather.map.toast.searchNotFound.title", "Place not found"),
|
|
92
|
+
description: v("healthybowl.weather.map.toast.searchNotFound.description", "Try a more specific location name, such as city and state."),
|
|
93
|
+
variant: "warning"
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
let i = [
|
|
98
|
+
e.name,
|
|
99
|
+
e.admin1,
|
|
100
|
+
e.country
|
|
101
|
+
].filter(Boolean).join(", ") || n, a = [e.latitude, e.longitude];
|
|
102
|
+
Z();
|
|
103
|
+
let o = document.createElement("span");
|
|
104
|
+
o.textContent = i, M.current = _.default.circleMarker(a, {
|
|
105
|
+
radius: 8,
|
|
106
|
+
color: "#ffffff",
|
|
107
|
+
weight: 2,
|
|
108
|
+
fillColor: "#0ea5e9",
|
|
109
|
+
fillOpacity: 1
|
|
110
|
+
}).addTo(t).bindPopup(o).openPopup(), t.flyTo(a, Math.max(t.getZoom(), S), { duration: .75 }), W(i);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
T({
|
|
113
|
+
title: v("healthybowl.weather.map.toast.searchFailed.title", "Search failed"),
|
|
114
|
+
description: e instanceof Error ? e.message : String(e),
|
|
115
|
+
variant: "error"
|
|
116
|
+
});
|
|
117
|
+
} finally {
|
|
118
|
+
H(!1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, [
|
|
122
|
+
Z,
|
|
123
|
+
z,
|
|
124
|
+
v,
|
|
125
|
+
T
|
|
69
126
|
]);
|
|
70
127
|
return o(() => {
|
|
71
|
-
let t =
|
|
128
|
+
let t = D.current;
|
|
72
129
|
if (!t) return;
|
|
73
|
-
|
|
130
|
+
w();
|
|
74
131
|
let i = new AbortController(), a, o = !1;
|
|
75
|
-
return
|
|
76
|
-
let s =
|
|
77
|
-
if (o || !
|
|
78
|
-
let u = l ?? [20, 0], d = l ?
|
|
79
|
-
|
|
132
|
+
return P("loading"), I(!1), K(null), W(null), k.current = null, (async () => {
|
|
133
|
+
let s = C(n) ? n : null, c = s ? null : await r(e, i.signal), l = s ? [s.lat, s.lng] : c ? [c.latitude, c.longitude] : null;
|
|
134
|
+
if (o || !D.current) return;
|
|
135
|
+
let u = l ?? [20, 0], d = l ? b : 2;
|
|
136
|
+
k.current = l ? _.default.latLng(l[0], l[1]) : null, I(!!l), a = _.default.map(t, {
|
|
80
137
|
center: u,
|
|
81
138
|
zoom: d,
|
|
82
139
|
scrollWheelZoom: !0
|
|
83
|
-
}),
|
|
140
|
+
}), O.current = a;
|
|
141
|
+
let f = _.default.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
84
142
|
attribution: "© OpenStreetMap contributors",
|
|
85
143
|
maxZoom: 18
|
|
86
|
-
}).
|
|
87
|
-
|
|
144
|
+
}), p = _.default.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
|
|
145
|
+
attribution: "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors",
|
|
146
|
+
maxZoom: 17
|
|
147
|
+
});
|
|
148
|
+
f.addTo(a);
|
|
149
|
+
let m = _.default.control.layers({
|
|
150
|
+
[q]: f,
|
|
151
|
+
[J]: p
|
|
152
|
+
}, void 0, { collapsed: !1 }).addTo(a);
|
|
153
|
+
if (_.default.control.scale({ imperial: !1 }).addTo(a), l) {
|
|
154
|
+
let t = _.default.divIcon({
|
|
88
155
|
className: "hb-weather-marker",
|
|
89
156
|
html: "<div style=\"width:16px;height:16px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);background:var(--color-action-primary-bg, #16a34a);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.4)\"></div>",
|
|
90
157
|
iconSize: [16, 16],
|
|
91
158
|
iconAnchor: [8, 16]
|
|
92
159
|
}), n = document.createElement("span");
|
|
93
|
-
n.textContent = e || "Your farm",
|
|
160
|
+
n.textContent = e || "Your farm", _.default.marker(u, { icon: t }).addTo(a).bindPopup(n);
|
|
94
161
|
}
|
|
95
162
|
try {
|
|
96
163
|
let e = await (await fetch("https://api.rainviewer.com/public/weather-maps.json", { signal: i.signal })).json(), t = e.radar?.past ?? [], n = t[t.length - 1];
|
|
97
|
-
!o && a && e.host && n?.path
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
164
|
+
if (!o && a && e.host && n?.path) {
|
|
165
|
+
let t = _.default.tileLayer(`${e.host}${n.path}/256/{z}/{x}/{y}/4/1_1.png`, {
|
|
166
|
+
opacity: .55,
|
|
167
|
+
maxZoom: 18,
|
|
168
|
+
maxNativeZoom: 7
|
|
169
|
+
}).addTo(a);
|
|
170
|
+
m.addOverlay(t, Y), typeof n.time == "number" && K(/* @__PURE__ */ new Date(n.time * 1e3));
|
|
171
|
+
}
|
|
102
172
|
} catch {}
|
|
103
|
-
o || (
|
|
173
|
+
o || (P("ready"), window.setTimeout(() => a?.invalidateSize(), 80));
|
|
104
174
|
})().catch(() => {
|
|
105
|
-
o ||
|
|
175
|
+
o || P("error");
|
|
106
176
|
}), () => {
|
|
107
|
-
o = !0, i.abort(),
|
|
177
|
+
o = !0, i.abort(), X(), Z(), a?.remove(), O.current = null, k.current = null;
|
|
108
178
|
};
|
|
109
179
|
}, [
|
|
110
180
|
n,
|
|
111
|
-
|
|
112
|
-
e
|
|
113
|
-
|
|
181
|
+
X,
|
|
182
|
+
e,
|
|
183
|
+
Y,
|
|
184
|
+
Z,
|
|
185
|
+
q,
|
|
186
|
+
J
|
|
187
|
+
]), /* @__PURE__ */ h("div", {
|
|
114
188
|
className: "relative",
|
|
115
189
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ h("div", {
|
|
117
191
|
className: "mb-3 flex flex-wrap items-center gap-2",
|
|
118
|
-
children: [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ h("form", {
|
|
194
|
+
onSubmit: te,
|
|
195
|
+
className: "flex min-w-[min(100%,22rem)] flex-1 flex-wrap items-center gap-2",
|
|
196
|
+
children: [
|
|
197
|
+
/* @__PURE__ */ h("div", {
|
|
198
|
+
className: "relative min-w-[12rem] flex-1",
|
|
199
|
+
children: [/* @__PURE__ */ m(f, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ m("input", {
|
|
200
|
+
type: "search",
|
|
201
|
+
value: z,
|
|
202
|
+
onChange: (e) => B(e.target.value),
|
|
203
|
+
disabled: N !== "ready" || V,
|
|
204
|
+
placeholder: v("healthybowl.weather.map.search.placeholder", "Search city or place..."),
|
|
205
|
+
"aria-label": v("healthybowl.weather.map.search.label", "Search map by place"),
|
|
206
|
+
className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60"
|
|
207
|
+
})]
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ h(g, {
|
|
210
|
+
type: "submit",
|
|
211
|
+
variant: "outline",
|
|
212
|
+
size: "sm",
|
|
213
|
+
disabled: N !== "ready" || V,
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ m(f, { className: "h-4 w-4" }),
|
|
216
|
+
" ",
|
|
217
|
+
V ? v("healthybowl.weather.map.search.searching", "Searching...") : v("healthybowl.weather.map.search.action", "Search")
|
|
218
|
+
]
|
|
219
|
+
}),
|
|
220
|
+
U && /* @__PURE__ */ m(g, {
|
|
221
|
+
type: "button",
|
|
222
|
+
variant: "ghost",
|
|
223
|
+
size: "sm",
|
|
224
|
+
onClick: Q,
|
|
225
|
+
"aria-label": v("healthybowl.weather.map.search.clear", "Clear searched place"),
|
|
226
|
+
title: v("healthybowl.weather.map.search.clear", "Clear searched place"),
|
|
227
|
+
children: /* @__PURE__ */ m(p, { className: "h-4 w-4" })
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ h(g, {
|
|
232
|
+
variant: "outline",
|
|
233
|
+
size: "sm",
|
|
234
|
+
onClick: $,
|
|
235
|
+
disabled: !F || N === "loading",
|
|
236
|
+
title: v("healthybowl.weather.map.actions.focusFarm.title", "Focus the weather map on the farm"),
|
|
237
|
+
"aria-label": v("healthybowl.weather.map.actions.focusFarm.title", "Focus the weather map on the farm"),
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ m(d, { className: "h-4 w-4" }),
|
|
240
|
+
" ",
|
|
241
|
+
v("healthybowl.weather.map.actions.focusFarm", "Farm")
|
|
242
|
+
]
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ h(g, {
|
|
245
|
+
variant: "outline",
|
|
246
|
+
size: "sm",
|
|
247
|
+
onClick: ee,
|
|
248
|
+
disabled: L || N !== "ready",
|
|
249
|
+
title: v("healthybowl.weather.map.actions.locateMe.title", "Go to my current location"),
|
|
250
|
+
"aria-label": v("healthybowl.weather.map.actions.locateMe.title", "Go to my current location"),
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ m(u, { className: "h-4 w-4" }),
|
|
253
|
+
" ",
|
|
254
|
+
L ? v("healthybowl.weather.map.actions.locating", "Locating...") : v("healthybowl.weather.map.actions.locateMe", "My location")
|
|
255
|
+
]
|
|
256
|
+
})
|
|
257
|
+
]
|
|
143
258
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
ref:
|
|
259
|
+
/* @__PURE__ */ m("div", {
|
|
260
|
+
ref: D,
|
|
146
261
|
className: "h-[60vh] max-h-[460px] w-full overflow-hidden rounded-md border border-border-subtle bg-bg-sunken"
|
|
147
262
|
}),
|
|
148
|
-
|
|
263
|
+
N === "loading" && /* @__PURE__ */ m("div", {
|
|
149
264
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/60 text-sm text-text-secondary",
|
|
150
265
|
children: "Loading map…"
|
|
151
266
|
}),
|
|
152
|
-
|
|
267
|
+
N === "error" && /* @__PURE__ */ m("div", {
|
|
153
268
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/80 px-4 text-center text-sm text-text-secondary",
|
|
154
269
|
children: "Weather map needs an internet connection and couldn’t load."
|
|
155
270
|
}),
|
|
156
|
-
|
|
271
|
+
N === "ready" && !F && /* @__PURE__ */ m("div", {
|
|
157
272
|
className: "pointer-events-none absolute left-1/2 top-16 z-[400] -translate-x-1/2 rounded-full bg-bg-surface/90 px-3 py-1.5 text-xs text-text-secondary shadow-sm",
|
|
158
|
-
children:
|
|
273
|
+
children: v("healthybowl.weather.map.noLocation", "No farm coordinates available")
|
|
159
274
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ h("p", {
|
|
161
276
|
className: "mt-2 text-xs text-text-secondary",
|
|
162
|
-
children: [
|
|
277
|
+
children: [
|
|
278
|
+
"Live precipitation radar via RainViewer · base map © OpenStreetMap",
|
|
279
|
+
e ? ` · centered on ${e}` : "",
|
|
280
|
+
U ? ` · viewing ${U}` : "",
|
|
281
|
+
G ? ` · radar ${G.toLocaleTimeString([], {
|
|
282
|
+
hour: "2-digit",
|
|
283
|
+
minute: "2-digit"
|
|
284
|
+
})}` : ""
|
|
285
|
+
]
|
|
163
286
|
}),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
toasts:
|
|
166
|
-
onDismiss:
|
|
287
|
+
/* @__PURE__ */ m(t, {
|
|
288
|
+
toasts: y,
|
|
289
|
+
onDismiss: E
|
|
167
290
|
})
|
|
168
291
|
]
|
|
169
292
|
});
|
|
170
293
|
};
|
|
171
294
|
//#endregion
|
|
172
|
-
export {
|
|
295
|
+
export { T as WeatherMap };
|
|
173
296
|
|
|
174
297
|
//# sourceMappingURL=WeatherMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeatherMap.js","names":[],"sources":["../../../src/healthybowl/components/WeatherMap.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, type FC } from 'react';\nimport L from 'leaflet';\nimport { LocateFixed, MapPinned } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { geocodePlace } from '../utils/geocode';\nimport { useToast } from '../hooks/useToast';\nimport { ToastContainer } from './Toast';\n\ninterface WeatherMapProps {\n /** Resolved place name (from the weather data) used to center the map. */\n location: string;\n /** Backend-resolved farm/weather coordinates. Preferred over client-side geocoding. */\n center?: { lat: number; lng: number } | null;\n}\n\nconst LEAFLET_CSS = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';\n// SRI for leaflet@1.9.4/dist/leaflet.css (immutable versioned URL) — guards against a CDN compromise.\nconst LEAFLET_CSS_SRI = 'sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=';\nconst FARM_WEATHER_ZOOM = 7;\nconst USER_LOCATION_ZOOM = 10;\n\nconst isUsableCoordinate = (value?: { lat: number; lng: number } | null): value is { lat: number; lng: number } =>\n Boolean(\n value &&\n Number.isFinite(value.lat) &&\n Number.isFinite(value.lng) &&\n value.lat >= -90 &&\n value.lat <= 90 &&\n value.lng >= -180 &&\n value.lng <= 180 &&\n (value.lat !== 0 || value.lng !== 0)\n );\n\n/**\n * Inject Leaflet's stylesheet at runtime. The MFE library build doesn't deliver\n * a component's bundled CSS to the host shell (the host styles come from its own\n * Tailwind), so we load Leaflet's CSS from a CDN instead — consistent with the\n * map being an inherently online feature (tiles + radar).\n */\nfunction ensureLeafletCss(): void {\n if (document.getElementById('leaflet-css')) return;\n const link = document.createElement('link');\n link.id = 'leaflet-css';\n link.rel = 'stylesheet';\n link.href = LEAFLET_CSS;\n link.integrity = LEAFLET_CSS_SRI;\n link.crossOrigin = 'anonymous';\n document.head.appendChild(link);\n}\n\n/**\n * Interactive weather map: OpenStreetMap base + live precipitation radar overlay\n * (RainViewer, keyless), centered on backend-resolved farm coordinates when\n * available, then client-geocoded from the weather location as a fallback.\n */\nexport const WeatherMap: FC<WeatherMapProps> = ({ location, center }) => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const containerRef = useRef<HTMLDivElement>(null);\n const mapRef = useRef<L.Map | null>(null);\n const farmCenterRef = useRef<L.LatLng | null>(null);\n const userLocationMarkerRef = useRef<L.CircleMarker | null>(null);\n const userAccuracyCircleRef = useRef<L.Circle | null>(null);\n const [status, setStatus] = useState<'loading' | 'ready' | 'error'>('loading');\n const [hasFarmCenter, setHasFarmCenter] = useState(false);\n const [locating, setLocating] = useState(false);\n\n const clearUserLocation = useCallback(() => {\n const map = mapRef.current;\n if (userLocationMarkerRef.current && map) map.removeLayer(userLocationMarkerRef.current);\n if (userAccuracyCircleRef.current && map) map.removeLayer(userAccuracyCircleRef.current);\n userLocationMarkerRef.current = null;\n userAccuracyCircleRef.current = null;\n }, []);\n\n const focusFarm = useCallback(() => {\n const map = mapRef.current;\n const farmCenter = farmCenterRef.current;\n if (!map || !farmCenter) return;\n map.flyTo(farmCenter, FARM_WEATHER_ZOOM, { duration: 0.6 });\n }, []);\n\n const handleLocateMe = useCallback(() => {\n const map = mapRef.current;\n if (!map) return;\n if (typeof navigator === 'undefined' || !navigator.geolocation) {\n toast({\n title: t('healthybowl.weather.map.toast.locationUnsupported.title', 'Location unavailable'),\n description: t(\n 'healthybowl.weather.map.toast.locationUnsupported.description',\n 'This browser does not support device location.'\n ),\n variant: 'warning',\n });\n return;\n }\n\n setLocating(true);\n navigator.geolocation.getCurrentPosition(\n (position) => {\n const latlng: L.LatLngExpression = [position.coords.latitude, position.coords.longitude];\n clearUserLocation();\n userAccuracyCircleRef.current = L.circle(latlng, {\n radius: Math.max(10, position.coords.accuracy || 0),\n color: '#2563eb',\n fillColor: '#3b82f6',\n fillOpacity: 0.12,\n opacity: 0.45,\n weight: 1,\n }).addTo(map);\n userLocationMarkerRef.current = L.circleMarker(latlng, {\n radius: 7,\n color: '#ffffff',\n weight: 2,\n fillColor: '#2563eb',\n fillOpacity: 1,\n }).addTo(map);\n map.flyTo(latlng, Math.max(map.getZoom(), USER_LOCATION_ZOOM), { duration: 0.75 });\n setLocating(false);\n },\n (error) => {\n const blocked = error.code === error.PERMISSION_DENIED;\n toast({\n title: blocked\n ? t('healthybowl.weather.map.toast.locationBlocked.title', 'Location blocked')\n : t('healthybowl.weather.map.toast.locationFailed.title', 'Could not get location'),\n description: blocked\n ? t(\n 'healthybowl.weather.map.toast.locationBlocked.description',\n 'Allow location access in the browser, then try again.'\n )\n : t(\n 'healthybowl.weather.map.toast.locationFailed.description',\n 'Make sure GPS is enabled and the page is open over HTTPS.'\n ),\n variant: 'warning',\n });\n setLocating(false);\n },\n { enableHighAccuracy: true, timeout: 12000, maximumAge: 60000 }\n );\n }, [clearUserLocation, t, toast]);\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return undefined;\n ensureLeafletCss();\n const controller = new AbortController();\n let map: L.Map | undefined;\n let cancelled = false;\n setStatus('loading');\n setHasFarmCenter(false);\n farmCenterRef.current = null;\n\n void (async () => {\n const backendCenter = isUsableCoordinate(center) ? center : null;\n const hit = backendCenter ? null : await geocodePlace(location, controller.signal);\n const located: [number, number] | null = backendCenter\n ? [backendCenter.lat, backendCenter.lng]\n : hit\n ? [hit.latitude, hit.longitude]\n : null;\n if (cancelled || !containerRef.current) return;\n const mapCenter: L.LatLngExpression = located ?? [20, 0];\n // z7 keeps the RainViewer radar at its native resolution (it has no tiles past z7)\n // while still framing the farm and its surrounding weather system.\n const zoom = located ? FARM_WEATHER_ZOOM : 2;\n farmCenterRef.current = located ? L.latLng(located[0], located[1]) : null;\n setHasFarmCenter(Boolean(located));\n\n map = L.map(el, { center: mapCenter, zoom, scrollWheelZoom: true });\n mapRef.current = map;\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors',\n maxZoom: 18,\n }).addTo(map);\n\n if (located) {\n const icon = L.divIcon({\n className: 'hb-weather-marker',\n html:\n '<div style=\"width:16px;height:16px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);' +\n 'background:var(--color-action-primary-bg, #16a34a);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.4)\"></div>',\n iconSize: [16, 16],\n iconAnchor: [8, 16],\n });\n // bindPopup treats a string as HTML; pass a text node so the place name\n // can never be interpreted as markup (defense-in-depth against a tainted value).\n const popupEl = document.createElement('span');\n popupEl.textContent = location || 'Your farm';\n L.marker(mapCenter, { icon }).addTo(map).bindPopup(popupEl);\n }\n\n // Live precipitation radar overlay (RainViewer — free, keyless).\n try {\n const res = await fetch('https://api.rainviewer.com/public/weather-maps.json', { signal: controller.signal });\n const data = (await res.json()) as { host?: string; radar?: { past?: Array<{ path?: string }> } };\n const frames = data.radar?.past ?? [];\n const latest = frames[frames.length - 1];\n // The map may have been removed during the await — guard before touching it.\n if (!cancelled && map && data.host && latest?.path) {\n // RainViewer radar only has tiles up to z7; cap maxNativeZoom so Leaflet\n // upscales from z7 instead of requesting the \"Zoom Level Not Supported\" placeholder.\n L.tileLayer(`${data.host}${latest.path}/256/{z}/{x}/{y}/4/1_1.png`, {\n opacity: 0.55,\n maxZoom: 18,\n maxNativeZoom: 7,\n }).addTo(map);\n }\n } catch {\n /* radar overlay is best-effort */\n }\n\n if (!cancelled) {\n setStatus('ready');\n window.setTimeout(() => map?.invalidateSize(), 80);\n }\n })().catch(() => {\n if (!cancelled) setStatus('error');\n });\n\n return () => {\n cancelled = true;\n controller.abort();\n clearUserLocation();\n map?.remove();\n mapRef.current = null;\n farmCenterRef.current = null;\n };\n }, [center, clearUserLocation, location]);\n\n return (\n <div className=\"relative\">\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={focusFarm}\n disabled={!hasFarmCenter || status === 'loading'}\n title={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n aria-label={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n >\n <MapPinned className=\"h-4 w-4\" /> {t('healthybowl.weather.map.actions.focusFarm', 'Farm')}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleLocateMe}\n disabled={locating || status !== 'ready'}\n title={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n aria-label={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n >\n <LocateFixed className=\"h-4 w-4\" />{' '}\n {locating\n ? t('healthybowl.weather.map.actions.locating', 'Locating...')\n : t('healthybowl.weather.map.actions.locateMe', 'My location')}\n </Button>\n </div>\n <div\n ref={containerRef}\n className=\"h-[60vh] max-h-[460px] w-full overflow-hidden rounded-md border border-border-subtle bg-bg-sunken\"\n />\n {status === 'loading' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/60 text-sm text-text-secondary\">\n Loading map…\n </div>\n )}\n {status === 'error' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/80 px-4 text-center text-sm text-text-secondary\">\n Weather map needs an internet connection and couldn’t load.\n </div>\n )}\n {status === 'ready' && !hasFarmCenter && (\n <div className=\"pointer-events-none absolute left-1/2 top-16 z-[400] -translate-x-1/2 rounded-full bg-bg-surface/90 px-3 py-1.5 text-xs text-text-secondary shadow-sm\">\n {t('healthybowl.weather.map.noLocation', 'No farm coordinates available')}\n </div>\n )}\n <p className=\"mt-2 text-xs text-text-secondary\">\n Live precipitation radar via RainViewer · base map © OpenStreetMap\n {location ? ` · centered on ${location}` : ''}\n </p>\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;mCAgBM,IAAc,oDAEd,IAAkB,uDAClB,IAAoB,GACpB,IAAqB,IAErB,KAAsB,MAC1B,GACE,KACA,OAAO,SAAS,EAAM,IAAI,IAC1B,OAAO,SAAS,EAAM,IAAI,IAC1B,EAAM,OAAO,OACb,EAAM,OAAO,MACb,EAAM,OAAO,QACb,EAAM,OAAO,QACZ,EAAM,QAAQ,KAAK,EAAM,QAAQ;AAStC,SAAS,IAAyB;AAChC,KAAI,SAAS,eAAe,cAAc,CAAE;CAC5C,IAAM,IAAO,SAAS,cAAc,OAAO;AAM3C,CALA,EAAK,KAAK,eACV,EAAK,MAAM,cACX,EAAK,OAAO,GACZ,EAAK,YAAY,GACjB,EAAK,cAAc,aACnB,SAAS,KAAK,YAAY,EAAK;;AAQjC,IAAa,KAAmC,EAAE,aAAU,gBAAa;CACvE,IAAM,EAAE,SAAM,GAAS,EACjB,EAAE,WAAQ,UAAO,eAAY,GAAU,EACvC,IAAe,EAAuB,KAAK,EAC3C,IAAS,EAAqB,KAAK,EACnC,IAAgB,EAAwB,KAAK,EAC7C,IAAwB,EAA8B,KAAK,EAC3D,IAAwB,EAAwB,KAAK,EACrD,CAAC,GAAQ,KAAa,EAAwC,UAAU,EACxE,CAAC,GAAe,KAAoB,EAAS,GAAM,EACnD,CAAC,GAAU,KAAe,EAAS,GAAM,EAEzC,IAAoB,QAAkB;EAC1C,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A4C,cAAc,GAC5D,EAAE,4CAA4C,cAAc;MACzD;OACL;;GACN,kBAAC,OAAD;IACE,KAAK;IACL,WAAU;IACV,CAAA;GACD,MAAW,aACV,kBAAC,OAAD;IAAK,WAAU;cAAgI;IAEzI,CAAA;GAEP,MAAW,WACV,kBAAC,OAAD;IAAK,WAAU;cAAiJ;IAE1J,CAAA;GAEP,MAAW,WAAW,CAAC,KACtB,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAE,sCAAsC,gCAAgC;IACrE,CAAA;GAER,kBAAC,KAAD;IAAG,WAAU;cAAb,CAAgD,sEAE7C,IAAW,kBAAkB,MAAa,GACzC;;GACJ,kBAAC,GAAD;IAAwB;IAAQ,WAAW;IAAW,CAAA;GAClD"}
|
|
1
|
+
{"version":3,"file":"WeatherMap.js","names":[],"sources":["../../../src/healthybowl/components/WeatherMap.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, type FC, type FormEvent } from 'react';\nimport L from 'leaflet';\nimport { LocateFixed, MapPinned, Search, X } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { geocodePlace } from '../utils/geocode';\nimport { useToast } from '../hooks/useToast';\nimport { ToastContainer } from './Toast';\n\ninterface WeatherMapProps {\n /** Resolved place name (from the weather data) used to center the map. */\n location: string;\n /** Backend-resolved farm/weather coordinates. Preferred over client-side geocoding. */\n center?: { lat: number; lng: number } | null;\n}\n\nconst LEAFLET_CSS = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';\n// SRI for leaflet@1.9.4/dist/leaflet.css (immutable versioned URL) — guards against a CDN compromise.\nconst LEAFLET_CSS_SRI = 'sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=';\nconst FARM_WEATHER_ZOOM = 7;\nconst USER_LOCATION_ZOOM = 10;\nconst SEARCH_LOCATION_ZOOM = 10;\n\nconst isUsableCoordinate = (value?: { lat: number; lng: number } | null): value is { lat: number; lng: number } =>\n Boolean(\n value &&\n Number.isFinite(value.lat) &&\n Number.isFinite(value.lng) &&\n value.lat >= -90 &&\n value.lat <= 90 &&\n value.lng >= -180 &&\n value.lng <= 180 &&\n (value.lat !== 0 || value.lng !== 0)\n );\n\n/**\n * Inject Leaflet's stylesheet at runtime. The MFE library build doesn't deliver\n * a component's bundled CSS to the host shell (the host styles come from its own\n * Tailwind), so we load Leaflet's CSS from a CDN instead — consistent with the\n * map being an inherently online feature (tiles + radar).\n */\nfunction ensureLeafletCss(): void {\n if (document.getElementById('leaflet-css')) return;\n const link = document.createElement('link');\n link.id = 'leaflet-css';\n link.rel = 'stylesheet';\n link.href = LEAFLET_CSS;\n link.integrity = LEAFLET_CSS_SRI;\n link.crossOrigin = 'anonymous';\n document.head.appendChild(link);\n}\n\n/**\n * Interactive weather map: OpenStreetMap base + live precipitation radar overlay\n * (RainViewer, keyless), centered on backend-resolved farm coordinates when\n * available, then client-geocoded from the weather location as a fallback.\n */\nexport const WeatherMap: FC<WeatherMapProps> = ({ location, center }) => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const containerRef = useRef<HTMLDivElement>(null);\n const mapRef = useRef<L.Map | null>(null);\n const farmCenterRef = useRef<L.LatLng | null>(null);\n const userLocationMarkerRef = useRef<L.CircleMarker | null>(null);\n const userAccuracyCircleRef = useRef<L.Circle | null>(null);\n const searchedPlaceMarkerRef = useRef<L.CircleMarker | null>(null);\n const [status, setStatus] = useState<'loading' | 'ready' | 'error'>('loading');\n const [hasFarmCenter, setHasFarmCenter] = useState(false);\n const [locating, setLocating] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [searching, setSearching] = useState(false);\n const [searchedPlace, setSearchedPlace] = useState<string | null>(null);\n const [radarUpdatedAt, setRadarUpdatedAt] = useState<Date | null>(null);\n const streetsLayerLabel = t('healthybowl.weather.map.layers.streets', 'Streets');\n const terrainLayerLabel = t('healthybowl.weather.map.layers.terrain', 'Terrain');\n const radarLayerLabel = t('healthybowl.weather.map.layers.radar', 'Live radar');\n\n const clearUserLocation = useCallback(() => {\n const map = mapRef.current;\n if (userLocationMarkerRef.current && map) map.removeLayer(userLocationMarkerRef.current);\n if (userAccuracyCircleRef.current && map) map.removeLayer(userAccuracyCircleRef.current);\n userLocationMarkerRef.current = null;\n userAccuracyCircleRef.current = null;\n }, []);\n\n const removeSearchedPlaceMarker = useCallback(() => {\n const map = mapRef.current;\n if (searchedPlaceMarkerRef.current && map) map.removeLayer(searchedPlaceMarkerRef.current);\n searchedPlaceMarkerRef.current = null;\n }, []);\n\n const clearSearchedPlace = useCallback(() => {\n removeSearchedPlaceMarker();\n setSearchedPlace(null);\n }, [removeSearchedPlaceMarker]);\n\n const focusFarm = useCallback(() => {\n const map = mapRef.current;\n const farmCenter = farmCenterRef.current;\n if (!map || !farmCenter) return;\n map.flyTo(farmCenter, FARM_WEATHER_ZOOM, { duration: 0.6 });\n }, []);\n\n const handleLocateMe = useCallback(() => {\n const map = mapRef.current;\n if (!map) return;\n if (typeof navigator === 'undefined' || !navigator.geolocation) {\n toast({\n title: t('healthybowl.weather.map.toast.locationUnsupported.title', 'Location unavailable'),\n description: t(\n 'healthybowl.weather.map.toast.locationUnsupported.description',\n 'This browser does not support device location.'\n ),\n variant: 'warning',\n });\n return;\n }\n\n setLocating(true);\n navigator.geolocation.getCurrentPosition(\n (position) => {\n const latlng: L.LatLngExpression = [position.coords.latitude, position.coords.longitude];\n clearUserLocation();\n userAccuracyCircleRef.current = L.circle(latlng, {\n radius: Math.max(10, position.coords.accuracy || 0),\n color: '#2563eb',\n fillColor: '#3b82f6',\n fillOpacity: 0.12,\n opacity: 0.45,\n weight: 1,\n }).addTo(map);\n userLocationMarkerRef.current = L.circleMarker(latlng, {\n radius: 7,\n color: '#ffffff',\n weight: 2,\n fillColor: '#2563eb',\n fillOpacity: 1,\n }).addTo(map);\n map.flyTo(latlng, Math.max(map.getZoom(), USER_LOCATION_ZOOM), { duration: 0.75 });\n setLocating(false);\n },\n (error) => {\n const blocked = error.code === error.PERMISSION_DENIED;\n toast({\n title: blocked\n ? t('healthybowl.weather.map.toast.locationBlocked.title', 'Location blocked')\n : t('healthybowl.weather.map.toast.locationFailed.title', 'Could not get location'),\n description: blocked\n ? t(\n 'healthybowl.weather.map.toast.locationBlocked.description',\n 'Allow location access in the browser, then try again.'\n )\n : t(\n 'healthybowl.weather.map.toast.locationFailed.description',\n 'Make sure GPS is enabled and the page is open over HTTPS.'\n ),\n variant: 'warning',\n });\n setLocating(false);\n },\n { enableHighAccuracy: true, timeout: 12000, maximumAge: 60000 }\n );\n }, [clearUserLocation, t, toast]);\n\n const handleSearchPlace = useCallback(\n async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const map = mapRef.current;\n const place = searchQuery.trim();\n if (!place) {\n toast({\n title: t('healthybowl.weather.map.toast.searchRequired.title', 'Place required'),\n description: t(\n 'healthybowl.weather.map.toast.searchRequired.description',\n 'Enter a city, village, district, or region to view it on the map.'\n ),\n variant: 'warning',\n });\n return;\n }\n if (!map) return;\n\n setSearching(true);\n try {\n const hit = await geocodePlace(place);\n if (!hit) {\n toast({\n title: t('healthybowl.weather.map.toast.searchNotFound.title', 'Place not found'),\n description: t(\n 'healthybowl.weather.map.toast.searchNotFound.description',\n 'Try a more specific location name, such as city and state.'\n ),\n variant: 'warning',\n });\n return;\n }\n\n const label = [hit.name, hit.admin1, hit.country].filter(Boolean).join(', ') || place;\n const latlng: L.LatLngExpression = [hit.latitude, hit.longitude];\n removeSearchedPlaceMarker();\n const popupEl = document.createElement('span');\n popupEl.textContent = label;\n searchedPlaceMarkerRef.current = L.circleMarker(latlng, {\n radius: 8,\n color: '#ffffff',\n weight: 2,\n fillColor: '#0ea5e9',\n fillOpacity: 1,\n })\n .addTo(map)\n .bindPopup(popupEl)\n .openPopup();\n map.flyTo(latlng, Math.max(map.getZoom(), SEARCH_LOCATION_ZOOM), { duration: 0.75 });\n setSearchedPlace(label);\n } catch (err) {\n toast({\n title: t('healthybowl.weather.map.toast.searchFailed.title', 'Search failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setSearching(false);\n }\n },\n [removeSearchedPlaceMarker, searchQuery, t, toast]\n );\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return undefined;\n ensureLeafletCss();\n const controller = new AbortController();\n let map: L.Map | undefined;\n let cancelled = false;\n setStatus('loading');\n setHasFarmCenter(false);\n setRadarUpdatedAt(null);\n setSearchedPlace(null);\n farmCenterRef.current = null;\n\n void (async () => {\n const backendCenter = isUsableCoordinate(center) ? center : null;\n const hit = backendCenter ? null : await geocodePlace(location, controller.signal);\n const located: [number, number] | null = backendCenter\n ? [backendCenter.lat, backendCenter.lng]\n : hit\n ? [hit.latitude, hit.longitude]\n : null;\n if (cancelled || !containerRef.current) return;\n const mapCenter: L.LatLngExpression = located ?? [20, 0];\n // z7 keeps the RainViewer radar at its native resolution (it has no tiles past z7)\n // while still framing the farm and its surrounding weather system.\n const zoom = located ? FARM_WEATHER_ZOOM : 2;\n farmCenterRef.current = located ? L.latLng(located[0], located[1]) : null;\n setHasFarmCenter(Boolean(located));\n\n map = L.map(el, { center: mapCenter, zoom, scrollWheelZoom: true });\n mapRef.current = map;\n const streetsLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors',\n maxZoom: 18,\n });\n const terrainLayer = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors',\n maxZoom: 17,\n });\n streetsLayer.addTo(map);\n const layerControl = L.control\n .layers(\n {\n [streetsLayerLabel]: streetsLayer,\n [terrainLayerLabel]: terrainLayer,\n },\n undefined,\n { collapsed: false }\n )\n .addTo(map);\n L.control.scale({ imperial: false }).addTo(map);\n\n if (located) {\n const icon = L.divIcon({\n className: 'hb-weather-marker',\n html:\n '<div style=\"width:16px;height:16px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);' +\n 'background:var(--color-action-primary-bg, #16a34a);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.4)\"></div>',\n iconSize: [16, 16],\n iconAnchor: [8, 16],\n });\n // bindPopup treats a string as HTML; pass a text node so the place name\n // can never be interpreted as markup (defense-in-depth against a tainted value).\n const popupEl = document.createElement('span');\n popupEl.textContent = location || 'Your farm';\n L.marker(mapCenter, { icon }).addTo(map).bindPopup(popupEl);\n }\n\n // Live precipitation radar overlay (RainViewer — free, keyless).\n try {\n const res = await fetch('https://api.rainviewer.com/public/weather-maps.json', { signal: controller.signal });\n const data = (await res.json()) as {\n host?: string;\n radar?: { past?: Array<{ path?: string; time?: number }> };\n };\n const frames = data.radar?.past ?? [];\n const latest = frames[frames.length - 1];\n // The map may have been removed during the await — guard before touching it.\n if (!cancelled && map && data.host && latest?.path) {\n // RainViewer radar only has tiles up to z7; cap maxNativeZoom so Leaflet\n // upscales from z7 instead of requesting the \"Zoom Level Not Supported\" placeholder.\n const radarLayer = L.tileLayer(`${data.host}${latest.path}/256/{z}/{x}/{y}/4/1_1.png`, {\n opacity: 0.55,\n maxZoom: 18,\n maxNativeZoom: 7,\n }).addTo(map);\n layerControl.addOverlay(radarLayer, radarLayerLabel);\n if (typeof latest.time === 'number') setRadarUpdatedAt(new Date(latest.time * 1000));\n }\n } catch {\n /* radar overlay is best-effort */\n }\n\n if (!cancelled) {\n setStatus('ready');\n window.setTimeout(() => map?.invalidateSize(), 80);\n }\n })().catch(() => {\n if (!cancelled) setStatus('error');\n });\n\n return () => {\n cancelled = true;\n controller.abort();\n clearUserLocation();\n removeSearchedPlaceMarker();\n map?.remove();\n mapRef.current = null;\n farmCenterRef.current = null;\n };\n }, [\n center,\n clearUserLocation,\n location,\n radarLayerLabel,\n removeSearchedPlaceMarker,\n streetsLayerLabel,\n terrainLayerLabel,\n ]);\n\n return (\n <div className=\"relative\">\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n <form onSubmit={handleSearchPlace} className=\"flex min-w-[min(100%,22rem)] flex-1 flex-wrap items-center gap-2\">\n <div className=\"relative min-w-[12rem] flex-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary\" />\n <input\n type=\"search\"\n value={searchQuery}\n onChange={(event) => setSearchQuery(event.target.value)}\n disabled={status !== 'ready' || searching}\n placeholder={t('healthybowl.weather.map.search.placeholder', 'Search city or place...')}\n aria-label={t('healthybowl.weather.map.search.label', 'Search map by place')}\n className=\"h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60\"\n />\n </div>\n <Button type=\"submit\" variant=\"outline\" size=\"sm\" disabled={status !== 'ready' || searching}>\n <Search className=\"h-4 w-4\" />{' '}\n {searching\n ? t('healthybowl.weather.map.search.searching', 'Searching...')\n : t('healthybowl.weather.map.search.action', 'Search')}\n </Button>\n {searchedPlace && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={clearSearchedPlace}\n aria-label={t('healthybowl.weather.map.search.clear', 'Clear searched place')}\n title={t('healthybowl.weather.map.search.clear', 'Clear searched place')}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n )}\n </form>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={focusFarm}\n disabled={!hasFarmCenter || status === 'loading'}\n title={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n aria-label={t('healthybowl.weather.map.actions.focusFarm.title', 'Focus the weather map on the farm')}\n >\n <MapPinned className=\"h-4 w-4\" /> {t('healthybowl.weather.map.actions.focusFarm', 'Farm')}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleLocateMe}\n disabled={locating || status !== 'ready'}\n title={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n aria-label={t('healthybowl.weather.map.actions.locateMe.title', 'Go to my current location')}\n >\n <LocateFixed className=\"h-4 w-4\" />{' '}\n {locating\n ? t('healthybowl.weather.map.actions.locating', 'Locating...')\n : t('healthybowl.weather.map.actions.locateMe', 'My location')}\n </Button>\n </div>\n <div\n ref={containerRef}\n className=\"h-[60vh] max-h-[460px] w-full overflow-hidden rounded-md border border-border-subtle bg-bg-sunken\"\n />\n {status === 'loading' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/60 text-sm text-text-secondary\">\n Loading map…\n </div>\n )}\n {status === 'error' && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/80 px-4 text-center text-sm text-text-secondary\">\n Weather map needs an internet connection and couldn’t load.\n </div>\n )}\n {status === 'ready' && !hasFarmCenter && (\n <div className=\"pointer-events-none absolute left-1/2 top-16 z-[400] -translate-x-1/2 rounded-full bg-bg-surface/90 px-3 py-1.5 text-xs text-text-secondary shadow-sm\">\n {t('healthybowl.weather.map.noLocation', 'No farm coordinates available')}\n </div>\n )}\n <p className=\"mt-2 text-xs text-text-secondary\">\n Live precipitation radar via RainViewer · base map © OpenStreetMap\n {location ? ` · centered on ${location}` : ''}\n {searchedPlace ? ` · viewing ${searchedPlace}` : ''}\n {radarUpdatedAt\n ? ` · radar ${radarUpdatedAt.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`\n : ''}\n </p>\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;mCAgBM,IAAc,oDAEd,IAAkB,uDAClB,IAAoB,GACpB,IAAqB,IACrB,IAAuB,IAEvB,KAAsB,MAC1B,GACE,KACA,OAAO,SAAS,EAAM,IAAI,IAC1B,OAAO,SAAS,EAAM,IAAI,IAC1B,EAAM,OAAO,OACb,EAAM,OAAO,MACb,EAAM,OAAO,QACb,EAAM,OAAO,QACZ,EAAM,QAAQ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