@blocklet/pages-kit-inner-components 0.4.99 → 0.4.100

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.
@@ -1,2357 +0,0 @@
1
- import { jsx as o, jsxs as _, Fragment as F } from "react/jsx-runtime";
2
- import { a as T, g as I, i as ce, b as le, E as de, c as lt, d as dt, e as zt, u as me, f as ue } from "./state-CYDNg8EG.js";
3
- import { cloneDeep as M } from "lodash";
4
- import { useLocaleContext as Wt } from "@arcblock/ux/lib/Locale/context";
5
- import Lt from "@arcblock/ux/lib/Result";
6
- import { useHeaderState as pe } from "@blocklet/pages-kit/builtin/page/header";
7
- import he from "@blocklet/ui-react/lib/Header";
8
- import { cx as k, css as nt } from "@emotion/css";
9
- import { Global as Ot, css as Ht } from "@emotion/react";
10
- import At from "@emotion/styled";
11
- import { Box as b, Tooltip as fe, styled as Mt, Stack as mt, Typography as B, Container as ge, useTheme as xe, createTheme as be, ThemeProvider as ye, Card as we, CircularProgress as Ut, Grid as kt, CardMedia as ve, CardContent as ke, Button as _e } from "@mui/material";
12
- import { useLatest as $e, useReactive as Se } from "ahooks";
13
- import Ce from "isomorphic-dompurify";
14
- import _t from "lodash/cloneDeep";
15
- import Ne from "lodash/isEmpty";
16
- import Ft from "lodash/isEqual";
17
- import Vt, { forwardRef as Ie, useState as E, useCallback as ut, useRef as V, Fragment as Pe, isValidElement as Gt, useEffect as z, useMemo as C, createContext as je, useContext as Dt, lazy as Jt, Suspense as Be } from "react";
18
- import { Helmet as Re } from "react-helmet";
19
- import { Link as Te, NavLink as Ee, useNavigate as ze, useSearchParams as We, Routes as Le, Route as Q, Navigate as Oe, ScrollRestoration as He } from "react-router-dom";
20
- import { useUpdate as Ae, useMount as Me, useWindowScroll as Ue, useAsync as qt } from "react-use";
21
- import { withoutTrailingSlash as et, isRelative as Fe, parseURL as Ve, joinURL as Z } from "ufo";
22
- import "@mui/icons-material";
23
- import { AIForm as $t, AIFormResult as St } from "@blocklet/ai-runtime/components";
24
- import { deepmerge as Ge } from "@mui/utils";
25
- import pt from "lodash/pick";
26
- import { ErrorBoundary as De } from "react-error-boundary";
27
- import { Icon as rt } from "@iconify/react";
28
- import Je from "react-markdown";
29
- import qe from "remark-gfm";
30
- import { LoadingButton as Ke } from "@mui/lab";
31
- import { useTheme as ht, styled as $ } from "@arcblock/ux/lib/Theme";
32
- import Xe from "@arcblock/react-hooks/lib/useBrowser";
33
- import Ct from "@arcblock/ux/lib/Colors";
34
- import { ResponsiveImage as Kt, CustomComponentRenderer as Ye } from "@blocklet/pages-kit/components";
35
- import Xt from "@mui/material/useMediaQuery";
36
- import j from "lodash/omit";
37
- import { Icon as Yt } from "@iconify-icon/react";
38
- import Qe from "@arcblock/ux/lib/Screenshot";
39
- import Ze from "@arcblock/ux/lib/Button";
40
- import it from "is-uri";
41
- import { join as tt } from "pathe";
42
- import { useMessage as to } from "@blocklet/embed/message";
43
- import { EmbedIframe as eo } from "@blocklet/embed/react";
44
- import { TwitterTimelineEmbed as oo } from "react-twitter-embed";
45
- import no from "@blocklet/ui-react/lib/Footer";
46
- import ro from "webfontloader";
47
- import { createAuthServiceSessionContext as io } from "@arcblock/did-connect/lib/Session";
48
- function so(t, e, n, r) {
49
- t.locales || (t.locales = {}), t.locales[n] = M(t.locales[n] || {}), t.locales[n].title = r.title ?? t.locales[n].title, t.locales[n].image = r.image ?? t.locales[n].image, t.locales[n].description = r.description ?? t.locales[n].description, Object.entries(r.sectionsData).forEach(([i, s]) => {
50
- var c, l, d, m;
51
- const a = Object.values(t.sections).find(
52
- (u) => u.id === i || u.name === i
53
- );
54
- if (a && a.isTemplateSection)
55
- if (a.locales = M(a.locales || {}), a.locales[n] = M(a.locales[n] || {}), a.component === "custom-component") {
56
- const u = (c = a.config) == null ? void 0 : c.componentId;
57
- if (!u)
58
- return;
59
- const h = ((l = e.components[u]) == null ? void 0 : l.data) || ((m = (d = e.resources.components) == null ? void 0 : d[u]) == null ? void 0 : m.component);
60
- if (!h)
61
- return;
62
- a.locales[n].properties = M(a.locales[n].properties || {}), Object.entries(s || {}).forEach(([p, x]) => {
63
- var f, w;
64
- const y = ((f = h == null ? void 0 : h.properties) == null ? void 0 : f[p]) || Object.values((h == null ? void 0 : h.properties) || {}).find((g) => {
65
- var v;
66
- return ((v = g.data) == null ? void 0 : v.key) === p;
67
- });
68
- y && (a.locales[n].properties[(w = y.data) == null ? void 0 : w.id] = {
69
- value: x
70
- });
71
- });
72
- } else
73
- a.locales[n] = {
74
- ...M(a.locales[n]),
75
- ...s || {}
76
- };
77
- });
78
- }
79
- const ao = Ie(({ onClick: t, ...e }, n) => {
80
- const [r, i] = E(!1), s = ut(
81
- async (a) => {
82
- try {
83
- i(!0), await (t == null ? void 0 : t(a));
84
- } finally {
85
- i(!1);
86
- }
87
- },
88
- [t]
89
- );
90
- return /* @__PURE__ */ o(Ke, { ref: n, ...e, loading: e.loading || r, onClick: s });
91
- });
92
- function co({
93
- tip: t,
94
- tipSucceed: e,
95
- title: n,
96
- titleSucceed: r,
97
- icon: i,
98
- iconSucceed: s,
99
- autoReset: a,
100
- placement: c = "top",
101
- ...l
102
- }) {
103
- const [d, m] = E(!1), [u, h] = E(), p = V(), x = () => {
104
- h(void 0), a && (p.current = window.setTimeout(() => {
105
- m(!1);
106
- }, 3e3));
107
- }, y = () => {
108
- clearTimeout(p.current);
109
- }, f = d ? s : i, w = u ? /* @__PURE__ */ o(b, { color: "error", children: u.message }) : d && e || t;
110
- return /* @__PURE__ */ o(fe, { title: w, disableInteractive: !0, placement: c, onClose: x, onOpen: y, children: /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
111
- ao,
112
- {
113
- startIcon: f && (typeof f == "string" ? /* @__PURE__ */ o(rt, { icon: f }) : f),
114
- loadingPosition: f ? "start" : void 0,
115
- ...l,
116
- onClick: async (v) => {
117
- if (l.onClick)
118
- try {
119
- await l.onClick(v), m(!0);
120
- } catch (P) {
121
- h(P);
122
- }
123
- },
124
- children: d ? r : n
125
- }
126
- ) }) });
127
- }
128
- const lo = Vt.lazy(() => import("react-syntax-highlighter").then((t) => ({ default: t.Prism }))), mo = Mt((t) => /* @__PURE__ */ o(
129
- Je,
130
- {
131
- ...t,
132
- remarkPlugins: [qe],
133
- components: {
134
- pre: uo,
135
- code: ({ node: e, inline: n, className: r, children: i, ...s }) => {
136
- if (!i) return null;
137
- const a = /language-(\w+)/.exec(r || "");
138
- return n ? /* @__PURE__ */ o(b, { component: "code", className: r, ...s, children: i }) : /* @__PURE__ */ o(b, { component: lo, language: a == null ? void 0 : a[1], ...s, sx: { borderRadius: 1 }, children: String(i).replace(/\n$/, "") });
139
- },
140
- table: ({ className: e, children: n }) => /* @__PURE__ */ o(b, { sx: { overflow: "auto", my: 1 }, children: /* @__PURE__ */ o("table", { className: e, children: n }) })
141
- }
142
- }
143
- ))`
144
- width: 100%;
145
- overflow: hidden;
146
- word-break: break-word;
147
-
148
- > * {
149
- &:first-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
150
- margin-top: 0;
151
- }
152
- &:last-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
153
- margin-bottom: 0;
154
- }
155
- }
156
-
157
- pre {
158
- overflow: auto;
159
- }
160
-
161
- li {
162
- margin: 0;
163
- padding: 0;
164
- }
165
-
166
- li p {
167
- display: inline-block;
168
- vertical-align: top;
169
- margin: 0;
170
- padding: 0;
171
- }
172
-
173
- table {
174
- border-collapse: collapse;
175
- white-space: nowrap;
176
-
177
- th,
178
- td {
179
- border: 1px solid grey;
180
- padding: 4px 8px;
181
- }
182
- }
183
-
184
- a {
185
- color: ${({ theme: t }) => t.palette.primary.main};
186
-
187
- :hover {
188
- text-decoration: underline;
189
- }
190
- }
191
-
192
- &.writing > *:last-child {
193
- &:after {
194
- content: '';
195
- display: inline-block;
196
- vertical-align: middle;
197
- height: 1.2em;
198
- margin-top: -0.2em;
199
- margin-left: 0.1em;
200
- border-right: 0.2em solid orange;
201
- border-radius: 10px;
202
- animation: blink-caret 0.75s step-end infinite;
203
-
204
- @keyframes blink-caret {
205
- from,
206
- to {
207
- border-color: transparent;
208
- }
209
- 50% {
210
- border-color: ${({ theme: t }) => t.palette.secondary.main};
211
- }
212
- }
213
- }
214
- }
215
- `;
216
- function uo({ children: t }) {
217
- const e = t == null ? void 0 : t.props;
218
- if (!(e != null && e.children)) return null;
219
- const n = /language-(\w+)/.exec(e.className || ""), r = n == null ? void 0 : n[1];
220
- return /* @__PURE__ */ _(
221
- b,
222
- {
223
- component: "div",
224
- sx: {
225
- fontSize: 14,
226
- borderRadius: 1,
227
- bgcolor: "rgb(245, 242, 240)",
228
- "> pre": { mt: "0 !important" }
229
- },
230
- children: [
231
- /* @__PURE__ */ _(mt, { direction: "row", alignItems: "center", p: 0.5, pl: 1.5, borderBottom: 1, borderColor: "grey.200", children: [
232
- /* @__PURE__ */ o(b, { children: r }),
233
- /* @__PURE__ */ o(b, { flex: 1 }),
234
- /* @__PURE__ */ o(
235
- co,
236
- {
237
- autoReset: !0,
238
- title: /* @__PURE__ */ o(rt, { icon: "tabler:copy" }),
239
- titleSucceed: /* @__PURE__ */ o(rt, { icon: "tabler:copy-check" }),
240
- sx: { minWidth: 32, minHeight: 32, p: 0, fontSize: 18 },
241
- onClick: () => {
242
- window.navigator.clipboard.writeText(e.children);
243
- }
244
- }
245
- )
246
- ] }),
247
- t
248
- ]
249
- }
250
- );
251
- }
252
- function O({ actions: t, center: e, className: n, align: r }) {
253
- return t && (t != null && t.length) ? /* @__PURE__ */ o(
254
- b,
255
- {
256
- className: k(
257
- "flex gap-4 flex-wrap",
258
- "lg:flex-row lg:gap-8",
259
- (e || r === "center") && "justify-center",
260
- !e && r === "right" && "justify-end",
261
- !e && r === "left" && "justify-start",
262
- n
263
- ),
264
- sx: { alignItems: "center" },
265
- children: t
266
- }
267
- ) : null;
268
- }
269
- const po = "section", ho = Mt(b)`
270
- overflow: hidden;
271
-
272
- .section__title {
273
- margin-top: 0;
274
- font-weight: 700;
275
- }
276
- .section__title_non_big {
277
- font-size: 32px;
278
- @media (max-width: 600px) {
279
- font-size: 24px;
280
- }
281
- }
282
- &.base-info .section__tag {
283
- margin-top: 0;
284
- margin-bottom: 2vw;
285
- background-color: ${({ theme: t }) => t.palette.primary.main};
286
- white-space: nowrap;
287
- max-width: 100%;
288
- display: inline-block;
289
- padding: 0 10px;
290
- justify-content: flex-start;
291
- overflow: hidden;
292
- text-overflow: ellipsis;
293
- font-size: 12px;
294
- color: #fff;
295
- border-radius: 4px;
296
- line-height: 20px;
297
- }
298
- .section__title {
299
- a {
300
- color: ${({ theme: t }) => t.palette.primary.main};
301
- }
302
- p {
303
- margin-top: 0;
304
- margin-bottom: 0;
305
- }
306
- }
307
- .section__description {
308
- margin-bottom: 4vw;
309
- margin-top: 0;
310
- a {
311
- color: ${({ theme: t }) => t.palette.primary.main};
312
- }
313
- p {
314
- margin-top: 0;
315
- margin-bottom: 0.5rem;
316
- }
317
- }
318
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[po]}px) {
319
- .section__tag {
320
- margin-bottom: 32px;
321
- }
322
- .section__title {
323
- margin-bottom: 32px;
324
- }
325
- .section__description {
326
- margin-bottom: 40px;
327
- }
328
- }
329
- `;
330
- function G({
331
- title: t,
332
- description: e,
333
- descriptionMarkdown: n,
334
- actions: r,
335
- className: i = "",
336
- classes: s = {},
337
- prepend: a,
338
- append: c,
339
- level: l = 2,
340
- tag: d,
341
- badge: m,
342
- center: u,
343
- logo: h,
344
- titleAppearance: p,
345
- descriptionAppearance: x,
346
- ...y
347
- }) {
348
- if (!t && !e && !r && !m && !d && !a && !c && !h) return null;
349
- const f = Math.max(Math.min(5, l + 1), 1), w = {
350
- 1: "xl:!text-3xl lg:!text-2xl md:!text-xl",
351
- 2: "xl:!text-2xl lg:!text-xl md:!text-lg",
352
- 3: "xl:!text-2xl lg:!text-xl md:!text-lg",
353
- 4: "xl:!text-xl lg:!text-lg md:!text-md",
354
- 5: "xl:!text-lg md:!text-md sm:!text-sm",
355
- 6: "!text-sm"
356
- }, g = l === 0 ? "big" : `h${f}`, v = l === 0;
357
- return /* @__PURE__ */ _(ho, { className: k("base-info", "lg:text-left", u && "!text-center", i), ...y, children: [
358
- a && /* @__PURE__ */ o("div", { children: a }),
359
- (d || m) && /* @__PURE__ */ o("div", { className: k("section__tag", (s == null ? void 0 : s.tag) || (s == null ? void 0 : s.badge)), children: d || m }),
360
- h && /* @__PURE__ */ o("img", { className: "w-[120px] m-auto mb-8", src: h, alt: "info", loading: "lazy" }),
361
- t && /* @__PURE__ */ o(
362
- B,
363
- {
364
- sx: {
365
- whiteSpace: "pre-wrap",
366
- mb: e ? "2vw" : 0,
367
- ...(p == null ? void 0 : p.color) && { color: `${p.color} !important` }
368
- },
369
- className: k(
370
- "section__title",
371
- "text-gray-800",
372
- "dark:text-gray-50",
373
- s.title,
374
- "page-kit-section__title",
375
- v ? "" : "section__title_non_big"
376
- ),
377
- component: `h${Math.max(l, 1)}`,
378
- variant: g,
379
- children: t
380
- }
381
- ),
382
- e && (n ? /* @__PURE__ */ o(
383
- b,
384
- {
385
- sx: {
386
- ...(x == null ? void 0 : x.color) && { color: `${x.color} !important` }
387
- },
388
- component: mo,
389
- className: k(
390
- "section__description",
391
- "text-gray-800",
392
- "dark:text-gray-100",
393
- w[f],
394
- s.description,
395
- "page-kit-section__description"
396
- ),
397
- children: e
398
- }
399
- ) : /* @__PURE__ */ o(
400
- B,
401
- {
402
- sx: {
403
- whiteSpace: "pre-wrap",
404
- ...(x == null ? void 0 : x.color) && { color: `${x.color} !important` }
405
- },
406
- className: k(
407
- "section__description",
408
- "text-gray-800",
409
- "dark:text-gray-100",
410
- w[f],
411
- s.description,
412
- "page-kit-section__description"
413
- ),
414
- component: "div",
415
- variant: "body1",
416
- gutterBottom: !0,
417
- children: e
418
- }
419
- )),
420
- /* @__PURE__ */ o(O, { actions: r, center: u, className: "mt-8" }),
421
- c && /* @__PURE__ */ o("div", { children: c })
422
- ] });
423
- }
424
- const D = [
425
- "actions",
426
- "append",
427
- "badge",
428
- "tag",
429
- "center",
430
- "description",
431
- "descriptionMarkdown",
432
- "level",
433
- "logo",
434
- "prepend",
435
- "title",
436
- "titleAppearance",
437
- "descriptionAppearance"
438
- ];
439
- function Qt(t) {
440
- if (t.type === Pe) {
441
- const n = (t.props.children || []).filter((r) => Gt(r));
442
- return n.length === 1 ? Qt(n[0]) : n.length > 1;
443
- }
444
- return Array.isArray(t);
445
- }
446
- const R = "&>*";
447
- function ft({ children: t, col: e, gap: n, className: r, align: i, sx: s, type: a, ...c } = {
448
- children: null,
449
- className: "",
450
- col: 3,
451
- gap: void 0,
452
- sx: {},
453
- align: "center",
454
- type: "default"
455
- }) {
456
- const l = ht(), d = Number(Math.floor(100 / e * 100) / 100), m = {
457
- center: "justify-center items-center",
458
- left: "justify-start items-center",
459
- right: "justify-end items-center",
460
- top: "justify-center items-start",
461
- bottom: "justify-center items-end",
462
- "top-left": "justify-start items-start",
463
- "top-right": "justify-end items-start",
464
- "bottom-left": "justify-start items-end",
465
- "bottom-right": "justify-end items-end"
466
- }, u = m[i] || m.center;
467
- let p = n ?? ({
468
- 2: 6,
469
- 3: 4,
470
- 4: 4,
471
- 5: 3,
472
- 6: 3
473
- }[e] || 0);
474
- Qt(t) || (p = 0);
475
- const y = (e - 1) * p / e;
476
- let f = { ...s, gap: `${p}rem` };
477
- const w = { [R]: { width: "100%" } }, g = {}, v = {}, P = {};
478
- switch (w.gap = "1rem", g.gap = `${p / 2}rem`, e) {
479
- case 3:
480
- case 4:
481
- g[R] = {
482
- width: `calc(50% - ${p / 2}rem)`
483
- };
484
- break;
485
- case 5:
486
- case 6:
487
- w[R] = {
488
- width: `calc(50% - ${p / 2 / 2}rem)`
489
- }, g[R] = {
490
- width: `calc(50% - ${p / 2 / 2}rem)`
491
- }, v[R] = {
492
- width: `calc(33.33% - ${p * 2 / 3}rem)`
493
- };
494
- break;
495
- }
496
- return f[R] = { width: `calc(${d}% - ${y}rem)` }, f[`@media (max-width: ${l.breakpoints.values.xl}px)`] = P, f[`@media (max-width: ${l.breakpoints.values.lg}px)`] = v, f[`@media (max-width: ${l.breakpoints.values.md}px)`] = g, f[`@media (max-width: ${l.breakpoints.values.sm}px)`] = w, a === "wall" && (f = { ...s, gap: `${p}rem` }, f[R] = { width: `calc(${d}% - ${y}rem)` }, w[R] = { width: `calc(45% - ${p / 2 / 2}rem)` }, f[`@media (max-width: ${l.breakpoints.values.sm}px)`] = w), /* @__PURE__ */ o(b, { className: k("flex flex-wrap flex-row h-full", u, r), sx: f, ...c, children: t });
497
- }
498
- function fo() {
499
- const t = navigator.userAgent.toLowerCase();
500
- return t.includes("safari") && !t.includes("chrome");
501
- }
502
- function go(t = "") {
503
- if (t.startsWith("data:image/svg+xml,")) return !0;
504
- const e = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/, n = /^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;
505
- return e.test(t) || n.test(t);
506
- }
507
- function st(t) {
508
- return (t == null ? void 0 : t.endsWith(".mp4")) || (t == null ? void 0 : t.endsWith(".m4v")) || (t == null ? void 0 : t.endsWith(".webm"));
509
- }
510
- function xo(t) {
511
- return t != null && t.endsWith(".mp4") || t != null && t.endsWith(".m4v") ? "video/mp4" : t != null && t.endsWith(".webm") ? "video/webm" : void 0;
512
- }
513
- function bo(t) {
514
- let e = {};
515
- return typeof t == "string" ? ce(t) ? e.image = t : (e.image = I(t), le(t) && (e.color = t, e.image = "")) : e = t, e;
516
- }
517
- function yo() {
518
- const [t, e] = E(Date.now());
519
- return z(() => {
520
- const n = () => {
521
- e(Date.now());
522
- };
523
- return document.addEventListener("visibilitychange", n), () => {
524
- document.removeEventListener("visibilitychange", n);
525
- };
526
- }, []), t;
527
- }
528
- function Nt(t, e, n, r, i) {
529
- let s = null;
530
- const { color: a = "", image: c } = bo(e);
531
- return c && go(c) ? (delete n.backgroundColor, !(t.mobile.apple.device || fo()) && st(c) ? s = /* @__PURE__ */ o(
532
- b,
533
- {
534
- component: "video",
535
- className: "section-bg",
536
- width: "100%",
537
- autoPlay: !0,
538
- loop: !0,
539
- muted: !0,
540
- controls: !1,
541
- playsInline: !0,
542
- poster: T(I(r), 1200, "quality"),
543
- src: st(c) ? c : T(c, 1200, "quality"),
544
- sx: {
545
- position: "absolute",
546
- zIndex: -9999,
547
- right: 0,
548
- left: 0,
549
- top: 0,
550
- width: "100%",
551
- height: "100%",
552
- objectFit: "cover"
553
- }
554
- },
555
- c
556
- ) : s = /* @__PURE__ */ o(
557
- Kt,
558
- {
559
- src: c,
560
- sizesAttr: {
561
- sm: 600,
562
- md: 900,
563
- lg: 1200
564
- },
565
- className: "section-bg",
566
- alt: "",
567
- width: "100%",
568
- loading: "lazy",
569
- sx: {
570
- position: "absolute",
571
- zIndex: -9999,
572
- right: 0,
573
- left: 0,
574
- top: 0,
575
- width: "100%",
576
- height: "100%",
577
- objectFit: "cover"
578
- }
579
- },
580
- i || c
581
- )) : c ? n.backgroundImage = `${c} !important` : a && (n.backgroundColor = `${a} !important`), s;
582
- }
583
- function wo({ autoWidth: t, children: e, ...n }) {
584
- return t ? /* @__PURE__ */ o(b, { display: "flex", ...n, children: e }) : /* @__PURE__ */ o(ge, { ...n, children: e });
585
- }
586
- function J({
587
- dark: t = !1,
588
- children: e,
589
- className: n,
590
- sx: r = {},
591
- boxed: i = { show: !1 },
592
- padding: s = "normal",
593
- boxProps: a,
594
- type: c,
595
- ...l
596
- }) {
597
- const d = { ...r }, m = Xt((p) => p.breakpoints.down("md"));
598
- t && (d.color = Ct.common.white, d.backgroundColor = `${Ct.grey[900]} !important`);
599
- const u = {
600
- none: "py-0",
601
- small: "py-5 md:py-8 lg:py-8 xl:py-12",
602
- normal: "py-10 md:py-15 lg:py-20 xl:py-25",
603
- large: "py-15 md:py-20 lg:py-25 xl:py-30"
604
- };
605
- i.show && (d.display = "flex");
606
- const h = C(() => !Number(l.boxMaxWidth) || m ? {
607
- width: "100%"
608
- } : c === "wall" && l.boxMaxWidth ? {
609
- maxWidth: `${l.boxMaxWidth}px !important`,
610
- width: "100%"
611
- } : {
612
- width: "100%"
613
- }, [l.boxMaxWidth, m, c]);
614
- return /* @__PURE__ */ o(
615
- vo,
616
- {
617
- component: "section",
618
- styles: { ...d },
619
- className: k("base-section", "px-2 md:px-5 lg:px-5 xl:px-10", u[s], n, { dark: t }),
620
- ...j(
621
- l,
622
- "hoverStyle",
623
- "boxMaxWidth",
624
- "embedUrl",
625
- "autoWidth",
626
- "paddingXY",
627
- "iframeHeight",
628
- "titleAppearance",
629
- "descriptionAppearance"
630
- ),
631
- children: /* @__PURE__ */ o(wo, { autoWidth: l == null ? void 0 : l.autoWidth, className: k("section-content h-full"), sx: h, children: i.show ? /* @__PURE__ */ o(Zt, { ...a, boxed: i, children: e }) : e })
632
- }
633
- );
634
- }
635
- function Zt({
636
- background: t = "",
637
- backgroundVideoPoster: e,
638
- children: n,
639
- sx: r = {},
640
- boxed: i = { show: !1 },
641
- className: s = "",
642
- styles: a = {},
643
- ...c
644
- }) {
645
- const l = { ...a, ...r };
646
- let d = null;
647
- const m = Xt((p) => p.breakpoints.up("sm")), u = Xe(), h = yo();
648
- return t && (d = Nt(u, t, l, e, h)), i.show && (l.borderRadius = "10px", l.padding === void 0 && (l.padding = m ? "50px" : "20px"), i != null && i.border && (l.border = "1px solid #c0c0c0"), i != null && i.background && (d = Nt(
649
- u,
650
- i == null ? void 0 : i.background,
651
- l,
652
- i == null ? void 0 : i.backgroundVideoPoster,
653
- h
654
- ))), /* @__PURE__ */ _(
655
- b,
656
- {
657
- ...c,
658
- sx: {
659
- ...l,
660
- ...d ? { position: "relative", overflow: "hidden", zIndex: 0 } : {}
661
- },
662
- className: k(s, (i == null ? void 0 : i.boxShadow) && "shadow-xl"),
663
- children: [
664
- d,
665
- n
666
- ]
667
- }
668
- );
669
- }
670
- const vo = $(Zt)`
671
- &:nth-of-type(even) {
672
- background: #f8f8f8;
673
- }
674
-
675
- @media (max-width: 600px) {
676
- .section__title {
677
- font-size: 24px;
678
- }
679
-
680
- .base-info {
681
- > *:last-child {
682
- margin-bottom: 0;
683
- }
684
- }
685
- }
686
- `;
687
- function te({ icon: t, ...e }) {
688
- return /* @__PURE__ */ o(Yt, { icon: t, ...e, ref: null });
689
- }
690
- function N(t, e) {
691
- const n = pt(t, e), r = j(t, e);
692
- return [n, r];
693
- }
694
- const ee = ["title", "description", "actions", "badge", "tag", "prepend", "append", "logo"];
695
- function ko({
696
- image: t,
697
- imageBorder: e,
698
- imageShadow: n,
699
- className: r,
700
- reverse: i = !1,
701
- fullSizeImage: s,
702
- ...a
703
- }) {
704
- const [c, l] = N(a, D), d = Object.keys(c).length > 0 && Object.values(pt(c, ee)).filter(Boolean).length > 0 && /* @__PURE__ */ o(G, { ...c }), m = Gt(t) ? t : /* @__PURE__ */ o(b, { component: "img", src: t, alt: "", className: "block" }), u = ["phone", "macbook"].includes(e), h = t && /* @__PURE__ */ o(
705
- b,
706
- {
707
- className: k(
708
- "section__image",
709
- "m-auto, leading-[1] text-center",
710
- n && "shadow-xl",
711
- c != null && c.center ? "flex justify-center items-center" : ""
712
- ),
713
- sx: {
714
- border: e === !0 ? "1px solid #c0c0c0" : void 0,
715
- borderRadius: 2,
716
- overflow: "hidden",
717
- // FIXME: Screenshot 组件无法设置最外层 div 的样式,只能通过父元素设置
718
- "> div": u ? { width: "100%", video: { borderRadius: "0 !important" } } : void 0
719
- },
720
- children: u ? (
721
- // @ts-ignore
722
- /* @__PURE__ */ o(Qe, { type: e, sx: { width: "100%" }, children: m })
723
- ) : m
724
- }
725
- );
726
- return /* @__PURE__ */ o(
727
- J,
728
- {
729
- className: k(
730
- "section--block",
731
- r,
732
- s && !i && nt`
733
- .section-bg {
734
- height: 80%;
735
- }
736
- `
737
- ),
738
- ...l,
739
- boxProps: s ? { sx: { padding: 0, overflow: "hidden" } } : void 0,
740
- children: /* @__PURE__ */ o(
741
- ft,
742
- {
743
- col: t ? 2 : 1,
744
- className: s ? nt`
745
- display: flex;
746
- flex-direction: column;
747
-
748
- > .base-info,
749
- > .section__image {
750
- width: 100%;
751
-
752
- > img,
753
- > video {
754
- width: 100%;
755
- }
756
- }
757
- ` : void 0,
758
- children: i ? /* @__PURE__ */ _(F, { children: [
759
- h,
760
- d
761
- ] }) : /* @__PURE__ */ _(F, { children: [
762
- d,
763
- h
764
- ] })
765
- }
766
- )
767
- }
768
- );
769
- }
770
- const q = ["editing", "height", "locale", "dev", "sx"];
771
- function _o(t) {
772
- return /* @__PURE__ */ o($o, { ...t });
773
- }
774
- const $o = $(b)`
775
- position: relative;
776
- `;
777
- function So({
778
- widget: t,
779
- reverse: e,
780
- projectId: n,
781
- assistantId: r,
782
- working: i,
783
- submitTitle: s,
784
- submitIcon: a,
785
- submitColor: c,
786
- placeholder: l,
787
- loadingIndicator: d,
788
- section: m,
789
- ...u
790
- }) {
791
- const [{ editing: h }, p] = N(u, q), [x, y] = N(p, D), f = n && r ? { projectId: n, gitRef: "main", assistantId: r, working: !0 } : void 0, w = {
792
- children: s,
793
- endIcon: a ? /* @__PURE__ */ o(te, { icon: a }) : void 0,
794
- sx: {
795
- background: c || void 0,
796
- ":hover": {
797
- background: c || void 0,
798
- opacity: 0.8
799
- }
800
- }
801
- }, g = [], v = l && /* @__PURE__ */ o(B, { variant: "caption", color: "text.disabled", children: l }), P = d && /* @__PURE__ */ o(B, { variant: "caption", color: "text.disabled", children: d });
802
- Object.keys(x).length > 0 && Object.values(pt(x, ee)).filter(Boolean).length > 0 && g.push(/* @__PURE__ */ o(G, { ...x }, "base-info")), f && (t === "form" ? g.push(/* @__PURE__ */ o($t, { identifier: f, SubmitProps: w }, "form")) : t === "result" ? g.push(
803
- /* @__PURE__ */ o(
804
- St,
805
- {
806
- identifier: f,
807
- placeholder: v,
808
- loadingIndicator: P
809
- },
810
- "result"
811
- )
812
- ) : g.push(
813
- /* @__PURE__ */ _(mt, { width: "100%", gap: 2, direction: "row", children: [
814
- /* @__PURE__ */ o($t, { identifier: f, BoxProps: { flex: 1 }, SubmitProps: w }),
815
- /* @__PURE__ */ o(
816
- St,
817
- {
818
- identifier: f,
819
- BoxProps: { flex: 1 },
820
- placeholder: v,
821
- loadingIndicator: P
822
- }
823
- )
824
- ] }, "form-result")
825
- )), e && g.reverse();
826
- const H = xe(), Y = C(
827
- () => be(Ge(H, { palette: { primary: c ? { main: c } : void 0 } })),
828
- [c, H]
829
- );
830
- return /* @__PURE__ */ o(De, { fallbackRender: de, children: /* @__PURE__ */ o(ye, { theme: Y, children: /* @__PURE__ */ o(J, { ...y, sx: h ? { pointerEvents: "none" } : {}, children: /* @__PURE__ */ o(ft, { col: g.length, children: g }) }) }) });
831
- }
832
- const oe = je({
833
- pages: [],
834
- project: void 0
835
- }), { Provider: Co, Consumer: Ir } = oe;
836
- function ne() {
837
- return Dt(oe);
838
- }
839
- function No({ icon: t, className: e = "", size: n = "1rem", ...r }) {
840
- return /* @__PURE__ */ o(Io, { component: te, className: k("css-icon", e), size: n, ...r, icon: t });
841
- }
842
- const Io = $(b)`
843
- &.css-icon {
844
- display: inline-block;
845
- width: ${({ size: t }) => t};
846
- height: ${({ size: t }) => t};
847
- }
848
- `;
849
- function Po({ icon: t, className: e = "", size: n = "1rem", imageMeta: r, ...i }) {
850
- const s = T(I(t), 540), [a, c] = E(!1), l = ht();
851
- return a ? /* @__PURE__ */ o(No, { icon: "i-mdi:image", color: l.palette.grey[500], size: n, className: e, ...i }) : /* @__PURE__ */ o(jo, { className: k("image-icon", e), size: n, ...i, children: /* @__PURE__ */ o(
852
- "img",
853
- {
854
- className: "image-icon__image",
855
- src: s,
856
- onError: () => c(!0),
857
- width: r == null ? void 0 : r.naturalWidth,
858
- height: r == null ? void 0 : r.naturalHeight,
859
- alt: (r == null ? void 0 : r.filename) || "card-icon",
860
- loading: "lazy"
861
- }
862
- ) });
863
- }
864
- const jo = $(b)`
865
- display: inline-block;
866
- width: ${({ size: t }) => t};
867
- height: ${({ size: t }) => t};
868
- .image-icon__image {
869
- object-fit: contain;
870
- height: 100%;
871
- width: 100%;
872
- }
873
- `, gt = (t) => typeof t == "string" && /^[\w-_]+:[\w-_]+$/.test(t);
874
- function at({ icon: t, size: e = "1rem", imageMeta: n, ...r }) {
875
- const i = window.isNaN(e) ? e : `${e}px`;
876
- return gt(t) ? /* @__PURE__ */ o(Yt, { icon: t }) : /* @__PURE__ */ o(Bo, { component: Po, imageMeta: n, className: "base-icon", icon: t, size: i, ...r });
877
- }
878
- const Bo = $(b)`
879
- flex-shrink: 0;
880
- `;
881
- function U({ text: t, children: e, icon: n = "", endIcon: r, color: i = "primary", link: s = "", href: a = "", ...c }) {
882
- const l = n ? /* @__PURE__ */ o(at, { icon: n }) : null, d = r ? /* @__PURE__ */ o(at, { icon: r }) : null, m = s || a, u = { ...c };
883
- return m && (u.href = m, it(m) && (u.target = u.target || "_blank")), /* @__PURE__ */ o(Ze, { startIcon: l, endIcon: d, color: i, ...u, children: t || e });
884
- }
885
- function re({ editing: t, text: e, ...n }) {
886
- const { pages: r = [] } = ne(), i = r.find((s) => s.id === (n.link || n.linkId));
887
- if (t)
888
- return /* @__PURE__ */ o(U, { ...j(n, ["link", "linkId"]), children: e });
889
- if (i) {
890
- const s = i.path || "/";
891
- return /* @__PURE__ */ o(Te, { to: s, children: /* @__PURE__ */ o(U, { ...j(n, ["link", "linkId"]), children: e }) });
892
- }
893
- return /* @__PURE__ */ o(U, { ...j(n, "linkId"), children: e });
894
- }
895
- function W({ type: t = "", icon: e = "", size: n = "3rem", className: r = "", ...i }) {
896
- return /* @__PURE__ */ o(at, { icon: e || t, size: n, className: k("content-icon", r), ...i });
897
- }
898
- W.propTypes = {};
899
- W.defaultProps = {
900
- type: "",
901
- icon: "",
902
- size: "3rem",
903
- color: "inherit",
904
- className: ""
905
- };
906
- function Ro({
907
- to: t,
908
- base: e,
909
- children: n,
910
- className: r,
911
- activeClassName: i = "active",
912
- target: s = "auto",
913
- autoExternalMark: a = !1,
914
- useRouterLink: c,
915
- ...l
916
- }) {
917
- const { pages: d = [], locale: m = "" } = {}, u = e ? tt("/", e) : e || "";
918
- let h = s === "auto" ? "_self" : s, p = tt(u, t);
919
- const x = a ? it(p) : !1;
920
- if (e)
921
- return p = tt(u, m, t), /* @__PURE__ */ o(
922
- "a",
923
- {
924
- className: `no-underline ${r}`,
925
- href: et(p),
926
- rel: "noreferrer noopener",
927
- target: h,
928
- ...l,
929
- children: n
930
- }
931
- );
932
- if (it(t))
933
- s === "auto" && (h = "_blank"), p = t;
934
- else {
935
- Fe(p) && (p = tt(window.location.pathname, p));
936
- const y = Ve(`${window.location.origin}${p}`), f = d.some((w) => w.pathname === y.pathname);
937
- if (c || f)
938
- return /* @__PURE__ */ o(
939
- Ee,
940
- {
941
- end: !0,
942
- to: et(p),
943
- className: ({ isActive: w }) => k(r, w ? i : ""),
944
- ...l,
945
- children: n
946
- }
947
- );
948
- }
949
- return /* @__PURE__ */ _(
950
- "a",
951
- {
952
- className: `no-underline ${r}`,
953
- href: et(p),
954
- rel: "noreferrer noopener",
955
- target: h,
956
- ...l,
957
- children: [
958
- n,
959
- x && /* @__PURE__ */ o(W, { icon: "i-mdi:arrow-top-right", size: "0.9em", className: "smart-link__mark", style: { marginLeft: 5 } })
960
- ]
961
- }
962
- );
963
- }
964
- function K({
965
- prepend: t,
966
- append: e,
967
- children: n,
968
- className: r = "",
969
- dark: i = !1,
970
- border: s = !0,
971
- ...a
972
- }) {
973
- let c = {};
974
- const { pages: l = [] } = ne(), d = l.find((h) => h.id === a.link), m = !n || Vt.Children.toArray(n).every((h) => h === null);
975
- return a.link && (c = {
976
- component: Ro,
977
- to: (d == null ? void 0 : d.path) || a.link,
978
- useRouterLink: !0
979
- }), /* @__PURE__ */ _(
980
- To,
981
- {
982
- className: k(
983
- "base-card card",
984
- { "border-gray-200": s },
985
- { "dark:border-gray-500": i && s },
986
- { dark: i, "border-transparent": !s },
987
- r
988
- ),
989
- ...c,
990
- ...j(a, ["listType", "dark", "iconColor", "link", "hoverStyle", "imageSize"]),
991
- children: [
992
- t,
993
- !m && /* @__PURE__ */ o("div", { className: "card__body", children: n }),
994
- e
995
- ]
996
- }
997
- );
998
- }
999
- const To = $(b)`
1000
- &.base-card {
1001
- text-align: left;
1002
- border-width: 1px;
1003
- border-style: solid;
1004
- border-radius: 12px;
1005
- overflow: hidden;
1006
- &,
1007
- &:hover {
1008
- text-decoration: none;
1009
- }
1010
- }
1011
- .card__body {
1012
- padding: 15px 15px;
1013
- }
1014
- `;
1015
- function X({
1016
- align: t = "left",
1017
- title: e,
1018
- titleProps: n = {},
1019
- description: r,
1020
- descriptionProps: i = {}
1021
- }) {
1022
- return /* @__PURE__ */ _(F, { children: [
1023
- e && /* @__PURE__ */ o(
1024
- B,
1025
- {
1026
- className: k("card__title text-gray-800", "dark:text-gray-50"),
1027
- component: "h5",
1028
- variant: "h5",
1029
- gutterBottom: !0,
1030
- align: t,
1031
- ...n,
1032
- children: e
1033
- }
1034
- ),
1035
- r && /* @__PURE__ */ o(
1036
- B,
1037
- {
1038
- className: k("card__description", "text-gray-500", "dark:text-gray-400"),
1039
- component: "div",
1040
- variant: "body1",
1041
- gutterBottom: !0,
1042
- align: t,
1043
- ...i,
1044
- children: r
1045
- }
1046
- )
1047
- ] });
1048
- }
1049
- function Eo({
1050
- image: t,
1051
- title: e,
1052
- description: n,
1053
- imageProps: r = {},
1054
- imageMeta: i,
1055
- imageSize: s,
1056
- titleProps: a = {},
1057
- descriptionProps: c = {},
1058
- actions: l,
1059
- align: d,
1060
- ...m
1061
- }) {
1062
- const u = gt(t), h = T(I(t), 540);
1063
- return /* @__PURE__ */ _(
1064
- zo,
1065
- {
1066
- className: "card-article",
1067
- ...m,
1068
- prepend: /* @__PURE__ */ o("div", { className: "card__image__wrap", children: u && t ? /* @__PURE__ */ o(
1069
- b,
1070
- {
1071
- sx: {
1072
- position: "absolute",
1073
- left: 0,
1074
- top: 0,
1075
- right: 0,
1076
- bottom: 0,
1077
- display: "flex",
1078
- alignItems: "center",
1079
- justifyContent: "center"
1080
- },
1081
- children: /* @__PURE__ */ o(W, { icon: t, color: "primary.main" })
1082
- }
1083
- ) : h && /* @__PURE__ */ o(
1084
- "img",
1085
- {
1086
- className: "card__image",
1087
- src: h,
1088
- ...r,
1089
- alt: r.alt || (i == null ? void 0 : i.filename) || "card-image",
1090
- width: i == null ? void 0 : i.naturalWidth,
1091
- height: i == null ? void 0 : i.naturalHeight,
1092
- style: { width: "100%", height: "100%", objectFit: s || "cover", objectPosition: "center" },
1093
- loading: "lazy"
1094
- }
1095
- ) }),
1096
- children: [
1097
- e || n ? /* @__PURE__ */ o(
1098
- X,
1099
- {
1100
- align: d,
1101
- title: e,
1102
- titleProps: a,
1103
- description: n,
1104
- descriptionProps: c
1105
- }
1106
- ) : null,
1107
- l != null && l.length ? /* @__PURE__ */ o(O, { align: d, actions: l, className: "mt-4" }) : null
1108
- ]
1109
- }
1110
- );
1111
- }
1112
- const zo = $(K)`
1113
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1114
- &:hover {
1115
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1116
- }` : ""}
1117
-
1118
- .card__image__wrap {
1119
- padding-top: 61.8%;
1120
- width: 100%;
1121
- position: relative;
1122
- }
1123
- .card__image {
1124
- position: absolute;
1125
- top: 0;
1126
- left: 0;
1127
- bottom: 0;
1128
- right: 0;
1129
- width: 100%;
1130
- height: 100%;
1131
- object-position: top center;
1132
- }
1133
- `, It = "section";
1134
- function Pt({
1135
- title: t,
1136
- image: e,
1137
- imageMeta: n,
1138
- description: r,
1139
- actions: i,
1140
- align: s,
1141
- listType: a = "",
1142
- className: c = "",
1143
- ...l
1144
- }) {
1145
- return /* @__PURE__ */ _(Wo, { className: k("card", `list-type-${a}`, c), align: s, ...l, children: [
1146
- e && /* @__PURE__ */ o(
1147
- W,
1148
- {
1149
- icon: e,
1150
- color: "primary.main",
1151
- size: a === "icon-title" ? "1.2rem" : "3rem",
1152
- imageMeta: n
1153
- }
1154
- ),
1155
- t || r ? /* @__PURE__ */ o(X, { align: s, title: t, description: r }) : null,
1156
- i != null && i.length ? /* @__PURE__ */ o(O, { align: s, actions: i, className: "mt-4" }) : null
1157
- ] });
1158
- }
1159
- const Wo = $(K)`
1160
- padding: 5vw 4vw;
1161
- box-sizing: border-box;
1162
- /* min-height: 320px; */
1163
- color: inherit !important;
1164
- border-radius: 0.5rem;
1165
- /* ${({ dark: t, theme: e }) => `background-color:${t ? e.palette.grey[900] : e.palette.common.white};`} */
1166
- @media (max-width: ${({ theme: t }) => t.breakpoints.values[It]}px) {
1167
- padding: 1.5rem 2rem;
1168
- }
1169
- @media (max-width: ${({ theme: t }) => t.breakpoints.values.sm}px) {
1170
- height: auto;
1171
- min-height: unset;
1172
- }
1173
-
1174
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1175
- &:hover {
1176
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1177
- }` : ""}
1178
-
1179
- .card__title {
1180
- font-weight: 700;
1181
- margin-top: 24px;
1182
- margin-bottom: 12px;
1183
- a {
1184
- color: ${({ theme: t }) => t.palette.primary.main};
1185
- }
1186
- }
1187
- .card__description {
1188
- a {
1189
- color: ${({ theme: t }) => t.palette.primary.main};
1190
- }
1191
- }
1192
- .card__body {
1193
- padding: 0;
1194
- ${({ align: t }) => `text-align:${t || "left"};`}
1195
- }
1196
-
1197
- &.list-type-icon-title {
1198
- padding: 1.2rem;
1199
- .title-line {
1200
- display: flex;
1201
- }
1202
- .card__title {
1203
- margin: 0;
1204
- font-size: 1em;
1205
- }
1206
- .css-icon {
1207
- margin-right: 0.5rem;
1208
- }
1209
- }
1210
-
1211
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[It]}px) {
1212
- padding: 2rem 2rem;
1213
- text-align: left;
1214
- box-sizing: border-box;
1215
- }
1216
- `;
1217
- function Lo({
1218
- image: t,
1219
- title: e,
1220
- description: n,
1221
- imageProps: r = {},
1222
- imageMeta: i,
1223
- imageSize: s,
1224
- titleProps: a = {},
1225
- descriptionProps: c = {},
1226
- actions: l,
1227
- align: d,
1228
- ...m
1229
- }) {
1230
- const u = gt(t), h = T(I(t), 540);
1231
- return /* @__PURE__ */ _(
1232
- Oo,
1233
- {
1234
- className: "card-article",
1235
- ...m,
1236
- prepend: /* @__PURE__ */ o("div", { className: "card__image__wrap", children: u && t ? /* @__PURE__ */ o(
1237
- b,
1238
- {
1239
- sx: {
1240
- position: "absolute",
1241
- left: 0,
1242
- top: 0,
1243
- right: 0,
1244
- bottom: 0,
1245
- display: "flex",
1246
- alignItems: "center",
1247
- justifyContent: "center"
1248
- },
1249
- children: /* @__PURE__ */ o(W, { icon: t, color: "primary.main" })
1250
- }
1251
- ) : h && /* @__PURE__ */ o(
1252
- b,
1253
- {
1254
- component: "img",
1255
- className: "card__image",
1256
- src: h,
1257
- ...r,
1258
- alt: r.alt || (i == null ? void 0 : i.filename) || "card-image",
1259
- width: i == null ? void 0 : i.naturalWidth,
1260
- height: i == null ? void 0 : i.naturalHeight,
1261
- style: { width: "100%", height: "100%", objectFit: s || "contain", objectPosition: "center" },
1262
- loading: "lazy"
1263
- }
1264
- ) }),
1265
- children: [
1266
- e || n ? /* @__PURE__ */ o(
1267
- X,
1268
- {
1269
- align: d,
1270
- title: e,
1271
- titleProps: a,
1272
- description: n,
1273
- descriptionProps: c
1274
- }
1275
- ) : null,
1276
- l != null && l.length ? /* @__PURE__ */ o(O, { align: d, actions: l, className: "mt-4" }) : null
1277
- ]
1278
- }
1279
- );
1280
- }
1281
- const Oo = $(K)`
1282
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1283
- &:hover {
1284
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1285
- }` : ""}
1286
-
1287
- border-radius: 0 !important;
1288
-
1289
- .card__body {
1290
- ${({ align: t }) => `text-align:${t || "left"};`}
1291
- }
1292
-
1293
- .card__image__wrap {
1294
- width: 100%;
1295
- height: 100%;
1296
- position: relative;
1297
- display: flex;
1298
- justify-content: center;
1299
- align-items: center;
1300
- }
1301
-
1302
- .card__image {
1303
- max-height: 60px;
1304
- }
1305
- `, jt = "section";
1306
- function Ho({
1307
- title: t,
1308
- image: e,
1309
- imageMeta: n,
1310
- iconSize: r = 100,
1311
- description: i,
1312
- actions: s,
1313
- align: a,
1314
- className: c = "",
1315
- ...l
1316
- }) {
1317
- return /* @__PURE__ */ o(Ao, { className: k("card", c), ...l, children: /* @__PURE__ */ _(b, { className: "flex items-center", children: [
1318
- e && /* @__PURE__ */ o(W, { icon: e, color: "primary.main", size: r, imageMeta: n }),
1319
- /* @__PURE__ */ _(b, { className: "flex-1 ml-4", children: [
1320
- /* @__PURE__ */ o(X, { align: a, title: t, description: i }),
1321
- /* @__PURE__ */ o(O, { align: a, actions: s, className: "mt-4" })
1322
- ] })
1323
- ] }) });
1324
- }
1325
- const Ao = $(K)`
1326
- padding: 5vw 4vw;
1327
- text-align: left;
1328
- box-sizing: border-box;
1329
- /* min-height: 320px; */
1330
- color: inherit !important;
1331
- border-radius: 0.5rem;
1332
- /* ${({ dark: t, theme: e }) => `background-color:${t ? e.palette.grey[900] : e.palette.common.white};`} */
1333
- @media (max-width: ${({ theme: t }) => t.breakpoints.values[jt]}px) {
1334
- padding: 1.5rem 2rem;
1335
- }
1336
- @media (max-width: ${({ theme: t }) => t.breakpoints.values.sm}px) {
1337
- height: auto;
1338
- min-height: unset;
1339
- }
1340
-
1341
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1342
- &:hover {
1343
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1344
- }` : ""}
1345
-
1346
- .card__title {
1347
- font-weight: 700;
1348
- margin-bottom: 12px;
1349
- a {
1350
- color: ${({ theme: t }) => t.palette.primary.main};
1351
- }
1352
- }
1353
- .card__description {
1354
- a {
1355
- color: ${({ theme: t }) => t.palette.primary.main};
1356
- }
1357
- }
1358
- .card__body {
1359
- padding: 0;
1360
- }
1361
-
1362
- &.list-type-icon-title {
1363
- padding: 1.2rem;
1364
- .title-line {
1365
- display: flex;
1366
- }
1367
- .card__title {
1368
- margin: 0;
1369
- font-size: 1em;
1370
- }
1371
- .css-icon {
1372
- margin-right: 0.5rem;
1373
- }
1374
- }
1375
-
1376
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[jt]}px) {
1377
- padding: 2rem 2rem;
1378
- text-align: left;
1379
- box-sizing: border-box;
1380
- }
1381
- `;
1382
- function Mo({
1383
- title: t,
1384
- titleProps: e = {},
1385
- description: n,
1386
- descriptionProps: r = {},
1387
- image: i,
1388
- imageMeta: s,
1389
- className: a = "",
1390
- align: c,
1391
- hoverStyle: l,
1392
- ...d
1393
- }) {
1394
- return /* @__PURE__ */ _(Uo, { className: k("card-simple", a, `hover-style__${l}`), align: c, ...d, children: [
1395
- i && /* @__PURE__ */ o(W, { icon: i, color: "primary.main", imageMeta: s }),
1396
- t || n ? /* @__PURE__ */ o(
1397
- X,
1398
- {
1399
- align: c,
1400
- title: t,
1401
- titleProps: e,
1402
- description: n,
1403
- descriptionProps: r
1404
- }
1405
- ) : null
1406
- ] });
1407
- }
1408
- const Uo = $(K)`
1409
- ${({ dark: t, theme: e }) => `background-color:${t ? e.palette.grey[900] : e.palette.common.white};`}
1410
-
1411
- &.hover-style__default {
1412
- &.card-simple {
1413
- &:hover {
1414
- border-top-right-radius: 36px;
1415
- }
1416
- }
1417
- .card__body {
1418
- &:hover {
1419
- &::before {
1420
- width: 42px;
1421
- height: 42px;
1422
- transform: translate(50%, -50%) rotate(45deg);
1423
- }
1424
- &::after {
1425
- transform: none;
1426
- }
1427
- }
1428
- }
1429
- }
1430
-
1431
- &.card-simple {
1432
- border-radius: 8px;
1433
- border-top-right-radius: 26px;
1434
-
1435
- .card__body {
1436
- ${({ align: t }) => `text-align:${t || "left"};`}
1437
- }
1438
-
1439
- ${(t) => t.link ? `
1440
- cursor: pointer;
1441
- ` : ""}
1442
- /* cursor: pointer; */
1443
- /* &:hover {
1444
- border-top-right-radius: 36px;
1445
- } */
1446
- transition: all 180ms ease 0s;
1447
- overflow: visible;
1448
- .card__title {
1449
- margin: 12px 0;
1450
- }
1451
- .card__body {
1452
- position: relative;
1453
- padding: 20px 16px 18px;
1454
- overflow: hidden;
1455
- transition: all 180ms ease 0s;
1456
- /* &:hover {
1457
- &::before {
1458
- width: 42px;
1459
- height: 42px;
1460
- transform: translate(50%, -50%) rotate(45deg);
1461
- }
1462
- &::after {
1463
- transform: none;
1464
- }
1465
- } */
1466
- &::before,
1467
- &::after {
1468
- content: ${({ border: t }) => t ? '""' : ""};
1469
- transition: inherit;
1470
- position: absolute;
1471
- top: 0px;
1472
- right: 0px;
1473
- }
1474
- &::before {
1475
- z-index: 3;
1476
- background: #fff;
1477
- width: 30px;
1478
- height: 30px;
1479
- transform: translate(50%, -50%) rotate(45deg);
1480
- box-shadow: 0 1px 0 0 #e9eaec;
1481
- }
1482
- &::after {
1483
- z-index: 2;
1484
- width: 28px;
1485
- height: 28px;
1486
- border-bottom-left-radius: 6px;
1487
- background: #fcfcfd;
1488
- box-shadow: -1px 1px 0 0 #e9eaec;
1489
- transform: translate(8px, -8px);
1490
- }
1491
- }
1492
- }
1493
- `;
1494
- function Fo({ type: t = "default", ...e }) {
1495
- const r = {
1496
- article: Eo,
1497
- simple: Mo,
1498
- news: Ho,
1499
- default: Pt,
1500
- wall: Lo
1501
- }[t] || Pt;
1502
- return /* @__PURE__ */ o(r, { ...t === "news" ? e : j(e, "iconSize") });
1503
- }
1504
- function Vo({
1505
- list: t = [],
1506
- align: e = "top",
1507
- cards: n,
1508
- listBorder: r = !0,
1509
- listType: i = "",
1510
- col: s = 3,
1511
- gap: a,
1512
- iconColor: c,
1513
- className: l = "",
1514
- type: d = "default",
1515
- dark: m = !1,
1516
- textAlign: u = "left",
1517
- hoverStyle: h,
1518
- ...p
1519
- }) {
1520
- return /* @__PURE__ */ o(
1521
- ft,
1522
- {
1523
- type: d,
1524
- className: k("card-list py-1", l, "items-stretch"),
1525
- col: s,
1526
- gap: a,
1527
- align: e,
1528
- ...p,
1529
- children: n || t.map((x) => /* @__PURE__ */ o(
1530
- Fo,
1531
- {
1532
- borderColor: r,
1533
- iconColor: c,
1534
- type: d,
1535
- listType: i,
1536
- dark: m,
1537
- ...x,
1538
- align: u,
1539
- sx: {
1540
- bgcolor: d === "wall" ? void 0 : m ? "grey.900" : "common.white"
1541
- },
1542
- style: a === 0 && t.length > 1 ? {
1543
- borderRadius: 0,
1544
- marginRight: "-1px",
1545
- marginBottom: "-1px"
1546
- } : {}
1547
- },
1548
- x.id
1549
- ))
1550
- }
1551
- );
1552
- }
1553
- const Go = [
1554
- "align",
1555
- "cards",
1556
- "list",
1557
- "listBorder",
1558
- "listType",
1559
- "col",
1560
- "gap",
1561
- "iconColor",
1562
- "type",
1563
- "textAlign"
1564
- ], Do = $(J)`
1565
- a .card {
1566
- color: #404040;
1567
- cursor: pointer;
1568
- }
1569
- a:not(.MuiButton-root) {
1570
- color: ${({ theme: t }) => t.palette.primary.main};
1571
- &:hover,
1572
- &:active {
1573
- color: ${({ theme: t }) => t.palette.primary.main};
1574
- }
1575
- }
1576
- a:hover .card {
1577
- color: #404040;
1578
- }
1579
- `;
1580
- function Jo({ className: t, ...e }) {
1581
- const [n, r] = N(e, D), [i, s] = N(r, Go);
1582
- return /* @__PURE__ */ _(Do, { className: k("section--card-list", t), type: e.type, ...s, children: [
1583
- Object.keys(n).length > 0 && /* @__PURE__ */ o(G, { center: !0, ...n, className: "mb-[2.5vw]" }),
1584
- /* @__PURE__ */ o(Vo, { ...i, dark: !!e.dark })
1585
- ] });
1586
- }
1587
- const qo = $(Jo)`
1588
- .card__description {
1589
- white-space: pre-wrap;
1590
- }
1591
- .section__description {
1592
- }
1593
- .card {
1594
- /* background: inherit !important; */
1595
- }
1596
- &.dark .card-simple .card__body::before {
1597
- background: #212121 !important;
1598
- }
1599
- .card-simple .card__body::after {
1600
- background: inherit !important;
1601
- }
1602
- `;
1603
- function Ko({ section: t, ...e }) {
1604
- const [{ editing: n }, r] = N(e, q), i = C(() => {
1605
- var s;
1606
- return {
1607
- ...j(r, ["listBorder", "list", "iconSize", "imageSize"]),
1608
- list: (s = r.list) == null ? void 0 : s.map((a) => {
1609
- var c, l;
1610
- return {
1611
- ...j(a, "icon", "iconColor"),
1612
- image: ["news", "simple", "default"].includes(r.type) && a.icon ? a.icon : a.image,
1613
- actions: (l = (c = a.actions) == null ? void 0 : c.map) == null ? void 0 : l.call(c, (d) => /* @__PURE__ */ o(re, { ...d, editing: n }, d.id)),
1614
- border: r.listBorder,
1615
- iconSize: r.iconSize,
1616
- imageSize: r.imageSize,
1617
- hoverStyle: r.hoverStyle
1618
- };
1619
- })
1620
- };
1621
- }, [r]);
1622
- return /* @__PURE__ */ o(qo, { style: n ? { pointerEvents: "none" } : {}, ...i });
1623
- }
1624
- function Xo({
1625
- properties: t,
1626
- section: e,
1627
- locale: n,
1628
- dev: r
1629
- }) {
1630
- var i;
1631
- return (i = e == null ? void 0 : e.config) != null && i.componentId ? /* @__PURE__ */ o(
1632
- Ye,
1633
- {
1634
- instanceId: e.id,
1635
- componentId: e.config.componentId,
1636
- blockletId: e.config.blockletId,
1637
- blockletTitle: e.config.blockletTitle,
1638
- componentName: e.config.componentName,
1639
- locale: n,
1640
- properties: t,
1641
- dev: r
1642
- }
1643
- ) : /* @__PURE__ */ o(b, { textAlign: "center", py: 2, children: /* @__PURE__ */ o(B, { variant: "caption", color: "text.secondary", children: "Please select component to render" }) });
1644
- }
1645
- function Yo({
1646
- src: t,
1647
- dataId: e,
1648
- isEdit: n = !1,
1649
- height: r = "100%",
1650
- onLoad: i = () => {
1651
- }
1652
- }) {
1653
- return /* @__PURE__ */ o(
1654
- eo,
1655
- {
1656
- isEdit: n,
1657
- embedId: e,
1658
- src: t,
1659
- height: r,
1660
- onLoad: () => {
1661
- i();
1662
- }
1663
- }
1664
- );
1665
- }
1666
- function Qo({ dataId: t, src: e, actions: n, center: r, onLoad: i, ...s }) {
1667
- const [a, c] = N(s, D);
1668
- return /* @__PURE__ */ _(J, { ...c, children: [
1669
- Object.keys(a).length > 0 && /* @__PURE__ */ o(G, { center: r, ...a }),
1670
- /* @__PURE__ */ o(
1671
- Yo,
1672
- {
1673
- dataId: t,
1674
- src: e,
1675
- onLoad: i,
1676
- height: s.iframeHeight ? `${s.iframeHeight}px` : "100%"
1677
- }
1678
- ),
1679
- /* @__PURE__ */ o(O, { actions: n, center: r })
1680
- ] });
1681
- }
1682
- function Zo({ section: t, id: e, src: n, ...r }) {
1683
- const i = `${e}-${r.locale}`, [{ editing: s }, a] = N(r, q), c = V({}), l = JSON.parse(JSON.stringify(a)), { message: d } = to(i, "server"), m = $e(JSON.parse(JSON.stringify(a.config) || "{}"));
1684
- return z(() => {
1685
- d && d.onInit(() => m.current);
1686
- }, [d]), z(() => {
1687
- const u = JSON.parse(JSON.stringify(a.config) || "{}");
1688
- Ft(c.current, u) || (c.current = u, d == null || d.send("config-set", u));
1689
- }, [d, a.config]), n ? /* @__PURE__ */ o(Qo, { ...l, dataId: i, src: n, style: s ? { pointerEvents: "none" } : {} }) : /* @__PURE__ */ o(tn, { children: 'Please set the "src" attribute for this block' });
1690
- }
1691
- const tn = $("div")`
1692
- user-select: none;
1693
- color: #999;
1694
- padding: 8px;
1695
- height: 200px;
1696
- `, en = [
1697
- /youtu\.be\/([^#&?]{11})/,
1698
- // youtu.be/<id>
1699
- /\?v=([^#&?]{11})/,
1700
- // ?v=<id>
1701
- /&v=([^#&?]{11})/,
1702
- // &v=<id>
1703
- /embed\/([^#&?]{11})/,
1704
- // embed/<id>
1705
- /\/v\/([^#&?]{11})/
1706
- // /v/<id>
1707
- ];
1708
- function on(t) {
1709
- var e;
1710
- if (/youtu\.?be/.test(t))
1711
- for (const n of en) {
1712
- const r = (e = n.exec(t)) == null ? void 0 : e[1];
1713
- if (r)
1714
- return r;
1715
- }
1716
- }
1717
- function nn(t) {
1718
- const e = on(t);
1719
- if (e)
1720
- return `https://youtube.com/embed/${e}`;
1721
- }
1722
- function rn({ src: t }) {
1723
- return z(() => {
1724
- import("@lottiefiles/lottie-player");
1725
- }, []), /* @__PURE__ */ o("lottie-player", { autoplay: !0, loop: !0, mode: "normal", src: t });
1726
- }
1727
- function sn(t) {
1728
- return /* @__PURE__ */ o(b, { maxHeight: 400, overflow: "hidden auto", children: /* @__PURE__ */ o(oo, { ...t }) });
1729
- }
1730
- function an({ url: t }) {
1731
- const e = V(null), n = 495, [r, i] = E(
1732
- e.current ? e.current.offsetWidth * 0.5625 : n
1733
- ), s = ut(() => {
1734
- const a = window.innerWidth > 990 ? 1 : window.innerWidth > 522 ? 1.2 : window.innerWidth > 400 ? 1.45 : 1.85, c = e.current ? e.current.offsetWidth * 0.5625 : n;
1735
- return i(Math.floor(c * a));
1736
- }, []);
1737
- return z(() => {
1738
- window.addEventListener("resize", s);
1739
- const a = window.innerWidth > 990 ? 1 : window.innerWidth > 522 ? 1.2 : window.innerWidth > 400 ? 1.45 : 1.85, c = e.current ? e.current.offsetWidth * 0.5625 : n;
1740
- return i(Math.floor(c * a)), function() {
1741
- window.removeEventListener("resize", s);
1742
- };
1743
- }, [r, s]), /* @__PURE__ */ o(
1744
- b,
1745
- {
1746
- component: "iframe",
1747
- ref: e,
1748
- title: "youtube",
1749
- width: "100%",
1750
- height: `${r}px`,
1751
- src: t,
1752
- frameBorder: "0",
1753
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
1754
- allowFullScreen: !0,
1755
- sx: { display: "block" }
1756
- }
1757
- );
1758
- }
1759
- const cn = $(ko)`
1760
- .section__description {
1761
- }
1762
- `;
1763
- function ln({
1764
- hasImage: t,
1765
- fullSizeImage: e,
1766
- boxed: n,
1767
- videoPoster: r,
1768
- imageMeta: i,
1769
- imageOptimization: s,
1770
- imageSize: a,
1771
- section: c,
1772
- ...l
1773
- }) {
1774
- var p, x;
1775
- const [{ editing: d }, m] = N({ ...l, boxed: e ? void 0 : n }, q);
1776
- let u = dn(m.image, r, e, i, s, a);
1777
- t || (u = null);
1778
- let h = null;
1779
- return m.actions && (h = (x = (p = m.actions) == null ? void 0 : p.map) == null ? void 0 : x.call(p, (y, f) => /* @__PURE__ */ o(re, { ...y, editing: d }, f))), /* @__PURE__ */ o(
1780
- cn,
1781
- {
1782
- ...m,
1783
- style: d ? { pointerEvents: "none" } : {},
1784
- image: u,
1785
- fullSizeImage: t && e,
1786
- actions: h
1787
- }
1788
- );
1789
- }
1790
- function dn(t, e, n, r, i, s) {
1791
- if (t) {
1792
- if (t.endsWith(".json"))
1793
- return /* @__PURE__ */ o(rn, { src: t });
1794
- if (t.indexOf("twitter.com") !== -1)
1795
- return /* @__PURE__ */ o(sn, { sourceType: "url", url: t });
1796
- const a = nn(t);
1797
- if (a)
1798
- return /* @__PURE__ */ o(an, { url: a });
1799
- const { naturalWidth: c, naturalHeight: l, filename: d } = r || {};
1800
- if (st(t))
1801
- return /* @__PURE__ */ o(
1802
- "video",
1803
- {
1804
- width: c && `${c}px`,
1805
- height: l && `${l}px`,
1806
- controls: !0,
1807
- autoPlay: !0,
1808
- muted: !0,
1809
- style: {
1810
- display: "block",
1811
- objectFit: s || "contain",
1812
- borderRadius: "8px",
1813
- width: "100%",
1814
- height: "100%"
1815
- },
1816
- poster: T(I(e), n ? 1200 : 540, i),
1817
- children: /* @__PURE__ */ o("source", { src: I(t), type: xo(t) })
1818
- },
1819
- t
1820
- );
1821
- const m = i === "quality" ? 1 : 0.6;
1822
- return /* @__PURE__ */ o(
1823
- Kt,
1824
- {
1825
- src: I(t),
1826
- sizesAttr: {
1827
- sm: 600 * m,
1828
- md: 450 * m,
1829
- lg: 540 * m,
1830
- ...n && {
1831
- md: 900 * m,
1832
- lg: 1200 * m
1833
- }
1834
- },
1835
- width: c && `${c}px`,
1836
- height: l && `${l}px`,
1837
- alt: d ?? t,
1838
- style: { objectFit: s || "contain", display: "block", width: "100%", height: "100%" },
1839
- loading: "lazy"
1840
- }
1841
- );
1842
- }
1843
- return null;
1844
- }
1845
- const mn = ["production", "draft"];
1846
- function un({ mode: t, version: e } = {}) {
1847
- const n = e && typeof e == "number" ? { mode: t, version: e } : { mode: t };
1848
- return lt.get(`/api/${dt()}/pages`, { params: n }).then((r) => r.data);
1849
- }
1850
- function Pr({ mode: t, pages: e }) {
1851
- return lt.post(`/api/${dt()}/pages/publish`, { mode: t, pages: e }).then((n) => n.data);
1852
- }
1853
- function pn({
1854
- locale: t,
1855
- sort: e,
1856
- page: n,
1857
- limit: r,
1858
- mode: i
1859
- } = {}) {
1860
- return lt.get(`/api/${dt()}/pages/toc`, { params: { locale: t, sort: e, page: n, limit: r, mode: i } }).then((s) => s.data);
1861
- }
1862
- const Bt = 20;
1863
- function hn({ style: t, sort: e, section: n, ...r }) {
1864
- const [{ editing: i, locale: s }, a] = N(r, q), [c, l] = N(a, D), [d, m] = E(), u = V(!1), h = Ae(), p = ze(), x = ut(async () => {
1865
- if (!u.current) {
1866
- u.current = !0, h();
1867
- try {
1868
- const y = d ? Math.floor(d.list.length / Bt) + 1 : 1, { list: f, total: w } = await pn({ locale: s, sort: e, page: y, limit: Bt });
1869
- m((g) => ({
1870
- list: ((g == null ? void 0 : g.list) ?? []).concat(f),
1871
- total: w
1872
- }));
1873
- } finally {
1874
- u.current = !1, h();
1875
- }
1876
- }
1877
- }, [d, s, e, h]);
1878
- return Me(() => {
1879
- x();
1880
- }), /* @__PURE__ */ _(J, { ...l, sx: i ? { pointerEvents: "none" } : {}, children: [
1881
- Object.keys(c).length > 0 && /* @__PURE__ */ o(G, { ...c }),
1882
- d ? /* @__PURE__ */ _(F, { children: [
1883
- /* @__PURE__ */ o(kt, { container: !0, spacing: 2, justifyContent: "center", children: d == null ? void 0 : d.list.map((y) => /* @__PURE__ */ o(kt, { item: !0, xs: 12, sm: t === "card" ? 6 : 12, md: t === "card" ? 3 : 12, children: /* @__PURE__ */ _(
1884
- fn,
1885
- {
1886
- elevation: 0,
1887
- className: k(t === "card" && "style-card"),
1888
- onClick: i ? void 0 : () => p(y.slug),
1889
- children: [
1890
- !!y.image && /* @__PURE__ */ o(
1891
- ve,
1892
- {
1893
- component: "img",
1894
- alt: "",
1895
- image: T(I(y.image), 540),
1896
- loading: "lazy"
1897
- }
1898
- ),
1899
- /* @__PURE__ */ _(ke, { children: [
1900
- /* @__PURE__ */ o(B, { variant: "h6", component: "div", className: Rt, children: y.title || y.id }),
1901
- /* @__PURE__ */ o(B, { variant: "body2", className: Rt, children: y.description })
1902
- ] })
1903
- ]
1904
- }
1905
- ) }, y.id)) }),
1906
- /* @__PURE__ */ o(b, { textAlign: "center", mt: 2, children: d.total > d.list.length ? /* @__PURE__ */ o(U, { variant: "outlined", color: "secondary", onClick: x, loading: u.current, children: "More" }) : /* @__PURE__ */ o(U, { variant: "outlined", color: "secondary", disabled: !0, children: "No More" }) })
1907
- ] }) : /* @__PURE__ */ o(b, { p: 2, textAlign: "center", children: /* @__PURE__ */ o(Ut, { size: 24 }) })
1908
- ] });
1909
- }
1910
- const Rt = nt`
1911
- display: -webkit-box;
1912
- -webkit-box-orient: vertical;
1913
- -webkit-line-clamp: 2;
1914
- overflow: hidden;
1915
- text-overflow: ellipsis;
1916
- `, fn = $(we)`
1917
- border: 1px solid #e0e0e0;
1918
- background-color: transparent;
1919
- cursor: pointer;
1920
- display: flex;
1921
- color: inherit;
1922
-
1923
- > .MuiCardMedia-root {
1924
- width: 30vw;
1925
- max-height: 50vw;
1926
- }
1927
-
1928
- &.style-card {
1929
- display: block;
1930
-
1931
- > .MuiCardMedia-root {
1932
- width: 100%;
1933
- max-height: 50vw;
1934
- }
1935
- }
1936
- `, gn = {
1937
- iframe: Zo,
1938
- section: ln,
1939
- "section-card-list": Ko,
1940
- toc: hn,
1941
- "ai-runtime": So,
1942
- "custom-component": Xo
1943
- };
1944
- function xn({ id: t, type: e, mode: n, config: r, section: i, ...s }) {
1945
- const a = gn[e], c = C(() => {
1946
- const { sx: m, height: u, ...h } = r;
1947
- return h;
1948
- }, [r]), l = C(() => {
1949
- const m = { sx: r.sx };
1950
- return e !== "custom-component" && (m.height = r.height), m;
1951
- }, [r.sx, r.height, e]), d = a && /* @__PURE__ */ o(a, { mode: n, ...c, id: t, section: i });
1952
- return /* @__PURE__ */ o(_o, { ...s, ...l, children: d });
1953
- }
1954
- const bn = $(no, { shouldForwardProp: (t) => !!t })`
1955
- & > div > .MuiContainer-root {
1956
- max-width: unset;
1957
- }
1958
- `;
1959
- function yn({ meta: t, ...e }) {
1960
- const n = ht();
1961
- return /* @__PURE__ */ o(bn, { ...e, meta: t, theme: n || {} });
1962
- }
1963
- function wn(t) {
1964
- return /* @__PURE__ */ o(b, { display: "flex", flex: 1, height: "100%", alignItems: "center", justifyContent: "center", ...t, children: /* @__PURE__ */ o(Ut, { size: 30 }) });
1965
- }
1966
- function vn(t) {
1967
- return /* @__PURE__ */ o(kn, { ...t });
1968
- }
1969
- const kn = $(b)`
1970
- position: fixed;
1971
- left: 0;
1972
- top: 0;
1973
- z-index: 999999999999;
1974
- width: 80px;
1975
- font-size: 12px;
1976
- text-align: center;
1977
- opacity: 0.7;
1978
- transform: translateX(-23%) translateY(70%) rotate(-45deg);
1979
- pointer-events: none;
1980
- `, _n = (t) => new Promise((e, n) => {
1981
- (t == null ? void 0 : t.length) > 0 ? ro.load({
1982
- google: {
1983
- families: t
1984
- },
1985
- fontactive: () => {
1986
- e("success");
1987
- },
1988
- fontinactive: () => {
1989
- n(new Error("load font fail"));
1990
- }
1991
- }) : e("success");
1992
- }), Tt = `Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
1993
- sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`, Et = {};
1994
- function $n({
1995
- titleFontFamily: t,
1996
- descriptionFontFamily: e
1997
- }) {
1998
- const n = async (r) => {
1999
- if (r && !document.querySelectorAll(`link[href*="${r}" i]`).length)
2000
- try {
2001
- Et[r] || (await _n([r]), Et[r] = !0);
2002
- } catch (i) {
2003
- console.error(i);
2004
- }
2005
- };
2006
- return z(() => {
2007
- t && n(t), e && n(e);
2008
- }, [t, e]), /* @__PURE__ */ o(
2009
- Ot,
2010
- {
2011
- styles: Ht`
2012
- #app {
2013
- .page-kit-section__title {
2014
- font-family: ${JSON.stringify(t)}, ${Tt};
2015
- }
2016
-
2017
- .page-kit-section__description {
2018
- font-family: ${JSON.stringify(e)}, ${Tt};
2019
- }
2020
- }
2021
- `
2022
- }
2023
- );
2024
- }
2025
- const { SessionProvider: jr, SessionContext: Sn, SessionConsumer: Br, withSession: Rr } = io();
2026
- function xt() {
2027
- return Dt(Sn);
2028
- }
2029
- function Cn(...t) {
2030
- var n;
2031
- const { session: e } = xt();
2032
- return t.includes((n = e.user) == null ? void 0 : n.role);
2033
- }
2034
- function Nn(...t) {
2035
- var r;
2036
- const { session: e } = xt(), n = Cn(...t);
2037
- return ((r = window.blocklet) == null ? void 0 : r.tenantMode) === "multiple" ? !!e.user : n;
2038
- }
2039
- function In(t) {
2040
- return t != null;
2041
- }
2042
- function Tr() {
2043
- const [t] = We(), { session: e } = xt(), n = Nn("owner", "admin", "pagesEditor", "member"), r = C(() => {
2044
- const s = t.get("mode");
2045
- return mn.includes(s) ? s : "production";
2046
- }, [t]), i = r === "production" ? r : e.user ? n ? r : "production" : null;
2047
- return i ? /* @__PURE__ */ o(Pn, { mode: i }) : null;
2048
- }
2049
- function Pn({ mode: t }) {
2050
- if (t !== "draft") {
2051
- const e = window.__PAGE_STATE__;
2052
- return e ? /* @__PURE__ */ o(ot, { mode: t, state: e }) : /* @__PURE__ */ o(Bn, { mode: t, children: ({ state: n }) => /* @__PURE__ */ o(ot, { mode: t, state: n }) });
2053
- }
2054
- return /* @__PURE__ */ o(jn, { children: ({ state: e }) => /* @__PURE__ */ o(ot, { mode: t, state: e }) });
2055
- }
2056
- const jn = Jt(() => import("./draft-data-B1GJKphX.js"));
2057
- function Bn({
2058
- mode: t,
2059
- children: e
2060
- }) {
2061
- const n = document.querySelector('meta[property="pages:version"]'), r = n == null ? void 0 : n.content, i = me(), s = C(() => {
2062
- if (r === "{{pagesPublishedAt}}") {
2063
- const l = localStorage.getItem(ue(i ?? ""));
2064
- return Number(l) ? Number(l) : (/* @__PURE__ */ new Date()).getTime();
2065
- }
2066
- return Number(r);
2067
- }, [r]), { loading: a, value: c } = qt(() => un({ mode: t, version: s }), [t, s]);
2068
- return a ? /* @__PURE__ */ o(wn, {}) : c ? e({ state: c }) : null;
2069
- }
2070
- function ot({ mode: t, state: e }) {
2071
- var x, y, f, w;
2072
- const { t: n, locale: r } = Wt(), {
2073
- pageIds: i,
2074
- pages: s,
2075
- supportedLocales: a,
2076
- config: { defaultLocale: c },
2077
- resources: l
2078
- } = e, d = zt(e), m = C(
2079
- () => a != null && a.some((g) => g.locale === r) ? r : void 0,
2080
- [r, a]
2081
- ), u = Object.values(s).find((g) => (g == null ? void 0 : g.slug) === "/") ? void 0 : Object.values(s)[0], h = C(
2082
- () => i.map((g) => {
2083
- const v = s[g];
2084
- return v && {
2085
- id: v.id,
2086
- path: Z("/", m || "", v.slug, t !== "production" ? `?mode=${t}` : "")
2087
- };
2088
- }).filter(In),
2089
- [i, s, m, t]
2090
- ), p = ([...g]) => (t !== "production" && g.unshift(
2091
- /* @__PURE__ */ o(Be, { fallback: /* @__PURE__ */ o("div", {}), children: /* @__PURE__ */ o(Rn, { mode: "production", state: e }) })
2092
- ), g);
2093
- return /* @__PURE__ */ _(Co, { value: { pages: h }, children: [
2094
- /* @__PURE__ */ _(Le, { children: [
2095
- u && /* @__PURE__ */ o(Q, { index: !0, element: /* @__PURE__ */ o(Oe, { to: Z("/", m || "", u.slug) }) }),
2096
- i.map((g) => {
2097
- const v = s[g];
2098
- return v ? /* @__PURE__ */ o(
2099
- Q,
2100
- {
2101
- path: Z(":projectIdOrSlug?", v.slug),
2102
- element: /* @__PURE__ */ o(
2103
- ct,
2104
- {
2105
- mode: t,
2106
- components: d,
2107
- page: v,
2108
- locale: m,
2109
- defaultLocale: c,
2110
- headerAddons: p
2111
- }
2112
- )
2113
- },
2114
- v.id
2115
- ) : null;
2116
- }),
2117
- l.pages && Object.values(l.pages).map(({ blockletId: g, page: v }) => /* @__PURE__ */ o(
2118
- Q,
2119
- {
2120
- path: Z("/", `@${g}`, v.slug),
2121
- element: /* @__PURE__ */ o(
2122
- ct,
2123
- {
2124
- mode: t,
2125
- components: d,
2126
- page: v,
2127
- locale: m,
2128
- defaultLocale: c,
2129
- headerAddons: p
2130
- }
2131
- )
2132
- },
2133
- v.id
2134
- )),
2135
- /* @__PURE__ */ o(
2136
- Q,
2137
- {
2138
- path: "*",
2139
- element: /* @__PURE__ */ o(b, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ o(Lt, { status: 404, extra: /* @__PURE__ */ o(se, { href: "/", children: n("common.back") }) }) })
2140
- }
2141
- )
2142
- ] }),
2143
- t !== "production" && /* @__PURE__ */ o(vn, { sx: { bgcolor: "info.light" }, children: t }),
2144
- /* @__PURE__ */ o(
2145
- $n,
2146
- {
2147
- titleFontFamily: (y = (x = e.config) == null ? void 0 : x.fontFamily) == null ? void 0 : y.title,
2148
- descriptionFontFamily: (w = (f = e.config) == null ? void 0 : f.fontFamily) == null ? void 0 : w.description
2149
- }
2150
- )
2151
- ] });
2152
- }
2153
- function Er({
2154
- mode: t,
2155
- state: e,
2156
- path: n,
2157
- pageData: r
2158
- }) {
2159
- const { t: i, locale: s } = Wt(), {
2160
- pages: a,
2161
- supportedLocales: c,
2162
- config: { defaultLocale: l },
2163
- resources: d
2164
- } = e, m = Object.values(a).find((f) => (f == null ? void 0 : f.slug) === n), u = Object.values(d.pages || {}).find((f) => f.page.slug === n), h = C(
2165
- () => c != null && c.some((f) => f.locale === s) ? s : void 0,
2166
- [s, c]
2167
- ), p = Se({
2168
- page: null
2169
- });
2170
- z(() => {
2171
- const f = m || (u == null ? void 0 : u.page) || null;
2172
- f ? p.page = _t(f) : p.page = null;
2173
- }, [m, u]);
2174
- const x = V();
2175
- if (z(() => {
2176
- Ft(r, x.current) || r && p.page && (so(p.page, e, h, r), x.current = _t(r));
2177
- }, [{}]), !m && !(u != null && u.page))
2178
- return /* @__PURE__ */ o(b, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ o(Lt, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ o(se, { href: "/", children: i("common.back") }) }) });
2179
- const y = zt(e);
2180
- return p.page ? /* @__PURE__ */ o(
2181
- ct,
2182
- {
2183
- mode: t,
2184
- components: y,
2185
- page: p.page,
2186
- locale: h,
2187
- defaultLocale: l
2188
- }
2189
- ) : null;
2190
- }
2191
- function ct({
2192
- mode: t,
2193
- components: e,
2194
- page: n,
2195
- locale: r,
2196
- defaultLocale: i,
2197
- headerAddons: s
2198
- }) {
2199
- var f, w, g, v, P, H, Y, bt, yt;
2200
- const a = ((f = n.locales) == null ? void 0 : f[r]) ?? ((w = n.locales) == null ? void 0 : w[i]) ?? {}, c = a.title || ((g = window.blocklet) == null ? void 0 : g.appName), l = a.description || ((v = window.blocklet) == null ? void 0 : v.appDescription), d = T(I(a.image), 540), { logo: m, brand: u, description: h, ...p } = pe(), x = C(
2201
- () => (L) => {
2202
- var A;
2203
- let S = (s == null ? void 0 : s(L)) ?? L;
2204
- return S = ((A = p.addons) == null ? void 0 : A.call(p, S)) ?? S, S;
2205
- },
2206
- [p.addons, s]
2207
- ), y = (P = a.header) != null && P.translucent ? En : ie;
2208
- return /* @__PURE__ */ _(F, { children: [
2209
- !!a.backgroundColor && /* @__PURE__ */ o(
2210
- Ot,
2211
- {
2212
- styles: Ht`
2213
- body {
2214
- background-color: ${a.backgroundColor} !important;
2215
- }
2216
- `
2217
- }
2218
- ),
2219
- /* @__PURE__ */ o(
2220
- y,
2221
- {
2222
- hideNavMenu: !!((H = a.header) != null && H.hideNavMenus),
2223
- translucentTextColor: (Y = a.header) == null ? void 0 : Y.translucentTextColor,
2224
- ...m ? { logo: m } : {},
2225
- ...u ? { brand: u } : {},
2226
- ...h ? { description: h } : {},
2227
- className: k(((bt = a.header) == null ? void 0 : bt.sticky) && "sticky", "page-header"),
2228
- maxWidth: !1,
2229
- addons: x
2230
- }
2231
- ),
2232
- /* @__PURE__ */ o(He, {}),
2233
- /* @__PURE__ */ _(Re, { children: [
2234
- /* @__PURE__ */ o("title", { children: c }),
2235
- /* @__PURE__ */ o("meta", { name: "og:title", content: c }),
2236
- /* @__PURE__ */ o("meta", { name: "og:description", content: l }),
2237
- /* @__PURE__ */ o("meta", { name: "og:image", content: d }),
2238
- /* @__PURE__ */ o("meta", { name: "twitter:image:src", content: d }),
2239
- /* @__PURE__ */ o("meta", { name: "twitter:image", content: d }),
2240
- /* @__PURE__ */ o("meta", { property: "twitter:description", content: l }),
2241
- /* @__PURE__ */ o("meta", { property: "twitter:title", content: c }),
2242
- /* @__PURE__ */ o("meta", { name: "description", content: l })
2243
- ] }),
2244
- /* @__PURE__ */ o(mt, { flexGrow: 1, children: n.sectionIds.map((L) => {
2245
- var wt, vt;
2246
- const S = n.sections[L];
2247
- if (!S || S.visibility === "hidden") return null;
2248
- const A = (wt = S.locales) == null ? void 0 : wt[r], ae = ((vt = S.locales) == null ? void 0 : vt[i]) ?? {};
2249
- return /* @__PURE__ */ o(
2250
- xn,
2251
- {
2252
- id: L,
2253
- type: S.component,
2254
- mode: t,
2255
- section: S,
2256
- config: {
2257
- ...Ne(A) ? ae : A,
2258
- locale: r,
2259
- dev: t === "draft" ? {
2260
- mode: t,
2261
- components: e,
2262
- defaultLocale: i
2263
- } : { mode: t }
2264
- }
2265
- },
2266
- L
2267
- );
2268
- }) }),
2269
- !((yt = a.footer) != null && yt.hidden) && /* @__PURE__ */ o(yn, {})
2270
- ] });
2271
- }
2272
- const Rn = Jt(() => import("./publish-button-BY10Od4q.js")), ie = At(he)`
2273
- &.sticky {
2274
- position: sticky;
2275
- top: 0;
2276
- }
2277
- `;
2278
- function Tn({ logo: t }) {
2279
- const [e, n] = E(), { value: r } = qt(() => new Promise((i) => {
2280
- fetch("/.well-known/service/blocklet/logo-rect").then((s) => {
2281
- const a = s.headers.get("content-type");
2282
- a != null && a.includes("svg") && s.text().then((c) => {
2283
- n(c), i(null);
2284
- }), i(s.url);
2285
- });
2286
- }), []);
2287
- if (t)
2288
- return t;
2289
- if (e)
2290
- return /* @__PURE__ */ o(b, { sx: { filter: "initial !important" }, dangerouslySetInnerHTML: { __html: Ce.sanitize(e) } });
2291
- if (r) {
2292
- const i = new URL(r);
2293
- i.searchParams.set("imageFilter", "convert"), i.searchParams.set("f", "png"), i.searchParams.set("h", "80");
2294
- const s = i.toString();
2295
- return /* @__PURE__ */ o("img", { src: s, alt: "logo" });
2296
- }
2297
- return null;
2298
- }
2299
- function En({
2300
- logo: t,
2301
- translucentTextColor: e,
2302
- ...n
2303
- }) {
2304
- const { y: r } = Ue();
2305
- let i = Math.min(r / 800, 1), s = "";
2306
- if (i > 0.1) {
2307
- i = Math.max(i, 0.6);
2308
- const a = Math.round(255 * Math.min(1 - i, 0.2));
2309
- s = `rgb(${a}, ${a}, ${a})`;
2310
- } else
2311
- s = e || "#EEEEEE";
2312
- return /* @__PURE__ */ o(
2313
- ie,
2314
- {
2315
- logo: /* @__PURE__ */ o(Tn, { logo: t }),
2316
- ...n,
2317
- className: k(i <= 0.7 && "reverse-color"),
2318
- style: {
2319
- backgroundColor: `rgba(255,255,255,${i})`,
2320
- // @ts-ignore
2321
- "--logo-invert": i <= 0.7 ? 1 - i / 6 : 1 - i
2322
- },
2323
- sx: {
2324
- backdropFilter: i >= 0.6 ? "blur(10px)" : "blur(0px)",
2325
- transition: "all 0.3s ease",
2326
- position: "fixed !important",
2327
- left: 0,
2328
- top: 0,
2329
- right: 0,
2330
- bgcolor: "transparent",
2331
- "&.reverse-color": {
2332
- ".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
2333
- color: `${s} !important`
2334
- }
2335
- },
2336
- ".header-logo > div": {
2337
- filter: "invert(var(--logo-invert))"
2338
- },
2339
- ".header-logo": {
2340
- color: s
2341
- }
2342
- }
2343
- }
2344
- );
2345
- }
2346
- const se = At(_e)``;
2347
- export {
2348
- Tr as H,
2349
- wn as L,
2350
- ot as P,
2351
- En as T,
2352
- Pn as a,
2353
- Er as b,
2354
- ct as c,
2355
- un as g,
2356
- Pr as p
2357
- };