webim-adapter 2.0.0 → 2.0.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.
@@ -1385,6 +1385,7 @@ function vt({ count: e, renderSlide: t, autoplay: n = !0, interval: r = 5, heigh
1385
1385
  position: "relative",
1386
1386
  overflow: "hidden",
1387
1387
  width: "100%",
1388
+ height: a,
1388
1389
  touchAction: "pan-y",
1389
1390
  userSelect: _ ? "none" : void 0,
1390
1391
  cursor: _ ? "grabbing" : void 0,
@@ -1393,7 +1394,7 @@ function vt({ count: e, renderSlide: t, autoplay: n = !0, interval: r = 5, heigh
1393
1394
  children: [/* @__PURE__ */ u("div", {
1394
1395
  style: {
1395
1396
  display: "flex",
1396
- height: a,
1397
+ height: "100%",
1397
1398
  transform: `translateX(calc(${-y * 100}% + ${_?.dx ?? 0}px))`,
1398
1399
  transition: _ ? "none" : "transform 450ms ease"
1399
1400
  },
@@ -6343,7 +6344,7 @@ var Lr = [
6343
6344
  new Set(Lr.filter((e) => e.ssr === "shell").flatMap((e) => e.keys));
6344
6345
  //#endregion
6345
6346
  //#region ../ui/src/components/builder/three/runtime.js
6346
- var zr = "0.185.1", Br = "4.3.1", Vr = "https://cdn.jsdelivr.net/npm", Hr = `${Vr}/three@${zr}/build/three.module.js`, Ur = `${Vr}/@google/model-viewer@${Br}/dist/model-viewer.min.js`, Wr = (e) => import(
6347
+ var zr = "0.185.1", Br = "4.2.0", Vr = "https://cdn.jsdelivr.net/npm", Hr = `${Vr}/three@${zr}/+esm`, Ur = `${Vr}/@google/model-viewer@${Br}/dist/model-viewer.min.js`, Wr = (e) => import(
6347
6348
  /* @vite-ignore */
6348
6349
  /* webpackIgnore: true */
6349
6350
  e
@@ -6356,12 +6357,12 @@ function Kr(e) {
6356
6357
  });
6357
6358
  return Gr.set(e, t), t;
6358
6359
  }
6359
- var qr = () => Kr(Hr);
6360
- function Jr() {
6360
+ var qr = () => Kr(Hr), Jr = (e) => Kr(`${Vr}/three@${zr}/examples/jsm/${e}/+esm`);
6361
+ function Yr() {
6361
6362
  return typeof window < "u" && window.customElements?.get("model-viewer") ? Promise.resolve(null) : Kr(Ur);
6362
6363
  }
6363
- var Yr = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, Xr = (e = 2) => Math.min(typeof window > "u" ? 1 : window.devicePixelRatio || 1, e);
6364
- function Zr(e, t) {
6364
+ var Xr = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, Zr = (e = 2) => Math.min(typeof window > "u" ? 1 : window.devicePixelRatio || 1, e);
6365
+ function Qr(e, t) {
6365
6366
  let n = 0, r = 0, i = 0, a = !0, o = (e) => {
6366
6367
  n = requestAnimationFrame(o), i ||= e;
6367
6368
  let a = r ? (e - r) / 1e3 : 0;
@@ -6380,7 +6381,7 @@ function Zr(e, t) {
6380
6381
  s(), l?.disconnect(), document.removeEventListener("visibilitychange", c);
6381
6382
  };
6382
6383
  }
6383
- function Qr(e, t, n = {}) {
6384
+ function $r(e, t, n = {}) {
6384
6385
  let r = {
6385
6386
  radius: n.distance ?? 4,
6386
6387
  polar: n.polar ?? Math.PI / 2.4,
@@ -6429,13 +6430,13 @@ function Qr(e, t, n = {}) {
6429
6430
  }
6430
6431
  //#endregion
6431
6432
  //#region ../ui/src/components/builder/three/views.jsx
6432
- var $r = (e, t) => Number.isFinite(Number(e)) && Number(e) > 0 ? Number(e) : t, ei = (e, t) => (Number.isFinite(Number(e)) ? Number(e) : t) / 100, ti = (e) => (Number.isFinite(Number(e)) ? Number(e) : 0) * Math.PI / 180;
6433
- function ni({ label: e, note: t, height: n, nodeRef: r, style: i }) {
6433
+ var ei = (e, t) => Number.isFinite(Number(e)) && Number(e) > 0 ? Number(e) : t, ti = (e, t) => (Number.isFinite(Number(e)) ? Number(e) : t) / 100, ni = (e) => (Number.isFinite(Number(e)) ? Number(e) : 0) * Math.PI / 180, ri = (e) => typeof e == "string" && !!e.trim();
6434
+ function ii({ label: e, note: t, height: n, nodeRef: r, style: i }) {
6434
6435
  return /* @__PURE__ */ d("div", {
6435
6436
  ref: r,
6436
6437
  style: {
6437
6438
  ...A(i),
6438
- minHeight: $r(n, 320),
6439
+ minHeight: ei(n, 320),
6439
6440
  display: "flex",
6440
6441
  flexDirection: "column",
6441
6442
  alignItems: "center",
@@ -6463,25 +6464,24 @@ function ni({ label: e, note: t, height: n, nodeRef: r, style: i }) {
6463
6464
  }) : null]
6464
6465
  });
6465
6466
  }
6466
- function ri({ src: e, poster: t, alt: n, height: r, bg: a, autoRotate: o, rotateDelay: s, cameraControls: l, ar: d, exposure: f, shadow: p, fieldOfView: m, environment: h, style: g, nodeRef: _, inert: v }) {
6467
+ function ai({ src: e, poster: t, alt: n, height: r, bg: a, autoRotate: o, rotateDelay: s, cameraControls: l, ar: d, exposure: f, shadow: p, fieldOfView: m, environment: h, style: g, nodeRef: _, inert: v }) {
6467
6468
  let [y, b] = c(typeof window < "u" && !!window.customElements?.get("model-viewer")), [x, S] = c(!1);
6468
6469
  i(() => {
6469
6470
  if (y || !e) return;
6470
6471
  let t = !0;
6471
- return Jr().then(() => t && b(!0), () => t && S(!0)), () => {
6472
+ return Yr().then(() => t && b(!0), () => t && S(!0)), () => {
6472
6473
  t = !1;
6473
6474
  };
6474
6475
  }, [y, e]);
6475
6476
  let C = {
6476
- ...A(g),
6477
6477
  display: "block",
6478
6478
  width: "100%",
6479
- minHeight: $r(r, 360),
6480
- height: $r(r, 360),
6479
+ minHeight: ei(r, 360),
6480
+ height: ei(r, 360),
6481
6481
  backgroundColor: a || "transparent",
6482
- borderRadius: A(g).borderRadius ?? void 0
6482
+ ...A(g)
6483
6483
  };
6484
- if (!e) return v ? /* @__PURE__ */ u(ni, {
6484
+ if (!e) return v ? /* @__PURE__ */ u(ii, {
6485
6485
  nodeRef: _,
6486
6486
  style: g,
6487
6487
  height: r,
@@ -6516,13 +6516,13 @@ function ri({ src: e, poster: t, alt: n, height: r, bg: a, autoRotate: o, rotate
6516
6516
  poster: t || void 0,
6517
6517
  style: C,
6518
6518
  "camera-controls": w(!v && l !== !1),
6519
- "auto-rotate": w(T && !Yr()),
6520
- "auto-rotate-delay": T ? String($r(s, 0)) : void 0,
6519
+ "auto-rotate": w(T && !Xr()),
6520
+ "auto-rotate-delay": T ? String(ei(s, 0)) : void 0,
6521
6521
  "rotation-per-second": "18deg",
6522
6522
  ar: w(!v && d === !0),
6523
6523
  "ar-modes": "webxr scene-viewer quick-look",
6524
- "shadow-intensity": String(ei(p, 100)),
6525
- exposure: String(ei(f, 100)),
6524
+ "shadow-intensity": String(ti(p, 100)),
6525
+ exposure: String(ti(f, 100)),
6526
6526
  "field-of-view": m ? `${Number(m)}deg` : void 0,
6527
6527
  "environment-image": h && h !== "neutral" ? h : "neutral",
6528
6528
  "interaction-prompt": v ? "none" : void 0,
@@ -6540,7 +6540,7 @@ function ri({ src: e, poster: t, alt: n, height: r, bg: a, autoRotate: o, rotate
6540
6540
  }) : null
6541
6541
  });
6542
6542
  }
6543
- var ii = ["attribute vec2 p;", "void main() { gl_Position = vec4(p, 0.0, 1.0); }"].join("\n"), ai = [
6543
+ var oi = ["attribute vec2 p;", "void main() { gl_Position = vec4(p, 0.0, 1.0); }"].join("\n"), si = [
6544
6544
  "precision highp float;",
6545
6545
  "uniform vec2 u_res;",
6546
6546
  "uniform float u_time;",
@@ -6563,7 +6563,7 @@ var ii = ["attribute vec2 p;", "void main() { gl_Position = vec4(p, 0.0, 1.0); }
6563
6563
  " return v;",
6564
6564
  "}",
6565
6565
  ""
6566
- ].join("\n"), oi = {
6566
+ ].join("\n"), ci = {
6567
6567
  gradient: [
6568
6568
  "void main(){",
6569
6569
  " vec2 uv = gl_FragCoord.xy / u_res;",
@@ -6615,7 +6615,7 @@ var ii = ["attribute vec2 p;", "void main() { gl_Position = vec4(p, 0.0, 1.0); }
6615
6615
  "}"
6616
6616
  ].join("\n")
6617
6617
  };
6618
- function si(e, t) {
6618
+ function li(e, t) {
6619
6619
  let n = /^#?([0-9a-f]{6})$/i.exec(String(e ?? "").trim());
6620
6620
  if (!n) return t;
6621
6621
  let r = parseInt(n[1], 16);
@@ -6625,7 +6625,7 @@ function si(e, t) {
6625
6625
  (r & 255) / 255
6626
6626
  ];
6627
6627
  }
6628
- function ci(e, t, n) {
6628
+ function ui(e, t, n) {
6629
6629
  let r = e.createShader(t);
6630
6630
  if (e.shaderSource(r, n), e.compileShader(r), !e.getShaderParameter(r, e.COMPILE_STATUS)) {
6631
6631
  let t = e.getShaderInfoLog(r);
@@ -6633,27 +6633,32 @@ function ci(e, t, n) {
6633
6633
  }
6634
6634
  return r;
6635
6635
  }
6636
- function li({ preset: e, code: t, colorA: n, colorB: r, colorC: a, speed: o, scale: l, height: f, interactive: p, style: m, nodeRef: h, inert: g }) {
6637
- let _ = s(null), v = s(null), [y, b] = c(""), x = typeof t == "string" && t.trim() ? t : oi[e] ?? oi.gradient, S = String(n ?? ""), C = String(r ?? ""), w = String(a ?? ""), T = ei(o, 100), E = Math.max(.05, ei(l, 100));
6636
+ function di({ preset: e, code: t, colorA: n, colorB: r, colorC: a, speed: o, scale: l, height: f, interactive: p, style: m, nodeRef: h, inert: g }) {
6637
+ let _ = s(null), v = s(null), y = s(null), [b, x] = c("");
6638
+ i(() => () => {
6639
+ let e = y.current;
6640
+ y.current = null, e?.getExtension("WEBGL_lose_context")?.loseContext();
6641
+ }, []);
6642
+ let S = typeof t == "string" && t.trim() ? t : ci[e] ?? ci.gradient, C = String(n ?? ""), w = String(r ?? ""), T = String(a ?? ""), E = ti(o, 100), D = Math.max(.05, ti(l, 100));
6638
6643
  return i(() => {
6639
6644
  let e = _.current, t = v.current;
6640
6645
  if (!e || !t) return;
6641
- let n = e.getContext("webgl", {
6646
+ let n = y.current ??= e.getContext("webgl", {
6642
6647
  antialias: !0,
6643
6648
  alpha: !0,
6644
6649
  premultipliedAlpha: !1
6645
6650
  });
6646
6651
  if (!n) {
6647
- b("WebGL is not available in this browser");
6652
+ x("WebGL is not available in this browser");
6648
6653
  return;
6649
6654
  }
6650
6655
  let r = null;
6651
6656
  try {
6652
- let e = ci(n, n.VERTEX_SHADER, ii), t = ci(n, n.FRAGMENT_SHADER, ai + x);
6657
+ let e = ui(n, n.VERTEX_SHADER, oi), t = ui(n, n.FRAGMENT_SHADER, si + S);
6653
6658
  if (r = n.createProgram(), n.attachShader(r, e), n.attachShader(r, t), n.linkProgram(r), !n.getProgramParameter(r, n.LINK_STATUS)) throw Error(n.getProgramInfoLog(r) || "Link failed");
6654
- b("");
6659
+ x("");
6655
6660
  } catch (e) {
6656
- b(e?.message || "Shader failed to compile");
6661
+ x(e?.message || "Shader failed to compile");
6657
6662
  return;
6658
6663
  }
6659
6664
  n.useProgram(r);
@@ -6685,49 +6690,49 @@ function li({ preset: e, code: t, colorA: n, colorB: r, colorC: a, speed: o, sca
6685
6690
  };
6686
6691
  p !== !1 && t.addEventListener("pointermove", l);
6687
6692
  let u = () => {
6688
- let r = Xr(), i = Math.max(1, Math.round(t.clientWidth * r)), a = Math.max(1, Math.round(t.clientHeight * r));
6693
+ let r = Zr(), i = Math.max(1, Math.round(t.clientWidth * r)), a = Math.max(1, Math.round(t.clientHeight * r));
6689
6694
  (e.width !== i || e.height !== a) && (e.width = i, e.height = a, n.viewport(0, 0, i, a));
6690
6695
  }, d = typeof ResizeObserver > "u" ? null : new ResizeObserver(u);
6691
6696
  d?.observe(t), u();
6692
- let f = Yr(), m = {
6693
- a: si(S, [
6697
+ let f = Xr(), m = {
6698
+ a: li(C, [
6694
6699
  .35,
6695
6700
  .4,
6696
6701
  .95
6697
6702
  ]),
6698
- b: si(C, [
6703
+ b: li(w, [
6699
6704
  .05,
6700
6705
  .06,
6701
6706
  .16
6702
6707
  ]),
6703
- c: si(w, [
6708
+ c: li(T, [
6704
6709
  .95,
6705
6710
  .35,
6706
6711
  .6
6707
6712
  ])
6708
6713
  }, h = {};
6709
- return h.stop = Zr(t, (t, r) => {
6710
- u(), n.uniform2f(s.res, e.width, e.height), n.uniform1f(s.time, (f ? 0 : r) * T), n.uniform2f(s.mouse, c.x, c.y), n.uniform3fv(s.a, m.a), n.uniform3fv(s.b, m.b), n.uniform3fv(s.c, m.c), n.uniform1f(s.scale, E), n.drawArrays(n.TRIANGLES, 0, 3), f && h.stop?.();
6714
+ return h.stop = Qr(t, (t, r) => {
6715
+ u(), n.uniform2f(s.res, e.width, e.height), n.uniform1f(s.time, (f ? 0 : r) * E), n.uniform2f(s.mouse, c.x, c.y), n.uniform3fv(s.a, m.a), n.uniform3fv(s.b, m.b), n.uniform3fv(s.c, m.c), n.uniform1f(s.scale, D), n.drawArrays(n.TRIANGLES, 0, 3), f && h.stop?.();
6711
6716
  }), () => {
6712
- h.stop?.(), d?.disconnect(), t.removeEventListener("pointermove", l), n.deleteProgram(r), n.deleteBuffer(i), n.getExtension("WEBGL_lose_context")?.loseContext();
6717
+ h.stop?.(), d?.disconnect(), t.removeEventListener("pointermove", l), n.deleteProgram(r), n.deleteBuffer(i);
6713
6718
  };
6714
6719
  }, [
6715
- x,
6716
6720
  S,
6717
6721
  C,
6718
6722
  w,
6719
6723
  T,
6720
6724
  E,
6725
+ D,
6721
6726
  p
6722
6727
  ]), /* @__PURE__ */ d("div", {
6723
6728
  ref: (e) => {
6724
6729
  v.current = e, typeof h == "function" && h(e);
6725
6730
  },
6726
6731
  style: {
6727
- ...A(m),
6728
- position: A(m).position ?? "relative",
6729
- minHeight: $r(f, 320),
6730
- overflow: "hidden"
6732
+ position: "relative",
6733
+ minHeight: ei(f, 320),
6734
+ overflow: "hidden",
6735
+ ...A(m)
6731
6736
  },
6732
6737
  children: [/* @__PURE__ */ u("canvas", {
6733
6738
  ref: _,
@@ -6738,7 +6743,7 @@ function li({ preset: e, code: t, colorA: n, colorB: r, colorC: a, speed: o, sca
6738
6743
  position: "absolute",
6739
6744
  inset: 0
6740
6745
  }
6741
- }), y && g ? /* @__PURE__ */ u("div", {
6746
+ }), b && g ? /* @__PURE__ */ u("div", {
6742
6747
  style: {
6743
6748
  position: "absolute",
6744
6749
  inset: 0,
@@ -6753,11 +6758,11 @@ function li({ preset: e, code: t, colorA: n, colorB: r, colorC: a, speed: o, sca
6753
6758
  whiteSpace: "pre-wrap",
6754
6759
  overflow: "auto"
6755
6760
  },
6756
- children: y
6761
+ children: b
6757
6762
  }) : null]
6758
6763
  });
6759
6764
  }
6760
- function ui(e, t) {
6765
+ function fi(e, t) {
6761
6766
  let n = new e.Scene(), r = new e.BoxGeometry();
6762
6767
  r.deleteAttribute("uv");
6763
6768
  let i = new e.Mesh(r, new e.MeshBasicMaterial({
@@ -6773,7 +6778,23 @@ function ui(e, t) {
6773
6778
  let o = new e.PMREMGenerator(t), s = o.fromScene(n, .04);
6774
6779
  return o.dispose(), r.dispose(), n.traverse((e) => e.material?.dispose?.()), s.texture;
6775
6780
  }
6776
- var di = {
6781
+ var pi = /* @__PURE__ */ new Map();
6782
+ function mi(e) {
6783
+ if (pi.has(e)) return pi.get(e);
6784
+ let t = Jr("loaders/GLTFLoader.js").then((t) => new Promise((n, r) => {
6785
+ new t.GLTFLoader().load(e, (e) => n(e.scene), void 0, r);
6786
+ })).catch((t) => {
6787
+ throw pi.delete(e), t;
6788
+ });
6789
+ return pi.set(e, t), t;
6790
+ }
6791
+ function hi(e, t) {
6792
+ let n = new e.Box3().setFromObject(t);
6793
+ if (n.isEmpty()) return t;
6794
+ let r = n.getSize(new e.Vector3()), i = n.getCenter(new e.Vector3()), a = Math.max(r.x, r.y, r.z) || 1, o = new e.Group();
6795
+ return t.position.sub(i), t.scale.multiplyScalar(1 / a), t.position.multiplyScalar(1 / a), o.add(t), o;
6796
+ }
6797
+ var gi = {
6777
6798
  box: (e) => new e.BoxGeometry(1, 1, 1, 1, 1, 1),
6778
6799
  sphere: (e) => new e.SphereGeometry(.62, 48, 32),
6779
6800
  torus: (e) => new e.TorusGeometry(.5, .2, 24, 64),
@@ -6782,9 +6803,9 @@ var di = {
6782
6803
  cylinder: (e) => new e.CylinderGeometry(.45, .45, 1.1, 48),
6783
6804
  plane: (e) => new e.PlaneGeometry(1.4, 1.4),
6784
6805
  capsule: (e) => new e.CapsuleGeometry(.35, .6, 8, 32)
6785
- }, fi = (e, t) => Number.isFinite(Number(e)) ? Number(e) : t;
6786
- function pi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate: a, spinSpeed: o, controls: l, ground: d, height: f, style: p, nodeRef: m, inert: h }) {
6787
- let g = s(null), [_, v] = c(!1), y = Array.isArray(e) ? e.filter((e) => e && typeof e == "object") : [], b = JSON.stringify(y), x = a !== !1 && !Yr(), S = l !== !1 && !h;
6806
+ }, _i = (e, t) => Number.isFinite(Number(e)) ? Number(e) : t;
6807
+ function vi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate: a, spinSpeed: o, controls: l, ground: d, height: f, style: p, nodeRef: m, inert: h }) {
6808
+ let g = s(null), [_, v] = c(!1), y = Array.isArray(e) ? e.filter((e) => e && typeof e == "object") : [], b = JSON.stringify(y), x = a !== !1 && !Xr(), S = l !== !1 && !h;
6788
6809
  return i(() => {
6789
6810
  let e = g.current;
6790
6811
  if (!e) return;
@@ -6795,46 +6816,61 @@ function pi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate:
6795
6816
  antialias: !0,
6796
6817
  alpha: !t
6797
6818
  });
6798
- c.setPixelRatio(Xr()), c.shadowMap.enabled = d !== !1, c.shadowMap.type = s.PCFSoftShadowMap, c.outputColorSpace = s.SRGBColorSpace, c.toneMapping = s.ACESFilmicToneMapping, c.domElement.style.display = "block", c.domElement.style.width = "100%", c.domElement.style.height = "100%", e.appendChild(c.domElement);
6819
+ c.setPixelRatio(Zr()), c.shadowMap.enabled = d !== !1, c.shadowMap.type = s.PCFSoftShadowMap, c.outputColorSpace = s.SRGBColorSpace, c.toneMapping = s.ACESFilmicToneMapping, c.domElement.style.display = "block", c.domElement.style.width = "100%", c.domElement.style.height = "100%", e.appendChild(c.domElement);
6799
6820
  let l = new s.Scene();
6800
- t && (l.background = new s.Color(t)), l.environment = ui(s, c);
6801
- let u = new s.PerspectiveCamera(fi(r, 45), 1, .1, 400), f = Qr(u, c.domElement, {
6802
- distance: fi(n, 5),
6821
+ t && (l.background = new s.Color(t)), l.environment = fi(s, c);
6822
+ let u = new s.PerspectiveCamera(_i(r, 45), 1, .1, 400), f = $r(u, c.domElement, {
6823
+ distance: _i(n, 5),
6803
6824
  enableZoom: S
6804
6825
  }), p = new s.DirectionalLight(16777215, 2.2);
6805
6826
  p.position.set(4, 7, 5), p.castShadow = d !== !1, p.shadow.mapSize.set(1024, 1024), p.shadow.camera.near = .5, p.shadow.camera.far = 30, l.add(p, new s.AmbientLight(16777215, .35));
6806
- let m = [], h = new s.Group();
6827
+ let m = [], h = new s.Group(), g = (e, t) => {
6828
+ let n = _i(t.scale, 1);
6829
+ e.position.set(_i(t.x, 0), _i(t.y, 0), _i(t.z, 0)), e.rotation.set(ni(t.rx), ni(t.ry), ni(t.rz)), e.scale.setScalar(n > 0 ? n : 1), e.userData.spin = ni(t.spin);
6830
+ };
6807
6831
  for (let e of y) {
6808
- let t = (di[e.shape] ?? di.box)(s), n = new s.MeshStandardMaterial({
6832
+ if (e.shape === "model") {
6833
+ if (!ri(e.src)) continue;
6834
+ let t = new s.Group();
6835
+ g(t, e), h.add(t), mi(e.src).then((e) => {
6836
+ if (!i) return;
6837
+ let n = hi(s, e.clone(!0));
6838
+ n.traverse((e) => {
6839
+ e.isMesh && (e.castShadow = !0, e.receiveShadow = !0);
6840
+ }), t.add(n);
6841
+ }, () => {});
6842
+ continue;
6843
+ }
6844
+ let t = (gi[e.shape] ?? gi.box)(s), n = new s.MeshStandardMaterial({
6809
6845
  color: /^#?[0-9a-f]{6}$/i.test(String(e.color ?? "")) ? e.color : "#6366f1",
6810
- metalness: Math.min(1, Math.max(0, ei(e.metalness, 10))),
6811
- roughness: Math.min(1, Math.max(0, ei(e.roughness, 35))),
6812
- transparent: ei(e.opacity, 100) < 1,
6813
- opacity: Math.min(1, Math.max(0, ei(e.opacity, 100))),
6846
+ metalness: Math.min(1, Math.max(0, ti(e.metalness, 10))),
6847
+ roughness: Math.min(1, Math.max(0, ti(e.roughness, 35))),
6848
+ transparent: ti(e.opacity, 100) < 1,
6849
+ opacity: Math.min(1, Math.max(0, ti(e.opacity, 100))),
6814
6850
  flatShading: e.flat === !0,
6815
6851
  wireframe: e.wireframe === !0,
6816
6852
  side: e.shape === "plane" ? s.DoubleSide : s.FrontSide
6817
- }), r = new s.Mesh(t, n), i = fi(e.scale, 1);
6818
- r.position.set(fi(e.x, 0), fi(e.y, 0), fi(e.z, 0)), r.rotation.set(fi(e.rx, 0) * Math.PI / 180, fi(e.ry, 0) * Math.PI / 180, fi(e.rz, 0) * Math.PI / 180), r.scale.setScalar(i > 0 ? i : 1), r.castShadow = !0, r.receiveShadow = !0, r.userData.spin = ti(e.spin), h.add(r), m.push(t, n);
6853
+ }), r = new s.Mesh(t, n);
6854
+ g(r, e), r.castShadow = !0, r.receiveShadow = !0, h.add(r), m.push(t, n);
6819
6855
  }
6820
6856
  l.add(h);
6821
- let g = null;
6857
+ let _ = null;
6822
6858
  if (d !== !1) {
6823
6859
  let e = new s.ShadowMaterial({ opacity: .22 }), t = new s.PlaneGeometry(60, 60);
6824
- g = new s.Mesh(t, e), g.rotation.x = -Math.PI / 2, g.position.y = fi(d === !0 ? 0 : d, -.85), g.receiveShadow = !0, l.add(g), m.push(t, e);
6860
+ _ = new s.Mesh(t, e), _.rotation.x = -Math.PI / 2, _.position.y = _i(d === !0 ? 0 : d, -.85), _.receiveShadow = !0, l.add(_), m.push(t, e);
6825
6861
  }
6826
- let _ = () => {
6862
+ let v = () => {
6827
6863
  let t = Math.max(1, e.clientWidth), n = Math.max(1, e.clientHeight);
6828
6864
  c.setSize(t, n, !1), u.aspect = t / n, u.updateProjectionMatrix();
6829
- }, v = typeof ResizeObserver > "u" ? null : new ResizeObserver(_);
6830
- v?.observe(e), _();
6831
- let b = ti(Number.isFinite(Number(o)) ? o : 20), C = Zr(e, (e) => {
6832
- f.autoSpin(x ? b : 0, e), f.update();
6865
+ }, b = typeof ResizeObserver > "u" ? null : new ResizeObserver(v);
6866
+ b?.observe(e), v();
6867
+ let C = ni(Number.isFinite(Number(o)) ? o : 20), w = Qr(e, (e) => {
6868
+ f.autoSpin(x ? C : 0, e), f.update();
6833
6869
  for (let t of h.children) t.userData.spin && (t.rotation.y += t.userData.spin * e);
6834
6870
  c.render(l, u);
6835
6871
  });
6836
6872
  a = () => {
6837
- C(), v?.disconnect(), f.dispose();
6873
+ w(), b?.disconnect(), f.dispose();
6838
6874
  for (let e of m) e.dispose?.();
6839
6875
  l.environment?.dispose?.(), c.dispose(), c.domElement.remove();
6840
6876
  };
@@ -6852,7 +6888,7 @@ function pi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate:
6852
6888
  o,
6853
6889
  S,
6854
6890
  d
6855
- ]), _ && h ? /* @__PURE__ */ u(ni, {
6891
+ ]), _ && h ? /* @__PURE__ */ u(ii, {
6856
6892
  nodeRef: m,
6857
6893
  style: p,
6858
6894
  height: f,
@@ -6863,15 +6899,15 @@ function pi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate:
6863
6899
  g.current = e, typeof m == "function" && m(e);
6864
6900
  },
6865
6901
  style: {
6866
- ...A(p),
6867
- minHeight: $r(f, 380),
6868
- height: $r(f, 380),
6902
+ minHeight: ei(f, 380),
6903
+ height: ei(f, 380),
6869
6904
  overflow: "hidden",
6870
- touchAction: S ? "pan-y" : void 0
6905
+ touchAction: S ? "pan-y" : void 0,
6906
+ ...A(p)
6871
6907
  }
6872
6908
  });
6873
6909
  }
6874
- function mi({ code: e, height: t, background: n, style: r, nodeRef: a, inert: o }) {
6910
+ function yi({ code: e, height: t, background: n, style: r, nodeRef: a, inert: o }) {
6875
6911
  let l = s(null), [d, f] = c("");
6876
6912
  return i(() => {
6877
6913
  let t = l.current;
@@ -6883,7 +6919,7 @@ function mi({ code: e, height: t, background: n, style: r, nodeRef: a, inert: o
6883
6919
  antialias: !0,
6884
6920
  alpha: !n
6885
6921
  });
6886
- o.setPixelRatio(Xr()), o.outputColorSpace = a.SRGBColorSpace, o.domElement.style.display = "block", o.domElement.style.width = "100%", o.domElement.style.height = "100%", t.appendChild(o.domElement);
6922
+ o.setPixelRatio(Zr()), o.outputColorSpace = a.SRGBColorSpace, o.domElement.style.display = "block", o.domElement.style.width = "100%", o.domElement.style.height = "100%", t.appendChild(o.domElement);
6887
6923
  let s = new a.Scene();
6888
6924
  n && (s.background = new a.Color(n));
6889
6925
  let c = new a.PerspectiveCamera(45, 1, .1, 1e3);
@@ -6906,7 +6942,7 @@ function mi({ code: e, height: t, background: n, style: r, nodeRef: a, inert: o
6906
6942
  o.setSize(e, n, !1), c.aspect = e / n, c.updateProjectionMatrix();
6907
6943
  }, d = typeof ResizeObserver > "u" ? null : new ResizeObserver(u);
6908
6944
  d?.observe(t), u();
6909
- let p = !1, m = Zr(t, (e, t) => {
6945
+ let p = !1, m = Qr(t, (e, t) => {
6910
6946
  if (!p && typeof l?.frame == "function") try {
6911
6947
  l.frame(e, t);
6912
6948
  } catch (e) {
@@ -6928,7 +6964,7 @@ function mi({ code: e, height: t, background: n, style: r, nodeRef: a, inert: o
6928
6964
  e,
6929
6965
  o,
6930
6966
  n
6931
- ]), o ? /* @__PURE__ */ u(ni, {
6967
+ ]), o ? /* @__PURE__ */ u(ii, {
6932
6968
  nodeRef: a,
6933
6969
  style: r,
6934
6970
  height: t,
@@ -6939,12 +6975,12 @@ function mi({ code: e, height: t, background: n, style: r, nodeRef: a, inert: o
6939
6975
  l.current = e, typeof a == "function" && a(e);
6940
6976
  },
6941
6977
  style: {
6942
- ...A(r),
6943
- minHeight: $r(t, 380),
6944
- height: $r(t, 380),
6978
+ minHeight: ei(t, 380),
6979
+ height: ei(t, 380),
6945
6980
  overflow: "hidden",
6946
6981
  position: "relative",
6947
- touchAction: "pan-y"
6982
+ touchAction: "pan-y",
6983
+ ...A(r)
6948
6984
  },
6949
6985
  children: d ? /* @__PURE__ */ u("div", {
6950
6986
  style: {
@@ -6963,40 +6999,40 @@ function mi({ code: e, height: t, background: n, style: r, nodeRef: a, inert: o
6963
6999
  }) : null
6964
7000
  });
6965
7001
  }
6966
- var hi = {
6967
- ModelViewerBlock: ri,
6968
- ShaderBlock: li,
6969
- SceneBlock: pi,
6970
- ThreeCanvasBlock: mi
6971
- }, gi = /* @__PURE__ */ new Map();
6972
- function _i(e) {
6973
- if (gi.has(e)) return gi.get(e);
7002
+ var bi = {
7003
+ ModelViewerBlock: ai,
7004
+ ShaderBlock: di,
7005
+ SceneBlock: vi,
7006
+ ThreeCanvasBlock: yi
7007
+ }, xi = /* @__PURE__ */ new Map();
7008
+ function Si(e) {
7009
+ if (xi.has(e)) return xi.get(e);
6974
7010
  let t = URL.createObjectURL(new Blob([e], { type: "text/javascript" })), n = import(
6975
7011
  /* @vite-ignore */
6976
7012
  /* webpackIgnore: true */
6977
7013
  t
6978
7014
  ).finally(() => URL.revokeObjectURL(t));
6979
- return gi.set(e, n), n;
7015
+ return xi.set(e, n), n;
6980
7016
  }
6981
- function vi(e) {
7017
+ function Ci(e) {
6982
7018
  let t = e && typeof e == "object" ? e.builder_plugins : null, n = t && typeof t == "object" ? t.plugins : null;
6983
7019
  return n && typeof n == "object" ? n : {};
6984
7020
  }
6985
7021
  //#endregion
6986
7022
  //#region ../ui/src/components/builder/plugins/view.jsx
6987
- async function yi(e, t) {
6988
- let n = await _i(e);
7023
+ async function wi(e, t) {
7024
+ let n = await Si(e);
6989
7025
  return (Array.isArray(n?.default?.blocks) ? n.default.blocks : []).find((e) => e?.id === t && typeof e.mount == "function") ?? null;
6990
7026
  }
6991
- var bi = {
7027
+ var Ti = {
6992
7028
  padding: "10px 12px",
6993
7029
  border: "1px dashed rgba(148, 163, 184, 0.5)",
6994
7030
  borderRadius: 8,
6995
7031
  fontSize: 12,
6996
7032
  opacity: .6
6997
7033
  };
6998
- function xi({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
6999
- let c = r(Z), l = vi(c?.settings)[e], f = s(null), p = s(null), m = {
7034
+ function Ei({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
7035
+ let c = r(Z), l = Ci(c?.settings)[e], f = s(null), p = s(null), m = {
7000
7036
  tenant: c?.tenant ?? "",
7001
7037
  apiUrl: c?.apiUrl ?? "/api",
7002
7038
  locale: c?.locale ?? "",
@@ -7008,7 +7044,7 @@ function xi({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
7008
7044
  let e = f.current;
7009
7045
  if (!l?.code || !e) return;
7010
7046
  let n = !0;
7011
- return yi(l.code, t).then((e) => {
7047
+ return wi(l.code, t).then((e) => {
7012
7048
  if (!(!n || !e || !f.current)) {
7013
7049
  p.current = e;
7014
7050
  try {
@@ -7038,7 +7074,7 @@ function xi({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
7038
7074
  }) : /* @__PURE__ */ d("div", {
7039
7075
  ref: o,
7040
7076
  style: {
7041
- ...bi,
7077
+ ...Ti,
7042
7078
  ...A(a)
7043
7079
  },
7044
7080
  children: [
@@ -7050,13 +7086,13 @@ function xi({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
7050
7086
  }
7051
7087
  //#endregion
7052
7088
  //#region ../ui/src/components/builder/render.jsx
7053
- var Si = {
7089
+ var Di = {
7054
7090
  ...ar,
7055
7091
  ...Rr,
7056
- ...hi,
7057
- PluginBlock: xi
7092
+ ...bi,
7093
+ PluginBlock: Ei
7058
7094
  };
7059
- function Ci(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
7095
+ function Oi(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
7060
7096
  let o = n[t];
7061
7097
  if (!o || o.hidden) return null;
7062
7098
  let s = o.type?.resolvedName, c = a?.mapProps ? a.mapProps(o.props ?? {}, s) : o.props ?? {};
@@ -7064,11 +7100,11 @@ function Ci(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
7064
7100
  let n = o.props?.componentId, s = r?.[n];
7065
7101
  if (!s?.template || i.has(n)) return null;
7066
7102
  let c = new Set(i).add(n);
7067
- return /* @__PURE__ */ u(e, { children: Ci(s.template.rootId, s.template.nodes, r, c, a) }, t);
7103
+ return /* @__PURE__ */ u(e, { children: Oi(s.template.rootId, s.template.nodes, r, c, a) }, t);
7068
7104
  }
7069
- let l = Si[s];
7105
+ let l = Di[s];
7070
7106
  if (!l) return null;
7071
- let d = (o.nodes ?? []).map((e) => Ci(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, Ci(t, n, r, i, a)])) : void 0, m = /* @__PURE__ */ u(l, {
7107
+ let d = (o.nodes ?? []).map((e) => Oi(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, Oi(t, n, r, i, a)])) : void 0, m = /* @__PURE__ */ u(l, {
7072
7108
  ...c,
7073
7109
  ...s === "CollectionList" ? { templateId: o.linkedNodes?.card } : null,
7074
7110
  linked: p,
@@ -7084,9 +7120,9 @@ function Ci(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
7084
7120
  }
7085
7121
  //#endregion
7086
7122
  //#region ../ui/src/components/builder/PageRenderer.jsx
7087
- var wi = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" "), Ti = (e) => `.webim-page[data-webim-mode="light"] { ${Object.entries(ue(e.light)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }
7123
+ var ki = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" "), Ai = (e) => `.webim-page[data-webim-mode="light"] { ${Object.entries(ue(e.light)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }
7088
7124
  .webim-page[data-webim-mode="dark"] { ${Object.entries(ue(e.dark)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }`;
7089
- function Ei({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, custom: s, animations: c, tenant: l, apiUrl: f, datasets: p, locale: m, direction: h, settings: _, siteUser: v }) {
7125
+ function ji({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, custom: s, animations: c, tenant: l, apiUrl: f, datasets: p, locale: m, direction: h, settings: _, siteUser: v }) {
7090
7126
  let b = s?.js?.trim();
7091
7127
  if (i(() => {
7092
7128
  if (!b) return;
@@ -7100,11 +7136,11 @@ function Ei({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, cu
7100
7136
  minHeight: "100%",
7101
7137
  display: "flex",
7102
7138
  flexDirection: "column"
7103
- }, w = Ci("ROOT", e, n), T = o(() => ({ render: (t, r) => Ci(t, e, n, void 0, { mapProps: r }) }), [e, n]), D = G(e, n), O = re(e, n), k = s?.css?.trim(), A = E(c), j = le(t), M = [j.font, j.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !oe[e]), N = [.../* @__PURE__ */ new Set([...y(e, n), ...M])].map((e) => /* @__PURE__ */ u("link", {
7139
+ }, w = Oi("ROOT", e, n), T = o(() => ({ render: (t, r) => Oi(t, e, n, void 0, { mapProps: r }) }), [e, n]), D = G(e, n), O = re(e, n), k = s?.css?.trim(), A = E(c), j = le(t), M = [j.font, j.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !oe[e]), N = [.../* @__PURE__ */ new Set([...y(e, n), ...M])].map((e) => /* @__PURE__ */ u("link", {
7104
7140
  rel: "stylesheet",
7105
7141
  precedence: "default",
7106
7142
  href: g(e)
7107
- }, e)), P = Ti(j);
7143
+ }, e)), P = Ai(j);
7108
7144
  return r === "auto" ? /* @__PURE__ */ u(Z.Provider, {
7109
7145
  value: {
7110
7146
  tenant: l || "",
@@ -7127,8 +7163,8 @@ function Ei({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, cu
7127
7163
  ...a
7128
7164
  },
7129
7165
  children: [
7130
- /* @__PURE__ */ u("style", { children: `.webim-page { ${wi(ue(j.light))} }
7131
- @media (prefers-color-scheme: dark) { .webim-page { ${wi(ue(j.dark))} } }` }),
7166
+ /* @__PURE__ */ u("style", { children: `.webim-page { ${ki(ue(j.light))} }
7167
+ @media (prefers-color-scheme: dark) { .webim-page { ${ki(ue(j.dark))} } }` }),
7132
7168
  /* @__PURE__ */ u("style", { children: P }),
7133
7169
  N,
7134
7170
  /* @__PURE__ */ u("style", { children: S }),
@@ -7181,8 +7217,8 @@ function Ei({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, cu
7181
7217
  }
7182
7218
  //#endregion
7183
7219
  //#region src/WebimContent.jsx
7184
- function Di({ bundle: e, mode: t = "auto", style: n }) {
7185
- return e?.blocks?.ROOT ? /* @__PURE__ */ u(Ei, {
7220
+ function Mi({ bundle: e, mode: t = "auto", style: n }) {
7221
+ return e?.blocks?.ROOT ? /* @__PURE__ */ u(ji, {
7186
7222
  blocks: e.blocks,
7187
7223
  theme: e.theme,
7188
7224
  components: e.components,
@@ -7200,7 +7236,7 @@ function Di({ bundle: e, mode: t = "auto", style: n }) {
7200
7236
  }
7201
7237
  //#endregion
7202
7238
  //#region src/WebimPage.jsx
7203
- function Oi({ apiUrl: e, tenant: t, slug: n, locale: r, preview: a, token: o, mode: l = "auto", style: d, fallback: f = null, errorFallback: p = null, onLoad: m, onError: h }) {
7239
+ function Ni({ apiUrl: e, tenant: t, slug: n, locale: r, preview: a, token: o, mode: l = "auto", style: d, fallback: f = null, errorFallback: p = null, onLoad: m, onError: h }) {
7204
7240
  let [g, _] = c({ status: "loading" }), v = s({
7205
7241
  onLoad: m,
7206
7242
  onError: h
@@ -7237,11 +7273,11 @@ function Oi({ apiUrl: e, tenant: t, slug: n, locale: r, preview: a, token: o, mo
7237
7273
  r,
7238
7274
  a,
7239
7275
  o
7240
- ]), g.status === "loading" ? f : g.status === "error" ? typeof p == "function" ? p(g.error) : p : /* @__PURE__ */ u(Di, {
7276
+ ]), g.status === "loading" ? f : g.status === "error" ? typeof p == "function" ? p(g.error) : p : /* @__PURE__ */ u(Mi, {
7241
7277
  bundle: g.bundle,
7242
7278
  mode: l,
7243
7279
  style: d
7244
7280
  });
7245
7281
  }
7246
7282
  //#endregion
7247
- export { Ei as PageRenderer, Di as WebimContent, Oi as WebimPage, ye as fetchPage, Ze as renderRichContent, he as resolveTheme };
7283
+ export { ji as PageRenderer, Mi as WebimContent, Ni as WebimPage, ye as fetchPage, Ze as renderRichContent, he as resolveTheme };