webim-adapter 2.0.1 → 2.0.2
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/CHANGELOG.md +7 -0
- package/build/webim-adapter.js +386 -284
- package/build/webim-embed.js +6 -6
- package/build/webim-ssr.js +306 -204
- package/package.json +9 -10
package/build/webim-ssr.js
CHANGED
|
@@ -5383,11 +5383,113 @@ function nr({ dialogId: e = "", trigger: t = "button", triggerLabel: n = "Open",
|
|
|
5383
5383
|
})]
|
|
5384
5384
|
});
|
|
5385
5385
|
}
|
|
5386
|
-
|
|
5386
|
+
function rr({ dropdownId: e = "", trigger: t = "button", triggerLabel: n = "Menu", openOn: r = "hover", align: i = "left", panelWidth: o = "", offset: s = 8, editorOpen: u = !0, linked: p, style: m, nodeRef: h, inert: g = !1 }) {
|
|
5387
|
+
let [_, v] = l(!1), y = c(null), b = c(null), x = r !== "click", S = () => {
|
|
5388
|
+
b.current && clearTimeout(b.current), b.current = null;
|
|
5389
|
+
}, C = () => {
|
|
5390
|
+
S(), b.current = setTimeout(() => v(!1), 160);
|
|
5391
|
+
};
|
|
5392
|
+
a(() => {
|
|
5393
|
+
if (g || !e) return;
|
|
5394
|
+
let t = `[data-webim-toggle="${e}"]`, n = (e) => {
|
|
5395
|
+
e.target.closest?.(t) && (e.preventDefault(), S(), v((e) => !e));
|
|
5396
|
+
}, r = (e) => {
|
|
5397
|
+
e.target.closest?.(t) && (S(), v(!0));
|
|
5398
|
+
}, i = (e) => {
|
|
5399
|
+
let n = e.target.closest?.(t);
|
|
5400
|
+
!n || e.relatedTarget && n.contains(e.relatedTarget) || C();
|
|
5401
|
+
};
|
|
5402
|
+
return document.addEventListener("click", n), x && (document.addEventListener("mouseover", r), document.addEventListener("mouseout", i)), () => {
|
|
5403
|
+
document.removeEventListener("click", n), document.removeEventListener("mouseover", r), document.removeEventListener("mouseout", i);
|
|
5404
|
+
};
|
|
5405
|
+
}, [
|
|
5406
|
+
g,
|
|
5407
|
+
e,
|
|
5408
|
+
x
|
|
5409
|
+
]), a(() => {
|
|
5410
|
+
if (g || !_) return;
|
|
5411
|
+
let t = (t) => {
|
|
5412
|
+
y.current?.contains(t.target) || e && t.target.closest?.(`[data-webim-toggle="${e}"]`) || v(!1);
|
|
5413
|
+
}, n = (e) => e.key === "Escape" && v(!1);
|
|
5414
|
+
return document.addEventListener("mousedown", t), document.addEventListener("keydown", n), () => {
|
|
5415
|
+
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", n);
|
|
5416
|
+
};
|
|
5417
|
+
}, [
|
|
5418
|
+
g,
|
|
5419
|
+
_,
|
|
5420
|
+
e
|
|
5421
|
+
]), a(() => S, []);
|
|
5422
|
+
let w = Number(o) > 0 ? Number(o) : null, T = g ? u !== !1 : _, E = /* @__PURE__ */ d("div", {
|
|
5423
|
+
style: {
|
|
5424
|
+
position: "absolute",
|
|
5425
|
+
top: `calc(100% + ${Number(s) || 0}px)`,
|
|
5426
|
+
...i === "right" ? { right: 0 } : i === "center" ? {
|
|
5427
|
+
left: "50%",
|
|
5428
|
+
transform: "translateX(-50%)"
|
|
5429
|
+
} : { left: 0 },
|
|
5430
|
+
zIndex: 60,
|
|
5431
|
+
display: T ? "block" : "none",
|
|
5432
|
+
minWidth: w ?? 240,
|
|
5433
|
+
width: w ?? void 0,
|
|
5434
|
+
maxWidth: "92vw",
|
|
5435
|
+
padding: 14,
|
|
5436
|
+
borderRadius: 10,
|
|
5437
|
+
background: "var(--page-surface, #ffffff)",
|
|
5438
|
+
color: "var(--page-text, inherit)",
|
|
5439
|
+
border: "1px solid var(--page-border, rgba(148, 163, 184, 0.35))",
|
|
5440
|
+
boxShadow: "0 16px 44px rgba(15, 23, 42, 0.22)",
|
|
5441
|
+
...P(m)
|
|
5442
|
+
},
|
|
5443
|
+
children: p?.content ?? null
|
|
5444
|
+
});
|
|
5445
|
+
return /* @__PURE__ */ f("div", {
|
|
5446
|
+
ref: (e) => {
|
|
5447
|
+
y.current = e, h && h(e);
|
|
5448
|
+
},
|
|
5449
|
+
id: e || void 0,
|
|
5450
|
+
onMouseEnter: !g && x ? () => {
|
|
5451
|
+
S(), v(!0);
|
|
5452
|
+
} : void 0,
|
|
5453
|
+
onMouseLeave: !g && x ? C : void 0,
|
|
5454
|
+
style: {
|
|
5455
|
+
position: "relative",
|
|
5456
|
+
display: "inline-block"
|
|
5457
|
+
},
|
|
5458
|
+
children: [t !== "none" && /* @__PURE__ */ f("button", {
|
|
5459
|
+
type: "button",
|
|
5460
|
+
"aria-haspopup": "true",
|
|
5461
|
+
"aria-expanded": g ? void 0 : _,
|
|
5462
|
+
onClick: () => !g && v((e) => !e),
|
|
5463
|
+
style: {
|
|
5464
|
+
padding: "9px 16px",
|
|
5465
|
+
border: "1px solid var(--page-border, rgba(148, 163, 184, 0.35))",
|
|
5466
|
+
borderRadius: 6,
|
|
5467
|
+
cursor: "pointer",
|
|
5468
|
+
fontSize: 15,
|
|
5469
|
+
fontFamily: "inherit",
|
|
5470
|
+
background: "var(--page-surface, transparent)",
|
|
5471
|
+
color: "inherit",
|
|
5472
|
+
display: "inline-flex",
|
|
5473
|
+
alignItems: "center",
|
|
5474
|
+
gap: 6
|
|
5475
|
+
},
|
|
5476
|
+
children: [n, /* @__PURE__ */ d("span", {
|
|
5477
|
+
"aria-hidden": "true",
|
|
5478
|
+
style: {
|
|
5479
|
+
fontSize: 10,
|
|
5480
|
+
opacity: .7
|
|
5481
|
+
},
|
|
5482
|
+
children: "▾"
|
|
5483
|
+
})]
|
|
5484
|
+
}), E]
|
|
5485
|
+
});
|
|
5486
|
+
}
|
|
5487
|
+
var ir = {
|
|
5387
5488
|
PageRoot: Le,
|
|
5388
5489
|
CalendarBlock: Xn,
|
|
5389
5490
|
LogoCarousel: $n,
|
|
5390
5491
|
DialogBlock: nr,
|
|
5492
|
+
DropdownBlock: rr,
|
|
5391
5493
|
Section: Re,
|
|
5392
5494
|
Container: ze,
|
|
5393
5495
|
Heading: Be,
|
|
@@ -5442,39 +5544,39 @@ var rr = {
|
|
|
5442
5544
|
FormFile: on,
|
|
5443
5545
|
FormRecaptcha: $t,
|
|
5444
5546
|
FormSubmit: sn
|
|
5445
|
-
},
|
|
5547
|
+
}, ar = {
|
|
5446
5548
|
id: "auth",
|
|
5447
5549
|
label: "Accounts",
|
|
5448
5550
|
category: "Apps",
|
|
5449
5551
|
keys: ["SiteLoginForm", "SiteAccountMenu"],
|
|
5450
5552
|
ssr: "shell",
|
|
5451
5553
|
settings: ["site.authRedirect"]
|
|
5452
|
-
},
|
|
5554
|
+
}, or = n({
|
|
5453
5555
|
user: null,
|
|
5454
5556
|
status: "idle",
|
|
5455
5557
|
ensure: () => {},
|
|
5456
5558
|
refresh: () => {},
|
|
5457
5559
|
signOut: () => {}
|
|
5458
5560
|
});
|
|
5459
|
-
function
|
|
5561
|
+
function sr(e, t) {
|
|
5460
5562
|
return t ? /^https?:\/\//i.test(t) ? t : `${e.replace(/\/+$/, "")}${t.startsWith("/") ? t : `/${t}`}` : "";
|
|
5461
5563
|
}
|
|
5462
|
-
function
|
|
5564
|
+
function cr(e) {
|
|
5463
5565
|
let t = e && typeof e == "object" ? e["site.session"] : null, n = t && typeof t == "object" && !Array.isArray(t) ? t : {}, r = (e) => typeof e == "string" ? e.trim() : "", i = r(n.url), a = r(n.mePath), o = r(n.logoutPath);
|
|
5464
5566
|
return {
|
|
5465
5567
|
mode: n.mode === "custom" || n.mode === "off" ? n.mode : "system",
|
|
5466
5568
|
url: i,
|
|
5467
5569
|
mePath: a,
|
|
5468
5570
|
logoutPath: o,
|
|
5469
|
-
meUrl:
|
|
5470
|
-
logoutUrl:
|
|
5571
|
+
meUrl: sr(i, a),
|
|
5572
|
+
logoutUrl: sr(i, o),
|
|
5471
5573
|
loginPage: r(n.loginPage),
|
|
5472
5574
|
userPath: r(n.userPath),
|
|
5473
5575
|
auth: n.auth === "bearer" ? "bearer" : "cookies",
|
|
5474
5576
|
tokenKey: r(n.tokenKey) || "webim_session_token"
|
|
5475
5577
|
};
|
|
5476
5578
|
}
|
|
5477
|
-
function
|
|
5579
|
+
function lr(e, t) {
|
|
5478
5580
|
if (!t) return e ?? null;
|
|
5479
5581
|
let n = e;
|
|
5480
5582
|
for (let e of t.split(".")) {
|
|
@@ -5483,26 +5585,26 @@ function cr(e, t) {
|
|
|
5483
5585
|
}
|
|
5484
5586
|
return n ?? null;
|
|
5485
5587
|
}
|
|
5486
|
-
function
|
|
5588
|
+
function ur(e) {
|
|
5487
5589
|
try {
|
|
5488
5590
|
return window.localStorage.getItem(e) || "";
|
|
5489
5591
|
} catch {
|
|
5490
5592
|
return "";
|
|
5491
5593
|
}
|
|
5492
5594
|
}
|
|
5493
|
-
function
|
|
5595
|
+
function dr(e) {
|
|
5494
5596
|
try {
|
|
5495
5597
|
window.localStorage.removeItem(e);
|
|
5496
5598
|
} catch {}
|
|
5497
5599
|
}
|
|
5498
|
-
var
|
|
5499
|
-
let e = i(
|
|
5600
|
+
var fr = () => {
|
|
5601
|
+
let e = i(or);
|
|
5500
5602
|
return a(() => {
|
|
5501
5603
|
e.ensure();
|
|
5502
5604
|
}, [e]), e;
|
|
5503
5605
|
};
|
|
5504
|
-
function
|
|
5505
|
-
let f = i(Y), p = o || f?.apiUrl || "/api", m = u || f?.tenant || "", h = s(() =>
|
|
5606
|
+
function pr({ children: e, initialUser: t, disabled: n, apiUrl: o, tenant: u }) {
|
|
5607
|
+
let f = i(Y), p = o || f?.apiUrl || "/api", m = u || f?.tenant || "", h = s(() => cr(f?.settings), [f?.settings]), [g, _] = l(t ?? null), [v, y] = l(t ? "user" : n ? "guest" : "idle"), b = c(!1), x = r((e, t) => fetch(`${p}${e}`, {
|
|
5506
5608
|
...t,
|
|
5507
5609
|
credentials: "include",
|
|
5508
5610
|
headers: {
|
|
@@ -5514,9 +5616,9 @@ function fr({ children: e, initialUser: t, disabled: n, apiUrl: o, tenant: u })
|
|
|
5514
5616
|
if (n) return Promise.resolve(null);
|
|
5515
5617
|
if (h.mode === "off") return Promise.resolve(S(null));
|
|
5516
5618
|
if (h.mode === "custom") {
|
|
5517
|
-
let e = h.auth === "bearer" ?
|
|
5619
|
+
let e = h.auth === "bearer" ? ur(h.tokenKey) : "";
|
|
5518
5620
|
return !h.meUrl || h.auth === "bearer" && !e ? Promise.resolve(S(null)) : fetch(h.meUrl, { ...h.auth === "bearer" ? { headers: { authorization: `Bearer ${e}` } } : { credentials: "include" } }).then((e) => e.ok ? e.json() : null).then((e) => {
|
|
5519
|
-
let t =
|
|
5621
|
+
let t = lr(e, h.userPath);
|
|
5520
5622
|
return S(t && typeof t == "object" ? t : null);
|
|
5521
5623
|
}).catch(() => S(null));
|
|
5522
5624
|
}
|
|
@@ -5529,12 +5631,12 @@ function fr({ children: e, initialUser: t, disabled: n, apiUrl: o, tenant: u })
|
|
|
5529
5631
|
]), w = r(() => {
|
|
5530
5632
|
if (h.mode === "off") return S(null), Promise.resolve();
|
|
5531
5633
|
if (h.mode === "custom") {
|
|
5532
|
-
let e = h.auth === "bearer" ?
|
|
5634
|
+
let e = h.auth === "bearer" ? ur(h.tokenKey) : "";
|
|
5533
5635
|
return (h.logoutUrl ? fetch(h.logoutUrl, {
|
|
5534
5636
|
method: "post",
|
|
5535
5637
|
...h.auth === "bearer" ? { headers: e ? { authorization: `Bearer ${e}` } : {} } : { credentials: "include" }
|
|
5536
5638
|
}).catch(() => {}) : Promise.resolve()).then(() => {
|
|
5537
|
-
h.auth === "bearer" &&
|
|
5639
|
+
h.auth === "bearer" && dr(h.tokenKey), S(null);
|
|
5538
5640
|
});
|
|
5539
5641
|
}
|
|
5540
5642
|
return x("/site/logout", { method: "post" }).catch(() => {}).then(() => {
|
|
@@ -5584,18 +5686,18 @@ function fr({ children: e, initialUser: t, disabled: n, apiUrl: o, tenant: u })
|
|
|
5584
5686
|
h.loginPage,
|
|
5585
5687
|
C,
|
|
5586
5688
|
w
|
|
5587
|
-
]), /* @__PURE__ */ d(
|
|
5689
|
+
]), /* @__PURE__ */ d(or.Provider, {
|
|
5588
5690
|
value: E,
|
|
5589
5691
|
children: e
|
|
5590
5692
|
});
|
|
5591
5693
|
}
|
|
5592
|
-
function
|
|
5593
|
-
let { status: n } =
|
|
5694
|
+
function mr({ when: e, children: t }) {
|
|
5695
|
+
let { status: n } = fr();
|
|
5594
5696
|
return !e || e === "always" ? t : n === "idle" || n === "loading" ? null : e === "user" == (n === "user") ? t : null;
|
|
5595
5697
|
}
|
|
5596
5698
|
//#endregion
|
|
5597
5699
|
//#region ../ui/src/components/builder/apps/auth/views.jsx
|
|
5598
|
-
function
|
|
5700
|
+
function hr({ mode: e = "login", redirect: t, emailLabel: n = "Email", passwordLabel: r = "Password", nameLabel: a = "Name", submitLabel: o, style: s, nodeRef: c, inert: u, linked: p, show: m }) {
|
|
5599
5701
|
let { tenant: h, apiUrl: g, settings: _ } = i(Y), [v, y] = l("form"), [b, x] = l(""), [S, C] = l(!1), w = e === "register", T = u ? m || "form" : v, E = (e) => typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e : "", D = async (e) => {
|
|
5600
5702
|
if (e.preventDefault(), u) return;
|
|
5601
5703
|
let n = new FormData(e.currentTarget);
|
|
@@ -5719,8 +5821,8 @@ function mr({ mode: e = "login", redirect: t, emailLabel: n = "Email", passwordL
|
|
|
5719
5821
|
]
|
|
5720
5822
|
});
|
|
5721
5823
|
}
|
|
5722
|
-
function
|
|
5723
|
-
let { user: c, status: l, signOut: u } =
|
|
5824
|
+
function gr({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !1, style: r, nodeRef: i, inert: a, linked: o, show: s }) {
|
|
5825
|
+
let { user: c, status: l, signOut: u } = fr(), p = a ? s || "user" : l, m = a ? {
|
|
5724
5826
|
name: "Ada Lovelace",
|
|
5725
5827
|
email: "ada@example.com"
|
|
5726
5828
|
} : c;
|
|
@@ -5785,40 +5887,40 @@ function hr({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !
|
|
|
5785
5887
|
}
|
|
5786
5888
|
//#endregion
|
|
5787
5889
|
//#region ../ui/src/components/builder/apps/consent/manifest.js
|
|
5788
|
-
var
|
|
5890
|
+
var _r = {
|
|
5789
5891
|
id: "consent",
|
|
5790
5892
|
label: "Cookie consent",
|
|
5791
5893
|
category: "Apps",
|
|
5792
5894
|
keys: ["CookieConsent"],
|
|
5793
5895
|
ssr: "shell",
|
|
5794
5896
|
settings: []
|
|
5795
|
-
},
|
|
5796
|
-
function
|
|
5897
|
+
}, vr = "webim.cookie_consent";
|
|
5898
|
+
function yr() {
|
|
5797
5899
|
try {
|
|
5798
|
-
let e = window.localStorage.getItem(
|
|
5900
|
+
let e = window.localStorage.getItem(vr), t = e ? JSON.parse(e) : null;
|
|
5799
5901
|
return t?.choice === "accepted" || t?.choice === "declined" ? t.choice : "";
|
|
5800
5902
|
} catch {
|
|
5801
5903
|
return "";
|
|
5802
5904
|
}
|
|
5803
5905
|
}
|
|
5804
|
-
function
|
|
5906
|
+
function br(e) {
|
|
5805
5907
|
try {
|
|
5806
5908
|
document.querySelectorAll(".webim-page").forEach((t) => t.setAttribute("data-webim-consent", e));
|
|
5807
5909
|
} catch {}
|
|
5808
5910
|
}
|
|
5809
|
-
function
|
|
5911
|
+
function xr(e) {
|
|
5810
5912
|
try {
|
|
5811
|
-
window.localStorage.setItem(
|
|
5913
|
+
window.localStorage.setItem(vr, JSON.stringify({
|
|
5812
5914
|
choice: e,
|
|
5813
5915
|
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5814
5916
|
}));
|
|
5815
5917
|
} catch {}
|
|
5816
|
-
|
|
5918
|
+
br(e);
|
|
5817
5919
|
try {
|
|
5818
5920
|
window.dispatchEvent(new CustomEvent("webim:consent", { detail: { choice: e } }));
|
|
5819
5921
|
} catch {}
|
|
5820
5922
|
}
|
|
5821
|
-
var
|
|
5923
|
+
var Sr = {
|
|
5822
5924
|
bottom: {
|
|
5823
5925
|
left: 0,
|
|
5824
5926
|
right: 0,
|
|
@@ -5840,18 +5942,18 @@ var xr = {
|
|
|
5840
5942
|
maxWidth: 400
|
|
5841
5943
|
}
|
|
5842
5944
|
};
|
|
5843
|
-
function
|
|
5945
|
+
function Cr({ message: e, acceptLabel: t, rejectLabel: n, showReject: r, linkLabel: i, linkHref: o, position: s, linked: c, style: p, nodeRef: m, inert: h }) {
|
|
5844
5946
|
let [g, _] = l(!!h), [v, y] = l(null), b = (e) => {
|
|
5845
5947
|
y(e), typeof m == "function" && m(e);
|
|
5846
5948
|
};
|
|
5847
5949
|
if (a(() => {
|
|
5848
5950
|
if (h) return;
|
|
5849
|
-
let e =
|
|
5850
|
-
e ?
|
|
5951
|
+
let e = yr();
|
|
5952
|
+
e ? br(e) : _(!0);
|
|
5851
5953
|
}, [h, v]), !g) return null;
|
|
5852
5954
|
let x = (e) => () => {
|
|
5853
|
-
h || (
|
|
5854
|
-
}, S =
|
|
5955
|
+
h || (xr(e), _(!1));
|
|
5956
|
+
}, S = Sr[s] ?? Sr.bottom, C = {
|
|
5855
5957
|
appearance: "none",
|
|
5856
5958
|
font: "inherit",
|
|
5857
5959
|
fontSize: 14,
|
|
@@ -5931,37 +6033,37 @@ function Sr({ message: e, acceptLabel: t, rejectLabel: n, showReject: r, linkLab
|
|
|
5931
6033
|
}
|
|
5932
6034
|
//#endregion
|
|
5933
6035
|
//#region ../ui/src/components/builder/apps/language/manifest.js
|
|
5934
|
-
var
|
|
6036
|
+
var wr = {
|
|
5935
6037
|
id: "language",
|
|
5936
6038
|
label: "Language",
|
|
5937
6039
|
category: "Apps",
|
|
5938
6040
|
keys: ["SiteLanguagePicker"],
|
|
5939
6041
|
ssr: "prefetch",
|
|
5940
6042
|
settings: ["locales"]
|
|
5941
|
-
},
|
|
6043
|
+
}, Tr = {
|
|
5942
6044
|
id: "search",
|
|
5943
6045
|
label: "Search",
|
|
5944
6046
|
category: "Apps",
|
|
5945
6047
|
keys: ["SiteSearch"],
|
|
5946
6048
|
ssr: "prefetch",
|
|
5947
6049
|
settings: []
|
|
5948
|
-
},
|
|
5949
|
-
function
|
|
6050
|
+
}, Er = 50, Dr = 2e3;
|
|
6051
|
+
function Or() {
|
|
5950
6052
|
return typeof window > "u" ? "" : new URLSearchParams(window.location.search).get("q") ?? "";
|
|
5951
6053
|
}
|
|
5952
|
-
function
|
|
6054
|
+
function kr(e, t) {
|
|
5953
6055
|
let n = e?.data ?? {}, r = [];
|
|
5954
6056
|
for (let e of Object.values(n)) {
|
|
5955
6057
|
let t = e == null ? "" : Ee(e);
|
|
5956
|
-
if (t && r.push(t), r.join(" ").length >
|
|
6058
|
+
if (t && r.push(t), r.join(" ").length > Dr) break;
|
|
5957
6059
|
}
|
|
5958
|
-
return r.join(" ").slice(0,
|
|
6060
|
+
return r.join(" ").slice(0, Dr).toLocaleLowerCase(t || void 0);
|
|
5959
6061
|
}
|
|
5960
|
-
function
|
|
5961
|
-
let { tenant: b, apiUrl: x, locale: S } = i(Y), [C, w] = l(() =>
|
|
6062
|
+
function Ar({ placeholder: e = "Search…", buttonLabel: t = "Search", showButton: n = !0, live: r = !1, layout: o = "inline", includePages: s = !0, collections: u = [], limit: p = 10, emptyText: m = "Nothing found", hint: h = "", style: g, nodeRef: _, inert: v = !1, sample: y = !1 }) {
|
|
6063
|
+
let { tenant: b, apiUrl: x, locale: S } = i(Y), [C, w] = l(() => Or()), [T, E] = l(() => Or()), [D, O] = l(null), [k, A] = l(!1), j = c(null), M = o === "popup";
|
|
5962
6064
|
a(() => {
|
|
5963
6065
|
let e = () => {
|
|
5964
|
-
let e =
|
|
6066
|
+
let e = Or();
|
|
5965
6067
|
w(e), E(e);
|
|
5966
6068
|
};
|
|
5967
6069
|
return window.addEventListener("popstate", e), window.addEventListener("webim:urlchange", e), () => {
|
|
@@ -6012,7 +6114,7 @@ function kr({ placeholder: e = "Search…", buttonLabel: t = "Search", showButto
|
|
|
6012
6114
|
});
|
|
6013
6115
|
}
|
|
6014
6116
|
else for (let t of e.rows) {
|
|
6015
|
-
if (!
|
|
6117
|
+
if (!kr(t, S).includes(N)) continue;
|
|
6016
6118
|
let n = t?.data ?? {}, r = Ee(n.name) || "Untitled", i = Ee(n.slug);
|
|
6017
6119
|
F.push({
|
|
6018
6120
|
key: `entry:${t.id}`,
|
|
@@ -6021,7 +6123,7 @@ function kr({ placeholder: e = "Search…", buttonLabel: t = "Search", showButto
|
|
|
6021
6123
|
kind: "entry"
|
|
6022
6124
|
});
|
|
6023
6125
|
}
|
|
6024
|
-
let I = F.slice(0, Math.min(Math.max(1, p),
|
|
6126
|
+
let I = F.slice(0, Math.min(Math.max(1, p), Er)), L = (e) => {
|
|
6025
6127
|
if (v) {
|
|
6026
6128
|
e.preventDefault(), w(T), A(!0);
|
|
6027
6129
|
return;
|
|
@@ -6161,21 +6263,21 @@ function kr({ placeholder: e = "Search…", buttonLabel: t = "Search", showButto
|
|
|
6161
6263
|
}
|
|
6162
6264
|
//#endregion
|
|
6163
6265
|
//#region ../ui/src/components/builder/apps/language/views.jsx
|
|
6164
|
-
function
|
|
6266
|
+
function jr(e) {
|
|
6165
6267
|
let t = e?.locales, n = [typeof t?.default == "string" && t.default.trim() ? t.default.trim() : "", ...Array.isArray(t?.enabled) ? t.enabled : []].filter((e) => typeof e == "string" && e.trim());
|
|
6166
6268
|
return [...new Set(n.map((e) => e.trim()))];
|
|
6167
6269
|
}
|
|
6168
|
-
var
|
|
6169
|
-
function
|
|
6270
|
+
var Mr = (e) => e && e.charAt(0).toUpperCase() + e.slice(1);
|
|
6271
|
+
function Nr(e, t) {
|
|
6170
6272
|
let n = String(e ?? "").toUpperCase();
|
|
6171
6273
|
if (t === "code") return n;
|
|
6172
6274
|
let r = "";
|
|
6173
6275
|
try {
|
|
6174
|
-
r =
|
|
6276
|
+
r = Mr(new Intl.DisplayNames([e], { type: "language" }).of(e) ?? "");
|
|
6175
6277
|
} catch {}
|
|
6176
6278
|
return !r || r.toUpperCase() === n ? n : t === "both" ? `${n} — ${r}` : r;
|
|
6177
6279
|
}
|
|
6178
|
-
function
|
|
6280
|
+
function Pr(e, t) {
|
|
6179
6281
|
let n = t ? "" : `?locale=${encodeURIComponent(e)}`;
|
|
6180
6282
|
if (typeof window > "u") return n || "?";
|
|
6181
6283
|
try {
|
|
@@ -6185,8 +6287,8 @@ function Nr(e, t) {
|
|
|
6185
6287
|
return n || "/";
|
|
6186
6288
|
}
|
|
6187
6289
|
}
|
|
6188
|
-
function
|
|
6189
|
-
let c = i(Y), l =
|
|
6290
|
+
function Fr({ variant: e, display: t, separator: n, label: r, style: a, nodeRef: o, inert: s }) {
|
|
6291
|
+
let c = i(Y), l = jr(c?.settings), u = l[0] ?? "", p = l.includes(c?.locale) ? c.locale : u, m = {
|
|
6190
6292
|
display: "inline-flex",
|
|
6191
6293
|
alignItems: "center",
|
|
6192
6294
|
gap: 8,
|
|
@@ -6221,7 +6323,7 @@ function Pr({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
6221
6323
|
style: { opacity: .4 },
|
|
6222
6324
|
children: n ?? "·"
|
|
6223
6325
|
}), /* @__PURE__ */ d("a", {
|
|
6224
|
-
href:
|
|
6326
|
+
href: Pr(e, e === u),
|
|
6225
6327
|
hrefLang: e,
|
|
6226
6328
|
"aria-current": e === p ? "true" : void 0,
|
|
6227
6329
|
onClick: s ? (e) => e.preventDefault() : void 0,
|
|
@@ -6231,7 +6333,7 @@ function Pr({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
6231
6333
|
textDecoration: "none",
|
|
6232
6334
|
cursor: s ? "default" : "pointer"
|
|
6233
6335
|
},
|
|
6234
|
-
children:
|
|
6336
|
+
children: Nr(e, t)
|
|
6235
6337
|
})]
|
|
6236
6338
|
}, e))]
|
|
6237
6339
|
}) : /* @__PURE__ */ f("div", {
|
|
@@ -6242,7 +6344,7 @@ function Pr({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
6242
6344
|
value: p,
|
|
6243
6345
|
onChange: s ? void 0 : (e) => {
|
|
6244
6346
|
let t = e.target.value;
|
|
6245
|
-
window.location.assign(
|
|
6347
|
+
window.location.assign(Pr(t, t === u));
|
|
6246
6348
|
},
|
|
6247
6349
|
onKeyDown: s ? (e) => e.preventDefault() : void 0,
|
|
6248
6350
|
style: {
|
|
@@ -6256,47 +6358,47 @@ function Pr({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
6256
6358
|
},
|
|
6257
6359
|
children: l.map((e) => /* @__PURE__ */ d("option", {
|
|
6258
6360
|
value: e,
|
|
6259
|
-
children:
|
|
6361
|
+
children: Nr(e, t)
|
|
6260
6362
|
}, e))
|
|
6261
6363
|
})]
|
|
6262
6364
|
});
|
|
6263
6365
|
}
|
|
6264
6366
|
//#endregion
|
|
6265
6367
|
//#region ../ui/src/components/builder/apps/index.js
|
|
6266
|
-
var
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
],
|
|
6272
|
-
SiteLoginForm:
|
|
6273
|
-
SiteAccountMenu:
|
|
6274
|
-
SiteLanguagePicker:
|
|
6275
|
-
CookieConsent:
|
|
6276
|
-
SiteSearch:
|
|
6368
|
+
var Ir = [
|
|
6369
|
+
ar,
|
|
6370
|
+
wr,
|
|
6371
|
+
_r,
|
|
6372
|
+
Tr
|
|
6373
|
+
], Lr = {
|
|
6374
|
+
SiteLoginForm: hr,
|
|
6375
|
+
SiteAccountMenu: gr,
|
|
6376
|
+
SiteLanguagePicker: Fr,
|
|
6377
|
+
CookieConsent: Cr,
|
|
6378
|
+
SiteSearch: Ar
|
|
6277
6379
|
};
|
|
6278
|
-
new Set(
|
|
6380
|
+
new Set(Ir.filter((e) => e.ssr === "shell").flatMap((e) => e.keys));
|
|
6279
6381
|
//#endregion
|
|
6280
6382
|
//#region ../ui/src/components/builder/three/runtime.js
|
|
6281
|
-
var
|
|
6383
|
+
var Rr = "0.185.1", zr = "4.2.0", Br = "https://cdn.jsdelivr.net/npm", Vr = `${Br}/three@${Rr}/+esm`, Hr = `${Br}/@google/model-viewer@${zr}/dist/model-viewer.min.js`, Ur = (e) => import(
|
|
6282
6384
|
/* @vite-ignore */
|
|
6283
6385
|
/* webpackIgnore: true */
|
|
6284
6386
|
e
|
|
6285
|
-
),
|
|
6286
|
-
function
|
|
6287
|
-
if (
|
|
6387
|
+
), Wr = /* @__PURE__ */ new Map();
|
|
6388
|
+
function Gr(e) {
|
|
6389
|
+
if (Wr.has(e)) return Wr.get(e);
|
|
6288
6390
|
if (typeof window > "u") return new Promise(() => {});
|
|
6289
|
-
let t =
|
|
6290
|
-
throw
|
|
6391
|
+
let t = Ur(e).catch((t) => {
|
|
6392
|
+
throw Wr.delete(e), t;
|
|
6291
6393
|
});
|
|
6292
|
-
return
|
|
6394
|
+
return Wr.set(e, t), t;
|
|
6293
6395
|
}
|
|
6294
|
-
var
|
|
6295
|
-
function
|
|
6296
|
-
return typeof window < "u" && window.customElements?.get("model-viewer") ? Promise.resolve(null) :
|
|
6396
|
+
var Kr = () => Gr(Vr), qr = (e) => Gr(`${Br}/three@${Rr}/examples/jsm/${e}/+esm`);
|
|
6397
|
+
function Jr() {
|
|
6398
|
+
return typeof window < "u" && window.customElements?.get("model-viewer") ? Promise.resolve(null) : Gr(Hr);
|
|
6297
6399
|
}
|
|
6298
|
-
var
|
|
6299
|
-
function
|
|
6400
|
+
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);
|
|
6401
|
+
function Zr(e, t) {
|
|
6300
6402
|
let n = 0, r = 0, i = 0, a = !0, o = (e) => {
|
|
6301
6403
|
n = requestAnimationFrame(o), i ||= e;
|
|
6302
6404
|
let a = r ? (e - r) / 1e3 : 0;
|
|
@@ -6315,7 +6417,7 @@ function Xr(e, t) {
|
|
|
6315
6417
|
s(), l?.disconnect(), document.removeEventListener("visibilitychange", c);
|
|
6316
6418
|
};
|
|
6317
6419
|
}
|
|
6318
|
-
function
|
|
6420
|
+
function Qr(e, t, n = {}) {
|
|
6319
6421
|
let r = {
|
|
6320
6422
|
radius: n.distance ?? 4,
|
|
6321
6423
|
polar: n.polar ?? Math.PI / 2.4,
|
|
@@ -6364,13 +6466,13 @@ function Zr(e, t, n = {}) {
|
|
|
6364
6466
|
}
|
|
6365
6467
|
//#endregion
|
|
6366
6468
|
//#region ../ui/src/components/builder/three/views.jsx
|
|
6367
|
-
var
|
|
6368
|
-
function
|
|
6469
|
+
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, ni = (e) => typeof e == "string" && !!e.trim();
|
|
6470
|
+
function ri({ label: e, note: t, height: n, nodeRef: r, style: i }) {
|
|
6369
6471
|
return /* @__PURE__ */ f("div", {
|
|
6370
6472
|
ref: r,
|
|
6371
6473
|
style: {
|
|
6372
6474
|
...P(i),
|
|
6373
|
-
minHeight:
|
|
6475
|
+
minHeight: $r(n, 320),
|
|
6374
6476
|
display: "flex",
|
|
6375
6477
|
flexDirection: "column",
|
|
6376
6478
|
alignItems: "center",
|
|
@@ -6398,24 +6500,24 @@ function ni({ label: e, note: t, height: n, nodeRef: r, style: i }) {
|
|
|
6398
6500
|
}) : null]
|
|
6399
6501
|
});
|
|
6400
6502
|
}
|
|
6401
|
-
function
|
|
6503
|
+
function ii({ src: e, poster: t, alt: n, height: r, bg: i, autoRotate: o, rotateDelay: s, cameraControls: c, ar: u, exposure: f, shadow: p, fieldOfView: m, environment: h, style: g, nodeRef: _, inert: v }) {
|
|
6402
6504
|
let [y, b] = l(typeof window < "u" && !!window.customElements?.get("model-viewer")), [x, S] = l(!1);
|
|
6403
6505
|
a(() => {
|
|
6404
6506
|
if (y || !e) return;
|
|
6405
6507
|
let t = !0;
|
|
6406
|
-
return
|
|
6508
|
+
return Jr().then(() => t && b(!0), () => t && S(!0)), () => {
|
|
6407
6509
|
t = !1;
|
|
6408
6510
|
};
|
|
6409
6511
|
}, [y, e]);
|
|
6410
6512
|
let C = {
|
|
6411
6513
|
display: "block",
|
|
6412
6514
|
width: "100%",
|
|
6413
|
-
minHeight:
|
|
6414
|
-
height:
|
|
6515
|
+
minHeight: $r(r, 360),
|
|
6516
|
+
height: $r(r, 360),
|
|
6415
6517
|
backgroundColor: i || "transparent",
|
|
6416
6518
|
...P(g)
|
|
6417
6519
|
};
|
|
6418
|
-
if (!e) return v ? /* @__PURE__ */ d(
|
|
6520
|
+
if (!e) return v ? /* @__PURE__ */ d(ri, {
|
|
6419
6521
|
nodeRef: _,
|
|
6420
6522
|
style: g,
|
|
6421
6523
|
height: r,
|
|
@@ -6450,13 +6552,13 @@ function ri({ src: e, poster: t, alt: n, height: r, bg: i, autoRotate: o, rotate
|
|
|
6450
6552
|
poster: t || void 0,
|
|
6451
6553
|
style: C,
|
|
6452
6554
|
"camera-controls": w(!v && c !== !1),
|
|
6453
|
-
"auto-rotate": w(T && !
|
|
6454
|
-
"auto-rotate-delay": T ? String(
|
|
6555
|
+
"auto-rotate": w(T && !Yr()),
|
|
6556
|
+
"auto-rotate-delay": T ? String($r(s, 0)) : void 0,
|
|
6455
6557
|
"rotation-per-second": "18deg",
|
|
6456
6558
|
ar: w(!v && u === !0),
|
|
6457
6559
|
"ar-modes": "webxr scene-viewer quick-look",
|
|
6458
|
-
"shadow-intensity": String(
|
|
6459
|
-
exposure: String(
|
|
6560
|
+
"shadow-intensity": String(ei(p, 100)),
|
|
6561
|
+
exposure: String(ei(f, 100)),
|
|
6460
6562
|
"field-of-view": m ? `${Number(m)}deg` : void 0,
|
|
6461
6563
|
"environment-image": h && h !== "neutral" ? h : "neutral",
|
|
6462
6564
|
"interaction-prompt": v ? "none" : void 0,
|
|
@@ -6474,7 +6576,7 @@ function ri({ src: e, poster: t, alt: n, height: r, bg: i, autoRotate: o, rotate
|
|
|
6474
6576
|
}) : null
|
|
6475
6577
|
});
|
|
6476
6578
|
}
|
|
6477
|
-
var
|
|
6579
|
+
var ai = ["attribute vec2 p;", "void main() { gl_Position = vec4(p, 0.0, 1.0); }"].join("\n"), oi = [
|
|
6478
6580
|
"precision highp float;",
|
|
6479
6581
|
"uniform vec2 u_res;",
|
|
6480
6582
|
"uniform float u_time;",
|
|
@@ -6497,7 +6599,7 @@ var ii = ["attribute vec2 p;", "void main() { gl_Position = vec4(p, 0.0, 1.0); }
|
|
|
6497
6599
|
" return v;",
|
|
6498
6600
|
"}",
|
|
6499
6601
|
""
|
|
6500
|
-
].join("\n"),
|
|
6602
|
+
].join("\n"), si = {
|
|
6501
6603
|
gradient: [
|
|
6502
6604
|
"void main(){",
|
|
6503
6605
|
" vec2 uv = gl_FragCoord.xy / u_res;",
|
|
@@ -6549,7 +6651,7 @@ var ii = ["attribute vec2 p;", "void main() { gl_Position = vec4(p, 0.0, 1.0); }
|
|
|
6549
6651
|
"}"
|
|
6550
6652
|
].join("\n")
|
|
6551
6653
|
};
|
|
6552
|
-
function
|
|
6654
|
+
function ci(e, t) {
|
|
6553
6655
|
let n = /^#?([0-9a-f]{6})$/i.exec(String(e ?? "").trim());
|
|
6554
6656
|
if (!n) return t;
|
|
6555
6657
|
let r = parseInt(n[1], 16);
|
|
@@ -6559,7 +6661,7 @@ function si(e, t) {
|
|
|
6559
6661
|
(r & 255) / 255
|
|
6560
6662
|
];
|
|
6561
6663
|
}
|
|
6562
|
-
function
|
|
6664
|
+
function li(e, t, n) {
|
|
6563
6665
|
let r = e.createShader(t);
|
|
6564
6666
|
if (e.shaderSource(r, n), e.compileShader(r), !e.getShaderParameter(r, e.COMPILE_STATUS)) {
|
|
6565
6667
|
let t = e.getShaderInfoLog(r);
|
|
@@ -6567,13 +6669,13 @@ function ci(e, t, n) {
|
|
|
6567
6669
|
}
|
|
6568
6670
|
return r;
|
|
6569
6671
|
}
|
|
6570
|
-
function
|
|
6672
|
+
function ui({ preset: e, code: t, colorA: n, colorB: r, colorC: i, speed: o, scale: s, height: u, interactive: p, style: m, nodeRef: h, inert: g }) {
|
|
6571
6673
|
let _ = c(null), v = c(null), y = c(null), [b, x] = l("");
|
|
6572
6674
|
a(() => () => {
|
|
6573
6675
|
let e = y.current;
|
|
6574
6676
|
y.current = null, e?.getExtension("WEBGL_lose_context")?.loseContext();
|
|
6575
6677
|
}, []);
|
|
6576
|
-
let S = typeof t == "string" && t.trim() ? t :
|
|
6678
|
+
let S = typeof t == "string" && t.trim() ? t : si[e] ?? si.gradient, C = String(n ?? ""), w = String(r ?? ""), T = String(i ?? ""), E = ei(o, 100), D = Math.max(.05, ei(s, 100));
|
|
6577
6679
|
return a(() => {
|
|
6578
6680
|
let e = _.current, t = v.current;
|
|
6579
6681
|
if (!e || !t) return;
|
|
@@ -6588,7 +6690,7 @@ function li({ preset: e, code: t, colorA: n, colorB: r, colorC: i, speed: o, sca
|
|
|
6588
6690
|
}
|
|
6589
6691
|
let r = null;
|
|
6590
6692
|
try {
|
|
6591
|
-
let e =
|
|
6693
|
+
let e = li(n, n.VERTEX_SHADER, ai), t = li(n, n.FRAGMENT_SHADER, oi + S);
|
|
6592
6694
|
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");
|
|
6593
6695
|
x("");
|
|
6594
6696
|
} catch (e) {
|
|
@@ -6624,28 +6726,28 @@ function li({ preset: e, code: t, colorA: n, colorB: r, colorC: i, speed: o, sca
|
|
|
6624
6726
|
};
|
|
6625
6727
|
p !== !1 && t.addEventListener("pointermove", l);
|
|
6626
6728
|
let u = () => {
|
|
6627
|
-
let r =
|
|
6729
|
+
let r = Xr(), i = Math.max(1, Math.round(t.clientWidth * r)), a = Math.max(1, Math.round(t.clientHeight * r));
|
|
6628
6730
|
(e.width !== i || e.height !== a) && (e.width = i, e.height = a, n.viewport(0, 0, i, a));
|
|
6629
6731
|
}, d = typeof ResizeObserver > "u" ? null : new ResizeObserver(u);
|
|
6630
6732
|
d?.observe(t), u();
|
|
6631
|
-
let f =
|
|
6632
|
-
a:
|
|
6733
|
+
let f = Yr(), m = {
|
|
6734
|
+
a: ci(C, [
|
|
6633
6735
|
.35,
|
|
6634
6736
|
.4,
|
|
6635
6737
|
.95
|
|
6636
6738
|
]),
|
|
6637
|
-
b:
|
|
6739
|
+
b: ci(w, [
|
|
6638
6740
|
.05,
|
|
6639
6741
|
.06,
|
|
6640
6742
|
.16
|
|
6641
6743
|
]),
|
|
6642
|
-
c:
|
|
6744
|
+
c: ci(T, [
|
|
6643
6745
|
.95,
|
|
6644
6746
|
.35,
|
|
6645
6747
|
.6
|
|
6646
6748
|
])
|
|
6647
6749
|
}, h = {};
|
|
6648
|
-
return h.stop =
|
|
6750
|
+
return h.stop = Zr(t, (t, r) => {
|
|
6649
6751
|
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?.();
|
|
6650
6752
|
}), () => {
|
|
6651
6753
|
h.stop?.(), d?.disconnect(), t.removeEventListener("pointermove", l), n.deleteProgram(r), n.deleteBuffer(i);
|
|
@@ -6664,7 +6766,7 @@ function li({ preset: e, code: t, colorA: n, colorB: r, colorC: i, speed: o, sca
|
|
|
6664
6766
|
},
|
|
6665
6767
|
style: {
|
|
6666
6768
|
position: "relative",
|
|
6667
|
-
minHeight:
|
|
6769
|
+
minHeight: $r(u, 320),
|
|
6668
6770
|
overflow: "hidden",
|
|
6669
6771
|
...P(m)
|
|
6670
6772
|
},
|
|
@@ -6696,7 +6798,7 @@ function li({ preset: e, code: t, colorA: n, colorB: r, colorC: i, speed: o, sca
|
|
|
6696
6798
|
}) : null]
|
|
6697
6799
|
});
|
|
6698
6800
|
}
|
|
6699
|
-
function
|
|
6801
|
+
function di(e, t) {
|
|
6700
6802
|
let n = new e.Scene(), r = new e.BoxGeometry();
|
|
6701
6803
|
r.deleteAttribute("uv");
|
|
6702
6804
|
let i = new e.Mesh(r, new e.MeshBasicMaterial({
|
|
@@ -6712,23 +6814,23 @@ function ui(e, t) {
|
|
|
6712
6814
|
let o = new e.PMREMGenerator(t), s = o.fromScene(n, .04);
|
|
6713
6815
|
return o.dispose(), r.dispose(), n.traverse((e) => e.material?.dispose?.()), s.texture;
|
|
6714
6816
|
}
|
|
6715
|
-
var
|
|
6716
|
-
function
|
|
6717
|
-
if (
|
|
6718
|
-
let t =
|
|
6817
|
+
var fi = /* @__PURE__ */ new Map();
|
|
6818
|
+
function pi(e) {
|
|
6819
|
+
if (fi.has(e)) return fi.get(e);
|
|
6820
|
+
let t = qr("loaders/GLTFLoader.js").then((t) => new Promise((n, r) => {
|
|
6719
6821
|
new t.GLTFLoader().load(e, (e) => n(e.scene), void 0, r);
|
|
6720
6822
|
})).catch((t) => {
|
|
6721
|
-
throw
|
|
6823
|
+
throw fi.delete(e), t;
|
|
6722
6824
|
});
|
|
6723
|
-
return
|
|
6825
|
+
return fi.set(e, t), t;
|
|
6724
6826
|
}
|
|
6725
|
-
function
|
|
6827
|
+
function mi(e, t) {
|
|
6726
6828
|
let n = new e.Box3().setFromObject(t);
|
|
6727
6829
|
if (n.isEmpty()) return t;
|
|
6728
6830
|
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();
|
|
6729
6831
|
return t.position.sub(i), t.scale.multiplyScalar(1 / a), t.position.multiplyScalar(1 / a), o.add(t), o;
|
|
6730
6832
|
}
|
|
6731
|
-
var
|
|
6833
|
+
var hi = {
|
|
6732
6834
|
box: (e) => new e.BoxGeometry(1, 1, 1, 1, 1, 1),
|
|
6733
6835
|
sphere: (e) => new e.SphereGeometry(.62, 48, 32),
|
|
6734
6836
|
torus: (e) => new e.TorusGeometry(.5, .2, 24, 64),
|
|
@@ -6737,50 +6839,50 @@ var mi = {
|
|
|
6737
6839
|
cylinder: (e) => new e.CylinderGeometry(.45, .45, 1.1, 48),
|
|
6738
6840
|
plane: (e) => new e.PlaneGeometry(1.4, 1.4),
|
|
6739
6841
|
capsule: (e) => new e.CapsuleGeometry(.35, .6, 8, 32)
|
|
6740
|
-
},
|
|
6741
|
-
function
|
|
6742
|
-
let g = c(null), [_, v] = l(!1), y = Array.isArray(e) ? e.filter((e) => e && typeof e == "object") : [], b = JSON.stringify(y), x = i !== !1 && !
|
|
6842
|
+
}, gi = (e, t) => Number.isFinite(Number(e)) ? Number(e) : t;
|
|
6843
|
+
function _i({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate: i, spinSpeed: o, controls: s, ground: u, height: f, style: p, nodeRef: m, inert: h }) {
|
|
6844
|
+
let g = c(null), [_, v] = l(!1), y = Array.isArray(e) ? e.filter((e) => e && typeof e == "object") : [], b = JSON.stringify(y), x = i !== !1 && !Yr(), S = s !== !1 && !h;
|
|
6743
6845
|
return a(() => {
|
|
6744
6846
|
let e = g.current;
|
|
6745
6847
|
if (!e) return;
|
|
6746
6848
|
let i = !0, a = null;
|
|
6747
|
-
return
|
|
6849
|
+
return Kr().then((s) => {
|
|
6748
6850
|
if (!i || !e) return;
|
|
6749
6851
|
let c = new s.WebGLRenderer({
|
|
6750
6852
|
antialias: !0,
|
|
6751
6853
|
alpha: !t
|
|
6752
6854
|
});
|
|
6753
|
-
c.setPixelRatio(
|
|
6855
|
+
c.setPixelRatio(Xr()), c.shadowMap.enabled = u !== !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);
|
|
6754
6856
|
let l = new s.Scene();
|
|
6755
|
-
t && (l.background = new s.Color(t)), l.environment =
|
|
6756
|
-
let d = new s.PerspectiveCamera(
|
|
6757
|
-
distance:
|
|
6857
|
+
t && (l.background = new s.Color(t)), l.environment = di(s, c);
|
|
6858
|
+
let d = new s.PerspectiveCamera(gi(r, 45), 1, .1, 400), f = Qr(d, c.domElement, {
|
|
6859
|
+
distance: gi(n, 5),
|
|
6758
6860
|
enableZoom: S
|
|
6759
6861
|
}), p = new s.DirectionalLight(16777215, 2.2);
|
|
6760
6862
|
p.position.set(4, 7, 5), p.castShadow = u !== !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));
|
|
6761
6863
|
let m = [], h = new s.Group(), g = (e, t) => {
|
|
6762
|
-
let n =
|
|
6763
|
-
e.position.set(
|
|
6864
|
+
let n = gi(t.scale, 1);
|
|
6865
|
+
e.position.set(gi(t.x, 0), gi(t.y, 0), gi(t.z, 0)), e.rotation.set(ti(t.rx), ti(t.ry), ti(t.rz)), e.scale.setScalar(n > 0 ? n : 1), e.userData.spin = ti(t.spin);
|
|
6764
6866
|
};
|
|
6765
6867
|
for (let e of y) {
|
|
6766
6868
|
if (e.shape === "model") {
|
|
6767
|
-
if (!
|
|
6869
|
+
if (!ni(e.src)) continue;
|
|
6768
6870
|
let t = new s.Group();
|
|
6769
|
-
g(t, e), h.add(t),
|
|
6871
|
+
g(t, e), h.add(t), pi(e.src).then((e) => {
|
|
6770
6872
|
if (!i) return;
|
|
6771
|
-
let n =
|
|
6873
|
+
let n = mi(s, e.clone(!0));
|
|
6772
6874
|
n.traverse((e) => {
|
|
6773
6875
|
e.isMesh && (e.castShadow = !0, e.receiveShadow = !0);
|
|
6774
6876
|
}), t.add(n);
|
|
6775
6877
|
}, () => {});
|
|
6776
6878
|
continue;
|
|
6777
6879
|
}
|
|
6778
|
-
let t = (
|
|
6880
|
+
let t = (hi[e.shape] ?? hi.box)(s), n = new s.MeshStandardMaterial({
|
|
6779
6881
|
color: /^#?[0-9a-f]{6}$/i.test(String(e.color ?? "")) ? e.color : "#6366f1",
|
|
6780
|
-
metalness: Math.min(1, Math.max(0,
|
|
6781
|
-
roughness: Math.min(1, Math.max(0,
|
|
6782
|
-
transparent:
|
|
6783
|
-
opacity: Math.min(1, Math.max(0,
|
|
6882
|
+
metalness: Math.min(1, Math.max(0, ei(e.metalness, 10))),
|
|
6883
|
+
roughness: Math.min(1, Math.max(0, ei(e.roughness, 35))),
|
|
6884
|
+
transparent: ei(e.opacity, 100) < 1,
|
|
6885
|
+
opacity: Math.min(1, Math.max(0, ei(e.opacity, 100))),
|
|
6784
6886
|
flatShading: e.flat === !0,
|
|
6785
6887
|
wireframe: e.wireframe === !0,
|
|
6786
6888
|
side: e.shape === "plane" ? s.DoubleSide : s.FrontSide
|
|
@@ -6791,14 +6893,14 @@ function gi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate:
|
|
|
6791
6893
|
let _ = null;
|
|
6792
6894
|
if (u !== !1) {
|
|
6793
6895
|
let e = new s.ShadowMaterial({ opacity: .22 }), t = new s.PlaneGeometry(60, 60);
|
|
6794
|
-
_ = new s.Mesh(t, e), _.rotation.x = -Math.PI / 2, _.position.y =
|
|
6896
|
+
_ = new s.Mesh(t, e), _.rotation.x = -Math.PI / 2, _.position.y = gi(u === !0 ? 0 : u, -.85), _.receiveShadow = !0, l.add(_), m.push(t, e);
|
|
6795
6897
|
}
|
|
6796
6898
|
let v = () => {
|
|
6797
6899
|
let t = Math.max(1, e.clientWidth), n = Math.max(1, e.clientHeight);
|
|
6798
6900
|
c.setSize(t, n, !1), d.aspect = t / n, d.updateProjectionMatrix();
|
|
6799
6901
|
}, b = typeof ResizeObserver > "u" ? null : new ResizeObserver(v);
|
|
6800
6902
|
b?.observe(e), v();
|
|
6801
|
-
let C =
|
|
6903
|
+
let C = ti(Number.isFinite(Number(o)) ? o : 20), w = Zr(e, (e) => {
|
|
6802
6904
|
f.autoSpin(x ? C : 0, e), f.update();
|
|
6803
6905
|
for (let t of h.children) t.userData.spin && (t.rotation.y += t.userData.spin * e);
|
|
6804
6906
|
c.render(l, d);
|
|
@@ -6822,7 +6924,7 @@ function gi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate:
|
|
|
6822
6924
|
o,
|
|
6823
6925
|
S,
|
|
6824
6926
|
u
|
|
6825
|
-
]), _ && h ? /* @__PURE__ */ d(
|
|
6927
|
+
]), _ && h ? /* @__PURE__ */ d(ri, {
|
|
6826
6928
|
nodeRef: m,
|
|
6827
6929
|
style: p,
|
|
6828
6930
|
height: f,
|
|
@@ -6833,27 +6935,27 @@ function gi({ objects: e, background: t, cameraDistance: n, fov: r, autoRotate:
|
|
|
6833
6935
|
g.current = e, typeof m == "function" && m(e);
|
|
6834
6936
|
},
|
|
6835
6937
|
style: {
|
|
6836
|
-
minHeight:
|
|
6837
|
-
height:
|
|
6938
|
+
minHeight: $r(f, 380),
|
|
6939
|
+
height: $r(f, 380),
|
|
6838
6940
|
overflow: "hidden",
|
|
6839
6941
|
touchAction: S ? "pan-y" : void 0,
|
|
6840
6942
|
...P(p)
|
|
6841
6943
|
}
|
|
6842
6944
|
});
|
|
6843
6945
|
}
|
|
6844
|
-
function
|
|
6946
|
+
function vi({ code: e, height: t, background: n, style: r, nodeRef: i, inert: o }) {
|
|
6845
6947
|
let s = c(null), [u, f] = l("");
|
|
6846
6948
|
return a(() => {
|
|
6847
6949
|
let t = s.current;
|
|
6848
6950
|
if (o || !t || typeof e != "string" || !e.trim()) return;
|
|
6849
6951
|
let r = !0, i = null;
|
|
6850
|
-
return
|
|
6952
|
+
return Kr().then((a) => {
|
|
6851
6953
|
if (!r || !t) return;
|
|
6852
6954
|
let o = new a.WebGLRenderer({
|
|
6853
6955
|
antialias: !0,
|
|
6854
6956
|
alpha: !n
|
|
6855
6957
|
});
|
|
6856
|
-
o.setPixelRatio(
|
|
6958
|
+
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);
|
|
6857
6959
|
let s = new a.Scene();
|
|
6858
6960
|
n && (s.background = new a.Color(n));
|
|
6859
6961
|
let c = new a.PerspectiveCamera(45, 1, .1, 1e3);
|
|
@@ -6876,7 +6978,7 @@ function _i({ code: e, height: t, background: n, style: r, nodeRef: i, inert: o
|
|
|
6876
6978
|
o.setSize(e, n, !1), c.aspect = e / n, c.updateProjectionMatrix();
|
|
6877
6979
|
}, d = typeof ResizeObserver > "u" ? null : new ResizeObserver(u);
|
|
6878
6980
|
d?.observe(t), u();
|
|
6879
|
-
let p = !1, m =
|
|
6981
|
+
let p = !1, m = Zr(t, (e, t) => {
|
|
6880
6982
|
if (!p && typeof l?.frame == "function") try {
|
|
6881
6983
|
l.frame(e, t);
|
|
6882
6984
|
} catch (e) {
|
|
@@ -6898,7 +7000,7 @@ function _i({ code: e, height: t, background: n, style: r, nodeRef: i, inert: o
|
|
|
6898
7000
|
e,
|
|
6899
7001
|
o,
|
|
6900
7002
|
n
|
|
6901
|
-
]), o ? /* @__PURE__ */ d(
|
|
7003
|
+
]), o ? /* @__PURE__ */ d(ri, {
|
|
6902
7004
|
nodeRef: i,
|
|
6903
7005
|
style: r,
|
|
6904
7006
|
height: t,
|
|
@@ -6909,8 +7011,8 @@ function _i({ code: e, height: t, background: n, style: r, nodeRef: i, inert: o
|
|
|
6909
7011
|
s.current = e, typeof i == "function" && i(e);
|
|
6910
7012
|
},
|
|
6911
7013
|
style: {
|
|
6912
|
-
minHeight:
|
|
6913
|
-
height:
|
|
7014
|
+
minHeight: $r(t, 380),
|
|
7015
|
+
height: $r(t, 380),
|
|
6914
7016
|
overflow: "hidden",
|
|
6915
7017
|
position: "relative",
|
|
6916
7018
|
touchAction: "pan-y",
|
|
@@ -6933,40 +7035,40 @@ function _i({ code: e, height: t, background: n, style: r, nodeRef: i, inert: o
|
|
|
6933
7035
|
}) : null
|
|
6934
7036
|
});
|
|
6935
7037
|
}
|
|
6936
|
-
var
|
|
6937
|
-
ModelViewerBlock:
|
|
6938
|
-
ShaderBlock:
|
|
6939
|
-
SceneBlock:
|
|
6940
|
-
ThreeCanvasBlock:
|
|
6941
|
-
},
|
|
6942
|
-
function
|
|
6943
|
-
if (
|
|
7038
|
+
var yi = {
|
|
7039
|
+
ModelViewerBlock: ii,
|
|
7040
|
+
ShaderBlock: ui,
|
|
7041
|
+
SceneBlock: _i,
|
|
7042
|
+
ThreeCanvasBlock: vi
|
|
7043
|
+
}, bi = /* @__PURE__ */ new Map();
|
|
7044
|
+
function xi(e) {
|
|
7045
|
+
if (bi.has(e)) return bi.get(e);
|
|
6944
7046
|
let t = URL.createObjectURL(new Blob([e], { type: "text/javascript" })), n = import(
|
|
6945
7047
|
/* @vite-ignore */
|
|
6946
7048
|
/* webpackIgnore: true */
|
|
6947
7049
|
t
|
|
6948
7050
|
).finally(() => URL.revokeObjectURL(t));
|
|
6949
|
-
return
|
|
7051
|
+
return bi.set(e, n), n;
|
|
6950
7052
|
}
|
|
6951
|
-
function
|
|
7053
|
+
function Si(e) {
|
|
6952
7054
|
let t = e && typeof e == "object" ? e.builder_plugins : null, n = t && typeof t == "object" ? t.plugins : null;
|
|
6953
7055
|
return n && typeof n == "object" ? n : {};
|
|
6954
7056
|
}
|
|
6955
7057
|
//#endregion
|
|
6956
7058
|
//#region ../ui/src/components/builder/plugins/view.jsx
|
|
6957
|
-
async function
|
|
6958
|
-
let n = await
|
|
7059
|
+
async function Ci(e, t) {
|
|
7060
|
+
let n = await xi(e);
|
|
6959
7061
|
return (Array.isArray(n?.default?.blocks) ? n.default.blocks : []).find((e) => e?.id === t && typeof e.mount == "function") ?? null;
|
|
6960
7062
|
}
|
|
6961
|
-
var
|
|
7063
|
+
var wi = {
|
|
6962
7064
|
padding: "10px 12px",
|
|
6963
7065
|
border: "1px dashed rgba(148, 163, 184, 0.5)",
|
|
6964
7066
|
borderRadius: 8,
|
|
6965
7067
|
fontSize: 12,
|
|
6966
7068
|
opacity: .6
|
|
6967
7069
|
};
|
|
6968
|
-
function
|
|
6969
|
-
let s = i(Y), l =
|
|
7070
|
+
function Ti({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
7071
|
+
let s = i(Y), l = Si(s?.settings)[e], u = c(null), p = c(null), m = {
|
|
6970
7072
|
tenant: s?.tenant ?? "",
|
|
6971
7073
|
apiUrl: s?.apiUrl ?? "/api",
|
|
6972
7074
|
locale: s?.locale ?? "",
|
|
@@ -6978,7 +7080,7 @@ function wi({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
|
6978
7080
|
let e = u.current;
|
|
6979
7081
|
if (!l?.code || !e) return;
|
|
6980
7082
|
let n = !0;
|
|
6981
|
-
return
|
|
7083
|
+
return Ci(l.code, t).then((e) => {
|
|
6982
7084
|
if (!(!n || !e || !u.current)) {
|
|
6983
7085
|
p.current = e;
|
|
6984
7086
|
try {
|
|
@@ -7008,7 +7110,7 @@ function wi({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
|
7008
7110
|
}) : /* @__PURE__ */ f("div", {
|
|
7009
7111
|
ref: o,
|
|
7010
7112
|
style: {
|
|
7011
|
-
...
|
|
7113
|
+
...wi,
|
|
7012
7114
|
...P(r)
|
|
7013
7115
|
},
|
|
7014
7116
|
children: [
|
|
@@ -7020,13 +7122,13 @@ function wi({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
|
7020
7122
|
}
|
|
7021
7123
|
//#endregion
|
|
7022
7124
|
//#region ../ui/src/components/builder/render.jsx
|
|
7023
|
-
var
|
|
7024
|
-
...
|
|
7025
|
-
...
|
|
7026
|
-
...
|
|
7027
|
-
PluginBlock:
|
|
7125
|
+
var Ei = {
|
|
7126
|
+
...ir,
|
|
7127
|
+
...Lr,
|
|
7128
|
+
...yi,
|
|
7129
|
+
PluginBlock: Ti
|
|
7028
7130
|
};
|
|
7029
|
-
function
|
|
7131
|
+
function Di(e, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
7030
7132
|
let o = n[e];
|
|
7031
7133
|
if (!o || o.hidden) return null;
|
|
7032
7134
|
let s = o.type?.resolvedName, c = a?.mapProps ? a.mapProps(o.props ?? {}, s) : o.props ?? {};
|
|
@@ -7034,11 +7136,11 @@ function Ei(e, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
|
7034
7136
|
let n = o.props?.componentId, s = r?.[n];
|
|
7035
7137
|
if (!s?.template || i.has(n)) return null;
|
|
7036
7138
|
let c = new Set(i).add(n);
|
|
7037
|
-
return /* @__PURE__ */ d(t, { children:
|
|
7139
|
+
return /* @__PURE__ */ d(t, { children: Di(s.template.rootId, s.template.nodes, r, c, a) }, e);
|
|
7038
7140
|
}
|
|
7039
|
-
let l =
|
|
7141
|
+
let l = Ei[s];
|
|
7040
7142
|
if (!l) return null;
|
|
7041
|
-
let u = (o.nodes ?? []).map((e) =>
|
|
7143
|
+
let u = (o.nodes ?? []).map((e) => Di(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, Di(t, n, r, i, a)])) : void 0, m = /* @__PURE__ */ d(l, {
|
|
7042
7144
|
...c,
|
|
7043
7145
|
...s === "CollectionList" ? { templateId: o.linkedNodes?.card } : null,
|
|
7044
7146
|
linked: p,
|
|
@@ -7047,16 +7149,16 @@ function Ei(e, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
|
7047
7149
|
},
|
|
7048
7150
|
children: u.length ? u : void 0
|
|
7049
7151
|
}, e);
|
|
7050
|
-
return c.when && c.when !== "always" ? /* @__PURE__ */ d(
|
|
7152
|
+
return c.when && c.when !== "always" ? /* @__PURE__ */ d(mr, {
|
|
7051
7153
|
when: c.when,
|
|
7052
7154
|
children: m
|
|
7053
7155
|
}, e) : m;
|
|
7054
7156
|
}
|
|
7055
7157
|
//#endregion
|
|
7056
7158
|
//#region ../ui/src/components/builder/PageRenderer.jsx
|
|
7057
|
-
var
|
|
7159
|
+
var Oi = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" "), ki = (e) => `.webim-page[data-webim-mode="light"] { ${Object.entries(me(e.light)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }
|
|
7058
7160
|
.webim-page[data-webim-mode="dark"] { ${Object.entries(me(e.dark)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }`;
|
|
7059
|
-
function
|
|
7161
|
+
function Ai({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, custom: o, animations: c, tenant: l, apiUrl: u, datasets: p, locale: m, direction: g, settings: _, siteUser: v }) {
|
|
7060
7162
|
let y = o?.js?.trim();
|
|
7061
7163
|
if (a(() => {
|
|
7062
7164
|
if (!y) return;
|
|
@@ -7070,11 +7172,11 @@ function ki({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
7070
7172
|
minHeight: "100%",
|
|
7071
7173
|
display: "flex",
|
|
7072
7174
|
flexDirection: "column"
|
|
7073
|
-
}, w =
|
|
7175
|
+
}, w = Di("ROOT", e, n), T = s(() => ({ render: (t, r) => Di(t, e, n, void 0, { mapProps: r }) }), [e, n]), E = se(e, n), O = oe(e, n), k = o?.css?.trim(), j = S(c), M = pe(t), N = [M.font, M.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !ue[e]), P = [.../* @__PURE__ */ new Set([...A(e, n), ...N])].map((e) => /* @__PURE__ */ d("link", {
|
|
7074
7176
|
rel: "stylesheet",
|
|
7075
7177
|
precedence: "default",
|
|
7076
7178
|
href: D(e)
|
|
7077
|
-
}, e)), F =
|
|
7179
|
+
}, e)), F = ki(M);
|
|
7078
7180
|
return r === "auto" ? /* @__PURE__ */ d(Y.Provider, {
|
|
7079
7181
|
value: {
|
|
7080
7182
|
tenant: l || "",
|
|
@@ -7082,7 +7184,7 @@ function ki({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
7082
7184
|
locale: m || "",
|
|
7083
7185
|
settings: _ ?? null
|
|
7084
7186
|
},
|
|
7085
|
-
children: /* @__PURE__ */ d(
|
|
7187
|
+
children: /* @__PURE__ */ d(pr, {
|
|
7086
7188
|
initialUser: v,
|
|
7087
7189
|
children: /* @__PURE__ */ d(xe.Provider, {
|
|
7088
7190
|
value: p ?? null,
|
|
@@ -7097,8 +7199,8 @@ function ki({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
7097
7199
|
...i
|
|
7098
7200
|
},
|
|
7099
7201
|
children: [
|
|
7100
|
-
/* @__PURE__ */ d("style", { children: `.webim-page { ${
|
|
7101
|
-
@media (prefers-color-scheme: dark) { .webim-page { ${
|
|
7202
|
+
/* @__PURE__ */ d("style", { children: `.webim-page { ${Oi(me(M.light))} }
|
|
7203
|
+
@media (prefers-color-scheme: dark) { .webim-page { ${Oi(me(M.dark))} } }` }),
|
|
7102
7204
|
/* @__PURE__ */ d("style", { children: F }),
|
|
7103
7205
|
P,
|
|
7104
7206
|
/* @__PURE__ */ d("style", { children: x }),
|
|
@@ -7118,7 +7220,7 @@ function ki({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
7118
7220
|
locale: m || "",
|
|
7119
7221
|
settings: _ ?? null
|
|
7120
7222
|
},
|
|
7121
|
-
children: /* @__PURE__ */ d(
|
|
7223
|
+
children: /* @__PURE__ */ d(pr, {
|
|
7122
7224
|
initialUser: v,
|
|
7123
7225
|
children: /* @__PURE__ */ d(xe.Provider, {
|
|
7124
7226
|
value: p ?? null,
|
|
@@ -7151,8 +7253,8 @@ function ki({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
7151
7253
|
}
|
|
7152
7254
|
//#endregion
|
|
7153
7255
|
//#region src/WebimContent.jsx
|
|
7154
|
-
function
|
|
7155
|
-
return e?.blocks?.ROOT ? /* @__PURE__ */ d(
|
|
7256
|
+
function ji({ bundle: e, mode: t = "auto", style: n }) {
|
|
7257
|
+
return e?.blocks?.ROOT ? /* @__PURE__ */ d(Ai, {
|
|
7156
7258
|
blocks: e.blocks,
|
|
7157
7259
|
theme: e.theme,
|
|
7158
7260
|
components: e.components,
|
|
@@ -7170,7 +7272,7 @@ function Ai({ bundle: e, mode: t = "auto", style: n }) {
|
|
|
7170
7272
|
}
|
|
7171
7273
|
//#endregion
|
|
7172
7274
|
//#region src/bundle.js
|
|
7173
|
-
function
|
|
7275
|
+
function Mi({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
|
|
7174
7276
|
let a = {
|
|
7175
7277
|
...t?.global ?? {},
|
|
7176
7278
|
...t?.tenant ?? {}
|
|
@@ -7196,18 +7298,18 @@ function ji({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
|
|
|
7196
7298
|
}
|
|
7197
7299
|
//#endregion
|
|
7198
7300
|
//#region src/fetchPage.js
|
|
7199
|
-
var
|
|
7301
|
+
var Ni = async (e) => {
|
|
7200
7302
|
let t = await e.json().catch(() => null);
|
|
7201
7303
|
if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
|
|
7202
7304
|
return t?.payload ?? t;
|
|
7203
7305
|
};
|
|
7204
|
-
async function
|
|
7306
|
+
async function Pi({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token: a, page: o, fetch: s }) {
|
|
7205
7307
|
if (!e) throw Error("fetchPage: apiUrl is required");
|
|
7206
7308
|
if (!n) throw Error("fetchPage: slug is required");
|
|
7207
7309
|
let c = s ?? fetch, l = e.replace(/\/$/, ""), u = {
|
|
7208
7310
|
...t ? { "x-tenant": t } : {},
|
|
7209
7311
|
...a ? { authorization: `Bearer ${a}` } : {}
|
|
7210
|
-
}, [d, f] = await Promise.all([c(`${l}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: u }).then(
|
|
7312
|
+
}, [d, f] = await Promise.all([c(`${l}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: u }).then(Ni), c(`${l}/settings/public`, { headers: u }).then(Ni)]), p = Mi({
|
|
7211
7313
|
page: d,
|
|
7212
7314
|
settings: f,
|
|
7213
7315
|
tenant: t,
|
|
@@ -7222,7 +7324,7 @@ async function Ni({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token:
|
|
|
7222
7324
|
"LogoCarousel"
|
|
7223
7325
|
].includes(e?.type?.resolvedName) ? e.props?.source : null).filter(Boolean))];
|
|
7224
7326
|
if (m.length) {
|
|
7225
|
-
let e = (e) => e.startsWith("api:") ? `${l}/data/${encodeURIComponent(e.slice(4))}` : `${l}/dynamic/${encodeURIComponent(e)}?all=1${r ? `&locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(m.map((t) => c(e(t), { headers: u }).then(
|
|
7327
|
+
let e = (e) => e.startsWith("api:") ? `${l}/data/${encodeURIComponent(e.slice(4))}` : `${l}/dynamic/${encodeURIComponent(e)}?all=1${r ? `&locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(m.map((t) => c(e(t), { headers: u }).then(Ni).then((e) => {
|
|
7226
7328
|
let n = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : [], r = Number(e?.total?.filtered ?? e?.total?.all ?? n.length);
|
|
7227
7329
|
return [[t, n], [`${t}:total`, Number.isFinite(r) ? r : n.length]];
|
|
7228
7330
|
}).catch(() => [[t, []]])));
|
|
@@ -7236,40 +7338,40 @@ async function Ni({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token:
|
|
|
7236
7338
|
}
|
|
7237
7339
|
//#endregion
|
|
7238
7340
|
//#region src/ssr.jsx
|
|
7239
|
-
var
|
|
7341
|
+
var Fi = (e) => String(e ?? "").replace(/[&<>"]/g, (e) => ({
|
|
7240
7342
|
"&": "&",
|
|
7241
7343
|
"<": "<",
|
|
7242
7344
|
">": ">",
|
|
7243
7345
|
"\"": """
|
|
7244
7346
|
})[e]);
|
|
7245
|
-
function
|
|
7246
|
-
return e(/* @__PURE__ */ d(
|
|
7347
|
+
function Ii(t, { mode: n = "auto", style: r } = {}) {
|
|
7348
|
+
return e(/* @__PURE__ */ d(ji, {
|
|
7247
7349
|
bundle: t,
|
|
7248
7350
|
mode: n,
|
|
7249
7351
|
style: r
|
|
7250
7352
|
}));
|
|
7251
7353
|
}
|
|
7252
|
-
function
|
|
7354
|
+
function Li(e, { mode: t = "auto", lang: n } = {}) {
|
|
7253
7355
|
let r = e.seo ?? {}, i = n || e.locale || "en", a = h(e.direction, i), o = r.title || e.title || e.slug || "Page", s = e.custom?.js?.trim(), c = [
|
|
7254
7356
|
"<meta charset=\"utf-8\"/>",
|
|
7255
7357
|
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>",
|
|
7256
|
-
`<title>${
|
|
7257
|
-
r.description && `<meta name="description" content="${
|
|
7258
|
-
`<meta property="og:title" content="${
|
|
7259
|
-
r.image && `<meta property="og:image" content="${
|
|
7358
|
+
`<title>${Fi(o)}</title>`,
|
|
7359
|
+
r.description && `<meta name="description" content="${Fi(r.description)}"/>`,
|
|
7360
|
+
`<meta property="og:title" content="${Fi(o)}"/>`,
|
|
7361
|
+
r.image && `<meta property="og:image" content="${Fi(r.image)}"/>`,
|
|
7260
7362
|
r.noindex && "<meta name=\"robots\" content=\"noindex\"/>",
|
|
7261
7363
|
"<style>html,body{margin:0;height:100%}</style>"
|
|
7262
7364
|
].filter(Boolean).join("\n");
|
|
7263
7365
|
return `<!doctype html>
|
|
7264
|
-
<html lang="${
|
|
7366
|
+
<html lang="${Fi(i)}"${a ? ` dir="${a}"` : ""}>
|
|
7265
7367
|
<head>
|
|
7266
7368
|
${c}
|
|
7267
7369
|
</head>
|
|
7268
7370
|
<body>
|
|
7269
|
-
${
|
|
7371
|
+
${Ii(e, { mode: t })}
|
|
7270
7372
|
${s ? `<script>${s.replaceAll("<\/script", "<\\/script")}<\/script>` : ""}
|
|
7271
7373
|
</body>
|
|
7272
7374
|
</html>`;
|
|
7273
7375
|
}
|
|
7274
7376
|
//#endregion
|
|
7275
|
-
export {
|
|
7377
|
+
export { Mi as assembleBundle, Pi as fetchPage, Ii as renderBundleHtml, Li as renderPageDocument };
|