@burdenoff/microfe-healthybowl 2026.713.2 → 2026.713.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,31 +1,34 @@
1
1
  import { __toESM as e } from "../../../_virtual/_rolldown/runtime.js";
2
2
  import { geocodePlace as t } from "../../utils/geocode.js";
3
3
  import { useHealthyBowl as n } from "../../context/HealthyBowlContext.js";
4
- import { PageLayout as r } from "../../components/PageLayout.js";
5
- import { ErrorState as i } from "../../components/ErrorState.js";
6
- import { ToastContainer as a } from "../../components/Toast.js";
7
- import { useConfirm as o } from "../../components/ConfirmDialog.js";
8
- import { Modal as s } from "../../components/Modal.js";
9
- import { require_leaflet_src as c } from "../../../node_modules/leaflet/dist/leaflet-src.js";
10
- import { useToast as ee } from "../../hooks/useToast.js";
11
- import { ensureLeafletCss as te } from "../../utils/leaflet.js";
12
- import { extractPolygon as ne, isValidPolygon as re, polygonAreaInUnit as ie, polygonAreaSqMeters as l, polygonCentroid as ae, ringToPolygon as oe } from "../../utils/geo.js";
13
- import { SOIL_PALETTE as se, soilColor as ce, soilLegendFor as le } from "../../utils/soil.js";
14
- import { elevationColor as ue, fetchElevations as de } from "../../utils/elevation.js";
15
- import { bedPlantCount as fe, generateBeds as pe } from "../../utils/bedLayout.js";
4
+ import { useBasePath as r } from "../../hooks/useBasePath.js";
5
+ import { PageLayout as i } from "../../components/PageLayout.js";
6
+ import { EmptyState as a } from "../../components/EmptyState.js";
7
+ import { ErrorState as o } from "../../components/ErrorState.js";
8
+ import { ToastContainer as ee } from "../../components/Toast.js";
9
+ import { useConfirm as te } from "../../components/ConfirmDialog.js";
10
+ import { Modal as ne } from "../../components/Modal.js";
11
+ import { require_leaflet_src as s } from "../../../node_modules/leaflet/dist/leaflet-src.js";
12
+ import { useToast as re } from "../../hooks/useToast.js";
13
+ import { ensureLeafletCss as ie } from "../../utils/leaflet.js";
14
+ import { extractPolygon as ae, isValidPolygon as oe, polygonAreaInUnit as se, polygonAreaSqMeters as c, polygonCentroid as ce, ringToPolygon as le } from "../../utils/geo.js";
15
+ import { SOIL_PALETTE as ue, soilColor as de, soilLegendFor as fe } from "../../utils/soil.js";
16
+ import { elevationColor as pe, fetchElevations as me } from "../../utils/elevation.js";
17
+ import { bedPlantCount as he, generateBeds as ge } from "../../utils/bedLayout.js";
16
18
  import "../../utils/index.js";
17
19
  import "../../components/index.js";
18
- import { useHealthyBowlData as me } from "../../hooks/useHealthyBowlData.js";
19
- import { DEFAULT_BED_WIDTH_M as he, DEFAULT_PATH_WIDTH_M as ge, getCropSpacingPreset as _e } from "../../utils/plantingCapacity.js";
20
- import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
21
- import { useI18n as ve } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
22
- import { Check as ye, Droplet as h, Fence as g, Layers as be, LayoutGrid as xe, LocateFixed as Se, MapPinned as Ce, Pencil as we, Plus as Te, Ruler as Ee, Save as De, Search as Oe, Shapes as ke, Spline as Ae, Sprout as _, Square as je, Trash2 as Me, TriangleAlert as Ne, Warehouse as v, Waypoints as Pe, X as Fe } from "lucide-react";
23
- import { Fragment as Ie, jsx as y, jsxs as b } from "react/jsx-runtime";
24
- import { Button as x, Select as Le, SelectContent as Re, SelectItem as S, SelectTrigger as ze, SelectValue as Be } from "@burdenoff/fe-libs/ui";
25
- import { gql as C } from "@apollo/client";
26
- import { useMutation as w, useQuery as Ve } from "@apollo/client/react";
20
+ import { useHealthyBowlData as _e } from "../../hooks/useHealthyBowlData.js";
21
+ import { DEFAULT_BED_WIDTH_M as ve, DEFAULT_PATH_WIDTH_M as ye, getCropSpacingPreset as be } from "../../utils/plantingCapacity.js";
22
+ import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
23
+ import { useI18n as xe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
24
+ import { Check as Se, Droplet as m, Fence as h, Layers as Ce, LayoutGrid as we, LocateFixed as Te, MapPinned as Ee, Pencil as De, Plus as Oe, Ruler as ke, Save as Ae, Search as je, Shapes as Me, Spline as Ne, Sprout as g, Square as Pe, Trash2 as Fe, TriangleAlert as Ie, Warehouse as Le, Waypoints as _, X as Re } from "lucide-react";
25
+ import { useNavigate as ze } from "react-router-dom";
26
+ import { Fragment as Be, jsx as v, jsxs as y } from "react/jsx-runtime";
27
+ import { Button as b, Select as Ve, SelectContent as He, SelectItem as x, SelectTrigger as Ue, SelectValue as We } from "@burdenoff/fe-libs/ui";
28
+ import { gql as S } from "@apollo/client";
29
+ import { useMutation as C, useQuery as Ge } from "@apollo/client/react";
27
30
  //#region src/healthybowl/pages/fields/FieldMapPage.tsx
28
- var T = /* @__PURE__ */ e(c(), 1), He = C`
31
+ var w = /* @__PURE__ */ e(s(), 1), Ke = S`
29
32
  mutation UpdateHealthyBowlFieldBoundaryOnMapPage($input: UpdateHealthyBowlFieldInput!) {
30
33
  updateHealthyBowlField(input: $input) {
31
34
  id
@@ -34,7 +37,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
34
37
  location
35
38
  }
36
39
  }
37
- `, Ue = C`
40
+ `, qe = S`
38
41
  query HealthyBowlBedsOnMapPage($context: ContextInput!, $fieldId: ID) {
39
42
  healthyBowlBeds(context: $context, fieldId: $fieldId) {
40
43
  id
@@ -50,13 +53,13 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
50
53
  status
51
54
  }
52
55
  }
53
- `, We = C`
56
+ `, Je = S`
54
57
  mutation CreateHealthyBowlBedOnMapPage($input: CreateHealthyBowlBedInput!) {
55
58
  createHealthyBowlBed(input: $input) {
56
59
  id
57
60
  }
58
61
  }
59
- `, Ge = C`
62
+ `, Ye = S`
60
63
  mutation UpdateHealthyBowlBedOnMapPage($input: UpdateHealthyBowlBedInput!) {
61
64
  updateHealthyBowlBed(input: $input) {
62
65
  id
@@ -64,11 +67,11 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
64
67
  plantCount
65
68
  }
66
69
  }
67
- `, Ke = C`
70
+ `, Xe = S`
68
71
  mutation DeleteHealthyBowlBedOnMapPage($id: ID!, $context: ContextInput!) {
69
72
  deleteHealthyBowlBed(id: $id, context: $context)
70
73
  }
71
- `, qe = C`
74
+ `, Ze = S`
72
75
  query HealthyBowlMapFeaturesOnMapPage($context: ContextInput!) {
73
76
  healthyBowlMapFeatures(context: $context) {
74
77
  id
@@ -79,17 +82,17 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
79
82
  color
80
83
  }
81
84
  }
82
- `, Je = C`
85
+ `, Qe = S`
83
86
  mutation CreateHealthyBowlMapFeatureOnMapPage($input: CreateHealthyBowlMapFeatureInput!) {
84
87
  createHealthyBowlMapFeature(input: $input) {
85
88
  id
86
89
  }
87
90
  }
88
- `, Ye = C`
91
+ `, $e = S`
89
92
  mutation DeleteHealthyBowlMapFeatureOnMapPage($id: ID!, $context: ContextInput!) {
90
93
  deleteHealthyBowlMapFeature(id: $id, context: $context)
91
94
  }
92
- `, Xe = [
95
+ `, et = [
93
96
  {
94
97
  type: "BUFFER_ZONE",
95
98
  kind: "polygon",
@@ -103,7 +106,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
103
106
  fillColor: "#f59e0b",
104
107
  fillOpacity: .15
105
108
  },
106
- icon: je
109
+ icon: Pe
107
110
  },
108
111
  {
109
112
  type: "GREENHOUSE",
@@ -117,7 +120,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
117
120
  fillColor: "#14b8a6",
118
121
  fillOpacity: .3
119
122
  },
120
- icon: _
123
+ icon: g
121
124
  },
122
125
  {
123
126
  type: "BUILDING",
@@ -131,7 +134,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
131
134
  fillColor: "#6b7280",
132
135
  fillOpacity: .4
133
136
  },
134
- icon: v
137
+ icon: Le
135
138
  },
136
139
  {
137
140
  type: "ENCLOSURE",
@@ -146,7 +149,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
146
149
  fillColor: "#92400e",
147
150
  fillOpacity: .2
148
151
  },
149
- icon: g
152
+ icon: h
150
153
  },
151
154
  {
152
155
  type: "CUSTOM",
@@ -160,7 +163,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
160
163
  fillColor: "#8b5cf6",
161
164
  fillOpacity: .25
162
165
  },
163
- icon: ke
166
+ icon: Me
164
167
  },
165
168
  {
166
169
  type: "IRRIGATION_LINE",
@@ -172,7 +175,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
172
175
  color: "#3b82f6",
173
176
  weight: 3
174
177
  },
175
- icon: Pe
178
+ icon: _
176
179
  },
177
180
  {
178
181
  type: "WATER_SOURCE",
@@ -186,7 +189,7 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
186
189
  fillColor: "#3b82f6",
187
190
  fillOpacity: 1
188
191
  },
189
- icon: h
192
+ icon: m
190
193
  },
