@spiffcommerce/preview 5.10.3-0 → 5.10.3-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -40,33 +40,33 @@ 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 D = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(D || {}), q = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(q || {});
43
+ var D = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(D || {}), q = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(q || {});
44
44
  function ze() {
45
- const s = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
46
- return s && e && t;
45
+ const n = navigator.vendor.toLowerCase().includes("apple"), e = navigator.maxTouchPoints > 0, t = !navigator.userAgent.toLowerCase().includes("crios");
46
+ return n && e && t;
47
47
  }
48
48
  const ce = /* @__PURE__ */ new Map();
49
- async function z(s, e, t) {
50
- const i = await ce.get(s);
49
+ async function z(n, e, t) {
50
+ const i = await ce.get(n);
51
51
  if (i && i.scene.uid === e.uid)
52
52
  return i;
53
53
  const r = k.LoadAssetContainerAsync(
54
- s,
54
+ n,
55
55
  void 0,
56
56
  e,
57
57
  t
58
58
  );
59
- return !ze() && ce.set(s, r), r;
59
+ return !ze() && ce.set(n, r), r;
60
60
  }
61
- k.OnPluginActivatedObservable.add((s) => {
62
- s.name === "gltf" && (s.animationStartMode = Pe.NONE);
61
+ k.OnPluginActivatedObservable.add((n) => {
62
+ n.name === "gltf" && (n.animationStartMode = Pe.NONE);
63
63
  });
64
64
  class de {
65
65
  constructor(e) {
66
66
  this.getSceneClearColor = () => {
67
- var i, r, n, o;
67
+ var i, r, s, o;
68
68
  const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
69
- if (this.customOptions && ((n = this.customOptions) != null && n.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
69
+ if (this.customOptions && ((s = this.customOptions) != null && s.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
70
70
  return new v(0, 0, 0, t).toLinearSpace();
71
71
  if (this.customOptions && this.customOptions.backgroundColor) {
72
72
  const a = C.FromHexString(
@@ -101,14 +101,14 @@ class de {
101
101
  * Configuration related to the scene
102
102
  */
103
103
  get scene() {
104
- var e, t, i, r, n;
104
+ var e, t, i, r, s;
105
105
  return {
106
106
  clearColor: this.getSceneClearColor(),
107
107
  transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
108
108
  environment: {
109
109
  file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
110
110
  intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
111
- rotationY: (((n = this.customOptions) == null ? void 0 : n.environmentRotationY) ?? 0) * (Math.PI / 180)
111
+ rotationY: (((s = this.customOptions) == null ? void 0 : s.environmentRotationY) ?? 0) * (Math.PI / 180)
112
112
  // Convert to radians
113
113
  }
114
114
  };
@@ -117,7 +117,7 @@ class de {
117
117
  * Configuration related to the camera used to view and interact with the scene.
118
118
  */
119
119
  get camera() {
120
- var e, t, i, r, n, o, a, l, h, c, u, m, f;
120
+ var e, t, i, r, s, o, a, l, h, c, u, m, f;
121
121
  return {
122
122
  autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
123
123
  autoRotation: {
@@ -126,7 +126,7 @@ class de {
126
126
  },
127
127
  limits: {
128
128
  min: {
129
- alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
129
+ alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((s = this.customOptions) == null ? void 0 : s.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
130
130
  beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
131
131
  radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
132
132
  },
@@ -202,7 +202,7 @@ class P {
202
202
  }
203
203
  }
204
204
  }
205
- const Ve = 128, d = {
205
+ const Ge = 128, d = {
206
206
  antiAliasing: {
207
207
  samples: 4,
208
208
  fxaaEnabled: !1
@@ -259,7 +259,7 @@ const Ve = 128, d = {
259
259
  weight: 1
260
260
  }
261
261
  };
262
- class _e {
262
+ class Ve {
263
263
  constructor(e) {
264
264
  this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
265
265
  }
@@ -275,9 +275,9 @@ class _e {
275
275
  e,
276
276
  t,
277
277
  function(r) {
278
- t.extras && Object.keys(t.extras).forEach((n) => {
279
- const o = t.extras[n];
280
- r.metadata[n] = o;
278
+ t.extras && Object.keys(t.extras).forEach((s) => {
279
+ const o = t.extras[s];
280
+ r.metadata[s] = o;
281
281
  }), i(r);
282
282
  }
283
283
  );
@@ -336,16 +336,16 @@ class _e {
336
336
  * @param scene The scene to parse.
337
337
  */
338
338
  applyReflections(e) {
339
- function t(n) {
339
+ function t(s) {
340
340
  const o = [];
341
- return n.transformNodes.forEach((a) => {
341
+ return s.transformNodes.forEach((a) => {
342
342
  a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
343
- }), n.meshes.forEach((a) => {
343
+ }), s.meshes.forEach((a) => {
344
344
  a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
345
345
  }), o;
346
346
  }
347
- function i(n, o = 1) {
348
- const a = n.material;
347
+ function i(s, o = 1) {
348
+ const a = s.material;
349
349
  if (!a)
350
350
  return;
351
351
  const l = new Re(
@@ -355,36 +355,36 @@ class _e {
355
355
  !0
356
356
  );
357
357
  l.renderList = t(e);
358
- const h = n.getVerticesData("normal");
358
+ const h = s.getVerticesData("normal");
359
359
  if (!h)
360
360
  throw new Error(
361
- "Mirror attribute specified on: " + n.name + "But no normals exist to generate a mirror from!"
361
+ "Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
362
362
  );
363
- n.computeWorldMatrix(!0);
364
- const c = n.getWorldMatrix(), u = oe.TransformNormal(
363
+ s.computeWorldMatrix(!0);
364
+ const c = s.getWorldMatrix(), u = oe.TransformNormal(
365
365
  new oe(h[0], h[1], h[2]),
366
366
  c
367
367
  ).normalize(), m = Te.FromPositionAndNormal(
368
- n.position,
368
+ s.position,
369
369
  u.scale(-1)
370
370
  );
371
371
  l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
372
372
  }
373
- function r(n) {
374
- const o = n.material, a = new Oe(
373
+ function r(s) {
374
+ const o = s.material, a = new Oe(
375
375
  "probe-" + o.name,
376
- Ve,
376
+ Ge,
377
377
  e
378
378
  );
379
- a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(n), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
379
+ a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(s), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
380
380
  }
381
- e.meshes.forEach((n) => {
382
- const o = n.metadata;
383
- o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe && r(n));
381
+ e.meshes.forEach((s) => {
382
+ const o = s.metadata;
383
+ o && (o.mirrorTexture && i(s, o.mirrorTexture), o.reflectionProbe && r(s));
384
384
  });
385
385
  }
386
386
  }
387
- class Ge {
387
+ class _e {
388
388
  constructor(e, t) {
389
389
  this.scene = e, this.intensity = t, this.meshCount = 0;
390
390
  }
@@ -406,12 +406,12 @@ class Ge {
406
406
  }
407
407
  }
408
408
  }
409
- function He(s, e, t, i, r = "") {
410
- t.forEach((n) => {
411
- const o = n.getID(), a = n.getName(), l = n.getPanelSize && n.getPanelSize(), h = P.getDynamicTextureResolution(
409
+ function He(n, e, t, i, r = "") {
410
+ t.forEach((s) => {
411
+ const o = s.getID(), a = s.getName(), l = s.getPanelSize && s.getPanelSize(), h = P.getDynamicTextureResolution(
412
412
  (l == null ? void 0 : l.width) === 1 || (l == null ? void 0 : l.height) === 1
413
413
  );
414
- s.filter((u) => u.name === r + a).forEach((u) => {
414
+ n.filter((u) => u.name === r + a).forEach((u) => {
415
415
  const m = i.get(o), f = !1;
416
416
  if (m)
417
417
  ue(u, m), m.update(f);
@@ -422,7 +422,7 @@ function He(s, e, t, i, r = "") {
422
422
  h.width,
423
423
  h.height
424
424
  );
425
- i.set(o, p), n.setStaticContext(
425
+ i.set(o, p), s.setStaticContext(
426
426
  p.getContext()
427
427
  ), ue(u, p), p.onLoadObservable.addOnce(() => {
428
428
  p.update(f);
@@ -431,45 +431,45 @@ function He(s, e, t, i, r = "") {
431
431
  });
432
432
  });
433
433
  }
434
- function Ue(s, e, t, i) {
434
+ function Ue(n, e, t, i) {
435
435
  const r = new Se(
436
- s,
436
+ n,
437
437
  { width: t, height: i },
438
438
  e,
439
439
  P.shouldMipMap(),
440
440
  Be.TRILINEAR_SAMPLINGMODE,
441
441
  B.TEXTUREFORMAT_RGBA
442
- ), n = r.getContext();
443
- return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i), r.update()), r;
442
+ ), s = r.getContext();
443
+ return s && (s.fillStyle = "#f5f5f5", s.fillRect(0, 0, t, i), r.update()), r;
444
444
  }
445
- function ue(s, e) {
446
- if (s instanceof N) {
447
- const t = s, i = t.albedoTexture;
445
+ function ue(n, e) {
446
+ if (n instanceof N) {
447
+ const t = n, i = t.albedoTexture;
448
448
  i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
449
449
  } else {
450
- const t = s, i = t.diffuseTexture;
450
+ const t = n, i = t.diffuseTexture;
451
451
  i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
452
452
  }
453
453
  }
454
454
  function Ke() {
455
- const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
456
- return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
455
+ const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
456
+ return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
457
457
  }
458
458
  const y = 60, me = 1;
459
- function ge(s) {
460
- return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
459
+ function ge(n) {
460
+ return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
461
461
  }
462
- function ve(s, e, t, i, r, n) {
463
- const o = r ? s.filter((c) => c.name === r) : s;
462
+ function ve(n, e, t, i, r, s) {
463
+ const o = r ? n.filter((c) => c.name === r) : n;
464
464
  if (o.length === 0) {
465
465
  console.warn(`No animations found for name: ${r}`);
466
466
  return;
467
467
  }
468
468
  let a = 0;
469
469
  const l = () => {
470
- a++, a === o.length && n && n();
470
+ a++, a === o.length && s && s();
471
471
  }, h = (c, u, m, f, p) => {
472
- c.stop(), c.start(u, m, f, p), n && (u == !1 || u === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
472
+ c.stop(), c.start(u, m, f, p), s && (u == !1 || u === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
473
473
  l();
474
474
  }) : c.onAnimationLoopObservable.addOnce(() => {
475
475
  l();
@@ -487,10 +487,19 @@ function ve(s, e, t, i, r, n) {
487
487
  h(c, e, me, m, f);
488
488
  });
489
489
  }
490
- function We(s, e, t) {
490
+ function We(n) {
491
+ n.forEach((e) => {
492
+ e.reset(), e.stop();
493
+ });
494
+ }
495
+ function Ye(n) {
496
+ const e = n.animationGroups;
497
+ We(e);
498
+ }
499
+ function Qe(n, e, t) {
491
500
  return new Promise((i) => {
492
- s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
493
- const r = [], n = t.target;
501
+ n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ze(e.alpha, 0, 2 * Math.PI));
502
+ const r = [], s = t.target;
494
503
  if (t.target && Object.keys(t.target).length > 0 && r.push(
495
504
  T(
496
505
  "cameraTargetLerp",
@@ -533,10 +542,10 @@ function We(s, e, t) {
533
542
  }
534
543
  e.animations.push(...r);
535
544
  const a = e.useAutoRotationBehavior;
536
- e.disableAutoRotationBehavior(), s.beginAnimation(
545
+ e.disableAutoRotationBehavior(), n.beginAnimation(
537
546
  e,
538
547
  0,
539
- n ? y * 2 : y,
548
+ s ? y * 2 : y,
540
549
  !1,
541
550
  1,
542
551
  () => {
@@ -545,33 +554,33 @@ function We(s, e, t) {
545
554
  );
546
555
  });
547
556
  }
548
- function pe(s) {
549
- return s * Math.PI / 180;
557
+ function pe(n) {
558
+ return n * Math.PI / 180;
550
559
  }
551
- function T(s, e, t, i, r, n = 0, o = A.ANIMATIONLOOPMODE_CONSTANT) {
560
+ function T(n, e, t, i, r, s = 0, o = A.ANIMATIONLOOPMODE_CONSTANT) {
552
561
  const a = new De();
553
562
  a.setEasingMode(qe.EASINGMODE_EASEINOUT);
554
563
  const l = new A(
555
- s,
564
+ n,
556
565
  e,
557
566
  y,
558
567
  r,
559
568
  o
560
569
  ), h = [];
561
- return n > 0 && h.push({ frame: 0, value: t }), h.push({ frame: y * n, value: t }), h.push({
562
- frame: y * (n + 1),
570
+ return s > 0 && h.push({ frame: 0, value: t }), h.push({ frame: y * s, value: t }), h.push({
571
+ frame: y * (s + 1),
563
572
  value: i
564
573
  }), l.setKeys(h), l.setEasingFunction(a), l;
565
574
  }
566
- function Ye(s, e, t) {
567
- return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
575
+ function Ze(n, e, t) {
576
+ return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
568
577
  }
569
- function Qe(s, e, t) {
570
- s.forEach((i) => {
578
+ function $e(n, e, t) {
579
+ n.forEach((i) => {
571
580
  t && i.name !== t || i.goToFrame(e);
572
581
  });
573
582
  }
574
- const Ze = {
583
+ const je = {
575
584
  albedoTexture: "albedoMap",
576
585
  bumpTexture: "normalMap",
577
586
  ambientTexture: "ambientMap",
@@ -581,7 +590,7 @@ const Ze = {
581
590
  refractionTexture: "refractionMap",
582
591
  reflectionTexture: "reflectionMap"
583
592
  };
584
- function $e(s, e, t, i) {
593
+ function Xe(n, e, t, i) {
585
594
  [
586
595
  "albedoTexture",
587
596
  "bumpTexture",
@@ -591,51 +600,51 @@ function $e(s, e, t, i) {
591
600
  "metallicTexture",
592
601
  "refractionTexture",
593
602
  "reflectionTexture"
594
- ].forEach((n) => {
595
- je(
596
- n,
603
+ ].forEach((s) => {
604
+ Je(
597
605
  s,
606
+ n,
598
607
  e,
599
608
  t,
600
609
  i
601
610
  );
602
- }), et(s, e);
611
+ }), it(n, e);
603
612
  }
604
- function je(s, e, t, i, r) {
605
- const n = Ze[s];
606
- if (!n)
613
+ function Je(n, e, t, i, r) {
614
+ const s = je[n];
615
+ if (!s)
607
616
  throw new Error("Unexpected texture name encountered.");
608
- const o = e[n], a = o == null ? void 0 : o.fileLink;
609
- a ? s === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
610
- s,
617
+ const o = e[s], a = o == null ? void 0 : o.fileLink;
618
+ a ? n === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
619
+ n,
611
620
  a,
612
621
  void 0,
613
622
  !1,
614
623
  void 0,
615
624
  !0
616
625
  ) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
617
- s,
626
+ n,
618
627
  a,
619
628
  128,
620
629
  !1,
621
630
  !0,
622
631
  !1
623
- ) : i.addTextureTask(s, a, !1, !1) : i.addTextureTask(s, a, !1, !1) : r && t[s] && (t[s] && t[s].dispose(), t[s] = null, Xe(s, t));
632
+ ) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : r && t[n] && (t[n] && t[n].dispose(), t[n] = null, et(n, t));
624
633
  }
625
- function Xe(s, e) {
626
- s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), s === "reflectionTexture" && (e.environmentIntensity = 1), s === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new C(0, 0, 0), e.reflectionTexture);
634
+ function et(n, e) {
635
+ 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 C(0, 0, 0), e.reflectionTexture);
627
636
  }
628
- function Je(s, e, t, i) {
637
+ function tt(n, e, t, i) {
629
638
  if (!e) {
630
639
  console.error("Failed to apply texture to material: material is null.");
631
640
  return;
632
641
  }
633
- s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), s === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[s] = i, s === "emissiveTexture" && (e.emissiveColor = new C(1, 1, 1), e.emissiveIntensity = 1);
642
+ 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 C(1, 1, 1), e.emissiveIntensity = 1);
634
643
  }
635
- function et(s, e) {
636
- s.clearCoat && (s.clearCoat === q.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === q.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
644
+ function it(n, e) {
645
+ n.clearCoat && (n.clearCoat === q.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === q.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
637
646
  }
638
- class tt {
647
+ class nt {
639
648
  constructor(e, t, i) {
640
649
  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;
641
650
  }
@@ -649,7 +658,7 @@ class tt {
649
658
  * where we want to undo changes are remove effects from display.
650
659
  */
651
660
  async applyMaterial(e, t, i, r) {
652
- return new Promise((n) => {
661
+ return new Promise((s) => {
653
662
  const o = this.materialVariantMap.get(e);
654
663
  this.materialVariantMap.set(e, {
655
664
  ...o,
@@ -659,12 +668,12 @@ class tt {
659
668
  (c) => c.name === a
660
669
  );
661
670
  if (l.length === 0) {
662
- n();
671
+ s();
663
672
  return;
664
673
  }
665
674
  const h = new ke(this.scene);
666
675
  h.useDefaultLoadingScreen = !1, l.forEach(
667
- (c) => $e(
676
+ (c) => Xe(
668
677
  t,
669
678
  c,
670
679
  h,
@@ -678,14 +687,14 @@ class tt {
678
687
  i && i(100, 100, u.name), this.scene.materials.filter(
679
688
  (p) => p.name === a
680
689
  ).forEach((p) => {
681
- Je(
690
+ tt(
682
691
  u.name,
683
692
  p,
684
693
  t,
685
694
  m.texture
686
695
  );
687
696
  });
688
- }), n();
697
+ }), s();
689
698
  }, h.loadAsync();
690
699
  });
691
700
  }
@@ -699,7 +708,7 @@ class tt {
699
708
  * @param getCurrentFrame A function that returns the current frame of the animation.
700
709
  * @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
701
710
  */
702
- async applyModel(e, t, i, r, n, o, a) {
711
+ async applyModel(e, t, i, r, s, o, a) {
703
712
  var m, f, p;
704
713
  if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
705
714
  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), (f = this.loadedMaterialsForKey.get(e)) == null || f.forEach((b) => b.dispose()), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
@@ -710,7 +719,7 @@ class tt {
710
719
  !0
711
720
  );
712
721
  this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), (p = this.loadedMaterialsForKey.get(e)) == null || p.forEach((b) => b.dispose()), this.loadedMaterialsForKey.delete(e));
713
- const c = n && n();
722
+ const c = s && s();
714
723
  if (c) {
715
724
  const b = o && o(), w = c.name ? this.renameClonedAsset(c.name) : void 0;
716
725
  if (ve(
@@ -721,7 +730,7 @@ class tt {
721
730
  w
722
731
  ), b != null) {
723
732
  const R = a && a() || !0;
724
- Qe(
733
+ $e(
725
734
  h.animationGroups,
726
735
  b + (R ? 2 : 0),
727
736
  w
@@ -754,36 +763,36 @@ class tt {
754
763
  }), e;
755
764
  }
756
765
  }
757
- function we(s) {
766
+ function we(n) {
758
767
  const e = [];
759
- return s.rootNodes.forEach((t) => {
768
+ return n.rootNodes.forEach((t) => {
760
769
  t.getChildMeshes().forEach((i) => {
761
770
  i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
762
- const n = r.getMaterial(!1);
763
- n && !e.includes(n) && e.push(n);
771
+ const s = r.getMaterial(!1);
772
+ s && !e.includes(s) && e.push(s);
764
773
  });
765
774
  });
766
775
  }), e;
767
776
  }
768
- function fe(s, e = "") {
769
- return s.map((t) => ({
777
+ function fe(n, e = "") {
778
+ return n.map((t) => ({
770
779
  name: t.name.substring(e.length),
771
780
  loop: t.loopAnimation,
772
781
  to: t.to,
773
782
  from: t.from
774
783
  }));
775
784
  }
776
- class it {
785
+ class st {
777
786
  constructor(e) {
778
787
  this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new M(), this.materialDeselectedObservable = new M(), this.materialVariantObservable = new M(), this.modelVariantObservable = new M(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.isExecutingAnimation = !1, this.animations = [], this.initialized = !1, this.materials = [];
779
788
  const {
780
789
  enablePicking: t,
781
790
  modelDetails: i,
782
791
  previewService: r,
783
- progressHandler: n,
792
+ progressHandler: s,
784
793
  scene: o
785
794
  } = e;
786
- this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new tt(
795
+ this.enablePicking = t, this.contextService = i.contextService, this.id = Ke(), this.previewService = r, this.scene = o, this.variantManager = new nt(
787
796
  o,
788
797
  this.renameClonedAsset.bind(this),
789
798
  this.setBaseModelEnabled.bind(this)
@@ -796,7 +805,7 @@ class it {
796
805
  return this.assetContainer = await z(
797
806
  i.model,
798
807
  o,
799
- n
808
+ s
800
809
  ), await this.instantiate(), this;
801
810
  };
802
811
  this.importPromise = a();
@@ -835,7 +844,7 @@ class it {
835
844
  }
836
845
  return;
837
846
  }
838
- const n = async () => {
847
+ const s = async () => {
839
848
  await this.variantManager.applyMaterial(
840
849
  e,
841
850
  i,
@@ -852,18 +861,18 @@ class it {
852
861
  if (this.materialChangesInProgress.includes(e)) {
853
862
  if (this.queuedMaterialChanges.has(e)) {
854
863
  const o = this.queuedMaterialChanges.get(e);
855
- o == null || o.set(t, n);
864
+ o == null || o.set(t, s);
856
865
  } else {
857
866
  this.queuedMaterialChanges.set(
858
867
  e,
859
868
  /* @__PURE__ */ new Map()
860
869
  );
861
870
  const o = this.queuedMaterialChanges.get(e);
862
- o == null || o.set(t, n);
871
+ o == null || o.set(t, s);
863
872
  }
864
873
  return;
865
874
  }
866
- if (this.materialChangesInProgress.push(e), await n(), this.queuedMaterialChanges.has(e)) {
875
+ if (this.materialChangesInProgress.push(e), await s(), this.queuedMaterialChanges.has(e)) {
867
876
  const o = this.queuedMaterialChanges.get(e);
868
877
  if (!o)
869
878
  throw new Error("Target material is undefined");
@@ -890,7 +899,7 @@ class it {
890
899
  this.getLastRequestedAnimation.bind(this),
891
900
  this.getCurrentAnimationFrame.bind(this),
892
901
  this.getAnimationIsPlaying.bind(this)
893
- ), n = async () => {
902
+ ), s = async () => {
894
903
  this.modelChangesInProgress.push(e);
895
904
  let a = await r();
896
905
  if (this.queuedModelChanges.has(e)) {
@@ -912,7 +921,7 @@ class it {
912
921
  this.queuedModelChanges.set(e, a);
913
922
  return;
914
923
  }
915
- const o = await n();
924
+ const o = await s();
916
925
  this.contextService || (this.contextService = t == null ? void 0 : t.contextService), o ? this.configureModelInstance(o) : this.configureGlowLayer();
917
926
  }
918
927
  dispose() {
@@ -925,7 +934,7 @@ class it {
925
934
  let i = () => {
926
935
  };
927
936
  const r = async () => {
928
- this.isExecutingAnimation = !0, await new Promise((n) => {
937
+ this.isExecutingAnimation = !0, await new Promise((s) => {
929
938
  var a;
930
939
  const o = [
931
940
  ...((a = this.modelInstance) == null ? void 0 : a.animationGroups) || [],
@@ -937,12 +946,12 @@ class it {
937
946
  e.to,
938
947
  e.from,
939
948
  e.name ? this.renameClonedAsset(e.name) : void 0,
940
- n
949
+ s
941
950
  );
942
951
  }), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, i();
943
952
  };
944
- return t ? r() : this.isExecutingAnimation ? (this.queuedAnimationFunction = r, new Promise((n) => {
945
- i = n;
953
+ return t ? (Ye(this.scene), r()) : this.isExecutingAnimation ? (this.queuedAnimationFunction = r, new Promise((s) => {
954
+ i = s;
946
955
  })) : r();
947
956
  }
948
957
  getAnimations(e) {
@@ -952,7 +961,7 @@ class it {
952
961
  this.variantManager.getAnimationGroups(),
953
962
  this.renameClonedAsset("")
954
963
  ) : []
955
- ].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, r) => r.indexOf(r.find((n) => n.name === t.name)) == i);
964
+ ].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, r) => r.indexOf(r.find((s) => s.name === t.name)) == i);
956
965
  }
957
966
  getId() {
958
967
  return this.id;
@@ -1060,7 +1069,7 @@ class it {
1060
1069
  this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
1061
1070
  }
1062
1071
  configureModelInstance(e) {
1063
- var n;
1072
+ var s;
1064
1073
  if (!this.transformRoot)
1065
1074
  throw new Error(
1066
1075
  "Transform disposed! This should never happen unless there is a race condition present!"
@@ -1072,7 +1081,7 @@ class it {
1072
1081
  for (const a of o.getChildMeshes(!1))
1073
1082
  a.alwaysSelectAsActiveMesh = !0;
1074
1083
  }
1075
- this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((n = this.contextService) == null ? void 0 : n.getAll()) || /* @__PURE__ */ new Map(), He(
1084
+ this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((s = this.contextService) == null ? void 0 : s.getAll()) || /* @__PURE__ */ new Map(), He(
1076
1085
  this.materials.concat(this.variantManager.getAllMaterials()),
1077
1086
  this.scene,
1078
1087
  this.canvasPanels,
@@ -1178,14 +1187,14 @@ class it {
1178
1187
  }
1179
1188
  //#endregion
1180
1189
  }
1181
- class V extends be {
1182
- constructor(e, t, i, r, n, o, a, l) {
1190
+ class G extends be {
1191
+ constructor(e, t, i, r, s, o, a, l) {
1183
1192
  super(
1184
1193
  e,
1185
1194
  t,
1186
1195
  i,
1187
1196
  r,
1188
- n,
1197
+ s,
1189
1198
  o,
1190
1199
  l
1191
1200
  ), this.lastFocus = new g(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, 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(
@@ -1243,10 +1252,10 @@ class V extends be {
1243
1252
  i.framingTime = t || 800;
1244
1253
  const r = () => {
1245
1254
  this.isRunningFramingBehavior = !1;
1246
- }, n = I(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
1255
+ }, s = I(this._scene), o = s.max.subtract(s.min), a = s.min.add(o.scale(0.5));
1247
1256
  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(
1248
- n.min,
1249
- n.max,
1257
+ s.min,
1258
+ s.max,
1250
1259
  void 0,
1251
1260
  r
1252
1261
  ), i.framingTime = 0;
@@ -1280,32 +1289,32 @@ class V extends be {
1280
1289
  */
1281
1290
  static create(e, t, i) {
1282
1291
  var l;
1283
- const r = I(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new V(
1292
+ const r = I(e), s = r.max.subtract(r.min), o = r.min.add(s.scale(0.5)), a = new G(
1284
1293
  "ProductCamera",
1285
1294
  -(Math.PI / 2),
1286
1295
  Math.PI / 2,
1287
- n.length() * 1.5,
1296
+ s.length() * 1.5,
1288
1297
  o,
1289
1298
  e,
1290
1299
  t
1291
1300
  );
1292
1301
  return a.setPanEnabled(
1293
1302
  ((l = t.options) == null ? void 0 : l.noPan) !== void 0 ? !t.options.noPan : !0
1294
- ), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
1303
+ ), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = s.length(), a.onAfterCheckInputsObservable.addOnce(() => {
1295
1304
  a.setPanEnabled(a.panEnabled);
1296
1305
  }), i && (e.activeCamera = a), a;
1297
1306
  }
1298
1307
  }
1299
- function I(s) {
1300
- if (s.meshes.length === 0)
1308
+ function I(n) {
1309
+ if (n.meshes.length === 0)
1301
1310
  return {
1302
1311
  min: new g(-1, -1, -1),
1303
1312
  max: new g(1, 1, 1)
1304
1313
  };
1305
- const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
1306
- return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
1314
+ const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
1315
+ return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
1307
1316
  }
1308
- class nt {
1317
+ class rt {
1309
1318
  constructor(e, t = !1, i = void 0) {
1310
1319
  this.renderingPipeline = new Ne(
1311
1320
  "default",
@@ -1323,9 +1332,9 @@ class nt {
1323
1332
  return this.currentConfiguration;
1324
1333
  }
1325
1334
  setConfiguration(e) {
1326
- var t, i, r, n, o, a, l, h, c, u, m, f, p, b, w, R, _, G, H, U, K, W, Y, Q, Z, $, j, X, J, ee, te, ie, ne;
1335
+ var t, i, r, s, o, a, l, h, c, u, m, f, p, b, w, R, V, _, H, U, K, W, Y, Q, Z, $, j, X, J, ee, te, ie, ne;
1327
1336
  if (this.renderingPipeline.isSupported) {
1328
- 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 = ((r = e.bloom) == null ? void 0 : r.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((n = e.bloom) == null ? void 0 : n.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 = ((h = e.chromaticAberration) == null ? void 0 : h.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.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 re(
1337
+ 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 = ((r = e.bloom) == null ? void 0 : r.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((s = e.bloom) == null ? void 0 : s.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 = ((h = e.chromaticAberration) == null ? void 0 : h.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.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 re(
1329
1338
  e.chromaticAberration.direction.x,
1330
1339
  e.chromaticAberration.direction.y
1331
1340
  ) : new re(
@@ -1343,7 +1352,7 @@ class nt {
1343
1352
  this.renderingPipeline.depthOfFieldBlurLevel = L.High;
1344
1353
  break;
1345
1354
  }
1346
- if (this.renderingPipeline.depthOfField.focalLength = ((b = e.depthOfField) == null ? void 0 : b.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((w = e.depthOfField) == null ? void 0 : w.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((R = e.depthOfField) == null ? void 0 : R.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((_ = e.depthOfField) == null ? void 0 : _.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((W = e.misc) == null ? void 0 : W.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((Y = e.misc) == null ? void 0 : Y.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1355
+ if (this.renderingPipeline.depthOfField.focalLength = ((b = e.depthOfField) == null ? void 0 : b.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((w = e.depthOfField) == null ? void 0 : w.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((R = e.depthOfField) == null ? void 0 : R.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((_ = e.grain) == null ? void 0 : _.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((W = e.misc) == null ? void 0 : W.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((Y = e.misc) == null ? void 0 : Y.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1347
1356
  switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
1348
1357
  case "Standard":
1349
1358
  this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
@@ -1379,22 +1388,22 @@ class nt {
1379
1388
  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;
1380
1389
  }
1381
1390
  }
1382
- ye.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
1383
- return new _e(s);
1391
+ ye.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
1392
+ return new Ve(n);
1384
1393
  });
1385
- k.OnPluginActivatedObservable.add((s) => {
1386
- if (s.name === "gltf") {
1387
- const e = s;
1394
+ k.OnPluginActivatedObservable.add((n) => {
1395
+ if (n.name === "gltf") {
1396
+ const e = n;
1388
1397
  e.transparencyAsCoverage = !0;
1389
1398
  }
1390
1399
  });
1391
- function F(s) {
1392
- return new g(s.x, s.y, s.z);
1400
+ function F(n) {
1401
+ return new g(n.x, n.y, n.z);
1393
1402
  }
1394
- function S(s) {
1395
- return { x: s.x, y: s.y, z: s.z };
1403
+ function S(n) {
1404
+ return { x: n.x, y: n.y, z: n.z };
1396
1405
  }
1397
- class Wt {
1406
+ class Qt {
1398
1407
  constructor(e) {
1399
1408
  var l;
1400
1409
  this.focusLostNotified = !1, this.focusLostObservable = new M(), this.modelLoadEventCallbacks = [], this.validHighlightMaterials = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
@@ -1429,7 +1438,7 @@ class Wt {
1429
1438
  fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
1430
1439
  }
1431
1440
  }, i && (i.getContext("webgl2") || i.getContext("webgl"));
1432
- const n = console.log;
1441
+ const s = console.log;
1433
1442
  console.log = () => {
1434
1443
  };
1435
1444
  const o = i ? new B(i, !0, {
@@ -1441,7 +1450,7 @@ class Wt {
1441
1450
  stencil: this.configuration.highlights.enabled,
1442
1451
  forceSRGBBufferSupportState: !0
1443
1452
  }) : new Ce();
1444
- o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new xe(o), this.camera = V.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
1453
+ o.enableOfflineSupport = !1, o.doNotHandleContextLost = !0, console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new xe(o), this.camera = G.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new rt(
1445
1454
  this.scene,
1446
1455
  !1,
1447
1456
  this.camera
@@ -1452,7 +1461,7 @@ class Wt {
1452
1461
  );
1453
1462
  a.name = "initial-environment-cube", 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(
1454
1463
  this.configuration.options.renderingPipelineConfiguration
1455
- ) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new Ge(
1464
+ ) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
1456
1465
  this.scene,
1457
1466
  this.configuration.emissiveGlowIntensity
1458
1467
  ), this.initPromise = new Promise((h) => {
@@ -1507,7 +1516,7 @@ class Wt {
1507
1516
  let t = () => {
1508
1517
  };
1509
1518
  const i = async () => {
1510
- this.isAnimatingCamera = !0, await We(
1519
+ this.isAnimatingCamera = !0, await Qe(
1511
1520
  this.scene,
1512
1521
  this.scene.activeCamera,
1513
1522
  e
@@ -1552,9 +1561,9 @@ class Wt {
1552
1561
  this.isAnimatingCamera = !0, await new Promise((i) => {
1553
1562
  this.focusLostNotified = !1;
1554
1563
  const r = () => {
1555
- const n = this.configuration;
1564
+ const s = this.configuration;
1556
1565
  this.camera.rerunFramingBehavior(() => {
1557
- n.camera.limits.min.radius && (this.camera.lowerRadiusLimit = n.camera.limits.min.radius), n.camera.limits.max.radius && (this.camera.upperRadiusLimit = n.camera.limits.max.radius), i();
1566
+ s.camera.limits.min.radius && (this.camera.lowerRadiusLimit = s.camera.limits.min.radius), s.camera.limits.max.radius && (this.camera.upperRadiusLimit = s.camera.limits.max.radius), i();
1558
1567
  });
1559
1568
  };
1560
1569
  this.scene.onAfterRenderObservable.addOnce(r);
@@ -1586,8 +1595,8 @@ class Wt {
1586
1595
  0,
1587
1596
  g.Zero(),
1588
1597
  this.scene
1589
- ), r = t.latDeg * Math.PI / 180, n = t.lonDeg * Math.PI / 180;
1590
- i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = n, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01;
1598
+ ), r = t.latDeg * Math.PI / 180, s = t.lonDeg * Math.PI / 180;
1599
+ i.target = t.target ? new g(t.target.x, t.target.y, t.target.z) : g.Zero(), i.alpha = s, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01;
1591
1600
  try {
1592
1601
  return await new Promise((o) => {
1593
1602
  const a = this.scene.onBeforeRenderObservable.add(async () => {
@@ -1612,10 +1621,10 @@ class Wt {
1612
1621
  const e = this.configuration;
1613
1622
  if (!e)
1614
1623
  return !0;
1615
- const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, n = e.camera.limits.max.beta;
1616
- if (t === void 0 || i === void 0 || r === void 0 || n === void 0)
1624
+ const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, s = e.camera.limits.max.beta;
1625
+ if (t === void 0 || i === void 0 || r === void 0 || s === void 0)
1617
1626
  return !0;
1618
- const o = [t, i], a = [r, n], l = o.every((c) => c === t), h = a.every((c) => c === r);
1627
+ const o = [t, i], a = [r, s], l = o.every((c) => c === t), h = a.every((c) => c === r);
1619
1628
  return !l && !h;
1620
1629
  }
1621
1630
  fireResizeEvent() {
@@ -1630,7 +1639,7 @@ class Wt {
1630
1639
  (i) => this.validHighlightMaterials.includes(i.name)
1631
1640
  ).forEach((i) => {
1632
1641
  const r = this.scene.materials.find(
1633
- (n) => n.id === i.id
1642
+ (s) => s.id === i.id
1634
1643
  );
1635
1644
  r && (r.emissiveColor = new C(
1636
1645
  this.configuration.highlights.color.r,
@@ -1643,14 +1652,14 @@ class Wt {
1643
1652
  this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
1644
1653
  }
1645
1654
  loadModel(e, t) {
1646
- const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new it({
1655
+ const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, s = new st({
1647
1656
  enablePicking: this.configuration.highlights.enabled,
1648
1657
  modelDetails: e,
1649
1658
  scene: this.scene,
1650
1659
  previewService: this,
1651
1660
  progressHandler: r
1652
1661
  });
1653
- return n.getInitializationPromise().then(() => {
1662
+ return s.getInitializationPromise().then(() => {
1654
1663
  if (this.modelContainers.size <= 1 && i) {
1655
1664
  const o = this.queuedCameraAnimation;
1656
1665
  this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
@@ -1659,14 +1668,14 @@ class Wt {
1659
1668
  });
1660
1669
  }, 1);
1661
1670
  }
1662
- }), this.configuration.highlights.enabled && (n.registerMaterialSelectedCallback((o) => {
1671
+ }), this.configuration.highlights.enabled && (s.registerMaterialSelectedCallback((o) => {
1663
1672
  this.setHighlights([o]);
1664
- }), n.registerMaterialDeselectedCallback(() => {
1673
+ }), s.registerMaterialDeselectedCallback(() => {
1665
1674
  this.setHighlights([]);
1666
- })), this.modelContainers.set(n.getId(), n), this.triggerModelLoadEvent({
1675
+ })), this.modelContainers.set(s.getId(), s), this.triggerModelLoadEvent({
1667
1676
  eventType: "load",
1668
- modelContainer: n
1669
- }), n;
1677
+ modelContainer: s
1678
+ }), s;
1670
1679
  }
1671
1680
  async preloadModel(e) {
1672
1681
  await z(e, this.scene);
@@ -1710,7 +1719,7 @@ class Wt {
1710
1719
  F(t || { x: 0, y: 0, z: 0 })
1711
1720
  ),
1712
1721
  F(e || { x: 0, y: 0, z: 0 })
1713
- ), n = ae.RotationAxis(g.Up(), Math.PI), o = r.multiply(n), a = g.Zero(), l = x.Identity(), h = g.Zero();
1722
+ ), s = ae.RotationAxis(g.Up(), Math.PI), o = r.multiply(s), a = g.Zero(), l = x.Identity(), h = g.Zero();
1714
1723
  return o.decompose(h, l, a), l.multiplyInPlace(x.FromEulerAngles(0, Math.PI, 0)), {
1715
1724
  position: S(a),
1716
1725
  rotation: S(l.toEulerAngles()),
@@ -1718,7 +1727,7 @@ class Wt {
1718
1727
  };
1719
1728
  }
1720
1729
  updatePreviewOptions(e) {
1721
- var r, n;
1730
+ var r, s;
1722
1731
  const t = new de(e);
1723
1732
  this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
1724
1733
  let i = this.scene.environmentTexture;
@@ -1728,7 +1737,7 @@ class Wt {
1728
1737
  ), i.name = "updated-environment-cube", i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (r = t.options) != null && r.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1729
1738
  t.options.renderingPipelineConfiguration
1730
1739
  ) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.updateConfiguration(t), this.camera.setPanEnabled(
1731
- ((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
1740
+ ((s = t.options) == null ? void 0 : s.noPan) !== void 0 ? !t.options.noPan : !0
1732
1741
  ), this.configuration = t;
1733
1742
  }
1734
1743
  setHighlightMaterials(e) {
@@ -1754,8 +1763,8 @@ class Wt {
1754
1763
  export {
1755
1764
  q as MaterialEffectMode,
1756
1765
  D as ProductCameraRig,
1757
- Ve as REFLECTION_PROBE_RESOLUTION,
1766
+ Ge as REFLECTION_PROBE_RESOLUTION,
1758
1767
  P as RenderingConfiguration,
1759
- Wt as SpiffCommerce3DPreviewService,
1768
+ Qt as SpiffCommerce3DPreviewService,
1760
1769
  d as renderingPipelineDefaults
1761
1770
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(d,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@babylonjs/core/Cameras/arcRotateCamera"),require("@babylonjs/core/Engines/engine"),require("@babylonjs/core/Engines/nullEngine"),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/loaders/glTF/glTFFileLoader"),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/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/Culling/ray"),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/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/loaders/glTF/glTFFileLoader","@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/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/Culling/ray","@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"],w):(d=typeof globalThis<"u"?globalThis:d||self,w(d.Preview={},d.arcRotateCamera,d.engine,d.nullEngine,d.sceneLoader,d.cubeTexture,d.math_color,d.math_vector,d.dracoCompression,d.observable,d.tools,d.scene,d.glTF,d.glTFFileLoader,d.pbrMaterial,d.mirrorTexture,d.math,d.reflectionProbe,d.glowLayer,d.actionManager,d.directActions,d.mesh,d.transformNode,d.dynamicTexture,d.texture,d.animation,d.easing,d.assetsManager,d.colorCurves,d.imageProcessingConfiguration,d.RenderPipeline,d.depthOfFieldEffect))})(this,function(d,w,I,Ce,S,G,v,p,ye,A,we,Me,xe,Ae,B,Pe,T,Te,Re,q,H,Ee,Oe,Le,Fe,M,U,Ie,K,R,Se,j){"use strict";var E=(s=>(s[s.Orbit=0]="Orbit",s[s.Pan=1]="Pan",s))(E||{}),O=(s=>(s.None="None",s.RemoveWhenSelected="RemoveWhenSelected",s.ApplyWhenSelected="ApplyWhenSelected",s))(O||{});function Be(){const s=navigator.vendor.toLowerCase().includes("apple"),e=navigator.maxTouchPoints>0,t=!navigator.userAgent.toLowerCase().includes("crios");return s&&e&&t}const W=new Map;async function D(s,e,t){const i=await W.get(s);if(i&&i.scene.uid===e.uid)return i;const r=S.SceneLoader.LoadAssetContainerAsync(s,void 0,e,t);return!Be()&&W.set(s,r),r}S.SceneLoader.OnPluginActivatedObservable.add(s=>{s.name==="gltf"&&(s.animationStartMode=Ae.GLTFLoaderAnimationStartMode.NONE)});class Q{constructor(e){this.getSceneClearColor=()=>{var i,r,n,o;const t=(i=this.customOptions)!=null&&i.transparentBackground||(r=this.customOptions)!=null&&r.backgroundImage?0:1;if(this.customOptions&&((n=this.customOptions)!=null&&n.transparentBackground)||(o=this.customOptions)!=null&&o.backgroundImage)return new v.Color4(0,0,0,t).toLinearSpace();if(this.customOptions&&this.customOptions.backgroundColor){const a=v.Color3.FromHexString(this.customOptions.backgroundColor);return new v.Color4(a.r,a.g,a.b,t).toLinearSpace()}return new v.Color4(.98,.98,.98,t).toLinearSpace()},this.highlightColorFromConfig=()=>this.customOptions&&this.customOptions.highlightColor?this.hexToColor4(this.customOptions.highlightColor):v.Color4.FromColor3(v.Color3.Gray()),this.hexToColor4=(t,i=1)=>{const r=v.Color3.FromHexString(t);return new v.Color4(r.r,r.g,r.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,r,n;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:((r=this.customOptions)==null?void 0:r.environmentIntensity)??1,rotationY:(((n=this.customOptions)==null?void 0:n.environmentRotationY)??0)*(Math.PI/180)}}}get camera(){var e,t,i,r,n,o,a,l,h,c,g,m,b;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:(r=this.customOptions)!=null&&r.lowerAlphaLimitDeg?((n=this.customOptions)==null?void 0:n.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:(h=this.customOptions)!=null&&h.upperAlphaLimitDeg?((c=this.customOptions)==null?void 0:c.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:(b=this.customOptions)==null?void 0:b.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,r;return{exposure:((t=(e=this.customOptions)==null?void 0:e.lighting)==null?void 0:t.exposure)??.9,contrast:((r=(i=this.customOptions)==null?void 0:i.lighting)==null?void 0:r.contrast)??1.6}}get emissiveGlowIntensity(){var e;return((e=this.customOptions)==null?void 0:e.emissiveGlowIntensity)??.5}}class x{static getDynamicTextureResolution(e=!1){return e?{width:1,height:1}:this.getIsMobile()||!x.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 Y=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 qe{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(r){t.extras&&Object.keys(t.extras).forEach(n=>{const o=t.extras[n];r.metadata[n]=o}),i(r)})}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 B.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 T.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(n){const o=[];return n.transformNodes.forEach(a=>{a.metadata&&a.metadata.reflective&&o.push(...a.getChildMeshes())}),n.meshes.forEach(a=>{a.metadata&&a.metadata.reflective&&!o.includes(a)&&o.push(a)}),o}function i(n,o=1){const a=n.material;if(!a)return;const l=new Pe.MirrorTexture("mirror",x.getMirrorTextureResolution(),e,!0);l.renderList=t(e);const h=n.getVerticesData("normal");if(!h)throw new Error("Mirror attribute specified on: "+n.name+"But no normals exist to generate a mirror from!");n.computeWorldMatrix(!0);const c=n.getWorldMatrix(),g=T.Vector3.TransformNormal(new T.Vector3(h[0],h[1],h[2]),c).normalize(),m=T.Plane.FromPositionAndNormal(n.position,g.scale(-1));l.mirrorPlane=m,l.level=o,a.reflectionTexture=l}function r(n){const o=n.material,a=new Te.ReflectionProbe("probe-"+o.name,Y,e);a.cubeTexture.name="reflection-probe-cube-texture",a.attachToMesh(n),a.renderList&&a.renderList.push(...t(e)),o.reflectionTexture=a.cubeTexture}e.meshes.forEach(n=>{const o=n.metadata;o&&(o.mirrorTexture&&i(n,o.mirrorTexture),o.reflectionProbe&&r(n))})}}class je{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)}}}function De(s,e,t,i,r=""){t.forEach(n=>{const o=n.getID(),a=n.getName(),l=n.getPanelSize&&n.getPanelSize(),h=x.getDynamicTextureResolution((l==null?void 0:l.width)===1||(l==null?void 0:l.height)===1);s.filter(g=>g.name===r+a).forEach(g=>{const m=i.get(o),b=!1;if(m)Z(g,m),m.update(b);else{const f=Ve(a,e,h.width,h.height);i.set(o,f),n.setStaticContext(f.getContext()),Z(g,f),f.onLoadObservable.addOnce(()=>{f.update(b)})}})})}function Ve(s,e,t,i){const r=new Le.DynamicTexture(s,{width:t,height:i},e,x.shouldMipMap(),Fe.Texture.TRILINEAR_SAMPLINGMODE,I.Engine.TEXTUREFORMAT_RGBA),n=r.getContext();return n&&(n.fillStyle="#f5f5f5",n.fillRect(0,0,t,i),r.update()),r}function Z(s,e){if(s instanceof B.PBRMaterial){const t=s,i=t.albedoTexture;i?(e.wrapU=i.wrapU,e.wrapV=i.wrapV):(e.wrapU=1,e.wrapV=1),t.albedoTexture=e}else{const t=s,i=t.diffuseTexture;i&&(e.wrapU=i.wrapU,e.wrapV=i.wrapV),t.diffuseTexture=e}}function Ne(){const s=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return s()+s()+"-"+s()+"-"+s()+"-"+s()+"-"+s()+s()+s()}const P=60,$=1;function _(s){return s.targetedAnimations.map(t=>t.animation.framePerSecond).reduce((t,i)=>t+i,0)/s.targetedAnimations.length||0}function X(s,e,t,i,r,n){const o=r?s.filter(c=>c.name===r):s;if(o.length===0){console.warn(`No animations found for name: ${r}`);return}let a=0;const l=()=>{a++,a===o.length&&n&&n()},h=(c,g,m,b,f)=>{c.stop(),c.start(g,m,b,f),n&&(g==!1||g===void 0&&!c.loopAnimation?c.onAnimationGroupEndObservable.addOnce(()=>{l()}):c.onAnimationLoopObservable.addOnce(()=>{l()}))};if(i!==void 0&&t!==void 0&&i===t){o.forEach(c=>{const g=_(c),m=i*g;h(c,!1,$,m,m)});return}o.forEach(c=>{const g=_(c),m=i!==void 0?i*g:void 0,b=t!==void 0?t*g:void 0;h(c,e,$,m,b)})}function ke(s,e,t){return new Promise(i=>{s.stopAnimation(e),e.animations=[],Math.abs(e.alpha)>2*Math.PI&&(e.alpha=ze(e.alpha,0,2*Math.PI));const r=[],n=t.target;if(t.target&&Object.keys(t.target).length>0&&r.push(L("cameraTargetLerp","target",new p.Vector3().copyFrom(e.target),new p.Vector3(t.target.x,t.target.y,t.target.z),M.Animation.ANIMATIONTYPE_VECTOR3)),r.push(L("cameraAlphaLerp","alpha",e.alpha,J(t.lonDeg),M.Animation.ANIMATIONTYPE_FLOAT)),r.push(L("cameraBetaLerp","beta",e.beta,J(t.latDeg),M.Animation.ANIMATIONTYPE_FLOAT)),t.radius!==void 0){const l=Math.max(.01,t.radius);r.push(L("cameraRadiusLerp","radius",e.radius,l,M.Animation.ANIMATIONTYPE_FLOAT))}e.animations.push(...r);const a=e.useAutoRotationBehavior;e.disableAutoRotationBehavior(),s.beginAnimation(e,0,n?P*2:P,!1,1,()=>{e.animations=[],a&&e.enableAutoRotationBehavior(),i()})})}function J(s){return s*Math.PI/180}function L(s,e,t,i,r,n=0,o=M.Animation.ANIMATIONLOOPMODE_CONSTANT){const a=new U.QuadraticEase;a.setEasingMode(U.EasingFunction.EASINGMODE_EASEINOUT);const l=new M.Animation(s,e,P,r,o),h=[];return n>0&&h.push({frame:0,value:t}),h.push({frame:P*n,value:t}),h.push({frame:P*(n+1),value:i}),l.setKeys(h),l.setEasingFunction(a),l}function ze(s,e,t){return s<e?s=t-(e-s)%(t-e):s=e+(s-e)%(t-e)}function Ge(s,e,t){s.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 Ue(s,e,t,i){["albedoTexture","bumpTexture","ambientTexture","emissiveTexture","opacityTexture","metallicTexture","refractionTexture","reflectionTexture"].forEach(n=>{Ke(n,s,e,t,i)}),Ye(s,e)}function Ke(s,e,t,i,r){const n=He[s];if(!n)throw new Error("Unexpected texture name encountered.");const o=e[n],a=o==null?void 0:o.fileLink;a?s==="reflectionTexture"?a.endsWith(".env")||a.endsWith(".dds")?i.addCubeTextureTask(s,a,void 0,!1,void 0,!0):a.endsWith(".hdr")?i.addHDRCubeTextureTask(s,a,128,!1,!0,!1):i.addTextureTask(s,a,!1,!1):i.addTextureTask(s,a,!1,!1):r&&t[s]&&(t[s]&&t[s].dispose(),t[s]=null,We(s,t))}function We(s,e){s==="opacityTexture"&&(e.useAlphaFromAlbedoTexture=!0),s==="metallicTexture"&&(e.useRoughnessFromMetallicTextureAlpha=!1,e.useRoughnessFromMetallicTextureGreen=!1,e.useMetallnessFromMetallicTextureBlue=!1),s==="refractionTexture"&&(e.subSurface.isRefractionEnabled=!1,e.subSurface.refractionIntensity=1),s==="reflectionTexture"&&(e.environmentIntensity=1),s==="emissiveTexture"&&(e.emissiveIntensity=0,e.emissiveColor=new v.Color3(0,0,0),e.reflectionTexture)}function Qe(s,e,t,i){if(!e){console.error("Failed to apply texture to material: material is null.");return}s==="opacityTexture"&&(e.useAlphaFromAlbedoTexture=!1),s==="metallicTexture"&&(e.useRoughnessFromMetallicTextureAlpha=!1,e.useRoughnessFromMetallicTextureGreen=!0,e.useMetallnessFromMetallicTextureBlue=!0),s==="refractionTexture"&&(e.subSurface.isRefractionEnabled=!0,e.subSurface.refractionIntensity=t.refractionIntensity||1),s==="reflectionTexture"&&(e.environmentIntensity=t.reflectionIntensity||1,i.isCube&&(i.rotationY=t.reflectionRotation?t.reflectionRotation*Math.PI/180:0)),e[s]=i,s==="emissiveTexture"&&(e.emissiveColor=new v.Color3(1,1,1),e.emissiveIntensity=1)}function Ye(s,e){s.clearCoat&&(s.clearCoat===O.RemoveWhenSelected?(e.clearCoat.isEnabled=!1,e.clearCoat.indexOfRefraction=1.5):s.clearCoat===O.ApplyWhenSelected&&(e.clearCoat.isEnabled=!0,e.clearCoat.indexOfRefraction=s.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,r){return new Promise(n=>{const o=this.materialVariantMap.get(e);this.materialVariantMap.set(e,{...o,...t});const a=this.renameClonedAsset(e),l=this.scene.materials.filter(c=>c.name===a);if(l.length===0){n();return}const h=new Ie.AssetsManager(this.scene);h.useDefaultLoadingScreen=!1,l.forEach(c=>Ue(t,c,h,r)),h.onProgress=(c,g,m)=>{i&&i(c/g*100,100,m.name)},h.onFinish=c=>{c.forEach(g=>{const m=g;i&&i(100,100,g.name),this.scene.materials.filter(f=>f.name===a).forEach(f=>{Qe(g.name,f,t,m.texture)})}),n()},h.loadAsync()})}async applyModel(e,t,i,r,n,o,a){var m,b,f;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),(m=this.loadedContainerForKey.get(e))==null||m.dispose(),this.loadedContainerForKey.delete(e),(b=this.loadedMaterialsForKey.get(e))==null||b.forEach(C=>C.dispose()),this.loadedMaterialsForKey.delete(e),this.keysThatRemovedBaseModel=this.keysThatRemovedBaseModel.filter(C=>C!==e),Promise.resolve(void 0);const h=(await D(i,this.scene,r)).instantiateModelsToScene(this.renameClonedAsset,!0);this.loadedContainerForKey.has(e)&&(this.loadedContainerForKey.get(e).dispose(),this.loadedContainerForKey.delete(e),(f=this.loadedMaterialsForKey.get(e))==null||f.forEach(C=>C.dispose()),this.loadedMaterialsForKey.delete(e));const c=n&&n();if(c){const C=o&&o(),y=c.name?this.renameClonedAsset(c.name):void 0;if(X(h.animationGroups,c.loop,c.to,c.from,y),C!=null){const F=a&&a()||!0;Ge(h.animationGroups,C+(F?2:0),y)}}t&&await this.setBaseModelEnabled(!1),this.loadedContainerForKey.set(e,h),this.loadedMaterialsForKey.set(e,ee(h));const g=[];return this.materialVariantMap.forEach(async(C,y)=>{g.push(this.applyMaterial(y,C))}),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 ee(s){const e=[];return s.rootNodes.forEach(t=>{t.getChildMeshes().forEach(i=>{i.material&&!e.includes(i.material)&&e.push(i.material),i.subMeshes&&i.subMeshes.forEach(r=>{const n=r.getMaterial(!1);n&&!e.includes(n)&&e.push(n)})})}),e}function te(s,e=""){return s.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 A.Observable,this.materialDeselectedObservable=new A.Observable,this.materialVariantObservable=new A.Observable,this.modelVariantObservable=new A.Observable,this.materialReadyToLoadCallbacks=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:r,progressHandler:n,scene:o}=e;this.enablePicking=t,this.contextService=i.contextService,this.id=Ne(),this.previewService=r,this.scene=o,this.variantManager=new Ze(o,this.renameClonedAsset.bind(this),this.setBaseModelEnabled.bind(this)),this.transformRoot=new Oe.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 D(i.model,o,n),await this.instantiate(),this};this.importPromise=a()}async applyMaterialVariant(e,t,i,r){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,r))}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,r))}return}const n=async()=>{await this.variantManager.applyMaterial(e,i,(o,a,l)=>{this.materialVariantObservable.notifyObservers({remainingCount:o,totalCount:a,taskName:l})},r)};if(this.materialChangesInProgress.includes(e)){if(this.queuedMaterialChanges.has(e)){const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,n)}else{this.queuedMaterialChanges.set(e,new Map);const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,n)}return}if(this.materialChangesInProgress.push(e),await n(),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(),this.scene.cleanCachedTextureBuffer()}async applyModelVariant(e,t,i){const r=()=>this.variantManager.applyModel(e,i,t==null?void 0:t.model,a=>{this.modelVariantObservable.notifyObservers({...a,key:e})},this.getLastRequestedAnimation.bind(this),this.getCurrentAnimationFrame.bind(this),this.getAnimationIsPlaying.bind(this)),n=async()=>{this.modelChangesInProgress.push(e);let a=await r();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};if(!this.initialized||this.modelChangesInProgress.includes(e)){const a=async()=>{const l=await r();return l?this.configureModelInstance(l):this.configureGlowLayer(),l};this.queuedModelChanges.set(e,a);return}const o=await n();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,t){if(this.lastRequestedAnimation=e,!this.initialized)return this.queuedModelAnimation=e,Promise.resolve();let i=()=>{};const r=async()=>{this.isExecutingAnimation=!0,await new Promise(n=>{var a;const o=[...((a=this.modelInstance)==null?void 0:a.animationGroups)||[],...this.variantManager.getAnimationGroups()];X(o,e.loop,e.to,e.from,e.name?this.renameClonedAsset(e.name):void 0,n)}),this.isExecutingAnimation=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,i()};return t?r():this.isExecutingAnimation?(this.queuedAnimationFunction=r,new Promise(n=>{i=n})):r()}getAnimations(e){return[...this.animations,...e?te(this.variantManager.getAnimationGroups(),this.renameClonedAsset("")):[]].map((t,i)=>({...t,name:t.name||`UNNAMED_ANIMATION_${i}`})).filter((t,i,r)=>r.indexOf(r.find(n=>n.name===t.name))==i)}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 q.ActionManager(this.scene)),i.actionManager.registerAction(new H.ExecuteCodeAction(q.ActionManager.OnPointerOverTrigger,r=>{r.meshUnderPointer&&i.material&&this.materialSelectedObservable.notifyObservers({id:i.material.id,name:this.stripIdFromName(i.material.name)})})),i.actionManager.registerAction(new H.ExecuteCodeAction(q.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.queuedModelChanges.size}configureGlowLayer(){const e=i=>i instanceof B.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 n;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,r=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;for(const a of o.getChildMeshes(!1))a.alwaysSelectAsActiveMesh=!0}this.transformRoot.position=t,this.transformRoot.rotationQuaternion=i,this.transformRoot.scaling=r,this.canvasPanels=((n=this.contextService)==null?void 0:n.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=ee(this.modelInstance),this.configureModelInstance(this.modelInstance),this.animations=te(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 r=this.dynamicTextures.get(i);r&&t.getStaticContextDirty()&&r.isReady()&&(r.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)}getLastRequestedAnimation(){return this.lastRequestedAnimation}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.queuedModelChanges.values()).map(e=>e())),this.queuedModelChanges.clear(),this.scene.onAfterRenderObservable.addOnce(()=>{this.queuedModelAnimation&&(this.executeAnimation(this.queuedModelAnimation),this.queuedModelAnimation=void 0)})}}class V extends w.ArcRotateCamera{constructor(e,t,i,r,n,o,a,l){super(e,t,i,r,n,o,l),this.lastFocus=new p.Vector3(0,0,0),this._isRunningFramingBehavior=!1,this.panDenominator=1,this.panEnabled=!0,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))}updateConfiguration(e){e&&(this.lowerBetaLimit=e.camera.limits.min.beta??null,this.upperBetaLimit=e.camera.limits.max.beta??null,this.lowerAlphaLimit=e.camera.limits.min.alpha??null,this.upperAlphaLimit=e.camera.limits.max.alpha??null,e.camera.autoRotation.enabled?this.enableAutoRotationBehavior(e.camera.autoRotation.idleTimeMs):this.disableAutoRotationBehavior())}get isRunningFramingBehavior(){return this._isRunningFramingBehavior}set isRunningFramingBehavior(e){this._isRunningFramingBehavior=e,!e&&this.framingBehaviourCallback&&(this.framingBehaviourCallback(),this.framingBehaviourCallback=void 0)}setPanEnabled(e){this.panEnabled=e,this.panningSensibility=1e3/this.panDenominator,this.panningAxis=e?new p.Vector3(1,1,0):new p.Vector3(0,0,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=N(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 r=()=>{this.isRunningFramingBehavior=!1},n=N(this._scene),o=n.max.subtract(n.min),a=n.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(n.min,n.max,void 0,r),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){var l;const r=N(e),n=r.max.subtract(r.min),o=r.min.add(n.scale(.5)),a=new V("ProductCamera",-(Math.PI/2),Math.PI/2,n.length()*1.5,o,e,t);return a.setPanEnabled(((l=t.options)==null?void 0:l.noPan)!==void 0?!t.options.noPan:!0),a.panningInertia=0,a.panningOriginTarget.copyFrom(o),a.panDenominator=n.length(),a.onAfterCheckInputsObservable.addOnce(()=>{a.setPanEnabled(a.panEnabled)}),i&&(e.activeCamera=a),a}}function N(s){if(s.meshes.length===0)return{min:new p.Vector3(-1,-1,-1),max:new p.Vector3(1,1,1)};const e=s.meshes.filter(t=>t.name.toLowerCase().endsWith("_t")||t.name.toLowerCase().includes("_t_"));return s.getWorldExtends(t=>t.isVisible&&t.isEnabled()&&(e.length===0||e.includes(t)))}class _e{constructor(e,t=!1,i=void 0){this.renderingPipeline=new Se.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,r,n,o,a,l,h,c,g,m,b,f,C,y,F,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=((r=e.bloom)==null?void 0:r.enabled)??u.bloom.enabled,this.renderingPipeline.bloomKernel=((n=e.bloom)==null?void 0:n.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=((l=e.bloom)==null?void 0:l.weight)??u.bloom.weight,this.renderingPipeline.chromaticAberrationEnabled=((h=e.chromaticAberration)==null?void 0:h.enabled)??u.chromaticAberration.enabled,this.renderingPipeline.chromaticAberration.aberrationAmount=((c=e.chromaticAberration)==null?void 0:c.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=((b=e.colorCurves)==null?void 0:b.enabled)??u.colorCurves.enabled,this.renderingPipeline.imageProcessing.colorCurves=e.colorCurves?this.updateColorCurve(e.colorCurves):new K.ColorCurves,this.renderingPipeline.depthOfFieldEnabled=((f=e.depthOfField)==null?void 0:f.enabled)??u.depthOfField.enabled,e.depthOfField)switch(e.depthOfField.blurLevel??u.depthOfField.blurLevel){case"Low":this.renderingPipeline.depthOfFieldBlurLevel=j.DepthOfFieldEffectBlurLevel.Low;break;case"Medium":this.renderingPipeline.depthOfFieldBlurLevel=j.DepthOfFieldEffectBlurLevel.Medium;break;case"High":this.renderingPipeline.depthOfFieldBlurLevel=j.DepthOfFieldEffectBlurLevel.High;break}if(this.renderingPipeline.depthOfField.focalLength=((C=e.depthOfField)==null?void 0:C.focalLength)??u.depthOfField.focalLength,this.renderingPipeline.depthOfField.fStop=((y=e.depthOfField)==null?void 0:y.fStop)??u.depthOfField.fStop,this.renderingPipeline.depthOfField.focusDistance=((F=e.depthOfField)==null?void 0:F.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=R.ImageProcessingConfiguration.TONEMAPPING_STANDARD;break;case"ACES":this.renderingPipeline.imageProcessing.toneMappingType=R.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=R.ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;break;case"Opaque":this.renderingPipeline.imageProcessing.vignetteBlendMode=R.ImageProcessingConfiguration.VIGNETTEMODE_OPAQUE;break}(pe=e.vignette)!=null&&pe.colorRgba?this.renderingPipeline.imageProcessing.vignetteColor=new v.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=v.Color4.FromHexString(e.vignette.colorHex):this.renderingPipeline.imageProcessing.vignetteColor=new v.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 K.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}}xe.GLTF2.GLTFLoader.RegisterExtension("glbPostProcessor",function(s){return new qe(s)}),S.SceneLoader.OnPluginActivatedObservable.add(s=>{if(s.name==="gltf"){const e=s;e.transparencyAsCoverage=!0}});function k(s){return new p.Vector3(s.x,s.y,s.z)}function z(s){return{x:s.x,y:s.y,z:s.z}}class Xe{constructor(e){var l;this.focusLostNotified=!1,this.focusLostObservable=new A.Observable,this.modelLoadEventCallbacks=[],this.validHighlightMaterials=[],this.modelContainers=new Map,this.plugins=[],this.initComplete=!1,this.isAnimatingCamera=!1,this.renderLoop=()=>{if(!this.engine.views)return;this.modelContainers.forEach(g=>{g.updateDynamicTextures()}),this.scene.autoClear=!0,this.scene.autoClearDepthAndStencil=!0;const h=this.engine.getRenderingCanvas();if(h)if(h.getContext("webgl2")??h.getContext("webgl")){const g=this.configuration.scene.clearColor,m=h.getContext("webgl2")??h.getContext("webgl");m.clearDepth(1),m.depthFunc(m.LEQUAL),m.clearStencil(0),m.clearColor(g.r,g.g,g.b,g.a),m.clear(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT|m.STENCIL_BUFFER_BIT)}else h.getContext("2d")?h.getContext("2d").clearRect(0,0,h.width,h.height):console.error("SpiffCommerce: Failed to get any context on the rendering canvas.");this.scene.render(),this.camera.isRunningFramingBehavior&&this.camera.getFramingBehavior().isUserIsMoving&&(this.camera.isRunningFramingBehavior=!1);const c=Math.max((this.camera.lowerRadiusLimit??1)*.01,.001);!this.camera.isRunningFramingBehavior&&!this.camera.target.equalsWithEpsilon(this.camera.lastFocus,c)&&!this.focusLostNotified&&(this.focusLostObservable.notifyObservers(void 0),this.focusLostNotified=!0)},this.configuration=new Q(e);const i=(()=>{if(!(e!=null&&e.noRender))return this.configuration.createCanvas()})(),r="1.5.7";ye.DracoCompression.Configuration={decoder:{wasmUrl:`https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,wasmBinaryUrl:`https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,fallbackUrl:`https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`}},i&&(i.getContext("webgl2")||i.getContext("webgl"));const n=console.log;console.log=()=>{};const o=i?new I.Engine(i,!0,{adaptToDeviceRatio:!0,limitDeviceRatio:2,premultipliedAlpha:!1,preserveDrawingBuffer:!!(e!=null&&e.backgroundImage),audioEngine:!1,stencil:this.configuration.highlights.enabled,forceSRGBBufferSupportState:!0}):new Ce.NullEngine;o.enableOfflineSupport=!1,o.doNotHandleContextLost=!0,console.log=n,o.hideLoadingUI(),window.addEventListener("resize",this.fireResizeEvent.bind(this)),this.engine=o,this.scene=new Me.Scene(o),this.camera=V.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=G.CubeTexture.CreateFromPrefilteredData(this.configuration.scene.environment.file,this.scene);a.name="initial-environment-cube",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 je(this.scene,this.configuration.emissiveGlowIntensity),this.initPromise=new Promise(h=>{this.scene.onReadyObservable.addOnce(()=>{this.initComplete=!0,h()})})}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(E.Pan),this.reattachControls(e),this.engine.activeRenderLoops.length===0&&this.engine.runRenderLoop(this.renderLoop)}unregisterView(e){this.engine.unRegisterView(e),this.engine.views&&this.engine.views.length===0&&this.engine.stopRenderLoop(this.renderLoop)}getNumViewports(){var e;return((e=this.engine.views)==null?void 0:e.length)||0}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(r=>r.getIsInitialized()))return this.queuedCameraAnimation=e,Promise.resolve();let t=()=>{};const i=async()=>{this.isAnimatingCamera=!0,await ke(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(r=>{t=r})):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===E.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 r=()=>{const n=this.configuration;this.camera.rerunFramingBehavior(()=>{n.camera.limits.min.radius&&(this.camera.lowerRadiusLimit=n.camera.limits.min.radius),n.camera.limits.max.radius&&(this.camera.upperRadiusLimit=n.camera.limits.max.radius),i()})};this.scene.onAfterRenderObservable.addOnce(r)}),this.isAnimatingCamera=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,e()};return this.isAnimatingCamera?(this.queuedAnimationFunction=t,new Promise(i=>{e=i})):t()}forceStopCameraAnimations(){var e;this.queuedAnimationFunction=void 0,this.queuedCameraAnimation=void 0,this.isAnimatingCamera=!1,(e=this.camera.framingBehavior)==null||e.stopAllAnimations(),this.scene.stopAnimation(this.camera)}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 w.ArcRotateCamera("screenshotCamera",0,0,0,p.Vector3.Zero(),this.scene),r=t.latDeg*Math.PI/180,n=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=n,i.beta=r,i.radius=t.radius||this.camera.radius,i.minZ=.01;try{return await new Promise(o=>{const a=this.scene.onBeforeRenderObservable.add(async()=>{this.scene.onBeforeRenderObservable.remove(a);const l=await we.Tools.CreateScreenshotUsingRenderTargetAsync(this.engine,i,e,"image/png",2,!0);return i.dispose(),o(l)});this.scene.render(),this.engine.endFrame()})}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,r=e.camera.limits.min.beta,n=e.camera.limits.max.beta;if(t===void 0||i===void 0||r===void 0||n===void 0)return!0;const o=[t,i],a=[r,n],l=o.every(c=>c===t),h=a.every(c=>c===r);return!l&&!h}fireResizeEvent(){this.getNumViewports()>0&&this.engine.resize()}setHighlights(e){this.scene.materials.forEach(()=>{this.scene.materials.forEach(i=>{i.emissiveIntensity===.18&&(i.emissiveColor=v.Color3.Black(),i.emissiveIntensity=1)})}),e.filter(i=>this.validHighlightMaterials.includes(i.name)).forEach(i=>{const r=this.scene.materials.find(n=>n.id===i.id);r&&(r.emissiveColor=new v.Color3(this.configuration.highlights.color.r,this.configuration.highlights.color.g,this.configuration.highlights.color.b),r.emissiveIntensity=.18)})}setRenderingPipelineConfiguration(e){this.renderingPipeline&&this.renderingPipeline.setConfiguration(e)}loadModel(e,t){const{refocusCamera:i=!0,progressHandler:r}=t??{},n=new $e({enablePicking:this.configuration.highlights.enabled,modelDetails:e,scene:this.scene,previewService:this,progressHandler:r});return n.getInitializationPromise().then(()=>{if(this.modelContainers.size<=1&&i){const o=this.queuedCameraAnimation;this.forceStopCameraAnimations(),this.camera.rerunFramingBehavior(()=>{this.scene.onAfterRenderObservable.addOnce(()=>{o&&(this.executeCameraAnimation(o),this.queuedCameraAnimation=void 0)})},1)}}),this.configuration.highlights.enabled&&(n.registerMaterialSelectedCallback(o=>{this.setHighlights([o])}),n.registerMaterialDeselectedCallback(()=>{this.setHighlights([])})),this.modelContainers.set(n.getId(),n),this.triggerModelLoadEvent({eventType:"load",modelContainer:n}),n}async preloadModel(e){await D(e,this.scene)}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(r=>r.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 r=p.Matrix.Compose(k(i||{x:1,y:1,z:1}),p.Quaternion.FromEulerVector(k(t||{x:0,y:0,z:0})),k(e||{x:0,y:0,z:0})),n=p.Matrix.RotationAxis(p.Vector3.Up(),Math.PI),o=r.multiply(n),a=p.Vector3.Zero(),l=p.Quaternion.Identity(),h=p.Vector3.Zero();return o.decompose(h,l,a),l.multiplyInPlace(p.Quaternion.FromEulerAngles(0,Math.PI,0)),{position:z(a),rotation:z(l.toEulerAngles()),scale:z(h)}}updatePreviewOptions(e){var r,n;const t=new Q(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=G.CubeTexture.CreateFromPrefilteredData(t.scene.environment.file,this.scene),i.name="updated-environment-cube",i.rotationY=this.configuration.scene.environment.rotationY,this.scene.environmentTexture=i),i.rotationY=t.scene.environment.rotationY,this.scene.environmentIntensity=t.scene.environment.intensity,(r=t.options)!=null&&r.renderingPipelineConfiguration?this.renderingPipeline.setConfiguration(t.options.renderingPipelineConfiguration):(this.scene.imageProcessingConfiguration.exposure=t.lighting.exposure,this.scene.imageProcessingConfiguration.contrast=t.lighting.contrast),this.glowLayerManager.setIntensity(t.emissiveGlowIntensity),this.camera.updateConfiguration(t),this.camera.setPanEnabled(((n=t.options)==null?void 0:n.noPan)!==void 0?!t.options.noPan:!0),this.configuration=t}setHighlightMaterials(e){this.validHighlightMaterials=e}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)}static isSupported(){return I.Engine.isSupported()}}d.MaterialEffectMode=O,d.ProductCameraRig=E,d.REFLECTION_PROBE_RESOLUTION=Y,d.RenderingConfiguration=x,d.SpiffCommerce3DPreviewService=Xe,d.renderingPipelineDefaults=u,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(d,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@babylonjs/core/Cameras/arcRotateCamera"),require("@babylonjs/core/Engines/engine"),require("@babylonjs/core/Engines/nullEngine"),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/loaders/glTF/glTFFileLoader"),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/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/Culling/ray"),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/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/loaders/glTF/glTFFileLoader","@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/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/Culling/ray","@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"],w):(d=typeof globalThis<"u"?globalThis:d||self,w(d.Preview={},d.arcRotateCamera,d.engine,d.nullEngine,d.sceneLoader,d.cubeTexture,d.math_color,d.math_vector,d.dracoCompression,d.observable,d.tools,d.scene,d.glTF,d.glTFFileLoader,d.pbrMaterial,d.mirrorTexture,d.math,d.reflectionProbe,d.glowLayer,d.actionManager,d.directActions,d.mesh,d.transformNode,d.dynamicTexture,d.texture,d.animation,d.easing,d.assetsManager,d.colorCurves,d.imageProcessingConfiguration,d.RenderPipeline,d.depthOfFieldEffect))})(this,function(d,w,I,Ce,S,G,v,p,ye,A,we,Me,xe,Ae,B,Pe,T,Te,Re,q,H,Ee,Oe,Le,Fe,M,U,Ie,K,R,Se,j){"use strict";var E=(n=>(n[n.Orbit=0]="Orbit",n[n.Pan=1]="Pan",n))(E||{}),O=(n=>(n.None="None",n.RemoveWhenSelected="RemoveWhenSelected",n.ApplyWhenSelected="ApplyWhenSelected",n))(O||{});function Be(){const n=navigator.vendor.toLowerCase().includes("apple"),e=navigator.maxTouchPoints>0,t=!navigator.userAgent.toLowerCase().includes("crios");return n&&e&&t}const W=new Map;async function D(n,e,t){const i=await W.get(n);if(i&&i.scene.uid===e.uid)return i;const r=S.SceneLoader.LoadAssetContainerAsync(n,void 0,e,t);return!Be()&&W.set(n,r),r}S.SceneLoader.OnPluginActivatedObservable.add(n=>{n.name==="gltf"&&(n.animationStartMode=Ae.GLTFLoaderAnimationStartMode.NONE)});class Q{constructor(e){this.getSceneClearColor=()=>{var i,r,s,o;const t=(i=this.customOptions)!=null&&i.transparentBackground||(r=this.customOptions)!=null&&r.backgroundImage?0:1;if(this.customOptions&&((s=this.customOptions)!=null&&s.transparentBackground)||(o=this.customOptions)!=null&&o.backgroundImage)return new v.Color4(0,0,0,t).toLinearSpace();if(this.customOptions&&this.customOptions.backgroundColor){const a=v.Color3.FromHexString(this.customOptions.backgroundColor);return new v.Color4(a.r,a.g,a.b,t).toLinearSpace()}return new v.Color4(.98,.98,.98,t).toLinearSpace()},this.highlightColorFromConfig=()=>this.customOptions&&this.customOptions.highlightColor?this.hexToColor4(this.customOptions.highlightColor):v.Color4.FromColor3(v.Color3.Gray()),this.hexToColor4=(t,i=1)=>{const r=v.Color3.FromHexString(t);return new v.Color4(r.r,r.g,r.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,r,s;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:((r=this.customOptions)==null?void 0:r.environmentIntensity)??1,rotationY:(((s=this.customOptions)==null?void 0:s.environmentRotationY)??0)*(Math.PI/180)}}}get camera(){var e,t,i,r,s,o,a,l,h,c,g,m,b;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:(r=this.customOptions)!=null&&r.lowerAlphaLimitDeg?((s=this.customOptions)==null?void 0:s.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:(h=this.customOptions)!=null&&h.upperAlphaLimitDeg?((c=this.customOptions)==null?void 0:c.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:(b=this.customOptions)==null?void 0:b.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,r;return{exposure:((t=(e=this.customOptions)==null?void 0:e.lighting)==null?void 0:t.exposure)??.9,contrast:((r=(i=this.customOptions)==null?void 0:i.lighting)==null?void 0:r.contrast)??1.6}}get emissiveGlowIntensity(){var e;return((e=this.customOptions)==null?void 0:e.emissiveGlowIntensity)??.5}}class x{static getDynamicTextureResolution(e=!1){return e?{width:1,height:1}:this.getIsMobile()||!x.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 Y=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 qe{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(r){t.extras&&Object.keys(t.extras).forEach(s=>{const o=t.extras[s];r.metadata[s]=o}),i(r)})}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 B.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 T.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(s){const o=[];return s.transformNodes.forEach(a=>{a.metadata&&a.metadata.reflective&&o.push(...a.getChildMeshes())}),s.meshes.forEach(a=>{a.metadata&&a.metadata.reflective&&!o.includes(a)&&o.push(a)}),o}function i(s,o=1){const a=s.material;if(!a)return;const l=new Pe.MirrorTexture("mirror",x.getMirrorTextureResolution(),e,!0);l.renderList=t(e);const h=s.getVerticesData("normal");if(!h)throw new Error("Mirror attribute specified on: "+s.name+"But no normals exist to generate a mirror from!");s.computeWorldMatrix(!0);const c=s.getWorldMatrix(),g=T.Vector3.TransformNormal(new T.Vector3(h[0],h[1],h[2]),c).normalize(),m=T.Plane.FromPositionAndNormal(s.position,g.scale(-1));l.mirrorPlane=m,l.level=o,a.reflectionTexture=l}function r(s){const o=s.material,a=new Te.ReflectionProbe("probe-"+o.name,Y,e);a.cubeTexture.name="reflection-probe-cube-texture",a.attachToMesh(s),a.renderList&&a.renderList.push(...t(e)),o.reflectionTexture=a.cubeTexture}e.meshes.forEach(s=>{const o=s.metadata;o&&(o.mirrorTexture&&i(s,o.mirrorTexture),o.reflectionProbe&&r(s))})}}class je{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)}}}function De(n,e,t,i,r=""){t.forEach(s=>{const o=s.getID(),a=s.getName(),l=s.getPanelSize&&s.getPanelSize(),h=x.getDynamicTextureResolution((l==null?void 0:l.width)===1||(l==null?void 0:l.height)===1);n.filter(g=>g.name===r+a).forEach(g=>{const m=i.get(o),b=!1;if(m)Z(g,m),m.update(b);else{const f=Ve(a,e,h.width,h.height);i.set(o,f),s.setStaticContext(f.getContext()),Z(g,f),f.onLoadObservable.addOnce(()=>{f.update(b)})}})})}function Ve(n,e,t,i){const r=new Le.DynamicTexture(n,{width:t,height:i},e,x.shouldMipMap(),Fe.Texture.TRILINEAR_SAMPLINGMODE,I.Engine.TEXTUREFORMAT_RGBA),s=r.getContext();return s&&(s.fillStyle="#f5f5f5",s.fillRect(0,0,t,i),r.update()),r}function Z(n,e){if(n instanceof B.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 Ne(){const n=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}const P=60,$=1;function _(n){return n.targetedAnimations.map(t=>t.animation.framePerSecond).reduce((t,i)=>t+i,0)/n.targetedAnimations.length||0}function X(n,e,t,i,r,s){const o=r?n.filter(c=>c.name===r):n;if(o.length===0){console.warn(`No animations found for name: ${r}`);return}let a=0;const l=()=>{a++,a===o.length&&s&&s()},h=(c,g,m,b,f)=>{c.stop(),c.start(g,m,b,f),s&&(g==!1||g===void 0&&!c.loopAnimation?c.onAnimationGroupEndObservable.addOnce(()=>{l()}):c.onAnimationLoopObservable.addOnce(()=>{l()}))};if(i!==void 0&&t!==void 0&&i===t){o.forEach(c=>{const g=_(c),m=i*g;h(c,!1,$,m,m)});return}o.forEach(c=>{const g=_(c),m=i!==void 0?i*g:void 0,b=t!==void 0?t*g:void 0;h(c,e,$,m,b)})}function ke(n){n.forEach(e=>{e.reset(),e.stop()})}function ze(n){const e=n.animationGroups;ke(e)}function Ge(n,e,t){return new Promise(i=>{n.stopAnimation(e),e.animations=[],Math.abs(e.alpha)>2*Math.PI&&(e.alpha=He(e.alpha,0,2*Math.PI));const r=[],s=t.target;if(t.target&&Object.keys(t.target).length>0&&r.push(L("cameraTargetLerp","target",new p.Vector3().copyFrom(e.target),new p.Vector3(t.target.x,t.target.y,t.target.z),M.Animation.ANIMATIONTYPE_VECTOR3)),r.push(L("cameraAlphaLerp","alpha",e.alpha,J(t.lonDeg),M.Animation.ANIMATIONTYPE_FLOAT)),r.push(L("cameraBetaLerp","beta",e.beta,J(t.latDeg),M.Animation.ANIMATIONTYPE_FLOAT)),t.radius!==void 0){const l=Math.max(.01,t.radius);r.push(L("cameraRadiusLerp","radius",e.radius,l,M.Animation.ANIMATIONTYPE_FLOAT))}e.animations.push(...r);const a=e.useAutoRotationBehavior;e.disableAutoRotationBehavior(),n.beginAnimation(e,0,s?P*2:P,!1,1,()=>{e.animations=[],a&&e.enableAutoRotationBehavior(),i()})})}function J(n){return n*Math.PI/180}function L(n,e,t,i,r,s=0,o=M.Animation.ANIMATIONLOOPMODE_CONSTANT){const a=new U.QuadraticEase;a.setEasingMode(U.EasingFunction.EASINGMODE_EASEINOUT);const l=new M.Animation(n,e,P,r,o),h=[];return s>0&&h.push({frame:0,value:t}),h.push({frame:P*s,value:t}),h.push({frame:P*(s+1),value:i}),l.setKeys(h),l.setEasingFunction(a),l}function He(n,e,t){return n<e?n=t-(e-n)%(t-e):n=e+(n-e)%(t-e)}function Ue(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 We(n,e,t,i){["albedoTexture","bumpTexture","ambientTexture","emissiveTexture","opacityTexture","metallicTexture","refractionTexture","reflectionTexture"].forEach(s=>{Qe(s,n,e,t,i)}),$e(n,e)}function Qe(n,e,t,i,r){const s=Ke[n];if(!s)throw new Error("Unexpected texture name encountered.");const o=e[s],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):r&&t[n]&&(t[n]&&t[n].dispose(),t[n]=null,Ye(n,t))}function Ye(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 v.Color3(0,0,0),e.reflectionTexture)}function Ze(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 v.Color3(1,1,1),e.emissiveIntensity=1)}function $e(n,e){n.clearCoat&&(n.clearCoat===O.RemoveWhenSelected?(e.clearCoat.isEnabled=!1,e.clearCoat.indexOfRefraction=1.5):n.clearCoat===O.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,r){return new Promise(s=>{const o=this.materialVariantMap.get(e);this.materialVariantMap.set(e,{...o,...t});const a=this.renameClonedAsset(e),l=this.scene.materials.filter(c=>c.name===a);if(l.length===0){s();return}const h=new Ie.AssetsManager(this.scene);h.useDefaultLoadingScreen=!1,l.forEach(c=>We(t,c,h,r)),h.onProgress=(c,g,m)=>{i&&i(c/g*100,100,m.name)},h.onFinish=c=>{c.forEach(g=>{const m=g;i&&i(100,100,g.name),this.scene.materials.filter(f=>f.name===a).forEach(f=>{Ze(g.name,f,t,m.texture)})}),s()},h.loadAsync()})}async applyModel(e,t,i,r,s,o,a){var m,b,f;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),(m=this.loadedContainerForKey.get(e))==null||m.dispose(),this.loadedContainerForKey.delete(e),(b=this.loadedMaterialsForKey.get(e))==null||b.forEach(C=>C.dispose()),this.loadedMaterialsForKey.delete(e),this.keysThatRemovedBaseModel=this.keysThatRemovedBaseModel.filter(C=>C!==e),Promise.resolve(void 0);const h=(await D(i,this.scene,r)).instantiateModelsToScene(this.renameClonedAsset,!0);this.loadedContainerForKey.has(e)&&(this.loadedContainerForKey.get(e).dispose(),this.loadedContainerForKey.delete(e),(f=this.loadedMaterialsForKey.get(e))==null||f.forEach(C=>C.dispose()),this.loadedMaterialsForKey.delete(e));const c=s&&s();if(c){const C=o&&o(),y=c.name?this.renameClonedAsset(c.name):void 0;if(X(h.animationGroups,c.loop,c.to,c.from,y),C!=null){const F=a&&a()||!0;Ue(h.animationGroups,C+(F?2:0),y)}}t&&await this.setBaseModelEnabled(!1),this.loadedContainerForKey.set(e,h),this.loadedMaterialsForKey.set(e,ee(h));const g=[];return this.materialVariantMap.forEach(async(C,y)=>{g.push(this.applyMaterial(y,C))}),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 ee(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(r=>{const s=r.getMaterial(!1);s&&!e.includes(s)&&e.push(s)})})}),e}function te(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 A.Observable,this.materialDeselectedObservable=new A.Observable,this.materialVariantObservable=new A.Observable,this.modelVariantObservable=new A.Observable,this.materialReadyToLoadCallbacks=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:r,progressHandler:s,scene:o}=e;this.enablePicking=t,this.contextService=i.contextService,this.id=Ne(),this.previewService=r,this.scene=o,this.variantManager=new _e(o,this.renameClonedAsset.bind(this),this.setBaseModelEnabled.bind(this)),this.transformRoot=new Oe.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 D(i.model,o,s),await this.instantiate(),this};this.importPromise=a()}async applyMaterialVariant(e,t,i,r){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,r))}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,r))}return}const s=async()=>{await this.variantManager.applyMaterial(e,i,(o,a,l)=>{this.materialVariantObservable.notifyObservers({remainingCount:o,totalCount:a,taskName:l})},r)};if(this.materialChangesInProgress.includes(e)){if(this.queuedMaterialChanges.has(e)){const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,s)}else{this.queuedMaterialChanges.set(e,new Map);const o=this.queuedMaterialChanges.get(e);o==null||o.set(t,s)}return}if(this.materialChangesInProgress.push(e),await s(),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(),this.scene.cleanCachedTextureBuffer()}async applyModelVariant(e,t,i){const r=()=>this.variantManager.applyModel(e,i,t==null?void 0:t.model,a=>{this.modelVariantObservable.notifyObservers({...a,key:e})},this.getLastRequestedAnimation.bind(this),this.getCurrentAnimationFrame.bind(this),this.getAnimationIsPlaying.bind(this)),s=async()=>{this.modelChangesInProgress.push(e);let a=await r();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};if(!this.initialized||this.modelChangesInProgress.includes(e)){const a=async()=>{const l=await r();return l?this.configureModelInstance(l):this.configureGlowLayer(),l};this.queuedModelChanges.set(e,a);return}const o=await s();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,t){if(this.lastRequestedAnimation=e,!this.initialized)return this.queuedModelAnimation=e,Promise.resolve();let i=()=>{};const r=async()=>{this.isExecutingAnimation=!0,await new Promise(s=>{var a;const o=[...((a=this.modelInstance)==null?void 0:a.animationGroups)||[],...this.variantManager.getAnimationGroups()];X(o,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,i()};return t?(ze(this.scene),r()):this.isExecutingAnimation?(this.queuedAnimationFunction=r,new Promise(s=>{i=s})):r()}getAnimations(e){return[...this.animations,...e?te(this.variantManager.getAnimationGroups(),this.renameClonedAsset("")):[]].map((t,i)=>({...t,name:t.name||`UNNAMED_ANIMATION_${i}`})).filter((t,i,r)=>r.indexOf(r.find(s=>s.name===t.name))==i)}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 q.ActionManager(this.scene)),i.actionManager.registerAction(new H.ExecuteCodeAction(q.ActionManager.OnPointerOverTrigger,r=>{r.meshUnderPointer&&i.material&&this.materialSelectedObservable.notifyObservers({id:i.material.id,name:this.stripIdFromName(i.material.name)})})),i.actionManager.registerAction(new H.ExecuteCodeAction(q.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.queuedModelChanges.size}configureGlowLayer(){const e=i=>i instanceof B.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 s;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,r=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;for(const a of o.getChildMeshes(!1))a.alwaysSelectAsActiveMesh=!0}this.transformRoot.position=t,this.transformRoot.rotationQuaternion=i,this.transformRoot.scaling=r,this.canvasPanels=((s=this.contextService)==null?void 0:s.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=ee(this.modelInstance),this.configureModelInstance(this.modelInstance),this.animations=te(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 r=this.dynamicTextures.get(i);r&&t.getStaticContextDirty()&&r.isReady()&&(r.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)}getLastRequestedAnimation(){return this.lastRequestedAnimation}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.queuedModelChanges.values()).map(e=>e())),this.queuedModelChanges.clear(),this.scene.onAfterRenderObservable.addOnce(()=>{this.queuedModelAnimation&&(this.executeAnimation(this.queuedModelAnimation),this.queuedModelAnimation=void 0)})}}class V extends w.ArcRotateCamera{constructor(e,t,i,r,s,o,a,l){super(e,t,i,r,s,o,l),this.lastFocus=new p.Vector3(0,0,0),this._isRunningFramingBehavior=!1,this.panDenominator=1,this.panEnabled=!0,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))}updateConfiguration(e){e&&(this.lowerBetaLimit=e.camera.limits.min.beta??null,this.upperBetaLimit=e.camera.limits.max.beta??null,this.lowerAlphaLimit=e.camera.limits.min.alpha??null,this.upperAlphaLimit=e.camera.limits.max.alpha??null,e.camera.autoRotation.enabled?this.enableAutoRotationBehavior(e.camera.autoRotation.idleTimeMs):this.disableAutoRotationBehavior())}get isRunningFramingBehavior(){return this._isRunningFramingBehavior}set isRunningFramingBehavior(e){this._isRunningFramingBehavior=e,!e&&this.framingBehaviourCallback&&(this.framingBehaviourCallback(),this.framingBehaviourCallback=void 0)}setPanEnabled(e){this.panEnabled=e,this.panningSensibility=1e3/this.panDenominator,this.panningAxis=e?new p.Vector3(1,1,0):new p.Vector3(0,0,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=N(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 r=()=>{this.isRunningFramingBehavior=!1},s=N(this._scene),o=s.max.subtract(s.min),a=s.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(s.min,s.max,void 0,r),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){var l;const r=N(e),s=r.max.subtract(r.min),o=r.min.add(s.scale(.5)),a=new V("ProductCamera",-(Math.PI/2),Math.PI/2,s.length()*1.5,o,e,t);return a.setPanEnabled(((l=t.options)==null?void 0:l.noPan)!==void 0?!t.options.noPan:!0),a.panningInertia=0,a.panningOriginTarget.copyFrom(o),a.panDenominator=s.length(),a.onAfterCheckInputsObservable.addOnce(()=>{a.setPanEnabled(a.panEnabled)}),i&&(e.activeCamera=a),a}}function N(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 Je{constructor(e,t=!1,i=void 0){this.renderingPipeline=new Se.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,r,s,o,a,l,h,c,g,m,b,f,C,y,F,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=((r=e.bloom)==null?void 0:r.enabled)??u.bloom.enabled,this.renderingPipeline.bloomKernel=((s=e.bloom)==null?void 0:s.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=((l=e.bloom)==null?void 0:l.weight)??u.bloom.weight,this.renderingPipeline.chromaticAberrationEnabled=((h=e.chromaticAberration)==null?void 0:h.enabled)??u.chromaticAberration.enabled,this.renderingPipeline.chromaticAberration.aberrationAmount=((c=e.chromaticAberration)==null?void 0:c.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=((b=e.colorCurves)==null?void 0:b.enabled)??u.colorCurves.enabled,this.renderingPipeline.imageProcessing.colorCurves=e.colorCurves?this.updateColorCurve(e.colorCurves):new K.ColorCurves,this.renderingPipeline.depthOfFieldEnabled=((f=e.depthOfField)==null?void 0:f.enabled)??u.depthOfField.enabled,e.depthOfField)switch(e.depthOfField.blurLevel??u.depthOfField.blurLevel){case"Low":this.renderingPipeline.depthOfFieldBlurLevel=j.DepthOfFieldEffectBlurLevel.Low;break;case"Medium":this.renderingPipeline.depthOfFieldBlurLevel=j.DepthOfFieldEffectBlurLevel.Medium;break;case"High":this.renderingPipeline.depthOfFieldBlurLevel=j.DepthOfFieldEffectBlurLevel.High;break}if(this.renderingPipeline.depthOfField.focalLength=((C=e.depthOfField)==null?void 0:C.focalLength)??u.depthOfField.focalLength,this.renderingPipeline.depthOfField.fStop=((y=e.depthOfField)==null?void 0:y.fStop)??u.depthOfField.fStop,this.renderingPipeline.depthOfField.focusDistance=((F=e.depthOfField)==null?void 0:F.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=R.ImageProcessingConfiguration.TONEMAPPING_STANDARD;break;case"ACES":this.renderingPipeline.imageProcessing.toneMappingType=R.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=R.ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;break;case"Opaque":this.renderingPipeline.imageProcessing.vignetteBlendMode=R.ImageProcessingConfiguration.VIGNETTEMODE_OPAQUE;break}(pe=e.vignette)!=null&&pe.colorRgba?this.renderingPipeline.imageProcessing.vignetteColor=new v.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=v.Color4.FromHexString(e.vignette.colorHex):this.renderingPipeline.imageProcessing.vignetteColor=new v.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 K.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}}xe.GLTF2.GLTFLoader.RegisterExtension("glbPostProcessor",function(n){return new qe(n)}),S.SceneLoader.OnPluginActivatedObservable.add(n=>{if(n.name==="gltf"){const e=n;e.transparencyAsCoverage=!0}});function k(n){return new p.Vector3(n.x,n.y,n.z)}function z(n){return{x:n.x,y:n.y,z:n.z}}class et{constructor(e){var l;this.focusLostNotified=!1,this.focusLostObservable=new A.Observable,this.modelLoadEventCallbacks=[],this.validHighlightMaterials=[],this.modelContainers=new Map,this.plugins=[],this.initComplete=!1,this.isAnimatingCamera=!1,this.renderLoop=()=>{if(!this.engine.views)return;this.modelContainers.forEach(g=>{g.updateDynamicTextures()}),this.scene.autoClear=!0,this.scene.autoClearDepthAndStencil=!0;const h=this.engine.getRenderingCanvas();if(h)if(h.getContext("webgl2")??h.getContext("webgl")){const g=this.configuration.scene.clearColor,m=h.getContext("webgl2")??h.getContext("webgl");m.clearDepth(1),m.depthFunc(m.LEQUAL),m.clearStencil(0),m.clearColor(g.r,g.g,g.b,g.a),m.clear(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT|m.STENCIL_BUFFER_BIT)}else h.getContext("2d")?h.getContext("2d").clearRect(0,0,h.width,h.height):console.error("SpiffCommerce: Failed to get any context on the rendering canvas.");this.scene.render(),this.camera.isRunningFramingBehavior&&this.camera.getFramingBehavior().isUserIsMoving&&(this.camera.isRunningFramingBehavior=!1);const c=Math.max((this.camera.lowerRadiusLimit??1)*.01,.001);!this.camera.isRunningFramingBehavior&&!this.camera.target.equalsWithEpsilon(this.camera.lastFocus,c)&&!this.focusLostNotified&&(this.focusLostObservable.notifyObservers(void 0),this.focusLostNotified=!0)},this.configuration=new Q(e);const i=(()=>{if(!(e!=null&&e.noRender))return this.configuration.createCanvas()})(),r="1.5.7";ye.DracoCompression.Configuration={decoder:{wasmUrl:`https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,wasmBinaryUrl:`https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,fallbackUrl:`https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`}},i&&(i.getContext("webgl2")||i.getContext("webgl"));const s=console.log;console.log=()=>{};const o=i?new I.Engine(i,!0,{adaptToDeviceRatio:!0,limitDeviceRatio:2,premultipliedAlpha:!1,preserveDrawingBuffer:!!(e!=null&&e.backgroundImage),audioEngine:!1,stencil:this.configuration.highlights.enabled,forceSRGBBufferSupportState:!0}):new Ce.NullEngine;o.enableOfflineSupport=!1,o.doNotHandleContextLost=!0,console.log=s,o.hideLoadingUI(),window.addEventListener("resize",this.fireResizeEvent.bind(this)),this.engine=o,this.scene=new Me.Scene(o),this.camera=V.create(this.scene,this.configuration),this.scene.activeCamera=this.camera,this.renderingPipeline=new Je(this.scene,!1,this.camera),this.scene.clearColor=this.configuration.scene.clearColor;const a=G.CubeTexture.CreateFromPrefilteredData(this.configuration.scene.environment.file,this.scene);a.name="initial-environment-cube",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 je(this.scene,this.configuration.emissiveGlowIntensity),this.initPromise=new Promise(h=>{this.scene.onReadyObservable.addOnce(()=>{this.initComplete=!0,h()})})}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(E.Pan),this.reattachControls(e),this.engine.activeRenderLoops.length===0&&this.engine.runRenderLoop(this.renderLoop)}unregisterView(e){this.engine.unRegisterView(e),this.engine.views&&this.engine.views.length===0&&this.engine.stopRenderLoop(this.renderLoop)}getNumViewports(){var e;return((e=this.engine.views)==null?void 0:e.length)||0}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(r=>r.getIsInitialized()))return this.queuedCameraAnimation=e,Promise.resolve();let t=()=>{};const i=async()=>{this.isAnimatingCamera=!0,await Ge(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(r=>{t=r})):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===E.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 r=()=>{const s=this.configuration;this.camera.rerunFramingBehavior(()=>{s.camera.limits.min.radius&&(this.camera.lowerRadiusLimit=s.camera.limits.min.radius),s.camera.limits.max.radius&&(this.camera.upperRadiusLimit=s.camera.limits.max.radius),i()})};this.scene.onAfterRenderObservable.addOnce(r)}),this.isAnimatingCamera=!1,this.queuedAnimationFunction&&this.queuedAnimationFunction(),this.queuedAnimationFunction=void 0,e()};return this.isAnimatingCamera?(this.queuedAnimationFunction=t,new Promise(i=>{e=i})):t()}forceStopCameraAnimations(){var e;this.queuedAnimationFunction=void 0,this.queuedCameraAnimation=void 0,this.isAnimatingCamera=!1,(e=this.camera.framingBehavior)==null||e.stopAllAnimations(),this.scene.stopAnimation(this.camera)}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 w.ArcRotateCamera("screenshotCamera",0,0,0,p.Vector3.Zero(),this.scene),r=t.latDeg*Math.PI/180,s=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=s,i.beta=r,i.radius=t.radius||this.camera.radius,i.minZ=.01;try{return await new Promise(o=>{const a=this.scene.onBeforeRenderObservable.add(async()=>{this.scene.onBeforeRenderObservable.remove(a);const l=await we.Tools.CreateScreenshotUsingRenderTargetAsync(this.engine,i,e,"image/png",2,!0);return i.dispose(),o(l)});this.scene.render(),this.engine.endFrame()})}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,r=e.camera.limits.min.beta,s=e.camera.limits.max.beta;if(t===void 0||i===void 0||r===void 0||s===void 0)return!0;const o=[t,i],a=[r,s],l=o.every(c=>c===t),h=a.every(c=>c===r);return!l&&!h}fireResizeEvent(){this.getNumViewports()>0&&this.engine.resize()}setHighlights(e){this.scene.materials.forEach(()=>{this.scene.materials.forEach(i=>{i.emissiveIntensity===.18&&(i.emissiveColor=v.Color3.Black(),i.emissiveIntensity=1)})}),e.filter(i=>this.validHighlightMaterials.includes(i.name)).forEach(i=>{const r=this.scene.materials.find(s=>s.id===i.id);r&&(r.emissiveColor=new v.Color3(this.configuration.highlights.color.r,this.configuration.highlights.color.g,this.configuration.highlights.color.b),r.emissiveIntensity=.18)})}setRenderingPipelineConfiguration(e){this.renderingPipeline&&this.renderingPipeline.setConfiguration(e)}loadModel(e,t){const{refocusCamera:i=!0,progressHandler:r}=t??{},s=new Xe({enablePicking:this.configuration.highlights.enabled,modelDetails:e,scene:this.scene,previewService:this,progressHandler:r});return s.getInitializationPromise().then(()=>{if(this.modelContainers.size<=1&&i){const o=this.queuedCameraAnimation;this.forceStopCameraAnimations(),this.camera.rerunFramingBehavior(()=>{this.scene.onAfterRenderObservable.addOnce(()=>{o&&(this.executeCameraAnimation(o),this.queuedCameraAnimation=void 0)})},1)}}),this.configuration.highlights.enabled&&(s.registerMaterialSelectedCallback(o=>{this.setHighlights([o])}),s.registerMaterialDeselectedCallback(()=>{this.setHighlights([])})),this.modelContainers.set(s.getId(),s),this.triggerModelLoadEvent({eventType:"load",modelContainer:s}),s}async preloadModel(e){await D(e,this.scene)}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(r=>r.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 r=p.Matrix.Compose(k(i||{x:1,y:1,z:1}),p.Quaternion.FromEulerVector(k(t||{x:0,y:0,z:0})),k(e||{x:0,y:0,z:0})),s=p.Matrix.RotationAxis(p.Vector3.Up(),Math.PI),o=r.multiply(s),a=p.Vector3.Zero(),l=p.Quaternion.Identity(),h=p.Vector3.Zero();return o.decompose(h,l,a),l.multiplyInPlace(p.Quaternion.FromEulerAngles(0,Math.PI,0)),{position:z(a),rotation:z(l.toEulerAngles()),scale:z(h)}}updatePreviewOptions(e){var r,s;const t=new Q(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=G.CubeTexture.CreateFromPrefilteredData(t.scene.environment.file,this.scene),i.name="updated-environment-cube",i.rotationY=this.configuration.scene.environment.rotationY,this.scene.environmentTexture=i),i.rotationY=t.scene.environment.rotationY,this.scene.environmentIntensity=t.scene.environment.intensity,(r=t.options)!=null&&r.renderingPipelineConfiguration?this.renderingPipeline.setConfiguration(t.options.renderingPipelineConfiguration):(this.scene.imageProcessingConfiguration.exposure=t.lighting.exposure,this.scene.imageProcessingConfiguration.contrast=t.lighting.contrast),this.glowLayerManager.setIntensity(t.emissiveGlowIntensity),this.camera.updateConfiguration(t),this.camera.setPanEnabled(((s=t.options)==null?void 0:s.noPan)!==void 0?!t.options.noPan:!0),this.configuration=t}setHighlightMaterials(e){this.validHighlightMaterials=e}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)}static isSupported(){return I.Engine.isSupported()}}d.MaterialEffectMode=O,d.ProductCameraRig=E,d.REFLECTION_PROBE_RESOLUTION=Y,d.RenderingConfiguration=x,d.SpiffCommerce3DPreviewService=et,d.renderingPipelineDefaults=u,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/preview",
3
- "version": "5.10.3-0",
3
+ "version": "5.10.3-1",
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",