gl-draw 0.16.0-beta.8 → 0.16.0

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,106 +1,106 @@
1
- var Ct = Object.defineProperty, Pt = Object.defineProperties;
2
- var It = Object.getOwnPropertyDescriptors;
3
- var k = Object.getOwnPropertySymbols;
4
- var et = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable;
5
- var st = Math.pow, tt = (n, t, e) => t in n ? Ct(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, L = (n, t) => {
6
- for (var e in t || (t = {}))
7
- et.call(t, e) && tt(n, e, t[e]);
8
- if (k)
9
- for (var e of k(t))
10
- it.call(t, e) && tt(n, e, t[e]);
11
- return n;
12
- }, $ = (n, t) => Pt(n, It(t));
13
- var nt = (n, t) => {
14
- var e = {};
15
- for (var i in n)
16
- et.call(n, i) && t.indexOf(i) < 0 && (e[i] = n[i]);
17
- if (n != null && k)
18
- for (var i of k(n))
19
- t.indexOf(i) < 0 && it.call(n, i) && (e[i] = n[i]);
20
- return e;
1
+ var Ce = Object.defineProperty, Ie = Object.defineProperties;
2
+ var Pe = Object.getOwnPropertyDescriptors;
3
+ var V = Object.getOwnPropertySymbols;
4
+ var te = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
+ var ne = Math.pow, ee = (s, e, t) => e in s ? Ce(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, k = (s, e) => {
6
+ for (var t in e || (e = {}))
7
+ te.call(e, t) && ee(s, t, e[t]);
8
+ if (V)
9
+ for (var t of V(e))
10
+ ie.call(e, t) && ee(s, t, e[t]);
11
+ return s;
12
+ }, $ = (s, e) => Ie(s, Pe(e));
13
+ var se = (s, e) => {
14
+ var t = {};
15
+ for (var i in s)
16
+ te.call(s, i) && e.indexOf(i) < 0 && (t[i] = s[i]);
17
+ if (s != null && V)
18
+ for (var i of V(s))
19
+ e.indexOf(i) < 0 && ie.call(s, i) && (t[i] = s[i]);
20
+ return t;
21
21
  };
22
- var rt = (n, t, e) => new Promise((i, s) => {
22
+ var re = (s, e, t) => new Promise((i, n) => {
23
23
  var a = (o) => {
24
24
  try {
25
- r(e.next(o));
25
+ r(t.next(o));
26
26
  } catch (c) {
27
- s(c);
27
+ n(c);
28
28
  }
29
29
  }, l = (o) => {
30
30
  try {
31
- r(e.throw(o));
31
+ r(t.throw(o));
32
32
  } catch (c) {
33
- s(c);
33
+ n(c);
34
34
  }
35
35
  }, r = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(a, l);
36
- r((e = e.apply(n, t)).next());
36
+ r((t = t.apply(s, e)).next());
37
37
  });
38
- import { Material as at, Object3D as N, Texture as ot, BufferGeometry as Z, Float32BufferAttribute as R, PointsMaterial as Bt, Points as J, InstancedMesh as xt, Vector3 as I, Quaternion as Dt, Group as Tt, Mesh as wt, Sprite as ct, Box3 as St, ShaderMaterial as zt, Vector2 as q, Color as lt, Vector4 as O, Matrix4 as _t, Line3 as Et, Sphere as Lt, InstancedInterleavedBuffer as Ot, InterleavedBufferAttribute as ut, MathUtils as Vt } from "three";
39
- import { CSS2DObject as kt } from "three/examples/jsm/renderers/CSS2DRenderer";
40
- import { CSS3DObject as Wt, CSS3DSprite as Ut } from "three/examples/jsm/renderers/CSS3DRenderer";
41
- import { geoBounds as jt, geoContains as Nt, geoDistance as Rt, geoInterpolate as Gt } from "d3-geo";
38
+ import { Material as ae, Object3D as N, Texture as oe, BufferGeometry as Z, Float32BufferAttribute as R, PointsMaterial as Be, Points as J, InstancedMesh as xe, Vector3 as P, Quaternion as De, Group as Te, Mesh as we, Sprite as ce, Box3 as Se, ShaderMaterial as ze, Vector2 as q, Color as le, Vector4 as E, Matrix4 as Oe, Line3 as _e, Sphere as ke, InstancedInterleavedBuffer as Ee, InterleavedBufferAttribute as ue, MathUtils as Le } from "three";
39
+ import { CSS2DObject as Ve } from "three/examples/jsm/renderers/CSS2DRenderer";
40
+ import { CSS3DObject as Ue, CSS3DSprite as We } from "three/examples/jsm/renderers/CSS3DRenderer";
41
+ import { geoBounds as je, geoContains as Ne, geoDistance as Re, geoInterpolate as Ge } from "d3-geo";
42
42
  import "d3-geo-projection";
43
- import { p as ft, a as Ft } from "./polar2Cartesian.module.js";
44
- import { merge as H, mean as $t, extent as dt } from "d3-array";
45
- import qt, { flatten as At } from "earcut";
46
- import Kt from "@turf/boolean-clockwise";
47
- import Qt from "delaunator";
48
- import Xt from "@turf/boolean-point-in-polygon";
49
- import { geoVoronoi as Yt } from "d3-geo-voronoi";
50
- import { scaleLinear as ht } from "d3-scale";
51
- import { LineSegmentsGeometry as Zt } from "three/examples/jsm/lines/LineSegmentsGeometry";
52
- const Jt = 0, De = 1, Ht = 2, Te = !1;
53
- class te {
43
+ import { p as fe, a as Fe } from "./polar2Cartesian.module.js";
44
+ import { merge as H, mean as $e, extent as de } from "d3-array";
45
+ import qe, { flatten as Ae } from "earcut";
46
+ import Ke from "@turf/boolean-clockwise";
47
+ import Qe from "delaunator";
48
+ import Xe from "@turf/boolean-point-in-polygon";
49
+ import { geoVoronoi as Ye } from "d3-geo-voronoi";
50
+ import { scaleLinear as he } from "d3-scale";
51
+ import { LineSegmentsGeometry as Ze } from "three/examples/jsm/lines/LineSegmentsGeometry";
52
+ const Je = 0, Dt = 1, He = 2, Tt = !1;
53
+ class et {
54
54
  constructor() {
55
55
  this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
56
56
  }
57
- track(t) {
58
- if (!t)
59
- return t;
60
- if (Array.isArray(t))
61
- return t.forEach((e) => this.track(e)), t;
62
- if (!this.disposeMaterial && t instanceof at)
63
- return t;
64
- if (t instanceof pt ? (t.disposeTrack && t.object3d ? this.track(t.object3d) : this.resources.add(t), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof N || Reflect.has(t, "dispose")) && this.resources.add(t), t instanceof pt)
65
- t.children.forEach((e) => {
66
- e.disposeTrack = !1;
67
- }), this.track(t.children);
68
- else if (t instanceof N) {
69
- const e = t;
70
- this.track(e.geometry), this.track(e.material), this.track(e.children);
71
- } else if (t instanceof at) {
72
- for (const i of Object.values(t))
73
- i instanceof ot && this.track(i);
74
- const e = t;
75
- if (e.uniforms) {
76
- for (const i of Object.values(e.uniforms))
57
+ track(e) {
58
+ if (!e)
59
+ return e;
60
+ if (Array.isArray(e))
61
+ return e.forEach((t) => this.track(t)), e;
62
+ if (!this.disposeMaterial && e instanceof ae)
63
+ return e;
64
+ if (e instanceof pe ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof N || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof pe)
65
+ e.children.forEach((t) => {
66
+ t.disposeTrack = !1;
67
+ }), this.track(e.children);
68
+ else if (e instanceof N) {
69
+ const t = e;
70
+ this.track(t.geometry), this.track(t.material), this.track(t.children);
71
+ } else if (e instanceof ae) {
72
+ for (const i of Object.values(e))
73
+ i instanceof oe && this.track(i);
74
+ const t = e;
75
+ if (t.uniforms) {
76
+ for (const i of Object.values(t.uniforms))
77
77
  if (i) {
78
- const s = i.value;
79
- (s instanceof ot || Array.isArray(s)) && this.track(s);
78
+ const n = i.value;
79
+ (n instanceof oe || Array.isArray(n)) && this.track(n);
80
80
  }
81
81
  }
82
- } else this.disposeVideo && t.isVideoTexture && t.source.data && this.resources.add(t.source.data);
83
- return t;
82
+ } else this.disposeVideo && e.isVideoTexture && e.source.data && this.resources.add(e.source.data);
83
+ return e;
84
84
  }
85
85
  dispose() {
86
- const t = [];
87
- for (const e of this.resources)
88
- e instanceof N ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
89
- t.forEach((e) => {
90
- e.removeFromParent();
91
- }), t.length = 0, this.resources.clear();
86
+ const e = [];
87
+ for (const t of this.resources)
88
+ t instanceof N ? e.push(t) : t instanceof HTMLVideoElement && t.pause(), Reflect.has(t, "dispose") && t.dispose();
89
+ e.forEach((t) => {
90
+ t.removeFromParent();
91
+ }), e.length = 0, this.resources.clear();
92
92
  }
93
93
  }
94
- const ee = (n, t = 1) => {
95
- const e = new Z();
96
- e.setAttribute(
94
+ const tt = (s, e = 1) => {
95
+ const t = new Z();
96
+ t.setAttribute(
97
97
  "position",
98
- new R(new Array(t * 3).fill(0), 3)
99
- ), e.setAttribute(
98
+ new R(new Array(e * 3).fill(0), 3)
99
+ ), t.setAttribute(
100
100
  "scaleAtt",
101
- new R(new Array(t).fill(1), 1)
101
+ new R(new Array(e).fill(1), 1)
102
102
  );
103
- const i = n.material, s = new Bt({
103
+ const i = s.material, n = new Be({
104
104
  size: 10,
105
105
  map: i.map,
106
106
  alphaMap: i.alphaMap,
@@ -113,7 +113,7 @@ const ee = (n, t = 1) => {
113
113
  alphaTest: i.alphaTest,
114
114
  sizeAttenuation: !1
115
115
  });
116
- return s.onBeforeCompile = (a) => {
116
+ return n.onBeforeCompile = (a) => {
117
117
  a.vertexShader = `
118
118
  attribute float scaleAtt;
119
119
  ${a.vertexShader.replace(
@@ -121,99 +121,99 @@ const ee = (n, t = 1) => {
121
121
  "gl_PointSize = size * scaleAtt;"
122
122
  )}
123
123
  `;
124
- }, new J(e, s);
125
- }, ie = (n, t) => {
126
- const e = new N();
127
- t.forEach((i, s) => {
128
- const a = ft(i.position), l = ft(i.scale || [1, 1, 1]);
129
- e.position.copy(a), e.scale.copy(l), e.updateMatrix();
130
- const r = e.matrix.clone();
131
- if (n instanceof xt || n.isInstantiate)
132
- n.setMatrixAt(s, r);
133
- else if (n instanceof J || n.type === "Points") {
134
- const c = n.geometry, f = c.attributes.position.array, d = c.attributes.scaleAtt.array, h = new I(), u = new I(), m = new Dt(), p = s * 3, v = s * 1;
124
+ }, new J(t, n);
125
+ }, it = (s, e) => {
126
+ const t = new N();
127
+ e.forEach((i, n) => {
128
+ const a = fe(i.position), l = fe(i.scale || [1, 1, 1]);
129
+ t.position.copy(a), t.scale.copy(l), t.updateMatrix();
130
+ const r = t.matrix.clone();
131
+ if (s instanceof xe || s.isInstantiate)
132
+ s.setMatrixAt(n, r);
133
+ else if (s instanceof J || s.type === "Points") {
134
+ const c = s.geometry, f = c.attributes.position.array, d = c.attributes.scaleAtt.array, h = new P(), u = new P(), m = new De(), p = n * 3, v = n * 1;
135
135
  r.decompose(h, m, u), f[p] = h.x, f[p + 1] = h.y, f[p + 2] = h.z, d[v] = Math.max(u.x, u.y, u.z), c.attributes.position.needsUpdate = !0, c.attributes.scaleAtt.needsUpdate = !0;
136
136
  }
137
137
  });
138
138
  };
139
- class se {
139
+ class nt {
140
140
  constructor() {
141
141
  this.onPointerIndex = [];
142
142
  }
143
- onPointerEvent(t, e) {
144
- const i = this.lead.handlePick([this], t, e);
143
+ onPointerEvent(e, t) {
144
+ const i = this.lead.handlePick([this], e, t);
145
145
  this.onPointerIndex.push(i);
146
146
  }
147
- onClick(t) {
148
- this.onPointerEvent("click", t);
147
+ onClick(e) {
148
+ this.onPointerEvent("click", e);
149
149
  }
150
- onPointerEnter(t) {
151
- this.onPointerEvent("enter", t);
150
+ onPointerEnter(e) {
151
+ this.onPointerEvent("enter", e);
152
152
  }
153
- onPointerLeave(t) {
154
- this.onPointerEvent("leave", t);
153
+ onPointerLeave(e) {
154
+ this.onPointerEvent("leave", e);
155
155
  }
156
- onPointerMove(t) {
157
- this.onPointerEvent("move", t);
156
+ onPointerMove(e) {
157
+ this.onPointerEvent("move", e);
158
158
  }
159
- onPointerDown(t) {
160
- this.onPointerEvent("down", t);
159
+ onPointerDown(e) {
160
+ this.onPointerEvent("down", e);
161
161
  }
162
162
  dispose() {
163
- this.onPointerIndex.forEach((t) => {
164
- this.lead.removePick(t);
163
+ this.onPointerIndex.forEach((e) => {
164
+ this.lead.removePick(e);
165
165
  });
166
166
  }
167
167
  }
168
- class ne extends se {
168
+ class st extends nt {
169
169
  constructor() {
170
170
  super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
171
171
  }
172
172
  cloneMaterial() {
173
- const t = this.object3d;
174
- if (!t || !t.material)
173
+ const e = this.object3d;
174
+ if (!e || !e.material)
175
175
  return;
176
- const e = t.material;
177
- if (Array.isArray(e))
178
- return e.map((i) => {
179
- const s = i.userData;
176
+ const t = e.material;
177
+ if (Array.isArray(t))
178
+ return t.map((i) => {
179
+ const n = i.userData;
180
180
  i.userData = {};
181
181
  const a = i.clone();
182
- return i.userData = s, a;
182
+ return i.userData = n, a;
183
183
  });
184
184
  {
185
- const i = e.userData;
186
- e.userData = {};
187
- const s = e.clone();
188
- return e.userData = i, s;
185
+ const i = t.userData;
186
+ t.userData = {};
187
+ const n = t.clone();
188
+ return t.userData = i, n;
189
189
  }
190
190
  }
191
- setMaterialList(t, e) {
191
+ setMaterialList(e, t) {
192
192
  const i = this.object3d;
193
193
  if (!i || !i.material)
194
194
  return;
195
195
  this.materialList.origin || (this.materialList.origin = i.material);
196
- const s = e === "clone" ? this.cloneMaterial() : Array.isArray(e) ? e.slice() : e;
197
- return this.materialList[t] = s, s;
196
+ const n = t === "clone" ? this.cloneMaterial() : Array.isArray(t) ? t.slice() : t;
197
+ return this.materialList[e] = n, n;
198
198
  }
199
- useMaterial(t) {
200
- const e = this.object3d;
201
- !e || !e.material || this.useMaterialType === t || !this.materialList[t] || (this.useMaterialType = t, e.material = this.materialList[t]);
199
+ useMaterial(e) {
200
+ const t = this.object3d;
201
+ !t || !t.material || this.useMaterialType === e || !this.materialList[e] || (this.useMaterialType = e, t.material = this.materialList[e]);
202
202
  }
203
- useMListById(t, e) {
203
+ useMListById(e, t) {
204
204
  if (!this.mList)
205
205
  return;
206
- const i = this.mList.get(t);
206
+ const i = this.mList.get(e);
207
207
  if (!i)
208
208
  return;
209
- const s = this.object3d;
210
- Array.isArray(s.material) && e !== void 0 ? s.material[e] = i : s.material = i;
209
+ const n = this.object3d;
210
+ Array.isArray(n.material) && t !== void 0 ? n.material[t] = i : n.material = i;
211
211
  }
212
- useMListByName(t, e) {
212
+ useMListByName(e, t) {
213
213
  if (!this.mList)
214
214
  return;
215
- const i = this.mList.getKeyByName(t);
216
- i && this.useMListById(i, e);
215
+ const i = this.mList.getKeyByName(e);
216
+ i && this.useMListById(i, t);
217
217
  }
218
218
  dispose() {
219
219
  super.dispose(), this.mList.rmBaseObjectMap(
@@ -223,16 +223,16 @@ class ne extends se {
223
223
  );
224
224
  }
225
225
  }
226
- class pt extends ne {
226
+ class pe extends st {
227
227
  constructor() {
228
- super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0;
228
+ super(...arguments), this.key = "", this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0;
229
229
  }
230
230
  get parent() {
231
- const t = this.object3d.parent;
232
- return t && this.lead.objMap.get(t) || null;
231
+ const e = this.object3d.parent;
232
+ return e && this.lead.objMap.get(e) || null;
233
233
  }
234
234
  get children() {
235
- return this.object3d.children.map((t) => this.lead.objMap.get(t)).filter((t) => !!t);
235
+ return this.object3d.children.map((e) => this.lead.objMap.get(e)).filter((e) => !!e);
236
236
  }
237
237
  get position() {
238
238
  return this.object3d.position;
@@ -246,17 +246,17 @@ class pt extends ne {
246
246
  get lookAt() {
247
247
  return this.object3d.lookAt;
248
248
  }
249
- add(...t) {
250
- [...t].forEach((e) => {
251
- this.lead.objMap.get(e) ? this.object3d.add(e) : this.lead.createBaseObject(e, {
249
+ add(...e) {
250
+ [...e].forEach((t) => {
251
+ this.lead.objMap.get(t) ? this.object3d.add(t) : this.lead.createBaseObject(t, {
252
252
  target: this
253
253
  });
254
254
  });
255
255
  }
256
- remove(...t) {
257
- [...t].forEach((e) => {
256
+ remove(...e) {
257
+ [...e].forEach((t) => {
258
258
  var i;
259
- this.lead.objMap.get(e) ? (i = this.lead.objMap.get(e)) == null || i.erase() : this.object3d.remove(e);
259
+ this.lead.objMap.get(t) ? (i = this.lead.objMap.get(t)) == null || i.erase() : this.object3d.remove(t);
260
260
  });
261
261
  }
262
262
  get visible() {
@@ -264,11 +264,11 @@ class pt extends ne {
264
264
  }
265
265
  get visibleWithAncestors() {
266
266
  if (this.visible) {
267
- let t = this.parent;
268
- for (; t; ) {
269
- if (!t.visible)
267
+ let e = this.parent;
268
+ for (; e; ) {
269
+ if (!e.visible)
270
270
  return !1;
271
- t = t.parent;
271
+ e = e.parent;
272
272
  }
273
273
  return !0;
274
274
  } else
@@ -279,90 +279,98 @@ class pt extends ne {
279
279
  }
280
280
  render() {
281
281
  }
282
- update(t, e) {
282
+ update(e, t) {
283
283
  }
284
- resize(t, e) {
284
+ resize(e, t) {
285
285
  }
286
286
  show() {
287
- return this.object3d.visible = !0, this.object3d.layers.set(Jt), this.isBloom && this.enableBloom(), this;
287
+ return this.object3d.visible = !0, this.object3d.layers.set(Je), this.isBloom && this.enableBloom(), this;
288
288
  }
289
289
  hide() {
290
- return this.object3d.visible = !1, this.object3d.layers.set(Ht), this;
290
+ return this.object3d.visible = !1, this.object3d.layers.set(He), this;
291
291
  }
292
292
  createGroup() {
293
- return this.object3d = new Tt(), this;
293
+ return this.object3d = new Te(), this;
294
294
  }
295
- createMesh(...t) {
296
- return this.object3d = new wt(...t), this;
295
+ createMesh(...e) {
296
+ return this.object3d = new we(...e), this;
297
297
  }
298
- createPoints(...t) {
299
- return this.object3d = new J(...t), this;
298
+ createPoints(...e) {
299
+ return this.object3d = new J(...e), this;
300
300
  }
301
- createCSS2DObject(t) {
302
- return this.object3d = new kt(t), this;
301
+ createCSS2DObject(e) {
302
+ return this.object3d = new Ve(e), this;
303
303
  }
304
- createCSS3DObject(t) {
305
- return this.object3d = new Wt(t), this;
304
+ createCSS3DObject(e) {
305
+ return this.object3d = new Ue(e), this;
306
306
  }
307
- createCSS3DSprite(t) {
308
- return this.object3d = new Ut(t), this;
307
+ createCSS3DSprite(e) {
308
+ return this.object3d = new We(e), this;
309
309
  }
310
- createSprite(t) {
311
- return this.object3d = new ct(t), this;
310
+ createSprite(e) {
311
+ return this.object3d = new ce(e), this;
312
312
  }
313
- attach(...t) {
314
- return [...t].forEach((e) => {
315
- this.object3d.attach(e.object3d);
313
+ attach(...e) {
314
+ return [...e].forEach((t) => {
315
+ this.object3d.attach(t.object3d);
316
316
  }), this;
317
317
  }
318
318
  getSize() {
319
- const t = new St().setFromObject(this.object3d);
319
+ const e = new Se().setFromObject(this.object3d);
320
320
  return {
321
- min: t.min,
322
- max: t.max,
323
- size: t.getSize(new I()),
324
- center: t.getCenter(new I())
321
+ min: e.min,
322
+ max: e.max,
323
+ size: e.getSize(new P()),
324
+ center: e.getCenter(new P())
325
325
  };
326
326
  }
327
- setTop(t) {
328
- this.object3d && (this.object3d.renderOrder = t);
327
+ setTop(e) {
328
+ this.object3d && (this.object3d.renderOrder = e);
329
329
  }
330
- traverse(t) {
331
- t(this), this.children.forEach((e) => {
332
- e.traverse(t);
330
+ traverse(e) {
331
+ e(this), this.children.forEach((t) => {
332
+ t.traverse(e);
333
333
  });
334
334
  }
335
- instantiate(t) {
336
- return rt(this, null, function* () {
335
+ instantiate(e) {
336
+ return re(this, null, function* () {
337
337
  var o, c;
338
- const e = (o = t == null ? void 0 : t.recursive) != null ? o : !0, i = (c = t == null ? void 0 : t.cloneMaterial) != null ? c : !1, { objectType: s, objectOptions: a } = this;
339
- let l = t == null ? void 0 : t.create;
340
- l === void 0 && (l = (f) => {
338
+ const t = (o = e == null ? void 0 : e.recursive) != null ? o : !0, i = (c = e == null ? void 0 : e.cloneMaterial) != null ? c : !1, { objectType: n, objectOptions: a } = this;
339
+ let l = e == null ? void 0 : e.create, r;
340
+ return this.objectType === "BaseObject" ? r = this.lead.createBaseObject(this.object3d.clone(!1), {
341
+ target: (e == null ? void 0 : e.target) || this.parent
342
+ }) : (l === void 0 && (l = (f) => {
341
343
  var d;
342
344
  if (this.object3d) {
343
- if ((d = t == null ? void 0 : t.instancedAttr) != null && d.length) {
344
- const h = t.instancedAttr.length;
345
- if (this.object3d instanceof ct)
346
- f.object3d = ee(this.object3d, h);
345
+ if ((d = e == null ? void 0 : e.instancedAttr) != null && d.length) {
346
+ const h = e.instancedAttr.length;
347
+ if (this.object3d instanceof ce)
348
+ f.object3d = tt(this.object3d, h);
347
349
  else {
348
350
  const u = this.object3d, m = i ? this.cloneMaterial() : u.material;
349
- f.object3d = new xt(u.geometry, m, h);
351
+ f.object3d = new xe(
352
+ u.geometry,
353
+ m,
354
+ h
355
+ );
350
356
  }
351
- ie(f.object3d, t == null ? void 0 : t.instancedAttr);
357
+ it(f.object3d, e == null ? void 0 : e.instancedAttr);
352
358
  } else
353
359
  f.object3d = this.object3d.clone(!1), i && f.object3d.material && (f.object3d.material = this.cloneMaterial());
354
360
  f.object3d.userData.prefab && delete f.object3d.userData.prefab;
355
361
  }
356
- });
357
- const r = yield this.lead.draw(s, $(L({}, a || {}), {
362
+ }), r = yield this.lead.draw(n, $(k({}, a || {}), {
358
363
  create: l,
359
364
  prefab: !1,
360
- key: (t == null ? void 0 : t.key) || (a == null ? void 0 : a.key),
361
- target: (t == null ? void 0 : t.target) || (a == null ? void 0 : a.target)
362
- }));
363
- return this.isBloom && r.enableBloom(), e && (yield Promise.all(
365
+ keyType: this.keyType,
366
+ key: (e == null ? void 0 : e.key) || this.keyName,
367
+ uId: (e == null ? void 0 : e.uId) || this.keyUId,
368
+ target: (e == null ? void 0 : e.target) || this.parent
369
+ }))), this.isBloom && r.enableBloom(), t && (yield Promise.all(
364
370
  this.children.map(
365
371
  (f) => f.instantiate({
372
+ key: f.keyUId ? `${f.keyName}-${f.keyUId}` : f.keyName,
373
+ uId: e == null ? void 0 : e.uId,
366
374
  cloneMaterial: i,
367
375
  target: r
368
376
  })
@@ -373,107 +381,107 @@ class pt extends ne {
373
381
  erase() {
374
382
  this.lead.erase(this);
375
383
  }
376
- handleMaterialChange(t) {
384
+ handleMaterialChange(e) {
377
385
  }
378
386
  enableBloom() {
379
- var t;
380
- (t = this.pencil.composerController) == null || t.setBloomSelection(this, !0), this.isBloom = !0;
387
+ var e;
388
+ (e = this.pencil.composerController) == null || e.setBloomSelection(this, !0), this.isBloom = !0;
381
389
  }
382
390
  disableBloom() {
383
- var t;
384
- (t = this.pencil.composerController) == null || t.setBloomSelection(this, !1), this.isBloom = !1;
391
+ var e;
392
+ (e = this.pencil.composerController) == null || e.setBloomSelection(this, !1), this.isBloom = !1;
385
393
  }
386
394
  dispose() {
387
- var t;
388
- if (super.dispose(), (t = this.pencil.composerController) == null || t.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
389
- const e = new te();
390
- e.disposeMaterial = !1, e.track(this), e.dispose();
395
+ var e;
396
+ if (super.dispose(), (e = this.pencil.composerController) == null || e.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
397
+ const t = new et();
398
+ t.disposeMaterial = !1, t.track(this), t.dispose();
391
399
  }
392
400
  }
393
401
  }
394
- function re(n, t) {
395
- return n.map((e) => {
402
+ function rt(s, e) {
403
+ return s.map((t) => {
396
404
  const i = [];
397
- let s;
398
- return e.forEach((a) => {
399
- if (s) {
400
- const l = Rt(a, s) * 180 / Math.PI;
401
- if (l > t) {
402
- const r = Gt(s, a), o = 1 / Math.ceil(l / t);
405
+ let n;
406
+ return t.forEach((a) => {
407
+ if (n) {
408
+ const l = Re(a, n) * 180 / Math.PI;
409
+ if (l > e) {
410
+ const r = Ge(n, a), o = 1 / Math.ceil(l / e);
403
411
  let c = o;
404
412
  for (; c < 1; )
405
413
  i.push(r(c)), c += o;
406
414
  }
407
415
  }
408
- i.push(s = a);
416
+ i.push(n = a);
409
417
  }), i;
410
418
  });
411
419
  }
412
- function ae(n, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
413
- const a = Math.round(st(360 / n, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, r = (u) => u / l * 360 % 360 - 180, o = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, c = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, f = [
414
- s !== void 0 ? Math.ceil(c(s)) : 0,
420
+ function at(s, { minLng: e, maxLng: t, minLat: i, maxLat: n } = {}) {
421
+ const a = Math.round(ne(360 / s, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, r = (u) => u / l * 360 % 360 - 180, o = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, c = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, f = [
422
+ n !== void 0 ? Math.ceil(c(n)) : 0,
415
423
  i !== void 0 ? Math.floor(c(i)) : a - 1
416
- ], d = t === void 0 && e === void 0 ? () => !0 : t === void 0 ? (u) => u <= e : e === void 0 ? (u) => u >= t : e >= t ? (u) => u >= t && u <= e : (u) => u >= t || u <= e, h = [];
424
+ ], d = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (u) => u <= t : t === void 0 ? (u) => u >= e : t >= e ? (u) => u >= e && u <= t : (u) => u >= e || u <= t, h = [];
417
425
  for (let u = f[0]; u <= f[1]; u++) {
418
426
  const m = r(u);
419
427
  d(m) && h.push([m, o(u)]);
420
428
  }
421
429
  return h;
422
430
  }
423
- function Y(n, t, e = !1) {
424
- return e ? Nt(t, n) : Xt(n, t);
431
+ function Y(s, e, t = !1) {
432
+ return t ? Ne(e, s) : Xe(s, e);
425
433
  }
426
- function oe(n, t) {
427
- const e = { type: "Polygon", coordinates: n }, [[i, s], [a, l]] = jt(e);
428
- if (Math.min(Math.abs(a - i), Math.abs(l - s)) < t)
434
+ function ot(s, e) {
435
+ const t = { type: "Polygon", coordinates: s }, [[i, n], [a, l]] = je(t);
436
+ if (Math.min(Math.abs(a - i), Math.abs(l - n)) < e)
429
437
  return [];
430
- const r = i > a || l >= 89 || s <= -89;
431
- return ae(t, {
438
+ const r = i > a || l >= 89 || n <= -89;
439
+ return at(e, {
432
440
  minLng: i,
433
441
  maxLng: a,
434
- minLat: s,
442
+ minLat: n,
435
443
  maxLat: l
436
444
  }).filter(
437
- (o) => Y(o, e, r)
445
+ (o) => Y(o, t, r)
438
446
  );
439
447
  }
440
- function ce(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
441
- const s = re(n, t), a = H(s), l = oe(n, t), r = [...a, ...l], o = { type: "Polygon", coordinates: n }, [[c, f], [d, h]] = jt(o), u = c > d || // crosses antimeridian
448
+ function ct(s, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
449
+ const n = rt(s, e), a = H(n), l = ot(s, e), r = [...a, ...l], o = { type: "Polygon", coordinates: s }, [[c, f], [d, h]] = je(o), u = c > d || // crosses antimeridian
442
450
  h >= 89 || // crosses north pole
443
451
  f <= -89;
444
452
  let m = [];
445
453
  if (u) {
446
- const b = Yt(r).triangles(), x = new Map(
447
- r.map(([A, C], _) => [`${A}-${C}`, _])
454
+ const y = Ye(r).triangles(), x = new Map(
455
+ r.map(([A, C], O) => [`${A}-${C}`, O])
448
456
  );
449
- b.features.forEach((A) => {
450
- const C = A.geometry.coordinates[0].slice(0, 3).reverse(), _ = [];
451
- if (C.forEach(([P, F]) => {
452
- const V = `${P}-${F}`;
453
- x.has(V) && _.push(x.get(V));
454
- }), _.length === 3) {
455
- if (_.some((P) => P < a.length)) {
456
- const P = A.properties.circumcenter;
457
+ y.features.forEach((A) => {
458
+ const C = A.geometry.coordinates[0].slice(0, 3).reverse(), O = [];
459
+ if (C.forEach(([I, F]) => {
460
+ const L = `${I}-${F}`;
461
+ x.has(L) && O.push(x.get(L));
462
+ }), O.length === 3) {
463
+ if (O.some((I) => I < a.length)) {
464
+ const I = A.properties.circumcenter;
457
465
  if (!Y(
458
- P,
466
+ I,
459
467
  o,
460
468
  u
461
469
  ))
462
470
  return;
463
471
  }
464
- m.push(..._);
472
+ m.push(...O);
465
473
  }
466
474
  });
467
475
  } else if (l.length) {
468
- const b = Qt.from(r);
469
- for (let x = 0, A = b.triangles.length; x < A; x += 3) {
470
- const C = [2, 1, 0].map((P) => b.triangles[x + P]), _ = C.map((P) => r[P]);
471
- if (C.some((P) => P < a.length)) {
472
- const P = [0, 1].map(
473
- (F) => $t(_, (V) => V[F])
476
+ const y = Qe.from(r);
477
+ for (let x = 0, A = y.triangles.length; x < A; x += 3) {
478
+ const C = [2, 1, 0].map((I) => y.triangles[x + I]), O = C.map((I) => r[I]);
479
+ if (C.some((I) => I < a.length)) {
480
+ const I = [0, 1].map(
481
+ (F) => $e(O, (L) => L[F])
474
482
  );
475
483
  if (!Y(
476
- P,
484
+ I,
477
485
  o,
478
486
  u
479
487
  ))
@@ -482,47 +490,47 @@ function ce(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
482
490
  m.push(...C);
483
491
  }
484
492
  } else {
485
- const { vertices: b, holes: x = [] } = At(s);
486
- m = qt(b, x, 2);
493
+ const { vertices: y, holes: x = [] } = Ae(n);
494
+ m = qe(y, x, 2);
487
495
  }
488
- let p = e ? [e[0], e[2]] : dt(r, (b) => b[0]), v = e ? [e[1], e[3]] : dt(r, (b) => b[1]);
496
+ let p = t ? [t[0], t[2]] : de(r, (y) => y[0]), v = t ? [t[1], t[3]] : de(r, (y) => y[1]);
489
497
  if (i) {
490
- const [b, x] = i([p[0], v[0]]), [A, C] = i([p[1], v[1]]);
491
- p = [b, A], v = [-x, -C];
498
+ const [y, x] = i([p[0], v[0]]), [A, C] = i([p[1], v[1]]);
499
+ p = [y, A], v = [-x, -C];
492
500
  }
493
- const w = ht(p, [0, 1]), S = ht(v, [0, 1]), B = r.map(([b, x]) => {
501
+ const w = he(p, [0, 1]), S = he(v, [0, 1]), B = r.map(([y, x]) => {
494
502
  if (i) {
495
- const [A, C] = i([b, x]);
503
+ const [A, C] = i([y, x]);
496
504
  return [w(A), S(-C)];
497
505
  } else
498
- return [w(b), S(x)];
506
+ return [w(y), S(x)];
499
507
  });
500
- return { contour: s, triangles: { points: r, indices: m, uvs: B } };
508
+ return { contour: n, triangles: { points: r, indices: m, uvs: B } };
501
509
  }
502
- const mt = new Z().setAttribute ? "setAttribute" : "addAttribute";
503
- function G(n, t, e, i) {
504
- const s = n.map(
510
+ const me = new Z().setAttribute ? "setAttribute" : "addAttribute";
511
+ function G(s, e, t, i) {
512
+ const n = s.map(
505
513
  (a) => a.map(([l, r]) => {
506
514
  if (i) {
507
515
  const [o, c] = i([l, r]);
508
- return [o, -c, t];
516
+ return [o, -c, e];
509
517
  }
510
- return e ? Ft(l, r, t) : [l, r, t];
518
+ return t ? Fe(l, r, e) : [l, r, e];
511
519
  })
512
520
  );
513
- return At(s);
521
+ return Ae(n);
514
522
  }
515
- function le(n, t, e, i, s) {
523
+ function lt(s, e, t, i, n) {
516
524
  const { vertices: a, holes: l } = G(
517
- n,
518
- t,
525
+ s,
526
+ e,
519
527
  i,
520
- s
528
+ n
521
529
  ), { vertices: r } = G(
522
- n,
523
- e,
530
+ s,
531
+ t,
524
532
  i,
525
- s
533
+ n
526
534
  ), o = H([r, a]), c = Math.round(r.length / 3), f = new Set(l);
527
535
  let d = 0;
528
536
  const h = [];
@@ -541,71 +549,71 @@ function le(n, t, e, i, s) {
541
549
  for (let p = 0; p < c; p += 1) u.push(p / (c - 1), m);
542
550
  return { indices: h, vertices: o, uvs: u, topVerts: r };
543
551
  }
544
- function vt(n, t, e, i, s, a) {
552
+ function ve(s, e, t, i, n, a) {
545
553
  return {
546
- indices: i ? n.indices : n.indices.slice().reverse(),
554
+ indices: i ? s.indices : s.indices.slice().reverse(),
547
555
  vertices: G(
548
- [n.points],
549
- t,
550
- s,
556
+ [s.points],
557
+ e,
558
+ n,
551
559
  a
552
560
  ).vertices,
553
- uvs: e
561
+ uvs: t
554
562
  };
555
563
  }
556
- const ue = ({
557
- polygonGeoJson: n,
558
- startHeight: t,
559
- endHeight: e,
564
+ const ut = ({
565
+ polygonGeoJson: s,
566
+ startHeight: e,
567
+ endHeight: t,
560
568
  curvatureResolution: i = 1,
561
- cartesian: s = !0,
569
+ cartesian: n = !0,
562
570
  hasSide: a = !0,
563
571
  hasBottom: l = !1,
564
572
  hasTop: r = !1,
565
573
  projection: o,
566
574
  bbox: c
567
575
  }) => {
568
- n.forEach((w) => {
569
- Kt(w) || w.reverse();
576
+ s.forEach((w) => {
577
+ Ke(w) || w.reverse();
570
578
  });
571
- const { contour: f, triangles: d } = ce(n, {
579
+ const { contour: f, triangles: d } = ct(s, {
572
580
  resolution: i,
573
581
  bbox: c,
574
582
  projection: o
575
583
  });
576
584
  let h = {}, u;
577
- a && (h = le(
585
+ a && (h = lt(
578
586
  f,
579
- t != null ? t : e,
580
587
  e != null ? e : t,
581
- s,
588
+ t != null ? t : e,
589
+ n,
582
590
  o
583
591
  ), u = h.topVerts);
584
592
  let m = [];
585
593
  (l || r) && (m = H(d.uvs));
586
594
  let p = {};
587
- l && (p = vt(
595
+ l && (p = ve(
588
596
  d,
589
- t,
597
+ e,
590
598
  m,
591
599
  !1,
592
- s,
600
+ n,
593
601
  o
594
602
  ));
595
603
  let v = {};
596
- return r && (v = vt(
604
+ return r && (v = ve(
597
605
  d,
598
- e,
606
+ t,
599
607
  m,
600
608
  !0,
601
- s,
609
+ n,
602
610
  o
603
611
  )), { contour: f, triangles: d, sideTorso: h, bottomCap: p, topCap: v, topVerts: u };
604
612
  };
605
- class ze extends Z {
606
- constructor(t, e = {}) {
607
- super(), this.type = "PolygonBufferGeometry", this.parameters = L({
608
- polygonGeoJson: t,
613
+ class zt extends Z {
614
+ constructor(e, t = {}) {
615
+ super(), this.type = "PolygonBufferGeometry", this.parameters = k({
616
+ polygonGeoJson: e,
609
617
  startHeight: 0,
610
618
  endHeight: 1,
611
619
  hasTop: !0,
@@ -615,33 +623,33 @@ class ze extends Z {
615
623
  curvatureResolution: 1,
616
624
  cartesian: !0,
617
625
  userDataRsoOffset: 0
618
- }, e);
626
+ }, t);
619
627
  const {
620
628
  endHeight: i,
621
- hasTop: s,
629
+ hasTop: n,
622
630
  topFirst: a,
623
631
  hasBottom: l,
624
632
  hasSide: r,
625
633
  cartesian: o,
626
634
  userDataRsoOffset: c,
627
635
  projection: f
628
- } = this.parameters, { contour: d, sideTorso: h, topVerts: u, bottomCap: m, topCap: p } = ue(L({}, this.parameters));
636
+ } = this.parameters, { contour: d, sideTorso: h, topVerts: u, bottomCap: m, topCap: p } = ut(k({}, this.parameters));
629
637
  let v = [], w = [], S = [], B = 0;
630
- const j = (b) => {
638
+ const j = (y) => {
631
639
  const x = Math.round(v.length / 3), A = S.length;
632
- v = v.concat(b.vertices), w = w.concat(b.uvs), S = S.concat(
633
- x ? b.indices.map((C) => C + x) : b.indices
640
+ v = v.concat(y.vertices), w = w.concat(y.uvs), S = S.concat(
641
+ x ? y.indices.map((C) => C + x) : y.indices
634
642
  ), this.addGroup(A, S.length - A, B++);
635
643
  };
636
- s && a && j(p), r && (j(h), this.userData.topVerts = c ? G(
644
+ n && a && j(p), r && (j(h), this.userData.topVerts = c ? G(
637
645
  d,
638
646
  i + c,
639
647
  o,
640
648
  f
641
- ).vertices : u), l && j(m), s && !a && j(p), this.setIndex(S), this[mt]("position", new R(v, 3)), this[mt]("uv", new R(w, 2)), this.computeVertexNormals();
649
+ ).vertices : u), l && j(m), n && !a && j(p), this.setIndex(S), this[me]("position", new R(v, 3)), this[me]("uv", new R(w, 2)), this.computeVertexNormals();
642
650
  }
643
651
  }
644
- const fe = `
652
+ const ft = `
645
653
  #include <fog_pars_fragment>
646
654
  #include <logdepthbuf_pars_fragment>
647
655
 
@@ -685,7 +693,7 @@ void main() {
685
693
  #include <tonemapping_fragment>
686
694
  #include <colorspace_fragment>
687
695
  }
688
- `, de = `
696
+ `, dt = `
689
697
  #include <common>
690
698
  #include <logdepthbuf_pars_vertex>
691
699
  #include <fog_pars_vertex>
@@ -778,12 +786,12 @@ void main() {
778
786
  #include <fog_vertex>
779
787
  }
780
788
  `;
781
- class _e extends zt {
782
- constructor(t = {}) {
783
- const S = t, {
784
- lineWidth: e = 1,
789
+ class Ot extends ze {
790
+ constructor(e = {}) {
791
+ const S = e, {
792
+ lineWidth: t = 1,
785
793
  color: i = "#ffffff",
786
- opacity: s = 1,
794
+ opacity: n = 1,
787
795
  map: a = null,
788
796
  dashOffset: l = 0,
789
797
  dashArray: r = 0,
@@ -796,7 +804,7 @@ class _e extends zt {
796
804
  alphaTest: m = 0,
797
805
  repeat: p = new q(1, 1),
798
806
  resolution: v = new q(1, 1)
799
- } = S, w = nt(S, [
807
+ } = S, w = se(S, [
800
808
  "lineWidth",
801
809
  "color",
802
810
  "opacity",
@@ -813,11 +821,11 @@ class _e extends zt {
813
821
  "repeat",
814
822
  "resolution"
815
823
  ]);
816
- super($(L({}, w), {
824
+ super($(k({}, w), {
817
825
  uniforms: {
818
- lineWidth: { value: e },
819
- color: { value: new lt(i) },
820
- opacity: { value: s },
826
+ lineWidth: { value: t },
827
+ color: { value: new le(i) },
828
+ opacity: { value: n },
821
829
  map: { value: a },
822
830
  useMap: { value: a ? 1 : 0 },
823
831
  resolution: { value: v },
@@ -834,73 +842,73 @@ class _e extends zt {
834
842
  useAlphaMap: { value: u ? 1 : 0 },
835
843
  repeat: { value: p }
836
844
  },
837
- vertexShader: de,
838
- fragmentShader: fe
845
+ vertexShader: dt,
846
+ fragmentShader: ft
839
847
  })), this.type = "MeshLineMaterial";
840
848
  }
841
849
  // Getter and setter for color
842
850
  get color() {
843
851
  return this.uniforms.color.value;
844
852
  }
845
- set color(t) {
846
- this.uniforms.color.value = new lt(t);
853
+ set color(e) {
854
+ this.uniforms.color.value = new le(e);
847
855
  }
848
856
  get opacity() {
849
- var t;
850
- return ((t = this.uniforms) == null ? void 0 : t.opacity.value) || 1;
857
+ var e;
858
+ return ((e = this.uniforms) == null ? void 0 : e.opacity.value) || 1;
851
859
  }
852
- set opacity(t) {
853
- this.uniforms && (this.uniforms.opacity.value = t);
860
+ set opacity(e) {
861
+ this.uniforms && (this.uniforms.opacity.value = e);
854
862
  }
855
863
  get alphaTest() {
856
864
  return this.uniforms.alphaTest.value;
857
865
  }
858
- set alphaTest(t) {
859
- this.uniforms && (this.uniforms.alphaTest.value = t);
866
+ set alphaTest(e) {
867
+ this.uniforms && (this.uniforms.alphaTest.value = e);
860
868
  }
861
869
  // Getter and setter for map
862
870
  get map() {
863
871
  return this.uniforms.map.value;
864
872
  }
865
- set map(t) {
866
- this.uniforms.map.value = t, this.uniforms.useMap.value = t ? 1 : 0;
873
+ set map(e) {
874
+ this.uniforms.map.value = e, this.uniforms.useMap.value = e ? 1 : 0;
867
875
  }
868
876
  get repeat() {
869
877
  return this.uniforms.repeat.value;
870
878
  }
871
- set repeat(t) {
872
- this.uniforms.repeat.value.copy(t);
879
+ set repeat(e) {
880
+ this.uniforms.repeat.value.copy(e);
873
881
  }
874
882
  // Getter and setter for lineWidth
875
883
  get lineWidth() {
876
884
  return this.uniforms.lineWidth.value;
877
885
  }
878
- set lineWidth(t) {
879
- this.uniforms.lineWidth.value = t;
886
+ set lineWidth(e) {
887
+ this.uniforms.lineWidth.value = e;
880
888
  }
881
889
  // Getter and setter for sizeAttenuation
882
890
  get sizeAttenuation() {
883
891
  return this.uniforms.sizeAttenuation.value === 1;
884
892
  }
885
- set sizeAttenuation(t) {
886
- this.uniforms.sizeAttenuation.value = t ? 1 : 0;
893
+ set sizeAttenuation(e) {
894
+ this.uniforms.sizeAttenuation.value = e ? 1 : 0;
887
895
  }
888
896
  }
889
- const K = new O(), bt = new I(), gt = new I(), g = new O(), y = new O(), D = new O(), Q = new I(), X = new _t(), M = new Et(), yt = new I(), W = new St(), U = new Lt(), T = new O();
890
- let z, E;
891
- function Mt(n, t, e) {
892
- return T.set(0, 0, -t, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = E / e.width, T.y = E / e.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
897
+ const K = new E(), ye = new P(), be = new P(), b = new E(), g = new E(), D = new E(), Q = new P(), X = new Oe(), M = new _e(), ge = new P(), U = new Se(), W = new ke(), T = new E();
898
+ let z, _;
899
+ function Me(s, e, t) {
900
+ return T.set(0, 0, -e, 1).applyMatrix4(s.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = _ / t.width, T.y = _ / t.height, T.applyMatrix4(s.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
893
901
  }
894
- function he(n, t) {
895
- const e = n.matrixWorld, i = n.geometry, s = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, s.count);
902
+ function ht(s, e) {
903
+ const t = s.matrixWorld, i = s.geometry, n = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, n.count);
896
904
  for (let r = 0, o = l; r < o; r++) {
897
- M.start.fromBufferAttribute(s, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(e);
898
- const c = new I(), f = new I();
899
- z.distanceSqToSegment(M.start, M.end, f, c), f.distanceTo(c) < E * 0.5 && t.push({
905
+ M.start.fromBufferAttribute(n, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(t);
906
+ const c = new P(), f = new P();
907
+ z.distanceSqToSegment(M.start, M.end, f, c), f.distanceTo(c) < _ * 0.5 && e.push({
900
908
  point: f,
901
909
  pointOnLine: c,
902
910
  distance: z.origin.distanceTo(f),
903
- object: n,
911
+ object: s,
904
912
  face: null,
905
913
  faceIndex: r,
906
914
  uv: null,
@@ -908,31 +916,31 @@ function he(n, t) {
908
916
  });
909
917
  }
910
918
  }
911
- function pe(n, t, e) {
912
- const i = t.projectionMatrix, a = n.material.resolution, l = n.matrixWorld, r = n.geometry, o = r.attributes.instanceStart, c = r.attributes.instanceEnd, f = Math.min(r.instanceCount, o.count), d = -t.near;
913
- z.at(1, D), D.w = 1, D.applyMatrix4(t.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= a.x / 2, D.y *= a.y / 2, D.z = 0, Q.copy(D), X.multiplyMatrices(t.matrixWorldInverse, l);
919
+ function pt(s, e, t) {
920
+ const i = e.projectionMatrix, a = s.material.resolution, l = s.matrixWorld, r = s.geometry, o = r.attributes.instanceStart, c = r.attributes.instanceEnd, f = Math.min(r.instanceCount, o.count), d = -e.near;
921
+ z.at(1, D), D.w = 1, D.applyMatrix4(e.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= a.x / 2, D.y *= a.y / 2, D.z = 0, Q.copy(D), X.multiplyMatrices(e.matrixWorldInverse, l);
914
922
  for (let h = 0, u = f; h < u; h++) {
915
- if (g.fromBufferAttribute(o, h), y.fromBufferAttribute(c, h), g.w = 1, y.w = 1, g.applyMatrix4(X), y.applyMatrix4(X), g.z > d && y.z > d)
923
+ if (b.fromBufferAttribute(o, h), g.fromBufferAttribute(c, h), b.w = 1, g.w = 1, b.applyMatrix4(X), g.applyMatrix4(X), b.z > d && g.z > d)
916
924
  continue;
917
- if (g.z > d) {
918
- const B = g.z - y.z, j = (g.z - d) / B;
919
- g.lerp(y, j);
920
- } else if (y.z > d) {
921
- const B = y.z - g.z, j = (y.z - d) / B;
922
- y.lerp(g, j);
925
+ if (b.z > d) {
926
+ const B = b.z - g.z, j = (b.z - d) / B;
927
+ b.lerp(g, j);
928
+ } else if (g.z > d) {
929
+ const B = g.z - b.z, j = (g.z - d) / B;
930
+ g.lerp(b, j);
923
931
  }
924
- g.applyMatrix4(i), y.applyMatrix4(i), g.multiplyScalar(1 / g.w), y.multiplyScalar(1 / y.w), g.x *= a.x / 2, g.y *= a.y / 2, y.x *= a.x / 2, y.y *= a.y / 2, M.start.copy(g), M.start.z = 0, M.end.copy(y), M.end.z = 0;
932
+ b.applyMatrix4(i), g.applyMatrix4(i), b.multiplyScalar(1 / b.w), g.multiplyScalar(1 / g.w), b.x *= a.x / 2, b.y *= a.y / 2, g.x *= a.x / 2, g.y *= a.y / 2, M.start.copy(b), M.start.z = 0, M.end.copy(g), M.end.z = 0;
925
933
  const p = M.closestPointToPointParameter(Q, !0);
926
- M.at(p, yt);
927
- const v = Vt.lerp(g.z, y.z, p), w = v >= -1 && v <= 1, S = Q.distanceTo(yt) < E * 0.5;
934
+ M.at(p, ge);
935
+ const v = Le.lerp(b.z, g.z, p), w = v >= -1 && v <= 1, S = Q.distanceTo(ge) < _ * 0.5;
928
936
  if (w && S) {
929
937
  M.start.fromBufferAttribute(o, h), M.end.fromBufferAttribute(c, h), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
930
- const B = new I(), j = new I();
931
- z.distanceSqToSegment(M.start, M.end, j, B), e.push({
938
+ const B = new P(), j = new P();
939
+ z.distanceSqToSegment(M.start, M.end, j, B), t.push({
932
940
  point: j,
933
941
  pointOnLine: B,
934
942
  distance: z.origin.distanceTo(j),
935
- object: n,
943
+ object: s,
936
944
  face: null,
937
945
  faceIndex: h,
938
946
  uv: null,
@@ -941,82 +949,82 @@ function pe(n, t, e) {
941
949
  }
942
950
  }
943
951
  }
944
- class Ee extends wt {
945
- constructor(t = new Zt(), e) {
946
- super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
952
+ class _t extends we {
953
+ constructor(e = new Ze(), t) {
954
+ super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
947
955
  }
948
956
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
949
957
  computeLineDistances() {
950
- const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, s = new Float32Array(2 * e.count);
951
- for (let l = 0, r = 0, o = e.count; l < o; l++, r += 2)
952
- bt.fromBufferAttribute(e, l), gt.fromBufferAttribute(i, l), s[r] = r === 0 ? 0 : s[r - 1], s[r + 1] = s[r] + bt.distanceTo(gt);
953
- const a = new Ot(
954
- s,
958
+ const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, n = new Float32Array(2 * t.count);
959
+ for (let l = 0, r = 0, o = t.count; l < o; l++, r += 2)
960
+ ye.fromBufferAttribute(t, l), be.fromBufferAttribute(i, l), n[r] = r === 0 ? 0 : n[r - 1], n[r + 1] = n[r] + ye.distanceTo(be);
961
+ const a = new Ee(
962
+ n,
955
963
  2,
956
964
  1
957
965
  );
958
- return t.setAttribute(
966
+ return e.setAttribute(
959
967
  "instanceDistanceStart",
960
- new ut(a, 1, 0)
961
- ), t.setAttribute(
968
+ new ue(a, 1, 0)
969
+ ), e.setAttribute(
962
970
  "instanceDistanceEnd",
963
- new ut(a, 1, 1)
971
+ new ue(a, 1, 1)
964
972
  ), this;
965
973
  }
966
- raycast(t, e) {
967
- const i = this.material.worldUnits, s = t.camera;
968
- s === null && !i && console.error(
974
+ raycast(e, t) {
975
+ const i = this.material.worldUnits, n = e.camera;
976
+ n === null && !i && console.error(
969
977
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
970
978
  );
971
- const a = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
972
- z = t.ray;
979
+ const a = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
980
+ z = e.ray;
973
981
  const l = this.matrixWorld, r = this.geometry, o = this.material;
974
- E = o.linewidth + a, r.boundingSphere === null && r.computeBoundingSphere(), U.copy(r.boundingSphere).applyMatrix4(l);
982
+ _ = o.linewidth + a, r.boundingSphere === null && r.computeBoundingSphere(), W.copy(r.boundingSphere).applyMatrix4(l);
975
983
  let c;
976
984
  if (i)
977
- c = E * 0.5;
985
+ c = _ * 0.5;
978
986
  else {
979
987
  const d = Math.max(
980
- s.near,
981
- U.distanceToPoint(z.origin)
988
+ n.near,
989
+ W.distanceToPoint(z.origin)
982
990
  );
983
- c = Mt(
984
- s,
991
+ c = Me(
992
+ n,
985
993
  d,
986
994
  o.resolution
987
995
  );
988
996
  }
989
- if (U.radius += c, z.intersectsSphere(U) === !1)
997
+ if (W.radius += c, z.intersectsSphere(W) === !1)
990
998
  return;
991
- r.boundingBox === null && r.computeBoundingBox(), W.copy(r.boundingBox).applyMatrix4(l);
999
+ r.boundingBox === null && r.computeBoundingBox(), U.copy(r.boundingBox).applyMatrix4(l);
992
1000
  let f;
993
1001
  if (i)
994
- f = E * 0.5;
1002
+ f = _ * 0.5;
995
1003
  else {
996
1004
  const d = Math.max(
997
- s.near,
998
- W.distanceToPoint(z.origin)
1005
+ n.near,
1006
+ U.distanceToPoint(z.origin)
999
1007
  );
1000
- f = Mt(
1001
- s,
1008
+ f = Me(
1009
+ n,
1002
1010
  d,
1003
1011
  o.resolution
1004
1012
  );
1005
1013
  }
1006
- W.expandByScalar(f), z.intersectsBox(W) !== !1 && (i ? he(this, e) : pe(this, s, e));
1014
+ U.expandByScalar(f), z.intersectsBox(U) !== !1 && (i ? ht(this, t) : pt(this, n, t));
1007
1015
  }
1008
- onBeforeRender(t) {
1009
- const e = this.material.uniforms;
1010
- e && e.resolution && (t.getViewport(K), this.material.uniforms.resolution.value.set(K.z, K.w));
1016
+ onBeforeRender(e) {
1017
+ const t = this.material.uniforms;
1018
+ t && t.resolution && (e.getViewport(K), this.material.uniforms.resolution.value.set(K.z, K.w));
1011
1019
  }
1012
1020
  }
1013
1021
  export {
1014
- De as B,
1015
- Te as I,
1016
- Ee as L,
1017
- _e as M,
1018
- ze as P,
1019
- te as R,
1020
- pt as a,
1021
- ue as g
1022
+ Dt as B,
1023
+ Tt as I,
1024
+ _t as L,
1025
+ Ot as M,
1026
+ zt as P,
1027
+ et as R,
1028
+ pe as a,
1029
+ ut as g
1022
1030
  };