191
194
  {
192
195
  type: "HAZARD",
@@ -200,70 +203,70 @@ var T = /* @__PURE__ */ e(c(), 1), He = C`
200
203
  fillColor: "#dc2626",
201
204
  fillOpacity: 1
202
205
  },
203
- icon: Ne
206
+ icon: Ie
204
207
  }
205
- ], E = new Map(Xe.map((e) => [e.type, e])), Ze = (e) => e === "polygon" ? "Area" : e === "line" ? "Line" : "Point", Qe = 250, $e = 20;
206
- async function et(e, t, n) {
208
+ ], T = new Map(et.map((e) => [e.type, e])), tt = (e) => e === "polygon" ? "Area" : e === "line" ? "Line" : "Point", nt = 250, rt = 20;
209
+ async function it(e, t, n) {
207
210
  for (let r = 0; r < e.length; r += t) await Promise.all(e.slice(r, r + t).map(n));
208
211
  }
209
- var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", nt = "Esri, Maxar, Earthstar Geographics", rt = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", it = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", at = 21, ot = 16, D = 2.47105, st = "#16a34a", ct = {
212
+ var at = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", ot = "Esri, Maxar, Earthstar Geographics", st = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", ct = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", lt = 21, ut = 16, dt = 2.47105, ft = "#16a34a", pt = {
210
213
  color: "#f59e0b",
211
214
  weight: 2,
212
215
  dashArray: "6 4",
213
216
  fillColor: "#f59e0b",
214
217
  fillOpacity: .15
215
- }, lt = {
218
+ }, mt = {
216
219
  color: "#ffffff",
217
220
  weight: 2,
218
221
  dashArray: "6 4",
219
222
  fillColor: "#22c55e",
220
223
  fillOpacity: .2
221
- }, ut = {
224
+ }, ht = {
222
225
  color: "#38bdf8",
223
226
  weight: 3,
224
227
  dashArray: "6 6"
225
- }, dt = {
228
+ }, gt = {
226
229
  color: "#b45309",
227
230
  weight: 1,
228
231
  dashArray: "4 3",
229
232
  fillColor: "#f59e0b",
230
233
  fillOpacity: .25
231
- }, ft = {
234
+ }, _t = {
232
235
  color: "#065f46",
233
236
  weight: 2,
234
237
  fillColor: "#34d399",
235
238
  fillOpacity: .5
236
- }, pt = {
239
+ }, vt = {
237
240
  color: "#065f46",
238
241
  weight: 2,
239
242
  fillColor: "#059669",
240
243
  fillOpacity: .6
241
- }, mt = (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)), ht = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), gt = (e) => ht(e.unit) ? e.area * D : e.area, _t = (e) => `${e.area.toFixed(1)} ${ht(e.unit) ? "ha" : "ac"}`, O = (e) => {
242
- let t = ne(e.boundary);
243
- return t && re(t) ? t : null;
244
- }, vt = T.default.divIcon({
244
+ }, yt = (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)), E = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), bt = (e) => E(e.unit) ? e.area * dt : e.area, xt = (e) => `${e.area.toFixed(1)} ${E(e.unit) ? "ha" : "ac"}`, D = (e) => {
245
+ let t = ae(e.boundary);
246
+ return t && oe(t) ? t : null;
247
+ }, St = w.default.divIcon({
245
248
  className: "",
246
249
  html: "<span style=\"display:block;width:12px;height:12px;background:#22c55e;border:2px solid #fff;border-radius:2px;box-shadow:0 0 3px rgba(0,0,0,.6)\"></span>",
247
250
  iconSize: [16, 16],
248
251
  iconAnchor: [8, 8]
249
- }), k = () => {
250
- let { t: e } = ve(), { workspaceId: c } = n(), h = o(), { fields: g, crops: _, loadings: je, errors: Ne, refetch: v, createField: Pe } = me(), { toasts: C, toast: D, dismiss: ht } = ee(), [k] = w(He), [yt] = w(We), [bt] = w(Ge), [xt] = w(Ke), [St] = w(Je), [Ct] = w(Ye), [A, wt] = m("loading"), [j, M] = m("view"), [N, P] = m(null), [Tt, Et] = m(!1), [Dt, Ot] = m(!0), [kt, At] = m(!1), [F, jt] = m({}), [Mt, Nt] = m(""), [Pt, Ft] = m(""), [It, Lt] = m(!1), [Rt, zt] = m(0), [Bt, Vt] = m(null), [Ht, Ut] = m(!1), [Wt, Gt] = m(!1), [I, Kt] = m(null), [qt, Jt] = m(!1), [L, Yt] = m(he), [Xt, Zt] = m(ge), [R, Qt] = m(0), [$t, en] = m(""), [tn, nn] = m(!1), [rn, an] = m(!1), [z, on] = m(null), [sn, cn] = m(""), [ln, un] = m(!1), [dn, fn] = m(!0), [pn, mn] = m(!1), [hn, gn] = m(null), [_n, vn] = m(0), [B, yn] = m(null), [bn, xn] = m(""), [Sn, Cn] = m(""), [wn, Tn] = m(!1), [V, En] = m(null), [Dn, On] = m(!1), [H, kn] = m(null), [An, jn] = m(!1), [Mn, Nn] = m(""), [Pn, Fn] = m("Clay loam"), [In, Ln] = m("Drip"), [Rn, zn] = m("active"), Bn = p(null), U = p(null), Vn = p(null), Hn = p(null), Un = p(null), Wn = p(null), Gn = p(null), Kn = p(null), qn = p(null), Jn = p(null), Yn = p(null), W = p([]), Xn = p(null), G = p(null), Zn = p([]), Qn = p(null), $n = p([]), er = p(null), tr = p([]), K = p("view"), nr = p(!1);
251
- d(() => {
252
- K.current = j;
253
- }, [j]), d(() => {
254
- G.current = hn;
255
- }, [hn]), d(() => {
256
- j !== "element" && (Yn.current?.clearLayers(), W.current = [], Xn.current = null);
257
- }, [j]);
258
- let rr = f(() => g.filter((e) => O(e) !== null).length, [g]), ir = f(() => g.reduce((e, t) => e + gt(t), 0), [g]), ar = f(() => le(g.map((e) => e.soilType)), [g]), q = f(() => g.find((e) => e.id === N) ?? null, [g, N]), or = f(() => {
259
- let e = Mt.trim().toLowerCase();
260
- return e ? g.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : g;
261
- }, [g, Mt]), sr = f(() => {
252
+ }), Ct = () => {
253
+ let { t: e } = xe(), { workspaceId: s } = n(), m = te(), { fields: h, crops: g, farm: Pe, loadings: Ie, errors: Le, refetch: _, createField: S } = _e(), { toasts: dt, toast: E, dismiss: Ct } = re(), wt = ze(), { buildPath: Tt } = r(), Et = !!Pe?.id, [Dt] = C(Ke), [Ot] = C(Je), [kt] = C(Ye), [At] = C(Xe), [jt] = C(Qe), [Mt] = C($e), [O, Nt] = p("loading"), [k, A] = p("view"), [j, M] = p(null), [Pt, Ft] = p(!1), [It, Lt] = p(!0), [Rt, zt] = p(!1), [N, Bt] = p({}), [Vt, Ht] = p(""), [Ut, Wt] = p(""), [Gt, Kt] = p(!1), [qt, Jt] = p(0), [Yt, Xt] = p(null), [Zt, Qt] = p(!1), [$t, en] = p(!1), [P, tn] = p(null), [nn, rn] = p(!1), [F, an] = p(ve), [on, sn] = p(ye), [I, cn] = p(0), [ln, un] = p(""), [dn, fn] = p(!1), [pn, mn] = p(!1), [L, hn] = p(null), [gn, _n] = p(""), [vn, yn] = p(!1), [bn, xn] = p(!0), [Sn, Cn] = p(!1), [wn, Tn] = p(null), [En, Dn] = p(0), [R, On] = p(null), [kn, An] = p(""), [jn, Mn] = p(""), [Nn, Pn] = p(!1), [z, Fn] = p(null), [In, Ln] = p(!1), [B, Rn] = p(null), [zn, Bn] = p(!1), [Vn, Hn] = p(""), [Un, Wn] = p("Clay loam"), [Gn, Kn] = p("Drip"), [qn, Jn] = p("active"), Yn = f(null), V = f(null), Xn = f(null), Zn = f(null), Qn = f(null), $n = f(null), er = f(null), tr = f(null), nr = f(null), rr = f(null), H = f(null), U = f([]), ir = f(null), W = f(null), ar = f([]), or = f(null), sr = f([]), cr = f(null), lr = f([]), G = f("view"), ur = f(!1);
254
+ u(() => {
255
+ G.current = k;
256
+ }, [k]), u(() => {
257
+ W.current = wn;
258
+ }, [wn]), u(() => {
259
+ k !== "element" && (H.current?.clearLayers(), U.current = [], ir.current = null);
260
+ }, [k]);
261
+ let dr = d(() => h.filter((e) => D(e) !== null).length, [h]), fr = d(() => h.reduce((e, t) => e + bt(t), 0), [h]), pr = d(() => fe(h.map((e) => e.soilType)), [h]), K = d(() => h.find((e) => e.id === j) ?? null, [h, j]), mr = d(() => {
262
+ let e = Vt.trim().toLowerCase();
263
+ return e ? h.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : h;
264
+ }, [h, Vt]), hr = d(() => {
262
265
  let e = [];
263
- for (let t of g) {
264
- let n = O(t);
266
+ for (let t of h) {
267
+ let n = D(t);
265
268
  if (n) {
266
- let r = ae(n);
269
+ let r = ce(n);
267
270
  if (r) {
268
271
  e.push({
269
272
  id: t.id,
@@ -273,78 +276,78 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
273
276
  continue;
274
277
  }
275
278
  }
276
- mt(t.location) && e.push({
279
+ yt(t.location) && e.push({
277
280
  id: t.id,
278
281
  lat: t.location.lat,
279
282
  lng: t.location.lng
280
283
  });
281
284
  }
282
285
  return e;
283
- }, [g]);
284
- d(() => {
285
- if (sr.length === 0) {
286
- jt({});
286
+ }, [h]);
287
+ u(() => {
288
+ if (hr.length === 0) {
289
+ Bt({});
287
290
  return;
288
291
  }
289
292
  let e = new AbortController(), t = !1;
290
- return de(sr.map((e) => ({
293
+ return me(hr.map((e) => ({
291
294
  lat: e.lat,
292
295
  lng: e.lng
293
296
  })), e.signal).then((e) => {
294
297
  if (t) return;
295
298
  let n = {};
296
- sr.forEach((t, r) => {
299
+ hr.forEach((t, r) => {
297
300
  n[t.id] = e[r] ?? null;
298
- }), jt(n);
301
+ }), Bt(n);
299
302
  }), () => {
300
303
  t = !0, e.abort();
301
304
  };
302
- }, [f(() => sr.map((e) => `${e.id}:${e.lat.toFixed(5)},${e.lng.toFixed(5)}`).join("|"), [sr])]);
303
- let [cr, lr] = f(() => {
304
- let e = Object.values(F).filter((e) => e != null && Number.isFinite(e));
305
+ }, [d(() => hr.map((e) => `${e.id}:${e.lat.toFixed(5)},${e.lng.toFixed(5)}`).join("|"), [hr])]);
306
+ let [gr, _r] = d(() => {
307
+ let e = Object.values(N).filter((e) => e != null && Number.isFinite(e));
305
308
  return e.length === 0 ? [0, 0] : [Math.min(...e), Math.max(...e)];
306
- }, [F]), ur = f(() => Object.values(F).some((e) => e != null && Number.isFinite(e)), [F]), dr = u((e) => {
309
+ }, [N]), vr = d(() => Object.values(N).some((e) => e != null && Number.isFinite(e)), [N]), yr = l((e) => {
307
310
  if (!e) return "";
308
- let t = _.find((t) => t.field === e.id || t.fieldName === e.name);
311
+ let t = g.find((t) => t.field === e.id || t.fieldName === e.name);
309
312
  return t ? t.name : (e.crops ?? []).join(", ");
310
- }, [_]), fr = f(() => q ? O(q) : null, [q]), pr = f(() => q ? _.find((e) => e.field === q.id || e.fieldName === q.name) ?? null : null, [_, q]), mr = f(() => _.find((e) => e.id === $t) ?? pr, [
311
- _,
312
- $t,
313
- pr
314
- ]), J = f(() => _e(mr), [mr]);
315
- d(() => {
316
- en("");
317
- }, [N]);
318
- let Y = f(() => fr ? pe(fr, {
319
- bedWidthM: L,
320
- pathWidthM: Xt,
321
- orientationDeg: R
313
+ }, [g]), br = d(() => K ? D(K) : null, [K]), xr = d(() => K ? g.find((e) => e.field === K.id || e.fieldName === K.name) ?? null : null, [g, K]), Sr = d(() => g.find((e) => e.id === ln) ?? xr, [
314
+ g,
315
+ ln,
316
+ xr
317
+ ]), q = d(() => be(Sr), [Sr]);
318
+ u(() => {
319
+ un("");
320
+ }, [j]);
321
+ let J = d(() => br ? ge(br, {
322
+ bedWidthM: F,
323
+ pathWidthM: on,
324
+ orientationDeg: I
322
325
  }) : null, [
323
- fr,
324
- L,
325
- Xt,
326
- R
327
- ]), hr = f(() => Y ? Y.beds.reduce((e, t) => e + fe(l(t), L, J.plantSpacingCm, J.rowSpacingCm), 0) : 0, [
328
- Y,
329
- L,
330
- J
331
- ]), { data: gr, loading: _r, refetch: vr } = Ve(Ue, {
326
+ br,
327
+ F,
328
+ on,
329
+ I
330
+ ]), Cr = d(() => J ? J.beds.reduce((e, t) => e + he(c(t), F, q.plantSpacingCm, q.rowSpacingCm), 0) : 0, [
331
+ J,
332
+ F,
333
+ q
334
+ ]), { data: wr, loading: Tr, refetch: Er } = Ge(qe, {
332
335
  variables: {
333
- context: { workspaceId: c },
334
- fieldId: N ?? void 0
336
+ context: { workspaceId: s },
337
+ fieldId: j ?? void 0
335
338
  },
336
- skip: !N,
339
+ skip: !j,
337
340
  fetchPolicy: "cache-and-network"
338
- }), X = f(() => gr?.healthyBowlBeds ?? [], [gr]), { data: yr, refetch: br } = Ve(qe, {
339
- variables: { context: { workspaceId: c } },
341
+ }), Y = d(() => wr?.healthyBowlBeds ?? [], [wr]), { data: Dr, refetch: Or } = Ge(Ze, {
342
+ variables: { context: { workspaceId: s } },
340
343
  fetchPolicy: "cache-and-network"
341
- }), xr = f(() => yr?.healthyBowlMapFeatures ?? [], [yr]), Sr = f(() => E.get(hn ?? "") ?? null, [hn]), Cr = u((e) => e ? _.find((t) => t.id === e)?.name ?? null : null, [_]);
342
- d(() => {
343
- let t = qn.current;
344
- t && (t.clearLayers(), j === "view" && (X.forEach((n) => {
345
- let r = ne(n.boundary);
346
- if (!r || !re(r)) return;
347
- let i = Cr(n.cropId), a = T.default.geoJSON(r, { style: () => n.cropId ? pt : ft });
344
+ }), kr = d(() => Dr?.healthyBowlMapFeatures ?? [], [Dr]), Ar = d(() => T.get(wn ?? "") ?? null, [wn]), jr = l((e) => e ? g.find((t) => t.id === e)?.name ?? null : null, [g]);
345
+ u(() => {
346
+ let t = nr.current;
347
+ t && (t.clearLayers(), k === "view" && (Y.forEach((n) => {
348
+ let r = ae(n.boundary);
349
+ if (!r || !oe(r)) return;
350
+ let i = jr(n.cropId), a = w.default.geoJSON(r, { style: () => n.cropId ? vt : _t });
348
351
  a.bindTooltip(e("healthybowl.fieldMapPage.beds.savedTooltip", "{{name}}{{crop}} · {{plants}} plants", {
349
352
  name: n.name,
350
353
  crop: i ? ` · ${i}` : "",
@@ -353,10 +356,10 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
353
356
  sticky: !0,
354
357
  direction: "top"
355
358
  }), a.on("click", (e) => {
356
- T.default.DomEvent.stopPropagation(e), on(n), cn(n.cropId ?? "");
359
+ w.default.DomEvent.stopPropagation(e), hn(n), _n(n.cropId ?? "");
357
360
  }), a.addTo(t);
358
- }), qt && Y && Y.beds.forEach((n) => {
359
- let r = l(n), i = fe(r, L, J.plantSpacingCm, J.rowSpacingCm), a = T.default.geoJSON(n, { style: () => dt });
361
+ }), nn && J && J.beds.forEach((n) => {
362
+ let r = c(n), i = he(r, F, q.plantSpacingCm, q.rowSpacingCm), a = w.default.geoJSON(n, { style: () => gt });
360
363
  a.bindTooltip(e("healthybowl.fieldMapPage.beds.bedTooltip", "{{plants}} plants · {{area}} m²", {
361
364
  plants: String(i),
362
365
  area: r.toFixed(0)
@@ -366,27 +369,27 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
366
369
  }), a.addTo(t);
367
370
  })));
368
371
  }, [
369
- qt,
370
- Y,
371
- L,
372
+ nn,
372
373
  J,
373
- j,
374
- X,
375
- Cr,
374
+ F,
375
+ q,
376
+ k,
377
+ Y,
378
+ jr,
376
379
  e
377
- ]), d(() => {
378
- let t = Jn.current;
379
- t && (t.clearLayers(), dn && xr.forEach((n) => {
380
- let r = E.get(n.type), i = n.color || r?.color || "#8b5cf6", a = r?.style ?? {
380
+ ]), u(() => {
381
+ let t = rr.current;
382
+ t && (t.clearLayers(), bn && kr.forEach((n) => {
383
+ let r = T.get(n.type), i = n.color || r?.color || "#8b5cf6", a = r?.style ?? {
381
384
  color: i,
382
385
  weight: 2,
383
386
  fillColor: i,
384
387
  fillOpacity: .25
385
388
  }, o = null;
386
389
  try {
387
- o = T.default.geoJSON(n.geometry, {
390
+ o = w.default.geoJSON(n.geometry, {
388
391
  style: () => a,
389
- pointToLayer: (e, t) => T.default.circleMarker(t, {
392
+ pointToLayer: (e, t) => w.default.circleMarker(t, {
390
393
  radius: 7,
391
394
  color: "#fff",
392
395
  weight: 2,
@@ -398,170 +401,170 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
398
401
  o = null;
399
402
  }
400
403
  if (!o) return;
401
- let s = r ? e(r.labelKey, r.label) : n.type;
402
- o.bindTooltip(`${n.name} · ${s}`, {
404
+ let ee = r ? e(r.labelKey, r.label) : n.type;
405
+ o.bindTooltip(`${n.name} · ${ee}`, {
403
406
  sticky: !0,
404
407
  direction: "top"
405
408
  }), o.on("click", (e) => {
406
- T.default.DomEvent.stopPropagation(e), K.current === "view" && En(n);
409
+ w.default.DomEvent.stopPropagation(e), G.current === "view" && Fn(n);
407
410
  }), o.addTo(t);
408
411
  }));
409
412
  }, [
410
- xr,
411
- dn,
413
+ kr,
414
+ bn,
412
415
  e
413
416
  ]);
414
- let wr = u(async () => {
415
- if (!(!q || !Y || Y.beds.length === 0)) {
416
- if (Y.bedCount > Qe) {
417
- D({
417
+ let Mr = l(async () => {
418
+ if (!(!K || !J || J.beds.length === 0)) {
419
+ if (J.bedCount > nt) {
420
+ E({
418
421
  title: e("healthybowl.fieldMapPage.beds.tooMany.title", "Too many beds to save"),
419
422
  description: e("healthybowl.fieldMapPage.beds.tooMany.description", "This layout has {{count}} beds (max {{max}}). Increase the bed width to reduce the count, then save.", {
420
- count: String(Y.bedCount),
421
- max: String(Qe)
423
+ count: String(J.bedCount),
424
+ max: String(nt)
422
425
  }),
423
426
  variant: "warning"
424
427
  });
425
428
  return;
426
429
  }
427
- nn(!0);
430
+ fn(!0);
428
431
  try {
429
- await et(X, $e, (e) => xt({ variables: {
432
+ await it(Y, rt, (e) => At({ variables: {
430
433
  id: e.id,
431
- context: { workspaceId: c }
434
+ context: { workspaceId: s }
432
435
  } }));
433
- let t = Y.beds;
434
- await et(t.map((e, t) => ({
436
+ let t = J.beds;
437
+ await it(t.map((e, t) => ({
435
438
  bed: e,
436
439
  index: t
437
- })), $e, ({ bed: t, index: n }) => {
438
- let r = l(t), i = fe(r, L, J.plantSpacingCm, J.rowSpacingCm);
439
- return yt({ variables: { input: {
440
- fieldId: q.id,
440
+ })), rt, ({ bed: t, index: n }) => {
441
+ let r = c(t), i = he(r, F, q.plantSpacingCm, q.rowSpacingCm);
442
+ return Ot({ variables: { input: {
443
+ fieldId: K.id,
441
444
  name: e("healthybowl.fieldMapPage.beds.bedName", "Bed {{n}}", { n: String(n + 1) }),
442
445
  boundary: t,
443
446
  area: r,
444
447
  unit: "sqm",
445
- widthM: L,
446
- orientationDeg: R,
447
- cropId: mr?.id ?? void 0,
448
+ widthM: F,
449
+ orientationDeg: I,
450
+ cropId: Sr?.id ?? void 0,
448
451
  plantCount: i,
449
- context: { workspaceId: c }
452
+ context: { workspaceId: s }
450
453
  } } });
451
- }), await vr(), D({
454
+ }), await Er(), E({
452
455
  title: e("healthybowl.fieldMapPage.beds.saved.title", "Bed layout saved"),
453
456
  description: e("healthybowl.fieldMapPage.beds.saved.description", "Saved {{count}} beds for {{name}}.", {
454
457
  count: String(t.length),
455
- name: q.name
458
+ name: K.name
456
459
  }),
457
460
  variant: "success"
458
461
  });
459
462
  } catch (t) {
460
- D({
463
+ E({
461
464
  title: e("healthybowl.fieldMapPage.beds.saveFailed.title", "Could not save beds"),
462
465
  description: String(t),
463
466
  variant: "error"
464
467
  });
465
468
  } finally {
466
- nn(!1);
469
+ fn(!1);
467
470
  }
468
471
  }
469
472
  }, [
470
- mr,
471
- Y,
472
- R,
473
+ Sr,
473
474
  J,
474
- L,
475
- yt,
476
- xt,
477
- vr,
478
- X,
475
+ I,
479
476
  q,
477
+ F,
478
+ Ot,
479
+ At,
480
+ Er,
481
+ Y,
482
+ K,
480
483
  e,
481
- D,
482
- c
483
- ]), Tr = u(async () => {
484
- if (!(!q || X.length === 0) && await h({
484
+ E,
485
+ s
486
+ ]), Nr = l(async () => {
487
+ if (!(!K || Y.length === 0) && await m({
485
488
  title: e("healthybowl.fieldMapPage.beds.clearConfirm.title", "Clear saved beds?"),
486
489
  message: e("healthybowl.fieldMapPage.beds.clearConfirm.description", "This deletes all {{count}} saved beds for {{name}}. You can re-generate and save again.", {
487
- count: String(X.length),
488
- name: q.name
490
+ count: String(Y.length),
491
+ name: K.name
489
492
  }),
490
493
  okButtonTitle: e("healthybowl.common.delete", "Delete")
491
494
  })) {
492
- an(!0);
495
+ mn(!0);
493
496
  try {
494
- await et(X, $e, (e) => xt({ variables: {
497
+ await it(Y, rt, (e) => At({ variables: {
495
498
  id: e.id,
496
- context: { workspaceId: c }
497
- } })), await vr(), D({
499
+ context: { workspaceId: s }
500
+ } })), await Er(), E({
498
501
  title: e("healthybowl.fieldMapPage.beds.cleared.title", "Saved beds cleared"),
499
502
  description: e("healthybowl.fieldMapPage.beds.cleared.description", "Removed the saved layout."),
500
503
  variant: "success"
501
504
  });
502
505
  } catch (t) {
503
- D({
506
+ E({
504
507
  title: e("healthybowl.fieldMapPage.beds.saveFailed.title", "Could not save beds"),
505
508
  description: String(t),
506
509
  variant: "error"
507
510
  });
508
511
  } finally {
509
- an(!1);
512
+ mn(!1);
510
513
  }
511
514
  }
512
515
  }, [
513
- h,
514
- xt,
515
- vr,
516
- X,
517
- q,
516
+ m,
517
+ At,
518
+ Er,
519
+ Y,
520
+ K,
518
521
  e,
519
- D,
520
- c
521
- ]), Er = u(async () => {
522
- if (!z) return;
523
- let t = _.find((e) => e.id === sn) ?? null, n = _e(t), r = ne(z.boundary), i = fe(z.area ?? (r ? l(r) : 0), z.widthM ?? L, n.plantSpacingCm, n.rowSpacingCm);
524
- un(!0);
522
+ E,
523
+ s
524
+ ]), Pr = l(async () => {
525
+ if (!L) return;
526
+ let t = g.find((e) => e.id === gn) ?? null, n = be(t), r = ae(L.boundary), i = he(L.area ?? (r ? c(r) : 0), L.widthM ?? F, n.plantSpacingCm, n.rowSpacingCm);
527
+ yn(!0);
525
528
  try {
526
- await bt({ variables: { input: {
527
- id: z.id,
528
- cropId: sn || null,
529
+ await kt({ variables: { input: {
530
+ id: L.id,
531
+ cropId: gn || null,
529
532
  plantCount: i,
530
- context: { workspaceId: c }
531
- } } }), await vr(), on(null), D({
533
+ context: { workspaceId: s }
534
+ } } }), await Er(), hn(null), E({
532
535
  title: e("healthybowl.fieldMapPage.beds.assigned.title", "Crop assigned"),
533
536
  description: t ? e("healthybowl.fieldMapPage.beds.assigned.description", "{{bed}}: {{crop}} · {{plants}} plants.", {
534
- bed: z.name,
537
+ bed: L.name,
535
538
  crop: t.name,
536
539
  plants: String(i)
537
- }) : e("healthybowl.fieldMapPage.beds.assigned.cleared", "{{bed}}: crop cleared.", { bed: z.name }),
540
+ }) : e("healthybowl.fieldMapPage.beds.assigned.cleared", "{{bed}}: crop cleared.", { bed: L.name }),
538
541
  variant: "success"
539
542
  });
540
543
  } catch (t) {
541
- D({
544
+ E({
542
545
  title: e("healthybowl.fieldMapPage.beds.assignFailed.title", "Could not assign crop"),
543
546
  description: String(t),
544
547
  variant: "error"
545
548
  });
546
549
  } finally {
547
- un(!1);
550
+ yn(!1);
548
551
  }
549
552
  }, [
550
- z,
551
- sn,
552
553
  L,
553
- _,
554
- vr,
554
+ gn,
555
+ F,
556
+ g,
557
+ Er,
555
558
  e,
556
- D,
557
- bt,
558
- c
559
- ]), Dr = u((e) => {
560
- let t = U.current;
559
+ E,
560
+ kt,
561
+ s
562
+ ]), Fr = l((e) => {
563
+ let t = V.current;
561
564
  if (!t) return;
562
- let n = O(e);
565
+ let n = D(e);
563
566
  if (n) try {
564
- let e = T.default.geoJSON(n).getBounds();
567
+ let e = w.default.geoJSON(n).getBounds();
565
568
  if (e.isValid()) {
566
569
  t.fitBounds(e, {
567
570
  padding: [40, 40],
@@ -570,30 +573,30 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
570
573
  return;
571
574
  }
572
575
  } catch {}
573
- mt(e.location) && t.flyTo([e.location.lat, e.location.lng], ot, { duration: .6 });
574
- }, []), Or = u((e) => {
575
- K.current === "draw" || K.current === "measure" || (P(e.id), Dr(e));
576
- }, [Dr]);
577
- d(() => {
578
- N && document.querySelector(`[data-field-id="${N}"]`)?.scrollIntoView({ block: "nearest" });
579
- }, [N]);
580
- let kr = u(() => {
581
- let t = U.current, n = Un.current;
576
+ yt(e.location) && t.flyTo([e.location.lat, e.location.lng], ut, { duration: .6 });
577
+ }, []), Ir = l((e) => {
578
+ G.current === "draw" || G.current === "measure" || (M(e.id), Fr(e));
579
+ }, [Fr]);
580
+ u(() => {
581
+ j && document.querySelector(`[data-field-id="${j}"]`)?.scrollIntoView({ block: "nearest" });
582
+ }, [j]);
583
+ let Lr = l(() => {
584
+ let t = V.current, n = Qn.current;
582
585
  if (!t || !n) return;
583
586
  n.clearLayers();
584
587
  let r = [];
585
- for (let t of g) {
586
- if (j === "edit" && t.id === N) continue;
587
- let i = t.id === N, a = F[t.id], o = kt && a != null ? ue(a, cr, lr) : Dt ? ce(t.soilType) : st, s = `${t.name} — ${_t(t)}`, c = O(t);
588
- if (c) {
589
- let e = T.default.geoJSON(c, { style: () => ({
588
+ for (let t of h) {
589
+ if (k === "edit" && t.id === j) continue;
590
+ let i = t.id === j, a = N[t.id], o = Rt && a != null ? pe(a, gr, _r) : It ? de(t.soilType) : ft, ee = `${t.name} — ${xt(t)}`, te = D(t);
591
+ if (te) {
592
+ let e = w.default.geoJSON(te, { style: () => ({
590
593
  color: i ? "#ffffff" : o,
591
594
  weight: i ? 5 : 2,
592
595
  opacity: 1,
593
596
  fillColor: o,
594
597
  fillOpacity: i ? .62 : .5
595
598
  }) });
596
- e.on("click", () => P(t.id)), e.bindTooltip(s, {
599
+ e.on("click", () => M(t.id)), e.bindTooltip(ee, {
597
600
  permanent: !0,
598
601
  direction: "center",
599
602
  className: "hb-field-label"
@@ -602,94 +605,94 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
602
605
  let t = e.getBounds();
603
606
  t.isValid() && r.push(t);
604
607
  } catch {}
605
- } else if (mt(t.location)) {
606
- let a = T.default.circleMarker([t.location.lat, t.location.lng], {
608
+ } else if (yt(t.location)) {
609
+ let a = w.default.circleMarker([t.location.lat, t.location.lng], {
607
610
  radius: i ? 9 : 7,
608
611
  color: i ? "#ffffff" : "#fff",
609
612
  weight: i ? 3 : 2,
610
613
  fillColor: o,
611
614
  fillOpacity: 1
612
615
  });
613
- a.on("click", () => P(t.id)), a.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
616
+ a.on("click", () => M(t.id)), a.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
614
617
  permanent: !1,
615
618
  direction: "top"
616
- }), a.addTo(n), r.push(T.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
619
+ }), a.addTo(n), r.push(w.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
617
620
  }
618
621
  }
619
- if (!nr.current && r.length > 0) {
620
- let e = r.reduce((e, t) => e.extend(t), T.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
622
+ if (!ur.current && r.length > 0) {
623
+ let e = r.reduce((e, t) => e.extend(t), w.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
621
624
  try {
622
625
  t.fitBounds(e, {
623
626
  padding: [40, 40],
624
627
  maxZoom: 17
625
- }), nr.current = !0;
628
+ }), ur.current = !0;
626
629
  } catch {}
627
630
  }
628
631
  }, [
629
- g,
632
+ h,
633
+ k,
630
634
  j,
635
+ It,
636
+ Rt,
631
637
  N,
632
- Dt,
633
- kt,
634
- F,
635
- cr,
636
- lr,
638
+ gr,
639
+ _r,
637
640
  e
638
641
  ]);
639
- d(() => {
640
- A === "ready" && kr();
641
- }, [kr, A]);
642
- let Z = u(() => {
643
- Wn.current?.clearLayers(), Qn.current = null, Zn.current = [], zt(0);
644
- }, []), Ar = u(() => {
645
- let e = Wn.current;
642
+ u(() => {
643
+ O === "ready" && Lr();
644
+ }, [Lr, O]);
645
+ let X = l(() => {
646
+ $n.current?.clearLayers(), or.current = null, ar.current = [], Jt(0);
647
+ }, []), Rr = l(() => {
648
+ let e = $n.current;
646
649
  if (!e) return;
647
- Qn.current &&= (e.removeLayer(Qn.current), null);
648
- let t = Zn.current;
649
- t.length >= 2 && (Qn.current = T.default.polygon(t, ct).addTo(e));
650
- }, []), jr = u(() => {
651
- let t = Zn.current;
650
+ or.current &&= (e.removeLayer(or.current), null);
651
+ let t = ar.current;
652
+ t.length >= 2 && (or.current = w.default.polygon(t, pt).addTo(e));
653
+ }, []), zr = l(() => {
654
+ let t = ar.current;
652
655
  if (t.length < 3) {
653
- D({
656
+ E({
654
657
  title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
655
658
  description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
656
659
  variant: "warning"
657
660
  });
658
661
  return;
659
662
  }
660
- let n = oe(t.map((e) => ({
663
+ let n = le(t.map((e) => ({
661
664
  lat: e.lat,
662
665
  lng: e.lng
663
666
  })));
664
- Z(), K.current = "view", M("view"), n && (kn({
667
+ X(), G.current = "view", A("view"), n && (Rn({
665
668
  boundary: n,
666
- area: ie(n, "acres"),
667
- centroid: ae(n) ?? [0, 0]
668
- }), Nn(""), Fn("Clay loam"), Ln("Drip"), zn("active"));
669
+ area: se(n, "acres"),
670
+ centroid: ce(n) ?? [0, 0]
671
+ }), Hn(""), Wn("Clay loam"), Kn("Drip"), Jn("active"));
669
672
  }, [
670
- Z,
673
+ X,
671
674
  e,
672
- D
673
- ]), Mr = u(() => {
674
- P(null), Z(), K.current = "draw", M("draw");
675
- }, [Z]), Nr = u(() => {
676
- Z(), K.current = "view", M("view");
677
- }, [Z]), Pr = u(() => {
678
- Gn.current?.clearLayers(), er.current = null, $n.current = [], Vt(null), Ut(!1);
679
- }, []), Fr = u(() => {
680
- if (!Gn.current || !er.current) return;
681
- er.current.setLatLngs($n.current);
682
- let e = oe($n.current.map((e) => ({
675
+ E
676
+ ]), Br = l(() => {
677
+ M(null), X(), G.current = "draw", A("draw");
678
+ }, [X]), Vr = l(() => {
679
+ X(), G.current = "view", A("view");
680
+ }, [X]), Hr = l(() => {
681
+ er.current?.clearLayers(), cr.current = null, sr.current = [], Xt(null), Qt(!1);
682
+ }, []), Ur = l(() => {
683
+ if (!er.current || !cr.current) return;
684
+ cr.current.setLatLngs(sr.current);
685
+ let e = le(sr.current.map((e) => ({
683
686
  lat: e.lat,
684
687
  lng: e.lng
685
688
  })));
686
- e && Vt(ie(e, q?.unit ?? "acres"));
687
- }, [q]), Ir = u(() => {
688
- let t = U.current, n = Gn.current;
689
- if (!t || !n || !q) return;
690
- let r = O(q);
689
+ e && Xt(se(e, K?.unit ?? "acres"));
690
+ }, [K]), Wr = l(() => {
691
+ let t = V.current, n = er.current;
692
+ if (!t || !n || !K) return;
693
+ let r = D(K);
691
694
  if (!r) {
692
- D({
695
+ E({
693
696
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
694
697
  description: e("healthybowl.fieldMapPage.toast.noBoundary.description", "Draw a boundary for this field first."),
695
698
  variant: "warning"
@@ -697,89 +700,89 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
697
700
  return;
698
701
  }
699
702
  n.clearLayers();
700
- let i = r.coordinates[0].slice(0, -1).map(([e, t]) => T.default.latLng(t, e));
701
- $n.current = i, er.current = T.default.polygon(i, lt).addTo(n), i.forEach((e, t) => {
702
- T.default.marker(i[t], {
703
- icon: vt,
703
+ let i = r.coordinates[0].slice(0, -1).map(([e, t]) => w.default.latLng(t, e));
704
+ sr.current = i, cr.current = w.default.polygon(i, mt).addTo(n), i.forEach((e, t) => {
705
+ w.default.marker(i[t], {
706
+ icon: St,
704
707
  draggable: !0
705
708
  }).addTo(n).on("drag", (e) => {
706
- $n.current[t] = e.target.getLatLng(), Fr(), Ut(!0);
709
+ sr.current[t] = e.target.getLatLng(), Ur(), Qt(!0);
707
710
  });
708
- }), K.current = "edit", M("edit"), Ut(!1), Vt(ie(r, q.unit));
711
+ }), G.current = "edit", A("edit"), Qt(!1), Xt(se(r, K.unit));
709
712
  }, [
710
- Fr,
711
- q,
713
+ Ur,
714
+ K,
712
715
  e,
713
- D
714
- ]), Lr = u(() => {
715
- Pr(), K.current = "view", M("view"), kr();
716
- }, [Pr, kr]), Rr = u(async () => {
717
- if (!q) return;
718
- let t = oe($n.current.map((e) => ({
716
+ E
717
+ ]), Gr = l(() => {
718
+ Hr(), G.current = "view", A("view"), Lr();
719
+ }, [Hr, Lr]), Kr = l(async () => {
720
+ if (!K) return;
721
+ let t = le(sr.current.map((e) => ({
719
722
  lat: e.lat,
720
723
  lng: e.lng
721
724
  })));
722
725
  if (t) {
723
- Gt(!0);
726
+ en(!0);
724
727
  try {
725
- let n = ie(t, q.unit);
726
- await k({ variables: { input: {
727
- id: q.id,
728
+ let n = se(t, K.unit);
729
+ await Dt({ variables: { input: {
730
+ id: K.id,
728
731
  boundary: t,
729
732
  area: n,
730
- context: { workspaceId: c }
731
- } } }), await v(), Pr(), K.current = "view", M("view"), D({
733
+ context: { workspaceId: s }
734
+ } } }), await _(), Hr(), G.current = "view", A("view"), E({
732
735
  title: e("healthybowl.fieldMapPage.toast.saved.title", "Boundary saved"),
733
736
  description: e("healthybowl.fieldMapPage.toast.saved.description", "Area updated to {{area}} {{unit}}.", {
734
737
  area: String(n),
735
- unit: q.unit
738
+ unit: K.unit
736
739
  }),
737
740
  variant: "success"
738
741
  });
739
742
  } catch (t) {
740
- D({
743
+ E({
741
744
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
742
745
  description: String(t),
743
746
  variant: "error"
744
747
  });
745
748
  } finally {
746
- Gt(!1);
749
+ en(!1);
747
750
  }
748
751
  }
749
752
  }, [
750
- Pr,
751
- v,
752
- q,
753
+ Hr,
754
+ _,
755
+ K,
753
756
  e,
754
- D,
755
- k,
756
- c
757
- ]), zr = u(async () => {
758
- if (q) {
759
- if (!O(q)) {
760
- D({
757
+ E,
758
+ Dt,
759
+ s
760
+ ]), qr = l(async () => {
761
+ if (K) {
762
+ if (!D(K)) {
763
+ E({
761
764
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
762
765
  description: e("healthybowl.fieldMapPage.toast.deleteNone.description", "This field has no boundary to delete."),
763
766
  variant: "warning"
764
767
  });
765
768
  return;
766
769
  }
767
- if (await h({
770
+ if (await m({
768
771
  title: e("healthybowl.fieldMapPage.confirmDelete.title", "Delete boundary?"),
769
- message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: q.name }),
772
+ message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: K.name }),
770
773
  okButtonTitle: e("healthybowl.common.delete", "Delete")
771
774
  })) try {
772
- await k({ variables: { input: {
773
- id: q.id,
775
+ await Dt({ variables: { input: {
776
+ id: K.id,
774
777
  boundary: null,
775
- context: { workspaceId: c }
776
- } } }), await v(), D({
778
+ context: { workspaceId: s }
779
+ } } }), await _(), E({
777
780
  title: e("healthybowl.fieldMapPage.toast.boundaryDeleted.title", "Boundary removed"),
778
781
  description: e("healthybowl.fieldMapPage.toast.boundaryDeleted.description", "The drawn shape was cleared."),
779
782
  variant: "success"
780
783
  });
781
784
  } catch (t) {
782
- D({
785
+ E({
783
786
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
784
787
  description: String(t),
785
788
  variant: "error"
@@ -787,90 +790,90 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
787
790
  }
788
791
  }
789
792
  }, [
790
- h,
791
- v,
792
- q,
793
+ m,
794
+ _,
795
+ K,
793
796
  e,
794
- D,
795
- k,
796
- c
797
- ]), Q = u(() => {
798
- Kn.current?.clearLayers(), tr.current = [], Kt(null);
799
- }, []), Br = u(() => {
800
- let e = Kn.current;
797
+ E,
798
+ Dt,
799
+ s
800
+ ]), Z = l(() => {
801
+ tr.current?.clearLayers(), lr.current = [], tn(null);
802
+ }, []), Jr = l(() => {
803
+ let e = tr.current;
801
804
  if (!e) return;
802
805
  e.clearLayers();
803
- let t = tr.current;
806
+ let t = lr.current;
804
807
  t.forEach((t) => {
805
- T.default.circleMarker(t, {
808
+ w.default.circleMarker(t, {
806
809
  radius: 4,
807
810
  color: "#38bdf8",
808
811
  weight: 2,
809
812
  fillColor: "#fff",
810
813
  fillOpacity: 1
811
814
  }).addTo(e);
812
- }), t.length >= 2 && T.default.polyline(t, ut).addTo(e);
815
+ }), t.length >= 2 && w.default.polyline(t, ht).addTo(e);
813
816
  let n = 0;
814
817
  for (let e = 1; e < t.length; e++) n += t[e - 1].distanceTo(t[e]);
815
818
  let r = null;
816
819
  if (t.length >= 3) {
817
- let e = oe(t.map((e) => ({
820
+ let e = le(t.map((e) => ({
818
821
  lat: e.lat,
819
822
  lng: e.lng
820
823
  })));
821
- e && (r = l(e));
824
+ e && (r = c(e));
822
825
  }
823
- Kt({
826
+ tn({
824
827
  distance: n,
825
828
  area: r
826
829
  });
827
- }, []), Vr = u(() => {
828
- P(null), Q(), K.current = "measure", M("measure"), Kt({
830
+ }, []), Yr = l(() => {
831
+ M(null), Z(), G.current = "measure", A("measure"), tn({
829
832
  distance: 0,
830
833
  area: null
831
834
  });
832
- }, [Q]), Hr = u(() => {
833
- Q(), K.current = "view", M("view");
834
- }, [Q]), Ur = u(() => {
835
- Yn.current?.clearLayers(), Xn.current = null, W.current = [], vn(0);
836
- }, []), Wr = u(() => {
837
- let e = Yn.current, t = E.get(G.current ?? "");
835
+ }, [Z]), Xr = l(() => {
836
+ Z(), G.current = "view", A("view");
837
+ }, [Z]), Q = l(() => {
838
+ H.current?.clearLayers(), ir.current = null, U.current = [], Dn(0);
839
+ }, []), Zr = l(() => {
840
+ let e = H.current, t = T.get(W.current ?? "");
838
841
  if (!e || !t) return;
839
- Xn.current &&= (e.removeLayer(Xn.current), null);
840
- let n = W.current;
841
- t.kind === "polygon" && n.length >= 2 ? Xn.current = T.default.polygon(n, {
842
+ ir.current &&= (e.removeLayer(ir.current), null);
843
+ let n = U.current;
844
+ t.kind === "polygon" && n.length >= 2 ? ir.current = w.default.polygon(n, {
842
845
  ...t.style,
843
846
  dashArray: "6 4"
844
- }).addTo(e) : t.kind === "line" && n.length >= 2 && (Xn.current = T.default.polyline(n, {
847
+ }).addTo(e) : t.kind === "line" && n.length >= 2 && (ir.current = w.default.polyline(n, {
845
848
  ...t.style,
846
849
  dashArray: "6 4"
847
850
  }).addTo(e));
848
- }, []), Gr = u((e, t) => {
849
- Ur(), gn(null), G.current = null, K.current = "view", M("view"), xn(""), Cn(""), yn({
851
+ }, []), Qr = l((e, t) => {
852
+ Q(), Tn(null), W.current = null, G.current = "view", A("view"), An(""), Mn(""), On({
850
853
  type: e,
851
854
  geometry: t
852
855
  });
853
- }, [Ur]), Kr = u(() => {
854
- let t = E.get(G.current ?? "");
856
+ }, [Q]), $r = l(() => {
857
+ let t = T.get(W.current ?? "");
855
858
  if (!t) return;
856
- let n = W.current;
859
+ let n = U.current;
857
860
  if (t.kind === "polygon") {
858
861
  if (n.length < 3) {
859
- D({
862
+ E({
860
863
  title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
861
864
  description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
862
865
  variant: "warning"
863
866
  });
864
867
  return;
865
868
  }
866
- let r = oe(n.map((e) => ({
869
+ let r = le(n.map((e) => ({
867
870
  lat: e.lat,
868
871
  lng: e.lng
869
872
  })));
870
- r && Gr(t.type, r);
873
+ r && Qr(t.type, r);
871
874
  } else if (t.kind === "line") {
872
875
  if (n.length < 2) {
873
- D({
876
+ E({
874
877
  title: e("healthybowl.fieldMapPage.toast.needLine.title", "Need at least 2 points"),
875
878
  description: e("healthybowl.fieldMapPage.toast.needLine.description", "Click the map to add more points."),
876
879
  variant: "warning"
@@ -881,526 +884,544 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
881
884
  type: "LineString",
882
885
  coordinates: n.map((e) => [e.lng, e.lat])
883
886
  };
884
- Gr(t.type, r);
887
+ Qr(t.type, r);
885
888
  }
886
889
  }, [
887
- Gr,
890
+ Qr,
888
891
  e,
889
- D
890
- ]), qr = u((e) => {
891
- Z(), Pr(), Q(), Ur(), P(null), En(null), mn(!1), E.has(e) && (gn(e), G.current = e, K.current = "element", M("element"));
892
+ E
893
+ ]), ei = l((e) => {
894
+ X(), Hr(), Z(), Q(), M(null), Fn(null), Cn(!1), T.has(e) && (Tn(e), W.current = e, G.current = "element", A("element"));
892
895
  }, [
896
+ X,
897
+ Hr,
893
898
  Z,
894
- Pr,
895
- Q,
896
- Ur
897
- ]), Jr = u(() => {
898
- Ur(), gn(null), G.current = null, K.current = "view", M("view");
899
- }, [Ur]), Yr = u((e) => {
900
- if (U.current) {
901
- if (K.current === "element") {
902
- let t = E.get(G.current ?? "");
899
+ Q
900
+ ]), ti = l(() => {
901
+ Q(), Tn(null), W.current = null, G.current = "view", A("view");
902
+ }, [Q]), ni = l((e) => {
903
+ if (V.current) {
904
+ if (G.current === "element") {
905
+ let t = T.get(W.current ?? "");
903
906
  if (!t) return;
904
907
  if (t.kind === "point") {
905
- Gr(t.type, {
908
+ Qr(t.type, {
906
909
  type: "Point",
907
910
  coordinates: [e.latlng.lng, e.latlng.lat]
908
911
  });
909
912
  return;
910
913
  }
911
- W.current.push(e.latlng);
912
- let n = W.current.length === 1, r = T.default.circleMarker(e.latlng, {
914
+ U.current.push(e.latlng);
915
+ let n = U.current.length === 1, r = w.default.circleMarker(e.latlng, {
913
916
  radius: n ? 7 : 5,
914
917
  color: "#fff",
915
918
  weight: 2,
916
919
  fillColor: t.color,
917
920
  fillOpacity: 1
918
- }).addTo(Yn.current);
921
+ }).addTo(H.current);
919
922
  n && t.kind === "polygon" && r.on("click", (e) => {
920
- T.default.DomEvent.stopPropagation(e), Kr();
921
- }), vn(W.current.length), Wr();
923
+ w.default.DomEvent.stopPropagation(e), $r();
924
+ }), Dn(U.current.length), Zr();
922
925
  return;
923
926
  }
924
- if (K.current === "draw") {
925
- Zn.current.push(e.latlng);
926
- let t = Zn.current.length === 1, n = T.default.circleMarker(e.latlng, {
927
+ if (G.current === "draw") {
928
+ ar.current.push(e.latlng);
929
+ let t = ar.current.length === 1, n = w.default.circleMarker(e.latlng, {
927
930
  radius: t ? 7 : 5,
928
931
  color: "#fff",
929
932
  weight: 2,
930
933
  fillColor: t ? "#16a34a" : "#f59e0b",
931
934
  fillOpacity: 1
932
- }).addTo(Wn.current);
935
+ }).addTo($n.current);
933
936
  t && n.on("click", (e) => {
934
- T.default.DomEvent.stopPropagation(e), jr();
935
- }), zt(Zn.current.length), Ar();
936
- } else K.current === "measure" && (tr.current.push(e.latlng), Br());
937
+ w.default.DomEvent.stopPropagation(e), zr();
938
+ }), Jt(ar.current.length), Rr();
939
+ } else G.current === "measure" && (lr.current.push(e.latlng), Jr());
937
940
  }
938
941
  }, [
939
- jr,
940
- Br,
941
- Ar,
942
- Gr,
943
- Kr,
944
- Wr
945
- ]), Xr = u(async (n) => {
942
+ zr,
943
+ Jr,
944
+ Rr,
945
+ Qr,
946
+ $r,
947
+ Zr
948
+ ]), ri = l(async (n) => {
946
949
  n.preventDefault();
947
- let r = U.current, i = Pt.trim();
950
+ let r = V.current, i = Ut.trim();
948
951
  if (!r || !i) return;
949
952
  let a = i.match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
950
953
  if (a) {
951
- r.flyTo([Number(a[1]), Number(a[2])], ot, { duration: .6 });
954
+ r.flyTo([Number(a[1]), Number(a[2])], ut, { duration: .6 });
952
955
  return;
953
956
  }
954
- Lt(!0);
957
+ Kt(!0);
955
958
  try {
956
959
  let n = await t(i);
957
960
  if (!n) {
958
- D({
961
+ E({
959
962
  title: e("healthybowl.fieldMapPage.toast.placeNotFound.title", "Place not found"),
960
963
  description: e("healthybowl.fieldMapPage.toast.placeNotFound.description", "Try a more specific place name."),
961
964
  variant: "warning"
962
965
  });
963
966
  return;
964
967
  }
965
- r.flyTo([n.latitude, n.longitude], ot, { duration: .6 });
968
+ r.flyTo([n.latitude, n.longitude], ut, { duration: .6 });
966
969
  } catch (t) {
967
- D({
970
+ E({
968
971
  title: e("healthybowl.fieldMapPage.toast.searchFailed.title", "Search failed"),
969
972
  description: t instanceof Error ? t.message : String(t),
970
973
  variant: "error"
971
974
  });
972
975
  } finally {
973
- Lt(!1);
976
+ Kt(!1);
974
977
  }
975
978
  }, [
976
- Pt,
979
+ Ut,
977
980
  e,
978
- D
979
- ]), Zr = u(async () => {
980
- if (H) {
981
- if (!Mn.trim()) {
982
- D({
981
+ E
982
+ ]), ii = l(async () => {
983
+ if (B) {
984
+ if (!Vn.trim()) {
985
+ E({
983
986
  title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
984
987
  description: e("healthybowl.fieldMapPage.toast.nameRequired.description", "Give the new field a name."),
985
988
  variant: "warning"
986
989
  });
987
990
  return;
988
991
  }
989
- jn(!0);
992
+ Bn(!0);
990
993
  try {
991
- let [t, n] = H.centroid, r = await Pe({
992
- name: Mn.trim(),
993
- area: H.area,
994
+ let [t, n] = B.centroid, r = await S({
995
+ name: Vn.trim(),
996
+ area: B.area,
994
997
  unit: "acres",
995
- soilType: Pn,
996
- irrigationType: In,
998
+ soilType: Un,
999
+ irrigationType: Gn,
997
1000
  organicCertified: !1,
998
- status: Rn,
1001
+ status: qn,
999
1002
  crops: [],
1000
1003
  location: {
1001
1004
  lat: t,
1002
1005
  lng: n
1003
1006
  }
1004
1007
  });
1005
- r?.id && await k({ variables: { input: {
1008
+ r?.id && await Dt({ variables: { input: {
1006
1009
  id: r.id,
1007
- boundary: H.boundary,
1008
- area: H.area,
1009
- context: { workspaceId: c }
1010
- } } }), await v(), kn(null), r?.id && P(r.id), D({
1010
+ boundary: B.boundary,
1011
+ area: B.area,
1012
+ context: { workspaceId: s }
1013
+ } } }), await _(), Rn(null), r?.id && M(r.id), E({
1011
1014
  title: e("healthybowl.fieldMapPage.toast.fieldCreated.title", "Field created"),
1012
1015
  description: e("healthybowl.fieldMapPage.toast.fieldCreated.description", "{{name}} saved at {{area}} acres.", {
1013
- name: Mn.trim(),
1014
- area: String(H.area)
1016
+ name: Vn.trim(),
1017
+ area: String(B.area)
1015
1018
  }),
1016
1019
  variant: "success"
1017
1020
  });
1018
1021
  } catch (t) {
1019
- D({
1022
+ E({
1020
1023
  title: e("healthybowl.fieldMapPage.toast.createFailed.title", "Create failed"),
1021
1024
  description: String(t),
1022
1025
  variant: "error"
1023
1026
  });
1024
1027
  } finally {
1025
- jn(!1);
1028
+ Bn(!1);
1026
1029
  }
1027
1030
  }
1028
1031
  }, [
1029
- Pe,
1030
- In,
1031
- Mn,
1032
- Pn,
1033
- Rn,
1034
- H,
1035
- v,
1032
+ S,
1033
+ Gn,
1034
+ Vn,
1035
+ Un,
1036
+ qn,
1037
+ B,
1038
+ _,
1036
1039
  e,
1037
- D,
1038
- k,
1039
- c
1040
- ]), Qr = u(async () => {
1041
- if (!B) return;
1042
- if (!bn.trim()) {
1043
- D({
1040
+ E,
1041
+ Dt,
1042
+ s
1043
+ ]), ai = l(async () => {
1044
+ if (!R) return;
1045
+ if (!kn.trim()) {
1046
+ E({
1044
1047
  title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
1045
1048
  description: e("healthybowl.fieldMapPage.elements.nameRequired", "Give this map element a name."),
1046
1049
  variant: "warning"
1047
1050
  });
1048
1051
  return;
1049
1052
  }
1050
- let t = E.get(B.type);
1051
- Tn(!0);
1053
+ let t = T.get(R.type);
1054
+ Pn(!0);
1052
1055
  try {
1053
- await St({ variables: { input: {
1054
- name: bn.trim(),
1055
- type: B.type,
1056
- geometry: B.geometry,
1057
- notes: Sn.trim() || void 0,
1056
+ await jt({ variables: { input: {
1057
+ name: kn.trim(),
1058
+ type: R.type,
1059
+ geometry: R.geometry,
1060
+ notes: jn.trim() || void 0,
1058
1061
  color: t?.color,
1059
- context: { workspaceId: c }
1060
- } } }), await br(), yn(null), D({
1062
+ context: { workspaceId: s }
1063
+ } } }), await Or(), On(null), E({
1061
1064
  title: e("healthybowl.fieldMapPage.elements.saved.title", "Map element added"),
1062
- description: e("healthybowl.fieldMapPage.elements.saved.description", "{{name}} saved to the map.", { name: bn.trim() }),
1065
+ description: e("healthybowl.fieldMapPage.elements.saved.description", "{{name}} saved to the map.", { name: kn.trim() }),
1063
1066
  variant: "success"
1064
1067
  });
1065
1068
  } catch (t) {
1066
- D({
1069
+ E({
1067
1070
  title: e("healthybowl.fieldMapPage.elements.saveFailed.title", "Could not add element"),
1068
1071
  description: String(t),
1069
1072
  variant: "error"
1070
1073
  });
1071
1074
  } finally {
1072
- Tn(!1);
1075
+ Pn(!1);
1073
1076
  }
1074
1077
  }, [
1075
- St,
1076
- bn,
1077
- Sn,
1078
- B,
1079
- br,
1078
+ jt,
1079
+ kn,
1080
+ jn,
1081
+ R,
1082
+ Or,
1080
1083
  e,
1081
- D,
1082
- c
1083
- ]), $r = u(async () => {
1084
- if (V && await h({
1084
+ E,
1085
+ s
1086
+ ]), oi = l(async () => {
1087
+ if (z && await m({
1085
1088
  title: e("healthybowl.fieldMapPage.elements.deleteConfirm.title", "Delete map element?"),
1086
- message: e("healthybowl.fieldMapPage.elements.deleteConfirm.description", "This removes {{name}} from the map. This cannot be undone.", { name: V.name }),
1089
+ message: e("healthybowl.fieldMapPage.elements.deleteConfirm.description", "This removes {{name}} from the map. This cannot be undone.", { name: z.name }),
1087
1090
  okButtonTitle: e("healthybowl.common.delete", "Delete")
1088
1091
  })) {
1089
- On(!0);
1092
+ Ln(!0);
1090
1093
  try {
1091
- await Ct({ variables: {
1092
- id: V.id,
1093
- context: { workspaceId: c }
1094
- } }), await br(), En(null), D({
1094
+ await Mt({ variables: {
1095
+ id: z.id,
1096
+ context: { workspaceId: s }
1097
+ } }), await Or(), Fn(null), E({
1095
1098
  title: e("healthybowl.fieldMapPage.elements.deleted.title", "Map element removed"),
1096
1099
  description: e("healthybowl.fieldMapPage.elements.deleted.description", "The element was deleted."),
1097
1100
  variant: "success"
1098
1101
  });
1099
1102
  } catch (t) {
1100
- D({
1103
+ E({
1101
1104
  title: e("healthybowl.fieldMapPage.elements.deleteFailed.title", "Could not delete element"),
1102
1105
  description: String(t),
1103
1106
  variant: "error"
1104
1107
  });
1105
1108
  } finally {
1106
- On(!1);
1109
+ Ln(!1);
1107
1110
  }
1108
1111
  }
1109
1112
  }, [
1110
- h,
1111
- Ct,
1112
- br,
1113
- V,
1113
+ m,
1114
+ Mt,
1115
+ Or,
1116
+ z,
1114
1117
  e,
1115
- D,
1116
- c
1118
+ E,
1119
+ s
1117
1120
  ]);
1118
- d(() => {
1119
- let e = Bn.current;
1121
+ u(() => {
1122
+ let e = Yn.current;
1120
1123
  if (!e) return;
1121
- te();
1122
- let t = T.default.tileLayer(tt, {
1123
- attribution: nt,
1124
- maxZoom: at,
1124
+ ie();
1125
+ let t = w.default.tileLayer(at, {
1126
+ attribution: ot,
1127
+ maxZoom: lt,
1125
1128
  maxNativeZoom: 18
1126
- }), n = T.default.tileLayer(rt, {
1127
- attribution: it,
1128
- maxZoom: at,
1129
+ }), n = w.default.tileLayer(st, {
1130
+ attribution: ct,
1131
+ maxZoom: lt,
1129
1132
  maxNativeZoom: 17,
1130
1133
  opacity: .65
1131
1134
  });
1132
- Vn.current = t, Hn.current = n;
1133
- let r = T.default.map(e, {
1135
+ Xn.current = t, Zn.current = n;
1136
+ let r = w.default.map(e, {
1134
1137
  center: [20, 78],
1135
1138
  zoom: 4,
1136
1139
  scrollWheelZoom: !0,
1137
- maxZoom: at,
1140
+ maxZoom: lt,
1138
1141
  layers: [t]
1139
1142
  });
1140
- return U.current = r, Un.current = T.default.layerGroup().addTo(r), qn.current = T.default.layerGroup().addTo(r), Jn.current = T.default.layerGroup().addTo(r), Wn.current = T.default.layerGroup().addTo(r), Gn.current = T.default.layerGroup().addTo(r), Kn.current = T.default.layerGroup().addTo(r), Yn.current = T.default.layerGroup().addTo(r), r.on("click", Yr), wt("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
1141
- r.off("click", Yr), r.remove(), U.current = null, Vn.current = null, Hn.current = null, Un.current = null, qn.current = null, Jn.current = null, Wn.current = null, Gn.current = null, Kn.current = null, Yn.current = null;
1143
+ return V.current = r, Qn.current = w.default.layerGroup().addTo(r), nr.current = w.default.layerGroup().addTo(r), rr.current = w.default.layerGroup().addTo(r), $n.current = w.default.layerGroup().addTo(r), er.current = w.default.layerGroup().addTo(r), tr.current = w.default.layerGroup().addTo(r), H.current = w.default.layerGroup().addTo(r), r.on("click", ni), Nt("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
1144
+ r.off("click", ni), r.remove(), V.current = null, Xn.current = null, Zn.current = null, Qn.current = null, nr.current = null, rr.current = null, $n.current = null, er.current = null, tr.current = null, H.current = null;
1142
1145
  };
1143
- }, []), d(() => {
1144
- let e = U.current, t = Hn.current;
1145
- !e || !t || (Tt ? t.addTo(e) : e.removeLayer(t));
1146
- }, [Tt]);
1147
- let ei = B ? E.get(B.type) ?? null : null, $ = V ? E.get(V.type) ?? null : null, ti = !je.crops && g.length === 0, ni = I ? I.distance >= 1e3 ? `${(I.distance / 1e3).toFixed(2)} km` : `${I.distance.toFixed(0)} m` : "";
1148
- if (Ne.crops && g.length === 0) return /* @__PURE__ */ y(r, {
1146
+ }, []), u(() => {
1147
+ let e = V.current, t = Zn.current;
1148
+ !e || !t || (Pt ? t.addTo(e) : e.removeLayer(t));
1149
+ }, [Pt]);
1150
+ let si = R ? T.get(R.type) ?? null : null, $ = z ? T.get(z.type) ?? null : null, ci = !Ie.crops && h.length === 0, li = P ? P.distance >= 1e3 ? `${(P.distance / 1e3).toFixed(2)} km` : `${P.distance.toFixed(0)} m` : "";
1151
+ if (Le.crops && h.length === 0) return /* @__PURE__ */ v(i, {
1152
+ title: e("healthybowl.fieldMapPage.title", "Field Map"),
1153
+ titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1154
+ description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1155
+ children: /* @__PURE__ */ v(o, { onRetry: _ })
1156
+ });
1157
+ if (!Ie.dashboard && !Et) return /* @__PURE__ */ v(i, {
1149
1158
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
1150
1159
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1151
1160
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1152
- children: /* @__PURE__ */ y(i, { onRetry: v })
1161
+ children: /* @__PURE__ */ v(a, {
1162
+ illustration: "onboarding",
1163
+ title: e("healthybowl.fieldMapPage.noFarm.title", "Set up your farm first"),
1164
+ description: e("healthybowl.fieldMapPage.noFarm.description", "The Field Map attaches every boundary you draw to your farm. Create your farm, then come back to trace and save your fields on the satellite view."),
1165
+ action: /* @__PURE__ */ y(b, {
1166
+ onClick: () => wt(Tt("getting-started")),
1167
+ children: [
1168
+ /* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
1169
+ " ",
1170
+ e("healthybowl.fieldMapPage.noFarm.action", "Set up your farm")
1171
+ ]
1172
+ })
1173
+ })
1153
1174
  });
1154
- let ri = (e, t, n, r) => /* @__PURE__ */ b("button", {
1175
+ let ui = (e, t, n, r) => /* @__PURE__ */ y("button", {
1155
1176
  type: "button",
1156
1177
  onClick: t,
1157
1178
  "aria-pressed": e,
1158
1179
  className: `flex flex-col items-center gap-1 rounded-md px-3 py-1.5 text-[11px] font-medium transition-colors ${e ? "bg-success text-white" : "text-text-primary hover:bg-bg-sunken"}`,
1159
1180
  children: [n, r]
1160
1181
  });
1161
- return /* @__PURE__ */ b(r, {
1182
+ return /* @__PURE__ */ y(i, {
1162
1183
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
1163
1184
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1164
1185
  hero: !0,
1165
1186
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1166
1187
  purpose: "Trace each plot on the aerial view to auto-calculate its acreage, shade fields by soil type, overlay terrain, and see your whole holding at a glance. Click any field in the list to fly straight to it.",
1167
1188
  children: [
1168
- /* @__PURE__ */ b("div", {
1189
+ /* @__PURE__ */ y("div", {
1169
1190
  className: "flex flex-col gap-4 lg:flex-row",
1170
- children: [/* @__PURE__ */ b("div", {
1191
+ children: [/* @__PURE__ */ y("div", {
1171
1192
  className: "min-w-0 flex-1 space-y-3",
1172
1193
  children: [
1173
- /* @__PURE__ */ b("form", {
1194
+ /* @__PURE__ */ y("form", {
1174
1195
  className: "flex gap-2",
1175
- onSubmit: Xr,
1176
- children: [/* @__PURE__ */ b("div", {
1196
+ onSubmit: ri,
1197
+ children: [/* @__PURE__ */ y("div", {
1177
1198
  className: "relative min-w-0 flex-1",
1178
- children: [/* @__PURE__ */ y(Oe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ y("input", {
1199
+ children: [/* @__PURE__ */ v(je, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ v("input", {
1179
1200
  type: "search",
1180
- value: Pt,
1181
- onChange: (e) => Ft(e.target.value),
1201
+ value: Ut,
1202
+ onChange: (e) => Wt(e.target.value),
1182
1203
  placeholder: e("healthybowl.fieldMapPage.placeSearch.placeholder", "Find your farm — village, city, or lat,lng…"),
1183
1204
  "aria-label": e("healthybowl.fieldMapPage.placeSearch.label", "Locate a place on the map"),
1184
1205
  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)]"
1185
1206
  })]
1186
- }), /* @__PURE__ */ b(x, {
1207
+ }), /* @__PURE__ */ y(b, {
1187
1208
  type: "submit",
1188
1209
  variant: "outline",
1189
1210
  size: "sm",
1190
- disabled: A !== "ready" || It,
1211
+ disabled: O !== "ready" || Gt,
1191
1212
  children: [
1192
- /* @__PURE__ */ y(Se, { className: "h-4 w-4" }),
1213
+ /* @__PURE__ */ v(Te, { className: "h-4 w-4" }),
1193
1214
  " ",
1194
- It ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
1215
+ Gt ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
1195
1216
  ]
1196
1217
  })]
1197
1218
  }),
1198
- /* @__PURE__ */ b("div", {
1219
+ /* @__PURE__ */ y("div", {
1199
1220
  className: "relative",
1200
1221
  children: [
1201
- /* @__PURE__ */ y("div", {
1202
- ref: Bn,
1222
+ /* @__PURE__ */ v("div", {
1223
+ ref: Yn,
1203
1224
  className: "h-[70vh] max-h-[640px] w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken"
1204
1225
  }),
1205
- A === "ready" && /* @__PURE__ */ b("div", {
1226
+ O === "ready" && /* @__PURE__ */ y("div", {
1206
1227
  className: "absolute right-3 top-3 z-[1000] flex items-center gap-1 rounded-lg border border-border-subtle bg-bg-surface/95 p-1 shadow-md",
1207
1228
  children: [
1208
- ri(j === "draw", () => j === "draw" ? Nr() : Mr(), /* @__PURE__ */ y(we, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
1209
- ri(j === "edit", () => j === "edit" ? Lr() : Ir(), /* @__PURE__ */ y(Ae, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
1210
- ri(!1, zr, /* @__PURE__ */ y(Me, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
1211
- ri(j === "measure", () => j === "measure" ? Hr() : Vr(), /* @__PURE__ */ y(Ee, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure")),
1212
- ri(j === "element" || pn, () => {
1213
- j === "element" ? (Jr(), mn(!1)) : mn((e) => !e);
1214
- }, /* @__PURE__ */ y(ke, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.elements", "Elements"))
1229
+ ui(k === "draw", () => k === "draw" ? Vr() : Br(), /* @__PURE__ */ v(De, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
1230
+ ui(k === "edit", () => k === "edit" ? Gr() : Wr(), /* @__PURE__ */ v(Ne, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
1231
+ ui(!1, qr, /* @__PURE__ */ v(Fe, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
1232
+ ui(k === "measure", () => k === "measure" ? Xr() : Yr(), /* @__PURE__ */ v(ke, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure")),
1233
+ ui(k === "element" || Sn, () => {
1234
+ k === "element" ? (ti(), Cn(!1)) : Cn((e) => !e);
1235
+ }, /* @__PURE__ */ v(Me, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.elements", "Elements"))
1215
1236
  ]
1216
1237
  }),
1217
- A === "ready" && pn && j !== "element" && /* @__PURE__ */ b("div", {
1238
+ O === "ready" && Sn && k !== "element" && /* @__PURE__ */ y("div", {
1218
1239
  className: "absolute right-3 top-16 z-[1001] w-60 rounded-lg border border-border-subtle bg-bg-surface/95 p-2 shadow-lg",
1219
- children: [/* @__PURE__ */ y("p", {
1240
+ children: [/* @__PURE__ */ v("p", {
1220
1241
  className: "px-1.5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-text-secondary",
1221
1242
  children: e("healthybowl.fieldMapPage.elements.menuTitle", "Add map element")
1222
- }), Xe.map((t) => {
1243
+ }), et.map((t) => {
1223
1244
  let n = t.icon;
1224
- return /* @__PURE__ */ b("button", {
1245
+ return /* @__PURE__ */ y("button", {
1225
1246
  type: "button",
1226
- onClick: () => qr(t.type),
1247
+ onClick: () => ei(t.type),
1227
1248
  className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken",
1228
1249
  children: [
1229
- /* @__PURE__ */ y(n, {
1250
+ /* @__PURE__ */ v(n, {
1230
1251
  className: "h-4 w-4 shrink-0",
1231
1252
  style: { color: t.color }
1232
1253
  }),
1233
- /* @__PURE__ */ y("span", {
1254
+ /* @__PURE__ */ v("span", {
1234
1255
  className: "min-w-0 flex-1 truncate",
1235
1256
  children: e(t.labelKey, t.label)
1236
1257
  }),
1237
- /* @__PURE__ */ y("span", {
1258
+ /* @__PURE__ */ v("span", {
1238
1259
  className: "shrink-0 text-[10px] uppercase tracking-wide text-text-secondary",
1239
- children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`, Ze(t.kind))
1260
+ children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`, tt(t.kind))
1240
1261
  })
1241
1262
  ]
1242
1263
  }, t.type);
1243
1264
  })]
1244
1265
  }),
1245
- j === "draw" && /* @__PURE__ */ b("div", {
1266
+ k === "draw" && /* @__PURE__ */ y("div", {
1246
1267
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1247
1268
  children: [
1248
- /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(Rt) }) }),
1249
- /* @__PURE__ */ b(x, {
1269
+ /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(qt) }) }),
1270
+ /* @__PURE__ */ y(b, {
1250
1271
  size: "sm",
1251
1272
  variant: "default",
1252
- onClick: jr,
1273
+ onClick: zr,
1253
1274
  children: [
1254
- /* @__PURE__ */ y(ye, { className: "h-3.5 w-3.5" }),
1275
+ /* @__PURE__ */ v(Se, { className: "h-3.5 w-3.5" }),
1255
1276
  " ",
1256
1277
  e("healthybowl.fieldMapPage.finish", "Finish")
1257
1278
  ]
1258
1279
  }),
1259
- /* @__PURE__ */ y(x, {
1280
+ /* @__PURE__ */ v(b, {
1260
1281
  size: "sm",
1261
1282
  variant: "outline",
1262
- onClick: Nr,
1263
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1283
+ onClick: Vr,
1284
+ children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
1264
1285
  })
1265
1286
  ]
1266
1287
  }),
1267
- j === "edit" && /* @__PURE__ */ b("div", {
1288
+ k === "edit" && /* @__PURE__ */ y("div", {
1268
1289
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1269
1290
  children: [
1270
- /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
1271
- area: String(Bt ?? ""),
1272
- unit: q?.unit ?? "acres"
1291
+ /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
1292
+ area: String(Yt ?? ""),
1293
+ unit: K?.unit ?? "acres"
1273
1294
  }) }),
1274
- /* @__PURE__ */ b(x, {
1295
+ /* @__PURE__ */ y(b, {
1275
1296
  size: "sm",
1276
1297
  variant: "default",
1277
- onClick: Rr,
1278
- disabled: !Ht || Wt,
1298
+ onClick: Kr,
1299
+ disabled: !Zt || $t,
1279
1300
  children: [
1280
- /* @__PURE__ */ y(De, { className: "h-3.5 w-3.5" }),
1301
+ /* @__PURE__ */ v(Ae, { className: "h-3.5 w-3.5" }),
1281
1302
  " ",
1282
- Wt ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
1303
+ $t ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
1283
1304
  ]
1284
1305
  }),
1285
- /* @__PURE__ */ y(x, {
1306
+ /* @__PURE__ */ v(b, {
1286
1307
  size: "sm",
1287
1308
  variant: "outline",
1288
- onClick: Lr,
1289
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1309
+ onClick: Gr,
1310
+ children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
1290
1311
  })
1291
1312
  ]
1292
1313
  }),
1293
- j === "measure" && I && /* @__PURE__ */ b("div", {
1314
+ k === "measure" && P && /* @__PURE__ */ y("div", {
1294
1315
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-3 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1295
1316
  children: [
1296
- /* @__PURE__ */ b("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: ni }), I.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (I.area / 4046.8564224).toFixed(2) })}`] }),
1297
- /* @__PURE__ */ y(x, {
1317
+ /* @__PURE__ */ y("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: li }), P.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (P.area / 4046.8564224).toFixed(2) })}`] }),
1318
+ /* @__PURE__ */ v(b, {
1298
1319
  size: "sm",
1299
1320
  variant: "outline",
1300
- onClick: Q,
1321
+ onClick: Z,
1301
1322
  children: e("healthybowl.fieldMapPage.measure.reset", "Reset")
1302
1323
  }),
1303
- /* @__PURE__ */ y(x, {
1324
+ /* @__PURE__ */ v(b, {
1304
1325
  size: "sm",
1305
1326
  variant: "outline",
1306
- onClick: Hr,
1307
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1327
+ onClick: Xr,
1328
+ children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
1308
1329
  })
1309
1330
  ]
1310
1331
  }),
1311
- j === "element" && Sr && /* @__PURE__ */ b("div", {
1332
+ k === "element" && Ar && /* @__PURE__ */ y("div", {
1312
1333
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1313
1334
  children: [
1314
- /* @__PURE__ */ y("span", { children: Sr.kind === "point" ? e("healthybowl.fieldMapPage.elements.hint.point", "Click the map to place {{label}}.", { label: e(Sr.labelKey, Sr.label) }) : Sr.kind === "line" ? e("healthybowl.fieldMapPage.elements.hint.line", "Click to add points ({{count}}) — then Finish.", { count: String(_n) }) : e("healthybowl.fieldMapPage.elements.hint.polygon", "Click to add corners ({{count}}) — click the first point or Finish.", { count: String(_n) }) }),
1315
- Sr.kind !== "point" && /* @__PURE__ */ b(x, {
1335
+ /* @__PURE__ */ v("span", { children: Ar.kind === "point" ? e("healthybowl.fieldMapPage.elements.hint.point", "Click the map to place {{label}}.", { label: e(Ar.labelKey, Ar.label) }) : Ar.kind === "line" ? e("healthybowl.fieldMapPage.elements.hint.line", "Click to add points ({{count}}) — then Finish.", { count: String(En) }) : e("healthybowl.fieldMapPage.elements.hint.polygon", "Click to add corners ({{count}}) — click the first point or Finish.", { count: String(En) }) }),
1336
+ Ar.kind !== "point" && /* @__PURE__ */ y(b, {
1316
1337
  size: "sm",
1317
1338
  variant: "default",
1318
- onClick: Kr,
1339
+ onClick: $r,
1319
1340
  children: [
1320
- /* @__PURE__ */ y(ye, { className: "h-3.5 w-3.5" }),
1341
+ /* @__PURE__ */ v(Se, { className: "h-3.5 w-3.5" }),
1321
1342
  " ",
1322
1343
  e("healthybowl.fieldMapPage.finish", "Finish")
1323
1344
  ]
1324
1345
  }),
1325
- /* @__PURE__ */ y(x, {
1346
+ /* @__PURE__ */ v(b, {
1326
1347
  size: "sm",
1327
1348
  variant: "outline",
1328
- onClick: Jr,
1329
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1349
+ onClick: ti,
1350
+ children: /* @__PURE__ */ v(Re, { className: "h-3.5 w-3.5" })
1330
1351
  })
1331
1352
  ]
1332
1353
  }),
1333
- A === "ready" && /* @__PURE__ */ b("div", {
1354
+ O === "ready" && /* @__PURE__ */ y("div", {
1334
1355
  className: "absolute bottom-3 left-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
1335
1356
  children: [
1336
- /* @__PURE__ */ b("div", {
1357
+ /* @__PURE__ */ y("div", {
1337
1358
  className: "mb-1.5 flex items-center gap-1.5 font-semibold text-text-primary",
1338
1359
  children: [
1339
- /* @__PURE__ */ y(be, { className: "h-3.5 w-3.5" }),
1360
+ /* @__PURE__ */ v(Ce, { className: "h-3.5 w-3.5" }),
1340
1361
  " ",
1341
1362
  e("healthybowl.fieldMapPage.layers.title", "Layers")
1342
1363
  ]
1343
1364
  }),
1344
- /* @__PURE__ */ b("label", {
1365
+ /* @__PURE__ */ y("label", {
1345
1366
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1346
- children: [/* @__PURE__ */ y("input", {
1367
+ children: [/* @__PURE__ */ v("input", {
1347
1368
  type: "checkbox",
1348
1369
  checked: !0,
1349
1370
  readOnly: !0,
1350
1371
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1351
1372
  }), e("healthybowl.fieldMapPage.layers.satellite", "Satellite")]
1352
1373
  }),
1353
- /* @__PURE__ */ b("label", {
1374
+ /* @__PURE__ */ y("label", {
1354
1375
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1355
- children: [/* @__PURE__ */ y("input", {
1376
+ children: [/* @__PURE__ */ v("input", {
1356
1377
  type: "checkbox",
1357
- checked: Tt,
1358
- onChange: (e) => Et(e.target.checked),
1378
+ checked: Pt,
1379
+ onChange: (e) => Ft(e.target.checked),
1359
1380
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1360
1381
  }), e("healthybowl.fieldMapPage.layers.terrain", "Terrain")]
1361
1382
  }),
1362
- /* @__PURE__ */ b("label", {
1383
+ /* @__PURE__ */ y("label", {
1363
1384
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1364
- children: [/* @__PURE__ */ y("input", {
1385
+ children: [/* @__PURE__ */ v("input", {
1365
1386
  type: "checkbox",
1366
- checked: Dt,
1367
- onChange: (e) => Ot(e.target.checked),
1387
+ checked: It,
1388
+ onChange: (e) => Lt(e.target.checked),
1368
1389
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1369
1390
  }), e("healthybowl.fieldMapPage.layers.soil", "Soil type")]
1370
1391
  }),
1371
- /* @__PURE__ */ b("label", {
1392
+ /* @__PURE__ */ y("label", {
1372
1393
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1373
- children: [/* @__PURE__ */ y("input", {
1394
+ children: [/* @__PURE__ */ v("input", {
1374
1395
  type: "checkbox",
1375
- checked: kt,
1376
- onChange: (e) => At(e.target.checked),
1396
+ checked: Rt,
1397
+ onChange: (e) => zt(e.target.checked),
1377
1398
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1378
1399
  }), e("healthybowl.fieldMapPage.layers.elevation", "Elevation")]
1379
1400
  }),
1380
- /* @__PURE__ */ b("label", {
1401
+ /* @__PURE__ */ y("label", {
1381
1402
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1382
- children: [/* @__PURE__ */ y("input", {
1403
+ children: [/* @__PURE__ */ v("input", {
1383
1404
  type: "checkbox",
1384
- checked: dn,
1385
- onChange: (e) => fn(e.target.checked),
1405
+ checked: bn,
1406
+ onChange: (e) => xn(e.target.checked),
1386
1407
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1387
1408
  }), e("healthybowl.fieldMapPage.layers.elements", "Map elements")]
1388
1409
  }),
1389
- dn && /* @__PURE__ */ b("div", {
1410
+ bn && /* @__PURE__ */ y("div", {
1390
1411
  className: "mt-1.5 max-h-40 overflow-y-auto border-t border-border-subtle pt-1.5",
1391
- children: [/* @__PURE__ */ y("div", {
1412
+ children: [/* @__PURE__ */ v("div", {
1392
1413
  className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-text-secondary",
1393
1414
  children: e("healthybowl.fieldMapPage.elements.legendTitle", "Element types")
1394
- }), Xe.map((t) => {
1415
+ }), et.map((t) => {
1395
1416
  let n = t.icon;
1396
- return /* @__PURE__ */ b("div", {
1417
+ return /* @__PURE__ */ y("div", {
1397
1418
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1398
1419
  children: [
1399
- /* @__PURE__ */ y("span", {
1420
+ /* @__PURE__ */ v("span", {
1400
1421
  className: `inline-block shrink-0 ${t.kind === "line" ? "h-0.5 w-3.5 rounded-full" : "h-3 w-3 rounded-sm"}`,
1401
1422
  style: { backgroundColor: t.color }
1402
1423
  }),
1403
- /* @__PURE__ */ y(n, {
1424
+ /* @__PURE__ */ v(n, {
1404
1425
  className: "h-3 w-3 shrink-0",
1405
1426
  style: { color: t.color }
1406
1427
  }),
@@ -1411,71 +1432,71 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1411
1432
  })
1412
1433
  ]
1413
1434
  }),
1414
- A === "ready" && kt && /* @__PURE__ */ b("div", {
1435
+ O === "ready" && Rt && /* @__PURE__ */ y("div", {
1415
1436
  className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
1416
- children: [/* @__PURE__ */ y("div", {
1437
+ children: [/* @__PURE__ */ v("div", {
1417
1438
  className: "mb-1.5 font-semibold text-text-primary",
1418
1439
  children: e("healthybowl.fieldMapPage.elevationLegend.title", "Elevation")
1419
- }), ur ? /* @__PURE__ */ b(Ie, { children: [/* @__PURE__ */ y("span", {
1440
+ }), vr ? /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v("span", {
1420
1441
  className: "block h-2 w-40 rounded-full",
1421
1442
  style: { background: "linear-gradient(to right, #16a34a, #f59e0b, #dc2626)" }
1422
- }), /* @__PURE__ */ b("div", {
1443
+ }), /* @__PURE__ */ y("div", {
1423
1444
  className: "mt-1 flex justify-between gap-3 text-text-secondary",
1424
- children: [/* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.elevationLegend.low", "{{value}} m Low", { value: String(Math.round(cr)) }) }), /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.elevationLegend.high", "{{value}} m High", { value: String(Math.round(lr)) }) })]
1425
- })] }) : /* @__PURE__ */ y("span", {
1445
+ children: [/* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.elevationLegend.low", "{{value}} m Low", { value: String(Math.round(gr)) }) }), /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.elevationLegend.high", "{{value}} m High", { value: String(Math.round(_r)) }) })]
1446
+ })] }) : /* @__PURE__ */ v("span", {
1426
1447
  className: "text-text-secondary",
1427
1448
  children: e("healthybowl.fieldMapPage.elevationLegend.loading", "Loading elevation…")
1428
1449
  })]
1429
1450
  }),
1430
- A === "ready" && Dt && !kt && ar.length > 0 && /* @__PURE__ */ b("div", {
1451
+ O === "ready" && It && !Rt && pr.length > 0 && /* @__PURE__ */ y("div", {
1431
1452
  className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
1432
- children: [/* @__PURE__ */ y("div", {
1453
+ children: [/* @__PURE__ */ v("div", {
1433
1454
  className: "mb-1.5 font-semibold text-text-primary",
1434
1455
  children: e("healthybowl.fieldMapPage.soilLegend.title", "Soil Legend")
1435
- }), ar.map((t) => /* @__PURE__ */ b("div", {
1456
+ }), pr.map((t) => /* @__PURE__ */ y("div", {
1436
1457
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1437
- children: [/* @__PURE__ */ y("span", {
1458
+ children: [/* @__PURE__ */ v("span", {
1438
1459
  className: "inline-block h-3 w-3 rounded-sm",
1439
1460
  style: { backgroundColor: t.color }
1440
1461
  }), e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)]
1441
1462
  }, t.key))]
1442
1463
  }),
1443
- A === "ready" && Tt && /* @__PURE__ */ b("div", {
1464
+ O === "ready" && Pt && /* @__PURE__ */ y("div", {
1444
1465
  className: "absolute left-3 top-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 px-3 py-2 text-[11px] text-text-secondary shadow-md",
1445
- children: [/* @__PURE__ */ y("div", {
1466
+ children: [/* @__PURE__ */ v("div", {
1446
1467
  className: "font-semibold text-text-primary",
1447
1468
  children: e("healthybowl.fieldMapPage.terrainLegend.title", "Terrain / Elevation")
1448
- }), /* @__PURE__ */ b("div", {
1469
+ }), /* @__PURE__ */ y("div", {
1449
1470
  className: "mt-1 flex items-center gap-2",
1450
- children: [/* @__PURE__ */ y("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
1471
+ children: [/* @__PURE__ */ v("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
1451
1472
  })]
1452
1473
  }),
1453
- (A === "loading" || je.crops && g.length === 0) && /* @__PURE__ */ y("div", {
1474
+ (O === "loading" || Ie.crops && h.length === 0) && /* @__PURE__ */ v("div", {
1454
1475
  className: "pointer-events-none absolute inset-0 z-[900] flex items-center justify-center rounded-lg bg-bg-surface/60 text-sm text-text-secondary",
1455
1476
  children: e("healthybowl.fieldMapPage.loading", "Loading map…")
1456
1477
  }),
1457
- ti && A === "ready" && j === "view" && /* @__PURE__ */ y("div", {
1478
+ ci && O === "ready" && k === "view" && /* @__PURE__ */ v("div", {
1458
1479
  className: "absolute inset-0 z-[950] flex items-center justify-center p-6",
1459
- children: /* @__PURE__ */ b("div", {
1480
+ children: /* @__PURE__ */ y("div", {
1460
1481
  className: "max-w-sm rounded-xl border border-border-subtle bg-bg-surface/95 p-6 text-center shadow-lg",
1461
1482
  children: [
1462
- /* @__PURE__ */ y("div", {
1483
+ /* @__PURE__ */ v("div", {
1463
1484
  className: "mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-success/15",
1464
- children: /* @__PURE__ */ y(Ce, { className: "h-6 w-6 text-success" })
1485
+ children: /* @__PURE__ */ v(Ee, { className: "h-6 w-6 text-success" })
1465
1486
  }),
1466
- /* @__PURE__ */ y("h3", {
1487
+ /* @__PURE__ */ v("h3", {
1467
1488
  className: "text-lg font-semibold text-text-primary",
1468
1489
  children: e("healthybowl.fieldMapPage.empty.title", "No field boundaries yet")
1469
1490
  }),
1470
- /* @__PURE__ */ y("p", {
1491
+ /* @__PURE__ */ v("p", {
1471
1492
  className: "mt-1 text-sm text-text-secondary",
1472
1493
  children: e("healthybowl.fieldMapPage.empty.description", "Draw the shape of each field on the satellite view to auto-calculate its area and unlock soil & terrain overlays.")
1473
1494
  }),
1474
- /* @__PURE__ */ b(x, {
1495
+ /* @__PURE__ */ y(b, {
1475
1496
  className: "mt-4",
1476
- onClick: Mr,
1497
+ onClick: Br,
1477
1498
  children: [
1478
- /* @__PURE__ */ y(Te, { className: "h-4 w-4" }),
1499
+ /* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
1479
1500
  " ",
1480
1501
  e("healthybowl.fieldMapPage.empty.action", "Draw Your First Field")
1481
1502
  ]
@@ -1485,188 +1506,188 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1485
1506
  })
1486
1507
  ]
1487
1508
  }),
1488
- /* @__PURE__ */ y("p", {
1509
+ /* @__PURE__ */ v("p", {
1489
1510
  className: "text-xs text-text-secondary",
1490
1511
  children: e("healthybowl.fieldMapPage.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · terrain © OpenTopoMap / OpenStreetMap")
1491
1512
  })
1492
1513
  ]
1493
- }), /* @__PURE__ */ b("aside", {
1514
+ }), /* @__PURE__ */ y("aside", {
1494
1515
  className: "shrink-0 space-y-4 lg:w-80",
1495
1516
  children: [
1496
- /* @__PURE__ */ b("div", {
1517
+ /* @__PURE__ */ y("div", {
1497
1518
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1498
1519
  children: [
1499
- /* @__PURE__ */ y("h2", {
1520
+ /* @__PURE__ */ v("h2", {
1500
1521
  className: "text-base font-semibold text-text-primary",
1501
1522
  children: e("healthybowl.fieldMapPage.panel.title", "Fields")
1502
1523
  }),
1503
- /* @__PURE__ */ y("p", {
1524
+ /* @__PURE__ */ v("p", {
1504
1525
  className: "mt-0.5 text-xs text-text-secondary",
1505
1526
  children: e("healthybowl.fieldMapPage.panel.summary", "{{acres}} acres · {{count}} fields · {{mapped}} mapped", {
1506
- acres: ir.toFixed(1),
1507
- count: String(g.length),
1508
- mapped: String(rr)
1527
+ acres: fr.toFixed(1),
1528
+ count: String(h.length),
1529
+ mapped: String(dr)
1509
1530
  })
1510
1531
  }),
1511
- /* @__PURE__ */ b("div", {
1532
+ /* @__PURE__ */ y("div", {
1512
1533
  className: "relative mt-3",
1513
- children: [/* @__PURE__ */ y(Oe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ y("input", {
1534
+ children: [/* @__PURE__ */ v(je, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ v("input", {
1514
1535
  type: "search",
1515
- value: Mt,
1516
- onChange: (e) => Nt(e.target.value),
1536
+ value: Vt,
1537
+ onChange: (e) => Ht(e.target.value),
1517
1538
  placeholder: e("healthybowl.fieldMapPage.panel.search", "Search fields…"),
1518
1539
  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)]"
1519
1540
  })]
1520
1541
  }),
1521
- /* @__PURE__ */ b("div", {
1542
+ /* @__PURE__ */ y("div", {
1522
1543
  className: "mt-3 max-h-[38vh] space-y-1 overflow-y-auto",
1523
- children: [or.map((t) => {
1524
- let n = O(t) !== null;
1525
- return /* @__PURE__ */ b("button", {
1544
+ children: [mr.map((t) => {
1545
+ let n = D(t) !== null;
1546
+ return /* @__PURE__ */ y("button", {
1526
1547
  type: "button",
1527
1548
  "data-field-id": t.id,
1528
- onClick: () => Or(t),
1529
- className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id === N ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
1549
+ onClick: () => Ir(t),
1550
+ className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id === j ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
1530
1551
  children: [
1531
- /* @__PURE__ */ y("span", {
1552
+ /* @__PURE__ */ v("span", {
1532
1553
  className: "mt-0.5 inline-block h-4 w-4 shrink-0 rounded",
1533
- style: { backgroundColor: ce(t.soilType) }
1554
+ style: { backgroundColor: de(t.soilType) }
1534
1555
  }),
1535
- /* @__PURE__ */ b("span", {
1556
+ /* @__PURE__ */ y("span", {
1536
1557
  className: "min-w-0 flex-1",
1537
- children: [/* @__PURE__ */ y("span", {
1558
+ children: [/* @__PURE__ */ v("span", {
1538
1559
  className: "block truncate text-sm font-medium text-text-primary",
1539
1560
  children: t.name
1540
- }), /* @__PURE__ */ b("span", {
1561
+ }), /* @__PURE__ */ y("span", {
1541
1562
  className: "block truncate text-xs text-text-secondary",
1542
1563
  children: [
1543
- _t(t),
1564
+ xt(t),
1544
1565
  " ·",
1545
1566
  " ",
1546
1567
  t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil"),
1547
- F[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(F[t.id])) })}`
1568
+ N[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[t.id])) })}`
1548
1569
  ]
1549
1570
  })]
1550
1571
  }),
1551
- !n && /* @__PURE__ */ y("span", {
1572
+ !n && /* @__PURE__ */ v("span", {
1552
1573
  className: "shrink-0 rounded-full bg-warning/20 px-1.5 py-0.5 text-[10px] font-medium text-warning",
1553
1574
  children: e("healthybowl.fieldMapPage.unmapped", "no boundary")
1554
1575
  })
1555
1576
  ]
1556
1577
  }, t.id);
1557
- }), or.length === 0 && /* @__PURE__ */ y("p", {
1578
+ }), mr.length === 0 && /* @__PURE__ */ v("p", {
1558
1579
  className: "px-2 py-4 text-center text-xs text-text-secondary",
1559
1580
  children: e("healthybowl.fieldMapPage.panel.none", "No fields match your search.")
1560
1581
  })]
1561
1582
  }),
1562
- /* @__PURE__ */ b(x, {
1583
+ /* @__PURE__ */ y(b, {
1563
1584
  className: "mt-3 w-full",
1564
- onClick: Mr,
1565
- disabled: j === "draw",
1585
+ onClick: Br,
1586
+ disabled: k === "draw",
1566
1587
  children: [
1567
- /* @__PURE__ */ y(Te, { className: "h-4 w-4" }),
1588
+ /* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
1568
1589
  " ",
1569
1590
  e("healthybowl.fieldMapPage.panel.drawNew", "Draw New Field")
1570
1591
  ]
1571
1592
  })
1572
1593
  ]
1573
1594
  }),
1574
- q && /* @__PURE__ */ b("div", {
1595
+ K && /* @__PURE__ */ y("div", {
1575
1596
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1576
1597
  children: [
1577
- /* @__PURE__ */ y("h3", {
1598
+ /* @__PURE__ */ v("h3", {
1578
1599
  className: "text-sm font-semibold text-text-primary",
1579
- children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: q.name })
1600
+ children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: K.name })
1580
1601
  }),
1581
- /* @__PURE__ */ b("dl", {
1602
+ /* @__PURE__ */ y("dl", {
1582
1603
  className: "mt-3 space-y-2 text-sm",
1583
1604
  children: [
1584
- /* @__PURE__ */ b("div", {
1605
+ /* @__PURE__ */ y("div", {
1585
1606
  className: "flex justify-between gap-3",
1586
- children: [/* @__PURE__ */ y("dt", {
1607
+ children: [/* @__PURE__ */ v("dt", {
1587
1608
  className: "text-text-secondary",
1588
1609
  children: e("healthybowl.fieldMapPage.detail.area", "Area")
1589
- }), /* @__PURE__ */ b("dd", {
1610
+ }), /* @__PURE__ */ y("dd", {
1590
1611
  className: "font-medium text-text-primary",
1591
1612
  children: [
1592
- q.area,
1613
+ K.area,
1593
1614
  " ",
1594
- q.unit
1615
+ K.unit
1595
1616
  ]
1596
1617
  })]
1597
1618
  }),
1598
- /* @__PURE__ */ b("div", {
1619
+ /* @__PURE__ */ y("div", {
1599
1620
  className: "flex justify-between gap-3",
1600
- children: [/* @__PURE__ */ y("dt", {
1621
+ children: [/* @__PURE__ */ v("dt", {
1601
1622
  className: "text-text-secondary",
1602
1623
  children: e("healthybowl.fieldMapPage.detail.elevation", "Elevation")
1603
- }), /* @__PURE__ */ y("dd", {
1624
+ }), /* @__PURE__ */ v("dd", {
1604
1625
  className: "font-medium text-text-primary",
1605
- children: F[q.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(F[q.id])) })
1626
+ children: N[K.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[K.id])) })
1606
1627
  })]
1607
1628
  }),
1608
- /* @__PURE__ */ b("div", {
1629
+ /* @__PURE__ */ y("div", {
1609
1630
  className: "flex justify-between gap-3",
1610
- children: [/* @__PURE__ */ y("dt", {
1631
+ children: [/* @__PURE__ */ v("dt", {
1611
1632
  className: "text-text-secondary",
1612
1633
  children: e("healthybowl.fieldMapPage.detail.soil", "Soil")
1613
- }), /* @__PURE__ */ y("dd", {
1634
+ }), /* @__PURE__ */ v("dd", {
1614
1635
  className: "font-medium text-text-primary",
1615
- children: q.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
1636
+ children: K.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
1616
1637
  })]
1617
1638
  }),
1618
- /* @__PURE__ */ b("div", {
1639
+ /* @__PURE__ */ y("div", {
1619
1640
  className: "flex justify-between gap-3",
1620
- children: [/* @__PURE__ */ y("dt", {
1641
+ children: [/* @__PURE__ */ v("dt", {
1621
1642
  className: "text-text-secondary",
1622
1643
  children: e("healthybowl.fieldMapPage.detail.irrigation", "Irrigation")
1623
- }), /* @__PURE__ */ y("dd", {
1644
+ }), /* @__PURE__ */ v("dd", {
1624
1645
  className: "font-medium text-text-primary",
1625
- children: q.irrigationType || "—"
1646
+ children: K.irrigationType || "—"
1626
1647
  })]
1627
1648
  }),
1628
- /* @__PURE__ */ b("div", {
1649
+ /* @__PURE__ */ y("div", {
1629
1650
  className: "flex justify-between gap-3",
1630
- children: [/* @__PURE__ */ y("dt", {
1651
+ children: [/* @__PURE__ */ v("dt", {
1631
1652
  className: "text-text-secondary",
1632
1653
  children: e("healthybowl.fieldMapPage.detail.crop", "Crop")
1633
- }), /* @__PURE__ */ y("dd", {
1654
+ }), /* @__PURE__ */ v("dd", {
1634
1655
  className: "font-medium text-text-primary",
1635
- children: dr(q) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
1656
+ children: yr(K) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
1636
1657
  })]
1637
1658
  }),
1638
- /* @__PURE__ */ b("div", {
1659
+ /* @__PURE__ */ y("div", {
1639
1660
  className: "flex justify-between gap-3",
1640
- children: [/* @__PURE__ */ y("dt", {
1661
+ children: [/* @__PURE__ */ v("dt", {
1641
1662
  className: "text-text-secondary",
1642
1663
  children: e("healthybowl.fieldMapPage.detail.status", "Status")
1643
- }), /* @__PURE__ */ y("dd", {
1664
+ }), /* @__PURE__ */ v("dd", {
1644
1665
  className: "font-medium capitalize text-text-primary",
1645
- children: q.status
1666
+ children: K.status
1646
1667
  })]
1647
1668
  })
1648
1669
  ]
1649
1670
  }),
1650
- /* @__PURE__ */ b("div", {
1671
+ /* @__PURE__ */ y("div", {
1651
1672
  className: "mt-3 flex gap-2",
1652
- children: [/* @__PURE__ */ b(x, {
1673
+ children: [/* @__PURE__ */ y(b, {
1653
1674
  variant: "outline",
1654
1675
  size: "sm",
1655
1676
  className: "flex-1",
1656
- onClick: () => Dr(q),
1677
+ onClick: () => Fr(K),
1657
1678
  children: [
1658
- /* @__PURE__ */ y(Ce, { className: "h-4 w-4" }),
1679
+ /* @__PURE__ */ v(Ee, { className: "h-4 w-4" }),
1659
1680
  " ",
1660
1681
  e("healthybowl.fieldMapPage.detail.flyTo", "Fly to")
1661
1682
  ]
1662
- }), O(q) && /* @__PURE__ */ b(x, {
1683
+ }), D(K) && /* @__PURE__ */ y(b, {
1663
1684
  variant: "outline",
1664
1685
  size: "sm",
1665
1686
  className: "flex-1",
1666
- onClick: Ir,
1667
- disabled: j === "edit",
1687
+ onClick: Wr,
1688
+ disabled: k === "edit",
1668
1689
  children: [
1669
- /* @__PURE__ */ y(Ae, { className: "h-4 w-4" }),
1690
+ /* @__PURE__ */ v(Ne, { className: "h-4 w-4" }),
1670
1691
  " ",
1671
1692
  e("healthybowl.fieldMapPage.detail.edit", "Edit")
1672
1693
  ]
@@ -1674,256 +1695,256 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1674
1695
  })
1675
1696
  ]
1676
1697
  }),
1677
- q && fr && /* @__PURE__ */ b("div", {
1698
+ K && br && /* @__PURE__ */ y("div", {
1678
1699
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1679
1700
  children: [
1680
- /* @__PURE__ */ b("div", {
1701
+ /* @__PURE__ */ y("div", {
1681
1702
  className: "flex items-center justify-between gap-2",
1682
- children: [/* @__PURE__ */ b("h3", {
1703
+ children: [/* @__PURE__ */ y("h3", {
1683
1704
  className: "flex items-center gap-1.5 text-sm font-semibold text-text-primary",
1684
1705
  children: [
1685
- /* @__PURE__ */ y(xe, { className: "h-4 w-4" }),
1706
+ /* @__PURE__ */ v(we, { className: "h-4 w-4" }),
1686
1707
  " ",
1687
1708
  e("healthybowl.fieldMapPage.beds.title", "Bed layout")
1688
1709
  ]
1689
- }), /* @__PURE__ */ b("label", {
1710
+ }), /* @__PURE__ */ y("label", {
1690
1711
  className: "flex cursor-pointer items-center gap-2 text-xs font-medium text-text-primary",
1691
- children: [/* @__PURE__ */ y("input", {
1712
+ children: [/* @__PURE__ */ v("input", {
1692
1713
  type: "checkbox",
1693
- checked: qt,
1694
- onChange: (e) => Jt(e.target.checked),
1714
+ checked: nn,
1715
+ onChange: (e) => rn(e.target.checked),
1695
1716
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1696
1717
  }), e("healthybowl.fieldMapPage.beds.show", "Show beds")]
1697
1718
  })]
1698
1719
  }),
1699
- /* @__PURE__ */ y("p", {
1720
+ /* @__PURE__ */ v("p", {
1700
1721
  className: "mt-1 text-xs text-text-secondary",
1701
1722
  children: e("healthybowl.fieldMapPage.beds.hint", "Draw planting bed strips inside this field, then save the layout. Click a saved bed to assign a crop.")
1702
1723
  }),
1703
- /* @__PURE__ */ b("div", {
1724
+ /* @__PURE__ */ y("div", {
1704
1725
  className: "mt-3 grid grid-cols-2 gap-3",
1705
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1726
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1706
1727
  className: "text-xs font-medium text-text-primary",
1707
1728
  children: e("healthybowl.fieldMapPage.beds.bedWidth", "Bed width (m)")
1708
- }), /* @__PURE__ */ y("input", {
1729
+ }), /* @__PURE__ */ v("input", {
1709
1730
  type: "number",
1710
1731
  min: .2,
1711
1732
  step: .1,
1712
- value: L,
1713
- onChange: (e) => Yt(Math.max(.2, Number(e.target.value) || 0)),
1733
+ value: F,
1734
+ onChange: (e) => an(Math.max(.2, Number(e.target.value) || 0)),
1714
1735
  className: "mt-1 h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
1715
- })] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1736
+ })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1716
1737
  className: "text-xs font-medium text-text-primary",
1717
1738
  children: e("healthybowl.fieldMapPage.beds.pathWidth", "Path width (m)")
1718
- }), /* @__PURE__ */ y("input", {
1739
+ }), /* @__PURE__ */ v("input", {
1719
1740
  type: "number",
1720
1741
  min: 0,
1721
1742
  step: .05,
1722
- value: Xt,
1723
- onChange: (e) => Zt(Math.max(0, Number(e.target.value) || 0)),
1743
+ value: on,
1744
+ onChange: (e) => sn(Math.max(0, Number(e.target.value) || 0)),
1724
1745
  className: "mt-1 h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
1725
1746
  })] })]
1726
1747
  }),
1727
- /* @__PURE__ */ b("div", {
1748
+ /* @__PURE__ */ y("div", {
1728
1749
  className: "mt-3",
1729
- children: [/* @__PURE__ */ b("div", {
1750
+ children: [/* @__PURE__ */ y("div", {
1730
1751
  className: "flex items-center justify-between",
1731
- children: [/* @__PURE__ */ y("label", {
1752
+ children: [/* @__PURE__ */ v("label", {
1732
1753
  className: "text-xs font-medium text-text-primary",
1733
1754
  children: e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
1734
- }), /* @__PURE__ */ b("span", {
1755
+ }), /* @__PURE__ */ y("span", {
1735
1756
  className: "text-xs text-text-secondary",
1736
- children: [R, "°"]
1757
+ children: [I, "°"]
1737
1758
  })]
1738
- }), /* @__PURE__ */ y("input", {
1759
+ }), /* @__PURE__ */ v("input", {
1739
1760
  type: "range",
1740
1761
  min: 0,
1741
1762
  max: 180,
1742
1763
  step: 1,
1743
- value: R,
1744
- onChange: (e) => Qt(Number(e.target.value)),
1764
+ value: I,
1765
+ onChange: (e) => cn(Number(e.target.value)),
1745
1766
  className: "mt-1 w-full accent-[var(--color-success)]",
1746
1767
  "aria-label": e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
1747
1768
  })]
1748
1769
  }),
1749
- _.length > 0 && /* @__PURE__ */ b("div", {
1770
+ g.length > 0 && /* @__PURE__ */ y("div", {
1750
1771
  className: "mt-3",
1751
1772
  children: [
1752
- /* @__PURE__ */ y("label", {
1773
+ /* @__PURE__ */ v("label", {
1753
1774
  className: "text-xs font-medium text-text-primary",
1754
1775
  children: e("healthybowl.fieldMapPage.beds.crop", "Spacing for crop")
1755
1776
  }),
1756
- /* @__PURE__ */ b(Le, {
1757
- value: mr?.id ?? "",
1758
- onValueChange: en,
1759
- children: [/* @__PURE__ */ y(ze, {
1777
+ /* @__PURE__ */ y(Ve, {
1778
+ value: Sr?.id ?? "",
1779
+ onValueChange: un,
1780
+ children: [/* @__PURE__ */ v(Ue, {
1760
1781
  className: "mt-1 w-full",
1761
- children: /* @__PURE__ */ y(Be, { placeholder: e("healthybowl.fieldMapPage.beds.cropPlaceholder", "Standard spacing") })
1762
- }), /* @__PURE__ */ y(Re, { children: _.map((e) => /* @__PURE__ */ y(S, {
1782
+ children: /* @__PURE__ */ v(We, { placeholder: e("healthybowl.fieldMapPage.beds.cropPlaceholder", "Standard spacing") })
1783
+ }), /* @__PURE__ */ v(He, { children: g.map((e) => /* @__PURE__ */ v(x, {
1763
1784
  value: e.id,
1764
1785
  children: e.name
1765
1786
  }, e.id)) })]
1766
1787
  }),
1767
- /* @__PURE__ */ y("p", {
1788
+ /* @__PURE__ */ v("p", {
1768
1789
  className: "mt-1 text-[11px] text-text-secondary",
1769
1790
  children: e("healthybowl.fieldMapPage.beds.spacingLine", "{{preset}} · {{plant}}×{{row}} cm", {
1770
- preset: J.label,
1771
- plant: String(J.plantSpacingCm),
1772
- row: String(J.rowSpacingCm)
1791
+ preset: q.label,
1792
+ plant: String(q.plantSpacingCm),
1793
+ row: String(q.rowSpacingCm)
1773
1794
  })
1774
1795
  })
1775
1796
  ]
1776
1797
  }),
1777
- Y && /* @__PURE__ */ b("div", {
1798
+ J && /* @__PURE__ */ y("div", {
1778
1799
  className: "mt-3 rounded-md bg-warning/10 px-3 py-2 text-sm font-medium text-text-primary",
1779
1800
  children: [e("healthybowl.fieldMapPage.beds.readout", "{{beds}} beds · ~{{plants}} plants", {
1780
- beds: String(Y.bedCount),
1781
- plants: hr.toLocaleString()
1782
- }), /* @__PURE__ */ y("span", {
1801
+ beds: String(J.bedCount),
1802
+ plants: Cr.toLocaleString()
1803
+ }), /* @__PURE__ */ v("span", {
1783
1804
  className: "ml-1 text-xs font-normal text-text-secondary",
1784
1805
  children: e("healthybowl.fieldMapPage.beds.previewTag", "(preview)")
1785
1806
  })]
1786
1807
  }),
1787
- X.length > 0 && /* @__PURE__ */ b("div", {
1808
+ Y.length > 0 && /* @__PURE__ */ y("div", {
1788
1809
  className: "mt-2 flex items-center gap-2 rounded-md bg-success/10 px-3 py-2 text-sm font-medium text-text-primary",
1789
- children: [/* @__PURE__ */ y("span", { className: "inline-block h-3 w-3 shrink-0 rounded-sm border border-[#065f46] bg-[#34d399]" }), e("healthybowl.fieldMapPage.beds.savedCount", "Saved ({{count}} beds)", { count: String(X.length) })]
1810
+ children: [/* @__PURE__ */ v("span", { className: "inline-block h-3 w-3 shrink-0 rounded-sm border border-[#065f46] bg-[#34d399]" }), e("healthybowl.fieldMapPage.beds.savedCount", "Saved ({{count}} beds)", { count: String(Y.length) })]
1790
1811
  }),
1791
- _r && X.length === 0 && /* @__PURE__ */ y("p", {
1812
+ Tr && Y.length === 0 && /* @__PURE__ */ v("p", {
1792
1813
  className: "mt-2 text-xs text-text-secondary",
1793
1814
  children: e("healthybowl.fieldMapPage.beds.loadingSaved", "Loading saved beds…")
1794
1815
  }),
1795
- /* @__PURE__ */ b("div", {
1816
+ /* @__PURE__ */ y("div", {
1796
1817
  className: "mt-3 flex gap-2",
1797
- children: [/* @__PURE__ */ b(x, {
1818
+ children: [/* @__PURE__ */ y(b, {
1798
1819
  size: "sm",
1799
1820
  className: "flex-1",
1800
- onClick: wr,
1801
- disabled: !Y || Y.beds.length === 0 || tn,
1821
+ onClick: Mr,
1822
+ disabled: !J || J.beds.length === 0 || dn,
1802
1823
  children: [
1803
- /* @__PURE__ */ y(De, { className: "h-4 w-4" }),
1824
+ /* @__PURE__ */ v(Ae, { className: "h-4 w-4" }),
1804
1825
  " ",
1805
- tn ? e("healthybowl.fieldMapPage.beds.saving", "Saving…") : X.length > 0 ? e("healthybowl.fieldMapPage.beds.resave", "Save layout (replace)") : e("healthybowl.fieldMapPage.beds.save", "Save layout")
1826
+ dn ? e("healthybowl.fieldMapPage.beds.saving", "Saving…") : Y.length > 0 ? e("healthybowl.fieldMapPage.beds.resave", "Save layout (replace)") : e("healthybowl.fieldMapPage.beds.save", "Save layout")
1806
1827
  ]
1807
- }), X.length > 0 && /* @__PURE__ */ b(x, {
1828
+ }), Y.length > 0 && /* @__PURE__ */ y(b, {
1808
1829
  variant: "outline",
1809
1830
  size: "sm",
1810
- onClick: Tr,
1811
- disabled: rn,
1831
+ onClick: Nr,
1832
+ disabled: pn,
1812
1833
  children: [
1813
- /* @__PURE__ */ y(Me, { className: "h-4 w-4" }),
1834
+ /* @__PURE__ */ v(Fe, { className: "h-4 w-4" }),
1814
1835
  " ",
1815
- rn ? e("healthybowl.fieldMapPage.beds.clearing", "Clearing…") : e("healthybowl.fieldMapPage.beds.clear", "Clear")
1836
+ pn ? e("healthybowl.fieldMapPage.beds.clearing", "Clearing…") : e("healthybowl.fieldMapPage.beds.clear", "Clear")
1816
1837
  ]
1817
1838
  })]
1818
1839
  }),
1819
- Y && Y.bedCount > Qe && /* @__PURE__ */ y("p", {
1840
+ J && J.bedCount > nt && /* @__PURE__ */ v("p", {
1820
1841
  className: "mt-2 text-xs text-warning",
1821
- children: e("healthybowl.fieldMapPage.beds.capHint", "Over the {{max}}-bed save limit — widen the beds to save this layout.", { max: String(Qe) })
1842
+ children: e("healthybowl.fieldMapPage.beds.capHint", "Over the {{max}}-bed save limit — widen the beds to save this layout.", { max: String(nt) })
1822
1843
  })
1823
1844
  ]
1824
1845
  })
1825
1846
  ]
1826
1847
  })]
1827
1848
  }),
1828
- /* @__PURE__ */ y(s, {
1829
- open: H !== null,
1830
- onClose: () => kn(null),
1849
+ /* @__PURE__ */ v(ne, {
1850
+ open: B !== null,
1851
+ onClose: () => Rn(null),
1831
1852
  title: e("healthybowl.fieldMapPage.create.title", "Save New Field"),
1832
1853
  description: e("healthybowl.fieldMapPage.create.description", "Name the field you just drew. Its area is auto-calculated."),
1833
- footer: /* @__PURE__ */ b(Ie, { children: [/* @__PURE__ */ y(x, {
1854
+ footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
1834
1855
  variant: "outline",
1835
- onClick: () => kn(null),
1856
+ onClick: () => Rn(null),
1836
1857
  className: "text-text-secondary",
1837
1858
  children: e("healthybowl.common.cancel", "Cancel")
1838
- }), /* @__PURE__ */ y(x, {
1839
- onClick: Zr,
1840
- disabled: An,
1841
- children: An ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
1859
+ }), /* @__PURE__ */ v(b, {
1860
+ onClick: ii,
1861
+ disabled: zn,
1862
+ children: zn ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
1842
1863
  })] }),
1843
- children: /* @__PURE__ */ b("div", {
1864
+ children: /* @__PURE__ */ y("div", {
1844
1865
  className: "space-y-4",
1845
1866
  children: [
1846
- /* @__PURE__ */ y("div", {
1867
+ /* @__PURE__ */ v("div", {
1847
1868
  className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
1848
- children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(H?.area ?? 0) })
1869
+ children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(B?.area ?? 0) })
1849
1870
  }),
1850
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1871
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1851
1872
  className: "text-sm font-medium text-text-primary",
1852
1873
  children: e("healthybowl.fieldMapPage.create.name", "Field name *")
1853
- }), /* @__PURE__ */ y("input", {
1874
+ }), /* @__PURE__ */ v("input", {
1854
1875
  type: "text",
1855
- value: Mn,
1856
- onChange: (e) => Nn(e.target.value),
1876
+ value: Vn,
1877
+ onChange: (e) => Hn(e.target.value),
1857
1878
  placeholder: e("healthybowl.fieldMapPage.create.namePlaceholder", "e.g., North Paddy"),
1858
1879
  className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
1859
1880
  })] }),
1860
- /* @__PURE__ */ b("div", {
1881
+ /* @__PURE__ */ y("div", {
1861
1882
  className: "grid grid-cols-2 gap-3",
1862
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1883
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1863
1884
  className: "text-sm font-medium text-text-primary",
1864
1885
  children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
1865
- }), /* @__PURE__ */ b(Le, {
1866
- value: Pn,
1867
- onValueChange: Fn,
1868
- children: [/* @__PURE__ */ y(ze, {
1886
+ }), /* @__PURE__ */ y(Ve, {
1887
+ value: Un,
1888
+ onValueChange: Wn,
1889
+ children: [/* @__PURE__ */ v(Ue, {
1869
1890
  className: "mt-1 w-full",
1870
- children: /* @__PURE__ */ y(Be, {})
1871
- }), /* @__PURE__ */ y(Re, { children: se.map((t) => /* @__PURE__ */ y(S, {
1891
+ children: /* @__PURE__ */ v(We, {})
1892
+ }), /* @__PURE__ */ v(He, { children: ue.map((t) => /* @__PURE__ */ v(x, {
1872
1893
  value: t.label,
1873
1894
  children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
1874
1895
  }, t.key)) })]
1875
- })] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1896
+ })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1876
1897
  className: "text-sm font-medium text-text-primary",
1877
1898
  children: e("healthybowl.fieldMapPage.create.irrigation", "Irrigation")
1878
- }), /* @__PURE__ */ b(Le, {
1879
- value: In,
1880
- onValueChange: Ln,
1881
- children: [/* @__PURE__ */ y(ze, {
1899
+ }), /* @__PURE__ */ y(Ve, {
1900
+ value: Gn,
1901
+ onValueChange: Kn,
1902
+ children: [/* @__PURE__ */ v(Ue, {
1882
1903
  className: "mt-1 w-full",
1883
- children: /* @__PURE__ */ y(Be, {})
1884
- }), /* @__PURE__ */ b(Re, { children: [
1885
- /* @__PURE__ */ y(S, {
1904
+ children: /* @__PURE__ */ v(We, {})
1905
+ }), /* @__PURE__ */ y(He, { children: [
1906
+ /* @__PURE__ */ v(x, {
1886
1907
  value: "Drip",
1887
1908
  children: e("healthybowl.fieldMapPage.irrigation.drip", "Drip")
1888
1909
  }),
1889
- /* @__PURE__ */ y(S, {
1910
+ /* @__PURE__ */ v(x, {
1890
1911
  value: "Sprinkler",
1891
1912
  children: e("healthybowl.fieldMapPage.irrigation.sprinkler", "Sprinkler")
1892
1913
  }),
1893
- /* @__PURE__ */ y(S, {
1914
+ /* @__PURE__ */ v(x, {
1894
1915
  value: "Flood",
1895
1916
  children: e("healthybowl.fieldMapPage.irrigation.flood", "Flood")
1896
1917
  }),
1897
- /* @__PURE__ */ y(S, {
1918
+ /* @__PURE__ */ v(x, {
1898
1919
  value: "Rainfed",
1899
1920
  children: e("healthybowl.fieldMapPage.irrigation.rainfed", "Rainfed")
1900
1921
  }),
1901
- /* @__PURE__ */ y(S, {
1922
+ /* @__PURE__ */ v(x, {
1902
1923
  value: "None",
1903
1924
  children: e("healthybowl.fieldMapPage.irrigation.none", "None")
1904
1925
  })
1905
1926
  ] })]
1906
1927
  })] })]
1907
1928
  }),
1908
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1929
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1909
1930
  className: "text-sm font-medium text-text-primary",
1910
1931
  children: e("healthybowl.fieldMapPage.create.status", "Status")
1911
- }), /* @__PURE__ */ b(Le, {
1912
- value: Rn,
1913
- onValueChange: zn,
1914
- children: [/* @__PURE__ */ y(ze, {
1932
+ }), /* @__PURE__ */ y(Ve, {
1933
+ value: qn,
1934
+ onValueChange: Jn,
1935
+ children: [/* @__PURE__ */ v(Ue, {
1915
1936
  className: "mt-1 w-full",
1916
- children: /* @__PURE__ */ y(Be, {})
1917
- }), /* @__PURE__ */ b(Re, { children: [
1918
- /* @__PURE__ */ y(S, {
1937
+ children: /* @__PURE__ */ v(We, {})
1938
+ }), /* @__PURE__ */ y(He, { children: [
1939
+ /* @__PURE__ */ v(x, {
1919
1940
  value: "active",
1920
1941
  children: e("healthybowl.fieldMapPage.status.active", "Active")
1921
1942
  }),
1922
- /* @__PURE__ */ y(S, {
1943
+ /* @__PURE__ */ v(x, {
1923
1944
  value: "preparation",
1924
1945
  children: e("healthybowl.fieldMapPage.status.preparation", "Preparation")
1925
1946
  }),
1926
- /* @__PURE__ */ y(S, {
1947
+ /* @__PURE__ */ v(x, {
1927
1948
  value: "fallow",
1928
1949
  children: e("healthybowl.fieldMapPage.status.fallow", "Fallow")
1929
1950
  })
@@ -1932,39 +1953,39 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1932
1953
  ]
1933
1954
  })
1934
1955
  }),
1935
- /* @__PURE__ */ y(s, {
1936
- open: z !== null,
1937
- onClose: () => on(null),
1938
- title: e("healthybowl.fieldMapPage.beds.assign.title", "Assign crop to {{bed}}", { bed: z?.name ?? "" }),
1956
+ /* @__PURE__ */ v(ne, {
1957
+ open: L !== null,
1958
+ onClose: () => hn(null),
1959
+ title: e("healthybowl.fieldMapPage.beds.assign.title", "Assign crop to {{bed}}", { bed: L?.name ?? "" }),
1939
1960
  description: e("healthybowl.fieldMapPage.beds.assign.description", "Pick a crop for this bed. Its plant count is recomputed from the crop's spacing."),
1940
- footer: /* @__PURE__ */ b(Ie, { children: [/* @__PURE__ */ y(x, {
1961
+ footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
1941
1962
  variant: "outline",
1942
- onClick: () => on(null),
1963
+ onClick: () => hn(null),
1943
1964
  className: "text-text-secondary",
1944
1965
  children: e("healthybowl.common.cancel", "Cancel")
1945
- }), /* @__PURE__ */ y(x, {
1946
- onClick: Er,
1947
- disabled: ln,
1948
- children: ln ? e("healthybowl.fieldMapPage.beds.assign.saving", "Saving…") : e("healthybowl.fieldMapPage.beds.assign.action", "Assign")
1966
+ }), /* @__PURE__ */ v(b, {
1967
+ onClick: Pr,
1968
+ disabled: vn,
1969
+ children: vn ? e("healthybowl.fieldMapPage.beds.assign.saving", "Saving…") : e("healthybowl.fieldMapPage.beds.assign.action", "Assign")
1949
1970
  })] }),
1950
- children: /* @__PURE__ */ b("div", {
1971
+ children: /* @__PURE__ */ y("div", {
1951
1972
  className: "space-y-3",
1952
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1973
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1953
1974
  className: "text-sm font-medium text-text-primary",
1954
1975
  children: e("healthybowl.fieldMapPage.beds.assign.crop", "Crop")
1955
- }), /* @__PURE__ */ b(Le, {
1956
- value: sn,
1957
- onValueChange: cn,
1958
- children: [/* @__PURE__ */ y(ze, {
1976
+ }), /* @__PURE__ */ y(Ve, {
1977
+ value: gn,
1978
+ onValueChange: _n,
1979
+ children: [/* @__PURE__ */ v(Ue, {
1959
1980
  className: "mt-1 w-full",
1960
- children: /* @__PURE__ */ y(Be, { placeholder: e("healthybowl.fieldMapPage.beds.assign.none", "No crop") })
1961
- }), /* @__PURE__ */ y(Re, { children: _.map((e) => /* @__PURE__ */ y(S, {
1981
+ children: /* @__PURE__ */ v(We, { placeholder: e("healthybowl.fieldMapPage.beds.assign.none", "No crop") })
1982
+ }), /* @__PURE__ */ v(He, { children: g.map((e) => /* @__PURE__ */ v(x, {
1962
1983
  value: e.id,
1963
1984
  children: e.name
1964
1985
  }, e.id)) })]
1965
1986
  })] }), (() => {
1966
- let t = _e(_.find((e) => e.id === sn) ?? null), n = z ? ne(z.boundary) : null, r = fe(z?.area ?? (n ? l(n) : 0), z?.widthM ?? L, t.plantSpacingCm, t.rowSpacingCm);
1967
- return /* @__PURE__ */ y("div", {
1987
+ let t = be(g.find((e) => e.id === gn) ?? null), n = L ? ae(L.boundary) : null, r = he(L?.area ?? (n ? c(n) : 0), L?.widthM ?? F, t.plantSpacingCm, t.rowSpacingCm);
1988
+ return /* @__PURE__ */ v("div", {
1968
1989
  className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
1969
1990
  children: e("healthybowl.fieldMapPage.beds.assign.preview", "{{preset}} · {{plant}}×{{row}} cm · ~{{plants}} plants", {
1970
1991
  preset: t.label,
@@ -1976,47 +1997,47 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1976
1997
  })()]
1977
1998
  })
1978
1999
  }),
1979
- /* @__PURE__ */ y(s, {
1980
- open: B !== null,
1981
- onClose: () => yn(null),
2000
+ /* @__PURE__ */ v(ne, {
2001
+ open: R !== null,
2002
+ onClose: () => On(null),
1982
2003
  title: e("healthybowl.fieldMapPage.elements.save.title", "Save map element"),
1983
2004
  description: e("healthybowl.fieldMapPage.elements.save.description", "Name the element you just drew. It will show on the map with its type styling."),
1984
- footer: /* @__PURE__ */ b(Ie, { children: [/* @__PURE__ */ y(x, {
2005
+ footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
1985
2006
  variant: "outline",
1986
- onClick: () => yn(null),
2007
+ onClick: () => On(null),
1987
2008
  className: "text-text-secondary",
1988
2009
  children: e("healthybowl.common.cancel", "Cancel")
1989
- }), /* @__PURE__ */ y(x, {
1990
- onClick: Qr,
1991
- disabled: wn,
1992
- children: wn ? e("healthybowl.fieldMapPage.elements.save.saving", "Saving…") : e("healthybowl.fieldMapPage.elements.save.action", "Save element")
2010
+ }), /* @__PURE__ */ v(b, {
2011
+ onClick: ai,
2012
+ disabled: Nn,
2013
+ children: Nn ? e("healthybowl.fieldMapPage.elements.save.saving", "Saving…") : e("healthybowl.fieldMapPage.elements.save.action", "Save element")
1993
2014
  })] }),
1994
- children: /* @__PURE__ */ b("div", {
2015
+ children: /* @__PURE__ */ y("div", {
1995
2016
  className: "space-y-4",
1996
2017
  children: [
1997
- ei && /* @__PURE__ */ b("div", {
2018
+ si && /* @__PURE__ */ y("div", {
1998
2019
  className: "flex items-center gap-2 rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
1999
- children: [/* @__PURE__ */ y(ei.icon, {
2020
+ children: [/* @__PURE__ */ v(si.icon, {
2000
2021
  className: "h-4 w-4 shrink-0",
2001
- style: { color: ei.color }
2002
- }), e("healthybowl.fieldMapPage.elements.save.typeLine", "Type: {{type}}", { type: e(ei.labelKey, ei.label) })]
2022
+ style: { color: si.color }
2023
+ }), e("healthybowl.fieldMapPage.elements.save.typeLine", "Type: {{type}}", { type: e(si.labelKey, si.label) })]
2003
2024
  }),
2004
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2025
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
2005
2026
  className: "text-sm font-medium text-text-primary",
2006
2027
  children: e("healthybowl.fieldMapPage.elements.save.name", "Name *")
2007
- }), /* @__PURE__ */ y("input", {
2028
+ }), /* @__PURE__ */ v("input", {
2008
2029
  type: "text",
2009
- value: bn,
2010
- onChange: (e) => xn(e.target.value),
2030
+ value: kn,
2031
+ onChange: (e) => An(e.target.value),
2011
2032
  placeholder: e("healthybowl.fieldMapPage.elements.save.namePlaceholder", "e.g., North buffer strip"),
2012
2033
  className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
2013
2034
  })] }),
2014
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2035
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
2015
2036
  className: "text-sm font-medium text-text-primary",
2016
2037
  children: e("healthybowl.fieldMapPage.elements.save.notes", "Notes")
2017
- }), /* @__PURE__ */ y("textarea", {
2018
- value: Sn,
2019
- onChange: (e) => Cn(e.target.value),
2038
+ }), /* @__PURE__ */ v("textarea", {
2039
+ value: jn,
2040
+ onChange: (e) => Mn(e.target.value),
2020
2041
  rows: 3,
2021
2042
  placeholder: e("healthybowl.fieldMapPage.elements.save.notesPlaceholder", "Optional details…"),
2022
2043
  className: "mt-1 w-full resize-y rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
@@ -2024,57 +2045,57 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
2024
2045
  ]
2025
2046
  })
2026
2047
  }),
2027
- /* @__PURE__ */ y(s, {
2028
- open: V !== null,
2029
- onClose: () => En(null),
2030
- title: V?.name ?? e("healthybowl.fieldMapPage.elements.detail.title", "Map element"),
2031
- description: $ ? e($.labelKey, $.label) : V?.type ?? "",
2032
- footer: /* @__PURE__ */ b(Ie, { children: [/* @__PURE__ */ y(x, {
2048
+ /* @__PURE__ */ v(ne, {
2049
+ open: z !== null,
2050
+ onClose: () => Fn(null),
2051
+ title: z?.name ?? e("healthybowl.fieldMapPage.elements.detail.title", "Map element"),
2052
+ description: $ ? e($.labelKey, $.label) : z?.type ?? "",
2053
+ footer: /* @__PURE__ */ y(Be, { children: [/* @__PURE__ */ v(b, {
2033
2054
  variant: "outline",
2034
- onClick: () => En(null),
2055
+ onClick: () => Fn(null),
2035
2056
  className: "text-text-secondary",
2036
2057
  children: e("healthybowl.common.close", "Close")
2037
- }), /* @__PURE__ */ b(x, {
2058
+ }), /* @__PURE__ */ y(b, {
2038
2059
  variant: "destructive",
2039
- onClick: $r,
2040
- disabled: Dn,
2060
+ onClick: oi,
2061
+ disabled: In,
2041
2062
  children: [
2042
- /* @__PURE__ */ y(Me, { className: "h-4 w-4" }),
2063
+ /* @__PURE__ */ v(Fe, { className: "h-4 w-4" }),
2043
2064
  " ",
2044
- Dn ? e("healthybowl.fieldMapPage.elements.detail.deleting", "Deleting…") : e("healthybowl.common.delete", "Delete")
2065
+ In ? e("healthybowl.fieldMapPage.elements.detail.deleting", "Deleting…") : e("healthybowl.common.delete", "Delete")
2045
2066
  ]
2046
2067
  })] }),
2047
- children: /* @__PURE__ */ b("div", {
2068
+ children: /* @__PURE__ */ y("div", {
2048
2069
  className: "space-y-3 text-sm",
2049
- children: [/* @__PURE__ */ b("div", {
2070
+ children: [/* @__PURE__ */ y("div", {
2050
2071
  className: "flex justify-between gap-3",
2051
- children: [/* @__PURE__ */ y("span", {
2072
+ children: [/* @__PURE__ */ v("span", {
2052
2073
  className: "text-text-secondary",
2053
2074
  children: e("healthybowl.fieldMapPage.elements.detail.type", "Type")
2054
- }), /* @__PURE__ */ b("span", {
2075
+ }), /* @__PURE__ */ y("span", {
2055
2076
  className: "flex items-center gap-1.5 font-medium text-text-primary",
2056
- children: [$ && /* @__PURE__ */ y($.icon, {
2077
+ children: [$ && /* @__PURE__ */ v($.icon, {
2057
2078
  className: "h-4 w-4",
2058
2079
  style: { color: $.color }
2059
- }), $ ? e($.labelKey, $.label) : V?.type]
2080
+ }), $ ? e($.labelKey, $.label) : z?.type]
2060
2081
  })]
2061
- }), V?.notes && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
2082
+ }), z?.notes && /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("span", {
2062
2083
  className: "text-text-secondary",
2063
2084
  children: e("healthybowl.fieldMapPage.elements.detail.notes", "Notes")
2064
- }), /* @__PURE__ */ y("p", {
2085
+ }), /* @__PURE__ */ v("p", {
2065
2086
  className: "mt-1 whitespace-pre-wrap text-text-primary",
2066
- children: V.notes
2087
+ children: z.notes
2067
2088
  })] })]
2068
2089
  })
2069
2090
  }),
2070
- /* @__PURE__ */ y(a, {
2071
- toasts: C,
2072
- onDismiss: ht
2091
+ /* @__PURE__ */ v(ee, {
2092
+ toasts: dt,
2093
+ onDismiss: Ct
2073
2094
  })
2074
2095
  ]
2075
2096
  });
2076
2097
  };
2077
2098
  //#endregion
2078
- export { k as FieldMapPage };
2099
+ export { Ct as FieldMapPage };
2079
2100
 
2080
2101
  //# sourceMappingURL=FieldMapPage.js.map