baselode 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/baselode.js CHANGED
@@ -1,107 +1,110 @@
1
- import W from "papaparse";
1
+ import Z from "papaparse";
2
2
  import { jsx as L, jsxs as Q } from "react/jsx-runtime";
3
- import { useRef as lt, useState as K, useEffect as ae, useMemo as ke } from "react";
4
- import Ce from "plotly.js-dist-min";
5
- import * as N from "three";
6
- import { OrbitControls as Ot } from "three/examples/jsm/controls/OrbitControls";
7
- import { FlyControls as Vt } from "three/examples/jsm/controls/FlyControls";
8
- import { ViewportGizmo as wt } from "three-viewport-gizmo";
9
- const E = "hole_id", te = "latitude", ne = "longitude", ge = "elevation", j = "azimuth", B = "dip", X = "from", G = "to", Re = "mid", se = "project_id", ce = "easting", ue = "northing", at = "crs", Y = "depth", ct = "alpha", ut = "beta", $t = "strike", hr = {
3
+ import { useRef as dt, useState as K, useEffect as ae, useMemo as Oe } from "react";
4
+ import Ee from "plotly.js-dist-min";
5
+ import * as _ from "three";
6
+ import { OrbitControls as Bt } from "three/examples/jsm/controls/OrbitControls";
7
+ import { FlyControls as Gt } from "three/examples/jsm/controls/FlyControls";
8
+ import { ViewportGizmo as Ut } from "three-viewport-gizmo";
9
+ import { EffectComposer as Yt } from "three/examples/jsm/postprocessing/EffectComposer.js";
10
+ import { RenderPass as qt } from "three/examples/jsm/postprocessing/RenderPass.js";
11
+ import { OutlinePass as Xt } from "three/examples/jsm/postprocessing/OutlinePass.js";
12
+ const v = "hole_id", te = "latitude", ne = "longitude", _e = "elevation", B = "azimuth", G = "dip", q = "from", U = "to", je = "mid", ie = "project_id", ce = "easting", ue = "northing", mt = "crs", Y = "depth", ft = "alpha", ht = "beta", Wt = "strike", Rr = {
10
13
  // A unique hole identifier across the entire dataset and all future data sets
11
- [E]: "string",
14
+ [v]: "string",
12
15
  // The hole ID from the original collar source
13
16
  datasource_hole_id: "string",
14
17
  // The project ID or project code from the original collar source, if available
15
- [se]: "string",
18
+ [ie]: "string",
16
19
  // The latitude of the collar, in decimal degrees (WGS84)
17
20
  [te]: "number",
18
21
  // The longitude of the collar, in decimal degrees (WGS84)
19
22
  [ne]: "number",
20
23
  // The elevation of the collar, in meters above sea level (WGS84)
21
- [ge]: "number",
24
+ [_e]: "number",
22
25
  // The easting coordinate of the collar, in meters (projected CRS)
23
26
  [ce]: "number",
24
27
  // The northing coordinate of the collar, in meters (projected CRS)
25
28
  [ue]: "number",
26
29
  // The coordinate reference system of the collar coordinates for easting/northing, as an EPSG code or proj string
27
- [at]: "string"
28
- }, pr = {
30
+ [mt]: "string"
31
+ }, Br = {
29
32
  // The unique hole id that maps to the collar and any other data tables
30
- [E]: "string",
33
+ [v]: "string",
31
34
  // The depth along the hole where the survey measurement was taken / started
32
35
  [Y]: "number",
33
36
  // The depth along the hole where the survey measurement ended, if applicable (some surveys are point measurements and may not have a 'to' depth)
34
- [G]: "number",
37
+ [U]: "number",
35
38
  // The azimuth of the hole at the survey depth, in degrees from north
36
- [j]: "number",
39
+ [B]: "number",
37
40
  // The dip of the hole at the survey depth, in degrees from horizontal (negative values indicate downward inclination)
38
- [B]: "number"
39
- }, br = {
41
+ [G]: "number"
42
+ }, Gr = {
40
43
  // The unique hole id that maps to the collar and any other data tables
41
- [E]: "string",
44
+ [v]: "string",
42
45
  // The depth along the hole where the assay interval starts
43
- [X]: "number",
46
+ [q]: "number",
44
47
  // The depth along the hole where the assay interval ends
45
- [G]: "number",
48
+ [U]: "number",
46
49
  // The midpoint depth of the assay interval
47
- [Re]: "number"
50
+ [je]: "number"
48
51
  // assay value columns are variable and not standardized here.
49
52
  // Assays may be flattened (one column per assay type) or long (one row per assay type with an additional 'assay_type' column)
50
- }, yr = {
51
- [E]: "string",
53
+ }, Ur = {
54
+ [v]: "string",
52
55
  [Y]: "number",
56
+ [G]: "number",
53
57
  [B]: "number",
54
- [j]: "number",
55
- [ct]: "number",
56
- [ut]: "number",
58
+ [ft]: "number",
59
+ [ht]: "number",
57
60
  comments: "string"
58
- }, Rt = {
59
- [E]: ["hole_id", "holeid", "hole id", "hole-id"],
61
+ }, Zt = {
62
+ [v]: ["hole_id", "holeid", "hole id", "hole-id"],
60
63
  datasource_hole_id: ["datasource_hole_id", "datasourceholeid", "datasource hole id", "datasource-hole-id", "company_hole_id", "companyholeid", "company hole id", "company-hole-id"],
61
- [se]: ["project_id", "projectid", "project id", "project-id", "project_code", "projectcode", "project code", "project-code", "companyId", "company_id", "companyid", "company id", "company-id", "dataset", "project"],
64
+ [ie]: ["project_id", "projectid", "project id", "project-id", "project_code", "projectcode", "project code", "project-code", "companyId", "company_id", "companyid", "company id", "company-id", "dataset", "project"],
62
65
  [te]: ["latitude", "lat"],
63
66
  [ne]: ["longitude", "lon"],
64
- [ge]: ["elevation", "rl", "elev", "z"],
67
+ [_e]: ["elevation", "rl", "elev", "z"],
65
68
  [ce]: ["easting", "x"],
66
69
  [ue]: ["northing", "y"],
67
- [at]: ["crs", "epsg", "projection"],
68
- [X]: ["from", "depth_from", "from_depth", "samp_from", "sample_from", "sampfrom", "fromdepth"],
69
- [G]: ["to", "depth_to", "to_depth", "samp_to", "sample_to", "sampto", "todepth"],
70
- [j]: ["azimuth", "az", "dip_direction", "dipdir", "dip direction", "dipdrn", "dipdirection", "dip_dir", "computed_plane_azimuth", "calc_dipdir", "calc_dipdir_deg", "dipdrn", "dipdir_calc", "dipdirect_calc"],
71
- [B]: ["dip", "computed_plane_dip", "calc_dip", "calc_dip_deg", "dip_calc"],
72
- [ct]: ["alpha", "alpha_angle", "alpha_angle_deg", "alpha_2"],
73
- [ut]: ["beta", "beta_angle", "beta_angle_deg", "beta_2"],
70
+ [mt]: ["crs", "epsg", "projection"],
71
+ [q]: ["from", "depth_from", "from_depth", "samp_from", "sample_from", "sampfrom", "fromdepth"],
72
+ [U]: ["to", "depth_to", "to_depth", "samp_to", "sample_to", "sampto", "todepth"],
73
+ [B]: ["azimuth", "az", "dip_direction", "dipdir", "dip direction", "dipdrn", "dipdirection", "dip_dir", "computed_plane_azimuth", "calc_dipdir", "calc_dipdir_deg", "dipdrn", "dipdir_calc", "dipdirect_calc"],
74
+ [G]: ["dip", "computed_plane_dip", "calc_dip", "calc_dip_deg", "dip_calc"],
75
+ [ft]: ["alpha", "alpha_angle", "alpha_angle_deg", "alpha_2"],
76
+ [ht]: ["beta", "beta_angle", "beta_angle_deg", "beta_2"],
74
77
  [Y]: ["depth", "survey_depth", "surveydepth"],
75
- [$t]: ["strike", "str"]
76
- }, mt = {};
77
- for (const [e, t] of Object.entries(Rt))
78
+ [Wt]: ["strike", "str"]
79
+ }, pt = {};
80
+ for (const [e, t] of Object.entries(Zt))
78
81
  for (const n of t) {
79
82
  const r = n.toLowerCase().trim();
80
- mt[r] = e;
83
+ pt[r] = e;
81
84
  }
