@spiffcommerce/preview 5.3.14-0 → 5.4.0-alpha.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.d.mts CHANGED
@@ -499,12 +499,6 @@ type PreviewOptions = {
499
499
  * @returns A canvas to be used for rendering.
500
500
  */
501
501
  readonly createCanvas?: () => HTMLCanvasElement;
502
- /**
503
- * A custom function that will be used to load models. Useful if you want to pre-load models or load them from disk.
504
- * @param src The source of the model to load.
505
- * @returns A promise which resolves to an ArrayBufferView of the model file.
506
- */
507
- readonly loadModel?: (src: string) => Promise<ArrayBuffer>;
508
502
  };
509
503
  /**
510
504
  * Defines an animation to be played on a product.
package/dist/index.esm.js CHANGED
@@ -2,21 +2,21 @@ import { ArcRotateCamera as pe } from "@babylonjs/core/Cameras/arcRotateCamera";
2
2
  import { Engine as fe } from "@babylonjs/core/Engines/engine";
3
3
  import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
4
4
  import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
5
- import { SceneLoader as B } from "@babylonjs/core/Loading/sceneLoader";
5
+ import { SceneLoader as S } from "@babylonjs/core/Loading/sceneLoader";
6
6
  import { CubeTexture as ie } from "@babylonjs/core/Materials/Textures/cubeTexture";
7
7
  import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
8
8
  import { Vector3 as p, Quaternion as y, Vector2 as ne, Matrix as se } from "@babylonjs/core/Maths/math.vector";
9
9
  import { DracoCompression as Me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
10
10
  import { Observable as C } from "@babylonjs/core/Misc/observable";
11
11
  import { Tools as xe } from "@babylonjs/core/Misc/tools";
12
- import { Scene as Ae } from "@babylonjs/core/scene";
13
- import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
14
- import { PBRMaterial as D } from "@babylonjs/core/Materials/PBR/pbrMaterial";
12
+ import { Scene as Pe } from "@babylonjs/core/scene";
13
+ import { GLTF2 as Ae } from "@babylonjs/loaders/glTF";
14
+ import { PBRMaterial as B } from "@babylonjs/core/Materials/PBR/pbrMaterial";
15
15
  import { MirrorTexture as Re } from "@babylonjs/core/Materials/Textures/mirrorTexture";
16
16
  import { Color3 as Te, Vector3 as re, Plane as Ee } from "@babylonjs/core/Maths/math";
17
17
  import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
18
18
  import { GlowLayer as Le } from "@babylonjs/core/Layers/glowLayer";
19
- import { ActionManager as T } from "@babylonjs/core/Actions/actionManager";
19
+ import { ActionManager as R } from "@babylonjs/core/Actions/actionManager";
20
20
  import { ExecuteCodeAction as ae } from "@babylonjs/core/Actions/directActions";
21
21
  import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
22
22
  import { TransformNode as Fe } from "@babylonjs/core/Meshes/transformNode";
@@ -29,7 +29,7 @@ import { AssetsManager as Ve } from "@babylonjs/core/Misc/assetsManager";
29
29
  import { ColorCurves as oe } from "@babylonjs/core/Materials/colorCurves";
30
30
  import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
31
31
  import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
32
- import { DepthOfFieldEffectBlurLevel as E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
32
+ import { DepthOfFieldEffectBlurLevel as T } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
33
33
  import "@babylonjs/core/Rendering/depthRendererSceneComponent";
34
34
  import "@babylonjs/core/Engines/Extensions/engine.views";
35
35
  import "@babylonjs/core/Meshes/instancedMesh";
@@ -40,7 +40,7 @@ import "@babylonjs/core/Animations/animatable";
40
40
  import "@babylonjs/core/Misc/screenshotTools";
41
41
  import "@babylonjs/core/Rendering/boundingBoxRenderer";
42
42
  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 || {});
43
+ var I = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(I || {}), F = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(F || {});
44
44
  class le {
45
45
  constructor(e) {
46
46
  this.getSceneClearColor = () => {
@@ -97,7 +97,7 @@ class le {
97
97
  * Configuration related to the camera used to view and interact with the scene.
98
98
  */
