@blocklet/pages-kit-inner-components 0.4.34 → 0.4.36

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.
@@ -0,0 +1,412 @@
1
+ import { jsx as P } from "react/jsx-runtime";
2
+ import { Box as x, Alert as B, Tooltip as G } from "@mui/material";
3
+ import q from "gradient-parser";
4
+ import K from "tinycolor2";
5
+ import { joinURL as I, withQuery as Q } from "ufo";
6
+ import { createAxios as X } from "@blocklet/js-sdk";
7
+ import * as Z from "yaml";
8
+ import Y, { getYjsDoc as H } from "@syncedstore/core";
9
+ import { useSyncedStore as tt } from "@syncedstore/react";
10
+ import { useLocalStorageState as et } from "ahooks";
11
+ import { produce as b } from "immer";
12
+ import nt from "js-cookie";
13
+ import W from "lodash/debounce";
14
+ import { customAlphabet as ot } from "nanoid";
15
+ import { createContext as rt, useState as E, useRef as st, useMemo as g, useCallback as U, useEffect as v, useContext as it } from "react";
16
+ import { useParams as ct, useNavigate as at } from "react-router-dom";
17
+ import { IndexeddbPersistence as ut } from "y-indexeddb";
18
+ import { WebsocketProvider as dt } from "y-websocket";
19
+ import { UndoManager as lt } from "yjs";
20
+ function ft() {
21
+ const { pathname: t } = window.location, n = t.match(/\/admin\/(maker|previewer)\/([^/]+)/), d = n == null ? void 0 : n[2], a = window.__PROJECT_ID__;
22
+ if (!d && !a)
23
+ throw new Error("Unable to get projectId from pathname");
24
+ return d || a;
25
+ }
26
+ function zt(t) {
27
+ return `${t}:pages:version`;
28
+ }
29
+ function Bt(t, n) {
30
+ return n === "yaml" ? Z.stringify(t, { indent: 2 }) : n === "json" ? JSON.parse(JSON.stringify(t || "{}")) : n === "array" ? JSON.parse(JSON.stringify(t || "[]")) : t;
31
+ }
32
+ function Gt({ error: t }) {
33
+ return /* @__PURE__ */ P(x, { children: /* @__PURE__ */ P(B, { severity: "error", children: t.message }) });
34
+ }
35
+ var R;
36
+ const O = ((R = window.blocklet) == null ? void 0 : R.prefix) || "/", F = X({
37
+ timeout: 200 * 1e3
38
+ }), mt = window.location.protocol === "https:" ? "wss" : "ws", qt = (t) => I(`${mt}://${window.location.hostname}`, O, `api/${t}/ws/pages`), pt = "z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";
39
+ var M;
40
+ (M = blocklet == null ? void 0 : blocklet.componentMountPoints.find((t) => t.did === pt)) != null && M.mountPoint || I(O, "/image-bin");
41
+ function Kt(t) {
42
+ return t && !/^(https?:\/\/|\/)/.test(t) ? window.location.origin + I(O, "uploads", t) : t;
43
+ }
44
+ const wt = window.innerWidth <= 750;
45
+ function Qt(t, n, d) {
46
+ if (!t || /\.gif/.test(t)) return t;
47
+ const a = (wt ? n / 1.5 : n) * (d === "quality" ? 1.5 : 1);
48
+ return St(t, { imageFilter: "resize", w: a, f: "webp" });
49
+ }
50
+ function St(t, n) {
51
+ return !t || !n ? t : Q(t, n);
52
+ }
53
+ function ht(t) {
54
+ if (t != null && t.trim())
55
+ try {
56
+ return q.parse(t), !0;
57
+ } catch {
58
+ return !1;
59
+ }
60
+ return !1;
61
+ }
62
+ function Xt(t) {
63
+ return typeof t != "string" ? !1 : !!(ht(t) || K(t).isValid());
64
+ }
65
+ async function gt(t) {
66
+ return F.get(`/api/projects/${t}`).then((n) => n.data);
67
+ }
68
+ async function Pt(t) {
69
+ return F.post(`/api/projects/${t.id}/update`, t).then((n) => n.data);
70
+ }
71
+ const jt = 500, N = ot("abcdefghijklmnopqrstuvwxyz0123456789", 16), J = rt(null);
72
+ function Zt({
73
+ url: t,
74
+ name: n,
75
+ children: d,
76
+ waitingSynced: a
77
+ }) {
78
+ const [l, u] = E(!1), w = V(), j = `${w}:MakerLocalState`, e = `${w}:${n}`, [r, o] = et(j, {
79
+ defaultValue: {},
80
+ listenStorageChange: !0
81
+ }), s = st(r);
82
+ s.current = r;
83
+ const c = g(
84
+ () => Y({
85
+ pages: {},
86
+ pageIds: [],
87
+ components: {},
88
+ supportedLocales: [],
89
+ config: {},
90
+ resources: {}
91
+ }),
92
+ []
93
+ ), i = g(() => H(c), [c]);
94
+ g(() => new ut(e, i), [e, i]);
95
+ const S = g(
96
+ () => new dt(t, e, i, { params: { token: nt.get("login_token") } }),
97
+ [t, e, i]
98
+ ), k = g(
99
+ () => new lt(
100
+ [i.getArray("pageIds"), i.getMap("pages"), i.getArray("supportedLocales"), i.getMap("config")],
101
+ { doc: i }
102
+ ),
103
+ [i]
104
+ ), [y, C] = E(null), [A, L] = E(!1), [_, $] = E(void 0), D = U(async () => {
105
+ if (w) {
106
+ L(!0);
107
+ try {
108
+ const f = await gt(w);
109
+ C(f);
110
+ } catch (f) {
111
+ console.error("Failed to fetch project:", f);
112
+ } finally {
113
+ L(!1);
114
+ }
115
+ }
116
+ }, [w]), T = U(
117
+ async (f, m) => {
118
+ var h;
119
+ if ($(void 0), !!w) {
120
+ m != null && m.optimisticUpdate && y && C((p) => ({
121
+ ...p,
122
+ ...f
123
+ }));
124
+ try {
125
+ const p = await Pt({
126
+ ...f
127
+ });
128
+ C(p);
129
+ } catch (p) {
130
+ console.error("Failed to update project:", p), m != null && m.optimisticUpdate && C(y), $((h = p == null ? void 0 : p.response) == null ? void 0 : h.data);
131
+ }
132
+ }
133
+ },
134
+ [w, y]
135
+ );
136
+ v(() => {
137
+ w && D();
138
+ }, [w, D]);
139
+ const z = g(
140
+ () => ({
141
+ doc: i,
142
+ state: c,
143
+ localState: r,
144
+ setLocalState: (f) => o(typeof f == "function" ? (m) => f(m ?? {}) : f),
145
+ undoManager: k,
146
+ projectState: {
147
+ project: y,
148
+ isLoadingProject: A,
149
+ error: _
150
+ },
151
+ updateProject: T
152
+ }),
153
+ // eslint-disable-next-line react-hooks/exhaustive-deps
154
+ [
155
+ i,
156
+ c,
157
+ JSON.stringify(r),
158
+ // resolve the problem of react warning
159
+ o,
160
+ k,
161
+ y,
162
+ A,
163
+ T,
164
+ _
165
+ ]
166
+ );
167
+ return v(() => {
168
+ k.on("stack-item-added", ({ stackItem: f }) => {
169
+ const { currentPageId: m, currentLocale: h, pages: p } = s.current;
170
+ f.meta.set("localState", { currentPageId: m, currentLocale: h, pages: p });
171
+ }), k.on("stack-item-popped", ({ stackItem: f }) => {
172
+ const m = f.meta.get("localState");
173
+ m && o((h) => ({ ...h, ...m }));
174
+ });
175
+ }, [k, o]), v(() => {
176
+ S.awareness.setLocalState(r);
177
+ }, [S, r]), v(() => {
178
+ S.once("synced", () => u(!0));
179
+ const f = () => {
180
+ o((p) => ({
181
+ ...p,
182
+ networkStatus: void 0
183
+ }));
184
+ }, m = () => {
185
+ o((p) => ({
186
+ ...p,
187
+ networkStatus: "offline"
188
+ }));
189
+ }, h = W(({ status: p }) => {
190
+ p === "connected" ? f() : p === "disconnected" && m();
191
+ }, jt);
192
+ return S.on("status", h), window.addEventListener("online", f), window.addEventListener("offline", m), () => {
193
+ S.off("status", h), window.removeEventListener("online", f), window.removeEventListener("offline", m);
194
+ };
195
+ }, [S, o]), a && !l ? null : /* @__PURE__ */ P(J.Provider, { value: z, children: d });
196
+ }
197
+ const kt = () => {
198
+ const t = it(J);
199
+ if (!t)
200
+ throw new Error("Context is null");
201
+ const n = tt(t.state), { setLocalState: d, localState: a } = t, l = at(), u = V(), w = g(
202
+ () => ({
203
+ setCurrentSectionId: (e, r) => {
204
+ var o, s;
205
+ e === a.currentPageId && r === ((s = (o = a.pages) == null ? void 0 : o[e]) == null ? void 0 : s.currentSectionId) || (l(I("/admin/maker", u ?? "", "pages", e)), d(
206
+ (c) => b(c, (i) => {
207
+ var S;
208
+ i.currentPageId = e, i.currentComponentId = void 0, i.componentDebugProps = {}, r !== void 0 && (i.pages ?? (i.pages = {}), (S = i.pages)[e] ?? (S[e] = {}), i.pages[e].currentSectionId = r ?? void 0), r ? window.sessionStorage.setItem("iframe_show_id", `"${r}"`) : window.sessionStorage.removeItem("iframe_show_id");
209
+ })
210
+ ));
211
+ },
212
+ setCurrentComponentId: (e) => {
213
+ e !== a.currentComponentId && (l(I("/admin/maker", u ?? "", "components", e)), d(
214
+ (r) => b(r, (o) => {
215
+ o.currentComponentId = e, o.componentDebugProps = {};
216
+ })
217
+ ));
218
+ },
219
+ setComponentDebugProps: (() => {
220
+ const e = {}, r = W(() => {
221
+ d(
222
+ (o) => b(o, (s) => {
223
+ s.componentDebugProps = {
224
+ ...s == null ? void 0 : s.componentDebugProps,
225
+ ...e
226
+ }, Object.keys(e).forEach((c) => delete e[c]);
227
+ })
228
+ );
229
+ }, 5);
230
+ return (o) => {
231
+ Object.assign(e, o), r();
232
+ };
233
+ })()
234
+ }),
235
+ [d, l, u]
236
+ ), j = g(
237
+ () => ({
238
+ addPage: (e, r) => {
239
+ const o = (e == null ? void 0 : e.id) ?? N(), s = {
240
+ ...e,
241
+ id: o,
242
+ createdAt: (e == null ? void 0 : e.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
243
+ updatedAt: (e == null ? void 0 : e.updatedAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
244
+ publishedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
245
+ slug: (e == null ? void 0 : e.slug) ?? `/${o}`,
246
+ sections: (e == null ? void 0 : e.sections) ?? {},
247
+ sectionIds: (e == null ? void 0 : e.sectionIds) ?? [],
248
+ isPublic: (e == null ? void 0 : e.isPublic) ?? !0,
249
+ isTemplate: (e == null ? void 0 : e.isTemplate) ?? !1
250
+ };
251
+ return t.doc.transact(() => {
252
+ n.pages[s.id] = s, n.pageIds.splice(r ?? n.pageIds.length, 0, s.id);
253
+ }), s;
254
+ },
255
+ deletePage: (e) => {
256
+ const r = n.pageIds.indexOf(e);
257
+ r !== -1 && t.doc.transact(() => {
258
+ n.pageIds.splice(r, 1), delete n.pages[e];
259
+ });
260
+ },
261
+ movePage: (e, r) => {
262
+ const { pageIds: o } = n, s = o.indexOf(e);
263
+ s >= 0 && o.splice(r, 0, ...o.splice(s, 1));
264
+ },
265
+ addSection: (e, r, o) => {
266
+ const s = n.pages[e];
267
+ if (!s)
268
+ throw new Error(`Page ${e} is not exists`);
269
+ const c = {
270
+ ...r,
271
+ id: r.id ?? N(),
272
+ isTemplateSection: r.isTemplateSection ?? !1
273
+ };
274
+ return t.doc.transact(() => {
275
+ s.sections[c.id] = c, s.sectionIds.splice(o ?? s.sectionIds.length, 0, c.id);
276
+ }), c;
277
+ },
278
+ deleteSection: (e, r) => {
279
+ const o = n.pages[e];
280
+ if (!o)
281
+ throw new Error(`Page ${e} is not exists`);
282
+ const s = o.sectionIds.indexOf(r);
283
+ s !== -1 && t.doc.transact(() => {
284
+ o.sectionIds.splice(s, 1), delete o.sections[r];
285
+ });
286
+ },
287
+ toggleSectionVisibility: (e, r, o) => {
288
+ const s = n.pages[e];
289
+ if (!s)
290
+ throw new Error(`Page ${e} is not exists`);
291
+ const c = s.sections[r];
292
+ c && (c.visibility = o);
293
+ },
294
+ moveSection: (e, r, o) => {
295
+ const s = n.pages[e];
296
+ if (!s)
297
+ throw new Error(`Page ${e} is not exists`);
298
+ const { sectionIds: c } = s, i = c.indexOf(r);
299
+ i >= 0 && c.splice(o, 0, ...c.splice(i, 1));
300
+ }
301
+ }),
302
+ [n, t.doc]
303
+ );
304
+ return {
305
+ ...t,
306
+ state: n,
307
+ actions: j,
308
+ localActions: w,
309
+ get currentPage() {
310
+ const {
311
+ localState: { currentPageId: e }
312
+ } = t;
313
+ return e ? n.pages[e] : void 0;
314
+ },
315
+ get currentSection() {
316
+ var s, c, i;
317
+ const {
318
+ localState: { currentPageId: e, ...r }
319
+ } = t;
320
+ if (!e)
321
+ return;
322
+ const o = (c = (s = r.pages) == null ? void 0 : s[e]) == null ? void 0 : c.currentSectionId;
323
+ if (o)
324
+ return (i = n.pages[e]) == null ? void 0 : i.sections[o];
325
+ }
326
+ };
327
+ }, V = () => {
328
+ const { projectId: t } = ct();
329
+ return t ?? ft();
330
+ };
331
+ function yt(t) {
332
+ var a, l;
333
+ const { resources: n } = t;
334
+ if (!n.components)
335
+ return {};
336
+ const d = {};
337
+ return (l = (a = window == null ? void 0 : window.blocklet) == null ? void 0 : a.componentMountPoints) == null || l.forEach((u) => {
338
+ d[u.did] = u;
339
+ }), Object.fromEntries(
340
+ Object.entries(n.components).map(([u, { blockletId: w, component: j }]) => {
341
+ var e;
342
+ return [
343
+ u,
344
+ { data: j, blockletId: w, blockletTitle: ((e = d[w]) == null ? void 0 : e.title) || w }
345
+ ];
346
+ })
347
+ );
348
+ }
349
+ function It(t) {
350
+ const { components: n } = t;
351
+ return n || {};
352
+ }
353
+ function Ct(t) {
354
+ return {
355
+ ...yt(t),
356
+ ...It(t)
357
+ };
358
+ }
359
+ const Yt = () => Ct(kt().state), Et = [
360
+ /\.\./,
361
+ // Directory traversal
362
+ /<[^>]*>/,
363
+ // HTML/XML tags
364
+ /%[0-9a-f]{2}/i,
365
+ // Percent encoding
366
+ /[<>'"%;{}()\\]/,
367
+ // Special characters
368
+ // eslint-disable-next-line no-control-regex
369
+ /\x00/,
370
+ // Null byte
371
+ /\n|\r|\t|\v|\f/,
372
+ // Control characters
373
+ /[^a-zA-Z0-9-_@/]/
374
+ // Disallow any characters except alphanumeric, dash, underscore and forward slash
375
+ ];
376
+ function Ht(t, n, d) {
377
+ const a = [];
378
+ {
379
+ let l;
380
+ n.slug ? n.slug.startsWith("/") ? n.slug !== "/" && n.slug.endsWith("/") ? l = t("maker.properties.pathCheckEndWithoutSlash") : /\/{2,}/.test(n.slug) ? l = t("maker.properties.pathCheckConsecutiveSlash") : /\s/.test(n.slug) ? l = t("maker.properties.pathCheckWhitespace") : Et.some((u) => u.test(n.slug)) ? l = t("maker.properties.pathCheckInvalid") : Object.values(d.pages).some((u) => (u == null ? void 0 : u.id) !== n.id && (u == null ? void 0 : u.slug) === n.slug) && (l = t("maker.properties.pathCheckAlreadyExist")) : l = t("maker.properties.pathCheckStartWithSlash") : l = t("maker.properties.pathCheckRequired"), l && a.push({ path: ["path"], message: l });
381
+ }
382
+ return a.length > 0 ? a : null;
383
+ }
384
+ function te({ errors: t, ...n }) {
385
+ return t != null && t.length ? /* @__PURE__ */ P(
386
+ G,
387
+ {
388
+ ...n,
389
+ title: /* @__PURE__ */ P(x, { children: t.map((d, a) => /* @__PURE__ */ P(x, { children: d.message }, a)) })
390
+ }
391
+ ) : null;
392
+ }
393
+ export {
394
+ Gt as E,
395
+ te as P,
396
+ Zt as S,
397
+ Qt as a,
398
+ Xt as b,
399
+ F as c,
400
+ ft as d,
401
+ Ct as e,
402
+ zt as f,
403
+ Kt as g,
404
+ kt as h,
405
+ ht as i,
406
+ Yt as j,
407
+ qt as k,
408
+ Ht as l,
409
+ N as n,
410
+ Bt as t,
411
+ V as u
412
+ };
@@ -7,7 +7,7 @@ import "lru-cache";
7
7
  import "node-fetch";
8
8
  import "ufo";
9
9
  import "crypto";
10
- import { c as _, G as E, d as i, e as d, j as l, k as N, m as O, h as P, b as c, f as g } from "./_chunks/site-state-BF64quiV.js";
10
+ import { c as _, G as E, d as i, e as d, j as l, k as N, m as O, h as P, b as c, f as g } from "./_chunks/site-state-F2Hmj9eb.js";
11
11
  export {
12
12
  _ as CUSTOM_COMPONENT_CACHE_DURATION_IN_SECONDS,
13
13
  E as GET_SERVER_SIDE_PROPS_TIMEOUT_IN_SECONDS,
package/lib/es/home.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import "react/jsx-runtime";
2
- import "./_chunks/state-CVCmClC_.js";
3
- import { a as b, P as h, c as x, b as y, T as B, H as R } from "./_chunks/home-C7rHVbsK.js";
4
- import "@blocklet/pages-kit/builtin/locale";
2
+ import "./_chunks/state-kKXkQecK.js";
3
+ import { a as b, P as h, c as x, b as y, T as B, H as R } from "./_chunks/home-DDJ3wLld.js";
4
+ import "@arcblock/ux/lib/Locale/context";
5
5
  import "@arcblock/ux/lib/Result";
6
6
  import "@blocklet/pages-kit/builtin/page/header";
7
7
  import "@blocklet/ui-react/lib/Header";
8
8
  import "@emotion/css";
9
9
  import "@emotion/react";
10
10
  import "@emotion/styled";
11
- import "@blocklet/pages-kit/builtin/mui/material";
11
+ import "@mui/material";
12
12
  import "ahooks";
13
13
  import "isomorphic-dompurify";
14
14
  import "lodash";
15
15
  import "lodash/isEmpty";
16
- import "@blocklet/pages-kit/builtin/react";
16
+ import "react";
17
17
  import "react-helmet";
18
- import "@blocklet/pages-kit/builtin/react-router-dom";
18
+ import "react-router-dom";
19
19
  import "react-use";
20
20
  import "ufo";
21
21
  export {
@@ -1,26 +1,25 @@
1
- import I from "vite-plugin-node-polyfills/shims/process";
2
- import { b as W, l as P } from "./_chunks/site-state-BF64quiV.js";
3
- import { initCronCrawlBlocklet as N, cancelCronCrawlBlocklet as J, initSEOMiddleware as G } from "@blocklet/crawler/middlewares";
4
- import { PreloadComponentScriptModule as K } from "@blocklet/pages-kit/types";
5
- import { injectPreloadComponents as Q } from "@blocklet/pages-kit/utils/preload";
6
- import { getComponentMountPoint as z } from "@blocklet/sdk/lib/component";
7
- import s, { getBlockletJs as V } from "@blocklet/sdk/lib/config";
8
- import * as j from "cheerio";
9
- import { Router as X } from "express";
10
- import { readFileSync as U } from "fs";
11
- import Y from "mustache";
12
- import { resolve as M } from "path";
13
- import { withQuery as Z, joinURL as D } from "ufo";
14
- const F = ["/assets/"], O = () => [!0, "true"].includes(s.env.preferences.allowCrawler);
15
- function R() {
16
- O() ? N({
1
+ import { b as H, l as P } from "./_chunks/site-state-F2Hmj9eb.js";
2
+ import { initCronCrawlBlocklet as W, cancelCronCrawlBlocklet as N, initSEOMiddleware as J } from "@blocklet/crawler/middlewares";
3
+ import { PreloadComponentScriptModule as G } from "@blocklet/pages-kit/types";
4
+ import { injectPreloadComponents as K } from "@blocklet/pages-kit/utils/preload";
5
+ import { getComponentMountPoint as Q } from "@blocklet/sdk/lib/component";
6
+ import s, { getBlockletJs as z } from "@blocklet/sdk/lib/config";
7
+ import * as I from "cheerio";
8
+ import { Router as V } from "express";
9
+ import { readFileSync as j } from "fs";
10
+ import X from "mustache";
11
+ import { resolve as U } from "path";
12
+ import { withQuery as Y, joinURL as M } from "ufo";
13
+ const Z = ["/assets/"], D = () => [!0, "true"].includes(s.env.preferences.allowCrawler);
14
+ function O() {
15
+ D() ? W({
17
16
  time: "30 30 */12 * * *",
18
17
  options: {}
19
- }) : J();
18
+ }) : N();
20
19
  }
21
- R();
22
- s.events.on(s.Events.envUpdate, R);
23
- function ue({
20
+ O();
21
+ s.events.on(s.Events.envUpdate, O);
22
+ function me({
24
23
  app: c,
25
24
  viteDevServer: u,
26
25
  // projectId,
@@ -28,26 +27,26 @@ function ue({
28
27
  }) {
29
28
  let C;
30
29
  if (u) {
31
- const t = U(M(I.cwd(), "./index.html"), "utf-8");
30
+ const t = j(U(process.cwd(), "./index.html"), "utf-8");
32
31
  c.use(async (b, $, y) => {
33
32
  const _ = b.originalUrl;
34
33
  C = await u.transformIndexHtml(_, t), y();
35
34
  });
36
35
  } else
37
- C = U(M(I.env.BLOCKLET_APP_DIR, "dist/index.html"), "utf-8");
38
- const k = X();
36
+ C = j(U(process.env.BLOCKLET_APP_DIR, "dist/index.html"), "utf-8");
37
+ const k = V();
39
38
  k.use(
40
- G({
39
+ J({
41
40
  autoReturnHtml: !1,
42
- allowCrawler: O
41
+ allowCrawler: D
43
42
  })
44
43
  ), k.get("/:path(*)?", async (t, b, $) => {
45
44
  var T, S, L;
46
- if (F.some((r) => t.path.startsWith(r))) {
45
+ if (Z.some((r) => t.path.startsWith(r))) {
47
46
  $();
48
47
  return;
49
48
  }
50
- const y = performance.now(), _ = () => Math.round(performance.now() - y), x = "production";
49
+ const y = performance.now(), _ = () => Math.round(performance.now() - y), R = "production";
51
50
  let e, a, h = C;
52
51
  if (t.path.startsWith("/pages")) {
53
52
  const r = t.params.lang, f = t.cookies.nf_lang, g = /* @__PURE__ */ new Set([...s.env.languages.map((d) => d.code)]);
@@ -72,23 +71,23 @@ function ue({
72
71
  });
73
72
  d.push(...v);
74
73
  });
75
- const H = new Promise((l, v) => {
74
+ const B = new Promise((l, v) => {
76
75
  setTimeout(() => {
77
76
  v(new Error("getPreloadComponents timeout in promise race, skip it"));
78
77
  }, 90 * 1e3);
79
78
  });
80
79
  try {
81
80
  await Promise.race([
82
- H,
83
- W({
84
- mode: x,
81
+ B,
82
+ H({
83
+ mode: R,
85
84
  req: t,
86
85
  state: n,
87
86
  locale: m,
88
87
  instances: d,
89
- module: K.UMD_FN
88
+ module: G.UMD_FN
90
89
  }).then((l) => {
91
- l && (a = Q(l));
90
+ l && (a = K(l));
92
91
  })
93
92
  ]);
94
93
  } catch (l) {
@@ -97,19 +96,19 @@ function ue({
97
96
  }
98
97
  }
99
98
  try {
100
- const r = (e == null ? void 0 : e.title) || s.env.appName, f = (e == null ? void 0 : e.description) || s.env.appDescription, g = Z(D(s.env.appUrl, "/.well-known/service/blocklet/og.png"), {
99
+ const r = (e == null ? void 0 : e.title) || s.env.appName, f = (e == null ? void 0 : e.description) || s.env.appDescription, g = Y(M(s.env.appUrl, "/.well-known/service/blocklet/og.png"), {
101
100
  title: r,
102
101
  description: f
103
102
  });
104
- h = Y.render(C, {
103
+ h = X.render(C, {
105
104
  ogTitle: r,
106
105
  ogDescription: f,
107
- ogImage: q(e == null ? void 0 : e.image) || g,
106
+ ogImage: F(e == null ? void 0 : e.image) || g,
108
107
  pagesPublishedAt: (n == null ? void 0 : n.config.publishedAt) || (/* @__PURE__ */ new Date()).getTime()
109
108
  });
110
109
  } catch {
111
110
  }
112
- const o = n == null ? void 0 : n.config.fontFamily, B = t.query.mode === "draft" || t.url.includes("preview"), p = j.load(h);
111
+ const o = n == null ? void 0 : n.config.fontFamily, x = t.query.mode === "draft" || t.url.includes("preview"), p = I.load(h);
113
112
  p("head").find("#injected-head-elements").replaceWith(`
114
113
  ${e != null && e.backgroundColor ? `<meta name="theme-color" content="${e.backgroundColor}" /><style>html,body,#app {background-color: ${e.backgroundColor} !important;}</style>` : ""}
115
114
  ${o != null && o.title ? `<link rel="preload" as="style" href="https://fonts.googleapis.com/css?family=${o.title}&display=swap">` : ""}
@@ -126,25 +125,25 @@ function ue({
126
125
  });
127
126
  <\/script>
128
127
 
129
- ${B ? `<script src="https://cdn.tailwindcss.com"><\/script>
128
+ ${x ? `<script src="https://cdn.tailwindcss.com"><\/script>
130
129
  <script>
131
130
  window.tailwind.config = {
132
131
  darkMode: "class",
133
132
  };
134
133
  <\/script>` : ""}
135
134
  `);
136
- const E = V();
135
+ const E = z();
137
136
  if (E && p('script[src="__blocklet__.js"]').replaceWith(`<script>${E}<\/script>`), a != null && a.html && p("head").find("#injected-html-elements").replaceWith(a.html), t.cachedHtml) {
138
- const r = j.load(t.cachedHtml);
137
+ const r = I.load(t.cachedHtml);
139
138
  p("body").html(r("body").html() || "");
140
139
  }
141
140
  h = p.html(), b.send(h), P.info(`[html] render: ${t.path}, ${_()}ms`), p.root().children().remove(), h = null, e = null, a = null;
142
141
  }), c.use(k);
143
142
  }
144
- function q(c) {
145
- const u = z("image-bin");
146
- return u && c && !/^(https?:\/\/|\/)/.test(c) ? s.env.appUrl + D(u, "uploads", c) : c;
143
+ function F(c) {
144
+ const u = Q("image-bin");
145
+ return u && c && !/^(https?:\/\/|\/)/.test(c) ? s.env.appUrl + M(u, "uploads", c) : c;
147
146
  }
148
147
  export {
149
- ue as default
148
+ me as default
150
149
  };
@@ -1,4 +1,4 @@
1
- import { P as S, i as b, g as M, l as x, C as J, R as X, S as N, t as W, a as G } from "./_chunks/site-state-BF64quiV.js";
1
+ import { P as S, i as b, g as M, l as x, C as J, R as X, S as N, t as W, a as G } from "./_chunks/site-state-F2Hmj9eb.js";
2
2
  import { AsyncLocalStorage as K } from "async_hooks";
3
3
  import { Router as Y } from "express";
4
4
  import d from "fs";