@spiffcommerce/preview 5.11.14 → 5.12.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/index.esm.js CHANGED
@@ -1,34 +1,37 @@
1
- import { ArcRotateCamera as j } from "@babylonjs/core/Cameras/arcRotateCamera";
2
- import { Engine as I } from "@babylonjs/core/Engines/engine";
3
- import { NullEngine as ee } from "@babylonjs/core/Engines/nullEngine";
4
- import { SceneLoader as B } from "@babylonjs/core/Loading/sceneLoader";
5
- import { CubeTexture as N } from "@babylonjs/core/Materials/Textures/cubeTexture";
6
- import { Color4 as b, Color3 as v } from "@babylonjs/core/Maths/math.color";
7
- import { Vector3 as g, Quaternion as A, Vector2 as z, Matrix as G } from "@babylonjs/core/Maths/math.vector";
8
- import { DracoCompression as te } from "@babylonjs/core/Meshes/Compression/dracoCompression";
1
+ import { ArcRotateCamera as re } from "@babylonjs/core/Cameras/arcRotateCamera";
2
+ import { Engine as D } from "@babylonjs/core/Engines/engine";
3
+ import { NullEngine as ce } from "@babylonjs/core/Engines/nullEngine";
4
+ import { HemisphericLight as de } from "@babylonjs/core/Lights/hemisphericLight";
5
+ import { SceneLoader as q } from "@babylonjs/core/Loading/sceneLoader";
6
+ import { CubeTexture as ue } from "@babylonjs/core/Materials/Textures/cubeTexture";
7
+ import { Color4 as v, Color3 as b } from "@babylonjs/core/Maths/math.color";
8
+ import { Vector3 as g, Quaternion as A, Vector2 as U, Matrix as K } from "@babylonjs/core/Maths/math.vector";
9
+ import { DracoCompression as me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
9
10
  import { Observable as C } from "@babylonjs/core/Misc/observable";
10
- import { Tools as ie } from "@babylonjs/core/Misc/tools";
11
- import { Scene as ne } from "@babylonjs/core/scene";
12
- import { GLTF2 as se } from "@babylonjs/loaders/glTF";
13
- import { GLTFLoaderAnimationStartMode as re } from "@babylonjs/loaders/glTF/glTFFileLoader";
14
- import { PBRMaterial as D } from "@babylonjs/core/Materials/PBR/pbrMaterial";
15
- import { MirrorTexture as ae } from "@babylonjs/core/Materials/Textures/mirrorTexture";
16
- import { Color3 as oe, Vector3 as V, Plane as le } from "@babylonjs/core/Maths/math";
17
- import { ReflectionProbe as he } from "@babylonjs/core/Probes/reflectionProbe";
18
- import { GlowLayer as ce } from "@babylonjs/core/Layers/glowLayer";
19
- import { ActionManager as E } from "@babylonjs/core/Actions/actionManager";
20
- import { ExecuteCodeAction as _ } from "@babylonjs/core/Actions/directActions";
21
- import { Mesh as de } from "@babylonjs/core/Meshes/mesh";
22
- import { TransformNode as ue } from "@babylonjs/core/Meshes/transformNode";
23
- import { DynamicTexture as me } from "@babylonjs/core/Materials/Textures/dynamicTexture";
24
- import { Texture as ge } from "@babylonjs/core/Materials/Textures/texture";
11
+ import { Tools as ge } from "@babylonjs/core/Misc/tools";
12
+ import { Scene as pe } from "@babylonjs/core/scene";
13
+ import { GLTF2 as fe } from "@babylonjs/loaders/glTF";
14
+ import { GLTFLoaderAnimationStartMode as be } from "@babylonjs/loaders/glTF/glTFFileLoader";
15
+ import { PBRMaterial as V } from "@babylonjs/core/Materials/PBR/pbrMaterial";
16
+ import { MirrorTexture as ve } from "@babylonjs/core/Materials/Textures/mirrorTexture";
17
+ import { Color3 as we, Vector3 as W, Plane as Ce } from "@babylonjs/core/Maths/math";
18
+ import { ReflectionProbe as Ae } from "@babylonjs/core/Probes/reflectionProbe";
19
+ import { GlowLayer as ye } from "@babylonjs/core/Layers/glowLayer";
20
+ import { ActionManager as L } from "@babylonjs/core/Actions/actionManager";
21
+ import { ExecuteCodeAction as $ } from "@babylonjs/core/Actions/directActions";
22
+ import { Mesh as xe } from "@babylonjs/core/Meshes/mesh";
23
+ import { TransformNode as Me } from "@babylonjs/core/Meshes/transformNode";
24
+ import { DynamicTexture as Pe } from "@babylonjs/core/Materials/Textures/dynamicTexture";
25
+ import { Texture as Ee } from "@babylonjs/core/Materials/Textures/texture";
25
26
  import { Animation as w } from "@babylonjs/core/Animations/animation";
26
- import { QuadraticEase as pe, EasingFunction as fe } from "@babylonjs/core/Animations/easing";
27
- import { AssetsManager as be } from "@babylonjs/core/Misc/assetsManager";
28
- import { ColorCurves as H } from "@babylonjs/core/Materials/colorCurves";
29
- import { ImageProcessingConfiguration as M } from "@babylonjs/core/Materials/imageProcessingConfiguration";
30
- import { DefaultRenderingPipeline as ve } from "@babylonjs/core/PostProcesses/RenderPipeline";
31
- import { DepthOfFieldEffectBlurLevel as R } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
27
+ import { QuadraticEase as Re, EasingFunction as Te } from "@babylonjs/core/Animations/easing";
28
+ import { VertexBuffer as Q } from "@babylonjs/core/Buffers/buffer";
29
+ import { MultiMaterial as Le } from "@babylonjs/core/Materials/multiMaterial";
30
+ import { AssetsManager as Oe } from "@babylonjs/core/Misc/assetsManager";
31
+ import { ColorCurves as Y } from "@babylonjs/core/Materials/colorCurves";
32
+ import { ImageProcessingConfiguration as E } from "@babylonjs/core/Materials/imageProcessingConfiguration";
33
+ import { DefaultRenderingPipeline as Ie } from "@babylonjs/core/PostProcesses/RenderPipeline";
34
+ import { DepthOfFieldEffectBlurLevel as O } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
32
35
  import "@babylonjs/core/Rendering/depthRendererSceneComponent";
33
36
  import "@babylonjs/core/Engines/Extensions/engine.views";
34
37
  import "@babylonjs/core/Meshes/instancedMesh";
@@ -40,36 +43,36 @@ import "@babylonjs/core/Animations/animatable";
40
43
  import "@babylonjs/core/Misc/screenshotTools";
41
44
  import "@babylonjs/core/Rendering/boundingBoxRenderer";
42
45
  import "@babylonjs/loaders/glTF/2.0/Extensions";
43
- var F = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(F || {}), S = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(S || {});
44
- function we() {
46
+ var k = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(k || {}), N = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(N || {});
47
+ function Fe() {
45
48
  const n = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
46
49
  return n && e && t;
47
50
  }
48
- const U = /* @__PURE__ */ new Map();
49
- async function q(n, e, t) {
50
- const i = await U.get(n);
51
+ const Z = /* @__PURE__ */ new Map();
52
+ async function z(n, e, t) {
53
+ const i = await Z.get(n);
51
54
  if (i && i.scene.uid === e.uid)
52
55
  return i;
53
- const a = B.LoadAssetContainerAsync(n, void 0, e, t);
54
- return !we() && U.set(n, a), a;
56
+ const a = q.LoadAssetContainerAsync(n, void 0, e, t);
57
+ return !Fe() && Z.set(n, a), a;
55
58
  }
56
- B.OnPluginActivatedObservable.add((n) => {
57
- n.name === "gltf" && (n.animationStartMode = re.NONE);
59
+ q.OnPluginActivatedObservable.add((n) => {
60
+ n.name === "gltf" && (n.animationStartMode = be.NONE);
58
61
  });
59
- class K {
62
+ class j {
60
63
  constructor(e) {
61
64
  this.getSceneClearColor = () => {
62
65
  const t = this.customOptions?.transparentBackground || this.customOptions?.backgroundImage ? 0 : 1;
63
66
  if (this.customOptions && this.customOptions?.transparentBackground || this.customOptions?.backgroundImage)
64
- return new b(0, 0, 0, t).toLinearSpace();
67
+ return new v(0, 0, 0, t).toLinearSpace();
65
68
  if (this.customOptions && this.customOptions.backgroundColor) {
66
- const i = v.FromHexString(this.customOptions.backgroundColor);
67
- return new b(i.r, i.g, i.b, t).toLinearSpace();
69
+ const i = b.FromHexString(this.customOptions.backgroundColor);
70
+ return new v(i.r, i.g, i.b, t).toLinearSpace();
68
71
  }
69
- return new b(0.98, 0.98, 0.98, t).toLinearSpace();
70
- }, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : b.FromColor3(v.Gray()), this.hexToColor4 = (t, i = 1) => {
71
- const a = v.FromHexString(t);
72
- return new b(a.r, a.g, a.b, i).toLinearSpace();
72
+ return new v(0.98, 0.98, 0.98, t).toLinearSpace();
73
+ }, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : v.FromColor3(b.Gray()), this.hexToColor4 = (t, i = 1) => {
74
+ const a = b.FromHexString(t);
75
+ return new v(a.r, a.g, a.b, i).toLinearSpace();
73
76
  }, this.customOptions = e;
74
77
  }
75
78
  createCanvas() {
@@ -133,6 +136,19 @@ class K {
133
136
  contrast: this.customOptions?.lighting?.contrast ?? 1.6
134
137
  };
135
138
  }
139
+ /**
140
+ * Configuration for the light used when the environment isn't lighting the scene.
141
+ * See PreviewOptions.fallbackLighting.
142
+ */
143
+ get fallbackLighting() {
144
+ const e = this.customOptions?.fallbackLighting;
145
+ return {
146
+ enabled: e?.enabled ?? !0,
147
+ intensity: e?.intensity ?? 1.2,
148
+ color: e?.color ? b.FromHexString(e.color) : b.White(),
149
+ groundColor: e?.groundColor ? b.FromHexString(e.groundColor) : new b(0.3, 0.3, 0.3)
150
+ };
151
+ }
136
152
  get emissiveGlowIntensity() {
137
153
  return this.customOptions?.emissiveGlowIntensity ?? 0.5;
138
154
  }
@@ -176,7 +192,7 @@ class x {
176
192
  }
177
193
  }
178
194
  }
179
- const Ce = 128, d = {
195
+ const Se = 128, d = {
180
196
  antiAliasing: {
181
197
  samples: 4,
182
198
  fxaaEnabled: !1
@@ -233,7 +249,7 @@ const Ce = 128, d = {
233
249
  weight: 1
234
250
  }
235
251
  };
236
- class Ae {
252
+ class Be {
237
253
  constructor(e) {
238
254
  this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
239
255
  }
@@ -246,9 +262,9 @@ class Ae {
246
262
  */
247
263
  loadNodeAsync(e, t, i) {
248
264
  return this.loader.loadNodeAsync(e, t, function(a) {
249
- t.extras && Object.keys(t.extras).forEach((r) => {
250
- const o = t.extras[r];
251
- a.metadata[r] = o;
265
+ t.extras && Object.keys(t.extras).forEach((s) => {
266
+ const o = t.extras[s];
267
+ a.metadata[s] = o;
252
268
  }), i(a);
253
269
  });
254
270
  }
@@ -269,14 +285,14 @@ class Ae {
269
285
  * @param babylonMaterial An instance of a material representation in babylon.
270
286
  */
271
287
  enableMaterialExtrasIfRequired(e, t) {
272
- if (!(!e.extras || !(t instanceof D))) {
288
+ if (!(!e.extras || !(t instanceof V))) {
273
289
  if (e.extras.sheen) {
274
290
  const i = t;
275
291
  i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
276
292
  }
277
293
  if (e.extras.translucency) {
278
294
  const i = t;
279
- i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new oe(
295
+ i.subSurface.isTranslucencyEnabled = !0, i.subSurface.translucencyIntensity = e.extras.translucency, e.extras.translucencyR && e.extras.translucencyG && e.extras.translucencyB && (i.subSurface.tintColor = new we(
280
296
  e.extras.translucencyR,
281
297
  e.extras.translucencyG,
282
298
  e.extras.translucencyB
@@ -302,48 +318,48 @@ class Ae {
302
318
  * @param scene The scene to parse.
303
319
  */
304
320
  applyReflections(e) {
305
- function t(r) {
321
+ function t(s) {
306
322
  const o = [];
307
- return r.transformNodes.forEach((s) => {
308
- s.metadata && s.metadata.reflective && o.push(...s.getChildMeshes());
309
- }), r.meshes.forEach((s) => {
310
- s.metadata && s.metadata.reflective && !o.includes(s) && o.push(s);
323
+ return s.transformNodes.forEach((r) => {
324
+ r.metadata && r.metadata.reflective && o.push(...r.getChildMeshes());
325
+ }), s.meshes.forEach((r) => {
326
+ r.metadata && r.metadata.reflective && !o.includes(r) && o.push(r);
311
327
  }), o;
312
328
  }
313
- function i(r, o = 1) {
314
- const s = r.material;
315
- if (!s)
329
+ function i(s, o = 1) {
330
+ const r = s.material;
331
+ if (!r)
316
332
  return;
317
- const h = new ae(
333
+ const c = new ve(
318
334
  "mirror",
319
335
  x.getMirrorTextureResolution(),
320
336
  e,
321
337
  !0
322
338
  );
323
- h.renderList = t(e);
324
- const c = r.getVerticesData("normal");
325
- if (!c)
339
+ c.renderList = t(e);
340
+ const l = s.getVerticesData("normal");
341
+ if (!l)
326
342
  throw new Error(
327
- "Mirror attribute specified on: " + r.name + "But no normals exist to generate a mirror from!"
343
+ "Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
328
344
  );
329
- r.computeWorldMatrix(!0);
330
- const l = r.getWorldMatrix(), m = V.TransformNormal(
331
- new V(c[0], c[1], c[2]),
332
- l
333
- ).normalize(), u = le.FromPositionAndNormal(r.position, m.scale(-1));
334
- h.mirrorPlane = u, h.level = o, s.reflectionTexture = h;
345
+ s.computeWorldMatrix(!0);
346
+ const h = s.getWorldMatrix(), m = W.TransformNormal(
347
+ new W(l[0], l[1], l[2]),
348
+ h
349
+ ).normalize(), u = Ce.FromPositionAndNormal(s.position, m.scale(-1));
350
+ c.mirrorPlane = u, c.level = o, r.reflectionTexture = c;
335
351
  }
336
- function a(r) {
337
- const o = r.material, s = new he("probe-" + o.name, Ce, e);
338
- s.cubeTexture.name = "reflection-probe-cube-texture", s.attachToMesh(r), s.renderList && s.renderList.push(...t(e)), o.reflectionTexture = s.cubeTexture;
352
+ function a(s) {
353
+ const o = s.material, r = new Ae("probe-" + o.name, Se, e);
354
+ r.cubeTexture.name = "reflection-probe-cube-texture", r.attachToMesh(s), r.renderList && r.renderList.push(...t(e)), o.reflectionTexture = r.cubeTexture;
339
355
  }
340
- e.meshes.forEach((r) => {
341
- const o = r.metadata;
342
- o && (o.mirrorTexture && i(r, o.mirrorTexture), o.reflectionProbe && a(r));
356
+ e.meshes.forEach((s) => {
357
+ const o = s.metadata;
358
+ o && (o.mirrorTexture && i(s, o.mirrorTexture), o.reflectionProbe && a(s));
343
359
  });
344
360
  }
345
361
  }
346
- class ye {
362
+ class De {
347
363
  constructor(e, t) {
348
364
  this.scene = e, this.intensity = t, this.meshCount = 0;
349
365
  }
@@ -352,7 +368,7 @@ class ye {
352
368
  }
353
369
  includeMeshes(e) {
354
370
  if (e) {
355
- this.glowLayer || (this.glowLayer = new ce("glow", this.scene), this.glowLayer.intensity = this.intensity);
371
+ this.glowLayer || (this.glowLayer = new ye("glow", this.scene), this.glowLayer.intensity = this.intensity);
356
372
  for (const t of e)
357
373
  this.glowLayer.hasMesh(t) || (this.glowLayer.addIncludedOnlyMesh(t), this.meshCount++);
358
374
  }
@@ -365,37 +381,37 @@ class ye {
365
381
  }
366
382
  }
367
383
  }
368
- function xe(n, e, t, i, a = "") {
369
- t.forEach((r) => {
370
- const o = r.getID(), s = r.getName(), h = r.getPanelSize && r.getPanelSize(), c = x.getDynamicTextureResolution(
371
- h?.width === 1 || h?.height === 1
384
+ function ke(n, e, t, i, a = "") {
385
+ t.forEach((s) => {
386
+ const o = s.getID(), r = s.getName(), c = s.getPanelSize && s.getPanelSize(), l = x.getDynamicTextureResolution(
387
+ c?.width === 1 || c?.height === 1
372
388
  );
373
- n.filter((m) => m.name === a + s).forEach((m) => {
389
+ n.filter((m) => m.name === a + r).forEach((m) => {
374
390
  const u = i.get(o), p = !1;
375
391
  if (u)
376
- W(m, u), u.update(p);
392
+ X(m, u), u.update(p);
377
393
  else {
378
- const f = Me(s, e, c.width, c.height);
379
- i.set(o, f), r.setStaticContext(f.getContext()), W(m, f), f.onLoadObservable.addOnce(() => {
394
+ const f = Ne(r, e, l.width, l.height);
395
+ i.set(o, f), s.setStaticContext(f.getContext()), X(m, f), f.onLoadObservable.addOnce(() => {
380
396
  f.update(p);
381
397
  });
382
398
  }
383
399
  });
384
400
  });
385
401
  }
386
- function Me(n, e, t, i) {
387
- const a = new me(
402
+ function Ne(n, e, t, i) {
403
+ const a = new Pe(
388
404
  n,
389
405
  { width: t, height: i },
390
406
  e,
391
407
  x.shouldMipMap(),
392
- ge.TRILINEAR_SAMPLINGMODE,
393
- I.TEXTUREFORMAT_RGBA
394
- ), r = a.getContext();
395
- return r && (r.fillStyle = "#f5f5f5", r.fillRect(0, 0, t, i), a.update()), a;
408
+ Ee.TRILINEAR_SAMPLINGMODE,
409
+ D.TEXTUREFORMAT_RGBA
410
+ ), s = a.getContext();
411
+ return s && (s.fillStyle = "#f5f5f5", s.fillRect(0, 0, t, i), a.update()), a;
396
412
  }
397
- function W(n, e) {
398
- if (n instanceof D) {
413
+ function X(n, e) {
414
+ if (n instanceof V) {
399
415
  const t = n, i = t.albedoTexture;
400
416
  i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
401
417
  } else {
@@ -403,57 +419,57 @@ function W(n, e) {
403
419
  i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
404
420
  }
405
421
  }
406
- function Pe() {
422
+ function qe() {
407
423
  const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
408
424
  return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
409
425
  }
410
- const y = 60, Q = 1;
411
- function Y(n) {
426
+ const y = 60, J = 1;
427
+ function ee(n) {
412
428
  return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
413
429
  }
414
- function X(n, e, t, i, a, r) {
415
- const o = a ? n.filter((l) => l.name === a) : n;
430
+ function ae(n, e, t, i, a, s) {
431
+ const o = a ? n.filter((h) => h.name === a) : n;
416
432
  if (o.length === 0) {
417
433
  console.warn(`No animations found for name: ${a}`);
418
434
  return;
419
435
  }
420
- let s = 0;
421
- const h = () => {
422
- s++, s === o.length && r && r();
423
- }, c = (l, m, u, p, f) => {
424
- l.stop(), l.start(m, u, p, f), r && (m == !1 || m === void 0 && !l.loopAnimation ? l.onAnimationGroupEndObservable.addOnce(() => {
425
- h();
426
- }) : l.onAnimationLoopObservable.addOnce(() => {
427
- h();
436
+ let r = 0;
437
+ const c = () => {
438
+ r++, r === o.length && s && s();
439
+ }, l = (h, m, u, p, f) => {
440
+ h.stop(), h.start(m, u, p, f), s && (m == !1 || m === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
441
+ c();
442
+ }) : h.onAnimationLoopObservable.addOnce(() => {
443
+ c();
428
444
  }));
429
445
  };
430
446
  if (i !== void 0 && t !== void 0 && i === t) {
431
- o.forEach((l) => {
432
- const m = Y(l), u = i * m;
433
- c(l, !1, Q, u, u);
447
+ o.forEach((h) => {
448
+ const m = ee(h), u = i * m;
449
+ l(h, !1, J, u, u);
434
450
  });
435
451
  return;
436
452
  }
437
- o.forEach((l) => {
438
- const m = Y(l), u = i !== void 0 ? i * m : void 0, p = t !== void 0 ? t * m : void 0;
439
- c(l, e, Q, u, p);
453
+ o.forEach((h) => {
454
+ const m = ee(h), u = i !== void 0 ? i * m : void 0, p = t !== void 0 ? t * m : void 0;
455
+ l(h, e, J, u, p);
440
456
  });
441
457
  }
442
- function Ee(n) {
458
+ function Ve(n) {
443
459
  n.forEach((e) => {
444
460
  e.reset(), e.stop();
445
461
  });
446
462
  }
447
- function Re(n) {
463
+ function ze(n) {
448
464
  const e = n.animationGroups;
449
- Ee(e);
465
+ Ve(e);
450
466
  }
451
- function Te(n, e, t) {
467
+ function _e(n, e, t) {
452
468
  return new Promise((i) => {
453
- n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Oe(e.alpha, 0, 2 * Math.PI));
454
- const a = [], r = t.target;
469
+ n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = He(e.alpha, 0, 2 * Math.PI));
470
+ const a = [], s = t.target;
455
471
  if (t.target && Object.keys(t.target).length > 0 && a.push(
456
- P(
472
+ R(
457
473
  "cameraTargetLerp",
458
474
  "target",
459
475
  new g().copyFrom(e.target),
@@ -461,61 +477,103 @@ function Te(n, e, t) {
461
477
  w.ANIMATIONTYPE_VECTOR3
462
478
  )
463
479
  ), a.push(
464
- P(
480
+ R(
465
481
  "cameraAlphaLerp",
466
482
  "alpha",
467
483
  e.alpha,
468
- Z(t.lonDeg),
484
+ te(t.lonDeg),
469
485
  w.ANIMATIONTYPE_FLOAT
470
486
  )
471
487
  ), a.push(
472
- P(
488
+ R(
473
489
  "cameraBetaLerp",
474
490
  "beta",
475
491
  e.beta,
476
- Z(t.latDeg),
492
+ te(t.latDeg),
477
493
  w.ANIMATIONTYPE_FLOAT
478
494
  )
479
495
  ), t.radius !== void 0) {
480
- const h = Math.max(0.01, t.radius);
496
+ const c = Math.max(0.01, t.radius);
481
497
  a.push(
482
- P(
498
+ R(
483
499
  "cameraRadiusLerp",
484
500
  "radius",
485
501
  e.radius,
486
- h,
502
+ c,
487
503
  w.ANIMATIONTYPE_FLOAT
488
504
  )
489
505
  );
490
506
  }
491
507
  e.animations.push(...a);
492
- const s = e.useAutoRotationBehavior;
493
- e.disableAutoRotationBehavior(), n.beginAnimation(e, 0, r ? y * 2 : y, !1, 1, () => {
494
- e.animations = [], s && e.enableAutoRotationBehavior(), i();
508
+ const r = e.useAutoRotationBehavior;
509
+ e.disableAutoRotationBehavior(), n.beginAnimation(e, 0, s ? y * 2 : y, !1, 1, () => {
510
+ e.animations = [], r && e.enableAutoRotationBehavior(), i();
495
511
  });
496
512
  });
497
513
  }
498
- function Z(n) {
514
+ function te(n) {
499
515
  return n * Math.PI / 180;
500
516
  }
501
- function P(n, e, t, i, a, r = 0, o = w.ANIMATIONLOOPMODE_CONSTANT) {
502
- const s = new pe();
503
- s.setEasingMode(fe.EASINGMODE_EASEINOUT);
504
- const h = new w(n, e, y, a, o), c = [];
505
- return r > 0 && c.push({ frame: 0, value: t }), c.push({ frame: y * r, value: t }), c.push({
506
- frame: y * (r + 1),
517
+ function R(n, e, t, i, a, s = 0, o = w.ANIMATIONLOOPMODE_CONSTANT) {
518
+ const r = new Re();
519
+ r.setEasingMode(Te.EASINGMODE_EASEINOUT);
520
+ const c = new w(n, e, y, a, o), l = [];
521
+ return s > 0 && l.push({ frame: 0, value: t }), l.push({ frame: y * s, value: t }), l.push({
522
+ frame: y * (s + 1),
507
523
  value: i
508
- }), h.setKeys(c), h.setEasingFunction(s), h;
524
+ }), c.setKeys(l), c.setEasingFunction(r), c;
509
525
  }
510
- function Oe(n, e, t) {
526
+ function He(n, e, t) {
511
527
  return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
512
528
  }
513
- function Le(n, e, t) {
529
+ function Ge(n, e, t) {
514
530
  n.forEach((i) => {
515
531
  t && i.name !== t || i.goToFrame(e);
516
532
  });
517
533
  }
518
- const Ie = {
534
+ const ie = 1e-4;
535
+ function Ue(n, e) {
536
+ if (n.material === e) {
537
+ const i = n.getIndices();
538
+ return i ? [{ start: 0, count: i.length }] : [];
539
+ }
540
+ if (!(n.material instanceof Le) || !n.subMeshes) return [];
541
+ const t = n.material.subMaterials;
542
+ return n.subMeshes.filter((i) => t[i.materialIndex] === e).map((i) => ({ start: i.indexStart, count: i.indexCount }));
543
+ }
544
+ function ne(n, e) {
545
+ return Math.abs(n[0] - e[0]) < ie && Math.abs(n[1] - e[1]) < ie;
546
+ }
547
+ function Ke(n, e, t, i) {
548
+ const a = (l) => Math.round(l * 1e6), s = (l) => `${a(t[l * 3])}_${a(t[l * 3 + 1])}_${a(t[l * 3 + 2])}`, o = (l) => [e[l * 2], e[l * 2 + 1]], r = /* @__PURE__ */ new Map();
549
+ for (const { start: l, count: h } of i)
550
+ for (let m = l; m < l + h; m += 3) {
551
+ const u = [n[m], n[m + 1], n[m + 2]];
552
+ for (let p = 0; p < 3; p++) {
553
+ const f = u[p], T = u[(p + 1) % 3], M = s(f), P = s(T);
554
+ if (M === P) continue;
555
+ const [le, he, H] = M < P ? [f, T, `${M}|${P}`] : [T, f, `${P}|${M}`], G = r.get(H) ?? [];
556
+ G.push({ uvLow: o(le), uvHigh: o(he) }), r.set(H, G);
557
+ }
558
+ }
559
+ const c = [];
560
+ return r.forEach((l) => {
561
+ if (!(l.length === 2 && ne(l[0].uvLow, l[1].uvLow) && ne(l[0].uvHigh, l[1].uvHigh)))
562
+ for (const h of l)
563
+ c.push({ u0: h.uvLow[0], v0: h.uvLow[1], u1: h.uvHigh[0], v1: h.uvHigh[1] });
564
+ }), c;
565
+ }
566
+ function We(n, e) {
567
+ const t = [];
568
+ for (const i of n) {
569
+ const a = Ue(i, e);
570
+ if (a.length === 0) continue;
571
+ const s = i.getIndices(), o = i.getVerticesData(Q.UVKind), r = i.getVerticesData(Q.PositionKind);
572
+ !s || !o || !r || t.push(...Ke(s, o, r, a));
573
+ }
574
+ return t;
575
+ }
576
+ const $e = {
519
577
  albedoTexture: "albedoMap",
520
578
  bumpTexture: "normalMap",
521
579
  ambientTexture: "ambientMap",
@@ -525,7 +583,7 @@ const Ie = {
525
583
  refractionTexture: "refractionMap",
526
584
  reflectionTexture: "reflectionMap"
527
585
  };
528
- function Fe(n, e, t, i) {
586
+ function Qe(n, e, t, i) {
529
587
  [
530
588
  "albedoTexture",
531
589
  "bumpTexture",
@@ -535,37 +593,37 @@ function Fe(n, e, t, i) {
535
593
  "metallicTexture",
536
594
  "refractionTexture",
537
595
  "reflectionTexture"
538
- ].forEach((r) => {
539
- Se(
540
- r,
596
+ ].forEach((s) => {
597
+ Ye(
598
+ s,
541
599
  n,
542
600
  e,
543
601
  t,
544
602
  i
545
603
  );
546
- }), qe(n, e);
604
+ }), Xe(n, e);
547
605
  }
548
- function Se(n, e, t, i, a) {
549
- const r = Ie[n];
550
- if (!r)
606
+ function Ye(n, e, t, i, a) {
607
+ const s = $e[n];
608
+ if (!s)
551
609
  throw new Error("Unexpected texture name encountered.");
552
- const s = e[r]?.fileLink;
553
- s ? n === "reflectionTexture" ? s.endsWith(".env") || s.endsWith(".dds") ? i.addCubeTextureTask(n, s, void 0, !1, void 0, !0) : s.endsWith(".hdr") ? i.addHDRCubeTextureTask(n, s, 128, !1, !0, !1) : i.addTextureTask(n, s, !1, !1) : i.addTextureTask(n, s, !1, !1) : a && t[n] && (t[n] && t[n].dispose(), t[n] = null, Be(n, t));
610
+ const r = e[s]?.fileLink;
611
+ r ? n === "reflectionTexture" ? r.endsWith(".env") || r.endsWith(".dds") ? i.addCubeTextureTask(n, r, void 0, !1, void 0, !0) : r.endsWith(".hdr") ? i.addHDRCubeTextureTask(n, r, 128, !1, !0, !1) : i.addTextureTask(n, r, !1, !1) : i.addTextureTask(n, r, !1, !1) : a && t[n] && (t[n] && t[n].dispose(), t[n] = null, Ze(n, t));
554
612
  }
555
- function Be(n, e) {
556
- n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), n === "reflectionTexture" && (e.environmentIntensity = 1), n === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new v(0, 0, 0), e.reflectionTexture);
613
+ function Ze(n, e) {
614
+ n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), n === "reflectionTexture" && (e.environmentIntensity = 1), n === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new b(0, 0, 0), e.reflectionTexture);
557
615
  }
558
- function De(n, e, t, i) {
616
+ function je(n, e, t, i) {
559
617
  if (!e) {
560
618
  console.error("Failed to apply texture to material: material is null.");
561
619
  return;
562
620
  }
563
- n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), n === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new v(1, 1, 1), e.emissiveIntensity = 1);
621
+ n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), n === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new b(1, 1, 1), e.emissiveIntensity = 1);
564
622
  }
565
- function qe(n, e) {
566
- n.clearCoat && (n.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
623
+ function Xe(n, e) {
624
+ n.clearCoat && (n.clearCoat === N.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === N.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
567
625
  }
568
- class ke {
626
+ class Je {
569
627
  constructor(e, t, i) {
570
628
  this.materialVariantMap = /* @__PURE__ */ new Map(), this.keysThatRemovedBaseModel = [], this.loadedContainerForKey = /* @__PURE__ */ new Map(), this.loadedMaterialsForKey = /* @__PURE__ */ new Map(), this.scene = e, this.renameClonedAsset = t, this.setBaseModelEnabled = i;
571
629
  }
@@ -579,34 +637,34 @@ class ke {
579
637
  * where we want to undo changes are remove effects from display.
580
638
  */
581
639
  async applyMaterial(e, t, i, a) {
582
- return new Promise((r) => {
640
+ return new Promise((s) => {
583
641
  const o = this.materialVariantMap.get(e);
584
642
  this.materialVariantMap.set(e, {
585
643
  ...o,
586
644
  ...t
587
645
  });
588
- const s = this.renameClonedAsset(e), h = this.scene.materials.filter(
589
- (l) => l.name === s
646
+ const r = this.renameClonedAsset(e), c = this.scene.materials.filter(
647
+ (h) => h.name === r
590
648
  );
591
- if (h.length === 0) {
592
- r();
649
+ if (c.length === 0) {
650
+ s();
593
651
  return;
594
652
  }
595
- const c = new be(this.scene);
596
- c.useDefaultLoadingScreen = !1, h.forEach(
597
- (l) => Fe(t, l, c, a)
598
- ), c.onProgress = (l, m, u) => {
599
- i && i(l / m * 100, 100, u.name);
600
- }, c.onFinish = (l) => {
601
- l.forEach((m) => {
653
+ const l = new Oe(this.scene);
654
+ l.useDefaultLoadingScreen = !1, c.forEach(
655
+ (h) => Qe(t, h, l, a)
656
+ ), l.onProgress = (h, m, u) => {
657
+ i && i(h / m * 100, 100, u.name);
658
+ }, l.onFinish = (h) => {
659
+ h.forEach((m) => {
602
660
  const u = m;
603
661
  i && i(100, 100, m.name), this.scene.materials.filter(
604
- (f) => f.name === s
662
+ (f) => f.name === r
605
663
  ).forEach((f) => {
606
- De(m.name, f, t, u.texture);
664
+ je(m.name, f, t, u.texture);
607
665
  });
608
- }), r();
609
- }, c.loadAsync();
666
+ }), s();
667
+ }, l.loadAsync();
610
668
  });
611
669
  }
612
670
  /**
@@ -619,27 +677,27 @@ class ke {
619
677
  * @param getCurrentFrame A function that returns the current frame of the animation.
620
678
  * @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
621
679
  */
622
- async applyModel(e, t, i, a, r, o, s) {
680
+ async applyModel(e, t, i, a, s, o, r) {
623
681
  if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
624
682
  return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), this.loadedContainerForKey.get(e)?.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.get(e)?.forEach((u) => u.dispose()), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter((u) => u !== e), Promise.resolve(void 0);
625
- const c = (await q(i, this.scene, a)).instantiateModelsToScene(this.renameClonedAsset, !0);
683
+ const l = (await z(i, this.scene, a)).instantiateModelsToScene(this.renameClonedAsset, !0);
626
684
  this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.get(e)?.forEach((u) => u.dispose()), this.loadedMaterialsForKey.delete(e));
627
- const l = r && r();
628
- if (l) {
629
- const u = o && o(), p = l.name ? this.renameClonedAsset(l.name) : void 0;
630
- X(
631
- c.animationGroups,
632
- l.loop,
633
- l.to,
634
- l.from,
685
+ const h = s && s();
686
+ if (h) {
687
+ const u = o && o(), p = h.name ? this.renameClonedAsset(h.name) : void 0;
688
+ ae(
689
+ l.animationGroups,
690
+ h.loop,
691
+ h.to,
692
+ h.from,
635
693
  p
636
- ), u != null && (s && s(), Le(c.animationGroups, u + 2, p));
694
+ ), u != null && (r && r(), Ge(l.animationGroups, u + 2, p));
637
695
  }
638
- t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, c), this.loadedMaterialsForKey.set(e, J(c));
696
+ t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, l), this.loadedMaterialsForKey.set(e, oe(l));
639
697
  const m = [];
640
698
  return this.materialVariantMap.forEach(async (u, p) => {
641
699
  m.push(this.applyMaterial(p, u));
642
- }), await Promise.all(m), c;
700
+ }), await Promise.all(m), l;
643
701
  }
644
702
  dispose() {
645
703
  this.loadedContainerForKey.forEach((e) => e?.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach((e) => e.forEach((t) => t?.dispose())), this.loadedMaterialsForKey.clear(), this.materialVariantMap.clear(), this.keysThatRemovedBaseModel = [];
@@ -659,18 +717,18 @@ class ke {
659
717
  }), e;
660
718
  }
661
719
  }
662
- function J(n) {
720
+ function oe(n) {
663
721
  const e = [];
664
722
  return n.rootNodes.forEach((t) => {
665
723
  t.getChildMeshes().forEach((i) => {
666
724
  i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((a) => {
667
- const r = a.getMaterial(!1);
668
- r && !e.includes(r) && e.push(r);
725
+ const s = a.getMaterial(!1);
726
+ s && !e.includes(s) && e.push(s);
669
727
  });
670
728
  });
671
729
  }), e;
672
730
  }
673
- function $(n, e = "") {
731
+ function se(n, e = "") {
674
732
  return n.map((t) => ({
675
733
  name: t.name.substring(e.length),
676
734
  loop: t.loopAnimation,
@@ -678,21 +736,21 @@ function $(n, e = "") {
678
736
  from: t.from
679
737
  }));
680
738
  }
681
- class Ne {
739
+ class et {
682
740
  constructor(e) {
683
741
  this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new C(), this.materialDeselectedObservable = new C(), this.materialVariantObservable = new C(), this.modelVariantObservable = new C(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.isExecutingAnimation = !1, this.animations = [], this.initialized = !1, this.materials = [];
684
- const { enablePicking: t, modelDetails: i, previewService: a, progressHandler: r, scene: o } = e;
685
- this.enablePicking = t, this.contextService = i.contextService, this.id = Pe(), this.previewService = a, this.scene = o, this.variantManager = new ke(
742
+ const { enablePicking: t, modelDetails: i, previewService: a, progressHandler: s, scene: o } = e;
743
+ this.enablePicking = t, this.contextService = i.contextService, this.id = qe(), this.previewService = a, this.scene = o, this.variantManager = new Je(
686
744
  o,
687
745
  this.renameClonedAsset.bind(this),
688
746
  this.setBaseModelEnabled.bind(this)
689
- ), this.transformRoot = new ue("root", this.scene);
690
- const s = async () => {
747
+ ), this.transformRoot = new Me("root", this.scene);
748
+ const r = async () => {
691
749
  if (!i.model)
692
750
  throw new Error("Model container constructed with no URL. This is currently unsupported.");
693
- return this.assetContainer = await q(i.model, o, r), await this.instantiate(), this;
751
+ return this.assetContainer = await z(i.model, o, s), await this.instantiate(), this;
694
752
  };
695
- this.importPromise = s();
753
+ this.importPromise = r();
696
754
  }
697
755
  //#region Interface implementation
698
756
  async applyMaterialVariant(e, t, i, a) {
@@ -706,29 +764,29 @@ class Ne {
706
764
  ));
707
765
  return;
708
766
  }
709
- const r = async () => {
767
+ const s = async () => {
710
768
  await this.variantManager.applyMaterial(
711
769
  e,
712
770
  i,
713
- (o, s, h) => {
771
+ (o, r, c) => {
714
772
  this.materialVariantObservable.notifyObservers({
715
773
  remainingCount: o,
716
- totalCount: s,
717
- taskName: h
774
+ totalCount: r,
775
+ taskName: c
718
776
  });
719
777
  },
720
778
  a
721
779
  );
722
780
  };
723
781
  if (this.materialChangesInProgress.includes(e)) {
724
- this.queuedMaterialChanges.has(e) ? this.queuedMaterialChanges.get(e)?.set(t, r) : (this.queuedMaterialChanges.set(e, /* @__PURE__ */ new Map()), this.queuedMaterialChanges.get(e)?.set(t, r));
782
+ this.queuedMaterialChanges.has(e) ? this.queuedMaterialChanges.get(e)?.set(t, s) : (this.queuedMaterialChanges.set(e, /* @__PURE__ */ new Map()), this.queuedMaterialChanges.get(e)?.set(t, s));
725
783
  return;
726
784
  }
727
- if (this.materialChangesInProgress.push(e), await r(), this.queuedMaterialChanges.has(e)) {
785
+ if (this.materialChangesInProgress.push(e), await s(), this.queuedMaterialChanges.has(e)) {
728
786
  const o = this.queuedMaterialChanges.get(e);
729
787
  if (!o) throw new Error("Target material is undefined");
730
- o.forEach(async (s) => {
731
- await s();
788
+ o.forEach(async (r) => {
789
+ await r();
732
790
  }), this.queuedMaterialChanges.delete(e);
733
791
  }
734
792
  this.materialChangesInProgress.splice(this.materialChangesInProgress.indexOf(e), 1), this.configureGlowLayer(), this.scene.cleanCachedTextureBuffer();
@@ -738,34 +796,34 @@ class Ne {
738
796
  e,
739
797
  i,
740
798
  t?.model,
741
- (s) => {
799
+ (r) => {
742
800
  this.modelVariantObservable.notifyObservers({
743
- ...s,
801
+ ...r,
744
802
  key: e
745
803
  });
746
804
  },
747
805
  this.getLastRequestedAnimation.bind(this),
748
806
  this.getCurrentAnimationFrame.bind(this),
749
807
  this.getAnimationIsPlaying.bind(this)
750
- ), r = async () => {
808
+ ), s = async () => {
751
809
  this.modelChangesInProgress.push(e);
752
- let s = await a();
810
+ let r = await a();
753
811
  if (this.queuedModelChanges.has(e)) {
754
- const h = this.queuedModelChanges.get(e);
755
- if (!h) throw new Error("Queued change resolved undefined");
756
- s = await h(), this.queuedModelChanges.delete(e);
812
+ const c = this.queuedModelChanges.get(e);
813
+ if (!c) throw new Error("Queued change resolved undefined");
814
+ r = await c(), this.queuedModelChanges.delete(e);
757
815
  }
758
- return this.modelChangesInProgress.splice(this.modelChangesInProgress.indexOf(e), 1), s;
816
+ return this.modelChangesInProgress.splice(this.modelChangesInProgress.indexOf(e), 1), r;
759
817
  };
760
818
  if (!this.initialized || this.modelChangesInProgress.includes(e)) {
761
- const s = async () => {
762
- const h = await a();
763
- return h ? this.configureModelInstance(h) : this.configureGlowLayer(), h;
819
+ const r = async () => {
820
+ const c = await a();
821
+ return c ? this.configureModelInstance(c) : this.configureGlowLayer(), c;
764
822
  };
765
- this.queuedModelChanges.set(e, s);
823
+ this.queuedModelChanges.set(e, r);
766
824
  return;
767
825
  }
768
- const o = await r();
826
+ const o = await s();
769
827
  this.contextService || (this.contextService = t?.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
770
828
  }
771
829
  dispose() {
@@ -777,30 +835,30 @@ class Ne {
777
835
  let i = () => {
778
836
  };
779
837
  const a = async () => {
780
- this.isExecutingAnimation = !0, await new Promise((r) => {
838
+ this.isExecutingAnimation = !0, await new Promise((s) => {
781
839
  const o = [
782
840
  ...this.modelInstance?.animationGroups || [],
783
841
  ...this.variantManager.getAnimationGroups()
784
842
  ];
785
- X(
843
+ ae(
786
844
  o,
787
845
  e.loop,
788
846
  e.to,
789
847
  e.from,
790
848
  e.name ? this.renameClonedAsset(e.name) : void 0,
791
- r
849
+ s
792
850
  );
793
851
  }), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, i();
794
852
  };
795
- return t ? (Re(this.scene), a()) : this.isExecutingAnimation ? (this.queuedAnimationFunction = a, new Promise((r) => {
796
- i = r;
853
+ return t ? (ze(this.scene), a()) : this.isExecutingAnimation ? (this.queuedAnimationFunction = a, new Promise((s) => {
854
+ i = s;
797
855
  })) : a();
798
856
  }
799
857
  getAnimations(e) {
800
858
  return [
801
859
  ...this.animations,
802
- ...e ? $(this.variantManager.getAnimationGroups(), this.renameClonedAsset("")) : []
803
- ].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, a) => a.indexOf(a.find((r) => r.name === t.name)) == i);
860
+ ...e ? se(this.variantManager.getAnimationGroups(), this.renameClonedAsset("")) : []
861
+ ].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, a) => a.indexOf(a.find((s) => s.name === t.name)) == i);
804
862
  }
805
863
  getId() {
806
864
  return this.id;
@@ -812,6 +870,10 @@ class Ne {
812
870
  name: this.stripIdFromName(t.name)
813
871
  })) : [];
814
872
  }
873
+ getUVIslandOutline(e) {
874
+ const t = this.renameClonedAsset(e), i = this.scene.materials.find((a) => a.name === t);
875
+ return i ? We(this.scene.meshes, i) : [];
876
+ }
815
877
  registerMaterialSelectedCallback(e) {
816
878
  this.materialSelectedObservable.add(e);
817
879
  }
@@ -854,15 +916,15 @@ class Ne {
854
916
  attachPickingHandler(e) {
855
917
  e.rootNodes.forEach((t) => {
856
918
  t.getChildMeshes(!1).forEach((i) => {
857
- i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new E(this.scene)), i.actionManager.registerAction(
858
- new _(E.OnPointerOverTrigger, (a) => {
919
+ i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new L(this.scene)), i.actionManager.registerAction(
920
+ new $(L.OnPointerOverTrigger, (a) => {
859
921
  a.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
860
922
  id: i.material.id,
861
923
  name: this.stripIdFromName(i.material.name)
862
924
  });
863
925
  })
864
926
  ), i.actionManager.registerAction(
865
- new _(E.OnPointerOutTrigger, () => {
927
+ new $(L.OnPointerOutTrigger, () => {
866
928
  i.material && this.materialDeselectedObservable.notifyObservers({
867
929
  id: i.material.id,
868
930
  name: this.stripIdFromName(i.material.name)
@@ -891,7 +953,7 @@ class Ne {
891
953
  return this.queuedModelChanges.size;
892
954
  }
893
955
  configureGlowLayer() {
894
- const e = (i) => i instanceof D && i.emissiveTexture !== null;
956
+ const e = (i) => i instanceof V && i.emissiveTexture !== null;
895
957
  this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
896
958
  }
897
959
  configureModelInstance(e) {
@@ -899,12 +961,12 @@ class Ne {
899
961
  throw new Error("Transform disposed! This should never happen unless there is a race condition present!");
900
962
  const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, a = this.transformRoot.scaling;
901
963
  this.transformRoot.position = g.Zero(), this.transformRoot.rotationQuaternion = A.Identity(), this.transformRoot.scaling = g.One();
902
- for (const r of e.rootNodes) {
903
- r.parent = this.transformRoot;
904
- for (const o of r.getChildMeshes(!1))
964
+ for (const s of e.rootNodes) {
965
+ s.parent = this.transformRoot;
966
+ for (const o of s.getChildMeshes(!1))
905
967
  o.alwaysSelectAsActiveMesh = !0;
906
968
  }
907
- this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = a, this.canvasPanels = this.contextService?.getAll() || /* @__PURE__ */ new Map(), xe(
969
+ this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = a, this.canvasPanels = this.contextService?.getAll() || /* @__PURE__ */ new Map(), ke(
908
970
  this.materials.concat(this.variantManager.getAllMaterials()),
909
971
  this.scene,
910
972
  this.canvasPanels,
@@ -919,11 +981,11 @@ class Ne {
919
981
  this.modelInstance?.dispose(), this.modelInstance = void 0;
920
982
  }
921
983
  getAllMeshes() {
922
- return this.modelInstance?.rootNodes.map((e) => e.getChildMeshes(!1).filter((t) => t instanceof de)).flat();
984
+ return this.modelInstance?.rootNodes.map((e) => e.getChildMeshes(!1).filter((t) => t instanceof xe)).flat();
923
985
  }
924
986
  async instantiate() {
925
987
  if (!this.assetContainer) throw new Error("Attempted to instantiate ModelContainer without an AssetContainer");
926
- this.modelInstance = this.assetContainer.instantiateModelsToScene(this.renameClonedAsset.bind(this), !0), this.materials = J(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = $(this.modelInstance.animationGroups, this.renameClonedAsset("")), this.initialized = !0, await this.processQueuedEvents();
988
+ this.modelInstance = this.assetContainer.instantiateModelsToScene(this.renameClonedAsset.bind(this), !0), this.materials = oe(this.modelInstance), this.configureModelInstance(this.modelInstance), this.animations = se(this.modelInstance.animationGroups, this.renameClonedAsset("")), this.initialized = !0, await this.processQueuedEvents();
927
989
  }
928
990
  renameClonedAsset(e) {
929
991
  return `${this.id}_${e}`;
@@ -982,9 +1044,9 @@ class Ne {
982
1044
  }
983
1045
  //#endregion
984
1046
  }
985
- class k extends j {
986
- constructor(e, t, i, a, r, o, s, h) {
987
- super(e, t, i, a, r, o, h), this.lastFocus = new g(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, s.camera.autoOrientation && (this.alpha += Math.PI), s && (s.camera.limits.min.beta && (this.lowerBetaLimit = s.camera.limits.min.beta), s.camera.limits.max.beta && (this.upperBetaLimit = s.camera.limits.max.beta), s.camera.limits.min.alpha && (this.lowerAlphaLimit = s.camera.limits.min.alpha), s.camera.limits.max.alpha && (this.upperAlphaLimit = s.camera.limits.max.alpha), s.camera.limits.min.radius && (this.lowerRadiusLimit = s.camera.limits.min.radius), s.camera.limits.max.radius && (this.upperRadiusLimit = s.camera.limits.max.radius), s.camera.autoRotation.enabled && this.enableAutoRotationBehavior(s.camera.autoRotation.idleTimeMs));
1047
+ class _ extends re {
1048
+ constructor(e, t, i, a, s, o, r, c) {
1049
+ super(e, t, i, a, s, o, c), this.lastFocus = new g(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, r.camera.autoOrientation && (this.alpha += Math.PI), r && (r.camera.limits.min.beta && (this.lowerBetaLimit = r.camera.limits.min.beta), r.camera.limits.max.beta && (this.upperBetaLimit = r.camera.limits.max.beta), r.camera.limits.min.alpha && (this.lowerAlphaLimit = r.camera.limits.min.alpha), r.camera.limits.max.alpha && (this.upperAlphaLimit = r.camera.limits.max.alpha), r.camera.limits.min.radius && (this.lowerRadiusLimit = r.camera.limits.min.radius), r.camera.limits.max.radius && (this.upperRadiusLimit = r.camera.limits.max.radius), r.camera.autoRotation.enabled && this.enableAutoRotationBehavior(r.camera.autoRotation.idleTimeMs));
988
1050
  }
989
1051
  updateConfiguration(e) {
990
1052
  e && (this.lowerBetaLimit = e.camera.limits.min.beta ?? null, this.upperBetaLimit = e.camera.limits.max.beta ?? null, this.lowerAlphaLimit = e.camera.limits.min.alpha ?? null, this.upperAlphaLimit = e.camera.limits.max.alpha ?? null, e.camera.autoRotation.enabled ? this.enableAutoRotationBehavior(e.camera.autoRotation.idleTimeMs) : this.disableAutoRotationBehavior());
@@ -1021,7 +1083,7 @@ class k extends j {
1021
1083
  this.useFramingBehavior = !0;
1022
1084
  const e = this.getFramingBehavior();
1023
1085
  e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
1024
- const t = T(this._scene);
1086
+ const t = I(this._scene);
1025
1087
  return e.zoomOnBoundingInfo(t.min, t.max), this.wheelPrecision = 100 / this.radius, this.lowerRadiusLimit === null && (this.lowerRadiusLimit = 0.1), this.lastFocus.copyFrom(this.target), e;
1026
1088
  }
1027
1089
  /**
@@ -1035,8 +1097,8 @@ class k extends j {
1035
1097
  i.framingTime = t || 800;
1036
1098
  const a = () => {
1037
1099
  this.isRunningFramingBehavior = !1;
1038
- }, r = T(this._scene), o = r.max.subtract(r.min), s = r.min.add(o.scale(0.5));
1039
- this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(s), this.panDenominator = o.length(), this.lastFocus.copyFrom(s), i.zoomOnBoundingInfo(r.min, r.max, void 0, a), i.framingTime = 0;
1100
+ }, s = I(this._scene), o = s.max.subtract(s.min), r = s.min.add(o.scale(0.5));
1101
+ this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(r), this.panDenominator = o.length(), this.lastFocus.copyFrom(r), i.zoomOnBoundingInfo(s.min, s.max, void 0, a), i.framingTime = 0;
1040
1102
  }
1041
1103
  /**
1042
1104
  * Activates the auto rotation behavior causing the camera to rotate slowly around
@@ -1066,21 +1128,21 @@ class k extends j {
1066
1128
  * @param disablePan If true the camera will not allow panning.
1067
1129
  */
1068
1130
  static create(e, t, i) {
1069
- const a = T(e), r = a.max.subtract(a.min), o = a.min.add(r.scale(0.5)), s = new k(
1131
+ const a = I(e), s = a.max.subtract(a.min), o = a.min.add(s.scale(0.5)), r = new _(
1070
1132
  "ProductCamera",
1071
1133
  -(Math.PI / 2),
1072
1134
  Math.PI / 2,
1073
- r.length() * 1.5,
1135
+ s.length() * 1.5,
1074
1136
  o,
1075
1137
  e,
1076
1138
  t
1077
1139
  );
1078
- return s.setPanEnabled(t.options?.noPan !== void 0 ? !t.options.noPan : !0), s.panningInertia = 0, s.panningOriginTarget.copyFrom(o), s.panDenominator = r.length(), s.onAfterCheckInputsObservable.addOnce(() => {
1079
- s.setPanEnabled(s.panEnabled);
1080
- }), i && (e.activeCamera = s), s;
1140
+ return r.setPanEnabled(t.options?.noPan !== void 0 ? !t.options.noPan : !0), r.panningInertia = 0, r.panningOriginTarget.copyFrom(o), r.panDenominator = s.length(), r.onAfterCheckInputsObservable.addOnce(() => {
1141
+ r.setPanEnabled(r.panEnabled);
1142
+ }), i && (e.activeCamera = r), r;
1081
1143
  }
1082
1144
  }
1083
- function T(n) {
1145
+ function I(n) {
1084
1146
  if (n.meshes.length === 0)
1085
1147
  return {
1086
1148
  min: new g(-1, -1, -1),
@@ -1089,9 +1151,9 @@ function T(n) {
1089
1151
  const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
1090
1152
  return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
1091
1153
  }
1092
- class ze {
1154
+ class tt {
1093
1155
  constructor(e, t = !1, i = void 0) {
1094
- this.renderingPipeline = new ve(
1156
+ this.renderingPipeline = new Ie(
1095
1157
  "default",
1096
1158
  t,
1097
1159
  e,
@@ -1108,47 +1170,47 @@ class ze {
1108
1170
  }
1109
1171
  setConfiguration(e) {
1110
1172
  if (this.renderingPipeline.isSupported) {
1111
- if (this.renderingPipeline.samples = e.antiAliasing?.samples ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = e.antiAliasing?.fxaaEnabled ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = e.bloom?.enabled ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = e.bloom?.kernel ?? d.bloom.kernel, this.renderingPipeline.bloomScale = e.bloom?.scale ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = e.bloom?.threshold ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = e.bloom?.weight ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = e.chromaticAberration?.enabled ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = e.chromaticAberration?.aberrationAmount ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = e.chromaticAberration?.radialIntensity ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = e.chromaticAberration?.direction ? new z(e.chromaticAberration.direction.x, e.chromaticAberration.direction.y) : new z(
1173
+ if (this.renderingPipeline.samples = e.antiAliasing?.samples ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = e.antiAliasing?.fxaaEnabled ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = e.bloom?.enabled ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = e.bloom?.kernel ?? d.bloom.kernel, this.renderingPipeline.bloomScale = e.bloom?.scale ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = e.bloom?.threshold ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = e.bloom?.weight ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = e.chromaticAberration?.enabled ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = e.chromaticAberration?.aberrationAmount ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = e.chromaticAberration?.radialIntensity ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = e.chromaticAberration?.direction ? new U(e.chromaticAberration.direction.x, e.chromaticAberration.direction.y) : new U(
1112
1174
  d.chromaticAberration.direction.x,
1113
1175
  d.chromaticAberration.direction.y
1114
- ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = e.colorCurves?.enabled ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new H(), this.renderingPipeline.depthOfFieldEnabled = e.depthOfField?.enabled ?? d.depthOfField.enabled, e.depthOfField)
1176
+ ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = e.colorCurves?.enabled ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new Y(), this.renderingPipeline.depthOfFieldEnabled = e.depthOfField?.enabled ?? d.depthOfField.enabled, e.depthOfField)
1115
1177
  switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
1116
1178
  case "Low":
1117
- this.renderingPipeline.depthOfFieldBlurLevel = R.Low;
1179
+ this.renderingPipeline.depthOfFieldBlurLevel = O.Low;
1118
1180
  break;
1119
1181
  case "Medium":
1120
- this.renderingPipeline.depthOfFieldBlurLevel = R.Medium;
1182
+ this.renderingPipeline.depthOfFieldBlurLevel = O.Medium;
1121
1183
  break;
1122
1184
  case "High":
1123
- this.renderingPipeline.depthOfFieldBlurLevel = R.High;
1185
+ this.renderingPipeline.depthOfFieldBlurLevel = O.High;
1124
1186
  break;
1125
1187
  }
1126
1188
  if (this.renderingPipeline.depthOfField.focalLength = e.depthOfField?.focalLength ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = e.depthOfField?.fStop ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = e.depthOfField?.focusDistance ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = e.depthOfField?.lensSize ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = e.grain?.enabled ?? d.grain.enabled, this.renderingPipeline.grain.animated = e.grain?.animated ?? d.grain.animated, this.renderingPipeline.grain.intensity = e.grain?.intensity ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = e.misc?.contrast ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = e.misc?.exposure ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = e.misc?.toneMappingEnabled ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1127
1189
  switch (e.misc?.toneMappingType ?? d.misc.toneMappingType) {
1128
1190
  case "Standard":
1129
- this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_STANDARD;
1191
+ this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
1130
1192
  break;
1131
1193
  case "ACES":
1132
- this.renderingPipeline.imageProcessing.toneMappingType = M.TONEMAPPING_ACES;
1194
+ this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_ACES;
1133
1195
  break;
1134
1196
  }
1135
1197
  if (this.renderingPipeline.sharpenEnabled = e.sharpen?.enabled ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = e.sharpen?.colorAmount ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = e.sharpen?.edgeAmount ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = e.vignette?.enabled ?? d.vignette.enabled, e.vignette?.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
1136
1198
  switch (e.vignette?.blendMode ?? d.vignette.blendMode) {
1137
1199
  case "Multiply":
1138
- this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_MULTIPLY;
1200
+ this.renderingPipeline.imageProcessing.vignetteBlendMode = E.VIGNETTEMODE_MULTIPLY;
1139
1201
  break;
1140
1202
  case "Opaque":
1141
- this.renderingPipeline.imageProcessing.vignetteBlendMode = M.VIGNETTEMODE_OPAQUE;
1203
+ this.renderingPipeline.imageProcessing.vignetteBlendMode = E.VIGNETTEMODE_OPAQUE;
1142
1204
  break;
1143
1205
  }
1144
- e.vignette?.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
1206
+ e.vignette?.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new v(
1145
1207
  e.vignette.colorRgba.r,
1146
1208
  e.vignette.colorRgba.g,
1147
1209
  e.vignette.colorRgba.b,
1148
1210
  e.vignette.colorRgba.a
1149
- ) : e.vignette?.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(
1211
+ ) : e.vignette?.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = v.FromHexString(
1150
1212
  e.vignette.colorHex
1151
- ) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
1213
+ ) : this.renderingPipeline.imageProcessing.vignetteColor = new v(
1152
1214
  d.vignette.colorRgba.r,
1153
1215
  d.vignette.colorRgba.g,
1154
1216
  d.vignette.colorRgba.b,
@@ -1157,58 +1219,59 @@ class ze {
1157
1219
  }
1158
1220
  }
1159
1221
  updateColorCurve(e) {
1160
- const t = new H();
1222
+ const t = new Y();
1161
1223
  return t.globalDensity = e.globalDensity ?? t.globalDensity, t.globalExposure = e.globalExposure ?? t.globalExposure, t.globalHue = e.globalHue ?? t.globalHue, t.globalSaturation = e.globalSaturation ?? t.globalSaturation, t.highlightsDensity = e.highlightsDensity ?? t.highlightsDensity, t.highlightsExposure = e.highlightsExposure ?? t.highlightsExposure, t.highlightsHue = e.highlightsHue ?? t.highlightsHue, t.highlightsSaturation = e.highlightsSaturation ?? t.highlightsSaturation, t.midtonesDensity = e.midtonesDensity ?? t.midtonesDensity, t.midtonesExposure = e.midtonesExposure ?? t.midtonesExposure, t.midtonesHue = e.midtonesHue ?? t.midtonesHue, t.midtonesSaturation = e.midtonesSaturation ?? t.midtonesSaturation, t.shadowsDensity = e.shadowsDensity ?? t.shadowsDensity, t.shadowsExposure = e.shadowsExposure ?? t.shadowsExposure, t.shadowsHue = e.shadowsHue ?? t.shadowsHue, t.shadowsSaturation = e.shadowsSaturation ?? t.shadowsSaturation, t;
1162
1224
  }
1163
1225
  }
1164
- se.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
1165
- return new Ae(n);
1226
+ fe.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
1227
+ return new Be(n);
1166
1228
  });
1167
- B.OnPluginActivatedObservable.add((n) => {
1229
+ q.OnPluginActivatedObservable.add((n) => {
1168
1230
  if (n.name === "gltf") {
1169
1231
  const e = n;
1170
1232
  e.transparencyAsCoverage = !0;
1171
1233
  }
1172
1234
  });
1173
- function O(n) {
1235
+ const F = "spiff-fallback-light";
1236
+ function S(n) {
1174
1237
  return new g(n.x, n.y, n.z);
1175
1238
  }
1176
- function L(n) {
1239
+ function B(n) {
1177
1240
  return { x: n.x, y: n.y, z: n.z };
1178
1241
  }
1179
- class Tt {
1242
+ class $t {
1180
1243
  constructor(e) {
1181
- this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.validHighlightMaterials = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
1244
+ this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.validHighlightMaterials = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.environmentLightingAvailable = !1, this.renderLoop = () => {
1182
1245
  if (!this.engine.views)
1183
1246
  return;
1184
- this.modelContainers.forEach((c) => {
1185
- c.updateDynamicTextures();
1247
+ this.modelContainers.forEach((l) => {
1248
+ l.updateDynamicTextures();
1186
1249
  }), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0;
1187
- const s = this.engine.getRenderingCanvas();
1188
- if (s)
1189
- if (s.getContext("webgl2") ?? s.getContext("webgl")) {
1190
- const c = this.configuration.scene.clearColor, l = s.getContext("webgl2") ?? s.getContext("webgl");
1191
- l.clearDepth(1), l.depthFunc(l.LEQUAL), l.clearStencil(0), l.clearColor(c.r, c.g, c.b, c.a), l.clear(l.COLOR_BUFFER_BIT | l.DEPTH_BUFFER_BIT | l.STENCIL_BUFFER_BIT);
1192
- } else s.getContext("2d") ? s.getContext("2d").clearRect(0, 0, s.width, s.height) : console.error("SpiffCommerce: Failed to get any context on the rendering canvas.");
1250
+ const r = this.engine.getRenderingCanvas();
1251
+ if (r)
1252
+ if (r.getContext("webgl2") ?? r.getContext("webgl")) {
1253
+ const l = this.configuration.scene.clearColor, h = r.getContext("webgl2") ?? r.getContext("webgl");
1254
+ h.clearDepth(1), h.depthFunc(h.LEQUAL), h.clearStencil(0), h.clearColor(l.r, l.g, l.b, l.a), h.clear(h.COLOR_BUFFER_BIT | h.DEPTH_BUFFER_BIT | h.STENCIL_BUFFER_BIT);
1255
+ } else r.getContext("2d") ? r.getContext("2d").clearRect(0, 0, r.width, r.height) : console.error("SpiffCommerce: Failed to get any context on the rendering canvas.");
1193
1256
  this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
1194
- const h = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
1195
- !this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, h) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0);
1196
- }, this.configuration = new K(e);
1257
+ const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
1258
+ !this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, c) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0);
1259
+ }, this.configuration = new j(e);
1197
1260
  const i = (() => {
1198
1261
  if (!e?.noRender)
1199
1262
  return this.configuration.createCanvas();
1200
1263
  })(), a = "1.5.7";
1201
- te.Configuration = {
1264
+ me.Configuration = {
1202
1265
  decoder: {
1203
1266
  wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_wasm_wrapper_gltf.js`,
1204
1267
  wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.wasm`,
1205
1268
  fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${a}/draco_decoder_gltf.js`
1206
1269
  }
1207
1270
  }, i && (i.getContext("webgl2") || i.getContext("webgl"));
1208
- const r = console.log;
1271
+ const s = console.log;
1209
1272
  console.log = () => {
1210
1273
  };
1211
- const o = i ? new I(i, !0, {
1274
+ const o = i ? new D(i, !0, {
1212
1275
  adaptToDeviceRatio: !0,
1213
1276
  limitDeviceRatio: 2,
1214
1277
  premultipliedAlpha: !1,
@@ -1216,17 +1279,10 @@ class Tt {
1216
1279
  audioEngine: !1,
1217
1280
  stencil: this.configuration.highlights.enabled,
1218
1281
  forceSRGBBufferSupportState: !0
1219
- }) : new ee();
1220
- if (o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new ne(o), this.camera = k.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new ze(this.scene, !1, this.camera), this.scene.clearColor = this.configuration.scene.clearColor, this.configuration.scene.environment.file) {
1221
- const s = N.CreateFromPrefilteredData(
1222
- this.configuration.scene.environment.file,
1223
- this.scene
1224
- );
1225
- s.name = "initial-environment-cube", s.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = s;
1226
- }
1227
- this.scene.environmentIntensity = this.configuration.scene.environment.intensity, this.configuration.options?.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(this.configuration.options.renderingPipelineConfiguration) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new ye(this.scene, this.configuration.emissiveGlowIntensity), this.initPromise = new Promise((s) => {
1282
+ }) : new ce();
1283
+ o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new pe(o), this.camera = _.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new tt(this.scene, !1, this.camera), this.scene.clearColor = this.configuration.scene.clearColor, this.setEnvironmentTexture(this.configuration, "initial-environment-cube"), this.scene.environmentIntensity = this.configuration.scene.environment.intensity, this.configuration.options?.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(this.configuration.options.renderingPipelineConfiguration) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new De(this.scene, this.configuration.emissiveGlowIntensity), this.initPromise = new Promise((r) => {
1228
1284
  this.scene.onReadyObservable.addOnce(() => {
1229
- this.initComplete = !0, s();
1285
+ this.initComplete = !0, r();
1230
1286
  });
1231
1287
  });
1232
1288
  }
@@ -1258,7 +1314,7 @@ class Tt {
1258
1314
  }
1259
1315
  registerView(e) {
1260
1316
  const t = e.height, i = e.width;
1261
- this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(F.Pan), this.reattachControls(e), this.engine.activeRenderLoops.length === 0 && this.engine.runRenderLoop(this.renderLoop);
1317
+ this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(k.Pan), this.reattachControls(e), this.engine.activeRenderLoops.length === 0 && this.engine.runRenderLoop(this.renderLoop);
1262
1318
  }
1263
1319
  unregisterView(e) {
1264
1320
  this.engine.unRegisterView(e), this.engine.views && this.engine.views.length === 0 && this.engine.stopRenderLoop(this.renderLoop);
@@ -1275,7 +1331,7 @@ class Tt {
1275
1331
  let t = () => {
1276
1332
  };
1277
1333
  const i = async () => {
1278
- this.isAnimatingCamera = !0, await Te(this.scene, this.scene.activeCamera, e), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
1334
+ this.isAnimatingCamera = !0, await _e(this.scene, this.scene.activeCamera, e), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
1279
1335
  };
1280
1336
  return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((a) => {
1281
1337
  t = a;
@@ -1300,7 +1356,7 @@ class Tt {
1300
1356
  setCameraState(e) {
1301
1357
  if (!this.engine?.views || !this.engine?.views[0])
1302
1358
  throw new Error("No views attached, camera state requires a view to attach controls onto.");
1303
- e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1359
+ e === k.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1304
1360
  }
1305
1361
  animateToLastCameraFocus() {
1306
1362
  let e = () => {
@@ -1309,9 +1365,9 @@ class Tt {
1309
1365
  this.isAnimatingCamera = !0, await new Promise((i) => {
1310
1366
  this.focusLostNotified = !1;
1311
1367
  const a = () => {
1312
- const r = this.configuration;
1368
+ const s = this.configuration;
1313
1369
  this.camera.rerunFramingBehavior(() => {
1314
- r.camera.limits.min.radius && (this.camera.lowerRadiusLimit = r.camera.limits.min.radius), r.camera.limits.max.radius && (this.camera.upperRadiusLimit = r.camera.limits.max.radius), i();
1370
+ s.camera.limits.min.radius && (this.camera.lowerRadiusLimit = s.camera.limits.min.radius), s.camera.limits.max.radius && (this.camera.upperRadiusLimit = s.camera.limits.max.radius), i();
1315
1371
  });
1316
1372
  };
1317
1373
  this.scene.onAfterRenderObservable.addOnce(a);
@@ -1333,13 +1389,13 @@ class Tt {
1333
1389
  async renderSceneScreenshot(e, t) {
1334
1390
  if (!this.camera)
1335
1391
  throw new Error("Missing product camera, cannot render screenshot!");
1336
- const i = new j("screenshotCamera", 0, 0, 0, g.Zero(), this.scene), a = t.latDeg * Math.PI / 180, r = t.lonDeg * Math.PI / 180;
1337
- i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = r, i.beta = a, i.radius = t.radius || this.camera.radius, i.minZ = 0.01;
1392
+ const i = new re("screenshotCamera", 0, 0, 0, g.Zero(), this.scene), a = t.latDeg * Math.PI / 180, s = t.lonDeg * Math.PI / 180;
1393
+ i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = s, i.beta = a, i.radius = t.radius || this.camera.radius, i.minZ = 0.01;
1338
1394
  try {
1339
1395
  return await new Promise((o) => {
1340
- const s = this.scene.onBeforeRenderObservable.add(async () => {
1341
- this.scene.onBeforeRenderObservable.remove(s);
1342
- const h = await ie.CreateScreenshotUsingRenderTargetAsync(
1396
+ const r = this.scene.onBeforeRenderObservable.add(async () => {
1397
+ this.scene.onBeforeRenderObservable.remove(r);
1398
+ const c = await ge.CreateScreenshotUsingRenderTargetAsync(
1343
1399
  this.engine,
1344
1400
  i,
1345
1401
  e,
@@ -1347,7 +1403,7 @@ class Tt {
1347
1403
  2,
1348
1404
  !0
1349
1405
  );
1350
- return i.dispose(), o(h);
1406
+ return i.dispose(), o(c);
1351
1407
  });
1352
1408
  this.scene.render(), this.engine.endFrame();
1353
1409
  });
@@ -1359,11 +1415,11 @@ class Tt {
1359
1415
  const e = this.configuration;
1360
1416
  if (!e)
1361
1417
  return !0;
1362
- const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, a = e.camera.limits.min.beta, r = e.camera.limits.max.beta;
1363
- if (t === void 0 || i === void 0 || a === void 0 || r === void 0)
1418
+ const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, a = e.camera.limits.min.beta, s = e.camera.limits.max.beta;
1419
+ if (t === void 0 || i === void 0 || a === void 0 || s === void 0)
1364
1420
  return !0;
1365
- const o = [t, i], s = [a, r], h = o.every((l) => l === t), c = s.every((l) => l === a);
1366
- return !h && !c;
1421
+ const o = [t, i], r = [a, s], c = o.every((h) => h === t), l = r.every((h) => h === a);
1422
+ return !c && !l;
1367
1423
  }
1368
1424
  fireResizeEvent() {
1369
1425
  this.getNumViewports() > 0 && this.engine.resize();
@@ -1371,11 +1427,11 @@ class Tt {
1371
1427
  setHighlights(e) {
1372
1428
  this.scene.materials.forEach(() => {
1373
1429
  this.scene.materials.forEach((i) => {
1374
- i.emissiveIntensity === 0.18 && (i.emissiveColor = v.Black(), i.emissiveIntensity = 1);
1430
+ i.emissiveIntensity === 0.18 && (i.emissiveColor = b.Black(), i.emissiveIntensity = 1);
1375
1431
  });
1376
1432
  }), e.filter((i) => this.validHighlightMaterials.includes(i.name)).forEach((i) => {
1377
- const a = this.scene.materials.find((r) => r.id === i.id);
1378
- a && (a.emissiveColor = new v(
1433
+ const a = this.scene.materials.find((s) => s.id === i.id);
1434
+ a && (a.emissiveColor = new b(
1379
1435
  this.configuration.highlights.color.r,
1380
1436
  this.configuration.highlights.color.g,
1381
1437
  this.configuration.highlights.color.b
@@ -1386,15 +1442,15 @@ class Tt {
1386
1442
  this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
1387
1443
  }
1388
1444
  loadModel(e, t) {
1389
- const { refocusCamera: i = !0, progressHandler: a } = t ?? {}, r = new Ne({
1445
+ const { refocusCamera: i = !0, progressHandler: a } = t ?? {}, s = new et({
1390
1446
  enablePicking: this.configuration.highlights.enabled,
1391
1447
  modelDetails: e,
1392
1448
  scene: this.scene,
1393
1449
  previewService: this,
1394
1450
  progressHandler: a
1395
1451
  });
1396
- return r.getInitializationPromise().then(() => {
1397
- if (this.modelContainers.size <= 1 && i) {
1452
+ return s.getInitializationPromise().then(() => {
1453
+ if (this.reconcileFallbackLighting(this.configuration), this.modelContainers.size <= 1 && i) {
1398
1454
  const o = this.queuedCameraAnimation;
1399
1455
  this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
1400
1456
  this.scene.onAfterRenderObservable.addOnce(() => {
@@ -1402,17 +1458,17 @@ class Tt {
1402
1458
  });
1403
1459
  }, 1);
1404
1460
  }
1405
- }), this.configuration.highlights.enabled && (r.registerMaterialSelectedCallback((o) => {
1461
+ }), this.configuration.highlights.enabled && (s.registerMaterialSelectedCallback((o) => {
1406
1462
  this.setHighlights([o]);
1407
- }), r.registerMaterialDeselectedCallback(() => {
1463
+ }), s.registerMaterialDeselectedCallback(() => {
1408
1464
  this.setHighlights([]);
1409
- })), this.modelContainers.set(r.getId(), r), this.triggerModelLoadEvent({
1465
+ })), this.modelContainers.set(s.getId(), s), this.triggerModelLoadEvent({
1410
1466
  eventType: "load",
1411
- modelContainer: r
1412
- }), r;
1467
+ modelContainer: s
1468
+ }), s;
1413
1469
  }
1414
1470
  async preloadModel(e) {
1415
- await q(e, this.scene);
1471
+ await z(e, this.scene);
1416
1472
  }
1417
1473
  getAllModels() {
1418
1474
  return Array.from(this.modelContainers.values());
@@ -1435,7 +1491,7 @@ class Tt {
1435
1491
  return this.glowLayerManager;
1436
1492
  }
1437
1493
  modelUnloaded(e) {
1438
- this.modelContainers.delete(e.getId()), this.triggerModelLoadEvent({
1494
+ this.modelContainers.delete(e.getId()), this.reconcileFallbackLighting(this.configuration), this.triggerModelLoadEvent({
1439
1495
  eventType: "unload",
1440
1496
  modelContainer: e
1441
1497
  });
@@ -1447,28 +1503,69 @@ class Tt {
1447
1503
  * Flips a transform around the origin.
1448
1504
  */
1449
1505
  flipTransform(e, t, i) {
1450
- const a = G.Compose(
1451
- O(i || { x: 1, y: 1, z: 1 }),
1452
- A.FromEulerVector(O(t || { x: 0, y: 0, z: 0 })),
1453
- O(e || { x: 0, y: 0, z: 0 })
1454
- ), r = G.RotationAxis(g.Up(), Math.PI), o = a.multiply(r), s = g.Zero(), h = A.Identity(), c = g.Zero();
1455
- return o.decompose(c, h, s), h.multiplyInPlace(A.FromEulerAngles(0, Math.PI, 0)), {
1456
- position: L(s),
1457
- rotation: L(h.toEulerAngles()),
1458
- scale: L(c)
1506
+ const a = K.Compose(
1507
+ S(i || { x: 1, y: 1, z: 1 }),
1508
+ A.FromEulerVector(S(t || { x: 0, y: 0, z: 0 })),
1509
+ S(e || { x: 0, y: 0, z: 0 })
1510
+ ), s = K.RotationAxis(g.Up(), Math.PI), o = a.multiply(s), r = g.Zero(), c = A.Identity(), l = g.Zero();
1511
+ return o.decompose(l, c, r), c.multiplyInPlace(A.FromEulerAngles(0, Math.PI, 0)), {
1512
+ position: B(r),
1513
+ rotation: B(c.toEulerAngles()),
1514
+ scale: B(l)
1459
1515
  };
1460
1516
  }
1461
1517
  updatePreviewOptions(e) {
1462
- const t = new K(e);
1463
- this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
1464
- let i = this.scene.environmentTexture;
1465
- t.scene.environment.file && this.configuration.scene.environment.file !== t.scene.environment.file && (i = N.CreateFromPrefilteredData(
1466
- t.scene.environment.file,
1467
- this.scene
1468
- ), i.name = "updated-environment-cube", this.scene.environmentTexture = i), i && (i.rotationY = t.scene.environment.rotationY), this.scene.environmentIntensity = t.scene.environment.intensity, t.options?.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(t.options.renderingPipelineConfiguration) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.updateConfiguration(t), this.camera.setPanEnabled(
1518
+ const t = new j(e);
1519
+ if (this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor, this.configuration.scene.environment.file !== t.scene.environment.file)
1520
+ this.setEnvironmentTexture(t, "updated-environment-cube");
1521
+ else {
1522
+ const i = this.scene.environmentTexture;
1523
+ i && (i.rotationY = t.scene.environment.rotationY), this.reconcileFallbackLighting(t);
1524
+ }
1525
+ this.scene.environmentIntensity = t.scene.environment.intensity, t.options?.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(t.options.renderingPipelineConfiguration) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.updateConfiguration(t), this.camera.setPanEnabled(
1469
1526
  t.options?.noPan !== void 0 ? !t.options.noPan : !0
1470
1527
  ), this.configuration = t;
1471
1528
  }
1529
+ /**
1530
+ * Applies the environment file from the given configuration to the scene, replacing whatever
1531
+ * environment texture is currently set. When no file is configured, or when the configured file
1532
+ * fails to load, fallback lighting is applied instead so the product doesn't render black.
1533
+ * @param configuration The configuration holding the environment file to apply.
1534
+ * @param textureName The name to give the created cube texture.
1535
+ */
1536
+ setEnvironmentTexture(e, t) {
1537
+ const i = e.scene.environment.file;
1538
+ if (!i) {
1539
+ this.scene.environmentTexture = null, this.environmentLightingAvailable = !1, this.reconcileFallbackLighting(e);
1540
+ return;
1541
+ }
1542
+ this.environmentLightingAvailable = !0;
1543
+ const a = this.scene.useDelayedTextureLoading;
1544
+ this.scene.useDelayedTextureLoading = !1;
1545
+ const s = new ue(i, this.scene, {
1546
+ prefiltered: !0,
1547
+ createPolynomials: !0,
1548
+ onError: () => {
1549
+ this.scene.environmentTexture === s && (this.environmentLightingAvailable = !1, this.reconcileFallbackLighting(this.configuration));
1550
+ }
1551
+ });
1552
+ this.scene.useDelayedTextureLoading = a, s.name = t, s.rotationY = e.scene.environment.rotationY, this.scene.environmentTexture = s, this.reconcileFallbackLighting(e);
1553
+ }
1554
+ /**
1555
+ * Adds, updates, or removes the fallback light so it is present exactly when the scene has no other
1556
+ * source of light: no working environment texture and no lights of its own (a GLB can bring its own
1557
+ * lighting via KHR_lights_punctual). Safe to call repeatedly.
1558
+ * @param configuration The configuration holding the fallback lighting settings to apply.
1559
+ */
1560
+ reconcileFallbackLighting(e) {
1561
+ const t = e.fallbackLighting, i = this.scene.getLightByName(F), a = this.scene.lights.some((o) => o.name !== F);
1562
+ if (!t.enabled || this.environmentLightingAvailable || a) {
1563
+ i?.dispose();
1564
+ return;
1565
+ }
1566
+ const s = i ?? new de(F, new g(0, 1, 0), this.scene);
1567
+ s.intensity = t.intensity, s.diffuse = t.color, s.groundColor = t.groundColor;
1568
+ }
1472
1569
  setHighlightMaterials(e) {
1473
1570
  this.validHighlightMaterials = e;
1474
1571
  }
@@ -1486,15 +1583,15 @@ class Tt {
1486
1583
  this.scene.attachControl(!0, !0, !0);
1487
1584
  }
1488
1585
  static isSupported() {
1489
- return I.isSupported();
1586
+ return D.isSupported();
1490
1587
  }
1491
1588
  }
1492
1589
  export {
1493
- S as MaterialEffectMode,
1494
- F as ProductCameraRig,
1495
- Ce as REFLECTION_PROBE_RESOLUTION,
1590
+ N as MaterialEffectMode,
1591
+ k as ProductCameraRig,
1592
+ Se as REFLECTION_PROBE_RESOLUTION,
1496
1593
  x as RenderingConfiguration,
1497
- Tt as SpiffCommerce3DPreviewService,
1594
+ $t as SpiffCommerce3DPreviewService,
1498
1595
  d as renderingPipelineDefaults
1499
1596
  };
1500
1597
  //# sourceMappingURL=index.esm.js.map