gl-draw 0.15.19 → 0.15.21

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,365 +1,450 @@
1
- var Jt = Object.defineProperty, Xt = Object.defineProperties;
2
- var Qt = Object.getOwnPropertyDescriptors;
3
- var lt = Object.getOwnPropertySymbols;
4
- var Vt = Object.prototype.hasOwnProperty, Bt = Object.prototype.propertyIsEnumerable;
5
- var It = (a, t, e) => t in a ? Jt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, G = (a, t) => {
6
- for (var e in t || (t = {}))
7
- Vt.call(t, e) && It(a, e, t[e]);
8
- if (lt)
9
- for (var e of lt(t))
10
- Bt.call(t, e) && It(a, e, t[e]);
11
- return a;
12
- }, ut = (a, t) => Xt(a, Qt(t));
13
- var gt = (a, t) => {
14
- var e = {};
15
- for (var s in a)
16
- Vt.call(a, s) && t.indexOf(s) < 0 && (e[s] = a[s]);
17
- if (a != null && lt)
18
- for (var s of lt(a))
19
- t.indexOf(s) < 0 && Bt.call(a, s) && (e[s] = a[s]);
20
- return e;
1
+ var Ze = Object.defineProperty, $e = Object.defineProperties;
2
+ var Je = Object.getOwnPropertyDescriptors;
3
+ var he = Object.getOwnPropertySymbols;
4
+ var Ie = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable;
5
+ var ze = (m, e, t) => e in m ? Ze(m, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[e] = t, j = (m, e) => {
6
+ for (var t in e || (e = {}))
7
+ Ie.call(e, t) && ze(m, t, e[t]);
8
+ if (he)
9
+ for (var t of he(e))
10
+ Be.call(e, t) && ze(m, t, e[t]);
11
+ return m;
12
+ }, ue = (m, e) => $e(m, Je(e));
13
+ var ge = (m, e) => {
14
+ var t = {};
15
+ for (var n in m)
16
+ Ie.call(m, n) && e.indexOf(n) < 0 && (t[n] = m[n]);
17
+ if (m != null && he)
18
+ for (var n of he(m))
19
+ e.indexOf(n) < 0 && Be.call(m, n) && (t[n] = m[n]);
20
+ return t;
21
21
  };
22
- var nt = (a, t, e) => new Promise((s, i) => {
23
- var n = (h) => {
22
+ var ie = (m, e, t) => new Promise((n, s) => {
23
+ var i = (r) => {
24
24
  try {
25
- l(e.next(h));
26
- } catch (b) {
27
- i(b);
25
+ f(t.next(r));
26
+ } catch (h) {
27
+ s(h);
28
28
  }
29
- }, r = (h) => {
29
+ }, a = (r) => {
30
30
  try {
31
- l(e.throw(h));
32
- } catch (b) {
33
- i(b);
31
+ f(t.throw(r));
32
+ } catch (h) {
33
+ s(h);
34
34
  }
35
- }, l = (h) => h.done ? s(h.value) : Promise.resolve(h.value).then(n, r);
36
- l((e = e.apply(a, t)).next());
35
+ }, f = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(i, a);
36
+ f((t = t.apply(m, e)).next());
37
37
  });
38
- import { a as q, L as Yt, M as Zt, P as Kt } from "../index.module2.js";
39
- import { g as as } from "../index.module2.js";
40
- import { BufferGeometry as ot, Float32BufferAttribute as wt, Vector3 as F, ShapeUtils as dt, Shape as xt, Vector2 as P, ArcCurve as te, CatmullRomCurve3 as ee, CubicBezierCurve as se, CubicBezierCurve3 as ie, EllipseCurve as ne, LineCurve as oe, LineCurve3 as re, QuadraticBezierCurve as ae, QuadraticBezierCurve3 as he, SplineCurve as ce, MeshBasicMaterial as le, Mesh as ue, AmbientLight as de, DirectionalLight as pe, PointLight as fe, SpotLight as me, HemisphereLight as ge, RectAreaLight as ye, LineSegments as be, Color as Nt, Matrix4 as we, BufferAttribute as $, Box3 as xe, PlaneGeometry as ve, CanvasTexture as Ae } from "three";
41
- import * as et from "@tweenjs/tween.js";
42
- import { RectAreaLightUniformsLib as Se } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
43
- import { mergeAttributes as zt, mergeGroups as _e } from "three/examples/jsm/utils/BufferGeometryUtils";
44
- import { LineSegments2 as Me } from "three/examples/jsm/lines/LineSegments2";
45
- import { LineSegmentsGeometry as Le } from "three/examples/jsm/lines/LineSegmentsGeometry";
46
- import { LineSegmentsGeometry as cs } from "three/examples/jsm/lines/LineSegmentsGeometry";
47
- import { LineMaterial as Te } from "three/examples/jsm/lines/LineMaterial";
48
- import { LineMaterial as us } from "three/examples/jsm/lines/LineMaterial";
49
- import { g as Ee, c as Pe } from "../uvGenerator.module.js";
50
- import { Brush as Rt, Evaluator as je, INTERSECTION as Ge } from "three-bvh-csg";
51
- class Xe extends q {
52
- constructor(t) {
53
- super(), this.objectType = "BaseObject#Node", this.onNodePointerIndex = [], this.options = G({
54
- type: "2d"
55
- }, t);
56
- }
57
- create() {
58
- const { position: t, children: e } = this.options, s = document.createElement("div");
59
- this.element = s, e && s.appendChild(e), this.options.type === "3d" ? this.createCSS3DObject(s) : this.options.type === "3dSprite" ? this.createCSS3DSprite(s) : this.createCSS2DObject(s), t && this.object3d.position.copy(t);
60
- }
61
- setChildren(t) {
62
- this.options.children = t, this.element.innerHTML = "", this.element.appendChild(t);
63
- }
64
- showAndEnsureVisible() {
65
- const t = this.options.children;
66
- t && (t.style.visibility = "hidden", this.show(), setTimeout(() => {
67
- t.style.visibility = "", this.ensureVisible();
68
- }));
69
- }
70
- moveElementToViewport() {
71
- const t = this.options.children;
72
- if (!t) return;
73
- const e = t.getBoundingClientRect(), s = window.innerWidth, i = window.innerHeight;
74
- let n = 0, r = 0;
75
- e.left < 0 ? n = -e.left : e.right > s && (n = s - e.right), e.top < 0 ? r = -e.top : e.bottom > i && (r = i - e.bottom), e.left + n < 0 && (n = -e.left), e.top + r < 0 && (r = -e.top), (n !== 0 || r !== 0) && (t.style.transform = `translate(${n}px, ${r}px)`);
38
+ import { LineMaterial as Qe } from "three/examples/jsm/lines/LineMaterial";
39
+ import { LineMaterial as ln } from "three/examples/jsm/lines/LineMaterial";
40
+ import { LineSegmentsGeometry as Ke } from "three/examples/jsm/lines/LineSegmentsGeometry";
41
+ import { LineSegmentsGeometry as un } from "three/examples/jsm/lines/LineSegmentsGeometry";
42
+ import { P as et, a as Z, M as tt, L as nt } from "../WebGPULineSegments2.module.js";
43
+ import { g as fn } from "../WebGPULineSegments2.module.js";
44
+ import { BufferGeometry as fe, Float32BufferAttribute as be, Vector3 as _, ShapeUtils as de, Shape as xe, Vector2 as G, ArcCurve as st, CatmullRomCurve3 as ot, CubicBezierCurve as it, CubicBezierCurve3 as rt, EllipseCurve as at, LineCurve as ct, LineCurve3 as lt, QuadraticBezierCurve as ht, QuadraticBezierCurve3 as ut, SplineCurve as dt, Box3 as ft, PlaneGeometry as pt, CanvasTexture as mt, AmbientLight as gt, DirectionalLight as yt, PointLight as bt, SpotLight as xt, HemisphereLight as wt, RectAreaLight as vt, Matrix4 as Ve, BufferAttribute as Y, Ray as St, Sphere as At, LineSegments as Xe, Color as Ne, MeshBasicMaterial as Mt, Mesh as Lt } from "three";
45
+ import { mergeAttributes as Re, mergeGroups as Tt } from "three/examples/jsm/utils/BufferGeometryUtils";
46
+ import { g as Et, c as Ct } from "../uvGenerator.module.js";
47
+ import { Brush as Oe, Evaluator as Gt, INTERSECTION as Pt } from "three-bvh-csg";
48
+ import { RectAreaLightUniformsLib as _t } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
49
+ import * as ne from "@tweenjs/tween.js";
50
+ import { LineSegments2 as jt } from "three/examples/jsm/lines/LineSegments2";
51
+ function H(m, e = 0) {
52
+ const t = m[0].index !== null, n = new Set(Object.keys(m[0].attributes)), s = new Set(
53
+ Object.keys(m[0].morphAttributes)
54
+ ), i = {}, a = {}, f = m[0].morphTargetsRelative, r = new fe();
55
+ let h = 0;
56
+ for (let o = 0; o < m.length; ++o) {
57
+ const c = m[o];
58
+ let y = 0;
59
+ if (t !== (c.index !== null))
60
+ return console.error(
61
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."
62
+ ), null;
63
+ for (const u in c.attributes) {
64
+ if (!n.has(u))
65
+ return console.error(
66
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + '. All geometries must have compatible attributes; make sure "' + u + '" attribute exists among all geometries, or in none of them.'
67
+ ), null;
68
+ i[u] === void 0 && (i[u] = []), i[u].push(c.attributes[u]), y++;
69
+ }
70
+ if (y !== n.size)
71
+ return console.error(
72
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". Make sure all geometries have the same number of attributes."
73
+ ), null;
74
+ if (f !== c.morphTargetsRelative)
75
+ return console.error(
76
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphTargetsRelative must be consistent throughout all geometries."
77
+ ), null;
78
+ for (const u in c.morphAttributes) {
79
+ if (!s.has(u))
80
+ return console.error(
81
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphAttributes must be consistent throughout all geometries."
82
+ ), null;
83
+ a[u] === void 0 && (a[u] = []), a[u].push(c.morphAttributes[u]);
84
+ }
85
+ if (e) {
86
+ let u;
87
+ if (t)
88
+ u = c.index.count;
89
+ else if (c.attributes.position !== void 0)
90
+ u = c.attributes.position.count;
91
+ else
92
+ return console.error(
93
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". The geometry must have either an index or a position attribute"
94
+ ), null;
95
+ if (e === 1)
96
+ r.addGroup(h, u, o);
97
+ else if (e === 2 && c.groups.length > 0)
98
+ for (let g of c.groups) {
99
+ let L = g.materialIndex;
100
+ r.addGroup(
101
+ h + g.start,
102
+ Math.min(g.count, u),
103
+ L
104
+ );
105
+ }
106
+ h += u;
107
+ }
76
108
  }
77
- ensureVisible() {
78
- const t = this.options.children;
79
- if (!t) return;
80
- t.style.transform && (t.style.transform = "");
81
- const e = new IntersectionObserver((s) => {
82
- s.forEach((i) => {
83
- i.isIntersecting && (this.moveElementToViewport(), e.disconnect());
84
- });
85
- });
86
- e.observe(t);
109
+ if (t) {
110
+ let o = 0;
111
+ const c = [];
112
+ for (let y = 0; y < m.length; ++y) {
113
+ const u = m[y].index;
114
+ for (let g = 0; g < u.count; ++g)
115
+ c.push(u.getX(g) + o);
116
+ o += m[y].attributes.position.count;
117
+ }
118
+ r.setIndex(c);
87
119
  }
88
- onPointerEvent(t, e) {
89
- const s = this.lead.handlePickNode([this], t, e);
90
- this.onNodePointerIndex.push(s);
120
+ for (const o in i) {
121
+ const c = Re(i[o]);
122
+ if (!c)
123
+ return console.error(
124
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " attribute."
125
+ ), null;
126
+ r.setAttribute(o, c);
91
127
  }
92
- dispose() {
93
- this.onNodePointerIndex.forEach((t) => {
94
- this.lead.removePickNode(t);
95
- }), super.dispose();
128
+ for (const o in a) {
129
+ const c = a[o][0].length;
130
+ if (c === 0) break;
131
+ r.morphAttributes = r.morphAttributes || {}, r.morphAttributes[o] = [];
132
+ for (let y = 0; y < c; ++y) {
133
+ const u = [];
134
+ for (let L = 0; L < a[o].length; ++L)
135
+ u.push(a[o][L][y]);
136
+ const g = Re(u);
137
+ if (!g)
138
+ return console.error(
139
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " morphAttribute."
140
+ ), null;
141
+ r.morphAttributes[o].push(g);
142
+ }
96
143
  }
144
+ return e === 2 ? Tt(r) : r;
97
145
  }
98
- class Qe extends q {
146
+ const Ue = (m) => {
147
+ const f = m, { coordinate: e, startHeight: t, height: n } = f, s = ge(f, ["coordinate", "startHeight", "height"]);
148
+ let i = t || 0;
149
+ return typeof t != "undefined" && typeof n != "undefined" && (i = t + n), new et([e], ue(j({}, s), {
150
+ startHeight: t,
151
+ endHeight: i
152
+ }));
153
+ };
154
+ class Zt extends Z {
155
+ constructor(e) {
156
+ super(), this.options = j({}, e);
157
+ }
99
158
  create() {
100
- this.createGroup();
159
+ const r = this.options, {
160
+ geometry: e,
161
+ coordinateArr: t,
162
+ coordinate: n,
163
+ material: s,
164
+ useGroups: i
165
+ } = r, a = ge(r, [
166
+ "geometry",
167
+ "coordinateArr",
168
+ "coordinate",
169
+ "material",
170
+ "useGroups"
171
+ ]);
172
+ let f = e;
173
+ if (!f && n)
174
+ f = Ue(j({
175
+ coordinate: n
176
+ }, a));
177
+ else if (!f && t) {
178
+ const h = t.map(
179
+ (o) => Ue(j({
180
+ coordinate: o
181
+ }, a))
182
+ );
183
+ f = H(h, i != null ? i : 0);
184
+ }
185
+ this.createMesh(f, s);
101
186
  }
102
187
  }
103
- const Ue = {
104
- ArcCurve: te,
105
- CatmullRomCurve3: ee,
106
- CubicBezierCurve: se,
107
- CubicBezierCurve3: ie,
108
- EllipseCurve: ne,
109
- LineCurve: oe,
110
- LineCurve3: re,
111
- QuadraticBezierCurve: ae,
112
- QuadraticBezierCurve3: he,
113
- SplineCurve: ce
188
+ const zt = {
189
+ ArcCurve: st,
190
+ CatmullRomCurve3: ot,
191
+ CubicBezierCurve: it,
192
+ CubicBezierCurve3: rt,
193
+ EllipseCurve: at,
194
+ LineCurve: ct,
195
+ LineCurve3: lt,
196
+ QuadraticBezierCurve: ht,
197
+ QuadraticBezierCurve3: ut,
198
+ SplineCurve: dt
114
199
  };
115
- class Z extends ot {
200
+ class K extends fe {
116
201
  /**
117
202
  * Constructs a new extrude geometry.
118
203
  *
119
204
  * @param {Shape|Array<Shape>} [shapes] - A shape or an array of shapes.
120
205
  * @param {ExtrudeGeometry~Options} [options] - The extrude settings.
121
206
  */
122
- constructor(t = new xt([
123
- new P(0.5, 0.5),
124
- new P(-0.5, 0.5),
125
- new P(-0.5, -0.5),
126
- new P(0.5, -0.5)
127
- ]), e = {}) {
207
+ constructor(e = new xe([
208
+ new G(0.5, 0.5),
209
+ new G(-0.5, 0.5),
210
+ new G(-0.5, -0.5),
211
+ new G(0.5, -0.5)
212
+ ]), t = {}) {
128
213
  super(), this.type = "ExtrudeGeometry", this.parameters = {
129
- shapes: t,
130
- options: e
131
- }, t = Array.isArray(t) ? t : [t];
132
- const s = this, i = [], n = [];
133
- for (let l = 0, h = t.length; l < h; l++) {
134
- const b = t[l];
135
- r(b);
214
+ shapes: e,
215
+ options: t
216
+ }, e = Array.isArray(e) ? e : [e];
217
+ const n = this, s = [], i = [];
218
+ for (let f = 0, r = e.length; f < r; f++) {
219
+ const h = e[f];
220
+ a(h);
136
221
  }
137
- this.setAttribute("position", new wt(i, 3)), this.setAttribute("uv", new wt(n, 2)), this.computeVertexNormals();
138
- function r(l) {
139
- var Lt, Tt, Et;
140
- const h = [], b = e.curveSegments !== void 0 ? e.curveSegments : 12, o = e.steps !== void 0 ? e.steps : 1, u = e.depth !== void 0 ? e.depth : 1;
141
- let y = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, f = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, w = e.bevelSize !== void 0 ? e.bevelSize : f - 0.1, M = e.bevelOffset !== void 0 ? e.bevelOffset : 0, _ = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
142
- const S = e.extrudePath, j = e.UVGenerator !== void 0 ? e.UVGenerator : Ce, v = (Lt = e.hasTop) != null ? Lt : !0, B = (Tt = e.hasBottom) != null ? Tt : !0, pt = (Et = e.hasSide) != null ? Et : !0;
143
- let J, K = !1, X, st, it, D;
144
- S && (J = S.getSpacedPoints(o), K = !0, y = !1, X = S.computeFrenetFrames(o, !1), st = new F(), it = new F(), D = new F()), y || (_ = 0, f = 0, w = 0, M = 0);
145
- const vt = l.extractPoints(b);
146
- let V = vt.shape;
147
- const U = vt.holes;
148
- if (!dt.isClockWise(V)) {
149
- V = V.reverse();
150
- for (let c = 0, d = U.length; c < d; c++) {
151
- const p = U[c];
152
- dt.isClockWise(p) && (U[c] = p.reverse());
222
+ this.setAttribute("position", new be(s, 3)), this.setAttribute("uv", new be(i, 2)), this.computeVertexNormals();
223
+ function a(f) {
224
+ var Le, Te, Ee;
225
+ const r = [], h = t.curveSegments !== void 0 ? t.curveSegments : 12, o = t.steps !== void 0 ? t.steps : 1, c = t.depth !== void 0 ? t.depth : 1;
226
+ let y = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, u = t.bevelThickness !== void 0 ? t.bevelThickness : 0.2, g = t.bevelSize !== void 0 ? t.bevelSize : u - 0.1, L = t.bevelOffset !== void 0 ? t.bevelOffset : 0, S = t.bevelSegments !== void 0 ? t.bevelSegments : 3;
227
+ const A = t.extrudePath, P = t.UVGenerator !== void 0 ? t.UVGenerator : It, v = (Le = t.hasTop) != null ? Le : !0, z = (Te = t.hasBottom) != null ? Te : !0, ee = (Ee = t.hasSide) != null ? Ee : !0;
228
+ let V, $ = !1, U, se, oe, X;
229
+ A && (V = A.getSpacedPoints(o), $ = !0, y = !1, U = A.computeFrenetFrames(o, !1), se = new _(), oe = new _(), X = new _()), y || (S = 0, u = 0, g = 0, L = 0);
230
+ const we = f.extractPoints(h);
231
+ let O = we.shape;
232
+ const I = we.holes;
233
+ if (!de.isClockWise(O)) {
234
+ O = O.reverse();
235
+ for (let l = 0, d = I.length; l < d; l++) {
236
+ const p = I[l];
237
+ de.isClockWise(p) && (I[l] = p.reverse());
153
238
  }
154
239
  }
155
- function At(c) {
240
+ function ve(l) {
156
241
  const p = 10000000000000001e-36;
157
- let g = c[0];
158
- for (let m = 1; m <= c.length; m++) {
159
- const A = m % c.length, x = c[A], L = x.x - g.x, T = x.y - g.y, E = L * L + T * T, C = Math.max(
242
+ let x = l[0];
243
+ for (let b = 1; b <= l.length; b++) {
244
+ const M = b % l.length, w = l[M], T = w.x - x.x, E = w.y - x.y, C = T * T + E * E, B = Math.max(
245
+ Math.abs(w.x),
246
+ Math.abs(w.y),
160
247
  Math.abs(x.x),
161
- Math.abs(x.y),
162
- Math.abs(g.x),
163
- Math.abs(g.y)
164
- ), Y = p * C * C;
165
- if (E <= Y) {
166
- c.splice(A, 1), m--;
248
+ Math.abs(x.y)
249
+ ), Q = p * B * B;
250
+ if (C <= Q) {
251
+ l.splice(M, 1), b--;
167
252
  continue;
168
253
  }
169
- g = x;
254
+ x = w;
170
255
  }
171
256
  }
172
- At(V), U.forEach(At);
173
- const ft = U.length, z = V;
174
- for (let c = 0; c < ft; c++) {
175
- const d = U[c];
176
- V = V.concat(d);
257
+ ve(O), I.forEach(ve);
258
+ const pe = I.length, D = O;
259
+ for (let l = 0; l < pe; l++) {
260
+ const d = I[l];
261
+ O = O.concat(d);
177
262
  }
178
- function tt(c, d, p) {
179
- return d || console.error("THREE.ExtrudeGeometry: vec does not exist"), c.clone().addScaledVector(d, p);
263
+ function te(l, d, p) {
264
+ return d || console.error("THREE.ExtrudeGeometry: vec does not exist"), l.clone().addScaledVector(d, p);
180
265
  }
181
- const O = V.length;
182
- function St(c, d, p) {
183
- let g, m, A;
184
- const x = c.x - d.x, L = c.y - d.y, T = p.x - c.x, E = p.y - c.y, C = x * x + L * L, Y = x * E - L * T;
185
- if (Math.abs(Y) > Number.EPSILON) {
186
- const I = Math.sqrt(C), Pt = Math.sqrt(
187
- T * T + E * E
188
- ), jt = d.x - L / I, Gt = d.y + x / I, $t = p.x - E / Pt, qt = p.y + T / Pt, Ut = (($t - jt) * E - (qt - Gt) * T) / (x * E - L * T);
189
- g = jt + x * Ut - c.x, m = Gt + L * Ut - c.y;
190
- const Ct = g * g + m * m;
191
- if (Ct <= 2)
192
- return new P(g, m);
193
- A = Math.sqrt(Ct / 2);
266
+ const N = O.length;
267
+ function Se(l, d, p) {
268
+ let x, b, M;
269
+ const w = l.x - d.x, T = l.y - d.y, E = p.x - l.x, C = p.y - l.y, B = w * w + T * T, Q = w * C - T * E;
270
+ if (Math.abs(Q) > Number.EPSILON) {
271
+ const R = Math.sqrt(B), Ce = Math.sqrt(
272
+ E * E + C * C
273
+ ), Ge = d.x - T / R, Pe = d.y + w / R, qe = p.x - C / Ce, Ye = p.y + E / Ce, _e = ((qe - Ge) * C - (Ye - Pe) * E) / (w * C - T * E);
274
+ x = Ge + w * _e - l.x, b = Pe + T * _e - l.y;
275
+ const je = x * x + b * b;
276
+ if (je <= 2)
277
+ return new G(x, b);
278
+ M = Math.sqrt(je / 2);
194
279
  } else {
195
- let I = !1;
196
- x > Number.EPSILON ? T > Number.EPSILON && (I = !0) : x < -Number.EPSILON ? T < -Number.EPSILON && (I = !0) : Math.sign(L) === Math.sign(E) && (I = !0), I ? (g = -L, m = x, A = Math.sqrt(C)) : (g = x, m = L, A = Math.sqrt(C / 2));
280
+ let R = !1;
281
+ w > Number.EPSILON ? E > Number.EPSILON && (R = !0) : w < -Number.EPSILON ? E < -Number.EPSILON && (R = !0) : Math.sign(T) === Math.sign(C) && (R = !0), R ? (x = -T, b = w, M = Math.sqrt(B)) : (x = w, b = T, M = Math.sqrt(B / 2));
197
282
  }
198
- return new P(g / A, m / A);
283
+ return new G(x / M, b / M);
199
284
  }
200
- const rt = [];
201
- for (let c = 0, d = z.length, p = d - 1, g = c + 1; c < d; c++, p++, g++)
202
- p === d && (p = 0), g === d && (g = 0), rt[c] = St(z[c], z[p], z[g]);
203
- const mt = [];
204
- let W, at = rt.concat();
205
- for (let c = 0, d = ft; c < d; c++) {
206
- const p = U[c];
207
- W = [];
208
- for (let g = 0, m = p.length, A = m - 1, x = g + 1; g < m; g++, A++, x++)
209
- A === m && (A = 0), x === m && (x = 0), W[g] = St(p[g], p[A], p[x]);
210
- mt.push(W), at = at.concat(W);
285
+ const re = [];
286
+ for (let l = 0, d = D.length, p = d - 1, x = l + 1; l < d; l++, p++, x++)
287
+ p === d && (p = 0), x === d && (x = 0), re[l] = Se(D[l], D[p], D[x]);
288
+ const me = [];
289
+ let q, ae = re.concat();
290
+ for (let l = 0, d = pe; l < d; l++) {
291
+ const p = I[l];
292
+ q = [];
293
+ for (let x = 0, b = p.length, M = b - 1, w = x + 1; x < b; x++, M++, w++)
294
+ M === b && (M = 0), w === b && (w = 0), q[x] = Se(p[x], p[M], p[w]);
295
+ me.push(q), ae = ae.concat(q);
211
296
  }
212
- let Q;
213
- if (_ === 0)
214
- Q = dt.triangulateShape(z, U);
297
+ let J;
298
+ if (S === 0)
299
+ J = de.triangulateShape(D, I);
215
300
  else {
216
- const c = [], d = [];
217
- for (let p = 0; p < _; p++) {
218
- const g = p / _, m = f * Math.cos(g * Math.PI / 2), A = w * Math.sin(g * Math.PI / 2) + M;
219
- for (let x = 0, L = z.length; x < L; x++) {
220
- const T = tt(z[x], rt[x], A);
221
- H(T.x, T.y, -m), g === 0 && c.push(T);
301
+ const l = [], d = [];
302
+ for (let p = 0; p < S; p++) {
303
+ const x = p / S, b = u * Math.cos(x * Math.PI / 2), M = g * Math.sin(x * Math.PI / 2) + L;
304
+ for (let w = 0, T = D.length; w < T; w++) {
305
+ const E = te(D[w], re[w], M);
306
+ W(E.x, E.y, -b), x === 0 && l.push(E);
222
307
  }
223
- for (let x = 0, L = ft; x < L; x++) {
224
- const T = U[x];
225
- W = mt[x];
226
- const E = [];
227
- for (let C = 0, Y = T.length; C < Y; C++) {
228
- const I = tt(T[C], W[C], A);
229
- H(I.x, I.y, -m), g === 0 && E.push(I);
308
+ for (let w = 0, T = pe; w < T; w++) {
309
+ const E = I[w];
310
+ q = me[w];
311
+ const C = [];
312
+ for (let B = 0, Q = E.length; B < Q; B++) {
313
+ const R = te(E[B], q[B], M);
314
+ W(R.x, R.y, -b), x === 0 && C.push(R);
230
315
  }
231
- g === 0 && d.push(E);
316
+ x === 0 && d.push(C);
232
317
  }
233
318
  }
234
- Q = dt.triangulateShape(
235
- c,
319
+ J = de.triangulateShape(
320
+ l,
236
321
  d
237
322
  );
238
323
  }
239
- const ht = Q.length, _t = w + M;
240
- for (let c = 0; c < O; c++) {
241
- const d = y ? tt(V[c], at[c], _t) : V[c];
242
- K ? (it.copy(X.normals[0]).multiplyScalar(d.x), st.copy(X.binormals[0]).multiplyScalar(d.y), D.copy(J[0]).add(it).add(st), H(D.x, D.y, D.z)) : H(d.x, d.y, 0);
324
+ const ce = J.length, Ae = g + L;
325
+ for (let l = 0; l < N; l++) {
326
+ const d = y ? te(O[l], ae[l], Ae) : O[l];
327
+ $ ? (oe.copy(U.normals[0]).multiplyScalar(d.x), se.copy(U.binormals[0]).multiplyScalar(d.y), X.copy(V[0]).add(oe).add(se), W(X.x, X.y, X.z)) : W(d.x, d.y, 0);
243
328
  }
244
- for (let c = 1; c <= o; c++)
245
- for (let d = 0; d < O; d++) {
246
- const p = y ? tt(V[d], at[d], _t) : V[d];
247
- K ? (it.copy(X.normals[c]).multiplyScalar(p.x), st.copy(X.binormals[c]).multiplyScalar(p.y), D.copy(J[c]).add(it).add(st), H(D.x, D.y, D.z)) : H(p.x, p.y, u / o * c);
329
+ for (let l = 1; l <= o; l++)
330
+ for (let d = 0; d < N; d++) {
331
+ const p = y ? te(O[d], ae[d], Ae) : O[d];
332
+ $ ? (oe.copy(U.normals[l]).multiplyScalar(p.x), se.copy(U.binormals[l]).multiplyScalar(p.y), X.copy(V[l]).add(oe).add(se), W(X.x, X.y, X.z)) : W(p.x, p.y, c / o * l);
248
333
  }
249
- for (let c = _ - 1; c >= 0; c--) {
250
- const d = c / _, p = f * Math.cos(d * Math.PI / 2), g = w * Math.sin(d * Math.PI / 2) + M;
251
- for (let m = 0, A = z.length; m < A; m++) {
252
- const x = tt(z[m], rt[m], g);
253
- H(x.x, x.y, u + p);
334
+ for (let l = S - 1; l >= 0; l--) {
335
+ const d = l / S, p = u * Math.cos(d * Math.PI / 2), x = g * Math.sin(d * Math.PI / 2) + L;
336
+ for (let b = 0, M = D.length; b < M; b++) {
337
+ const w = te(D[b], re[b], x);
338
+ W(w.x, w.y, c + p);
254
339
  }
255
- for (let m = 0, A = U.length; m < A; m++) {
256
- const x = U[m];
257
- W = mt[m];
258
- for (let L = 0, T = x.length; L < T; L++) {
259
- const E = tt(x[L], W[L], g);
260
- K ? H(
261
- E.x,
262
- E.y + J[o - 1].y,
263
- J[o - 1].x + p
264
- ) : H(E.x, E.y, u + p);
340
+ for (let b = 0, M = I.length; b < M; b++) {
341
+ const w = I[b];
342
+ q = me[b];
343
+ for (let T = 0, E = w.length; T < E; T++) {
344
+ const C = te(w[T], q[T], x);
345
+ $ ? W(
346
+ C.x,
347
+ C.y + V[o - 1].y,
348
+ V[o - 1].x + p
349
+ ) : W(C.x, C.y, c + p);
265
350
  }
266
351
  }
267
352
  }
268
- kt(), pt && Ft();
269
- function kt() {
270
- const c = i.length / 3;
353
+ We(), ee && ke();
354
+ function We() {
355
+ const l = s.length / 3;
271
356
  if (y) {
272
- let d = 0, p = O * d;
273
- if (B)
274
- for (let g = 0; g < ht; g++) {
275
- const m = Q[g];
276
- ct(m[2] + p, m[1] + p, m[0] + p);
357
+ let d = 0, p = N * d;
358
+ if (z)
359
+ for (let x = 0; x < ce; x++) {
360
+ const b = J[x];
361
+ le(b[2] + p, b[1] + p, b[0] + p);
277
362
  }
278
- if (d = o + _ * 2, p = O * d, v)
279
- for (let g = 0; g < ht; g++) {
280
- const m = Q[g];
281
- ct(m[0] + p, m[1] + p, m[2] + p);
363
+ if (d = o + S * 2, p = N * d, v)
364
+ for (let x = 0; x < ce; x++) {
365
+ const b = J[x];
366
+ le(b[0] + p, b[1] + p, b[2] + p);
282
367
  }
283
368
  } else {
284
- if (B)
285
- for (let d = 0; d < ht; d++) {
286
- const p = Q[d];
287
- ct(p[2], p[1], p[0]);
369
+ if (z)
370
+ for (let d = 0; d < ce; d++) {
371
+ const p = J[d];
372
+ le(p[2], p[1], p[0]);
288
373
  }
289
374
  if (v)
290
- for (let d = 0; d < ht; d++) {
291
- const p = Q[d];
292
- ct(
293
- p[0] + O * o,
294
- p[1] + O * o,
295
- p[2] + O * o
375
+ for (let d = 0; d < ce; d++) {
376
+ const p = J[d];
377
+ le(
378
+ p[0] + N * o,
379
+ p[1] + N * o,
380
+ p[2] + N * o
296
381
  );
297
382
  }
298
383
  }
299
- s.addGroup(c, i.length / 3 - c, 0);
384
+ n.addGroup(l, s.length / 3 - l, 0);
300
385
  }
301
- function Ft() {
302
- const c = i.length / 3;
386
+ function ke() {
387
+ const l = s.length / 3;
303
388
  let d = 0;
304
- Mt(z, d), d += z.length;
305
- for (let p = 0, g = U.length; p < g; p++) {
306
- const m = U[p];
307
- Mt(m, d), d += m.length;
389
+ Me(D, d), d += D.length;
390
+ for (let p = 0, x = I.length; p < x; p++) {
391
+ const b = I[p];
392
+ Me(b, d), d += b.length;
308
393
  }
309
- s.addGroup(c, i.length / 3 - c, 1);
394
+ n.addGroup(l, s.length / 3 - l, 1);
310
395
  }
311
- function Mt(c, d) {
312
- let p = c.length;
396
+ function Me(l, d) {
397
+ let p = l.length;
313
398
  for (; --p >= 0; ) {
314
- const g = p;
315
- let m = p - 1;
316
- m < 0 && (m = c.length - 1);
317
- for (let A = 0, x = o + _ * 2; A < x; A++) {
318
- const L = O * A, T = O * (A + 1), E = d + g + L, C = d + m + L, Y = d + m + T, I = d + g + T;
319
- Wt(E, C, Y, I);
399
+ const x = p;
400
+ let b = p - 1;
401
+ b < 0 && (b = l.length - 1);
402
+ for (let M = 0, w = o + S * 2; M < w; M++) {
403
+ const T = N * M, E = N * (M + 1), C = d + x + T, B = d + b + T, Q = d + b + E, R = d + x + E;
404
+ Fe(C, B, Q, R);
320
405
  }
321
406
  }
322
407
  }
323
- function H(c, d, p) {
324
- h.push(c), h.push(d), h.push(p);
408
+ function W(l, d, p) {
409
+ r.push(l), r.push(d), r.push(p);
325
410
  }
326
- function ct(c, d, p) {
327
- N(c), N(d), N(p);
328
- const g = i.length / 3, m = j.generateTopUV(
411
+ function le(l, d, p) {
412
+ k(l), k(d), k(p);
413
+ const x = s.length / 3, b = P.generateTopUV(
414
+ n,
329
415
  s,
330
- i,
331
- g - 3,
332
- g - 2,
333
- g - 1
416
+ x - 3,
417
+ x - 2,
418
+ x - 1
334
419
  );
335
- k(m[0]), k(m[1]), k(m[2]);
420
+ F(b[0]), F(b[1]), F(b[2]);
336
421
  }
337
- function Wt(c, d, p, g) {
338
- N(c), N(d), N(g), N(d), N(p), N(g);
339
- const m = i.length / 3, A = j.generateSideWallUV(
422
+ function Fe(l, d, p, x) {
423
+ k(l), k(d), k(x), k(d), k(p), k(x);
424
+ const b = s.length / 3, M = P.generateSideWallUV(
425
+ n,
340
426
  s,
341
- i,
342
- m - 6,
343
- m - 3,
344
- m - 2,
345
- m - 1
427
+ b - 6,
428
+ b - 3,
429
+ b - 2,
430
+ b - 1
346
431
  );
347
- k(A[0]), k(A[1]), k(A[3]), k(A[1]), k(A[2]), k(A[3]);
432
+ F(M[0]), F(M[1]), F(M[3]), F(M[1]), F(M[2]), F(M[3]);
348
433
  }
349
- function N(c) {
350
- i.push(h[c * 3 + 0]), i.push(h[c * 3 + 1]), i.push(h[c * 3 + 2]);
434
+ function k(l) {
435
+ s.push(r[l * 3 + 0]), s.push(r[l * 3 + 1]), s.push(r[l * 3 + 2]);
351
436
  }
352
- function k(c) {
353
- n.push(c.x), n.push(c.y);
437
+ function F(l) {
438
+ i.push(l.x), i.push(l.y);
354
439
  }
355
440
  }
356
441
  }
357
- copy(t) {
358
- return super.copy(t), this.parameters = Object.assign({}, t.parameters), this;
442
+ copy(e) {
443
+ return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
359
444
  }
360
445
  toJSON() {
361
- const t = super.toJSON(), e = this.parameters.shapes, s = this.parameters.options;
362
- return Ie(e, s, t);
446
+ const e = super.toJSON(), t = this.parameters.shapes, n = this.parameters.options;
447
+ return Bt(t, n, e);
363
448
  }
364
449
  /**
365
450
  * Factory method for creating an instance of this class from the given
@@ -369,751 +454,693 @@ class Z extends ot {
369
454
  * @param {Array<Shape>} shapes - An array of shapes.
370
455
  * @return {ExtrudeGeometry} A new instance.
371
456
  */
372
- static fromJSON(t, e) {
373
- const s = [];
374
- for (let n = 0, r = t.shapes.length; n < r; n++) {
375
- const l = e[t.shapes[n]];
376
- s.push(l);
457
+ static fromJSON(e, t) {
458
+ const n = [];
459
+ for (let i = 0, a = e.shapes.length; i < a; i++) {
460
+ const f = t[e.shapes[i]];
461
+ n.push(f);
377
462
  }
378
- const i = t.options.extrudePath;
379
- return i !== void 0 && (t.options.extrudePath = new Ue[`${i.type}`]().fromJSON(
380
- i
381
- )), new Z(s, t.options);
463
+ const s = e.options.extrudePath;
464
+ return s !== void 0 && (e.options.extrudePath = new zt[`${s.type}`]().fromJSON(
465
+ s
466
+ )), new K(n, e.options);
382
467
  }
383
468
  }
384
- const Ce = {
385
- generateTopUV: function(a, t, e, s, i) {
386
- const n = t[e * 3], r = t[e * 3 + 1], l = t[s * 3], h = t[s * 3 + 1], b = t[i * 3], o = t[i * 3 + 1];
469
+ const It = {
470
+ generateTopUV: function(m, e, t, n, s) {
471
+ const i = e[t * 3], a = e[t * 3 + 1], f = e[n * 3], r = e[n * 3 + 1], h = e[s * 3], o = e[s * 3 + 1];
387
472
  return [
388
- new P(n, r),
389
- new P(l, h),
390
- new P(b, o)
473
+ new G(i, a),
474
+ new G(f, r),
475
+ new G(h, o)
391
476
  ];
392
477
  },
393
- generateSideWallUV: function(a, t, e, s, i, n) {
394
- const r = t[e * 3], l = t[e * 3 + 1], h = t[e * 3 + 2], b = t[s * 3], o = t[s * 3 + 1], u = t[s * 3 + 2], y = t[i * 3], f = t[i * 3 + 1], w = t[i * 3 + 2], M = t[n * 3], _ = t[n * 3 + 1], S = t[n * 3 + 2];
395
- return Math.abs(l - o) < Math.abs(r - b) ? [
396
- new P(r, 1 - h),
397
- new P(b, 1 - u),
398
- new P(y, 1 - w),
399
- new P(M, 1 - S)
478
+ generateSideWallUV: function(m, e, t, n, s, i) {
479
+ const a = e[t * 3], f = e[t * 3 + 1], r = e[t * 3 + 2], h = e[n * 3], o = e[n * 3 + 1], c = e[n * 3 + 2], y = e[s * 3], u = e[s * 3 + 1], g = e[s * 3 + 2], L = e[i * 3], S = e[i * 3 + 1], A = e[i * 3 + 2];
480
+ return Math.abs(f - o) < Math.abs(a - h) ? [
481
+ new G(a, 1 - r),
482
+ new G(h, 1 - c),
483
+ new G(y, 1 - g),
484
+ new G(L, 1 - A)
400
485
  ] : [
401
- new P(l, 1 - h),
402
- new P(o, 1 - u),
403
- new P(f, 1 - w),
404
- new P(_, 1 - S)
486
+ new G(f, 1 - r),
487
+ new G(o, 1 - c),
488
+ new G(u, 1 - g),
489
+ new G(S, 1 - A)
405
490
  ];
406
491
  }
407
492
  };
408
- function Ie(a, t, e) {
409
- if (e.shapes = [], Array.isArray(a))
410
- for (let s = 0, i = a.length; s < i; s++) {
411
- const n = a[s];
412
- e.shapes.push(n.uuid);
493
+ function Bt(m, e, t) {
494
+ if (t.shapes = [], Array.isArray(m))
495
+ for (let n = 0, s = m.length; n < s; n++) {
496
+ const i = m[n];
497
+ t.shapes.push(i.uuid);
413
498
  }
414
499
  else
415
- e.shapes.push(a.uuid);
416
- return e.options = Object.assign({}, t), t.extrudePath !== void 0 && (e.options.extrudePath = t.extrudePath.toJSON()), e;
500
+ t.shapes.push(m.uuid);
501
+ return t.options = Object.assign({}, e), e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t;
417
502
  }
418
- class Ye extends q {
419
- constructor(t) {
420
- super(), this.options = G({
421
- maxDepth: 10,
422
- percentDepth: !1,
423
- innerRadius: 25,
424
- outRadius: 42,
425
- activeIndex: -1
426
- }, t);
503
+ class Rt extends K {
504
+ constructor(e, t) {
505
+ super(e, t);
506
+ const n = new Oe(
507
+ new K(e, ue(j({}, t), {
508
+ hasTop: !0,
509
+ hasSide: !0,
510
+ hasBottom: !1
511
+ }))
512
+ );
513
+ n.updateMatrixWorld();
514
+ const s = new ft().setFromObject(n), i = new _();
515
+ s.getSize(i);
516
+ const a = new _(
517
+ s.min.x + i.x / 2,
518
+ s.min.y + i.y / 2,
519
+ 0
520
+ );
521
+ let f = t.topSegments, r = t.box3;
522
+ if (r) {
523
+ r = r.union(s);
524
+ const A = new _();
525
+ r.getSize(A);
526
+ const P = Math.max(
527
+ i.x / A.x,
528
+ i.y / A.y
529
+ );
530
+ f = Math.ceil(t.topSegments * P);
531
+ }
532
+ if (f < 4)
533
+ return this;
534
+ const h = new pt(
535
+ i.x,
536
+ i.y,
537
+ f,
538
+ f
539
+ ), o = new Oe(h);
540
+ o.position.set(a.x, a.y, a.z), o.updateMatrixWorld();
541
+ const y = new Gt().evaluate(o, n, Pt), u = y.geometry.getAttribute("position"), g = new be(
542
+ u.count * 2,
543
+ 2
544
+ );
545
+ for (let A = 0; A < u.count; A++) {
546
+ const P = u.getZ(A);
547
+ u.setZ(A, t.depth + P);
548
+ }
549
+ if (r) {
550
+ const A = r.min, P = r.max, v = new _().subVectors(P, A);
551
+ for (let z = 0; z < u.count; z++) {
552
+ const ee = u.getX(z), V = u.getY(z), $ = (ee - A.x) / v.x, U = (V - A.y) / v.y;
553
+ g.setXY(z, $, U);
554
+ }
555
+ y.geometry.setAttribute("uv", g);
556
+ }
557
+ u.needsUpdate = !0;
558
+ const L = new K(e, ue(j({}, t), {
559
+ hasTop: !1
560
+ })), S = H([y.geometry, L], 2);
561
+ this.copy(S.toNonIndexed());
427
562
  }
428
- create() {
429
- return nt(this, null, function* () {
430
- this.createGroup();
431
- const { data: t, maxDepth: e, colors: s, material: i, percentDepth: n, activeIndex: r } = this.options, l = Math.max(...t), h = t.reduce((o, u) => o + u, 0);
432
- let b = Math.PI / 2;
433
- t.forEach((o, u) => {
434
- if (o === 0) return;
435
- const y = Math.PI * 2 * (o / h), f = s[u], w = n ? e * (o / l) : e, M = this.createGeometry(w, y), _ = i ? i.clone() : new le({
436
- color: f
437
- });
438
- i && _.color.set(f);
439
- const S = new ue(M, _);
440
- S.userData.depth = w, S.userData.index = u, S.rotateZ(b), b += y, this.add(S);
441
- }), r !== -1 && this.setActive(r);
442
- });
563
+ }
564
+ const De = (m) => {
565
+ const {
566
+ split: e,
567
+ depth: t,
568
+ points: n,
569
+ box3: s,
570
+ hasTop: i,
571
+ hasBottom: a,
572
+ hasSide: f,
573
+ sideRepeat: r,
574
+ topSegments: h
575
+ } = m, o = h ? Rt : K, c = new o(new xe(n), {
576
+ depth: t,
577
+ bevelEnabled: !1,
578
+ box3: s,
579
+ UVGenerator: Et({
580
+ split: e,
581
+ box3: s,
582
+ sideRepeat: r
583
+ }),
584
+ hasTop: i,
585
+ hasBottom: a,
586
+ hasSide: f,
587
+ topSegments: h
588
+ });
589
+ return Ct(), c;
590
+ };
591
+ class $t extends Z {
592
+ constructor(e) {
593
+ super(), this.options = j({
594
+ depth: 1
595
+ }, e);
443
596
  }
444
- createGeometry(t, e) {
445
- const { outRadius: s, innerRadius: i } = this.options, n = new xt();
446
- return n.moveTo(s, 0), n.lineTo(i, 0), n.absarc(0, 0, i, 0, e, !1), n.absarc(0, 0, s, e, 0, !0), new Z(n, {
447
- curveSegments: 48,
448
- depth: t,
449
- bevelEnabled: !1
597
+ create() {
598
+ return ie(this, null, function* () {
599
+ const {
600
+ points: e,
601
+ pointsArr: t,
602
+ useGroups: n,
603
+ depth: s,
604
+ geometry: i,
605
+ geometryArr: a,
606
+ material: f,
607
+ box3: r,
608
+ split: h,
609
+ hasTop: o,
610
+ hasBottom: c,
611
+ hasSide: y
612
+ } = this.options, u = Array.isArray(s) ? s : [s], g = Array.isArray(r) ? r : [r], L = f;
613
+ let S = i;
614
+ L || console.log("material is null"), !S && e ? S = De({
615
+ points: e,
616
+ depth: u[0],
617
+ box3: g[0],
618
+ split: h,
619
+ hasTop: o,
620
+ hasBottom: c,
621
+ hasSide: y
622
+ }) : !S && t ? S = H(
623
+ t.map(
624
+ (A, P) => {
625
+ var v, z;
626
+ return De({
627
+ points: A,
628
+ depth: (v = u[P]) != null ? v : u[0],
629
+ box3: (z = g[P]) != null ? z : g[0],
630
+ split: h,
631
+ hasTop: o,
632
+ hasBottom: c,
633
+ hasSide: y
634
+ });
635
+ }
636
+ ),
637
+ n != null ? n : 0
638
+ ) : !S && a && a.length > 1 ? S = H(a, n != null ? n : 0) : !S && a && a.length === 1 && ([S] = a), this.createMesh(S, L);
450
639
  });
451
640
  }
452
- handlePick(t, e = 1.3) {
453
- const { object: s } = this.pencil.pick(t, this.object3d.children) || {}, i = s ? this.object3d.children.findIndex((n) => n === s) : this.options.activeIndex;
454
- return this.setActive(i, e);
641
+ addGeometries(e) {
642
+ const t = this.object3d, n = H([t.geometry, ...e]);
643
+ t.geometry = n;
455
644
  }
456
- setActive(t, e = 1.3) {
457
- const s = this.object3d.children[t];
458
- if (this.object3d.children.forEach((i) => {
459
- if (!(s && s === i) && i.scale.z !== 1) {
460
- if (i.userData.levTween) return;
461
- i.userData.enTween && (i.userData.enTween.stop(), i.userData.enTween = null);
462
- const n = new et.Tween(i.scale).to({ z: 1 }, 100);
463
- i.userData.levTween = n, n.start();
464
- }
465
- }), s) {
466
- if (s.userData.enTween)
467
- return;
468
- s.userData.levTween && (s.userData.levTween.stop(), s.userData.levTween = null);
469
- const i = new et.Tween(s.scale).to({ z: e }, 100);
470
- return s.userData.enTween = i, i.start(), s.userData.index;
471
- }
472
- return -1;
645
+ setTextureAnisotropic(e, t) {
646
+ e.anisotropy = t || this.pencil.renderer.capabilities.getMaxAnisotropy();
473
647
  }
474
- render() {
475
- this.object3d.scale.z = 0, new et.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(et.Easing.Sinusoidal.InOut).start();
648
+ }
649
+ const Jt = (m) => {
650
+ const {
651
+ topColor: e,
652
+ sideColor: t,
653
+ sideMap: n,
654
+ createCanvasObjectURL: s,
655
+ split: i,
656
+ maxAnisotropy: a
657
+ } = m;
658
+ return new Promise((f) => {
659
+ const r = n ? document.createElement("img") : {
660
+ src: "",
661
+ onload: () => {
662
+ },
663
+ width: 128,
664
+ height: 128
665
+ };
666
+ r.onload = () => {
667
+ const h = i, o = document.createElement("canvas"), c = o.getContext("2d");
668
+ o.height = r.height / (1 - h), o.width = r.width, h && e && (c.fillStyle = e, c.fillRect(0, 0, r.width, o.height * h)), n && r instanceof HTMLImageElement ? c.drawImage(r, 0, o.height * h, r.width, r.height) : t && (c.fillStyle = t, c.fillRect(0, o.height * h, r.width, r.height)), s && o.toBlob((u) => {
669
+ console.log(URL.createObjectURL(u));
670
+ });
671
+ const y = new mt(o);
672
+ f(y);
673
+ }, n ? r.src = n : r instanceof HTMLImageElement || r.onload();
674
+ });
675
+ };
676
+ class Qt extends Z {
677
+ create() {
678
+ this.createGroup();
476
679
  }
477
680
  }
478
- class Ze extends q {
479
- constructor(t) {
480
- super(), this.rectAreaLightUniformsLibInit = !1, this.options = t;
681
+ class Kt extends Z {
682
+ constructor(e) {
683
+ super(), this.rectAreaLightUniformsLibInit = !1, this.options = e;
481
684
  }
482
685
  create() {
483
- var e, s, i, n, r, l, h, b, o, u, y, f, w, M, _, S, j;
484
- const t = this.options;
485
- if (t.type === "AmbientLight") {
486
- const v = new de(t.color);
686
+ var t, n, s, i, a, f, r, h, o, c, y, u, g, L, S, A, P;
687
+ const e = this.options;
688
+ if (e.type === "AmbientLight") {
689
+ const v = new gt(e.color);
487
690
  v.name = "环境光", this.object3d = v;
488
- } else if (t.type === "DirectionalLight") {
489
- const v = new pe(t.color, t.intensity);
691
+ } else if (e.type === "DirectionalLight") {
692
+ const v = new yt(e.color, e.intensity);
490
693
  v.name = "平行光", v.target.position.set(0, 0, 0), this.object3d = v, v.target.name = "平行光目标", v.shadow.camera.name = "平行光阴影相机", v.shadow.camera.userData.directionalLightShadow = !0, this.directionalLight = v;
491
- } else if (t.type === "PointLight") {
492
- const v = new fe(
493
- (e = t.color) != null ? e : 16777215,
494
- (s = t.intensity) != null ? s : 1,
495
- (i = t.distance) != null ? i : 0,
496
- (n = t.decay) != null ? n : 2
694
+ } else if (e.type === "PointLight") {
695
+ const v = new bt(
696
+ (t = e.color) != null ? t : 16777215,
697
+ (n = e.intensity) != null ? n : 1,
698
+ (s = e.distance) != null ? s : 0,
699
+ (i = e.decay) != null ? i : 2
497
700
  );
498
701
  v.name = "点光源", this.object3d = v, this.pointLight = v;
499
- } else if (t.type === "SpotLight") {
500
- const v = new me(
501
- (r = t.color) != null ? r : 16777215,
502
- (l = t.intensity) != null ? l : 1,
503
- (h = t.distance) != null ? h : 0,
504
- (b = t.angle) != null ? b : Math.PI / 3,
505
- (o = t.penumbra) != null ? o : 1,
506
- (u = t.decay) != null ? u : 2
702
+ } else if (e.type === "SpotLight") {
703
+ const v = new xt(
704
+ (a = e.color) != null ? a : 16777215,
705
+ (f = e.intensity) != null ? f : 1,
706
+ (r = e.distance) != null ? r : 0,
707
+ (h = e.angle) != null ? h : Math.PI / 3,
708
+ (o = e.penumbra) != null ? o : 1,
709
+ (c = e.decay) != null ? c : 2
507
710
  );
508
711
  v.name = "聚光灯", this.object3d = v, this.spotLight = v, v.target.name = "聚光灯目标";
509
- } else if (t.type === "HemisphereLight") {
510
- const v = new ge(
511
- (y = t.color) != null ? y : 16777215,
512
- (f = t.groundColor) != null ? f : 16777215,
513
- (w = t.intensity) != null ? w : 1
712
+ } else if (e.type === "HemisphereLight") {
713
+ const v = new wt(
714
+ (y = e.color) != null ? y : 16777215,
715
+ (u = e.groundColor) != null ? u : 16777215,
716
+ (g = e.intensity) != null ? g : 1
514
717
  );
515
718
  v.name = "半球光", this.object3d = v, this.hemisphereLight = v;
516
- } else if (t.type === "RectAreaLight") {
517
- this.rectAreaLightUniformsLibInit || (Se.init(), this.rectAreaLightUniformsLibInit = !0);
518
- const v = new ye(
519
- (M = t.color) != null ? M : 16777215,
520
- (_ = t.intensity) != null ? _ : 1,
521
- (S = t.width) != null ? S : 10,
522
- (j = t.height) != null ? j : 10
719
+ } else if (e.type === "RectAreaLight") {
720
+ this.rectAreaLightUniformsLibInit || (_t.init(), this.rectAreaLightUniformsLibInit = !0);
721
+ const v = new vt(
722
+ (L = e.color) != null ? L : 16777215,
723
+ (S = e.intensity) != null ? S : 1,
724
+ (A = e.width) != null ? A : 10,
725
+ (P = e.height) != null ? P : 10
523
726
  );
524
727
  v.name = "矩形区域光", this.object3d = v, this.rectAreaLight = v;
525
728
  }
526
729
  }
527
730
  render() {
528
- const t = this.object3d;
529
- t.target && this.pencil.scene.add(t.target);
530
- const e = this.pencil.cameraTarget;
731
+ const e = this.object3d;
732
+ e.target && this.pencil.scene.add(e.target);
733
+ const t = this.pencil.cameraTarget;
531
734
  if (this.spotLight || this.directionalLight) {
532
- const s = this.spotLight || this.directionalLight;
533
- s.position.copy(e), s.target.position.copy(e);
534
- } else this.pointLight && this.pointLight.position.copy(e);
735
+ const n = this.spotLight || this.directionalLight;
736
+ n.position.copy(t), n.target.position.copy(t);
737
+ } else this.pointLight && this.pointLight.position.copy(t);
535
738
  }
536
739
  dispose() {
537
- const t = this.object3d;
538
- t.target && this.pencil.scene.remove(t.target), super.dispose();
740
+ const e = this.object3d;
741
+ e.target && this.pencil.scene.remove(e.target), super.dispose();
539
742
  }
540
743
  }
541
- function R(a, t = 0) {
542
- const e = a[0].index !== null, s = new Set(Object.keys(a[0].attributes)), i = new Set(
543
- Object.keys(a[0].morphAttributes)
544
- ), n = {}, r = {}, l = a[0].morphTargetsRelative, h = new ot();
545
- let b = 0;
546
- for (let o = 0; o < a.length; ++o) {
547
- const u = a[o];
548
- let y = 0;
549
- if (e !== (u.index !== null))
550
- return console.error(
551
- "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."
552
- ), null;
553
- for (const f in u.attributes) {
554
- if (!s.has(f))
555
- return console.error(
556
- "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + '. All geometries must have compatible attributes; make sure "' + f + '" attribute exists among all geometries, or in none of them.'
557
- ), null;
558
- n[f] === void 0 && (n[f] = []), n[f].push(u.attributes[f]), y++;
559
- }
560
- if (y !== s.size)
561
- return console.error(
562
- "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". Make sure all geometries have the same number of attributes."
563
- ), null;
564
- if (l !== u.morphTargetsRelative)
565
- return console.error(
566
- "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphTargetsRelative must be consistent throughout all geometries."
567
- ), null;
568
- for (const f in u.morphAttributes) {
569
- if (!i.has(f))
570
- return console.error(
571
- "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphAttributes must be consistent throughout all geometries."
572
- ), null;
573
- r[f] === void 0 && (r[f] = []), r[f].push(u.morphAttributes[f]);
574
- }
575
- if (t) {
576
- let f;
577
- if (e)
578
- f = u.index.count;
579
- else if (u.attributes.position !== void 0)
580
- f = u.attributes.position.count;
581
- else
582
- return console.error(
583
- "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". The geometry must have either an index or a position attribute"
584
- ), null;
585
- if (t === 1)
586
- h.addGroup(b, f, o);
587
- else if (t === 2 && u.groups.length > 0)
588
- for (let w of u.groups) {
589
- let M = w.materialIndex;
590
- h.addGroup(
591
- b + w.start,
592
- Math.min(w.count, f),
593
- M
594
- );
595
- }
596
- b += f;
597
- }
744
+ class Ot extends fe {
745
+ constructor(e = [], t = "none", n) {
746
+ super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (s) => 1, this.matrixWorld = new Ve(), this.shape = t, n && (this.shapeFunction = n), e.length > 0 && this.setPoints(e);
598
747
  }
599
- if (e) {
600
- let o = 0;
601
- const u = [];
602
- for (let y = 0; y < a.length; ++y) {
603
- const f = a[y].index;
604
- for (let w = 0; w < f.count; ++w)
605
- u.push(f.getX(w) + o);
606
- o += a[y].attributes.position.count;
607
- }
608
- h.setIndex(u);
748
+ convertToVector3Array(e) {
749
+ if (typeof e[0] == "number") {
750
+ const t = [], n = e;
751
+ for (let s = 0; s < n.length; s += 3)
752
+ t.push(new _(n[s], n[s + 1], n[s + 2]));
753
+ return t;
754
+ } else
755
+ return e.map((t) => {
756
+ if (t instanceof G)
757
+ return new _(t.x, t.y, 0);
758
+ if (t instanceof _)
759
+ return t;
760
+ if (Array.isArray(t) && t.length === 2)
761
+ return new _(t[0], t[1], 0);
762
+ if (Array.isArray(t) && t.length === 3)
763
+ return new _(t[0], t[1], t[2]);
764
+ }).filter(Boolean);
609
765
  }
610
- for (const o in n) {
611
- const u = zt(n[o]);
612
- if (!u)
613
- return console.error(
614
- "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " attribute."
615
- ), null;
616
- h.setAttribute(o, u);
766
+ setMatrixWorld(e) {
767
+ this.matrixWorld = e;
617
768
  }
618
- for (const o in r) {
619
- const u = r[o][0].length;
620
- if (u === 0) break;
621
- h.morphAttributes = h.morphAttributes || {}, h.morphAttributes[o] = [];
622
- for (let y = 0; y < u; ++y) {
623
- const f = [];
624
- for (let M = 0; M < r[o].length; ++M)
625
- f.push(r[o][M][y]);
626
- const w = zt(f);
627
- if (!w)
628
- return console.error(
629
- "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " morphAttribute."
630
- ), null;
631
- h.morphAttributes[o].push(w);
632
- }
769
+ setPoints(e, t) {
770
+ !e || e.length === 0 || (this._points = this.convertToVector3Array(e), this.pointCount = this._points.length, t && (this.shapeFunction = t, this.shape = "custom"), this.initializeGeometry(), this.updateGeometry());
633
771
  }
634
- return t === 2 ? _e(h) : h;
635
- }
636
- const Dt = (a) => {
637
- const { points: t } = a, e = t.reduce((i, n, r) => (r < t.length - 1 && i.push(n, t[r + 1]), i), []);
638
- return new ot().setFromPoints(e);
639
- };
640
- let Ke = class extends q {
641
- constructor(t = {}) {
642
- super(), this.options = G({}, t);
643
- }
644
- get material() {
645
- var t;
646
- return (t = this.object3d) == null ? void 0 : t.material;
647
- }
648
- create() {
649
- return nt(this, null, function* () {
650
- const {
651
- points: t,
652
- pointsArr: e,
653
- geometry: s,
654
- geometryArr: i,
655
- material: n,
656
- useGroups: r,
657
- setPointWidth: l,
658
- lineWidthArr: h,
659
- materialParameters: b,
660
- instanceCount: o
661
- } = this.options;
662
- let u = n, y = s;
663
- !u && b && (u = this.getMaterial(b)), !y && t ? y = Dt({
664
- points: t
665
- }) : !y && e ? y = R(
666
- e.map((w) => Dt({
667
- points: w
668
- })),
669
- r != null ? r : 0
670
- ) : !y && i && i.length > 1 ? y = R(i, r != null ? r : 0) : !y && i && i.length === 1 && ([y] = i);
671
- const f = new Le().fromLineSegments(
672
- new be(y)
673
- );
674
- if (this.pencil.options.WebGPUTHREE) {
675
- o && (f.instanceCount = o);
676
- const w = new Yt(f, u);
677
- w.computeLineDistances(), this.object3d = w;
678
- } else {
679
- const w = new Me(f, u);
680
- w.computeLineDistances(), this.object3d = w;
772
+ initializeGeometry() {
773
+ const e = new Y(
774
+ new Float32Array(this.pointCount * 6),
775
+ 3
776
+ ), t = new Y(
777
+ new Float32Array(this.pointCount * 6),
778
+ 3
779
+ ), n = new Y(new Float32Array(this.pointCount * 6), 3), s = new Y(
780
+ new Float32Array(this.pointCount * 2),
781
+ 1
782
+ ), i = new Y(new Float32Array(this.pointCount * 2), 1), a = new Y(new Float32Array(this.pointCount * 2), 1), f = new Y(new Float32Array(this.pointCount * 4), 2), r = new Y(
783
+ new Uint16Array((this.pointCount - 1) * 6),
784
+ 1
785
+ );
786
+ this.shape === "taper" && (this.shapeFunction = (h) => 1 * Math.pow(4 * h * (1 - h), 1));
787
+ for (let h = 0, o = 0, c = 0; h < this.pointCount; h += 1, o += 2, c += 6) {
788
+ s.setX(o, h / this.pointCount), s.setX(o + 1, h / this.pointCount), i.setX(o, 1), i.setX(o + 1, -1);
789
+ const y = this.shape === "none" ? 1 : this.shapeFunction(h / (this.pointCount - 1));
790
+ a.setX(o, y), a.setX(o + 1, y);
791
+ const u = h / (this.pointCount - 1);
792
+ if (f.setXY(o, u, 0), f.setXY(o + 1, u, 1), h < this.pointCount - 1) {
793
+ const g = h * 2;
794
+ r.setX(c + 0, g + 0), r.setX(c + 1, g + 1), r.setX(c + 2, g + 2), r.setX(c + 3, g + 2), r.setX(c + 4, g + 1), r.setX(c + 5, g + 3);
681
795
  }
682
- });
683
- }
684
- getMaterial(t) {
685
- return new Te(G({
686
- color: new Nt("#ffffff")
687
- }, t));
796
+ }
797
+ this.setAttribute("position", e), this.setAttribute("previous", t), this.setAttribute("next", n), this.setAttribute("counters", s), this.setAttribute("side", i), this.setAttribute("width", a), this.setAttribute("uv", f), this.setIndex(r);
688
798
  }
689
- };
690
- function yt(a, t, e, s, i) {
691
- let n;
692
- if (a = a.subarray || a.slice ? a : a.buffer, e = e.subarray || e.slice ? e : e.buffer, a = t ? (
693
- // @ts-ignore
694
- a.subarray ? (
695
- // @ts-ignore
696
- a.subarray(t, i && t + i)
697
- ) : (
698
- // @ts-ignore
699
- a.slice(t, i && t + i)
700
- )
701
- ) : a, e.set)
702
- e.set(a, s);
703
- else
704
- for (n = 0; n < a.length; n++) e[n + s] = a[n];
705
- return e;
706
- }
707
- function Ve(a) {
708
- return a instanceof Float32Array ? a : a instanceof ot ? a.getAttribute("position").array : a.map((t) => {
709
- const e = Array.isArray(t);
710
- return t instanceof F ? [t.x, t.y, t.z] : t instanceof P ? [t.x, t.y, 0] : e && t.length === 3 ? [t[0], t[1], t[2]] : e && t.length === 2 ? [t[0], t[1], 0] : t;
711
- }).flat();
712
- }
713
- class Be extends ot {
714
- constructor() {
715
- super(), this.type = "MeshLine", this.isMeshLine = !0, this.positions = [], this.previous = [], this.next = [], this.side = [], this.width = [], this.indices_array = [], this.uvs = [], this.counters = [], this.widthCallback = null, this._points = [], this.matrixWorld = new we(), Object.defineProperties(this, {
716
- points: {
717
- enumerable: !0,
718
- get() {
719
- return this._points;
720
- },
721
- set(t) {
722
- this.setPoints(t, this.widthCallback);
723
- }
724
- }
725
- });
799
+ updateGeometry() {
800
+ if (!this._points[0]) return;
801
+ const e = this.getAttribute("position"), t = this.getAttribute("previous"), n = this.getAttribute("next");
802
+ let s = 0, i = 0, a = 0;
803
+ const f = this._points[0];
804
+ t.setXYZ(i, f.x, f.y, f.z), i += 1, t.setXYZ(i, f.x, f.y, f.z), i += 1;
805
+ for (let h = 0; h < this.pointCount; h++) {
806
+ const o = this._points[h];
807
+ e.setXYZ(s, o.x, o.y, o.z), s += 1, e.setXYZ(s, o.x, o.y, o.z), s += 1, h < this.pointCount - 1 && (t.setXYZ(i, o.x, o.y, o.z), i += 1, t.setXYZ(i, o.x, o.y, o.z), i += 1), h > 0 && h + 1 <= this.pointCount && (n.setXYZ(a, o.x, o.y, o.z), a += 1, n.setXYZ(a, o.x, o.y, o.z), a += 1);
808
+ }
809
+ const r = this._points[this.pointCount - 1];
810
+ n.setXYZ(a, r.x, r.y, r.z), a += 1, n.setXYZ(a, r.x, r.y, r.z), a += 1, e.needsUpdate = !0, t.needsUpdate = !0, n.needsUpdate = !0, this.computeBoundingSphere(), this.computeBoundingBox();
726
811
  }
727
- setMatrixWorld(t) {
728
- this.matrixWorld = t;
812
+ get points() {
813
+ return this._points;
729
814
  }
730
- setPoints(t, e) {
731
- if (t = Ve(t), this._points = t, this.widthCallback = e != null ? e : null, this.positions = [], this.counters = [], t.length && t[0] instanceof F)
732
- for (let s = 0; s < t.length; s++) {
733
- const i = t[s], n = s / (t.length - 1);
734
- this.positions.push(i.x, i.y, i.z), this.positions.push(i.x, i.y, i.z), this.counters.push(n), this.counters.push(n);
735
- }
736
- else
737
- for (let s = 0; s < t.length; s += 3) {
738
- const i = s / (t.length - 1);
739
- this.positions.push(t[s], t[s + 1], t[s + 2]), this.positions.push(t[s], t[s + 1], t[s + 2]), this.counters.push(i), this.counters.push(i);
740
- }
741
- this.process();
815
+ set points(e) {
816
+ this.setPoints(e);
742
817
  }
743
- compareV3(t, e) {
744
- const s = t * 6, i = e * 6;
745
- return this.positions[s] === this.positions[i] && this.positions[s + 1] === this.positions[i + 1] && this.positions[s + 2] === this.positions[i + 2];
818
+ updatePoints(e, t) {
819
+ const n = this.convertToVector3Array(e);
820
+ if (n.length !== this.pointCount) {
821
+ console.warn(
822
+ "MeshLineGeometry: Cannot update points with different length. Use setPoints() instead."
823
+ );
824
+ return;
825
+ }
826
+ this._points = n, t && (this.shapeFunction = t, this.shape = "custom", this.initializeGeometry()), this.updateGeometry();
746
827
  }
747
- copyV3(t) {
748
- const e = t * 6;
749
- return [this.positions[e], this.positions[e + 1], this.positions[e + 2]];
828
+ setShape(e, t) {
829
+ this.shape = e, t && (this.shapeFunction = t), this._points.length > 0 && (this.initializeGeometry(), this.updateGeometry());
750
830
  }
751
- process() {
752
- const t = this.positions.length / 6;
753
- this.previous = [], this.next = [], this.side = [], this.width = [], this.indices_array = [], this.uvs = [];
754
- let e, s;
755
- this.compareV3(0, t - 1) ? s = this.copyV3(t - 2) : s = this.copyV3(0), this.previous.push(s[0], s[1], s[2]), this.previous.push(s[0], s[1], s[2]);
756
- for (let i = 0; i < t; i++) {
757
- if (this.side.push(1), this.side.push(-1), this.widthCallback ? e = this.widthCallback(i / (t - 1)) : e = 1, this.width.push(e), this.width.push(e), this.uvs.push(i / (t - 1), 0), this.uvs.push(i / (t - 1), 1), i < t - 1) {
758
- s = this.copyV3(i), this.previous.push(s[0], s[1], s[2]), this.previous.push(s[0], s[1], s[2]);
759
- const n = i * 2;
760
- this.indices_array.push(n, n + 1, n + 2), this.indices_array.push(n + 2, n + 1, n + 3);
761
- }
762
- i > 0 && (s = this.copyV3(i), this.next.push(s[0], s[1], s[2]), this.next.push(s[0], s[1], s[2]));
831
+ }
832
+ function en(m, e) {
833
+ const t = new Ve(), n = new St(), s = new At(), i = new _(), a = this.geometry;
834
+ if (s.copy(a.boundingSphere), s.applyMatrix4(this.matrixWorld), !m.ray.intersectSphere(s, i)) return;
835
+ t.copy(this.matrixWorld).invert(), n.copy(m.ray).applyMatrix4(t);
836
+ const f = new _(), r = new _(), h = new _(), o = this instanceof Xe ? 2 : 1, c = a.index, y = a.attributes;
837
+ if (c !== null) {
838
+ const u = c.array, g = y.position.array, L = y.width.array;
839
+ for (let S = 0, A = u.length - 1; S < A; S += o) {
840
+ const P = u[S], v = u[S + 1];
841
+ f.fromArray(g, P * 3), r.fromArray(g, v * 3);
842
+ const z = L[Math.floor(S / 3)] !== void 0 ? L[Math.floor(S / 3)] : 1, ee = m.params.Line.threshold + this.material.lineWidth * z / 2, V = ee * ee;
843
+ if (n.distanceSqToSegment(
844
+ f,
845
+ r,
846
+ i,
847
+ h
848
+ ) > V) continue;
849
+ i.applyMatrix4(this.matrixWorld);
850
+ const U = m.ray.origin.distanceTo(i);
851
+ U < m.near || U > m.far || (e.push({
852
+ distance: U,
853
+ // What do we want? intersection point on the ray or on the segment??
854
+ // point: raycaster.ray.at( distance ),
855
+ point: h.clone().applyMatrix4(this.matrixWorld),
856
+ index: S,
857
+ face: null,
858
+ faceIndex: void 0,
859
+ object: this
860
+ }), S = A);
763
861
  }
764
- this.compareV3(t - 1, 0) ? s = this.copyV3(1) : s = this.copyV3(t - 1), this.next.push(s[0], s[1], s[2]), this.next.push(s[0], s[1], s[2]), !this._attributes || this._attributes.position.count !== this.counters.length ? this._attributes = {
765
- position: new $(new Float32Array(this.positions), 3),
766
- previous: new $(new Float32Array(this.previous), 3),
767
- next: new $(new Float32Array(this.next), 3),
768
- side: new $(new Float32Array(this.side), 1),
769
- width: new $(new Float32Array(this.width), 1),
770
- uv: new $(new Float32Array(this.uvs), 2),
771
- index: new $(new Uint16Array(this.indices_array), 1),
772
- counters: new $(new Float32Array(this.counters), 1)
773
- } : (this._attributes.position.copyArray(new Float32Array(this.positions)), this._attributes.position.needsUpdate = !0, this._attributes.previous.copyArray(new Float32Array(this.previous)), this._attributes.previous.needsUpdate = !0, this._attributes.next.copyArray(new Float32Array(this.next)), this._attributes.next.needsUpdate = !0, this._attributes.side.copyArray(new Float32Array(this.side)), this._attributes.side.needsUpdate = !0, this._attributes.width.copyArray(new Float32Array(this.width)), this._attributes.width.needsUpdate = !0, this._attributes.uv.copyArray(new Float32Array(this.uvs)), this._attributes.uv.needsUpdate = !0, this._attributes.index.copyArray(new Uint16Array(this.indices_array)), this._attributes.index.needsUpdate = !0), this.setAttribute("position", this._attributes.position), this.setAttribute("previous", this._attributes.previous), this.setAttribute("next", this._attributes.next), this.setAttribute("side", this._attributes.side), this.setAttribute("width", this._attributes.width), this.setAttribute("uv", this._attributes.uv), this.setAttribute("counters", this._attributes.counters), this.setAttribute("position", this._attributes.position), this.setAttribute("previous", this._attributes.previous), this.setAttribute("next", this._attributes.next), this.setAttribute("side", this._attributes.side), this.setAttribute("width", this._attributes.width), this.setAttribute("uv", this._attributes.uv), this.setAttribute("counters", this._attributes.counters), this.setIndex(this._attributes.index), this.computeBoundingSphere(), this.computeBoundingBox();
774
- }
775
- /**
776
- * Fast method to advance the line by one position. The oldest position is removed.
777
- * @param position
778
- */
779
- advance({ x: t, y: e, z: s }) {
780
- const i = this._attributes.position.array, n = this._attributes.previous.array, r = this._attributes.next.array, l = i.length;
781
- yt(i, 0, n, 0, l), yt(i, 6, i, 0, l - 6), i[l - 6] = t, i[l - 5] = e, i[l - 4] = s, i[l - 3] = t, i[l - 2] = e, i[l - 1] = s, yt(i, 6, r, 0, l - 6), r[l - 6] = t, r[l - 5] = e, r[l - 4] = s, r[l - 3] = t, r[l - 2] = e, r[l - 1] = s, this._attributes.position.needsUpdate = !0, this._attributes.previous.needsUpdate = !0, this._attributes.next.needsUpdate = !0;
782
862
  }
783
863
  }
784
- const bt = (a) => {
785
- const { setPointWidth: t, nodes: e } = a, s = new Be();
786
- return s.setPoints(e, t), s;
864
+ const ye = (m) => {
865
+ const { setPointWidth: e, nodes: t } = m, n = new Ot();
866
+ return n.setPoints(t, e), n;
787
867
  };
788
- class es extends q {
789
- constructor(t = {}) {
790
- super(), this.options = G({}, t);
868
+ let tn = class extends Z {
869
+ constructor(e = {}) {
870
+ super(), this.options = j({}, e);
791
871
  }
792
872
  get material() {
793
- var t;
794
- return (t = this.object3d) == null ? void 0 : t.material;
873
+ var e;
874
+ return (e = this.object3d) == null ? void 0 : e.material;
795
875
  }
796
876
  create() {
797
- return nt(this, null, function* () {
877
+ return ie(this, null, function* () {
798
878
  const {
799
- nodes: t,
800
- nodesArr: e,
801
- geometry: s,
802
- geometryArr: i,
803
- material: n,
804
- useGroups: r,
805
- setPointWidth: l,
806
- lineWidthArr: h,
807
- materialParameters: b
879
+ nodes: e,
880
+ nodesArr: t,
881
+ geometry: n,
882
+ geometryArr: s,
883
+ material: i,
884
+ useGroups: a,
885
+ setPointWidth: f,
886
+ lineWidthArr: r,
887
+ materialParameters: h
808
888
  } = this.options;
809
- let o = n, u = s;
810
- !o && b && (o = this.getMaterial(b)), !u && t ? u = bt({
811
- nodes: t,
812
- setPointWidth: l
813
- }) : !u && e ? u = R(
814
- e.map((y, f) => {
815
- let w = l;
816
- return !w && h && (w = () => {
817
- var M;
818
- return (M = h[f]) != null ? M : h[0];
819
- }), bt({
889
+ let o = i, c = n;
890
+ !o && h && (o = this.getMaterial(h)), !c && e ? c = ye({
891
+ nodes: e,
892
+ setPointWidth: f
893
+ }) : !c && t ? c = H(
894
+ t.map((y, u) => {
895
+ let g = f;
896
+ return !g && r && (g = () => {
897
+ var L;
898
+ return (L = r[u]) != null ? L : r[0];
899
+ }), ye({
820
900
  nodes: y,
821
- setPointWidth: w
901
+ setPointWidth: g
822
902
  });
823
903
  }),
824
- r != null ? r : 0
825
- ) : !u && i && i.length > 1 ? u = R(i, r != null ? r : 0) : !u && i && i.length === 1 && ([u] = i), this.createMesh(u, o);
904
+ a != null ? a : 0
905
+ ) : !c && s && s.length > 1 ? c = H(s, a != null ? a : 0) : !c && s && s.length === 1 && ([c] = s), this.createMesh(c, o);
826
906
  });
827
907
  }
828
- setGeometry(t, e) {
829
- const s = bt({
830
- nodes: t,
831
- setPointWidth: e
832
- }), i = this.object3d, n = i.geometry;
833
- i.geometry = s, n.dispose();
908
+ setGeometry(e, t) {
909
+ const n = ye({
910
+ nodes: e,
911
+ setPointWidth: t
912
+ }), s = this.object3d, i = s.geometry;
913
+ s.geometry = n, i.dispose();
834
914
  }
835
- getMaterial(t) {
836
- const { width: e, height: s } = this.pencil.getSize();
837
- return new Zt(G({
838
- color: new Nt("#ffffff"),
839
- resolution: new P(e, s)
840
- }, t));
915
+ getMaterial(e) {
916
+ const { width: t, height: n } = this.pencil.getSize(), s = new tt(j({
917
+ color: new Ne("#ffffff")
918
+ }, e));
919
+ return s.uniforms.resolution.value.set(t, n), s;
841
920
  }
842
- addGeometries(t) {
843
- const e = this.object3d, s = R([e.geometry, ...t]);
844
- e.geometry = s;
921
+ addGeometries(e) {
922
+ const t = this.object3d, n = H([t.geometry, ...e]);
923
+ t.geometry = n;
845
924
  }
846
- resize(t, e) {
847
- var s, i;
848
- (i = (s = this.material) == null ? void 0 : s.uniforms) == null || i.resolution.value.set(t, e);
925
+ resize(e, t) {
926
+ var n, s;
927
+ (s = (n = this.material) == null ? void 0 : n.uniforms) == null || s.resolution.value.set(e, t);
849
928
  }
850
- useMaterial(t) {
851
- super.useMaterial(t);
852
- const { width: e, height: s } = this.pencil.getSize();
853
- this.resize(e, s);
929
+ handleMaterialChange(e) {
930
+ if (e) {
931
+ const { width: t, height: n } = this.pencil.getSize();
932
+ this.resize(t, n);
933
+ }
854
934
  }
855
935
  animate({
856
- duration: t = 1e3,
857
- delay: e = 0,
858
- repeat: s = 0,
859
- lineLoop: i,
860
- onRepeat: n,
861
- onUpdate: r,
862
- onComplete: l,
863
- startShow: h
936
+ duration: e = 1e3,
937
+ delay: t = 0,
938
+ repeat: n = 0,
939
+ lineLoop: s,
940
+ onRepeat: i,
941
+ onUpdate: a,
942
+ onComplete: f,
943
+ startShow: r
864
944
  } = {}) {
865
- const { offset: b, offsetLoop: o } = this.material.uniforms;
945
+ const { offset: h, offsetLoop: o } = this.material.uniforms;
866
946
  if (this.material.userData.tween)
867
947
  return;
868
- const u = i != null ? i : !0;
869
- b.value.x = 1, o.value = u && h ? 1 : 0;
948
+ const c = s != null ? s : !0;
949
+ h.value.x = 1, o.value = c && r ? 1 : 0;
870
950
  let y = 0;
871
- const f = new et.Tween(b.value).to({ x: -1 }, t).delay(e).repeat(s).onUpdate(({ x: w }) => {
872
- u && w <= 0 && o.value === 0 && (o.value = 1), r && r(w);
951
+ const u = new ne.Tween(h.value).to({ x: -1 }, e).delay(t).repeat(n).onUpdate(({ x: g }) => {
952
+ c && g <= 0 && o.value === 0 && (o.value = 1), a && a(g);
873
953
  }).onRepeat(() => {
874
- y += 1, n && n(y);
954
+ y += 1, i && i(y);
875
955
  }).onComplete(() => {
876
- l && l();
956
+ f && f();
877
957
  }).start();
878
- this.material.userData.tween = f;
958
+ this.material.userData.tween = u;
879
959
  }
880
960
  render() {
881
- const { width: t, height: e } = this.pencil.getSize();
882
- this.resize(t, e);
961
+ const { width: e, height: t } = this.pencil.getSize();
962
+ this.resize(e, t);
883
963
  }
884
964
  dispose() {
885
- this.material.userData.tween && (this.material.userData.tween.stop(), et.remove(this.material.userData.tween)), super.dispose();
965
+ this.material.userData.tween && (this.material.userData.tween.stop(), ne.remove(this.material.userData.tween)), super.dispose();
886
966
  }
887
- }
888
- const Ot = (a) => {
889
- const l = a, { coordinate: t, startHeight: e, height: s } = l, i = gt(l, ["coordinate", "startHeight", "height"]);
890
- let n = e || 0;
891
- return typeof e != "undefined" && typeof s != "undefined" && (n = e + s), new Kt([t], ut(G({}, i), {
892
- startHeight: e,
893
- endHeight: n
894
- }));
895
967
  };
896
- class ss extends q {
897
- constructor(t) {
898
- super(), this.options = G({}, t);
968
+ const He = (m) => {
969
+ const { points: e } = m, t = e.reduce((s, i, a) => (a < e.length - 1 && s.push(i, e[a + 1]), s), []);
970
+ return new fe().setFromPoints(t);
971
+ };
972
+ class sn extends Z {
973
+ constructor(e = {}) {
974
+ super(), this.options = j({}, e);
975
+ }
976
+ get material() {
977
+ var e;
978
+ return (e = this.object3d) == null ? void 0 : e.material;
899
979
  }
900
980
  create() {
901
- const h = this.options, {
902
- geometry: t,
903
- coordinateArr: e,
904
- coordinate: s,
905
- material: i,
906
- useGroups: n
907
- } = h, r = gt(h, [
908
- "geometry",
909
- "coordinateArr",
910
- "coordinate",
911
- "material",
912
- "useGroups"
913
- ]);
914
- let l = t;
915
- if (!l && s)
916
- l = Ot(G({
917
- coordinate: s
918
- }, r));
919
- else if (!l && e) {
920
- const b = e.map(
921
- (o) => Ot(G({
922
- coordinate: o
923
- }, r))
981
+ return ie(this, null, function* () {
982
+ const {
983
+ points: e,
984
+ pointsArr: t,
985
+ geometry: n,
986
+ geometryArr: s,
987
+ material: i,
988
+ useGroups: a,
989
+ setPointWidth: f,
990
+ lineWidthArr: r,
991
+ materialParameters: h,
992
+ instanceCount: o
993
+ } = this.options;
994
+ let c = i, y = n;
995
+ !c && h && (c = this.getMaterial(h)), !y && e ? y = He({
996
+ points: e
997
+ }) : !y && t ? y = H(
998
+ t.map((g) => He({
999
+ points: g
1000
+ })),
1001
+ a != null ? a : 0
1002
+ ) : !y && s && s.length > 1 ? y = H(s, a != null ? a : 0) : !y && s && s.length === 1 && ([y] = s);
1003
+ const u = new Ke().fromLineSegments(
1004
+ new Xe(y)
924
1005
  );
925
- l = R(b, n != null ? n : 0);
926
- }
927
- this.createMesh(l, i);
1006
+ if (this.pencil.options.WebGPUTHREE) {
1007
+ o && (u.instanceCount = o);
1008
+ const g = new nt(u, c);
1009
+ g.computeLineDistances(), this.object3d = g;
1010
+ } else {
1011
+ const g = new jt(u, c);
1012
+ g.computeLineDistances(), this.object3d = g;
1013
+ }
1014
+ });
1015
+ }
1016
+ getMaterial(e) {
1017
+ return new Qe(j({
1018
+ color: new Ne("#ffffff")
1019
+ }, e));
928
1020
  }
929
1021
  }
930
- class ze extends Z {
931
- constructor(t, e) {
932
- super(t, e);
933
- const s = new Rt(
934
- new Z(t, ut(G({}, e), {
935
- hasTop: !0,
936
- hasSide: !0,
937
- hasBottom: !1
938
- }))
939
- );
940
- s.updateMatrixWorld();
941
- const i = new xe().setFromObject(s), n = new F();
942
- i.getSize(n);
943
- const r = new F(
944
- i.min.x + n.x / 2,
945
- i.min.y + n.y / 2,
946
- 0
947
- );
948
- let l = e.topSegments, h = e.box3;
949
- if (h) {
950
- h = h.union(i);
951
- const S = new F();
952
- h.getSize(S);
953
- const j = Math.max(
954
- n.x / S.x,
955
- n.y / S.y
956
- );
957
- l = Math.ceil(e.topSegments * j);
958
- }
959
- if (l < 4)
960
- return this;
961
- const b = new ve(
962
- n.x,
963
- n.y,
964
- l,
965
- l
966
- ), o = new Rt(b);
967
- o.position.set(r.x, r.y, r.z), o.updateMatrixWorld();
968
- const y = new je().evaluate(o, s, Ge), f = y.geometry.getAttribute("position"), w = new wt(
969
- f.count * 2,
970
- 2
971
- );
972
- for (let S = 0; S < f.count; S++) {
973
- const j = f.getZ(S);
974
- f.setZ(S, e.depth + j);
975
- }
976
- if (h) {
977
- const S = h.min, j = h.max, v = new F().subVectors(j, S);
978
- for (let B = 0; B < f.count; B++) {
979
- const pt = f.getX(B), J = f.getY(B), K = (pt - S.x) / v.x, X = (J - S.y) / v.y;
980
- w.setXY(B, K, X);
981
- }
982
- y.geometry.setAttribute("uv", w);
983
- }
984
- f.needsUpdate = !0;
985
- const M = new Z(t, ut(G({}, e), {
986
- hasTop: !1
987
- })), _ = R([y.geometry, M], 2);
988
- this.copy(_.toNonIndexed());
1022
+ class on extends Z {
1023
+ constructor(e) {
1024
+ super(), this.objectType = "BaseObject#Node", this.onNodePointerIndex = [], this.options = j({
1025
+ type: "2d"
1026
+ }, e);
1027
+ }
1028
+ create() {
1029
+ const { position: e, children: t } = this.options, n = document.createElement("div");
1030
+ this.element = n, t && n.appendChild(t), this.options.type === "3d" ? this.createCSS3DObject(n) : this.options.type === "3dSprite" ? this.createCSS3DSprite(n) : this.createCSS2DObject(n), e && this.object3d.position.copy(e);
1031
+ }
1032
+ setChildren(e) {
1033
+ this.options.children = e, this.element.innerHTML = "", this.element.appendChild(e);
1034
+ }
1035
+ showAndEnsureVisible() {
1036
+ const e = this.options.children;
1037
+ e && (e.style.visibility = "hidden", this.show(), setTimeout(() => {
1038
+ e.style.visibility = "", this.ensureVisible();
1039
+ }));
1040
+ }
1041
+ moveElementToViewport() {
1042
+ const e = this.options.children;
1043
+ if (!e) return;
1044
+ const t = e.getBoundingClientRect(), n = window.innerWidth, s = window.innerHeight;
1045
+ let i = 0, a = 0;
1046
+ t.left < 0 ? i = -t.left : t.right > n && (i = n - t.right), t.top < 0 ? a = -t.top : t.bottom > s && (a = s - t.bottom), t.left + i < 0 && (i = -t.left), t.top + a < 0 && (a = -t.top), (i !== 0 || a !== 0) && (e.style.transform = `translate(${i}px, ${a}px)`);
1047
+ }
1048
+ ensureVisible() {
1049
+ const e = this.options.children;
1050
+ if (!e) return;
1051
+ e.style.transform && (e.style.transform = "");
1052
+ const t = new IntersectionObserver((n) => {
1053
+ n.forEach((s) => {
1054
+ s.isIntersecting && (this.moveElementToViewport(), t.disconnect());
1055
+ });
1056
+ });
1057
+ t.observe(e);
1058
+ }
1059
+ onPointerEvent(e, t) {
1060
+ const n = this.lead.handlePickNode([this], e, t);
1061
+ this.onNodePointerIndex.push(n);
1062
+ }
1063
+ dispose() {
1064
+ this.onNodePointerIndex.forEach((e) => {
1065
+ this.lead.removePickNode(e);
1066
+ }), super.dispose();
989
1067
  }
990
1068
  }
991
- const Ht = (a) => {
992
- const {
993
- split: t,
994
- depth: e,
995
- points: s,
996
- box3: i,
997
- hasTop: n,
998
- hasBottom: r,
999
- hasSide: l,
1000
- sideRepeat: h,
1001
- topSegments: b
1002
- } = a, o = b ? ze : Z, u = new o(new xt(s), {
1003
- depth: e,
1004
- bevelEnabled: !1,
1005
- box3: i,
1006
- UVGenerator: Ee({
1007
- split: t,
1008
- box3: i,
1009
- sideRepeat: h
1010
- }),
1011
- hasTop: n,
1012
- hasBottom: r,
1013
- hasSide: l,
1014
- topSegments: b
1015
- });
1016
- return Pe(), u;
1017
- };
1018
- class is extends q {
1019
- constructor(t) {
1020
- super(), this.options = G({
1021
- depth: 1
1022
- }, t);
1069
+ class rn extends Z {
1070
+ constructor(e) {
1071
+ super(), this.options = j({
1072
+ maxDepth: 10,
1073
+ percentDepth: !1,
1074
+ innerRadius: 25,
1075
+ outRadius: 42,
1076
+ activeIndex: -1
1077
+ }, e);
1023
1078
  }
1024
1079
  create() {
1025
- return nt(this, null, function* () {
1026
- const {
1027
- points: t,
1028
- pointsArr: e,
1029
- useGroups: s,
1030
- depth: i,
1031
- geometry: n,
1032
- geometryArr: r,
1033
- material: l,
1034
- box3: h,
1035
- split: b,
1036
- hasTop: o,
1037
- hasBottom: u,
1038
- hasSide: y
1039
- } = this.options, f = Array.isArray(i) ? i : [i], w = Array.isArray(h) ? h : [h], M = l;
1040
- let _ = n;
1041
- M || console.log("material is null"), !_ && t ? _ = Ht({
1042
- points: t,
1043
- depth: f[0],
1044
- box3: w[0],
1045
- split: b,
1046
- hasTop: o,
1047
- hasBottom: u,
1048
- hasSide: y
1049
- }) : !_ && e ? _ = R(
1050
- e.map(
1051
- (S, j) => {
1052
- var v, B;
1053
- return Ht({
1054
- points: S,
1055
- depth: (v = f[j]) != null ? v : f[0],
1056
- box3: (B = w[j]) != null ? B : w[0],
1057
- split: b,
1058
- hasTop: o,
1059
- hasBottom: u,
1060
- hasSide: y
1061
- });
1062
- }
1063
- ),
1064
- s != null ? s : 0
1065
- ) : !_ && r && r.length > 1 ? _ = R(r, s != null ? s : 0) : !_ && r && r.length === 1 && ([_] = r), this.createMesh(_, M);
1080
+ return ie(this, null, function* () {
1081
+ this.createGroup();
1082
+ const { data: e, maxDepth: t, colors: n, material: s, percentDepth: i, activeIndex: a } = this.options, f = Math.max(...e), r = e.reduce((o, c) => o + c, 0);
1083
+ let h = Math.PI / 2;
1084
+ e.forEach((o, c) => {
1085
+ if (o === 0) return;
1086
+ const y = Math.PI * 2 * (o / r), u = n[c], g = i ? t * (o / f) : t, L = this.createGeometry(g, y), S = s ? s.clone() : new Mt({
1087
+ color: u
1088
+ });
1089
+ s && S.color.set(u);
1090
+ const A = new Lt(L, S);
1091
+ A.userData.depth = g, A.userData.index = c, A.rotateZ(h), h += y, this.add(A);
1092
+ }), a !== -1 && this.setActive(a);
1093
+ });
1094
+ }
1095
+ createGeometry(e, t) {
1096
+ const { outRadius: n, innerRadius: s } = this.options, i = new xe();
1097
+ return i.moveTo(n, 0), i.lineTo(s, 0), i.absarc(0, 0, s, 0, t, !1), i.absarc(0, 0, n, t, 0, !0), new K(i, {
1098
+ curveSegments: 48,
1099
+ depth: e,
1100
+ bevelEnabled: !1
1066
1101
  });
1067
1102
  }
1068
- addGeometries(t) {
1069
- const e = this.object3d, s = R([e.geometry, ...t]);
1070
- e.geometry = s;
1103
+ handlePick(e, t = 1.3) {
1104
+ const { object: n } = this.pencil.pick(e, this.object3d.children) || {}, s = n ? this.object3d.children.findIndex((i) => i === n) : this.options.activeIndex;
1105
+ return this.setActive(s, t);
1071
1106
  }
1072
- setTextureAnisotropic(t, e) {
1073
- t.anisotropy = e || this.pencil.renderer.capabilities.getMaxAnisotropy();
1107
+ setActive(e, t = 1.3) {
1108
+ const n = this.object3d.children[e];
1109
+ if (this.object3d.children.forEach((s) => {
1110
+ if (!(n && n === s) && s.scale.z !== 1) {
1111
+ if (s.userData.levTween) return;
1112
+ s.userData.enTween && (s.userData.enTween.stop(), s.userData.enTween = null);
1113
+ const i = new ne.Tween(s.scale).to({ z: 1 }, 100);
1114
+ s.userData.levTween = i, i.start();
1115
+ }
1116
+ }), n) {
1117
+ if (n.userData.enTween)
1118
+ return;
1119
+ n.userData.levTween && (n.userData.levTween.stop(), n.userData.levTween = null);
1120
+ const s = new ne.Tween(n.scale).to({ z: t }, 100);
1121
+ return n.userData.enTween = s, s.start(), n.userData.index;
1122
+ }
1123
+ return -1;
1124
+ }
1125
+ render() {
1126
+ this.object3d.scale.z = 0, new ne.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(ne.Easing.Sinusoidal.InOut).start();
1074
1127
  }
1075
1128
  }
1076
- const ns = (a) => {
1077
- const {
1078
- topColor: t,
1079
- sideColor: e,
1080
- sideMap: s,
1081
- createCanvasObjectURL: i,
1082
- split: n,
1083
- maxAnisotropy: r
1084
- } = a;
1085
- return new Promise((l) => {
1086
- const h = s ? document.createElement("img") : {
1087
- src: "",
1088
- onload: () => {
1089
- },
1090
- width: 128,
1091
- height: 128
1092
- };
1093
- h.onload = () => {
1094
- const b = n, o = document.createElement("canvas"), u = o.getContext("2d");
1095
- o.height = h.height / (1 - b), o.width = h.width, b && t && (u.fillStyle = t, u.fillRect(0, 0, h.width, o.height * b)), s && h instanceof HTMLImageElement ? u.drawImage(h, 0, o.height * b, h.width, h.height) : e && (u.fillStyle = e, u.fillRect(0, o.height * b, h.width, h.height)), i && o.toBlob((f) => {
1096
- console.log(URL.createObjectURL(f));
1097
- });
1098
- const y = new Ae(o);
1099
- l(y);
1100
- }, s ? h.src = s : h instanceof HTMLImageElement || h.onload();
1101
- });
1102
- };
1103
1129
  export {
1104
- ss as ConicPolygon,
1105
- is as ExtrudePolygon,
1106
- Qe as Group,
1107
- Ze as Light,
1108
- es as Line,
1109
- Ke as Line2,
1110
- us as Line2Material,
1111
- cs as LineSegmentsGeometry,
1112
- Be as MeshLineGeometry,
1113
- Zt as MeshLineMaterial,
1114
- Xe as Node,
1115
- Ye as Pie,
1116
- Kt as getConicPolygonGeometry,
1117
- as as getConicPolygonGeometryMetas,
1118
- ns as getSplitTexture
1130
+ Zt as ConicPolygon,
1131
+ $t as ExtrudePolygon,
1132
+ Qt as Group,
1133
+ Kt as Light,
1134
+ tn as Line,
1135
+ sn as Line2,
1136
+ ln as Line2Material,
1137
+ un as LineSegmentsGeometry,
1138
+ Ot as MeshLineGeometry,
1139
+ tt as MeshLineMaterial,
1140
+ en as MeshLineRaycast,
1141
+ on as Node,
1142
+ rn as Pie,
1143
+ et as getConicPolygonGeometry,
1144
+ fn as getConicPolygonGeometryMetas,
1145
+ Jt as getSplitTexture
1119
1146
  };