99
99
  get camera() {
100
- var e, t, i, s, r, o, a, l, d, h, u, m, g;
100
+ var e, t, i, s, r, o, a, h, c, l, u, m, g;
101
101
  return {
102
102
  autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
103
103
  autoRotation: {
@@ -108,10 +108,10 @@ class le {
108
108
  min: {
109
109
  alpha: (s = this.customOptions) != null && s.lowerAlphaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
110
110
  beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
111
- radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
111
+ radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
112
112
  },
113
113
  max: {
114
- alpha: (d = this.customOptions) != null && d.upperAlphaLimitDeg ? ((h = this.customOptions) == null ? void 0 : h.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
114
+ alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((l = this.customOptions) == null ? void 0 : l.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
115
115
  beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
116
116
  radius: (g = this.customOptions) == null ? void 0 : g.maxZoomOverride
117
117
  }
@@ -182,7 +182,7 @@ class x {
182
182
  }
183
183
  }
184
184
  }
185
- const Ne = 128, c = {
185
+ const Ne = 128, d = {
186
186
  antiAliasing: {
187
187
  samples: 4,
188
188
  fxaaEnabled: !1
@@ -283,7 +283,7 @@ class Ge {
283
283
  * @param babylonMaterial An instance of a material representation in babylon.
284
284
  */
285
285
  enableMaterialExtrasIfRequired(e, t) {
286
- if (!(!e.extras || !(t instanceof D))) {
286
+ if (!(!e.extras || !(t instanceof B))) {
287
287
  if (e.extras.sheen) {
288
288
  const i = t;
289
289
  i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
@@ -328,27 +328,27 @@ class Ge {
328
328
  const a = r.material;
329
329
  if (!a)
330
330
  return;
331
- const l = new Re(
331
+ const h = new Re(
332
332
  "mirror",
333
333
  x.getMirrorTextureResolution(),
334
334
  e,
335
335
  !0
336
336
  );
337
- l.renderList = t(e);
338
- const d = r.getVerticesData("normal");
339
- if (!d)
337
+ h.renderList = t(e);
338
+ const c = r.getVerticesData("normal");
339
+ if (!c)
340
340
  throw new Error(
341
341
  "Mirror attribute specified on: " + r.name + "But no normals exist to generate a mirror from!"
342
342
  );
343
343
  r.computeWorldMatrix(!0);
344
- const h = r.getWorldMatrix(), u = re.TransformNormal(
345
- new re(d[0], d[1], d[2]),
346
- h
344
+ const l = r.getWorldMatrix(), u = re.TransformNormal(
345
+ new re(c[0], c[1], c[2]),
346
+ l
347
347
  ).normalize(), m = Ee.FromPositionAndNormal(
348
348
  r.position,
349
349
  u.scale(-1)
350
350
  );
351
- l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
351
+ h.mirrorPlane = m, h.level = o, a.reflectionTexture = h;
352
352
  }
353
353
  function s(r) {
354
354
  const o = r.material, a = new Oe(
@@ -387,54 +387,47 @@ class _e {
387
387
  }
388
388
  }
389
389
  const he = /* @__PURE__ */ new Map();
390
- async function He(n, e) {
391
- if (e)
392
- return e(n).then(
393
- (t) => new File([t], n, { type: "model/gltf-binary" })
394
- );
395
- }
396
- async function be(n, e, t, i) {
397
- const s = he.get(n);
398
- if (s && s.scene.uid === e.uid)
399
- return s;
390
+ async function be(n, e, t) {
391
+ const i = he.get(n);
392
+ if (i)
393
+ return i;
400
394
  {
401
- const r = await He(n, i), o = await B.LoadAssetContainerAsync(
395
+ const s = S.LoadAssetContainerAsync(
402
396
  n,
403
- r,
397
+ void 0,
404
398
  e,
405
- t,
406
- ".glb"
399
+ t
407
400
  );
408
- return he.set(n, o), o;
401
+ return he.set(n, s), s;
409
402
  }
410
403
  }
411
- B.OnPluginActivatedObservable.add((n) => {
404
+ S.OnPluginActivatedObservable.add((n) => {
412
405
  n.name === "gltf" && (n.animationStartMode = Se.NONE);
413
406
  });
414
- function Ke(n, e, t, i, s = "") {
407
+ function He(n, e, t, i, s = "") {
415
408
  t.forEach((r) => {
416
- const o = r.getID(), a = r.getName(), l = x.getDynamicTextureResolution();
417
- n.filter((h) => h.name === s + a).forEach((h) => {
409
+ const o = r.getID(), a = r.getName(), h = x.getDynamicTextureResolution();
410
+ n.filter((l) => l.name === s + a).forEach((l) => {
418
411
  const u = i.get(o), m = !1;
419
412
  if (u)
420
- ce(h, u), u.update(m);
413
+ ce(l, u), u.update(m);
421
414
  else {
422
- const g = Ue(
415
+ const g = Ke(
423
416
  a,
424
417
  e,
425
- l.width,
426
- l.height
418
+ h.width,
419
+ h.height
427
420
  );
428
421
  i.set(o, g), r.setStaticContext(
429
422
  g.getContext()
430
- ), ce(h, g), g.onLoadObservable.addOnce(() => {
423
+ ), ce(l, g), g.onLoadObservable.addOnce(() => {
431
424
  g.update(m);
432
425
  });
433
426
  }
434
427
  });
435
428
  });
436
429
  }
437
- function Ue(n, e, t, i) {
430
+ function Ke(n, e, t, i) {
438
431
  const s = new Be(
439
432
  n,
440
433
  { width: t, height: i },
@@ -446,7 +439,7 @@ function Ue(n, e, t, i) {
446
439
  return r && (r.fillStyle = "#f5f5f5", r.fillRect(0, 0, t, i), s.update()), s;
447
440
  }
448
441
  function ce(n, e) {
449
- if (n instanceof D) {
442
+ if (n instanceof B) {
450
443
  const t = n, i = t.albedoTexture;
451
444
  i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
452
445
  } else {
@@ -454,7 +447,7 @@ function ce(n, e) {
454
447
  i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
455
448
  }
456
449
  }
457
- function We() {
450
+ function Ue() {
458
451
  const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
459
452
  return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
460
453
  }
@@ -463,39 +456,39 @@ function ue(n) {
463
456
  return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
464
457
  }
465
458
  function ve(n, e, t, i, s, r) {
466
- const o = s ? n.filter((h) => h.name === s) : n;
459
+ const o = s ? n.filter((l) => l.name === s) : n;
467
460
  if (o.length === 0) {
468
461
  console.warn(`No animations found for name: ${s}`);
469
462
  return;
470
463
  }
471
464
  let a = 0;
472
- const l = () => {
465
+ const h = () => {
473
466
  a++, a === o.length && r && r();
474
- }, d = (h, u, m, g, f) => {
475
- h.stop(), h.start(u, m, g, f), r && (u == !1 || u === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
476
- l();
477
- }) : h.onAnimationLoopObservable.addOnce(() => {
478
- l();
467
+ }, c = (l, u, m, g, f) => {
468
+ l.stop(), l.start(u, m, g, f), r && (u == !1 || u === void 0 && !l.loopAnimation ? l.onAnimationGroupEndObservable.addOnce(() => {
469
+ h();
470
+ }) : l.onAnimationLoopObservable.addOnce(() => {
471
+ h();
479
472
  }));
480
473
  };
481
474
  if (i !== void 0 && t !== void 0 && i === t) {
482
- o.forEach((h) => {
483
- const u = ue(h), m = i * u;
484
- d(h, !1, de, m, m);
475
+ o.forEach((l) => {
476
+ const u = ue(l), m = i * u;
477
+ c(l, !1, de, m, m);
485
478
  });
486
479
  return;
487
480
  }
488
- o.forEach((h) => {
489
- const u = ue(h), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
490
- d(h, e, de, m, g);
481
+ o.forEach((l) => {
482
+ const u = ue(l), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
483
+ c(l, e, de, m, g);
491
484
  });
492
485
  }
493
- function Ye(n, e, t) {
486
+ function We(n, e, t) {
494
487
  return new Promise((i) => {
495
- n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
488
+ n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
496
489
  const s = [], r = t.target, o = 0, a = r ? 1 : 0;
497
490
  if (t.target && Object.keys(t.target).length > 0 && s.push(
498
- R(
491
+ A(
499
492
  "cameraTargetLerp",
500
493
  "target",
501
494
  new p().copyFrom(e.target),
@@ -508,7 +501,7 @@ function Ye(n, e, t) {
508
501
  o
509
502
  )
510
503
  ), s.push(
511
- R(
504
+ A(
512
505
  "cameraAlphaLerp",
513
506
  "alpha",
514
507
  e.alpha,
@@ -517,7 +510,7 @@ function Ye(n, e, t) {
517
510
  a
518
511
  )
519
512
  ), s.push(
520
- R(
513
+ A(
521
514
  "cameraBetaLerp",
522
515
  "beta",
523
516
  e.beta,
@@ -526,20 +519,20 @@ function Ye(n, e, t) {
526
519
  a
527
520
  )
528
521
  ), t.radius !== void 0) {
529
- const h = Math.max(0.01, t.radius);
522
+ const l = Math.max(0.01, t.radius);
530
523
  s.push(
531
- R(
524
+ A(
532
525
  "cameraRadiusLerp",
533
526
  "radius",
534
527
  e.radius,
535
- h,
528
+ l,
536
529
  v.ANIMATIONTYPE_FLOAT,
537
530
  a
538
531
  )
539
532
  );
540
533
  }
541
534
  e.animations.push(...s);
542
- const d = e.useAutoRotationBehavior;
535
+ const c = e.useAutoRotationBehavior;
543
536
  e.disableAutoRotationBehavior(), n.beginAnimation(
544
537
  e,
545
538
  0,
@@ -547,7 +540,7 @@ function Ye(n, e, t) {
547
540
  !1,
548
541
  1,
549
542
  () => {
550
- e.animations = [], d && e.enableAutoRotationBehavior(), i();
543
+ e.animations = [], c && e.enableAutoRotationBehavior(), i();
551
544
  }
552
545
  );
553
546
  });
@@ -555,30 +548,30 @@ function Ye(n, e, t) {
555
548
  function me(n) {
556
549
  return n * Math.PI / 180;
557
550
  }
558
- function R(n, e, t, i, s, r = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
551
+ function A(n, e, t, i, s, r = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
559
552
  const a = new ke();
560
553
  a.setEasingMode(ze.EASINGMODE_EASEINOUT);
561
- const l = new v(
554
+ const h = new v(
562
555
  n,
563
556
  e,
564
557
  M,
565
558
  s,
566
559
  o
567
- ), d = [];
568
- return r > 0 && d.push({ frame: 0, value: t }), d.push({ frame: M * r, value: t }), d.push({
560
+ ), c = [];
561
+ return r > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * r, value: t }), c.push({
569
562
  frame: M * (r + 1),
570
563
  value: i
571
- }), l.setKeys(d), l.setEasingFunction(a), l;
564
+ }), h.setKeys(c), h.setEasingFunction(a), h;
572
565
  }
573
- function Qe(n, e, t) {
566
+ function Ye(n, e, t) {
574
567
  return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
575
568
  }
576
- function Ze(n, e, t) {
569
+ function Qe(n, e, t) {
577
570
  n.forEach((i) => {
578
571
  t && i.name !== t || i.goToFrame(e);
579
572
  });
580
573
  }
581
- const $e = {
574
+ const Ze = {
582
575
  albedoTexture: "albedoMap",
583
576
  bumpTexture: "normalMap",
584
577
  ambientTexture: "ambientMap",
@@ -588,7 +581,7 @@ const $e = {
588
581
  refractionTexture: "refractionMap",
589
582
  reflectionTexture: "reflectionMap"
590
583
  };
591
- function je(n, e, t, i) {
584
+ function $e(n, e, t, i) {
592
585
  [
593
586
  "albedoTexture",
594
587
  "bumpTexture",
@@ -599,17 +592,17 @@ function je(n, e, t, i) {
599
592
  "refractionTexture",
600
593
  "reflectionTexture"
601
594
  ].forEach((r) => {
602
- Xe(
595
+ je(
603
596
  r,
604
597
  n,
605
598
  e,
606
599
  t,
607
600
  i
608
601
  );
609
- }), tt(n, e);
602
+ }), et(n, e);
610
603
  }
611
- function Xe(n, e, t, i, s) {
612
- const r = $e[n];
604
+ function je(n, e, t, i, s) {
605
+ const r = Ze[n];
613
606
  if (!r)
614
607
  throw new Error("Unexpected texture name encountered.");
615
608
  const o = e[r], a = o == null ? void 0 : o.fileLink;
@@ -627,22 +620,22 @@ function Xe(n, e, t, i, s) {
627
620
  !1,
628
621
  !0,
629
622
  !1
630
- ) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null, Je(n, t));
623
+ ) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null, Xe(n, t));
631
624
  }
632
- function Je(n, e) {
625
+ function Xe(n, e) {
633
626
  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 w(0, 0, 0), e.reflectionTexture);
634
627
  }
635
- function et(n, e, t, i) {
628
+ function Je(n, e, t, i) {
636
629
  if (!e) {
637
630
  console.error("Failed to apply texture to material: material is null.");
638
631
  return;
639
632
  }
640
633
  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 w(1, 1, 1), e.emissiveIntensity = 1);
641
634
  }
642
- function tt(n, e) {
643
- 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));
635
+ function et(n, e) {
636
+ n.clearCoat && (n.clearCoat === F.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === F.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
644
637
  }
645
- class it {
638
+ class tt {
646
639
  constructor(e, t, i) {
647
640
  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;
648
641
  }
@@ -662,30 +655,30 @@ class it {
662
655
  ...o,
663
656
  ...t
664
657
  });
665
- const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
666
- (h) => h.name === a
658
+ const a = this.renameClonedAsset(e), h = this.scene.materials.filter(
659
+ (l) => l.name === a
667
660
  );
668
- if (l.length === 0) {
661
+ if (h.length === 0) {
669
662
  r();
670
663
  return;
671
664
  }
672
- const d = new Ve(this.scene);
673
- d.useDefaultLoadingScreen = !1, l.forEach(
674
- (h) => je(
665
+ const c = new Ve(this.scene);
666
+ c.useDefaultLoadingScreen = !1, h.forEach(
667
+ (l) => $e(
675
668
  t,
676
- h,
677
- d,
669
+ l,
670
+ c,
678
671
  s
679
672
  )
680
- ), d.onProgress = (h, u, m) => {
681
- i && i(h / u * 100, 100, m.name);
682
- }, d.onFinish = (h) => {
683
- h.forEach((u) => {
673
+ ), c.onProgress = (l, u, m) => {
674
+ i && i(l / u * 100, 100, m.name);
675
+ }, c.onFinish = (l) => {
676
+ l.forEach((u) => {
684
677
  const m = u;
685
678
  i && i(100, 100, u.name), this.scene.materials.filter(
686
679
  (f) => f.name === a
687
680
  ).forEach(
688
- (f) => et(
681
+ (f) => Je(
689
682
  u.name,
690
683
  f,
691
684
  t,
@@ -693,7 +686,7 @@ class it {
693
686
  )
694
687
  );
695
688
  }), r();
696
- }, d.loadAsync();
689
+ }, c.loadAsync();
697
690
  });
698
691
  }
699
692
  /**
@@ -705,45 +698,39 @@ class it {
705
698
  * @param lastPlayedAnimation The last played animation, this is used to ensure the animation is played on the new model.
706
699
  * @param getCurrentFrame A function that returns the current frame of the animation.
707
700
  * @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
708
- * @param loadModel A function that loads a model from a given URL.
709
701
  */
710
- async applyModel(e, t, i, s, r, o, a, l) {
711
- var m;
702
+ async applyModel(e, t, i, s, r, o, a) {
703
+ var u;
712
704
  if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
713
- return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (m = this.loadedContainerForKey.get(e)) == null || m.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
714
- (g) => g !== e
705
+ return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (u = this.loadedContainerForKey.get(e)) == null || u.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
706
+ (m) => m !== e
715
707
  ), Promise.resolve(void 0);
716
- const h = (await be(
717
- i,
718
- this.scene,
719
- s,
720
- l
721
- )).instantiateModelsToScene(
708
+ const c = (await be(i, this.scene, s)).instantiateModelsToScene(
722
709
  this.renameClonedAsset,
723
710
  !0
724
711
  );
725
712
  if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), r) {
726
- const g = o && o(), f = r.name ? this.renameClonedAsset(r.name) : void 0;
713
+ const m = o && o(), g = r.name ? this.renameClonedAsset(r.name) : void 0;
727
714
  if (ve(
728
- h.animationGroups,
715
+ c.animationGroups,
729
716
  r.loop,
730
717
  r.to,
731
718
  r.from,
732
- f
733
- ), g != null) {
734
- const A = a && a() || !0;
735
- Ze(
736
- h.animationGroups,
737
- g + (A ? 2 : 0),
738
- f
719
+ g
720
+ ), m != null) {
721
+ const f = a && a() || !0;
722
+ Qe(
723
+ c.animationGroups,
724
+ m + (f ? 2 : 0),
725
+ g
739
726
  );
740
727
  }
741
728
  }
742
- t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, h), this.loadedMaterialsForKey.set(e, we(h));
743
- const u = [];
744
- return this.materialVariantMap.forEach(async (g, f) => {
745
- u.push(this.applyMaterial(f, g));
746
- }), await Promise.all(u), h;
729
+ t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, c), this.loadedMaterialsForKey.set(e, we(c));
730
+ const l = [];
731
+ return this.materialVariantMap.forEach(async (m, g) => {
732
+ l.push(this.applyMaterial(g, m));
733
+ }), await Promise.all(l), c;
747
734
  }
748
735
  dispose() {
749
736
  this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
@@ -784,7 +771,7 @@ function ge(n, e = "") {
784
771
  from: t.from
785
772
  }));
786
773
  }
787
- class nt {
774
+ class it {
788
775
  constructor(e) {
789
776
  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.modelReadyToLoadCallbacks = /* @__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 = [];
790
777
  const {
@@ -794,13 +781,12 @@ class nt {
794
781
  progressHandler: r,
795
782
  scene: o
796
783
  } = e;
797
- this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService = s, this.scene = o, this.variantManager = new it(
784
+ this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = s, this.scene = o, this.variantManager = new tt(
798
785
  o,
799
786
  this.renameClonedAsset.bind(this),
800
787
  this.setBaseModelEnabled.bind(this)
801
788
  ), this.transformRoot = new Fe("root", this.scene);
802
789
  const a = async () => {
803
- var l;
804
790
  if (!i.model)
805
791
  throw new Error(
806
792
  "Model container constructed with no URL. This is currently unsupported."
@@ -808,8 +794,7 @@ class nt {
808
794
  return this.assetContainer = await be(
809
795
  i.model,
810
796
  o,
811
- r,
812
- (l = this.previewService.getCurrentConfiguration()) == null ? void 0 : l.loadModel
797
+ r
813
798
  ), await this.instantiate(), this;
814
799
  };
815
800
  this.importPromise = a();
@@ -852,11 +837,11 @@ class nt {
852
837
  await this.variantManager.applyMaterial(
853
838
  e,
854
839
  i,
855
- (o, a, l) => {
840
+ (o, a, h) => {
856
841
  this.materialVariantObservable.notifyObservers({
857
842
  remainingCount: o,
858
843
  totalCount: a,
859
- taskName: l
844
+ taskName: h
860
845
  });
861
846
  },
862
847
  s
@@ -902,24 +887,20 @@ class nt {
902
887
  );
903
888
  return;
904
889
  }
905
- const s = () => {
906
- var a;
907
- return this.variantManager.applyModel(
908
- e,
909
- i,
910
- t == null ? void 0 : t.model,
911
- (l) => {
912
- this.modelVariantObservable.notifyObservers({
913
- ...l,
914
- key: e
915
- });
916
- },
917
- this.lastPlayedAnimation,
918
- this.getCurrentAnimationFrame.bind(this),
919
- this.getAnimationIsPlaying.bind(this),
920
- (a = this.previewService.getCurrentConfiguration()) == null ? void 0 : a.loadModel
921
- );
922
- };
890
+ const s = () => this.variantManager.applyModel(
891
+ e,
892
+ i,
893
+ t == null ? void 0 : t.model,
894
+ (a) => {
895
+ this.modelVariantObservable.notifyObservers({
896
+ ...a,
897
+ key: e
898
+ });
899
+ },
900
+ this.lastPlayedAnimation,
901
+ this.getCurrentAnimationFrame.bind(this),
902
+ this.getAnimationIsPlaying.bind(this)
903
+ );
923
904
  if (this.modelChangesInProgress.includes(e)) {
924
905
  this.queuedModelChanges.set(e, s);
925
906
  return;
@@ -928,10 +909,10 @@ class nt {
928
909
  this.modelChangesInProgress.push(e);
929
910
  let a = await s();
930
911
  if (this.queuedModelChanges.has(e)) {
931
- const l = this.queuedModelChanges.get(e);
932
- if (!l)
912
+ const h = this.queuedModelChanges.get(e);
913
+ if (!h)
933
914
  throw new Error("Queued change resolved undefined");
934
- a = await l(), this.queuedModelChanges.delete(e);
915
+ a = await h(), this.queuedModelChanges.delete(e);
935
916
  }
936
917
  return this.modelChangesInProgress.splice(
937
918
  this.modelChangesInProgress.indexOf(e),
@@ -1044,15 +1025,15 @@ class nt {
1044
1025
  attachPickingHandler(e) {
1045
1026
  e.rootNodes.forEach((t) => {
1046
1027
  t.getChildMeshes(!1).forEach((i) => {
1047
- i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new T(this.scene)), i.actionManager.registerAction(
1048
- new ae(T.OnPointerOverTrigger, (s) => {
1028
+ i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
1029
+ new ae(R.OnPointerOverTrigger, (s) => {
1049
1030
  s.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
1050
1031
  id: i.material.id,
1051
1032
  name: this.stripIdFromName(i.material.name)
1052
1033
  });
1053
1034
  })
1054
1035
  ), i.actionManager.registerAction(
1055
- new ae(T.OnPointerOutTrigger, () => {
1036
+ new ae(R.OnPointerOutTrigger, () => {
1056
1037
  i.material && this.materialDeselectedObservable.notifyObservers({
1057
1038
  id: i.material.id,
1058
1039
  name: this.stripIdFromName(i.material.name)
@@ -1081,7 +1062,7 @@ class nt {
1081
1062
  return this.modelReadyToLoadCallbacks.size;
1082
1063
  }
1083
1064
  configureGlowLayer() {
1084
- const e = (i) => i instanceof D && i.emissiveTexture !== null;
1065
+ const e = (i) => i instanceof B && i.emissiveTexture !== null;
1085
1066
  this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
1086
1067
  }
1087
1068
  configureModelInstance(e) {
@@ -1094,7 +1075,7 @@ class nt {
1094
1075
  this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
1095
1076
  for (const o of e.rootNodes)
1096
1077
  o.parent = this.transformRoot;
1097
- this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(), Ke(
1078
+ this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(), He(
1098
1079
  this.materials.concat(this.variantManager.getAllMaterials()),
1099
1080
  this.scene,
1100
1081
  this.canvasPanels,
@@ -1197,8 +1178,8 @@ class nt {
1197
1178
  }
1198
1179
  //#endregion
1199
1180
  }
1200
- class k extends pe {
1201
- constructor(e, t, i, s, r, o, a, l) {
1181
+ class D extends pe {
1182
+ constructor(e, t, i, s, r, o, a, h) {
1202
1183
  super(
1203
1184
  e,
1204
1185
  t,
@@ -1206,7 +1187,7 @@ class k extends pe {
1206
1187
  s,
1207
1188
  r,
1208
1189
  o,
1209
- l
1190
+ h
1210
1191
  ), this.lastFocus = new p(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, a.camera.autoOrientation && (this.alpha += Math.PI), a && (a.camera.limits.min.beta && (this.lowerBetaLimit = a.camera.limits.min.beta), a.camera.limits.max.beta && (this.upperBetaLimit = a.camera.limits.max.beta), a.camera.limits.min.alpha && (this.lowerAlphaLimit = a.camera.limits.min.alpha), a.camera.limits.max.alpha && (this.upperAlphaLimit = a.camera.limits.max.alpha), a.camera.limits.min.radius && (this.lowerRadiusLimit = a.camera.limits.min.radius), a.camera.limits.max.radius && (this.upperRadiusLimit = a.camera.limits.max.radius), a.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
1211
1192
  a.camera.autoRotation.idleTimeMs
1212
1193
  ));
@@ -1240,7 +1221,7 @@ class k extends pe {
1240
1221
  this.useFramingBehavior = !0;
1241
1222
  const e = this.getFramingBehavior();
1242
1223
  e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
1243
- const t = O(this._scene);
1224
+ const t = E(this._scene);
1244
1225
  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;
1245
1226
  }
1246
1227
  /**
@@ -1254,7 +1235,7 @@ class k extends pe {
1254
1235
  i.framingTime = t || 800;
1255
1236
  const s = () => {
1256
1237
  this.isRunningFramingBehavior = !1;
1257
- }, r = O(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
1238
+ }, r = E(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
1258
1239
  this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(a), this.panDenominator = o.length(), this.lastFocus.copyFrom(a), i.zoomOnBoundingInfo(
1259
1240
  r.min,
1260
1241
  r.max,
@@ -1289,7 +1270,7 @@ class k extends pe {
1289
1270
  * @param assignActive If true the camera will be assigned as the active camera on the scene.
1290
1271
  */
1291
1272
  static create(e, t, i) {
1292
- const s = O(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new k(
1273
+ const s = E(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new D(
1293
1274
  "ProductCamera",
1294
1275
  -(Math.PI / 2),
1295
1276
  Math.PI / 2,
@@ -1303,7 +1284,7 @@ class k extends pe {
1303
1284
  }), i && (e.activeCamera = a), a;
1304
1285
  }
1305
1286
  }
1306
- function O(n) {
1287
+ function E(n) {
1307
1288
  if (n.meshes.length === 0)
1308
1289
  return {
1309
1290
  min: new p(-1, -1, -1),
@@ -1312,7 +1293,7 @@ function O(n) {
1312
1293
  const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
1313
1294
  return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
1314
1295
  }
1315
- class st {
1296
+ class nt {
1316
1297
  constructor(e, t = !1, i = void 0) {
1317
1298
  this.renderingPipeline = new qe(
1318
1299
  "default",
@@ -1321,7 +1302,7 @@ class st {
1321
1302
  i ? [i] : void 0,
1322
1303
  !1
1323
1304
  // Disable automatic build
1324
- ), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(c));
1305
+ ), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(d));
1325
1306
  }
1326
1307
  dispose() {
1327
1308
  this.renderingPipeline.dispose();
@@ -1330,28 +1311,28 @@ class st {
1330
1311
  return this.currentConfiguration;
1331
1312
  }
1332
1313
  setConfiguration(e) {
1333
- var t, i, s, r, o, a, l, d, h, u, m, g, f, A, z, V, q, N, G, _, H, K, U, W, Y, Q, Z, $, j, X, J, ee, te;
1314
+ var t, i, s, r, o, a, h, c, l, u, m, g, f, k, z, V, q, N, G, _, H, K, U, W, Y, Q, Z, $, j, X, J, ee, te;
1334
1315
  if (this.renderingPipeline.isSupported) {
1335
- if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? c.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? c.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((s = e.bloom) == null ? void 0 : s.enabled) ?? c.bloom.enabled, this.renderingPipeline.bloomKernel = ((r = e.bloom) == null ? void 0 : r.kernel) ?? c.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? c.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? c.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? c.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((d = e.chromaticAberration) == null ? void 0 : d.enabled) ?? c.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((h = e.chromaticAberration) == null ? void 0 : h.aberrationAmount) ?? c.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? c.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ne(
1316
+ if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((s = e.bloom) == null ? void 0 : s.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((r = e.bloom) == null ? void 0 : r.kernel) ?? d.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = ((h = e.bloom) == null ? void 0 : h.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((l = e.chromaticAberration) == null ? void 0 : l.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ne(
1336
1317
  e.chromaticAberration.direction.x,
1337
1318
  e.chromaticAberration.direction.y
1338
1319
  ) : new ne(
1339
- c.chromaticAberration.direction.x,
1340
- c.chromaticAberration.direction.y
1341
- ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? c.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new oe(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? c.depthOfField.enabled, e.depthOfField)
1342
- switch (e.depthOfField.blurLevel ?? c.depthOfField.blurLevel) {
1320
+ d.chromaticAberration.direction.x,
1321
+ d.chromaticAberration.direction.y
1322
+ ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new oe(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? d.depthOfField.enabled, e.depthOfField)
1323
+ switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
1343
1324
  case "Low":
1344
- this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
1325
+ this.renderingPipeline.depthOfFieldBlurLevel = T.Low;
1345
1326
  break;
1346
1327
  case "Medium":
1347
- this.renderingPipeline.depthOfFieldBlurLevel = E.Medium;
1328
+ this.renderingPipeline.depthOfFieldBlurLevel = T.Medium;
1348
1329
  break;
1349
1330
  case "High":
1350
- this.renderingPipeline.depthOfFieldBlurLevel = E.High;
1331
+ this.renderingPipeline.depthOfFieldBlurLevel = T.High;
1351
1332
  break;
1352
1333
  }
1353
- if (this.renderingPipeline.depthOfField.focalLength = ((A = e.depthOfField) == null ? void 0 : A.focalLength) ?? c.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? c.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? c.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((q = e.depthOfField) == null ? void 0 : q.lensSize) ?? c.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((N = e.grain) == null ? void 0 : N.enabled) ?? c.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? c.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? c.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.contrast) ?? c.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? c.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? c.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1354
- switch (e.misc.toneMappingType ?? c.misc.toneMappingType) {
1334
+ if (this.renderingPipeline.depthOfField.focalLength = ((k = e.depthOfField) == null ? void 0 : k.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((q = e.depthOfField) == null ? void 0 : q.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((N = e.grain) == null ? void 0 : N.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1335
+ switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
1355
1336
  case "Standard":
1356
1337
  this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
1357
1338
  break;
@@ -1359,8 +1340,8 @@ class st {
1359
1340
  this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
1360
1341
  break;
1361
1342
  }
1362
- if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? c.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Y = e.sharpen) == null ? void 0 : Y.colorAmount) ?? c.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Q = e.sharpen) == null ? void 0 : Q.edgeAmount) ?? c.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.enabled) ?? c.vignette.enabled, ($ = e.vignette) != null && $.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = c.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = c.vignette.center.y), e.vignette)
1363
- switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? c.vignette.blendMode) {
1343
+ if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Y = e.sharpen) == null ? void 0 : Y.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Q = e.sharpen) == null ? void 0 : Q.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.enabled) ?? d.vignette.enabled, ($ = e.vignette) != null && $.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)
1344
+ switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? d.vignette.blendMode) {
1364
1345
  case "Multiply":
1365
1346
  this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
1366
1347
  break;
@@ -1374,11 +1355,11 @@ class st {
1374
1355
  e.vignette.colorRgba.b,
1375
1356
  e.vignette.colorRgba.a
1376
1357
  ) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
1377
- c.vignette.colorRgba.r,
1378
- c.vignette.colorRgba.g,
1379
- c.vignette.colorRgba.b,
1380
- c.vignette.colorRgba.a
1381
- ), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? c.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? c.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1358
+ d.vignette.colorRgba.r,
1359
+ d.vignette.colorRgba.g,
1360
+ d.vignette.colorRgba.b,
1361
+ d.vignette.colorRgba.a
1362
+ ), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1382
1363
  }
1383
1364
  }
1384
1365
  updateColorCurve(e) {
@@ -1386,32 +1367,32 @@ class st {
1386
1367
  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;
1387
1368
  }
1388
1369
  }
1389
- Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
1370
+ Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
1390
1371
  return new Ge(n);
1391
1372
  });
1392
- B.OnPluginActivatedObservable.add((n) => {
1373
+ S.OnPluginActivatedObservable.add((n) => {
1393
1374
  if (n.name === "gltf") {
1394
1375
  const e = n;
1395
1376
  e.transparencyAsCoverage = !0;
1396
1377
  }
1397
1378
  });
1398
- function L(n) {
1379
+ function O(n) {
1399
1380
  return new p(n.x, n.y, n.z);
1400
1381
  }
1401
- function I(n) {
1382
+ function L(n) {
1402
1383
  return { x: n.x, y: n.y, z: n.z };
1403
1384
  }
1404
- class Yt {
1385
+ class Wt {
1405
1386
  constructor(e) {
1406
- var l;
1387
+ var h;
1407
1388
  this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
1408
1389
  if (!this.engine.views)
1409
1390
  return;
1410
- this.modelContainers.forEach((h) => {
1411
- h.updateDynamicTextures();
1391
+ this.modelContainers.forEach((l) => {
1392
+ l.updateDynamicTextures();
1412
1393
  }), this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
1413
- const d = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
1414
- !this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, d) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
1394
+ const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
1395
+ !this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, c) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
1415
1396
  }, this.configuration = new le(e);
1416
1397
  const i = (() => {
1417
1398
  if (!(e != null && e.noRender))
@@ -1436,7 +1417,7 @@ class Yt {
1436
1417
  stencil: this.configuration.highlights.enabled,
1437
1418
  forceSRGBBufferSupportState: !0
1438
1419
  }) : new Ce();
1439
- console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Ae(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = k.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
1420
+ console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Pe(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = D.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
1440
1421
  this.scene,
1441
1422
  !1,
1442
1423
  this.camera
@@ -1445,14 +1426,14 @@ class Yt {
1445
1426
  this.configuration.scene.environment.file,
1446
1427
  this.scene
1447
1428
  );
1448
- a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (l = this.configuration.options) != null && l.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1429
+ a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (h = this.configuration.options) != null && h.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1449
1430
  this.configuration.options.renderingPipelineConfiguration
1450
1431
  ) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
1451
1432
  this.scene,
1452
1433
  this.configuration.emissiveGlowIntensity
1453
- ), this.initPromise = new Promise((d) => {
1434
+ ), this.initPromise = new Promise((c) => {
1454
1435
  this.scene.onReadyObservable.addOnce(() => {
1455
- this.initComplete = !0, d();
1436
+ this.initComplete = !0, c();
1456
1437
  });
1457
1438
  }), this.engine.runRenderLoop(this.renderLoop);
1458
1439
  }
@@ -1484,7 +1465,7 @@ class Yt {
1484
1465
  }
1485
1466
  registerView(e) {
1486
1467
  const t = e.height, i = e.width;
1487
- 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);
1468
+ this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(I.Pan), this.reattachControls(e);
1488
1469
  }
1489
1470
  getNumViewports() {
1490
1471
  var e;
@@ -1502,7 +1483,7 @@ class Yt {
1502
1483
  let t = () => {
1503
1484
  };
1504
1485
  const i = async () => {
1505
- this.isAnimatingCamera = !0, await Ye(
1486
+ this.isAnimatingCamera = !0, await We(
1506
1487
  this.scene,
1507
1488
  this.scene.activeCamera,
1508
1489
  e
@@ -1538,7 +1519,7 @@ class Yt {
1538
1519
  throw new Error(
1539
1520
  "No views attached, camera state requires a view to attach controls onto."
1540
1521
  );
1541
- e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1522
+ e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1542
1523
  }
1543
1524
  animateToLastCameraFocus() {
1544
1525
  let e = () => {
@@ -1601,8 +1582,8 @@ class Yt {
1601
1582
  const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, s = e.camera.limits.min.beta, r = e.camera.limits.max.beta;
1602
1583
  if (t === void 0 || i === void 0 || s === void 0 || r === void 0)
1603
1584
  return !0;
1604
- const o = [t, i], a = [s, r], l = o.every((h) => h === t), d = a.every((h) => h === s);
1605
- return !l && !d;
1585
+ const o = [t, i], a = [s, r], h = o.every((l) => l === t), c = a.every((l) => l === s);
1586
+ return !h && !c;
1606
1587
  }
1607
1588
  fireResizeEvent() {
1608
1589
  this.getNumViewports() > 0 && this.engine.resize();
@@ -1621,8 +1602,8 @@ class Yt {
1621
1602
  );
1622
1603
  o && o.getBindedMeshes().forEach(
1623
1604
  (a) => {
1624
- var l;
1625
- return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
1605
+ var h;
1606
+ return (h = this.highlightLayer) == null ? void 0 : h.addMesh(
1626
1607
  a,
1627
1608
  i || w.FromHexString("#fcba03")
1628
1609
  );
@@ -1634,7 +1615,7 @@ class Yt {
1634
1615
  this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
1635
1616
  }
1636
1617
  loadModel(e, t) {
1637
- const i = new nt({
1618
+ const i = new it({
1638
1619
  enablePicking: this.configuration.highlights.enabled,
1639
1620
  modelDetails: e,
1640
1621
  scene: this.scene,
@@ -1690,16 +1671,16 @@ class Yt {
1690
1671
  */
1691
1672
  flipTransform(e, t, i) {
1692
1673
  const s = se.Compose(
1693
- L(i || { x: 1, y: 1, z: 1 }),
1674
+ O(i || { x: 1, y: 1, z: 1 }),
1694
1675
  y.FromEulerVector(
1695
- L(t || { x: 0, y: 0, z: 0 })
1676
+ O(t || { x: 0, y: 0, z: 0 })
1696
1677
  ),
1697
- L(e || { x: 0, y: 0, z: 0 })
1698
- ), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(), l = y.Identity(), d = p.Zero();
1699
- return o.decompose(d, l, a), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
1700
- position: I(a),
1701
- rotation: I(l.toEulerAngles()),
1702
- scale: I(d)
1678
+ O(e || { x: 0, y: 0, z: 0 })
1679
+ ), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(), h = y.Identity(), c = p.Zero();
1680
+ return o.decompose(c, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
1681
+ position: L(a),
1682
+ rotation: L(h.toEulerAngles()),
1683
+ scale: L(c)
1703
1684
  };
1704
1685
  }
1705
1686
  updatePreviewOptions(e) {
@@ -1729,10 +1710,10 @@ class Yt {
1729
1710
  }
1730
1711
  }
1731
1712
  export {
1732
- S as MaterialEffectMode,
1733
- F as ProductCameraRig,
1713
+ F as MaterialEffectMode,
1714
+ I as ProductCameraRig,
1734
1715
  Ne as REFLECTION_PROBE_RESOLUTION,
1735
1716
  x as RenderingConfiguration,
1736
- Yt as SpiffCommerce3DPreviewService,
1737
- c as renderingPipelineDefaults
1717
+ Wt as SpiffCommerce3DPreviewService,
1718
+ d as renderingPipelineDefaults
1738
1719
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(c,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("@babylonjs/core/Cameras/arcRotateCamera"),require("@babylonjs/core/Engines/engine"),require("@babylonjs/core/Engines/nullEngine"),require("@babylonjs/core/Layers/highlightLayer"),require("@babylonjs/core/Loading/sceneLoader"),require("@babylonjs/core/Materials/Textures/cubeTexture"),require("@babylonjs/core/Maths/math.color"),require("@babylonjs/core/Maths/math.vector"),require("@babylonjs/core/Meshes/Compression/dracoCompression"),require("@babylonjs/core/Misc/observable"),require("@babylonjs/core/Misc/tools"),require("@babylonjs/core/scene"),require("@babylonjs/loaders/glTF"),require("@babylonjs/core/Materials/PBR/pbrMaterial"),require("@babylonjs/core/Materials/Textures/mirrorTexture"),require("@babylonjs/core/Maths/math"),require("@babylonjs/core/Probes/reflectionProbe"),require("@babylonjs/core/Layers/glowLayer"),require("@babylonjs/core/Actions/actionManager"),require("@babylonjs/core/Actions/directActions"),require("@babylonjs/core/Meshes/mesh"),require("@babylonjs/core/Meshes/transformNode"),require("@babylonjs/loaders/glTF/glTFFileLoader"),require("@babylonjs/core/Materials/Textures/dynamicTexture"),require("@babylonjs/core/Materials/Textures/texture"),require("@babylonjs/core/Animations/animation"),require("@babylonjs/core/Animations/easing"),require("@babylonjs/core/Misc/assetsManager"),require("@babylonjs/core/Materials/colorCurves"),require("@babylonjs/core/Materials/imageProcessingConfiguration"),require("@babylonjs/core/PostProcesses/RenderPipeline"),require("@babylonjs/core/PostProcesses/depthOfFieldEffect"),require("@babylonjs/core/Rendering/depthRendererSceneComponent"),require("@babylonjs/core/Engines/Extensions/engine.views"),require("@babylonjs/core/Meshes/instancedMesh"),require("@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader"),require("@babylonjs/core/Materials/Textures/Loaders/envTextureLoader"),require("@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader"),require("@babylonjs/core/Animations/animatable"),require("@babylonjs/core/Misc/screenshotTools"),require("@babylonjs/core/Rendering/boundingBoxRenderer"),require("@babylonjs/loaders/glTF/2.0/Extensions")):typeof define=="function"&&define.amd?define(["exports","@babylonjs/core/Cameras/arcRotateCamera","@babylonjs/core/Engines/engine","@babylonjs/core/Engines/nullEngine","@babylonjs/core/Layers/highlightLayer","@babylonjs/core/Loading/sceneLoader","@babylonjs/core/Materials/Textures/cubeTexture","@babylonjs/core/Maths/math.color","@babylonjs/core/Maths/math.vector","@babylonjs/core/Meshes/Compression/dracoCompression","@babylonjs/core/Misc/observable","@babylonjs/core/Misc/tools","@babylonjs/core/scene","@babylonjs/loaders/glTF","@babylonjs/core/Materials/PBR/pbrMaterial","@babylonjs/core/Materials/Textures/mirrorTexture","@babylonjs/core/Maths/math","@babylonjs/core/Probes/reflectionProbe","@babylonjs/core/Layers/glowLayer","@babylonjs/core/Actions/actionManager","@babylonjs/core/Actions/directActions","@babylonjs/core/Meshes/mesh","@babylonjs/core/Meshes/transformNode","@babylonjs/loaders/glTF/glTFFileLoader","@babylonjs/core/Materials/Textures/dynamicTexture","@babylonjs/core/Materials/Textures/texture","@babylonjs/core/Animations/animation","@babylonjs/core/Animations/easing","@babylonjs/core/Misc/assetsManager","@babylonjs/core/Materials/colorCurves","@babylonjs/core/Materials/imageProcessingConfiguration","@babylonjs/core/PostProcesses/RenderPipeline","@babylonjs/core/PostProcesses/depthOfFieldEffect","@babylonjs/core/Rendering/depthRendererSceneComponent","@babylonjs/core/Engines/Extensions/engine.views","@babylonjs/core/Meshes/instancedMesh","@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader","@babylonjs/core/Materials/Textures/Loaders/envTextureLoader","@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader","@babylonjs/core/Animations/animatable","@babylonjs/core/Misc/screenshotTools","@babylonjs/core/Rendering/boundingBoxRenderer","@babylonjs/loaders/glTF/2.0/Extensions"],y):(c=typeof globalThis<"u"?globalThis:c||self,y(c.Preview={},c.arcRotateCamera,c.engine,c.nullEngine,c.highlightLayer,c.sceneLoader,c.cubeTexture,c.math_color,c.math_vector,c.dracoCompression,c.observable,c.tools,c.scene,c.glTF,c.pbrMaterial,c.mirrorTexture,c.math,c.reflectionProbe,c.glowLayer,c.actionManager,c.directActions,c.mesh,c.transformNode,c.glTFFileLoader,c.dynamicTexture,c.texture,c.animation,c.easing,c.assetsManager,c.colorCurves,c.imageProcessingConfiguration,c.RenderPipeline,c.depthOfFieldEffect))})(this,function(c,y,V,ye,Ce,O,k,b,m,we,M,Me,xe,Pe,F,Ae,P,Te,Re,I,z,Ee,Le,Oe,Fe,Ie,C,N,Se,G,A,Be,S){"use strict";var T=(n=>(n[n.Orbit=0]="Orbit",n[n.Pan=1]="Pan",n))(T||{}),R=(n=>(n.None="None",n.RemoveWhenSelected="RemoveWhenSelected",n.ApplyWhenSelected="ApplyWhenSelected",n))(R||{});class H{constructor(e){this.getSceneClearColor=()=>{var i,s,r,o;const t=(i=this.customOptions)!=null&&i.transparentBackground||(s=this.customOptions)!=null&&s.backgroundImage?0:1;if(this.customOptions&&((r=this.customOptions)!=null&&r.transparentBackground)||(o=this.customOptions)!=null&&o.backgroundImage)return new b.Color4(0,0,0,t).toLinearSpace();if(this.customOptions&&this.customOptions.backgroundColor){const a=b.Color3.FromHexString(this.customOptions.backgroundColor);return new b.Color4(a.r,a.g,a.b,t).toLinearSpace()}return new b.Color4(.98,.98,.98,t).toLinearSpace()},this.highlightColorFromConfig=()=>this.customOptions&&this.customOptions.highlightColor?this.hexToColor4(this.customOptions.highlightColor):new b.Color4(.98,.98,.98,1).toLinearSpace(),this.hexToColor4=(t,i=1)=>{const s=b.Color3.FromHexString(t);return new b.Color4(s.r,s.g,s.b,i).toLinearSpace()},this.customOptions=e}createCanvas(){var e;return(e=this.customOptions)!=null&&e.createCanvas?this.customOptions.createCanvas():document.createElement("canvas")}get options(){return this.customOptions}get scene(){var e,t,i,s,r;return{clearColor:this.getSceneClearColor(),transparentBackground:((e=this.customOptions)==null?void 0:e.transparentBackground)||((t=this.customOptions)==null?void 0:t.backgroundImage),environment:{file:((i=this.customOptions)==null?void 0:i.environmentFile)??"assets/model-viewer/default.env",intensity:((s=this.customOptions)==null?void 0:s.environmentIntensity)??1,rotationY:(((r=this.customOptions)==null?void 0:r.environmentRotationY)??0)*(Math.PI/180)}}}get camera(){var e,t,i,s,r,o,a,l,u,h,g,p,f;return{autoOrientation:((e=this.customOptions)==null?void 0:e.disableAutomaticOrientation)??!0,autoRotation:{enabled:((t=this.customOptions)==null?void 0:t.autoRotation)??!1,idleTimeMs:((i=this.customOptions)==null?void 0:i.idleTimeBeforeRotation)??5e3},limits:{min:{alpha:(s=this.customOptions)!=null&&s.lowerAlphaLimitDeg?((r=this.customOptions)==null?void 0:r.lowerAlphaLimitDeg)*Math.PI/180:void 0,beta:(o=this.customOptions)!=null&&o.lowerBetaLimitDeg?((a=this.customOptions)==null?void 0:a.lowerBetaLimitDeg)*Math.PI/180:void 0,radius:(l=this.customOptions)==null?void 0:l.minZoomOverride},max:{alpha:(u=this.customOptions)!=null&&u.upperAlphaLimitDeg?((h=this.customOptions)==null?void 0:h.upperAlphaLimitDeg)*Math.PI/180:void 0,beta:(g=this.customOptions)!=null&&g.upperBetaLimitDeg?((p=this.customOptions)==null?void 0:p.upperBetaLimitDeg)*Math.PI/180:void 0,radius:(f=this.customOptions)==null?void 0:f.maxZoomOverride}}}}get highlights(){var e;return{enabled:((e=this.customOptions)==null?void 0:e.highlightOnMaterialHover)??!1,color:this.highlightColorFromConfig()}}get lighting(){var e,t,i,s;return{exposure:((t=(e=this.customOptions)==null?void 0:e.lighting)==null?void 0:t.exposure)??.9,contrast:((s=(i=this.customOptions)==null?void 0:i.lighting)==null?void 0:s.contrast)??1.6}}get emissiveGlowIntensity(){var e;return((e=this.customOptions)==null?void 0:e.emissiveGlowIntensity)??.5}}class w{static getDynamicTextureResolution(){return this.getIsMobile()||!w.offscreenRenderingSupported()?{width:1024,height:1024}:{width:2048,height:2048}}static shouldMipMap(){return!0}static offscreenRenderingSupported(){return navigator.userAgent.includes("SamsungBrowser")?!1:!!window.Worker&&!!window.OffscreenCanvas}static getMirrorTextureResolution(){return this.getIsMobile()?512:1024}static getIsMobile(){try{return typeof window>"u"||!window.navigator?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent)||window.innerWidth/window.devicePixelRatio<=480}catch{return!1}}}const K=128,d={antiAliasing:{samples:4,fxaaEnabled:!1},bloom:{enabled:!1,kernel:64,scale:.5,threshold:.9,weight:.15},chromaticAberration:{enabled:!1,aberrationAmount:30,direction:{x:0,y:0},radialIntensity:0},colorCurves:{enabled:!1},depthOfField:{enabled:!1,blurLevel:"Low",focalLength:50,focusDistance:2e3,fStop:1.4,lensSize:50},grain:{enabled:!1,animated:!1,intensity:30},misc:{contrast:1,exposure:1,toneMappingEnabled:!1,toneMappingType:"Standard"},sharpen:{enabled:!1,colorAmount:1,edgeAmount:.3},vignette:{enabled:!1,blendMode:"Multiply",cameraFov:.5,center:{x:0,y:0},colorHex:"#000000ff",colorRgba:{r:0,g:0,b:0,a:1},stretch:0,weight:1}};class je{constructor(e){this.name="glbPostProcessor",this.enabled=!0,this.loader=e}onReady(){this.applyReflections(this.loader.babylonScene)}loadNodeAsync(e,t,i){return this.loader.loadNodeAsync(e,t,function(s){t.extras&&Object.keys(t.extras).forEach(r=>{const o=t.extras[r];s.metadata[r]=o}),i(s)})}async loadMaterialPropertiesAsync(e,t,i){await this.loader.loadMaterialPropertiesAsync(e,t,i),this.enableMaterialExtrasIfRequired(t,i),i.needDepthPrePass=!0}dispose(){}enableMaterialExtrasIfRequired(e,t){if(!(!e.extras||!(t instanceof F.PBRMaterial))){if(e.extras.sheen){const i=t;i.sheen.isEnabled=!0,i.sheen.intensity=e.extras.sheen}if(e.extras.translucency){const i=t;i.subSurface.isTranslucencyEnabled=!0,i.subSurface.translucencyIntensity=e.extras.translucency,e.extras.translucencyR&&e.extras.translucencyG&&e.extras.translucencyB&&(i.subSurface.tintColor=new P.Color3(e.extras.translucencyR,e.extras.translucencyG,e.extras.translucencyB))}if(e.extras.refractionIOR){const i=t;i.subSurface.isRefractionEnabled=!0,i.subSurface.volumeIndexOfRefraction=e.extras.refractionIOR}if(e.extras.useDepthPrePass){const i=t;i.needDepthPrePass=!0,i.forceIrradianceInFragment=!0}if(e.extras.useParallax){const i=t;i.useParallax=!0,i.useParallaxOcclusion=!0,i.parallaxScaleBias=e.extras.useParallax}}}applyReflections(e){function t(r){const o=[];return r.transformNodes.forEach(a=>{a.metadata&&a.metadata.reflective&&o.push(...a.getChildMeshes())}),r.meshes.forEach(a=>{a.metadata&&a.metadata.reflective&&!o.includes(a)&&o.push(a)}),o}function i(r,o=1){const a=r.material;if(!a)return;const l=new Ae.MirrorTexture("mirror",w.getMirrorTextureResolution(),e,!0);l.renderList=t(e);const u=r.getVerticesData("normal");if(!u)throw new Error("Mirror attribute specified on: "+r.name+"But no normals exist to generate a mirror from!");r.computeWorldMatrix(!0);const h=r.getWorldMatrix(),g=P.Vector3.TransformNormal(new P.Vector3(u[0],u[1],u[2]),h).normalize(),p=P.Plane.FromPositionAndNormal(r.position,g.scale(-1));l.mirrorPlane=p,l.level=o,a.reflectionTexture=l}function s(r){const o=r.material,a=new Te.ReflectionProbe("probe-"+o.name,K,e);a.attachToMesh(r),a.renderList&&a.renderList.push(...t(e)),o.reflectionTexture=a.cubeTexture}e.meshes.forEach(r=>{const o=r.metadata;o&&(o.mirrorTexture&&i(r,o.mirrorTexture),o.reflectionProbe&&s(r))})}}class qe{constructor(e,t){this.scene=e,this.intensity=t,this.meshCount=0}setIntensity(e){this.intensity=e,this.glowLayer&&(this.glowLayer.intensity=e)}includeMeshes(e){if(e){this.glowLayer||(this.glowLayer=new Re.GlowLayer("glow",this.scene),this.glowLayer.intensity=this.intensity);for(const t of e)this.glowLayer.hasMesh(t)||(this.glowLayer.addIncludedOnlyMesh(t),this.meshCount++)}}removeMeshes(e){if(!(!this.glowLayer||!e)){for(const t of e)this.glowLayer.hasMesh(t)&&(this.glowLayer.removeIncludedOnlyMesh(t),this.meshCount--);this.meshCount===0&&(this.glowLayer.dispose(),this.glowLayer=void 0)}}}const U=new Map;async function De(n,e){if(e)return e(n).then(t=>new File([t],n,{type:"model/gltf-binary"}))}async function W(n,e,t,i){const s=U.get(n);if(s&&s.scene.uid===e.uid)return s;{const r=await De(n,i),o=await O.SceneLoader.LoadAssetContainerAsync(n,r,e,t,".glb");return U.set(n,o),o}}O.SceneLoader.OnPluginActivatedObservable.add(n=>{n.name==="gltf"&&(n.animationStartMode=Oe.GLTFLoaderAnimationStartMode.NONE)});function Ve(n,e,t,i,s=""){t.forEach(r=>{const o=r.getID(),a=r.getName(),l=w.getDynamicTextureResolution();n.filter(h=>h.name===s+a).forEach(h=>{const g=i.get(o),p=!1;if(g)Q(h,g),g.update(p);else{const f=ke(a,e,l.width,l.height);i.set(o,f),r.setStaticContext(f.getContext()),Q(h,f),f.onLoadObservable.addOnce(()=>{f.update(p)})}})})}function ke(n,e,t,i){const s=new Fe.DynamicTexture(n,{width:t,height:i},e,w.shouldMipMap(),Ie.Texture.TRILINEAR_SAMPLINGMODE,V.Engine.TEXTUREFORMAT_RGBA),r=s.getContext();return r&&(r.fillStyle="#f5f5f5",r.fillRect(0,0,t,i),s.update()),s}function Q(n,e){if(n instanceof F.PBRMaterial){const t=n,i=t.albedoTexture;i?(e.wrapU=i.wrapU,e.wrapV=i.wrapV):(e.wrapU=1,e.wrapV=1),t.albedoTexture=e}else{const t=n,i=t.diffuseTexture;i&&(e.wrapU=i.wrapU,e.wrapV=i.wrapV),t.diffuseTexture=e}}function ze(){const n=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}const x=60,Y=1;function Z(n){return n.targetedAnimations.map(t=>t.animation.framePerSecond).reduce((t,i)=>t+i,0)/n.targetedAnimations.length||0}function $(n,e,t,i,s,r){const o=s?n.filter(h=>h.name===s):n;if(o.length===0){console.warn(`No animations found for name: ${s}`);return}let a=0;const l=()=>{a++,a===o.length&&r&&r()},u=(h,g,p,f,v)=>{h.stop(),h.start(g,p,f,v),r&&(g==!1||g===void 0&&!h.loopAnimation?h.onAnimationGroupEndObservable.addOnce(()=>{l()}):h.onAnimationLoopObservable.addOnce(()=>{l()}))};if(i!==void 0&&t!==void 0&&i===t){o.forEach(h=>{const g=Z(h),p=i*g;u(h,!1,Y,p,p)});return}o.forEach(h=>{const g=Z(h),p=i!==void 0?i*g:void 0,f=t!==void 0?t*g:void 0;u(h,e,Y,p,f)})}function Ne(n,e,t){return new Promise(i=>{n.stopAnimation(e),e.animations=[],Math.abs(e.alpha)>2*Math.PI&&(e.alpha=Ge(e.alpha,0,2*Math.PI));const s=[],r=t.target,o=0,a=r?1:0;if(t.target&&Object.keys(t.target).length>0&&s.push(E("cameraTargetLerp","target",new m.Vector3().copyFrom(e.target),new m.Vector3(t.target.x,t.target.y,t.target.z),C.Animation.ANIMATIONTYPE_VECTOR3,o)),s.push(E("cameraAlphaLerp","alpha",e.alpha,X(t.lonDeg),C.Animation.ANIMATIONTYPE_FLOAT,a)),s.push(E("cameraBetaLerp","beta",e.beta,X(t.latDeg),C.Animation.ANIMATIONTYPE_FLOAT,a)),t.radius!==void 0){const h=Math.max(.01,t.radius);s.push(E("cameraRadiusLerp","radius",e.radius,h,C.Animation.ANIMATIONTYPE_FLOAT,a))}e.animations.push(...s);const u=e.useAutoRotationBehavior;e.disableAutoRotationBehavior(),n.beginAnimation(e,0,r?x*2:x,!1,1,()=>{e.animations=[],u&&e.enableAutoRotationBehavior(),i()})})}function X(n){return n*Math.PI/180}function E(n,e,t,i,s,r=0,o=C.Animation.ANIMATIONLOOPMODE_CONSTANT){const a=new N.QuadraticEase;a.setEasingMode(N.EasingFunction.EASINGMODE_EASEINOUT);const l=new C.Animation(n,e,x,s,o),u=[];return r>0&&u.push({frame:0,value:t}),u.push({frame:x*r,value:t}),u.push({frame:x*(r+1),value:i}),l.setKeys(u),l.setEasingFunction(a),l}function Ge(n,e,t){return n<e?n=t-(e-n)%(t-e):n=e+(n-e)%(t-e)}function He(n,e,t){n.forEach(i=>{t&&i.name!==t||i.goToFrame(e)})}const Ke={albedoTexture:"albedoMap",bumpTexture:"normalMap",ambientTexture:"ambientMap",emissiveTexture:"emissionMap",opacityTexture:"alphaMap",metallicTexture:"metallicMap",refractionTexture:"refractionMap",reflectionTexture:"reflectionMap"};function Ue(n,e,t,i){["albedoTexture","bumpTexture","ambientTexture","emissiveTexture","opacityTexture","metallicTexture","refractionTexture","reflectionTexture"].forEach(r=>{We(r,n,e,t,i)}),Ze(n,e)}function We(n,e,t,i,s){const r=Ke[n];if(!r)throw new Error("Unexpected texture name encountered.");const o=e[r],a=o==null?void 0:o.fileLink;a?n==="reflectionTexture"?a.endsWith(".env")||a.endsWith(".dds")?i.addCubeTextureTask(n,a,void 0,!1,void 0,!0):a.endsWith(".hdr")?i.addHDRCubeTextureTask(n,a,128,!1,!0,!1):i.addTextureTask(n,a,!1,!1):i.addTextureTask(n,a,!1,!1):s&&t[n]&&(t[n]&&t[n].dispose(),t[n]=null,Qe(n,t))}function Qe(n,e){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.Color3(0,0,0),e.reflectionTexture)}function Ye(n,e,t,i){if(!e){console.error("Failed to apply texture to material: material is null.");return}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.Color3(1,1,1),e.emissiveIntensity=1)}function Ze(n,e){n.clearCoat&&(n.clearCoat===R.RemoveWhenSelected?(e.clearCoat.isEnabled=!1,e.clearCoat.indexOfRefraction=1.5):n.clearCoat===R.ApplyWhenSelected&&(e.clearCoat.isEnabled=!0,e.clearCoat.indexOfRefraction=n.clearCoatIOR||e.clearCoat.indexOfRefraction))}class $e{constructor(e,t,i){this.materialVariantMap=new Map,this.keysThatRemovedBaseModel=[],this.loadedContainerForKey=new Map,this.loadedMaterialsForKey=new Map,this.scene=e,this.renameClonedAsset=t,this.setBaseModelEnabled=i}async applyMaterial(e,t,i,s){return new Promise(r=>{const o=this.materialVariantMap.get(e);this.materialVariantMap.set(e,{...o,...t});const a=this.renameClonedAsset(e),l=this.scene.materials.filter(h=>h.name===a);if(l.length===0){r();return}const u=new Se.AssetsManager(this.scene);u.useDefaultLoadingScreen=!1,l.forEach(h=>Ue(t,h,u,s)),u.onProgress=(h,g,p)=>{i&&i(h/g*100,100,p.name)},u.onFinish=h=>{h.forEach(g=>{const p=g;i&&i(100,100,g.name),this.scene.materials.filter(v=>v.name===a).forEach(v=>Ye(g.name,v,t,p.texture))}),r()},u.loadAsync()})}async applyModel(e,t,i,s,r,o,a,l){var p;if(i&&t&&!this.keysThatRemovedBaseModel.includes(e)&&this.keysThatRemovedBaseModel.push(e),!i)return this.keysThatRemovedBaseModel.includes(e)&&this.keysThatRemovedBaseModel.length===1&&await this.setBaseModelEnabled(!0),(p=this.loadedContainerForKey.get(e))==null||p.dispose(),this.loadedContainerForKey.delete(e),this.loadedMaterialsForKey.delete(e),this.keysThatRemovedBaseModel=this.keysThatRemovedBaseModel.filter(f=>f!==e),Promise.resolve(void 0);const h=(await W(i,this.scene,s,l)).instantiateModelsToScene(this.renameClonedAsset,!0);if(this.loadedContainerForKey.has(e)&&(this.loadedContainerForKey.get(e).dispose(),this.loadedContainerForKey.delete(e),this.loadedMaterialsForKey.delete(e)),r){const f=o&&o(),v=r.name?this.renameClonedAsset(r.name):void 0;if($(h.animationGroups,r.loop,r.to,r.from,v),f!=null){const L=a&&a()||!0;He(h.animationGroups,f+(L?2:0),v)}}t&&await this.setBaseModelEnabled(!1),this.loadedContainerForKey.set(e,h),this.loadedMaterialsForKey.set(e,_(h));const g=[];return this.materialVariantMap.forEach(async(f,v)=>{g.push(this.applyMaterial(v,f))}),await Promise.all(g),h}dispose(){this.loadedContainerForKey.forEach(e=>e==null?void 0:e.dispose()),this.loadedContainerForKey.clear(),this.loadedMaterialsForKey.forEach(e=>e.forEach(t=>t==null?void 0:t.dispose())),this.loadedMaterialsForKey.clear(),this.materialVariantMap.clear(),this.keysThatRemovedBaseModel=[]}getAllMaterials(){const e=[];return this.loadedMaterialsForKey.forEach(t=>{t.forEach(i=>{e.includes(i)||e.push(i)})}),e}getAnimationGroups(){const e=[];return this.loadedContainerForKey.forEach(t=>{e.push(...t.animationGroups)}),e}}function _(n){const e=[];return n.rootNodes.forEach(t=>{t.getChildMeshes().forEach(i=>{i.material&&!e.includes(i.material)&&e.push(i.material),i.subMeshes&&i.subMeshes.forEach(s=>{const r=s.getMaterial(!1);r&&!e.includes(r)&&e.push(r)})})}),e}function J(n,e=""){return n.map(t=>({name:t.name.substring(e.length),loop:t.loopAnimation,to:t.to,from:t.from}))}class Xe{constructor(e){this.metadata=new Map,this.materialSelectedObservable=new M.Observable,this.materialDeselectedObservable=new M.Observable,this.materialVariantObservable=new M.Observable,this.modelVariantObservable=new M.Observable,this.materialReadyToLoadCallbacks=new Map,this.modelReadyToLoadCallbacks=new Map,this.dynamicTextures=new Map,this.queuedMaterialChanges=new Map,this.materialChangesInProgress=[],this.queuedModelChanges=new Map,this.modelChangesInProgress=[],this.isExecutingAnimation=!1,this.animations=[],this.initialized=!1,this.materials=[];const{enablePicking:t,modelDetails:i,previewService:s,progressHandler:r,scene:o}=e;this.enablePicking=t,this.contextService=i.contextService,this.id=ze(),this.previewService=s,this.scene=o,this.variantManager=new $e(o,this.renameClonedAsset.bind(this),this.setBaseModelEnabled.bind(this)),this.transformRoot=new Le.TransformNode("root",this.scene);const a=async()=>{var l;if(!i.model)throw new Error("Model container constructed with no URL. This is currently unsupported.");return this.assetContainer=await W(i.model,o,r,(l=this.previewService.getCurrentConfiguration())==null?void 0:l.loadModel),await this.instantiate(),this};this.importPromise=a()}async applyMaterialVariant(e,t,i,s){if(!this.initialized){if(this.materialReadyToLoadCallbacks.has(e)){const o=this.materialReadyToLoadCallbacks.get(e);o==null||o.set(t,this.applyMaterialVariant.bind(this,e,t,i,s))}else{this.materialReadyToLoadCallbacks.set(e,new Map);const o=this.materialReadyToLoadCallbacks.get(e);o==null||o.set(t,this.applyMaterialVariant.bind(this,e,t,i,s))}return}const r=async()=>{await this.variantManager.applyMaterial(e,i,(o,a,l)=>{this.materialVariantObservable.notifyObservers({remainingCount:o,totalCount:a,taskName:l})},s)};if(this.materialChangesInProgress.includes(e)){if(this.queuedMaterialChanges.has(e)){const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,r)}else{this.queuedMaterialChanges.set(e,new Map);const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,r)}return}if(this.materialChangesInProgress.push(e),await r(),this.queuedMaterialChanges.has(e)){const o=this.queuedMaterialChanges.get(e);if(!o)throw new Error("Target material is undefined");o.forEach(async a=>{await a()}),this.queuedMaterialChanges.delete(e)}this.materialChangesInProgress.splice(this.materialChangesInProgress.indexOf(e),1),this.configureGlowLayer()}async applyModelVariant(e,t,i){if(!this.initialized){this.modelReadyToLoadCallbacks.set(e,this.applyModelVariant.bind(this,e,t,i));return}const s=()=>{var a;return this.variantManager.applyModel(e,i,t==null?void 0:t.model,l=>{this.modelVariantObservable.notifyObservers({...l,key:e})},this.lastPlayedAnimation,this.getCurrentAnimationFrame.bind(this),this.getAnimationIsPlaying.bind(this),(a=this.previewService.getCurrentConfiguration())==null?void 0:a.loadModel)};if(this.modelChangesInProgress.includes(e)){this.queuedModelChanges.set(e,s);return}const o=await(async()=>{this.modelChangesInProgress.push(e);let a=await s();if(this.queuedModelChanges.has(e)){const l=this.queuedModelChanges.get(e);if(!l)throw new Error("Queued change resolved undefined");a=await l(),this.queuedModelChanges.delete(e)}return this.modelChangesInProgress.splice(this.modelChangesInProgress.indexOf(e),1),a})();this.contextService||(this.contextService=t==null?void 0:t.contextService),o?this.configureModelInstance(o):this.configureGlowLayer()}dispose(){var e;this.destroyInstance(),this.variantManager.dispose(),this.dynamicTextures.forEach(t=>t==null?void 0:t.dispose()),this.dynamicTextures.clear(),this.materials.forEach(t=>t&&(t==null?void 0:t.dispose())),this.materials=[],(e=this.transformRoot)==null||e.dispose(),this.transformRoot=void 0,this.previewService.modelUnloaded(this)}executeAnimation(e){if(!this.initialized)return this.queuedModelAnimation=e,Promise.resolve();let t=()=>{};const i=async()=>{this.lastPlayedAnimation=e,this.isExecutingAnimation=!0,await new Promise(s=>{var o;const r=[...((o=this.modelInstance)==null?void 0:o.animationGroups)||[],...this.variantManager.getAnimationGroups()];$(r,e.loop,e.to,e.from,e.name?this.renameClonedAsset(e.name):void 0,s)}),this.isExecutingAnimation=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,t()};return this.isExecutingAnimation?(this.queuedAnimationFunction=i,new Promise(s=>{t=s})):i()}getAnimations(e){return[...this.animations,...e?J(this.variantManager.getAnimationGroups(),this.renameClonedAsset("")):[]]}getId(){return this.id}listMaterials(){var t;const e=(t=this.scene)==null?void 0:t.materials.filter(i=>i.name.startsWith(this.id));return e?e.map(i=>({id:i.id,name:this.stripIdFromName(i.name)})):[]}registerMaterialSelectedCallback(e){this.materialSelectedObservable.add(e)}unregisterMaterialSelectedCallback(e){this.materialSelectedObservable.removeCallback(e)}registerMaterialDeselectedCallback(e){this.materialDeselectedObservable.add(e)}unregisterMaterialDeselectedCallback(e){this.materialDeselectedObservable.removeCallback(e)}get position(){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to requesting position!");return this.transformRoot.position}set position(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting position!");this.transformRoot.position=new m.Vector3(e.x,e.y,e.z)}get rotation(){var e;if(!((e=this.transformRoot)!=null&&e.rotationQuaternion))throw new Error("ModelContainer disposed prior to requesting rotation!");return this.transformRoot.rotationQuaternion.toEulerAngles()}set rotation(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting rotation!");this.transformRoot.rotationQuaternion=m.Quaternion.FromEulerAngles(e.x,e.y,e.z)}get scale(){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to requesting scale!");return this.transformRoot.scaling}set scale(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting scale!");this.transformRoot.scaling=new m.Vector3(e.x,e.y,e.z)}attachPickingHandler(e){e.rootNodes.forEach(t=>{t.getChildMeshes(!1).forEach(i=>{i.name==="targetcube_t"||i.name==="backgroundShell"||(i.actionManager||(i.actionManager=new I.ActionManager(this.scene)),i.actionManager.registerAction(new z.ExecuteCodeAction(I.ActionManager.OnPointerOverTrigger,s=>{s.meshUnderPointer&&i.material&&this.materialSelectedObservable.notifyObservers({id:i.material.id,name:this.stripIdFromName(i.material.name)})})),i.actionManager.registerAction(new z.ExecuteCodeAction(I.ActionManager.OnPointerOutTrigger,()=>{i.material&&this.materialDeselectedObservable.notifyObservers({id:i.material.id,name:this.stripIdFromName(i.material.name)})})))})})}getInitializationPromise(){return this.importPromise}getIsInitialized(){return this.initialized}getQueuedMaterialVariantCount(){return this.materialReadyToLoadCallbacks.size}getQueuedModelVariantCount(){return this.modelReadyToLoadCallbacks.size}configureGlowLayer(){const e=i=>i instanceof F.PBRMaterial&&i.emissiveTexture!==null;this.materials.some(e)||this.variantManager.getAllMaterials().some(e)?this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()):this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes())}configureModelInstance(e){var r;if(!this.transformRoot)throw new Error("Transform disposed! This should never happen unless there is a race condition present!");const t=this.transformRoot.position,i=this.transformRoot.rotationQuaternion,s=this.transformRoot.scaling;this.transformRoot.position=m.Vector3.Zero(),this.transformRoot.rotationQuaternion=m.Quaternion.Identity(),this.transformRoot.scaling=m.Vector3.One();for(const o of e.rootNodes)o.parent=this.transformRoot;this.transformRoot.position=t,this.transformRoot.rotationQuaternion=i,this.transformRoot.scaling=s,this.canvasPanels=((r=this.contextService)==null?void 0:r.getAll())||new Map,Ve(this.materials.concat(this.variantManager.getAllMaterials()),this.scene,this.canvasPanels,this.dynamicTextures,`${this.id}_`),this.enablePicking&&this.attachPickingHandler(e),this.configureGlowLayer()}destroyInstance(){var e;(e=this.modelInstance)==null||e.dispose(),this.modelInstance=void 0}getAllMeshes(){var e;return(e=this.modelInstance)==null?void 0:e.rootNodes.map(t=>t.getChildMeshes(!1).filter(i=>i instanceof Ee.Mesh)).flat()}async instantiate(){if(!this.assetContainer)throw new Error("Attempted to instantiate ModelContainer without an AssetContainer");this.modelInstance=this.assetContainer.instantiateModelsToScene(this.renameClonedAsset.bind(this),!0),this.materials=_(this.modelInstance),this.configureModelInstance(this.modelInstance),this.animations=J(this.modelInstance.animationGroups,this.renameClonedAsset("")),this.initialized=!0,await this.processQueuedEvents()}renameClonedAsset(e){return`${this.id}_${e}`}async setBaseModelEnabled(e){e&&!this.modelInstance?await this.instantiate():!e&&this.modelInstance&&this.destroyInstance()}updateDynamicTextures(){var e;(e=this.canvasPanels)==null||e.forEach((t,i)=>{const s=this.dynamicTextures.get(i);s&&t.getStaticContextDirty()&&s.isReady()&&(s.update(!1),t.setStaticContextDirty(!1))})}registerMaterialVariantListener(e){this.materialVariantObservable.add(e)}unregisterMaterialVariantListener(e){this.materialVariantObservable.removeCallback(e)}registerModelVariantListener(e){this.modelVariantObservable.add(e)}unregisterModelVariantListener(e){this.modelVariantObservable.removeCallback(e)}getCurrentAnimationFrame(){var t;const e=[...((t=this.modelInstance)==null?void 0:t.animationGroups)||[],...this.variantManager.getAnimationGroups()];for(const i of e)if(i.animatables.length>0&&i.animatables[0].masterFrame!==void 0&&i.animatables[0].masterFrame!==null)return i.animatables[0].masterFrame;return 0}getAnimationIsPlaying(){var t;const e=[...((t=this.modelInstance)==null?void 0:t.animationGroups)||[],...this.variantManager.getAnimationGroups()];for(const i of e)if(i.isPlaying)return!0;return!1}stripIdFromName(e){return e.substring(this.id.length+1)}async processQueuedEvents(){await Promise.all(Array.from(this.materialReadyToLoadCallbacks.values()).flatMap(e=>Array.from(e.values()).map(t=>t()))),this.materialReadyToLoadCallbacks.clear(),await Promise.all(Array.from(this.modelReadyToLoadCallbacks.values()).map(e=>e())),this.modelReadyToLoadCallbacks.clear(),this.scene.onAfterRenderObservable.addOnce(()=>{this.queuedModelAnimation&&(this.executeAnimation(this.queuedModelAnimation),this.queuedModelAnimation=void 0)})}}class B extends y.ArcRotateCamera{constructor(e,t,i,s,r,o,a,l){super(e,t,i,s,r,o,l),this.lastFocus=new m.Vector3(0,0,0),this._isRunningFramingBehavior=!1,this.panDenominator=1,this.minZ=.01,this.updateRadiusBounds(this.radius),this.enableFramingBehavior(),this.wheelDeltaPercentage=.01,this.pinchDeltaPercentage=.005,this.useNaturalPinchZoom=!0,a.camera.autoOrientation&&(this.alpha+=Math.PI),a&&(a.camera.limits.min.beta&&(this.lowerBetaLimit=a.camera.limits.min.beta),a.camera.limits.max.beta&&(this.upperBetaLimit=a.camera.limits.max.beta),a.camera.limits.min.alpha&&(this.lowerAlphaLimit=a.camera.limits.min.alpha),a.camera.limits.max.alpha&&(this.upperAlphaLimit=a.camera.limits.max.alpha),a.camera.limits.min.radius&&(this.lowerRadiusLimit=a.camera.limits.min.radius),a.camera.limits.max.radius&&(this.upperRadiusLimit=a.camera.limits.max.radius),a.camera.autoRotation.enabled&&this.enableAutoRotationBehavior(a.camera.autoRotation.idleTimeMs))}get isRunningFramingBehavior(){return this._isRunningFramingBehavior}set isRunningFramingBehavior(e){this._isRunningFramingBehavior=e,!e&&this.framingBehaviourCallback&&(this.framingBehaviourCallback(),this.framingBehaviourCallback=void 0)}getFramingBehavior(){return this.getBehaviorByName("Framing")}getAutoRotationBehavior(){const e=this.getBehaviorByName("AutoRotation");if(e)return e}enableFramingBehavior(){this.useFramingBehavior=!0;const e=this.getFramingBehavior();e.attach(this),e.framingTime=0,e.elevationReturnTime=-1,e.zoomStopsAnimation=!1,this.lowerRadiusLimit=null;const t=j(this._scene);return e.zoomOnBoundingInfo(t.min,t.max),this.wheelPrecision=100/this.radius,this.lowerRadiusLimit===null&&(this.lowerRadiusLimit=.1),this.lastFocus.copyFrom(this.target),e}rerunFramingBehavior(e,t){this._isRunningFramingBehavior=!0,this.framingBehaviourCallback=e;const i=this.getFramingBehavior();i.framingTime=t||800;const s=()=>{this.isRunningFramingBehavior=!1},r=j(this._scene),o=r.max.subtract(r.min),a=r.min.add(o.scale(.5));this.updateRadiusBounds(o.length()*1.5),this.wheelPrecision=100/this.radius,this.panningInertia=0,this.panningOriginTarget.copyFrom(a),this.panDenominator=o.length(),this.lastFocus.copyFrom(a),i.zoomOnBoundingInfo(r.min,r.max,void 0,s),i.framingTime=0}enableAutoRotationBehavior(e=5e3){this.useAutoRotationBehavior=!0;const t=this.getAutoRotationBehavior();t&&(t.idleRotationWaitTime=e)}disableAutoRotationBehavior(){this.useAutoRotationBehavior=!1}updateRadiusBounds(e){this.maxZ=e*1e3,this.lowerRadiusLimit=e*.01,this.upperRadiusLimit=1.5*e,this.wheelPrecision=100/e,this.pinchPrecision=300/e}static create(e,t,i){const s=j(e),r=s.max.subtract(s.min),o=s.min.add(r.scale(.5)),a=new B("ProductCamera",-(Math.PI/2),Math.PI/2,r.length()*1.5,o,e,t);return a.panningInertia=0,a.panningOriginTarget.copyFrom(o),a.panDenominator=r.length(),a.onAfterCheckInputsObservable.add(()=>{a.panningSensibility=1e3/a.panDenominator}),i&&(e.activeCamera=a),a}}function j(n){if(n.meshes.length===0)return{min:new m.Vector3(-1,-1,-1),max:new m.Vector3(1,1,1)};const e=n.meshes.filter(t=>t.name.toLowerCase().endsWith("_t")||t.name.toLowerCase().includes("_t_"));return n.getWorldExtends(t=>t.isVisible&&t.isEnabled()&&(e.length===0||e.includes(t)))}class _e{constructor(e,t=!1,i=void 0){this.renderingPipeline=new Be.DefaultRenderingPipeline("default",t,e,i?[i]:void 0,!1),this.renderingPipeline.isSupported&&(this.renderingPipeline.prepare(),this.setConfiguration(d))}dispose(){this.renderingPipeline.dispose()}getConfiguration(){return this.currentConfiguration}setConfiguration(e){var t,i,s,r,o,a,l,u,h,g,p,f,v,L,ee,te,ie,ne,se,re,ae,oe,le,he,ce,de,ue,ge,me,pe,fe,be,ve;if(this.renderingPipeline.isSupported){if(this.renderingPipeline.samples=((t=e.antiAliasing)==null?void 0:t.samples)??d.antiAliasing.samples,this.renderingPipeline.fxaaEnabled=((i=e.antiAliasing)==null?void 0:i.fxaaEnabled)??d.antiAliasing.fxaaEnabled,this.renderingPipeline.bloomEnabled=((s=e.bloom)==null?void 0:s.enabled)??d.bloom.enabled,this.renderingPipeline.bloomKernel=((r=e.bloom)==null?void 0:r.kernel)??d.bloom.kernel,this.renderingPipeline.bloomScale=((o=e.bloom)==null?void 0:o.scale)??d.bloom.scale,this.renderingPipeline.bloomThreshold=((a=e.bloom)==null?void 0:a.threshold)??d.bloom.threshold,this.renderingPipeline.bloomWeight=((l=e.bloom)==null?void 0:l.weight)??d.bloom.weight,this.renderingPipeline.chromaticAberrationEnabled=((u=e.chromaticAberration)==null?void 0:u.enabled)??d.chromaticAberration.enabled,this.renderingPipeline.chromaticAberration.aberrationAmount=((h=e.chromaticAberration)==null?void 0:h.aberrationAmount)??d.chromaticAberration.aberrationAmount,this.renderingPipeline.chromaticAberration.radialIntensity=((g=e.chromaticAberration)==null?void 0:g.radialIntensity)??d.chromaticAberration.radialIntensity,this.renderingPipeline.chromaticAberration.direction=(p=e.chromaticAberration)!=null&&p.direction?new m.Vector2(e.chromaticAberration.direction.x,e.chromaticAberration.direction.y):new m.Vector2(d.chromaticAberration.direction.x,d.chromaticAberration.direction.y),this.renderingPipeline.imageProcessing.colorCurvesEnabled=((f=e.colorCurves)==null?void 0:f.enabled)??d.colorCurves.enabled,this.renderingPipeline.imageProcessing.colorCurves=e.colorCurves?this.updateColorCurve(e.colorCurves):new G.ColorCurves,this.renderingPipeline.depthOfFieldEnabled=((v=e.depthOfField)==null?void 0:v.enabled)??d.depthOfField.enabled,e.depthOfField)switch(e.depthOfField.blurLevel??d.depthOfField.blurLevel){case"Low":this.renderingPipeline.depthOfFieldBlurLevel=S.DepthOfFieldEffectBlurLevel.Low;break;case"Medium":this.renderingPipeline.depthOfFieldBlurLevel=S.DepthOfFieldEffectBlurLevel.Medium;break;case"High":this.renderingPipeline.depthOfFieldBlurLevel=S.DepthOfFieldEffectBlurLevel.High;break}if(this.renderingPipeline.depthOfField.focalLength=((L=e.depthOfField)==null?void 0:L.focalLength)??d.depthOfField.focalLength,this.renderingPipeline.depthOfField.fStop=((ee=e.depthOfField)==null?void 0:ee.fStop)??d.depthOfField.fStop,this.renderingPipeline.depthOfField.focusDistance=((te=e.depthOfField)==null?void 0:te.focusDistance)??d.depthOfField.focusDistance,this.renderingPipeline.depthOfField.lensSize=((ie=e.depthOfField)==null?void 0:ie.lensSize)??d.depthOfField.lensSize,this.renderingPipeline.grainEnabled=((ne=e.grain)==null?void 0:ne.enabled)??d.grain.enabled,this.renderingPipeline.grain.animated=((se=e.grain)==null?void 0:se.animated)??d.grain.animated,this.renderingPipeline.grain.intensity=((re=e.grain)==null?void 0:re.intensity)??d.grain.intensity,this.renderingPipeline.imageProcessing.contrast=((ae=e.misc)==null?void 0:ae.contrast)??d.misc.contrast,this.renderingPipeline.imageProcessing.exposure=((oe=e.misc)==null?void 0:oe.exposure)??d.misc.exposure,this.renderingPipeline.imageProcessing.toneMappingEnabled=((le=e.misc)==null?void 0:le.toneMappingEnabled)??d.misc.toneMappingEnabled,this.renderingPipeline.imageProcessing.toneMappingEnabled)switch(e.misc.toneMappingType??d.misc.toneMappingType){case"Standard":this.renderingPipeline.imageProcessing.toneMappingType=A.ImageProcessingConfiguration.TONEMAPPING_STANDARD;break;case"ACES":this.renderingPipeline.imageProcessing.toneMappingType=A.ImageProcessingConfiguration.TONEMAPPING_ACES;break}if(this.renderingPipeline.sharpenEnabled=((he=e.sharpen)==null?void 0:he.enabled)??d.sharpen.enabled,this.renderingPipeline.sharpen.colorAmount=((ce=e.sharpen)==null?void 0:ce.colorAmount)??d.sharpen.colorAmount,this.renderingPipeline.sharpen.edgeAmount=((de=e.sharpen)==null?void 0:de.edgeAmount)??d.sharpen.edgeAmount,this.renderingPipeline.imageProcessing.vignetteEnabled=((ue=e.vignette)==null?void 0:ue.enabled)??d.vignette.enabled,(ge=e.vignette)!=null&&ge.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)switch(((me=e.vignette)==null?void 0:me.blendMode)??d.vignette.blendMode){case"Multiply":this.renderingPipeline.imageProcessing.vignetteBlendMode=A.ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;break;case"Opaque":this.renderingPipeline.imageProcessing.vignetteBlendMode=A.ImageProcessingConfiguration.VIGNETTEMODE_OPAQUE;break}(pe=e.vignette)!=null&&pe.colorRgba?this.renderingPipeline.imageProcessing.vignetteColor=new b.Color4(e.vignette.colorRgba.r,e.vignette.colorRgba.g,e.vignette.colorRgba.b,e.vignette.colorRgba.a):(fe=e.vignette)!=null&&fe.colorHex?this.renderingPipeline.imageProcessing.vignetteColor=b.Color4.FromHexString(e.vignette.colorHex):this.renderingPipeline.imageProcessing.vignetteColor=new b.Color4(d.vignette.colorRgba.r,d.vignette.colorRgba.g,d.vignette.colorRgba.b,d.vignette.colorRgba.a),this.renderingPipeline.imageProcessing.vignetteStretch=((be=e.vignette)==null?void 0:be.stretch)??d.vignette.stretch,this.renderingPipeline.imageProcessing.vignetteWeight=((ve=e.vignette)==null?void 0:ve.weight)??d.vignette.weight,this.renderingPipeline.prepare(),this.currentConfiguration=e}}updateColorCurve(e){const t=new G.ColorCurves;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}}Pe.GLTF2.GLTFLoader.RegisterExtension("glbPostProcessor",function(n){return new je(n)}),O.SceneLoader.OnPluginActivatedObservable.add(n=>{if(n.name==="gltf"){const e=n;e.transparencyAsCoverage=!0}});function q(n){return new m.Vector3(n.x,n.y,n.z)}function D(n){return{x:n.x,y:n.y,z:n.z}}class Je{constructor(e){var l;this.focusLostNotified=!1,this.focusLostObservable=new M.Observable,this.modelLoadEventCallbacks=[],this.modelContainers=new Map,this.plugins=[],this.initComplete=!1,this.isAnimatingCamera=!1,this.renderLoop=()=>{if(!this.engine.views)return;this.modelContainers.forEach(h=>{h.updateDynamicTextures()}),this.scene.render(),this.camera.isRunningFramingBehavior&&this.camera.getFramingBehavior().isUserIsMoving&&(this.camera.isRunningFramingBehavior=!1);const u=Math.max((this.camera.lowerRadiusLimit??1)*.01,.001);!this.camera.isRunningFramingBehavior&&!this.camera.target.equalsWithEpsilon(this.camera.lastFocus,u)&&!this.focusLostNotified&&(this.focusLostObservable.notifyObservers(void 0),this.focusLostNotified=!0),this.screenshotPrepareResolve&&(this.screenshotPrepareResolve(),this.screenshotPrepareResolve=void 0)},this.configuration=new H(e);const i=(()=>{if(!(e!=null&&e.noRender))return this.configuration.createCanvas()})(),s="1.5.6";we.DracoCompression.Configuration={decoder:{wasmUrl:`https://www.gstatic.com/draco/versioned/decoders/${s}/draco_wasm_wrapper_gltf.js`,wasmBinaryUrl:`https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.wasm`,fallbackUrl:`https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.js`}},i&&(i.getContext("webgl2")||i.getContext("webgl"));const r=console.log;console.log=()=>{};const o=i?new V.Engine(i,!0,{adaptToDeviceRatio:!0,limitDeviceRatio:2,premultipliedAlpha:!1,preserveDrawingBuffer:!!(e!=null&&e.backgroundImage),audioEngine:!1,stencil:this.configuration.highlights.enabled,forceSRGBBufferSupportState:!0}):new ye.NullEngine;console.log=r,o.hideLoadingUI(),window.addEventListener("resize",this.fireResizeEvent.bind(this)),this.engine=o,this.scene=new xe.Scene(o),this.scene.autoClear=!0,this.scene.autoClearDepthAndStencil=!0,this.camera=B.create(this.scene,this.configuration),this.scene.activeCamera=this.camera,this.renderingPipeline=new _e(this.scene,!1,this.camera),this.scene.clearColor=this.configuration.scene.clearColor;const a=k.CubeTexture.CreateFromPrefilteredData(this.configuration.scene.environment.file,this.scene);a.rotationY=this.configuration.scene.environment.rotationY,this.scene.environmentTexture=a,this.scene.environmentIntensity=this.configuration.scene.environment.intensity,(l=this.configuration.options)!=null&&l.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 qe(this.scene,this.configuration.emissiveGlowIntensity),this.initPromise=new Promise(u=>{this.scene.onReadyObservable.addOnce(()=>{this.initComplete=!0,u()})}),this.engine.runRenderLoop(this.renderLoop)}getInitializationPromise(){return this.initPromise}getInitializationComplete(){return this.initComplete}getEngineContext(){return{engine:this.engine,scene:this.scene,camera:this.camera}}registerFocusLostListener(e){this.focusLostObservable.add(e)}unregisterFocusLostListener(e){this.focusLostObservable.removeCallback(e)}registerModelLoadEventListener(e){this.modelLoadEventCallbacks.push(e)}unregisterModelLoadEventListener(e){const t=this.modelLoadEventCallbacks.indexOf(e);t>-1&&this.modelLoadEventCallbacks.splice(t,1)}registerView(e){const t=e.height,i=e.width;this.engine.registerView(e,void 0,!0),e.setAttribute("height",t.toString()),e.setAttribute("width",i.toString()),this.orbitEnabled()||this.setCameraState(T.Pan),this.reattachControls(e)}getNumViewports(){var e;return((e=this.engine.views)==null?void 0:e.length)||0}unregisterView(e){this.engine.unRegisterView(e)}shutdown(){this.plugins.forEach(e=>e.dispose(!0)),this.renderingPipeline.dispose(),this.engine&&this.engine.dispose(),window.removeEventListener("resize",this.fireResizeEvent)}executeCameraAnimation(e){if(!this.camera||this.scene.activeCamera!==this.camera||this.getAllModels().length===0||!this.getAllModels().some(s=>s.getIsInitialized()))return this.queuedCameraAnimation=e,Promise.resolve();let t=()=>{};const i=async()=>{this.isAnimatingCamera=!0,await Ne(this.scene,this.scene.activeCamera,e),this.isAnimatingCamera=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,t()};return this.isAnimatingCamera?(this.queuedAnimationFunction=i,new Promise(s=>{t=s})):i()}getCameraPose(){if(this.scene&&this.camera)return{lonDeg:Math.round(this.camera.alpha*180/Math.PI),latDeg:Math.round(this.camera.beta*180/Math.PI),radius:Math.round((this.camera.radius+Number.EPSILON)*1e4)/1e4,target:{x:this.camera.target.x,y:this.camera.target.y,z:this.camera.target.z}}}setCameraPose(e){this.scene&&this.camera&&(this.camera.target=new m.Vector3(e.target.x,e.target.y,e.target.z),this.camera.radius=e.radius,this.camera.alpha=e.latDeg,this.camera.beta=e.lonDeg)}setCameraState(e){var t,i;if(!((t=this.engine)!=null&&t.views)||!((i=this.engine)!=null&&i.views[0]))throw new Error("No views attached, camera state requires a view to attach controls onto.");e===T.Orbit?this.reattachControls(this.engine.views[0].target,2):this.reattachControls(this.engine.views[0].target,0)}animateToLastCameraFocus(){let e=()=>{};const t=async()=>{this.isAnimatingCamera=!0,await new Promise(i=>{this.focusLostNotified=!1;const s=()=>{const r=this.configuration;this.camera.rerunFramingBehavior(()=>{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()})};this.scene.onAfterRenderObservable.addOnce(s)}),this.isAnimatingCamera=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,e()};return this.isAnimatingCamera?(this.queuedAnimationFunction=t,new Promise(i=>{e=i})):t()}setAutoRotation(e){!this.configuration.camera.autoRotation.enabled||!this.camera||(e?this.camera.enableAutoRotationBehavior(this.configuration.camera.autoRotation.idleTimeMs):this.camera.disableAutoRotationBehavior())}getCurrentConfiguration(){return this.configuration.options}async renderSceneScreenshot(e,t){if(!this.camera)throw new Error("Missing product camera, cannot render screenshot!");const i=new y.ArcRotateCamera("screenshotCamera",0,0,0,m.Vector3.Zero(),this.scene);try{const s=t.latDeg*Math.PI/180,r=t.lonDeg*Math.PI/180;i.target=t.target?new m.Vector3(t.target.x,t.target.y,t.target.z):m.Vector3.Zero(),i.alpha=r,i.beta=s,i.radius=t.radius||this.camera.radius,i.minZ=.01,this.scene.render();const o=await Me.Tools.CreateScreenshotUsingRenderTargetAsync(this.engine,i,e,"image/png",2,!0);return i.dispose(),o}catch{throw i.isDisposed()||i.dispose(),new Error("Failed to render screenshot")}}orbitEnabled(){const e=this.configuration;if(!e)return!0;const t=e.camera.limits.min.alpha,i=e.camera.limits.max.alpha,s=e.camera.limits.min.beta,r=e.camera.limits.max.beta;if(t===void 0||i===void 0||s===void 0||r===void 0)return!0;const o=[t,i],a=[s,r],l=o.every(h=>h===t),u=a.every(h=>h===s);return!l&&!u}fireResizeEvent(){this.getNumViewports()>0&&this.engine.resize()}setHighlights(e,t){var s;e.length===0&&((s=this.highlightLayer)==null||s.dispose(),this.highlightLayer=void 0),this.highlightLayer||(this.highlightLayer=new Ce.HighlightLayer("highlights",this.scene,{isStroke:!0,blurVerticalSize:.85,blurHorizontalSize:.85}),this.highlightLayer.innerGlow=!0,this.highlightLayer.outerGlow=!1),this.highlightLayer.removeAllMeshes();const i=t?new b.Color3(t[0],t[1],t[2]).toLinearSpace():void 0;e.forEach(r=>{const o=this.scene.materials.find(a=>a.name===r.name&&a.id===r.id);o&&o.getBindedMeshes().forEach(a=>{var l;return(l=this.highlightLayer)==null?void 0:l.addMesh(a,i||b.Color3.FromHexString("#fcba03"))})})}setRenderingPipelineConfiguration(e){this.renderingPipeline&&this.renderingPipeline.setConfiguration(e)}loadModel(e,t){const i=new Xe({enablePicking:this.configuration.highlights.enabled,modelDetails:e,scene:this.scene,previewService:this,progressHandler:t});return i.getInitializationPromise().then(()=>{this.modelContainers.size<=1&&this.camera.rerunFramingBehavior(()=>{this.scene.onAfterRenderObservable.addOnce(()=>{this.queuedCameraAnimation&&(this.executeCameraAnimation(this.queuedCameraAnimation),this.queuedCameraAnimation=void 0)})},1)}),this.configuration.highlights.enabled&&(i.registerMaterialSelectedCallback(s=>{this.setHighlights([s])}),i.registerMaterialDeselectedCallback(()=>{this.setHighlights([])})),this.modelContainers.set(i.getId(),i),this.triggerModelLoadEvent({eventType:"load",modelContainer:i}),i}getAllModels(){return Array.from(this.modelContainers.values())}getModelById(e){return this.modelContainers.get(e)}registerPlugin(e){this.plugins.push(e),e.initialize(this,{camera:this.camera,engine:this.engine,scene:this.scene})}unregisterPlugin(e){const t=this.plugins.indexOf(e);t>-1&&this.plugins.splice(t,1).forEach(s=>s.dispose(!1))}getGlowLayerManager(){return this.glowLayerManager}modelUnloaded(e){this.modelContainers.delete(e.getId()),this.triggerModelLoadEvent({eventType:"unload",modelContainer:e})}triggerModelLoadEvent(e){this.modelLoadEventCallbacks.forEach(t=>t(e))}flipTransform(e,t,i){const s=m.Matrix.Compose(q(i||{x:1,y:1,z:1}),m.Quaternion.FromEulerVector(q(t||{x:0,y:0,z:0})),q(e||{x:0,y:0,z:0})),r=m.Matrix.RotationAxis(m.Vector3.Up(),Math.PI),o=s.multiply(r),a=m.Vector3.Zero(),l=m.Quaternion.Identity(),u=m.Vector3.Zero();return o.decompose(u,l,a),l.multiplyInPlace(m.Quaternion.FromEulerAngles(0,Math.PI,0)),{position:D(a),rotation:D(l.toEulerAngles()),scale:D(u)}}updatePreviewOptions(e){var s;const t=new H(e);this.configuration.highlights.enabled!==t.highlights.enabled&&this.engine.setStencilBuffer(t.highlights.enabled),this.scene.clearColor=t.scene.clearColor;let i=this.scene.environmentTexture;this.configuration.scene.environment.file!==t.scene.environment.file&&(i=k.CubeTexture.CreateFromPrefilteredData(t.scene.environment.file,this.scene),i.rotationY=this.configuration.scene.environment.rotationY,this.scene.environmentTexture=i),i.rotationY=t.scene.environment.rotationY,this.scene.environmentIntensity=t.scene.environment.intensity,(s=t.options)!=null&&s.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.configuration=t}reattachControls(e,t=2){if(this.scene.detachControl(),this.engine.inputElement=e,this.camera){this.camera.attachControl(!0,!1,t);const i=this.camera.inputs.attached.pointers;i.multiTouchPanning=!1}this.scene.attachControl(!0,!0,!0)}}c.MaterialEffectMode=R,c.ProductCameraRig=T,c.REFLECTION_PROBE_RESOLUTION=K,c.RenderingConfiguration=w,c.SpiffCommerce3DPreviewService=Je,c.renderingPipelineDefaults=d,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("@babylonjs/core/Cameras/arcRotateCamera"),require("@babylonjs/core/Engines/engine"),require("@babylonjs/core/Engines/nullEngine"),require("@babylonjs/core/Layers/highlightLayer"),require("@babylonjs/core/Loading/sceneLoader"),require("@babylonjs/core/Materials/Textures/cubeTexture"),require("@babylonjs/core/Maths/math.color"),require("@babylonjs/core/Maths/math.vector"),require("@babylonjs/core/Meshes/Compression/dracoCompression"),require("@babylonjs/core/Misc/observable"),require("@babylonjs/core/Misc/tools"),require("@babylonjs/core/scene"),require("@babylonjs/loaders/glTF"),require("@babylonjs/core/Materials/PBR/pbrMaterial"),require("@babylonjs/core/Materials/Textures/mirrorTexture"),require("@babylonjs/core/Maths/math"),require("@babylonjs/core/Probes/reflectionProbe"),require("@babylonjs/core/Layers/glowLayer"),require("@babylonjs/core/Actions/actionManager"),require("@babylonjs/core/Actions/directActions"),require("@babylonjs/core/Meshes/mesh"),require("@babylonjs/core/Meshes/transformNode"),require("@babylonjs/loaders/glTF/glTFFileLoader"),require("@babylonjs/core/Materials/Textures/dynamicTexture"),require("@babylonjs/core/Materials/Textures/texture"),require("@babylonjs/core/Animations/animation"),require("@babylonjs/core/Animations/easing"),require("@babylonjs/core/Misc/assetsManager"),require("@babylonjs/core/Materials/colorCurves"),require("@babylonjs/core/Materials/imageProcessingConfiguration"),require("@babylonjs/core/PostProcesses/RenderPipeline"),require("@babylonjs/core/PostProcesses/depthOfFieldEffect"),require("@babylonjs/core/Rendering/depthRendererSceneComponent"),require("@babylonjs/core/Engines/Extensions/engine.views"),require("@babylonjs/core/Meshes/instancedMesh"),require("@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader"),require("@babylonjs/core/Materials/Textures/Loaders/envTextureLoader"),require("@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader"),require("@babylonjs/core/Animations/animatable"),require("@babylonjs/core/Misc/screenshotTools"),require("@babylonjs/core/Rendering/boundingBoxRenderer"),require("@babylonjs/loaders/glTF/2.0/Extensions")):typeof define=="function"&&define.amd?define(["exports","@babylonjs/core/Cameras/arcRotateCamera","@babylonjs/core/Engines/engine","@babylonjs/core/Engines/nullEngine","@babylonjs/core/Layers/highlightLayer","@babylonjs/core/Loading/sceneLoader","@babylonjs/core/Materials/Textures/cubeTexture","@babylonjs/core/Maths/math.color","@babylonjs/core/Maths/math.vector","@babylonjs/core/Meshes/Compression/dracoCompression","@babylonjs/core/Misc/observable","@babylonjs/core/Misc/tools","@babylonjs/core/scene","@babylonjs/loaders/glTF","@babylonjs/core/Materials/PBR/pbrMaterial","@babylonjs/core/Materials/Textures/mirrorTexture","@babylonjs/core/Maths/math","@babylonjs/core/Probes/reflectionProbe","@babylonjs/core/Layers/glowLayer","@babylonjs/core/Actions/actionManager","@babylonjs/core/Actions/directActions","@babylonjs/core/Meshes/mesh","@babylonjs/core/Meshes/transformNode","@babylonjs/loaders/glTF/glTFFileLoader","@babylonjs/core/Materials/Textures/dynamicTexture","@babylonjs/core/Materials/Textures/texture","@babylonjs/core/Animations/animation","@babylonjs/core/Animations/easing","@babylonjs/core/Misc/assetsManager","@babylonjs/core/Materials/colorCurves","@babylonjs/core/Materials/imageProcessingConfiguration","@babylonjs/core/PostProcesses/RenderPipeline","@babylonjs/core/PostProcesses/depthOfFieldEffect","@babylonjs/core/Rendering/depthRendererSceneComponent","@babylonjs/core/Engines/Extensions/engine.views","@babylonjs/core/Meshes/instancedMesh","@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader","@babylonjs/core/Materials/Textures/Loaders/envTextureLoader","@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader","@babylonjs/core/Animations/animatable","@babylonjs/core/Misc/screenshotTools","@babylonjs/core/Rendering/boundingBoxRenderer","@babylonjs/loaders/glTF/2.0/Extensions"],y):(c=typeof globalThis<"u"?globalThis:c||self,y(c.Preview={},c.arcRotateCamera,c.engine,c.nullEngine,c.highlightLayer,c.sceneLoader,c.cubeTexture,c.math_color,c.math_vector,c.dracoCompression,c.observable,c.tools,c.scene,c.glTF,c.pbrMaterial,c.mirrorTexture,c.math,c.reflectionProbe,c.glowLayer,c.actionManager,c.directActions,c.mesh,c.transformNode,c.glTFFileLoader,c.dynamicTexture,c.texture,c.animation,c.easing,c.assetsManager,c.colorCurves,c.imageProcessingConfiguration,c.RenderPipeline,c.depthOfFieldEffect))})(this,function(c,y,D,ye,Ce,L,V,b,p,we,M,Me,xe,Pe,O,Ae,P,Te,Re,F,k,Ee,Le,Oe,Fe,Ie,C,z,Se,N,A,Be,I){"use strict";var T=(n=>(n[n.Orbit=0]="Orbit",n[n.Pan=1]="Pan",n))(T||{}),R=(n=>(n.None="None",n.RemoveWhenSelected="RemoveWhenSelected",n.ApplyWhenSelected="ApplyWhenSelected",n))(R||{});class G{constructor(e){this.getSceneClearColor=()=>{var i,s,r,o;const t=(i=this.customOptions)!=null&&i.transparentBackground||(s=this.customOptions)!=null&&s.backgroundImage?0:1;if(this.customOptions&&((r=this.customOptions)!=null&&r.transparentBackground)||(o=this.customOptions)!=null&&o.backgroundImage)return new b.Color4(0,0,0,t).toLinearSpace();if(this.customOptions&&this.customOptions.backgroundColor){const a=b.Color3.FromHexString(this.customOptions.backgroundColor);return new b.Color4(a.r,a.g,a.b,t).toLinearSpace()}return new b.Color4(.98,.98,.98,t).toLinearSpace()},this.highlightColorFromConfig=()=>this.customOptions&&this.customOptions.highlightColor?this.hexToColor4(this.customOptions.highlightColor):new b.Color4(.98,.98,.98,1).toLinearSpace(),this.hexToColor4=(t,i=1)=>{const s=b.Color3.FromHexString(t);return new b.Color4(s.r,s.g,s.b,i).toLinearSpace()},this.customOptions=e}createCanvas(){var e;return(e=this.customOptions)!=null&&e.createCanvas?this.customOptions.createCanvas():document.createElement("canvas")}get options(){return this.customOptions}get scene(){var e,t,i,s,r;return{clearColor:this.getSceneClearColor(),transparentBackground:((e=this.customOptions)==null?void 0:e.transparentBackground)||((t=this.customOptions)==null?void 0:t.backgroundImage),environment:{file:((i=this.customOptions)==null?void 0:i.environmentFile)??"assets/model-viewer/default.env",intensity:((s=this.customOptions)==null?void 0:s.environmentIntensity)??1,rotationY:(((r=this.customOptions)==null?void 0:r.environmentRotationY)??0)*(Math.PI/180)}}}get camera(){var e,t,i,s,r,o,a,h,d,l,g,m,f;return{autoOrientation:((e=this.customOptions)==null?void 0:e.disableAutomaticOrientation)??!0,autoRotation:{enabled:((t=this.customOptions)==null?void 0:t.autoRotation)??!1,idleTimeMs:((i=this.customOptions)==null?void 0:i.idleTimeBeforeRotation)??5e3},limits:{min:{alpha:(s=this.customOptions)!=null&&s.lowerAlphaLimitDeg?((r=this.customOptions)==null?void 0:r.lowerAlphaLimitDeg)*Math.PI/180:void 0,beta:(o=this.customOptions)!=null&&o.lowerBetaLimitDeg?((a=this.customOptions)==null?void 0:a.lowerBetaLimitDeg)*Math.PI/180:void 0,radius:(h=this.customOptions)==null?void 0:h.minZoomOverride},max:{alpha:(d=this.customOptions)!=null&&d.upperAlphaLimitDeg?((l=this.customOptions)==null?void 0:l.upperAlphaLimitDeg)*Math.PI/180:void 0,beta:(g=this.customOptions)!=null&&g.upperBetaLimitDeg?((m=this.customOptions)==null?void 0:m.upperBetaLimitDeg)*Math.PI/180:void 0,radius:(f=this.customOptions)==null?void 0:f.maxZoomOverride}}}}get highlights(){var e;return{enabled:((e=this.customOptions)==null?void 0:e.highlightOnMaterialHover)??!1,color:this.highlightColorFromConfig()}}get lighting(){var e,t,i,s;return{exposure:((t=(e=this.customOptions)==null?void 0:e.lighting)==null?void 0:t.exposure)??.9,contrast:((s=(i=this.customOptions)==null?void 0:i.lighting)==null?void 0:s.contrast)??1.6}}get emissiveGlowIntensity(){var e;return((e=this.customOptions)==null?void 0:e.emissiveGlowIntensity)??.5}}class w{static getDynamicTextureResolution(){return this.getIsMobile()||!w.offscreenRenderingSupported()?{width:1024,height:1024}:{width:2048,height:2048}}static shouldMipMap(){return!0}static offscreenRenderingSupported(){return navigator.userAgent.includes("SamsungBrowser")?!1:!!window.Worker&&!!window.OffscreenCanvas}static getMirrorTextureResolution(){return this.getIsMobile()?512:1024}static getIsMobile(){try{return typeof window>"u"||!window.navigator?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent)||window.innerWidth/window.devicePixelRatio<=480}catch{return!1}}}const H=128,u={antiAliasing:{samples:4,fxaaEnabled:!1},bloom:{enabled:!1,kernel:64,scale:.5,threshold:.9,weight:.15},chromaticAberration:{enabled:!1,aberrationAmount:30,direction:{x:0,y:0},radialIntensity:0},colorCurves:{enabled:!1},depthOfField:{enabled:!1,blurLevel:"Low",focalLength:50,focusDistance:2e3,fStop:1.4,lensSize:50},grain:{enabled:!1,animated:!1,intensity:30},misc:{contrast:1,exposure:1,toneMappingEnabled:!1,toneMappingType:"Standard"},sharpen:{enabled:!1,colorAmount:1,edgeAmount:.3},vignette:{enabled:!1,blendMode:"Multiply",cameraFov:.5,center:{x:0,y:0},colorHex:"#000000ff",colorRgba:{r:0,g:0,b:0,a:1},stretch:0,weight:1}};class je{constructor(e){this.name="glbPostProcessor",this.enabled=!0,this.loader=e}onReady(){this.applyReflections(this.loader.babylonScene)}loadNodeAsync(e,t,i){return this.loader.loadNodeAsync(e,t,function(s){t.extras&&Object.keys(t.extras).forEach(r=>{const o=t.extras[r];s.metadata[r]=o}),i(s)})}async loadMaterialPropertiesAsync(e,t,i){await this.loader.loadMaterialPropertiesAsync(e,t,i),this.enableMaterialExtrasIfRequired(t,i),i.needDepthPrePass=!0}dispose(){}enableMaterialExtrasIfRequired(e,t){if(!(!e.extras||!(t instanceof O.PBRMaterial))){if(e.extras.sheen){const i=t;i.sheen.isEnabled=!0,i.sheen.intensity=e.extras.sheen}if(e.extras.translucency){const i=t;i.subSurface.isTranslucencyEnabled=!0,i.subSurface.translucencyIntensity=e.extras.translucency,e.extras.translucencyR&&e.extras.translucencyG&&e.extras.translucencyB&&(i.subSurface.tintColor=new P.Color3(e.extras.translucencyR,e.extras.translucencyG,e.extras.translucencyB))}if(e.extras.refractionIOR){const i=t;i.subSurface.isRefractionEnabled=!0,i.subSurface.volumeIndexOfRefraction=e.extras.refractionIOR}if(e.extras.useDepthPrePass){const i=t;i.needDepthPrePass=!0,i.forceIrradianceInFragment=!0}if(e.extras.useParallax){const i=t;i.useParallax=!0,i.useParallaxOcclusion=!0,i.parallaxScaleBias=e.extras.useParallax}}}applyReflections(e){function t(r){const o=[];return r.transformNodes.forEach(a=>{a.metadata&&a.metadata.reflective&&o.push(...a.getChildMeshes())}),r.meshes.forEach(a=>{a.metadata&&a.metadata.reflective&&!o.includes(a)&&o.push(a)}),o}function i(r,o=1){const a=r.material;if(!a)return;const h=new Ae.MirrorTexture("mirror",w.getMirrorTextureResolution(),e,!0);h.renderList=t(e);const d=r.getVerticesData("normal");if(!d)throw new Error("Mirror attribute specified on: "+r.name+"But no normals exist to generate a mirror from!");r.computeWorldMatrix(!0);const l=r.getWorldMatrix(),g=P.Vector3.TransformNormal(new P.Vector3(d[0],d[1],d[2]),l).normalize(),m=P.Plane.FromPositionAndNormal(r.position,g.scale(-1));h.mirrorPlane=m,h.level=o,a.reflectionTexture=h}function s(r){const o=r.material,a=new Te.ReflectionProbe("probe-"+o.name,H,e);a.attachToMesh(r),a.renderList&&a.renderList.push(...t(e)),o.reflectionTexture=a.cubeTexture}e.meshes.forEach(r=>{const o=r.metadata;o&&(o.mirrorTexture&&i(r,o.mirrorTexture),o.reflectionProbe&&s(r))})}}class qe{constructor(e,t){this.scene=e,this.intensity=t,this.meshCount=0}setIntensity(e){this.intensity=e,this.glowLayer&&(this.glowLayer.intensity=e)}includeMeshes(e){if(e){this.glowLayer||(this.glowLayer=new Re.GlowLayer("glow",this.scene),this.glowLayer.intensity=this.intensity);for(const t of e)this.glowLayer.hasMesh(t)||(this.glowLayer.addIncludedOnlyMesh(t),this.meshCount++)}}removeMeshes(e){if(!(!this.glowLayer||!e)){for(const t of e)this.glowLayer.hasMesh(t)&&(this.glowLayer.removeIncludedOnlyMesh(t),this.meshCount--);this.meshCount===0&&(this.glowLayer.dispose(),this.glowLayer=void 0)}}}const K=new Map;async function U(n,e,t){const i=K.get(n);if(i)return i;{const s=L.SceneLoader.LoadAssetContainerAsync(n,void 0,e,t);return K.set(n,s),s}}L.SceneLoader.OnPluginActivatedObservable.add(n=>{n.name==="gltf"&&(n.animationStartMode=Oe.GLTFLoaderAnimationStartMode.NONE)});function De(n,e,t,i,s=""){t.forEach(r=>{const o=r.getID(),a=r.getName(),h=w.getDynamicTextureResolution();n.filter(l=>l.name===s+a).forEach(l=>{const g=i.get(o),m=!1;if(g)W(l,g),g.update(m);else{const f=Ve(a,e,h.width,h.height);i.set(o,f),r.setStaticContext(f.getContext()),W(l,f),f.onLoadObservable.addOnce(()=>{f.update(m)})}})})}function Ve(n,e,t,i){const s=new Fe.DynamicTexture(n,{width:t,height:i},e,w.shouldMipMap(),Ie.Texture.TRILINEAR_SAMPLINGMODE,D.Engine.TEXTUREFORMAT_RGBA),r=s.getContext();return r&&(r.fillStyle="#f5f5f5",r.fillRect(0,0,t,i),s.update()),s}function W(n,e){if(n instanceof O.PBRMaterial){const t=n,i=t.albedoTexture;i?(e.wrapU=i.wrapU,e.wrapV=i.wrapV):(e.wrapU=1,e.wrapV=1),t.albedoTexture=e}else{const t=n,i=t.diffuseTexture;i&&(e.wrapU=i.wrapU,e.wrapV=i.wrapV),t.diffuseTexture=e}}function ke(){const n=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}const x=60,Q=1;function Y(n){return n.targetedAnimations.map(t=>t.animation.framePerSecond).reduce((t,i)=>t+i,0)/n.targetedAnimations.length||0}function Z(n,e,t,i,s,r){const o=s?n.filter(l=>l.name===s):n;if(o.length===0){console.warn(`No animations found for name: ${s}`);return}let a=0;const h=()=>{a++,a===o.length&&r&&r()},d=(l,g,m,f,v)=>{l.stop(),l.start(g,m,f,v),r&&(g==!1||g===void 0&&!l.loopAnimation?l.onAnimationGroupEndObservable.addOnce(()=>{h()}):l.onAnimationLoopObservable.addOnce(()=>{h()}))};if(i!==void 0&&t!==void 0&&i===t){o.forEach(l=>{const g=Y(l),m=i*g;d(l,!1,Q,m,m)});return}o.forEach(l=>{const g=Y(l),m=i!==void 0?i*g:void 0,f=t!==void 0?t*g:void 0;d(l,e,Q,m,f)})}function ze(n,e,t){return new Promise(i=>{n.stopAnimation(e),e.animations=[],Math.abs(e.alpha)>2*Math.PI&&(e.alpha=Ne(e.alpha,0,2*Math.PI));const s=[],r=t.target,o=0,a=r?1:0;if(t.target&&Object.keys(t.target).length>0&&s.push(E("cameraTargetLerp","target",new p.Vector3().copyFrom(e.target),new p.Vector3(t.target.x,t.target.y,t.target.z),C.Animation.ANIMATIONTYPE_VECTOR3,o)),s.push(E("cameraAlphaLerp","alpha",e.alpha,$(t.lonDeg),C.Animation.ANIMATIONTYPE_FLOAT,a)),s.push(E("cameraBetaLerp","beta",e.beta,$(t.latDeg),C.Animation.ANIMATIONTYPE_FLOAT,a)),t.radius!==void 0){const l=Math.max(.01,t.radius);s.push(E("cameraRadiusLerp","radius",e.radius,l,C.Animation.ANIMATIONTYPE_FLOAT,a))}e.animations.push(...s);const d=e.useAutoRotationBehavior;e.disableAutoRotationBehavior(),n.beginAnimation(e,0,r?x*2:x,!1,1,()=>{e.animations=[],d&&e.enableAutoRotationBehavior(),i()})})}function $(n){return n*Math.PI/180}function E(n,e,t,i,s,r=0,o=C.Animation.ANIMATIONLOOPMODE_CONSTANT){const a=new z.QuadraticEase;a.setEasingMode(z.EasingFunction.EASINGMODE_EASEINOUT);const h=new C.Animation(n,e,x,s,o),d=[];return r>0&&d.push({frame:0,value:t}),d.push({frame:x*r,value:t}),d.push({frame:x*(r+1),value:i}),h.setKeys(d),h.setEasingFunction(a),h}function Ne(n,e,t){return n<e?n=t-(e-n)%(t-e):n=e+(n-e)%(t-e)}function Ge(n,e,t){n.forEach(i=>{t&&i.name!==t||i.goToFrame(e)})}const He={albedoTexture:"albedoMap",bumpTexture:"normalMap",ambientTexture:"ambientMap",emissiveTexture:"emissionMap",opacityTexture:"alphaMap",metallicTexture:"metallicMap",refractionTexture:"refractionMap",reflectionTexture:"reflectionMap"};function Ke(n,e,t,i){["albedoTexture","bumpTexture","ambientTexture","emissiveTexture","opacityTexture","metallicTexture","refractionTexture","reflectionTexture"].forEach(r=>{Ue(r,n,e,t,i)}),Ye(n,e)}function Ue(n,e,t,i,s){const r=He[n];if(!r)throw new Error("Unexpected texture name encountered.");const o=e[r],a=o==null?void 0:o.fileLink;a?n==="reflectionTexture"?a.endsWith(".env")||a.endsWith(".dds")?i.addCubeTextureTask(n,a,void 0,!1,void 0,!0):a.endsWith(".hdr")?i.addHDRCubeTextureTask(n,a,128,!1,!0,!1):i.addTextureTask(n,a,!1,!1):i.addTextureTask(n,a,!1,!1):s&&t[n]&&(t[n]&&t[n].dispose(),t[n]=null,We(n,t))}function We(n,e){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.Color3(0,0,0),e.reflectionTexture)}function Qe(n,e,t,i){if(!e){console.error("Failed to apply texture to material: material is null.");return}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.Color3(1,1,1),e.emissiveIntensity=1)}function Ye(n,e){n.clearCoat&&(n.clearCoat===R.RemoveWhenSelected?(e.clearCoat.isEnabled=!1,e.clearCoat.indexOfRefraction=1.5):n.clearCoat===R.ApplyWhenSelected&&(e.clearCoat.isEnabled=!0,e.clearCoat.indexOfRefraction=n.clearCoatIOR||e.clearCoat.indexOfRefraction))}class Ze{constructor(e,t,i){this.materialVariantMap=new Map,this.keysThatRemovedBaseModel=[],this.loadedContainerForKey=new Map,this.loadedMaterialsForKey=new Map,this.scene=e,this.renameClonedAsset=t,this.setBaseModelEnabled=i}async applyMaterial(e,t,i,s){return new Promise(r=>{const o=this.materialVariantMap.get(e);this.materialVariantMap.set(e,{...o,...t});const a=this.renameClonedAsset(e),h=this.scene.materials.filter(l=>l.name===a);if(h.length===0){r();return}const d=new Se.AssetsManager(this.scene);d.useDefaultLoadingScreen=!1,h.forEach(l=>Ke(t,l,d,s)),d.onProgress=(l,g,m)=>{i&&i(l/g*100,100,m.name)},d.onFinish=l=>{l.forEach(g=>{const m=g;i&&i(100,100,g.name),this.scene.materials.filter(v=>v.name===a).forEach(v=>Qe(g.name,v,t,m.texture))}),r()},d.loadAsync()})}async applyModel(e,t,i,s,r,o,a){var g;if(i&&t&&!this.keysThatRemovedBaseModel.includes(e)&&this.keysThatRemovedBaseModel.push(e),!i)return this.keysThatRemovedBaseModel.includes(e)&&this.keysThatRemovedBaseModel.length===1&&await this.setBaseModelEnabled(!0),(g=this.loadedContainerForKey.get(e))==null||g.dispose(),this.loadedContainerForKey.delete(e),this.loadedMaterialsForKey.delete(e),this.keysThatRemovedBaseModel=this.keysThatRemovedBaseModel.filter(m=>m!==e),Promise.resolve(void 0);const d=(await U(i,this.scene,s)).instantiateModelsToScene(this.renameClonedAsset,!0);if(this.loadedContainerForKey.has(e)&&(this.loadedContainerForKey.get(e).dispose(),this.loadedContainerForKey.delete(e),this.loadedMaterialsForKey.delete(e)),r){const m=o&&o(),f=r.name?this.renameClonedAsset(r.name):void 0;if(Z(d.animationGroups,r.loop,r.to,r.from,f),m!=null){const v=a&&a()||!0;Ge(d.animationGroups,m+(v?2:0),f)}}t&&await this.setBaseModelEnabled(!1),this.loadedContainerForKey.set(e,d),this.loadedMaterialsForKey.set(e,X(d));const l=[];return this.materialVariantMap.forEach(async(m,f)=>{l.push(this.applyMaterial(f,m))}),await Promise.all(l),d}dispose(){this.loadedContainerForKey.forEach(e=>e==null?void 0:e.dispose()),this.loadedContainerForKey.clear(),this.loadedMaterialsForKey.forEach(e=>e.forEach(t=>t==null?void 0:t.dispose())),this.loadedMaterialsForKey.clear(),this.materialVariantMap.clear(),this.keysThatRemovedBaseModel=[]}getAllMaterials(){const e=[];return this.loadedMaterialsForKey.forEach(t=>{t.forEach(i=>{e.includes(i)||e.push(i)})}),e}getAnimationGroups(){const e=[];return this.loadedContainerForKey.forEach(t=>{e.push(...t.animationGroups)}),e}}function X(n){const e=[];return n.rootNodes.forEach(t=>{t.getChildMeshes().forEach(i=>{i.material&&!e.includes(i.material)&&e.push(i.material),i.subMeshes&&i.subMeshes.forEach(s=>{const r=s.getMaterial(!1);r&&!e.includes(r)&&e.push(r)})})}),e}function _(n,e=""){return n.map(t=>({name:t.name.substring(e.length),loop:t.loopAnimation,to:t.to,from:t.from}))}class $e{constructor(e){this.metadata=new Map,this.materialSelectedObservable=new M.Observable,this.materialDeselectedObservable=new M.Observable,this.materialVariantObservable=new M.Observable,this.modelVariantObservable=new M.Observable,this.materialReadyToLoadCallbacks=new Map,this.modelReadyToLoadCallbacks=new Map,this.dynamicTextures=new Map,this.queuedMaterialChanges=new Map,this.materialChangesInProgress=[],this.queuedModelChanges=new Map,this.modelChangesInProgress=[],this.isExecutingAnimation=!1,this.animations=[],this.initialized=!1,this.materials=[];const{enablePicking:t,modelDetails:i,previewService:s,progressHandler:r,scene:o}=e;this.enablePicking=t,this.contextService=i.contextService,this.id=ke(),this.previewService=s,this.scene=o,this.variantManager=new Ze(o,this.renameClonedAsset.bind(this),this.setBaseModelEnabled.bind(this)),this.transformRoot=new Le.TransformNode("root",this.scene);const a=async()=>{if(!i.model)throw new Error("Model container constructed with no URL. This is currently unsupported.");return this.assetContainer=await U(i.model,o,r),await this.instantiate(),this};this.importPromise=a()}async applyMaterialVariant(e,t,i,s){if(!this.initialized){if(this.materialReadyToLoadCallbacks.has(e)){const o=this.materialReadyToLoadCallbacks.get(e);o==null||o.set(t,this.applyMaterialVariant.bind(this,e,t,i,s))}else{this.materialReadyToLoadCallbacks.set(e,new Map);const o=this.materialReadyToLoadCallbacks.get(e);o==null||o.set(t,this.applyMaterialVariant.bind(this,e,t,i,s))}return}const r=async()=>{await this.variantManager.applyMaterial(e,i,(o,a,h)=>{this.materialVariantObservable.notifyObservers({remainingCount:o,totalCount:a,taskName:h})},s)};if(this.materialChangesInProgress.includes(e)){if(this.queuedMaterialChanges.has(e)){const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,r)}else{this.queuedMaterialChanges.set(e,new Map);const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,r)}return}if(this.materialChangesInProgress.push(e),await r(),this.queuedMaterialChanges.has(e)){const o=this.queuedMaterialChanges.get(e);if(!o)throw new Error("Target material is undefined");o.forEach(async a=>{await a()}),this.queuedMaterialChanges.delete(e)}this.materialChangesInProgress.splice(this.materialChangesInProgress.indexOf(e),1),this.configureGlowLayer()}async applyModelVariant(e,t,i){if(!this.initialized){this.modelReadyToLoadCallbacks.set(e,this.applyModelVariant.bind(this,e,t,i));return}const s=()=>this.variantManager.applyModel(e,i,t==null?void 0:t.model,a=>{this.modelVariantObservable.notifyObservers({...a,key:e})},this.lastPlayedAnimation,this.getCurrentAnimationFrame.bind(this),this.getAnimationIsPlaying.bind(this));if(this.modelChangesInProgress.includes(e)){this.queuedModelChanges.set(e,s);return}const o=await(async()=>{this.modelChangesInProgress.push(e);let a=await s();if(this.queuedModelChanges.has(e)){const h=this.queuedModelChanges.get(e);if(!h)throw new Error("Queued change resolved undefined");a=await h(),this.queuedModelChanges.delete(e)}return this.modelChangesInProgress.splice(this.modelChangesInProgress.indexOf(e),1),a})();this.contextService||(this.contextService=t==null?void 0:t.contextService),o?this.configureModelInstance(o):this.configureGlowLayer()}dispose(){var e;this.destroyInstance(),this.variantManager.dispose(),this.dynamicTextures.forEach(t=>t==null?void 0:t.dispose()),this.dynamicTextures.clear(),this.materials.forEach(t=>t&&(t==null?void 0:t.dispose())),this.materials=[],(e=this.transformRoot)==null||e.dispose(),this.transformRoot=void 0,this.previewService.modelUnloaded(this)}executeAnimation(e){if(!this.initialized)return this.queuedModelAnimation=e,Promise.resolve();let t=()=>{};const i=async()=>{this.lastPlayedAnimation=e,this.isExecutingAnimation=!0,await new Promise(s=>{var o;const r=[...((o=this.modelInstance)==null?void 0:o.animationGroups)||[],...this.variantManager.getAnimationGroups()];Z(r,e.loop,e.to,e.from,e.name?this.renameClonedAsset(e.name):void 0,s)}),this.isExecutingAnimation=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,t()};return this.isExecutingAnimation?(this.queuedAnimationFunction=i,new Promise(s=>{t=s})):i()}getAnimations(e){return[...this.animations,...e?_(this.variantManager.getAnimationGroups(),this.renameClonedAsset("")):[]]}getId(){return this.id}listMaterials(){var t;const e=(t=this.scene)==null?void 0:t.materials.filter(i=>i.name.startsWith(this.id));return e?e.map(i=>({id:i.id,name:this.stripIdFromName(i.name)})):[]}registerMaterialSelectedCallback(e){this.materialSelectedObservable.add(e)}unregisterMaterialSelectedCallback(e){this.materialSelectedObservable.removeCallback(e)}registerMaterialDeselectedCallback(e){this.materialDeselectedObservable.add(e)}unregisterMaterialDeselectedCallback(e){this.materialDeselectedObservable.removeCallback(e)}get position(){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to requesting position!");return this.transformRoot.position}set position(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting position!");this.transformRoot.position=new p.Vector3(e.x,e.y,e.z)}get rotation(){var e;if(!((e=this.transformRoot)!=null&&e.rotationQuaternion))throw new Error("ModelContainer disposed prior to requesting rotation!");return this.transformRoot.rotationQuaternion.toEulerAngles()}set rotation(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting rotation!");this.transformRoot.rotationQuaternion=p.Quaternion.FromEulerAngles(e.x,e.y,e.z)}get scale(){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to requesting scale!");return this.transformRoot.scaling}set scale(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting scale!");this.transformRoot.scaling=new p.Vector3(e.x,e.y,e.z)}attachPickingHandler(e){e.rootNodes.forEach(t=>{t.getChildMeshes(!1).forEach(i=>{i.name==="targetcube_t"||i.name==="backgroundShell"||(i.actionManager||(i.actionManager=new F.ActionManager(this.scene)),i.actionManager.registerAction(new k.ExecuteCodeAction(F.ActionManager.OnPointerOverTrigger,s=>{s.meshUnderPointer&&i.material&&this.materialSelectedObservable.notifyObservers({id:i.material.id,name:this.stripIdFromName(i.material.name)})})),i.actionManager.registerAction(new k.ExecuteCodeAction(F.ActionManager.OnPointerOutTrigger,()=>{i.material&&this.materialDeselectedObservable.notifyObservers({id:i.material.id,name:this.stripIdFromName(i.material.name)})})))})})}getInitializationPromise(){return this.importPromise}getIsInitialized(){return this.initialized}getQueuedMaterialVariantCount(){return this.materialReadyToLoadCallbacks.size}getQueuedModelVariantCount(){return this.modelReadyToLoadCallbacks.size}configureGlowLayer(){const e=i=>i instanceof O.PBRMaterial&&i.emissiveTexture!==null;this.materials.some(e)||this.variantManager.getAllMaterials().some(e)?this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()):this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes())}configureModelInstance(e){var r;if(!this.transformRoot)throw new Error("Transform disposed! This should never happen unless there is a race condition present!");const t=this.transformRoot.position,i=this.transformRoot.rotationQuaternion,s=this.transformRoot.scaling;this.transformRoot.position=p.Vector3.Zero(),this.transformRoot.rotationQuaternion=p.Quaternion.Identity(),this.transformRoot.scaling=p.Vector3.One();for(const o of e.rootNodes)o.parent=this.transformRoot;this.transformRoot.position=t,this.transformRoot.rotationQuaternion=i,this.transformRoot.scaling=s,this.canvasPanels=((r=this.contextService)==null?void 0:r.getAll())||new Map,De(this.materials.concat(this.variantManager.getAllMaterials()),this.scene,this.canvasPanels,this.dynamicTextures,`${this.id}_`),this.enablePicking&&this.attachPickingHandler(e),this.configureGlowLayer()}destroyInstance(){var e;(e=this.modelInstance)==null||e.dispose(),this.modelInstance=void 0}getAllMeshes(){var e;return(e=this.modelInstance)==null?void 0:e.rootNodes.map(t=>t.getChildMeshes(!1).filter(i=>i instanceof Ee.Mesh)).flat()}async instantiate(){if(!this.assetContainer)throw new Error("Attempted to instantiate ModelContainer without an AssetContainer");this.modelInstance=this.assetContainer.instantiateModelsToScene(this.renameClonedAsset.bind(this),!0),this.materials=X(this.modelInstance),this.configureModelInstance(this.modelInstance),this.animations=_(this.modelInstance.animationGroups,this.renameClonedAsset("")),this.initialized=!0,await this.processQueuedEvents()}renameClonedAsset(e){return`${this.id}_${e}`}async setBaseModelEnabled(e){e&&!this.modelInstance?await this.instantiate():!e&&this.modelInstance&&this.destroyInstance()}updateDynamicTextures(){var e;(e=this.canvasPanels)==null||e.forEach((t,i)=>{const s=this.dynamicTextures.get(i);s&&t.getStaticContextDirty()&&s.isReady()&&(s.update(!1),t.setStaticContextDirty(!1))})}registerMaterialVariantListener(e){this.materialVariantObservable.add(e)}unregisterMaterialVariantListener(e){this.materialVariantObservable.removeCallback(e)}registerModelVariantListener(e){this.modelVariantObservable.add(e)}unregisterModelVariantListener(e){this.modelVariantObservable.removeCallback(e)}getCurrentAnimationFrame(){var t;const e=[...((t=this.modelInstance)==null?void 0:t.animationGroups)||[],...this.variantManager.getAnimationGroups()];for(const i of e)if(i.animatables.length>0&&i.animatables[0].masterFrame!==void 0&&i.animatables[0].masterFrame!==null)return i.animatables[0].masterFrame;return 0}getAnimationIsPlaying(){var t;const e=[...((t=this.modelInstance)==null?void 0:t.animationGroups)||[],...this.variantManager.getAnimationGroups()];for(const i of e)if(i.isPlaying)return!0;return!1}stripIdFromName(e){return e.substring(this.id.length+1)}async processQueuedEvents(){await Promise.all(Array.from(this.materialReadyToLoadCallbacks.values()).flatMap(e=>Array.from(e.values()).map(t=>t()))),this.materialReadyToLoadCallbacks.clear(),await Promise.all(Array.from(this.modelReadyToLoadCallbacks.values()).map(e=>e())),this.modelReadyToLoadCallbacks.clear(),this.scene.onAfterRenderObservable.addOnce(()=>{this.queuedModelAnimation&&(this.executeAnimation(this.queuedModelAnimation),this.queuedModelAnimation=void 0)})}}class S extends y.ArcRotateCamera{constructor(e,t,i,s,r,o,a,h){super(e,t,i,s,r,o,h),this.lastFocus=new p.Vector3(0,0,0),this._isRunningFramingBehavior=!1,this.panDenominator=1,this.minZ=.01,this.updateRadiusBounds(this.radius),this.enableFramingBehavior(),this.wheelDeltaPercentage=.01,this.pinchDeltaPercentage=.005,this.useNaturalPinchZoom=!0,a.camera.autoOrientation&&(this.alpha+=Math.PI),a&&(a.camera.limits.min.beta&&(this.lowerBetaLimit=a.camera.limits.min.beta),a.camera.limits.max.beta&&(this.upperBetaLimit=a.camera.limits.max.beta),a.camera.limits.min.alpha&&(this.lowerAlphaLimit=a.camera.limits.min.alpha),a.camera.limits.max.alpha&&(this.upperAlphaLimit=a.camera.limits.max.alpha),a.camera.limits.min.radius&&(this.lowerRadiusLimit=a.camera.limits.min.radius),a.camera.limits.max.radius&&(this.upperRadiusLimit=a.camera.limits.max.radius),a.camera.autoRotation.enabled&&this.enableAutoRotationBehavior(a.camera.autoRotation.idleTimeMs))}get isRunningFramingBehavior(){return this._isRunningFramingBehavior}set isRunningFramingBehavior(e){this._isRunningFramingBehavior=e,!e&&this.framingBehaviourCallback&&(this.framingBehaviourCallback(),this.framingBehaviourCallback=void 0)}getFramingBehavior(){return this.getBehaviorByName("Framing")}getAutoRotationBehavior(){const e=this.getBehaviorByName("AutoRotation");if(e)return e}enableFramingBehavior(){this.useFramingBehavior=!0;const e=this.getFramingBehavior();e.attach(this),e.framingTime=0,e.elevationReturnTime=-1,e.zoomStopsAnimation=!1,this.lowerRadiusLimit=null;const t=B(this._scene);return e.zoomOnBoundingInfo(t.min,t.max),this.wheelPrecision=100/this.radius,this.lowerRadiusLimit===null&&(this.lowerRadiusLimit=.1),this.lastFocus.copyFrom(this.target),e}rerunFramingBehavior(e,t){this._isRunningFramingBehavior=!0,this.framingBehaviourCallback=e;const i=this.getFramingBehavior();i.framingTime=t||800;const s=()=>{this.isRunningFramingBehavior=!1},r=B(this._scene),o=r.max.subtract(r.min),a=r.min.add(o.scale(.5));this.updateRadiusBounds(o.length()*1.5),this.wheelPrecision=100/this.radius,this.panningInertia=0,this.panningOriginTarget.copyFrom(a),this.panDenominator=o.length(),this.lastFocus.copyFrom(a),i.zoomOnBoundingInfo(r.min,r.max,void 0,s),i.framingTime=0}enableAutoRotationBehavior(e=5e3){this.useAutoRotationBehavior=!0;const t=this.getAutoRotationBehavior();t&&(t.idleRotationWaitTime=e)}disableAutoRotationBehavior(){this.useAutoRotationBehavior=!1}updateRadiusBounds(e){this.maxZ=e*1e3,this.lowerRadiusLimit=e*.01,this.upperRadiusLimit=1.5*e,this.wheelPrecision=100/e,this.pinchPrecision=300/e}static create(e,t,i){const s=B(e),r=s.max.subtract(s.min),o=s.min.add(r.scale(.5)),a=new S("ProductCamera",-(Math.PI/2),Math.PI/2,r.length()*1.5,o,e,t);return a.panningInertia=0,a.panningOriginTarget.copyFrom(o),a.panDenominator=r.length(),a.onAfterCheckInputsObservable.add(()=>{a.panningSensibility=1e3/a.panDenominator}),i&&(e.activeCamera=a),a}}function B(n){if(n.meshes.length===0)return{min:new p.Vector3(-1,-1,-1),max:new p.Vector3(1,1,1)};const e=n.meshes.filter(t=>t.name.toLowerCase().endsWith("_t")||t.name.toLowerCase().includes("_t_"));return n.getWorldExtends(t=>t.isVisible&&t.isEnabled()&&(e.length===0||e.includes(t)))}class Xe{constructor(e,t=!1,i=void 0){this.renderingPipeline=new Be.DefaultRenderingPipeline("default",t,e,i?[i]:void 0,!1),this.renderingPipeline.isSupported&&(this.renderingPipeline.prepare(),this.setConfiguration(u))}dispose(){this.renderingPipeline.dispose()}getConfiguration(){return this.currentConfiguration}setConfiguration(e){var t,i,s,r,o,a,h,d,l,g,m,f,v,J,ee,te,ie,ne,se,re,ae,oe,le,he,ce,de,ue,ge,me,pe,fe,be,ve;if(this.renderingPipeline.isSupported){if(this.renderingPipeline.samples=((t=e.antiAliasing)==null?void 0:t.samples)??u.antiAliasing.samples,this.renderingPipeline.fxaaEnabled=((i=e.antiAliasing)==null?void 0:i.fxaaEnabled)??u.antiAliasing.fxaaEnabled,this.renderingPipeline.bloomEnabled=((s=e.bloom)==null?void 0:s.enabled)??u.bloom.enabled,this.renderingPipeline.bloomKernel=((r=e.bloom)==null?void 0:r.kernel)??u.bloom.kernel,this.renderingPipeline.bloomScale=((o=e.bloom)==null?void 0:o.scale)??u.bloom.scale,this.renderingPipeline.bloomThreshold=((a=e.bloom)==null?void 0:a.threshold)??u.bloom.threshold,this.renderingPipeline.bloomWeight=((h=e.bloom)==null?void 0:h.weight)??u.bloom.weight,this.renderingPipeline.chromaticAberrationEnabled=((d=e.chromaticAberration)==null?void 0:d.enabled)??u.chromaticAberration.enabled,this.renderingPipeline.chromaticAberration.aberrationAmount=((l=e.chromaticAberration)==null?void 0:l.aberrationAmount)??u.chromaticAberration.aberrationAmount,this.renderingPipeline.chromaticAberration.radialIntensity=((g=e.chromaticAberration)==null?void 0:g.radialIntensity)??u.chromaticAberration.radialIntensity,this.renderingPipeline.chromaticAberration.direction=(m=e.chromaticAberration)!=null&&m.direction?new p.Vector2(e.chromaticAberration.direction.x,e.chromaticAberration.direction.y):new p.Vector2(u.chromaticAberration.direction.x,u.chromaticAberration.direction.y),this.renderingPipeline.imageProcessing.colorCurvesEnabled=((f=e.colorCurves)==null?void 0:f.enabled)??u.colorCurves.enabled,this.renderingPipeline.imageProcessing.colorCurves=e.colorCurves?this.updateColorCurve(e.colorCurves):new N.ColorCurves,this.renderingPipeline.depthOfFieldEnabled=((v=e.depthOfField)==null?void 0:v.enabled)??u.depthOfField.enabled,e.depthOfField)switch(e.depthOfField.blurLevel??u.depthOfField.blurLevel){case"Low":this.renderingPipeline.depthOfFieldBlurLevel=I.DepthOfFieldEffectBlurLevel.Low;break;case"Medium":this.renderingPipeline.depthOfFieldBlurLevel=I.DepthOfFieldEffectBlurLevel.Medium;break;case"High":this.renderingPipeline.depthOfFieldBlurLevel=I.DepthOfFieldEffectBlurLevel.High;break}if(this.renderingPipeline.depthOfField.focalLength=((J=e.depthOfField)==null?void 0:J.focalLength)??u.depthOfField.focalLength,this.renderingPipeline.depthOfField.fStop=((ee=e.depthOfField)==null?void 0:ee.fStop)??u.depthOfField.fStop,this.renderingPipeline.depthOfField.focusDistance=((te=e.depthOfField)==null?void 0:te.focusDistance)??u.depthOfField.focusDistance,this.renderingPipeline.depthOfField.lensSize=((ie=e.depthOfField)==null?void 0:ie.lensSize)??u.depthOfField.lensSize,this.renderingPipeline.grainEnabled=((ne=e.grain)==null?void 0:ne.enabled)??u.grain.enabled,this.renderingPipeline.grain.animated=((se=e.grain)==null?void 0:se.animated)??u.grain.animated,this.renderingPipeline.grain.intensity=((re=e.grain)==null?void 0:re.intensity)??u.grain.intensity,this.renderingPipeline.imageProcessing.contrast=((ae=e.misc)==null?void 0:ae.contrast)??u.misc.contrast,this.renderingPipeline.imageProcessing.exposure=((oe=e.misc)==null?void 0:oe.exposure)??u.misc.exposure,this.renderingPipeline.imageProcessing.toneMappingEnabled=((le=e.misc)==null?void 0:le.toneMappingEnabled)??u.misc.toneMappingEnabled,this.renderingPipeline.imageProcessing.toneMappingEnabled)switch(e.misc.toneMappingType??u.misc.toneMappingType){case"Standard":this.renderingPipeline.imageProcessing.toneMappingType=A.ImageProcessingConfiguration.TONEMAPPING_STANDARD;break;case"ACES":this.renderingPipeline.imageProcessing.toneMappingType=A.ImageProcessingConfiguration.TONEMAPPING_ACES;break}if(this.renderingPipeline.sharpenEnabled=((he=e.sharpen)==null?void 0:he.enabled)??u.sharpen.enabled,this.renderingPipeline.sharpen.colorAmount=((ce=e.sharpen)==null?void 0:ce.colorAmount)??u.sharpen.colorAmount,this.renderingPipeline.sharpen.edgeAmount=((de=e.sharpen)==null?void 0:de.edgeAmount)??u.sharpen.edgeAmount,this.renderingPipeline.imageProcessing.vignetteEnabled=((ue=e.vignette)==null?void 0:ue.enabled)??u.vignette.enabled,(ge=e.vignette)!=null&&ge.center?(this.renderingPipeline.imageProcessing.vignetteCenterX=e.vignette.center.x,this.renderingPipeline.imageProcessing.vignetteCenterY=e.vignette.center.y):(this.renderingPipeline.imageProcessing.vignetteCenterX=u.vignette.center.x,this.renderingPipeline.imageProcessing.vignetteCenterY=u.vignette.center.y),e.vignette)switch(((me=e.vignette)==null?void 0:me.blendMode)??u.vignette.blendMode){case"Multiply":this.renderingPipeline.imageProcessing.vignetteBlendMode=A.ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;break;case"Opaque":this.renderingPipeline.imageProcessing.vignetteBlendMode=A.ImageProcessingConfiguration.VIGNETTEMODE_OPAQUE;break}(pe=e.vignette)!=null&&pe.colorRgba?this.renderingPipeline.imageProcessing.vignetteColor=new b.Color4(e.vignette.colorRgba.r,e.vignette.colorRgba.g,e.vignette.colorRgba.b,e.vignette.colorRgba.a):(fe=e.vignette)!=null&&fe.colorHex?this.renderingPipeline.imageProcessing.vignetteColor=b.Color4.FromHexString(e.vignette.colorHex):this.renderingPipeline.imageProcessing.vignetteColor=new b.Color4(u.vignette.colorRgba.r,u.vignette.colorRgba.g,u.vignette.colorRgba.b,u.vignette.colorRgba.a),this.renderingPipeline.imageProcessing.vignetteStretch=((be=e.vignette)==null?void 0:be.stretch)??u.vignette.stretch,this.renderingPipeline.imageProcessing.vignetteWeight=((ve=e.vignette)==null?void 0:ve.weight)??u.vignette.weight,this.renderingPipeline.prepare(),this.currentConfiguration=e}}updateColorCurve(e){const t=new N.ColorCurves;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}}Pe.GLTF2.GLTFLoader.RegisterExtension("glbPostProcessor",function(n){return new je(n)}),L.SceneLoader.OnPluginActivatedObservable.add(n=>{if(n.name==="gltf"){const e=n;e.transparencyAsCoverage=!0}});function j(n){return new p.Vector3(n.x,n.y,n.z)}function q(n){return{x:n.x,y:n.y,z:n.z}}class _e{constructor(e){var h;this.focusLostNotified=!1,this.focusLostObservable=new M.Observable,this.modelLoadEventCallbacks=[],this.modelContainers=new Map,this.plugins=[],this.initComplete=!1,this.isAnimatingCamera=!1,this.renderLoop=()=>{if(!this.engine.views)return;this.modelContainers.forEach(l=>{l.updateDynamicTextures()}),this.scene.render(),this.camera.isRunningFramingBehavior&&this.camera.getFramingBehavior().isUserIsMoving&&(this.camera.isRunningFramingBehavior=!1);const d=Math.max((this.camera.lowerRadiusLimit??1)*.01,.001);!this.camera.isRunningFramingBehavior&&!this.camera.target.equalsWithEpsilon(this.camera.lastFocus,d)&&!this.focusLostNotified&&(this.focusLostObservable.notifyObservers(void 0),this.focusLostNotified=!0),this.screenshotPrepareResolve&&(this.screenshotPrepareResolve(),this.screenshotPrepareResolve=void 0)},this.configuration=new G(e);const i=(()=>{if(!(e!=null&&e.noRender))return this.configuration.createCanvas()})(),s="1.5.6";we.DracoCompression.Configuration={decoder:{wasmUrl:`https://www.gstatic.com/draco/versioned/decoders/${s}/draco_wasm_wrapper_gltf.js`,wasmBinaryUrl:`https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.wasm`,fallbackUrl:`https://www.gstatic.com/draco/versioned/decoders/${s}/draco_decoder_gltf.js`}},i&&(i.getContext("webgl2")||i.getContext("webgl"));const r=console.log;console.log=()=>{};const o=i?new D.Engine(i,!0,{adaptToDeviceRatio:!0,limitDeviceRatio:2,premultipliedAlpha:!1,preserveDrawingBuffer:!!(e!=null&&e.backgroundImage),audioEngine:!1,stencil:this.configuration.highlights.enabled,forceSRGBBufferSupportState:!0}):new ye.NullEngine;console.log=r,o.hideLoadingUI(),window.addEventListener("resize",this.fireResizeEvent.bind(this)),this.engine=o,this.scene=new xe.Scene(o),this.scene.autoClear=!0,this.scene.autoClearDepthAndStencil=!0,this.camera=S.create(this.scene,this.configuration),this.scene.activeCamera=this.camera,this.renderingPipeline=new Xe(this.scene,!1,this.camera),this.scene.clearColor=this.configuration.scene.clearColor;const a=V.CubeTexture.CreateFromPrefilteredData(this.configuration.scene.environment.file,this.scene);a.rotationY=this.configuration.scene.environment.rotationY,this.scene.environmentTexture=a,this.scene.environmentIntensity=this.configuration.scene.environment.intensity,(h=this.configuration.options)!=null&&h.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 qe(this.scene,this.configuration.emissiveGlowIntensity),this.initPromise=new Promise(d=>{this.scene.onReadyObservable.addOnce(()=>{this.initComplete=!0,d()})}),this.engine.runRenderLoop(this.renderLoop)}getInitializationPromise(){return this.initPromise}getInitializationComplete(){return this.initComplete}getEngineContext(){return{engine:this.engine,scene:this.scene,camera:this.camera}}registerFocusLostListener(e){this.focusLostObservable.add(e)}unregisterFocusLostListener(e){this.focusLostObservable.removeCallback(e)}registerModelLoadEventListener(e){this.modelLoadEventCallbacks.push(e)}unregisterModelLoadEventListener(e){const t=this.modelLoadEventCallbacks.indexOf(e);t>-1&&this.modelLoadEventCallbacks.splice(t,1)}registerView(e){const t=e.height,i=e.width;this.engine.registerView(e,void 0,!0),e.setAttribute("height",t.toString()),e.setAttribute("width",i.toString()),this.orbitEnabled()||this.setCameraState(T.Pan),this.reattachControls(e)}getNumViewports(){var e;return((e=this.engine.views)==null?void 0:e.length)||0}unregisterView(e){this.engine.unRegisterView(e)}shutdown(){this.plugins.forEach(e=>e.dispose(!0)),this.renderingPipeline.dispose(),this.engine&&this.engine.dispose(),window.removeEventListener("resize",this.fireResizeEvent)}executeCameraAnimation(e){if(!this.camera||this.scene.activeCamera!==this.camera||this.getAllModels().length===0||!this.getAllModels().some(s=>s.getIsInitialized()))return this.queuedCameraAnimation=e,Promise.resolve();let t=()=>{};const i=async()=>{this.isAnimatingCamera=!0,await ze(this.scene,this.scene.activeCamera,e),this.isAnimatingCamera=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,t()};return this.isAnimatingCamera?(this.queuedAnimationFunction=i,new Promise(s=>{t=s})):i()}getCameraPose(){if(this.scene&&this.camera)return{lonDeg:Math.round(this.camera.alpha*180/Math.PI),latDeg:Math.round(this.camera.beta*180/Math.PI),radius:Math.round((this.camera.radius+Number.EPSILON)*1e4)/1e4,target:{x:this.camera.target.x,y:this.camera.target.y,z:this.camera.target.z}}}setCameraPose(e){this.scene&&this.camera&&(this.camera.target=new p.Vector3(e.target.x,e.target.y,e.target.z),this.camera.radius=e.radius,this.camera.alpha=e.latDeg,this.camera.beta=e.lonDeg)}setCameraState(e){var t,i;if(!((t=this.engine)!=null&&t.views)||!((i=this.engine)!=null&&i.views[0]))throw new Error("No views attached, camera state requires a view to attach controls onto.");e===T.Orbit?this.reattachControls(this.engine.views[0].target,2):this.reattachControls(this.engine.views[0].target,0)}animateToLastCameraFocus(){let e=()=>{};const t=async()=>{this.isAnimatingCamera=!0,await new Promise(i=>{this.focusLostNotified=!1;const s=()=>{const r=this.configuration;this.camera.rerunFramingBehavior(()=>{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()})};this.scene.onAfterRenderObservable.addOnce(s)}),this.isAnimatingCamera=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,e()};return this.isAnimatingCamera?(this.queuedAnimationFunction=t,new Promise(i=>{e=i})):t()}setAutoRotation(e){!this.configuration.camera.autoRotation.enabled||!this.camera||(e?this.camera.enableAutoRotationBehavior(this.configuration.camera.autoRotation.idleTimeMs):this.camera.disableAutoRotationBehavior())}getCurrentConfiguration(){return this.configuration.options}async renderSceneScreenshot(e,t){if(!this.camera)throw new Error("Missing product camera, cannot render screenshot!");const i=new y.ArcRotateCamera("screenshotCamera",0,0,0,p.Vector3.Zero(),this.scene);try{const s=t.latDeg*Math.PI/180,r=t.lonDeg*Math.PI/180;i.target=t.target?new p.Vector3(t.target.x,t.target.y,t.target.z):p.Vector3.Zero(),i.alpha=r,i.beta=s,i.radius=t.radius||this.camera.radius,i.minZ=.01,this.scene.render();const o=await Me.Tools.CreateScreenshotUsingRenderTargetAsync(this.engine,i,e,"image/png",2,!0);return i.dispose(),o}catch{throw i.isDisposed()||i.dispose(),new Error("Failed to render screenshot")}}orbitEnabled(){const e=this.configuration;if(!e)return!0;const t=e.camera.limits.min.alpha,i=e.camera.limits.max.alpha,s=e.camera.limits.min.beta,r=e.camera.limits.max.beta;if(t===void 0||i===void 0||s===void 0||r===void 0)return!0;const o=[t,i],a=[s,r],h=o.every(l=>l===t),d=a.every(l=>l===s);return!h&&!d}fireResizeEvent(){this.getNumViewports()>0&&this.engine.resize()}setHighlights(e,t){var s;e.length===0&&((s=this.highlightLayer)==null||s.dispose(),this.highlightLayer=void 0),this.highlightLayer||(this.highlightLayer=new Ce.HighlightLayer("highlights",this.scene,{isStroke:!0,blurVerticalSize:.85,blurHorizontalSize:.85}),this.highlightLayer.innerGlow=!0,this.highlightLayer.outerGlow=!1),this.highlightLayer.removeAllMeshes();const i=t?new b.Color3(t[0],t[1],t[2]).toLinearSpace():void 0;e.forEach(r=>{const o=this.scene.materials.find(a=>a.name===r.name&&a.id===r.id);o&&o.getBindedMeshes().forEach(a=>{var h;return(h=this.highlightLayer)==null?void 0:h.addMesh(a,i||b.Color3.FromHexString("#fcba03"))})})}setRenderingPipelineConfiguration(e){this.renderingPipeline&&this.renderingPipeline.setConfiguration(e)}loadModel(e,t){const i=new $e({enablePicking:this.configuration.highlights.enabled,modelDetails:e,scene:this.scene,previewService:this,progressHandler:t});return i.getInitializationPromise().then(()=>{this.modelContainers.size<=1&&this.camera.rerunFramingBehavior(()=>{this.scene.onAfterRenderObservable.addOnce(()=>{this.queuedCameraAnimation&&(this.executeCameraAnimation(this.queuedCameraAnimation),this.queuedCameraAnimation=void 0)})},1)}),this.configuration.highlights.enabled&&(i.registerMaterialSelectedCallback(s=>{this.setHighlights([s])}),i.registerMaterialDeselectedCallback(()=>{this.setHighlights([])})),this.modelContainers.set(i.getId(),i),this.triggerModelLoadEvent({eventType:"load",modelContainer:i}),i}getAllModels(){return Array.from(this.modelContainers.values())}getModelById(e){return this.modelContainers.get(e)}registerPlugin(e){this.plugins.push(e),e.initialize(this,{camera:this.camera,engine:this.engine,scene:this.scene})}unregisterPlugin(e){const t=this.plugins.indexOf(e);t>-1&&this.plugins.splice(t,1).forEach(s=>s.dispose(!1))}getGlowLayerManager(){return this.glowLayerManager}modelUnloaded(e){this.modelContainers.delete(e.getId()),this.triggerModelLoadEvent({eventType:"unload",modelContainer:e})}triggerModelLoadEvent(e){this.modelLoadEventCallbacks.forEach(t=>t(e))}flipTransform(e,t,i){const s=p.Matrix.Compose(j(i||{x:1,y:1,z:1}),p.Quaternion.FromEulerVector(j(t||{x:0,y:0,z:0})),j(e||{x:0,y:0,z:0})),r=p.Matrix.RotationAxis(p.Vector3.Up(),Math.PI),o=s.multiply(r),a=p.Vector3.Zero(),h=p.Quaternion.Identity(),d=p.Vector3.Zero();return o.decompose(d,h,a),h.multiplyInPlace(p.Quaternion.FromEulerAngles(0,Math.PI,0)),{position:q(a),rotation:q(h.toEulerAngles()),scale:q(d)}}updatePreviewOptions(e){var s;const t=new G(e);this.configuration.highlights.enabled!==t.highlights.enabled&&this.engine.setStencilBuffer(t.highlights.enabled),this.scene.clearColor=t.scene.clearColor;let i=this.scene.environmentTexture;this.configuration.scene.environment.file!==t.scene.environment.file&&(i=V.CubeTexture.CreateFromPrefilteredData(t.scene.environment.file,this.scene),i.rotationY=this.configuration.scene.environment.rotationY,this.scene.environmentTexture=i),i.rotationY=t.scene.environment.rotationY,this.scene.environmentIntensity=t.scene.environment.intensity,(s=t.options)!=null&&s.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.configuration=t}reattachControls(e,t=2){if(this.scene.detachControl(),this.engine.inputElement=e,this.camera){this.camera.attachControl(!0,!1,t);const i=this.camera.inputs.attached.pointers;i.multiTouchPanning=!1}this.scene.attachControl(!0,!0,!0)}}c.MaterialEffectMode=R,c.ProductCameraRig=T,c.REFLECTION_PROBE_RESOLUTION=H,c.RenderingConfiguration=w,c.SpiffCommerce3DPreviewService=_e,c.renderingPipelineDefaults=u,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/preview",
3
- "version": "5.3.14-0",
3
+ "version": "5.4.0-alpha.0",
4
4
  "description": "An internal implementation of the ThreeDPreviewService interface used by Spiff Commerce",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.umd.js",
@@ -15,9 +15,9 @@
15
15
  "dev": "ladle serve"
16
16
  },
17
17
  "dependencies": {
18
- "@babylonjs/core": "^6.39.0",
19
- "@babylonjs/loaders": "^6.39.0",
20
- "babylonjs-gltf2interface": "^6.39.0"
18
+ "@babylonjs/core": "^6.36.1",
19
+ "@babylonjs/loaders": "^6.36.1",
20
+ "babylonjs-gltf2interface": "^6.36.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@ladle/react": "^3.2.2",