82
- function Ie(e) {
85
+ function ve(e) {
83
86
  return (e || "").toString().trim().toLowerCase().replace(/\s+/g, "_");
84
87
  }
85
88
  function pe(e, t = null, n = null) {
86
- const r = { ...mt };
89
+ const r = { ...pt };
87
90
  if (n) {
88
- for (const [s, i] of Object.entries(n))
89
- if (s != null && i != null) {
90
- const c = Ie(s), u = Ie(i);
91
+ for (const [i, s] of Object.entries(n))
92
+ if (i != null && s != null) {
93
+ const c = ve(i), u = ve(s);
91
94
  r[c] = u;
92
95
  }
93
96
  }
94
97
  const o = {};
95
- for (const [s, i] of Object.entries(e)) {
96
- const c = Ie(s), u = r[c] || c;
97
- o[u] = i;
98
+ for (const [i, s] of Object.entries(e)) {
99
+ const c = ve(i), u = r[c] || c;
100
+ o[u] = s;
98
101
  }
99
102
  return o;
100
103
  }
101
- function gr(e, t = null, n = null) {
104
+ function Yr(e, t = null, n = null) {
102
105
  return e.map((r) => pe(r, t, n));
103
106
  }
104
- const Ht = /* @__PURE__ */ new Set([
107
+ const Kt = /* @__PURE__ */ new Set([
105
108
  "hole_id",
106
109
  "holeid",
107
110
  "id",
@@ -133,87 +136,87 @@ const Ht = /* @__PURE__ */ new Set([
133
136
  "todepth",
134
137
  "comment",
135
138
  "z"
136
- ]), Ve = "[baselode:data]";
137
- function jt(e, t = "Unknown error") {
139
+ ]), we = "[baselode:data]";
140
+ function Jt(e, t = "Unknown error") {
138
141
  if (e instanceof Error) return e;
139
142
  const n = typeof e == "string" && e.trim() ? e : t;
140
143
  return new Error(n);
141
144
  }
142
145
  function w(e, t, n = "Operation failed") {
143
- const r = jt(t, n), o = new Error(`${e}: ${r.message}`);
146
+ const r = Jt(t, n), o = new Error(`${e}: ${r.message}`);
144
147
  return o.cause = r, o;
145
148
  }
146
- function _r(e, t) {
149
+ function qr(e, t) {
147
150
  if (t !== void 0) {
148
- console.warn(`${Ve} ${e}`, t);
151
+ console.warn(`${we} ${e}`, t);
149
152
  return;
150
153
  }
151
- console.warn(`${Ve} ${e}`);
154
+ console.warn(`${we} ${e}`);
152
155
  }
153
- function xr(e) {
154
- console.info(`${Ve} ${e}`);
156
+ function Xr(e) {
157
+ console.info(`${we} ${e}`);
155
158
  }
156
- const Se = (e, t = null) => pe(e, null, t);
157
- function Bt(e) {
158
- return { holeId: e[E] };
159
+ const Ce = (e, t = null) => pe(e, null, t);
160
+ function Qt(e) {
161
+ return { holeId: e[v] };
159
162
  }
160
- function dt(e, t = null) {
161
- const n = e[E], r = n !== void 0 ? `${n}`.trim() : "";
163
+ function bt(e, t = null) {
164
+ const n = e[v], r = n !== void 0 ? `${n}`.trim() : "";
162
165
  if (!r) return null;
163
- const o = e[se] || e.project || e.project_code, s = Number(e[X]), i = Number(e[G]);
164
- return !Number.isFinite(s) || !Number.isFinite(i) || i <= s ? null : {
166
+ const o = e[ie] || e.project || e.project_code, i = Number(e[q]), s = Number(e[U]);
167
+ return !Number.isFinite(i) || !Number.isFinite(s) || s <= i ? null : {
165
168
  holeId: r,
166
169
  project: o,
167
- from: s,
168
- to: i,
170
+ from: i,
171
+ to: s,
169
172
  ...e
170
173
  };
171
174
  }
172
- function ft(e, t) {
175
+ function yt(e, t) {
173
176
  var o;
174
- const n = t.sort((s, i) => s.from - i.from), r = [];
175
- return n.forEach((s) => {
176
- const { from: i, to: c, project: u, ...l } = s, a = {
177
- z: i,
178
- from: i,
177
+ const n = t.sort((i, s) => i.from - s.from), r = [];
178
+ return n.forEach((i) => {
179
+ const { from: s, to: c, project: u, ...l } = i, a = {
180
+ z: s,
181
+ from: s,
179
182
  to: c,
180
- [E]: e,
181
- [se]: u,
183
+ [v]: e,
184
+ [ie]: u,
182
185
  ...l
183
186
  };
184
187
  r.push(a), r.push({ ...a, z: c });
185
188
  }), { id: e, project: (o = n[0]) == null ? void 0 : o.project, points: r };
186
189
  }
187
- function Nr(e, t = null) {
190
+ function Wr(e, t = null) {
188
191
  return new Promise((n, r) => {
189
192
  const o = /* @__PURE__ */ new Set();
190
- W.parse(e, {
193
+ Z.parse(e, {
191
194
  header: !0,
192
195
  dynamicTyping: !0,
193
196
  skipEmptyLines: !0,
194
- step: (s) => {
195
- const c = Se(s.data, t)[E];
197
+ step: (i) => {
198
+ const c = Ce(i.data, t)[v];
196
199
  c !== void 0 && `${c}`.trim() !== "" && o.add(`${c}`.trim());
197
200
  },
198
201
  complete: () => n(Array.from(o)),
199
- error: (s) => r(w("parseAssayHoleIds", s))
202
+ error: (i) => r(w("parseAssayHoleIds", i))
200
203
  });
201
204
  });
202
205
  }
203
- function Gt(e) {
204
- return Object.entries(e || {}).some(([t, n]) => !(Ht.has(t) || n == null || typeof n == "string" && n.trim() === ""));
206
+ function en(e) {
207
+ return Object.entries(e || {}).some(([t, n]) => !(Kt.has(t) || n == null || typeof n == "string" && n.trim() === ""));
205
208
  }
206
- function Ut(e, t = null) {
209
+ function tn(e, t = null) {
207
210
  return new Promise((n, r) => {
208
211
  const o = /* @__PURE__ */ new Map();
209
- W.parse(e, {
212
+ Z.parse(e, {
210
213
  header: !0,
211
214
  dynamicTyping: !0,
212
215
  skipEmptyLines: !0,
213
- step: (s) => {
214
- const i = Se(s.data, t);
215
- if (!Gt(i)) return;
216
- const u = Bt(i).holeId;
216
+ step: (i) => {
217
+ const s = Ce(i.data, t);
218
+ if (!en(s)) return;
219
+ const u = Qt(s).holeId;
217
220
  if (u !== void 0 && `${u}`.trim() !== "") {
218
221
  const l = `${u}`.trim();
219
222
  o.has(l) || o.set(l, {
@@ -222,64 +225,64 @@ function Ut(e, t = null) {
222
225
  }
223
226
  },
224
227
  complete: () => n(Array.from(o.values())),
225
- error: (s) => r(w("parseAssayHoleIdsWithAssays", s))
228
+ error: (i) => r(w("parseAssayHoleIdsWithAssays", i))
226
229
  });
227
230
  });
228
231
  }
229
- function Yt(e, t, n = null, r = null) {
230
- return new Promise((o, s) => {
231
- const i = `${t}`.trim();
232
- if (!i) {
233
- s(w("parseAssayHole", new Error("Missing hole id")));
232
+ function nn(e, t, n = null, r = null) {
233
+ return new Promise((o, i) => {
234
+ const s = `${t}`.trim();
235
+ if (!s) {
236
+ i(w("parseAssayHole", new Error("Missing hole id")));
234
237
  return;
235
238
  }
236
239
  const c = [];
237
- W.parse(e, {
240
+ Z.parse(e, {
238
241
  header: !0,
239
242
  dynamicTyping: !0,
240
243
  skipEmptyLines: !0,
241
244
  step: (u) => {
242
- const l = Se(u.data, r), a = dt(l, r);
243
- a && `${a.holeId}`.trim() === i && c.push(a);
245
+ const l = Ce(u.data, r), a = bt(l, r);
246
+ a && `${a.holeId}`.trim() === s && c.push(a);
244
247
  },
245
248
  complete: () => {
246
249
  if (!c.length) {
247
250
  o(null);
248
251
  return;
249
252
  }
250
- const u = ft(i, c);
253
+ const u = yt(s, c);
251
254
  o(u);
252
255
  },
253
- error: (u) => s(w("parseAssayHole", u))
256
+ error: (u) => i(w("parseAssayHole", u))
254
257
  });
255
258
  });
256
259
  }
257
- function qt(e, t = null, n = null) {
260
+ function rn(e, t = null, n = null) {
258
261
  return new Promise((r, o) => {
259
- W.parse(e, {
262
+ Z.parse(e, {
260
263
  header: !0,
261
264
  dynamicTyping: !0,
262
265
  skipEmptyLines: !0,
263
- complete: (s) => {
264
- const i = /* @__PURE__ */ new Map();
265
- s.data.forEach((u) => {
266
- const l = Se(u, n), a = dt(l, n);
267
- a && (i.has(a.holeId) || i.set(a.holeId, []), i.get(a.holeId).push(a));
266
+ complete: (i) => {
267
+ const s = /* @__PURE__ */ new Map();
268
+ i.data.forEach((u) => {
269
+ const l = Ce(u, n), a = bt(l, n);
270
+ a && (s.has(a.holeId) || s.set(a.holeId, []), s.get(a.holeId).push(a));
268
271
  });
269
- const c = Array.from(i.entries()).map(([u, l]) => ft(u, l));
272
+ const c = Array.from(s.entries()).map(([u, l]) => yt(u, l));
270
273
  r({ holes: c });
271
274
  },
272
- error: (s) => o(w("parseAssaysCSV", s))
275
+ error: (i) => o(w("parseAssaysCSV", i))
273
276
  });
274
277
  });
275
278
  }
276
- function zr(e = {}) {
279
+ function Zr(e = {}) {
277
280
  const t = {};
278
281
  return Object.entries(e || {}).forEach(([n, r]) => {
279
- n && (t[Ie(n)] = r);
282
+ n && (t[ve(n)] = r);
280
283
  }), t;
281
284
  }
282
- function Mr(e = {}, t = [], n) {
285
+ function Kr(e = {}, t = [], n) {
283
286
  for (const r of t) {
284
287
  const o = e[r];
285
288
  if (o != null && `${o}`.trim() !== "")
@@ -287,16 +290,16 @@ function Mr(e = {}, t = [], n) {
287
290
  }
288
291
  return n;
289
292
  }
290
- const Xt = 4;
291
- function ht(e = [], t = "") {
293
+ const on = 4;
294
+ function gt(e = [], t = "") {
292
295
  if (!e.length) return [];
293
296
  if (!t) return e;
294
- const n = e.findIndex((s) => s === t);
297
+ const n = e.findIndex((i) => i === t);
295
298
  if (n === -1) return e;
296
- const r = e[n], o = e.filter((s, i) => i !== n);
299
+ const r = e[n], o = e.filter((i, s) => s !== n);
297
300
  return [r, ...o];
298
301
  }
299
- function Ae({
302
+ function Se({
300
303
  property: e = "",
301
304
  chartType: t = "",
302
305
  categoricalProps: n = [],
@@ -305,49 +308,49 @@ function Ae({
305
308
  } = {}) {
306
309
  return e ? r.includes(e) ? "comment" : n.includes(e) ? "categorical" : e === "dip" ? "tadpole" : !t || t === "categorical" || t === "comment" || t === "tadpole" ? o : t : t || o;
307
310
  }
308
- function pt({
311
+ function _t({
309
312
  holeIds: e = [],
310
313
  focusedHoleId: t = "",
311
- plotCount: n = Xt,
314
+ plotCount: n = on,
312
315
  defaultProp: r = "",
313
316
  categoricalProps: o = [],
314
- commentProps: s = [],
315
- numericDefaultChartType: i = "markers+line"
317
+ commentProps: i = [],
318
+ numericDefaultChartType: s = "markers+line"
316
319
  } = {}) {
317
- const c = ht(e, t);
320
+ const c = gt(e, t);
318
321
  return Array.from({ length: n }).map((u, l) => {
319
- const a = c[l] || e[l] || "", m = Ae({
322
+ const a = c[l] || e[l] || "", d = Se({
320
323
  property: r,
321
324
  chartType: "",
322
325
  categoricalProps: o,
323
- commentProps: s,
324
- numericDefaultChartType: i
326
+ commentProps: i,
327
+ numericDefaultChartType: s
325
328
  });
326
329
  return {
327
330
  holeId: a,
328
331
  property: r,
329
- chartType: m
332
+ chartType: d
330
333
  };
331
334
  });
332
335
  }
333
- const xe = "numeric", Me = "categorical", _e = "comment", ve = "hidden", we = "tadpole", Xe = {
334
- [xe]: [
336
+ const ze = "numeric", Ae = "categorical", Ne = "comment", Pe = "hidden", He = "tadpole", Ze = {
337
+ [ze]: [
335
338
  { value: "bar", label: "Bars" },
336
339
  { value: "markers", label: "Markers" },
337
340
  { value: "markers+line", label: "Markers + Line" },
338
341
  { value: "line", label: "Line only" }
339
342
  ],
340
- [Me]: [
343
+ [Ae]: [
341
344
  { value: "categorical", label: "Categorical bands" }
342
345
  ],
343
- [_e]: [
346
+ [Ne]: [
344
347
  { value: "comment", label: "Comments" }
345
348
  ],
346
- [we]: [
349
+ [He]: [
347
350
  { value: "tadpole", label: "Tadpole" }
348
351
  ],
349
- [ve]: []
350
- }, Ze = /* @__PURE__ */ new Set([
352
+ [Pe]: []
353
+ }, Ke = /* @__PURE__ */ new Set([
351
354
  // Hole identifiers
352
355
  "hole_id",
353
356
  "holeid",
@@ -402,7 +405,7 @@ const xe = "numeric", Me = "categorical", _e = "comment", ve = "hidden", we = "t
402
405
  "data_source",
403
406
  "_hole_key",
404
407
  "_hole_id_key"
405
- ]), Zt = /* @__PURE__ */ new Set([
408
+ ]), sn = /* @__PURE__ */ new Set([
406
409
  "comments",
407
410
  "comment",
408
411
  "notes",
@@ -414,71 +417,71 @@ const xe = "numeric", Me = "categorical", _e = "comment", ve = "hidden", we = "t
414
417
  "struct_comment",
415
418
  "structcomment"
416
419
  ]);
417
- function Wt(e) {
420
+ function ln(e) {
418
421
  if (!(e != null && e.length))
419
422
  return { byType: {}, numericCols: [], categoricalCols: [], commentCols: [] };
420
423
  const t = new Set(e.flatMap((r) => Object.keys(r || {}))), n = {};
421
424
  for (const r of t) {
422
425
  const o = r.toLowerCase().trim();
423
- if (Ze.has(o) || Ze.has(r)) {
424
- n[r] = ve;
426
+ if (Ke.has(o) || Ke.has(r)) {
427
+ n[r] = Pe;
425
428
  continue;
426
429
  }
427
- if (Zt.has(o)) {
430
+ if (sn.has(o)) {
428
431
  const c = e.some((u) => {
429
432
  const l = u[r];
430
433
  return l != null && String(l).trim() !== "" && String(l) !== "null";
431
434
  });
432
- n[r] = c ? _e : ve;
435
+ n[r] = c ? Ne : Pe;
433
436
  continue;
434
437
  }
435
- let s = !1, i = !1;
438
+ let i = !1, s = !1;
436
439
  for (const c of e) {
437
440
  const u = c[r];
438
- if (!(u == null || typeof u == "string" && u.trim() === "") && (i = !0, typeof u == "number" && Number.isFinite(u))) {
439
- s = !0;
441
+ if (!(u == null || typeof u == "string" && u.trim() === "") && (s = !0, typeof u == "number" && Number.isFinite(u))) {
442
+ i = !0;
440
443
  break;
441
444
  }
442
445
  }
443
- i ? s ? n[r] = xe : n[r] = Me : n[r] = ve;
446
+ s ? i ? n[r] = ze : n[r] = Ae : n[r] = Pe;
444
447
  }
445
448
  return {
446
449
  byType: n,
447
- numericCols: Object.entries(n).filter(([, r]) => r === xe).map(([r]) => r),
448
- categoricalCols: Object.entries(n).filter(([, r]) => r === Me).map(([r]) => r),
449
- commentCols: Object.entries(n).filter(([, r]) => r === _e).map(([r]) => r)
450
+ numericCols: Object.entries(n).filter(([, r]) => r === ze).map(([r]) => r),
451
+ categoricalCols: Object.entries(n).filter(([, r]) => r === Ae).map(([r]) => r),
452
+ commentCols: Object.entries(n).filter(([, r]) => r === Ne).map(([r]) => r)
450
453
  };
451
454
  }
452
- function He(e) {
453
- return Xe[e] ?? Xe[xe];
455
+ function Re(e) {
456
+ return Ze[e] ?? Ze[ze];
454
457
  }
455
- function Cr(e) {
456
- const t = He(e);
457
- return t.length ? e === xe ? "line" : t[0].value : "markers+line";
458
+ function Jr(e) {
459
+ const t = Re(e);
460
+ return t.length ? e === ze ? "line" : t[0].value : "markers+line";
458
461
  }
459
- function Ee(e = []) {
460
- const t = e.flatMap((c) => c.points || []), { numericCols: n, categoricalCols: r, commentCols: o, byType: s } = Wt(t), i = n[0] || r[0] || "";
462
+ function De(e = []) {
463
+ const t = e.flatMap((c) => c.points || []), { numericCols: n, categoricalCols: r, commentCols: o, byType: i } = ln(t), s = n[0] || r[0] || "";
461
464
  return {
462
465
  numericProps: n,
463
466
  categoricalProps: r,
464
467
  commentProps: o,
465
- columnMeta: s,
466
- defaultProp: i
468
+ columnMeta: i,
469
+ defaultProp: s
467
470
  };
468
471
  }
469
- async function Kt(e, t = null) {
470
- return await Ut(e);
472
+ async function an(e, t = null) {
473
+ return await tn(e);
471
474
  }
472
- async function Jt(e, t, n = null) {
473
- return await Yt(e, t);
475
+ async function cn(e, t, n = null) {
476
+ return await nn(e, t);
474
477
  }
475
- function Qt(e = [], t = "") {
478
+ function un(e = [], t = "") {
476
479
  if (!e.length) return null;
477
- const { numericProps: n, categoricalProps: r, commentProps: o, columnMeta: s, defaultProp: i } = Ee(e), c = e.map((l) => l.id || l.holeId).filter(Boolean), u = pt({
480
+ const { numericProps: n, categoricalProps: r, commentProps: o, columnMeta: i, defaultProp: s } = De(e), c = e.map((l) => l.id || l.holeId).filter(Boolean), u = _t({
478
481
  holeIds: c,
479
482
  focusedHoleId: t,
480
483
  plotCount: 4,
481
- defaultProp: i,
484
+ defaultProp: s,
482
485
  categoricalProps: r,
483
486
  commentProps: o,
484
487
  numericDefaultChartType: "line"
@@ -488,65 +491,65 @@ function Qt(e = [], t = "") {
488
491
  numericProps: n,
489
492
  categoricalProps: r,
490
493
  commentProps: o,
491
- columnMeta: s,
492
- defaultProp: i,
494
+ columnMeta: i,
495
+ defaultProp: s,
493
496
  traceConfigs: u
494
497
  };
495
498
  }
496
- async function Ir(e, t = "", n = null) {
497
- const { holes: r } = await qt(e, n), o = Qt(r, t);
499
+ async function Qr(e, t = "", n = null) {
500
+ const { holes: r } = await rn(e, n), o = un(r, t);
498
501
  if (!o) throw new Error("No valid assay intervals found.");
499
502
  return o;
500
503
  }
501
- function Ar(e, t = null) {
504
+ function eo(e, t = null) {
502
505
  return new Promise((n, r) => {
503
- W.parse(e, {
506
+ Z.parse(e, {
504
507
  header: !0,
505
508
  dynamicTyping: !0,
506
509
  skipEmptyLines: !0,
507
510
  complete: (o) => {
508
- const s = o.data.map((i) => en(i, t)).filter((i) => i[E] && Number.isFinite(i[Y]) && Number.isFinite(i[B]) && Number.isFinite(i[j]));
509
- n(s);
511
+ const i = o.data.map((s) => dn(s, t)).filter((s) => s[v] && Number.isFinite(s[Y]) && Number.isFinite(s[G]) && Number.isFinite(s[B]));
512
+ n(i);
510
513
  },
511
514
  error: (o) => r(w("parseSurveyCSV", o))
512
515
  });
513
516
  });
514
517
  }
515
- function en(e, t = null) {
516
- const n = pe(e, null, t), r = n[E], o = n[se] || n.project || n.project_code, s = ye(n[te]), i = ye(n[ne]), c = ye(n[Y]), u = ye(n[B]), l = ye(n[j]), a = ye(n.maxdepth);
518
+ function dn(e, t = null) {
519
+ const n = pe(e, null, t), r = n[v], o = n[ie] || n.project || n.project_code, i = ge(n[te]), s = ge(n[ne]), c = ge(n[Y]), u = ge(n[G]), l = ge(n[B]), a = ge(n.maxdepth);
517
520
  return {
518
521
  raw: n,
519
- [E]: r,
520
- [se]: o,
521
- [te]: s,
522
- [ne]: i,
522
+ [v]: r,
523
+ [ie]: o,
524
+ [te]: i,
525
+ [ne]: s,
523
526
  [Y]: c,
524
- [B]: u,
525
- [j]: l,
527
+ [G]: u,
528
+ [B]: l,
526
529
  maxdepth: a,
527
530
  // Legacy field names for backwards compatibility
528
531
  project_code: o,
529
- latitude: s,
530
- longitude: i,
532
+ latitude: i,
533
+ longitude: s,
531
534
  surveydepth: c
532
535
  };
533
536
  }
534
- const ye = (e) => {
537
+ const ge = (e) => {
535
538
  const t = Number(e);
536
539
  return Number.isFinite(t) ? t : void 0;
537
540
  };
538
- function vr(e, t) {
539
- var l, a, m, d;
541
+ function to(e, t) {
542
+ var l, a, d, m;
540
543
  const n = /* @__PURE__ */ new Map();
541
544
  e.forEach((f) => {
542
- const b = (f[E] || f.holeId || f.id || "").toString().trim();
545
+ const b = (f[v] || f.holeId || f.id || "").toString().trim();
543
546
  if (!b) return;
544
547
  const p = b.toLowerCase();
545
548
  n.has(p) || n.set(p, f);
546
549
  });
547
- const r = ((l = e[0]) == null ? void 0 : l.lat) ?? ((a = e[0]) == null ? void 0 : a[te]) ?? 0, o = ((m = e[0]) == null ? void 0 : m.lng) ?? ((d = e[0]) == null ? void 0 : d[ne]) ?? 0, s = 111132, i = 111320 * Math.cos(r * Math.PI / 180), c = /* @__PURE__ */ new Map();
550
+ const r = ((l = e[0]) == null ? void 0 : l.lat) ?? ((a = e[0]) == null ? void 0 : a[te]) ?? 0, o = ((d = e[0]) == null ? void 0 : d.lng) ?? ((m = e[0]) == null ? void 0 : m[ne]) ?? 0, i = 111132, s = 111320 * Math.cos(r * Math.PI / 180), c = /* @__PURE__ */ new Map();
548
551
  t.forEach((f) => {
549
- const b = (f[E] || "").toString().trim();
552
+ const b = (f[v] || "").toString().trim();
550
553
  if (!b) return;
551
554
  const p = b.toLowerCase();
552
555
  c.has(p) || c.set(p, []), c.get(p).push(f);
@@ -555,52 +558,52 @@ function vr(e, t) {
555
558
  return c.forEach((f, b) => {
556
559
  const p = n.get(b);
557
560
  if (!p) return;
558
- const h = f.filter((T) => Number.isFinite(T[Y] ?? T.surveydepth)).sort((T, R) => (T[Y] ?? T.surveydepth) - (R[Y] ?? R.surveydepth));
561
+ const h = f.filter((O) => Number.isFinite(O[Y] ?? O.surveydepth)).sort((O, $) => (O[Y] ?? O.surveydepth) - ($[Y] ?? $.surveydepth));
559
562
  if (!h.length) return;
560
- const _ = p.lat ?? p[te], y = p.lng ?? p[ne], I = 111132, z = 111320 * Math.cos(_ * Math.PI / 180), x = (y - o) * i, D = (_ - r) * s, S = [];
561
- let M = 0, O = 0, $ = 0;
562
- for (let T = 0; T < h.length; T += 1) {
563
- const R = h[T], q = h[T - 1], A = R[Y] ?? R.surveydepth, v = R[j] ?? R.azimuth, P = R[B] ?? R.dip;
564
- if (!q) {
565
- S.push({
566
- x: x + M,
567
- y: D + O,
563
+ const N = p.lat ?? p[te], y = p.lng ?? p[ne], E = 111132, M = 111320 * Math.cos(N * Math.PI / 180), z = (y - o) * s, P = (N - r) * i, D = [];
564
+ let x = 0, V = 0, H = 0;
565
+ for (let O = 0; O < h.length; O += 1) {
566
+ const $ = h[O], j = h[O - 1], S = $[Y] ?? $.surveydepth, I = $[B] ?? $.azimuth, g = $[G] ?? $.dip;
567
+ if (!j) {
568
+ D.push({
569
+ x: z + x,
570
+ y: P + V,
568
571
  z: 0,
569
- md: A,
570
- azimuth: v,
571
- dip: P
572
+ md: S,
573
+ azimuth: I,
574
+ dip: g
572
575
  });
573
576
  continue;
574
577
  }
575
- const g = q[Y] ?? q.surveydepth, C = q[j] ?? q.azimuth, F = q[B] ?? q.dip, V = A - g;
576
- if (V <= 0) continue;
577
- const k = We(F), H = We(P), U = $e(C), re = $e(v), de = Math.acos(
578
- Math.sin(k) * Math.sin(H) * Math.cos(U - re) + Math.cos(k) * Math.cos(H)
579
- ), ie = de > 1e-6 ? 2 / de * Math.tan(de / 2) : 1, Ne = 0.5 * V * (Math.sin(k) * Math.cos(U) + Math.sin(H) * Math.cos(re)) * ie, le = 0.5 * V * (Math.sin(k) * Math.sin(U) + Math.sin(H) * Math.sin(re)) * ie, Pe = 0.5 * V * (Math.cos(k) + Math.cos(H)) * ie;
580
- M += Ne, O += le, $ += Pe, S.push({
581
- x: x + M,
582
- y: D + O,
583
- z: -$,
578
+ const k = j[Y] ?? j.surveydepth, A = j[B] ?? j.azimuth, T = j[G] ?? j.dip, F = S - k;
579
+ if (F <= 0) continue;
580
+ const C = Je(T), R = Je(g), X = $e(A), re = $e(I), me = Math.acos(
581
+ Math.sin(C) * Math.sin(R) * Math.cos(X - re) + Math.cos(C) * Math.cos(R)
582
+ ), se = me > 1e-6 ? 2 / me * Math.tan(me / 2) : 1, Me = 0.5 * F * (Math.sin(C) * Math.cos(X) + Math.sin(R) * Math.cos(re)) * se, le = 0.5 * F * (Math.sin(C) * Math.sin(X) + Math.sin(R) * Math.sin(re)) * se, Le = 0.5 * F * (Math.cos(C) + Math.cos(R)) * se;
583
+ x += Me, V += le, H += Le, D.push({
584
+ x: z + x,
585
+ y: P + V,
586
+ z: -H,
584
587
  // render with z up; depth down
585
- md: A,
586
- azimuth: v,
587
- dip: P
588
+ md: S,
589
+ azimuth: I,
590
+ dip: g
588
591
  });
589
592
  }
590
- const Z = S.map((T) => ({
591
- ...T,
592
- lat: _ + T.y / I,
593
- lng: y + T.x / z
593
+ const W = D.map((O) => ({
594
+ ...O,
595
+ lat: N + O.y / E,
596
+ lng: y + O.x / M
594
597
  }));
595
598
  u.push({
596
- id: p[E] || p.holeId || b,
597
- project: p[se] || p.project_id || p.project || "",
598
- points: Z,
599
+ id: p[v] || p.holeId || b,
600
+ project: p[ie] || p.project_id || p.project || "",
601
+ points: W,
599
602
  collar: p
600
603
  });
601
604
  }), u;
602
605
  }
603
- const $e = (e) => e * Math.PI / 180, We = (e) => {
606
+ const $e = (e) => e * Math.PI / 180, Je = (e) => {
604
607
  const t = Number(e), n = 90 + (Number.isFinite(t) ? t : 0), r = Math.min(180, Math.max(0, n));
605
608
  return $e(r);
606
609
  };
@@ -608,178 +611,178 @@ function ee(e, t = void 0) {
608
611
  const n = Number(e);
609
612
  return Number.isFinite(n) ? n : t;
610
613
  }
611
- function Ke(e) {
614
+ function Qe(e) {
612
615
  return e == null ? "" : `${e}`.trim();
613
616
  }
614
- function De(e = [], t = null) {
615
- const n = t || "hole_id", o = [n, "hole_id", "holeId", "id"].find((s) => e.some((i) => Ke(i == null ? void 0 : i[s])));
617
+ function ke(e = [], t = null) {
618
+ const n = t || "hole_id", o = [n, "hole_id", "holeId", "id"].find((i) => e.some((s) => Qe(s == null ? void 0 : s[i])));
616
619
  if (!o)
617
620
  throw w("canonicalizeHoleIdRows", new Error(`hole id column '${n}' not found`));
618
621
  return {
619
622
  aliasCol: o,
620
- rows: e.map((s) => ({
621
- ...s,
622
- hole_id: Ke(s == null ? void 0 : s[o])
623
+ rows: e.map((i) => ({
624
+ ...i,
625
+ hole_id: Qe(i == null ? void 0 : i[o])
623
626
  }))
624
627
  };
625
628
  }
626
- function Je(e) {
629
+ function et(e) {
627
630
  return Number(e) * Math.PI / 180;
628
631
  }
629
- function Le(e, t) {
630
- const n = Je(e), r = Je(t), o = Math.cos(r) * Math.sin(n), s = Math.cos(r) * Math.cos(n), i = Math.sin(r) * -1;
631
- return { ca: o, cb: s, cc: i };
632
+ function Te(e, t) {
633
+ const n = et(e), r = et(t), o = Math.cos(r) * Math.sin(n), i = Math.cos(r) * Math.cos(n), s = Math.sin(r) * -1;
634
+ return { ca: o, cb: i, cc: s };
632
635
  }
633
- function tn(e, t, n, r, o, s = "minimum_curvature") {
634
- const i = Le(t, n), c = Le(r, o);
635
- if (s === "tangential")
636
+ function mn(e, t, n, r, o, i = "minimum_curvature") {
637
+ const s = Te(t, n), c = Te(r, o);
638
+ if (i === "tangential")
636
639
  return {
637
- dx: e * i.ca,
638
- dy: e * i.cb,
639
- dz: e * i.cc,
640
+ dx: e * s.ca,
641
+ dy: e * s.cb,
642
+ dz: e * s.cc,
640
643
  azimuth: t,
641
644
  dip: n
642
645
  };
643
- if (s === "balanced_tangential") {
644
- const m = 0.5 * (t + r), d = 0.5 * (n + o), f = Le(m, d);
646
+ if (i === "balanced_tangential") {
647
+ const d = 0.5 * (t + r), m = 0.5 * (n + o), f = Te(d, m);
645
648
  return {
646
649
  dx: e * f.ca,
647
650
  dy: e * f.cb,
648
651
  dz: e * f.cc,
649
- azimuth: m,
650
- dip: d
652
+ azimuth: d,
653
+ dip: m
651
654
  };
652
655
  }
653
- const u = i.ca * c.ca + i.cb * c.cb + i.cc * c.cc, l = Math.acos(Math.max(-1, Math.min(1, u))), a = l > 1e-6 ? 2 * Math.tan(l / 2) / l : 1;
656
+ const u = s.ca * c.ca + s.cb * c.cb + s.cc * c.cc, l = Math.acos(Math.max(-1, Math.min(1, u))), a = l > 1e-6 ? 2 * Math.tan(l / 2) / l : 1;
654
657
  return {
655
- dx: 0.5 * e * (i.ca + c.ca) * a,
656
- dy: 0.5 * e * (i.cb + c.cb) * a,
657
- dz: 0.5 * e * (i.cc + c.cc) * a,
658
+ dx: 0.5 * e * (s.ca + c.ca) * a,
659
+ dy: 0.5 * e * (s.cb + c.cb) * a,
660
+ dz: 0.5 * e * (s.cc + c.cc) * a,
658
661
  azimuth: r,
659
662
  dip: o
660
663
  };
661
664
  }
662
- function je(e = [], t = [], n = {}) {
665
+ function Be(e = [], t = [], n = {}) {
663
666
  const {
664
667
  step: r = 1,
665
668
  holeIdCol: o = null,
666
- method: s = "minimum_curvature"
667
- } = n, i = Number.isFinite(Number(r)) && Number(r) > 0 ? Number(r) : 1, c = De(e, o), u = De(t, o || c.aliasCol);
669
+ method: i = "minimum_curvature"
670
+ } = n, s = Number.isFinite(Number(r)) && Number(r) > 0 ? Number(r) : 1, c = ke(e, o), u = ke(t, o || c.aliasCol);
668
671
  if (!c.rows.length || !u.rows.length) return [];
669
672
  const l = /* @__PURE__ */ new Map();
670
- c.rows.forEach((d) => {
671
- !d.hole_id || l.has(d.hole_id) || l.set(d.hole_id, d);
673
+ c.rows.forEach((m) => {
674
+ !m.hole_id || l.has(m.hole_id) || l.set(m.hole_id, m);
672
675
  });
673
676
  const a = /* @__PURE__ */ new Map();
674
- u.rows.forEach((d) => {
675
- d.hole_id && (a.has(d.hole_id) || a.set(d.hole_id, []), a.get(d.hole_id).push(d));
677
+ u.rows.forEach((m) => {
678
+ m.hole_id && (a.has(m.hole_id) || a.set(m.hole_id, []), a.get(m.hole_id).push(m));
676
679
  });
677
- const m = [];
678
- return a.forEach((d, f) => {
680
+ const d = [];
681
+ return a.forEach((m, f) => {
679
682
  const b = l.get(f);
680
683
  if (!b) return;
681
- const p = [...d].map((S) => ({
682
- ...S,
683
- from: ee(S.from),
684
- azimuth: ee(S.azimuth),
685
- dip: ee(S.dip)
686
- })).filter((S) => Number.isFinite(S.from) && Number.isFinite(S.azimuth) && Number.isFinite(S.dip)).sort((S, M) => S.from - M.from);
684
+ const p = [...m].map((D) => ({
685
+ ...D,
686
+ from: ee(D.from),
687
+ azimuth: ee(D.azimuth),
688
+ dip: ee(D.dip)
689
+ })).filter((D) => Number.isFinite(D.from) && Number.isFinite(D.azimuth) && Number.isFinite(D.dip)).sort((D, x) => D.from - x.from);
687
690
  if (!p.length) return;
688
- let h = ee(b.x, 0), _ = ee(b.y, 0), y = ee(b.z, 0), I = p[0].from;
689
- const z = p[0].azimuth, x = p[0].dip, D = {
691
+ let h = ee(b.x, 0), N = ee(b.y, 0), y = ee(b.z, 0), E = p[0].from;
692
+ const M = p[0].azimuth, z = p[0].dip, P = {
690
693
  hole_id: f,
691
- md: I,
694
+ md: E,
692
695
  x: h,
693
- y: _,
696
+ y: N,
694
697
  z: y,
695
- azimuth: z,
696
- dip: x
698
+ azimuth: M,
699
+ dip: z
697
700
  };
698
- c.aliasCol !== "hole_id" && b[c.aliasCol] !== void 0 && (D[c.aliasCol] = b[c.aliasCol]), m.push(D);
699
- for (let S = 0; S < p.length - 1; S += 1) {
700
- const M = p[S], O = p[S + 1], $ = M.from, T = O.from - $;
701
- if (T <= 0) continue;
702
- const R = Math.max(1, Math.ceil(T / i)), q = T / R;
703
- for (let A = 0; A < R; A += 1) {
704
- I += q;
705
- const v = (I - $) / T, P = M.azimuth + v * (O.azimuth - M.azimuth), g = M.dip + v * (O.dip - M.dip), C = tn(q, M.azimuth, M.dip, O.azimuth, O.dip, s);
706
- h += C.dx, _ += C.dy, y += C.dz;
707
- const F = {
701
+ c.aliasCol !== "hole_id" && b[c.aliasCol] !== void 0 && (P[c.aliasCol] = b[c.aliasCol]), d.push(P);
702
+ for (let D = 0; D < p.length - 1; D += 1) {
703
+ const x = p[D], V = p[D + 1], H = x.from, O = V.from - H;
704
+ if (O <= 0) continue;
705
+ const $ = Math.max(1, Math.ceil(O / s)), j = O / $;
706
+ for (let S = 0; S < $; S += 1) {
707
+ E += j;
708
+ const I = (E - H) / O, g = x.azimuth + I * (V.azimuth - x.azimuth), k = x.dip + I * (V.dip - x.dip), A = mn(j, x.azimuth, x.dip, V.azimuth, V.dip, i);
709
+ h += A.dx, N += A.dy, y += A.dz;
710
+ const T = {
708
711
  hole_id: f,
709
- md: I,
712
+ md: E,
710
713
  x: h,
711
- y: _,
714
+ y: N,
712
715
  z: y,
713
- azimuth: s === "minimum_curvature" ? P : C.azimuth,
714
- dip: s === "minimum_curvature" ? g : C.dip
716
+ azimuth: i === "minimum_curvature" ? g : A.azimuth,
717
+ dip: i === "minimum_curvature" ? k : A.dip
715
718
  };
716
- c.aliasCol !== "hole_id" && b[c.aliasCol] !== void 0 && (F[c.aliasCol] = b[c.aliasCol]), m.push(F);
719
+ c.aliasCol !== "hole_id" && b[c.aliasCol] !== void 0 && (T[c.aliasCol] = b[c.aliasCol]), d.push(T);
717
720
  }
718
721
  }
719
- }), m;
722
+ }), d;
720
723
  }
721
- function nn(e, t, n = {}) {
722
- return je(e, t, { ...n, method: "minimum_curvature" });
724
+ function fn(e, t, n = {}) {
725
+ return Be(e, t, { ...n, method: "minimum_curvature" });
723
726
  }
724
- function Er(e, t, n = {}) {
725
- return je(e, t, { ...n, method: "tangential" });
727
+ function no(e, t, n = {}) {
728
+ return Be(e, t, { ...n, method: "tangential" });
726
729
  }
727
- function Dr(e, t, n = {}) {
728
- return je(e, t, { ...n, method: "balanced_tangential" });
730
+ function ro(e, t, n = {}) {
731
+ return Be(e, t, { ...n, method: "balanced_tangential" });
729
732
  }
730
- function Sr(e, t, n = {}) {
731
- return nn(e, t, n);
733
+ function oo(e, t, n = {}) {
734
+ return fn(e, t, n);
732
735
  }
733
- function rn(e, t) {
736
+ function hn(e, t) {
734
737
  if (!e.length || !Number.isFinite(t)) return null;
735
738
  let n = null, r = 1 / 0;
736
739
  for (let o = 0; o < e.length; o += 1) {
737
- const s = e[o], i = ee(s.md);
738
- if (!Number.isFinite(i)) continue;
739
- const c = Math.abs(i - t);
740
- c < r && (r = c, n = s);
740
+ const i = e[o], s = ee(i.md);
741
+ if (!Number.isFinite(s)) continue;
742
+ const c = Math.abs(s - t);
743
+ c < r && (r = c, n = i);
741
744
  }
742
745
  return n;
743
746
  }
744
- function Pr(e = [], t = [], n = {}) {
745
- const r = n.holeIdCol || "hole_id", o = De(e, r), s = De(t, r);
746
- if (!o.rows.length || !s.rows.length) return [...o.rows];
747
- const i = /* @__PURE__ */ new Map();
748
- return s.rows.forEach((c) => {
749
- c.hole_id && (i.has(c.hole_id) || i.set(c.hole_id, []), i.get(c.hole_id).push(c));
750
- }), i.forEach((c, u) => {
751
- i.set(u, [...c].sort((l, a) => ee(l.md, 0) - ee(a.md, 0)));
747
+ function io(e = [], t = [], n = {}) {
748
+ const r = n.holeIdCol || "hole_id", o = ke(e, r), i = ke(t, r);
749
+ if (!o.rows.length || !i.rows.length) return [...o.rows];
750
+ const s = /* @__PURE__ */ new Map();
751
+ return i.rows.forEach((c) => {
752
+ c.hole_id && (s.has(c.hole_id) || s.set(c.hole_id, []), s.get(c.hole_id).push(c));
753
+ }), s.forEach((c, u) => {
754
+ s.set(u, [...c].sort((l, a) => ee(l.md, 0) - ee(a.md, 0)));
752
755
  }), o.rows.map((c) => {
753
756
  const u = ee(c.from), l = ee(c.to), a = Number.isFinite(u) && Number.isFinite(l) ? 0.5 * (u + l) : void 0;
754
757
  if (!c.hole_id || !Number.isFinite(a)) return { ...c };
755
- const m = rn(i.get(c.hole_id) || [], a);
756
- if (!m) return { ...c };
757
- const d = { ...c };
758
+ const d = hn(s.get(c.hole_id) || [], a);
759
+ if (!d) return { ...c };
760
+ const m = { ...c };
758
761
  return ["md", "x", "y", "z", "azimuth", "dip"].forEach((f) => {
759
- m[f] !== void 0 && (Object.prototype.hasOwnProperty.call(d, f) ? d[`${f}_trace`] = m[f] : d[f] = m[f]);
760
- }), d;
762
+ d[f] !== void 0 && (Object.prototype.hasOwnProperty.call(m, f) ? m[`${f}_trace`] = d[f] : m[f] = d[f]);
763
+ }), m;
761
764
  });
762
765
  }
763
- function kr(e, t = null) {
766
+ function so(e, t = null) {
764
767
  return new Promise((n, r) => {
765
- W.parse(e, {
768
+ Z.parse(e, {
766
769
  header: !0,
767
770
  dynamicTyping: !0,
768
771
  skipEmptyLines: !0,
769
772
  complete: (o) => {
770
- const s = /* @__PURE__ */ new Map();
773
+ const i = /* @__PURE__ */ new Map();
771
774
  o.data.forEach((c, u) => {
772
- const l = pe(c, null, t), a = l[E], m = a !== void 0 ? `${a}`.trim() : "", d = l[ce] ?? l.x, f = l[ue] ?? l.y, b = l[ge] ?? l.z, p = l.order ?? u;
773
- !m || d === null || d === void 0 || f === null || f === void 0 || b === null || b === void 0 || (s.has(m) || s.set(m, []), s.get(m).push({
775
+ const l = pe(c, null, t), a = l[v], d = a !== void 0 ? `${a}`.trim() : "", m = l[ce] ?? l.x, f = l[ue] ?? l.y, b = l[_e] ?? l.z, p = l.order ?? u;
776
+ !d || m === null || m === void 0 || f === null || f === void 0 || b === null || b === void 0 || (i.has(d) || i.set(d, []), i.get(d).push({
774
777
  ...l,
775
- holeId: m,
778
+ holeId: d,
776
779
  order: p,
777
- x: Number(d) ?? 0,
780
+ x: Number(m) ?? 0,
778
781
  y: Number(f) ?? 0,
779
782
  z: Number(b) ?? 0
780
783
  }));
781
784
  });
782
- const i = Array.from(s.entries()).map(([c, u]) => ({
785
+ const s = Array.from(i.entries()).map(([c, u]) => ({
783
786
  id: c,
784
787
  points: u.sort((l, a) => l.order - a.order).map((l) => ({
785
788
  ...l,
@@ -788,33 +791,33 @@ function kr(e, t = null) {
788
791
  z: Number(l.z) || 0
789
792
  }))
790
793
  }));
791
- n({ holes: i });
794
+ n({ holes: s });
792
795
  },
793
796
  error: (o) => r(w("parseDrillholesCSV", o))
794
797
  });
795
798
  });
796
799
  }
797
- function ze(e) {
800
+ function xe(e) {
798
801
  return e ? Array.isArray(e) ? [...e] : [] : [];
799
802
  }
800
803
  function J(e) {
801
804
  const t = Number(e);
802
805
  return Number.isFinite(t) ? t : void 0;
803
806
  }
804
- function bt(e = [], t = []) {
807
+ function Nt(e = [], t = []) {
805
808
  const n = [...e];
806
809
  return n.sort((r, o) => {
807
- for (let s = 0; s < t.length; s += 1) {
808
- const i = t[s], c = r == null ? void 0 : r[i], u = o == null ? void 0 : o[i];
810
+ for (let i = 0; i < t.length; i += 1) {
811
+ const s = t[i], c = r == null ? void 0 : r[s], u = o == null ? void 0 : o[s];
809
812
  if (c !== u)
810
813
  return c == null ? 1 : u == null ? -1 : typeof c == "number" && typeof u == "number" ? c - u : `${c}`.localeCompare(`${u}`);
811
814
  }
812
815
  return 0;
813
816
  }), n;
814
817
  }
815
- function on(e, t = {}) {
818
+ function pn(e, t = {}) {
816
819
  return new Promise((n, r) => {
817
- W.parse(e, {
820
+ Z.parse(e, {
818
821
  header: !0,
819
822
  dynamicTyping: !0,
820
823
  skipEmptyLines: !0,
@@ -824,119 +827,119 @@ function on(e, t = {}) {
824
827
  });
825
828
  });
826
829
  }
827
- function sn(e = [], t = null, n = null) {
830
+ function bn(e = [], t = null, n = null) {
828
831
  return e.map((r) => pe(r, t, n));
829
832
  }
830
- async function Be(e, t = {}) {
833
+ async function Ge(e, t = {}) {
831
834
  const {
832
835
  kind: n = "csv",
833
836
  columnMap: r = null,
834
837
  sourceColumnMap: o = null,
835
- papaParseConfig: s = {}
838
+ papaParseConfig: i = {}
836
839
  } = t;
837
- let i;
840
+ let s;
838
841
  if (Array.isArray(e))
839
- i = ze(e);
842
+ s = xe(e);
840
843
  else if (n === "csv")
841
- i = await on(e, s);
844
+ s = await pn(e, i);
842
845
  else throw n === "parquet" || n === "sql" ? w("loadTable", new Error(`Unsupported kind in JS runtime: ${n}`)) : w("loadTable", new Error(`Unsupported kind: ${n}`));
843
- return sn(i, r, o);
846
+ return bn(s, r, o);
844
847
  }
845
- async function Lr(e, t = {}) {
848
+ async function lo(e, t = {}) {
846
849
  const {
847
850
  crs: n = null,
848
851
  sourceColumnMap: r = null,
849
852
  keepAll: o = !0,
850
- ...s
851
- } = t, i = await Be(e, { ...s, sourceColumnMap: r });
852
- if (!i.some((d) => E in d))
853
- throw w("loadCollars", new Error(`Collar table missing column: ${E}`));
854
- const u = i.some((d) => ce in d && ue in d), l = i.some((d) => te in d && ne in d);
853
+ ...i
854
+ } = t, s = await Ge(e, { ...i, sourceColumnMap: r });
855
+ if (!s.some((m) => v in m))
856
+ throw w("loadCollars", new Error(`Collar table missing column: ${v}`));
857
+ const u = s.some((m) => ce in m && ue in m), l = s.some((m) => te in m && ne in m);
855
858
  if (!u && !l)
856
859
  throw w("loadCollars", new Error("Collar table missing coordinate columns (need easting/northing or latitude/longitude)"));
857
- const a = i.map((d) => {
858
- const f = { ...d };
859
- if (E in f) {
860
- const b = f[E];
861
- f[E] = b == null ? "" : `${b}`.trim();
860
+ const a = s.map((m) => {
861
+ const f = { ...m };
862
+ if (v in f) {
863
+ const b = f[v];
864
+ f[v] = b == null ? "" : `${b}`.trim();
862
865
  }
863
- return te in f && (f[te] = J(f[te])), ne in f && (f[ne] = J(f[ne])), ge in f && (f[ge] = J(f[ge])), ce in f && (f[ce] = J(f[ce])), ue in f && (f[ue] = J(f[ue])), !("datasource_hole_id" in f) && E in f && (f.datasource_hole_id = f[E]), f;
866
+ return te in f && (f[te] = J(f[te])), ne in f && (f[ne] = J(f[ne])), _e in f && (f[_e] = J(f[_e])), ce in f && (f[ce] = J(f[ce])), ue in f && (f[ue] = J(f[ue])), !("datasource_hole_id" in f) && v in f && (f.datasource_hole_id = f[v]), f;
864
867
  });
865
- if (!a.every((d) => !(!d[E] || l && (!Number.isFinite(d[te]) || !Number.isFinite(d[ne])) || u && !l && (!Number.isFinite(d[ce]) || !Number.isFinite(d[ue])))))
868
+ if (!a.every((m) => !(!m[v] || l && (!Number.isFinite(m[te]) || !Number.isFinite(m[ne])) || u && !l && (!Number.isFinite(m[ce]) || !Number.isFinite(m[ue])))))
866
869
  throw w("loadCollars", new Error("Collar table has missing required values"));
867
870
  return a;
868
871
  }
869
- async function Tr(e, t = {}) {
872
+ async function ao(e, t = {}) {
870
873
  const {
871
874
  sourceColumnMap: n = null,
872
875
  keepAll: r = !0,
873
876
  ...o
874
- } = t, s = await Be(e, { ...o, sourceColumnMap: n }), i = [E, Y, j, B];
875
- for (const l of i)
876
- if (!s.some((m) => l in m))
877
+ } = t, i = await Ge(e, { ...o, sourceColumnMap: n }), s = [v, Y, B, G];
878
+ for (const l of s)
879
+ if (!i.some((d) => l in d))
877
880
  throw w("loadSurveys", new Error(`Survey table missing column: ${l}`));
878
- const c = s.map((l) => {
881
+ const c = i.map((l) => {
879
882
  const a = { ...l };
880
- if (E in a) {
881
- const m = a[E];
882
- a[E] = m == null ? "" : `${m}`.trim();
883
+ if (v in a) {
884
+ const d = a[v];
885
+ a[v] = d == null ? "" : `${d}`.trim();
883
886
  }
884
- return Y in a && (a[Y] = J(a[Y])), G in a && (a[G] = J(a[G])), j in a && (a[j] = J(a[j])), B in a && (a[B] = J(a[B])), a;
887
+ return Y in a && (a[Y] = J(a[Y])), U in a && (a[U] = J(a[U])), B in a && (a[B] = J(a[B])), G in a && (a[G] = J(a[G])), a;
885
888
  });
886
- if (!c.every((l) => !(!l[E] || !Number.isFinite(l[Y]) || !Number.isFinite(l[j]) || !Number.isFinite(l[B]))))
889
+ if (!c.every((l) => !(!l[v] || !Number.isFinite(l[Y]) || !Number.isFinite(l[B]) || !Number.isFinite(l[G]))))
887
890
  throw w("loadSurveys", new Error("Survey table has missing required values"));
888
- return bt(c, [E, Y]);
891
+ return Nt(c, [v, Y]);
889
892
  }
890
- async function Fr(e, t = {}) {
893
+ async function co(e, t = {}) {
891
894
  const {
892
895
  sourceColumnMap: n = null,
893
896
  keepAll: r = !0,
894
897
  ...o
895
- } = t, s = await Be(e, { ...o, sourceColumnMap: n }), i = [E, X, G];
896
- for (const l of i)
897
- if (!s.some((m) => l in m))
898
+ } = t, i = await Ge(e, { ...o, sourceColumnMap: n }), s = [v, q, U];
899
+ for (const l of s)
900
+ if (!i.some((d) => l in d))
898
901
  throw w("loadAssays", new Error(`Assay table missing column: ${l}`));
899
- const c = s.map((l) => {
902
+ const c = i.map((l) => {
900
903
  const a = { ...l };
901
- if (E in a) {
902
- const m = a[E];
903
- a[E] = m == null ? "" : `${m}`.trim();
904
+ if (v in a) {
905
+ const d = a[v];
906
+ a[v] = d == null ? "" : `${d}`.trim();
904
907
  }
905
- return X in a && (a[X] = J(a[X])), G in a && (a[G] = J(a[G])), X in a && G in a && Number.isFinite(a[X]) && Number.isFinite(a[G]) && (a[Re] = 0.5 * (a[X] + a[G])), a;
908
+ return q in a && (a[q] = J(a[q])), U in a && (a[U] = J(a[U])), q in a && U in a && Number.isFinite(a[q]) && Number.isFinite(a[U]) && (a[je] = 0.5 * (a[q] + a[U])), a;
906
909
  });
907
- if (!c.every((l) => !(!l[E] || !Number.isFinite(l[X]) || !Number.isFinite(l[G]))))
910
+ if (!c.every((l) => !(!l[v] || !Number.isFinite(l[q]) || !Number.isFinite(l[U]))))
908
911
  throw w("loadAssays", new Error("Assay table has missing required values"));
909
- return bt(c, [E, X, G]);
912
+ return Nt(c, [v, q, U]);
910
913
  }
911
- function Or(e = [], t = [], n = {}) {
912
- const r = Array.isArray(n.onCols) && n.onCols.length ? n.onCols : [E];
914
+ function uo(e = [], t = [], n = {}) {
915
+ const r = Array.isArray(n.onCols) && n.onCols.length ? n.onCols : [v];
913
916
  if (!t.length) return [...e];
914
- const o = (i) => r.map((c) => `${(i == null ? void 0 : i[c]) ?? ""}`).join("|"), s = /* @__PURE__ */ new Map();
915
- return t.forEach((i) => {
916
- s.set(o(i), i);
917
- }), e.map((i) => {
918
- const c = s.get(o(i));
919
- if (!c) return { ...i };
920
- const u = { ...i };
917
+ const o = (s) => r.map((c) => `${(s == null ? void 0 : s[c]) ?? ""}`).join("|"), i = /* @__PURE__ */ new Map();
918
+ return t.forEach((s) => {
919
+ i.set(o(s), s);
920
+ }), e.map((s) => {
921
+ const c = i.get(o(s));
922
+ if (!c) return { ...s };
923
+ const u = { ...s };
921
924
  return Object.entries(c).forEach(([l, a]) => {
922
925
  r.includes(l) || (Object.prototype.hasOwnProperty.call(u, l) ? u[`${l}_trace`] = a : u[l] = a);
923
926
  }), u;
924
927
  });
925
928
  }
926
- function Vr(e = [], t = null) {
927
- return t == null ? [...e] : e.length ? e.some((r) => se in r) ? e.filter((r) => (r == null ? void 0 : r[se]) === t) : [...e] : [];
929
+ function mo(e = [], t = null) {
930
+ return t == null ? [...e] : e.length ? e.some((r) => ie in r) ? e.filter((r) => (r == null ? void 0 : r[ie]) === t) : [...e] : [];
928
931
  }
929
- function wr(e = [], t = []) {
932
+ function fo(e = [], t = []) {
930
933
  return e.map((n) => {
931
934
  const r = { ...n };
932
935
  return t.forEach((o) => {
933
936
  if (!(o in r)) return;
934
- const s = J(r[o]);
935
- r[o] = s;
937
+ const i = J(r[o]);
938
+ r[o] = i;
936
939
  }), r;
937
940
  });
938
941
  }
939
- function $r({
942
+ function ho({
940
943
  collars: e = [],
941
944
  surveys: t = [],
942
945
  assays: n = [],
@@ -944,46 +947,46 @@ function $r({
944
947
  metadata: o = {}
945
948
  } = {}) {
946
949
  return {
947
- collars: ze(e),
948
- surveys: ze(t),
949
- assays: ze(n),
950
- structures: ze(r),
950
+ collars: xe(e),
951
+ surveys: xe(t),
952
+ assays: xe(n),
953
+ structures: xe(r),
951
954
  metadata: o || {}
952
955
  };
953
956
  }
954
- const yt = ["x", "y", "z", "dx", "dy", "dz"], ln = {
957
+ const zt = ["x", "y", "z", "dx", "dy", "dz"], yn = {
955
958
  x: ["x", "easting", "center_x", "xc", "xcentre", "xcenter", "x_centre", "x_center", "cx"],
956
959
  y: ["y", "northing", "center_y", "yc", "ycentre", "ycenter", "y_centre", "y_center", "cy"],
957
960
  z: ["z", "elevation", "center_z", "zc", "zcentre", "zcenter", "z_centre", "z_center", "cz"],
958
961
  dx: ["dx", "size_x", "sx", "sizex", "dim_x", "block_size_x"],
959
962
  dy: ["dy", "size_y", "sy", "sizey", "dim_y", "block_size_y"],
960
963
  dz: ["dz", "size_z", "sz", "sizez", "dim_z", "block_size_z"]
961
- }, gt = {};
962
- Object.entries(ln).forEach(([e, t]) => {
964
+ }, Mt = {};
965
+ Object.entries(yn).forEach(([e, t]) => {
963
966
  t.forEach((n) => {
964
- gt[n.toLowerCase()] = e;
967
+ Mt[n.toLowerCase()] = e;
965
968
  });
966
969
  });
967
- function an(e) {
970
+ function gn(e) {
968
971
  const t = {};
969
972
  return Object.entries(e).forEach(([n, r]) => {
970
- const o = gt[n.toLowerCase().trim()] || n;
973
+ const o = Mt[n.toLowerCase().trim()] || n;
971
974
  t[o] = r;
972
975
  }), t;
973
976
  }
974
- function Rr(e) {
977
+ function po(e) {
975
978
  return new Promise((t, n) => {
976
- W.parse(e, {
979
+ Z.parse(e, {
977
980
  header: !0,
978
981
  dynamicTyping: !0,
979
982
  skipEmptyLines: !0,
980
983
  complete: (r) => {
981
- const s = (r.data || []).map(an).filter(
984
+ const i = (r.data || []).map(gn).filter(
982
985
  (c) => c.x !== null && c.y !== null && c.z !== null
983
- ), i = Object.keys(s[0] || {}).filter(
984
- (c) => !yt.includes(c)
986
+ ), s = Object.keys(i[0] || {}).filter(
987
+ (c) => !zt.includes(c)
985
988
  );
986
- t({ data: s, properties: i });
989
+ t({ data: i, properties: s });
987
990
  },
988
991
  error: (r) => {
989
992
  n(w("parseBlockModelCSV", r));
@@ -991,7 +994,7 @@ function Rr(e) {
991
994
  });
992
995
  });
993
996
  }
994
- function Hr(e) {
997
+ function bo(e) {
995
998
  if (typeof e == "string")
996
999
  try {
997
1000
  return JSON.parse(e);
@@ -1001,134 +1004,134 @@ function Hr(e) {
1001
1004
  if (e && typeof e == "object") return e;
1002
1005
  throw w("loadBlockModelMetadata", new Error("Invalid metadata source"));
1003
1006
  }
1004
- function cn(e, t) {
1005
- const n = e.map((s) => s[t]).filter((s) => s != null);
1006
- if (n.length > 0 && n.every((s) => typeof s == "number")) {
1007
- const s = Math.min(...n), i = Math.max(...n);
1008
- return { type: "numeric", min: s, max: i, values: n };
1007
+ function _n(e, t) {
1008
+ const n = e.map((i) => i[t]).filter((i) => i != null);
1009
+ if (n.length > 0 && n.every((i) => typeof i == "number")) {
1010
+ const i = Math.min(...n), s = Math.max(...n);
1011
+ return { type: "numeric", min: i, max: s, values: n };
1009
1012
  }
1010
1013
  return { type: "categorical", categories: [...new Set(n)], values: n };
1011
1014
  }
1012
- function jr(e) {
1015
+ function yo(e) {
1013
1016
  if (!e || e.length === 0) return {};
1014
1017
  const t = Object.keys(e[0]).filter(
1015
- (r) => !yt.includes(r)
1018
+ (r) => !zt.includes(r)
1016
1019
  ), n = {};
1017
1020
  return t.forEach((r) => {
1018
- n[r] = cn(e, r);
1021
+ n[r] = _n(e, r);
1019
1022
  }), n;
1020
1023
  }
1021
- function un(e, t) {
1024
+ function Nn(e, t) {
1022
1025
  return !t || typeof t != "object" ? e : e.filter(
1023
1026
  (n) => Object.entries(t).every(([r, o]) => {
1024
- const s = n[r];
1025
- return o == null ? !0 : typeof o != "object" || Array.isArray(o) ? s === o : !("gt" in o && !(s > o.gt) || "gte" in o && !(s >= o.gte) || "lt" in o && !(s < o.lt) || "lte" in o && !(s <= o.lte) || "eq" in o && s !== o.eq || "ne" in o && s === o.ne || "in" in o && !o.in.includes(s));
1027
+ const i = n[r];
1028
+ return o == null ? !0 : typeof o != "object" || Array.isArray(o) ? i === o : !("gt" in o && !(i > o.gt) || "gte" in o && !(i >= o.gte) || "lt" in o && !(i < o.lt) || "lte" in o && !(i <= o.lte) || "eq" in o && i !== o.eq || "ne" in o && i === o.ne || "in" in o && !o.in.includes(i));
1026
1029
  })
1027
1030
  );
1028
1031
  }
1029
- function Br(e, t = null) {
1030
- return (t ? un(e, t) : e).reduce((r, o) => {
1031
- const s = Number(o.dx) || 0, i = Number(o.dy) || 0, c = Number(o.dz) || 0;
1032
- return r + s * i * c;
1032
+ function go(e, t = null) {
1033
+ return (t ? Nn(e, t) : e).reduce((r, o) => {
1034
+ const i = Number(o.dx) || 0, s = Number(o.dy) || 0, c = Number(o.dz) || 0;
1035
+ return r + i * s * c;
1033
1036
  }, 0);
1034
1037
  }
1035
- function mn(e, t, n) {
1038
+ function zn(e, t, n) {
1036
1039
  if (!t) return new n.Color("#888888");
1037
1040
  if (t.type === "numeric") {
1038
- const s = t.max - t.min, c = (1 - (s === 0 ? 0.5 : (e - t.min) / s)) * 240;
1041
+ const i = t.max - t.min, c = (1 - (i === 0 ? 0.5 : (e - t.min) / i)) * 240;
1039
1042
  return new n.Color().setHSL(c / 360, 0.8, 0.5);
1040
1043
  }
1041
1044
  const o = t.categories.indexOf(e) / Math.max(t.categories.length, 1) * 360;
1042
1045
  return new n.Color().setHSL(o / 360, 0.7, 0.5);
1043
1046
  }
1044
- const Ge = (e, t = null) => pe(e, null, t);
1045
- function dn(e) {
1047
+ const Ue = (e, t = null) => pe(e, null, t);
1048
+ function Mn(e) {
1046
1049
  if (!e.length) return null;
1047
- const t = e[0], n = X in t && G in t, r = Y in t && !n;
1050
+ const t = e[0], n = q in t && U in t, r = Y in t && !n;
1048
1051
  return n ? "interval" : r ? "point" : null;
1049
1052
  }
1050
1053
  function oe(e) {
1051
1054
  const t = Number(e);
1052
1055
  return Number.isFinite(t) ? t : null;
1053
1056
  }
1054
- function _t(e) {
1055
- const t = e[E] !== void 0 ? `${e[E]}`.trim() : "";
1057
+ function xt(e) {
1058
+ const t = e[v] !== void 0 ? `${e[v]}`.trim() : "";
1056
1059
  if (!t) return null;
1057
1060
  const n = oe(e[Y]);
1058
1061
  return n === null ? null : {
1059
- [E]: t,
1062
+ [v]: t,
1060
1063
  [Y]: n,
1064
+ [G]: oe(e[G]),
1061
1065
  [B]: oe(e[B]),
1062
- [j]: oe(e[j]),
1063
1066
  comments: e.comments != null ? `${e.comments}` : null,
1064
1067
  ...e
1065
1068
  };
1066
1069
  }
1067
- function xt(e) {
1068
- const t = e[E] !== void 0 ? `${e[E]}`.trim() : "";
1070
+ function It(e) {
1071
+ const t = e[v] !== void 0 ? `${e[v]}`.trim() : "";
1069
1072
  if (!t) return null;
1070
- const n = oe(e[X]), r = oe(e[G]);
1073
+ const n = oe(e[q]), r = oe(e[U]);
1071
1074
  if (n === null || r === null || r <= n) return null;
1072
1075
  const o = 0.5 * (n + r);
1073
1076
  return {
1074
- [E]: t,
1075
- [X]: n,
1076
- [G]: r,
1077
+ [v]: t,
1078
+ [q]: n,
1079
+ [U]: r,
1077
1080
  mid: o,
1081
+ [G]: oe(e[G]),
1078
1082
  [B]: oe(e[B]),
1079
- [j]: oe(e[j]),
1080
1083
  classification: e.classification != null ? `${e.classification}` : null,
1081
1084
  comments: e.comments != null ? `${e.comments}` : null,
1082
1085
  ...e
1083
1086
  };
1084
1087
  }
1085
- function Gr(e) {
1088
+ function _o(e) {
1086
1089
  const t = [], n = [];
1087
1090
  for (const r of e) {
1088
- const o = [], s = oe(r[B]), i = oe(r[j]);
1089
- s !== null && (s < 0 || s > 90) && o.push(`dip ${s} out of range [0, 90]`), i !== null && (i < 0 || i >= 360) && o.push(`azimuth ${i} out of range [0, 360)`), o.length ? n.push({ row: r, message: o.join("; ") }) : t.push(r);
1091
+ const o = [], i = oe(r[G]), s = oe(r[B]);
1092
+ i !== null && (i < 0 || i > 90) && o.push(`dip ${i} out of range [0, 90]`), s !== null && (s < 0 || s >= 360) && o.push(`azimuth ${s} out of range [0, 360)`), o.length ? n.push({ row: r, message: o.join("; ") }) : t.push(r);
1090
1093
  }
1091
1094
  return { valid: t, errors: n };
1092
1095
  }
1093
- function Ur(e, t = null) {
1096
+ function No(e, t = null) {
1094
1097
  return new Promise((n, r) => {
1095
1098
  const o = {
1096
1099
  header: !0,
1097
1100
  dynamicTyping: !0,
1098
1101
  skipEmptyLines: !0,
1099
- complete: (s) => {
1100
- const i = [];
1101
- for (const c of s.data) {
1102
- const u = Ge(c, t), l = _t(u);
1103
- l && i.push(l);
1102
+ complete: (i) => {
1103
+ const s = [];
1104
+ for (const c of i.data) {
1105
+ const u = Ue(c, t), l = xt(u);
1106
+ l && s.push(l);
1104
1107
  }
1105
- n(i);
1108
+ n(s);
1106
1109
  },
1107
- error: (s) => r(w("parseStructuralPointsCSV", s))
1110
+ error: (i) => r(w("parseStructuralPointsCSV", i))
1108
1111
  };
1109
1112
  typeof e == "string" && !e.startsWith("data:") && e.includes(`
1110
- `) ? W.parse(e, o) : W.parse(e, o);
1113
+ `) ? Z.parse(e, o) : Z.parse(e, o);
1111
1114
  });
1112
1115
  }
1113
- function Yr(e, t = null) {
1116
+ function zo(e, t = null) {
1114
1117
  return new Promise((n, r) => {
1115
- W.parse(e, {
1118
+ Z.parse(e, {
1116
1119
  header: !0,
1117
1120
  dynamicTyping: !0,
1118
1121
  skipEmptyLines: !0,
1119
1122
  complete: (o) => {
1120
- const s = [];
1121
- for (const i of o.data) {
1122
- const c = Ge(i, t), u = xt(c);
1123
- u && s.push(u);
1123
+ const i = [];
1124
+ for (const s of o.data) {
1125
+ const c = Ue(s, t), u = It(c);
1126
+ u && i.push(u);
1124
1127
  }
1125
- n(s);
1128
+ n(i);
1126
1129
  },
1127
1130
  error: (o) => r(w("parseStructuralIntervalsCSV", o))
1128
1131
  });
1129
1132
  });
1130
1133
  }
1131
- function fn(e, t = E) {
1134
+ function xn(e, t = v) {
1132
1135
  const n = /* @__PURE__ */ new Map();
1133
1136
  for (const r of e) {
1134
1137
  const o = r[t] != null ? String(r[t]).trim() : "";
@@ -1136,15 +1139,15 @@ function fn(e, t = E) {
1136
1139
  }
1137
1140
  return Array.from(n.values());
1138
1141
  }
1139
- function hn(e, t = null) {
1142
+ function In(e, t = null) {
1140
1143
  return new Promise((n, r) => {
1141
- W.parse(e, {
1144
+ Z.parse(e, {
1142
1145
  header: !0,
1143
1146
  dynamicTyping: !0,
1144
1147
  skipEmptyLines: !0,
1145
1148
  complete: (o) => {
1146
- const s = o.data.map((u) => Ge(u, t)), i = dn(s);
1147
- if (!i) {
1149
+ const i = o.data.map((u) => Ue(u, t)), s = Mn(i);
1150
+ if (!s) {
1148
1151
  r(w(
1149
1152
  "parseStructuralCSV",
1150
1153
  new Error("Structural CSV requires either 'depth' (point) or 'from'/'to' (interval) columns")
@@ -1152,69 +1155,69 @@ function hn(e, t = null) {
1152
1155
  return;
1153
1156
  }
1154
1157
  const c = [];
1155
- for (const u of s) {
1156
- const l = i === "interval" ? xt(u) : _t(u);
1158
+ for (const u of i) {
1159
+ const l = s === "interval" ? It(u) : xt(u);
1157
1160
  l && c.push(l);
1158
1161
  }
1159
- n({ schema: i, rows: c });
1162
+ n({ schema: s, rows: c });
1160
1163
  },
1161
1164
  error: (o) => r(w("parseStructuralCSV", o))
1162
1165
  });
1163
1166
  });
1164
1167
  }
1165
- function pn(e) {
1168
+ function An(e) {
1166
1169
  return new Promise((t) => {
1167
- W.parse(e, {
1170
+ Z.parse(e, {
1168
1171
  header: !0,
1169
1172
  dynamicTyping: !0,
1170
1173
  skipEmptyLines: !0,
1171
1174
  complete: (n) => {
1172
1175
  const r = /* @__PURE__ */ new Map();
1173
- for (const s of n.data) {
1174
- const i = pe(s), c = i[E] != null ? `${i[E]}`.trim() : "";
1176
+ for (const i of n.data) {
1177
+ const s = pe(i), c = s[v] != null ? `${s[v]}`.trim() : "";
1175
1178
  if (!c) continue;
1176
- const u = Number(i[X]), l = Number(i[G]);
1179
+ const u = Number(s[q]), l = Number(s[U]);
1177
1180
  if (!Number.isFinite(u) || !Number.isFinite(l) || l <= u) continue;
1178
- const a = (u + l) / 2, { [B]: m, [j]: d, ...f } = i, b = {
1181
+ const a = (u + l) / 2, { [G]: d, [B]: m, ...f } = s, b = {
1179
1182
  ...f,
1180
- [E]: c,
1181
- [X]: u,
1182
- [G]: l,
1183
- [Re]: a,
1183
+ [v]: c,
1184
+ [q]: u,
1185
+ [U]: l,
1186
+ [je]: a,
1184
1187
  [Y]: a,
1185
1188
  // unified depth field for y-axis rendering
1186
1189
  _source: "assay"
1187
1190
  };
1188
1191
  r.has(c) || r.set(c, []), r.get(c).push(b);
1189
1192
  }
1190
- const o = Array.from(r.entries()).map(([s, i]) => ({
1191
- holeId: s,
1192
- points: i.sort((c, u) => c[X] - u[X])
1193
+ const o = Array.from(r.entries()).map(([i, s]) => ({
1194
+ holeId: i,
1195
+ points: s.sort((c, u) => c[q] - u[q])
1193
1196
  }));
1194
1197
  t(o);
1195
1198
  }
1196
1199
  });
1197
1200
  });
1198
1201
  }
1199
- async function qr({ assayCsv: e, structuralCsv: t } = {}) {
1202
+ async function Mo({ assayCsv: e, structuralCsv: t } = {}) {
1200
1203
  const [n, r] = await Promise.all([
1201
- e ? pn(e) : Promise.resolve([]),
1202
- t ? hn(t).then(
1203
- ({ rows: s }) => fn(s.map((i) => ({ ...i, _source: "structural" })))
1204
+ e ? An(e) : Promise.resolve([]),
1205
+ t ? In(t).then(
1206
+ ({ rows: i }) => xn(i.map((s) => ({ ...s, _source: "structural" })))
1204
1207
  ) : Promise.resolve([])
1205
- ]), o = new Map(n.map((s) => [s.holeId, { ...s, points: [...s.points] }]));
1206
- for (const s of r) {
1207
- const i = s.holeId;
1208
- if (i)
1209
- if (o.has(i)) {
1210
- const c = o.get(i);
1211
- o.set(i, { ...c, points: [...c.points, ...s.points || []] });
1208
+ ]), o = new Map(n.map((i) => [i.holeId, { ...i, points: [...i.points] }]));
1209
+ for (const i of r) {
1210
+ const s = i.holeId;
1211
+ if (s)
1212
+ if (o.has(s)) {
1213
+ const c = o.get(s);
1214
+ o.set(s, { ...c, points: [...c.points, ...i.points || []] });
1212
1215
  } else
1213
- o.set(i, s);
1216
+ o.set(s, i);
1214
1217
  }
1215
1218
  return { holes: Array.from(o.values()) };
1216
1219
  }
1217
- function bn(e, t) {
1220
+ function En(e, t) {
1218
1221
  if (!e || e.length === 0 || !Number.isFinite(t)) return null;
1219
1222
  const n = e.length;
1220
1223
  if (n === 1) {
@@ -1223,181 +1226,181 @@ function bn(e, t) {
1223
1226
  }
1224
1227
  let r = -1;
1225
1228
  for (let y = 0; y < n - 1; y++) {
1226
- const I = Number(e[y].md), z = Number(e[y + 1].md);
1227
- if (t >= I && t <= z) {
1229
+ const E = Number(e[y].md), M = Number(e[y + 1].md);
1230
+ if (t >= E && t <= M) {
1228
1231
  r = y;
1229
1232
  break;
1230
1233
  }
1231
1234
  }
1232
- let o, s, i;
1235
+ let o, i, s;
1233
1236
  if (r === -1) {
1234
- t < Number(e[0].md) ? (o = e[0], s = e[1]) : (o = e[n - 2], s = e[n - 1]);
1235
- const y = Number(o.md), z = Number(s.md) - y;
1236
- i = z > 0 ? (t - y) / z : t < y ? 0 : 1;
1237
+ t < Number(e[0].md) ? (o = e[0], i = e[1]) : (o = e[n - 2], i = e[n - 1]);
1238
+ const y = Number(o.md), M = Number(i.md) - y;
1239
+ s = M > 0 ? (t - y) / M : t < y ? 0 : 1;
1237
1240
  } else {
1238
- o = e[r], s = e[r + 1];
1239
- const y = Number(o.md), z = Number(s.md) - y;
1240
- i = z > 0 ? (t - y) / z : 0;
1241
+ o = e[r], i = e[r + 1];
1242
+ const y = Number(o.md), M = Number(i.md) - y;
1243
+ s = M > 0 ? (t - y) / M : 0;
1241
1244
  }
1242
- const c = Number(o.x) + i * (Number(s.x) - Number(o.x)), u = Number(o.y) + i * (Number(s.y) - Number(o.y)), l = Number(o.z) + i * (Number(s.z) - Number(o.z));
1243
- let a, m, d;
1244
- const f = Number(o.azimuth), b = Number(o.dip), p = Number(s.azimuth), h = Number(s.dip);
1245
+ const c = Number(o.x) + s * (Number(i.x) - Number(o.x)), u = Number(o.y) + s * (Number(i.y) - Number(o.y)), l = Number(o.z) + s * (Number(i.z) - Number(o.z));
1246
+ let a, d, m;
1247
+ const f = Number(o.azimuth), b = Number(o.dip), p = Number(i.azimuth), h = Number(i.dip);
1245
1248
  if (Number.isFinite(f) && Number.isFinite(b)) {
1246
- const y = Number.isFinite(p) && Number.isFinite(h) ? f + i * (p - f) : f, I = Number.isFinite(p) && Number.isFinite(h) ? b + i * (h - b) : b, z = y * Math.PI / 180, x = I * Math.PI / 180;
1247
- a = Math.cos(x) * Math.sin(z), m = Math.cos(x) * Math.cos(z), d = -Math.sin(x);
1249
+ const y = Number.isFinite(p) && Number.isFinite(h) ? f + s * (p - f) : f, E = Number.isFinite(p) && Number.isFinite(h) ? b + s * (h - b) : b, M = y * Math.PI / 180, z = E * Math.PI / 180;
1250
+ a = Math.cos(z) * Math.sin(M), d = Math.cos(z) * Math.cos(M), m = -Math.sin(z);
1248
1251
  } else {
1249
- const y = Number(s.x) - Number(o.x), I = Number(s.y) - Number(o.y), z = Number(s.z) - Number(o.z), x = Math.sqrt(y * y + I * I + z * z);
1250
- if (x < 1e-10) return { x: c, y: u, z: l, dx: 0, dy: 0, dz: -1 };
1251
- a = y / x, m = I / x, d = z / x;
1252
+ const y = Number(i.x) - Number(o.x), E = Number(i.y) - Number(o.y), M = Number(i.z) - Number(o.z), z = Math.sqrt(y * y + E * E + M * M);
1253
+ if (z < 1e-10) return { x: c, y: u, z: l, dx: 0, dy: 0, dz: -1 };
1254
+ a = y / z, d = E / z, m = M / z;
1252
1255
  }
1253
- const _ = Math.sqrt(a * a + m * m + d * d);
1254
- return _ < 1e-10 ? { x: c, y: u, z: l, dx: 0, dy: 0, dz: -1 } : { x: c, y: u, z: l, dx: a / _, dy: m / _, dz: d / _ };
1256
+ const N = Math.sqrt(a * a + d * d + m * m);
1257
+ return N < 1e-10 ? { x: c, y: u, z: l, dx: 0, dy: 0, dz: -1 } : { x: c, y: u, z: l, dx: a / N, dy: d / N, dz: m / N };
1255
1258
  }
1256
- function yn(e, t, n, r = {}) {
1257
- const { betaZeroAxis: o = "B", betaHandedness: s = 1 } = r, { dx: i, dy: c, dz: u } = n, l = [i, c, u];
1259
+ function vn(e, t, n, r = {}) {
1260
+ const { betaZeroAxis: o = "B", betaHandedness: i = 1 } = r, { dx: s, dy: c, dz: u } = n, l = [s, c, u];
1258
1261
  let a = [0, 0, 1];
1259
- const m = l[0] * a[0] + l[1] * a[1] + l[2] * a[2];
1260
- Math.abs(m) > 0.99 && (a = [0, 1, 0]);
1261
- const d = [
1262
+ const d = l[0] * a[0] + l[1] * a[1] + l[2] * a[2];
1263
+ Math.abs(d) > 0.99 && (a = [0, 1, 0]);
1264
+ const m = [
1262
1265
  a[1] * l[2] - a[2] * l[1],
1263
1266
  a[2] * l[0] - a[0] * l[2],
1264
1267
  a[0] * l[1] - a[1] * l[0]
1265
- ], f = Math.sqrt(d[0] ** 2 + d[1] ** 2 + d[2] ** 2), b = f > 1e-10 ? [d[0] / f, d[1] / f, d[2] / f] : [1, 0, 0], p = [
1268
+ ], f = Math.sqrt(m[0] ** 2 + m[1] ** 2 + m[2] ** 2), b = f > 1e-10 ? [m[0] / f, m[1] / f, m[2] / f] : [1, 0, 0], p = [
1266
1269
  l[1] * b[2] - l[2] * b[1],
1267
1270
  l[2] * b[0] - l[0] * b[2],
1268
1271
  l[0] * b[1] - l[1] * b[0]
1269
- ], h = Math.sqrt(p[0] ** 2 + p[1] ** 2 + p[2] ** 2), _ = h > 1e-10 ? [p[0] / h, p[1] / h, p[2] / h] : [0, 1, 0], y = o === "R" ? b : _, I = t * Math.PI / 180 * s, z = Math.cos(I), x = Math.sin(I), D = y[0] * l[0] + y[1] * l[1] + y[2] * l[2], S = [
1272
+ ], h = Math.sqrt(p[0] ** 2 + p[1] ** 2 + p[2] ** 2), N = h > 1e-10 ? [p[0] / h, p[1] / h, p[2] / h] : [0, 1, 0], y = o === "R" ? b : N, E = t * Math.PI / 180 * i, M = Math.cos(E), z = Math.sin(E), P = y[0] * l[0] + y[1] * l[1] + y[2] * l[2], D = [
1270
1273
  l[1] * y[2] - l[2] * y[1],
1271
1274
  l[2] * y[0] - l[0] * y[2],
1272
1275
  l[0] * y[1] - l[1] * y[0]
1273
- ], M = [
1274
- y[0] * z + S[0] * x + l[0] * D * (1 - z),
1275
- y[1] * z + S[1] * x + l[1] * D * (1 - z),
1276
- y[2] * z + S[2] * x + l[2] * D * (1 - z)
1277
- ], O = (90 - e) * Math.PI / 180, $ = Math.cos(O), Z = Math.sin(O), T = $ * M[0] + Z * l[0], R = $ * M[1] + Z * l[1], q = $ * M[2] + Z * l[2], A = Math.sqrt(T * T + R * R + q * q);
1278
- return A < 1e-10 ? { nx: 0, ny: 0, nz: 1 } : { nx: T / A, ny: R / A, nz: q / A };
1279
- }
1280
- function gn(e, t, n = {}) {
1276
+ ], x = [
1277
+ y[0] * M + D[0] * z + l[0] * P * (1 - M),
1278
+ y[1] * M + D[1] * z + l[1] * P * (1 - M),
1279
+ y[2] * M + D[2] * z + l[2] * P * (1 - M)
1280
+ ], V = (90 - e) * Math.PI / 180, H = Math.cos(V), W = Math.sin(V), O = H * x[0] + W * l[0], $ = H * x[1] + W * l[1], j = H * x[2] + W * l[2], S = Math.sqrt(O * O + $ * $ + j * j);
1281
+ return S < 1e-10 ? { nx: 0, ny: 0, nz: 1 } : { nx: O / S, ny: $ / S, nz: j / S };
1282
+ }
1283
+ function Sn(e, t, n = {}) {
1281
1284
  if (!(e != null && e.length) || !(t != null && t.length)) return [];
1282
1285
  const r = /* @__PURE__ */ new Map();
1283
- for (const s of t) {
1284
- const i = s.hole_id != null ? `${s.hole_id}`.trim().toLowerCase() : "";
1285
- i && (r.has(i) || r.set(i, []), r.get(i).push(s));
1286
+ for (const i of t) {
1287
+ const s = i.hole_id != null ? `${i.hole_id}`.trim().toLowerCase() : "";
1288
+ s && (r.has(s) || r.set(s, []), r.get(s).push(i));
1286
1289
  }
1287
- for (const [, s] of r)
1288
- s.sort((i, c) => Number(i.md) - Number(c.md));
1290
+ for (const [, i] of r)
1291
+ i.sort((s, c) => Number(s.md) - Number(c.md));
1289
1292
  const o = [];
1290
- for (const s of e) {
1291
- const i = s.hole_id != null ? `${s.hole_id}`.trim().toLowerCase() : "";
1292
- if (!i) continue;
1293
- const c = r.get(i);
1293
+ for (const i of e) {
1294
+ const s = i.hole_id != null ? `${i.hole_id}`.trim().toLowerCase() : "";
1295
+ if (!s) continue;
1296
+ const c = r.get(s);
1294
1297
  if (!c || c.length === 0) continue;
1295
- const u = s.depth != null ? Number(s.depth) : s.mid != null ? Number(s.mid) : null;
1298
+ const u = i.depth != null ? Number(i.depth) : i.mid != null ? Number(i.mid) : null;
1296
1299
  if (!Number.isFinite(u)) continue;
1297
- const l = bn(c, u);
1300
+ const l = En(c, u);
1298
1301
  if (!l) continue;
1299
- const { x: a, y: m, z: d, dx: f, dy: b, dz: p } = l;
1300
- let h, _, y;
1301
- const I = s.alpha != null ? Number(s.alpha) : null, z = s.beta != null ? Number(s.beta) : null;
1302
- if (Number.isFinite(I)) {
1303
- const x = Number.isFinite(z) ? z : 0, D = yn(I, x, { dx: f, dy: b, dz: p }, n);
1304
- h = D.nx, _ = D.ny, y = D.nz;
1302
+ const { x: a, y: d, z: m, dx: f, dy: b, dz: p } = l;
1303
+ let h, N, y;
1304
+ const E = i.alpha != null ? Number(i.alpha) : null, M = i.beta != null ? Number(i.beta) : null;
1305
+ if (Number.isFinite(E)) {
1306
+ const z = Number.isFinite(M) ? M : 0, P = vn(E, z, { dx: f, dy: b, dz: p }, n);
1307
+ h = P.nx, N = P.ny, y = P.nz;
1305
1308
  } else {
1306
- const x = s.dip != null ? Number(s.dip) : null, D = s.azimuth != null ? Number(s.azimuth) : null;
1307
- if (!Number.isFinite(x) || !Number.isFinite(D)) continue;
1308
- const S = x * Math.PI / 180, M = D * Math.PI / 180;
1309
- h = Math.sin(M) * Math.sin(S), _ = Math.cos(M) * Math.sin(S), y = Math.cos(S);
1309
+ const z = i.dip != null ? Number(i.dip) : null, P = i.azimuth != null ? Number(i.azimuth) : null;
1310
+ if (!Number.isFinite(z) || !Number.isFinite(P)) continue;
1311
+ const D = z * Math.PI / 180, x = P * Math.PI / 180;
1312
+ h = Math.sin(x) * Math.sin(D), N = Math.cos(x) * Math.sin(D), y = Math.cos(D);
1310
1313
  }
1311
- o.push({ ...s, x: a, y: m, z: d, nx: h, ny: _, nz: y });
1314
+ o.push({ ...i, x: a, y: d, z: m, nx: h, ny: N, nz: y });
1312
1315
  }
1313
1316
  return o;
1314
1317
  }
1315
- const Qe = "#8b1e3f", _n = "#a8324f", xn = "#6b7280", Nn = { l: 4, r: 4, t: 4, b: 4 }, et = 10, tt = 12;
1316
- function nt(e) {
1318
+ const tt = "#8b1e3f", Pn = "#a8324f", Dn = "#6b7280", kn = { l: 4, r: 4, t: 4, b: 4 }, nt = 10, rt = 12;
1319
+ function ot(e) {
1317
1320
  return e ? typeof e == "string" ? { text: e } : e : {};
1318
1321
  }
1319
- function Nt(e = {}) {
1320
- const t = nt(e.xaxis && e.xaxis.title), n = nt(e.yaxis && e.yaxis.title);
1322
+ function At(e = {}) {
1323
+ const t = ot(e.xaxis && e.xaxis.title), n = ot(e.yaxis && e.yaxis.title);
1321
1324
  return {
1322
1325
  ...e,
1323
- margin: Nn,
1326
+ margin: kn,
1324
1327
  autosize: !0,
1325
1328
  width: void 0,
1326
1329
  xaxis: {
1327
1330
  ...e.xaxis || {},
1328
1331
  tickfont: {
1329
1332
  ...e.xaxis && e.xaxis.tickfont || {},
1330
- size: et
1333
+ size: nt
1331
1334
  },
1332
1335
  title: {
1333
1336
  ...t,
1334
- font: { ...t.font || {}, size: tt }
1337
+ font: { ...t.font || {}, size: rt }
1335
1338
  }
1336
1339
  },
1337
1340
  yaxis: {
1338
1341
  ...e.yaxis || {},
1339
1342
  tickfont: {
1340
1343
  ...e.yaxis && e.yaxis.tickfont || {},
1341
- size: et
1344
+ size: nt
1342
1345
  },
1343
1346
  title: {
1344
1347
  ...n,
1345
- font: { ...n.font || {}, size: tt }
1348
+ font: { ...n.font || {}, size: rt }
1346
1349
  }
1347
1350
  }
1348
1351
  };
1349
1352
  }
1350
- function zn(e, t) {
1353
+ function Cn(e, t) {
1351
1354
  var r;
1352
1355
  if (!e || !t) return !1;
1353
1356
  const n = e.points || [];
1354
1357
  for (let o = 0; o < n.length; o += 1) {
1355
- const s = (r = n[o]) == null ? void 0 : r[t];
1356
- if (s != null && (typeof s == "number" && Number.isFinite(s) || typeof s == "string" && s.trim() !== ""))
1358
+ const i = (r = n[o]) == null ? void 0 : r[t];
1359
+ if (i != null && (typeof i == "number" && Number.isFinite(i) || typeof i == "string" && i.trim() !== ""))
1357
1360
  return !0;
1358
1361
  }
1359
1362
  return !1;
1360
1363
  }
1361
- function Mn(e, t, n) {
1364
+ function Ln(e, t, n) {
1362
1365
  if (!e || !t) return [];
1363
- const r = (e == null ? void 0 : e.points) || [], o = [], s = /* @__PURE__ */ new Set();
1364
- return r.forEach((i) => {
1366
+ const r = (e == null ? void 0 : e.points) || [], o = [], i = /* @__PURE__ */ new Set();
1367
+ return r.forEach((s) => {
1365
1368
  let c = Number(
1366
- i.from ?? i.samp_from ?? i.sample_from ?? i.fromdepth ?? i.from_depth ?? i.depth_from
1369
+ s.from ?? s.samp_from ?? s.sample_from ?? s.fromdepth ?? s.from_depth ?? s.depth_from
1367
1370
  ), u = Number(
1368
- i.to ?? i.samp_to ?? i.sample_to ?? i.todepth ?? i.to_depth ?? i.depth_to
1371
+ s.to ?? s.samp_to ?? s.sample_to ?? s.todepth ?? s.to_depth ?? s.depth_to
1369
1372
  );
1370
1373
  if (!Number.isFinite(c) || !Number.isFinite(u)) {
1371
- const f = Number(i.depth ?? i.md);
1374
+ const f = Number(s.depth ?? s.md);
1372
1375
  Number.isFinite(f) && (c = f, u = f);
1373
1376
  }
1374
- const l = i == null ? void 0 : i[t];
1377
+ const l = s == null ? void 0 : s[t];
1375
1378
  if (!Number.isFinite(c) || !Number.isFinite(u) || u < c || l == null || l === "" || n && typeof l == "string" && /^(nan|null|none)$/i.test(l.trim())) return;
1376
1379
  const a = `${t}:${c}-${u}`;
1377
- if (s.has(a)) return;
1378
- s.add(a);
1379
- const m = (c + u) / 2, d = n ? l : Number(l);
1380
- !n && !Number.isFinite(d) || o.push({
1381
- z: m,
1382
- val: d,
1380
+ if (i.has(a)) return;
1381
+ i.add(a);
1382
+ const d = (c + u) / 2, m = n ? l : Number(l);
1383
+ !n && !Number.isFinite(m) || o.push({
1384
+ z: d,
1385
+ val: m,
1383
1386
  from: c,
1384
1387
  to: u,
1385
- errorPlus: u - m,
1386
- errorMinus: m - c
1388
+ errorPlus: u - d,
1389
+ errorMinus: d - c
1387
1390
  });
1388
- }), o.sort((i, c) => c.z - i.z);
1391
+ }), o.sort((s, c) => c.z - s.z);
1389
1392
  }
1390
- function Cn(e, t) {
1393
+ function On(e, t) {
1391
1394
  if (!e.length) return { data: [], layout: {} };
1392
- const n = [...e].sort((a, m) => m.z - a.z), r = [];
1395
+ const n = [...e].sort((a, d) => d.z - a.z), r = [];
1393
1396
  for (let a = 0; a < n.length; a += 1) {
1394
- const m = n[a], d = n[a + 1], f = m.z, b = d ? d.z : m.z - 20;
1397
+ const d = n[a], m = n[a + 1], f = d.z, b = m ? m.z : d.z - 20;
1395
1398
  if (b === f) continue;
1396
- const p = m.val == null ? "" : String(m.val).trim();
1397
- !p || /^(nan|null|none)$/i.test(p) || r.push({ y0: f, y1: b, category: p, fromVal: m.from, toVal: m.to });
1399
+ const p = d.val == null ? "" : String(d.val).trim();
1400
+ !p || /^(nan|null|none)$/i.test(p) || r.push({ y0: f, y1: b, category: p, fromVal: d.from, toVal: d.to });
1398
1401
  }
1399
- const o = ["#4e79a7", "#f28e2b", "#e15759", "#76b7b2", "#59a14f", "#edc948", "#b07aa1", "#ff9da7", "#9c755f", "#bab0ac", "#d4a6c8", "#86bcb6"], s = [...new Set(r.map((a) => a.category))], i = Object.fromEntries(
1400
- s.map((a, m) => [a, o[m % o.length]])
1402
+ const o = ["#4e79a7", "#f28e2b", "#e15759", "#76b7b2", "#59a14f", "#edc948", "#b07aa1", "#ff9da7", "#9c755f", "#bab0ac", "#d4a6c8", "#86bcb6"], i = [...new Set(r.map((a) => a.category))], s = Object.fromEntries(
1403
+ i.map((a, d) => [a, o[d % o.length]])
1401
1404
  ), c = r.map((a) => ({
1402
1405
  type: "rect",
1403
1406
  xref: "x",
@@ -1406,7 +1409,7 @@ function Cn(e, t) {
1406
1409
  x1: 1,
1407
1410
  y0: a.y0,
1408
1411
  y1: a.y1,
1409
- fillcolor: i[a.category],
1412
+ fillcolor: s[a.category],
1410
1413
  line: { width: 0 }
1411
1414
  }));
1412
1415
  return { data: [{
@@ -1419,7 +1422,7 @@ function Cn(e, t) {
1419
1422
  hoverinfo: "text",
1420
1423
  customdata: r.map((a) => [Math.min(a.fromVal, a.toVal), Math.max(a.fromVal, a.toVal)]),
1421
1424
  hovertemplate: "Category: %{text}<br>from: %{customdata[0]} to: %{customdata[1]}<extra></extra>"
1422
- }], layout: Nt({
1425
+ }], layout: At({
1423
1426
  xaxis: { range: [0, 1], visible: !1, fixedrange: !0 },
1424
1427
  yaxis: { title: "Depth (m)", autorange: "reversed", zeroline: !1 },
1425
1428
  shapes: c,
@@ -1427,9 +1430,9 @@ function Cn(e, t) {
1427
1430
  title: t || void 0
1428
1431
  }) };
1429
1432
  }
1430
- function In(e, t, n) {
1433
+ function Tn(e, t, n) {
1431
1434
  if (!e.length) return { data: [], layout: {} };
1432
- const r = n === "bar", o = n === "markers", s = n === "line", i = {
1435
+ const r = n === "bar", o = n === "markers", i = n === "line", s = {
1433
1436
  x: e.map((a) => a.val),
1434
1437
  y: e.map((a) => a.z),
1435
1438
  hovertemplate: `${t}: %{x}<br>from: %{customdata[0]} to: %{customdata[1]}<extra></extra>`,
@@ -1441,32 +1444,32 @@ function In(e, t, n) {
1441
1444
  arrayminus: e.map((a) => a.errorMinus),
1442
1445
  thickness: 1.5,
1443
1446
  width: 2,
1444
- color: xn
1447
+ color: Dn
1445
1448
  };
1446
1449
  return { data: [r ? {
1447
- ...i,
1450
+ ...s,
1448
1451
  type: "bar",
1449
1452
  orientation: "h",
1450
- marker: { color: Qe },
1453
+ marker: { color: tt },
1451
1454
  error_y: c
1452
1455
  } : {
1453
- ...i,
1456
+ ...s,
1454
1457
  type: "scatter",
1455
- mode: o ? "markers" : s ? "lines" : "lines+markers",
1456
- line: { color: Qe, width: 2 },
1457
- marker: { size: 7, color: _n },
1458
- error_y: s ? void 0 : c
1459
- }], layout: Nt({
1458
+ mode: o ? "markers" : i ? "lines" : "lines+markers",
1459
+ line: { color: tt, width: 2 },
1460
+ marker: { size: 7, color: Pn },
1461
+ error_y: i ? void 0 : c
1462
+ }], layout: At({
1460
1463
  xaxis: { title: t, zeroline: !1 },
1461
1464
  yaxis: { title: "Depth (m)", autorange: "reversed", zeroline: !1 },
1462
1465
  barmode: "overlay",
1463
1466
  showlegend: !1
1464
1467
  }) };
1465
1468
  }
1466
- function An({ points: e, isCategorical: t, property: n, chartType: r }) {
1467
- return !e || !e.length || !n ? { data: [], layout: {} } : t || r === "categorical" ? Cn(e, n) : In(e, n, r);
1469
+ function Fn({ points: e, isCategorical: t, property: n, chartType: r }) {
1470
+ return !e || !e.length || !n ? { data: [], layout: {} } : t || r === "categorical" ? On(e, n) : Tn(e, n, r);
1468
1471
  }
1469
- const zt = [
1472
+ const Et = [
1470
1473
  "#0f172a",
1471
1474
  "#1e3a5f",
1472
1475
  "#7c3aed",
@@ -1477,24 +1480,24 @@ const zt = [
1477
1480
  "#db2777",
1478
1481
  "#65a30d",
1479
1482
  "#9333ea"
1480
- ], vn = { l: 4, r: 4, t: 4, b: 4 }, rt = 10, ot = 12;
1481
- function Mt(e = {}) {
1483
+ ], Vn = { l: 4, r: 4, t: 4, b: 4 }, it = 10, st = 12;
1484
+ function vt(e = {}) {
1482
1485
  return {
1483
1486
  ...e,
1484
- margin: vn,
1487
+ margin: Vn,
1485
1488
  autosize: !0,
1486
1489
  width: void 0,
1487
1490
  xaxis: {
1488
1491
  ...e.xaxis || {},
1489
1492
  tickfont: {
1490
1493
  ...e.xaxis && e.xaxis.tickfont || {},
1491
- size: rt
1494
+ size: it
1492
1495
  },
1493
1496
  title: {
1494
1497
  ...e.xaxis && e.xaxis.title || {},
1495
1498
  font: {
1496
1499
  ...e.xaxis && e.xaxis.title && e.xaxis.title.font || {},
1497
- size: ot
1500
+ size: st
1498
1501
  }
1499
1502
  }
1500
1503
  },
@@ -1502,28 +1505,28 @@ function Mt(e = {}) {
1502
1505
  ...e.yaxis || {},
1503
1506
  tickfont: {
1504
1507
  ...e.yaxis && e.yaxis.tickfont || {},
1505
- size: rt
1508
+ size: it
1506
1509
  },
1507
1510
  title: {
1508
1511
  ...e.yaxis && e.yaxis.title || {},
1509
1512
  font: {
1510
1513
  ...e.yaxis && e.yaxis.title && e.yaxis.title.font || {},
1511
- size: ot
1514
+ size: st
1512
1515
  }
1513
1516
  }
1514
1517
  }
1515
1518
  };
1516
1519
  }
1517
- function En(e, {
1520
+ function wn(e, {
1518
1521
  tailScale: t = 5,
1519
1522
  colorBy: n = null,
1520
- palette: r = zt,
1523
+ palette: r = Et,
1521
1524
  depthCol: o = Y,
1522
- dipCol: s = B,
1523
- azCol: i = j
1525
+ dipCol: i = G,
1526
+ azCol: s = B
1524
1527
  } = {}) {
1525
1528
  const c = e.filter(
1526
- (b) => b[o] != null && b[s] != null && b[i] != null
1529
+ (b) => b[o] != null && b[i] != null && b[s] != null
1527
1530
  );
1528
1531
  if (!c.length)
1529
1532
  return { data: [], layout: {} };
@@ -1533,34 +1536,34 @@ function En(e, {
1533
1536
  });
1534
1537
  const l = /* @__PURE__ */ new Map(), a = [];
1535
1538
  for (const b of c) {
1536
- const p = Number(b[o]), h = Number(b[s]), _ = Number(b[i]), y = n ? b[n] ?? "_default" : "_default", I = n ? u[y] ?? "#0f172a" : "#0f172a";
1537
- l.has(y) || l.set(y, { xs: [], ys: [], dips: [], azs: [], color: I });
1538
- const z = l.get(y);
1539
- z.xs.push(h), z.ys.push(p), z.dips.push(h), z.azs.push(_);
1540
- const x = _ * Math.PI / 180, D = t * (Math.abs(h) / 90), S = Math.sin(x) * D, M = Math.cos(x) * D;
1539
+ const p = Number(b[o]), h = Number(b[i]), N = Number(b[s]), y = n ? b[n] ?? "_default" : "_default", E = n ? u[y] ?? "#0f172a" : "#0f172a";
1540
+ l.has(y) || l.set(y, { xs: [], ys: [], dips: [], azs: [], color: E });
1541
+ const M = l.get(y);
1542
+ M.xs.push(h), M.ys.push(p), M.dips.push(h), M.azs.push(N);
1543
+ const z = N * Math.PI / 180, P = t * (Math.abs(h) / 90), D = Math.sin(z) * P, x = Math.cos(z) * P;
1541
1544
  a.push({
1542
1545
  type: "line",
1543
1546
  x0: h,
1544
1547
  y0: p,
1545
- x1: h + S,
1546
- y1: p + M,
1547
- line: { color: I, width: 2 }
1548
+ x1: h + D,
1549
+ y1: p + x,
1550
+ line: { color: E, width: 2 }
1548
1551
  });
1549
1552
  }
1550
- const m = [], d = n && l.size > 1;
1553
+ const d = [], m = n && l.size > 1;
1551
1554
  for (const [b, p] of l.entries())
1552
- m.push({
1555
+ d.push({
1553
1556
  type: "scatter",
1554
1557
  x: p.xs,
1555
1558
  y: p.ys,
1556
1559
  mode: "markers",
1557
1560
  name: b !== "_default" ? String(b) : void 0,
1558
1561
  marker: { size: 8, color: p.color },
1559
- showlegend: d && b !== "_default",
1560
- customdata: p.dips.map((h, _) => [h, p.azs[_]]),
1562
+ showlegend: m && b !== "_default",
1563
+ customdata: p.dips.map((h, N) => [h, p.azs[N]]),
1561
1564
  hovertemplate: "Depth: %{y}<br>Dip: %{customdata[0]}<br>Az: %{customdata[1]}<extra></extra>"
1562
1565
  });
1563
- return { data: m, layout: {
1566
+ return { data: d, layout: {
1564
1567
  shapes: a,
1565
1568
  height: 400,
1566
1569
  margin: { l: 40, r: 10, t: 10, b: 40 },
@@ -1572,36 +1575,36 @@ function En(e, {
1572
1575
  tickvals: [-90, -60, -30, 0, 30, 60, 90]
1573
1576
  },
1574
1577
  yaxis: { title: "Depth (m)", autorange: "reversed" },
1575
- showlegend: !!d
1578
+ showlegend: !!m
1576
1579
  } };
1577
1580
  }
1578
- function Xr(e, {
1581
+ function xo(e, {
1579
1582
  labelCol: t = "structure_type",
1580
- palette: n = zt,
1581
- fromCol: r = X,
1582
- toCol: o = G
1583
+ palette: n = Et,
1584
+ fromCol: r = q,
1585
+ toCol: o = U
1583
1586
  } = {}) {
1584
- const s = e.filter((m) => m[r] != null && m[o] != null && Number(m[o]) > Number(m[r])).filter((m) => {
1585
- const d = m[t];
1586
- if (d == null) return !1;
1587
- const f = String(d).trim();
1587
+ const i = e.filter((d) => d[r] != null && d[o] != null && Number(d[o]) > Number(d[r])).filter((d) => {
1588
+ const m = d[t];
1589
+ if (m == null) return !1;
1590
+ const f = String(m).trim();
1588
1591
  return f !== "" && !/^(nan|null|none)$/i.test(f);
1589
- }).map((m) => ({ from: Number(m[r]), to: Number(m[o]), label: String(m[t]).trim() })).sort((m, d) => m.from - d.from);
1590
- if (!s.length)
1592
+ }).map((d) => ({ from: Number(d[r]), to: Number(d[o]), label: String(d[t]).trim() })).sort((d, m) => d.from - m.from);
1593
+ if (!i.length)
1591
1594
  return { data: [], layout: {} };
1592
- const i = [], c = [], u = [];
1593
- return s.forEach((m, d) => {
1594
- i.push({
1595
+ const s = [], c = [], u = [];
1596
+ return i.forEach((d, m) => {
1597
+ s.push({
1595
1598
  type: "rect",
1596
1599
  xref: "x",
1597
1600
  yref: "y",
1598
1601
  x0: 0,
1599
1602
  x1: 1,
1600
- y0: m.from,
1601
- y1: m.to,
1602
- fillcolor: n[d % n.length],
1603
+ y0: d.from,
1604
+ y1: d.to,
1605
+ fillcolor: n[m % n.length],
1603
1606
  line: { width: 0 }
1604
- }), c.push(0.5 * (m.from + m.to)), u.push(m.label);
1607
+ }), c.push(0.5 * (d.from + d.to)), u.push(d.label);
1605
1608
  }), { data: [{
1606
1609
  type: "scatter",
1607
1610
  x: Array(u.length).fill(0.5),
@@ -1611,40 +1614,40 @@ function Xr(e, {
1611
1614
  textposition: "middle center",
1612
1615
  showlegend: !1,
1613
1616
  hoverinfo: "text"
1614
- }], layout: Mt({
1615
- shapes: i,
1617
+ }], layout: vt({
1618
+ shapes: s,
1616
1619
  height: 400,
1617
1620
  xaxis: { range: [0, 1], visible: !1, fixedrange: !0 },
1618
1621
  yaxis: { title: "Depth (m)", autorange: "reversed" },
1619
1622
  showlegend: !1
1620
1623
  }) };
1621
1624
  }
1622
- function Dn(e, t) {
1625
+ function Hn(e, t) {
1623
1626
  if (!e) return "";
1624
1627
  const n = String(e).trim().split(/\s+/), r = [];
1625
1628
  let o = "";
1626
- for (const s of n)
1627
- o && o.length + 1 + s.length > t ? (r.push(o), o = s) : o = o ? `${o} ${s}` : s;
1629
+ for (const i of n)
1630
+ o && o.length + 1 + i.length > t ? (r.push(o), o = i) : o = o ? `${o} ${i}` : i;
1628
1631
  return o && r.push(o), r.join("<br>");
1629
1632
  }
1630
- function Sn(e, {
1633
+ function $n(e, {
1631
1634
  commentCol: t = "comments",
1632
- fromCol: n = X,
1633
- toCol: r = G,
1635
+ fromCol: n = q,
1636
+ toCol: r = U,
1634
1637
  bgColor: o = "#f1f5f9",
1635
- borderColor: s = "#cbd5e1",
1636
- textColor: i = "#1e293b",
1638
+ borderColor: i = "#cbd5e1",
1639
+ textColor: s = "#1e293b",
1637
1640
  charsPerLine: c = 18
1638
1641
  } = {}) {
1639
1642
  const u = e.filter((h) => h[n] != null && h[r] != null && Number(h[r]) > Number(h[n])).map((h) => {
1640
- const _ = h[t], y = _ != null && String(_).trim() !== "" && String(_) !== "null" ? String(_).trim() : "";
1643
+ const N = h[t], y = N != null && String(N).trim() !== "" && String(N) !== "null" ? String(N).trim() : "";
1641
1644
  return { from: Number(h[n]), to: Number(h[r]), comment: y };
1642
- }).sort((h, _) => h.from - _.from);
1645
+ }).sort((h, N) => h.from - N.from);
1643
1646
  if (!u.length)
1644
1647
  return { data: [], layout: {} };
1645
- const l = [], a = [], m = [], d = [], f = [];
1648
+ const l = [], a = [], d = [], m = [], f = [];
1646
1649
  for (const h of u) {
1647
- const _ = 0.5 * (h.from + h.to), y = !!h.comment;
1650
+ const N = 0.5 * (h.from + h.to), y = !!h.comment;
1648
1651
  l.push({
1649
1652
  type: "rect",
1650
1653
  xref: "x",
@@ -1654,21 +1657,21 @@ function Sn(e, {
1654
1657
  y0: h.from,
1655
1658
  y1: h.to,
1656
1659
  fillcolor: y ? o : "rgba(0,0,0,0)",
1657
- line: { color: s, width: 1 }
1658
- }), y && (a.push(0.5), m.push(_), d.push(Dn(h.comment, c)), f.push(`${h.from}–${h.to} m: ${h.comment}`));
1660
+ line: { color: i, width: 1 }
1661
+ }), y && (a.push(0.5), d.push(N), m.push(Hn(h.comment, c)), f.push(`${h.from}–${h.to} m: ${h.comment}`));
1659
1662
  }
1660
1663
  return { data: a.length ? [{
1661
1664
  type: "scatter",
1662
1665
  x: a,
1663
- y: m,
1666
+ y: d,
1664
1667
  mode: "text",
1665
- text: d,
1668
+ text: m,
1666
1669
  textposition: "middle center",
1667
- textfont: { color: i, size: 10 },
1670
+ textfont: { color: s, size: 10 },
1668
1671
  hovertext: f,
1669
1672
  hoverinfo: "text",
1670
1673
  showlegend: !1
1671
- }] : [], layout: Mt({
1674
+ }] : [], layout: vt({
1672
1675
  shapes: l,
1673
1676
  height: 400,
1674
1677
  xaxis: { range: [0, 1], visible: !1, fixedrange: !0 },
@@ -1676,87 +1679,87 @@ function Sn(e, {
1676
1679
  showlegend: !1
1677
1680
  }) };
1678
1681
  }
1679
- function Zr(e, {
1682
+ function Io(e, {
1680
1683
  symbolSize: t = 10,
1681
1684
  xCol: n = "easting",
1682
1685
  yCol: r = "northing"
1683
1686
  } = {}) {
1684
- const o = e[n] != null ? Number(e[n]) : null, s = e[r] != null ? Number(e[r]) : null, i = e[B] != null ? Number(e[B]) : null, c = e[j] != null ? Number(e[j]) : null;
1685
- if (o === null || s === null || i === null || c === null) return null;
1686
- const u = (c - 90 + 360) % 360, l = u * Math.PI / 180, a = c * Math.PI / 180, m = t * Math.sin(l), d = t * Math.cos(l), f = t * 0.4 * (i / 90), b = f * Math.sin(a), p = f * Math.cos(a);
1687
+ const o = e[n] != null ? Number(e[n]) : null, i = e[r] != null ? Number(e[r]) : null, s = e[G] != null ? Number(e[G]) : null, c = e[B] != null ? Number(e[B]) : null;
1688
+ if (o === null || i === null || s === null || c === null) return null;
1689
+ const u = (c - 90 + 360) % 360, l = u * Math.PI / 180, a = c * Math.PI / 180, d = t * Math.sin(l), m = t * Math.cos(l), f = t * 0.4 * (s / 90), b = f * Math.sin(a), p = f * Math.cos(a);
1687
1690
  return {
1688
1691
  strike: u,
1689
- dipValue: i,
1692
+ dipValue: s,
1690
1693
  x: o,
1691
- y: s,
1692
- strikeX0: o - m,
1693
- strikeY0: s - d,
1694
- strikeX1: o + m,
1695
- strikeY1: s + d,
1694
+ y: i,
1695
+ strikeX0: o - d,
1696
+ strikeY0: i - m,
1697
+ strikeX1: o + d,
1698
+ strikeY1: i + m,
1696
1699
  tickX1: o + b,
1697
- tickY1: s + p
1700
+ tickY1: i + p
1698
1701
  };
1699
1702
  }
1700
- const Ct = "markers+line";
1701
- function Pn(e, t) {
1703
+ const St = "markers+line";
1704
+ function jn(e, t) {
1702
1705
  var r;
1703
- const n = He(e);
1704
- return n.some((o) => o.value === t) ? t : ((r = n[0]) == null ? void 0 : r.value) || Ct;
1706
+ const n = Re(e);
1707
+ return n.some((o) => o.value === t) ? t : ((r = n[0]) == null ? void 0 : r.value) || St;
1705
1708
  }
1706
- function Wr({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [], onConfigChange: o }) {
1707
- const s = lt(null), i = t == null ? void 0 : t.hole, c = (t == null ? void 0 : t.points) || [], u = (e == null ? void 0 : e.property) || "", l = (e == null ? void 0 : e.chartType) || Ct, a = (e == null ? void 0 : e.holeId) || "", m = (t == null ? void 0 : t.displayType) || (t != null && t.isComment ? _e : t != null && t.isCategorical ? Me : xe), d = He(m), f = Pn(m, l), [b, p] = K("");
1709
+ function Ao({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [], onConfigChange: o }) {
1710
+ const i = dt(null), s = t == null ? void 0 : t.hole, c = (t == null ? void 0 : t.points) || [], u = (e == null ? void 0 : e.property) || "", l = (e == null ? void 0 : e.chartType) || St, a = (e == null ? void 0 : e.holeId) || "", d = (t == null ? void 0 : t.displayType) || (t != null && t.isComment ? Ne : t != null && t.isCategorical ? Ae : ze), m = Re(d), f = jn(d, l), [b, p] = K("");
1708
1711
  return ae(() => {
1709
- const h = m === _e, _ = m === we;
1710
- if (!i || !u || !h && !_ && c.length === 0) return;
1711
- const y = s.current;
1712
+ const h = d === Ne, N = d === He;
1713
+ if (!s || !u || !h && !N && c.length === 0) return;
1714
+ const y = i.current;
1712
1715
  if (!y) return;
1713
- let I;
1716
+ let E;
1714
1717
  try {
1715
- h ? I = Sn(c, { commentCol: u, fromCol: "from", toCol: "to" }) : _ ? I = En(c) : I = An({
1718
+ h ? E = $n(c, { commentCol: u, fromCol: "from", toCol: "to" }) : N ? E = wn(c) : E = Fn({
1716
1719
  points: c,
1717
- isCategorical: m === Me,
1720
+ isCategorical: d === Ae,
1718
1721
  property: u,
1719
1722
  chartType: f
1720
1723
  });
1721
- } catch (x) {
1722
- console.error("Plot build error", x), p((x == null ? void 0 : x.message) || "Plot build error");
1724
+ } catch (z) {
1725
+ console.error("Plot build error", z), p((z == null ? void 0 : z.message) || "Plot build error");
1723
1726
  return;
1724
1727
  }
1725
- if ((!(I != null && I.data) || I.data.length === 0) && !h)
1728
+ if ((!(E != null && E.data) || E.data.length === 0) && !h)
1726
1729
  return;
1727
- const z = {
1730
+ const M = {
1728
1731
  displayModeBar: !0,
1729
1732
  responsive: !0,
1730
1733
  useResizeHandler: !0,
1731
1734
  modeBarButtonsToRemove: ["select2d", "lasso2d", "zoom2d", "zoomIn2d", "zoomOut2d", "autoScale2d"]
1732
1735
  };
1733
1736
  try {
1734
- p(""), Ce.react(y, I.data, I.layout, z), requestAnimationFrame(() => {
1735
- y && y.parentElement && Ce.Plots.resize(y);
1737
+ p(""), Ee.react(y, E.data, E.layout, M), requestAnimationFrame(() => {
1738
+ y && y.parentElement && Ee.Plots.resize(y);
1736
1739
  });
1737
- } catch (x) {
1738
- console.error("Plot render error", x), p((x == null ? void 0 : x.message) || "Plot render error");
1740
+ } catch (z) {
1741
+ console.error("Plot render error", z), p((z == null ? void 0 : z.message) || "Plot render error");
1739
1742
  }
1740
1743
  return () => {
1741
1744
  if (y)
1742
1745
  try {
1743
- Ce.purge(y);
1744
- } catch (x) {
1745
- console.warn("Plot purge error", x);
1746
+ Ee.purge(y);
1747
+ } catch (z) {
1748
+ console.warn("Plot purge error", z);
1746
1749
  }
1747
1750
  };
1748
- }, [i, u, f, m, c]), ae(() => {
1749
- const h = s.current;
1751
+ }, [s, u, f, d, c]), ae(() => {
1752
+ const h = i.current;
1750
1753
  if (!h || typeof ResizeObserver > "u") return;
1751
- const _ = new ResizeObserver(() => {
1754
+ const N = new ResizeObserver(() => {
1752
1755
  try {
1753
- h && h.data && Ce.Plots.resize(h);
1756
+ h && h.data && Ee.Plots.resize(h);
1754
1757
  } catch (y) {
1755
1758
  console.warn("Plot resize error", y);
1756
1759
  }
1757
1760
  });
1758
- return _.observe(h), () => _.disconnect();
1759
- }, []), !i || !u ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ L("div", { className: "placeholder", children: e != null && e.holeId ? t != null && t.loading ? `Loading ${e.holeId}...` : "Select a property" : "Loading demo data..." }) }) : m !== _e && m !== we && c.length === 0 ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ L("div", { className: "placeholder", children: "No data" }) }) : b ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ Q("div", { className: "placeholder", children: [
1761
+ return N.observe(h), () => N.disconnect();
1762
+ }, []), !s || !u ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ L("div", { className: "placeholder", children: e != null && e.holeId ? t != null && t.loading ? `Loading ${e.holeId}...` : "Select a property" : "Loading demo data..." }) }) : d !== Ne && d !== He && c.length === 0 ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ L("div", { className: "placeholder", children: "No data" }) }) : b ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ Q("div", { className: "placeholder", children: [
1760
1763
  "Plot error: ",
1761
1764
  b
1762
1765
  ] }) }) : /* @__PURE__ */ Q("div", { className: "plot-card", children: [
@@ -1767,8 +1770,8 @@ function Wr({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [],
1767
1770
  value: a,
1768
1771
  onChange: (h) => o && o({ holeId: h.target.value }),
1769
1772
  children: n.map((h) => {
1770
- const _ = typeof h == "string" ? h : h.holeId, y = typeof h == "string" ? h : h.label || h.holeId;
1771
- return /* @__PURE__ */ L("option", { value: _, children: y }, _);
1773
+ const N = typeof h == "string" ? h : h.holeId, y = typeof h == "string" ? h : h.label || h.holeId;
1774
+ return /* @__PURE__ */ L("option", { value: N, children: y }, N);
1772
1775
  })
1773
1776
  }
1774
1777
  ) }),
@@ -1782,184 +1785,184 @@ function Wr({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [],
1782
1785
  children: r.map((h) => /* @__PURE__ */ L("option", { value: h, children: h }, h))
1783
1786
  }
1784
1787
  ),
1785
- d.length > 1 && /* @__PURE__ */ L(
1788
+ m.length > 1 && /* @__PURE__ */ L(
1786
1789
  "select",
1787
1790
  {
1788
1791
  className: "plot-select",
1789
1792
  value: f,
1790
1793
  onChange: (h) => o && o({ chartType: h.target.value }),
1791
- children: d.map((h) => /* @__PURE__ */ L("option", { value: h.value, children: h.label }, h.value))
1794
+ children: m.map((h) => /* @__PURE__ */ L("option", { value: h.value, children: h.label }, h.value))
1792
1795
  }
1793
1796
  )
1794
1797
  ] }),
1795
- /* @__PURE__ */ L("div", { className: "plotly-chart", ref: s })
1798
+ /* @__PURE__ */ L("div", { className: "plotly-chart", ref: i })
1796
1799
  ] });
1797
1800
  }
1798
- function st(e, t) {
1801
+ function lt(e, t) {
1799
1802
  if (!(t != null && t.length)) return e;
1800
1803
  const n = new Map(e.map((r) => [r.id || r.holeId, { ...r }]));
1801
1804
  for (const r of t) {
1802
1805
  const o = r.id || r.holeId;
1803
1806
  if (o)
1804
1807
  if (n.has(o)) {
1805
- const s = n.get(o);
1806
- n.set(o, { ...s, points: [...s.points || [], ...r.points || []] });
1808
+ const i = n.get(o);
1809
+ n.set(o, { ...i, points: [...i.points || [], ...r.points || []] });
1807
1810
  } else
1808
1811
  n.set(o, r);
1809
1812
  }
1810
1813
  return Array.from(n.values());
1811
1814
  }
1812
- function kn(e, t) {
1815
+ function Rn(e, t) {
1813
1816
  if (!e || !t) return [];
1814
1817
  const n = /* @__PURE__ */ new Set(), r = [];
1815
1818
  for (const o of e.points || []) {
1816
- const s = Number(o.from ?? o.samp_from ?? o.depth_from ?? o.from_depth), i = Number(o.to ?? o.samp_to ?? o.depth_to ?? o.to_depth);
1817
- if (!Number.isFinite(s) || !Number.isFinite(i) || i <= s) continue;
1818
- const c = `${s}-${i}`;
1819
- n.has(c) || (n.add(c), r.push({ from: s, to: i, [t]: o[t] ?? "" }));
1819
+ const i = Number(o.from ?? o.samp_from ?? o.depth_from ?? o.from_depth), s = Number(o.to ?? o.samp_to ?? o.depth_to ?? o.to_depth);
1820
+ if (!Number.isFinite(i) || !Number.isFinite(s) || s <= i) continue;
1821
+ const c = `${i}-${s}`;
1822
+ n.has(c) || (n.add(c), r.push({ from: i, to: s, [t]: o[t] ?? "" }));
1820
1823
  }
1821
1824
  return r;
1822
1825
  }
1823
- function Kr({
1826
+ function Eo({
1824
1827
  initialFocusedHoleId: e = "",
1825
1828
  sourceFile: t = null,
1826
1829
  extraHoles: n = [],
1827
1830
  plotCount: r = 4
1828
1831
  } = {}) {
1829
- const [o, s] = K([]), [i, c] = K([]), [u, l] = K([]), [a, m] = K([]), [d, f] = K([]), [b, p] = K({}), [h, _] = K(""), [y, I] = K([]), [z, x] = K(""), [D, S] = K(e || ""), [M, O] = K([]), $ = lt(null);
1832
+ const [o, i] = K([]), [s, c] = K([]), [u, l] = K([]), [a, d] = K([]), [m, f] = K([]), [b, p] = K({}), [h, N] = K(""), [y, E] = K([]), [M, z] = K(""), [P, D] = K(e || ""), [x, V] = K([]), H = dt(null);
1830
1833
  ae(() => {
1831
- !t || $.current === t || ($.current = t, Kt(t).then((A) => {
1832
- if (!A) return;
1833
- const v = Array.from(new Map(A.map((P) => [P.holeId, P])).values());
1834
- c(v), I(pt({
1835
- holeIds: v.map((P) => P.holeId),
1836
- focusedHoleId: D,
1834
+ !t || H.current === t || (H.current = t, an(t).then((S) => {
1835
+ if (!S) return;
1836
+ const I = Array.from(new Map(S.map((g) => [g.holeId, g])).values());
1837
+ c(I), E(_t({
1838
+ holeIds: I.map((g) => g.holeId),
1839
+ focusedHoleId: P,
1837
1840
  plotCount: r,
1838
1841
  defaultProp: "",
1839
1842
  categoricalProps: a,
1840
- commentProps: d,
1843
+ commentProps: m,
1841
1844
  numericDefaultChartType: "markers+line"
1842
1845
  }));
1843
- }).catch((A) => {
1844
- console.info("Assay metadata load skipped:", A.message);
1846
+ }).catch((S) => {
1847
+ console.info("Assay metadata load skipped:", S.message);
1845
1848
  }));
1846
- }, [t, D, r, a, d]), ae(() => {
1849
+ }, [t, P, r, a, m]), ae(() => {
1847
1850
  if (!(n != null && n.length)) return;
1848
- const A = n.map((v) => ({ holeId: v.id || v.holeId })).filter((v) => v.holeId);
1849
- c((v) => {
1850
- const P = new Set(v.map((C) => C.holeId)), g = A.filter((C) => !P.has(C.holeId));
1851
- return g.length ? [...v, ...g] : v;
1851
+ const S = n.map((I) => ({ holeId: I.id || I.holeId })).filter((I) => I.holeId);
1852
+ c((I) => {
1853
+ const g = new Set(I.map((A) => A.holeId)), k = S.filter((A) => !g.has(A.holeId));
1854
+ return k.length ? [...I, ...k] : I;
1852
1855
  });
1853
1856
  }, [n]), ae(() => {
1854
- x((A) => A && A.startsWith("Loading data for hole") ? A : "");
1857
+ z((S) => S && S.startsWith("Loading data for hole") ? S : "");
1855
1858
  }, [y]), ae(() => {
1856
- if (!i.length) {
1857
- I([]);
1859
+ if (!s.length) {
1860
+ E([]);
1858
1861
  return;
1859
1862
  }
1860
- const A = ht(i.map((v) => v.holeId), D);
1861
- I((v) => Array.from({ length: r }).map((g, C) => {
1862
- var U;
1863
- const F = v[C] || {}, V = i.some((re) => re.holeId === F.holeId) ? F.holeId : A[C] || ((U = i[C]) == null ? void 0 : U.holeId) || "", k = F.property || h, H = Ae({
1864
- property: k,
1865
- chartType: F.chartType,
1863
+ const S = gt(s.map((I) => I.holeId), P);
1864
+ E((I) => Array.from({ length: r }).map((k, A) => {
1865
+ var X;
1866
+ const T = I[A] || {}, F = s.some((re) => re.holeId === T.holeId) ? T.holeId : S[A] || ((X = s[A]) == null ? void 0 : X.holeId) || "", C = T.property || h, R = Se({
1867
+ property: C,
1868
+ chartType: T.chartType,
1866
1869
  categoricalProps: a,
1867
- commentProps: d,
1870
+ commentProps: m,
1868
1871
  numericDefaultChartType: "markers+line"
1869
1872
  });
1870
- return { holeId: V, property: k, chartType: H };
1873
+ return { holeId: F, property: C, chartType: R };
1871
1874
  }));
1872
- }, [i, D, h, a, d, r]), ae(() => {
1875
+ }, [s, P, h, a, m, r]), ae(() => {
1873
1876
  if (!t) return;
1874
- y.map((v) => v.holeId).filter(Boolean).forEach((v) => {
1875
- const P = o.some((C) => (C.id || C.holeId) === v), g = M.includes(v);
1876
- P || g || (O((C) => [...C, v]), Jt(t, v).then((C) => {
1877
- O((F) => F.filter((V) => V !== v)), C && s((F) => {
1878
- const V = st(
1879
- [...F.filter((H) => (H.id || H.holeId) !== v), C],
1877
+ y.map((I) => I.holeId).filter(Boolean).forEach((I) => {
1878
+ const g = o.some((A) => (A.id || A.holeId) === I), k = x.includes(I);
1879
+ g || k || (V((A) => [...A, I]), cn(t, I).then((A) => {
1880
+ V((T) => T.filter((F) => F !== I)), A && i((T) => {
1881
+ const F = lt(
1882
+ [...T.filter((R) => (R.id || R.holeId) !== I), A],
1880
1883
  n
1881
- ), k = Ee(V);
1882
- return l(k.numericProps), m(k.categoricalProps), f(k.commentProps), p(k.columnMeta), !h && k.defaultProp && (_(k.defaultProp), I((H) => H.map((U) => ({
1883
- ...U,
1884
- property: U.property || k.defaultProp,
1885
- chartType: Ae({
1886
- property: U.property || k.defaultProp,
1887
- chartType: U.chartType,
1888
- categoricalProps: k.categoricalProps,
1889
- commentProps: k.commentProps,
1884
+ ), C = De(F);
1885
+ return l(C.numericProps), d(C.categoricalProps), f(C.commentProps), p(C.columnMeta), !h && C.defaultProp && (N(C.defaultProp), E((R) => R.map((X) => ({
1886
+ ...X,
1887
+ property: X.property || C.defaultProp,
1888
+ chartType: Se({
1889
+ property: X.property || C.defaultProp,
1890
+ chartType: X.chartType,
1891
+ categoricalProps: C.categoricalProps,
1892
+ commentProps: C.commentProps,
1890
1893
  numericDefaultChartType: "markers+line"
1891
1894
  })
1892
- })))), V;
1895
+ })))), F;
1893
1896
  });
1894
- }).catch((C) => {
1895
- console.error(C), O((F) => F.filter((V) => V !== v)), x(C.message || `Error loading hole ${v}`);
1897
+ }).catch((A) => {
1898
+ console.error(A), V((T) => T.filter((F) => F !== I)), z(A.message || `Error loading hole ${I}`);
1896
1899
  }));
1897
1900
  });
1898
- }, [y, t, o, M, h, n]), ae(() => {
1899
- n != null && n.length && s((A) => {
1900
- if (!A.length) {
1901
- const g = Ee(n);
1902
- return l(g.numericProps), m(g.categoricalProps), f(g.commentProps), p(g.columnMeta), !h && g.defaultProp && _(g.defaultProp), n;
1901
+ }, [y, t, o, x, h, n]), ae(() => {
1902
+ n != null && n.length && i((S) => {
1903
+ if (!S.length) {
1904
+ const k = De(n);
1905
+ return l(k.numericProps), d(k.categoricalProps), f(k.commentProps), p(k.columnMeta), !h && k.defaultProp && N(k.defaultProp), n;
1903
1906
  }
1904
- const v = st(A, n), P = Ee(v);
1905
- return l(P.numericProps), m(P.categoricalProps), f(P.commentProps), p(P.columnMeta), !h && P.defaultProp && _(P.defaultProp), v;
1907
+ const I = lt(S, n), g = De(I);
1908
+ return l(g.numericProps), d(g.categoricalProps), f(g.commentProps), p(g.columnMeta), !h && g.defaultProp && N(g.defaultProp), I;
1906
1909
  });
1907
1910
  }, [n]);
1908
- const Z = ke(
1909
- () => [...u, ...a, ...d],
1910
- [u, a, d]
1911
- ), T = ke(
1912
- () => i.map((A) => ({ holeId: A.holeId, label: A.holeId })).sort((A, v) => A.label.localeCompare(v.label)),
1913
- [i]
1914
- ), R = ke(() => {
1915
- const A = [...u, ...a, ...d];
1916
- return Array.from({ length: r }).map((v, P) => {
1917
- const g = y[P] || {}, C = o.find((le) => (le.id || le.holeId) === g.holeId) || null, F = C ? A.filter((le) => zn(C, le)) : A;
1918
- let V = g.property || h;
1919
- C && !F.includes(V) && (V = F[0] || V);
1920
- const k = d.includes(V), H = !k && a.includes(V), U = !k && !H && V === "dip", re = k ? "comment" : U ? "tadpole" : H ? "categorical" : "numeric", de = U ? "tadpole" : g.chartType || (k ? "comment" : H ? "categorical" : "markers+line"), ie = g.holeId || (C == null ? void 0 : C.id) || (C == null ? void 0 : C.holeId) || "", Ne = U ? (C == null ? void 0 : C.points) || [] : k ? kn(C, V) : Mn(C, V, H);
1911
+ const W = Oe(
1912
+ () => [...u, ...a, ...m],
1913
+ [u, a, m]
1914
+ ), O = Oe(
1915
+ () => s.map((S) => ({ holeId: S.holeId, label: S.holeId })).sort((S, I) => S.label.localeCompare(I.label)),
1916
+ [s]
1917
+ ), $ = Oe(() => {
1918
+ const S = [...u, ...a, ...m];
1919
+ return Array.from({ length: r }).map((I, g) => {
1920
+ const k = y[g] || {}, A = o.find((le) => (le.id || le.holeId) === k.holeId) || null, T = A ? S.filter((le) => Cn(A, le)) : S;
1921
+ let F = k.property || h;
1922
+ A && !T.includes(F) && (F = T[0] || F);
1923
+ const C = m.includes(F), R = !C && a.includes(F), X = !C && !R && F === "dip", re = C ? "comment" : X ? "tadpole" : R ? "categorical" : "numeric", me = X ? "tadpole" : k.chartType || (C ? "comment" : R ? "categorical" : "markers+line"), se = k.holeId || (A == null ? void 0 : A.id) || (A == null ? void 0 : A.holeId) || "", Me = X ? (A == null ? void 0 : A.points) || [] : C ? Rn(A, F) : Ln(A, F, R);
1921
1924
  return {
1922
- config: { holeId: ie, property: V, chartType: de },
1923
- hole: C,
1924
- loading: M.includes(g.holeId),
1925
- isCategorical: H,
1926
- isComment: k,
1927
- isTadpole: U,
1925
+ config: { holeId: se, property: F, chartType: me },
1926
+ hole: A,
1927
+ loading: x.includes(k.holeId),
1928
+ isCategorical: R,
1929
+ isComment: C,
1930
+ isTadpole: X,
1928
1931
  displayType: re,
1929
- points: Ne,
1930
- propertyOptions: F,
1931
- label: ie
1932
+ points: Me,
1933
+ propertyOptions: T,
1934
+ label: se
1932
1935
  };
1933
1936
  });
1934
- }, [y, o, h, a, d, M, r, u]), q = (A, v) => {
1935
- I((P) => {
1936
- const g = [...P], F = { ...g[A] || {}, ...v };
1937
- return v.property && (F.chartType = Ae({
1938
- property: v.property,
1939
- chartType: F.chartType,
1937
+ }, [y, o, h, a, m, x, r, u]), j = (S, I) => {
1938
+ E((g) => {
1939
+ const k = [...g], T = { ...k[S] || {}, ...I };
1940
+ return I.property && (T.chartType = Se({
1941
+ property: I.property,
1942
+ chartType: T.chartType,
1940
1943
  categoricalProps: a,
1941
- commentProps: d,
1944
+ commentProps: m,
1942
1945
  numericDefaultChartType: "markers+line"
1943
- })), g[A] = F, g;
1946
+ })), k[S] = T, k;
1944
1947
  });
1945
1948
  };
1946
1949
  return {
1947
- error: z,
1948
- focusedHoleId: D,
1949
- setFocusedHoleId: S,
1950
- setError: x,
1951
- holeCount: i.length,
1950
+ error: M,
1951
+ focusedHoleId: P,
1952
+ setFocusedHoleId: D,
1953
+ setError: z,
1954
+ holeCount: s.length,
1952
1955
  numericProps: u,
1953
1956
  categoricalProps: a,
1954
- commentProps: d,
1957
+ commentProps: m,
1955
1958
  columnMeta: b,
1956
- propertyOptions: Z,
1957
- labeledHoleOptions: T,
1958
- traceGraphs: R,
1959
- handleConfigChange: q
1959
+ propertyOptions: W,
1960
+ labeledHoleOptions: O,
1961
+ traceGraphs: $,
1962
+ handleConfigChange: j
1960
1963
  };
1961
1964
  }
1962
- const Ln = [
1965
+ const Bn = [
1963
1966
  "#313695",
1964
1967
  "#4575b4",
1965
1968
  "#74add1",
@@ -1971,7 +1974,7 @@ const Ln = [
1971
1974
  "#d73027",
1972
1975
  "#a50026"
1973
1976
  ];
1974
- function Tn(e = [], t = Ln) {
1977
+ function Gn(e = [], t = Bn) {
1975
1978
  const n = e.filter((l) => Number.isFinite(l));
1976
1979
  if (!n.length)
1977
1980
  return {
@@ -1981,44 +1984,44 @@ function Tn(e = [], t = Ln) {
1981
1984
  bins: [],
1982
1985
  colors: t
1983
1986
  };
1984
- const r = n.slice().sort((l, a) => l - a), o = r[0], s = r[r.length - 1], i = t.length;
1985
- if (s === o) {
1986
- const l = t.map((a, m) => ({
1987
- index: m,
1987
+ const r = n.slice().sort((l, a) => l - a), o = r[0], i = r[r.length - 1], s = t.length;
1988
+ if (i === o) {
1989
+ const l = t.map((a, d) => ({
1990
+ index: d,
1988
1991
  min: o,
1989
- max: s,
1992
+ max: i,
1990
1993
  label: `${o}`
1991
1994
  }));
1992
1995
  return {
1993
1996
  min: o,
1994
- max: s,
1997
+ max: i,
1995
1998
  step: 0,
1996
1999
  bins: l,
1997
2000
  colors: t
1998
2001
  };
1999
2002
  }
2000
2003
  const c = t.map((l, a) => {
2001
- const m = a / i, d = (a + 1) / i, f = Math.floor(m * r.length), b = Math.min(r.length - 1, Math.floor(d * r.length)), p = r[f], h = a === i - 1 ? s : r[b];
2004
+ const d = a / s, m = (a + 1) / s, f = Math.floor(d * r.length), b = Math.min(r.length - 1, Math.floor(m * r.length)), p = r[f], h = a === s - 1 ? i : r[b];
2002
2005
  return {
2003
2006
  index: a,
2004
2007
  min: p,
2005
2008
  max: h,
2006
- label: Fn(p, h)
2009
+ label: Un(p, h)
2007
2010
  };
2008
- }), u = (s - o) / i;
2011
+ }), u = (i - o) / s;
2009
2012
  return {
2010
2013
  min: o,
2011
- max: s,
2014
+ max: i,
2012
2015
  step: u,
2013
2016
  bins: c,
2014
2017
  colors: t
2015
2018
  };
2016
2019
  }
2017
- function Fn(e, t) {
2020
+ function Un(e, t) {
2018
2021
  const n = (r) => Number.isFinite(r) ? Math.abs(r) >= 1e3 ? r.toFixed(0) : Math.abs(r) >= 10 ? r.toFixed(1) : Math.abs(r) >= 0.1 ? r.toFixed(2) : r.toFixed(3) : "n/a";
2019
2022
  return `${n(e)} – ${n(t)}`;
2020
2023
  }
2021
- function It(e, t) {
2024
+ function Pt(e, t) {
2022
2025
  if (!Number.isFinite(e) || !t || !Array.isArray(t.bins) || !t.bins.length)
2023
2026
  return -1;
2024
2027
  if (t.max === t.min)
@@ -2030,92 +2033,92 @@ function It(e, t) {
2030
2033
  }
2031
2034
  return -1;
2032
2035
  }
2033
- function On(e, t, n = "#8b1e3f") {
2034
- const r = It(e, t);
2036
+ function Yn(e, t, n = "#8b1e3f") {
2037
+ const r = Pt(e, t);
2035
2038
  return r < 0 ? n : t.colors[r] || n;
2036
2039
  }
2037
- function At(e) {
2040
+ function Dt(e) {
2038
2041
  return Array.isArray(e) ? e : [];
2039
2042
  }
2040
- function Te(e) {
2043
+ function Fe(e) {
2041
2044
  const t = Number(e);
2042
2045
  return Number.isFinite(t) ? t : void 0;
2043
2046
  }
2044
- function vt(e = {}) {
2047
+ function kt(e = {}) {
2045
2048
  return {
2046
2049
  ...e,
2047
- x: Te(e.x),
2048
- y: Te(e.y),
2049
- z: Te(e.z)
2050
+ x: Fe(e.x),
2051
+ y: Fe(e.y),
2052
+ z: Fe(e.z)
2050
2053
  };
2051
2054
  }
2052
- function Vn(e = [], t = [0, 0], n = 0) {
2053
- const [r, o] = t, s = Number(n) * Math.PI / 180, i = Math.cos(s), c = Math.sin(s);
2054
- return At(e).map(vt).map((u) => {
2055
+ function qn(e = [], t = [0, 0], n = 0) {
2056
+ const [r, o] = t, i = Number(n) * Math.PI / 180, s = Math.cos(i), c = Math.sin(i);
2057
+ return Dt(e).map(kt).map((u) => {
2055
2058
  if (!Number.isFinite(u.x) || !Number.isFinite(u.y)) return { ...u };
2056
2059
  const l = u.x - r, a = u.y - o;
2057
2060
  return {
2058
2061
  ...u,
2059
- along: l * c + a * i,
2060
- across: l * i - a * c
2062
+ along: l * c + a * s,
2063
+ across: l * s - a * c
2061
2064
  };
2062
2065
  });
2063
2066
  }
2064
- function wn(e = [], t = [0, 0], n = 0, r = 50) {
2065
- const o = Vn(e, t, n), s = 0.5 * Number(r || 0);
2066
- return !Number.isFinite(s) || s <= 0 ? o : o.filter((i) => Number.isFinite(i.across) && Math.abs(i.across) <= s);
2067
+ function Xn(e = [], t = [0, 0], n = 0, r = 50) {
2068
+ const o = qn(e, t, n), i = 0.5 * Number(r || 0);
2069
+ return !Number.isFinite(i) || i <= 0 ? o : o.filter((s) => Number.isFinite(s.across) && Math.abs(s.across) <= i);
2067
2070
  }
2068
- function Jr(e = [], t = null, n = null) {
2069
- let r = At(e).map(vt);
2071
+ function vo(e = [], t = null, n = null) {
2072
+ let r = Dt(e).map(kt);
2070
2073
  if (Array.isArray(t) && t.length === 2) {
2071
- const [o, s] = t;
2072
- r = r.filter((i) => Number.isFinite(i.z) && i.z <= Number(o) && i.z >= Number(s));
2074
+ const [o, i] = t;
2075
+ r = r.filter((s) => Number.isFinite(s.z) && s.z <= Number(o) && s.z >= Number(i));
2073
2076
  }
2074
2077
  return n && (r = r.map((o) => ({
2075
2078
  ...o,
2076
2079
  color_value: o == null ? void 0 : o[n]
2077
2080
  }))), r;
2078
2081
  }
2079
- function Qr(e = [], t = [0, 0], n = 0, r = 50, o = null) {
2080
- let s = wn(e, t, n, r);
2081
- return o && (s = s.map((i) => ({
2082
- ...i,
2083
- color_value: i == null ? void 0 : i[o]
2084
- }))), s;
2082
+ function So(e = [], t = [0, 0], n = 0, r = 50, o = null) {
2083
+ let i = Xn(e, t, n, r);
2084
+ return o && (i = i.map((s) => ({
2085
+ ...s,
2086
+ color_value: s == null ? void 0 : s[o]
2087
+ }))), i;
2085
2088
  }
2086
- function Ue(e) {
2089
+ function Ye(e) {
2087
2090
  return Array.isArray(e) ? e : [];
2088
2091
  }
2089
- function Ye(e = {}) {
2092
+ function qe(e = {}) {
2090
2093
  return e.hole_id ?? e.holeId ?? e.id;
2091
2094
  }
2092
2095
  function he(e, t = void 0) {
2093
2096
  const n = Number(e);
2094
2097
  return Number.isFinite(n) ? n : t;
2095
2098
  }
2096
- function eo(e = [], t = null) {
2099
+ function Po(e = [], t = null) {
2097
2100
  const n = /* @__PURE__ */ new Map();
2098
- Ue(e).forEach((o) => {
2099
- const s = Ye(o);
2100
- if (s == null || `${s}`.trim() === "") return;
2101
- const i = `${s}`;
2102
- n.has(i) || n.set(i, []), n.get(i).push(o);
2101
+ Ye(e).forEach((o) => {
2102
+ const i = qe(o);
2103
+ if (i == null || `${i}`.trim() === "") return;
2104
+ const s = `${i}`;
2105
+ n.has(s) || n.set(s, []), n.get(s).push(o);
2103
2106
  });
2104
2107
  const r = [];
2105
- return n.forEach((o, s) => {
2106
- const i = [...o].sort((u, l) => he(u.md, 0) - he(l.md, 0)), c = {
2107
- hole_id: s,
2108
- x: i.map((u) => he(u.x, 0)),
2109
- y: i.map((u) => he(u.y, 0)),
2110
- z: i.map((u) => he(u.z, 0)),
2108
+ return n.forEach((o, i) => {
2109
+ const s = [...o].sort((u, l) => he(u.md, 0) - he(l.md, 0)), c = {
2110
+ hole_id: i,
2111
+ x: s.map((u) => he(u.x, 0)),
2112
+ y: s.map((u) => he(u.y, 0)),
2113
+ z: s.map((u) => he(u.z, 0)),
2111
2114
  color: null
2112
2115
  };
2113
- t && (c.color = i.map((u) => u == null ? void 0 : u[t])), r.push(c);
2116
+ t && (c.color = s.map((u) => u == null ? void 0 : u[t])), r.push(c);
2114
2117
  }), r;
2115
2118
  }
2116
- function to(e = [], t = 1, n = null) {
2117
- return Ue(e).map((r) => ({
2118
- hole_id: Ye(r),
2119
+ function Do(e = [], t = 1, n = null) {
2120
+ return Ye(e).map((r) => ({
2121
+ hole_id: qe(r),
2119
2122
  from: r == null ? void 0 : r.from,
2120
2123
  to: r == null ? void 0 : r.to,
2121
2124
  radius: t,
@@ -2123,14 +2126,21 @@ function to(e = [], t = 1, n = null) {
2123
2126
  value: n ? r == null ? void 0 : r[n] : null
2124
2127
  }));
2125
2128
  }
2126
- function no(e = [], t = null) {
2127
- return t ? Ue(e).filter((n) => Object.prototype.hasOwnProperty.call(n || {}, t)).map((n) => ({
2128
- hole_id: Ye(n),
2129
+ function ko(e = [], t = null) {
2130
+ return t ? Ye(e).filter((n) => Object.prototype.hasOwnProperty.call(n || {}, t)).map((n) => ({
2131
+ hole_id: qe(n),
2129
2132
  label: n == null ? void 0 : n[t],
2130
2133
  depth: 0.5 * (he(n == null ? void 0 : n.from, 0) + he(n == null ? void 0 : n.to, 0))
2131
2134
  })) : [];
2132
2135
  }
2133
- const $n = {
2136
+ function be(e) {
2137
+ e.selectables = [
2138
+ ...e.blocks,
2139
+ ...e.drillMeshes,
2140
+ ...e.structuralMeshes
2141
+ ];
2142
+ }
2143
+ const Wn = {
2134
2144
  bedding: "#2563eb",
2135
2145
  foliation: "#16a34a",
2136
2146
  joint: "#9333ea",
@@ -2139,13 +2149,13 @@ const $n = {
2139
2149
  "shear zone": "#0ea5e9",
2140
2150
  "fault zone": "#ef4444"
2141
2151
  };
2142
- function Rn(e, t) {
2143
- const n = t || $n, r = (e || "").toLowerCase().trim(), o = n[r] || "#888888";
2144
- return new N.Color(o).getHex();
2152
+ function Zn(e, t) {
2153
+ const n = t || Wn, r = (e || "").toLowerCase().trim(), o = n[r] || "#888888";
2154
+ return new _.Color(o).getHex();
2145
2155
  }
2146
- function Hn(e, t) {
2156
+ function Kn(e, t) {
2147
2157
  const n = e * Math.PI / 180, r = t * Math.PI / 180;
2148
- return new N.Vector3(
2158
+ return new _.Vector3(
2149
2159
  Math.sin(r) * Math.sin(n),
2150
2160
  // East component
2151
2161
  Math.cos(r) * Math.sin(n),
@@ -2154,32 +2164,32 @@ function Hn(e, t) {
2154
2164
  // Up component
2155
2165
  ).normalize();
2156
2166
  }
2157
- function jn(e, t = {}) {
2167
+ function Jn(e, t = {}) {
2158
2168
  const {
2159
2169
  radius: n = 5,
2160
2170
  discThickness: r = 0.2,
2161
2171
  opacity: o = 0.7,
2162
- segments: s = 32,
2163
- colorMap: i = null
2164
- } = t, c = new N.Group(), u = new N.Vector3(0, 1, 0);
2172
+ segments: i = 32,
2173
+ colorMap: s = null
2174
+ } = t, c = new _.Group(), u = new _.Vector3(0, 1, 0);
2165
2175
  for (const l of e) {
2166
- const a = l.x != null ? l.x : l.easting != null ? l.easting : null, m = l.y != null ? l.y : l.northing != null ? l.northing : null, d = l.z != null ? l.z : l.elevation != null ? l.elevation : null;
2167
- if (a == null || m == null || d == null || !Number.isFinite(a) || !Number.isFinite(m) || !Number.isFinite(d)) continue;
2168
- const f = l[B] != null ? Number(l[B]) : null, b = l[j] != null ? Number(l[j]) : null;
2176
+ const a = l.x != null ? l.x : l.easting != null ? l.easting : null, d = l.y != null ? l.y : l.northing != null ? l.northing : null, m = l.z != null ? l.z : l.elevation != null ? l.elevation : null;
2177
+ if (a == null || d == null || m == null || !Number.isFinite(a) || !Number.isFinite(d) || !Number.isFinite(m)) continue;
2178
+ const f = l[G] != null ? Number(l[G]) : null, b = l[B] != null ? Number(l[B]) : null;
2169
2179
  let p;
2170
2180
  if (l.nx != null && Number.isFinite(l.nx) && l.ny != null && Number.isFinite(l.ny) && l.nz != null && Number.isFinite(l.nz))
2171
- p = new N.Vector3(l.nx, l.ny, l.nz).normalize();
2181
+ p = new _.Vector3(l.nx, l.ny, l.nz).normalize();
2172
2182
  else {
2173
2183
  if (f == null || b == null || !Number.isFinite(f) || !Number.isFinite(b)) continue;
2174
- p = Hn(f, b);
2184
+ p = Kn(f, b);
2175
2185
  }
2176
- const h = new N.CylinderGeometry(n, n, r, s, 1, !1), _ = new N.MeshStandardMaterial({
2177
- color: Rn(l.structure_type, i),
2186
+ const h = new _.CylinderGeometry(n, n, r, i, 1, !1), N = new _.MeshStandardMaterial({
2187
+ color: Zn(l.structure_type, s),
2178
2188
  transparent: !0,
2179
2189
  opacity: o,
2180
- side: N.DoubleSide
2181
- }), y = new N.Mesh(h, _);
2182
- y.position.set(a, m, d), y.quaternion.setFromUnitVectors(u, p), y.userData = {
2190
+ side: _.DoubleSide
2191
+ }), y = new _.Mesh(h, N);
2192
+ y.position.set(a, d, m), y.quaternion.setFromUnitVectors(u, p), y.userData = {
2183
2193
  type: "structure",
2184
2194
  hole_id: l.hole_id,
2185
2195
  depth: l.depth ?? l.mid,
@@ -2191,23 +2201,46 @@ function jn(e, t = {}) {
2191
2201
  }
2192
2202
  return c;
2193
2203
  }
2194
- function qe(e) {
2195
- var n, r, o, s, i, c, u, l, a;
2204
+ function Qn(e, t, n, r = {}) {
2205
+ if (!e.scene || (Ct(e), !(t != null && t.length) || !(n != null && n.length))) return;
2206
+ const { maxDiscs: o = 3e3 } = r;
2207
+ let i = t;
2208
+ if (i.length > o) {
2209
+ const u = i.length / o, l = [];
2210
+ for (let a = 0; a < o; a++)
2211
+ l.push(i[Math.floor(a * u)]);
2212
+ i = l;
2213
+ }
2214
+ const s = n.flatMap((u) => (u.points || []).map((l) => ({ ...l, hole_id: u.id }))), c = Sn(i, s, r);
2215
+ c.length && (e.structuralGroup = Jn(c, r), e.scene.add(e.structuralGroup), e.structuralGroup.traverse((u) => {
2216
+ u.isMesh && e.structuralMeshes.push(u);
2217
+ }), be(e));
2218
+ }
2219
+ function Ct(e) {
2220
+ e.structuralGroup && (e.scene.remove(e.structuralGroup), e.structuralGroup.traverse((t) => {
2221
+ t.isMesh && (t.geometry.dispose(), t.material.dispose());
2222
+ }), e.structuralGroup = null), e.structuralMeshes = [], be(e);
2223
+ }
2224
+ function er(e, t) {
2225
+ e.structuralGroup && (e.structuralGroup.visible = !!t);
2226
+ }
2227
+ function Xe(e) {
2228
+ var n, r, o, i, s, c, u, l, a;
2196
2229
  if (!e) return "";
2197
- const t = (m) => Number.isFinite(m) ? m.toFixed(3) : "nan";
2230
+ const t = (d) => Number.isFinite(d) ? d.toFixed(3) : "nan";
2198
2231
  return [
2199
2232
  t((n = e.camera) == null ? void 0 : n.x),
2200
2233
  t((r = e.camera) == null ? void 0 : r.y),
2201
2234
  t((o = e.camera) == null ? void 0 : o.z),
2202
- t((s = e.target) == null ? void 0 : s.x),
2203
- t((i = e.target) == null ? void 0 : i.y),
2235
+ t((i = e.target) == null ? void 0 : i.x),
2236
+ t((s = e.target) == null ? void 0 : s.y),
2204
2237
  t((c = e.target) == null ? void 0 : c.z),
2205
2238
  t((u = e.up) == null ? void 0 : u.x),
2206
2239
  t((l = e.up) == null ? void 0 : l.y),
2207
2240
  t((a = e.up) == null ? void 0 : a.z)
2208
2241
  ].join("|");
2209
2242
  }
2210
- function Et(e) {
2243
+ function Lt(e) {
2211
2244
  return !e.camera || !e.controls ? null : {
2212
2245
  camera: {
2213
2246
  x: e.camera.position.x,
@@ -2226,55 +2259,55 @@ function Et(e) {
2226
2259
  }
2227
2260
  };
2228
2261
  }
2229
- function Bn(e, t) {
2262
+ function tr(e, t) {
2230
2263
  if (!e.camera || !e.controls || !t) return !1;
2231
2264
  const n = t.camera || {}, r = t.target || {}, o = t.up || {};
2232
- return [n.x, n.y, n.z, r.x, r.y, r.z, o.x, o.y, o.z].every(Number.isFinite) ? (e.camera.position.set(n.x, n.y, n.z), e.controls.target.set(r.x, r.y, r.z), e.camera.up.set(o.x, o.y, o.z), e.camera.lookAt(r.x, r.y, r.z), e.controls.update(), e._lastViewSignature = qe(t), !0) : !1;
2265
+ return [n.x, n.y, n.z, r.x, r.y, r.z, o.x, o.y, o.z].every(Number.isFinite) ? (e.camera.position.set(n.x, n.y, n.z), e.controls.target.set(r.x, r.y, r.z), e.camera.up.set(o.x, o.y, o.z), e.camera.lookAt(r.x, r.y, r.z), e.controls.update(), e._lastViewSignature = Xe(t), !0) : !1;
2233
2266
  }
2234
- function Gn(e) {
2267
+ function nr(e) {
2235
2268
  if (!e.viewChangeHandler) return;
2236
2269
  const t = Date.now();
2237
2270
  if (t - e._lastViewEmitMs < 250) return;
2238
- const n = Et(e);
2271
+ const n = Lt(e);
2239
2272
  if (!n) return;
2240
- const r = qe(n);
2273
+ const r = Xe(n);
2241
2274
  r !== e._lastViewSignature && (e._lastViewSignature = r, e._lastViewEmitMs = t, e.viewChangeHandler(n));
2242
2275
  }
2243
- function Fe(e, { minX: t, maxX: n, minY: r, maxY: o, minZ: s, maxZ: i }) {
2244
- const c = (t + n) / 2, u = (r + o) / 2, l = (s + i) / 2, a = n - t, m = o - r, d = i - s, b = Math.max(a, m, d, 1) * 2;
2276
+ function We(e, { minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s }) {
2277
+ const c = (t + n) / 2, u = (r + o) / 2, l = (i + s) / 2, a = n - t, d = o - r, m = s - i, b = Math.max(a, d, m, 1) * 2;
2245
2278
  e.controls.target.set(c, u, l), e.camera.position.set(c + b, u + b, l + b), e.camera.lookAt(c, u, l), e.controls.update();
2246
2279
  }
2247
- function Un(e, t = 1e3) {
2280
+ function rr(e, t = 1e3) {
2248
2281
  !e.camera || !e.controls || (e.controls.target.set(0, 0, 0), e.camera.position.set(t, t, t), e.camera.lookAt(0, 0, 0), e.controls.update());
2249
2282
  }
2250
- function Yn(e, t = 2e3) {
2283
+ function or(e, t = 2e3) {
2251
2284
  !e.camera || !e.controls || (e.controls.target.set(0, 0, 0), e.camera.position.set(0, 0, t), e.camera.up.set(0, 1, 0), e.camera.lookAt(0, 0, 0), e.controls.update());
2252
2285
  }
2253
- function qn(e, t = 0, n = 0) {
2286
+ function ir(e, t = 0, n = 0) {
2254
2287
  e.controls && typeof e.controls.pan == "function" && (e.controls.pan(t, n), e.controls.update());
2255
2288
  }
2256
- function Xn(e, t = 1.1) {
2289
+ function sr(e, t = 1.1) {
2257
2290
  !e.controls || typeof e.controls.dollyIn != "function" || typeof e.controls.dollyOut != "function" || (t > 1 ? e.controls.dollyOut(t) : e.controls.dollyIn(1 / t), e.controls.update());
2258
2291
  }
2259
- function Zn(e, t = 1.2) {
2292
+ function lr(e, t = 1.2) {
2260
2293
  if (!e.lastBounds) return;
2261
2294
  const {
2262
2295
  minX: n,
2263
2296
  maxX: r,
2264
2297
  minY: o,
2265
- maxY: s,
2266
- minZ: i,
2298
+ maxY: i,
2299
+ minZ: s,
2267
2300
  maxZ: c
2268
- } = e.lastBounds, u = (r - n) * t, l = (s - o) * t, a = (c - i) * t, m = (n + r) / 2, d = (o + s) / 2, f = (i + c) / 2, p = Math.max(u, l, a, 1) * 2;
2269
- e.controls.target.set(m, d, f), e.camera.position.set(m + p, d + p, f + p), e.camera.lookAt(m, d, f), e.controls.update();
2301
+ } = e.lastBounds, u = (r - n) * t, l = (i - o) * t, a = (c - s) * t, d = (n + r) / 2, m = (o + i) / 2, f = (s + c) / 2, p = Math.max(u, l, a, 1) * 2;
2302
+ e.controls.target.set(d, m, f), e.camera.position.set(d + p, m + p, f + p), e.camera.lookAt(d, m, f), e.controls.update();
2270
2303
  }
2271
- const Wn = 1, Kn = 120;
2272
- function Jn(e, t) {
2304
+ const ar = 1, cr = 120;
2305
+ function ur(e, t) {
2273
2306
  if (!e.camera || !e.controls || !Number.isFinite(t)) return !1;
2274
- const n = Math.min(Kn, Math.max(Wn, t)), r = e.controls.target, o = e.camera.position.distanceTo(r), s = e.camera.fov * Math.PI / 180, i = 2 * o * Math.tan(s / 2), c = n * Math.PI / 180, u = i / (2 * Math.tan(c / 2)), l = e.camera.position.clone().sub(r).normalize();
2307
+ const n = Math.min(cr, Math.max(ar, t)), r = e.controls.target, o = e.camera.position.distanceTo(r), i = e.camera.fov * Math.PI / 180, s = 2 * o * Math.tan(i / 2), c = n * Math.PI / 180, u = s / (2 * Math.tan(c / 2)), l = e.camera.position.clone().sub(r).normalize();
2275
2308
  return e.camera.position.copy(r).addScaledVector(l, u), e.camera.fov = n, e.camera.updateProjectionMatrix(), e.controls.update(), !0;
2276
2309
  }
2277
- function Qn(e, t = "orbit") {
2310
+ function dr(e, t = "orbit") {
2278
2311
  if (e.controlMode = t === "fly" ? "fly" : "orbit", e.controlMode === "fly")
2279
2312
  e.controls && (e.controls.enabled = !1), e.flyControls && (e.flyControls.enabled = !0);
2280
2313
  else if (e.flyControls && (e.flyControls.enabled = !1), e.controls) {
@@ -2283,394 +2316,464 @@ function Qn(e, t = "orbit") {
2283
2316
  e.controls.target.copy(n), e.controls.update();
2284
2317
  }
2285
2318
  }
2286
- const me = "#9ca3af";
2287
- function it(e, t) {
2319
+ const at = "#ffffbb", mr = 2, fr = 1.5, hr = 1;
2320
+ function pr(e) {
2321
+ const { renderer: t, scene: n, camera: r, container: o } = e;
2322
+ if (!t || !n || !r) return;
2323
+ const i = (o == null ? void 0 : o.clientWidth) || t.domElement.clientWidth || 1, s = (o == null ? void 0 : o.clientHeight) || t.domElement.clientHeight || 1, c = new Yt(t), u = new qt(n, r);
2324
+ c.addPass(u);
2325
+ const l = new _.Vector2(i, s), a = new Xt(l, n, r);
2326
+ a.visibleEdgeColor.set(at), a.hiddenEdgeColor.set(at), a.edgeStrength = mr, a.edgeThickness = fr, a.edgeGlow = hr, a.pulsePeriod = 0, a.selectedObjects = [], c.addPass(a), c.setSize(i, s), e._composer = c, e._outlinePass = a;
2327
+ }
2328
+ function br(e, t, n) {
2329
+ !e._composer || !e._outlinePass || (e._composer.setSize(t, n), e._outlinePass.resolution.set(t, n));
2330
+ }
2331
+ function Ie(e, t) {
2332
+ e._outlinePass && (e._outlinePass.selectedObjects = t ? [t] : [], e._selectedObject = t || null);
2333
+ }
2334
+ function ct(e) {
2335
+ e._composer && (e._composer.dispose(), e._composer = null), e._outlinePass = null, e._selectedObject = null, e.selectables = [];
2336
+ }
2337
+ const de = "#9ca3af";
2338
+ function ut(e, t) {
2288
2339
  const n = Number(e == null ? void 0 : e.md), r = Number(t == null ? void 0 : t.md);
2289
2340
  if (!Number.isFinite(n) || !Number.isFinite(r)) return null;
2290
- const o = Math.min(n, r), s = Math.max(n, r);
2291
- return s <= o ? null : { segStart: o, segEnd: s };
2341
+ const o = Math.min(n, r), i = Math.max(n, r);
2342
+ return i <= o ? null : { segStart: o, segEnd: i };
2292
2343
  }
2293
- function er(e, t, n) {
2344
+ function yr(e, t, n) {
2294
2345
  let r = 0, o = 0;
2295
- for (let i = 0; i < e.length; i += 1) {
2296
- const c = e[i], u = Number(c == null ? void 0 : c.from), l = Number(c == null ? void 0 : c.to), a = Number(c == null ? void 0 : c.value);
2346
+ for (let s = 0; s < e.length; s += 1) {
2347
+ const c = e[s], u = Number(c == null ? void 0 : c.from), l = Number(c == null ? void 0 : c.to), a = Number(c == null ? void 0 : c.value);
2297
2348
  if (!Number.isFinite(u) || !Number.isFinite(l) || !Number.isFinite(a) || l <= u) continue;
2298
- const m = Math.max(t, u), f = Math.min(n, l) - m;
2349
+ const d = Math.max(t, u), f = Math.min(n, l) - d;
2299
2350
  f <= 0 || (r += a * f, o += f);
2300
2351
  }
2301
2352
  if (o <= 0) return null;
2302
- const s = r / o;
2303
- return Number.isFinite(s) ? s : null;
2353
+ const i = r / o;
2354
+ return Number.isFinite(i) ? i : null;
2304
2355
  }
2305
- function tr(e, t) {
2306
- if (!Number.isFinite(e)) return new N.Color(me);
2307
- if (It(e, t) < 0) return new N.Color(me);
2308
- const r = On(e, t, me);
2309
- return new N.Color(r);
2356
+ function gr(e, t) {
2357
+ if (!Number.isFinite(e)) return new _.Color(de);
2358
+ if (Pt(e, t) < 0) return new _.Color(de);
2359
+ const r = Yn(e, t, de);
2360
+ return new _.Color(r);
2310
2361
  }
2311
- function nr(e = {}) {
2362
+ function _r(e = {}) {
2312
2363
  return {
2313
2364
  preserveView: !!e.preserveView,
2314
2365
  assayIntervalsByHole: e.assayIntervalsByHole || null,
2315
2366
  selectedAssayVariable: e.selectedAssayVariable || ""
2316
2367
  };
2317
2368
  }
2318
- function rr(e, t) {
2369
+ function Nr(e, t) {
2319
2370
  if (!e || !t) return [];
2320
2371
  const n = [];
2321
2372
  return Object.values(e).forEach((r) => {
2322
2373
  (r || []).forEach((o) => {
2323
- const s = Number(o == null ? void 0 : o.value);
2324
- Number.isFinite(s) && n.push(s);
2374
+ const i = Number(o == null ? void 0 : o.value);
2375
+ Number.isFinite(i) && n.push(i);
2325
2376
  });
2326
2377
  }), n;
2327
2378
  }
2328
- function Oe(e) {
2379
+ function Ve(e) {
2329
2380
  return {
2330
2381
  holeId: e.id,
2331
2382
  project: e.project
2332
2383
  };
2333
2384
  }
2334
- class ro {
2385
+ function zr(e) {
2386
+ return `${e ?? ""}`.trim().toLowerCase();
2387
+ }
2388
+ function Mr(e, t) {
2389
+ const n = `${e ?? ""}:${t ?? 0}`, r = xr(n), o = (t ?? 0) % 14 / 14, i = (r * 0.15 + o * 0.85) % 1, s = new _.Color();
2390
+ return s.setHSL(i, 1, 0.5), s;
2391
+ }
2392
+ function xr(e) {
2393
+ const t = `${e ?? ""}`;
2394
+ let n = 2166136261;
2395
+ for (let r = 0; r < t.length; r += 1)
2396
+ n ^= t.charCodeAt(r), n = Math.imul(n, 16777619);
2397
+ return (n >>> 0) / 4294967295;
2398
+ }
2399
+ function Ir(e, t) {
2400
+ if (!t || !e) return [];
2401
+ const n = e.id || e.holeId;
2402
+ if (!n) return [];
2403
+ const r = t[n];
2404
+ if (Array.isArray(r) && r.length) return r;
2405
+ const o = zr(n);
2406
+ if (o) {
2407
+ const i = t[o];
2408
+ if (Array.isArray(i) && i.length) return i;
2409
+ }
2410
+ return [];
2411
+ }
2412
+ function Ar({ selectedAssayVariable: e, assayIntervals: t, assayScale: n, holeId: r, segmentIndex: o, p1: i, p2: s }) {
2413
+ if (!e)
2414
+ return Mr(r, o);
2415
+ if (e === "__HAS_ASSAY__") {
2416
+ if (!(t != null && t.length)) return new _.Color(de);
2417
+ const l = ut(i, s);
2418
+ return l ? t.some((d) => {
2419
+ const m = Number(d == null ? void 0 : d.from), f = Number(d == null ? void 0 : d.to);
2420
+ if (!Number.isFinite(m) || !Number.isFinite(f)) return !1;
2421
+ const b = Math.max(l.segStart, m);
2422
+ return Math.min(l.segEnd, f) > b;
2423
+ }) ? new _.Color("#ff8c42") : new _.Color(de) : new _.Color(de);
2424
+ }
2425
+ if (!(t != null && t.length)) return new _.Color(de);
2426
+ const c = ut(i, s);
2427
+ if (!c) return new _.Color(de);
2428
+ const u = yr(t, c.segStart, c.segEnd);
2429
+ return gr(u, n);
2430
+ }
2431
+ function Er(e, t, n = {}) {
2432
+ if (!e.scene || (Ot(e), !t || t.length === 0)) return;
2433
+ const { preserveView: r, assayIntervalsByHole: o, selectedAssayVariable: i } = _r(n), s = Nr(o, i), c = Gn(s);
2434
+ let u = 1 / 0, l = -1 / 0, a = 1 / 0, d = -1 / 0, m = 1 / 0, f = -1 / 0;
2435
+ const b = new _.Vector3(), p = new _.Vector3(0, 1, 0);
2436
+ t.forEach((h, N) => {
2437
+ const E = N * 137.5 % 360 / 360, M = new _.Color().setHSL(E, 0.75, 0.55), z = (h.points || []).map((x) => {
2438
+ u = Math.min(u, x.x), l = Math.max(l, x.x), a = Math.min(a, x.y), d = Math.max(d, x.y), m = Math.min(m, x.z), f = Math.max(f, x.z);
2439
+ const V = new _.Vector3(x.x, x.y, x.z);
2440
+ return V.md = x.md, V;
2441
+ });
2442
+ if (z.length < 2) {
2443
+ if (z.length === 1) {
2444
+ const x = new _.SphereGeometry(5, 12, 12), V = new _.MeshLambertMaterial({
2445
+ color: M,
2446
+ emissive: M,
2447
+ emissiveIntensity: 0.2
2448
+ }), H = new _.Mesh(x, V);
2449
+ H.position.copy(z[0]), H.userData = Ve(h), e.scene.add(H), e.drillLines.push(H), e.drillMeshes.push(H);
2450
+ }
2451
+ return;
2452
+ }
2453
+ const P = new _.Group();
2454
+ P.userData = Ve(h);
2455
+ const D = i ? Ir(h, o) : [];
2456
+ for (let x = 0; x < z.length - 1; x += 1) {
2457
+ const V = z[x], H = z[x + 1], W = b.subVectors(H, V), O = W.length();
2458
+ if (O <= 1e-3) continue;
2459
+ const $ = 2.2, j = new _.CylinderGeometry($, $, O, 6, 1, !0), S = Ar({
2460
+ selectedAssayVariable: i,
2461
+ assayIntervals: D,
2462
+ assayScale: c,
2463
+ holeId: h.id,
2464
+ segmentIndex: x,
2465
+ p1: V,
2466
+ p2: H
2467
+ }), I = new _.MeshLambertMaterial({
2468
+ color: S,
2469
+ flatShading: !0,
2470
+ emissive: S,
2471
+ emissiveIntensity: 0.15
2472
+ }), g = new _.Mesh(j, I);
2473
+ g.position.copy(V.clone().addScaledVector(W, 0.5)), g.quaternion.setFromUnitVectors(p, W.clone().normalize()), g.userData = Ve(h), P.add(g), e.drillMeshes.push(g);
2474
+ }
2475
+ e.scene.add(P), e.drillLines.push(P);
2476
+ }), e.camera && e.controls && (e.lastBounds = { minX: u, maxX: l, minY: a, maxY: d, minZ: m, maxZ: f }, r || We(e, { minX: u, maxX: l, minY: a, maxY: d, minZ: m, maxZ: f })), be(e);
2477
+ }
2478
+ function Ot(e) {
2479
+ e.drillLines.forEach((t) => {
2480
+ e.scene.remove(t), t.isGroup ? t.traverse((n) => {
2481
+ n.isMesh && (n.geometry.dispose(), n.material.dispose());
2482
+ }) : t.isMesh && (t.geometry.dispose(), t.material.dispose());
2483
+ }), e.drillLines = [], e.drillMeshes = [], be(e);
2484
+ }
2485
+ const vr = [
2486
+ { normal: [1, 0, 0], neibDir: [1, 0, 0], verts: [[1, -1, -1], [1, 1, -1], [1, 1, 1], [1, -1, 1]] },
2487
+ { normal: [-1, 0, 0], neibDir: [-1, 0, 0], verts: [[-1, -1, 1], [-1, 1, 1], [-1, 1, -1], [-1, -1, -1]] },
2488
+ { normal: [0, 1, 0], neibDir: [0, 1, 0], verts: [[-1, 1, 1], [1, 1, 1], [1, 1, -1], [-1, 1, -1]] },
2489
+ { normal: [0, -1, 0], neibDir: [0, -1, 0], verts: [[1, -1, 1], [-1, -1, 1], [-1, -1, -1], [1, -1, -1]] },
2490
+ { normal: [0, 0, 1], neibDir: [0, 0, 1], verts: [[-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]] },
2491
+ { normal: [0, 0, -1], neibDir: [0, 0, -1], verts: [[1, -1, -1], [-1, -1, -1], [-1, 1, -1], [1, 1, -1]] }
2492
+ ];
2493
+ function Sr(e, t, n, r, o = {}) {
2494
+ if (!e.scene || (Tt(e), !t || !n || !r)) return;
2495
+ const { autoCenter: i = !0, opacity: s = 1 } = o;
2496
+ let c = 1 / 0, u = -1 / 0, l = 1 / 0, a = -1 / 0, d = 1 / 0, m = -1 / 0;
2497
+ t.forEach((g) => {
2498
+ const k = Number(g.x ?? g.center_x ?? 0), A = Number(g.y ?? g.center_y ?? 0), T = Number(g.z ?? g.center_z ?? 0), F = Number(g.dx ?? g.size_x ?? 1), C = Number(g.dy ?? g.size_y ?? 1), R = Number(g.dz ?? g.size_z ?? 1);
2499
+ c = Math.min(c, k - F / 2), u = Math.max(u, k + F / 2), l = Math.min(l, A - C / 2), a = Math.max(a, A + C / 2), d = Math.min(d, T - R / 2), m = Math.max(m, T + R / 2);
2500
+ });
2501
+ let f = 0, b = 0, p = 0;
2502
+ o.offset ? (f = Number(o.offset.x ?? 0), b = Number(o.offset.y ?? 0), p = Number(o.offset.z ?? 0)) : i && (f = -((c + u) / 2), b = -((l + a) / 2), p = -((d + m) / 2));
2503
+ const h = c + f, N = u + f, y = l + b, E = a + b, M = d + p, z = m + p, P = (g, k, A) => `${Math.round(g)},${Math.round(k)},${Math.round(A)}`, D = new Set(
2504
+ t.map((g) => P(Number(g.x ?? 0), Number(g.y ?? 0), Number(g.z ?? 0)))
2505
+ ), x = [], V = [], H = [], W = [], O = [];
2506
+ let $ = 0;
2507
+ if (t.forEach((g) => {
2508
+ const k = Number(g.x ?? g.center_x ?? 0), A = Number(g.y ?? g.center_y ?? 0), T = Number(g.z ?? g.center_z ?? 0), F = Number(g.dx ?? g.size_x ?? 1), C = Number(g.dy ?? g.size_y ?? 1), R = Number(g.dz ?? g.size_z ?? 1), X = k + f, re = A + b, me = T + p, se = zn(g[n], r, _), { r: Me, g: le, b: Le } = se;
2509
+ vr.forEach((fe) => {
2510
+ const Vt = k + fe.neibDir[0] * F, wt = A + fe.neibDir[1] * C, Ht = T + fe.neibDir[2] * R;
2511
+ if (D.has(P(Vt, wt, Ht))) return;
2512
+ const ye = $;
2513
+ fe.verts.forEach(([$t, jt, Rt]) => {
2514
+ x.push(X + $t * F / 2, re + jt * C / 2, me + Rt * R / 2), V.push(fe.normal[0], fe.normal[1], fe.normal[2]), H.push(Me, le, Le), $++;
2515
+ }), W.push(ye, ye + 1, ye + 2, ye, ye + 2, ye + 3), O.push(g);
2516
+ });
2517
+ }), x.length === 0) return;
2518
+ const j = new _.BufferGeometry();
2519
+ j.setAttribute("position", new _.Float32BufferAttribute(x, 3)), j.setAttribute("normal", new _.Float32BufferAttribute(V, 3)), j.setAttribute("color", new _.Float32BufferAttribute(H, 3)), j.setIndex(W);
2520
+ const S = new _.MeshLambertMaterial({
2521
+ vertexColors: !0,
2522
+ transparent: s < 1,
2523
+ opacity: s,
2524
+ side: _.DoubleSide
2525
+ }), I = new _.Mesh(j, S);
2526
+ I.userData._isMergedBlocks = !0, I.userData._quadToBlock = O, I.userData._offset = { x: f, y: b, z: p }, e.scene.add(I), e.blocks.push(I), be(e), e.camera && e.controls && (e.lastBounds = { minX: h, maxX: N, minY: y, maxY: E, minZ: M, maxZ: z }, We(e, { minX: h, maxX: N, minY: y, maxY: E, minZ: M, maxZ: z }));
2527
+ }
2528
+ function Tt(e) {
2529
+ var t;
2530
+ e.blocks.forEach((n) => {
2531
+ e.scene.remove(n), n.geometry.dispose(), n.material.dispose();
2532
+ }), e.blocks = [], e._blockHighlightMesh && ((t = e.scene) == null || t.remove(e._blockHighlightMesh), e._blockHighlightMesh.geometry.dispose(), e._blockHighlightMesh.material.dispose(), e._blockHighlightMesh = null), be(e);
2533
+ }
2534
+ function Pr(e, t) {
2535
+ const n = Math.max(0, Math.min(1, Number(t)));
2536
+ e.blocks.forEach((r) => {
2537
+ r.material && (r.material.opacity = n, r.material.transparent = n < 1, r.material.needsUpdate = !0);
2538
+ });
2539
+ }
2540
+ function Dr(e, t, n) {
2541
+ const r = (n == null ? void 0 : n.x) ?? 0, o = (n == null ? void 0 : n.y) ?? 0, i = (n == null ? void 0 : n.z) ?? 0, s = Number(t.x ?? t.center_x ?? 0) + r, c = Number(t.y ?? t.center_y ?? 0) + o, u = Number(t.z ?? t.center_z ?? 0) + i, l = Number(t.dx ?? t.size_x ?? 1), a = Number(t.dy ?? t.size_y ?? 1), d = Number(t.dz ?? t.size_z ?? 1);
2542
+ if (!e._blockHighlightMesh) {
2543
+ const m = new _.BoxGeometry(1, 1, 1), f = new _.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1 });
2544
+ e._blockHighlightMesh = new _.Mesh(m, f), e.scene.add(e._blockHighlightMesh);
2545
+ }
2546
+ return e._blockHighlightMesh.position.set(s, c, u), e._blockHighlightMesh.scale.set(l, a, d), e._blockHighlightMesh;
2547
+ }
2548
+ function Ft(e) {
2549
+ var o, i;
2550
+ if (!e._outlinePass || e.selectables.length === 0) {
2551
+ e._outlinePass && Ie(e, null);
2552
+ return;
2553
+ }
2554
+ const t = e.raycaster.intersectObjects(e.selectables, !0);
2555
+ if (t.length === 0) {
2556
+ Ie(e, null);
2557
+ return;
2558
+ }
2559
+ const n = t[0], r = n.object;
2560
+ if ((o = r == null ? void 0 : r.userData) != null && o._isMergedBlocks) {
2561
+ const s = Math.floor(n.faceIndex / 2), c = (i = r.userData._quadToBlock) == null ? void 0 : i[s];
2562
+ if (c) {
2563
+ Ie(e, Dr(e, c, r.userData._offset));
2564
+ return;
2565
+ }
2566
+ }
2567
+ Ie(e, r);
2568
+ }
2569
+ function kr(e) {
2570
+ const t = e.renderer;
2571
+ t && (e.handleCanvasClick = (n) => {
2572
+ var f, b, p, h, N, y, E;
2573
+ if (n.button !== 0) return;
2574
+ if ((f = e.gizmo) != null && f.domElement) {
2575
+ const M = e.gizmo.domElement.getBoundingClientRect();
2576
+ if (n.clientX >= M.left && n.clientX <= M.right && n.clientY >= M.top && n.clientY <= M.bottom)
2577
+ return;
2578
+ }
2579
+ const r = t.domElement.getBoundingClientRect(), o = n.clientX - r.left, i = n.clientY - r.top;
2580
+ if (e.pointer.x = o / r.width * 2 - 1, e.pointer.y = -(i / r.height * 2) + 1, e.raycaster.setFromCamera(e.pointer, e.camera), Ft(e), e.blocks.length > 0) {
2581
+ const M = e.raycaster.intersectObjects(e.blocks, !1);
2582
+ if (M.length > 0) {
2583
+ const z = M[0], P = z.object;
2584
+ if ((b = P == null ? void 0 : P.userData) != null && b._isMergedBlocks && e.blockClickHandler) {
2585
+ const D = Math.floor(z.faceIndex / 2), x = P.userData._quadToBlock[D];
2586
+ x && e.blockClickHandler(x);
2587
+ }
2588
+ return;
2589
+ }
2590
+ }
2591
+ const s = e.raycaster.intersectObjects(e.drillMeshes, !0), c = e.raycaster.intersectObjects(e.structuralMeshes, !0), u = ((p = s[0]) == null ? void 0 : p.distance) ?? 1 / 0;
2592
+ if ((((h = c[0]) == null ? void 0 : h.distance) ?? 1 / 0) < u && c.length > 0) {
2593
+ const M = c[0].object;
2594
+ e.drillholeClickHandler && e.drillholeClickHandler({ type: "structure", ...M.userData });
2595
+ return;
2596
+ }
2597
+ if (s.length === 0) return;
2598
+ let a = s[0].object;
2599
+ for (; a && a.parent && !((N = a.userData) != null && N.holeId); )
2600
+ a = a.parent;
2601
+ const d = (y = a == null ? void 0 : a.userData) == null ? void 0 : y.holeId, m = (E = a == null ? void 0 : a.userData) == null ? void 0 : E.project;
2602
+ d && e.drillholeClickHandler && e.drillholeClickHandler({ holeId: d, project: m });
2603
+ }, t.domElement.addEventListener("click", e.handleCanvasClick));
2604
+ }
2605
+ class Co {
2335
2606
  constructor() {
2336
- this.container = null, this.scene = null, this.camera = null, this.renderer = null, this.controls = null, this.flyControls = null, this.gizmo = null, this.blocks = [], this.drillLines = [], this.drillMeshes = [], this.structuralGroup = null, this.structuralMeshes = [], this.frameId = null, this.clock = new N.Clock(), this.handleCanvasClick = null, this.raycaster = new N.Raycaster(), this.pointer = new N.Vector2(), this.drillholeClickHandler = null, this.blockClickHandler = null, this.controlMode = "orbit", this._tmpDir = new N.Vector3(), this.viewChangeHandler = null, this._lastViewSignature = "", this._lastViewEmitMs = 0;
2607
+ this.container = null, this.scene = null, this.camera = null, this.renderer = null, this.controls = null, this.flyControls = null, this.gizmo = null, this.blocks = [], this.drillLines = [], this.drillMeshes = [], this.structuralGroup = null, this.structuralMeshes = [], this.frameId = null, this.clock = new _.Clock(), this.handleCanvasClick = null, this.raycaster = new _.Raycaster(), this.pointer = new _.Vector2(), this.drillholeClickHandler = null, this.blockClickHandler = null, this.controlMode = "orbit", this._tmpDir = new _.Vector3(), this.viewChangeHandler = null, this._lastViewSignature = "", this._lastViewEmitMs = 0, this.selectables = [], this._selectedObject = null, this._composer = null, this._blockHighlightMesh = null, this._outlinePass = null;
2337
2608
  }
2338
2609
  init(t) {
2339
2610
  if (!t) return;
2340
2611
  this.container = t;
2341
2612
  const n = t.clientWidth, r = t.clientHeight;
2342
- this.scene = new N.Scene(), this.scene.background = new N.Color(16777215), this.camera = new N.PerspectiveCamera(28, n / r, 1e-3, 1e5), this.camera.up.set(0, 0, 1), this.camera.position.set(50, 50, 50), this.camera.lookAt(0, 0, 0), this.renderer = new N.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(n, r), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.autoClear = !1, t.appendChild(this.renderer.domElement);
2343
- const o = new N.AmbientLight(16777215, 0.5);
2613
+ this.scene = new _.Scene(), this.scene.background = new _.Color(16777215), this.camera = new _.PerspectiveCamera(28, n / r, 1e-3, 1e5), this.camera.up.set(0, 0, 1), this.camera.position.set(50, 50, 50), this.camera.lookAt(0, 0, 0), this.renderer = new _.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(n, r), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.autoClear = !1, t.appendChild(this.renderer.domElement);
2614
+ const o = new _.AmbientLight(16777215, 0.5);
2344
2615
  this.scene.add(o);
2345
- const s = new N.DirectionalLight(16777215, 0.6);
2346
- s.position.set(10, 10, 5), this.scene.add(s);
2347
- const i = new N.AxesHelper(20);
2348
- this.scene.add(i), this.controls = new Ot(this.camera, this.renderer.domElement), this.controls.enableDamping = !1, this.controls.screenSpacePanning = !0, this.controls.enableZoom = !0, this.controls.zoomSpeed = 1.2, this.controls.minDistance = 3e-3, this.controls.maxDistance = 4e4, this.controls.mouseButtons = {
2349
- LEFT: N.MOUSE.PAN,
2350
- MIDDLE: N.MOUSE.DOLLY,
2351
- RIGHT: N.MOUSE.ROTATE
2616
+ const i = new _.DirectionalLight(16777215, 0.6);
2617
+ i.position.set(10, 10, 5), this.scene.add(i);
2618
+ const s = new _.AxesHelper(20);
2619
+ this.scene.add(s), this.controls = new Bt(this.camera, this.renderer.domElement), this.controls.enableDamping = !1, this.controls.screenSpacePanning = !0, this.controls.enableZoom = !0, this.controls.zoomSpeed = 1.2, this.controls.minDistance = 3e-3, this.controls.maxDistance = 4e4, this.controls.mouseButtons = {
2620
+ LEFT: _.MOUSE.PAN,
2621
+ MIDDLE: _.MOUSE.DOLLY,
2622
+ RIGHT: _.MOUSE.ROTATE
2352
2623
  }, this.controls.touches = {
2353
- ONE: N.TOUCH.ROTATE,
2354
- TWO: N.TOUCH.PAN
2355
- }, this.controls.maxPolarAngle = Math.PI, this.flyControls = new Vt(this.camera, this.renderer.domElement), this.flyControls.movementSpeed = 2e3, this.flyControls.rollSpeed = Math.PI / 12, this.flyControls.dragToLook = !0, this.flyControls.enabled = !1, this.gizmo = new wt(this.camera, this.renderer, {
2624
+ ONE: _.TOUCH.ROTATE,
2625
+ TWO: _.TOUCH.PAN
2626
+ }, this.controls.maxPolarAngle = Math.PI, this.flyControls = new Gt(this.camera, this.renderer.domElement), this.flyControls.movementSpeed = 2e3, this.flyControls.rollSpeed = Math.PI / 12, this.flyControls.dragToLook = !0, this.flyControls.enabled = !1, this.gizmo = new Ut(this.camera, this.renderer, {
2356
2627
  container: this.container,
2357
2628
  placement: "top-right",
2358
2629
  size: 110,
2359
2630
  offset: { top: 12, right: 12 },
2360
2631
  animated: !0,
2361
2632
  speed: 1.5
2362
- }), this.gizmo.attachControls(this.controls), this._attachCanvasClickHandler();
2633
+ }), this.gizmo.attachControls(this.controls), kr(this), pr(this);
2363
2634
  const c = () => {
2364
2635
  var l;
2365
2636
  this.frameId = requestAnimationFrame(c);
2366
2637
  const u = this.clock.getDelta();
2367
- this.renderer.clear(), this.controlMode === "fly" && ((l = this.flyControls) != null && l.enabled) ? this.flyControls.update(u) : this.controls && this.controls.update(), this._emitViewChangeIfNeeded(), this.renderer.render(this.scene, this.camera), this.gizmo && this.gizmo.render();
2638
+ this.renderer.clear(), this.controlMode === "fly" && ((l = this.flyControls) != null && l.enabled) ? this.flyControls.update(u) : this.controls && this.controls.update(), this._emitViewChangeIfNeeded(), this._composer ? this._composer.render(u) : this.renderer.render(this.scene, this.camera), this.gizmo && this.gizmo.render();
2368
2639
  };
2369
2640
  c();
2370
2641
  }
2371
- setViewChangeHandler(t) {
2372
- this.viewChangeHandler = typeof t == "function" ? t : null;
2373
- }
2374
- getViewState() {
2375
- return Et(this);
2376
- }
2377
- setViewState(t) {
2378
- return Bn(this, t);
2379
- }
2380
- _buildViewSignature(t) {
2381
- return qe(t);
2382
- }
2383
- _emitViewChangeIfNeeded() {
2384
- Gn(this);
2385
- }
2386
- _attachCanvasClickHandler() {
2387
- const t = this.renderer;
2388
- t && (this.handleCanvasClick = (n) => {
2389
- var f, b, p, h, _, y, I;
2390
- if (n.button !== 0) return;
2391
- if ((f = this.gizmo) != null && f.domElement) {
2392
- const z = this.gizmo.domElement.getBoundingClientRect();
2393
- if (n.clientX >= z.left && n.clientX <= z.right && n.clientY >= z.top && n.clientY <= z.bottom)
2394
- return;
2395
- }
2396
- const r = t.domElement.getBoundingClientRect(), o = n.clientX - r.left, s = n.clientY - r.top;
2397
- if (this.pointer.x = o / r.width * 2 - 1, this.pointer.y = -(s / r.height * 2) + 1, this.raycaster.setFromCamera(this.pointer, this.camera), this.blocks.length > 0) {
2398
- const z = this.raycaster.intersectObjects(this.blocks, !1);
2399
- if (z.length > 0) {
2400
- const x = z[0], D = x.object;
2401
- if ((b = D == null ? void 0 : D.userData) != null && b._isMergedBlocks && this.blockClickHandler) {
2402
- const S = Math.floor(x.faceIndex / 2), M = D.userData._quadToBlock[S];
2403
- M && this.blockClickHandler(M);
2404
- }
2405
- return;
2406
- }
2407
- }
2408
- const i = this.raycaster.intersectObjects(this.drillMeshes, !0), c = this.raycaster.intersectObjects(this.structuralMeshes, !0), u = ((p = i[0]) == null ? void 0 : p.distance) ?? 1 / 0;
2409
- if ((((h = c[0]) == null ? void 0 : h.distance) ?? 1 / 0) < u && c.length > 0) {
2410
- const z = c[0].object;
2411
- this.drillholeClickHandler && this.drillholeClickHandler({ type: "structure", ...z.userData });
2412
- return;
2413
- }
2414
- if (i.length === 0) return;
2415
- let a = i[0].object;
2416
- for (; a && a.parent && !((_ = a.userData) != null && _.holeId); )
2417
- a = a.parent;
2418
- const m = (y = a == null ? void 0 : a.userData) == null ? void 0 : y.holeId, d = (I = a == null ? void 0 : a.userData) == null ? void 0 : I.project;
2419
- m && this.drillholeClickHandler && this.drillholeClickHandler({ holeId: m, project: d });
2420
- }, t.domElement.addEventListener("click", this.handleCanvasClick));
2421
- }
2422
2642
  resize() {
2423
2643
  if (!this.container || !this.camera || !this.renderer) return;
2424
2644
  const t = this.container.clientWidth, n = this.container.clientHeight;
2425
- this.camera.aspect = t / n, this.camera.updateProjectionMatrix(), this.renderer.setSize(t, n), this.gizmo && this.gizmo.update();
2645
+ this.camera.aspect = t / n, this.camera.updateProjectionMatrix(), this.renderer.setSize(t, n), this.gizmo && this.gizmo.update(), br(this, t, n);
2646
+ }
2647
+ dispose() {
2648
+ this.frameId && cancelAnimationFrame(this.frameId), this.renderer && this.handleCanvasClick && this.renderer.domElement.removeEventListener("click", this.handleCanvasClick), this.gizmo && (this.gizmo.dispose(), this.gizmo = null), this.viewChangeHandler = null, Tt(this), Ot(this), Ct(this), ct(this), this.controls && this.controls.dispose(), this.flyControls && this.flyControls.dispose(), this.renderer && (this.renderer.dispose(), this.container && this.renderer.domElement && this.container.removeChild(this.renderer.domElement));
2649
+ }
2650
+ // ---------------------------------------------------------------------------
2651
+ // Data renderers — delegate to domain modules
2652
+ // ---------------------------------------------------------------------------
2653
+ setDrillholes(t, n = {}) {
2654
+ Er(this, t, n);
2426
2655
  }
2427
2656
  /**
2428
2657
  * Render block model data as a single merged mesh of exterior faces only.
2429
- *
2430
- * Adjacent blocks' shared faces are skipped so there are no coincident
2431
- * polygons and therefore no z-fighting. Vertex colours are used so the
2432
- * entire model is a single draw call.
2433
- *
2434
- * Accepts rows with canonical column names ``x``, ``y``, ``z``, ``dx``,
2435
- * ``dy``, ``dz`` (produced by :func:`parseBlockModelCSV`).
2436
- *
2437
2658
  * @param {Array<Object>} data - Block rows (canonical column names)
2438
2659
  * @param {string} selectedProperty - Attribute column used for colouring
2439
- * @param {Object} stats - Property statistics (from :func:`calculatePropertyStats`)
2660
+ * @param {Object} stats - Property statistics
2440
2661
  * @param {Object} [options]
2441
- * @param {Object} [options.offset] - Optional ``{x, y, z}`` translation applied
2442
- * to all block centres before rendering. When omitted the scene defaults to
2443
- * auto-centering by shifting the extent centre to the origin.
2444
- * @param {number} [options.opacity=1.0] - Initial material opacity (0–1)
2445
- * @param {boolean} [options.autoCenter=true] - If true and no offset is
2446
- * supplied, translate block centres so the extent centre sits at the origin.
2447
2662
  */
2448
2663
  setBlocks(t, n, r, o = {}) {
2449
- if (!this.scene || (this._clearBlocks(), !t || !n || !r)) return;
2450
- const { autoCenter: s = !0, opacity: i = 1 } = o;
2451
- let c = 1 / 0, u = -1 / 0, l = 1 / 0, a = -1 / 0, m = 1 / 0, d = -1 / 0;
2452
- t.forEach((g) => {
2453
- const C = Number(g.x ?? g.center_x ?? 0), F = Number(g.y ?? g.center_y ?? 0), V = Number(g.z ?? g.center_z ?? 0), k = Number(g.dx ?? g.size_x ?? 1), H = Number(g.dy ?? g.size_y ?? 1), U = Number(g.dz ?? g.size_z ?? 1);
2454
- c = Math.min(c, C - k / 2), u = Math.max(u, C + k / 2), l = Math.min(l, F - H / 2), a = Math.max(a, F + H / 2), m = Math.min(m, V - U / 2), d = Math.max(d, V + U / 2);
2455
- });
2456
- let f = 0, b = 0, p = 0;
2457
- o.offset ? (f = Number(o.offset.x ?? 0), b = Number(o.offset.y ?? 0), p = Number(o.offset.z ?? 0)) : s && (f = -((c + u) / 2), b = -((l + a) / 2), p = -((m + d) / 2));
2458
- const h = c + f, _ = u + f, y = l + b, I = a + b, z = m + p, x = d + p, D = (g, C, F) => `${Math.round(g)},${Math.round(C)},${Math.round(F)}`, S = new Set(
2459
- t.map((g) => D(Number(g.x ?? 0), Number(g.y ?? 0), Number(g.z ?? 0)))
2460
- ), M = [
2461
- { normal: [1, 0, 0], neibDir: [1, 0, 0], verts: [[1, -1, -1], [1, 1, -1], [1, 1, 1], [1, -1, 1]] },
2462
- { normal: [-1, 0, 0], neibDir: [-1, 0, 0], verts: [[-1, -1, 1], [-1, 1, 1], [-1, 1, -1], [-1, -1, -1]] },
2463
- { normal: [0, 1, 0], neibDir: [0, 1, 0], verts: [[-1, 1, 1], [1, 1, 1], [1, 1, -1], [-1, 1, -1]] },
2464
- { normal: [0, -1, 0], neibDir: [0, -1, 0], verts: [[1, -1, 1], [-1, -1, 1], [-1, -1, -1], [1, -1, -1]] },
2465
- { normal: [0, 0, 1], neibDir: [0, 0, 1], verts: [[-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]] },
2466
- { normal: [0, 0, -1], neibDir: [0, 0, -1], verts: [[1, -1, -1], [-1, -1, -1], [-1, 1, -1], [1, 1, -1]] }
2467
- ], O = [], $ = [], Z = [], T = [], R = [];
2468
- let q = 0;
2469
- if (t.forEach((g) => {
2470
- const C = Number(g.x ?? g.center_x ?? 0), F = Number(g.y ?? g.center_y ?? 0), V = Number(g.z ?? g.center_z ?? 0), k = Number(g.dx ?? g.size_x ?? 1), H = Number(g.dy ?? g.size_y ?? 1), U = Number(g.dz ?? g.size_z ?? 1), re = C + f, de = F + b, ie = V + p, Ne = mn(g[n], r, N), { r: le, g: Pe, b: Dt } = Ne;
2471
- M.forEach((fe) => {
2472
- const St = C + fe.neibDir[0] * k, Pt = F + fe.neibDir[1] * H, kt = V + fe.neibDir[2] * U;
2473
- if (S.has(D(St, Pt, kt))) return;
2474
- const be = q;
2475
- fe.verts.forEach(([Lt, Tt, Ft]) => {
2476
- O.push(re + Lt * k / 2, de + Tt * H / 2, ie + Ft * U / 2), $.push(fe.normal[0], fe.normal[1], fe.normal[2]), Z.push(le, Pe, Dt), q++;
2477
- }), T.push(be, be + 1, be + 2, be, be + 2, be + 3), R.push(g);
2478
- });
2479
- }), O.length === 0) return;
2480
- const A = new N.BufferGeometry();
2481
- A.setAttribute("position", new N.Float32BufferAttribute(O, 3)), A.setAttribute("normal", new N.Float32BufferAttribute($, 3)), A.setAttribute("color", new N.Float32BufferAttribute(Z, 3)), A.setIndex(T);
2482
- const v = new N.MeshLambertMaterial({
2483
- vertexColors: !0,
2484
- transparent: i < 1,
2485
- opacity: i,
2486
- side: N.DoubleSide
2487
- // safe — all interior faces are already removed
2488
- }), P = new N.Mesh(A, v);
2489
- P.userData._isMergedBlocks = !0, P.userData._quadToBlock = R, this.scene.add(P), this.blocks.push(P), this.camera && this.controls && (this.lastBounds = { minX: h, maxX: _, minY: y, maxY: I, minZ: z, maxZ: x }, Fe(this, { minX: h, maxX: _, minY: y, maxY: I, minZ: z, maxZ: x }));
2664
+ Sr(this, t, n, r, o);
2490
2665
  }
2491
2666
  /**
2492
2667
  * Update the opacity of all currently rendered blocks.
2493
- * @param {number} opacity - New opacity value between 0 (transparent) and 1 (opaque)
2668
+ * @param {number} opacity - New opacity value between 0 and 1
2494
2669
  */
2495
2670
  setBlockOpacity(t) {
2496
- const n = Math.max(0, Math.min(1, Number(t)));
2497
- this.blocks.forEach((r) => {
2498
- r.material && (r.material.opacity = n, r.material.transparent = n < 1, r.material.needsUpdate = !0);
2499
- });
2671
+ Pr(this, t);
2672
+ }
2673
+ setStructuralDiscs(t, n, r = {}) {
2674
+ Qn(this, t, n, r);
2675
+ }
2676
+ setStructuralDiscsVisible(t) {
2677
+ er(this, t);
2678
+ }
2679
+ // ---------------------------------------------------------------------------
2680
+ // Click handlers
2681
+ // ---------------------------------------------------------------------------
2682
+ setDrillholeClickHandler(t) {
2683
+ this.drillholeClickHandler = t;
2500
2684
  }
2501
2685
  /**
2502
2686
  * Register a click handler for block selection.
2503
- * The handler is called with the full block row data when a block is clicked.
2504
2687
  * @param {Function|null} handler - Callback ``(blockData) => void``, or null to clear
2505
2688
  */
2506
2689
  setBlockClickHandler(t) {
2507
2690
  this.blockClickHandler = typeof t == "function" ? t : null;
2508
2691
  }
2509
- setDrillholes(t, n = {}) {
2510
- if (!this.scene || (this._clearDrillholes(), !t || t.length === 0)) return;
2511
- const { preserveView: r, assayIntervalsByHole: o, selectedAssayVariable: s } = nr(n), i = rr(o, s), c = Tn(i);
2512
- let u = 1 / 0, l = -1 / 0, a = 1 / 0, m = -1 / 0, d = 1 / 0, f = -1 / 0;
2513
- const b = new N.Vector3(), p = new N.Vector3(0, 1, 0);
2514
- t.forEach((h, _) => {
2515
- const I = _ * 137.5 % 360 / 360, z = new N.Color().setHSL(I, 0.75, 0.55), x = (h.points || []).map((M) => {
2516
- u = Math.min(u, M.x), l = Math.max(l, M.x), a = Math.min(a, M.y), m = Math.max(m, M.y), d = Math.min(d, M.z), f = Math.max(f, M.z);
2517
- const O = new N.Vector3(M.x, M.y, M.z);
2518
- return O.md = M.md, O;
2519
- });
2520
- if (x.length < 2) {
2521
- if (x.length === 1) {
2522
- const M = new N.SphereGeometry(5, 12, 12), O = new N.MeshLambertMaterial({
2523
- color: z,
2524
- emissive: z,
2525
- emissiveIntensity: 0.2
2526
- }), $ = new N.Mesh(M, O);
2527
- $.position.copy(x[0]), $.userData = Oe(h), this.scene.add($), this.drillLines.push($), this.drillMeshes.push($);
2528
- }
2529
- return;
2530
- }
2531
- const D = new N.Group();
2532
- D.userData = Oe(h);
2533
- const S = s ? this._resolveAssayIntervalsForHole(h, o) : [];
2534
- for (let M = 0; M < x.length - 1; M += 1) {
2535
- const O = x[M], $ = x[M + 1], Z = b.subVectors($, O), T = Z.length();
2536
- if (T <= 1e-3) continue;
2537
- const R = 2.2, q = new N.CylinderGeometry(R, R, T, 6, 1, !0), A = this._getSegmentColor({
2538
- selectedAssayVariable: s,
2539
- assayIntervals: S,
2540
- assayScale: c,
2541
- holeId: h.id,
2542
- segmentIndex: M,
2543
- p1: O,
2544
- p2: $
2545
- }), v = new N.MeshLambertMaterial({
2546
- color: A,
2547
- flatShading: !0,
2548
- emissive: A,
2549
- emissiveIntensity: 0.15
2550
- }), P = new N.Mesh(q, v);
2551
- P.position.copy(O.clone().addScaledVector(Z, 0.5)), P.quaternion.setFromUnitVectors(p, Z.clone().normalize()), P.userData = Oe(h), D.add(P), this.drillMeshes.push(P);
2552
- }
2553
- this.scene.add(D), this.drillLines.push(D);
2554
- }), this.camera && this.controls && (this.lastBounds = { minX: u, maxX: l, minY: a, maxY: m, minZ: d, maxZ: f }, r || Fe(this, { minX: u, maxX: l, minY: a, maxY: m, minZ: d, maxZ: f }));
2555
- }
2556
- _getSegmentColor({ selectedAssayVariable: t, assayIntervals: n, assayScale: r, holeId: o, segmentIndex: s, p1: i, p2: c }) {
2557
- if (!t)
2558
- return sr(o, s);
2559
- if (t === "__HAS_ASSAY__") {
2560
- if (!(n != null && n.length)) return new N.Color(me);
2561
- const a = it(i, c);
2562
- return a ? n.some((d) => {
2563
- const f = Number(d == null ? void 0 : d.from), b = Number(d == null ? void 0 : d.to);
2564
- if (!Number.isFinite(f) || !Number.isFinite(b)) return !1;
2565
- const p = Math.max(a.segStart, f);
2566
- return Math.min(a.segEnd, b) > p;
2567
- }) ? new N.Color("#ff8c42") : new N.Color(me) : new N.Color(me);
2568
- }
2569
- if (!(n != null && n.length)) return new N.Color(me);
2570
- const u = it(i, c);
2571
- if (!u) return new N.Color(me);
2572
- const l = er(n, u.segStart, u.segEnd);
2573
- return tr(l, r);
2574
- }
2575
- _resolveAssayIntervalsForHole(t, n) {
2576
- if (!n || !t) return [];
2577
- const r = t.id || t.holeId;
2578
- if (!r) return [];
2579
- const o = n[r];
2580
- if (Array.isArray(o) && o.length) return o;
2581
- const s = or(r);
2582
- if (s) {
2583
- const i = n[s];
2584
- if (Array.isArray(i) && i.length) return i;
2585
- }
2586
- return [];
2692
+ // ---------------------------------------------------------------------------
2693
+ // Camera controls delegate to baselode3dCameraControls
2694
+ // ---------------------------------------------------------------------------
2695
+ setViewChangeHandler(t) {
2696
+ this.viewChangeHandler = typeof t == "function" ? t : null;
2697
+ }
2698
+ getViewState() {
2699
+ return Lt(this);
2700
+ }
2701
+ setViewState(t) {
2702
+ return tr(this, t);
2703
+ }
2704
+ _buildViewSignature(t) {
2705
+ return Xe(t);
2706
+ }
2707
+ _emitViewChangeIfNeeded() {
2708
+ nr(this);
2587
2709
  }
2588
- _fitCameraToBounds({ minX: t, maxX: n, minY: r, maxY: o, minZ: s, maxZ: i }) {
2589
- Fe(this, { minX: t, maxX: n, minY: r, maxY: o, minZ: s, maxZ: i });
2710
+ _fitCameraToBounds({ minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s }) {
2711
+ We(this, { minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s });
2590
2712
  }
2591
2713
  recenterCameraToOrigin(t = 1e3) {
2592
- Un(this, t);
2714
+ rr(this, t);
2593
2715
  }
2594
2716
  lookDown(t = 2e3) {
2595
- Yn(this, t);
2717
+ or(this, t);
2596
2718
  }
2597
2719
  pan(t = 0, n = 0) {
2598
- qn(this, t, n);
2720
+ ir(this, t, n);
2599
2721
  }
2600
2722
  dolly(t = 1.1) {
2601
- Xn(this, t);
2723
+ sr(this, t);
2602
2724
  }
2603
2725
  focusOnLastBounds(t = 1.2) {
2604
- Zn(this, t);
2605
- }
2606
- _clearBlocks() {
2607
- this.blocks.forEach((t) => {
2608
- this.scene.remove(t), t.geometry.dispose(), t.material.dispose();
2609
- }), this.blocks = [];
2610
- }
2611
- setStructuralDiscs(t, n, r = {}) {
2612
- if (!this.scene || (this._clearStructuralDiscs(), !(t != null && t.length) || !(n != null && n.length))) return;
2613
- const { maxDiscs: o = 3e3 } = r;
2614
- let s = t;
2615
- if (s.length > o) {
2616
- const u = s.length / o, l = [];
2617
- for (let a = 0; a < o; a++)
2618
- l.push(s[Math.floor(a * u)]);
2619
- s = l;
2620
- }
2621
- const i = n.flatMap((u) => (u.points || []).map((l) => ({ ...l, hole_id: u.id }))), c = gn(s, i, r);
2622
- c.length && (this.structuralGroup = jn(c, r), this.scene.add(this.structuralGroup), this.structuralGroup.traverse((u) => {
2623
- u.isMesh && this.structuralMeshes.push(u);
2624
- }));
2726
+ lr(this, t);
2625
2727
  }
2626
2728
  /**
2627
2729
  * Change the camera field-of-view while keeping the visible scene the same apparent size.
2628
- * FOV is clamped to [FOV_MIN_DEG, FOV_MAX_DEG]. Delegates to setFov in baselode3dCameraControls.
2629
2730
  * @param {number} fovDeg - Desired FOV in degrees
2630
2731
  */
2631
2732
  setCameraFov(t) {
2632
- Jn(this, t);
2733
+ ur(this, t);
2633
2734
  }
2634
- setStructuralDiscsVisible(t) {
2635
- this.structuralGroup && (this.structuralGroup.visible = !!t);
2735
+ setControlMode(t = "orbit") {
2736
+ dr(this, t);
2636
2737
  }
2637
- _clearStructuralDiscs() {
2638
- this.structuralGroup && (this.scene.remove(this.structuralGroup), this.structuralGroup.traverse((t) => {
2639
- t.isMesh && (t.geometry.dispose(), t.material.dispose());
2640
- }), this.structuralGroup = null), this.structuralMeshes = [];
2738
+ // ---------------------------------------------------------------------------
2739
+ // Selection glow public API
2740
+ // ---------------------------------------------------------------------------
2741
+ _syncSelectables() {
2742
+ be(this);
2743
+ }
2744
+ /**
2745
+ * Register the objects that are candidates for click-select glow.
2746
+ * @param {THREE.Object3D[]} objects
2747
+ */
2748
+ setSelectableObjects(t) {
2749
+ this.selectables = Array.isArray(t) ? t.slice() : [];
2641
2750
  }
2642
- _clearDrillholes() {
2643
- this.drillLines.forEach((t) => {
2644
- this.scene.remove(t), t.isGroup ? t.traverse((n) => {
2645
- n.isMesh && (n.geometry.dispose(), n.material.dispose());
2646
- }) : t.isMesh && (t.geometry.dispose(), t.material.dispose());
2647
- }), this.drillLines = [], this.drillMeshes = [];
2751
+ /**
2752
+ * Programmatically select an object (or pass null to clear).
2753
+ * @param {THREE.Object3D|null} object
2754
+ */
2755
+ selectObject(t) {
2756
+ Ie(this, t || null);
2648
2757
  }
2649
- dispose() {
2650
- this.frameId && cancelAnimationFrame(this.frameId), this.renderer && this.handleCanvasClick && this.renderer.domElement.removeEventListener("click", this.handleCanvasClick), this.gizmo && (this.gizmo.dispose(), this.gizmo = null), this.viewChangeHandler = null, this._clearBlocks(), this._clearDrillholes(), this._clearStructuralDiscs(), this.controls && this.controls.dispose(), this.flyControls && this.flyControls.dispose(), this.renderer && (this.renderer.dispose(), this.container && this.renderer.domElement && this.container.removeChild(this.renderer.domElement));
2758
+ /**
2759
+ * Return the currently selected object, or null if nothing is selected.
2760
+ * @returns {THREE.Object3D|null}
2761
+ */
2762
+ getSelectedObject() {
2763
+ return this._selectedObject || null;
2651
2764
  }
2652
- setDrillholeClickHandler(t) {
2653
- this.drillholeClickHandler = t;
2765
+ /**
2766
+ * Dispose the effect composer and all GPU resources used by the selection glow.
2767
+ */
2768
+ disposeGlow() {
2769
+ ct(this);
2654
2770
  }
2655
- setControlMode(t = "orbit") {
2656
- Qn(this, t);
2771
+ /** @private */
2772
+ _updateSelectionFromPointer() {
2773
+ Ft(this);
2657
2774
  }
2658
2775
  }
2659
- function or(e) {
2660
- return `${e ?? ""}`.trim().toLowerCase();
2661
- }
2662
- function sr(e, t) {
2663
- const n = `${e ?? ""}:${t ?? 0}`, r = ir(n), o = (t ?? 0) % 14 / 14, s = (r * 0.15 + o * 0.85) % 1, i = new N.Color();
2664
- return i.setHSL(s, 1, 0.5), i;
2665
- }
2666
- function ir(e) {
2667
- const t = `${e ?? ""}`;
2668
- let n = 2166136261;
2669
- for (let r = 0; r < t.length; r += 1)
2670
- n ^= t.charCodeAt(r), n = Math.imul(n, 16777619);
2671
- return (n >>> 0) / 4294967295;
2672
- }
2673
- function oo({
2776
+ function Lo({
2674
2777
  controlMode: e = "orbit",
2675
2778
  onToggleFly: t = () => {
2676
2779
  },
@@ -2688,7 +2791,7 @@ function oo({
2688
2791
  /* @__PURE__ */ L("button", { type: "button", className: "ghost-button", onClick: t, children: e === "orbit" ? "Enable fly controls" : "Disable fly controls" })
2689
2792
  ] });
2690
2793
  }
2691
- function so({
2794
+ function Oo({
2692
2795
  properties: e = [],
2693
2796
  selectedProperty: t = "",
2694
2797
  onPropertyChange: n = () => {
@@ -2696,8 +2799,8 @@ function so({
2696
2799
  opacity: r = 0.85,
2697
2800
  onOpacityChange: o = () => {
2698
2801
  },
2699
- propertyStats: s = null,
2700
- clickedBlock: i = null,
2802
+ propertyStats: i = null,
2803
+ clickedBlock: s = null,
2701
2804
  onPopupClose: c = () => {
2702
2805
  }
2703
2806
  }) {
@@ -2717,18 +2820,18 @@ function so({
2717
2820
  ]
2718
2821
  }
2719
2822
  ),
2720
- s && s.type === "numeric" && /* @__PURE__ */ Q("div", { className: "bm-widget__scale", children: [
2721
- /* @__PURE__ */ L("span", { className: "bm-widget__scale-label bm-widget__scale-label--min", children: ((u = s.min) == null ? void 0 : u.toFixed(2)) ?? "—" }),
2823
+ i && i.type === "numeric" && /* @__PURE__ */ Q("div", { className: "bm-widget__scale", children: [
2824
+ /* @__PURE__ */ L("span", { className: "bm-widget__scale-label bm-widget__scale-label--min", children: ((u = i.min) == null ? void 0 : u.toFixed(2)) ?? "—" }),
2722
2825
  /* @__PURE__ */ L("div", { className: "bm-widget__scale-bar" }),
2723
- /* @__PURE__ */ L("span", { className: "bm-widget__scale-label bm-widget__scale-label--max", children: ((l = s.max) == null ? void 0 : l.toFixed(2)) ?? "—" })
2826
+ /* @__PURE__ */ L("span", { className: "bm-widget__scale-label bm-widget__scale-label--max", children: ((l = i.max) == null ? void 0 : l.toFixed(2)) ?? "—" })
2724
2827
  ] }),
2725
- s && s.type === "categorical" && /* @__PURE__ */ L("div", { className: "bm-widget__categories", children: (s.categories || []).map((a, m) => {
2726
- const d = Math.round(m / Math.max(s.categories.length, 1) * 360);
2828
+ i && i.type === "categorical" && /* @__PURE__ */ L("div", { className: "bm-widget__categories", children: (i.categories || []).map((a, d) => {
2829
+ const m = Math.round(d / Math.max(i.categories.length, 1) * 360);
2727
2830
  return /* @__PURE__ */ L(
2728
2831
  "span",
2729
2832
  {
2730
2833
  className: "bm-widget__category-chip",
2731
- style: { background: `hsl(${d},70%,50%)` },
2834
+ style: { background: `hsl(${m},70%,50%)` },
2732
2835
  children: a
2733
2836
  },
2734
2837
  a
@@ -2752,7 +2855,7 @@ function so({
2752
2855
  onChange: (a) => o(parseFloat(a.target.value))
2753
2856
  }
2754
2857
  ),
2755
- i && /* @__PURE__ */ Q("div", { className: "bm-widget__popup", children: [
2858
+ s && /* @__PURE__ */ Q("div", { className: "bm-widget__popup", children: [
2756
2859
  /* @__PURE__ */ Q("div", { className: "bm-widget__popup-header", children: [
2757
2860
  /* @__PURE__ */ L("span", { children: "Block attributes" }),
2758
2861
  /* @__PURE__ */ L(
@@ -2766,140 +2869,140 @@ function so({
2766
2869
  }
2767
2870
  )
2768
2871
  ] }),
2769
- /* @__PURE__ */ L("table", { className: "bm-widget__popup-table", children: /* @__PURE__ */ L("tbody", { children: Object.entries(i).map(([a, m]) => /* @__PURE__ */ Q("tr", { children: [
2872
+ /* @__PURE__ */ L("table", { className: "bm-widget__popup-table", children: /* @__PURE__ */ L("tbody", { children: Object.entries(s).map(([a, d]) => /* @__PURE__ */ Q("tr", { children: [
2770
2873
  /* @__PURE__ */ L("th", { children: a }),
2771
- /* @__PURE__ */ L("td", { children: m == null ? "—" : String(m) })
2874
+ /* @__PURE__ */ L("td", { children: d == null ? "—" : String(d) })
2772
2875
  ] }, a)) }) })
2773
2876
  ] })
2774
2877
  ] });
2775
2878
  }
2776
2879
  export {
2777
- Ln as ASSAY_COLOR_PALETTE_10,
2778
- Ht as ASSAY_NON_VALUE_FIELDS,
2779
- j as AZIMUTH,
2780
- br as BASELODE_DATA_MODEL_DRILL_ASSAY,
2781
- hr as BASELODE_DATA_MODEL_DRILL_COLLAR,
2782
- pr as BASELODE_DATA_MODEL_DRILL_SURVEY,
2783
- yr as BASELODE_DATA_MODEL_STRUCTURAL_POINT,
2784
- oo as Baselode3DControls,
2785
- ro as Baselode3DScene,
2786
- so as BlockModelWidget,
2787
- Xe as CHART_OPTIONS,
2788
- Zt as COMMENT_COLUMN_NAMES,
2789
- at as CRS,
2790
- Rt as DEFAULT_COLUMN_MAP,
2880
+ Bn as ASSAY_COLOR_PALETTE_10,
2881
+ Kt as ASSAY_NON_VALUE_FIELDS,
2882
+ B as AZIMUTH,
2883
+ Gr as BASELODE_DATA_MODEL_DRILL_ASSAY,
2884
+ Rr as BASELODE_DATA_MODEL_DRILL_COLLAR,
2885
+ Br as BASELODE_DATA_MODEL_DRILL_SURVEY,
2886
+ Ur as BASELODE_DATA_MODEL_STRUCTURAL_POINT,
2887
+ Lo as Baselode3DControls,
2888
+ Co as Baselode3DScene,
2889
+ Oo as BlockModelWidget,
2890
+ Ze as CHART_OPTIONS,
2891
+ sn as COMMENT_COLUMN_NAMES,
2892
+ mt as CRS,
2893
+ Zt as DEFAULT_COLUMN_MAP,
2791
2894
  Y as DEPTH,
2792
- B as DIP,
2793
- Me as DISPLAY_CATEGORICAL,
2794
- _e as DISPLAY_COMMENT,
2795
- ve as DISPLAY_HIDDEN,
2796
- xe as DISPLAY_NUMERIC,
2797
- we as DISPLAY_TADPOLE,
2895
+ G as DIP,
2896
+ Ae as DISPLAY_CATEGORICAL,
2897
+ Ne as DISPLAY_COMMENT,
2898
+ Pe as DISPLAY_HIDDEN,
2899
+ ze as DISPLAY_NUMERIC,
2900
+ He as DISPLAY_TADPOLE,
2798
2901
  ce as EASTING,
2799
- ge as ELEVATION,
2800
- xn as ERROR_COLOR,
2801
- Kn as FOV_MAX_DEG,
2802
- Wn as FOV_MIN_DEG,
2803
- X as FROM,
2804
- Ze as HIDDEN_COLUMNS,
2805
- E as HOLE_ID,
2902
+ _e as ELEVATION,
2903
+ Dn as ERROR_COLOR,
2904
+ cr as FOV_MAX_DEG,
2905
+ ar as FOV_MIN_DEG,
2906
+ q as FROM,
2907
+ Ke as HIDDEN_COLUMNS,
2908
+ v as HOLE_ID,
2806
2909
  te as LATITUDE,
2807
2910
  ne as LONGITUDE,
2808
- Re as MID,
2911
+ je as MID,
2809
2912
  ue as NORTHING,
2810
- Qe as NUMERIC_LINE_COLOR,
2811
- _n as NUMERIC_MARKER_COLOR,
2812
- se as PROJECT_ID,
2813
- $t as STRIKE,
2814
- G as TO,
2815
- Wr as TracePlot,
2816
- yn as alphaBetaToNormal,
2817
- no as annotationsFromIntervals,
2818
- $r as assembleDataset,
2819
- Pr as attachAssayPositions,
2820
- Dr as balancedTangentialDesurvey,
2821
- Qt as buildAssayState,
2822
- Sn as buildCommentsConfig,
2823
- Tn as buildEqualRangeColorScale,
2824
- Mn as buildIntervalPoints,
2825
- An as buildPlotConfig,
2826
- Zr as buildStrikeDipSymbol,
2827
- jn as buildStructuralDiscs,
2828
- Xr as buildStructuralStripConfig,
2829
- En as buildTadpoleConfig,
2830
- Sr as buildTraces,
2831
- qe as buildViewSignature,
2832
- Br as calculateBlockVolume,
2833
- cn as calculatePropertyStats,
2834
- Wt as classifyColumns,
2835
- wr as coerceNumeric,
2836
- gn as computeStructuralPositions,
2837
- Cr as defaultChartType,
2838
- Ee as deriveAssayProps,
2839
- vr as desurveyTraces,
2840
- Hn as dipAzimuthToNormal,
2841
- Xn as dolly,
2842
- Gn as emitViewChangeIfNeeded,
2843
- un as filterBlocks,
2844
- Vr as filterByProject,
2845
- Fe as fitCameraToBounds,
2846
- Zn as focusOnLastBounds,
2847
- jr as getBlockStats,
2848
- He as getChartOptions,
2849
- mn as getColorForValue,
2850
- It as getEqualRangeBinIndex,
2851
- On as getEqualRangeColor,
2852
- Et as getViewState,
2853
- fn as groupRowsByHole,
2854
- zn as holeHasData,
2855
- bn as interpolateTrace,
2856
- to as intervalsAsTubes,
2857
- Or as joinAssaysToTraces,
2858
- Ir as loadAssayFile,
2859
- Jt as loadAssayHole,
2860
- Kt as loadAssayMetadata,
2861
- Fr as loadAssays,
2862
- Hr as loadBlockModelMetadata,
2863
- Lr as loadCollars,
2864
- Tr as loadSurveys,
2865
- Be as loadTable,
2866
- xr as logDataInfo,
2867
- _r as logDataWarning,
2868
- Yn as lookDown,
2869
- nn as minimumCurvatureDesurvey,
2870
- an as normalizeBlockRow,
2871
- zr as normalizeCsvRow,
2872
- Ie as normalizeFieldName,
2873
- qn as pan,
2874
- pn as parseAssayCsvTextToHoles,
2875
- Yt as parseAssayHole,
2876
- Nr as parseAssayHoleIds,
2877
- Ut as parseAssayHoleIdsWithAssays,
2878
- qt as parseAssaysCSV,
2879
- Rr as parseBlockModelCSV,
2880
- kr as parseDrillholesCSV,
2881
- hn as parseStructuralCSV,
2882
- Yr as parseStructuralIntervalsCSV,
2883
- Ur as parseStructuralPointsCSV,
2884
- Ar as parseSurveyCSV,
2885
- qr as parseUnifiedDataset,
2886
- Mr as pickFirstPresent,
2887
- Jr as planView,
2888
- Vn as projectTraceToSection,
2889
- Un as recenterCameraToOrigin,
2890
- ht as reorderHoleIds,
2891
- Qr as sectionView,
2892
- wn as sectionWindow,
2893
- Qn as setControlMode,
2894
- Jn as setFov,
2895
- Bn as setViewState,
2913
+ tt as NUMERIC_LINE_COLOR,
2914
+ Pn as NUMERIC_MARKER_COLOR,
2915
+ ie as PROJECT_ID,
2916
+ Wt as STRIKE,
2917
+ U as TO,
2918
+ Ao as TracePlot,
2919
+ vn as alphaBetaToNormal,
2920
+ ko as annotationsFromIntervals,
2921
+ ho as assembleDataset,
2922
+ io as attachAssayPositions,
2923
+ ro as balancedTangentialDesurvey,
2924
+ un as buildAssayState,
2925
+ $n as buildCommentsConfig,
2926
+ Gn as buildEqualRangeColorScale,
2927
+ Ln as buildIntervalPoints,
2928
+ Fn as buildPlotConfig,
2929
+ Io as buildStrikeDipSymbol,
2930
+ Jn as buildStructuralDiscs,
2931
+ xo as buildStructuralStripConfig,
2932
+ wn as buildTadpoleConfig,
2933
+ oo as buildTraces,
2934
+ Xe as buildViewSignature,
2935
+ go as calculateBlockVolume,
2936
+ _n as calculatePropertyStats,
2937
+ ln as classifyColumns,
2938
+ fo as coerceNumeric,
2939
+ Sn as computeStructuralPositions,
2940
+ Jr as defaultChartType,
2941
+ De as deriveAssayProps,
2942
+ to as desurveyTraces,
2943
+ Kn as dipAzimuthToNormal,
2944
+ sr as dolly,
2945
+ nr as emitViewChangeIfNeeded,
2946
+ Nn as filterBlocks,
2947
+ mo as filterByProject,
2948
+ We as fitCameraToBounds,
2949
+ lr as focusOnLastBounds,
2950
+ yo as getBlockStats,
2951
+ Re as getChartOptions,
2952
+ zn as getColorForValue,
2953
+ Pt as getEqualRangeBinIndex,
2954
+ Yn as getEqualRangeColor,
2955
+ Lt as getViewState,
2956
+ xn as groupRowsByHole,
2957
+ Cn as holeHasData,
2958
+ En as interpolateTrace,
2959
+ Do as intervalsAsTubes,
2960
+ uo as joinAssaysToTraces,
2961
+ Qr as loadAssayFile,
2962
+ cn as loadAssayHole,
2963
+ an as loadAssayMetadata,
2964
+ co as loadAssays,
2965
+ bo as loadBlockModelMetadata,
2966
+ lo as loadCollars,
2967
+ ao as loadSurveys,
2968
+ Ge as loadTable,
2969
+ Xr as logDataInfo,
2970
+ qr as logDataWarning,
2971
+ or as lookDown,
2972
+ fn as minimumCurvatureDesurvey,
2973
+ gn as normalizeBlockRow,
2974
+ Zr as normalizeCsvRow,
2975
+ ve as normalizeFieldName,
2976
+ ir as pan,
2977
+ An as parseAssayCsvTextToHoles,
2978
+ nn as parseAssayHole,
2979
+ Wr as parseAssayHoleIds,
2980
+ tn as parseAssayHoleIdsWithAssays,
2981
+ rn as parseAssaysCSV,
2982
+ po as parseBlockModelCSV,
2983
+ so as parseDrillholesCSV,
2984
+ In as parseStructuralCSV,
2985
+ zo as parseStructuralIntervalsCSV,
2986
+ No as parseStructuralPointsCSV,
2987
+ eo as parseSurveyCSV,
2988
+ Mo as parseUnifiedDataset,
2989
+ Kr as pickFirstPresent,
2990
+ vo as planView,
2991
+ qn as projectTraceToSection,
2992
+ rr as recenterCameraToOrigin,
2993
+ gt as reorderHoleIds,
2994
+ So as sectionView,
2995
+ Xn as sectionWindow,
2996
+ dr as setControlMode,
2997
+ ur as setFov,
2998
+ tr as setViewState,
2896
2999
  pe as standardizeColumns,
2897
- gr as standardizeRowArray,
2898
- Er as tangentialDesurvey,
2899
- jt as toError,
2900
- eo as tracesAsSegments,
2901
- Kr as useDrillholeTraceGrid,
2902
- Gr as validateStructuralPoints,
3000
+ Yr as standardizeRowArray,
3001
+ no as tangentialDesurvey,
3002
+ Jt as toError,
3003
+ Po as tracesAsSegments,
3004
+ Eo as useDrillholeTraceGrid,
3005
+ _o as validateStructuralPoints,
2903
3006
  w as withDataErrorContext
2904
3007
  };
2905
3008
  //# sourceMappingURL=baselode.js.map