baselode 0.1.5 → 0.1.7

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