gl-draw 0.17.0-beta.35 → 0.17.0-beta.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,56 +1,56 @@
1
- var Oe = Object.defineProperty, De = Object.defineProperties;
2
- var Te = Object.getOwnPropertyDescriptors;
3
- var W = Object.getOwnPropertySymbols;
4
- var se = Object.prototype.hasOwnProperty, re = Object.prototype.propertyIsEnumerable;
5
- var ne = Math.pow, ie = (n, e, t) => e in n ? Oe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, z = (n, e) => {
1
+ var _e = Object.defineProperty, Ne = Object.defineProperties;
2
+ var Re = Object.getOwnPropertyDescriptors;
3
+ var _ = Object.getOwnPropertySymbols;
4
+ var oe = Object.prototype.hasOwnProperty, ae = Object.prototype.propertyIsEnumerable;
5
+ var ce = Math.pow, re = (r, e, t) => e in r ? _e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, k = (r, e) => {
6
6
  for (var t in e || (e = {}))
7
- se.call(e, t) && ie(n, t, e[t]);
8
- if (W)
9
- for (var t of W(e))
10
- re.call(e, t) && ie(n, t, e[t]);
11
- return n;
12
- }, q = (n, e) => De(n, Te(e));
13
- var oe = (n, e) => {
7
+ oe.call(e, t) && re(r, t, e[t]);
8
+ if (_)
9
+ for (var t of _(e))
10
+ ae.call(e, t) && re(r, t, e[t]);
11
+ return r;
12
+ }, X = (r, e) => Ne(r, Re(e));
13
+ var le = (r, e) => {
14
14
  var t = {};
15
- for (var i in n)
16
- se.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]);
17
- if (n != null && W)
18
- for (var i of W(n))
19
- e.indexOf(i) < 0 && re.call(n, i) && (t[i] = n[i]);
15
+ for (var i in r)
16
+ oe.call(r, i) && e.indexOf(i) < 0 && (t[i] = r[i]);
17
+ if (r != null && _)
18
+ for (var i of _(r))
19
+ e.indexOf(i) < 0 && ae.call(r, i) && (t[i] = r[i]);
20
20
  return t;
21
21
  };
