@burdenoff/microfe-healthybowl 2026.713.2 → 2026.713.4

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, Undo2 as Le, Warehouse as Re, Waypoints as _, X as ze } from "lucide-react";
25
+ import { useNavigate as Be } from "react-router-dom";
26
+ import { Fragment as Ve, jsx as v, jsxs as y } from "react/jsx-runtime";
27
+ import { Button as b, Select as He, SelectContent as Ue, SelectItem as x, SelectTrigger as We, SelectValue as Ge } from "@burdenoff/fe-libs/ui";
28
+ import { gql as S } from "@apollo/client";
29
+ import { useMutation as Ke, useQuery as qe } from "@apollo/client/react";
27
30
  //#region src/healthybowl/pages/fields/FieldMapPage.tsx
28
- var T = /* @__PURE__ */ e(c(), 1), He = C`
31
+ var C = /* @__PURE__ */ e(s(), 1), Je = 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
+ `, Ye = 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
+ `, Xe = S`
54
57
  mutation CreateHealthyBowlBedOnMapPage($input: CreateHealthyBowlBedInput!) {
55
58
  createHealthyBowlBed(input: $input) {
56
59
  id
57
60
  }
58
61
  }
59
- `, Ge = C`
62
+ `, Ze = 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
+ `, Qe = S`
68
71
  mutation DeleteHealthyBowlBedOnMapPage($id: ID!, $context: ContextInput!) {
69
72
  deleteHealthyBowlBed(id: $id, context: $context)
70
73
  }
71
- `, qe = C`
74
+ `, $e = 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
+ `, et = S`
83
86
  mutation CreateHealthyBowlMapFeatureOnMapPage($input: CreateHealthyBowlMapFeatureInput!) {
84
87
  createHealthyBowlMapFeature(input: $input) {
85
88
  id
86
89
  }
87
90
  }
88
- `, Ye = C`
91
+ `, tt = S`
89
92
  mutation DeleteHealthyBowlMapFeatureOnMapPage($id: ID!, $context: ContextInput!) {
90
93
  deleteHealthyBowlMapFeature(id: $id, context: $context)
91
94
  }
