@tresjs/core 4.1.0-next.0 → 4.2.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.
package/dist/tres.js CHANGED
@@ -1,24 +1,24 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.1.0-next.0
3
+ * version: v4.2.0
4
4
  * (c) 2024
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- var at = Object.defineProperty;
9
- var lt = (e, t, r) => t in e ? at(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
10
- var ie = (e, t, r) => (lt(e, typeof t != "symbol" ? t + "" : t, r), r);
11
- import { ref as L, computed as D, watchEffect as ve, onUnmounted as N, shallowRef as H, watch as G, reactive as ze, readonly as ue, unref as W, provide as fe, inject as ct, defineComponent as xe, useSlots as ut, getCurrentInstance as ke, onMounted as ft, openBlock as pt, createElementBlock as dt, normalizeClass as mt, normalizeStyle as gt, createRenderer as vt, h as Oe, Fragment as ht } from "vue";
12
- import * as Ge from "three";
13
- import { PerspectiveCamera as pe, Camera as yt, Clock as Ve, Vector3 as he, Color as re, Scene as qe, MeshBasicMaterial as Ye, DoubleSide as wt, REVISION as bt, SRGBColorSpace as Mt, ACESFilmicToneMapping as Je, PCFSoftShadowMap as Pt, NoToneMapping as _t, WebGLRenderer as ae, TextureLoader as Ct, Vector2 as le, MathUtils as Et, Raycaster as St, BufferAttribute as Tt, Object3D as xt, Line as kt, BufferGeometry as Ae, Float32BufferAttribute as Le, LineBasicMaterial as Ot, Mesh as At, BackSide as Lt, DirectionalLightHelper as Dt, PointLightHelper as Bt, SpotLightHelper as jt, HemisphereLightHelper as Rt, ArrowHelper as It } from "three";
14
- import { createEventHook as A, useRafFn as Qe, toValue as T, unrefElement as Ht, useDevicePixelRatio as $t, usePointer as Ft, useElementBounding as Ut, useWindowSize as Wt, useElementSize as Nt, refDebounced as De, tryOnScopeDispose as zt, useFps as Gt, useMemory as Vt } from "@vueuse/core";
15
- const qt = "@tresjs/core", Yt = "module", Jt = "4.1.0-next.0", Qt = "pnpm@9.1.4", Kt = "Declarative ThreeJS using Vue Components", Xt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Zt = "MIT", er = [
8
+ var bt = Object.defineProperty;
9
+ var Pt = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
+ var me = (e, t, n) => Pt(e, typeof t != "symbol" ? t + "" : t, n);
11
+ import { ref as I, computed as Y, watchEffect as Te, onUnmounted as Q, shallowRef as H, watch as le, readonly as ye, unref as K, provide as _e, inject as Mt, isRef as Ct, reactive as Et, defineComponent as Be, useSlots as Tt, getCurrentInstance as Ie, onMounted as St, openBlock as At, createElementBlock as kt, normalizeClass as xt, normalizeStyle as Lt, createRenderer as Rt, h as He, Fragment as Ot } from "vue";
12
+ import * as et from "three";
13
+ import { PerspectiveCamera as we, Camera as Dt, Clock as tt, Vector3 as Se, Color as ce, Scene as nt, MathUtils as rt, MeshBasicMaterial as ot, DoubleSide as jt, REVISION as Bt, SRGBColorSpace as It, ACESFilmicToneMapping as st, PCFSoftShadowMap as Ht, NoToneMapping as $t, WebGLRenderer as he, TextureLoader as Ut, Vector2 as ge, Raycaster as Ft, BufferAttribute as Wt, Object3D as Nt, Line as zt, BufferGeometry as $e, Float32BufferAttribute as Ue, LineBasicMaterial as Gt, Mesh as Vt, BackSide as Yt, DirectionalLightHelper as qt, PointLightHelper as Jt, SpotLightHelper as Kt, HemisphereLightHelper as Qt, ArrowHelper as Xt } from "three";
14
+ import { createEventHook as j, useRafFn as it, toValue as k, unrefElement as Zt, useDevicePixelRatio as en, usePointer as tn, useElementBounding as nn, useWindowSize as rn, useElementSize as on, refDebounced as Fe, tryOnScopeDispose as sn, useFps as an, useMemory as ln } from "@vueuse/core";
15
+ const cn = "@tresjs/core", un = "module", fn = "4.2.0", dn = "pnpm@9.1.4", pn = "Declarative ThreeJS using Vue Components", mn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", hn = "MIT", gn = [
16
16
  "vue",
17
17
  "3d",
18
18
  "threejs",
19
19
  "three",
20
20
  "threejs-vue"
21
- ], tr = !1, rr = {
21
+ ], vn = !1, yn = {
22
22
  ".": {
23
23
  types: "./dist/index.d.ts",
24
24
  import: "./dist/tres.js",
@@ -37,12 +37,12 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.1.0-next.0", Qt = "pnpm@9.1.4"
37
37
  types: "./dist/src/utils/index.d.ts"
38
38
  },
39
39
  "./*": "./*"
40
- }, nr = "./dist/tres.js", or = "./dist/tres.js", sr = "./dist/index.d.ts", ir = [
40
+ }, _n = "./dist/tres.js", wn = "./dist/tres.js", bn = "./dist/index.d.ts", Pn = [
41
41
  "*.d.ts",
42
42
  "dist"
43
- ], ar = {
43
+ ], Mn = {
44
44
  access: "public"
45
- }, lr = {
45
+ }, Cn = {
46
46
  dev: "cd playground && npm run dev",
47
47
  build: "vite build",
48
48
  playground: "cd playground && npm run dev",
@@ -59,28 +59,28 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.1.0-next.0", Qt = "pnpm@9.1.4"
59
59
  "docs:preview": "vitepress preview docs",
60
60
  "docs:contributors": "esno scripts/update-contributors.ts",
61
61
  prepare: "node .husky/install.mjs"
62
- }, cr = {
62
+ }, En = {
63
63
  three: ">=0.133",
64
64
  vue: ">=3.4"
65
- }, ur = {
65
+ }, Tn = {
66
66
  "@alvarosabu/utils": "^3.2.0",
67
- "@vue/devtools-api": "^6.6.2",
68
- "@vueuse/core": "^10.10.0"
69
- }, fr = {
67
+ "@vue/devtools-api": "^6.6.3",
68
+ "@vueuse/core": "^10.11.0"
69
+ }, Sn = {
70
70
  "@release-it/conventional-changelog": "^8.0.1",
71
- "@stackblitz/sdk": "^1.10.0",
71
+ "@stackblitz/sdk": "^1.11.0",
72
72
  "@tresjs/cientos": "3.9.0",
73
73
  "@tresjs/eslint-config": "^1.1.0",
74
- "@types/three": "^0.165.0",
75
- "@typescript-eslint/eslint-plugin": "^7.11.0",
76
- "@typescript-eslint/parser": "^7.11.0",
74
+ "@types/three": "^0.166.0",
75
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
76
+ "@typescript-eslint/parser": "^7.16.0",
77
77
  "@vitejs/plugin-vue": "^5.0.5",
78
78
  "@vitest/coverage-c8": "^0.33.0",
79
- "@vitest/coverage-v8": "^1.6.0",
80
- "@vitest/ui": "^1.6.0",
79
+ "@vitest/coverage-v8": "^2.0.2",
80
+ "@vitest/ui": "^2.0.2",
81
81
  "@vue/test-utils": "^2.4.6",
82
- eslint: "^9.4.0",
83
- "eslint-plugin-vue": "^9.26.0",
82
+ eslint: "^9.6.0",
83
+ "eslint-plugin-vue": "^9.27.0",
84
84
  esno: "^4.7.0",
85
85
  gsap: "^3.12.5",
86
86
  husky: "^9.0.11",
@@ -88,299 +88,447 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.1.0-next.0", Qt = "pnpm@9.1.4"
88
88
  kolorist: "^1.8.0",
89
89
  ohmyfetch: "^0.4.21",
90
90
  pathe: "^1.1.2",
91
- "release-it": "^17.3.0",
91
+ "release-it": "^17.5.0",
92
92
  "rollup-plugin-analyzer": "^4.0.0",
93
93
  "rollup-plugin-copy": "^3.5.0",
94
94
  "rollup-plugin-visualizer": "^5.12.0",
95
- three: "^0.165.0",
96
- unocss: "^0.60.4",
97
- unplugin: "^1.10.1",
98
- "unplugin-vue-components": "^0.27.0",
99
- vite: "^5.2.12",
95
+ sponsorkit: "^0.14.6",
96
+ three: "^0.166.1",
97
+ unocss: "^0.61.3",
98
+ unplugin: "^1.11.0",
99
+ "unplugin-vue-components": "^0.27.2",
100
+ vite: "^5.3.3",
100
101
  "vite-plugin-banner": "^0.7.1",
101
102
  "vite-plugin-dts": "3.9.1",
102
103
  "vite-plugin-inspect": "^0.8.4",
103
104
  "vite-plugin-require-transform": "^1.0.21",
104
105
  "vite-svg-loader": "^5.1.0",
105
- vitepress: "1.2.2",
106
- vitest: "^1.6.0",
107
- vue: "^3.4.27",
106
+ vitepress: "1.3.0",
107
+ vitest: "^2.0.2",
108
+ vue: "^3.4.31",
108
109
  "vue-demi": "^0.14.8"
109
- }, pr = {
110
- name: qt,
111
- type: Yt,
112
- version: Jt,
113
- packageManager: Qt,
114
- description: Kt,
115
- author: Xt,
116
- license: Zt,
117
- keywords: er,
118
- sideEffects: tr,
119
- exports: rr,
120
- main: nr,
121
- module: or,
122
- types: sr,
123
- files: ir,
124
- publishConfig: ar,
125
- scripts: lr,
126
- peerDependencies: cr,
127
- dependencies: ur,
128
- devDependencies: fr
129
- }, dr = ({ sizes: e }) => {
130
- const t = L([]), r = D(
110
+ }, An = {
111
+ name: cn,
112
+ type: un,
113
+ version: fn,
114
+ packageManager: dn,
115
+ description: pn,
116
+ author: mn,
117
+ license: hn,
118
+ keywords: gn,
119
+ sideEffects: vn,
120
+ exports: yn,
121
+ main: _n,
122
+ module: wn,
123
+ types: bn,
124
+ files: Pn,
125
+ publishConfig: Mn,
126
+ scripts: Cn,
127
+ peerDependencies: En,
128
+ dependencies: Tn,
129
+ devDependencies: Sn
130
+ };
131
+ function be(e) {
132
+ return typeof e > "u";
133
+ }
134
+ function de(e) {
135
+ return Array.isArray(e);
136
+ }
137
+ function kn(e) {
138
+ return typeof e == "number";
139
+ }
140
+ function at(e) {
141
+ return typeof e == "string";
142
+ }
143
+ function V(e) {
144
+ return typeof e == "function";
145
+ }
146
+ function N(e) {
147
+ return e === Object(e) && !de(e) && !V(e);
148
+ }
149
+ function W(e) {
150
+ return N(e) && "isObject3D" in e && !!e.isObject3D;
151
+ }
152
+ function We(e) {
153
+ return N(e) && "isCamera" in e && !!e.isCamera;
154
+ }
155
+ function xn(e) {
156
+ return N(e) && "isBufferGeometry" in e && !!e.isBufferGeometry;
157
+ }
158
+ function Ln(e) {
159
+ return N(e) && "isMaterial" in e && !!e.isMaterial;
160
+ }
161
+ function Rn(e) {
162
+ return N(e) && "isFog" in e && !!e.isFog;
163
+ }
164
+ function On(e) {
165
+ return N(e) && "isScene" in e && !!e.isScene;
166
+ }
167
+ function re(e) {
168
+ return W(e) || xn(e) || Ln(e) || Rn(e);
169
+ }
170
+ function Dn(e) {
171
+ return N(e) && !!e.isPrimitive;
172
+ }
173
+ const jn = ({ sizes: e }) => {
174
+ const t = I([]), n = Y(
131
175
  () => t.value[0]
132
- ), o = (i) => {
133
- const a = i instanceof yt ? i : t.value.find((f) => f.uuid === i);
134
- if (!a)
176
+ ), r = (i) => {
177
+ const l = i instanceof Dt ? i : t.value.find((o) => o.uuid === i);
178
+ if (!l)
135
179
  return;
136
- const n = t.value.filter(({ uuid: f }) => f !== a.uuid);
137
- t.value = [a, ...n];
138
- }, s = (i, a = !1) => {
139
- t.value.some(({ uuid: n }) => n === i.uuid) || (a ? o(i) : t.value.push(i));
140
- }, c = (i) => {
141
- t.value = t.value.filter(({ uuid: a }) => a !== i.uuid);
180
+ const c = t.value.filter(({ uuid: o }) => o !== l.uuid);
181
+ t.value = [l, ...c];
182
+ }, s = (i, l = !1) => {
183
+ if (We(i)) {
184
+ const c = i;
185
+ if (t.value.some(({ uuid: o }) => o === c.uuid))
186
+ return;
187
+ l ? r(c) : t.value.push(c);
188
+ }
189
+ }, a = (i) => {
190
+ if (We(i)) {
191
+ const l = i;
192
+ t.value = t.value.filter(({ uuid: c }) => c !== l.uuid);
193
+ }
142
194
  };
143
- return ve(() => {
195
+ return Te(() => {
144
196
  e.aspectRatio.value && t.value.forEach((i) => {
145
- !i.manual && (i instanceof pe || mr(i)) && (i instanceof pe ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
197
+ !i.manual && (i instanceof we || Bn(i)) && (i instanceof we ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
146
198
  });
147
- }), N(() => {
199
+ }), Q(() => {
148
200
  t.value = [];
149
201
  }), {
150
- camera: r,
202
+ camera: n,
151
203
  cameras: t,
152
204
  registerCamera: s,
153
- deregisterCamera: c,
154
- setCameraActive: o
205
+ deregisterCamera: a,
206
+ setCameraActive: r
155
207
  };
156
208
  };
157
- function mr(e) {
209
+ function Bn(e) {
158
210
  return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
159
211
  }
160
- const Ke = A(), Xe = A(), ye = A(), V = new Ve();
161
- let ne = 0, oe = 0;
162
- const { pause: gr, resume: Be, isActive: vr } = Qe(
212
+ const lt = j(), ct = j(), Ae = j(), ee = new tt();
213
+ let ue = 0, fe = 0;
214
+ const { pause: In, resume: Ne, isActive: Hn } = it(
163
215
  () => {
164
- Ke.trigger({ delta: ne, elapsed: oe, clock: V }), Xe.trigger({ delta: ne, elapsed: oe, clock: V }), ye.trigger({ delta: ne, elapsed: oe, clock: V });
216
+ lt.trigger({ delta: ue, elapsed: fe, clock: ee }), ct.trigger({ delta: ue, elapsed: fe, clock: ee }), Ae.trigger({ delta: ue, elapsed: fe, clock: ee });
165
217
  },
166
218
  { immediate: !1 }
167
219
  );
168
- ye.on(() => {
169
- ne = V.getDelta(), oe = V.getElapsedTime();
220
+ Ae.on(() => {
221
+ ue = ee.getDelta(), fe = ee.getElapsedTime();
170
222
  });
171
- let je = !1;
172
- const fn = () => (je || (je = !0, Be()), {
173
- onBeforeLoop: Ke.on,
174
- onLoop: Xe.on,
175
- onAfterLoop: ye.on,
176
- pause: gr,
177
- resume: Be,
178
- isActive: vr
179
- }), pn = !0, K = "[TresJS ▲ ■ ●] ";
180
- function $() {
181
- function e(...o) {
182
- typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.error(...o);
223
+ let ze = !1;
224
+ const $r = () => (ze || (ze = !0, Ne()), {
225
+ onBeforeLoop: lt.on,
226
+ onLoop: ct.on,
227
+ onAfterLoop: Ae.on,
228
+ pause: In,
229
+ resume: Ne,
230
+ isActive: Hn
231
+ }), Ur = !0, oe = "[TresJS ▲ ■ ●] ";
232
+ function z() {
233
+ function e(...r) {
234
+ typeof r[0] == "string" ? r[0] = oe + r[0] : r.unshift(oe), console.error(...r);
183
235
  }
184
- function t(...o) {
185
- typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.warn(...o);
236
+ function t(...r) {
237
+ typeof r[0] == "string" ? r[0] = oe + r[0] : r.unshift(oe), console.warn(...r);
186
238
  }
187
- function r(o, s) {
239
+ function n(r, s) {
188
240
  }
189
241
  return {
190
242
  logError: e,
191
243
  logWarning: t,
192
- logMessage: r
244
+ logMessage: n
193
245
  };
194
246
  }
195
- function dn(e) {
196
- return typeof e == "number" ? [e, e, e] : e instanceof he ? [e.x, e.y, e.z] : e;
247
+ function Fr(e) {
248
+ return typeof e == "number" ? [e, e, e] : e instanceof Se ? [e.x, e.y, e.z] : e;
197
249
  }
198
- function hr(e) {
199
- return e instanceof re ? e : Array.isArray(e) ? new re(...e) : new re(e);
250
+ function $n(e) {
251
+ return e instanceof ce ? e : Array.isArray(e) ? new ce(...e) : new ce(e);
200
252
  }
201
- class yr extends Ge.Mesh {
202
- constructor(...r) {
203
- super(...r);
204
- ie(this, "type", "HightlightMesh");
205
- ie(this, "createTime");
253
+ class Un extends et.Mesh {
254
+ constructor(...n) {
255
+ super(...n);
256
+ me(this, "type", "HightlightMesh");
257
+ me(this, "createTime");
206
258
  this.createTime = Date.now();
207
259
  }
208
260
  onBeforeRender() {
209
- const o = (Date.now() - this.createTime) / 1e3, i = 1 + 0.07 * Math.sin(2.5 * o);
261
+ const r = (Date.now() - this.createTime) / 1e3, i = 1 + 0.07 * Math.sin(2.5 * r);
210
262
  this.scale.set(i, i, i);
211
263
  }
212
264
  }
213
- const Ze = (e, t) => {
214
- for (const r of Object.keys(t))
215
- t[r] instanceof Object && Object.assign(t[r], Ze(e[r], t[r]));
265
+ const ut = (e, t) => {
266
+ for (const n of Object.keys(t))
267
+ t[n] instanceof Object && Object.assign(t[n], ut(e[n], t[n]));
216
268
  return Object.assign(e || {}, t), e;
217
- }, wr = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", br = /* @__PURE__ */ _r(wr);
218
- function Re(e) {
269
+ }, Fn = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", Wn = /* @__PURE__ */ Gn(Fn);
270
+ function Ge(e) {
219
271
  return e && e.nodeType === 1;
220
272
  }
221
- function X(e) {
222
- return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
223
- }
224
- const Mr = /\B([A-Z])/g;
225
- function Pr(e) {
226
- return e.replace(Mr, "-$1").toLowerCase();
227
- }
228
- function _r(e, t) {
229
- const r = /* @__PURE__ */ Object.create(null), o = e.split(",");
230
- for (let s = 0; s < o.length; s++)
231
- r[o[s]] = !0;
232
- return (s) => !!r[s];
233
- }
234
- const Cr = (e, t) => {
235
- const r = /* @__PURE__ */ new Set(), o = [];
236
- for (const s of e) {
237
- const c = t(s);
238
- r.has(c) || (r.add(c), o.push(s));
239
- }
240
- return o;
241
- }, Ie = (e, t) => {
273
+ function se(e) {
274
+ return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
275
+ }
276
+ const Nn = /\B([A-Z])/g;
277
+ function zn(e) {
278
+ return e.replace(Nn, "-$1").toLowerCase();
279
+ }
280
+ function Gn(e, t) {
281
+ const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
282
+ for (let s = 0; s < r.length; s++)
283
+ n[r[s]] = !0;
284
+ return (s) => !!n[s];
285
+ }
286
+ const Ve = (e, t) => {
242
287
  if (!t)
243
288
  return;
289
+ const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
290
+ return n == null ? void 0 : n.reduce((r, s) => r && r[s], e);
291
+ }, Vn = (e, t, n) => {
244
292
  const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
245
- return r == null ? void 0 : r.reduce((o, s) => o && o[s], e);
246
- }, Er = (e, t, r) => {
247
- const o = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
248
- o && o.reduce((s, c, i) => (s[c] === void 0 && (s[c] = {}), i === o.length - 1 && (s[c] = r), s[c]), e);
293
+ r && r.reduce((s, a, i) => (s[a] === void 0 && (s[a] = {}), i === r.length - 1 && (s[a] = n), s[a]), e);
249
294
  };
250
- function et(e, t) {
251
- if (Re(e) && Re(t)) {
252
- const s = e.attributes, c = t.attributes;
253
- return s.length !== c.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
295
+ function ft(e, t) {
296
+ if (Ge(e) && Ge(t)) {
297
+ const s = e.attributes, a = t.attributes;
298
+ return s.length !== a.length ? !1 : Array.from(s).every(({ name: i, value: l }) => t.getAttribute(i) === l);
254
299
  }
255
300
  if (e === t)
256
301
  return !0;
257
302
  if (e === null || typeof e != "object" || t === null || typeof t != "object")
258
303
  return !1;
259
- const r = Object.keys(e), o = Object.keys(t);
260
- if (r.length !== o.length)
304
+ const n = Object.keys(e), r = Object.keys(t);
305
+ if (n.length !== r.length)
261
306
  return !1;
262
- for (const s of r)
263
- if (!o.includes(s) || !et(e[s], t[s]))
307
+ for (const s of n)
308
+ if (!r.includes(s) || !ft(e[s], t[s]))
264
309
  return !1;
265
310
  return !0;
266
311
  }
267
- function Sr(e, t) {
312
+ function Yn(e, t) {
268
313
  if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
269
314
  return !1;
270
- for (let r = 0; r < e.length; r++)
271
- if (!et(e[r], t[r]))
315
+ for (let n = 0; n < e.length; n++)
316
+ if (!ft(e[n], t[n]))
272
317
  return !1;
273
318
  return !0;
274
319
  }
275
- const Tr = Array.isArray;
276
- function xr(e, t, r, o) {
277
- const s = (n) => {
278
- if (n.uuid === t)
279
- return n;
280
- for (const f of n.children) {
281
- const h = s(f);
282
- if (h)
283
- return h;
320
+ const qn = Array.isArray;
321
+ function Jn(e, t, n, r) {
322
+ const s = (c) => {
323
+ if (c.uuid === t)
324
+ return c;
325
+ for (const o of c.children) {
326
+ const f = s(o);
327
+ if (f)
328
+ return f;
284
329
  }
285
- }, c = s(e);
286
- if (!c) {
330
+ }, a = s(e);
331
+ if (!a) {
287
332
  console.warn("Object with UUID not found in the scene.");
288
333
  return;
289
334
  }
290
- let i = c;
291
- for (let n = 0; n < r.length - 1; n++)
292
- if (i[r[n]] !== void 0)
293
- i = i[r[n]];
335
+ let i = a;
336
+ for (let c = 0; c < n.length - 1; c++)
337
+ if (i[n[c]] !== void 0)
338
+ i = i[n[c]];
294
339
  else {
295
- console.warn(`Property path is not valid: ${r.join(".")}`);
340
+ console.warn(`Property path is not valid: ${n.join(".")}`);
296
341
  return;
297
342
  }
298
- const a = r[r.length - 1];
299
- i[a] !== void 0 ? i[a] = o : console.warn(`Property path is not valid: ${r.join(".")}`);
343
+ const l = n[n.length - 1];
344
+ i[l] !== void 0 ? i[l] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
300
345
  }
301
- function kr(e) {
302
- const t = new Ye({
346
+ function Kn(e) {
347
+ const t = new ot({
303
348
  color: 11003607,
304
349
  // Highlight color, e.g., yellow
305
350
  transparent: !0,
306
351
  opacity: 0.2,
307
352
  depthTest: !1,
308
353
  // So the highlight is always visible
309
- side: wt
354
+ side: jt
310
355
  // To e
311
356
  });
312
- return new yr(e.geometry.clone(), t);
357
+ return new Un(e.geometry.clone(), t);
313
358
  }
314
- function Or(e) {
315
- var r;
359
+ function Qn(e) {
360
+ var n;
316
361
  let t = e.value;
317
- return e.value && ((r = e.value) != null && r.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new he(...t)), t;
362
+ return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new Se(...t)), t;
318
363
  }
319
- function Ar(e) {
364
+ function Xn(e) {
320
365
  return "map" in e;
321
366
  }
322
- function He(e) {
323
- Ar(e) && e.map && e.map.dispose(), e.dispose();
367
+ function Ye(e) {
368
+ Xn(e) && e.map && e.map.dispose(), e.dispose();
324
369
  }
325
- function we(e) {
326
- var r, o;
327
- if (e.parent && ((r = e.removeFromParent) == null || r.call(e)), delete e.__tres, [...e.children].forEach((s) => we(s)), !(e instanceof qe)) {
370
+ function dt(e) {
371
+ var n, r;
372
+ if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((s) => dt(s)), !(e instanceof nt)) {
328
373
  const s = e;
329
- e && ((o = e.dispose) == null || o.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((c) => He(c)), delete s.material) : s.material && (He(s.material), delete s.material);
374
+ e && ((r = e.dispose) == null || r.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((a) => Ye(a)), delete s.material) : s.material && (Ye(s.material), delete s.material);
330
375
  }
331
376
  }
332
- const Lr = Number.parseInt(bt.replace("dev", "")), Z = {
377
+ function Zn(e, t) {
378
+ let n = 0;
379
+ for (let r = 0; r < e.length; r++)
380
+ t(e[r], r) && (e[n] = e[r], n++);
381
+ return e.length = n, e;
382
+ }
383
+ function Pe(e, t) {
384
+ let n = e;
385
+ if (t.includes("-")) {
386
+ const r = t.split("-");
387
+ let s = r.shift();
388
+ for (; n && r.length; )
389
+ s in n ? (n = n[s], s = r.shift()) : s = qe(s, r.shift());
390
+ return { target: n, key: qe(s, ...r) };
391
+ } else
392
+ return { target: n, key: t };
393
+ }
394
+ function qe(...e) {
395
+ return e.map((t, n) => n === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
396
+ }
397
+ const Je = /-\d+$/;
398
+ function er(e, t, n) {
399
+ if (at(n)) {
400
+ if (Je.test(n)) {
401
+ const a = n.replace(Je, ""), { target: i, key: l } = Pe(e, a);
402
+ if (!Array.isArray(i[l])) {
403
+ const c = i[l], o = [];
404
+ o.__tresDetach = () => {
405
+ o.every((f) => be(f)) && (i[l] = c);
406
+ }, i[l] = o;
407
+ }
408
+ }
409
+ const { target: r, key: s } = Pe(e, n);
410
+ t.__tres.previousAttach = r[s], r[s] = X(t);
411
+ } else
412
+ t.__tres.previousAttach = n(e, t);
413
+ }
414
+ function tr(e, t, n) {
415
+ var r, s, a;
416
+ if (at(n)) {
417
+ const { target: i, key: l } = Pe(e, n), c = t.__tres.previousAttach;
418
+ c === void 0 ? delete i[l] : i[l] = c, "__tresDetach" in i && i.__tresDetach();
419
+ } else
420
+ (s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
421
+ (a = t.__tres) == null || delete a.previousAttach;
422
+ }
423
+ function G(e, t, n) {
424
+ const r = e;
425
+ return r.__tres = {
426
+ type: "unknown",
427
+ eventCount: 0,
428
+ root: n,
429
+ handlers: {},
430
+ memoizedProps: {},
431
+ objects: [],
432
+ parent: null,
433
+ previousAttach: null,
434
+ ...t
435
+ }, r.__tres.attach || (r.isMaterial ? r.__tres.attach = "material" : r.isBufferGeometry ? r.__tres.attach = "geometry" : r.isFog && (r.__tres.attach = "fog")), r;
436
+ }
437
+ function pt(e) {
438
+ var n;
439
+ const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
440
+ t && t.render && t.render.canBeInvalidated.value && t.invalidate();
441
+ }
442
+ function nr(e, t, n) {
443
+ var s;
444
+ if (!V(e.setPixelRatio))
445
+ return;
446
+ let r = 0;
447
+ if (de(n) && n.length >= 2) {
448
+ const [a, i] = n;
449
+ r = rt.clamp(t, a, i);
450
+ } else kn(n) ? r = n : r = t;
451
+ r !== ((s = e.getPixelRatio) == null ? void 0 : s.call(e)) && e.setPixelRatio(r);
452
+ }
453
+ function rr(e, t, n, r, s) {
454
+ const a = [...t.__tres.objects], i = X(t);
455
+ if (e = X(e), i === e)
456
+ return !0;
457
+ const l = G(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
458
+ delete o.object;
459
+ for (const f of a)
460
+ mt(f, s), ht(f, s);
461
+ i.__tres.objects = [], r.remove(t);
462
+ for (const [f, v] of Object.entries(o))
463
+ r.patchProp(l, f, l[f], v);
464
+ n(e), r.insert(t, c);
465
+ for (const f of a)
466
+ r.insert(f, t);
467
+ return !0;
468
+ }
469
+ function X(e) {
470
+ return Dn(e) ? (e.object.__tres = e.__tres, e.object) : e;
471
+ }
472
+ function mt(e, t) {
473
+ var r, s, a, i;
474
+ const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
475
+ e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && Zn(n.__tres.objects, (l) => l !== e), (s = e.__tres) != null && s.attach ? tr(n, e, e.__tres.attach) : ((i = (a = e.parent) == null ? void 0 : a.remove) == null || i.call(a, X(e)), e.parent = null);
476
+ }
477
+ function ht(e, t) {
478
+ var n;
479
+ (n = e.traverse) == null || n.call(e, (r) => {
480
+ var s;
481
+ t.deregisterCamera(r), (s = t.eventManager) == null || s.deregisterPointerMissedObject(r);
482
+ }), t.deregisterCamera(e), pt(e);
483
+ }
484
+ const or = Number.parseInt(Bt.replace("dev", "")), ie = {
333
485
  realistic: {
334
486
  shadows: !0,
335
487
  physicallyCorrectLights: !0,
336
- outputColorSpace: Mt,
337
- toneMapping: Je,
488
+ outputColorSpace: It,
489
+ toneMapping: st,
338
490
  toneMappingExposure: 3,
339
491
  shadowMap: {
340
492
  enabled: !0,
341
- type: Pt
493
+ type: Ht
342
494
  }
343
495
  },
344
496
  flat: {
345
- toneMapping: _t,
497
+ toneMapping: $t,
346
498
  toneMappingExposure: 1
347
499
  }
348
500
  };
349
- function Dr({
501
+ function sr({
350
502
  canvas: e,
351
503
  options: t,
352
- contextParts: { sizes: r, render: o, invalidate: s, advance: c }
504
+ contextParts: { sizes: n, render: r, invalidate: s, advance: a }
353
505
  }) {
354
- const i = D(() => ({
355
- alpha: T(t.alpha) ?? !0,
356
- depth: T(t.depth),
357
- canvas: Ht(e),
358
- context: T(t.context),
359
- stencil: T(t.stencil),
360
- antialias: T(t.antialias) ?? !0,
361
- precision: T(t.precision),
362
- powerPreference: T(t.powerPreference),
363
- premultipliedAlpha: T(t.premultipliedAlpha),
364
- preserveDrawingBuffer: T(t.preserveDrawingBuffer),
365
- logarithmicDepthBuffer: T(t.logarithmicDepthBuffer),
366
- failIfMajorPerformanceCaveat: T(t.failIfMajorPerformanceCaveat)
367
- })), a = H(new ae(i.value));
368
- function n() {
506
+ const i = Y(() => ({
507
+ alpha: k(t.alpha) ?? !0,
508
+ depth: k(t.depth),
509
+ canvas: Zt(e),
510
+ context: k(t.context),
511
+ stencil: k(t.stencil),
512
+ antialias: k(t.antialias) ?? !0,
513
+ precision: k(t.precision),
514
+ powerPreference: k(t.powerPreference),
515
+ premultipliedAlpha: k(t.premultipliedAlpha),
516
+ preserveDrawingBuffer: k(t.preserveDrawingBuffer),
517
+ logarithmicDepthBuffer: k(t.logarithmicDepthBuffer),
518
+ failIfMajorPerformanceCaveat: k(t.failIfMajorPerformanceCaveat)
519
+ })), l = H(new he(i.value));
520
+ function c() {
369
521
  t.renderMode === "on-demand" && s();
370
522
  }
371
- G(i, () => {
372
- a.value.dispose(), a.value = new ae(i.value), n();
373
- }), G([r.width, r.height], () => {
374
- a.value.setSize(r.width.value, r.height.value), n();
523
+ le(i, () => {
524
+ l.value.dispose(), l.value = new he(i.value), c();
525
+ }), le([n.width, n.height], () => {
526
+ l.value.setSize(n.width.value, n.height.value), c();
375
527
  }, {
376
528
  immediate: !0
377
- }), G(() => t.clearColor, n);
378
- const { pixelRatio: f } = $t();
379
- G(f, () => {
380
- a.value.setPixelRatio(f.value);
381
- });
382
- const { logError: h } = $(), w = (() => {
383
- const p = new ae(), P = {
529
+ }), le(() => t.clearColor, c);
530
+ const { pixelRatio: o } = en(), { logError: f } = z(), u = (() => {
531
+ const p = new he(), P = {
384
532
  shadowMap: {
385
533
  enabled: p.shadowMap.enabled,
386
534
  type: p.shadowMap.type
@@ -390,402 +538,509 @@ function Dr({
390
538
  outputColorSpace: p.outputColorSpace
391
539
  };
392
540
  return p.dispose(), P;
393
- })(), b = T(t.renderMode);
394
- return b === "on-demand" && s(), b === "manual" && setTimeout(() => {
395
- c();
396
- }, 100), ve(() => {
397
- const p = T(t.preset);
398
- p && (p in Z || h(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ze(a.value, Z[p])), b === "always" && (o.frames.value = Math.max(1, o.frames.value));
399
- const P = (d, M) => {
400
- const _ = T(d), u = () => {
541
+ })(), _ = k(t.renderMode);
542
+ return _ === "on-demand" && s(), _ === "manual" && setTimeout(() => {
543
+ a();
544
+ }, 100), Te(() => {
545
+ const p = k(t.preset);
546
+ p && (p in ie || f(`Renderer Preset must be one of these: ${Object.keys(ie).join(", ")}`), ut(l.value, ie[p])), nr(l.value, o.value, k(t.dpr)), _ === "always" && (r.frames.value = Math.max(1, r.frames.value));
547
+ const P = (g, E) => {
548
+ const C = k(g), T = () => {
401
549
  if (p)
402
- return Ie(Z[p], M);
550
+ return Ve(ie[p], E);
403
551
  };
404
- if (_ !== void 0)
405
- return _;
406
- const v = u();
407
- return v !== void 0 ? v : Ie(w, M);
408
- }, y = (d, M) => Er(a.value, M, P(d, M));
409
- y(t.shadows, "shadowMap.enabled"), y(t.toneMapping ?? Je, "toneMapping"), y(t.shadowMapType, "shadowMap.type"), Lr < 150 && y(!t.useLegacyLights, "physicallyCorrectLights"), y(t.outputColorSpace, "outputColorSpace"), y(t.toneMappingExposure, "toneMappingExposure");
410
- const g = P(t.clearColor, "clearColor");
411
- g && a.value.setClearColor(
412
- g ? hr(g) : new re(0)
552
+ if (C !== void 0)
553
+ return C;
554
+ const M = T();
555
+ return M !== void 0 ? M : Ve(u, E);
556
+ }, m = (g, E) => Vn(l.value, E, P(g, E));
557
+ m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? st, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), or < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
558
+ const y = P(t.clearColor, "clearColor");
559
+ y && l.value.setClearColor(
560
+ y ? $n(y) : new ce(0)
413
561
  // default clear color is not easily/efficiently retrievable from three
414
562
  );
415
- }), N(() => {
416
- a.value.dispose(), a.value.forceContextLoss();
563
+ }), Q(() => {
564
+ l.value.dispose(), l.value.forceContextLoss();
417
565
  }), {
418
- renderer: a
566
+ renderer: l
419
567
  };
420
568
  }
421
- const ee = (e) => typeof e == "function", Br = (e) => !!e && e.constructor === Array;
422
- function jr(e) {
569
+ const ir = (e) => !!e && e.constructor === Array;
570
+ function ar(e) {
423
571
  const t = { nodes: {}, materials: {} };
424
- return e && e.traverse((r) => {
425
- r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
572
+ return e && e.traverse((n) => {
573
+ n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
426
574
  }), t;
427
575
  }
428
- async function mn(e, t, r, o, s) {
429
- const { logError: c } = $(), i = new e();
430
- s && s(i), r && r(i);
431
- const n = (Array.isArray(t) ? t : [t]).map(
432
- (f) => new Promise((h, l) => {
576
+ async function Wr(e, t, n, r, s) {
577
+ const { logError: a } = z(), i = new e();
578
+ s && s(i), n && n(i);
579
+ const c = (Array.isArray(t) ? t : [t]).map(
580
+ (o) => new Promise((f, v) => {
433
581
  i.load(
434
- f,
435
- (w) => {
436
- w.scene && Object.assign(w, jr(w.scene)), h(w);
437
- },
438
582
  o,
439
- (w) => l(c("[useLoader] - Failed to load resource", w))
583
+ (u) => {
584
+ u.scene && Object.assign(u, ar(u.scene)), f(u);
585
+ },
586
+ r,
587
+ (u) => v(a("[useLoader] - Failed to load resource", u))
440
588
  );
441
589
  })
442
590
  );
443
- return Br(t) ? await Promise.all(n) : await n[0];
591
+ return ir(t) ? await Promise.all(c) : await c[0];
444
592
  }
445
- async function gn(e, t) {
446
- const r = new Ct(t), o = (s) => new Promise((c, i) => {
447
- r.load(
593
+ async function Nr(e, t) {
594
+ const n = new Ut(t), r = (s) => new Promise((a, i) => {
595
+ n.load(
448
596
  s,
449
- (a) => c(a),
597
+ (l) => a(l),
450
598
  () => null,
451
599
  () => {
452
600
  i(new Error("[useTextures] - Failed to load texture"));
453
601
  }
454
602
  );
455
603
  });
456
- if (Tr(e)) {
457
- const s = await Promise.all(e.map((c) => o(c)));
604
+ if (qn(e)) {
605
+ const s = await Promise.all(e.map((a) => r(a)));
458
606
  return e.length > 1 ? s : s[0];
459
607
  } else {
460
608
  const {
461
609
  map: s,
462
- displacementMap: c,
610
+ displacementMap: a,
463
611
  normalMap: i,
464
- roughnessMap: a,
465
- metalnessMap: n,
466
- aoMap: f,
467
- alphaMap: h,
468
- matcap: l
612
+ roughnessMap: l,
613
+ metalnessMap: c,
614
+ aoMap: o,
615
+ alphaMap: f,
616
+ matcap: v
469
617
  } = e;
470
618
  return {
471
- map: s ? await o(s) : null,
472
- displacementMap: c ? await o(c) : null,
473
- normalMap: i ? await o(i) : null,
474
- roughnessMap: a ? await o(a) : null,
475
- metalnessMap: n ? await o(n) : null,
476
- aoMap: f ? await o(f) : null,
477
- alphaMap: h ? await o(h) : null,
478
- matcap: l ? await o(l) : null
619
+ map: s ? await r(s) : null,
620
+ displacementMap: a ? await r(a) : null,
621
+ normalMap: i ? await r(i) : null,
622
+ roughnessMap: l ? await r(l) : null,
623
+ metalnessMap: c ? await r(c) : null,
624
+ aoMap: o ? await r(o) : null,
625
+ alphaMap: f ? await r(f) : null,
626
+ matcap: v ? await r(v) : null
479
627
  };
480
628
  }
481
629
  }
482
- const tt = (e, t) => {
483
- const r = D(() => t.renderer.value.domElement), o = H([]), { x: s, y: c } = Ft({ target: r }), i = D(() => e.value.filter((m) => {
484
- var C;
485
- return ((C = m.__tres) == null ? void 0 : C.eventCount) > 0;
486
- }));
487
- let a = 0;
488
- const { width: n, height: f, top: h, left: l } = Ut(r), w = ({ x: m, y: C }) => {
489
- if (r.value)
630
+ const lr = (e, t) => {
631
+ const n = Y(() => t.renderer.value.domElement), r = H([]), { x: s, y: a } = tn({ target: n });
632
+ let i = 0;
633
+ const { width: l, height: c, top: o, left: f } = nn(n), v = ({ x: h, y: S }) => {
634
+ if (n.value)
490
635
  return {
491
- x: (m - l.value) / n.value * 2 - 1,
492
- y: -((C - h.value) / f.value) * 2 + 1
636
+ x: (h - f.value) / l.value * 2 - 1,
637
+ y: -((S - o.value) / c.value) * 2 + 1
493
638
  };
494
- }, b = ({ x: m, y: C }) => {
639
+ }, u = ({ x: h, y: S }) => {
495
640
  if (t.camera.value)
496
- return t.raycaster.value.setFromCamera(new le(m, C), t.camera.value), o.value = t.raycaster.value.intersectObjects(i.value, !0), o.value;
497
- }, p = (m) => {
498
- const C = w({
499
- x: (m == null ? void 0 : m.clientX) ?? s.value,
500
- y: (m == null ? void 0 : m.clientY) ?? c.value
641
+ return t.raycaster.value.setFromCamera(new ge(h, S), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
642
+ }, _ = (h) => {
643
+ const S = v({
644
+ x: (h == null ? void 0 : h.clientX) ?? s.value,
645
+ y: (h == null ? void 0 : h.clientY) ?? a.value
501
646
  });
502
- return C ? b(C) || [] : [];
503
- }, P = A(), y = A(), g = A(), d = A(), M = A(), _ = A(), u = A(), v = A();
504
- function E(m) {
505
- const C = {};
506
- for (const R in m)
507
- typeof R != "function" && (C[R] = m[R]);
508
- return C;
647
+ return S ? u(S) || [] : [];
648
+ }, p = j(), P = j(), m = j(), y = j(), g = j(), E = j(), C = j(), T = j();
649
+ function M(h) {
650
+ const S = {};
651
+ for (const U in h)
652
+ typeof U != "function" && (S[U] = h[U]);
653
+ return S;
509
654
  }
510
- const S = (m, C) => {
511
- var Ee, Se, Te;
512
- const R = E(C), Q = new he(C == null ? void 0 : C.clientX, C == null ? void 0 : C.clientY, 0).unproject((Ee = t.camera) == null ? void 0 : Ee.value);
513
- m.trigger({
514
- ...R,
515
- intersections: o.value,
655
+ const w = (h, S) => {
656
+ var Oe, De, je;
657
+ const U = M(S), ne = new Se(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Oe = t.camera) == null ? void 0 : Oe.value);
658
+ h.trigger({
659
+ ...U,
660
+ intersections: r.value,
516
661
  // The unprojectedPoint is wrong, math needs to be fixed
517
- unprojectedPoint: Q,
518
- ray: (Se = t.raycaster) == null ? void 0 : Se.value.ray,
519
- camera: (Te = t.camera) == null ? void 0 : Te.value,
520
- sourceEvent: C,
521
- delta: a,
662
+ unprojectedPoint: ne,
663
+ ray: (De = t.raycaster) == null ? void 0 : De.value.ray,
664
+ camera: (je = t.camera) == null ? void 0 : je.value,
665
+ sourceEvent: S,
666
+ delta: i,
522
667
  stopPropagating: !1
523
668
  });
524
669
  };
525
- let B;
526
- const x = (m) => {
527
- p(m), S(g, m), B = m;
528
- }, k = () => {
529
- B && x(B);
670
+ let L;
671
+ const x = (h) => {
672
+ _(h), w(m, h), L = h;
673
+ }, d = () => {
674
+ L && x(L);
530
675
  };
531
- let F, O, q;
532
- const Y = (m) => {
533
- var C;
534
- F = (C = o.value[0]) == null ? void 0 : C.object, a = 0, O = new le(
535
- (m == null ? void 0 : m.clientX) ?? s.value,
536
- (m == null ? void 0 : m.clientY) ?? c.value
537
- ), S(M, m);
676
+ let b, A, D;
677
+ const $ = (h) => {
678
+ var S;
679
+ b = (S = r.value[0]) == null ? void 0 : S.object, i = 0, A = new ge(
680
+ (h == null ? void 0 : h.clientX) ?? s.value,
681
+ (h == null ? void 0 : h.clientY) ?? a.value
682
+ ), w(g, h);
538
683
  };
539
- let se, J = !1;
540
- const Me = (m) => {
541
- var C, R, Q;
542
- m instanceof PointerEvent && (o.value.length === 0 && S(_, m), F === ((C = o.value[0]) == null ? void 0 : C.object) && (q = new le(
543
- (m == null ? void 0 : m.clientX) ?? s.value,
544
- (m == null ? void 0 : m.clientY) ?? c.value
545
- ), a = O == null ? void 0 : O.distanceTo(q), m.button === 0 ? (S(P, m), se === ((R = o.value[0]) == null ? void 0 : R.object) ? J = !0 : (se = (Q = o.value[0]) == null ? void 0 : Q.object, J = !1)) : m.button === 2 && S(u, m)), S(d, m));
546
- }, Pe = (m) => {
547
- J && (S(y, m), se = void 0, J = !1);
548
- }, _e = (m) => S(g, m), Ce = (m) => S(v, m);
549
- return r.value.addEventListener("pointerup", Me), r.value.addEventListener("pointerdown", Y), r.value.addEventListener("pointermove", x), r.value.addEventListener("pointerleave", _e), r.value.addEventListener("dblclick", Pe), r.value.addEventListener("wheel", Ce), N(() => {
550
- r != null && r.value && (r.value.removeEventListener("pointerup", Me), r.value.removeEventListener("pointerdown", Y), r.value.removeEventListener("pointermove", x), r.value.removeEventListener("pointerleave", _e), r.value.removeEventListener("dblclick", Pe), r.value.removeEventListener("wheel", Ce));
684
+ let R, O = !1;
685
+ const q = (h) => {
686
+ var S, U, ne;
687
+ h instanceof PointerEvent && (r.value.length === 0 && w(E, h), b === ((S = r.value[0]) == null ? void 0 : S.object) && (D = new ge(
688
+ (h == null ? void 0 : h.clientX) ?? s.value,
689
+ (h == null ? void 0 : h.clientY) ?? a.value
690
+ ), i = A == null ? void 0 : A.distanceTo(D), h.button === 0 ? (w(p, h), R === ((U = r.value[0]) == null ? void 0 : U.object) ? O = !0 : (R = (ne = r.value[0]) == null ? void 0 : ne.object, O = !1)) : h.button === 2 && w(C, h)), w(y, h));
691
+ }, xe = (h) => {
692
+ O && (w(P, h), R = void 0, O = !1);
693
+ }, Le = (h) => w(m, h), Re = (h) => w(T, h);
694
+ return n.value.addEventListener("pointerup", q), n.value.addEventListener("pointerdown", $), n.value.addEventListener("pointermove", x), n.value.addEventListener("pointerleave", Le), n.value.addEventListener("dblclick", xe), n.value.addEventListener("wheel", Re), Q(() => {
695
+ n != null && n.value && (n.value.removeEventListener("pointerup", q), n.value.removeEventListener("pointerdown", $), n.value.removeEventListener("pointermove", x), n.value.removeEventListener("pointerleave", Le), n.value.removeEventListener("dblclick", xe), n.value.removeEventListener("wheel", Re));
551
696
  }), {
552
- intersects: o,
553
- onClick: (m) => P.on(m).off,
554
- onDblClick: (m) => y.on(m).off,
555
- onContextMenu: (m) => u.on(m).off,
556
- onPointerMove: (m) => g.on(m).off,
557
- onPointerUp: (m) => d.on(m).off,
558
- onPointerDown: (m) => M.on(m).off,
559
- onPointerMissed: (m) => _.on(m).off,
560
- onWheel: (m) => v.on(m).off,
561
- forceUpdate: k
697
+ intersects: r,
698
+ onClick: (h) => p.on(h).off,
699
+ onDblClick: (h) => P.on(h).off,
700
+ onContextMenu: (h) => C.on(h).off,
701
+ onPointerMove: (h) => m.on(h).off,
702
+ onPointerUp: (h) => y.on(h).off,
703
+ onPointerDown: (h) => g.on(h).off,
704
+ onPointerMissed: (h) => E.on(h).off,
705
+ onWheel: (h) => T.on(h).off,
706
+ forceUpdate: d
562
707
  };
563
708
  };
564
- function vn() {
565
- const { logWarning: e } = $();
566
- function t(c, i, a) {
567
- let n = null;
568
- return c.traverse((f) => {
569
- f[i] === a && (n = f);
570
- }), n || e(`Child with ${i} '${a}' not found.`), n;
709
+ function zr() {
710
+ const { logWarning: e } = z();
711
+ function t(a, i, l) {
712
+ let c = null;
713
+ return a.traverse((o) => {
714
+ o[i] === l && (c = o);
715
+ }), c || e(`Child with ${i} '${l}' not found.`), c;
571
716
  }
572
- function r(c, i, a) {
573
- const n = [];
574
- return c.traverse((f) => {
575
- f[i].includes(a) && n.push(f);
576
- }), n.length || e(`Children with ${i} '${a}' not found.`), n;
717
+ function n(a, i, l) {
718
+ const c = [];
719
+ return a.traverse((o) => {
720
+ o[i].includes(l) && c.push(o);
721
+ }), c.length || e(`Children with ${i} '${l}' not found.`), c;
577
722
  }
578
- function o(c, i) {
579
- return t(c, "name", i);
723
+ function r(a, i) {
724
+ return t(a, "name", i);
580
725
  }
581
- function s(c, i) {
582
- return r(c, "name", i);
726
+ function s(a, i) {
727
+ return n(a, "name", i);
583
728
  }
584
729
  return {
585
730
  seek: t,
586
- seekByName: o,
587
- seekAll: r,
731
+ seekByName: r,
732
+ seekAll: n,
588
733
  seekAllByName: s
589
734
  };
590
735
  }
591
- const hn = (e) => {
592
- const t = ze({
593
- click: /* @__PURE__ */ new Map(),
594
- pointerMove: /* @__PURE__ */ new Map(),
595
- pointerEnter: /* @__PURE__ */ new Map(),
596
- pointerLeave: /* @__PURE__ */ new Map()
597
- }), r = L(/* @__PURE__ */ new Set()), o = (l) => {
598
- r.value.add(l);
599
- }, s = (l) => {
600
- r.value.delete(l);
601
- }, c = (l) => {
602
- Object.values(t).forEach((w) => w.delete(l)), s(l);
603
- }, i = (l) => {
604
- const { onClick: w, onPointerMove: b, onPointerEnter: p, onPointerLeave: P } = l;
605
- w && t.click.set(l, w), b && t.pointerMove.set(l, b), p && t.pointerEnter.set(l, p), P && t.pointerLeave.set(l, P);
606
- }, a = D(
607
- () => Cr(
608
- [
609
- ...Array.from(r.value),
610
- ...Object.values(t).map((l) => Array.from(l.keys())).flat()
611
- ],
612
- ({ uuid: l }) => l
613
- )
614
- );
615
- e.registerObjectAtPointerEventHandler = i, e.deregisterObjectAtPointerEventHandler = c, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = s;
616
- const { onClick: n, onPointerMove: f } = tt(a, e);
617
- n(({ intersects: l, event: w }) => {
618
- var b;
619
- l.length && ((b = t.click.get(l[0].object)) == null || b(l[0], w));
620
- });
621
- let h;
622
- return f(({ intersects: l, event: w }) => {
623
- var g, d, M, _;
624
- const b = (g = l == null ? void 0 : l[0]) == null ? void 0 : g.object, { pointerLeave: p, pointerEnter: P, pointerMove: y } = t;
625
- h && h !== b && ((d = p.get(h)) == null || d(h, w)), b && (h !== b && ((M = P.get(b)) == null || M(l[0], w)), (_ = y.get(b)) == null || _(l[0], w)), h = b || null;
626
- }), {
627
- registerObject: i,
628
- deregisterObject: c,
629
- registerBlockingObject: o,
630
- deregisterBlockingObject: s
631
- };
632
- };
633
- function be(e) {
736
+ function ke(e) {
634
737
  let t = 0;
635
- return e.traverse((r) => {
636
- if (r.isMesh && r.geometry) {
637
- const o = r.geometry, s = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, c = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, n = s + c + i + a;
638
- t += n;
738
+ return e.traverse((n) => {
739
+ if (n.isMesh && n.geometry) {
740
+ const r = n.geometry, s = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, a = r.index ? r.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = r.attributes.normal ? r.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, l = r.attributes.uv ? r.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, c = s + a + i + l;
741
+ t += c;
639
742
  }
640
743
  }), t;
641
744
  }
642
- function Rr(e) {
745
+ function cr(e) {
643
746
  return (e / 1024).toFixed(2);
644
747
  }
645
- const de = L({}), me = (e) => Object.assign(de.value, e);
646
- function Ir(e, t, r = 10) {
647
- const o = T(e) ? Wt() : Nt(D(() => T(t).parentElement)), s = ue(De(o.width, r)), c = ue(De(o.height, r)), i = D(() => s.value / c.value);
748
+ const Me = I({}), Ce = (e) => Object.assign(Me.value, e);
749
+ function ur(e, t, n) {
750
+ var x;
751
+ const r = H(), s = H();
752
+ e && (r.value = e), t && (s.value = t);
753
+ const a = (d) => {
754
+ var b;
755
+ return ((b = d.__tres) == null ? void 0 : b.eventCount) > 0;
756
+ }, i = (d) => {
757
+ var b;
758
+ return ((b = d.children) == null ? void 0 : b.some((A) => i(A))) || a(d);
759
+ }, l = H(((x = r.value) == null ? void 0 : x.children).filter(i) || []);
760
+ function c(d, b) {
761
+ if (Array.isArray(d))
762
+ for (const A of d)
763
+ A(b);
764
+ typeof d == "function" && d(b);
765
+ }
766
+ function o(d, b) {
767
+ const A = [], D = () => b.stopPropagating = !0;
768
+ b.stopPropagation = D;
769
+ for (const $ of b == null ? void 0 : b.intersections) {
770
+ if (b.stopPropagating)
771
+ return;
772
+ b = { ...b, ...$ };
773
+ const { object: R } = $;
774
+ b.eventObject = R, c(R[d], b), A.push(R);
775
+ let O = R.parent;
776
+ for (; O !== null && !b.stopPropagating && !A.includes(O); )
777
+ b.eventObject = O, c(O[d], b), A.push(O), O = O.parent;
778
+ const q = zn(d.slice(2));
779
+ n(q, { intersection: $, event: b });
780
+ }
781
+ }
782
+ const {
783
+ onClick: f,
784
+ onDblClick: v,
785
+ onContextMenu: u,
786
+ onPointerMove: _,
787
+ onPointerDown: p,
788
+ onPointerUp: P,
789
+ onPointerMissed: m,
790
+ onWheel: y,
791
+ forceUpdate: g
792
+ } = lr(l, t);
793
+ P((d) => o("onPointerUp", d)), p((d) => o("onPointerDown", d)), f((d) => o("onClick", d)), v((d) => o("onDoubleClick", d)), u((d) => o("onContextMenu", d)), y((d) => o("onWheel", d));
794
+ let E = [];
795
+ _((d) => {
796
+ const b = d.intersections.map(({ object: D }) => D), A = d.intersections;
797
+ E.forEach(({ object: D }) => {
798
+ b.includes(D) || (d.intersections = E, o("onPointerLeave", d), o("onPointerOut", d));
799
+ }), d.intersections = A, d.intersections.forEach(({ object: D }) => {
800
+ E.includes(D) || (o("onPointerEnter", d), o("onPointerOver", d));
801
+ }), o("onPointerMove", d), E = d.intersections;
802
+ });
803
+ const C = [];
804
+ m((d) => {
805
+ const b = () => d.stopPropagating = !0;
806
+ d.stopPropagation = b, C.forEach((A) => {
807
+ d.stopPropagating || (d.eventObject = A, c(A.onPointerMissed, d));
808
+ }), n("pointer-missed", { event: d });
809
+ });
810
+ function T(d) {
811
+ re(d) && W(d) && l.value.push(d);
812
+ }
813
+ function M(d) {
814
+ if (re(d) && W(d)) {
815
+ const b = l.value.indexOf(d);
816
+ b > -1 && l.value.splice(b, 1);
817
+ }
818
+ }
819
+ function w(d) {
820
+ re(d) && W(d) && d.onPointerMissed && C.push(d);
821
+ }
822
+ function L(d) {
823
+ if (re(d) && W(d)) {
824
+ const b = C.indexOf(d);
825
+ b > -1 && C.splice(b, 1);
826
+ }
827
+ }
828
+ return t.eventManager = {
829
+ forceUpdate: g,
830
+ registerObject: T,
831
+ deregisterObject: M,
832
+ registerPointerMissedObject: w,
833
+ deregisterPointerMissedObject: L
834
+ }, {
835
+ forceUpdate: g,
836
+ registerObject: T,
837
+ deregisterObject: M,
838
+ registerPointerMissedObject: w,
839
+ deregisterPointerMissedObject: L
840
+ };
841
+ }
842
+ function fr(e, t, n = 10) {
843
+ const r = k(e) ? rn() : on(Y(() => k(t).parentElement)), s = ye(Fe(r.width, n)), a = ye(Fe(r.height, n)), i = Y(() => s.value / a.value);
648
844
  return {
649
- height: c,
845
+ height: a,
650
846
  width: s,
651
847
  aspectRatio: i
652
848
  };
653
849
  }
654
- function ce() {
850
+ function ve() {
655
851
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
656
- let r = 0, o = !1;
852
+ let n = 0, r = !1;
657
853
  const s = () => {
658
- const f = Array.from(e.entries()).sort((h, l) => {
659
- const w = h[1].priority - l[1].priority;
660
- return w === 0 ? h[1].addI - l[1].addI : w;
854
+ const o = Array.from(e.entries()).sort((f, v) => {
855
+ const u = f[1].priority - v[1].priority;
856
+ return u === 0 ? f[1].addI - v[1].addI : u;
661
857
  });
662
- t.clear(), f.forEach((h) => t.add(h[0]));
663
- }, c = (f) => {
664
- e.delete(f), t.delete(f);
858
+ t.clear(), o.forEach((f) => t.add(f[0]));
859
+ }, a = (o) => {
860
+ e.delete(o), t.delete(o);
665
861
  };
666
- return { on: (f, h = 0) => {
667
- e.set(f, { priority: h, addI: r++ });
668
- const l = () => c(f);
669
- return zt(l), o = !0, {
670
- off: l
862
+ return { on: (o, f = 0) => {
863
+ e.set(o, { priority: f, addI: n++ });
864
+ const v = () => a(o);
865
+ return sn(v), r = !0, {
866
+ off: v
671
867
  };
672
- }, off: c, trigger: (...f) => {
673
- o && (s(), o = !1), t.forEach((h) => h(...f));
868
+ }, off: a, trigger: (...o) => {
869
+ r && (s(), r = !1), t.forEach((f) => f(...o));
674
870
  }, dispose: () => {
675
871
  e.clear(), t.clear();
676
872
  }, get count() {
677
873
  return e.size;
678
874
  } };
679
875
  }
680
- function Hr() {
681
- const e = new Ve(!1), t = L(!1), r = L(!1);
682
- let o;
683
- const s = Et.generateUUID();
876
+ function dr() {
877
+ let e = !0, t = !0, n = !1;
878
+ const r = new tt(!1), s = I(r.running), a = I(!1);
879
+ let i;
880
+ const l = rt.generateUUID();
684
881
  let c = null;
685
- const i = ce(), a = ce(), n = ce();
686
- let f = {};
687
- function h(M) {
688
- f = M;
882
+ const o = ve(), f = ve(), v = ve();
883
+ M();
884
+ let u = {};
885
+ function _(w) {
886
+ u = w;
689
887
  }
690
- function l(M, _, u = 0) {
691
- switch (_) {
888
+ function p(w, L, x = 0) {
889
+ switch (L) {
692
890
  case "before":
693
- return i.on(M, u);
891
+ return o.on(w, x);
694
892
  case "render":
695
- return c || (c = M), a.dispose(), a.on(M);
893
+ return c || (c = w), f.dispose(), f.on(w);
696
894
  case "after":
697
- return n.on(M, u);
895
+ return v.on(w, x);
698
896
  }
699
897
  }
700
- function w() {
701
- t.value || (e.start(), t.value = !0, d());
702
- }
703
- function b() {
704
- t.value && (e.stop(), cancelAnimationFrame(o), t.value = !1);
705
- }
706
- function p() {
707
- e.stop(), t.value = !1;
708
- }
709
898
  function P() {
710
- e.start(), t.value = !0;
899
+ t && (t = !1, M(), T());
900
+ }
901
+ function m() {
902
+ t = !0, M(), cancelAnimationFrame(i);
711
903
  }
712
904
  function y() {
713
- r.value = !0;
905
+ n = !1, M();
714
906
  }
715
907
  function g() {
716
- r.value = !1;
908
+ n = !0, M();
909
+ }
910
+ function E() {
911
+ a.value = !0;
912
+ }
913
+ function C() {
914
+ a.value = !1;
915
+ }
916
+ function T() {
917
+ if (!e) {
918
+ i = requestAnimationFrame(T);
919
+ return;
920
+ }
921
+ const w = r.getDelta(), L = r.getElapsedTime(), x = {
922
+ camera: K(u.camera),
923
+ scene: K(u.scene),
924
+ renderer: K(u.renderer),
925
+ raycaster: K(u.raycaster),
926
+ controls: K(u.controls),
927
+ invalidate: u.invalidate,
928
+ advance: u.advance
929
+ }, d = { delta: w, elapsed: L, clock: r, ...x };
930
+ s.value && o.trigger(d), a.value || (f.count ? f.trigger(d) : c && c(d)), s.value && v.trigger(d), i = requestAnimationFrame(T);
931
+ }
932
+ function M() {
933
+ const w = !t && !n;
934
+ r.running !== w && (r.running ? r.stop() : r.start()), s.value = r.running;
935
+ }
936
+ return {
937
+ loopId: l,
938
+ register: (w, L, x) => p(w, L, x),
939
+ start: P,
940
+ stop: m,
941
+ pause: g,
942
+ resume: y,
943
+ pauseRender: E,
944
+ resumeRender: C,
945
+ isRenderPaused: a,
946
+ isActive: s,
947
+ setContext: _,
948
+ setReady: (w) => e = w
949
+ };
950
+ }
951
+ function pr(e, t, n = 100) {
952
+ n = n <= 0 ? 100 : n;
953
+ const r = j(), s = /* @__PURE__ */ new Set();
954
+ let a = !1, i = !1, l = null;
955
+ function c() {
956
+ l && clearTimeout(l), !i && !a && e() ? (r.trigger(t), s.forEach((u) => u()), s.clear(), a = !0) : !i && !a && (l = setTimeout(c, n));
717
957
  }
718
- function d() {
719
- const M = e.getDelta(), _ = e.getElapsedTime(), u = {
720
- camera: W(f.camera),
721
- scene: W(f.scene),
722
- renderer: W(f.renderer),
723
- raycaster: W(f.raycaster),
724
- controls: W(f.controls),
725
- invalidate: f.invalidate,
726
- advance: f.advance
727
- }, v = { delta: M, elapsed: _, clock: e, ...u };
728
- t.value && i.trigger(v), r.value || (a.count ? a.trigger(v) : c && c(v)), t.value && n.trigger(v), o = requestAnimationFrame(d);
958
+ function o() {
959
+ i = !0, l && clearTimeout(l);
729
960
  }
961
+ c();
962
+ const f = (u, ..._) => {
963
+ u(..._);
964
+ };
730
965
  return {
731
- loopId: s,
732
- register: (M, _, u) => l(M, _, u),
733
- start: w,
734
- stop: b,
735
- pause: p,
736
- resume: P,
737
- pauseRender: y,
738
- resumeRender: g,
739
- isRenderPaused: r,
740
- isActive: t,
741
- setContext: h
966
+ on: (u) => {
967
+ if (a)
968
+ return f(u, t), { off: () => {
969
+ } };
970
+ {
971
+ const _ = r.on(u);
972
+ return s.add(_.off), r.on(u);
973
+ }
974
+ },
975
+ off: r.off,
976
+ trigger: r.trigger,
977
+ cancel: o
742
978
  };
743
979
  }
744
- function $r({
980
+ const te = /* @__PURE__ */ new WeakMap();
981
+ function gt(e) {
982
+ if (e = e || pe(), te.has(e))
983
+ return te.get(e);
984
+ const t = 100, n = Date.now(), a = pr(() => {
985
+ if (Date.now() - n >= t)
986
+ return !0;
987
+ {
988
+ const i = e.renderer.value, l = (i == null ? void 0 : i.domElement) || { width: 0, height: 0 };
989
+ return !!(i && l.width > 0 && l.height > 0);
990
+ }
991
+ }, e);
992
+ return te.set(e, a), a;
993
+ }
994
+ function Gr(e) {
995
+ const t = pe();
996
+ if (t)
997
+ return te.has(t) ? te.get(t).on(e) : gt(t).on(e);
998
+ }
999
+ function mr({
745
1000
  scene: e,
746
1001
  canvas: t,
747
- windowSize: r,
748
- disableRender: o,
1002
+ windowSize: n,
1003
+ disableRender: r,
749
1004
  rendererOptions: s,
750
- emit: c
1005
+ emit: a
751
1006
  }) {
752
- const { logWarning: i } = $(), a = H(e), n = Ir(r, t), {
753
- camera: f,
754
- cameras: h,
755
- registerCamera: l,
756
- deregisterCamera: w,
757
- setCameraActive: b
758
- } = dr({ sizes: n, scene: e }), p = {
759
- mode: L(s.renderMode || "always"),
760
- priority: L(0),
761
- frames: L(0),
1007
+ const { logWarning: i } = z(), l = H(e), c = fr(n, t), {
1008
+ camera: o,
1009
+ cameras: f,
1010
+ registerCamera: v,
1011
+ deregisterCamera: u,
1012
+ setCameraActive: _
1013
+ } = jn({ sizes: c, scene: e }), p = {
1014
+ mode: I(s.renderMode || "always"),
1015
+ priority: I(0),
1016
+ frames: I(0),
762
1017
  maxFrames: 60,
763
- canBeInvalidated: D(() => p.mode.value === "on-demand" && p.frames.value === 0)
1018
+ canBeInvalidated: Y(() => p.mode.value === "on-demand" && p.frames.value === 0)
764
1019
  };
765
- function P(O = 1) {
766
- s.renderMode === "on-demand" ? p.frames.value = Math.min(p.maxFrames, p.frames.value + O) : i("`invalidate` can only be used when `renderMode` is set to `on-demand`");
1020
+ function P(R = 1) {
1021
+ s.renderMode === "on-demand" ? p.frames.value = Math.min(p.maxFrames, p.frames.value + R) : i("`invalidate` can only be used when `renderMode` is set to `on-demand`");
767
1022
  }
768
- function y() {
1023
+ function m() {
769
1024
  s.renderMode === "manual" ? p.frames.value = 1 : i("`advance` can only be used when `renderMode` is set to `manual`");
770
1025
  }
771
- const { renderer: g } = Dr(
1026
+ const { renderer: y } = sr(
772
1027
  {
773
1028
  scene: e,
774
1029
  canvas: t,
775
1030
  options: s,
776
- emit: c,
1031
+ emit: a,
777
1032
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
778
- contextParts: { sizes: n, camera: f, render: p, invalidate: P, advance: y },
779
- disableRender: o
1033
+ contextParts: { sizes: c, camera: o, render: p, invalidate: P, advance: m },
1034
+ disableRender: r
780
1035
  }
781
- ), d = {
782
- sizes: n,
783
- scene: a,
784
- camera: f,
785
- cameras: ue(h),
786
- renderer: g,
787
- raycaster: H(new St()),
788
- controls: L(null),
1036
+ ), g = {
1037
+ sizes: c,
1038
+ scene: l,
1039
+ camera: o,
1040
+ cameras: ye(f),
1041
+ renderer: y,
1042
+ raycaster: H(new Ft()),
1043
+ controls: I(null),
789
1044
  perf: {
790
1045
  maxFrames: 160,
791
1046
  fps: {
@@ -799,151 +1054,105 @@ function $r({
799
1054
  }
800
1055
  },
801
1056
  render: p,
802
- advance: y,
803
- extend: me,
1057
+ advance: m,
1058
+ extend: Ce,
804
1059
  invalidate: P,
805
- registerCamera: l,
806
- setCameraActive: b,
807
- deregisterCamera: w,
808
- loop: Hr()
1060
+ registerCamera: v,
1061
+ setCameraActive: _,
1062
+ deregisterCamera: u,
1063
+ loop: dr()
809
1064
  };
810
- fe("useTres", d), d.scene.value.__tres = {
811
- root: d
812
- }, d.loop.register(() => {
813
- f.value && p.frames.value > 0 && (g.value.render(e, f.value), c("render", d.renderer.value)), p.priority.value = 0, p.mode.value === "always" ? p.frames.value = 1 : p.frames.value = Math.max(0, p.frames.value - 1);
814
- }, "render"), d.loop.start(), N(() => {
815
- d.loop.stop();
1065
+ _e("useTres", g), g.scene.value.__tres = {
1066
+ root: g
1067
+ }, g.loop.register(() => {
1068
+ o.value && p.frames.value > 0 && (y.value.render(e, o.value), a("render", g.renderer.value)), p.priority.value = 0, p.mode.value === "always" ? p.frames.value = 1 : p.frames.value = Math.max(0, p.frames.value - 1);
1069
+ }, "render");
1070
+ const { on: E, cancel: C } = gt(g);
1071
+ g.loop.setReady(!1), g.loop.start(), E(() => {
1072
+ a("ready", g), g.loop.setReady(!0), ur(e, g, a);
1073
+ }), Q(() => {
1074
+ C(), g.loop.stop();
816
1075
  });
817
- const M = 100, _ = Gt({ every: M }), { isSupported: u, memory: v } = Vt({ interval: M }), E = 160;
818
- let S = performance.now();
819
- const B = ({ timestamp: O }) => {
820
- d.scene.value && (d.perf.memory.allocatedMem = be(d.scene.value)), O - S >= M && (S = O, d.perf.fps.accumulator.push(_.value), d.perf.fps.accumulator.length > E && d.perf.fps.accumulator.shift(), d.perf.fps.value = _.value, u.value && v.value && (d.perf.memory.accumulator.push(v.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > E && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((q, Y) => q + Y, 0) / d.perf.memory.accumulator.length));
1076
+ const T = 100, M = an({ every: T }), { isSupported: w, memory: L } = ln({ interval: T }), x = 160;
1077
+ let d = performance.now();
1078
+ const b = ({ timestamp: R }) => {
1079
+ g.scene.value && (g.perf.memory.allocatedMem = ke(g.scene.value)), R - d >= T && (d = R, g.perf.fps.accumulator.push(M.value), g.perf.fps.accumulator.length > x && g.perf.fps.accumulator.shift(), g.perf.fps.value = M.value, w.value && L.value && (g.perf.memory.accumulator.push(L.value.usedJSHeapSize / 1024 / 1024), g.perf.memory.accumulator.length > x && g.perf.memory.accumulator.shift(), g.perf.memory.currentMem = g.perf.memory.accumulator.reduce((O, q) => O + q, 0) / g.perf.memory.accumulator.length));
821
1080
  };
822
- let x = 0;
823
- const k = 1, { pause: F } = Qe(({ delta: O }) => {
824
- window.__TRES__DEVTOOLS__ && (B({ timestamp: performance.now() }), x += O, x >= k && (window.__TRES__DEVTOOLS__.cb(d), x = 0));
1081
+ let A = 0;
1082
+ const D = 1, { pause: $ } = it(({ delta: R }) => {
1083
+ window.__TRES__DEVTOOLS__ && (b({ timestamp: performance.now() }), A += R, A >= D && (window.__TRES__DEVTOOLS__.cb(g), A = 0));
825
1084
  }, { immediate: !0 });
826
- return N(() => {
827
- F();
828
- }), d;
1085
+ return Q(() => {
1086
+ $();
1087
+ }), g;
829
1088
  }
830
- function rt() {
831
- const e = ct("useTres");
1089
+ function pe() {
1090
+ const e = Mt("useTres");
832
1091
  if (!e)
833
1092
  throw new Error("useTresContext must be used together with useTresContextProvider");
834
1093
  return e;
835
1094
  }
836
- const yn = rt;
837
- function wn() {
1095
+ const Vr = pe;
1096
+ function Yr() {
838
1097
  const {
839
1098
  camera: e,
840
1099
  scene: t,
841
- renderer: r,
842
- loop: o,
1100
+ renderer: n,
1101
+ loop: r,
843
1102
  raycaster: s,
844
- controls: c,
1103
+ controls: a,
845
1104
  invalidate: i,
846
- advance: a
847
- } = rt();
848
- o.setContext({
1105
+ advance: l
1106
+ } = pe();
1107
+ r.setContext({
849
1108
  camera: e,
850
1109
  scene: t,
851
- renderer: r,
1110
+ renderer: n,
852
1111
  raycaster: s,
853
- controls: c,
1112
+ controls: a,
854
1113
  invalidate: i,
855
- advance: a
1114
+ advance: l
856
1115
  });
857
- function n(l, w = 0) {
858
- return o.register(l, "before", w);
1116
+ function c(v, u = 0) {
1117
+ return r.register(v, "before", u);
859
1118
  }
860
- function f(l) {
861
- return o.register(l, "render");
1119
+ function o(v) {
1120
+ return r.register(v, "render");
862
1121
  }
863
- function h(l, w = 0) {
864
- return o.register(l, "after", w);
1122
+ function f(v, u = 0) {
1123
+ return r.register(v, "after", u);
865
1124
  }
866
1125
  return {
867
- pause: o.pause,
868
- resume: o.resume,
869
- pauseRender: o.pauseRender,
870
- resumeRender: o.resumeRender,
871
- isActive: o.isActive,
872
- onBeforeRender: n,
873
- render: f,
874
- onAfterRender: h
1126
+ pause: r.pause,
1127
+ resume: r.resume,
1128
+ pauseRender: r.pauseRender,
1129
+ resumeRender: r.resumeRender,
1130
+ isActive: r.isActive,
1131
+ onBeforeRender: c,
1132
+ render: o,
1133
+ onAfterRender: f
875
1134
  };
876
1135
  }
877
- function Fr(e, t, r) {
878
- const o = H(), s = H();
879
- e && (o.value = e), t && (s.value = t);
880
- const c = D(
881
- () => o.value ? o.value.children : []
882
- );
883
- function i(u, v) {
884
- if (Array.isArray(u))
885
- for (const E of u)
886
- E(v);
887
- typeof u == "function" && u(v);
888
- }
889
- function a(u, v) {
890
- const E = [], S = () => v.stopPropagating = !0;
891
- v.stopPropagation = S;
892
- for (const B of v == null ? void 0 : v.intersections) {
893
- if (v.stopPropagating)
894
- return;
895
- v = { ...v, ...B };
896
- const { object: x } = B;
897
- v.eventObject = x, i(x[u], v), E.push(x);
898
- let k = x.parent;
899
- for (; k !== null && !v.stopPropagating && !E.includes(k); )
900
- v.eventObject = k, i(k[u], v), E.push(k), k = k.parent;
901
- const F = Pr(u.slice(2));
902
- r(F, { intersection: B, event: v });
1136
+ function hr(e, t = {}, n = {}) {
1137
+ let r = e;
1138
+ const s = (l) => {
1139
+ r = l;
1140
+ };
1141
+ let a = new Proxy({}, {});
1142
+ const i = {
1143
+ has(l, c) {
1144
+ return c in t || c in r;
1145
+ },
1146
+ get(l, c, o) {
1147
+ return c in t ? t[c](r) : r[c];
1148
+ },
1149
+ set(l, c, o) {
1150
+ return n[c] ? n[c](o, r, a, s) : r[c] = o, !0;
903
1151
  }
904
- }
905
- const {
906
- onClick: n,
907
- onDblClick: f,
908
- onContextMenu: h,
909
- onPointerMove: l,
910
- onPointerDown: w,
911
- onPointerUp: b,
912
- onPointerMissed: p,
913
- onWheel: P,
914
- forceUpdate: y
915
- } = tt(c, t);
916
- b((u) => a("onPointerUp", u)), w((u) => a("onPointerDown", u)), n((u) => a("onClick", u)), f((u) => a("onDoubleClick", u)), h((u) => a("onContextMenu", u)), P((u) => a("onWheel", u));
917
- let g = [];
918
- l((u) => {
919
- const v = u.intersections.map(({ object: S }) => S), E = u.intersections;
920
- g.forEach(({ object: S }) => {
921
- v.includes(S) || (u.intersections = g, a("onPointerLeave", u), a("onPointerOut", u));
922
- }), u.intersections = E, u.intersections.forEach(({ object: S }) => {
923
- g.includes(S) || (a("onPointerEnter", u), a("onPointerOver", u));
924
- }), a("onPointerMove", u), g = u.intersections;
925
- });
926
- const d = [];
927
- p((u) => {
928
- const v = () => u.stopPropagating = !0;
929
- u.stopPropagation = v, d.forEach((E) => {
930
- u.stopPropagating || (u.eventObject = E, i(E.onPointerMissed, u));
931
- }), r("pointer-missed", { event: u });
932
- });
933
- function M(u) {
934
- d.push(u);
935
- }
936
- function _(u) {
937
- const v = d.indexOf(u);
938
- v > -1 && d.splice(v, 1);
939
- }
940
- return t.eventManager = {
941
- forceUpdate: y,
942
- registerPointerMissedObject: M,
943
- deregisterPointerMissedObject: _
944
- }, { forceUpdate: y, registerPointerMissedObject: M, deregisterPointerMissedObject: _ };
1152
+ };
1153
+ return a = new Proxy({}, i), a;
945
1154
  }
946
- const { logError: $e } = $(), Fe = [
1155
+ const { logError: Ke } = z(), Qe = [
947
1156
  "onClick",
948
1157
  "onContextMenu",
949
1158
  "onPointerMove",
@@ -958,245 +1167,251 @@ const { logError: $e } = $(), Fe = [
958
1167
  "onPointerMissed",
959
1168
  "onLostPointerCapture",
960
1169
  "onWheel"
961
- ];
962
- function Ue(e) {
963
- var r;
964
- const t = (r = e == null ? void 0 : e.__tres) == null ? void 0 : r.root;
965
- t && t.render && t.render.canBeInvalidated.value && t.invalidate();
966
- }
967
- const Ur = () => {
968
- let e = null;
969
- function t(n, f, h, l) {
970
- if (l || (l = {}), l.args || (l.args = []), n === "template" || br(n))
1170
+ ], gr = (e) => {
1171
+ const t = e.scene.value;
1172
+ function n(o, f, v, u) {
1173
+ if (u || (u = {}), u.args || (u.args = []), o === "template" || Wn(o))
971
1174
  return null;
972
- let w = n.replace("Tres", ""), b;
973
- if (n === "primitive") {
974
- (l == null ? void 0 : l.object) === void 0 && $e("Tres primitives need a prop 'object'");
975
- const p = l.object;
976
- w = p.type, b = Object.assign(p.clone(), { type: w });
1175
+ let _ = o.replace("Tres", ""), p;
1176
+ if (o === "primitive") {
1177
+ (!N(u.object) || Ct(u.object)) && Ke(
1178
+ "Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
1179
+ ), _ = u.object.type;
1180
+ const P = {};
1181
+ p = hr(
1182
+ u.object,
1183
+ {
1184
+ object: (y) => y,
1185
+ isPrimitive: () => !0,
1186
+ __tres: () => P
1187
+ },
1188
+ {
1189
+ object: (y, g, E, C) => {
1190
+ rr(y, E, C, { patchProp: a, remove: s, insert: r }, e);
1191
+ },
1192
+ __tres: (y) => {
1193
+ Object.assign(P, y);
1194
+ }
1195
+ }
1196
+ );
977
1197
  } else {
978
- const p = de.value[w];
979
- p || $e(
980
- `${w} is not defined on the THREE namespace. Use extend to add it to the catalog.`
981
- ), b = new p(...l.args);
1198
+ const P = Me.value[_];
1199
+ P || Ke(
1200
+ `${_} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1201
+ ), p = new P(...u.args);
982
1202
  }
983
- return b ? (b.isCamera && (l != null && l.position || b.position.set(3, 3, 3), l != null && l.lookAt || b.lookAt(0, 0, 0)), (l == null ? void 0 : l.attach) === void 0 && (b.isMaterial ? b.attach = "material" : b.isBufferGeometry && (b.attach = "geometry")), b.__tres = {
984
- ...b.__tres,
985
- type: w,
986
- memoizedProps: l,
1203
+ return p ? (p.isCamera && (u != null && u.position || p.position.set(3, 3, 3), u != null && u.lookAt || p.lookAt(0, 0, 0)), p = G(p, {
1204
+ ...p.__tres,
1205
+ type: _,
1206
+ memoizedProps: u,
987
1207
  eventCount: 0,
988
- disposable: !0,
989
- primitive: n === "primitive"
990
- }, b.isObject3D && b.__tres && (l != null && l.material || l != null && l.geometry) && (b.__tres.disposable = !1), b) : null;
1208
+ primitive: o === "primitive",
1209
+ attach: u.attach
1210
+ }, e), p) : null;
991
1211
  }
992
- function r(n, f) {
993
- var l, w, b, p, P;
994
- if (!n)
1212
+ function r(o, f) {
1213
+ var _, p, P;
1214
+ if (!o)
995
1215
  return;
996
- f && f.isScene && (e = f), e && n.__tres && (n.__tres.root = e.__tres.root);
997
- const h = f || e;
998
- if (n != null && n.isObject3D) {
999
- const { registerCamera: y } = (l = n == null ? void 0 : n.__tres) == null ? void 0 : l.root;
1000
- n != null && n.isCamera && y(n), n.onPointerMissed && ((w = n == null ? void 0 : n.__tres) != null && w.root) && ((P = (p = (b = n == null ? void 0 : n.__tres) == null ? void 0 : b.root) == null ? void 0 : p.eventManager) == null || P.registerPointerMissedObject(n));
1001
- }
1002
- n != null && n.isObject3D && (h != null && h.isObject3D) ? (h.add(n), n.dispatchEvent({ type: "added" })) : n != null && n.isFog ? h.fog = n : typeof (n == null ? void 0 : n.attach) == "string" && (n.__previousAttach = n[h == null ? void 0 : h.attach], h && (h[n.attach] = n));
1216
+ f = f || t;
1217
+ const v = o.__tres ? o : G(o, {}, e), u = f.__tres ? f : G(f, {}, e);
1218
+ o = X(v), f = X(u), o.__tres && ((_ = o.__tres) == null ? void 0 : _.eventCount) > 0 && ((p = e.eventManager) == null || p.registerObject(o)), e.registerCamera(o), (P = e.eventManager) == null || P.registerPointerMissedObject(o), v.__tres.attach ? er(u, v, v.__tres.attach) : W(o) && W(u) && (u.add(o), o.dispatchEvent({ type: "added" })), v.__tres.parent = u, u.__tres.objects && !u.__tres.objects.includes(v) && u.__tres.objects.push(v);
1003
1219
  }
1004
- function o(n) {
1005
- var h, l, w, b;
1006
- if (!n)
1220
+ function s(o, f) {
1221
+ var p, P, m, y;
1222
+ if (!o)
1007
1223
  return;
1008
- const f = n.__tres;
1009
- if (n.parent = n.parent || e, n.isObject3D) {
1010
- const p = (y) => {
1011
- var d, M;
1012
- const g = (M = (d = n == null ? void 0 : n.__tres) == null ? void 0 : d.root) == null ? void 0 : M.deregisterCamera;
1013
- y.isCamera && (g == null || g(y));
1014
- };
1015
- (h = n.removeFromParent) == null || h.call(n), n.traverse((y) => {
1016
- var g, d;
1017
- p(y), y.onPointerMissed && ((d = (g = f == null ? void 0 : f.root) == null ? void 0 : g.eventManager) == null || d.deregisterPointerMissedObject(y));
1018
- }), p(n), Ue(n), !((l = n.__tres) == null ? void 0 : l.primitive) && ((w = n.__tres) != null && w.disposable) && we(n), (b = n.dispose) == null || b.call(n);
1224
+ o != null && o.__tres && ((p = o.__tres) == null ? void 0 : p.eventCount) > 0 && ((P = e.eventManager) == null || P.deregisterObject(o)), f = be(f) ? "default" : f;
1225
+ const v = (m = o.__tres) == null ? void 0 : m.dispose;
1226
+ be(v) || (v === null ? f = !1 : f = v);
1227
+ const u = (y = o.__tres) == null ? void 0 : y.primitive, _ = f === "default" ? !u : !!f;
1228
+ if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((g) => s(g, f)), _ && o.children && [...o.children].forEach((g) => s(g, f)), mt(o, e), ht(o, e), _ && !On(o)) {
1229
+ if (V(f))
1230
+ f(o);
1231
+ else if (V(o.dispose))
1232
+ try {
1233
+ o.dispose();
1234
+ } catch {
1235
+ }
1019
1236
  }
1237
+ "__tres" in o && delete o.__tres;
1020
1238
  }
1021
- function s(n, f, h, l) {
1022
- var w, b;
1023
- if (n) {
1024
- let p = n, P = f;
1025
- if ((w = n == null ? void 0 : n.__tres) != null && w.primitive && P === "object" && h !== null) {
1026
- const M = t("primitive", void 0, void 0, {
1027
- object: l
1028
- });
1029
- for (const _ in M) {
1030
- if (_ === "uuid")
1031
- continue;
1032
- const u = n[_], v = M[_];
1033
- !(u != null && u.set) && !ee(u) ? n[_] = v : u.constructor === v.constructor && (u != null && u.copy) ? u == null || u.copy(v) : Array.isArray(v) ? u.set(...v) : !u.isColor && u.setScalar ? u.setScalar(v) : u.set(v);
1034
- }
1035
- M != null && M.__tres && (M.__tres.root = e == null ? void 0 : e.__tres.root), M != null && M.isGroup ? (n.geometry = void 0, n.material = void 0) : delete n.isGroup;
1036
- }
1037
- if (n != null && n.isObject3D && P === "blocks-pointer-events") {
1038
- l || l === "" ? n[P] = l : delete n[P];
1039
- return;
1040
- }
1041
- Fe.includes(f) && (n.__tres.eventCount += 1);
1042
- let y = X(P), g = p == null ? void 0 : p[y];
1043
- if (P === "args") {
1044
- const M = n, _ = h ?? [], u = l ?? [], v = ((b = n == null ? void 0 : n.__tres) == null ? void 0 : b.type) || n.type;
1045
- v && _.length && !Sr(_, u) && (p = Object.assign(
1046
- M,
1047
- new de.value[v](...l)
1048
- ));
1049
- return;
1050
- }
1051
- if (p.type === "BufferGeometry") {
1052
- if (P === "args")
1053
- return;
1054
- p.setAttribute(
1055
- X(P),
1056
- new Tt(...l)
1057
- );
1058
- return;
1059
- }
1060
- if (P.includes("-") && g === void 0) {
1061
- const M = P.split("-");
1062
- g = M.reduce((_, u) => _[X(u)], p), P = M.pop(), y = P, g != null && g.set || (p = M.reduce((_, u) => _[X(u)], p));
1063
- }
1064
- let d = l;
1065
- if (d === "" && (d = !0), ee(g)) {
1066
- Fe.includes(f) || (Array.isArray(d) ? n[y](...d) : n[y](d)), y.startsWith("on") && ee(d) && (p[y] = d);
1239
+ function a(o, f, v, u) {
1240
+ var g, E;
1241
+ if (!o)
1242
+ return;
1243
+ let _ = o, p = f;
1244
+ if (o.__tres && (o.__tres.memoizedProps[f] = u), f === "attach") {
1245
+ const C = ((g = o.__tres) == null ? void 0 : g.parent) || o.parent;
1246
+ s(o), G(o, { attach: u }, e), C && r(o, C);
1247
+ return;
1248
+ }
1249
+ if (f === "dispose") {
1250
+ o.__tres || (o = G(o, {}, e)), o.__tres.dispose = u;
1251
+ return;
1252
+ }
1253
+ if (W(o) && p === "blocks-pointer-events") {
1254
+ u || u === "" ? o[p] = u : delete o[p];
1255
+ return;
1256
+ }
1257
+ Qe.includes(f) && o.__tres && (o.__tres.eventCount += 1);
1258
+ let P = se(p), m = _ == null ? void 0 : _[P];
1259
+ if (p === "args") {
1260
+ const C = o, T = v ?? [], M = u ?? [], w = ((E = o.__tres) == null ? void 0 : E.type) || o.type;
1261
+ w && T.length && !Yn(T, M) && (_ = Object.assign(
1262
+ C,
1263
+ new Me.value[w](...u)
1264
+ ));
1265
+ return;
1266
+ }
1267
+ if (_.type === "BufferGeometry") {
1268
+ if (p === "args")
1067
1269
  return;
1068
- }
1069
- !(g != null && g.set) && !ee(g) ? p[y] = d : g.constructor === d.constructor && (g != null && g.copy) ? g == null || g.copy(d) : Array.isArray(d) ? g.set(...d) : !g.isColor && g.setScalar ? g.setScalar(d) : g.set(d), Ue(n);
1270
+ _.setAttribute(
1271
+ se(p),
1272
+ new Wt(...u)
1273
+ );
1274
+ return;
1070
1275
  }
1276
+ if (p.includes("-") && m === void 0) {
1277
+ const C = p.split("-");
1278
+ m = C.reduce((T, M) => T[se(M)], _), p = C.pop(), P = p, m != null && m.set || (_ = C.reduce((T, M) => T[se(M)], _));
1279
+ }
1280
+ let y = u;
1281
+ if (y === "" && (y = !0), V(m)) {
1282
+ Qe.includes(f) || (de(y) ? o[P](...y) : o[P](y)), P.startsWith("on") && V(y) && (_[P] = y);
1283
+ return;
1284
+ }
1285
+ !(m != null && m.set) && !V(m) ? _[P] = y : m.constructor === y.constructor && (m != null && m.copy) ? m == null || m.copy(y) : de(y) ? m.set(...y) : !m.isColor && m.setScalar ? m.setScalar(y) : m.set(y), pt(o);
1071
1286
  }
1072
- function c(n) {
1073
- return (n == null ? void 0 : n.parent) || null;
1287
+ function i(o) {
1288
+ var f;
1289
+ return ((f = o == null ? void 0 : o.__tres) == null ? void 0 : f.parent) || null;
1074
1290
  }
1075
- function i(n) {
1076
- const f = new xt();
1077
- return f.name = n, f.__tres = { type: "Comment" }, f.__tres.root = e == null ? void 0 : e.__tres.root, f;
1291
+ function l(o) {
1292
+ const f = G(new Nt(), { type: "Comment" }, e);
1293
+ return f.name = o, f;
1078
1294
  }
1079
- function a(n) {
1080
- if (!n)
1081
- return null;
1082
- const f = n.parent || e, h = f.children.indexOf(n);
1083
- return f.children[h + 1] || null;
1295
+ function c(o) {
1296
+ var _;
1297
+ const f = i(o), v = ((_ = f == null ? void 0 : f.__tres) == null ? void 0 : _.objects) || [], u = v.indexOf(o);
1298
+ return u < 0 || u >= v.length - 1 ? null : v[u + 1];
1084
1299
  }
1085
1300
  return {
1086
1301
  insert: r,
1087
- remove: o,
1088
- createElement: t,
1089
- patchProp: s,
1090
- parentNode: c,
1302
+ remove: s,
1303
+ createElement: n,
1304
+ patchProp: a,
1305
+ parentNode: i,
1091
1306
  createText: () => void 0,
1092
- createComment: i,
1307
+ createComment: l,
1093
1308
  setText: () => void 0,
1094
1309
  setElementText: () => void 0,
1095
- nextSibling: a,
1310
+ nextSibling: c,
1096
1311
  querySelector: () => void 0,
1097
1312
  setScopeId: () => void 0,
1098
1313
  cloneNode: () => void 0,
1099
1314
  insertStaticContent: () => void 0
1100
1315
  };
1101
1316
  };
1102
- function Wr() {
1103
- return nt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1317
+ function vr() {
1318
+ return vt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1104
1319
  }
1105
- function nt() {
1320
+ function vt() {
1106
1321
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1107
1322
  }
1108
- const Nr = typeof Proxy == "function", zr = "devtools-plugin:setup", Gr = "plugin:settings:set";
1109
- let U, ge;
1110
- function Vr() {
1323
+ const yr = typeof Proxy == "function", _r = "devtools-plugin:setup", wr = "plugin:settings:set";
1324
+ let J, Ee;
1325
+ function br() {
1111
1326
  var e;
1112
- return U !== void 0 || (typeof window < "u" && window.performance ? (U = !0, ge = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (U = !0, ge = globalThis.perf_hooks.performance) : U = !1), U;
1327
+ return J !== void 0 || (typeof window < "u" && window.performance ? (J = !0, Ee = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (J = !0, Ee = globalThis.perf_hooks.performance) : J = !1), J;
1113
1328
  }
1114
- function qr() {
1115
- return Vr() ? ge.now() : Date.now();
1329
+ function Pr() {
1330
+ return br() ? Ee.now() : Date.now();
1116
1331
  }
1117
- class Yr {
1118
- constructor(t, r) {
1119
- this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = r;
1120
- const o = {};
1332
+ class Mr {
1333
+ constructor(t, n) {
1334
+ this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1335
+ const r = {};
1121
1336
  if (t.settings)
1122
1337
  for (const i in t.settings) {
1123
- const a = t.settings[i];
1124
- o[i] = a.defaultValue;
1338
+ const l = t.settings[i];
1339
+ r[i] = l.defaultValue;
1125
1340
  }
1126
1341
  const s = `__vue-devtools-plugin-settings__${t.id}`;
1127
- let c = Object.assign({}, o);
1342
+ let a = Object.assign({}, r);
1128
1343
  try {
1129
- const i = localStorage.getItem(s), a = JSON.parse(i);
1130
- Object.assign(c, a);
1344
+ const i = localStorage.getItem(s), l = JSON.parse(i);
1345
+ Object.assign(a, l);
1131
1346
  } catch {
1132
1347
  }
1133
1348
  this.fallbacks = {
1134
1349
  getSettings() {
1135
- return c;
1350
+ return a;
1136
1351
  },
1137
1352
  setSettings(i) {
1138
1353
  try {
1139
1354
  localStorage.setItem(s, JSON.stringify(i));
1140
1355
  } catch {
1141
1356
  }
1142
- c = i;
1357
+ a = i;
1143
1358
  },
1144
1359
  now() {
1145
- return qr();
1360
+ return Pr();
1146
1361
  }
1147
- }, r && r.on(Gr, (i, a) => {
1148
- i === this.plugin.id && this.fallbacks.setSettings(a);
1362
+ }, n && n.on(wr, (i, l) => {
1363
+ i === this.plugin.id && this.fallbacks.setSettings(l);
1149
1364
  }), this.proxiedOn = new Proxy({}, {
1150
- get: (i, a) => this.target ? this.target.on[a] : (...n) => {
1365
+ get: (i, l) => this.target ? this.target.on[l] : (...c) => {
1151
1366
  this.onQueue.push({
1152
- method: a,
1153
- args: n
1367
+ method: l,
1368
+ args: c
1154
1369
  });
1155
1370
  }
1156
1371
  }), this.proxiedTarget = new Proxy({}, {
1157
- get: (i, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...n) => (this.targetQueue.push({
1158
- method: a,
1159
- args: n,
1372
+ get: (i, l) => this.target ? this.target[l] : l === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(l) ? (...c) => (this.targetQueue.push({
1373
+ method: l,
1374
+ args: c,
1160
1375
  resolve: () => {
1161
1376
  }
1162
- }), this.fallbacks[a](...n)) : (...n) => new Promise((f) => {
1377
+ }), this.fallbacks[l](...c)) : (...c) => new Promise((o) => {
1163
1378
  this.targetQueue.push({
1164
- method: a,
1165
- args: n,
1166
- resolve: f
1379
+ method: l,
1380
+ args: c,
1381
+ resolve: o
1167
1382
  });
1168
1383
  })
1169
1384
  });
1170
1385
  }
1171
1386
  async setRealTarget(t) {
1172
1387
  this.target = t;
1173
- for (const r of this.onQueue)
1174
- this.target.on[r.method](...r.args);
1175
- for (const r of this.targetQueue)
1176
- r.resolve(await this.target[r.method](...r.args));
1388
+ for (const n of this.onQueue)
1389
+ this.target.on[n.method](...n.args);
1390
+ for (const n of this.targetQueue)
1391
+ n.resolve(await this.target[n.method](...n.args));
1177
1392
  }
1178
1393
  }
1179
- function Jr(e, t) {
1180
- const r = e, o = nt(), s = Wr(), c = Nr && r.enableEarlyProxy;
1181
- if (s && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !c))
1182
- s.emit(zr, e, t);
1394
+ function Cr(e, t) {
1395
+ const n = e, r = vt(), s = vr(), a = yr && n.enableEarlyProxy;
1396
+ if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
1397
+ s.emit(_r, e, t);
1183
1398
  else {
1184
- const i = c ? new Yr(r, s) : null;
1185
- (o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1186
- pluginDescriptor: r,
1399
+ const i = a ? new Mr(n, s) : null;
1400
+ (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1401
+ pluginDescriptor: n,
1187
1402
  setupFn: t,
1188
1403
  proxy: i
1189
1404
  }), i && t(i.proxiedTarget);
1190
1405
  }
1191
1406
  }
1192
- function Qr(e, t) {
1193
- const r = `▲ ■ ●${e}`;
1194
- typeof We == "function" ? We(r, t) : console.log(r);
1407
+ function Er(e, t) {
1408
+ const n = `▲ ■ ●${e}`;
1409
+ typeof Xe == "function" ? Xe(n, t) : console.log(n);
1195
1410
  }
1196
- function We(e, t) {
1411
+ function Xe(e, t) {
1197
1412
  throw new Error(e + t);
1198
1413
  }
1199
- const ot = (e) => {
1414
+ const yt = (e) => {
1200
1415
  const t = {
1201
1416
  id: e.uuid,
1202
1417
  label: e.type,
@@ -1208,9 +1423,9 @@ const ot = (e) => {
1208
1423
  textColor: 5750629,
1209
1424
  backgroundColor: 15793395
1210
1425
  });
1211
- const r = be(e);
1212
- return r > 0 && t.tags.push({
1213
- label: `${Rr(r)} KB`,
1426
+ const n = ke(e);
1427
+ return n > 0 && t.tags.push({
1428
+ label: `${cr(n)} KB`,
1214
1429
  textColor: 15707189,
1215
1430
  backgroundColor: 16775644,
1216
1431
  tooltip: "Memory usage"
@@ -1236,87 +1451,83 @@ const ot = (e) => {
1236
1451
  tooltip: "Position"
1237
1452
  })), t;
1238
1453
  };
1239
- function st(e, t, r = "") {
1240
- e.children.forEach((o) => {
1241
- if (o.type === "HightlightMesh" || r && !o.type.includes(r) && !o.name.includes(r))
1454
+ function _t(e, t, n = "") {
1455
+ e.children.forEach((r) => {
1456
+ if (r.type === "HightlightMesh" || n && !r.type.includes(n) && !r.name.includes(n))
1242
1457
  return;
1243
- const s = ot(o);
1244
- t.children.push(s), st(o, s, r);
1458
+ const s = yt(r);
1459
+ t.children.push(s), _t(r, s, n);
1245
1460
  });
1246
1461
  }
1247
- const Kr = [], z = "tres:inspector", Xr = ze({
1462
+ const Tr = [], Z = "tres:inspector", Sr = Et({
1248
1463
  sceneGraph: null
1249
1464
  });
1250
- function Zr(e, t) {
1251
- Jr(
1465
+ function Ar(e, t) {
1466
+ Cr(
1252
1467
  {
1253
1468
  id: "dev.esm.tres",
1254
1469
  label: "TresJS 🪐",
1255
1470
  logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
1256
1471
  packageName: "tresjs",
1257
1472
  homepage: "https://tresjs.org",
1258
- componentStateTypes: Kr,
1473
+ componentStateTypes: Tr,
1259
1474
  app: e
1260
1475
  },
1261
- (r) => {
1262
- typeof r.now != "function" && Qr(
1476
+ (n) => {
1477
+ typeof n.now != "function" && Er(
1263
1478
  "You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."
1264
- ), r.addInspector({
1265
- id: z,
1479
+ ), n.addInspector({
1480
+ id: Z,
1266
1481
  label: "TresJS 🪐",
1267
1482
  icon: "account_tree",
1268
1483
  treeFilterPlaceholder: "Search instances"
1269
1484
  }), setInterval(() => {
1270
- r.sendInspectorTree(z);
1485
+ n.sendInspectorTree(Z);
1271
1486
  }, 1e3), setInterval(() => {
1272
- r.notifyComponentUpdate();
1273
- }, 5e3), r.on.getInspectorTree((c) => {
1274
- if (c.inspectorId === z) {
1275
- const i = ot(t.scene.value);
1276
- st(t.scene.value, i, c.filter), Xr.sceneGraph = i, c.rootNodes = [i];
1487
+ n.notifyComponentUpdate();
1488
+ }, 5e3), n.on.getInspectorTree((a) => {
1489
+ if (a.inspectorId === Z) {
1490
+ const i = yt(t.scene.value);
1491
+ _t(t.scene.value, i, a.filter), Sr.sceneGraph = i, a.rootNodes = [i];
1277
1492
  }
1278
1493
  });
1279
- let o = null, s = null;
1280
- r.on.getInspectorState((c) => {
1494
+ let r = null, s = null;
1495
+ n.on.getInspectorState((a) => {
1281
1496
  var i;
1282
- if (c.inspectorId === z) {
1283
- const [a] = t.scene.value.getObjectsByProperty("uuid", c.nodeId);
1284
- if (!a)
1497
+ if (a.inspectorId === Z) {
1498
+ const [l] = t.scene.value.getObjectsByProperty("uuid", a.nodeId);
1499
+ if (!l)
1285
1500
  return;
1286
- if (s && o && o.parent && s.remove(o), a.isMesh) {
1287
- const n = kr(a);
1288
- a.add(n), o = n, s = a;
1501
+ if (s && r && r.parent && s.remove(r), l.isMesh) {
1502
+ const c = Kn(l);
1503
+ l.add(c), r = c, s = l;
1289
1504
  }
1290
- c.state = {
1291
- object: Object.entries(a).map(([n, f]) => ({
1292
- key: n,
1293
- value: f,
1294
- editable: !0
1295
- })).filter(({ key: n }) => n !== "parent")
1296
- }, a.isScene && (c.state.info = {
1297
- memory: be(a),
1298
- objects: a.children.length,
1505
+ a.state = {
1506
+ object: Object.entries(l).map(([c, o]) => ({ key: c, value: o, editable: !0 })).filter(({ key: c }) => c !== "parent")
1507
+ }, l.isScene && (a.state.info = {
1508
+ memory: ke(l),
1509
+ objects: l.children.length,
1299
1510
  calls: t.renderer.value.info.render.calls,
1300
1511
  triangles: t.renderer.value.info.render.triangles,
1301
1512
  points: t.renderer.value.info.render.points,
1302
1513
  lines: t.renderer.value.info.render.lines
1303
- }, c.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((n) => ({
1304
- key: n.name,
1514
+ }, a.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((c) => ({
1515
+ key: c.name,
1305
1516
  value: {
1306
- ...n,
1307
- vertexShader: n.vertexShader,
1308
- attributes: n.getAttributes(),
1309
- uniforms: n.getUniforms()
1517
+ ...c,
1518
+ vertexShader: c.vertexShader,
1519
+ attributes: c.getAttributes(),
1520
+ uniforms: c.getUniforms()
1310
1521
  }
1311
1522
  }))) || []);
1312
1523
  }
1313
- }), r.on.editInspectorState((c) => {
1314
- c.inspectorId === z && xr(t.scene.value, c.nodeId, c.path, c.state.value);
1524
+ }), n.on.editInspectorState((a) => {
1525
+ a.inspectorId === Z && Jn(t.scene.value, a.nodeId, a.path, a.state.value);
1315
1526
  });
1316
1527
  }
1317
1528
  );
1318
1529
  }
1319
- const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
1530
+ const kr = ["data-scene", "data-tres"], xr = /* @__PURE__ */ Be({
1320
1531
  __name: "TresCanvas",
1321
1532
  props: {
1322
1533
  shadows: { type: Boolean, default: void 0 },
@@ -1327,6 +1538,7 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
1327
1538
  outputColorSpace: {},
1328
1539
  toneMappingExposure: {},
1329
1540
  renderMode: { default: "always" },
1541
+ dpr: {},
1330
1542
  camera: {},
1331
1543
  preset: {},
1332
1544
  windowSize: { type: Boolean, default: void 0 },
@@ -1356,93 +1568,94 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
1356
1568
  "pointer-over",
1357
1569
  "pointer-out",
1358
1570
  "pointer-missed",
1359
- "wheel"
1571
+ "wheel",
1572
+ "ready"
1360
1573
  ],
1361
- setup(e, { expose: t, emit: r }) {
1574
+ setup(e, { expose: t, emit: n }) {
1362
1575
  var P;
1363
- const o = e, s = r, c = ut(), { logWarning: i } = $(), a = L(), n = H(new qe()), f = (P = ke()) == null ? void 0 : P.appContext.app;
1364
- me(Ge);
1365
- const h = (y) => xe({
1576
+ const r = e, s = n, a = Tt(), { logWarning: i } = z(), l = I(), c = H(new nt()), o = (P = Ie()) == null ? void 0 : P.appContext.app;
1577
+ Ce(et);
1578
+ const f = (m) => Be({
1366
1579
  setup() {
1367
- var d;
1368
- const g = (d = ke()) == null ? void 0 : d.appContext;
1369
- return g && (g.app = f), fe("useTres", y), fe("extend", me), typeof window < "u" && Zr(g == null ? void 0 : g.app, y), () => Oe(ht, null, c != null && c.default ? c.default() : []);
1580
+ var g;
1581
+ const y = (g = Ie()) == null ? void 0 : g.appContext;
1582
+ return y && (y.app = o), _e("useTres", m), _e("extend", Ce), typeof window < "u" && Ar(y == null ? void 0 : y.app, m), () => He(Ot, null, a != null && a.default ? a.default() : []);
1370
1583
  }
1371
- }), l = (y) => {
1372
- const g = h(y), { render: d } = vt(Ur());
1373
- d(Oe(g), n.value);
1374
- }, w = (y, g = !1) => {
1375
- we(y.scene.value), g && (y.renderer.value.dispose(), y.renderer.value.renderLists.dispose(), y.renderer.value.forceContextLoss()), n.value.__tres = {
1376
- root: y
1377
- }, l(y);
1378
- }, b = D(() => o.disableRender), p = H(null);
1379
- return t({ context: p, dispose: () => w(p.value, !0) }), ft(() => {
1380
- const y = a;
1381
- p.value = $r({
1382
- scene: n.value,
1383
- canvas: y,
1384
- windowSize: o.windowSize ?? !1,
1385
- disableRender: b.value ?? !1,
1386
- rendererOptions: o,
1584
+ }), v = (m) => {
1585
+ const y = f(m), { render: g } = Rt(gr(m));
1586
+ g(He(y), c.value);
1587
+ }, u = (m, y = !1) => {
1588
+ dt(m.scene.value), y && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), c.value.__tres = {
1589
+ root: m
1590
+ }, v(m);
1591
+ }, _ = Y(() => r.disableRender), p = H(null);
1592
+ return t({ context: p, dispose: () => u(p.value, !0) }), St(() => {
1593
+ const m = l;
1594
+ p.value = mr({
1595
+ scene: c.value,
1596
+ canvas: m,
1597
+ windowSize: r.windowSize ?? !1,
1598
+ disableRender: _.value ?? !1,
1599
+ rendererOptions: r,
1387
1600
  emit: s
1388
- }), Fr(n.value, p.value, s);
1389
- const { registerCamera: g, camera: d, cameras: M, deregisterCamera: _ } = p.value;
1390
- l(p.value);
1391
- const u = () => {
1392
- const v = new pe(
1601
+ });
1602
+ const { registerCamera: y, camera: g, cameras: E, deregisterCamera: C } = p.value;
1603
+ v(p.value);
1604
+ const T = () => {
1605
+ const M = new we(
1393
1606
  45,
1394
1607
  window.innerWidth / window.innerHeight,
1395
1608
  0.1,
1396
1609
  1e3
1397
1610
  );
1398
- v.position.set(3, 3, 3), v.lookAt(0, 0, 0), g(v);
1399
- const E = ve(() => {
1400
- M.value.length >= 2 && (v.removeFromParent(), _(v), E == null || E());
1611
+ M.position.set(3, 3, 3), M.lookAt(0, 0, 0), y(M);
1612
+ const w = Te(() => {
1613
+ E.value.length >= 2 && (M.removeFromParent(), C(M), w == null || w());
1401
1614
  });
1402
1615
  };
1403
- G(
1404
- () => o.camera,
1405
- (v, E) => {
1406
- v && g(v), E && (E.removeFromParent(), _(E));
1616
+ le(
1617
+ () => r.camera,
1618
+ (M, w) => {
1619
+ M && y(M), w && (w.removeFromParent(), C(w));
1407
1620
  },
1408
1621
  {
1409
1622
  immediate: !0
1410
1623
  }
1411
- ), d.value || (i(
1624
+ ), g.value || (i(
1412
1625
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1413
- ), u());
1414
- }), N(() => {
1415
- w(p.value);
1416
- }), (y, g) => (pt(), dt("canvas", {
1626
+ ), T());
1627
+ }), Q(() => {
1628
+ u(p.value);
1629
+ }), (m, y) => (At(), kt("canvas", {
1417
1630
  ref_key: "canvas",
1418
- ref: a,
1419
- "data-scene": n.value.uuid,
1420
- class: mt(y.$attrs.class),
1421
- "data-tres": `tresjs ${W(pr).version}`,
1422
- style: gt({
1631
+ ref: l,
1632
+ "data-scene": c.value.uuid,
1633
+ class: xt(m.$attrs.class),
1634
+ "data-tres": `tresjs ${K(An).version}`,
1635
+ style: Lt({
1423
1636
  display: "block",
1424
1637
  width: "100%",
1425
1638
  height: "100%",
1426
- position: y.windowSize ? "fixed" : "relative",
1639
+ position: m.windowSize ? "fixed" : "relative",
1427
1640
  top: 0,
1428
1641
  left: 0,
1429
1642
  pointerEvents: "auto",
1430
1643
  touchAction: "none",
1431
- ...y.$attrs.style
1644
+ ...m.$attrs.style
1432
1645
  })
1433
- }, null, 14, en));
1646
+ }, null, 14, kr));
1434
1647
  }
1435
- }), rn = [
1648
+ }), Lr = [
1436
1649
  "TresCanvas",
1437
1650
  "TresLeches",
1438
1651
  "TresScene"
1439
- ], nn = {
1652
+ ], Rr = {
1440
1653
  template: {
1441
1654
  compilerOptions: {
1442
- isCustomElement: (e) => e.startsWith("Tres") && !rn.includes(e) || e === "primitive"
1655
+ isCustomElement: (e) => e.startsWith("Tres") && !Lr.includes(e) || e === "primitive"
1443
1656
  }
1444
1657
  }
1445
- }, bn = nn, Mn = {
1658
+ }, qr = Rr, Jr = {
1446
1659
  mounted: (e, t) => {
1447
1660
  if (t.arg) {
1448
1661
  console.log(`v-log:${t.arg}`, e[t.arg]);
@@ -1451,22 +1664,22 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
1451
1664
  console.log("v-log", e);
1452
1665
  }
1453
1666
  };
1454
- class it extends kt {
1455
- constructor(t, r) {
1456
- const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new Ae();
1457
- s.setAttribute("position", new Le(o, 3)), s.computeBoundingSphere();
1458
- const c = new Ot({ fog: !1 });
1459
- super(s, c), this.light = t, this.color = r, this.type = "RectAreaLightHelper";
1460
- const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Ae();
1461
- a.setAttribute("position", new Le(i, 3)), a.computeBoundingSphere(), this.add(new At(a, new Ye({ side: Lt, fog: !1 })));
1667
+ class wt extends zt {
1668
+ constructor(t, n) {
1669
+ const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new $e();
1670
+ s.setAttribute("position", new Ue(r, 3)), s.computeBoundingSphere();
1671
+ const a = new Gt({ fog: !1 });
1672
+ super(s, a), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1673
+ const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], l = new $e();
1674
+ l.setAttribute("position", new Ue(i, 3)), l.computeBoundingSphere(), this.add(new Vt(l, new ot({ side: Yt, fog: !1 })));
1462
1675
  }
1463
1676
  updateMatrixWorld() {
1464
1677
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
1465
1678
  this.material.color.set(this.color), this.children[0].material.color.set(this.color);
1466
1679
  else {
1467
1680
  this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
1468
- const t = this.material.color, r = Math.max(t.r, t.g, t.b);
1469
- r > 1 && t.multiplyScalar(1 / r), this.children[0].material.color.copy(this.material.color);
1681
+ const t = this.material.color, n = Math.max(t.r, t.g, t.b);
1682
+ n > 1 && t.multiplyScalar(1 / n), this.children[0].material.color.copy(this.material.color);
1470
1683
  }
1471
1684
  this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
1472
1685
  }
@@ -1474,87 +1687,87 @@ class it extends kt {
1474
1687
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1475
1688
  }
1476
1689
  }
1477
- const { logWarning: Ne } = $();
1478
- let te, I;
1479
- const on = {
1480
- DirectionalLight: Dt,
1481
- PointLight: Bt,
1482
- SpotLight: jt,
1483
- HemisphereLight: Rt,
1484
- RectAreaLight: it
1485
- }, Pn = {
1690
+ const { logWarning: Ze } = z();
1691
+ let ae, F;
1692
+ const Or = {
1693
+ DirectionalLight: qt,
1694
+ PointLight: Jt,
1695
+ SpotLight: Kt,
1696
+ HemisphereLight: Qt,
1697
+ RectAreaLight: wt
1698
+ }, Kr = {
1486
1699
  mounted: (e) => {
1487
1700
  if (!e.isLight) {
1488
- Ne(`${e.type} is not a light`);
1701
+ Ze(`${e.type} is not a light`);
1489
1702
  return;
1490
1703
  }
1491
- te = on[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
1704
+ ae = Or[e.type], e.parent.add(new ae(e, 1, e.color.getHex()));
1492
1705
  },
1493
1706
  updated: (e) => {
1494
- I = e.parent.children.find((t) => t instanceof te), !(I instanceof it) && I.update();
1707
+ F = e.parent.children.find((t) => t instanceof ae), !(F instanceof wt) && F.update();
1495
1708
  },
1496
1709
  unmounted: (e) => {
1497
1710
  if (!e.isLight) {
1498
- Ne(`${e.type} is not a light`);
1711
+ Ze(`${e.type} is not a light`);
1499
1712
  return;
1500
1713
  }
1501
- I = e.parent.children.find((t) => t instanceof te), I && I.dispose && I.dispose(), e.parent.remove(I);
1714
+ F = e.parent.children.find((t) => t instanceof ae), F && F.dispose && F.dispose(), e.parent.remove(F);
1502
1715
  }
1503
- }, { logWarning: sn } = $();
1504
- let j = null;
1505
- const _n = {
1716
+ }, { logWarning: Dr } = z();
1717
+ let B = null;
1718
+ const Qr = {
1506
1719
  updated: (e, t) => {
1507
1720
  var s;
1508
- const r = Or(t);
1509
- if (!r) {
1510
- sn(`v-distance-to: problem with binding value: ${t.value}`);
1721
+ const n = Qn(t);
1722
+ if (!n) {
1723
+ Dr(`v-distance-to: problem with binding value: ${t.value}`);
1511
1724
  return;
1512
1725
  }
1513
- j && (j.dispose(), e.parent.remove(j));
1514
- const o = r.clone().sub(e.position);
1515
- o.normalize(), j = new It(o, e.position, e.position.distanceTo(r), 16776960), e.parent.add(j), console.table(
1726
+ B && (B.dispose(), e.parent.remove(B));
1727
+ const r = n.clone().sub(e.position);
1728
+ r.normalize(), B = new Xt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(B), console.table(
1516
1729
  [
1517
- ["Distance:", e.position.distanceTo(r)],
1730
+ ["Distance:", e.position.distanceTo(n)],
1518
1731
  [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
1519
- [`Destiny: ${e.name || e.type}`, `x:${r.x}, y:${r.y}, z:${r == null ? void 0 : r.z}`]
1732
+ [`Destiny: ${e.name || e.type}`, `x:${n.x}, y:${n.y}, z:${n == null ? void 0 : n.z}`]
1520
1733
  ]
1521
1734
  );
1522
1735
  },
1523
1736
  unmounted: (e) => {
1524
- j == null || j.dispose(), e.parent.remove(j);
1737
+ B == null || B.dispose(), e.parent.remove(B);
1525
1738
  }
1526
- }, Cn = {
1739
+ }, Xr = {
1527
1740
  install(e) {
1528
- e.component("TresCanvas", tn);
1741
+ e.component("TresCanvas", xr);
1529
1742
  }
1530
1743
  };
1531
1744
  export {
1532
- tn as TresCanvas,
1533
- de as catalogue,
1534
- Hr as createRenderLoop,
1535
- Cn as default,
1536
- we as dispose,
1537
- me as extend,
1538
- pn as isProd,
1539
- hr as normalizeColor,
1540
- dn as normalizeVectorFlexibleParam,
1541
- bn as templateCompilerOptions,
1542
- jr as trasverseObjects,
1543
- dr as useCamera,
1544
- mn as useLoader,
1545
- $ as useLogger,
1546
- wn as useLoop,
1547
- hn as usePointerEventHandler,
1548
- tt as useRaycaster,
1549
- fn as useRenderLoop,
1550
- Dr as useRenderer,
1551
- vn as useSeek,
1552
- gn as useTexture,
1553
- yn as useTres,
1554
- rt as useTresContext,
1555
- $r as useTresContextProvider,
1556
- Fr as useTresEventManager,
1557
- _n as vDistanceTo,
1558
- Pn as vLightHelper,
1559
- Mn as vLog
1745
+ xr as TresCanvas,
1746
+ Me as catalogue,
1747
+ dr as createRenderLoop,
1748
+ Xr as default,
1749
+ dt as dispose,
1750
+ Ce as extend,
1751
+ Ur as isProd,
1752
+ $n as normalizeColor,
1753
+ Fr as normalizeVectorFlexibleParam,
1754
+ Gr as onTresReady,
1755
+ qr as templateCompilerOptions,
1756
+ ar as trasverseObjects,
1757
+ jn as useCamera,
1758
+ Wr as useLoader,
1759
+ z as useLogger,
1760
+ Yr as useLoop,
1761
+ lr as useRaycaster,
1762
+ $r as useRenderLoop,
1763
+ sr as useRenderer,
1764
+ zr as useSeek,
1765
+ Nr as useTexture,
1766
+ Vr as useTres,
1767
+ pe as useTresContext,
1768
+ mr as useTresContextProvider,
1769
+ ur as useTresEventManager,
1770
+ Qr as vDistanceTo,
1771
+ Kr as vLightHelper,
1772
+ Jr as vLog
1560
1773
  };