22
- var ae = (n, e, t) => new Promise((i, s) => {
22
+ var ue = (r, e, t) => new Promise((i, s) => {
23
23
  var o = (a) => {
24
24
  try {
25
- r(t.next(a));
26
- } catch (l) {
27
- s(l);
25
+ n(t.next(a));
26
+ } catch (h) {
27
+ s(h);
28
28
  }
29
29
  }, c = (a) => {
30
30
  try {
31
- r(t.throw(a));
32
- } catch (l) {
33
- s(l);
31
+ n(t.throw(a));
32
+ } catch (h) {
33
+ s(h);
34
34
  }
35
- }, r = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(o, c);
36
- r((t = t.apply(n, e)).next());
35
+ }, n = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(o, c);
36
+ n((t = t.apply(r, e)).next());
37
37
  });
38
- import { merge as H, mean as Ee, extent as ce } from "d3-array";
39
- import Le, { flatten as Ce } from "earcut";
40
- import { Material as le, Object3D as R, Texture as ue, BufferGeometry as ee, Float32BufferAttribute as G, PointsMaterial as ke, Points as te, InstancedMesh as Ae, Vector3 as S, Quaternion as ze, Group as Ve, Mesh as Pe, Sprite as de, Box3 as Ie, ShaderMaterial as Ne, Vector2 as K, Color as he, Vector4 as V, Matrix4 as We, Line3 as _e, Sphere as Ue, InstancedInterleavedBuffer as Re, InterleavedBufferAttribute as fe, MathUtils as Ge } from "three";
41
- import $e from "@turf/boolean-clockwise";
42
- import { p as pe, a as Fe } from "./polar2Cartesian.module.js";
43
- import qe from "delaunator";
44
- import Ke from "@turf/boolean-point-in-polygon";
45
- import { geoBounds as Be, geoContains as Qe, geoDistance as Xe, geoInterpolate as Ye } from "d3-geo";
46
- import { geoVoronoi as Ze } from "d3-geo-voronoi";
47
- import { scaleLinear as me } from "d3-scale";
48
- import { LineSegmentsGeometry as Je } from "three/examples/jsm/lines/LineSegmentsGeometry";
49
- import { CSS2DObject as He } from "three/examples/jsm/renderers/CSS2DRenderer";
50
- import { CSS3DObject as et, CSS3DSprite as tt } from "three/examples/jsm/renderers/CSS3DRenderer";
38
+ import { merge as ie, mean as Ue, extent as he } from "d3-array";
39
+ import Ge, { flatten as Oe } from "earcut";
40
+ import { Material as de, Object3D as G, Texture as fe, Vector3 as S, Matrix4 as De, Ray as $e, Sphere as ze, BufferGeometry as se, Float32BufferAttribute as $, PointsMaterial as Fe, Points as ne, InstancedMesh as Ee, Quaternion as qe, Group as Xe, Mesh as Le, Sprite as pe, Box3 as ke, ShaderMaterial as Ke, Vector2 as K, Color as me, Vector4 as V, Line3 as Qe, InstancedInterleavedBuffer as Ye, InterleavedBufferAttribute as ve, MathUtils as Ze } from "three";
41
+ import Je from "@turf/boolean-clockwise";
42
+ import { p as be, W as Q, c as ye } from "./cartographicToCartesian.module.js";
43
+ import He from "delaunator";
44
+ import et from "@turf/boolean-point-in-polygon";
45
+ import { geoBounds as Ve, geoContains as tt, geoDistance as it, geoInterpolate as st } from "d3-geo";
46
+ import { geoVoronoi as nt } from "d3-geo-voronoi";
47
+ import { scaleLinear as ge } from "d3-scale";
48
+ import { LineSegmentsGeometry as rt } from "three/examples/jsm/lines/LineSegmentsGeometry";
49
+ import { CSS2DObject as ot } from "three/examples/jsm/renderers/CSS2DRenderer";
50
+ import { CSS3DObject as at, CSS3DSprite as ct } from "three/examples/jsm/renderers/CSS3DRenderer";
51
51
  import "d3-geo-projection";
52
- const ve = 0, be = 1, Tt = !1;
53
- class it {
52
+ const Me = 0, xe = 1, Nt = !1;
53
+ class lt {
54
54
  constructor() {
55
55
  this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
56
56
  }
@@ -59,24 +59,24 @@ class it {
59
59
  return e;
60
60
  if (Array.isArray(e))
61
61
  return e.forEach((t) => this.track(t)), e;
62
- if (!this.disposeMaterial && e instanceof le)
62
+ if (!this.disposeMaterial && e instanceof de)
63
63
  return e;
64
- if (e instanceof Z ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof R || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof Z)
64
+ if (e instanceof ee ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof G || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof ee)
65
65
  e.children.forEach((t) => {
66
66
  t.disposeTrack = !1;
67
67
  }), this.track(e.children);
68
- else if (e instanceof R) {
68
+ else if (e instanceof G) {
69
69
  const t = e;
70
70
  this.track(t.geometry), this.track(t.material), this.track(t.children);
71
- } else if (e instanceof le) {
71
+ } else if (e instanceof de) {
72
72
  for (const i of Object.values(e))
73
- i instanceof ue && this.track(i);
73
+ i instanceof fe && this.track(i);
74
74
  const t = e;
75
75
  if (t.uniforms) {
76
76
  for (const i of Object.values(t.uniforms))
77
77
  if (i) {
78
78
  const s = i.value;
79
- (s instanceof ue || Array.isArray(s)) && this.track(s);
79
+ (s instanceof fe || Array.isArray(s)) && this.track(s);
80
80
  }
81
81
  }
82
82
  } else this.disposeVideo && e.isVideoTexture && e.source.data && this.resources.add(e.source.data);
@@ -85,22 +85,78 @@ class it {
85
85
  dispose() {
86
86
  const e = [];
87
87
  for (const t of this.resources)
88
- t instanceof R ? e.push(t) : t instanceof HTMLVideoElement && t.pause(), Reflect.has(t, "dispose") && t.dispose();
88
+ t instanceof G ? e.push(t) : t instanceof HTMLVideoElement && t.pause(), Reflect.has(t, "dispose") && t.dispose();
89
89
  e.forEach((t) => {
90
90
  t.removeFromParent();
91
91
  }), e.length = 0, this.resources.clear();
92
92
  }
93
93
  }
94
- const st = (n, e = 1) => {
95
- const t = new ee();
94
+ const we = /* @__PURE__ */ new De(), We = /* @__PURE__ */ new $e(), Y = /* @__PURE__ */ new ze(), N = /* @__PURE__ */ new S();
95
+ function ut(r, e) {
96
+ const t = this.geometry, i = this.matrixWorld, s = r.params.Points.threshold, o = t.drawRange;
97
+ t.boundingSphere === null && t.computeBoundingSphere(), Y.copy(t.boundingSphere), Y.applyMatrix4(i), Y.radius += s, we.copy(i).invert(), We.copy(r.ray).applyMatrix4(we);
98
+ const c = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), n = t.index, h = t.attributes.position;
99
+ if (n !== null) {
100
+ const d = Math.max(0, o.start), u = Math.min(n.count, o.start + o.count);
101
+ for (let f = d, l = u; f < l; f++) {
102
+ const p = n.getX(f);
103
+ N.fromBufferAttribute(h, p), Se(
104
+ N,
105
+ p,
106
+ c,
107
+ i,
108
+ r,
109
+ e,
110
+ this
111
+ );
112
+ }
113
+ } else {
114
+ const d = Math.max(0, o.start), u = Math.min(
115
+ h.count,
116
+ o.start + o.count
117
+ );
118
+ for (let f = d, l = u; f < l; f++)
119
+ N.fromBufferAttribute(h, f), Se(
120
+ N,
121
+ f,
122
+ c,
123
+ i,
124
+ r,
125
+ e,
126
+ this
127
+ );
128
+ }
129
+ }
130
+ function Se(r, e, t, i, s, o, c) {
131
+ const n = new S();
132
+ We.closestPointToPoint(r, n), n.applyMatrix4(i);
133
+ const a = s.ray.origin.distanceTo(r), h = n.distanceTo(r), d = Math.asin(
134
+ h / a
135
+ );
136
+ if (d < t) {
137
+ if (a < s.near || a > s.far)
138
+ return;
139
+ o.push({
140
+ distance: a,
141
+ distanceToRay: h,
142
+ angleToRay: d,
143
+ point: n,
144
+ index: e,
145
+ face: null,
146
+ object: c
147
+ });
148
+ }
149
+ }
150
+ const ht = (r, e = 1) => {
151
+ const t = new se();
96
152
  t.setAttribute(
97
153
  "position",
98
- new G(new Array(e * 3).fill(0), 3)
154
+ new $(new Array(e * 3).fill(0), 3)
99
155
  ), t.setAttribute(
100
156
  "scaleAtt",
101
- new G(new Array(e).fill(1), 1)
157
+ new $(new Array(e).fill(1), 1)
102
158
  );
103
- const i = n.material, s = new ke({
159
+ const i = r.material, s = new Fe({
104
160
  size: 10,
105
161
  map: i.map,
106
162
  alphaMap: i.alphaMap,
@@ -113,30 +169,32 @@ const st = (n, e = 1) => {
113
169
  alphaTest: i.alphaTest,
114
170
  sizeAttenuation: !1
115
171
  });
116
- return s.onBeforeCompile = (o) => {
117
- o.vertexShader = `
172
+ s.onBeforeCompile = (c) => {
173
+ c.vertexShader = `
118
174
  attribute float scaleAtt;
119
- ${o.vertexShader.replace(
175
+ ${c.vertexShader.replace(
120
176
  "gl_PointSize = size;",
121
177
  "gl_PointSize = size * scaleAtt;"
122
178
  )}
123
179
  `;
124
- }, new te(t, s);
125
- }, rt = (n, e) => {
126
- const t = new R();
180
+ };
181
+ const o = new ne(t, s);
182
+ return o.raycast = ut, o;
183
+ }, dt = (r, e) => {
184
+ const t = new G();
127
185
  e.forEach((i, s) => {
128
- const o = pe(i.position), c = pe(i.scale || [1, 1, 1]);
186
+ const o = be(i.position), c = be(i.scale || [1, 1, 1]);
129
187
  t.position.copy(o), t.scale.copy(c), t.updateMatrix();
130
- const r = t.matrix.clone();
131
- if (n instanceof Ae || n.isInstantiate)
132
- n.setMatrixAt(s, r);
133
- else if (n instanceof te || n.type === "Points") {
134
- const l = n.geometry, m = l.attributes.position.array, u = l.attributes.scaleAtt.array, f = new S(), d = new S(), p = new ze(), h = s * 3, v = s * 1;
135
- r.decompose(f, p, d), m[h] = f.x, m[h + 1] = f.y, m[h + 2] = f.z, u[v] = Math.max(d.x, d.y, d.z), l.attributes.position.needsUpdate = !0, l.attributes.scaleAtt.needsUpdate = !0;
188
+ const n = t.matrix.clone();
189
+ if (r instanceof Ee || r.isInstantiate)
190
+ r.setMatrixAt(s, n);
191
+ else if (r instanceof ne || r.type === "Points") {
192
+ const h = r.geometry, d = h.attributes.position.array, u = h.attributes.scaleAtt.array, f = new S(), l = new S(), p = new qe(), m = s * 3, b = s * 1;
193
+ n.decompose(f, p, l), d[m] = f.x, d[m + 1] = f.y, d[m + 2] = f.z, u[b] = Math.max(l.x, l.y, l.z), h.attributes.position.needsUpdate = !0, h.attributes.scaleAtt.needsUpdate = !0;
136
194
  }
137
195
  });
138
196
  };
139
- class nt {
197
+ class ft {
140
198
  constructor() {
141
199
  this.onPointerIndex = [];
142
200
  }
@@ -168,7 +226,7 @@ class nt {
168
226
  });
169
227
  }
170
228
  }
171
- class ot extends nt {
229
+ class pt extends ft {
172
230
  constructor() {
173
231
  super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
174
232
  }
@@ -226,7 +284,7 @@ class ot extends nt {
226
284
  );
227
285
  }
228
286
  }
229
- class Z extends ot {
287
+ class ee extends pt {
230
288
  constructor() {
231
289
  super(...arguments), this.key = "", this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0, this.isDispose = !1;
232
290
  }
@@ -294,7 +352,7 @@ class Z extends ot {
294
352
  */
295
353
  _disableLayersRecursive() {
296
354
  var e;
297
- (e = this.object3d) == null || e.layers.disable(ve), this.children.forEach((t) => {
355
+ (e = this.object3d) == null || e.layers.disable(Me), this.children.forEach((t) => {
298
356
  t._disableLayersRecursive();
299
357
  });
300
358
  }
@@ -303,30 +361,30 @@ class Z extends ot {
303
361
  */
304
362
  _enableLayersRecursive() {
305
363
  var e;
306
- this.object3d.visible && ((e = this.object3d) == null || e.layers.enable(ve), this.children.forEach((t) => {
364
+ this.object3d.visible && ((e = this.object3d) == null || e.layers.enable(Me), this.children.forEach((t) => {
307
365
  t._enableLayersRecursive();
308
366
  }));
309
367
  }
310
368
  createGroup() {
311
- return this.object3d = new Ve(), this;
369
+ return this.object3d = new Xe(), this;
312
370
  }
313
371
  createMesh(...e) {
314
- return this.object3d = new Pe(...e), this;
372
+ return this.object3d = new Le(...e), this;
315
373
  }
316
374
  createPoints(...e) {
317
- return this.object3d = new te(...e), this;
375
+ return this.object3d = new ne(...e), this;
318
376
  }
319
377
  createCSS2DObject(e) {
320
- return this.object3d = new He(e), this;
378
+ return this.object3d = new ot(e), this;
321
379
  }
322
380
  createCSS3DObject(e) {
323
- return this.object3d = new et(e), this;
381
+ return this.object3d = new at(e), this;
324
382
  }
325
383
  createCSS3DSprite(e) {
326
- return this.object3d = new tt(e), this;
384
+ return this.object3d = new ct(e), this;
327
385
  }
328
386
  createSprite(e) {
329
- return this.object3d = new de(e), this;
387
+ return this.object3d = new pe(e), this;
330
388
  }
331
389
  attach(...e) {
332
390
  return [...e].forEach((t) => {
@@ -334,7 +392,7 @@ class Z extends ot {
334
392
  }), this;
335
393
  }
336
394
  getSize() {
337
- const e = new Ie().setFromObject(this.object3d);
395
+ const e = new ke().setFromObject(this.object3d);
338
396
  return {
339
397
  min: e.min,
340
398
  max: e.max,
@@ -351,49 +409,49 @@ class Z extends ot {
351
409
  });
352
410
  }
353
411
  instantiate(e) {
354
- return ae(this, null, function* () {
355
- var l, m;
356
- const t = (l = e == null ? void 0 : e.recursive) != null ? l : !0, i = (m = e == null ? void 0 : e.cloneMaterial) != null ? m : !1, { objectType: s, objectOptions: o } = this;
357
- let c = e == null ? void 0 : e.create, r, a = (e == null ? void 0 : e.target) || this.parent;
358
- return a === this.lead.prefabGroup && (a = this.lead.group), this.objectType === "BaseObject" ? r = this.lead.createBaseObject(this.object3d.clone(!1), {
412
+ return ue(this, null, function* () {
413
+ var h, d;
414
+ const t = (h = e == null ? void 0 : e.recursive) != null ? h : !0, i = (d = e == null ? void 0 : e.cloneMaterial) != null ? d : !1, { objectType: s, objectOptions: o } = this;
415
+ let c = e == null ? void 0 : e.create, n, a = (e == null ? void 0 : e.target) || this.parent;
416
+ return a === this.lead.prefabGroup && (a = this.lead.group), this.objectType === "BaseObject" ? n = this.lead.createBaseObject(this.object3d.clone(!1), {
359
417
  target: a
360
418
  }) : (c === void 0 && (c = (u) => {
361
419
  var f;
362
420
  if (this.object3d) {
363
421
  if ((f = e == null ? void 0 : e.instancedAttr) != null && f.length) {
364
- const d = e.instancedAttr.length;
365
- if (this.object3d instanceof de)
366
- u.object3d = st(this.object3d, d);
422
+ const l = e.instancedAttr.length;
423
+ if (this.object3d instanceof pe)
424
+ u.object3d = ht(this.object3d, l);
367
425
  else {
368
- const p = this.object3d, h = i ? this.cloneMaterial() : p.material;
369
- u.object3d = new Ae(
426
+ const p = this.object3d, m = i ? this.cloneMaterial() : p.material;
427
+ u.object3d = new Ee(
370
428
  p.geometry,
371
- h,
372
- d
429
+ m,
430
+ l
373
431
  );
374
432
  }
375
- rt(u.object3d, e == null ? void 0 : e.instancedAttr);
433
+ dt(u.object3d, e == null ? void 0 : e.instancedAttr);
376
434
  } else
377
435
  u.object3d = this.object3d.clone(!1), i && u.object3d.material && (u.object3d.material = this.cloneMaterial());
378
436
  u.object3d.userData.prefab && delete u.object3d.userData.prefab;
379
437
  }
380
- }), r = yield this.lead.draw(s, q(z({}, o || {}), {
438
+ }), n = yield this.lead.draw(s, X(k({}, o || {}), {
381
439
  create: c,
382
440
  prefab: !1,
383
441
  keyType: this.keyType,
384
442
  key: (e == null ? void 0 : e.key) || this.keyName,
385
443
  uId: (e == null ? void 0 : e.uId) || this.keyUId,
386
444
  target: a
387
- }))), this.isBloom && r.enableBloom(), t && (yield Promise.all(
445
+ }))), this.isBloom && n.enableBloom(), t && (yield Promise.all(
388
446
  this.children.map(
389
447
  (u) => u.instantiate({
390
448
  key: u.keyUId && u.keyName ? `${u.keyName}-${u.keyUId}` : u.keyName,
391
449
  uId: e == null ? void 0 : e.uId,
392
450
  cloneMaterial: i,
393
- target: r
451
+ target: n
394
452
  })
395
453
  )
396
- )), r.isInstantiate = !0, r;
454
+ )), n.isInstantiate = !0, n;
397
455
  });
398
456
  }
399
457
  erase() {
@@ -413,7 +471,7 @@ class Z extends ot {
413
471
  });
414
472
  return;
415
473
  }
416
- this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(be)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !0;
474
+ this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(xe)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !0;
417
475
  }
418
476
  disableBloom(e = !0) {
419
477
  var t, i, s;
@@ -427,230 +485,237 @@ class Z extends ot {
427
485
  });
428
486
  return;
429
487
  }
430
- this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(be)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !1;
488
+ this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(xe)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !1;
431
489
  }
432
490
  dispose() {
433
491
  var e, t;
434
492
  if (!this.isDispose && (this.isDispose = !0, super.dispose(), this.isBloom && (this.disableBloom(!1), (e = this.pencil.composerController) == null || e.checkBloomComposerActive()), (t = this.lead) == null || t.disableCursor(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack)) {
435
- const i = new it();
493
+ const i = new lt();
436
494
  i.disposeMaterial = !1, i.track(this), i.dispose();
437
495
  }
438
496
  }
439
497
  }
440
- function at(n, e) {
441
- return n.map((t) => {
498
+ function mt(r, e) {
499
+ return r.map((t) => {
442
500
  const i = [];
443
501
  let s;
444
502
  return t.forEach((o) => {
445
503
  if (s) {
446
- const c = Xe(o, s) * 180 / Math.PI;
504
+ const c = it(o, s) * 180 / Math.PI;
447
505
  if (c > e) {
448
- const r = Ye(s, o), a = 1 / Math.ceil(c / e);
449
- let l = a;
450
- for (; l < 1; )
451
- i.push(r(l)), l += a;
506
+ const n = st(s, o), a = 1 / Math.ceil(c / e);
507
+ let h = a;
508
+ for (; h < 1; )
509
+ i.push(n(h)), h += a;
452
510
  }
453
511
  }
454
512
  i.push(s = o);
455
513
  }), i;
456
514
  });
457
515
  }
458
- function ct(n, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
459
- const o = Math.round(ne(360 / n, 2) / Math.PI), c = (1 + Math.sqrt(5)) / 2, r = (d) => d / c * 360 % 360 - 180, a = (d) => Math.acos(2 * d / o - 1) / Math.PI * 180 - 90, l = (d) => o * (Math.cos((d + 90) * Math.PI / 180) + 1) / 2, m = [
460
- s !== void 0 ? Math.ceil(l(s)) : 0,
461
- i !== void 0 ? Math.floor(l(i)) : o - 1
462
- ], u = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (d) => d <= t : t === void 0 ? (d) => d >= e : t >= e ? (d) => d >= e && d <= t : (d) => d >= e || d <= t, f = [];
463
- for (let d = m[0]; d <= m[1]; d++) {
464
- const p = r(d);
465
- u(p) && f.push([p, a(d)]);
516
+ function vt(r, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
517
+ const o = Math.round(ce(360 / r, 2) / Math.PI), c = (1 + Math.sqrt(5)) / 2, n = (l) => l / c * 360 % 360 - 180, a = (l) => Math.acos(2 * l / o - 1) / Math.PI * 180 - 90, h = (l) => o * (Math.cos((l + 90) * Math.PI / 180) + 1) / 2, d = [
518
+ s !== void 0 ? Math.ceil(h(s)) : 0,
519
+ i !== void 0 ? Math.floor(h(i)) : o - 1
520
+ ], u = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (l) => l <= t : t === void 0 ? (l) => l >= e : t >= e ? (l) => l >= e && l <= t : (l) => l >= e || l <= t, f = [];
521
+ for (let l = d[0]; l <= d[1]; l++) {
522
+ const p = n(l);
523
+ u(p) && f.push([p, a(l)]);
466
524
  }
467
525
  return f;
468
526
  }
469
- function J(n, e, t = !1) {
470
- return t ? Qe(e, n) : Ke(n, e);
527
+ function te(r, e, t = !1) {
528
+ return t ? tt(e, r) : et(r, e);
471
529
  }
472
- function lt(n, e) {
473
- const t = { type: "Polygon", coordinates: n }, [[i, s], [o, c]] = Be(t);
530
+ function bt(r, e) {
531
+ const t = { type: "Polygon", coordinates: r }, [[i, s], [o, c]] = Ve(t);
474
532
  if (Math.min(Math.abs(o - i), Math.abs(c - s)) < e)
475
533
  return [];
476
- const r = i > o || c >= 89 || s <= -89;
477
- return ct(e, {
534
+ const n = i > o || c >= 89 || s <= -89;
535
+ return vt(e, {
478
536
  minLng: i,
479
537
  maxLng: o,
480
538
  minLat: s,
481
539
  maxLat: c
482
540
  }).filter(
483
- (a) => J(a, t, r)
541
+ (a) => te(a, t, n)
484
542
  );
485
543
  }
486
- function ut(n, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
487
- const s = at(n, e), o = H(s), c = lt(n, e), r = [...o, ...c], a = { type: "Polygon", coordinates: n }, [[l, m], [u, f]] = Be(a), d = l > u || // crosses antimeridian
544
+ function yt(r, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
545
+ const s = mt(r, e), o = ie(s), c = bt(r, e), n = [...o, ...c], a = { type: "Polygon", coordinates: r }, [[h, d], [u, f]] = Ve(a), l = h > u || // crosses antimeridian
488
546
  f >= 89 || // crosses north pole
489
- m <= -89;
547
+ d <= -89;
490
548
  let p = [];
491
- if (d) {
492
- const y = Ze(r).triangles(), x = new Map(
493
- r.map(([P, I], L) => [`${P}-${I}`, L])
549
+ if (l) {
550
+ const y = nt(n).triangles(), w = new Map(
551
+ n.map(([I, T], E) => [`${I}-${T}`, E])
494
552
  );
495
- y.features.forEach((P) => {
496
- const I = P.geometry.coordinates[0].slice(0, 3).reverse(), L = [];
497
- if (I.forEach(([B, F]) => {
498
- const N = `${B}-${F}`;
499
- x.has(N) && L.push(x.get(N));
500
- }), L.length === 3) {
501
- if (L.some((B) => B < o.length)) {
502
- const B = P.properties.circumcenter;
503
- if (!J(
504
- B,
553
+ y.features.forEach((I) => {
554
+ const T = I.geometry.coordinates[0].slice(0, 3).reverse(), E = [];
555
+ if (T.forEach(([A, q]) => {
556
+ const W = `${A}-${q}`;
557
+ w.has(W) && E.push(w.get(W));
558
+ }), E.length === 3) {
559
+ if (E.some((A) => A < o.length)) {
560
+ const A = I.properties.circumcenter;
561
+ if (!te(
562
+ A,
505
563
  a,
506
- d
564
+ l
507
565
  ))
508
566
  return;
509
567
  }
510
- p.push(...L);
568
+ p.push(...E);
511
569
  }
512
570
  });
513
571
  } else if (c.length) {
514
- const y = qe.from(r);
515
- for (let x = 0, P = y.triangles.length; x < P; x += 3) {
516
- const I = [2, 1, 0].map((B) => y.triangles[x + B]), L = I.map((B) => r[B]);
517
- if (I.some((B) => B < o.length)) {
518
- const B = [0, 1].map(
519
- (F) => Ee(L, (N) => N[F])
572
+ const y = He.from(n);
573
+ for (let w = 0, I = y.triangles.length; w < I; w += 3) {
574
+ const T = [2, 1, 0].map((A) => y.triangles[w + A]), E = T.map((A) => n[A]);
575
+ if (T.some((A) => A < o.length)) {
576
+ const A = [0, 1].map(
577
+ (q) => Ue(E, (W) => W[q])
520
578
  );
521
- if (!J(
522
- B,
579
+ if (!te(
580
+ A,
523
581
  a,
524
- d
582
+ l
525
583
  ))
526
584
  continue;
527
585
  }
528
- p.push(...I);
586
+ p.push(...T);
529
587
  }
530
588
  } else {
531
- const { vertices: y, holes: x = [] } = Ce(s);
532
- p = Le(y, x, 2);
589
+ const { vertices: y, holes: w = [] } = Oe(s);
590
+ p = Ge(y, w, 2);
533
591
  }
534
- let h = t ? [t[0], t[2]] : ce(r, (y) => y[0]), v = t ? [t[1], t[3]] : ce(r, (y) => y[1]);
592
+ let m = t ? [t[0], t[2]] : he(n, (y) => y[0]), b = t ? [t[1], t[3]] : he(n, (y) => y[1]);
535
593
  if (i) {
536
- const [y, x] = i([h[0], v[0]]), [P, I] = i([h[1], v[1]]);
537
- h = [y, P], v = [-x, -I];
594
+ const [y, w] = i([m[0], b[0]]), [I, T] = i([m[1], b[1]]);
595
+ m = [y, I], b = [-w, -T];
538
596
  }
539
- const j = me(h, [0, 1]), C = me(v, [0, 1]), O = r.map(([y, x]) => {
597
+ const j = ge(m, [0, 1]), z = ge(b, [0, 1]), C = n.map(([y, w]) => {
540
598
  if (i) {
541
- const [P, I] = i([y, x]);
542
- return [j(P), C(-I)];
599
+ const [I, T] = i([y, w]);
600
+ return [j(I), z(-T)];
543
601
  } else
544
- return [j(y), C(x)];
602
+ return [j(y), z(w)];
545
603
  });
546
- return { contour: s, triangles: { points: r, indices: p, uvs: O } };
604
+ return { contour: s, triangles: { points: n, indices: p, uvs: C } };
547
605
  }
548
- const ye = new ee().setAttribute ? "setAttribute" : "addAttribute";
549
- function $(n, e, t, i) {
550
- const s = n.map(
551
- (o) => o.map(([c, r]) => {
552
- if (i) {
553
- const [a, l] = i([c, r]);
554
- return [a, -l, e];
606
+ const je = new se().setAttribute ? "setAttribute" : "addAttribute";
607
+ function F(r, e, t) {
608
+ const i = r.map(
609
+ (s) => s.map(([o, c]) => {
610
+ if (t === "cesium") {
611
+ const n = 1 / Q.a, a = e / n, h = Math.max(0, a - Q.a), d = ye(o, c, h, n, !1);
612
+ return [d.x, d.y, d.z];
613
+ }
614
+ if (t === "sphere") {
615
+ const n = ye(
616
+ o,
617
+ c,
618
+ e - Q.a,
619
+ 1,
620
+ !0
621
+ );
622
+ return [n.x, n.y, n.z];
623
+ }
624
+ if (typeof t == "function") {
625
+ const [n, a] = t([o, c]);
626
+ return [n, -a, e];
555
627
  }
556
- return t ? Fe(c, r, e) : [c, r, e];
628
+ return [o, c, e];
557
629
  })
558
630
  );
559
- return Ce(s);
631
+ return Oe(i);
560
632
  }
561
- function dt(n, e, t, i, s) {
562
- const { vertices: o, holes: c } = $(
563
- n,
633
+ function gt(r, e, t, i) {
634
+ const { vertices: s, holes: o } = F(
635
+ r,
564
636
  e,
565
- i,
566
- s
567
- ), { vertices: r } = $(
568
- n,
637
+ i
638
+ ), { vertices: c } = F(
639
+ r,
569
640
  t,
570
- i,
571
- s
572
- ), a = H([r, o]), l = Math.round(r.length / 3), m = new Set(c);
573
- let u = 0;
574
- const f = [];
575
- for (let p = 0; p < l; p++) {
576
- let h = p + 1;
577
- if (h === l)
578
- h = u;
579
- else if (m.has(h)) {
580
- const v = h;
581
- h = u, u = v;
641
+ i
642
+ ), n = ie([c, s]), a = Math.round(c.length / 3), h = new Set(o);
643
+ let d = 0;
644
+ const u = [];
645
+ for (let l = 0; l < a; l++) {
646
+ let p = l + 1;
647
+ if (p === a)
648
+ p = d;
649
+ else if (h.has(p)) {
650
+ const m = p;
651
+ p = d, d = m;
582
652
  }
583
- f.push(p, p + l, h + l), f.push(h + l, h, p);
653
+ u.push(l, l + a, p + a), u.push(p + a, p, l);
584
654
  }
585
- const d = [];
586
- for (let p = 1; p >= 0; p--)
587
- for (let h = 0; h < l; h += 1) d.push(h / (l - 1), p);
588
- return { indices: f, vertices: a, uvs: d, topVerts: r };
655
+ const f = [];
656
+ for (let l = 1; l >= 0; l--)
657
+ for (let p = 0; p < a; p += 1) f.push(p / (a - 1), l);
658
+ return { indices: u, vertices: n, uvs: f, topVerts: c };
589
659
  }
590
- function ge(n, e, t, i, s, o) {
660
+ function Ce(r, e, t, i, s) {
591
661
  return {
592
- indices: i ? n.indices : n.indices.slice().reverse(),
593
- vertices: $(
594
- [n.points],
662
+ indices: i ? r.indices : r.indices.slice().reverse(),
663
+ vertices: F(
664
+ [r.points],
595
665
  e,
596
- s,
597
- o
666
+ s
598
667
  ).vertices,
599
668
  uvs: t
600
669
  };
601
670
  }
602
- const ht = ({
603
- polygonGeoJson: n,
671
+ const Mt = ({
672
+ polygonGeoJson: r,
604
673
  startHeight: e,
605
674
  endHeight: t,
606
675
  curvatureResolution: i = 1,
607
- cartesian: s = !0,
608
- hasSide: o = !0,
609
- hasBottom: c = !1,
610
- hasTop: r = !1,
611
- projection: a,
612
- bbox: l
676
+ hasSide: s = !0,
677
+ hasBottom: o = !1,
678
+ hasTop: c = !1,
679
+ projection: n = "sphere",
680
+ bbox: a
613
681
  }) => {
614
- n.forEach((j) => {
615
- $e(j) || j.reverse();
682
+ r.forEach((j) => {
683
+ Je(j) || j.reverse();
616
684
  });
617
- const { contour: m, triangles: u } = ut(n, {
685
+ const h = typeof n == "function" ? n : void 0, { contour: d, triangles: u } = yt(r, {
618
686
  resolution: i,
619
- bbox: l,
620
- projection: a
687
+ bbox: a,
688
+ projection: h
621
689
  });
622
- let f = {}, d;
623
- o && (f = dt(
624
- m,
690
+ let f = {}, l;
691
+ s && (f = gt(
692
+ d,
625
693
  e != null ? e : t,
626
694
  t != null ? t : e,
627
- s,
628
- a
629
- ), d = f.topVerts);
695
+ n
696
+ ), l = f.topVerts);
630
697
  let p = [];
631
- (c || r) && (p = H(u.uvs));
632
- let h = {};
633
- c && (h = ge(
698
+ (o || c) && (p = ie(u.uvs));
699
+ let m = {};
700
+ o && (m = Ce(
634
701
  u,
635
702
  e,
636
703
  p,
637
704
  !1,
638
- s,
639
- a
705
+ n
640
706
  ));
641
- let v = {};
642
- return r && (v = ge(
707
+ let b = {};
708
+ return c && (b = Ce(
643
709
  u,
644
710
  t,
645
711
  p,
646
712
  !0,
647
- s,
648
- a
649
- )), { contour: m, triangles: u, sideTorso: f, bottomCap: h, topCap: v, topVerts: d };
713
+ n
714
+ )), { contour: d, triangles: u, sideTorso: f, bottomCap: m, topCap: b, topVerts: l };
650
715
  };
651
- class Et extends ee {
716
+ class Rt extends se {
652
717
  constructor(e, t = {}) {
653
- super(), this.type = "PolygonBufferGeometry", this.parameters = z({
718
+ super(), this.type = "PolygonBufferGeometry", this.parameters = k({
654
719
  polygonGeoJson: e,
655
720
  startHeight: 0,
656
721
  endHeight: 1,
@@ -659,7 +724,7 @@ class Et extends ee {
659
724
  hasBottom: !0,
660
725
  hasSide: !0,
661
726
  curvatureResolution: 1,
662
- cartesian: !0,
727
+ projection: "sphere",
663
728
  userDataRsoOffset: 0
664
729
  }, t);
665
730
  const {
@@ -667,27 +732,25 @@ class Et extends ee {
667
732
  hasTop: s,
668
733
  topFirst: o,
669
734
  hasBottom: c,
670
- hasSide: r,
671
- cartesian: a,
672
- userDataRsoOffset: l,
673
- projection: m
674
- } = this.parameters, { contour: u, sideTorso: f, topVerts: d, bottomCap: p, topCap: h } = ht(z({}, this.parameters));
675
- let v = [], j = [], C = [], O = 0;
676
- const A = (y) => {
677
- const x = Math.round(v.length / 3), P = C.length;
678
- v = v.concat(y.vertices), j = j.concat(y.uvs), C = C.concat(
679
- x ? y.indices.map((I) => I + x) : y.indices
680
- ), this.addGroup(P, C.length - P, O++);
735
+ hasSide: n,
736
+ userDataRsoOffset: a,
737
+ projection: h
738
+ } = this.parameters, { contour: d, sideTorso: u, topVerts: f, bottomCap: l, topCap: p } = Mt(k({}, this.parameters));
739
+ let m = [], b = [], j = [], z = 0;
740
+ const C = (P) => {
741
+ const y = Math.round(m.length / 3), w = j.length;
742
+ m = m.concat(P.vertices), b = b.concat(P.uvs), j = j.concat(
743
+ y ? P.indices.map((I) => I + y) : P.indices
744
+ ), this.addGroup(w, j.length - w, z++);
681
745
  };
682
- s && o && A(h), r && (A(f), this.userData.topVerts = l ? $(
683
- u,
684
- i + l,
685
- a,
686
- m
687
- ).vertices : d), c && A(p), s && !o && A(h), this.setIndex(C), this[ye]("position", new G(v, 3)), this[ye]("uv", new G(j, 2)), this.computeVertexNormals();
746
+ s && o && C(p), n && (C(u), this.userData.topVerts = a ? F(
747
+ d,
748
+ i + a,
749
+ h
750
+ ).vertices : f), c && C(l), s && !o && C(p), this.setIndex(j), this[je]("position", new $(m, 3)), this[je]("uv", new $(b, 2)), this.computeVertexNormals();
688
751
  }
689
752
  }
690
- const ft = `
753
+ const xt = `
691
754
  #include <fog_pars_fragment>
692
755
  #include <logdepthbuf_pars_fragment>
693
756
 
@@ -731,7 +794,7 @@ void main() {
731
794
  #include <tonemapping_fragment>
732
795
  #include <colorspace_fragment>
733
796
  }
734
- `, pt = `
797
+ `, wt = `
735
798
  #include <common>
736
799
  #include <logdepthbuf_pars_vertex>
737
800
  #include <fog_pars_vertex>
@@ -824,25 +887,25 @@ void main() {
824
887
  #include <fog_vertex>
825
888
  }
826
889
  `;
827
- class Lt extends Ne {
890
+ class Ut extends Ke {
828
891
  constructor(e = {}) {
829
- const C = e, {
892
+ const z = e, {
830
893
  lineWidth: t = 1,
831
894
  color: i = "#ffffff",
832
895
  opacity: s = 1,
833
896
  map: o = null,
834
897
  dashOffset: c = 0,
835
- dashArray: r = 0,
898
+ dashArray: n = 0,
836
899
  dashRatio: a = 0,
837
- sizeAttenuation: l = !0,
838
- offsetLoop: m = !0,
900
+ sizeAttenuation: h = !0,
901
+ offsetLoop: d = !0,
839
902
  offset: u = new K(0, 0),
840
903
  scaleDown: f = 0,
841
- alphaMap: d = void 0,
904
+ alphaMap: l = void 0,
842
905
  alphaTest: p = 0,
843
- repeat: h = new K(1, 1),
844
- resolution: v = new K(1, 1)
845
- } = C, j = oe(C, [
906
+ repeat: m = new K(1, 1),
907
+ resolution: b = new K(1, 1)
908
+ } = z, j = le(z, [
846
909
  "lineWidth",
847
910
  "color",
848
911
  "opacity",
@@ -859,29 +922,29 @@ class Lt extends Ne {
859
922
  "repeat",
860
923
  "resolution"
861
924
  ]);
862
- super(q(z({}, j), {
925
+ super(X(k({}, j), {
863
926
  uniforms: {
864
927
  lineWidth: { value: t },
865
- color: { value: new he(i) },
928
+ color: { value: new me(i) },
866
929
  opacity: { value: s },
867
930
  map: { value: o },
868
931
  useMap: { value: o ? 1 : 0 },
869
- resolution: { value: v },
870
- sizeAttenuation: { value: l ? 1 : 0 },
932
+ resolution: { value: b },
933
+ sizeAttenuation: { value: h ? 1 : 0 },
871
934
  offset: { value: u },
872
- offsetLoop: { value: m ? 1 : 0 },
873
- dashArray: { value: r },
935
+ offsetLoop: { value: d ? 1 : 0 },
936
+ dashArray: { value: n },
874
937
  dashOffset: { value: c },
875
938
  dashRatio: { value: a },
876
- useDash: { value: r > 0 ? 1 : 0 },
939
+ useDash: { value: n > 0 ? 1 : 0 },
877
940
  scaleDown: { value: f / 10 },
878
941
  alphaTest: { value: p },
879
- alphaMap: { value: d },
880
- useAlphaMap: { value: d ? 1 : 0 },
881
- repeat: { value: h }
942
+ alphaMap: { value: l },
943
+ useAlphaMap: { value: l ? 1 : 0 },
944
+ repeat: { value: m }
882
945
  },
883
- vertexShader: pt,
884
- fragmentShader: ft
946
+ vertexShader: wt,
947
+ fragmentShader: xt
885
948
  })), this.type = "MeshLineMaterial";
886
949
  }
887
950
  // Getter and setter for color
@@ -889,7 +952,7 @@ class Lt extends Ne {
889
952
  return this.uniforms.color.value;
890
953
  }
891
954
  set color(e) {
892
- this.uniforms.color.value = new he(e);
955
+ this.uniforms.color.value = new me(e);
893
956
  }
894
957
  get opacity() {
895
958
  var e;
@@ -932,53 +995,53 @@ class Lt extends Ne {
932
995
  this.uniforms.sizeAttenuation.value = e ? 1 : 0;
933
996
  }
934
997
  }
935
- const Q = new V(), Me = new S(), we = new S(), g = new V(), M = new V(), D = new V(), X = new S(), Y = new We(), w = new _e(), xe = new S(), _ = new Ie(), U = new Ue(), T = new V();
936
- let E, k;
937
- function Se(n, e, t) {
938
- return T.set(0, 0, -e, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = k / t.width, T.y = k / t.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
998
+ const Z = new V(), Pe = new S(), Ae = new S(), g = new V(), M = new V(), B = new V(), J = new S(), H = new De(), x = new Qe(), Ie = new S(), R = new ke(), U = new ze(), O = new V();
999
+ let D, L;
1000
+ function Te(r, e, t) {
1001
+ return O.set(0, 0, -e, 1).applyMatrix4(r.projectionMatrix), O.multiplyScalar(1 / O.w), O.x = L / t.width, O.y = L / t.height, O.applyMatrix4(r.projectionMatrixInverse), O.multiplyScalar(1 / O.w), Math.abs(Math.max(O.x, O.y));
939
1002
  }
940
- function mt(n, e) {
941
- const t = n.matrixWorld, i = n.geometry, s = i.attributes.instanceStart, o = i.attributes.instanceEnd, c = Math.min(i.instanceCount, s.count);
942
- for (let r = 0, a = c; r < a; r++) {
943
- w.start.fromBufferAttribute(s, r), w.end.fromBufferAttribute(o, r), w.applyMatrix4(t);
944
- const l = new S(), m = new S();
945
- E.distanceSqToSegment(w.start, w.end, m, l), m.distanceTo(l) < k * 0.5 && e.push({
946
- point: m,
947
- pointOnLine: l,
948
- distance: E.origin.distanceTo(m),
949
- object: n,
1003
+ function St(r, e) {
1004
+ const t = r.matrixWorld, i = r.geometry, s = i.attributes.instanceStart, o = i.attributes.instanceEnd, c = Math.min(i.instanceCount, s.count);
1005
+ for (let n = 0, a = c; n < a; n++) {
1006
+ x.start.fromBufferAttribute(s, n), x.end.fromBufferAttribute(o, n), x.applyMatrix4(t);
1007
+ const h = new S(), d = new S();
1008
+ D.distanceSqToSegment(x.start, x.end, d, h), d.distanceTo(h) < L * 0.5 && e.push({
1009
+ point: d,
1010
+ pointOnLine: h,
1011
+ distance: D.origin.distanceTo(d),
1012
+ object: r,
950
1013
  face: null,
951
- faceIndex: r,
1014
+ faceIndex: n,
952
1015
  uv: null,
953
1016
  uv1: null
954
1017
  });
955
1018
  }
956
1019
  }
957
- function vt(n, e, t) {
958
- const i = e.projectionMatrix, o = n.material.resolution, c = n.matrixWorld, r = n.geometry, a = r.attributes.instanceStart, l = r.attributes.instanceEnd, m = Math.min(r.instanceCount, a.count), u = -e.near;
959
- E.at(1, D), D.w = 1, D.applyMatrix4(e.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= o.x / 2, D.y *= o.y / 2, D.z = 0, X.copy(D), Y.multiplyMatrices(e.matrixWorldInverse, c);
960
- for (let f = 0, d = m; f < d; f++) {
961
- if (g.fromBufferAttribute(a, f), M.fromBufferAttribute(l, f), g.w = 1, M.w = 1, g.applyMatrix4(Y), M.applyMatrix4(Y), g.z > u && M.z > u)
1020
+ function jt(r, e, t) {
1021
+ const i = e.projectionMatrix, o = r.material.resolution, c = r.matrixWorld, n = r.geometry, a = n.attributes.instanceStart, h = n.attributes.instanceEnd, d = Math.min(n.instanceCount, a.count), u = -e.near;
1022
+ D.at(1, B), B.w = 1, B.applyMatrix4(e.matrixWorldInverse), B.applyMatrix4(i), B.multiplyScalar(1 / B.w), B.x *= o.x / 2, B.y *= o.y / 2, B.z = 0, J.copy(B), H.multiplyMatrices(e.matrixWorldInverse, c);
1023
+ for (let f = 0, l = d; f < l; f++) {
1024
+ if (g.fromBufferAttribute(a, f), M.fromBufferAttribute(h, f), g.w = 1, M.w = 1, g.applyMatrix4(H), M.applyMatrix4(H), g.z > u && M.z > u)
962
1025
  continue;
963
1026
  if (g.z > u) {
964
- const O = g.z - M.z, A = (g.z - u) / O;
965
- g.lerp(M, A);
1027
+ const C = g.z - M.z, P = (g.z - u) / C;
1028
+ g.lerp(M, P);
966
1029
  } else if (M.z > u) {
967
- const O = M.z - g.z, A = (M.z - u) / O;
968
- M.lerp(g, A);
1030
+ const C = M.z - g.z, P = (M.z - u) / C;
1031
+ M.lerp(g, P);
969
1032
  }
970
- g.applyMatrix4(i), M.applyMatrix4(i), g.multiplyScalar(1 / g.w), M.multiplyScalar(1 / M.w), g.x *= o.x / 2, g.y *= o.y / 2, M.x *= o.x / 2, M.y *= o.y / 2, w.start.copy(g), w.start.z = 0, w.end.copy(M), w.end.z = 0;
971
- const h = w.closestPointToPointParameter(X, !0);
972
- w.at(h, xe);
973
- const v = Ge.lerp(g.z, M.z, h), j = v >= -1 && v <= 1, C = X.distanceTo(xe) < k * 0.5;
974
- if (j && C) {
975
- w.start.fromBufferAttribute(a, f), w.end.fromBufferAttribute(l, f), w.start.applyMatrix4(c), w.end.applyMatrix4(c);
976
- const O = new S(), A = new S();
977
- E.distanceSqToSegment(w.start, w.end, A, O), t.push({
978
- point: A,
979
- pointOnLine: O,
980
- distance: E.origin.distanceTo(A),
981
- object: n,
1033
+ g.applyMatrix4(i), M.applyMatrix4(i), g.multiplyScalar(1 / g.w), M.multiplyScalar(1 / M.w), g.x *= o.x / 2, g.y *= o.y / 2, M.x *= o.x / 2, M.y *= o.y / 2, x.start.copy(g), x.start.z = 0, x.end.copy(M), x.end.z = 0;
1034
+ const m = x.closestPointToPointParameter(J, !0);
1035
+ x.at(m, Ie);
1036
+ const b = Ze.lerp(g.z, M.z, m), j = b >= -1 && b <= 1, z = J.distanceTo(Ie) < L * 0.5;
1037
+ if (j && z) {
1038
+ x.start.fromBufferAttribute(a, f), x.end.fromBufferAttribute(h, f), x.start.applyMatrix4(c), x.end.applyMatrix4(c);
1039
+ const C = new S(), P = new S();
1040
+ D.distanceSqToSegment(x.start, x.end, P, C), t.push({
1041
+ point: P,
1042
+ pointOnLine: C,
1043
+ distance: D.origin.distanceTo(P),
1044
+ object: r,
982
1045
  face: null,
983
1046
  faceIndex: f,
984
1047
  uv: null,
@@ -987,26 +1050,26 @@ function vt(n, e, t) {
987
1050
  }
988
1051
  }
989
1052
  }
990
- class kt extends Pe {
991
- constructor(e = new Je(), t) {
1053
+ class Gt extends Le {
1054
+ constructor(e = new rt(), t) {
992
1055
  super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
993
1056
  }
994
1057
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
995
1058
  computeLineDistances() {
996
1059
  const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, s = new Float32Array(2 * t.count);
997
- for (let c = 0, r = 0, a = t.count; c < a; c++, r += 2)
998
- Me.fromBufferAttribute(t, c), we.fromBufferAttribute(i, c), s[r] = r === 0 ? 0 : s[r - 1], s[r + 1] = s[r] + Me.distanceTo(we);
999
- const o = new Re(
1060
+ for (let c = 0, n = 0, a = t.count; c < a; c++, n += 2)
1061
+ Pe.fromBufferAttribute(t, c), Ae.fromBufferAttribute(i, c), s[n] = n === 0 ? 0 : s[n - 1], s[n + 1] = s[n] + Pe.distanceTo(Ae);
1062
+ const o = new Ye(
1000
1063
  s,
1001
1064
  2,
1002
1065
  1
1003
1066
  );
1004
1067
  return e.setAttribute(
1005
1068
  "instanceDistanceStart",
1006
- new fe(o, 1, 0)
1069
+ new ve(o, 1, 0)
1007
1070
  ), e.setAttribute(
1008
1071
  "instanceDistanceEnd",
1009
- new fe(o, 1, 1)
1072
+ new ve(o, 1, 1)
1010
1073
  ), this;
1011
1074
  }
1012
1075
  raycast(e, t) {
@@ -1015,50 +1078,50 @@ class kt extends Pe {
1015
1078
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
1016
1079
  );
1017
1080
  const o = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
1018
- E = e.ray;
1019
- const c = this.matrixWorld, r = this.geometry, a = this.material;
1020
- k = a.linewidth + o, r.boundingSphere === null && r.computeBoundingSphere(), U.copy(r.boundingSphere).applyMatrix4(c);
1021
- let l;
1081
+ D = e.ray;
1082
+ const c = this.matrixWorld, n = this.geometry, a = this.material;
1083
+ L = a.linewidth + o, n.boundingSphere === null && n.computeBoundingSphere(), U.copy(n.boundingSphere).applyMatrix4(c);
1084
+ let h;
1022
1085
  if (i)
1023
- l = k * 0.5;
1086
+ h = L * 0.5;
1024
1087
  else {
1025
1088
  const u = Math.max(
1026
1089
  s.near,
1027
- U.distanceToPoint(E.origin)
1090
+ U.distanceToPoint(D.origin)
1028
1091
  );
1029
- l = Se(
1092
+ h = Te(
1030
1093
  s,
1031
1094
  u,
1032
1095
  a.resolution
1033
1096
  );
1034
1097
  }
1035
- if (U.radius += l, E.intersectsSphere(U) === !1)
1098
+ if (U.radius += h, D.intersectsSphere(U) === !1)
1036
1099
  return;
1037
- r.boundingBox === null && r.computeBoundingBox(), _.copy(r.boundingBox).applyMatrix4(c);
1038
- let m;
1100
+ n.boundingBox === null && n.computeBoundingBox(), R.copy(n.boundingBox).applyMatrix4(c);
1101
+ let d;
1039
1102
  if (i)
1040
- m = k * 0.5;
1103
+ d = L * 0.5;
1041
1104
  else {
1042
1105
  const u = Math.max(
1043
1106
  s.near,
1044
- _.distanceToPoint(E.origin)
1107
+ R.distanceToPoint(D.origin)
1045
1108
  );
1046
- m = Se(
1109
+ d = Te(
1047
1110
  s,
1048
1111
  u,
1049
1112
  a.resolution
1050
1113
  );
1051
1114
  }
1052
- _.expandByScalar(m), E.intersectsBox(_) !== !1 && (i ? mt(this, t) : vt(this, s, t));
1115
+ R.expandByScalar(d), D.intersectsBox(R) !== !1 && (i ? St(this, t) : jt(this, s, t));
1053
1116
  }
1054
1117
  onBeforeRender(e) {
1055
1118
  const t = this.material.uniforms;
1056
- t && t.resolution && (e.getViewport(Q), this.material.uniforms.resolution.value.set(Q.z, Q.w));
1119
+ t && t.resolution && (e.getViewport(Z), this.material.uniforms.resolution.value.set(Z.z, Z.w));
1057
1120
  }
1058
1121
  }
1059
- const b = class b extends Z {
1122
+ const v = class v extends ee {
1060
1123
  constructor(e) {
1061
- super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options = z({
1124
+ super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options = k({
1062
1125
  type: "2d"
1063
1126
  }, e);
1064
1127
  }
@@ -1079,17 +1142,17 @@ const b = class b extends Z {
1079
1142
  const e = this.options.children;
1080
1143
  if (!e) return;
1081
1144
  const t = e.getBoundingClientRect(), i = window.innerWidth, s = window.innerHeight, o = t.width, c = t.height;
1082
- let r = 0, a = 0;
1083
- o > i ? t.left > 0 && (r = -t.left) : t.left < 0 ? r = -t.left : t.right > i && (r = i - t.right, t.left + r < 0 && (r = -t.left)), c > s ? t.top > 0 && (a = -t.top) : t.top < 0 ? a = -t.top : t.bottom > s && (a = s - t.bottom, t.top + a < 0 && (a = -t.top)), (r !== 0 || a !== 0) && (e.style.transform = `translate(${r}px, ${a}px)`);
1145
+ let n = 0, a = 0;
1146
+ o > i ? t.left > 0 && (n = -t.left) : t.left < 0 ? n = -t.left : t.right > i && (n = i - t.right, t.left + n < 0 && (n = -t.left)), c > s ? t.top > 0 && (a = -t.top) : t.top < 0 ? a = -t.top : t.bottom > s && (a = s - t.bottom, t.top + a < 0 && (a = -t.top)), (n !== 0 || a !== 0) && (e.style.transform = `translate(${n}px, ${a}px)`);
1084
1147
  }
1085
1148
  ensureVisible() {
1086
1149
  const e = this.options.children;
1087
- e && (e.style.transform && (e.style.transform = ""), !b.observerMap.has(e) && (b.sharedObserver || (b.sharedObserver = new IntersectionObserver((t) => {
1150
+ e && (e.style.transform && (e.style.transform = ""), !v.observerMap.has(e) && (v.sharedObserver || (v.sharedObserver = new IntersectionObserver((t) => {
1088
1151
  t.forEach((i) => {
1089
- const s = i.target, o = b.observerMap.get(s);
1090
- o && i.isIntersecting && (o.moveElementToViewport(), b.observerMap.delete(s), b.sharedObserver && (b.sharedObserver.unobserve(s), b.observerMap.size === 0 && (b.sharedObserver.disconnect(), b.sharedObserver = void 0)));
1152
+ const s = i.target, o = v.observerMap.get(s);
1153
+ o && i.isIntersecting && (o.moveElementToViewport(), v.observerMap.delete(s), v.sharedObserver && (v.sharedObserver.unobserve(s), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)));
1091
1154
  });
1092
- })), b.observerMap.set(e, this), b.sharedObserver.observe(e)));
1155
+ })), v.observerMap.set(e, this), v.sharedObserver.observe(e)));
1093
1156
  }
1094
1157
  onPointerEvent(e, t) {
1095
1158
  const i = this.lead.handlePickNode([this], e, t);
@@ -1097,21 +1160,21 @@ const b = class b extends Z {
1097
1160
  }
1098
1161
  dispose() {
1099
1162
  const e = this.options.children;
1100
- e && b.sharedObserver && (b.observerMap.delete(e), b.sharedObserver.unobserve(e), b.observerMap.size === 0 && (b.sharedObserver.disconnect(), b.sharedObserver = void 0)), this.onNodePointerIndex.forEach((t) => {
1163
+ e && v.sharedObserver && (v.observerMap.delete(e), v.sharedObserver.unobserve(e), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)), this.onNodePointerIndex.forEach((t) => {
1101
1164
  this.lead.removePickNode(t);
1102
1165
  }), super.dispose();
1103
1166
  }
1104
1167
  };
1105
- b.observerMap = /* @__PURE__ */ new Map();
1106
- let je = b;
1168
+ v.observerMap = /* @__PURE__ */ new Map();
1169
+ let Be = v;
1107
1170
  export {
1108
- be as B,
1109
- Tt as I,
1110
- kt as L,
1111
- Lt as M,
1112
- je as N,
1113
- Et as P,
1114
- it as R,
1115
- Z as a,
1116
- ht as g
1171
+ xe as B,
1172
+ Nt as I,
1173
+ Gt as L,
1174
+ Ut as M,
1175
+ Be as N,
1176
+ Rt as P,
1177
+ lt as R,
1178
+ ee as a,
1179
+ Mt as g
1117
1180
  };