@spiffcommerce/preview 5.11.1-alpha.0 → 5.11.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.d.mts CHANGED
@@ -962,7 +962,7 @@ declare class Configuration {
962
962
  clearColor: Color4;
963
963
  transparentBackground: string | true | undefined;
964
964
  environment: {
965
- file: string;
965
+ file: string | undefined;
966
966
  intensity: number;
967
967
  rotationY: number;
968
968
  };
package/dist/index.esm.js CHANGED
@@ -106,7 +106,7 @@ class de {
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
- file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
109
+ file: (i = this.customOptions) == null ? void 0 : i.environmentFile,
110
110
  intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
111
111
  rotationY: (((s = this.customOptions) == null ? void 0 : s.environmentRotationY) ?? 0) * (Math.PI / 180)
112
112
  // Convert to radians
@@ -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, s, o, a, l, h, c, u, m, f;
120
+ var e, t, i, r, s, o, a, l, c, h, d, m, f;
121
121
  return {
122
122
  autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
123
123
  autoRotation: {
@@ -131,8 +131,8 @@ class de {
131
131
  radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
132
132
  },
133
133
  max: {
134
- alpha: (h = this.customOptions) != null && h.upperAlphaLimitDeg ? ((c = this.customOptions) == null ? void 0 : c.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
135
- beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
134
+ alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((h = this.customOptions) == null ? void 0 : h.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
135
+ beta: (d = this.customOptions) != null && d.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
136
136
  radius: (f = this.customOptions) == null ? void 0 : f.maxZoomOverride
137
137
  }
138
138
  }
@@ -202,7 +202,7 @@ class P {
202
202
  }
203
203
  }
204
204
  }
205
- const Ge = 128, d = {
205
+ const Ge = 128, u = {
206
206
  antiAliasing: {
207
207
  samples: 4,
208
208
  fxaaEnabled: !1
@@ -355,18 +355,18 @@ class Ve {
355
355
  !0
356
356
  );
357
357
  l.renderList = t(e);
358
- const h = s.getVerticesData("normal");
359
- if (!h)
358
+ const c = s.getVerticesData("normal");
359
+ if (!c)
360
360
  throw new Error(
361
361
  "Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
362
362
  );
363
363
  s.computeWorldMatrix(!0);
364
- const c = s.getWorldMatrix(), u = oe.TransformNormal(
365
- new oe(h[0], h[1], h[2]),
366
- c
364
+ const h = s.getWorldMatrix(), d = oe.TransformNormal(
365
+ new oe(c[0], c[1], c[2]),
366
+ h
367
367
  ).normalize(), m = Te.FromPositionAndNormal(
368
368
  s.position,
369
- u.scale(-1)
369
+ d.scale(-1)
370
370
  );
371
371
  l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
372
372
  }
@@ -408,23 +408,23 @@ class _e {
408
408
  }
409
409
  function He(n, e, t, i, r = "") {
410
410
  t.forEach((s) => {
411
- const o = s.getID(), a = s.getName(), l = s.getPanelSize && s.getPanelSize(), h = P.getDynamicTextureResolution(
411
+ const o = s.getID(), a = s.getName(), l = s.getPanelSize && s.getPanelSize(), c = P.getDynamicTextureResolution(
412
412
  (l == null ? void 0 : l.width) === 1 || (l == null ? void 0 : l.height) === 1
413
413
  );
414
- n.filter((u) => u.name === r + a).forEach((u) => {
414
+ n.filter((d) => d.name === r + a).forEach((d) => {
415
415
  const m = i.get(o), f = !1;
416
416
  if (m)
417
- ue(u, m), m.update(f);
417
+ ue(d, m), m.update(f);
418
418
  else {
419
419
  const p = Ue(
420
420
  a,
421
421
  e,
422
- h.width,
423
- h.height
422
+ c.width,
423
+ c.height
424
424
  );
425
425
  i.set(o, p), s.setStaticContext(
426
426
  p.getContext()
427
- ), ue(u, p), p.onLoadObservable.addOnce(() => {
427
+ ), ue(d, p), p.onLoadObservable.addOnce(() => {
428
428
  p.update(f);
429
429
  });
430
430
  }
@@ -460,7 +460,7 @@ function ge(n) {
460
460
  return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
461
461
  }
462
462
  function ve(n, e, t, i, r, s) {
463
- const o = r ? n.filter((c) => c.name === r) : n;
463
+ const o = r ? n.filter((h) => h.name === r) : n;
464
464
  if (o.length === 0) {
465
465
  console.warn(`No animations found for name: ${r}`);
466
466
  return;
@@ -468,23 +468,23 @@ function ve(n, e, t, i, r, s) {
468
468
  let a = 0;
469
469
  const l = () => {
470
470
  a++, a === o.length && s && s();
471
- }, h = (c, u, m, f, p) => {
472
- c.stop(), c.start(u, m, f, p), s && (u == !1 || u === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
471
+ }, c = (h, d, m, f, p) => {
472
+ h.stop(), h.start(d, m, f, p), s && (d == !1 || d === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
473
473
  l();
474
- }) : c.onAnimationLoopObservable.addOnce(() => {
474
+ }) : h.onAnimationLoopObservable.addOnce(() => {
475
475
  l();
476
476
  }));
477
477
  };
478
478
  if (i !== void 0 && t !== void 0 && i === t) {
479
- o.forEach((c) => {
480
- const u = ge(c), m = i * u;
481
- h(c, !1, me, m, m);
479
+ o.forEach((h) => {
480
+ const d = ge(h), m = i * d;
481
+ c(h, !1, me, m, m);
482
482
  });
483
483
  return;
484
484
  }
485
- o.forEach((c) => {
486
- const u = ge(c), m = i !== void 0 ? i * u : void 0, f = t !== void 0 ? t * u : void 0;
487
- h(c, e, me, m, f);
485
+ o.forEach((h) => {
486
+ const d = ge(h), m = i !== void 0 ? i * d : void 0, f = t !== void 0 ? t * d : void 0;
487
+ c(h, e, me, m, f);
488
488
  });
489
489
  }
490
490
  function We(n) {
@@ -492,11 +492,11 @@ function We(n) {
492
492
  e.reset(), e.stop();
493
493
  });
494
494
  }
495
- function Ye(n) {
495
+ function Qe(n) {
496
496
  const e = n.animationGroups;
497
497
  We(e);
498
498
  }
499
- function Qe(n, e, t) {
499
+ function Ye(n, e, t) {
500
500
  return new Promise((i) => {
501
501
  n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ze(e.alpha, 0, 2 * Math.PI));
502
502
  const r = [], s = t.target;
@@ -566,11 +566,11 @@ function T(n, e, t, i, r, s = 0, o = A.ANIMATIONLOOPMODE_CONSTANT) {
566
566
  y,
567
567
  r,
568
568
  o
569
- ), h = [];
570
- return s > 0 && h.push({ frame: 0, value: t }), h.push({ frame: y * s, value: t }), h.push({
569
+ ), c = [];
570
+ return s > 0 && c.push({ frame: 0, value: t }), c.push({ frame: y * s, value: t }), c.push({
571
571
  frame: y * (s + 1),
572
572
  value: i
573
- }), l.setKeys(h), l.setEasingFunction(a), l;
573
+ }), l.setKeys(c), l.setEasingFunction(a), l;
574
574
  }
575
575
  function Ze(n, e, t) {
576
576
  return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
@@ -665,37 +665,37 @@ class nt {
665
665
  ...t
666
666
  });
667
667
  const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
668
- (c) => c.name === a
668
+ (h) => h.name === a
669
669
  );
670
670
  if (l.length === 0) {
671
671
  s();
672
672
  return;
673
673
  }
674
- const h = new ke(this.scene);
675
- h.useDefaultLoadingScreen = !1, l.forEach(
676
- (c) => Xe(
674
+ const c = new ke(this.scene);
675
+ c.useDefaultLoadingScreen = !1, l.forEach(
676
+ (h) => Xe(
677
677
  t,
678
- c,
679
678
  h,
679
+ c,
680
680
  r
681
681
  )
682
- ), h.onProgress = (c, u, m) => {
683
- i && i(c / u * 100, 100, m.name);
684
- }, h.onFinish = (c) => {
685
- c.forEach((u) => {
686
- const m = u;
687
- i && i(100, 100, u.name), this.scene.materials.filter(
682
+ ), c.onProgress = (h, d, m) => {
683
+ i && i(h / d * 100, 100, m.name);
684
+ }, c.onFinish = (h) => {
685
+ h.forEach((d) => {
686
+ const m = d;
687
+ i && i(100, 100, d.name), this.scene.materials.filter(
688
688
  (p) => p.name === a
689
689
  ).forEach((p) => {
690
690
  tt(
691
- u.name,
691
+ d.name,
692
692
  p,
693
693
  t,
694
694
  m.texture
695
695
  );
696
696
  });
697
697
  }), s();
698
- }, h.loadAsync();
698
+ }, c.loadAsync();
699
699
  });
700
700
  }
701
701
  /**
@@ -714,34 +714,34 @@ class nt {
714
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(
715
715
  (b) => b !== e
716
716
  ), Promise.resolve(void 0);
717
- const h = (await z(i, this.scene, r)).instantiateModelsToScene(
717
+ const c = (await z(i, this.scene, r)).instantiateModelsToScene(
718
718
  this.renameClonedAsset,
719
719
  !0
720
720
  );
721
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));
722
- const c = s && s();
723
- if (c) {
724
- const b = o && o(), w = c.name ? this.renameClonedAsset(c.name) : void 0;
722
+ const h = s && s();
723
+ if (h) {
724
+ const b = o && o(), w = h.name ? this.renameClonedAsset(h.name) : void 0;
725
725
  if (ve(
726
- h.animationGroups,
727
- c.loop,
728
- c.to,
729
- c.from,
726
+ c.animationGroups,
727
+ h.loop,
728
+ h.to,
729
+ h.from,
730
730
  w
731
731
  ), b != null) {
732
732
  const R = a && a() || !0;
733
733
  $e(
734
- h.animationGroups,
734
+ c.animationGroups,
735
735
  b + (R ? 2 : 0),
736
736
  w
737
737
  );
738
738
  }
739
739
  }
740
- t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, h), this.loadedMaterialsForKey.set(e, we(h));
741
- const u = [];
740
+ t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, c), this.loadedMaterialsForKey.set(e, we(c));
741
+ const d = [];
742
742
  return this.materialVariantMap.forEach(async (b, w) => {
743
- u.push(this.applyMaterial(w, b));
744
- }), await Promise.all(u), h;
743
+ d.push(this.applyMaterial(w, b));
744
+ }), await Promise.all(d), c;
745
745
  }
746
746
  dispose() {
747
747
  this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
@@ -950,7 +950,7 @@ class st {
950
950
  );
951
951
  }), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, i();
952
952
  };
953
- return t ? (Ye(this.scene), r()) : this.isExecutingAnimation ? (this.queuedAnimationFunction = r, new Promise((s) => {
953
+ return t ? (Qe(this.scene), r()) : this.isExecutingAnimation ? (this.queuedAnimationFunction = r, new Promise((s) => {
954
954
  i = s;
955
955
  })) : r();
956
956
  }
@@ -1323,7 +1323,7 @@ class rt {
1323
1323
  i ? [i] : void 0,
1324
1324
  !1
1325
1325
  // Disable automatic build
1326
- ), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(d));
1326
+ ), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(u));
1327
1327
  }
1328
1328
  dispose() {
1329
1329
  this.renderingPipeline.dispose();
@@ -1332,16 +1332,16 @@ class rt {
1332
1332
  return this.currentConfiguration;
1333
1333
  }
1334
1334
  setConfiguration(e) {
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;
1335
+ var t, i, r, s, o, a, l, c, h, d, m, f, p, b, w, R, V, _, H, U, K, W, Q, Y, Z, $, j, X, J, ee, te, ie, ne;
1336
1336
  if (this.renderingPipeline.isSupported) {
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(
1337
+ 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 = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? u.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((h = e.chromaticAberration) == null ? void 0 : h.aberrationAmount) ?? u.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((d = e.chromaticAberration) == null ? void 0 : d.radialIntensity) ?? u.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new re(
1338
1338
  e.chromaticAberration.direction.x,
1339
1339
  e.chromaticAberration.direction.y
1340
1340
  ) : new re(
1341
- d.chromaticAberration.direction.x,
1342
- d.chromaticAberration.direction.y
1343
- ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((f = e.colorCurves) == null ? void 0 : f.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new he(), this.renderingPipeline.depthOfFieldEnabled = ((p = e.depthOfField) == null ? void 0 : p.enabled) ?? d.depthOfField.enabled, e.depthOfField)
1344
- switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
1341
+ u.chromaticAberration.direction.x,
1342
+ u.chromaticAberration.direction.y
1343
+ ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((f = e.colorCurves) == null ? void 0 : f.enabled) ?? u.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new he(), this.renderingPipeline.depthOfFieldEnabled = ((p = e.depthOfField) == null ? void 0 : p.enabled) ?? u.depthOfField.enabled, e.depthOfField)
1344
+ switch (e.depthOfField.blurLevel ?? u.depthOfField.blurLevel) {
1345
1345
  case "Low":
1346
1346
  this.renderingPipeline.depthOfFieldBlurLevel = L.Low;
1347
1347
  break;
@@ -1352,8 +1352,8 @@ class rt {
1352
1352
  this.renderingPipeline.depthOfFieldBlurLevel = L.High;
1353
1353
  break;
1354
1354
  }
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)
1356
- switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
1355
+ if (this.renderingPipeline.depthOfField.focalLength = ((b = e.depthOfField) == null ? void 0 : b.focalLength) ?? u.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((w = e.depthOfField) == null ? void 0 : w.fStop) ?? u.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((R = e.depthOfField) == null ? void 0 : R.focusDistance) ?? u.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? u.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((_ = e.grain) == null ? void 0 : _.enabled) ?? u.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? u.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? u.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? u.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((W = e.misc) == null ? void 0 : W.exposure) ?? u.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((Q = e.misc) == null ? void 0 : Q.toneMappingEnabled) ?? u.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1356
+ switch (e.misc.toneMappingType ?? u.misc.toneMappingType) {
1357
1357
  case "Standard":
1358
1358
  this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_STANDARD;
1359
1359
  break;
@@ -1361,8 +1361,8 @@ class rt {
1361
1361
  this.renderingPipeline.imageProcessing.toneMappingType = E.TONEMAPPING_ACES;
1362
1362
  break;
1363
1363
  }
1364
- if (this.renderingPipeline.sharpenEnabled = ((Q = e.sharpen) == null ? void 0 : Q.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Z = e.sharpen) == null ? void 0 : Z.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = (($ = e.sharpen) == null ? void 0 : $.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((j = e.vignette) == null ? void 0 : j.enabled) ?? d.vignette.enabled, (X = e.vignette) != null && X.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
1365
- switch (((J = e.vignette) == null ? void 0 : J.blendMode) ?? d.vignette.blendMode) {
1364
+ if (this.renderingPipeline.sharpenEnabled = ((Y = e.sharpen) == null ? void 0 : Y.enabled) ?? u.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Z = e.sharpen) == null ? void 0 : Z.colorAmount) ?? u.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = (($ = e.sharpen) == null ? void 0 : $.edgeAmount) ?? u.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((j = e.vignette) == null ? void 0 : j.enabled) ?? u.vignette.enabled, (X = e.vignette) != null && X.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)
1365
+ switch (((J = e.vignette) == null ? void 0 : J.blendMode) ?? u.vignette.blendMode) {
1366
1366
  case "Multiply":
1367
1367
  this.renderingPipeline.imageProcessing.vignetteBlendMode = E.VIGNETTEMODE_MULTIPLY;
1368
1368
  break;
@@ -1376,11 +1376,11 @@ class rt {
1376
1376
  e.vignette.colorRgba.b,
1377
1377
  e.vignette.colorRgba.a
1378
1378
  ) : (te = e.vignette) != null && te.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = v.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new v(
1379
- d.vignette.colorRgba.r,
1380
- d.vignette.colorRgba.g,
1381
- d.vignette.colorRgba.b,
1382
- d.vignette.colorRgba.a
1383
- ), this.renderingPipeline.imageProcessing.vignetteStretch = ((ie = e.vignette) == null ? void 0 : ie.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ne = e.vignette) == null ? void 0 : ne.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1379
+ u.vignette.colorRgba.r,
1380
+ u.vignette.colorRgba.g,
1381
+ u.vignette.colorRgba.b,
1382
+ u.vignette.colorRgba.a
1383
+ ), this.renderingPipeline.imageProcessing.vignetteStretch = ((ie = e.vignette) == null ? void 0 : ie.stretch) ?? u.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ne = e.vignette) == null ? void 0 : ne.weight) ?? u.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1384
1384
  }
1385
1385
  }
1386
1386
  updateColorCurve(e) {
@@ -1403,24 +1403,24 @@ function F(n) {
1403
1403
  function S(n) {
1404
1404
  return { x: n.x, y: n.y, z: n.z };
1405
1405
  }
1406
- class Qt {
1406
+ class Yt {
1407
1407
  constructor(e) {
1408
- var l;
1408
+ var a;
1409
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 = () => {
1410
1410
  if (!this.engine.views)
1411
1411
  return;
1412
- this.modelContainers.forEach((u) => {
1413
- u.updateDynamicTextures();
1412
+ this.modelContainers.forEach((h) => {
1413
+ h.updateDynamicTextures();
1414
1414
  }), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0;
1415
- const h = this.engine.getRenderingCanvas();
1416
- if (h)
1417
- if (h.getContext("webgl2") ?? h.getContext("webgl")) {
1418
- const u = this.configuration.scene.clearColor, m = h.getContext("webgl2") ?? h.getContext("webgl");
1419
- m.clearDepth(1), m.depthFunc(m.LEQUAL), m.clearStencil(0), m.clearColor(u.r, u.g, u.b, u.a), m.clear(
1420
- m.COLOR_BUFFER_BIT | m.DEPTH_BUFFER_BIT | m.STENCIL_BUFFER_BIT
1415
+ const l = this.engine.getRenderingCanvas();
1416
+ if (l)
1417
+ if (l.getContext("webgl2") ?? l.getContext("webgl")) {
1418
+ const h = this.configuration.scene.clearColor, d = l.getContext("webgl2") ?? l.getContext("webgl");
1419
+ d.clearDepth(1), d.depthFunc(d.LEQUAL), d.clearStencil(0), d.clearColor(h.r, h.g, h.b, h.a), d.clear(
1420
+ d.COLOR_BUFFER_BIT | d.DEPTH_BUFFER_BIT | d.STENCIL_BUFFER_BIT
1421
1421
  );
1422
1422
  } else
1423
- h.getContext("2d") ? h.getContext("2d").clearRect(0, 0, h.width, h.height) : console.error(
1423
+ l.getContext("2d") ? l.getContext("2d").clearRect(0, 0, l.width, l.height) : console.error(
1424
1424
  "SpiffCommerce: Failed to get any context on the rendering canvas."
1425
1425
  );
1426
1426
  this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
@@ -1450,23 +1450,25 @@ class Qt {
1450
1450
  stencil: this.configuration.highlights.enabled,
1451
1451
  forceSRGBBufferSupportState: !0
1452
1452
  }) : new Ce();
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(
1453
+ if (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(
1454
1454
  this.scene,
1455
1455
  !1,
1456
1456
  this.camera
1457
- ), this.scene.clearColor = this.configuration.scene.clearColor;
1458
- const a = se.CreateFromPrefilteredData(
1459
- this.configuration.scene.environment.file,
1460
- this.scene
1461
- );
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(
1457
+ ), this.scene.clearColor = this.configuration.scene.clearColor, this.configuration.scene.environment.file) {
1458
+ const l = se.CreateFromPrefilteredData(
1459
+ this.configuration.scene.environment.file,
1460
+ this.scene
1461
+ );
1462
+ l.name = "initial-environment-cube", l.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = l;
1463
+ }
1464
+ this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (a = this.configuration.options) != null && a.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1463
1465
  this.configuration.options.renderingPipelineConfiguration
1464
1466
  ) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
1465
1467
  this.scene,
1466
1468
  this.configuration.emissiveGlowIntensity
1467
- ), this.initPromise = new Promise((h) => {
1469
+ ), this.initPromise = new Promise((l) => {
1468
1470
  this.scene.onReadyObservable.addOnce(() => {
1469
- this.initComplete = !0, h();
1471
+ this.initComplete = !0, l();
1470
1472
  });
1471
1473
  });
1472
1474
  }
@@ -1516,7 +1518,7 @@ class Qt {
1516
1518
  let t = () => {
1517
1519
  };
1518
1520
  const i = async () => {
1519
- this.isAnimatingCamera = !0, await Qe(
1521
+ this.isAnimatingCamera = !0, await Ye(
1520
1522
  this.scene,
1521
1523
  this.scene.activeCamera,
1522
1524
  e
@@ -1624,8 +1626,8 @@ class Qt {
1624
1626
  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
1627
  if (t === void 0 || i === void 0 || r === void 0 || s === void 0)
1626
1628
  return !0;
1627
- const o = [t, i], a = [r, s], l = o.every((c) => c === t), h = a.every((c) => c === r);
1628
- return !l && !h;
1629
+ const o = [t, i], a = [r, s], l = o.every((h) => h === t), c = a.every((h) => h === r);
1630
+ return !l && !c;
1629
1631
  }
1630
1632
  fireResizeEvent() {
1631
1633
  this.getNumViewports() > 0 && this.engine.resize();
@@ -1719,11 +1721,11 @@ class Qt {
1719
1721
  F(t || { x: 0, y: 0, z: 0 })
1720
1722
  ),
1721
1723
  F(e || { x: 0, y: 0, z: 0 })
1722
- ), s = ae.RotationAxis(g.Up(), Math.PI), o = r.multiply(s), a = g.Zero(), l = x.Identity(), h = g.Zero();
1723
- return o.decompose(h, l, a), l.multiplyInPlace(x.FromEulerAngles(0, Math.PI, 0)), {
1724
+ ), s = ae.RotationAxis(g.Up(), Math.PI), o = r.multiply(s), a = g.Zero(), l = x.Identity(), c = g.Zero();
1725
+ return o.decompose(c, l, a), l.multiplyInPlace(x.FromEulerAngles(0, Math.PI, 0)), {
1724
1726
  position: S(a),
1725
1727
  rotation: S(l.toEulerAngles()),
1726
- scale: S(h)
1728
+ scale: S(c)
1727
1729
  };
1728
1730
  }
1729
1731
  updatePreviewOptions(e) {
@@ -1731,10 +1733,10 @@ class Qt {
1731
1733
  const t = new de(e);
1732
1734
  this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
1733
1735
  let i = this.scene.environmentTexture;
1734
- this.configuration.scene.environment.file !== t.scene.environment.file && (i = se.CreateFromPrefilteredData(
1736
+ t.scene.environment.file && this.configuration.scene.environment.file !== t.scene.environment.file && (i = se.CreateFromPrefilteredData(
1735
1737
  t.scene.environment.file,
1736
1738
  this.scene
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(
1739
+ ), i.name = "updated-environment-cube", 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(
1738
1740
  t.options.renderingPipelineConfiguration
1739
1741
  ) : (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(
1740
1742
  ((s = t.options) == null ? void 0 : s.noPan) !== void 0 ? !t.options.noPan : !0
@@ -1765,6 +1767,6 @@ export {
1765
1767
  D as ProductCameraRig,
1766
1768
  Ge as REFLECTION_PROBE_RESOLUTION,
1767
1769
  P as RenderingConfiguration,
1768
- Qt as SpiffCommerce3DPreviewService,
1769
- d as renderingPipelineDefaults
1770
+ Yt as SpiffCommerce3DPreviewService,
1771
+ u as renderingPipelineDefaults
1770
1772
  };
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=(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"})});
1
+ (function(c,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):(c=typeof globalThis<"u"?globalThis:c||self,w(c.Preview={},c.arcRotateCamera,c.engine,c.nullEngine,c.sceneLoader,c.cubeTexture,c.math_color,c.math_vector,c.dracoCompression,c.observable,c.tools,c.scene,c.glTF,c.glTFFileLoader,c.pbrMaterial,c.mirrorTexture,c.math,c.reflectionProbe,c.glowLayer,c.actionManager,c.directActions,c.mesh,c.transformNode,c.dynamicTexture,c.texture,c.animation,c.easing,c.assetsManager,c.colorCurves,c.imageProcessingConfiguration,c.RenderPipeline,c.depthOfFieldEffect))})(this,function(c,w,I,Ce,S,G,v,m,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,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,u,h,g,p,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:(u=this.customOptions)!=null&&u.upperAlphaLimitDeg?((h=this.customOptions)==null?void 0:h.upperAlphaLimitDeg)*Math.PI/180:void 0,beta:(g=this.customOptions)!=null&&g.upperBetaLimitDeg?((p=this.customOptions)==null?void 0:p.upperBetaLimitDeg)*Math.PI/180:void 0,radius:(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,d={antiAliasing:{samples:4,fxaaEnabled:!1},bloom:{enabled:!1,kernel:64,scale:.5,threshold:.9,weight:.15},chromaticAberration:{enabled:!1,aberrationAmount:30,direction:{x:0,y:0},radialIntensity:0},colorCurves:{enabled:!1},depthOfField:{enabled:!1,blurLevel:"Low",focalLength:50,focusDistance:2e3,fStop:1.4,lensSize:50},grain:{enabled:!1,animated:!1,intensity:30},misc:{contrast:1,exposure:1,toneMappingEnabled:!1,toneMappingType:"Standard"},sharpen:{enabled:!1,colorAmount:1,edgeAmount:.3},vignette:{enabled:!1,blendMode:"Multiply",cameraFov:.5,center:{x:0,y:0},colorHex:"#000000ff",colorRgba:{r:0,g:0,b:0,a:1},stretch:0,weight:1}};class 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 u=s.getVerticesData("normal");if(!u)throw new Error("Mirror attribute specified on: "+s.name+"But no normals exist to generate a mirror from!");s.computeWorldMatrix(!0);const h=s.getWorldMatrix(),g=T.Vector3.TransformNormal(new T.Vector3(u[0],u[1],u[2]),h).normalize(),p=T.Plane.FromPositionAndNormal(s.position,g.scale(-1));l.mirrorPlane=p,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(),u=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 p=i.get(o),b=!1;if(p)Z(g,p),p.update(b);else{const f=Ve(a,e,u.width,u.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(h=>h.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()},u=(h,g,p,b,f)=>{h.stop(),h.start(g,p,b,f),s&&(g==!1||g===void 0&&!h.loopAnimation?h.onAnimationGroupEndObservable.addOnce(()=>{l()}):h.onAnimationLoopObservable.addOnce(()=>{l()}))};if(i!==void 0&&t!==void 0&&i===t){o.forEach(h=>{const g=_(h),p=i*g;u(h,!1,$,p,p)});return}o.forEach(h=>{const g=_(h),p=i!==void 0?i*g:void 0,b=t!==void 0?t*g:void 0;u(h,e,$,p,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 m.Vector3().copyFrom(e.target),new m.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),u=[];return s>0&&u.push({frame:0,value:t}),u.push({frame:P*s,value:t}),u.push({frame:P*(s+1),value:i}),l.setKeys(u),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(h=>h.name===a);if(l.length===0){s();return}const u=new Ie.AssetsManager(this.scene);u.useDefaultLoadingScreen=!1,l.forEach(h=>We(t,h,u,r)),u.onProgress=(h,g,p)=>{i&&i(h/g*100,100,p.name)},u.onFinish=h=>{h.forEach(g=>{const p=g;i&&i(100,100,g.name),this.scene.materials.filter(f=>f.name===a).forEach(f=>{Ze(g.name,f,t,p.texture)})}),s()},u.loadAsync()})}async applyModel(e,t,i,r,s,o,a){var p,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),(p=this.loadedContainerForKey.get(e))==null||p.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 u=(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 h=s&&s();if(h){const C=o&&o(),y=h.name?this.renameClonedAsset(h.name):void 0;if(X(u.animationGroups,h.loop,h.to,h.from,y),C!=null){const F=a&&a()||!0;Ue(u.animationGroups,C+(F?2:0),y)}}t&&await this.setBaseModelEnabled(!1),this.loadedContainerForKey.set(e,u),this.loadedMaterialsForKey.set(e,ee(u));const g=[];return this.materialVariantMap.forEach(async(C,y)=>{g.push(this.applyMaterial(y,C))}),await Promise.all(g),u}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 m.Vector3(e.x,e.y,e.z)}get rotation(){var e;if(!((e=this.transformRoot)!=null&&e.rotationQuaternion))throw new Error("ModelContainer disposed prior to requesting rotation!");return this.transformRoot.rotationQuaternion.toEulerAngles()}set rotation(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting rotation!");this.transformRoot.rotationQuaternion=m.Quaternion.FromEulerAngles(e.x,e.y,e.z)}get scale(){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to requesting scale!");return this.transformRoot.scaling}set scale(e){if(!this.transformRoot)throw new Error("ModelContainer disposed prior to setting scale!");this.transformRoot.scaling=new m.Vector3(e.x,e.y,e.z)}attachPickingHandler(e){e.rootNodes.forEach(t=>{t.getChildMeshes(!1).forEach(i=>{i.name==="targetcube_t"||i.name==="backgroundShell"||(i.actionManager||(i.actionManager=new 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=m.Vector3.Zero(),this.transformRoot.rotationQuaternion=m.Quaternion.Identity(),this.transformRoot.scaling=m.Vector3.One();for(const o of e.rootNodes){o.parent=this.transformRoot;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 m.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 m.Vector3(1,1,0):new m.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 m.Vector3(-1,-1,-1),max:new m.Vector3(1,1,1)};const e=n.meshes.filter(t=>t.name.toLowerCase().endsWith("_t")||t.name.toLowerCase().includes("_t_"));return n.getWorldExtends(t=>t.isVisible&&t.isEnabled()&&(e.length===0||e.includes(t)))}class 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(d))}dispose(){this.renderingPipeline.dispose()}getConfiguration(){return this.currentConfiguration}setConfiguration(e){var t,i,r,s,o,a,l,u,h,g,p,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)??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=((u=e.chromaticAberration)==null?void 0:u.enabled)??d.chromaticAberration.enabled,this.renderingPipeline.chromaticAberration.aberrationAmount=((h=e.chromaticAberration)==null?void 0:h.aberrationAmount)??d.chromaticAberration.aberrationAmount,this.renderingPipeline.chromaticAberration.radialIntensity=((g=e.chromaticAberration)==null?void 0:g.radialIntensity)??d.chromaticAberration.radialIntensity,this.renderingPipeline.chromaticAberration.direction=(p=e.chromaticAberration)!=null&&p.direction?new m.Vector2(e.chromaticAberration.direction.x,e.chromaticAberration.direction.y):new m.Vector2(d.chromaticAberration.direction.x,d.chromaticAberration.direction.y),this.renderingPipeline.imageProcessing.colorCurvesEnabled=((b=e.colorCurves)==null?void 0:b.enabled)??d.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)??d.depthOfField.enabled,e.depthOfField)switch(e.depthOfField.blurLevel??d.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)??d.depthOfField.focalLength,this.renderingPipeline.depthOfField.fStop=((y=e.depthOfField)==null?void 0:y.fStop)??d.depthOfField.fStop,this.renderingPipeline.depthOfField.focusDistance=((F=e.depthOfField)==null?void 0:F.focusDistance)??d.depthOfField.focusDistance,this.renderingPipeline.depthOfField.lensSize=((ie=e.depthOfField)==null?void 0:ie.lensSize)??d.depthOfField.lensSize,this.renderingPipeline.grainEnabled=((ne=e.grain)==null?void 0:ne.enabled)??d.grain.enabled,this.renderingPipeline.grain.animated=((se=e.grain)==null?void 0:se.animated)??d.grain.animated,this.renderingPipeline.grain.intensity=((re=e.grain)==null?void 0:re.intensity)??d.grain.intensity,this.renderingPipeline.imageProcessing.contrast=((ae=e.misc)==null?void 0:ae.contrast)??d.misc.contrast,this.renderingPipeline.imageProcessing.exposure=((oe=e.misc)==null?void 0:oe.exposure)??d.misc.exposure,this.renderingPipeline.imageProcessing.toneMappingEnabled=((le=e.misc)==null?void 0:le.toneMappingEnabled)??d.misc.toneMappingEnabled,this.renderingPipeline.imageProcessing.toneMappingEnabled)switch(e.misc.toneMappingType??d.misc.toneMappingType){case"Standard":this.renderingPipeline.imageProcessing.toneMappingType=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)??d.sharpen.enabled,this.renderingPipeline.sharpen.colorAmount=((ce=e.sharpen)==null?void 0:ce.colorAmount)??d.sharpen.colorAmount,this.renderingPipeline.sharpen.edgeAmount=((de=e.sharpen)==null?void 0:de.edgeAmount)??d.sharpen.edgeAmount,this.renderingPipeline.imageProcessing.vignetteEnabled=((ue=e.vignette)==null?void 0:ue.enabled)??d.vignette.enabled,(ge=e.vignette)!=null&&ge.center?(this.renderingPipeline.imageProcessing.vignetteCenterX=e.vignette.center.x,this.renderingPipeline.imageProcessing.vignetteCenterY=e.vignette.center.y):(this.renderingPipeline.imageProcessing.vignetteCenterX=d.vignette.center.x,this.renderingPipeline.imageProcessing.vignetteCenterY=d.vignette.center.y),e.vignette)switch(((me=e.vignette)==null?void 0:me.blendMode)??d.vignette.blendMode){case"Multiply":this.renderingPipeline.imageProcessing.vignetteBlendMode=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(d.vignette.colorRgba.r,d.vignette.colorRgba.g,d.vignette.colorRgba.b,d.vignette.colorRgba.a),this.renderingPipeline.imageProcessing.vignetteStretch=((be=e.vignette)==null?void 0:be.stretch)??d.vignette.stretch,this.renderingPipeline.imageProcessing.vignetteWeight=((ve=e.vignette)==null?void 0:ve.weight)??d.vignette.weight,this.renderingPipeline.prepare(),this.currentConfiguration=e}}updateColorCurve(e){const t=new 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 m.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 a;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(h=>{h.updateDynamicTextures()}),this.scene.autoClear=!0,this.scene.autoClearDepthAndStencil=!0;const l=this.engine.getRenderingCanvas();if(l)if(l.getContext("webgl2")??l.getContext("webgl")){const h=this.configuration.scene.clearColor,g=l.getContext("webgl2")??l.getContext("webgl");g.clearDepth(1),g.depthFunc(g.LEQUAL),g.clearStencil(0),g.clearColor(h.r,h.g,h.b,h.a),g.clear(g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT|g.STENCIL_BUFFER_BIT)}else l.getContext("2d")?l.getContext("2d").clearRect(0,0,l.width,l.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 u=Math.max((this.camera.lowerRadiusLimit??1)*.01,.001);!this.camera.isRunningFramingBehavior&&!this.camera.target.equalsWithEpsilon(this.camera.lastFocus,u)&&!this.focusLostNotified&&(this.focusLostObservable.notifyObservers(void 0),this.focusLostNotified=!0)},this.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;if(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,this.configuration.scene.environment.file){const l=G.CubeTexture.CreateFromPrefilteredData(this.configuration.scene.environment.file,this.scene);l.name="initial-environment-cube",l.rotationY=this.configuration.scene.environment.rotationY,this.scene.environmentTexture=l}this.scene.environmentIntensity=this.configuration.scene.environment.intensity,(a=this.configuration.options)!=null&&a.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(l=>{this.scene.onReadyObservable.addOnce(()=>{this.initComplete=!0,l()})})}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 m.Vector3(e.target.x,e.target.y,e.target.z),this.camera.radius=e.radius,this.camera.alpha=e.latDeg,this.camera.beta=e.lonDeg)}setCameraState(e){var t,i;if(!((t=this.engine)!=null&&t.views)||!((i=this.engine)!=null&&i.views[0]))throw new Error("No views attached, camera state requires a view to attach controls onto.");e===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,m.Vector3.Zero(),this.scene),r=t.latDeg*Math.PI/180,s=t.lonDeg*Math.PI/180;i.target=t.target?new m.Vector3(t.target.x,t.target.y,t.target.z):m.Vector3.Zero(),i.alpha=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(h=>h===t),u=a.every(h=>h===r);return!l&&!u}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=m.Matrix.Compose(k(i||{x:1,y:1,z:1}),m.Quaternion.FromEulerVector(k(t||{x:0,y:0,z:0})),k(e||{x:0,y:0,z:0})),s=m.Matrix.RotationAxis(m.Vector3.Up(),Math.PI),o=r.multiply(s),a=m.Vector3.Zero(),l=m.Quaternion.Identity(),u=m.Vector3.Zero();return o.decompose(u,l,a),l.multiplyInPlace(m.Quaternion.FromEulerAngles(0,Math.PI,0)),{position:z(a),rotation:z(l.toEulerAngles()),scale:z(u)}}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;t.scene.environment.file&&this.configuration.scene.environment.file!==t.scene.environment.file&&(i=G.CubeTexture.CreateFromPrefilteredData(t.scene.environment.file,this.scene),i.name="updated-environment-cube",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()}}c.MaterialEffectMode=O,c.ProductCameraRig=E,c.REFLECTION_PROBE_RESOLUTION=Y,c.RenderingConfiguration=x,c.SpiffCommerce3DPreviewService=et,c.renderingPipelineDefaults=d,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/preview",
3
- "version": "5.11.1-alpha.0",
3
+ "version": "5.11.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",