92
- `, Xe = [
95
+ `, nt = [
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: Re
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
+ ], w = new Map(nt.map((e) => [e.type, e])), rt = (e) => e === "polygon" ? "Area" : e === "line" ? "Line" : "Point", it = 250, at = 20;
209
+ async function ot(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 st = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", ct = "Esri, Maxar, Earthstar Geographics", lt = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", ut = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", dt = 21, ft = 16, pt = 2.47105, mt = "#16a34a", ht = {
210
213
  color: "#f59e0b",
211
214
  weight: 2,
212
215
  dashArray: "6 4",
213
216
  fillColor: "#f59e0b",
214
217
  fillOpacity: .15
215
- }, lt = {
218
+ }, gt = {
216
219
  color: "#ffffff",
217
220
  weight: 2,
218
221
  dashArray: "6 4",
219
222
  fillColor: "#22c55e",
220
223
  fillOpacity: .2
221
- }, ut = {
224
+ }, _t = {
222
225
  color: "#38bdf8",
223
226
  weight: 3,
224
227
  dashArray: "6 6"
225
- }, dt = {
228
+ }, vt = {
226
229
  color: "#b45309",
227
230
  weight: 1,
228
231
  dashArray: "4 3",
229
232
  fillColor: "#f59e0b",
230
233
  fillOpacity: .25
231
- }, ft = {
234
+ }, yt = {
232
235
  color: "#065f46",
233
236
  weight: 2,
234
237
  fillColor: "#34d399",
235
238
  fillOpacity: .5
236
- }, pt = {
239
+ }, bt = {
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
+ }, xt = (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)), T = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), St = (e) => T(e.unit) ? e.area * pt : e.area, Ct = (e) => `${e.area.toFixed(1)} ${T(e.unit) ? "ha" : "ac"}`, E = (e) => {
245
+ let t = ae(e.boundary);
246
+ return t && oe(t) ? t : null;
247
+ }, wt = C.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
+ }), Tt = () => {
253
+ let { t: e } = xe(), { workspaceId: s } = n(), m = te(), { fields: h, crops: g, farm: Pe, loadings: Ie, errors: Re, refetch: _, createField: S } = _e(), { toasts: pt, toast: T, dismiss: Tt } = re(), Et = Be(), { buildPath: Dt } = r(), Ot = !!Pe?.id, [D] = Ke(Je), [kt] = Ke(Xe), [At] = Ke(Ze), [jt] = Ke(Qe), [Mt] = Ke(et), [Nt] = Ke(tt), [O, Pt] = p("loading"), [k, A] = p("view"), [j, M] = p(null), [Ft, It] = p(!1), [Lt, Rt] = p(!0), [zt, Bt] = p(!1), [N, Vt] = p({}), [Ht, Ut] = p(""), [Wt, Gt] = p(""), [Kt, qt] = p(!1), [Jt, Yt] = p(0), [Xt, Zt] = p(null), [Qt, $t] = p(!1), [en, tn] = p(!1), [P, nn] = p(null), [rn, an] = p(!1), [F, on] = p(ve), [sn, cn] = p(ye), [I, ln] = p(0), [un, dn] = p(""), [fn, pn] = p(!1), [mn, hn] = p(!1), [L, gn] = p(null), [_n, vn] = p(""), [yn, bn] = p(!1), [xn, Sn] = p(!0), [Cn, wn] = p(!1), [Tn, En] = p(null), [Dn, On] = p(0), [R, kn] = p(null), [An, jn] = p(""), [Mn, Nn] = p(""), [Pn, Fn] = p(!1), [z, In] = p(null), [Ln, Rn] = p(!1), [B, zn] = p(null), [Bn, Vn] = p(!1), [Hn, Un] = p(""), [Wn, Gn] = p("Clay loam"), [Kn, qn] = p("Drip"), [Jn, Yn] = p("active"), Xn = f(null), V = f(null), Zn = f(null), Qn = f(null), $n = f(null), H = f(null), er = f(null), tr = f(null), nr = f(null), rr = f(null), ir = f(null), U = f([]), ar = f(null), W = f(null), G = f([]), or = f(null), sr = f([]), cr = f(null), lr = f([]), K = f("view"), ur = f(!1);
254
+ u(() => {
255
+ K.current = k;
256
+ }, [k]), u(() => {
257
+ W.current = Tn;
258
+ }, [Tn]), u(() => {
259
+ k !== "element" && (ir.current?.clearLayers(), U.current = [], ar.current = null);
260
+ }, [k]);
261
+ let dr = d(() => h.filter((e) => E(e) !== null).length, [h]), fr = d(() => h.reduce((e, t) => e + St(t), 0), [h]), pr = d(() => fe(h.map((e) => e.soilType)), [h]), q = d(() => h.find((e) => e.id === j) ?? null, [h, j]), mr = d(() => {
262
+ let e = Ht.trim().toLowerCase();
263
+ return e ? h.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : h;
264
+ }, [h, Ht]), 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 = E(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
+ xt(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
+ Vt({});
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
+ }), Vt(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(() => q ? E(q) : null, [q]), xr = d(() => q ? g.find((e) => e.field === q.id || e.fieldName === q.name) ?? null : null, [g, q]), Sr = d(() => g.find((e) => e.id === un) ?? xr, [
314
+ g,
315
+ un,
316
+ xr
317
+ ]), J = d(() => be(Sr), [Sr]);
318
+ u(() => {
319
+ dn("");
320
+ }, [j]);
321
+ let Y = d(() => br ? ge(br, {
322
+ bedWidthM: F,
323
+ pathWidthM: sn,
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, [
326
+ br,
327
+ F,
328
+ sn,
329
+ I
330
+ ]), Cr = d(() => Y ? Y.beds.reduce((e, t) => e + he(c(t), F, J.plantSpacingCm, J.rowSpacingCm), 0) : 0, [
328
331
  Y,
329
- L,
332
+ F,
330
333
  J
331
- ]), { data: gr, loading: _r, refetch: vr } = Ve(Ue, {
334
+ ]), { data: wr, loading: Tr, refetch: Er } = qe(Ye, {
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
+ }), X = d(() => wr?.healthyBowlBeds ?? [], [wr]), { data: Dr, refetch: Or } = qe($e, {
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(() => w.get(Tn ?? "") ?? null, [Tn]), 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" && (X.forEach((n) => {
348
+ let r = ae(n.boundary);
349
+ if (!r || !oe(r)) return;
350
+ let i = jr(n.cropId), a = C.default.geoJSON(r, { style: () => n.cropId ? bt : yt });
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
+ C.default.DomEvent.stopPropagation(e), gn(n), vn(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
+ }), rn && Y && Y.beds.forEach((n) => {
362
+ let r = c(n), i = he(r, F, J.plantSpacingCm, J.rowSpacingCm), a = C.default.geoJSON(n, { style: () => vt });
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,
372
+ rn,
370
373
  Y,
371
- L,
374
+ F,
372
375
  J,
373
- j,
376
+ k,
374
377
  X,
375
- Cr,
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(), xn && kr.forEach((n) => {
383
+ let r = w.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 = C.default.geoJSON(n.geometry, {
388
391
  style: () => a,
389
- pointToLayer: (e, t) => T.default.circleMarker(t, {
392
+ pointToLayer: (e, t) => C.default.circleMarker(t, {
390
393
  radius: 7,
391
394
  color: "#fff",
392
395
  weight: 2,
@@ -398,57 +401,57 @@ 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
+ C.default.DomEvent.stopPropagation(e), K.current === "view" && In(n);
407
410
  }), o.addTo(t);
408
411
  }));
409
412
  }, [
410
- xr,
411
- dn,
413
+ kr,
414
+ xn,
412
415
  e
413
416
  ]);
414
- let wr = u(async () => {
417
+ let Mr = l(async () => {
415
418
  if (!(!q || !Y || Y.beds.length === 0)) {
416
- if (Y.bedCount > Qe) {
417
- D({
419
+ if (Y.bedCount > it) {
420
+ T({
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
423
  count: String(Y.bedCount),
421
- max: String(Qe)
424
+ max: String(it)
422
425
  }),
423
426
  variant: "warning"
424
427
  });
425
428
  return;
426
429
  }
427
- nn(!0);
430
+ pn(!0);
428
431
  try {
429
- await et(X, $e, (e) => xt({ variables: {
432
+ await ot(X, at, (e) => jt({ variables: {
430
433
  id: e.id,
431
- context: { workspaceId: c }
434
+ context: { workspaceId: s }
432
435
  } }));
433
436
  let t = Y.beds;
434
- await et(t.map((e, t) => ({
437
+ await ot(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
+ })), at, ({ bed: t, index: n }) => {
441
+ let r = c(t), i = he(r, F, J.plantSpacingCm, J.rowSpacingCm);
442
+ return kt({ variables: { input: {
440
443
  fieldId: q.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(), T({
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),
@@ -457,31 +460,31 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
457
460
  variant: "success"
458
461
  });
459
462
  } catch (t) {
460
- D({
463
+ T({
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
+ pn(!1);
467
470
  }
468
471
  }
469
472
  }, [
470
- mr,
473
+ Sr,
471
474
  Y,
472
- R,
475
+ I,
473
476
  J,
474
- L,
475
- yt,
476
- xt,
477
- vr,
477
+ F,
478
+ kt,
479
+ jt,
480
+ Er,
478
481
  X,
479
482
  q,
480
483
  e,
481
- D,
482
- c
483
- ]), Tr = u(async () => {
484
- if (!(!q || X.length === 0) && await h({
484
+ T,
485
+ s
486
+ ]), Nr = l(async () => {
487
+ if (!(!q || X.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
490
  count: String(X.length),
@@ -489,79 +492,79 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
489
492
  }),
490
493
  okButtonTitle: e("healthybowl.common.delete", "Delete")
491
494
  })) {
492
- an(!0);
495
+ hn(!0);
493
496
  try {
494
- await et(X, $e, (e) => xt({ variables: {
497
+ await ot(X, at, (e) => jt({ variables: {
495
498
  id: e.id,
496
- context: { workspaceId: c }
497
- } })), await vr(), D({
499
+ context: { workspaceId: s }
500
+ } })), await Er(), T({
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
+ T({
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
+ hn(!1);
510
513
  }
511
514
  }
512
515
  }, [
513
- h,
514
- xt,
515
- vr,
516
+ m,
517
+ jt,
518
+ Er,
516
519
  X,
517
520
  q,
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
+ T,
523
+ s
524
+ ]), Pr = l(async () => {
525
+ if (!L) return;
526
+ let t = g.find((e) => e.id === _n) ?? null, n = be(t), r = ae(L.boundary), i = he(L.area ?? (r ? c(r) : 0), L.widthM ?? F, n.plantSpacingCm, n.rowSpacingCm);
527
+ bn(!0);
525
528
  try {
526
- await bt({ variables: { input: {
527
- id: z.id,
528
- cropId: sn || null,
529
+ await At({ variables: { input: {
530
+ id: L.id,
531
+ cropId: _n || null,
529
532
  plantCount: i,
530
- context: { workspaceId: c }
531
- } } }), await vr(), on(null), D({
533
+ context: { workspaceId: s }
534
+ } } }), await Er(), gn(null), T({
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
+ T({
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
+ bn(!1);
548
551
  }
549
552
  }, [
550
- z,
551
- sn,
552
553
  L,
553
- _,
554
- vr,
554
+ _n,
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
+ T,
560
+ At,
561
+ s
562
+ ]), Fr = l((e) => {
563
+ let t = V.current;
561
564
  if (!t) return;
562
- let n = O(e);
565
+ let n = E(e);
563
566
  if (n) try {
564
- let e = T.default.geoJSON(n).getBounds();
567
+ let e = C.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
+ xt(e.location) && t.flyTo([e.location.lat, e.location.lng], ft, { duration: .6 });
577
+ }, []), Ir = l((e) => {
578
+ K.current === "draw" || K.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 = $n.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 = zt && a != null ? pe(a, gr, _r) : Lt ? de(t.soilType) : mt, ee = `${t.name} — ${Ct(t)}`, te = E(t);
591
+ if (te) {
592
+ let e = C.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,124 @@ 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 (xt(t.location)) {
609
+ let a = C.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(C.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), C.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
+ Lt,
636
+ zt,
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 Z = l(() => {
646
+ H.current?.clearLayers(), or.current = null, G.current = [], Yt(0);
647
+ }, []), Rr = l(() => {
648
+ let e = H.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 = G.current;
652
+ t.length >= 2 && (or.current = C.default.polygon(t, ht).addTo(e));
653
+ }, []), zr = l(() => {
654
+ let t = G.current;
652
655
  if (t.length < 3) {
653
- D({
656
+ T({
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
+ Z(), K.current = "view", A("view"), n && (zn({
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
+ }), Un(""), Gn("Clay loam"), qn("Drip"), Yn("active"));
669
672
  }, [
670
673
  Z,
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
+ T
676
+ ]), Br = l(() => {
677
+ M(null), Z(), K.current = "draw", A("draw");
678
+ }, [Z]), Vr = l(() => {
679
+ Z(), K.current = "view", A("view");
680
+ }, [Z]), Hr = l(() => {
681
+ let e = G.current;
682
+ if (e.length === 0) return;
683
+ e.pop();
684
+ let t = H.current;
685
+ t && (t.clearLayers(), or.current = null, e.forEach((e, n) => {
686
+ let r = n === 0, i = C.default.circleMarker(e, {
687
+ radius: r ? 7 : 5,
688
+ color: "#fff",
689
+ weight: 2,
690
+ fillColor: r ? "#16a34a" : "#f59e0b",
691
+ fillOpacity: 1
692
+ }).addTo(t);
693
+ r && i.on("click", (e) => {
694
+ C.default.DomEvent.stopPropagation(e), zr();
695
+ });
696
+ }), Rr()), Yt(e.length);
697
+ }, [zr, Rr]);
698
+ u(() => {
699
+ if (k !== "draw") return;
700
+ let e = (e) => {
701
+ let t = e.target;
702
+ t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable) || (e.key === "Backspace" || e.key === "Delete" ? (e.preventDefault(), Hr()) : e.key === "Escape" && (e.preventDefault(), Vr()));
703
+ };
704
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
705
+ }, [
706
+ k,
707
+ Hr,
708
+ Vr
709
+ ]);
710
+ let Ur = l(() => {
711
+ er.current?.clearLayers(), cr.current = null, sr.current = [], Zt(null), $t(!1);
712
+ }, []), Wr = l(() => {
713
+ if (!er.current || !cr.current) return;
714
+ cr.current.setLatLngs(sr.current);
715
+ let e = le(sr.current.map((e) => ({
683
716
  lat: e.lat,
684
717
  lng: e.lng
685
718
  })));
686
- e && Vt(ie(e, q?.unit ?? "acres"));
687
- }, [q]), Ir = u(() => {
688
- let t = U.current, n = Gn.current;
719
+ e && Zt(se(e, q?.unit ?? "acres"));
720
+ }, [q]), Gr = l(() => {
721
+ let t = V.current, n = er.current;
689
722
  if (!t || !n || !q) return;
690
- let r = O(q);
723
+ let r = E(q);
691
724
  if (!r) {
692
- D({
725
+ T({
693
726
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
694
727
  description: e("healthybowl.fieldMapPage.toast.noBoundary.description", "Draw a boundary for this field first."),
695
728
  variant: "warning"
@@ -697,38 +730,38 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
697
730
  return;
698
731
  }
699
732
  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,
733
+ let i = r.coordinates[0].slice(0, -1).map(([e, t]) => C.default.latLng(t, e));
734
+ sr.current = i, cr.current = C.default.polygon(i, gt).addTo(n), i.forEach((e, t) => {
735
+ C.default.marker(i[t], {
736
+ icon: wt,
704
737
  draggable: !0
705
738
  }).addTo(n).on("drag", (e) => {
706
- $n.current[t] = e.target.getLatLng(), Fr(), Ut(!0);
739
+ sr.current[t] = e.target.getLatLng(), Wr(), $t(!0);
707
740
  });
708
- }), K.current = "edit", M("edit"), Ut(!1), Vt(ie(r, q.unit));
741
+ }), K.current = "edit", A("edit"), $t(!1), Zt(se(r, q.unit));
709
742
  }, [
710
- Fr,
743
+ Wr,
711
744
  q,
712
745
  e,
713
- D
714
- ]), Lr = u(() => {
715
- Pr(), K.current = "view", M("view"), kr();
716
- }, [Pr, kr]), Rr = u(async () => {
746
+ T
747
+ ]), Kr = l(() => {
748
+ Ur(), K.current = "view", A("view"), Lr();
749
+ }, [Ur, Lr]), qr = l(async () => {
717
750
  if (!q) return;
718
- let t = oe($n.current.map((e) => ({
751
+ let t = le(sr.current.map((e) => ({
719
752
  lat: e.lat,
720
753
  lng: e.lng
721
754
  })));
722
755
  if (t) {
723
- Gt(!0);
756
+ tn(!0);
724
757
  try {
725
- let n = ie(t, q.unit);
726
- await k({ variables: { input: {
758
+ let n = se(t, q.unit);
759
+ await D({ variables: { input: {
727
760
  id: q.id,
728
761
  boundary: t,
729
762
  area: n,
730
- context: { workspaceId: c }
731
- } } }), await v(), Pr(), K.current = "view", M("view"), D({
763
+ context: { workspaceId: s }
764
+ } } }), await _(), Ur(), K.current = "view", A("view"), T({
732
765
  title: e("healthybowl.fieldMapPage.toast.saved.title", "Boundary saved"),
733
766
  description: e("healthybowl.fieldMapPage.toast.saved.description", "Area updated to {{area}} {{unit}}.", {
734
767
  area: String(n),
@@ -737,49 +770,49 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
737
770
  variant: "success"
738
771
  });
739
772
  } catch (t) {
740
- D({
773
+ T({
741
774
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
742
775
  description: String(t),
743
776
  variant: "error"
744
777
  });
745
778
  } finally {
746
- Gt(!1);
779
+ tn(!1);
747
780
  }
748
781
  }
749
782
  }, [
750
- Pr,
751
- v,
783
+ Ur,
784
+ _,
752
785
  q,
753
786
  e,
787
+ T,
754
788
  D,
755
- k,
756
- c
757
- ]), zr = u(async () => {
789
+ s
790
+ ]), Jr = l(async () => {
758
791
  if (q) {
759
- if (!O(q)) {
760
- D({
792
+ if (!E(q)) {
793
+ T({
761
794
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
762
795
  description: e("healthybowl.fieldMapPage.toast.deleteNone.description", "This field has no boundary to delete."),
763
796
  variant: "warning"
764
797
  });
765
798
  return;
766
799
  }
767
- if (await h({
800
+ if (await m({
768
801
  title: e("healthybowl.fieldMapPage.confirmDelete.title", "Delete boundary?"),
769
802
  message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: q.name }),
770
803
  okButtonTitle: e("healthybowl.common.delete", "Delete")
771
804
  })) try {
772
- await k({ variables: { input: {
805
+ await D({ variables: { input: {
773
806
  id: q.id,
774
807
  boundary: null,
775
- context: { workspaceId: c }
776
- } } }), await v(), D({
808
+ context: { workspaceId: s }
809
+ } } }), await _(), T({
777
810
  title: e("healthybowl.fieldMapPage.toast.boundaryDeleted.title", "Boundary removed"),
778
811
  description: e("healthybowl.fieldMapPage.toast.boundaryDeleted.description", "The drawn shape was cleared."),
779
812
  variant: "success"
780
813
  });
781
814
  } catch (t) {
782
- D({
815
+ T({
783
816
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
784
817
  description: String(t),
785
818
  variant: "error"
@@ -787,90 +820,90 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
787
820
  }
788
821
  }
789
822
  }, [
790
- h,
791
- v,
823
+ m,
824
+ _,
792
825
  q,
793
826
  e,
827
+ T,
794
828
  D,
795
- k,
796
- c
797
- ]), Q = u(() => {
798
- Kn.current?.clearLayers(), tr.current = [], Kt(null);
799
- }, []), Br = u(() => {
800
- let e = Kn.current;
829
+ s
830
+ ]), Q = l(() => {
831
+ tr.current?.clearLayers(), lr.current = [], nn(null);
832
+ }, []), Yr = l(() => {
833
+ let e = tr.current;
801
834
  if (!e) return;
802
835
  e.clearLayers();
803
- let t = tr.current;
836
+ let t = lr.current;
804
837
  t.forEach((t) => {
805
- T.default.circleMarker(t, {
838
+ C.default.circleMarker(t, {
806
839
  radius: 4,
807
840
  color: "#38bdf8",
808
841
  weight: 2,
809
842
  fillColor: "#fff",
810
843
  fillOpacity: 1
811
844
  }).addTo(e);
812
- }), t.length >= 2 && T.default.polyline(t, ut).addTo(e);
845
+ }), t.length >= 2 && C.default.polyline(t, _t).addTo(e);
813
846
  let n = 0;
814
847
  for (let e = 1; e < t.length; e++) n += t[e - 1].distanceTo(t[e]);
815
848
  let r = null;
816
849
  if (t.length >= 3) {
817
- let e = oe(t.map((e) => ({
850
+ let e = le(t.map((e) => ({
818
851
  lat: e.lat,
819
852
  lng: e.lng
820
853
  })));
821
- e && (r = l(e));
854
+ e && (r = c(e));
822
855
  }
823
- Kt({
856
+ nn({
824
857
  distance: n,
825
858
  area: r
826
859
  });
827
- }, []), Vr = u(() => {
828
- P(null), Q(), K.current = "measure", M("measure"), Kt({
860
+ }, []), Xr = l(() => {
861
+ M(null), Q(), K.current = "measure", A("measure"), nn({
829
862
  distance: 0,
830
863
  area: null
831
864
  });
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 ?? "");
865
+ }, [Q]), Zr = l(() => {
866
+ Q(), K.current = "view", A("view");
867
+ }, [Q]), Qr = l(() => {
868
+ ir.current?.clearLayers(), ar.current = null, U.current = [], On(0);
869
+ }, []), $r = l(() => {
870
+ let e = ir.current, t = w.get(W.current ?? "");
838
871
  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, {
872
+ ar.current &&= (e.removeLayer(ar.current), null);
873
+ let n = U.current;
874
+ t.kind === "polygon" && n.length >= 2 ? ar.current = C.default.polygon(n, {
842
875
  ...t.style,
843
876
  dashArray: "6 4"
844
- }).addTo(e) : t.kind === "line" && n.length >= 2 && (Xn.current = T.default.polyline(n, {
877
+ }).addTo(e) : t.kind === "line" && n.length >= 2 && (ar.current = C.default.polyline(n, {
845
878
  ...t.style,
846
879
  dashArray: "6 4"
847
880
  }).addTo(e));
848
- }, []), Gr = u((e, t) => {
849
- Ur(), gn(null), G.current = null, K.current = "view", M("view"), xn(""), Cn(""), yn({
881
+ }, []), ei = l((e, t) => {
882
+ Qr(), En(null), W.current = null, K.current = "view", A("view"), jn(""), Nn(""), kn({
850
883
  type: e,
851
884
  geometry: t
852
885
  });
853
- }, [Ur]), Kr = u(() => {
854
- let t = E.get(G.current ?? "");
886
+ }, [Qr]), ti = l(() => {
887
+ let t = w.get(W.current ?? "");
855
888
  if (!t) return;
856
- let n = W.current;
889
+ let n = U.current;
857
890
  if (t.kind === "polygon") {
858
891
  if (n.length < 3) {
859
- D({
892
+ T({
860
893
  title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
861
894
  description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
862
895
  variant: "warning"
863
896
  });
864
897
  return;
865
898
  }
866
- let r = oe(n.map((e) => ({
899
+ let r = le(n.map((e) => ({
867
900
  lat: e.lat,
868
901
  lng: e.lng
869
902
  })));
870
- r && Gr(t.type, r);
903
+ r && ei(t.type, r);
871
904
  } else if (t.kind === "line") {
872
905
  if (n.length < 2) {
873
- D({
906
+ T({
874
907
  title: e("healthybowl.fieldMapPage.toast.needLine.title", "Need at least 2 points"),
875
908
  description: e("healthybowl.fieldMapPage.toast.needLine.description", "Click the map to add more points."),
876
909
  variant: "warning"
@@ -881,526 +914,556 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
881
914
  type: "LineString",
882
915
  coordinates: n.map((e) => [e.lng, e.lat])
883
916
  };
884
- Gr(t.type, r);
917
+ ei(t.type, r);
885
918
  }
886
919
  }, [
887
- Gr,
920
+ ei,
888
921
  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"));
922
+ T
923
+ ]), ni = l((e) => {
924
+ Z(), Ur(), Q(), Qr(), M(null), In(null), wn(!1), w.has(e) && (En(e), W.current = e, K.current = "element", A("element"));
892
925
  }, [
893
926
  Z,
894
- Pr,
927
+ Ur,
895
928
  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) {
929
+ Qr
930
+ ]), ri = l(() => {
931
+ Qr(), En(null), W.current = null, K.current = "view", A("view");
932
+ }, [Qr]), ii = l((e) => {
933
+ if (V.current) {
901
934
  if (K.current === "element") {
902
- let t = E.get(G.current ?? "");
935
+ let t = w.get(W.current ?? "");
903
936
  if (!t) return;
904
937
  if (t.kind === "point") {
905
- Gr(t.type, {
938
+ ei(t.type, {
906
939
  type: "Point",
907
940
  coordinates: [e.latlng.lng, e.latlng.lat]
908
941
  });
909
942
  return;
910
943
  }
911
- W.current.push(e.latlng);
912
- let n = W.current.length === 1, r = T.default.circleMarker(e.latlng, {
944
+ U.current.push(e.latlng);
945
+ let n = U.current.length === 1, r = C.default.circleMarker(e.latlng, {
913
946
  radius: n ? 7 : 5,
914
947
  color: "#fff",
915
948
  weight: 2,
916
949
  fillColor: t.color,
917
950
  fillOpacity: 1
918
- }).addTo(Yn.current);
951
+ }).addTo(ir.current);
919
952
  n && t.kind === "polygon" && r.on("click", (e) => {
920
- T.default.DomEvent.stopPropagation(e), Kr();
921
- }), vn(W.current.length), Wr();
953
+ C.default.DomEvent.stopPropagation(e), ti();
954
+ }), On(U.current.length), $r();
922
955
  return;
923
956
  }
924
957
  if (K.current === "draw") {
925
- Zn.current.push(e.latlng);
926
- let t = Zn.current.length === 1, n = T.default.circleMarker(e.latlng, {
958
+ G.current.push(e.latlng);
959
+ let t = G.current.length === 1, n = C.default.circleMarker(e.latlng, {
927
960
  radius: t ? 7 : 5,
928
961
  color: "#fff",
929
962
  weight: 2,
930
963
  fillColor: t ? "#16a34a" : "#f59e0b",
931
964
  fillOpacity: 1
932
- }).addTo(Wn.current);
965
+ }).addTo(H.current);
933
966
  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());
967
+ C.default.DomEvent.stopPropagation(e), zr();
968
+ }), Yt(G.current.length), Rr();
969
+ } else K.current === "measure" && (lr.current.push(e.latlng), Yr());
937
970
  }
938
971
  }, [
939
- jr,
940
- Br,
941
- Ar,
942
- Gr,
943
- Kr,
944
- Wr
945
- ]), Xr = u(async (n) => {
972
+ zr,
973
+ Yr,
974
+ Rr,
975
+ ei,
976
+ ti,
977
+ $r
978
+ ]), ai = l(async (n) => {
946
979
  n.preventDefault();
947
- let r = U.current, i = Pt.trim();
980
+ let r = V.current, i = Wt.trim();
948
981
  if (!r || !i) return;
949
982
  let a = i.match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
950
983
  if (a) {
951
- r.flyTo([Number(a[1]), Number(a[2])], ot, { duration: .6 });
984
+ r.flyTo([Number(a[1]), Number(a[2])], ft, { duration: .6 });
952
985
  return;
953
986
  }
954
- Lt(!0);
987
+ qt(!0);
955
988
  try {
956
989
  let n = await t(i);
957
990
  if (!n) {
958
- D({
991
+ T({
959
992
  title: e("healthybowl.fieldMapPage.toast.placeNotFound.title", "Place not found"),
960
993
  description: e("healthybowl.fieldMapPage.toast.placeNotFound.description", "Try a more specific place name."),
961
994
  variant: "warning"
962
995
  });
963
996
  return;
964
997
  }
965
- r.flyTo([n.latitude, n.longitude], ot, { duration: .6 });
998
+ r.flyTo([n.latitude, n.longitude], ft, { duration: .6 });
966
999
  } catch (t) {
967
- D({
1000
+ T({
968
1001
  title: e("healthybowl.fieldMapPage.toast.searchFailed.title", "Search failed"),
969
1002
  description: t instanceof Error ? t.message : String(t),
970
1003
  variant: "error"
971
1004
  });
972
1005
  } finally {
973
- Lt(!1);
1006
+ qt(!1);
974
1007
  }
975
1008
  }, [
976
- Pt,
1009
+ Wt,
977
1010
  e,
978
- D
979
- ]), Zr = u(async () => {
980
- if (H) {
981
- if (!Mn.trim()) {
982
- D({
1011
+ T
1012
+ ]), oi = l(async () => {
1013
+ if (B) {
1014
+ if (!Hn.trim()) {
1015
+ T({
983
1016
  title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
984
1017
  description: e("healthybowl.fieldMapPage.toast.nameRequired.description", "Give the new field a name."),
985
1018
  variant: "warning"
986
1019
  });
987
1020
  return;
988
1021
  }
989
- jn(!0);
1022
+ Vn(!0);
990
1023
  try {
991
- let [t, n] = H.centroid, r = await Pe({
992
- name: Mn.trim(),
993
- area: H.area,
1024
+ let [t, n] = B.centroid, r = await S({
1025
+ name: Hn.trim(),
1026
+ area: B.area,
994
1027
  unit: "acres",
995
- soilType: Pn,
996
- irrigationType: In,
1028
+ soilType: Wn,
1029
+ irrigationType: Kn,
997
1030
  organicCertified: !1,
998
- status: Rn,
1031
+ status: Jn,
999
1032
  crops: [],
1000
1033
  location: {
1001
1034
  lat: t,
1002
1035
  lng: n
1003
1036
  }
1004
1037
  });
1005
- r?.id && await k({ variables: { input: {
1038
+ r?.id && await D({ variables: { input: {
1006
1039
  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({
1040
+ boundary: B.boundary,
1041
+ area: B.area,
1042
+ context: { workspaceId: s }
1043
+ } } }), await _(), zn(null), r?.id && M(r.id), T({
1011
1044
  title: e("healthybowl.fieldMapPage.toast.fieldCreated.title", "Field created"),
1012
1045
  description: e("healthybowl.fieldMapPage.toast.fieldCreated.description", "{{name}} saved at {{area}} acres.", {
1013
- name: Mn.trim(),
1014
- area: String(H.area)
1046
+ name: Hn.trim(),
1047
+ area: String(B.area)
1015
1048
  }),
1016
1049
  variant: "success"
1017
1050
  });
1018
1051
  } catch (t) {
1019
- D({
1052
+ T({
1020
1053
  title: e("healthybowl.fieldMapPage.toast.createFailed.title", "Create failed"),
1021
1054
  description: String(t),
1022
1055
  variant: "error"
1023
1056
  });
1024
1057
  } finally {
1025
- jn(!1);
1058
+ Vn(!1);
1026
1059
  }
1027
1060
  }
1028
1061
  }, [
1029
- Pe,
1030
- In,
1031
- Mn,
1032
- Pn,
1033
- Rn,
1034
- H,
1035
- v,
1062
+ S,
1063
+ Kn,
1064
+ Hn,
1065
+ Wn,
1066
+ Jn,
1067
+ B,
1068
+ _,
1036
1069
  e,
1070
+ T,
1037
1071
  D,
1038
- k,
1039
- c
1040
- ]), Qr = u(async () => {
1041
- if (!B) return;
1042
- if (!bn.trim()) {
1043
- D({
1072
+ s
1073
+ ]), si = l(async () => {
1074
+ if (!R) return;
1075
+ if (!An.trim()) {
1076
+ T({
1044
1077
  title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
1045
1078
  description: e("healthybowl.fieldMapPage.elements.nameRequired", "Give this map element a name."),
1046
1079
  variant: "warning"
1047
1080
  });
1048
1081
  return;
1049
1082
  }
1050
- let t = E.get(B.type);
1051
- Tn(!0);
1083
+ let t = w.get(R.type);
1084
+ Fn(!0);
1052
1085
  try {
1053
- await St({ variables: { input: {
1054
- name: bn.trim(),
1055
- type: B.type,
1056
- geometry: B.geometry,
1057
- notes: Sn.trim() || void 0,
1086
+ await Mt({ variables: { input: {
1087
+ name: An.trim(),
1088
+ type: R.type,
1089
+ geometry: R.geometry,
1090
+ notes: Mn.trim() || void 0,
1058
1091
  color: t?.color,
1059
- context: { workspaceId: c }
1060
- } } }), await br(), yn(null), D({
1092
+ context: { workspaceId: s }
1093
+ } } }), await Or(), kn(null), T({
1061
1094
  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() }),
1095
+ description: e("healthybowl.fieldMapPage.elements.saved.description", "{{name}} saved to the map.", { name: An.trim() }),
1063
1096
  variant: "success"
1064
1097
  });
1065
1098
  } catch (t) {
1066
- D({
1099
+ T({
1067
1100
  title: e("healthybowl.fieldMapPage.elements.saveFailed.title", "Could not add element"),
1068
1101
  description: String(t),
1069
1102
  variant: "error"
1070
1103
  });
1071
1104
  } finally {
1072
- Tn(!1);
1105
+ Fn(!1);
1073
1106
  }
1074
1107
  }, [
1075
- St,
1076
- bn,
1077
- Sn,
1078
- B,
1079
- br,
1108
+ Mt,
1109
+ An,
1110
+ Mn,
1111
+ R,
1112
+ Or,
1080
1113
  e,
1081
- D,
1082
- c
1083
- ]), $r = u(async () => {
1084
- if (V && await h({
1114
+ T,
1115
+ s
1116
+ ]), ci = l(async () => {
1117
+ if (z && await m({
1085
1118
  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 }),
1119
+ message: e("healthybowl.fieldMapPage.elements.deleteConfirm.description", "This removes {{name}} from the map. This cannot be undone.", { name: z.name }),
1087
1120
  okButtonTitle: e("healthybowl.common.delete", "Delete")
1088
1121
  })) {
1089
- On(!0);
1122
+ Rn(!0);
1090
1123
  try {
1091
- await Ct({ variables: {
1092
- id: V.id,
1093
- context: { workspaceId: c }
1094
- } }), await br(), En(null), D({
1124
+ await Nt({ variables: {
1125
+ id: z.id,
1126
+ context: { workspaceId: s }
1127
+ } }), await Or(), In(null), T({
1095
1128
  title: e("healthybowl.fieldMapPage.elements.deleted.title", "Map element removed"),
1096
1129
  description: e("healthybowl.fieldMapPage.elements.deleted.description", "The element was deleted."),
1097
1130
  variant: "success"
1098
1131
  });
1099
1132
  } catch (t) {
1100
- D({
1133
+ T({
1101
1134
  title: e("healthybowl.fieldMapPage.elements.deleteFailed.title", "Could not delete element"),
1102
1135
  description: String(t),
1103
1136
  variant: "error"
1104
1137
  });
1105
1138
  } finally {
1106
- On(!1);
1139
+ Rn(!1);
1107
1140
  }
1108
1141
  }
1109
1142
  }, [
1110
- h,
1111
- Ct,
1112
- br,
1113
- V,
1143
+ m,
1144
+ Nt,
1145
+ Or,
1146
+ z,
1114
1147
  e,
1115
- D,
1116
- c
1148
+ T,
1149
+ s
1117
1150
  ]);
1118
- d(() => {
1119
- let e = Bn.current;
1151
+ u(() => {
1152
+ let e = Xn.current;
1120
1153
  if (!e) return;
1121
- te();
1122
- let t = T.default.tileLayer(tt, {
1123
- attribution: nt,
1124
- maxZoom: at,
1154
+ ie();
1155
+ let t = C.default.tileLayer(st, {
1156
+ attribution: ct,
1157
+ maxZoom: dt,
1125
1158
  maxNativeZoom: 18
1126
- }), n = T.default.tileLayer(rt, {
1127
- attribution: it,
1128
- maxZoom: at,
1159
+ }), n = C.default.tileLayer(lt, {
1160
+ attribution: ut,
1161
+ maxZoom: dt,
1129
1162
  maxNativeZoom: 17,
1130
1163
  opacity: .65
1131
1164
  });
1132
- Vn.current = t, Hn.current = n;
1133
- let r = T.default.map(e, {
1165
+ Zn.current = t, Qn.current = n;
1166
+ let r = C.default.map(e, {
1134
1167
  center: [20, 78],
1135
1168
  zoom: 4,
1136
1169
  scrollWheelZoom: !0,
1137
- maxZoom: at,
1170
+ maxZoom: dt,
1138
1171
  layers: [t]
1139
1172
  });
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;
1173
+ return V.current = r, $n.current = C.default.layerGroup().addTo(r), nr.current = C.default.layerGroup().addTo(r), rr.current = C.default.layerGroup().addTo(r), H.current = C.default.layerGroup().addTo(r), er.current = C.default.layerGroup().addTo(r), tr.current = C.default.layerGroup().addTo(r), ir.current = C.default.layerGroup().addTo(r), r.on("click", ii), Pt("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
1174
+ r.off("click", ii), r.remove(), V.current = null, Zn.current = null, Qn.current = null, $n.current = null, nr.current = null, rr.current = null, H.current = null, er.current = null, tr.current = null, ir.current = null;
1142
1175
  };
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, {
1176
+ }, []), u(() => {
1177
+ let e = V.current, t = Qn.current;
1178
+ !e || !t || (Ft ? t.addTo(e) : e.removeLayer(t));
1179
+ }, [Ft]);
1180
+ let li = R ? w.get(R.type) ?? null : null, $ = z ? w.get(z.type) ?? null : null, ui = !Ie.crops && h.length === 0, di = P ? P.distance >= 1e3 ? `${(P.distance / 1e3).toFixed(2)} km` : `${P.distance.toFixed(0)} m` : "";
1181
+ if (Re.crops && h.length === 0) return /* @__PURE__ */ v(i, {
1149
1182
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
1150
1183
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1151
1184
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1152
- children: /* @__PURE__ */ y(i, { onRetry: v })
1185
+ children: /* @__PURE__ */ v(o, { onRetry: _ })
1153
1186
  });
1154
- let ri = (e, t, n, r) => /* @__PURE__ */ b("button", {
1187
+ if (!Ie.dashboard && !Ot) return /* @__PURE__ */ v(i, {
1188
+ title: e("healthybowl.fieldMapPage.title", "Field Map"),
1189
+ titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1190
+ description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1191
+ children: /* @__PURE__ */ v(a, {
1192
+ illustration: "onboarding",
1193
+ title: e("healthybowl.fieldMapPage.noFarm.title", "Set up your farm first"),
1194
+ 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."),
1195
+ action: /* @__PURE__ */ y(b, {
1196
+ onClick: () => Et(Dt("getting-started")),
1197
+ children: [
1198
+ /* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
1199
+ " ",
1200
+ e("healthybowl.fieldMapPage.noFarm.action", "Set up your farm")
1201
+ ]
1202
+ })
1203
+ })
1204
+ });
1205
+ let fi = (e, t, n, r) => /* @__PURE__ */ y("button", {
1155
1206
  type: "button",
1156
1207
  onClick: t,
1157
1208
  "aria-pressed": e,
1158
1209
  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
1210
  children: [n, r]
1160
1211
  });
1161
- return /* @__PURE__ */ b(r, {
1212
+ return /* @__PURE__ */ y(i, {
1162
1213
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
1163
1214
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1164
1215
  hero: !0,
1165
1216
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1166
1217
  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
1218
  children: [
1168
- /* @__PURE__ */ b("div", {
1219
+ /* @__PURE__ */ y("div", {
1169
1220
  className: "flex flex-col gap-4 lg:flex-row",
1170
- children: [/* @__PURE__ */ b("div", {
1221
+ children: [/* @__PURE__ */ y("div", {
1171
1222
  className: "min-w-0 flex-1 space-y-3",
1172
1223
  children: [
1173
- /* @__PURE__ */ b("form", {
1224
+ /* @__PURE__ */ y("form", {
1174
1225
  className: "flex gap-2",
1175
- onSubmit: Xr,
1176
- children: [/* @__PURE__ */ b("div", {
1226
+ onSubmit: ai,
1227
+ children: [/* @__PURE__ */ y("div", {
1177
1228
  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", {
1229
+ 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
1230
  type: "search",
1180
- value: Pt,
1181
- onChange: (e) => Ft(e.target.value),
1231
+ value: Wt,
1232
+ onChange: (e) => Gt(e.target.value),
1182
1233
  placeholder: e("healthybowl.fieldMapPage.placeSearch.placeholder", "Find your farm — village, city, or lat,lng…"),
1183
1234
  "aria-label": e("healthybowl.fieldMapPage.placeSearch.label", "Locate a place on the map"),
1184
1235
  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
1236
  })]
1186
- }), /* @__PURE__ */ b(x, {
1237
+ }), /* @__PURE__ */ y(b, {
1187
1238
  type: "submit",
1188
1239
  variant: "outline",
1189
1240
  size: "sm",
1190
- disabled: A !== "ready" || It,
1241
+ disabled: O !== "ready" || Kt,
1191
1242
  children: [
1192
- /* @__PURE__ */ y(Se, { className: "h-4 w-4" }),
1243
+ /* @__PURE__ */ v(Te, { className: "h-4 w-4" }),
1193
1244
  " ",
1194
- It ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
1245
+ Kt ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
1195
1246
  ]
1196
1247
  })]
1197
1248
  }),
1198
- /* @__PURE__ */ b("div", {
1249
+ /* @__PURE__ */ y("div", {
1199
1250
  className: "relative",
1200
1251
  children: [
1201
- /* @__PURE__ */ y("div", {
1202
- ref: Bn,
1252
+ /* @__PURE__ */ v("div", {
1253
+ ref: Xn,
1203
1254
  className: "h-[70vh] max-h-[640px] w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken"
1204
1255
  }),
1205
- A === "ready" && /* @__PURE__ */ b("div", {
1256
+ O === "ready" && /* @__PURE__ */ y("div", {
1206
1257
  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
1258
  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"))
1259
+ fi(k === "draw", () => k === "draw" ? Vr() : Br(), /* @__PURE__ */ v(De, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
1260
+ fi(k === "edit", () => k === "edit" ? Kr() : Gr(), /* @__PURE__ */ v(Ne, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
1261
+ fi(!1, Jr, /* @__PURE__ */ v(Fe, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
1262
+ fi(k === "measure", () => k === "measure" ? Zr() : Xr(), /* @__PURE__ */ v(ke, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure")),
1263
+ fi(k === "element" || Cn, () => {
1264
+ k === "element" ? (ri(), wn(!1)) : wn((e) => !e);
1265
+ }, /* @__PURE__ */ v(Me, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.elements", "Elements"))
1215
1266
  ]
1216
1267
  }),
1217
- A === "ready" && pn && j !== "element" && /* @__PURE__ */ b("div", {
1268
+ O === "ready" && Cn && k !== "element" && /* @__PURE__ */ y("div", {
1218
1269
  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", {
1270
+ children: [/* @__PURE__ */ v("p", {
1220
1271
  className: "px-1.5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-text-secondary",
1221
1272
  children: e("healthybowl.fieldMapPage.elements.menuTitle", "Add map element")
1222
- }), Xe.map((t) => {
1273
+ }), nt.map((t) => {
1223
1274
  let n = t.icon;
1224
- return /* @__PURE__ */ b("button", {
1275
+ return /* @__PURE__ */ y("button", {
1225
1276
  type: "button",
1226
- onClick: () => qr(t.type),
1277
+ onClick: () => ni(t.type),
1227
1278
  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
1279
  children: [
1229
- /* @__PURE__ */ y(n, {
1280
+ /* @__PURE__ */ v(n, {
1230
1281
  className: "h-4 w-4 shrink-0",
1231
1282
  style: { color: t.color }
1232
1283
  }),
1233
- /* @__PURE__ */ y("span", {
1284
+ /* @__PURE__ */ v("span", {
1234
1285
  className: "min-w-0 flex-1 truncate",
1235
1286
  children: e(t.labelKey, t.label)
1236
1287
  }),
1237
- /* @__PURE__ */ y("span", {
1288
+ /* @__PURE__ */ v("span", {
1238
1289
  className: "shrink-0 text-[10px] uppercase tracking-wide text-text-secondary",
1239
- children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`, Ze(t.kind))
1290
+ children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`, rt(t.kind))
1240
1291
  })
1241
1292
  ]
1242
1293
  }, t.type);
1243
1294
  })]
1244
1295
  }),
1245
- j === "draw" && /* @__PURE__ */ b("div", {
1296
+ k === "draw" && /* @__PURE__ */ y("div", {
1246
1297
  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
1298
  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, {
1299
+ /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(Jt) }) }),
1300
+ /* @__PURE__ */ y(b, {
1301
+ size: "sm",
1302
+ variant: "outline",
1303
+ onClick: Hr,
1304
+ disabled: Jt === 0,
1305
+ title: e("healthybowl.fieldMapPage.undoCorner", "Undo last corner"),
1306
+ children: [
1307
+ /* @__PURE__ */ v(Le, { className: "h-3.5 w-3.5" }),
1308
+ " ",
1309
+ e("healthybowl.fieldMapPage.undo", "Undo")
1310
+ ]
1311
+ }),
1312
+ /* @__PURE__ */ y(b, {
1250
1313
  size: "sm",
1251
1314
  variant: "default",
1252
- onClick: jr,
1315
+ onClick: zr,
1253
1316
  children: [
1254
- /* @__PURE__ */ y(ye, { className: "h-3.5 w-3.5" }),
1317
+ /* @__PURE__ */ v(Se, { className: "h-3.5 w-3.5" }),
1255
1318
  " ",
1256
1319
  e("healthybowl.fieldMapPage.finish", "Finish")
1257
1320
  ]
1258
1321
  }),
1259
- /* @__PURE__ */ y(x, {
1322
+ /* @__PURE__ */ v(b, {
1260
1323
  size: "sm",
1261
1324
  variant: "outline",
1262
- onClick: Nr,
1263
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1325
+ onClick: Vr,
1326
+ children: /* @__PURE__ */ v(ze, { className: "h-3.5 w-3.5" })
1264
1327
  })
1265
1328
  ]
1266
1329
  }),
1267
- j === "edit" && /* @__PURE__ */ b("div", {
1330
+ k === "edit" && /* @__PURE__ */ y("div", {
1268
1331
  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
1332
  children: [
1270
- /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
1271
- area: String(Bt ?? ""),
1333
+ /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
1334
+ area: String(Xt ?? ""),
1272
1335
  unit: q?.unit ?? "acres"
1273
1336
  }) }),
1274
- /* @__PURE__ */ b(x, {
1337
+ /* @__PURE__ */ y(b, {
1275
1338
  size: "sm",
1276
1339
  variant: "default",
1277
- onClick: Rr,
1278
- disabled: !Ht || Wt,
1340
+ onClick: qr,
1341
+ disabled: !Qt || en,
1279
1342
  children: [
1280
- /* @__PURE__ */ y(De, { className: "h-3.5 w-3.5" }),
1343
+ /* @__PURE__ */ v(Ae, { className: "h-3.5 w-3.5" }),
1281
1344
  " ",
1282
- Wt ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
1345
+ en ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
1283
1346
  ]
1284
1347
  }),
1285
- /* @__PURE__ */ y(x, {
1348
+ /* @__PURE__ */ v(b, {
1286
1349
  size: "sm",
1287
1350
  variant: "outline",
1288
- onClick: Lr,
1289
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1351
+ onClick: Kr,
1352
+ children: /* @__PURE__ */ v(ze, { className: "h-3.5 w-3.5" })
1290
1353
  })
1291
1354
  ]
1292
1355
  }),
1293
- j === "measure" && I && /* @__PURE__ */ b("div", {
1356
+ k === "measure" && P && /* @__PURE__ */ y("div", {
1294
1357
  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
1358
  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, {
1359
+ /* @__PURE__ */ y("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: di }), P.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (P.area / 4046.8564224).toFixed(2) })}`] }),
1360
+ /* @__PURE__ */ v(b, {
1298
1361
  size: "sm",
1299
1362
  variant: "outline",
1300
1363
  onClick: Q,
1301
1364
  children: e("healthybowl.fieldMapPage.measure.reset", "Reset")
1302
1365
  }),
1303
- /* @__PURE__ */ y(x, {
1366
+ /* @__PURE__ */ v(b, {
1304
1367
  size: "sm",
1305
1368
  variant: "outline",
1306
- onClick: Hr,
1307
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1369
+ onClick: Zr,
1370
+ children: /* @__PURE__ */ v(ze, { className: "h-3.5 w-3.5" })
1308
1371
  })
1309
1372
  ]
1310
1373
  }),
1311
- j === "element" && Sr && /* @__PURE__ */ b("div", {
1374
+ k === "element" && Ar && /* @__PURE__ */ y("div", {
1312
1375
  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
1376
  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, {
1377
+ /* @__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(Dn) }) : e("healthybowl.fieldMapPage.elements.hint.polygon", "Click to add corners ({{count}}) — click the first point or Finish.", { count: String(Dn) }) }),
1378
+ Ar.kind !== "point" && /* @__PURE__ */ y(b, {
1316
1379
  size: "sm",
1317
1380
  variant: "default",
1318
- onClick: Kr,
1381
+ onClick: ti,
1319
1382
  children: [
1320
- /* @__PURE__ */ y(ye, { className: "h-3.5 w-3.5" }),
1383
+ /* @__PURE__ */ v(Se, { className: "h-3.5 w-3.5" }),
1321
1384
  " ",
1322
1385
  e("healthybowl.fieldMapPage.finish", "Finish")
1323
1386
  ]
1324
1387
  }),
1325
- /* @__PURE__ */ y(x, {
1388
+ /* @__PURE__ */ v(b, {
1326
1389
  size: "sm",
1327
1390
  variant: "outline",
1328
- onClick: Jr,
1329
- children: /* @__PURE__ */ y(Fe, { className: "h-3.5 w-3.5" })
1391
+ onClick: ri,
1392
+ children: /* @__PURE__ */ v(ze, { className: "h-3.5 w-3.5" })
1330
1393
  })
1331
1394
  ]
1332
1395
  }),
1333
- A === "ready" && /* @__PURE__ */ b("div", {
1396
+ O === "ready" && /* @__PURE__ */ y("div", {
1334
1397
  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
1398
  children: [
1336
- /* @__PURE__ */ b("div", {
1399
+ /* @__PURE__ */ y("div", {
1337
1400
  className: "mb-1.5 flex items-center gap-1.5 font-semibold text-text-primary",
1338
1401
  children: [
1339
- /* @__PURE__ */ y(be, { className: "h-3.5 w-3.5" }),
1402
+ /* @__PURE__ */ v(Ce, { className: "h-3.5 w-3.5" }),
1340
1403
  " ",
1341
1404
  e("healthybowl.fieldMapPage.layers.title", "Layers")
1342
1405
  ]
1343
1406
  }),
1344
- /* @__PURE__ */ b("label", {
1407
+ /* @__PURE__ */ y("label", {
1345
1408
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1346
- children: [/* @__PURE__ */ y("input", {
1409
+ children: [/* @__PURE__ */ v("input", {
1347
1410
  type: "checkbox",
1348
1411
  checked: !0,
1349
1412
  readOnly: !0,
1350
1413
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1351
1414
  }), e("healthybowl.fieldMapPage.layers.satellite", "Satellite")]
1352
1415
  }),
1353
- /* @__PURE__ */ b("label", {
1416
+ /* @__PURE__ */ y("label", {
1354
1417
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1355
- children: [/* @__PURE__ */ y("input", {
1418
+ children: [/* @__PURE__ */ v("input", {
1356
1419
  type: "checkbox",
1357
- checked: Tt,
1358
- onChange: (e) => Et(e.target.checked),
1420
+ checked: Ft,
1421
+ onChange: (e) => It(e.target.checked),
1359
1422
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1360
1423
  }), e("healthybowl.fieldMapPage.layers.terrain", "Terrain")]
1361
1424
  }),
1362
- /* @__PURE__ */ b("label", {
1425
+ /* @__PURE__ */ y("label", {
1363
1426
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1364
- children: [/* @__PURE__ */ y("input", {
1427
+ children: [/* @__PURE__ */ v("input", {
1365
1428
  type: "checkbox",
1366
- checked: Dt,
1367
- onChange: (e) => Ot(e.target.checked),
1429
+ checked: Lt,
1430
+ onChange: (e) => Rt(e.target.checked),
1368
1431
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1369
1432
  }), e("healthybowl.fieldMapPage.layers.soil", "Soil type")]
1370
1433
  }),
1371
- /* @__PURE__ */ b("label", {
1434
+ /* @__PURE__ */ y("label", {
1372
1435
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1373
- children: [/* @__PURE__ */ y("input", {
1436
+ children: [/* @__PURE__ */ v("input", {
1374
1437
  type: "checkbox",
1375
- checked: kt,
1376
- onChange: (e) => At(e.target.checked),
1438
+ checked: zt,
1439
+ onChange: (e) => Bt(e.target.checked),
1377
1440
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1378
1441
  }), e("healthybowl.fieldMapPage.layers.elevation", "Elevation")]
1379
1442
  }),
1380
- /* @__PURE__ */ b("label", {
1443
+ /* @__PURE__ */ y("label", {
1381
1444
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1382
- children: [/* @__PURE__ */ y("input", {
1445
+ children: [/* @__PURE__ */ v("input", {
1383
1446
  type: "checkbox",
1384
- checked: dn,
1385
- onChange: (e) => fn(e.target.checked),
1447
+ checked: xn,
1448
+ onChange: (e) => Sn(e.target.checked),
1386
1449
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1387
1450
  }), e("healthybowl.fieldMapPage.layers.elements", "Map elements")]
1388
1451
  }),
1389
- dn && /* @__PURE__ */ b("div", {
1452
+ xn && /* @__PURE__ */ y("div", {
1390
1453
  className: "mt-1.5 max-h-40 overflow-y-auto border-t border-border-subtle pt-1.5",
1391
- children: [/* @__PURE__ */ y("div", {
1454
+ children: [/* @__PURE__ */ v("div", {
1392
1455
  className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-text-secondary",
1393
1456
  children: e("healthybowl.fieldMapPage.elements.legendTitle", "Element types")
1394
- }), Xe.map((t) => {
1457
+ }), nt.map((t) => {
1395
1458
  let n = t.icon;
1396
- return /* @__PURE__ */ b("div", {
1459
+ return /* @__PURE__ */ y("div", {
1397
1460
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1398
1461
  children: [
1399
- /* @__PURE__ */ y("span", {
1462
+ /* @__PURE__ */ v("span", {
1400
1463
  className: `inline-block shrink-0 ${t.kind === "line" ? "h-0.5 w-3.5 rounded-full" : "h-3 w-3 rounded-sm"}`,
1401
1464
  style: { backgroundColor: t.color }
1402
1465
  }),
1403
- /* @__PURE__ */ y(n, {
1466
+ /* @__PURE__ */ v(n, {
1404
1467
  className: "h-3 w-3 shrink-0",
1405
1468
  style: { color: t.color }
1406
1469
  }),
@@ -1411,71 +1474,71 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1411
1474
  })
1412
1475
  ]
1413
1476
  }),
1414
- A === "ready" && kt && /* @__PURE__ */ b("div", {
1477
+ O === "ready" && zt && /* @__PURE__ */ y("div", {
1415
1478
  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", {
1479
+ children: [/* @__PURE__ */ v("div", {
1417
1480
  className: "mb-1.5 font-semibold text-text-primary",
1418
1481
  children: e("healthybowl.fieldMapPage.elevationLegend.title", "Elevation")
1419
- }), ur ? /* @__PURE__ */ b(Ie, { children: [/* @__PURE__ */ y("span", {
1482
+ }), vr ? /* @__PURE__ */ y(Ve, { children: [/* @__PURE__ */ v("span", {
1420
1483
  className: "block h-2 w-40 rounded-full",
1421
1484
  style: { background: "linear-gradient(to right, #16a34a, #f59e0b, #dc2626)" }
1422
- }), /* @__PURE__ */ b("div", {
1485
+ }), /* @__PURE__ */ y("div", {
1423
1486
  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", {
1487
+ 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)) }) })]
1488
+ })] }) : /* @__PURE__ */ v("span", {
1426
1489
  className: "text-text-secondary",
1427
1490
  children: e("healthybowl.fieldMapPage.elevationLegend.loading", "Loading elevation…")
1428
1491
  })]
1429
1492
  }),
1430
- A === "ready" && Dt && !kt && ar.length > 0 && /* @__PURE__ */ b("div", {
1493
+ O === "ready" && Lt && !zt && pr.length > 0 && /* @__PURE__ */ y("div", {
1431
1494
  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", {
1495
+ children: [/* @__PURE__ */ v("div", {
1433
1496
  className: "mb-1.5 font-semibold text-text-primary",
1434
1497
  children: e("healthybowl.fieldMapPage.soilLegend.title", "Soil Legend")
1435
- }), ar.map((t) => /* @__PURE__ */ b("div", {
1498
+ }), pr.map((t) => /* @__PURE__ */ y("div", {
1436
1499
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1437
- children: [/* @__PURE__ */ y("span", {
1500
+ children: [/* @__PURE__ */ v("span", {
1438
1501
  className: "inline-block h-3 w-3 rounded-sm",
1439
1502
  style: { backgroundColor: t.color }
1440
1503
  }), e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)]
1441
1504
  }, t.key))]
1442
1505
  }),
1443
- A === "ready" && Tt && /* @__PURE__ */ b("div", {
1506
+ O === "ready" && Ft && /* @__PURE__ */ y("div", {
1444
1507
  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", {
1508
+ children: [/* @__PURE__ */ v("div", {
1446
1509
  className: "font-semibold text-text-primary",
1447
1510
  children: e("healthybowl.fieldMapPage.terrainLegend.title", "Terrain / Elevation")
1448
- }), /* @__PURE__ */ b("div", {
1511
+ }), /* @__PURE__ */ y("div", {
1449
1512
  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)") })]
1513
+ 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
1514
  })]
1452
1515
  }),
1453
- (A === "loading" || je.crops && g.length === 0) && /* @__PURE__ */ y("div", {
1516
+ (O === "loading" || Ie.crops && h.length === 0) && /* @__PURE__ */ v("div", {
1454
1517
  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
1518
  children: e("healthybowl.fieldMapPage.loading", "Loading map…")
1456
1519
  }),
1457
- ti && A === "ready" && j === "view" && /* @__PURE__ */ y("div", {
1520
+ ui && O === "ready" && k === "view" && /* @__PURE__ */ v("div", {
1458
1521
  className: "absolute inset-0 z-[950] flex items-center justify-center p-6",
1459
- children: /* @__PURE__ */ b("div", {
1522
+ children: /* @__PURE__ */ y("div", {
1460
1523
  className: "max-w-sm rounded-xl border border-border-subtle bg-bg-surface/95 p-6 text-center shadow-lg",
1461
1524
  children: [
1462
- /* @__PURE__ */ y("div", {
1525
+ /* @__PURE__ */ v("div", {
1463
1526
  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" })
1527
+ children: /* @__PURE__ */ v(Ee, { className: "h-6 w-6 text-success" })
1465
1528
  }),
1466
- /* @__PURE__ */ y("h3", {
1529
+ /* @__PURE__ */ v("h3", {
1467
1530
  className: "text-lg font-semibold text-text-primary",
1468
1531
  children: e("healthybowl.fieldMapPage.empty.title", "No field boundaries yet")
1469
1532
  }),
1470
- /* @__PURE__ */ y("p", {
1533
+ /* @__PURE__ */ v("p", {
1471
1534
  className: "mt-1 text-sm text-text-secondary",
1472
1535
  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
1536
  }),
1474
- /* @__PURE__ */ b(x, {
1537
+ /* @__PURE__ */ y(b, {
1475
1538
  className: "mt-4",
1476
- onClick: Mr,
1539
+ onClick: Br,
1477
1540
  children: [
1478
- /* @__PURE__ */ y(Te, { className: "h-4 w-4" }),
1541
+ /* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
1479
1542
  " ",
1480
1543
  e("healthybowl.fieldMapPage.empty.action", "Draw Your First Field")
1481
1544
  ]
@@ -1485,108 +1548,108 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1485
1548
  })
1486
1549
  ]
1487
1550
  }),
1488
- /* @__PURE__ */ y("p", {
1551
+ /* @__PURE__ */ v("p", {
1489
1552
  className: "text-xs text-text-secondary",
1490
1553
  children: e("healthybowl.fieldMapPage.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · terrain © OpenTopoMap / OpenStreetMap")
1491
1554
  })
1492
1555
  ]
1493
- }), /* @__PURE__ */ b("aside", {
1556
+ }), /* @__PURE__ */ y("aside", {
1494
1557
  className: "shrink-0 space-y-4 lg:w-80",
1495
1558
  children: [
1496
- /* @__PURE__ */ b("div", {
1559
+ /* @__PURE__ */ y("div", {
1497
1560
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1498
1561
  children: [
1499
- /* @__PURE__ */ y("h2", {
1562
+ /* @__PURE__ */ v("h2", {
1500
1563
  className: "text-base font-semibold text-text-primary",
1501
1564
  children: e("healthybowl.fieldMapPage.panel.title", "Fields")
1502
1565
  }),
1503
- /* @__PURE__ */ y("p", {
1566
+ /* @__PURE__ */ v("p", {
1504
1567
  className: "mt-0.5 text-xs text-text-secondary",
1505
1568
  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)
1569
+ acres: fr.toFixed(1),
1570
+ count: String(h.length),
1571
+ mapped: String(dr)
1509
1572
  })
1510
1573
  }),
1511
- /* @__PURE__ */ b("div", {
1574
+ /* @__PURE__ */ y("div", {
1512
1575
  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", {
1576
+ 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
1577
  type: "search",
1515
- value: Mt,
1516
- onChange: (e) => Nt(e.target.value),
1578
+ value: Ht,
1579
+ onChange: (e) => Ut(e.target.value),
1517
1580
  placeholder: e("healthybowl.fieldMapPage.panel.search", "Search fields…"),
1518
1581
  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
1582
  })]
1520
1583
  }),
1521
- /* @__PURE__ */ b("div", {
1584
+ /* @__PURE__ */ y("div", {
1522
1585
  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", {
1586
+ children: [mr.map((t) => {
1587
+ let n = E(t) !== null;
1588
+ return /* @__PURE__ */ y("button", {
1526
1589
  type: "button",
1527
1590
  "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"}`,
1591
+ onClick: () => Ir(t),
1592
+ 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
1593
  children: [
1531
- /* @__PURE__ */ y("span", {
1594
+ /* @__PURE__ */ v("span", {
1532
1595
  className: "mt-0.5 inline-block h-4 w-4 shrink-0 rounded",
1533
- style: { backgroundColor: ce(t.soilType) }
1596
+ style: { backgroundColor: de(t.soilType) }
1534
1597
  }),
1535
- /* @__PURE__ */ b("span", {
1598
+ /* @__PURE__ */ y("span", {
1536
1599
  className: "min-w-0 flex-1",
1537
- children: [/* @__PURE__ */ y("span", {
1600
+ children: [/* @__PURE__ */ v("span", {
1538
1601
  className: "block truncate text-sm font-medium text-text-primary",
1539
1602
  children: t.name
1540
- }), /* @__PURE__ */ b("span", {
1603
+ }), /* @__PURE__ */ y("span", {
1541
1604
  className: "block truncate text-xs text-text-secondary",
1542
1605
  children: [
1543
- _t(t),
1606
+ Ct(t),
1544
1607
  " ·",
1545
1608
  " ",
1546
1609
  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])) })}`
1610
+ N[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[t.id])) })}`
1548
1611
  ]
1549
1612
  })]
1550
1613
  }),
1551
- !n && /* @__PURE__ */ y("span", {
1614
+ !n && /* @__PURE__ */ v("span", {
1552
1615
  className: "shrink-0 rounded-full bg-warning/20 px-1.5 py-0.5 text-[10px] font-medium text-warning",
1553
1616
  children: e("healthybowl.fieldMapPage.unmapped", "no boundary")
1554
1617
  })
1555
1618
  ]
1556
1619
  }, t.id);
1557
- }), or.length === 0 && /* @__PURE__ */ y("p", {
1620
+ }), mr.length === 0 && /* @__PURE__ */ v("p", {
1558
1621
  className: "px-2 py-4 text-center text-xs text-text-secondary",
1559
1622
  children: e("healthybowl.fieldMapPage.panel.none", "No fields match your search.")
1560
1623
  })]
1561
1624
  }),
1562
- /* @__PURE__ */ b(x, {
1625
+ /* @__PURE__ */ y(b, {
1563
1626
  className: "mt-3 w-full",
1564
- onClick: Mr,
1565
- disabled: j === "draw",
1627
+ onClick: Br,
1628
+ disabled: k === "draw",
1566
1629
  children: [
1567
- /* @__PURE__ */ y(Te, { className: "h-4 w-4" }),
1630
+ /* @__PURE__ */ v(Oe, { className: "h-4 w-4" }),
1568
1631
  " ",
1569
1632
  e("healthybowl.fieldMapPage.panel.drawNew", "Draw New Field")
1570
1633
  ]
1571
1634
  })
1572
1635
  ]
1573
1636
  }),
1574
- q && /* @__PURE__ */ b("div", {
1637
+ q && /* @__PURE__ */ y("div", {
1575
1638
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1576
1639
  children: [
1577
- /* @__PURE__ */ y("h3", {
1640
+ /* @__PURE__ */ v("h3", {
1578
1641
  className: "text-sm font-semibold text-text-primary",
1579
1642
  children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: q.name })
1580
1643
  }),
1581
- /* @__PURE__ */ b("dl", {
1644
+ /* @__PURE__ */ y("dl", {
1582
1645
  className: "mt-3 space-y-2 text-sm",
1583
1646
  children: [
1584
- /* @__PURE__ */ b("div", {
1647
+ /* @__PURE__ */ y("div", {
1585
1648
  className: "flex justify-between gap-3",
1586
- children: [/* @__PURE__ */ y("dt", {
1649
+ children: [/* @__PURE__ */ v("dt", {
1587
1650
  className: "text-text-secondary",
1588
1651
  children: e("healthybowl.fieldMapPage.detail.area", "Area")
1589
- }), /* @__PURE__ */ b("dd", {
1652
+ }), /* @__PURE__ */ y("dd", {
1590
1653
  className: "font-medium text-text-primary",
1591
1654
  children: [
1592
1655
  q.area,
@@ -1595,78 +1658,78 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1595
1658
  ]
1596
1659
  })]
1597
1660
  }),
1598
- /* @__PURE__ */ b("div", {
1661
+ /* @__PURE__ */ y("div", {
1599
1662
  className: "flex justify-between gap-3",
1600
- children: [/* @__PURE__ */ y("dt", {
1663
+ children: [/* @__PURE__ */ v("dt", {
1601
1664
  className: "text-text-secondary",
1602
1665
  children: e("healthybowl.fieldMapPage.detail.elevation", "Elevation")
1603
- }), /* @__PURE__ */ y("dd", {
1666
+ }), /* @__PURE__ */ v("dd", {
1604
1667
  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])) })
1668
+ children: N[q.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[q.id])) })
1606
1669
  })]
1607
1670
  }),
1608
- /* @__PURE__ */ b("div", {
1671
+ /* @__PURE__ */ y("div", {
1609
1672
  className: "flex justify-between gap-3",
1610
- children: [/* @__PURE__ */ y("dt", {
1673
+ children: [/* @__PURE__ */ v("dt", {
1611
1674
  className: "text-text-secondary",
1612
1675
  children: e("healthybowl.fieldMapPage.detail.soil", "Soil")
1613
- }), /* @__PURE__ */ y("dd", {
1676
+ }), /* @__PURE__ */ v("dd", {
1614
1677
  className: "font-medium text-text-primary",
1615
1678
  children: q.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
1616
1679
  })]
1617
1680
  }),
1618
- /* @__PURE__ */ b("div", {
1681
+ /* @__PURE__ */ y("div", {
1619
1682
  className: "flex justify-between gap-3",
1620
- children: [/* @__PURE__ */ y("dt", {
1683
+ children: [/* @__PURE__ */ v("dt", {
1621
1684
  className: "text-text-secondary",
1622
1685
  children: e("healthybowl.fieldMapPage.detail.irrigation", "Irrigation")
1623
- }), /* @__PURE__ */ y("dd", {
1686
+ }), /* @__PURE__ */ v("dd", {
1624
1687
  className: "font-medium text-text-primary",
1625
1688
  children: q.irrigationType || "—"
1626
1689
  })]
1627
1690
  }),
1628
- /* @__PURE__ */ b("div", {
1691
+ /* @__PURE__ */ y("div", {
1629
1692
  className: "flex justify-between gap-3",
1630
- children: [/* @__PURE__ */ y("dt", {
1693
+ children: [/* @__PURE__ */ v("dt", {
1631
1694
  className: "text-text-secondary",
1632
1695
  children: e("healthybowl.fieldMapPage.detail.crop", "Crop")
1633
- }), /* @__PURE__ */ y("dd", {
1696
+ }), /* @__PURE__ */ v("dd", {
1634
1697
  className: "font-medium text-text-primary",
1635
- children: dr(q) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
1698
+ children: yr(q) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
1636
1699
  })]
1637
1700
  }),
1638
- /* @__PURE__ */ b("div", {
1701
+ /* @__PURE__ */ y("div", {
1639
1702
  className: "flex justify-between gap-3",
1640
- children: [/* @__PURE__ */ y("dt", {
1703
+ children: [/* @__PURE__ */ v("dt", {
1641
1704
  className: "text-text-secondary",
1642
1705
  children: e("healthybowl.fieldMapPage.detail.status", "Status")
1643
- }), /* @__PURE__ */ y("dd", {
1706
+ }), /* @__PURE__ */ v("dd", {
1644
1707
  className: "font-medium capitalize text-text-primary",
1645
1708
  children: q.status
1646
1709
  })]
1647
1710
  })
1648
1711
  ]
1649
1712
  }),
1650
- /* @__PURE__ */ b("div", {
1713
+ /* @__PURE__ */ y("div", {
1651
1714
  className: "mt-3 flex gap-2",
1652
- children: [/* @__PURE__ */ b(x, {
1715
+ children: [/* @__PURE__ */ y(b, {
1653
1716
  variant: "outline",
1654
1717
  size: "sm",
1655
1718
  className: "flex-1",
1656
- onClick: () => Dr(q),
1719
+ onClick: () => Fr(q),
1657
1720
  children: [
1658
- /* @__PURE__ */ y(Ce, { className: "h-4 w-4" }),
1721
+ /* @__PURE__ */ v(Ee, { className: "h-4 w-4" }),
1659
1722
  " ",
1660
1723
  e("healthybowl.fieldMapPage.detail.flyTo", "Fly to")
1661
1724
  ]
1662
- }), O(q) && /* @__PURE__ */ b(x, {
1725
+ }), E(q) && /* @__PURE__ */ y(b, {
1663
1726
  variant: "outline",
1664
1727
  size: "sm",
1665
1728
  className: "flex-1",
1666
- onClick: Ir,
1667
- disabled: j === "edit",
1729
+ onClick: Gr,
1730
+ disabled: k === "edit",
1668
1731
  children: [
1669
- /* @__PURE__ */ y(Ae, { className: "h-4 w-4" }),
1732
+ /* @__PURE__ */ v(Ne, { className: "h-4 w-4" }),
1670
1733
  " ",
1671
1734
  e("healthybowl.fieldMapPage.detail.edit", "Edit")
1672
1735
  ]
@@ -1674,97 +1737,97 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1674
1737
  })
1675
1738
  ]
1676
1739
  }),
1677
- q && fr && /* @__PURE__ */ b("div", {
1740
+ q && br && /* @__PURE__ */ y("div", {
1678
1741
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1679
1742
  children: [
1680
- /* @__PURE__ */ b("div", {
1743
+ /* @__PURE__ */ y("div", {
1681
1744
  className: "flex items-center justify-between gap-2",
1682
- children: [/* @__PURE__ */ b("h3", {
1745
+ children: [/* @__PURE__ */ y("h3", {
1683
1746
  className: "flex items-center gap-1.5 text-sm font-semibold text-text-primary",
1684
1747
  children: [
1685
- /* @__PURE__ */ y(xe, { className: "h-4 w-4" }),
1748
+ /* @__PURE__ */ v(we, { className: "h-4 w-4" }),
1686
1749
  " ",
1687
1750
  e("healthybowl.fieldMapPage.beds.title", "Bed layout")
1688
1751
  ]
1689
- }), /* @__PURE__ */ b("label", {
1752
+ }), /* @__PURE__ */ y("label", {
1690
1753
  className: "flex cursor-pointer items-center gap-2 text-xs font-medium text-text-primary",
1691
- children: [/* @__PURE__ */ y("input", {
1754
+ children: [/* @__PURE__ */ v("input", {
1692
1755
  type: "checkbox",
1693
- checked: qt,
1694
- onChange: (e) => Jt(e.target.checked),
1756
+ checked: rn,
1757
+ onChange: (e) => an(e.target.checked),
1695
1758
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1696
1759
  }), e("healthybowl.fieldMapPage.beds.show", "Show beds")]
1697
1760
  })]
1698
1761
  }),
1699
- /* @__PURE__ */ y("p", {
1762
+ /* @__PURE__ */ v("p", {
1700
1763
  className: "mt-1 text-xs text-text-secondary",
1701
1764
  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
1765
  }),
1703
- /* @__PURE__ */ b("div", {
1766
+ /* @__PURE__ */ y("div", {
1704
1767
  className: "mt-3 grid grid-cols-2 gap-3",
1705
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1768
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1706
1769
  className: "text-xs font-medium text-text-primary",
1707
1770
  children: e("healthybowl.fieldMapPage.beds.bedWidth", "Bed width (m)")
1708
- }), /* @__PURE__ */ y("input", {
1771
+ }), /* @__PURE__ */ v("input", {
1709
1772
  type: "number",
1710
1773
  min: .2,
1711
1774
  step: .1,
1712
- value: L,
1713
- onChange: (e) => Yt(Math.max(.2, Number(e.target.value) || 0)),
1775
+ value: F,
1776
+ onChange: (e) => on(Math.max(.2, Number(e.target.value) || 0)),
1714
1777
  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", {
1778
+ })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1716
1779
  className: "text-xs font-medium text-text-primary",
1717
1780
  children: e("healthybowl.fieldMapPage.beds.pathWidth", "Path width (m)")
1718
- }), /* @__PURE__ */ y("input", {
1781
+ }), /* @__PURE__ */ v("input", {
1719
1782
  type: "number",
1720
1783
  min: 0,
1721
1784
  step: .05,
1722
- value: Xt,
1723
- onChange: (e) => Zt(Math.max(0, Number(e.target.value) || 0)),
1785
+ value: sn,
1786
+ onChange: (e) => cn(Math.max(0, Number(e.target.value) || 0)),
1724
1787
  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
1788
  })] })]
1726
1789
  }),
1727
- /* @__PURE__ */ b("div", {
1790
+ /* @__PURE__ */ y("div", {
1728
1791
  className: "mt-3",
1729
- children: [/* @__PURE__ */ b("div", {
1792
+ children: [/* @__PURE__ */ y("div", {
1730
1793
  className: "flex items-center justify-between",
1731
- children: [/* @__PURE__ */ y("label", {
1794
+ children: [/* @__PURE__ */ v("label", {
1732
1795
  className: "text-xs font-medium text-text-primary",
1733
1796
  children: e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
1734
- }), /* @__PURE__ */ b("span", {
1797
+ }), /* @__PURE__ */ y("span", {
1735
1798
  className: "text-xs text-text-secondary",
1736
- children: [R, "°"]
1799
+ children: [I, "°"]
1737
1800
  })]
1738
- }), /* @__PURE__ */ y("input", {
1801
+ }), /* @__PURE__ */ v("input", {
1739
1802
  type: "range",
1740
1803
  min: 0,
1741
1804
  max: 180,
1742
1805
  step: 1,
1743
- value: R,
1744
- onChange: (e) => Qt(Number(e.target.value)),
1806
+ value: I,
1807
+ onChange: (e) => ln(Number(e.target.value)),
1745
1808
  className: "mt-1 w-full accent-[var(--color-success)]",
1746
1809
  "aria-label": e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
1747
1810
  })]
1748
1811
  }),
1749
- _.length > 0 && /* @__PURE__ */ b("div", {
1812
+ g.length > 0 && /* @__PURE__ */ y("div", {
1750
1813
  className: "mt-3",
1751
1814
  children: [
1752
- /* @__PURE__ */ y("label", {
1815
+ /* @__PURE__ */ v("label", {
1753
1816
  className: "text-xs font-medium text-text-primary",
1754
1817
  children: e("healthybowl.fieldMapPage.beds.crop", "Spacing for crop")
1755
1818
  }),
1756
- /* @__PURE__ */ b(Le, {
1757
- value: mr?.id ?? "",
1758
- onValueChange: en,
1759
- children: [/* @__PURE__ */ y(ze, {
1819
+ /* @__PURE__ */ y(He, {
1820
+ value: Sr?.id ?? "",
1821
+ onValueChange: dn,
1822
+ children: [/* @__PURE__ */ v(We, {
1760
1823
  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, {
1824
+ children: /* @__PURE__ */ v(Ge, { placeholder: e("healthybowl.fieldMapPage.beds.cropPlaceholder", "Standard spacing") })
1825
+ }), /* @__PURE__ */ v(Ue, { children: g.map((e) => /* @__PURE__ */ v(x, {
1763
1826
  value: e.id,
1764
1827
  children: e.name
1765
1828
  }, e.id)) })]
1766
1829
  }),
1767
- /* @__PURE__ */ y("p", {
1830
+ /* @__PURE__ */ v("p", {
1768
1831
  className: "mt-1 text-[11px] text-text-secondary",
1769
1832
  children: e("healthybowl.fieldMapPage.beds.spacingLine", "{{preset}} · {{plant}}×{{row}} cm", {
1770
1833
  preset: J.label,
@@ -1774,156 +1837,166 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1774
1837
  })
1775
1838
  ]
1776
1839
  }),
1777
- Y && /* @__PURE__ */ b("div", {
1840
+ Y && /* @__PURE__ */ y("div", {
1778
1841
  className: "mt-3 rounded-md bg-warning/10 px-3 py-2 text-sm font-medium text-text-primary",
1779
1842
  children: [e("healthybowl.fieldMapPage.beds.readout", "{{beds}} beds · ~{{plants}} plants", {
1780
1843
  beds: String(Y.bedCount),
1781
- plants: hr.toLocaleString()
1782
- }), /* @__PURE__ */ y("span", {
1844
+ plants: Cr.toLocaleString()
1845
+ }), /* @__PURE__ */ v("span", {
1783
1846
  className: "ml-1 text-xs font-normal text-text-secondary",
1784
1847
  children: e("healthybowl.fieldMapPage.beds.previewTag", "(preview)")
1785
1848
  })]
1786
1849
  }),
1787
- X.length > 0 && /* @__PURE__ */ b("div", {
1850
+ X.length > 0 && /* @__PURE__ */ y("div", {
1788
1851
  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) })]
1852
+ 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(X.length) })]
1790
1853
  }),
1791
- _r && X.length === 0 && /* @__PURE__ */ y("p", {
1854
+ Tr && X.length === 0 && /* @__PURE__ */ v("p", {
1792
1855
  className: "mt-2 text-xs text-text-secondary",
1793
1856
  children: e("healthybowl.fieldMapPage.beds.loadingSaved", "Loading saved beds…")
1794
1857
  }),
1795
- /* @__PURE__ */ b("div", {
1858
+ /* @__PURE__ */ y("div", {
1796
1859
  className: "mt-3 flex gap-2",
1797
- children: [/* @__PURE__ */ b(x, {
1860
+ children: [/* @__PURE__ */ y(b, {
1798
1861
  size: "sm",
1799
1862
  className: "flex-1",
1800
- onClick: wr,
1801
- disabled: !Y || Y.beds.length === 0 || tn,
1863
+ onClick: Mr,
1864
+ disabled: !Y || Y.beds.length === 0 || fn,
1802
1865
  children: [
1803
- /* @__PURE__ */ y(De, { className: "h-4 w-4" }),
1866
+ /* @__PURE__ */ v(Ae, { className: "h-4 w-4" }),
1804
1867
  " ",
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")
1868
+ fn ? e("healthybowl.fieldMapPage.beds.saving", "Saving…") : X.length > 0 ? e("healthybowl.fieldMapPage.beds.resave", "Save layout (replace)") : e("healthybowl.fieldMapPage.beds.save", "Save layout")
1806
1869
  ]
1807
- }), X.length > 0 && /* @__PURE__ */ b(x, {
1870
+ }), X.length > 0 && /* @__PURE__ */ y(b, {
1808
1871
  variant: "outline",
1809
1872
  size: "sm",
1810
- onClick: Tr,
1811
- disabled: rn,
1873
+ onClick: Nr,
1874
+ disabled: mn,
1812
1875
  children: [
1813
- /* @__PURE__ */ y(Me, { className: "h-4 w-4" }),
1876
+ /* @__PURE__ */ v(Fe, { className: "h-4 w-4" }),
1814
1877
  " ",
1815
- rn ? e("healthybowl.fieldMapPage.beds.clearing", "Clearing…") : e("healthybowl.fieldMapPage.beds.clear", "Clear")
1878
+ mn ? e("healthybowl.fieldMapPage.beds.clearing", "Clearing…") : e("healthybowl.fieldMapPage.beds.clear", "Clear")
1816
1879
  ]
1817
1880
  })]
1818
1881
  }),
1819
- Y && Y.bedCount > Qe && /* @__PURE__ */ y("p", {
1882
+ Y && Y.bedCount > it && /* @__PURE__ */ v("p", {
1820
1883
  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) })
1884
+ children: e("healthybowl.fieldMapPage.beds.capHint", "Over the {{max}}-bed save limit — widen the beds to save this layout.", { max: String(it) })
1822
1885
  })
1823
1886
  ]
1824
1887
  })
1825
1888
  ]
1826
1889
  })]
1827
1890
  }),
1828
- /* @__PURE__ */ y(s, {
1829
- open: H !== null,
1830
- onClose: () => kn(null),
1891
+ /* @__PURE__ */ v(ne, {
1892
+ open: B !== null,
1893
+ onClose: () => zn(null),
1831
1894
  title: e("healthybowl.fieldMapPage.create.title", "Save New Field"),
1832
1895
  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, {
1896
+ footer: /* @__PURE__ */ y(Ve, { children: [/* @__PURE__ */ v(b, {
1834
1897
  variant: "outline",
1835
- onClick: () => kn(null),
1898
+ onClick: () => zn(null),
1836
1899
  className: "text-text-secondary",
1837
1900
  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")
1901
+ }), /* @__PURE__ */ v(b, {
1902
+ onClick: oi,
1903
+ disabled: Bn,
1904
+ children: Bn ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
1842
1905
  })] }),
1843
- children: /* @__PURE__ */ b("div", {
1906
+ children: /* @__PURE__ */ y("div", {
1844
1907
  className: "space-y-4",
1845
1908
  children: [
1846
- /* @__PURE__ */ y("div", {
1909
+ /* @__PURE__ */ v("div", {
1847
1910
  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) })
1911
+ children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(B?.area ?? 0) })
1849
1912
  }),
1850
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1913
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1851
1914
  className: "text-sm font-medium text-text-primary",
1852
1915
  children: e("healthybowl.fieldMapPage.create.name", "Field name *")
1853
- }), /* @__PURE__ */ y("input", {
1916
+ }), /* @__PURE__ */ v("input", {
1854
1917
  type: "text",
1855
- value: Mn,
1856
- onChange: (e) => Nn(e.target.value),
1918
+ value: Hn,
1919
+ onChange: (e) => Un(e.target.value),
1857
1920
  placeholder: e("healthybowl.fieldMapPage.create.namePlaceholder", "e.g., North Paddy"),
1858
1921
  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
1922
  })] }),
1860
- /* @__PURE__ */ b("div", {
1923
+ /* @__PURE__ */ y("div", {
1861
1924
  className: "grid grid-cols-2 gap-3",
1862
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1863
- className: "text-sm font-medium text-text-primary",
1864
- children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
1865
- }), /* @__PURE__ */ b(Le, {
1866
- value: Pn,
1867
- onValueChange: Fn,
1868
- children: [/* @__PURE__ */ y(ze, {
1869
- className: "mt-1 w-full",
1870
- children: /* @__PURE__ */ y(Be, {})
1871
- }), /* @__PURE__ */ y(Re, { children: se.map((t) => /* @__PURE__ */ y(S, {
1872
- value: t.label,
1873
- children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
1874
- }, t.key)) })]
1875
- })] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1925
+ children: [/* @__PURE__ */ y("div", { children: [
1926
+ /* @__PURE__ */ v("label", {
1927
+ className: "text-sm font-medium text-text-primary",
1928
+ children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
1929
+ }),
1930
+ /* @__PURE__ */ y(He, {
1931
+ value: Wn,
1932
+ onValueChange: Gn,
1933
+ children: [/* @__PURE__ */ v(We, {
1934
+ className: "mt-1 w-full",
1935
+ children: /* @__PURE__ */ v(Ge, {})
1936
+ }), /* @__PURE__ */ v(Ue, { children: ue.map((t) => /* @__PURE__ */ v(x, {
1937
+ value: t.label,
1938
+ children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
1939
+ }, t.key)) })]
1940
+ }),
1941
+ /* @__PURE__ */ y("p", {
1942
+ className: "mt-1 flex items-center gap-1.5 text-xs text-text-secondary",
1943
+ children: [/* @__PURE__ */ v("span", {
1944
+ className: "inline-block h-3 w-3 shrink-0 rounded-sm border border-border-subtle",
1945
+ style: { backgroundColor: de(Wn) }
1946
+ }), e("healthybowl.fieldMapPage.create.soilHint", "The map shades each field by its soil type — pick the right one so fields stand apart.")]
1947
+ })
1948
+ ] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1876
1949
  className: "text-sm font-medium text-text-primary",
1877
1950
  children: e("healthybowl.fieldMapPage.create.irrigation", "Irrigation")
1878
- }), /* @__PURE__ */ b(Le, {
1879
- value: In,
1880
- onValueChange: Ln,
1881
- children: [/* @__PURE__ */ y(ze, {
1951
+ }), /* @__PURE__ */ y(He, {
1952
+ value: Kn,
1953
+ onValueChange: qn,
1954
+ children: [/* @__PURE__ */ v(We, {
1882
1955
  className: "mt-1 w-full",
1883
- children: /* @__PURE__ */ y(Be, {})
1884
- }), /* @__PURE__ */ b(Re, { children: [
1885
- /* @__PURE__ */ y(S, {
1956
+ children: /* @__PURE__ */ v(Ge, {})
1957
+ }), /* @__PURE__ */ y(Ue, { children: [
1958
+ /* @__PURE__ */ v(x, {
1886
1959
  value: "Drip",
1887
1960
  children: e("healthybowl.fieldMapPage.irrigation.drip", "Drip")
1888
1961
  }),
1889
- /* @__PURE__ */ y(S, {
1962
+ /* @__PURE__ */ v(x, {
1890
1963
  value: "Sprinkler",
1891
1964
  children: e("healthybowl.fieldMapPage.irrigation.sprinkler", "Sprinkler")
1892
1965
  }),
1893
- /* @__PURE__ */ y(S, {
1966
+ /* @__PURE__ */ v(x, {
1894
1967
  value: "Flood",
1895
1968
  children: e("healthybowl.fieldMapPage.irrigation.flood", "Flood")
1896
1969
  }),
1897
- /* @__PURE__ */ y(S, {
1970
+ /* @__PURE__ */ v(x, {
1898
1971
  value: "Rainfed",
1899
1972
  children: e("healthybowl.fieldMapPage.irrigation.rainfed", "Rainfed")
1900
1973
  }),
1901
- /* @__PURE__ */ y(S, {
1974
+ /* @__PURE__ */ v(x, {
1902
1975
  value: "None",
1903
1976
  children: e("healthybowl.fieldMapPage.irrigation.none", "None")
1904
1977
  })
1905
1978
  ] })]
1906
1979
  })] })]
1907
1980
  }),
1908
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1981
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1909
1982
  className: "text-sm font-medium text-text-primary",
1910
1983
  children: e("healthybowl.fieldMapPage.create.status", "Status")
1911
- }), /* @__PURE__ */ b(Le, {
1912
- value: Rn,
1913
- onValueChange: zn,
1914
- children: [/* @__PURE__ */ y(ze, {
1984
+ }), /* @__PURE__ */ y(He, {
1985
+ value: Jn,
1986
+ onValueChange: Yn,
1987
+ children: [/* @__PURE__ */ v(We, {
1915
1988
  className: "mt-1 w-full",
1916
- children: /* @__PURE__ */ y(Be, {})
1917
- }), /* @__PURE__ */ b(Re, { children: [
1918
- /* @__PURE__ */ y(S, {
1989
+ children: /* @__PURE__ */ v(Ge, {})
1990
+ }), /* @__PURE__ */ y(Ue, { children: [
1991
+ /* @__PURE__ */ v(x, {
1919
1992
  value: "active",
1920
1993
  children: e("healthybowl.fieldMapPage.status.active", "Active")
1921
1994
  }),
1922
- /* @__PURE__ */ y(S, {
1995
+ /* @__PURE__ */ v(x, {
1923
1996
  value: "preparation",
1924
1997
  children: e("healthybowl.fieldMapPage.status.preparation", "Preparation")
1925
1998
  }),
1926
- /* @__PURE__ */ y(S, {
1999
+ /* @__PURE__ */ v(x, {
1927
2000
  value: "fallow",
1928
2001
  children: e("healthybowl.fieldMapPage.status.fallow", "Fallow")
1929
2002
  })
@@ -1932,39 +2005,39 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1932
2005
  ]
1933
2006
  })
1934
2007
  }),
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 ?? "" }),
2008
+ /* @__PURE__ */ v(ne, {
2009
+ open: L !== null,
2010
+ onClose: () => gn(null),
2011
+ title: e("healthybowl.fieldMapPage.beds.assign.title", "Assign crop to {{bed}}", { bed: L?.name ?? "" }),
1939
2012
  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, {
2013
+ footer: /* @__PURE__ */ y(Ve, { children: [/* @__PURE__ */ v(b, {
1941
2014
  variant: "outline",
1942
- onClick: () => on(null),
2015
+ onClick: () => gn(null),
1943
2016
  className: "text-text-secondary",
1944
2017
  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")
2018
+ }), /* @__PURE__ */ v(b, {
2019
+ onClick: Pr,
2020
+ disabled: yn,
2021
+ children: yn ? e("healthybowl.fieldMapPage.beds.assign.saving", "Saving…") : e("healthybowl.fieldMapPage.beds.assign.action", "Assign")
1949
2022
  })] }),
1950
- children: /* @__PURE__ */ b("div", {
2023
+ children: /* @__PURE__ */ y("div", {
1951
2024
  className: "space-y-3",
1952
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2025
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1953
2026
  className: "text-sm font-medium text-text-primary",
1954
2027
  children: e("healthybowl.fieldMapPage.beds.assign.crop", "Crop")
1955
- }), /* @__PURE__ */ b(Le, {
1956
- value: sn,
1957
- onValueChange: cn,
1958
- children: [/* @__PURE__ */ y(ze, {
2028
+ }), /* @__PURE__ */ y(He, {
2029
+ value: _n,
2030
+ onValueChange: vn,
2031
+ children: [/* @__PURE__ */ v(We, {
1959
2032
  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, {
2033
+ children: /* @__PURE__ */ v(Ge, { placeholder: e("healthybowl.fieldMapPage.beds.assign.none", "No crop") })
2034
+ }), /* @__PURE__ */ v(Ue, { children: g.map((e) => /* @__PURE__ */ v(x, {
1962
2035
  value: e.id,
1963
2036
  children: e.name
1964
2037
  }, e.id)) })]
1965
2038
  })] }), (() => {
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", {
2039
+ let t = be(g.find((e) => e.id === _n) ?? null), n = L ? ae(L.boundary) : null, r = he(L?.area ?? (n ? c(n) : 0), L?.widthM ?? F, t.plantSpacingCm, t.rowSpacingCm);
2040
+ return /* @__PURE__ */ v("div", {
1968
2041
  className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
1969
2042
  children: e("healthybowl.fieldMapPage.beds.assign.preview", "{{preset}} · {{plant}}×{{row}} cm · ~{{plants}} plants", {
1970
2043
  preset: t.label,
@@ -1976,47 +2049,47 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1976
2049
  })()]
1977
2050
  })
1978
2051
  }),
1979
- /* @__PURE__ */ y(s, {
1980
- open: B !== null,
1981
- onClose: () => yn(null),
2052
+ /* @__PURE__ */ v(ne, {
2053
+ open: R !== null,
2054
+ onClose: () => kn(null),
1982
2055
  title: e("healthybowl.fieldMapPage.elements.save.title", "Save map element"),
1983
2056
  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, {
2057
+ footer: /* @__PURE__ */ y(Ve, { children: [/* @__PURE__ */ v(b, {
1985
2058
  variant: "outline",
1986
- onClick: () => yn(null),
2059
+ onClick: () => kn(null),
1987
2060
  className: "text-text-secondary",
1988
2061
  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")
2062
+ }), /* @__PURE__ */ v(b, {
2063
+ onClick: si,
2064
+ disabled: Pn,
2065
+ children: Pn ? e("healthybowl.fieldMapPage.elements.save.saving", "Saving…") : e("healthybowl.fieldMapPage.elements.save.action", "Save element")
1993
2066
  })] }),
1994
- children: /* @__PURE__ */ b("div", {
2067
+ children: /* @__PURE__ */ y("div", {
1995
2068
  className: "space-y-4",
1996
2069
  children: [
1997
- ei && /* @__PURE__ */ b("div", {
2070
+ li && /* @__PURE__ */ y("div", {
1998
2071
  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, {
2072
+ children: [/* @__PURE__ */ v(li.icon, {
2000
2073
  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) })]
2074
+ style: { color: li.color }
2075
+ }), e("healthybowl.fieldMapPage.elements.save.typeLine", "Type: {{type}}", { type: e(li.labelKey, li.label) })]
2003
2076
  }),
2004
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2077
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
2005
2078
  className: "text-sm font-medium text-text-primary",
2006
2079
  children: e("healthybowl.fieldMapPage.elements.save.name", "Name *")
2007
- }), /* @__PURE__ */ y("input", {
2080
+ }), /* @__PURE__ */ v("input", {
2008
2081
  type: "text",
2009
- value: bn,
2010
- onChange: (e) => xn(e.target.value),
2082
+ value: An,
2083
+ onChange: (e) => jn(e.target.value),
2011
2084
  placeholder: e("healthybowl.fieldMapPage.elements.save.namePlaceholder", "e.g., North buffer strip"),
2012
2085
  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
2086
  })] }),
2014
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2087
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
2015
2088
  className: "text-sm font-medium text-text-primary",
2016
2089
  children: e("healthybowl.fieldMapPage.elements.save.notes", "Notes")
2017
- }), /* @__PURE__ */ y("textarea", {
2018
- value: Sn,
2019
- onChange: (e) => Cn(e.target.value),
2090
+ }), /* @__PURE__ */ v("textarea", {
2091
+ value: Mn,
2092
+ onChange: (e) => Nn(e.target.value),
2020
2093
  rows: 3,
2021
2094
  placeholder: e("healthybowl.fieldMapPage.elements.save.notesPlaceholder", "Optional details…"),
2022
2095
  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 +2097,57 @@ var tt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
2024
2097
  ]
2025
2098
  })
2026
2099
  }),
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, {
2100
+ /* @__PURE__ */ v(ne, {
2101
+ open: z !== null,
2102
+ onClose: () => In(null),
2103
+ title: z?.name ?? e("healthybowl.fieldMapPage.elements.detail.title", "Map element"),
2104
+ description: $ ? e($.labelKey, $.label) : z?.type ?? "",
2105
+ footer: /* @__PURE__ */ y(Ve, { children: [/* @__PURE__ */ v(b, {
2033
2106
  variant: "outline",
2034
- onClick: () => En(null),
2107
+ onClick: () => In(null),
2035
2108
  className: "text-text-secondary",
2036
2109
  children: e("healthybowl.common.close", "Close")
2037
- }), /* @__PURE__ */ b(x, {
2110
+ }), /* @__PURE__ */ y(b, {
2038
2111
  variant: "destructive",
2039
- onClick: $r,
2040
- disabled: Dn,
2112
+ onClick: ci,
2113
+ disabled: Ln,
2041
2114
  children: [
2042
- /* @__PURE__ */ y(Me, { className: "h-4 w-4" }),
2115
+ /* @__PURE__ */ v(Fe, { className: "h-4 w-4" }),
2043
2116
  " ",
2044
- Dn ? e("healthybowl.fieldMapPage.elements.detail.deleting", "Deleting…") : e("healthybowl.common.delete", "Delete")
2117
+ Ln ? e("healthybowl.fieldMapPage.elements.detail.deleting", "Deleting…") : e("healthybowl.common.delete", "Delete")
2045
2118
  ]
2046
2119
  })] }),
2047
- children: /* @__PURE__ */ b("div", {
2120
+ children: /* @__PURE__ */ y("div", {
2048
2121
  className: "space-y-3 text-sm",
2049
- children: [/* @__PURE__ */ b("div", {
2122
+ children: [/* @__PURE__ */ y("div", {
2050
2123
  className: "flex justify-between gap-3",
2051
- children: [/* @__PURE__ */ y("span", {
2124
+ children: [/* @__PURE__ */ v("span", {
2052
2125
  className: "text-text-secondary",
2053
2126
  children: e("healthybowl.fieldMapPage.elements.detail.type", "Type")
2054
- }), /* @__PURE__ */ b("span", {
2127
+ }), /* @__PURE__ */ y("span", {
2055
2128
  className: "flex items-center gap-1.5 font-medium text-text-primary",
2056
- children: [$ && /* @__PURE__ */ y($.icon, {
2129
+ children: [$ && /* @__PURE__ */ v($.icon, {
2057
2130
  className: "h-4 w-4",
2058
2131
  style: { color: $.color }
2059
- }), $ ? e($.labelKey, $.label) : V?.type]
2132
+ }), $ ? e($.labelKey, $.label) : z?.type]
2060
2133
  })]
2061
- }), V?.notes && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
2134
+ }), z?.notes && /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("span", {
2062
2135
  className: "text-text-secondary",
2063
2136
  children: e("healthybowl.fieldMapPage.elements.detail.notes", "Notes")
2064
- }), /* @__PURE__ */ y("p", {
2137
+ }), /* @__PURE__ */ v("p", {
2065
2138
  className: "mt-1 whitespace-pre-wrap text-text-primary",
2066
- children: V.notes
2139
+ children: z.notes
2067
2140
  })] })]
2068
2141
  })
2069
2142
  }),
2070
- /* @__PURE__ */ y(a, {
2071
- toasts: C,
2072
- onDismiss: ht
2143
+ /* @__PURE__ */ v(ee, {
2144
+ toasts: pt,
2145
+ onDismiss: Tt
2073
2146
  })
2074
2147
  ]
2075
2148
  });
2076
2149
  };
2077
2150
  //#endregion
2078
- export { k as FieldMapPage };
2151
+ export { Tt as FieldMapPage };
2079
2152
 
2080
2153
  //# sourceMappingURL=FieldMapPage.js.map