@webx-ui/module-blocks 0.7.1 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,29 +1,31 @@
1
- import { defineComponent as ae, computed as T, openBlock as i, createElementBlock as S, createVNode as u, unref as e, createElementVNode as E, createTextVNode as W, toDisplayString as _, Fragment as j, createCommentVNode as N, renderList as ee, ref as U, onMounted as Ue, watch as X, createBlock as I, withCtx as d, onBeforeUnmount as Ge, normalizeStyle as xe, reactive as Qe, normalizeClass as $e, withDirectives as Jt, vShow as Kt, resolveComponent as xt, isRef as $t, nextTick as Gt, withKeys as ut, withModifiers as ct, provide as St, inject as qe, useModel as Yt, getCurrentInstance as Zt, resolveDynamicComponent as Qt, mergeProps as Xt, mergeModels as el } from "vue";
2
- import { useRoute as tl, useRouter as Tt } from "vue-router";
3
- import { useTranslate as de, useAdmin as Me, useErrorText as De, WxDate as ll, WxScreenHead as nl, WxRenameButton as al, WxHelpButton as ol, WxRowMenu as sl, adminKey as il, WxListScreen as rl } from "@webx-ui/module-admin";
4
- import { WxIcon as be, WxSkeleton as We, WxText as F, WxBadge as ue, WxButton as ce, confirm as Ke, toast as G, useElementWidth as Ye, WxSegmented as Ct, WxCard as Be, WxPopover as ul, WxAlert as Vt, WxTabs as cl, WxTab as Le, WxCodeEditor as je, WxFormItem as ne, WxInput as Pe, WxSelect as Et, WxTextarea as dl, WxIconPicker as pl, WxInputNumber as dt, WxTagsInput as pt, WxSwitch as vl, WxActionBar as fl, useModal as Bt, WxDialog as Lt, WxEmpty as Wt, WxAction as Ie, WxSortableList as ml, createModal as At, WxDrawer as hl, WxSpace as bl, WxSkeletonItem as Fe } from "@webx-ui/core";
5
- import { WxScreenRenderer as zt, coreTypes as Xe } from "@webx-ui/schema";
6
- function Ae(t) {
7
- const l = `${t.apiPath}/blocks`, o = (a) => a.data;
1
+ import { defineComponent as ae, computed as V, openBlock as u, createElementBlock as C, createVNode as f, unref as l, createElementVNode as B, createTextVNode as z, toDisplayString as S, Fragment as F, createCommentVNode as N, renderList as le, ref as I, onMounted as Ue, watch as te, createBlock as M, withCtx as b, onBeforeUnmount as Qe, normalizeStyle as xe, reactive as nt, normalizeClass as $e, withDirectives as nl, vShow as sl, resolveComponent as Vt, isRef as Bt, nextTick as ol, withKeys as vt, withModifiers as mt, provide as At, inject as Ye, useModel as al, getCurrentInstance as il, resolveDynamicComponent as rl, mergeProps as ul, mergeModels as cl } from "vue";
2
+ import { useRoute as dl, useRouter as Lt } from "vue-router";
3
+ import { useTranslate as de, useAdmin as Re, useErrorText as je, WxDate as pl, WxScreenHead as fl, WxRenameButton as vl, WxHelpButton as ml, WxRowMenu as hl, adminKey as bl, WxListScreen as gl } from "@webx-ui/module-admin";
4
+ import { WxIcon as he, WxSkeleton as Le, WxText as q, WxBadge as ue, WxButton as ce, confirm as Ze, toast as Z, useElementWidth as Xe, WxSegmented as Wt, WxCard as Be, WxPopover as yl, WxAlert as zt, WxTabs as kl, WxTab as Ae, WxCodeEditor as qe, WxFormItem as oe, WxInput as Oe, WxSelect as Dt, WxTextarea as wl, WxIconPicker as _l, WxInputNumber as ht, WxTagsInput as bt, WxSwitch as xl, WxActionBar as $l, useModal as Mt, WxDialog as Nt, WxEmpty as It, WxAction as Ne, WxSortableList as Sl, createModal as Pt, WxDrawer as El, WxSpace as Tl, WxSkeletonItem as Ke } from "@webx-ui/core";
5
+ import { WxScreenRenderer as Ot, coreTypes as Je } from "@webx-ui/schema";
6
+ import { autocompletion as Cl, snippetCompletion as me, pickedCompletion as ut, startCompletion as Vl } from "@codemirror/autocomplete";
7
+ import { EditorState as Bl } from "@codemirror/state";
8
+ function ze(e) {
9
+ const n = `${e.apiPath}/blocks`, t = (s) => s.data;
8
10
  return {
9
- list: () => t.http.get(l).then(o),
10
- catalog: () => t.http.get(`${l}/catalog`).then(o),
11
- get: (a) => t.http.get(`${l}/${a}`).then(o),
12
- create: (a) => t.http.post(l, a).then(o),
13
- update: (a, s) => t.http.put(`${l}/${a}`, s).then(o),
14
- remove: (a) => t.http.delete(`${l}/${a}`),
15
- publish: (a) => t.http.post(`${l}/${a}/publish`, {}).then(o),
16
- render: (a, s = {}) => t.http.post(`${l}/${a}/render`, s).then(o),
17
- usage: (a) => t.http.get(`${l}/${a}/usage`).then(o),
18
- versions: (a) => t.http.get(`${l}/${a}/versions`).then(o),
19
- version: (a, s) => t.http.get(`${l}/${a}/versions/${s}`).then(o),
20
- restore: (a, s) => t.http.post(`${l}/${a}/versions/${s}/restore`, {}).then(o)
11
+ list: () => e.http.get(n).then(t),
12
+ catalog: () => e.http.get(`${n}/catalog`).then(t),
13
+ get: (s) => e.http.get(`${n}/${s}`).then(t),
14
+ create: (s) => e.http.post(n, s).then(t),
15
+ update: (s, a) => e.http.put(`${n}/${s}`, a).then(t),
16
+ remove: (s) => e.http.delete(`${n}/${s}`),
17
+ publish: (s) => e.http.post(`${n}/${s}/publish`, {}).then(t),
18
+ render: (s, a = {}) => e.http.post(`${n}/${s}/render`, a).then(t),
19
+ usage: (s) => e.http.get(`${n}/${s}/usage`).then(t),
20
+ versions: (s) => e.http.get(`${n}/${s}/versions`).then(t),
21
+ version: (s, a) => e.http.get(`${n}/${s}/versions/${a}`).then(t),
22
+ restore: (s, a) => e.http.post(`${n}/${s}/versions/${a}/restore`, {}).then(t)
21
23
  };
22
24
  }
23
- const gl = { class: "wx-block-checks" }, kl = {
25
+ const Al = { class: "wx-block-checks" }, Ll = {
24
26
  key: 0,
25
27
  class: "wx-block-checks__line is-error"
26
- }, yl = /* @__PURE__ */ ae({
28
+ }, Wl = /* @__PURE__ */ ae({
27
29
  __name: "BlockChecks",
28
30
  props: {
29
31
  file: {},
@@ -31,284 +33,294 @@ const gl = { class: "wx-block-checks" }, kl = {
31
33
  slug: {},
32
34
  error: {}
33
35
  },
34
- setup(t) {
35
- const l = t, o = de("webx-blocks"), a = T(() => l.lints.filter((r) => r.file === l.file)), s = T(() => {
36
- const r = new Set(a.value.map((b) => b.code)), n = [];
37
- return l.file === "template" && (r.has("no-marker") || n.push(o("checks.ok-marker")), r.has("variables-missing") || n.push(o("checks.ok-variables"))), l.file === "styles" && (r.has("stray-selectors") || n.push(o("checks.ok-prefix", { slug: l.slug })), r.has("bare-selectors") || n.push(o("checks.ok-bare")), r.has("media-query") || n.push(o("checks.ok-container"))), n;
36
+ setup(e) {
37
+ const n = e, t = de("webx-blocks"), s = V(() => n.lints.filter((i) => i.file === n.file)), a = V(() => {
38
+ const i = new Set(s.value.map((r) => r.code)), o = [];
39
+ return n.file === "template" && (i.has("no-marker") || o.push(t("checks.ok-marker")), i.has("variables-missing") || o.push(t("checks.ok-variables"))), n.file === "styles" && (i.has("stray-selectors") || o.push(t("checks.ok-prefix", { slug: n.slug })), i.has("bare-selectors") || o.push(t("checks.ok-bare")), i.has("media-query") || o.push(t("checks.ok-container"))), o;
38
40
  });
39
- return (r, n) => (i(), S("div", gl, [
40
- t.error ? (i(), S("div", kl, [
41
- u(e(be), { name: "close-circle" }),
42
- E("span", null, [
43
- W(_(t.error.message) + " ", 1),
44
- t.error.line !== null ? (i(), S(j, { key: 0 }, [
45
- W(" · " + _(e(o)("page.line", { line: t.error.line })), 1)
41
+ return (i, o) => (u(), C("div", Al, [
42
+ e.error ? (u(), C("div", Ll, [
43
+ f(l(he), { name: "close-circle" }),
44
+ B("span", null, [
45
+ z(S(e.error.message) + " ", 1),
46
+ e.error.line !== null ? (u(), C(F, { key: 0 }, [
47
+ z(" · " + S(l(t)("page.line", { line: e.error.line })), 1)
46
48
  ], 64)) : N("", !0),
47
- t.error.where ? (i(), S(j, { key: 1 }, [
48
- W(" · " + _(t.error.where), 1)
49
+ e.error.where ? (u(), C(F, { key: 1 }, [
50
+ z(" · " + S(e.error.where), 1)
49
51
  ], 64)) : N("", !0)
50
52
  ])
51
53
  ])) : N("", !0),
52
- (i(!0), S(j, null, ee(a.value, (b) => (i(), S("div", {
53
- key: b.code,
54
+ (u(!0), C(F, null, le(s.value, (r) => (u(), C("div", {
55
+ key: r.code,
54
56
  class: "wx-block-checks__line is-warning"
55
57
  }, [
56
- u(e(be), { name: "warning" }),
57
- E("span", null, [
58
- W(_(b.message) + " ", 1),
59
- b.line !== null ? (i(), S(j, { key: 0 }, [
60
- W(" · " + _(e(o)("page.line", { line: b.line })), 1)
58
+ f(l(he), { name: "warning" }),
59
+ B("span", null, [
60
+ z(S(r.message) + " ", 1),
61
+ r.line !== null ? (u(), C(F, { key: 0 }, [
62
+ z(" · " + S(l(t)("page.line", { line: r.line })), 1)
61
63
  ], 64)) : N("", !0)
62
64
  ])
63
65
  ]))), 128)),
64
- (i(!0), S(j, null, ee(s.value, (b) => (i(), S("div", {
65
- key: b,
66
+ (u(!0), C(F, null, le(a.value, (r) => (u(), C("div", {
67
+ key: r,
66
68
  class: "wx-block-checks__line is-ok"
67
69
  }, [
68
- u(e(be), { name: "check" }),
69
- E("span", null, _(b), 1)
70
+ f(l(he), { name: "check" }),
71
+ B("span", null, S(r), 1)
70
72
  ]))), 128))
71
73
  ]));
72
74
  }
73
- }), oe = (t, l) => {
74
- const o = t.__vccOpts || t;
75
- for (const [a, s] of l)
76
- o[a] = s;
77
- return o;
78
- }, vt = /* @__PURE__ */ oe(yl, [["__scopeId", "data-v-e56947a8"]]), wl = { class: "wx-block-history" }, _l = { class: "wx-block-history__number" }, xl = { class: "wx-block-history__who" }, $l = /* @__PURE__ */ ae({
75
+ }), ie = (e, n) => {
76
+ const t = e.__vccOpts || e;
77
+ for (const [s, a] of n)
78
+ t[s] = a;
79
+ return t;
80
+ }, gt = /* @__PURE__ */ ie(Wl, [["__scopeId", "data-v-e56947a8"]]), zl = { class: "wx-block-history" }, Dl = { class: "wx-block-history__number" }, Ml = { class: "wx-block-history__who" }, Nl = /* @__PURE__ */ ae({
79
81
  __name: "BlockHistory",
80
82
  props: {
81
83
  block: {},
82
84
  canManage: { type: Boolean }
83
85
  },
84
86
  emits: ["restored"],
85
- setup(t, { emit: l }) {
86
- const o = t, a = l, s = Me(), r = Ae(s), n = de("webx-blocks"), b = De(), P = U(null);
87
- async function v() {
88
- P.value = await r.versions(o.block.id);
89
- }
90
- function p(f) {
91
- return o.block.draft?.number === f.number ? "draft" : o.block.published?.number === f.number ? "live" : "replaced";
92
- }
93
- async function g(f) {
94
- if (await Ke({
95
- title: n("page.restore-title", { number: f.number }),
96
- message: n("page.restore-text"),
97
- confirmText: n("page.restore"),
98
- cancelText: n("page.cancel")
87
+ setup(e, { emit: n }) {
88
+ const t = e, s = n, a = Re(), i = ze(a), o = de("webx-blocks"), r = je(), m = I(null);
89
+ async function c() {
90
+ m.value = await i.versions(t.block.id);
91
+ }
92
+ function d(v) {
93
+ return t.block.draft?.number === v.number ? "draft" : t.block.published?.number === v.number ? "live" : "replaced";
94
+ }
95
+ async function p(v) {
96
+ if (await Ze({
97
+ title: o("page.restore-title", { number: v.number }),
98
+ message: o("page.restore-text"),
99
+ confirmText: o("page.restore"),
100
+ cancelText: o("page.cancel")
99
101
  }))
100
102
  try {
101
- const C = await r.restore(o.block.id, f.number);
102
- G.success(n("page.restored", { number: C.draft?.number ?? f.number })), a("restored", C), await v();
103
- } catch (C) {
104
- G.danger(b(C));
103
+ const x = await i.restore(t.block.id, v.number);
104
+ Z.success(o("page.restored", { number: x.draft?.number ?? v.number })), s("restored", x), await c();
105
+ } catch (x) {
106
+ Z.danger(r(x));
105
107
  }
106
108
  }
107
- return Ue(v), X(
108
- () => [o.block.draft?.number, o.block.published?.number],
109
+ return Ue(c), te(
110
+ () => [t.block.draft?.number, t.block.published?.number],
109
111
  () => {
110
- v();
112
+ c();
111
113
  }
112
- ), (f, k) => (i(), S("div", wl, [
113
- P.value === null ? (i(), I(e(We), {
114
+ ), (v, g) => (u(), C("div", zl, [
115
+ m.value === null ? (u(), M(l(Le), {
114
116
  key: 0,
115
117
  class: "wx-block-history__ghost",
116
118
  rows: 3
117
- })) : (i(!0), S(j, { key: 1 }, ee(P.value, (C) => (i(), S("div", {
118
- key: C.number,
119
+ })) : (u(!0), C(F, { key: 1 }, le(m.value, (x) => (u(), C("div", {
120
+ key: x.number,
119
121
  class: "wx-block-history__row"
120
122
  }, [
121
- E("code", _l, _(e(n)("page.version", { number: C.number })), 1),
122
- E("div", xl, [
123
- u(e(F), null, {
124
- default: d(() => [
125
- W(_(e(n)(`page.version-${p(C)}`)), 1)
123
+ B("code", Dl, S(l(o)("page.version", { number: x.number })), 1),
124
+ B("div", Ml, [
125
+ f(l(q), null, {
126
+ default: b(() => [
127
+ z(S(l(o)(`page.version-${d(x)}`)), 1)
126
128
  ]),
127
129
  _: 2
128
130
  }, 1024),
129
- u(e(F), {
131
+ f(l(q), {
130
132
  size: "sm",
131
133
  tone: "muted"
132
134
  }, {
133
- default: d(() => [
134
- C.created_at ? (i(), I(e(ll), {
135
+ default: b(() => [
136
+ x.created_at ? (u(), M(l(pl), {
135
137
  key: 0,
136
- value: C.created_at
138
+ value: x.created_at
137
139
  }, null, 8, ["value"])) : N("", !0),
138
- W(" · " + _(C.author ?? e(n)(`page.source-${C.source}`)) + " ", 1),
139
- C.comment ? (i(), S(j, { key: 1 }, [
140
- W(" · " + _(C.comment), 1)
140
+ z(" · " + S(x.author ?? l(o)(`page.source-${x.source}`)) + " ", 1),
141
+ x.comment ? (u(), C(F, { key: 1 }, [
142
+ z(" · " + S(x.comment), 1)
141
143
  ], 64)) : N("", !0)
142
144
  ]),
143
145
  _: 2
144
146
  }, 1024)
145
147
  ]),
146
- p(C) === "draft" ? (i(), I(e(ue), {
148
+ d(x) === "draft" ? (u(), M(l(ue), {
147
149
  key: 0,
148
150
  type: "warning",
149
151
  dot: ""
150
152
  }, {
151
- default: d(() => [
152
- W(_(e(n)("page.version-draft")), 1)
153
+ default: b(() => [
154
+ z(S(l(o)("page.version-draft")), 1)
153
155
  ]),
154
156
  _: 1
155
- })) : p(C) === "live" ? (i(), I(e(ue), {
157
+ })) : d(x) === "live" ? (u(), M(l(ue), {
156
158
  key: 1,
157
159
  type: "success",
158
160
  dot: ""
159
161
  }, {
160
- default: d(() => [
161
- W(_(e(n)("page.version-live")), 1)
162
+ default: b(() => [
163
+ z(S(l(o)("page.version-live")), 1)
162
164
  ]),
163
165
  _: 1
164
166
  })) : N("", !0),
165
- t.canManage && p(C) === "replaced" ? (i(), I(e(ce), {
167
+ e.canManage && d(x) === "replaced" ? (u(), M(l(ce), {
166
168
  key: 2,
167
169
  size: "sm",
168
170
  variant: "outline",
169
- onClick: (V) => g(C)
171
+ onClick: (T) => p(x)
170
172
  }, {
171
- default: d(() => [
172
- W(_(e(n)("page.restore")), 1)
173
+ default: b(() => [
174
+ z(S(l(o)("page.restore")), 1)
173
175
  ]),
174
176
  _: 1
175
177
  }, 8, ["onClick"])) : N("", !0)
176
178
  ]))), 128))
177
179
  ]));
178
180
  }
179
- }), Sl = /* @__PURE__ */ oe($l, [["__scopeId", "data-v-42c6b7ad"]]), Ne = "wx-preview-selected", Je = "wx-preview-hover", ft = "wx-preview-style";
180
- function It(t, l) {
181
- const a = (t.ownerDocument ?? t).createTreeWalker(
182
- t,
181
+ }), Il = /* @__PURE__ */ ie(Nl, [["__scopeId", "data-v-42c6b7ad"]]), Ie = "wx-preview-selected", Ge = "wx-preview-hover", yt = "wx-preview-style";
182
+ function Ut(e, n) {
183
+ const s = (e.ownerDocument ?? e).createTreeWalker(
184
+ e,
183
185
  128
184
186
  /* NodeFilter.SHOW_COMMENT */
185
187
  );
186
- let s = null;
187
- for (let r = a.nextNode(); r; r = a.nextNode()) {
188
- const n = r.data.trim();
189
- if (s === null && n === `wx:${l}`)
190
- s = r;
191
- else if (s !== null && n === `/wx:${l}`)
192
- return { start: s, end: r };
188
+ let a = null;
189
+ for (let i = s.nextNode(); i; i = s.nextNode()) {
190
+ const o = i.data.trim();
191
+ if (a === null && o === `wx:${n}`)
192
+ a = i;
193
+ else if (a !== null && o === `/wx:${n}`)
194
+ return { start: a, end: i };
193
195
  }
194
196
  return null;
195
197
  }
196
- function Nt(t, l, o) {
197
- const a = It(t, l);
198
- if (!a) return !1;
199
- const s = a.start.parentNode;
198
+ function Rt(e, n, t) {
199
+ const s = Ut(e, n);
200
200
  if (!s) return !1;
201
- const r = t.createElement("template");
202
- r.innerHTML = o;
203
- const n = a.end.nextSibling;
204
- let b = a.start;
205
- for (; b; ) {
206
- const g = b.nextSibling, f = b === a.end;
207
- if (s.removeChild(b), f) break;
208
- b = g;
201
+ const a = s.start.parentNode;
202
+ if (!a) return !1;
203
+ const i = e.createElement("template");
204
+ i.innerHTML = t;
205
+ const o = s.end.nextSibling;
206
+ let r = s.start;
207
+ for (; r; ) {
208
+ const p = r.nextSibling, v = r === s.end;
209
+ if (a.removeChild(r), v) break;
210
+ r = p;
209
211
  }
210
- const P = r.content, v = Array.from(P.childNodes);
211
- s.insertBefore(P, n);
212
- const p = t.defaultView?.webx;
213
- if (p?.mount)
214
- for (const g of v)
215
- g.nodeType === 1 && p.mount(g);
212
+ const m = i.content, c = Array.from(m.childNodes);
213
+ a.insertBefore(m, o);
214
+ const d = e.defaultView?.webx;
215
+ if (d?.mount)
216
+ for (const p of c)
217
+ p.nodeType === 1 && d.mount(p);
216
218
  return !0;
217
219
  }
218
- function at(t, l) {
219
- const o = It(t, l);
220
- if (!o) return null;
221
- for (let a = o.start.nextSibling; a && a !== o.end; a = a.nextSibling)
222
- if (a.nodeType === 1) return a;
220
+ function ct(e, n) {
221
+ const t = Ut(e, n);
222
+ if (!t) return null;
223
+ for (let s = t.start.nextSibling; s && s !== t.end; s = s.nextSibling)
224
+ if (s.nodeType === 1) return s;
223
225
  return null;
224
226
  }
225
- function et(t, l) {
226
- ot(t);
227
- for (const a of Array.from(t.querySelectorAll(`.${Ne}`)))
228
- a.classList.remove(Ne);
229
- if (l === null) return null;
230
- const o = at(t, l);
231
- return o?.classList.add(Ne), o;
232
- }
233
- function mt(t, l) {
234
- ot(t);
235
- for (const o of Array.from(t.querySelectorAll(`.${Je}`)))
236
- o.classList.remove(Je);
237
- l !== null && at(t, l)?.classList.add(Je);
238
- }
239
- function ht(t) {
240
- let l = t?.nodeType === 1 ? t : t?.parentElement ?? null;
241
- for (; l; ) {
242
- let o = 0;
243
- for (let a = l.previousSibling; a; a = a.previousSibling) {
244
- if (a.nodeType !== 8) continue;
245
- const s = a.data.trim();
246
- if (s.startsWith("/wx:"))
247
- o += 1;
248
- else if (s.startsWith("wx:")) {
249
- if (o === 0) return s.slice(3);
250
- o -= 1;
227
+ function st(e, n) {
228
+ dt(e);
229
+ for (const s of Array.from(e.querySelectorAll(`.${Ie}`)))
230
+ s.classList.remove(Ie);
231
+ if (n === null) return null;
232
+ const t = ct(e, n);
233
+ return t?.classList.add(Ie), t;
234
+ }
235
+ function kt(e, n) {
236
+ dt(e);
237
+ for (const t of Array.from(e.querySelectorAll(`.${Ge}`)))
238
+ t.classList.remove(Ge);
239
+ n !== null && ct(e, n)?.classList.add(Ge);
240
+ }
241
+ function wt(e) {
242
+ let n = e?.nodeType === 1 ? e : e?.parentElement ?? null;
243
+ for (; n; ) {
244
+ let t = 0;
245
+ for (let s = n.previousSibling; s; s = s.previousSibling) {
246
+ if (s.nodeType !== 8) continue;
247
+ const a = s.data.trim();
248
+ if (a.startsWith("/wx:"))
249
+ t += 1;
250
+ else if (a.startsWith("wx:")) {
251
+ if (t === 0) return a.slice(3);
252
+ t -= 1;
251
253
  }
252
254
  }
253
- l = l.parentElement;
255
+ n = n.parentElement;
254
256
  }
255
257
  return null;
256
258
  }
257
- function Tl(t, l) {
258
- ot(t);
259
- let o = null;
260
- function a(n) {
261
- he(n), l.select(ht(n.target));
259
+ function Pl(e, n) {
260
+ dt(e);
261
+ let t = null;
262
+ function s(o) {
263
+ const r = wt(o.target);
264
+ r === null ? Pe(o) : _e(o), n.select(r);
262
265
  }
263
- function s(n) {
264
- const b = ht(n.target);
265
- b !== o && (o = b, mt(t, b));
266
+ function a(o) {
267
+ const r = wt(o.target);
268
+ r !== t && (t = r, kt(e, r));
266
269
  }
267
- function r() {
268
- o = null, mt(t, null);
270
+ function i() {
271
+ t = null, kt(e, null);
269
272
  }
270
- return t.addEventListener("click", a, !0), t.addEventListener("auxclick", he, !0), t.addEventListener("submit", he, !0), t.addEventListener("dragstart", he, !0), t.addEventListener("mousemove", s, !0), t.addEventListener("mouseleave", r), {
273
+ return e.addEventListener("click", s, !0), e.addEventListener("auxclick", Pe, !0), e.addEventListener("submit", _e, !0), e.addEventListener("dragstart", _e, !0), e.addEventListener("mousemove", a, !0), e.addEventListener("mouseleave", i), {
271
274
  release() {
272
- t.removeEventListener("click", a, !0), t.removeEventListener("auxclick", he, !0), t.removeEventListener("submit", he, !0), t.removeEventListener("dragstart", he, !0), t.removeEventListener("mousemove", s, !0), t.removeEventListener("mouseleave", r);
275
+ e.removeEventListener("click", s, !0), e.removeEventListener("auxclick", Pe, !0), e.removeEventListener("submit", _e, !0), e.removeEventListener("dragstart", _e, !0), e.removeEventListener("mousemove", a, !0), e.removeEventListener("mouseleave", i);
273
276
  }
274
277
  };
275
278
  }
276
- function he(t) {
277
- t.preventDefault(), t.stopPropagation();
279
+ function _e(e) {
280
+ e.preventDefault(), e.stopPropagation();
281
+ }
282
+ function Pe(e) {
283
+ const n = e.target;
284
+ (n?.nodeType === Node.ELEMENT_NODE ? n : n?.parentElement ?? null)?.closest("a[href], area[href]") && e.preventDefault();
278
285
  }
279
- function Cl(t) {
280
- const l = ["click", "auxclick", "submit", "dragstart"];
281
- for (const o of l) t.addEventListener(o, he, !0);
286
+ function Ol(e) {
287
+ const n = [
288
+ ["click", Pe],
289
+ ["auxclick", Pe],
290
+ ["submit", _e],
291
+ ["dragstart", _e]
292
+ ];
293
+ for (const [t, s] of n) e.addEventListener(t, s, !0);
282
294
  return {
283
295
  release() {
284
- for (const o of l) t.removeEventListener(o, he, !0);
296
+ for (const [t, s] of n) e.removeEventListener(t, s, !0);
285
297
  }
286
298
  };
287
299
  }
288
- const tt = "sample", bt = "wx-stage-styles";
289
- function Vl(t, l) {
290
- let o = t.getElementById(bt);
291
- o === null && (o = t.createElement("style"), o.id = bt, (t.head ?? t.documentElement).appendChild(o)), o.textContent = l.styles;
292
- const a = `<!--wx:${tt}-->`, s = l.html.trimStart().startsWith(a) ? l.html : `${a}${l.html}<!--/wx:${tt}-->`;
293
- return Nt(t, tt, s);
300
+ const ot = "sample", _t = "wx-stage-styles";
301
+ function Ul(e, n) {
302
+ let t = e.getElementById(_t);
303
+ t === null && (t = e.createElement("style"), t.id = _t, (e.head ?? e.documentElement).appendChild(t)), t.textContent = n.styles;
304
+ const s = `<!--wx:${ot}-->`, a = n.html.trimStart().startsWith(s) ? n.html : `${s}${n.html}<!--/wx:${ot}-->`;
305
+ return Rt(e, ot, a);
294
306
  }
295
- function El(t, l) {
296
- const o = t.createElement("script");
297
- o.textContent = l, t.body.appendChild(o);
307
+ function Rl(e, n) {
308
+ const t = e.createElement("script");
309
+ t.textContent = n, e.body.appendChild(t);
298
310
  }
299
- function ot(t) {
300
- if (t.getElementById(ft)) return;
301
- const l = t.createElement("style");
302
- l.id = ft, l.textContent = `.${Ne}{outline:2px solid #427edd;outline-offset:-2px;}.${Je}:not(.${Ne}){outline:1px solid #427edd;outline-offset:-1px;cursor:pointer;}`, (t.head ?? t.documentElement).appendChild(l);
311
+ function dt(e) {
312
+ if (e.getElementById(yt)) return;
313
+ const n = e.createElement("style");
314
+ n.id = yt, n.textContent = `.${Ie}{outline:2px solid #427edd;outline-offset:-2px;}.${Ge}:not(.${Ie}){outline:1px solid #427edd;outline-offset:-1px;cursor:pointer;}`, (e.head ?? e.documentElement).appendChild(n);
303
315
  }
304
- function Pt(t) {
305
- const l = t.base ? `<base href="${gt(t.base)}">` : "", o = t.frame ? `<style>${t.frame}</style>` : "", a = t.script && t.runtime ? `<script src="${gt(t.runtime)}"><\/script><script>${t.script}<\/script>` : "";
306
- return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${l}<style>html,body{margin:0}body{container-type:inline-size}</style>${o}<style>${t.styles}</style></head><body>${t.html}${a}</body></html>`;
316
+ function jt(e) {
317
+ const n = e.base ? `<base href="${xt(e.base)}">` : "", t = e.frame ? `<style>${e.frame}</style>` : "", s = e.script && e.runtime ? `<script src="${xt(e.runtime)}"><\/script><script>${e.script}<\/script>` : "";
318
+ return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${n}<style>html,body{margin:0}body{container-type:inline-size}</style>${t}<style>${e.styles}</style></head><body>${e.html}${s}</body></html>`;
307
319
  }
308
- function gt(t) {
309
- return t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
320
+ function xt(e) {
321
+ return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
310
322
  }
311
- const Bl = { class: "wx-block-stage" }, Ll = { class: "wx-block-stage__bar" }, Wl = ["src", "srcdoc", "title"], Al = /* @__PURE__ */ ae({
323
+ const jl = { class: "wx-block-stage" }, Fl = { class: "wx-block-stage__bar" }, Hl = ["src", "srcdoc", "title"], ql = /* @__PURE__ */ ae({
312
324
  __name: "BlockStage",
313
325
  props: {
314
326
  html: {},
@@ -318,211 +330,211 @@ const Bl = { class: "wx-block-stage" }, Ll = { class: "wx-block-stage__bar" }, W
318
330
  stage: { default: null },
319
331
  loading: { type: Boolean, default: !1 }
320
332
  },
321
- setup(t) {
322
- const l = t, o = de("webx-blocks"), a = T(() => [
323
- { value: 1280, icon: "monitor", ariaLabel: o("page.width-desktop") },
324
- { value: 834, icon: "tablet", ariaLabel: o("page.width-tablet") },
325
- { value: 390, icon: "smartphone", ariaLabel: o("page.width-phone") }
326
- ]), s = U(1280), r = U(null), n = U(null), b = Ye(r), P = U(360), v = U(!1);
327
- X([b, a], () => {
328
- if (v.value || b.value === 0) return;
329
- const c = a.value.find((B) => b.value / B.value >= 0.45);
330
- s.value = (c ?? a.value[a.value.length - 1]).value;
333
+ setup(e) {
334
+ const n = e, t = de("webx-blocks"), s = V(() => [
335
+ { value: 1280, icon: "monitor", ariaLabel: t("page.width-desktop") },
336
+ { value: 834, icon: "tablet", ariaLabel: t("page.width-tablet") },
337
+ { value: 390, icon: "smartphone", ariaLabel: t("page.width-phone") }
338
+ ]), a = I(1280), i = I(null), o = I(null), r = Xe(i), m = I(360), c = I(!1);
339
+ te([r, s], () => {
340
+ if (c.value || r.value === 0) return;
341
+ const h = s.value.find((A) => r.value / A.value >= 0.45);
342
+ a.value = (h ?? s.value[s.value.length - 1]).value;
331
343
  });
332
- function p(c) {
333
- v.value = !0, s.value = c;
334
- }
335
- const g = T(() => b.value === 0 ? 1 : Math.min(1, b.value / s.value)), f = T(
336
- () => l.stage ? void 0 : Pt({
337
- html: l.html,
338
- styles: l.styles,
339
- script: l.script,
340
- runtime: l.runtime,
344
+ function d(h) {
345
+ c.value = !0, a.value = h;
346
+ }
347
+ const p = V(() => r.value === 0 ? 1 : Math.min(1, r.value / a.value)), v = V(
348
+ () => n.stage ? void 0 : jt({
349
+ html: n.html,
350
+ styles: n.styles,
351
+ script: n.script,
352
+ runtime: n.runtime,
341
353
  base: typeof location > "u" ? null : location.origin + "/"
342
354
  })
343
- ), k = U(0);
344
- let C = null;
345
- X(
346
- () => l.script,
347
- (c) => {
348
- l.stage && c !== C && (k.value += 1);
355
+ ), g = I(0);
356
+ let x = null;
357
+ te(
358
+ () => n.script,
359
+ (h) => {
360
+ n.stage && h !== x && (g.value += 1);
349
361
  }
350
362
  );
351
- function V() {
352
- const c = n.value?.contentDocument?.body;
353
- if (!c) return;
354
- const B = c.ownerDocument.defaultView, D = B && parseFloat(B.getComputedStyle(c).marginBottom) || 0, K = c.getBoundingClientRect().bottom + D + (B?.scrollY ?? 0);
355
- P.value = Math.max(120, Math.ceil(Math.max(c.scrollHeight, K)));
356
- }
357
- let x = null, m = null;
358
- function y() {
359
- x?.release(), x = null, m?.disconnect(), m = null;
360
- }
361
- function R(c) {
362
- l.stage && (l.script && C !== l.script && (C = l.script, El(c, l.script)), Vl(c, { html: l.html, styles: l.styles }));
363
- }
364
- function q() {
365
- y();
366
- const c = n.value?.contentDocument;
367
- if (!c?.body) return;
368
- l.stage && (C = null, x = Cl(c), R(c)), V();
369
- const B = c.defaultView?.ResizeObserver;
370
- B && (m = new B(() => V()), m.observe(c.body));
371
- }
372
- X(
373
- () => [l.html, l.styles],
363
+ function T() {
364
+ const h = o.value?.contentDocument?.body;
365
+ if (!h) return;
366
+ const A = h.ownerDocument.defaultView, P = A && parseFloat(A.getComputedStyle(h).marginBottom) || 0, J = h.getBoundingClientRect().bottom + P + (A?.scrollY ?? 0);
367
+ m.value = Math.max(120, Math.ceil(Math.max(h.scrollHeight, J)));
368
+ }
369
+ let w = null, y = null;
370
+ function _() {
371
+ w?.release(), w = null, y?.disconnect(), y = null;
372
+ }
373
+ function R(h) {
374
+ n.stage && (n.script && x !== n.script && (x = n.script, Rl(h, n.script)), Ul(h, { html: n.html, styles: n.styles }));
375
+ }
376
+ function K() {
377
+ _();
378
+ const h = o.value?.contentDocument;
379
+ if (!h?.body) return;
380
+ n.stage && (x = null, w = Ol(h), R(h)), T();
381
+ const A = h.defaultView?.ResizeObserver;
382
+ A && (y = new A(() => T()), y.observe(h.body));
383
+ }
384
+ te(
385
+ () => [n.html, n.styles],
374
386
  () => {
375
- const c = n.value?.contentDocument;
376
- l.stage && c?.body && x !== null && R(c);
387
+ const h = o.value?.contentDocument;
388
+ n.stage && h?.body && w !== null && R(h);
377
389
  }
378
- ), X(b, (c, B) => {
379
- c > 0 && B === 0 && setTimeout(V, 50);
380
- }), X(s, () => setTimeout(V, 50)), Ge(y);
381
- const J = T(() => ({
382
- width: `${s.value}px`,
383
- height: `${P.value}px`,
384
- transform: `scale(${g.value})`
385
- })), Z = T(() => ({
386
- width: `${Math.round(s.value * g.value)}px`,
387
- height: `${Math.round(P.value * g.value)}px`
390
+ ), te(r, (h, A) => {
391
+ h > 0 && A === 0 && setTimeout(T, 50);
392
+ }), te(a, () => setTimeout(T, 50)), Qe(_);
393
+ const Y = V(() => ({
394
+ width: `${a.value}px`,
395
+ height: `${m.value}px`,
396
+ transform: `scale(${p.value})`
397
+ })), X = V(() => ({
398
+ width: `${Math.round(a.value * p.value)}px`,
399
+ height: `${Math.round(m.value * p.value)}px`
388
400
  }));
389
- return (c, B) => (i(), S("div", Bl, [
390
- E("div", Ll, [
391
- u(e(Ct), {
392
- "model-value": s.value,
393
- options: a.value,
401
+ return (h, A) => (u(), C("div", jl, [
402
+ B("div", Fl, [
403
+ f(l(Wt), {
404
+ "model-value": a.value,
405
+ options: s.value,
394
406
  size: "sm",
395
- "aria-label": e(o)("page.width"),
396
- "onUpdate:modelValue": B[0] || (B[0] = (D) => p(Number(D)))
407
+ "aria-label": l(t)("page.width"),
408
+ "onUpdate:modelValue": A[0] || (A[0] = (P) => d(Number(P)))
397
409
  }, null, 8, ["model-value", "options", "aria-label"])
398
410
  ]),
399
- E("div", {
411
+ B("div", {
400
412
  ref_key: "box",
401
- ref: r,
413
+ ref: i,
402
414
  class: "wx-block-stage__ground"
403
415
  }, [
404
- t.loading && !t.html ? (i(), I(e(We), {
416
+ e.loading && !e.html ? (u(), M(l(Le), {
405
417
  key: 0,
406
418
  rows: 3
407
- })) : (i(), S("div", {
419
+ })) : (u(), C("div", {
408
420
  key: 1,
409
421
  class: "wx-block-stage__clip",
410
- style: xe(Z.value)
422
+ style: xe(X.value)
411
423
  }, [
412
- (i(), S("iframe", {
424
+ (u(), C("iframe", {
413
425
  ref_key: "frame",
414
- ref: n,
415
- key: k.value,
426
+ ref: o,
427
+ key: g.value,
416
428
  class: "wx-block-stage__frame",
417
- src: t.stage ?? void 0,
418
- srcdoc: f.value,
419
- style: xe(J.value),
429
+ src: e.stage ?? void 0,
430
+ srcdoc: v.value,
431
+ style: xe(Y.value),
420
432
  sandbox: "allow-same-origin allow-scripts",
421
- title: e(o)("page.preview"),
422
- onLoad: q
423
- }, null, 44, Wl))
433
+ title: l(t)("page.preview"),
434
+ onLoad: K
435
+ }, null, 44, Hl))
424
436
  ], 4))
425
437
  ], 512)
426
438
  ]));
427
439
  }
428
- }), zl = /* @__PURE__ */ oe(Al, [["__scopeId", "data-v-3185ee45"]]);
429
- function Ut(t) {
430
- return typeof t == "object" && t !== null && typeof t.type == "string" && t.type !== "";
440
+ }), Kl = /* @__PURE__ */ ie(ql, [["__scopeId", "data-v-3185ee45"]]);
441
+ function Ft(e) {
442
+ return typeof e == "object" && e !== null && typeof e.type == "string" && e.type !== "";
431
443
  }
432
- function Ze(t) {
433
- return Array.isArray(t) && t.length > 0 && t.every(Ut);
444
+ function et(e) {
445
+ return Array.isArray(e) && e.length > 0 && e.every(Ft);
434
446
  }
435
- function lt() {
447
+ function it() {
436
448
  return (typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().replace(/-/g, "") : Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).slice(0, 12);
437
449
  }
438
- function Il(t, l = {}) {
439
- return { key: lt(), type: t, values: l };
450
+ function Yl(e, n = {}) {
451
+ return { key: it(), type: e, values: n };
440
452
  }
441
- function re(t, l) {
442
- return Mt(t, l, null, null);
453
+ function re(e, n) {
454
+ return Ht(e, n, null, null);
443
455
  }
444
- function Mt(t, l, o, a) {
445
- for (let s = 0; s < t.length; s++) {
446
- const r = t[s];
447
- if (r.key === l) return { node: r, parent: o, field: a, list: t, index: s };
448
- for (const [n, b] of Object.entries(r.values ?? {}))
449
- if (Ze(b)) {
450
- const P = Mt(b, l, r, n);
451
- if (P) return P;
456
+ function Ht(e, n, t, s) {
457
+ for (let a = 0; a < e.length; a++) {
458
+ const i = e[a];
459
+ if (i.key === n) return { node: i, parent: t, field: s, list: e, index: a };
460
+ for (const [o, r] of Object.entries(i.values ?? {}))
461
+ if (et(r)) {
462
+ const m = Ht(r, n, i, o);
463
+ if (m) return m;
452
464
  }
453
465
  }
454
466
  return null;
455
467
  }
456
- function Oe(t, l, o = 0, a = null) {
457
- for (const s of t)
458
- if (Ut(s)) {
459
- l(s, o, a);
460
- for (const r of Object.values(s.values ?? {}))
461
- Ze(r) && Oe(r, l, o + 1, s);
462
- }
463
- }
464
- function Nl(t, l) {
465
- let o = 0;
466
- return Oe(t, (a) => {
467
- a.type === l && o++;
468
- }), o;
469
- }
470
- function Pl(t) {
471
- let l = 0;
472
- for (const o of Object.values(t.values ?? {}))
473
- Ze(o) && Oe(o, () => l++);
474
- return l;
475
- }
476
- function wa(t) {
477
- const l = [];
478
- return Oe(t, (o) => {
479
- l.includes(o.type) || l.push(o.type);
480
- }), l;
481
- }
482
- function Dt(t) {
483
- const l = [];
484
- for (const o of t)
485
- o.type === "wx-blocks" && l.push(o), o.children && l.push(...Dt(o.children));
486
- return l;
487
- }
488
- function Ot(t) {
489
- const l = {};
490
- for (const [o, a] of Object.entries(t.values ?? {}))
491
- l[o] = Ze(a) ? a.map(Ot) : ge(a);
492
- return t.hidden === !0 ? { key: lt(), type: t.type, hidden: !0, values: l } : { key: lt(), type: t.type, values: l };
493
- }
494
- function Ul(t, l, o) {
495
- const a = ge(t), s = re(a, l);
496
- return s ? (o ? s.node.hidden = !0 : delete s.node.hidden, a) : t;
497
- }
498
- function Ml(t, l, o) {
499
- if (l === null) return t;
500
- const a = re(t, l);
501
- if (!a || o === null) return null;
502
- const s = a.node.values[o];
503
- return Array.isArray(s) || (a.node.values[o] = []), a.node.values[o];
504
- }
505
- function kt(t, l, o, a, s) {
506
- const r = ge(t), n = Ml(r, l, o);
507
- return n ? (n.splice(Math.max(0, Math.min(a, n.length)), 0, s), r) : t;
508
- }
509
- function Dl(t, l) {
510
- const o = ge(t), a = re(o, l);
511
- return a ? (a.list.splice(a.index, 1), o) : t;
512
- }
513
- function Ol(t, l, o) {
514
- const a = ge(t), s = re(a, l);
515
- return s ? (s.node.values = o, a) : t;
516
- }
517
- function Rl(t, l, o, a) {
518
- if (l === null) return ge(a);
519
- const s = ge(t), r = re(s, l);
520
- return !r || o === null ? t : (r.node.values[o] = ge(a), s);
521
- }
522
- function ge(t) {
523
- return t === void 0 ? t : JSON.parse(JSON.stringify(t));
524
- }
525
- const Hl = {
468
+ function Fe(e, n, t = 0, s = null) {
469
+ for (const a of e)
470
+ if (Ft(a)) {
471
+ n(a, t, s);
472
+ for (const i of Object.values(a.values ?? {}))
473
+ et(i) && Fe(i, n, t + 1, a);
474
+ }
475
+ }
476
+ function Jl(e, n) {
477
+ let t = 0;
478
+ return Fe(e, (s) => {
479
+ s.type === n && t++;
480
+ }), t;
481
+ }
482
+ function Gl(e) {
483
+ let n = 0;
484
+ for (const t of Object.values(e.values ?? {}))
485
+ et(t) && Fe(t, () => n++);
486
+ return n;
487
+ }
488
+ function lo(e) {
489
+ const n = [];
490
+ return Fe(e, (t) => {
491
+ n.includes(t.type) || n.push(t.type);
492
+ }), n;
493
+ }
494
+ function qt(e) {
495
+ const n = [];
496
+ for (const t of e)
497
+ t.type === "wx-blocks" && n.push(t), t.children && n.push(...qt(t.children));
498
+ return n;
499
+ }
500
+ function Kt(e) {
501
+ const n = {};
502
+ for (const [t, s] of Object.entries(e.values ?? {}))
503
+ n[t] = et(s) ? s.map(Kt) : be(s);
504
+ return e.hidden === !0 ? { key: it(), type: e.type, hidden: !0, values: n } : { key: it(), type: e.type, values: n };
505
+ }
506
+ function Zl(e, n, t) {
507
+ const s = be(e), a = re(s, n);
508
+ return a ? (t ? a.node.hidden = !0 : delete a.node.hidden, s) : e;
509
+ }
510
+ function Ql(e, n, t) {
511
+ if (n === null) return e;
512
+ const s = re(e, n);
513
+ if (!s || t === null) return null;
514
+ const a = s.node.values[t];
515
+ return Array.isArray(a) || (s.node.values[t] = []), s.node.values[t];
516
+ }
517
+ function $t(e, n, t, s, a) {
518
+ const i = be(e), o = Ql(i, n, t);
519
+ return o ? (o.splice(Math.max(0, Math.min(s, o.length)), 0, a), i) : e;
520
+ }
521
+ function Xl(e, n) {
522
+ const t = be(e), s = re(t, n);
523
+ return s ? (s.list.splice(s.index, 1), t) : e;
524
+ }
525
+ function en(e, n, t) {
526
+ const s = be(e), a = re(s, n);
527
+ return a ? (a.node.values = t, s) : e;
528
+ }
529
+ function tn(e, n, t, s) {
530
+ if (n === null) return be(s);
531
+ const a = be(e), i = re(a, n);
532
+ return !i || t === null ? e : (i.node.values[t] = be(s), a);
533
+ }
534
+ function be(e) {
535
+ return e === void 0 ? e : JSON.parse(JSON.stringify(e));
536
+ }
537
+ const ln = {
526
538
  module: {
527
539
  title: "Blocks"
528
540
  },
@@ -678,130 +690,439 @@ const Hl = {
678
690
  "ok-container": "Width is decided by container queries.",
679
691
  "ok-variables": "Every variable of the template is a field of the schema."
680
692
  }
681
- }, yt = /* @__PURE__ */ new WeakSet();
682
- function Re() {
693
+ }, St = /* @__PURE__ */ new WeakSet();
694
+ function He() {
683
695
  try {
684
- const { i18n: t } = Me();
685
- yt.has(t) || (t.defaults("webx-blocks", Hl), yt.add(t));
696
+ const { i18n: e } = Re();
697
+ St.has(e) || (e.defaults("webx-blocks", ln), St.add(e));
686
698
  } catch {
687
699
  }
688
700
  }
689
- const jl = ["block", "entity", "loop", "__env", "errors", "app"];
690
- function Fl(t, l, o) {
691
- const a = [];
692
- /data-wx-block\s*=/.test(l.template) || a.push({ file: "template", code: "no-marker", line: null, message: o("checks.no-marker") });
693
- const s = ql(l.template, l.schema);
694
- s.length > 0 && a.push({
701
+ function at(e) {
702
+ return [
703
+ Cl({ icons: !1 }),
704
+ Bl.languageData.of(() => [{ autocomplete: e }])
705
+ ];
706
+ }
707
+ const nn = [
708
+ ["block", "key, type, version, depth, value()"],
709
+ ["entity", "the page or article the block stands on"]
710
+ ], sn = ["key", "type", "version", "depth"], Yt = ["url", "alt", "title", "path"], on = [...Yt, "thumb", "name", "extension", "mime", "size", "width", "height"], an = ["wx-media"], rn = ["wx-gallery", "wx-files"];
711
+ function un({ schema: e, styles: n }) {
712
+ return (t) => {
713
+ const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /\$block->(\w*)$/.exec(s);
714
+ if (a) return pn(t, a[1]);
715
+ const i = /\$(\w+)\[\s*(['"]?)(\w*)$/.exec(s);
716
+ if (i) return fn(t, i[1], i[2], i[3], e());
717
+ const o = /\$(\w*)$/.exec(s);
718
+ if (o)
719
+ return {
720
+ from: t.pos - o[0].length,
721
+ options: cn(e(), t.state.doc.toString()),
722
+ validFor: /^\$\w*$/
723
+ };
724
+ const r = /(\{\{|\{!!)(\s*)(\w*)$/.exec(s);
725
+ if (r) return dn(t, r[1], r[2], r[3], e());
726
+ const m = /\bclass\s*=\s*"([^"]*)$/.exec(s);
727
+ if (m) return mn(t, m[1], n());
728
+ const c = /(?:^|[\s>(])@(\w*)$/.exec(s);
729
+ return c ? {
730
+ from: t.pos - c[1].length - 1,
731
+ options: hn(e()),
732
+ validFor: /^@\w*$/
733
+ } : null;
734
+ };
735
+ }
736
+ function cn(e, n) {
737
+ const t = Zt(e).map((s, a) => ({
738
+ label: `$${s.id}`,
739
+ detail: s.type,
740
+ info: s.label,
741
+ type: "variable",
742
+ boost: 50 - a
743
+ }));
744
+ for (const s of Jt(n).keys())
745
+ t.push({ label: `$${s}`, detail: "loop", type: "variable" });
746
+ for (const [s, a] of nn)
747
+ t.push({ label: `$${s}`, detail: "given", info: a, type: "variable", boost: -10 });
748
+ return t.push({ label: "$loop", detail: "given", info: "inside @foreach", boost: -20 }), t;
749
+ }
750
+ function dn(e, n, t, s, a) {
751
+ const i = Zt(a);
752
+ if (i.length === 0) return null;
753
+ const o = n === "{{" ? "}}" : "!!}";
754
+ return {
755
+ from: e.pos - s.length,
756
+ options: i.map((r, m) => ({
757
+ label: r.id,
758
+ displayLabel: `$${r.id}`,
759
+ detail: r.type,
760
+ info: r.label,
761
+ type: "variable",
762
+ boost: 50 - m,
763
+ apply: (c, d, p, v) => {
764
+ const g = c.state.sliceDoc(v, v + 8), x = new RegExp(`^\\s*${xn(o)}`).exec(g), T = x ? /^\s/.test(g) ? "" : " " : ` ${o}`, w = `${t === "" ? " " : ""}$${r.id}${T}`;
765
+ c.dispatch({
766
+ changes: { from: p, to: v, insert: w },
767
+ // Past the closing braces: the echo is finished, the next thing is the markup.
768
+ selection: { anchor: p + w.length + (x ? x[0].length : 0) },
769
+ annotations: ut.of(d),
770
+ userEvent: "input.complete"
771
+ });
772
+ }
773
+ })),
774
+ validFor: /^\w*$/
775
+ };
776
+ }
777
+ function pn(e, n) {
778
+ return {
779
+ from: e.pos - n.length,
780
+ options: [
781
+ ...sn.map((t) => ({ label: t, type: "property" })),
782
+ me("value('${name}', ${default})", {
783
+ label: "value",
784
+ detail: "('name', default)",
785
+ type: "method"
786
+ })
787
+ ],
788
+ validFor: /^\w*$/
789
+ };
790
+ }
791
+ function fn(e, n, t, s, a) {
792
+ const i = vn(n, a, e.state.doc.toString());
793
+ return i.length === 0 ? null : {
794
+ from: e.pos - s.length,
795
+ options: i.map(([o, r]) => ({
796
+ label: o,
797
+ detail: r,
798
+ type: "property",
799
+ apply: (m, c, d, p) => {
800
+ const v = t ? d - 1 : d, g = m.state.sliceDoc(p, p + 2), x = t || "'", T = p + (g.startsWith(x) ? 1 : 0), w = m.state.sliceDoc(T, T + 1) === "]", y = `${x}${o}${x}${w ? "" : "]"}`;
801
+ m.dispatch({
802
+ changes: { from: v, to: T, insert: y },
803
+ selection: { anchor: v + y.length + (w ? 1 : 0) },
804
+ annotations: ut.of(c),
805
+ userEvent: "input.complete"
806
+ });
807
+ }
808
+ })),
809
+ validFor: /^\w*$/
810
+ };
811
+ }
812
+ function vn(e, n, t) {
813
+ const s = We(n).find((o) => o.id === e);
814
+ if (s && an.includes(s.type)) return Yt.map((o) => [o, s.type]);
815
+ const a = Jt(t).get(e), i = a ? We(n).find((o) => o.id === a) : void 0;
816
+ return i ? rn.includes(i.type) ? on.map((o) => [o, i.type]) : i.type === "wx-repeater" ? We(i.children ?? []).map((o) => [o.id, o.type]) : [] : [];
817
+ }
818
+ function Jt(e) {
819
+ const n = /* @__PURE__ */ new Map();
820
+ for (const t of e.matchAll(/\$(\w+)\s+as\s+\$(\w+)(?:\s*=>\s*\$(\w+))?/g))
821
+ n.set(t[3] ?? t[2], t[1]);
822
+ return n;
823
+ }
824
+ function mn(e, n, t) {
825
+ const s = /[\w-]*$/.exec(n)[0], a = new Set(n.split(/\s+/));
826
+ return {
827
+ from: e.pos - s.length,
828
+ options: Gt(t).filter((i) => !a.has(i) || i === s).map((i) => ({ label: i, detail: "styles", type: "class" })),
829
+ validFor: /^[\w-]*$/
830
+ };
831
+ }
832
+ function hn(e) {
833
+ const n = We(e).filter((t) => t.type === "wx-blocks");
834
+ return [
835
+ me("@if (${condition})\n ${}\n@endif", { label: "@if", type: "keyword" }),
836
+ me("@isset(${value})\n ${}\n@endisset", { label: "@isset", type: "keyword" }),
837
+ me("@foreach (${items} as ${item})\n ${}\n@endforeach", {
838
+ label: "@foreach",
839
+ type: "keyword"
840
+ }),
841
+ me("@forelse (${items} as ${item})\n ${}\n@empty\n ${}\n@endforelse", {
842
+ label: "@forelse",
843
+ type: "keyword"
844
+ }),
845
+ me("@unless (${condition})\n ${}\n@endunless", {
846
+ label: "@unless",
847
+ type: "keyword"
848
+ }),
849
+ me("@class([${}])", { label: "@class", type: "keyword" }),
850
+ me("@style([${}])", { label: "@style", type: "keyword" }),
851
+ ...n.map(
852
+ (t) => me(`@blocks('${t.id}')`, {
853
+ label: "@blocks",
854
+ detail: `('${t.id}')`,
855
+ type: "keyword",
856
+ boost: 10
857
+ })
858
+ ),
859
+ ...["@elseif", "@else", "@endif", "@endforeach", "@endisset", "@empty", "@endforelse"].map(
860
+ (t) => ({ label: t, type: "keyword", boost: -10 })
861
+ )
862
+ ];
863
+ }
864
+ function bn({ slug: e, template: n }) {
865
+ return (t) => {
866
+ const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /(?:^|[\s,>+~(}{])\.([\w-]*)$/.exec(s);
867
+ if (!a) return null;
868
+ const i = /[^{};]*$/.exec(s)[0];
869
+ if (/^\s*[\w-]+\s*:\s/.test(i)) return null;
870
+ const o = `b-${e()}`, r = new Set(Gt(t.state.doc.toString())), m = gn(n()), c = [o, ...m.filter((p) => p !== o)], d = c.map((p, v) => ({
871
+ label: `.${p}`,
872
+ // A class the template uses and nothing styles yet is the likeliest thing to write.
873
+ detail: r.has(p) ? "template" : "template · no rule yet",
874
+ type: "class",
875
+ boost: (r.has(p) ? 0 : 20) + (p === o ? 30 : 0) - v / 100
876
+ }));
877
+ for (const p of r)
878
+ c.includes(p) || d.push({ label: `.${p}`, detail: "styles", type: "class" });
879
+ return { from: t.pos - a[1].length - 1, options: d, validFor: /^\.[\w-]*$/ };
880
+ };
881
+ }
882
+ function Gt(e) {
883
+ const n = e.replace(/\/\*[\s\S]*?\*\//g, ""), t = /* @__PURE__ */ new Set(), s = [];
884
+ let a = "";
885
+ for (const i of n)
886
+ if (i === "{") {
887
+ const o = s.at(-1) ?? [""], r = a.split(",").map((m) => m.trim()).filter((m) => m !== "" && !m.startsWith("@")).flatMap(
888
+ (m) => m.includes("&") ? o.map((c) => m.replaceAll("&", c)) : o.map((c) => c ? `${c} ${m}` : m)
889
+ );
890
+ for (const m of r)
891
+ for (const c of m.matchAll(/\.(-?[a-zA-Z_][\w-]*)/g)) t.add(c[1]);
892
+ s.push(a.trim().startsWith("@") ? o : r.length ? r : o), a = "";
893
+ } else i === "}" ? (s.pop(), a = "") : i === ";" ? a = "" : a += i;
894
+ return [...t];
895
+ }
896
+ function gn(e) {
897
+ const n = /* @__PURE__ */ new Set();
898
+ for (const t of e.matchAll(/\bclass\s*=\s*"([^"]*)"/g)) {
899
+ const s = t[1].replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}|@\w+(\([^)]*\))?/g, " ");
900
+ for (const a of s.split(/\s+/))
901
+ /^-?[a-zA-Z_][\w-]*$/.test(a) && n.add(a);
902
+ }
903
+ return [...n];
904
+ }
905
+ const yn = [
906
+ { key: "id", value: '""', info: "The variable the template gets, in snake_case." },
907
+ { key: "type", value: '""', info: "A type from the registry." },
908
+ { key: "label", value: '""', info: "What the editor sees above the field." },
909
+ { key: "help", value: '""', info: "A hint under the field." },
910
+ { key: "localized", value: "true", info: "Edited per content language." },
911
+ { key: "props", value: "{}", info: "Passed to the component as they are." },
912
+ { key: "children", value: "[]", info: "Nodes inside a layout node or a repeater." },
913
+ { key: "visible", value: "", info: "`false`, or a condition on another field." },
914
+ { key: "slot", value: '""', info: "The parent's named slot to land in." },
915
+ { key: "can", value: '""', info: "The permission the node needs." }
916
+ ];
917
+ function kn({ types: e }) {
918
+ return (n) => {
919
+ const t = wn(n.state.doc.toString(), n.pos);
920
+ if (!t || !t.node) return null;
921
+ const s = t.string ? n.state.sliceDoc(t.string, n.pos) : /[\w-]*$/.exec(n.state.sliceDoc(Math.max(0, n.pos - 60), n.pos))[0];
922
+ if (!t.string && s === "" && !n.explicit) return null;
923
+ const a = n.pos - s.length, i = t.string !== null;
924
+ if (t.phase === "key") {
925
+ const o = yn.filter(({ key: r }) => !t.keys.has(r) || r === s).map(
926
+ ({ key: r, value: m, info: c }, d) => ({
927
+ label: r,
928
+ info: c,
929
+ type: "property",
930
+ boost: -d,
931
+ apply: (p, v, g, x) => Et(p, v, g, x, i, `"${r}": ${m}`, m)
932
+ })
933
+ );
934
+ return { from: a, options: o, validFor: /^[\w-]*$/ };
935
+ }
936
+ if (t.phase === "value" && t.key === "type") {
937
+ const o = Object.entries(e()).map(([r, m]) => ({
938
+ label: r,
939
+ detail: m.kind,
940
+ type: "type",
941
+ // Fields first: a block's schema is mostly fields, the layout only groups them.
942
+ boost: m.kind === "field" ? 1 : 0,
943
+ apply: (c, d, p, v) => Et(c, d, p, v, i, `"${r}"`, "")
944
+ }));
945
+ return { from: a, options: o, validFor: /^[\w-]*$/ };
946
+ }
947
+ return null;
948
+ };
949
+ }
950
+ function Et(e, n, t, s, a, i, o) {
951
+ const r = a ? t - 1 : t, m = /^[\w-]*"?/.exec(e.state.sliceDoc(s, s + 60))[0], c = s + (a ? m.length : /^[\w-]*/.exec(m)[0].length), d = o === '""' || o === "{}" || o === "[]" ? 1 : 0;
952
+ e.dispatch({
953
+ changes: { from: r, to: c, insert: i },
954
+ selection: { anchor: r + i.length - d },
955
+ annotations: ut.of(n),
956
+ userEvent: "input.complete"
957
+ }), i.startsWith('"type"') && Vl(e);
958
+ }
959
+ function wn(e, n) {
960
+ let t = null, s = null, a = null, i = !1;
961
+ const o = (r) => r?.kind === "object" && r.parent?.kind === "array" && (r.parent.parent === null || r.parent.under === "children");
962
+ for (let r = 0; r <= e.length && (r === n && (s = t?.kind === "object" ? {
963
+ node: o(t),
964
+ phase: a?.key ? "key" : t.phase,
965
+ key: t.key,
966
+ keys: t.keys,
967
+ string: a ? a.start + 1 : null
968
+ } : null), r !== e.length); r++) {
969
+ const m = e[r];
970
+ if (a) {
971
+ if (i) i = !1;
972
+ else if (m === "\\") i = !0;
973
+ else if (m === '"' || m === `
974
+ `) {
975
+ const c = e.slice(a.start + 1, r);
976
+ t?.kind === "object" && (a.key ? (t.keys.add(c), t.key = c, t.phase = "colon") : t.phase === "value" && (t.phase = "after")), a = null;
977
+ }
978
+ continue;
979
+ }
980
+ if (!/\s/.test(m))
981
+ if (m === '"')
982
+ a = { start: r, key: t?.kind === "object" && t.phase === "key" };
983
+ else if (m === "{" || m === "[") {
984
+ const c = {
985
+ kind: m === "{" ? "object" : "array",
986
+ parent: t,
987
+ under: t?.kind === "object" ? t.key : null,
988
+ keys: /* @__PURE__ */ new Set(),
989
+ phase: "key",
990
+ key: null
991
+ };
992
+ t?.kind === "object" && (t.phase = "after"), t = c;
993
+ } else m === "}" || m === "]" ? t = t?.parent ?? null : m === ":" ? t?.kind === "object" && (t.phase = "value") : m === "," && t?.kind === "object" && (t.phase = "key", t.key = null);
994
+ }
995
+ return s;
996
+ }
997
+ function We(e) {
998
+ const n = [];
999
+ for (const t of e)
1000
+ !t || typeof t != "object" || (_n.has(t.type) ? n.push(...We(t.children ?? [])) : typeof t.id == "string" && t.id !== "" && n.push(t));
1001
+ return n;
1002
+ }
1003
+ function Zt(e) {
1004
+ return We(e).filter((n) => n.type !== "wx-blocks");
1005
+ }
1006
+ const _n = /* @__PURE__ */ new Set(["wx-card", "wx-tabs", "wx-tab", "wx-row", "wx-col", "wx-divider"]);
1007
+ function xn(e) {
1008
+ return e.replace(/[.*+?^${}()|[\]\\!]/g, "\\$&");
1009
+ }
1010
+ const $n = ["block", "entity", "loop", "__env", "errors", "app"];
1011
+ function Sn(e, n, t) {
1012
+ const s = [];
1013
+ /data-wx-block\s*=/.test(n.template) || s.push({ file: "template", code: "no-marker", line: null, message: t("checks.no-marker") });
1014
+ const a = En(n.template, n.schema);
1015
+ a.length > 0 && s.push({
695
1016
  file: "template",
696
1017
  code: "variables-missing",
697
1018
  line: null,
698
- message: o("checks.variables-missing", {
699
- variables: s.map((p) => `$${p}`).join(", ")
1019
+ message: t("checks.variables-missing", {
1020
+ variables: a.map((d) => `$${d}`).join(", ")
700
1021
  })
701
1022
  });
702
- const r = [], n = [], b = `.b-${t}`;
703
- for (const [p, g] of Jl(l.styles))
704
- p.startsWith(b) || p.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(p) ? n.push([p, g]) : r.push([p, g]));
705
- r.length > 0 && a.push({
1023
+ const i = [], o = [], r = `.b-${e}`;
1024
+ for (const [d, p] of Tn(n.styles))
1025
+ d.startsWith(r) || d.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(d) ? o.push([d, p]) : i.push([d, p]));
1026
+ i.length > 0 && s.push({
706
1027
  file: "styles",
707
1028
  code: "stray-selectors",
708
- line: r[0][1],
709
- message: o("checks.stray-selectors", { slug: t, selectors: wt(r) })
710
- }), n.length > 0 && a.push({
1029
+ line: i[0][1],
1030
+ message: t("checks.stray-selectors", { slug: e, selectors: Tt(i) })
1031
+ }), o.length > 0 && s.push({
711
1032
  file: "styles",
712
1033
  code: "bare-selectors",
713
- line: n[0][1],
714
- message: o("checks.bare-selectors", { selectors: wt(n) })
1034
+ line: o[0][1],
1035
+ message: t("checks.bare-selectors", { selectors: Tt(o) })
715
1036
  });
716
- const P = Ht(l.styles), v = /@media\b/.exec(P);
717
- return v && a.push({
1037
+ const m = Xt(n.styles), c = /@media\b/.exec(m);
1038
+ return c && s.push({
718
1039
  file: "styles",
719
1040
  code: "media-query",
720
- line: jt(P, v.index),
721
- message: o("checks.media-query")
722
- }), a;
723
- }
724
- function Rt(t) {
725
- const l = [];
726
- for (const o of t)
727
- o.id && l.push(o.id), o.children && l.push(...Rt(o.children));
728
- return l;
729
- }
730
- function ql(t, l) {
731
- const o = /* @__PURE__ */ new Set([...Rt(l), ...jl]);
732
- for (const s of t.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
733
- o.add(s[1]), s[2] && o.add(s[2]);
734
- for (const s of t.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
735
- o.add(s[1]);
736
- const a = [];
737
- for (const s of t.matchAll(/\$([a-zA-Z_]\w*)/g)) {
738
- const r = s[1];
739
- !o.has(r) && !a.includes(r) && a.push(r);
1041
+ line: el(m, c.index),
1042
+ message: t("checks.media-query")
1043
+ }), s;
1044
+ }
1045
+ function Qt(e) {
1046
+ const n = [];
1047
+ for (const t of e)
1048
+ t.id && n.push(t.id), t.children && n.push(...Qt(t.children));
1049
+ return n;
1050
+ }
1051
+ function En(e, n) {
1052
+ const t = /* @__PURE__ */ new Set([...Qt(n), ...$n]);
1053
+ for (const a of e.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
1054
+ t.add(a[1]), a[2] && t.add(a[2]);
1055
+ for (const a of e.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
1056
+ t.add(a[1]);
1057
+ const s = [];
1058
+ for (const a of e.matchAll(/\$([a-zA-Z_]\w*)/g)) {
1059
+ const i = a[1];
1060
+ !t.has(i) && !s.includes(i) && s.push(i);
740
1061
  }
741
- return a;
742
- }
743
- function Jl(t) {
744
- const l = Ht(t), o = [];
745
- for (const a of l.matchAll(/([^{};]+)\{/g)) {
746
- const s = a[1], r = s.trim();
747
- if (!(r === "" || r.startsWith("@")))
748
- for (const n of s.split(",")) {
749
- const b = n.trim();
750
- b === "" || b === "from" || b === "to" || b.endsWith("%") || o.push([b, jt(l, a.index + s.indexOf(b))]);
1062
+ return s;
1063
+ }
1064
+ function Tn(e) {
1065
+ const n = Xt(e), t = [];
1066
+ for (const s of n.matchAll(/([^{};]+)\{/g)) {
1067
+ const a = s[1], i = a.trim();
1068
+ if (!(i === "" || i.startsWith("@")))
1069
+ for (const o of a.split(",")) {
1070
+ const r = o.trim();
1071
+ r === "" || r === "from" || r === "to" || r.endsWith("%") || t.push([r, el(n, s.index + a.indexOf(r))]);
751
1072
  }
752
1073
  }
753
- return o;
1074
+ return t;
754
1075
  }
755
- function Ht(t) {
756
- return t.replace(/\/\*[\s\S]*?\*\//g, (l) => l.replace(/[^\n]/g, " "));
1076
+ function Xt(e) {
1077
+ return e.replace(/\/\*[\s\S]*?\*\//g, (n) => n.replace(/[^\n]/g, " "));
757
1078
  }
758
- function jt(t, l) {
759
- return t.slice(0, Math.max(0, l)).split(`
1079
+ function el(e, n) {
1080
+ return e.slice(0, Math.max(0, n)).split(`
760
1081
  `).length;
761
1082
  }
762
- function wt(t) {
763
- const l = [...new Set(t.map(([o]) => o))];
764
- return l.slice(0, 3).join(", ") + (l.length > 3 ? ", …" : "");
1083
+ function Tt(e) {
1084
+ const n = [...new Set(e.map(([t]) => t))];
1085
+ return n.slice(0, 3).join(", ") + (n.length > 3 ? ", …" : "");
765
1086
  }
766
- function st(t) {
767
- return t.map((l) => ({
768
- ...l,
769
- name: l.name ?? l.id,
770
- children: l.children ? st(l.children) : l.children
1087
+ function pt(e) {
1088
+ return e.map((n) => ({
1089
+ ...n,
1090
+ name: n.name ?? n.id,
1091
+ children: n.children ? pt(n.children) : n.children
771
1092
  }));
772
1093
  }
773
- function nt(t, l) {
774
- return t === 0 ? l("page.not-used") : t === 1 ? l("page.on-page") : l("page.on-pages", { count: t });
1094
+ function rt(e, n) {
1095
+ return e === 0 ? n("page.not-used") : e === 1 ? n("page.on-page") : n("page.on-pages", { count: e });
775
1096
  }
776
- function ze(t, l) {
777
- const o = `groups.${t}`, a = l(o);
778
- return a === o || a === `webx-blocks::${o}` ? t.charAt(0).toUpperCase() + t.slice(1) : a;
1097
+ function De(e, n) {
1098
+ const t = `groups.${e}`, s = n(t);
1099
+ return s === t || s === `webx-blocks::${t}` ? e.charAt(0).toUpperCase() + e.slice(1) : s;
779
1100
  }
780
- const Kl = { class: "wx-block-editor" }, Gl = { class: "wx-block-editor__split" }, Yl = {
1101
+ const Cn = { class: "wx-block-editor" }, Vn = { class: "wx-block-editor__split" }, Bn = {
781
1102
  type: "button",
782
1103
  class: "wx-block-editor__uses"
783
- }, Zl = { class: "wx-block-editor__usage" }, Ql = { class: "wx-block-editor__pane" }, Xl = {
1104
+ }, An = { class: "wx-block-editor__usage" }, Ln = { class: "wx-block-editor__pane" }, Wn = {
784
1105
  key: 0,
785
1106
  class: "wx-block-editor__pills"
786
- }, en = ["disabled", "onClick", "textContent"], tn = { class: "wx-block-editor__pane" }, ln = { class: "wx-block-editor__pane" }, nn = { class: "wx-block-editor__note" }, an = { class: "wx-block-editor__split" }, on = { class: "wx-block-editor__pane" }, sn = { class: "wx-block-editor__note" }, rn = { class: "wx-block-editor__settings" }, un = {
1107
+ }, zn = ["disabled", "onClick", "textContent"], Dn = { class: "wx-block-editor__pane" }, Mn = { class: "wx-block-editor__pane" }, Nn = { class: "wx-block-editor__note" }, In = { class: "wx-block-editor__split" }, Pn = { class: "wx-block-editor__pane" }, On = { class: "wx-block-editor__note" }, Un = { class: "wx-block-editor__settings" }, Rn = {
787
1108
  key: 0,
788
1109
  class: "is-wide wx-block-editor__danger"
789
- }, cn = /* @__PURE__ */ ae({
1110
+ }, jn = /* @__PURE__ */ ae({
790
1111
  __name: "BlockEditorPage",
791
1112
  props: {
792
1113
  base: { default: "/blocks" }
793
1114
  },
794
- setup(t) {
795
- const l = t, o = Me(), a = Ae(o), s = tl(), r = Tt();
796
- Re();
797
- const n = de("webx-blocks"), b = De(), P = T(() => Number(s.params.id)), v = U(null), p = U([]), g = U(!0), f = U(!1), k = U(!1), C = U("template"), V = T(() => {
798
- const A = o.state.manifest?.modules.find((h) => h.id === "blocks")?.meta;
1115
+ setup(e) {
1116
+ const n = e, t = Re(), s = ze(t), a = dl(), i = Lt();
1117
+ He();
1118
+ const o = de("webx-blocks"), r = je(), m = V(() => Number(a.params.id)), c = I(null), d = I([]), p = I(!0), v = I(!1), g = I(!1), x = I("template"), T = V(() => {
1119
+ const L = t.state.manifest?.modules.find((k) => k.id === "blocks")?.meta;
799
1120
  return {
800
- groups: A?.groups ?? [],
801
- editing: A?.editing ?? !0,
802
- provides: A?.provides ?? []
1121
+ groups: L?.groups ?? [],
1122
+ editing: L?.editing ?? !0,
1123
+ provides: L?.provides ?? []
803
1124
  };
804
- }), x = T(() => o.can("blocks.manage") && V.value.editing), m = Qe({
1125
+ }), w = V(() => t.can("blocks.manage") && T.value.editing), y = nt({
805
1126
  slug: "",
806
1127
  title: "",
807
1128
  description: "",
@@ -812,194 +1133,205 @@ const Kl = { class: "wx-block-editor" }, Gl = { class: "wx-block-editor__split"
812
1133
  allowed_in: [],
813
1134
  max_per_entity: null,
814
1135
  is_enabled: !0
815
- }), y = Qe({
1136
+ }), _ = nt({
816
1137
  schema: [],
817
1138
  template: "",
818
1139
  styles: "",
819
1140
  script: null,
820
1141
  sample: {}
821
- }), R = U("[]"), q = U(null), J = U(""), Z = U({}), c = U(null), B = Qe({
1142
+ }), R = I("[]"), K = I(null), Y = I(""), X = I({}), h = I(null), A = nt({
822
1143
  html: "",
823
1144
  styles: "",
824
1145
  script: null,
825
1146
  runtime: null,
826
1147
  stage: null,
827
1148
  loading: !1
828
- }), D = T(() => JSON.stringify({ settings: m, content: y })), K = T(() => J.value !== "" && D.value !== J.value), Se = T(() => Fl(m.slug, y, n)), pe = T(() => {
829
- const A = [...V.value.groups];
830
- return A.includes(m.group) || A.push(m.group), A.map((h) => ({ value: h, label: ze(h, n) }));
831
- }), se = T({
832
- get: () => y.sample,
833
- set: (A) => {
834
- y.sample = A;
1149
+ }), P = V(() => JSON.stringify({ settings: y, content: _ })), J = V(() => Y.value !== "" && P.value !== Y.value), Se = V(() => Sn(y.slug, _, o)), ne = {
1150
+ template: [
1151
+ at(
1152
+ un({ schema: () => _.schema, styles: () => _.styles })
1153
+ )
1154
+ ],
1155
+ styles: [
1156
+ at(bn({ slug: () => y.slug, template: () => _.template }))
1157
+ ],
1158
+ // The renderer's own types under the panel's, the same merge the sample form is drawn with.
1159
+ schema: [at(kn({ types: () => ({ ...Je, ...t.types }) }))]
1160
+ }, pe = V(() => {
1161
+ const L = [...T.value.groups];
1162
+ return L.includes(y.group) || L.push(y.group), L.map((k) => ({ value: k, label: De(k, o) }));
1163
+ }), ye = V({
1164
+ get: () => _.sample,
1165
+ set: (L) => {
1166
+ _.sample = L;
835
1167
  }
836
- }), _e = T(() => Te(y.schema));
837
- function Te(A) {
838
- const h = [];
839
- for (const $ of A)
840
- $.type !== "wx-blocks" && !($.children?.length && !$.name) && h.push($.id), $.children && h.push(...Te($.children));
841
- return h;
842
- }
843
- function ke(A) {
844
- v.value = A, Object.assign(m, {
845
- slug: A.slug,
846
- title: A.title,
847
- description: A.description,
848
- icon: A.icon,
849
- group: A.group,
850
- sort: A.sort,
851
- allow: A.allow ?? [],
852
- allowed_in: A.allowed_in ?? [],
853
- max_per_entity: A.max_per_entity,
854
- is_enabled: A.is_enabled
1168
+ }), Ee = V(() => Te(_.schema));
1169
+ function Te(L) {
1170
+ const k = [];
1171
+ for (const E of L)
1172
+ E.type !== "wx-blocks" && !(E.children?.length && !E.name) && k.push(E.id), E.children && k.push(...Te(E.children));
1173
+ return k;
1174
+ }
1175
+ function Q(L) {
1176
+ c.value = L, Object.assign(y, {
1177
+ slug: L.slug,
1178
+ title: L.title,
1179
+ description: L.description,
1180
+ icon: L.icon,
1181
+ group: L.group,
1182
+ sort: L.sort,
1183
+ allow: L.allow ?? [],
1184
+ allowed_in: L.allowed_in ?? [],
1185
+ max_per_entity: L.max_per_entity,
1186
+ is_enabled: L.is_enabled
855
1187
  });
856
- const h = A.content ?? {
1188
+ const k = L.content ?? {
857
1189
  schema: [],
858
1190
  template: "",
859
1191
  styles: "",
860
1192
  script: null,
861
1193
  sample: {}
862
1194
  };
863
- Object.assign(y, ge(h)), R.value = JSON.stringify(h.schema, null, 2), q.value = null, J.value = D.value;
1195
+ Object.assign(_, be(k)), R.value = JSON.stringify(k.schema, null, 2), K.value = null, Y.value = P.value;
864
1196
  }
865
- async function te() {
866
- g.value = !0;
1197
+ async function ke() {
1198
+ p.value = !0;
867
1199
  try {
868
- ke(await a.get(P.value)), p.value = await a.usage(P.value);
869
- } catch (A) {
870
- G.danger(b(A));
1200
+ Q(await s.get(m.value)), d.value = await s.usage(m.value);
1201
+ } catch (L) {
1202
+ Z.danger(r(L));
871
1203
  } finally {
872
- g.value = !1;
1204
+ p.value = !1;
873
1205
  }
874
1206
  }
875
- function Ce(A) {
876
- R.value = A;
1207
+ function Ce(L) {
1208
+ R.value = L;
877
1209
  try {
878
- const h = JSON.parse(A);
879
- if (!Array.isArray(h)) throw new Error("not a list");
880
- y.schema = h, q.value = null;
881
- } catch (h) {
882
- q.value = n("page.schema-invalid", { error: h.message });
1210
+ const k = JSON.parse(L);
1211
+ if (!Array.isArray(k)) throw new Error("not a list");
1212
+ _.schema = k, K.value = null;
1213
+ } catch (k) {
1214
+ K.value = o("page.schema-invalid", { error: k.message });
883
1215
  }
884
1216
  }
885
- let ye, fe = 0;
886
- function z() {
887
- clearTimeout(ye), ye = setTimeout(() => {
888
- O();
1217
+ let ge, W = 0;
1218
+ function O() {
1219
+ clearTimeout(ge), ge = setTimeout(() => {
1220
+ j();
889
1221
  }, 250);
890
1222
  }
891
- async function O() {
892
- if (!v.value) return;
893
- const A = ++fe;
894
- B.loading = !0;
1223
+ async function j() {
1224
+ if (!c.value) return;
1225
+ const L = ++W;
1226
+ A.loading = !0;
895
1227
  try {
896
- const h = await a.render(v.value.id, {
897
- values: y.sample,
898
- content: x.value ? {
899
- template: y.template,
900
- styles: y.styles,
901
- script: y.script,
902
- schema: y.schema
1228
+ const k = await s.render(c.value.id, {
1229
+ values: _.sample,
1230
+ content: w.value ? {
1231
+ template: _.template,
1232
+ styles: _.styles,
1233
+ script: _.script,
1234
+ schema: _.schema
903
1235
  } : void 0
904
1236
  });
905
- if (A !== fe) return;
906
- B.html = h.html, B.styles = h.styles, B.script = h.script, B.runtime = h.runtime, B.stage = h.stage ?? null;
907
- } catch (h) {
908
- A === fe && G.danger(b(h));
1237
+ if (L !== W) return;
1238
+ A.html = k.html, A.styles = k.styles, A.script = k.script, A.runtime = k.runtime, A.stage = k.stage ?? null;
1239
+ } catch (k) {
1240
+ L === W && Z.danger(r(k));
909
1241
  } finally {
910
- A === fe && (B.loading = !1);
1242
+ L === W && (A.loading = !1);
911
1243
  }
912
1244
  }
913
- X(
914
- () => [y.template, y.styles, y.script, y.schema, y.sample],
915
- z,
1245
+ te(
1246
+ () => [_.template, _.styles, _.script, _.schema, _.sample],
1247
+ O,
916
1248
  { deep: !0 }
917
1249
  );
918
- const H = U(null);
919
- function Y(A) {
920
- return `{{ $${A} }}`;
921
- }
922
- function ve(A) {
923
- const $ = H.value?.view?.value;
924
- if (!$) {
925
- y.template += `{{ $${A} }}`;
1250
+ const G = I(null);
1251
+ function fe(L) {
1252
+ return `{{ $${L} }}`;
1253
+ }
1254
+ function we(L) {
1255
+ const E = G.value?.view?.value;
1256
+ if (!E) {
1257
+ _.template += `{{ $${L} }}`;
926
1258
  return;
927
1259
  }
928
- $.dispatch($.state.replaceSelection(`{{ $${A} }}`)), $.focus();
1260
+ E.dispatch(E.state.replaceSelection(`{{ $${L} }}`)), E.focus();
929
1261
  }
930
- async function me() {
931
- if (!v.value) return;
932
- f.value = !0, Z.value = {}, c.value = null;
933
- const A = v.value.draft?.number ?? null;
1262
+ async function se() {
1263
+ if (!c.value) return;
1264
+ v.value = !0, X.value = {}, h.value = null;
1265
+ const L = c.value.draft?.number ?? null;
934
1266
  try {
935
- const h = await a.update(v.value.id, {
936
- ...m,
937
- allow: m.allow.length ? m.allow : null,
938
- allowed_in: m.allowed_in.length ? m.allowed_in : null,
939
- description: m.description || null,
940
- icon: m.icon || null,
941
- content: q.value ? { ...y, schema: void 0 } : y
1267
+ const k = await s.update(c.value.id, {
1268
+ ...y,
1269
+ allow: y.allow.length ? y.allow : null,
1270
+ allowed_in: y.allowed_in.length ? y.allowed_in : null,
1271
+ description: y.description || null,
1272
+ icon: y.icon || null,
1273
+ content: K.value ? { ..._, schema: void 0 } : _
942
1274
  });
943
- ke(h), G.success(
944
- h.draft && h.draft.number !== A ? n("page.saved", { number: h.draft.number }) : n("page.unchanged")
1275
+ Q(k), Z.success(
1276
+ k.draft && k.draft.number !== L ? o("page.saved", { number: k.draft.number }) : o("page.unchanged")
945
1277
  );
946
- } catch (h) {
947
- const $ = h.body;
948
- $?.errors ? (Z.value = $.errors, G.danger(n("page.failed"))) : G.danger(b(h, n("page.failed")));
1278
+ } catch (k) {
1279
+ const E = k.body;
1280
+ E?.errors ? (X.value = E.errors, Z.danger(o("page.failed"))) : Z.danger(r(k, o("page.failed")));
949
1281
  } finally {
950
- f.value = !1;
1282
+ v.value = !1;
951
1283
  }
952
1284
  }
953
- async function ie() {
954
- if (!(!v.value?.draft || (K.value && await me(), !v.value.draft) || !await Ke({
955
- title: n("page.publish-title", { number: v.value.draft.number }),
956
- message: n("page.publish-text", { count: v.value.usage_count }),
957
- confirmText: n("page.publish"),
958
- cancelText: n("page.cancel")
1285
+ async function ve() {
1286
+ if (!(!c.value?.draft || (J.value && await se(), !c.value.draft) || !await Ze({
1287
+ title: o("page.publish-title", { number: c.value.draft.number }),
1288
+ message: o("page.publish-text", { count: c.value.usage_count }),
1289
+ confirmText: o("page.publish"),
1290
+ cancelText: o("page.cancel")
959
1291
  }))) {
960
- k.value = !0, c.value = null;
1292
+ g.value = !0, h.value = null;
961
1293
  try {
962
- ke(await a.publish(v.value.id)), G.success(n("page.published", { number: v.value.published?.number ?? 0 }));
963
- } catch (h) {
964
- const $ = h.body;
965
- $?.errors ? (c.value = $, C.value = "template", G.danger(n("page.publish-failed"))) : G.danger(b(h, n("page.publish-failed")));
1294
+ Q(await s.publish(c.value.id)), Z.success(o("page.published", { number: c.value.published?.number ?? 0 }));
1295
+ } catch (k) {
1296
+ const E = k.body;
1297
+ E?.errors ? (h.value = E, x.value = "template", Z.danger(o("page.publish-failed"))) : Z.danger(r(k, o("page.publish-failed")));
966
1298
  } finally {
967
- k.value = !1;
1299
+ g.value = !1;
968
1300
  }
969
1301
  }
970
1302
  }
971
- async function we() {
972
- if (!(!v.value || !await Ke({
973
- title: n("page.delete-title", { title: v.value.title }),
974
- message: n("page.delete-text"),
975
- confirmText: n("page.delete"),
976
- cancelText: n("page.cancel"),
1303
+ async function Ve() {
1304
+ if (!(!c.value || !await Ze({
1305
+ title: o("page.delete-title", { title: c.value.title }),
1306
+ message: o("page.delete-text"),
1307
+ confirmText: o("page.delete"),
1308
+ cancelText: o("page.cancel"),
977
1309
  tone: "danger"
978
1310
  })))
979
1311
  try {
980
- await a.remove(v.value.id), G.success(n("page.deleted")), r.push(l.base);
981
- } catch (h) {
982
- G.danger(b(h));
1312
+ await s.remove(c.value.id), Z.success(o("page.deleted")), i.push(n.base);
1313
+ } catch (k) {
1314
+ Z.danger(r(k));
983
1315
  }
984
1316
  }
985
- const Ve = T(
986
- () => c.value ? {
987
- message: c.value.errors.template?.[0] ?? c.value.message,
988
- line: c.value.line,
989
- where: c.value.entity ? n("page.failed-on", {
990
- title: c.value.entity.title ?? `#${c.value.entity.id}`
1317
+ const Me = V(
1318
+ () => h.value ? {
1319
+ message: h.value.errors.template?.[0] ?? h.value.message,
1320
+ line: h.value.line,
1321
+ where: h.value.entity ? o("page.failed-on", {
1322
+ title: h.value.entity.title ?? `#${h.value.entity.id}`
991
1323
  }) : null
992
1324
  } : null
993
- ), Ee = T(() => C.value === "template" || C.value === "styles"), w = T(() => [
1325
+ ), $ = V(() => x.value === "template" || x.value === "styles"), D = V(() => [
994
1326
  {
995
- title: n("page.example-handler"),
1327
+ title: o("page.example-handler"),
996
1328
  code: `el.querySelector('.b-hero__button')?.addEventListener('click', (event) => {
997
1329
  event.preventDefault()
998
1330
  el.classList.toggle('is-open')
999
1331
  })`
1000
1332
  },
1001
1333
  {
1002
- title: n("page.example-values"),
1334
+ title: o("page.example-values"),
1003
1335
  /* The one thing the sentence above the examples does not say: values reach the script
1004
1336
  only through the attribute, and a template that never prints it hands over `{}`. */
1005
1337
  code: `// <section data-wx-values="{{ json_encode($block->values) }}">
@@ -1008,304 +1340,306 @@ const seconds = Number(values.delay ?? 5)
1008
1340
  setInterval(() => el.classList.toggle('is-second'), seconds * 1000)`
1009
1341
  },
1010
1342
  {
1011
- title: n("page.example-provided"),
1343
+ title: o("page.example-provided"),
1012
1344
  code: `const Swiper = await webx.use('swiper')
1013
1345
 
1014
1346
  new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1015
1347
  }
1016
- ]), L = T(() => p.value.slice(0, 5));
1017
- function M(A) {
1018
- return Z.value[A]?.[0];
1348
+ ]), U = V(() => d.value.slice(0, 5));
1349
+ function H(L) {
1350
+ return X.value[L]?.[0];
1019
1351
  }
1020
- function Q(A) {
1021
- K.value && A.preventDefault();
1352
+ function ee(L) {
1353
+ J.value && L.preventDefault();
1022
1354
  }
1023
1355
  Ue(() => {
1024
- te(), window.addEventListener("beforeunload", Q);
1025
- }), Ge(() => {
1026
- clearTimeout(ye), window.removeEventListener("beforeunload", Q);
1027
- }), X(P, () => {
1028
- te();
1356
+ ke(), window.addEventListener("beforeunload", ee);
1357
+ }), Qe(() => {
1358
+ clearTimeout(ge), window.removeEventListener("beforeunload", ee);
1359
+ }), te(m, () => {
1360
+ ke();
1029
1361
  });
1030
- const le = T(
1031
- () => x.value ? [
1032
- { key: "save", label: n("page.save"), loading: f.value, run: () => {
1033
- me();
1362
+ const tt = V(
1363
+ () => w.value ? [
1364
+ { key: "save", label: o("page.save"), loading: v.value, run: () => {
1365
+ se();
1034
1366
  } },
1035
1367
  {
1036
1368
  key: "publish",
1037
- label: n("page.publish"),
1369
+ label: o("page.publish"),
1038
1370
  primary: !0,
1039
- loading: k.value,
1040
- disabled: !v.value?.draft && !K.value,
1371
+ loading: g.value,
1372
+ disabled: !c.value?.draft && !J.value,
1041
1373
  run: () => {
1042
- ie();
1374
+ ve();
1043
1375
  }
1044
1376
  }
1045
1377
  ] : []
1046
1378
  );
1047
- return (A, h) => (i(), S("div", Kl, [
1048
- g.value || !v.value ? (i(), S(j, { key: 0 }, [
1049
- u(e(We), {
1379
+ return (L, k) => (u(), C("div", Cn, [
1380
+ p.value || !c.value ? (u(), C(F, { key: 0 }, [
1381
+ f(l(Le), {
1050
1382
  class: "wx-block-editor__ghost-head",
1051
1383
  title: "",
1052
1384
  rows: 1
1053
1385
  }),
1054
- E("div", Gl, [
1055
- u(e(Be), null, {
1056
- default: d(() => [
1057
- u(e(We), { rows: 8 })
1386
+ B("div", Vn, [
1387
+ f(l(Be), null, {
1388
+ default: b(() => [
1389
+ f(l(Le), { rows: 8 })
1058
1390
  ]),
1059
1391
  _: 1
1060
1392
  }),
1061
- u(e(Be), null, {
1062
- default: d(() => [
1063
- u(e(We), { rows: 4 })
1393
+ f(l(Be), null, {
1394
+ default: b(() => [
1395
+ f(l(Le), { rows: 4 })
1064
1396
  ]),
1065
1397
  _: 1
1066
1398
  })
1067
1399
  ])
1068
- ], 64)) : (i(), S(j, { key: 1 }, [
1069
- u(e(nl), {
1070
- title: m.title,
1071
- back: t.base,
1072
- "back-label": e(n)("page.back"),
1073
- actions: le.value
1400
+ ], 64)) : (u(), C(F, { key: 1 }, [
1401
+ f(l(fl), {
1402
+ title: y.title,
1403
+ back: e.base,
1404
+ "back-label": l(o)("page.back"),
1405
+ actions: tt.value
1074
1406
  }, {
1075
- "title-after": d(() => [
1076
- x.value ? (i(), I(e(al), {
1407
+ "title-after": b(() => [
1408
+ w.value ? (u(), M(l(vl), {
1077
1409
  key: 0,
1078
- name: m.title,
1079
- placeholder: e(n)("page.title"),
1080
- onRename: h[0] || (h[0] = ($) => m.title = $)
1410
+ name: y.title,
1411
+ placeholder: l(o)("page.title"),
1412
+ onRename: k[0] || (k[0] = (E) => y.title = E)
1081
1413
  }, null, 8, ["name", "placeholder"])) : N("", !0),
1082
- K.value ? (i(), I(e(ue), {
1414
+ J.value ? (u(), M(l(ue), {
1083
1415
  key: 1,
1084
1416
  type: "primary",
1085
1417
  dot: ""
1086
1418
  }, {
1087
- default: d(() => [
1088
- W(_(e(n)("page.unsaved")), 1)
1419
+ default: b(() => [
1420
+ z(S(l(o)("page.unsaved")), 1)
1089
1421
  ]),
1090
1422
  _: 1
1091
1423
  })) : N("", !0),
1092
- v.value.draft ? (i(), I(e(ue), {
1424
+ c.value.draft ? (u(), M(l(ue), {
1093
1425
  key: 2,
1094
1426
  type: "warning",
1095
1427
  dot: ""
1096
1428
  }, {
1097
- default: d(() => [
1098
- W(_(e(n)("page.draft", { number: v.value.draft.number })), 1)
1429
+ default: b(() => [
1430
+ z(S(l(o)("page.draft", { number: c.value.draft.number })), 1)
1099
1431
  ]),
1100
1432
  _: 1
1101
1433
  })) : N("", !0),
1102
- v.value.published ? (i(), I(e(ue), {
1434
+ c.value.published ? (u(), M(l(ue), {
1103
1435
  key: 3,
1104
1436
  type: "success",
1105
1437
  dot: ""
1106
1438
  }, {
1107
- default: d(() => [
1108
- W(_(e(n)("page.live", { number: v.value.published.number })), 1)
1439
+ default: b(() => [
1440
+ z(S(l(o)("page.live", { number: c.value.published.number })), 1)
1109
1441
  ]),
1110
1442
  _: 1
1111
- })) : (i(), I(e(ue), {
1443
+ })) : (u(), M(l(ue), {
1112
1444
  key: 4,
1113
1445
  type: "default"
1114
1446
  }, {
1115
- default: d(() => [
1116
- W(_(e(n)("page.never-published")), 1)
1447
+ default: b(() => [
1448
+ z(S(l(o)("page.never-published")), 1)
1117
1449
  ]),
1118
1450
  _: 1
1119
1451
  }))
1120
1452
  ]),
1121
- subtitle: d(() => [
1122
- E("code", null, _(m.slug), 1),
1123
- W(" · " + _(e(ze)(m.group, e(n))) + " · ", 1),
1124
- v.value.usage_count > 0 ? (i(), I(e(ul), {
1453
+ subtitle: b(() => [
1454
+ B("code", null, S(y.slug), 1),
1455
+ z(" · " + S(l(De)(y.group, l(o))) + " · ", 1),
1456
+ c.value.usage_count > 0 ? (u(), M(l(yl), {
1125
1457
  key: 0,
1126
- title: e(n)("page.usage"),
1458
+ title: l(o)("page.usage"),
1127
1459
  width: 260,
1128
1460
  align: "start"
1129
1461
  }, {
1130
- trigger: d(() => [
1131
- E("button", Yl, _(e(nt)(v.value.usage_count, e(n))), 1)
1462
+ trigger: b(() => [
1463
+ B("button", Bn, S(l(rt)(c.value.usage_count, l(o))), 1)
1132
1464
  ]),
1133
- default: d(() => [
1134
- E("div", Zl, [
1135
- (i(!0), S(j, null, ee(L.value, ($) => (i(), S("div", {
1136
- key: `${$.model}:${$.id}`,
1465
+ default: b(() => [
1466
+ B("div", An, [
1467
+ (u(!0), C(F, null, le(U.value, (E) => (u(), C("div", {
1468
+ key: `${E.model}:${E.id}`,
1137
1469
  class: "wx-block-editor__use"
1138
1470
  }, [
1139
- E("span", null, _($.title ?? `#${$.id}`), 1),
1140
- $.published ? N("", !0) : (i(), I(e(ue), {
1471
+ B("span", null, S(E.title ?? `#${E.id}`), 1),
1472
+ E.published ? N("", !0) : (u(), M(l(ue), {
1141
1473
  key: 0,
1142
1474
  type: "warning",
1143
1475
  size: "sm"
1144
1476
  }, {
1145
- default: d(() => [
1146
- W(_(e(n)("page.unpublished-page")), 1)
1477
+ default: b(() => [
1478
+ z(S(l(o)("page.unpublished-page")), 1)
1147
1479
  ]),
1148
1480
  _: 1
1149
1481
  }))
1150
1482
  ]))), 128)),
1151
- p.value.length > L.value.length ? (i(), I(e(F), {
1483
+ d.value.length > U.value.length ? (u(), M(l(q), {
1152
1484
  key: 0,
1153
1485
  size: "sm",
1154
1486
  tone: "muted"
1155
1487
  }, {
1156
- default: d(() => [
1157
- W(_(e(n)("page.usage-more", { count: p.value.length - L.value.length })), 1)
1488
+ default: b(() => [
1489
+ z(S(l(o)("page.usage-more", { count: d.value.length - U.value.length })), 1)
1158
1490
  ]),
1159
1491
  _: 1
1160
1492
  })) : N("", !0)
1161
1493
  ])
1162
1494
  ]),
1163
1495
  _: 1
1164
- }, 8, ["title"])) : (i(), S(j, { key: 1 }, [
1165
- W(_(e(nt)(v.value.usage_count, e(n))), 1)
1496
+ }, 8, ["title"])) : (u(), C(F, { key: 1 }, [
1497
+ z(S(l(rt)(c.value.usage_count, l(o))), 1)
1166
1498
  ], 64))
1167
1499
  ]),
1168
1500
  _: 1
1169
1501
  }, 8, ["title", "back", "back-label", "actions"]),
1170
- V.value.editing ? N("", !0) : (i(), I(e(Vt), {
1502
+ T.value.editing ? N("", !0) : (u(), M(l(zt), {
1171
1503
  key: 0,
1172
1504
  type: "info",
1173
1505
  variant: "soft",
1174
- description: e(n)("page.editing-off")
1506
+ description: l(o)("page.editing-off")
1175
1507
  }, null, 8, ["description"])),
1176
- E("div", {
1177
- class: $e(["wx-block-editor__columns", { "is-alone": !Ee.value }])
1508
+ B("div", {
1509
+ class: $e(["wx-block-editor__columns", { "is-alone": !$.value }])
1178
1510
  }, [
1179
- u(e(cl), {
1180
- modelValue: C.value,
1181
- "onUpdate:modelValue": h[14] || (h[14] = ($) => C.value = $),
1511
+ f(l(kl), {
1512
+ modelValue: x.value,
1513
+ "onUpdate:modelValue": k[14] || (k[14] = (E) => x.value = E),
1182
1514
  "keep-alive": ""
1183
1515
  }, {
1184
- default: d(() => [
1185
- u(e(Le), {
1516
+ default: b(() => [
1517
+ f(l(Ae), {
1186
1518
  value: "template",
1187
- label: e(n)("page.tab-template")
1519
+ label: l(o)("page.tab-template")
1188
1520
  }, {
1189
- default: d(() => [
1190
- E("div", Ql, [
1191
- u(e(je), {
1521
+ default: b(() => [
1522
+ B("div", Ln, [
1523
+ f(l(qe), {
1192
1524
  ref_key: "templateEditor",
1193
- ref: H,
1194
- modelValue: y.template,
1195
- "onUpdate:modelValue": h[1] || (h[1] = ($) => y.template = $),
1525
+ ref: G,
1526
+ modelValue: _.template,
1527
+ "onUpdate:modelValue": k[1] || (k[1] = (E) => _.template = E),
1196
1528
  language: "php",
1197
- readonly: !x.value,
1529
+ extensions: ne.template,
1530
+ readonly: !w.value,
1198
1531
  "min-height": "340px",
1199
1532
  "max-height": "70vh",
1200
1533
  "line-wrapping": ""
1201
- }, null, 8, ["modelValue", "readonly"]),
1202
- _e.value.length ? (i(), S("div", Xl, [
1203
- u(e(F), {
1534
+ }, null, 8, ["modelValue", "extensions", "readonly"]),
1535
+ Ee.value.length ? (u(), C("div", Wn, [
1536
+ f(l(q), {
1204
1537
  size: "sm",
1205
1538
  tone: "muted"
1206
1539
  }, {
1207
- default: d(() => [
1208
- W(_(e(n)("page.insert-field")), 1)
1540
+ default: b(() => [
1541
+ z(S(l(o)("page.insert-field")), 1)
1209
1542
  ]),
1210
1543
  _: 1
1211
1544
  }),
1212
- (i(!0), S(j, null, ee(_e.value, ($) => (i(), S("button", {
1213
- key: $,
1545
+ (u(!0), C(F, null, le(Ee.value, (E) => (u(), C("button", {
1546
+ key: E,
1214
1547
  type: "button",
1215
1548
  class: "wx-block-editor__pill",
1216
- disabled: !x.value,
1217
- onClick: (He) => ve($),
1218
- textContent: _(Y($))
1219
- }, null, 8, en))), 128))
1549
+ disabled: !w.value,
1550
+ onClick: (lt) => we(E),
1551
+ textContent: S(fe(E))
1552
+ }, null, 8, zn))), 128))
1220
1553
  ])) : N("", !0),
1221
- u(vt, {
1554
+ f(gt, {
1222
1555
  file: "template",
1223
1556
  lints: Se.value,
1224
- slug: m.slug,
1225
- error: Ve.value
1557
+ slug: y.slug,
1558
+ error: Me.value
1226
1559
  }, null, 8, ["lints", "slug", "error"])
1227
1560
  ])
1228
1561
  ]),
1229
1562
  _: 1
1230
1563
  }, 8, ["label"]),
1231
- u(e(Le), {
1564
+ f(l(Ae), {
1232
1565
  value: "styles",
1233
- label: e(n)("page.tab-styles")
1566
+ label: l(o)("page.tab-styles")
1234
1567
  }, {
1235
- default: d(() => [
1236
- E("div", tn, [
1237
- u(e(je), {
1238
- modelValue: y.styles,
1239
- "onUpdate:modelValue": h[2] || (h[2] = ($) => y.styles = $),
1568
+ default: b(() => [
1569
+ B("div", Dn, [
1570
+ f(l(qe), {
1571
+ modelValue: _.styles,
1572
+ "onUpdate:modelValue": k[2] || (k[2] = (E) => _.styles = E),
1240
1573
  language: "css",
1241
- readonly: !x.value,
1574
+ extensions: ne.styles,
1575
+ readonly: !w.value,
1242
1576
  "min-height": "340px",
1243
1577
  "max-height": "70vh"
1244
- }, null, 8, ["modelValue", "readonly"]),
1245
- u(vt, {
1578
+ }, null, 8, ["modelValue", "extensions", "readonly"]),
1579
+ f(gt, {
1246
1580
  file: "styles",
1247
1581
  lints: Se.value,
1248
- slug: m.slug
1582
+ slug: y.slug
1249
1583
  }, null, 8, ["lints", "slug"])
1250
1584
  ])
1251
1585
  ]),
1252
1586
  _: 1
1253
1587
  }, 8, ["label"]),
1254
- u(e(Le), {
1588
+ f(l(Ae), {
1255
1589
  value: "script",
1256
- label: e(n)("page.tab-script")
1590
+ label: l(o)("page.tab-script")
1257
1591
  }, {
1258
- default: d(() => [
1259
- E("div", ln, [
1260
- u(e(je), {
1261
- "model-value": y.script ?? "",
1592
+ default: b(() => [
1593
+ B("div", Mn, [
1594
+ f(l(qe), {
1595
+ "model-value": _.script ?? "",
1262
1596
  language: "javascript",
1263
- readonly: !x.value,
1597
+ readonly: !w.value,
1264
1598
  "min-height": "340px",
1265
1599
  "max-height": "70vh",
1266
- "onUpdate:modelValue": h[3] || (h[3] = ($) => y.script = $ || null)
1600
+ "onUpdate:modelValue": k[3] || (k[3] = (E) => _.script = E || null)
1267
1601
  }, null, 8, ["model-value", "readonly"]),
1268
- E("div", nn, [
1269
- u(e(F), {
1602
+ B("div", Nn, [
1603
+ f(l(q), {
1270
1604
  size: "sm",
1271
1605
  tone: "muted"
1272
1606
  }, {
1273
- default: d(() => [
1274
- W(_(e(n)("page.script-help")), 1)
1607
+ default: b(() => [
1608
+ z(S(l(o)("page.script-help")), 1)
1275
1609
  ]),
1276
1610
  _: 1
1277
1611
  }),
1278
- u(e(F), {
1612
+ f(l(q), {
1279
1613
  size: "sm",
1280
1614
  tone: "muted"
1281
1615
  }, {
1282
- default: d(() => [
1283
- W(_(V.value.provides.length ? e(n)("page.provides", { names: V.value.provides.join(", ") }) : e(n)("page.provides-none")), 1)
1616
+ default: b(() => [
1617
+ z(S(T.value.provides.length ? l(o)("page.provides", { names: T.value.provides.join(", ") }) : l(o)("page.provides-none")), 1)
1284
1618
  ]),
1285
1619
  _: 1
1286
1620
  })
1287
1621
  ])
1288
1622
  ]),
1289
- u(e(Be), {
1623
+ f(l(Be), {
1290
1624
  class: "wx-block-editor__examples",
1291
- title: e(n)("page.examples")
1625
+ title: l(o)("page.examples")
1292
1626
  }, {
1293
- default: d(() => [
1294
- (i(!0), S(j, null, ee(w.value, ($) => (i(), S("div", {
1295
- key: $.title,
1627
+ default: b(() => [
1628
+ (u(!0), C(F, null, le(D.value, (E) => (u(), C("div", {
1629
+ key: E.title,
1296
1630
  class: "wx-block-editor__example"
1297
1631
  }, [
1298
- u(e(F), {
1632
+ f(l(q), {
1299
1633
  size: "sm",
1300
1634
  tone: "muted"
1301
1635
  }, {
1302
- default: d(() => [
1303
- W(_($.title), 1)
1636
+ default: b(() => [
1637
+ z(S(E.title), 1)
1304
1638
  ]),
1305
1639
  _: 2
1306
1640
  }, 1024),
1307
- E("pre", null, [
1308
- E("code", null, _($.code), 1)
1641
+ B("pre", null, [
1642
+ B("code", null, S(E.code), 1)
1309
1643
  ])
1310
1644
  ]))), 128))
1311
1645
  ]),
@@ -1314,71 +1648,72 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1314
1648
  ]),
1315
1649
  _: 1
1316
1650
  }, 8, ["label"]),
1317
- u(e(Le), {
1651
+ f(l(Ae), {
1318
1652
  value: "fields",
1319
- label: e(n)("page.tab-fields")
1653
+ label: l(o)("page.tab-fields")
1320
1654
  }, {
1321
- default: d(() => [
1322
- E("div", an, [
1323
- E("div", on, [
1324
- u(e(je), {
1655
+ default: b(() => [
1656
+ B("div", In, [
1657
+ B("div", Pn, [
1658
+ f(l(qe), {
1325
1659
  "model-value": R.value,
1326
1660
  language: "json",
1661
+ extensions: ne.schema,
1327
1662
  lint: "",
1328
- readonly: !x.value,
1663
+ readonly: !w.value,
1329
1664
  "min-height": "340px",
1330
1665
  "max-height": "70vh",
1331
1666
  "onUpdate:modelValue": Ce
1332
- }, null, 8, ["model-value", "readonly"]),
1333
- E("div", sn, [
1334
- q.value ? (i(), I(e(F), {
1667
+ }, null, 8, ["model-value", "extensions", "readonly"]),
1668
+ B("div", On, [
1669
+ K.value ? (u(), M(l(q), {
1335
1670
  key: 0,
1336
1671
  size: "sm",
1337
1672
  tone: "danger"
1338
1673
  }, {
1339
- default: d(() => [
1340
- W(_(q.value), 1)
1674
+ default: b(() => [
1675
+ z(S(K.value), 1)
1341
1676
  ]),
1342
1677
  _: 1
1343
- })) : M("content.schema") ? (i(), I(e(F), {
1678
+ })) : H("content.schema") ? (u(), M(l(q), {
1344
1679
  key: 1,
1345
1680
  size: "sm",
1346
1681
  tone: "danger"
1347
1682
  }, {
1348
- default: d(() => [
1349
- W(_(M("content.schema")), 1)
1683
+ default: b(() => [
1684
+ z(S(H("content.schema")), 1)
1350
1685
  ]),
1351
1686
  _: 1
1352
- })) : (i(), I(e(F), {
1687
+ })) : (u(), M(l(q), {
1353
1688
  key: 2,
1354
1689
  size: "sm",
1355
1690
  tone: "muted"
1356
1691
  }, {
1357
- default: d(() => [
1358
- W(_(e(n)("page.fields-help")), 1)
1692
+ default: b(() => [
1693
+ z(S(l(o)("page.fields-help")), 1)
1359
1694
  ]),
1360
1695
  _: 1
1361
1696
  })),
1362
- u(e(ol), {
1363
- title: e(n)("help.schema-title"),
1364
- body: e(n)("help.schema")
1697
+ f(l(ml), {
1698
+ title: l(o)("help.schema-title"),
1699
+ body: l(o)("help.schema")
1365
1700
  }, null, 8, ["title", "body"])
1366
1701
  ])
1367
1702
  ]),
1368
- u(e(Be), {
1703
+ f(l(Be), {
1369
1704
  class: "wx-block-editor__sample",
1370
- title: e(n)("page.sample")
1705
+ title: l(o)("page.sample")
1371
1706
  }, {
1372
- default: d(() => [
1373
- y.schema.length ? (i(), I(e(zt), {
1707
+ default: b(() => [
1708
+ _.schema.length ? (u(), M(l(Ot), {
1374
1709
  key: 0,
1375
- modelValue: se.value,
1376
- "onUpdate:modelValue": h[4] || (h[4] = ($) => se.value = $),
1377
- root: e(st)(y.schema),
1378
- types: e(o).types,
1379
- translate: e(o).i18n.t,
1380
- can: e(o).can,
1381
- disabled: !x.value,
1710
+ modelValue: ye.value,
1711
+ "onUpdate:modelValue": k[4] || (k[4] = (E) => ye.value = E),
1712
+ root: l(pt)(_.schema),
1713
+ types: l(t).types,
1714
+ translate: l(t).i18n.t,
1715
+ can: l(t).can,
1716
+ disabled: !w.value,
1382
1717
  size: "sm"
1383
1718
  }, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : N("", !0)
1384
1719
  ]),
@@ -1388,169 +1723,169 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1388
1723
  ]),
1389
1724
  _: 1
1390
1725
  }, 8, ["label"]),
1391
- u(e(Le), {
1726
+ f(l(Ae), {
1392
1727
  value: "settings",
1393
- label: e(n)("page.tab-settings")
1728
+ label: l(o)("page.tab-settings")
1394
1729
  }, {
1395
- default: d(() => [
1396
- u(e(Be), { class: "wx-block-editor__sheet" }, {
1397
- default: d(() => [
1398
- E("div", rn, [
1399
- u(e(ne), {
1400
- label: e(n)("page.identifier"),
1401
- help: e(n)("page.identifier-help"),
1402
- error: M("slug"),
1403
- disabled: !x.value
1730
+ default: b(() => [
1731
+ f(l(Be), { class: "wx-block-editor__sheet" }, {
1732
+ default: b(() => [
1733
+ B("div", Un, [
1734
+ f(l(oe), {
1735
+ label: l(o)("page.identifier"),
1736
+ help: l(o)("page.identifier-help"),
1737
+ error: H("slug"),
1738
+ disabled: !w.value
1404
1739
  }, {
1405
- default: d(() => [
1406
- u(e(Pe), {
1407
- modelValue: m.slug,
1408
- "onUpdate:modelValue": h[5] || (h[5] = ($) => m.slug = $)
1740
+ default: b(() => [
1741
+ f(l(Oe), {
1742
+ modelValue: y.slug,
1743
+ "onUpdate:modelValue": k[5] || (k[5] = (E) => y.slug = E)
1409
1744
  }, null, 8, ["modelValue"])
1410
1745
  ]),
1411
1746
  _: 1
1412
1747
  }, 8, ["label", "help", "error", "disabled"]),
1413
- u(e(ne), {
1414
- label: e(n)("page.group"),
1415
- help: e(n)("page.group-help"),
1416
- error: M("group"),
1417
- disabled: !x.value
1748
+ f(l(oe), {
1749
+ label: l(o)("page.group"),
1750
+ help: l(o)("page.group-help"),
1751
+ error: H("group"),
1752
+ disabled: !w.value
1418
1753
  }, {
1419
- default: d(() => [
1420
- u(e(Et), {
1421
- modelValue: m.group,
1422
- "onUpdate:modelValue": h[6] || (h[6] = ($) => m.group = $),
1754
+ default: b(() => [
1755
+ f(l(Dt), {
1756
+ modelValue: y.group,
1757
+ "onUpdate:modelValue": k[6] || (k[6] = (E) => y.group = E),
1423
1758
  options: pe.value
1424
1759
  }, null, 8, ["modelValue", "options"])
1425
1760
  ]),
1426
1761
  _: 1
1427
1762
  }, 8, ["label", "help", "error", "disabled"]),
1428
- u(e(ne), {
1763
+ f(l(oe), {
1429
1764
  class: "is-wide",
1430
- label: e(n)("page.description"),
1431
- help: e(n)("page.description-help"),
1432
- error: M("description"),
1433
- disabled: !x.value
1765
+ label: l(o)("page.description"),
1766
+ help: l(o)("page.description-help"),
1767
+ error: H("description"),
1768
+ disabled: !w.value
1434
1769
  }, {
1435
- default: d(() => [
1436
- u(e(dl), {
1437
- "model-value": m.description ?? "",
1770
+ default: b(() => [
1771
+ f(l(wl), {
1772
+ "model-value": y.description ?? "",
1438
1773
  rows: 2,
1439
- "onUpdate:modelValue": h[7] || (h[7] = ($) => m.description = String($ ?? ""))
1774
+ "onUpdate:modelValue": k[7] || (k[7] = (E) => y.description = String(E ?? ""))
1440
1775
  }, null, 8, ["model-value"])
1441
1776
  ]),
1442
1777
  _: 1
1443
1778
  }, 8, ["label", "help", "error", "disabled"]),
1444
- u(e(ne), {
1445
- label: e(n)("page.icon"),
1446
- error: M("icon"),
1447
- disabled: !x.value
1779
+ f(l(oe), {
1780
+ label: l(o)("page.icon"),
1781
+ error: H("icon"),
1782
+ disabled: !w.value
1448
1783
  }, {
1449
- default: d(() => [
1450
- u(e(pl), {
1451
- "model-value": m.icon,
1784
+ default: b(() => [
1785
+ f(l(_l), {
1786
+ "model-value": y.icon,
1452
1787
  clearable: "",
1453
- placeholder: e(n)("page.icon-search"),
1454
- "empty-text": e(n)("page.icon-none"),
1455
- "unknown-text": e(n)("page.icon-unknown"),
1456
- "clear-label": e(n)("page.icon-clear"),
1457
- "onUpdate:modelValue": h[8] || (h[8] = ($) => m.icon = $)
1788
+ placeholder: l(o)("page.icon-search"),
1789
+ "empty-text": l(o)("page.icon-none"),
1790
+ "unknown-text": l(o)("page.icon-unknown"),
1791
+ "clear-label": l(o)("page.icon-clear"),
1792
+ "onUpdate:modelValue": k[8] || (k[8] = (E) => y.icon = E)
1458
1793
  }, null, 8, ["model-value", "placeholder", "empty-text", "unknown-text", "clear-label"])
1459
1794
  ]),
1460
1795
  _: 1
1461
1796
  }, 8, ["label", "error", "disabled"]),
1462
- u(e(ne), {
1463
- label: e(n)("page.sort"),
1464
- help: e(n)("page.sort-help"),
1465
- error: M("sort"),
1466
- disabled: !x.value
1797
+ f(l(oe), {
1798
+ label: l(o)("page.sort"),
1799
+ help: l(o)("page.sort-help"),
1800
+ error: H("sort"),
1801
+ disabled: !w.value
1467
1802
  }, {
1468
- default: d(() => [
1469
- u(e(dt), {
1470
- modelValue: m.sort,
1471
- "onUpdate:modelValue": h[9] || (h[9] = ($) => m.sort = $)
1803
+ default: b(() => [
1804
+ f(l(ht), {
1805
+ modelValue: y.sort,
1806
+ "onUpdate:modelValue": k[9] || (k[9] = (E) => y.sort = E)
1472
1807
  }, null, 8, ["modelValue"])
1473
1808
  ]),
1474
1809
  _: 1
1475
1810
  }, 8, ["label", "help", "error", "disabled"]),
1476
- u(e(ne), {
1477
- label: e(n)("page.allow"),
1478
- help: e(n)("page.allow-help"),
1479
- error: M("allow"),
1480
- disabled: !x.value
1811
+ f(l(oe), {
1812
+ label: l(o)("page.allow"),
1813
+ help: l(o)("page.allow-help"),
1814
+ error: H("allow"),
1815
+ disabled: !w.value
1481
1816
  }, {
1482
- default: d(() => [
1483
- u(e(pt), {
1484
- modelValue: m.allow,
1485
- "onUpdate:modelValue": h[10] || (h[10] = ($) => m.allow = $),
1817
+ default: b(() => [
1818
+ f(l(bt), {
1819
+ modelValue: y.allow,
1820
+ "onUpdate:modelValue": k[10] || (k[10] = (E) => y.allow = E),
1486
1821
  "allow-create": ""
1487
1822
  }, null, 8, ["modelValue"])
1488
1823
  ]),
1489
1824
  _: 1
1490
1825
  }, 8, ["label", "help", "error", "disabled"]),
1491
- u(e(ne), {
1492
- label: e(n)("page.allowed-in"),
1493
- help: e(n)("page.allowed-in-help"),
1494
- error: M("allowed_in"),
1495
- disabled: !x.value
1826
+ f(l(oe), {
1827
+ label: l(o)("page.allowed-in"),
1828
+ help: l(o)("page.allowed-in-help"),
1829
+ error: H("allowed_in"),
1830
+ disabled: !w.value
1496
1831
  }, {
1497
- default: d(() => [
1498
- u(e(pt), {
1499
- modelValue: m.allowed_in,
1500
- "onUpdate:modelValue": h[11] || (h[11] = ($) => m.allowed_in = $),
1832
+ default: b(() => [
1833
+ f(l(bt), {
1834
+ modelValue: y.allowed_in,
1835
+ "onUpdate:modelValue": k[11] || (k[11] = (E) => y.allowed_in = E),
1501
1836
  "allow-create": "",
1502
1837
  suggestions: ["root"]
1503
1838
  }, null, 8, ["modelValue"])
1504
1839
  ]),
1505
1840
  _: 1
1506
1841
  }, 8, ["label", "help", "error", "disabled"]),
1507
- u(e(ne), {
1508
- label: e(n)("page.max-per-entity"),
1509
- help: e(n)("page.max-per-entity-help"),
1510
- error: M("max_per_entity"),
1511
- disabled: !x.value
1842
+ f(l(oe), {
1843
+ label: l(o)("page.max-per-entity"),
1844
+ help: l(o)("page.max-per-entity-help"),
1845
+ error: H("max_per_entity"),
1846
+ disabled: !w.value
1512
1847
  }, {
1513
- default: d(() => [
1514
- u(e(dt), {
1515
- "model-value": m.max_per_entity ?? void 0,
1848
+ default: b(() => [
1849
+ f(l(ht), {
1850
+ "model-value": y.max_per_entity ?? void 0,
1516
1851
  min: 1,
1517
- "onUpdate:modelValue": h[12] || (h[12] = ($) => m.max_per_entity = $ ?? null)
1852
+ "onUpdate:modelValue": k[12] || (k[12] = (E) => y.max_per_entity = E ?? null)
1518
1853
  }, null, 8, ["model-value"])
1519
1854
  ]),
1520
1855
  _: 1
1521
1856
  }, 8, ["label", "help", "error", "disabled"]),
1522
- u(e(ne), {
1523
- label: e(n)("page.enabled"),
1524
- help: e(n)("page.enabled-help"),
1525
- disabled: !x.value
1857
+ f(l(oe), {
1858
+ label: l(o)("page.enabled"),
1859
+ help: l(o)("page.enabled-help"),
1860
+ disabled: !w.value
1526
1861
  }, {
1527
- default: d(() => [
1528
- u(e(vl), {
1529
- modelValue: m.is_enabled,
1530
- "onUpdate:modelValue": h[13] || (h[13] = ($) => m.is_enabled = $)
1862
+ default: b(() => [
1863
+ f(l(xl), {
1864
+ modelValue: y.is_enabled,
1865
+ "onUpdate:modelValue": k[13] || (k[13] = (E) => y.is_enabled = E)
1531
1866
  }, null, 8, ["modelValue"])
1532
1867
  ]),
1533
1868
  _: 1
1534
1869
  }, 8, ["label", "help", "disabled"]),
1535
- x.value ? (i(), S("div", un, [
1536
- u(e(ce), {
1870
+ w.value ? (u(), C("div", Rn, [
1871
+ f(l(ce), {
1537
1872
  type: "danger",
1538
1873
  variant: "outline",
1539
- disabled: v.value.usage_count > 0,
1540
- onClick: we
1874
+ disabled: c.value.usage_count > 0,
1875
+ onClick: Ve
1541
1876
  }, {
1542
- default: d(() => [
1543
- W(_(e(n)("page.delete")), 1)
1877
+ default: b(() => [
1878
+ z(S(l(o)("page.delete")), 1)
1544
1879
  ]),
1545
1880
  _: 1
1546
1881
  }, 8, ["disabled"]),
1547
- v.value.usage_count > 0 ? (i(), I(e(F), {
1882
+ c.value.usage_count > 0 ? (u(), M(l(q), {
1548
1883
  key: 0,
1549
1884
  size: "sm",
1550
1885
  tone: "muted"
1551
1886
  }, {
1552
- default: d(() => [
1553
- W(_(v.value.usage_count === 1 ? e(n)("page.delete-used-one") : e(n)("page.delete-used", { count: v.value.usage_count })), 1)
1887
+ default: b(() => [
1888
+ z(S(c.value.usage_count === 1 ? l(o)("page.delete-used-one") : l(o)("page.delete-used", { count: c.value.usage_count })), 1)
1554
1889
  ]),
1555
1890
  _: 1
1556
1891
  })) : N("", !0)
@@ -1562,20 +1897,20 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1562
1897
  ]),
1563
1898
  _: 1
1564
1899
  }, 8, ["label"]),
1565
- u(e(Le), {
1900
+ f(l(Ae), {
1566
1901
  value: "history",
1567
- label: e(n)("page.tab-history")
1902
+ label: l(o)("page.tab-history")
1568
1903
  }, {
1569
- default: d(() => [
1570
- u(e(Be), {
1904
+ default: b(() => [
1905
+ f(l(Be), {
1571
1906
  class: "wx-block-editor__sheet",
1572
1907
  padding: "none"
1573
1908
  }, {
1574
- default: d(() => [
1575
- u(Sl, {
1576
- block: v.value,
1577
- "can-manage": x.value,
1578
- onRestored: ke
1909
+ default: b(() => [
1910
+ f(Il, {
1911
+ block: c.value,
1912
+ "can-manage": w.value,
1913
+ onRestored: Q
1579
1914
  }, null, 8, ["block", "can-manage"])
1580
1915
  ]),
1581
1916
  _: 1
@@ -1586,38 +1921,38 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1586
1921
  ]),
1587
1922
  _: 1
1588
1923
  }, 8, ["modelValue"]),
1589
- Jt(u(zl, {
1924
+ nl(f(Kl, {
1590
1925
  class: "wx-block-editor__stage",
1591
- html: B.html,
1592
- styles: B.styles,
1593
- script: B.script,
1594
- runtime: B.runtime,
1595
- stage: B.stage,
1596
- loading: B.loading
1926
+ html: A.html,
1927
+ styles: A.styles,
1928
+ script: A.script,
1929
+ runtime: A.runtime,
1930
+ stage: A.stage,
1931
+ loading: A.loading
1597
1932
  }, null, 8, ["html", "styles", "script", "runtime", "stage", "loading"]), [
1598
- [Kt, Ee.value]
1933
+ [sl, $.value]
1599
1934
  ])
1600
1935
  ], 2),
1601
- x.value ? (i(), I(e(fl), { key: 1 }, {
1602
- default: d(() => [
1603
- u(e(ce), {
1936
+ w.value ? (u(), M(l($l), { key: 1 }, {
1937
+ default: b(() => [
1938
+ f(l(ce), {
1604
1939
  variant: "outline",
1605
- loading: f.value,
1606
- onClick: me
1940
+ loading: v.value,
1941
+ onClick: se
1607
1942
  }, {
1608
- default: d(() => [
1609
- W(_(e(n)("page.save")), 1)
1943
+ default: b(() => [
1944
+ z(S(l(o)("page.save")), 1)
1610
1945
  ]),
1611
1946
  _: 1
1612
1947
  }, 8, ["loading"]),
1613
- u(e(ce), {
1948
+ f(l(ce), {
1614
1949
  type: "primary",
1615
- loading: k.value,
1616
- disabled: !v.value.draft && !K.value,
1617
- onClick: ie
1950
+ loading: g.value,
1951
+ disabled: !c.value.draft && !J.value,
1952
+ onClick: ve
1618
1953
  }, {
1619
- default: d(() => [
1620
- W(_(e(n)("page.publish")), 1)
1954
+ default: b(() => [
1955
+ z(S(l(o)("page.publish")), 1)
1621
1956
  ]),
1622
1957
  _: 1
1623
1958
  }, 8, ["loading", "disabled"])
@@ -1627,47 +1962,47 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1627
1962
  ], 64))
1628
1963
  ]));
1629
1964
  }
1630
- }), dn = /* @__PURE__ */ oe(cn, [["__scopeId", "data-v-86e412ef"]]), pn = ["srcdoc"], vn = {
1965
+ }), Fn = /* @__PURE__ */ ie(jn, [["__scopeId", "data-v-22e5f784"]]), Hn = ["srcdoc"], qn = {
1631
1966
  key: 1,
1632
1967
  class: "wx-block-thumb__empty"
1633
- }, fn = /* @__PURE__ */ ae({
1968
+ }, Kn = /* @__PURE__ */ ae({
1634
1969
  __name: "BlockThumb",
1635
1970
  props: {
1636
1971
  thumbnail: {},
1637
1972
  width: { default: 1280 },
1638
1973
  height: { default: 120 }
1639
1974
  },
1640
- setup(t) {
1641
- const l = t, o = U(null), a = Ye(o), s = T(() => a.value > 0 ? a.value / l.width : 0.2), r = T(
1642
- () => l.thumbnail ? Pt({ html: l.thumbnail.html, styles: l.thumbnail.styles }) : ""
1643
- ), n = T(() => ({
1644
- width: `${l.width}px`,
1645
- height: `${Math.round(l.height / s.value)}px`,
1646
- transform: `scale(${s.value})`
1975
+ setup(e) {
1976
+ const n = e, t = I(null), s = Xe(t), a = V(() => s.value > 0 ? s.value / n.width : 0.2), i = V(
1977
+ () => n.thumbnail ? jt({ html: n.thumbnail.html, styles: n.thumbnail.styles }) : ""
1978
+ ), o = V(() => ({
1979
+ width: `${n.width}px`,
1980
+ height: `${Math.round(n.height / a.value)}px`,
1981
+ transform: `scale(${a.value})`
1647
1982
  }));
1648
- return (b, P) => (i(), S("div", {
1983
+ return (r, m) => (u(), C("div", {
1649
1984
  ref_key: "box",
1650
- ref: o,
1985
+ ref: t,
1651
1986
  class: "wx-block-thumb",
1652
- style: xe({ height: `${t.height}px` })
1987
+ style: xe({ height: `${e.height}px` })
1653
1988
  }, [
1654
- t.thumbnail ? (i(), S("iframe", {
1989
+ e.thumbnail ? (u(), C("iframe", {
1655
1990
  key: 0,
1656
1991
  class: "wx-block-thumb__frame",
1657
- srcdoc: r.value,
1658
- style: xe(n.value),
1992
+ srcdoc: i.value,
1993
+ style: xe(o.value),
1659
1994
  sandbox: "allow-same-origin",
1660
1995
  tabindex: "-1",
1661
1996
  "aria-hidden": "true"
1662
- }, null, 12, pn)) : (i(), S("div", vn, [
1663
- u(e(be), { name: "grid" })
1997
+ }, null, 12, Hn)) : (u(), C("div", qn, [
1998
+ f(l(he), { name: "grid" })
1664
1999
  ]))
1665
2000
  ], 4));
1666
2001
  }
1667
- }), Ft = /* @__PURE__ */ oe(fn, [["__scopeId", "data-v-615b818a"]]), mn = { class: "wx-block-picker" }, hn = {
2002
+ }), tl = /* @__PURE__ */ ie(Kn, [["__scopeId", "data-v-615b818a"]]), Yn = { class: "wx-block-picker" }, Jn = {
1668
2003
  key: 0,
1669
2004
  class: "wx-block-picker__group-title"
1670
- }, bn = { class: "wx-block-picker__cards" }, gn = ["disabled", "title", "onClick"], kn = { class: "wx-block-picker__body" }, yn = { class: "wx-block-picker__title" }, wn = /* @__PURE__ */ ae({
2005
+ }, Gn = { class: "wx-block-picker__cards" }, Zn = ["disabled", "title", "onClick"], Qn = { class: "wx-block-picker__body" }, Xn = { class: "wx-block-picker__title" }, es = /* @__PURE__ */ ae({
1671
2006
  __name: "BlockPicker",
1672
2007
  props: {
1673
2008
  catalog: {},
@@ -1677,135 +2012,135 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1677
2012
  groups: { default: () => [] },
1678
2013
  blocksPath: { default: null }
1679
2014
  },
1680
- setup(t) {
1681
- const l = t, { resolve: o, dismiss: a, open: s } = Bt();
1682
- Re();
1683
- const r = de("webx-blocks"), n = U("");
1684
- function b(f) {
1685
- if (l.parent === null)
1686
- return f.allowed_in === null || f.allowed_in.includes("root");
1687
- const k = l.allow ? l.allow.includes(f.slug) : l.parent.allow?.includes(f.slug) === !0, C = f.allowed_in === null || f.allowed_in.includes(l.parent.slug);
1688
- return k && C;
1689
- }
1690
- const P = T(
1691
- () => l.catalog.filter((f) => f.is_enabled && f.published !== null && b(f)).map((f) => {
1692
- const k = Nl(l.tree, f.slug), C = f.max_per_entity !== null && k >= f.max_per_entity;
1693
- return { type: f, reason: C ? r("field.limit-reached", { count: k }) : null };
2015
+ setup(e) {
2016
+ const n = e, { resolve: t, dismiss: s, open: a } = Mt();
2017
+ He();
2018
+ const i = de("webx-blocks"), o = I("");
2019
+ function r(v) {
2020
+ if (n.parent === null)
2021
+ return v.allowed_in === null || v.allowed_in.includes("root");
2022
+ const g = n.allow ? n.allow.includes(v.slug) : n.parent.allow?.includes(v.slug) === !0, x = v.allowed_in === null || v.allowed_in.includes(n.parent.slug);
2023
+ return g && x;
2024
+ }
2025
+ const m = V(
2026
+ () => n.catalog.filter((v) => v.is_enabled && v.published !== null && r(v)).map((v) => {
2027
+ const g = Jl(n.tree, v.slug), x = v.max_per_entity !== null && g >= v.max_per_entity;
2028
+ return { type: v, reason: x ? i("field.limit-reached", { count: g }) : null };
1694
2029
  })
1695
- ), v = T(() => {
1696
- const f = n.value.trim().toLowerCase();
1697
- return f === "" ? P.value : P.value.filter(
1698
- ({ type: k }) => k.title.toLowerCase().includes(f) || k.slug.includes(f) || (k.description ?? "").toLowerCase().includes(f)
2030
+ ), c = V(() => {
2031
+ const v = o.value.trim().toLowerCase();
2032
+ return v === "" ? m.value : m.value.filter(
2033
+ ({ type: g }) => g.title.toLowerCase().includes(v) || g.slug.includes(v) || (g.description ?? "").toLowerCase().includes(v)
1699
2034
  );
1700
- }), p = T(() => {
1701
- const f = [...l.groups];
1702
- for (const { type: V } of v.value)
1703
- f.includes(V.group) || f.push(V.group);
1704
- const k = f.map((V) => ({
1705
- id: V,
1706
- label: ze(V, r),
1707
- options: v.value.filter((x) => x.type.group === V)
1708
- })).filter((V) => V.options.length > 0);
1709
- return v.value.length <= 5 || n.value.trim() !== "" || k.length < 2 ? [{ id: "", label: "", options: v.value }] : k;
1710
- }), g = T(() => {
1711
- if (l.catalog.length === 0) return r("field.pick-none");
1712
- if (P.value.length === 0 && l.parent) {
1713
- const f = (l.allow ?? l.parent.allow ?? []).filter(
1714
- (k) => l.catalog.some((C) => C.slug === k)
2035
+ }), d = V(() => {
2036
+ const v = [...n.groups];
2037
+ for (const { type: T } of c.value)
2038
+ v.includes(T.group) || v.push(T.group);
2039
+ const g = v.map((T) => ({
2040
+ id: T,
2041
+ label: De(T, i),
2042
+ options: c.value.filter((w) => w.type.group === T)
2043
+ })).filter((T) => T.options.length > 0);
2044
+ return c.value.length <= 5 || o.value.trim() !== "" || g.length < 2 ? [{ id: "", label: "", options: c.value }] : g;
2045
+ }), p = V(() => {
2046
+ if (n.catalog.length === 0) return i("field.pick-none");
2047
+ if (m.value.length === 0 && n.parent) {
2048
+ const v = (n.allow ?? n.parent.allow ?? []).filter(
2049
+ (g) => n.catalog.some((x) => x.slug === g)
1715
2050
  );
1716
- return f.length === 0 ? r("field.pick-nothing-allowed", { parent: l.parent.title }) : r("field.pick-limited", { parent: l.parent.title, types: f.join(", ") });
2051
+ return v.length === 0 ? i("field.pick-nothing-allowed", { parent: n.parent.title }) : i("field.pick-limited", { parent: n.parent.title, types: v.join(", ") });
1717
2052
  }
1718
- return r("field.pick-empty");
2053
+ return i("field.pick-empty");
1719
2054
  });
1720
- return (f, k) => {
1721
- const C = xt("router-link");
1722
- return i(), I(e(Lt), {
1723
- open: e(s),
1724
- "onUpdate:open": k[2] || (k[2] = (V) => $t(s) ? s.value = V : null),
1725
- title: e(r)("field.pick"),
2055
+ return (v, g) => {
2056
+ const x = Vt("router-link");
2057
+ return u(), M(l(Nt), {
2058
+ open: l(a),
2059
+ "onUpdate:open": g[2] || (g[2] = (T) => Bt(a) ? a.value = T : null),
2060
+ title: l(i)("field.pick"),
1726
2061
  width: 860
1727
2062
  }, {
1728
- footer: d(() => [
1729
- u(e(ce), {
2063
+ footer: b(() => [
2064
+ f(l(ce), {
1730
2065
  variant: "outline",
1731
- onClick: k[1] || (k[1] = (V) => e(a)())
2066
+ onClick: g[1] || (g[1] = (T) => l(s)())
1732
2067
  }, {
1733
- default: d(() => [
1734
- W(_(e(r)("field.close")), 1)
2068
+ default: b(() => [
2069
+ z(S(l(i)("field.close")), 1)
1735
2070
  ]),
1736
2071
  _: 1
1737
2072
  })
1738
2073
  ]),
1739
- default: d(() => [
1740
- E("div", mn, [
1741
- P.value.length > 0 ? (i(), I(e(Pe), {
2074
+ default: b(() => [
2075
+ B("div", Yn, [
2076
+ m.value.length > 0 ? (u(), M(l(Oe), {
1742
2077
  key: 0,
1743
- modelValue: n.value,
1744
- "onUpdate:modelValue": k[0] || (k[0] = (V) => n.value = V),
1745
- placeholder: e(r)("field.search"),
2078
+ modelValue: o.value,
2079
+ "onUpdate:modelValue": g[0] || (g[0] = (T) => o.value = T),
2080
+ placeholder: l(i)("field.search"),
1746
2081
  clearable: "",
1747
2082
  autofocus: ""
1748
2083
  }, null, 8, ["modelValue", "placeholder"])) : N("", !0),
1749
- v.value.length === 0 ? (i(), I(e(Wt), {
2084
+ c.value.length === 0 ? (u(), M(l(It), {
1750
2085
  key: 1,
1751
2086
  icon: "grid",
1752
- title: g.value,
2087
+ title: p.value,
1753
2088
  size: "sm"
1754
2089
  }, {
1755
- default: d(() => [
1756
- t.catalog.length === 0 && t.blocksPath ? (i(), I(C, {
2090
+ default: b(() => [
2091
+ e.catalog.length === 0 && e.blocksPath ? (u(), M(x, {
1757
2092
  key: 0,
1758
- to: t.blocksPath
2093
+ to: e.blocksPath
1759
2094
  }, {
1760
- default: d(() => [
1761
- W(_(e(r)("field.pick-none-link")), 1)
2095
+ default: b(() => [
2096
+ z(S(l(i)("field.pick-none-link")), 1)
1762
2097
  ]),
1763
2098
  _: 1
1764
2099
  }, 8, ["to"])) : N("", !0)
1765
2100
  ]),
1766
2101
  _: 1
1767
2102
  }, 8, ["title"])) : N("", !0),
1768
- (i(!0), S(j, null, ee(p.value, (V) => (i(), S("section", {
1769
- key: V.id,
2103
+ (u(!0), C(F, null, le(d.value, (T) => (u(), C("section", {
2104
+ key: T.id,
1770
2105
  class: "wx-block-picker__group"
1771
2106
  }, [
1772
- V.label ? (i(), S("div", hn, _(V.label), 1)) : N("", !0),
1773
- E("div", bn, [
1774
- (i(!0), S(j, null, ee(V.options, (x) => (i(), S("button", {
1775
- key: x.type.id,
2107
+ T.label ? (u(), C("div", Jn, S(T.label), 1)) : N("", !0),
2108
+ B("div", Gn, [
2109
+ (u(!0), C(F, null, le(T.options, (w) => (u(), C("button", {
2110
+ key: w.type.id,
1776
2111
  type: "button",
1777
- class: $e(["wx-block-picker__card", { "is-disabled": x.reason !== null }]),
1778
- disabled: x.reason !== null,
1779
- title: x.reason ?? void 0,
1780
- onClick: (m) => e(o)(x.type)
2112
+ class: $e(["wx-block-picker__card", { "is-disabled": w.reason !== null }]),
2113
+ disabled: w.reason !== null,
2114
+ title: w.reason ?? void 0,
2115
+ onClick: (y) => l(t)(w.type)
1781
2116
  }, [
1782
- u(Ft, {
1783
- thumbnail: x.type.thumbnail,
2117
+ f(tl, {
2118
+ thumbnail: w.type.thumbnail,
1784
2119
  height: 96
1785
2120
  }, null, 8, ["thumbnail"]),
1786
- E("div", kn, [
1787
- E("div", yn, _(x.type.title), 1),
1788
- x.reason ? (i(), I(e(F), {
2121
+ B("div", Qn, [
2122
+ B("div", Xn, S(w.type.title), 1),
2123
+ w.reason ? (u(), M(l(q), {
1789
2124
  key: 0,
1790
2125
  size: "sm",
1791
2126
  tone: "warning"
1792
2127
  }, {
1793
- default: d(() => [
1794
- W(_(x.reason), 1)
2128
+ default: b(() => [
2129
+ z(S(w.reason), 1)
1795
2130
  ]),
1796
2131
  _: 2
1797
- }, 1024)) : x.type.description ? (i(), I(e(F), {
2132
+ }, 1024)) : w.type.description ? (u(), M(l(q), {
1798
2133
  key: 1,
1799
2134
  size: "sm",
1800
2135
  tone: "muted"
1801
2136
  }, {
1802
- default: d(() => [
1803
- W(_(x.type.description), 1)
2137
+ default: b(() => [
2138
+ z(S(w.type.description), 1)
1804
2139
  ]),
1805
2140
  _: 2
1806
2141
  }, 1024)) : N("", !0)
1807
2142
  ])
1808
- ], 10, gn))), 128))
2143
+ ], 10, Zn))), 128))
1809
2144
  ])
1810
2145
  ]))), 128))
1811
2146
  ])
@@ -1814,7 +2149,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1814
2149
  }, 8, ["open", "title"]);
1815
2150
  };
1816
2151
  }
1817
- }), _n = /* @__PURE__ */ oe(wn, [["__scopeId", "data-v-99f4090e"]]), xn = { class: "wx-blocks-preview__tools" }, $n = ["src", "title"], Sn = /* @__PURE__ */ ae({
2152
+ }), ts = /* @__PURE__ */ ie(es, [["__scopeId", "data-v-99f4090e"]]), ls = { class: "wx-blocks-preview__tools" }, ns = ["src", "title"], ss = /* @__PURE__ */ ae({
1818
2153
  __name: "BlocksPreview",
1819
2154
  props: {
1820
2155
  url: {},
@@ -1823,199 +2158,199 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1823
2158
  compact: { type: Boolean, default: !1 }
1824
2159
  },
1825
2160
  emits: ["select", "edit"],
1826
- setup(t, { expose: l, emit: o }) {
1827
- const a = t, s = o, r = de("webx-blocks"), n = U(null), b = U(null), P = U(null), v = Ye(P), p = U(!1), g = U(!1), f = U(null), k = U(0), C = T(() => k.value > 0), V = T(() => [
1828
- { value: 1280, icon: "monitor", ariaLabel: r("field.width-desktop") },
1829
- { value: 834, icon: "tablet", ariaLabel: r("field.width-tablet") },
1830
- { value: 390, icon: "smartphone", ariaLabel: r("field.width-phone") }
1831
- ]), x = T(() => f.value !== null ? f.value : a.compact ? v.value > 0 && v.value < 560 ? 390 : 834 : 1280), m = T(() => v.value === 0 ? 1 : Math.min(1, v.value / x.value)), y = T(() => ({
1832
- width: `${x.value}px`,
1833
- transform: `scale(${m.value})`,
1834
- ...C.value ? { height: `${k.value}px` } : {}
1835
- })), R = T(() => ({
1836
- width: `${Math.round(x.value * m.value)}px`,
1837
- ...C.value ? { height: `${Math.round(k.value * m.value)}px` } : {}
1838
- })), q = T(() => {
1839
- if (!a.url) return "";
2161
+ setup(e, { expose: n, emit: t }) {
2162
+ const s = e, a = t, i = de("webx-blocks"), o = I(null), r = I(null), m = I(null), c = Xe(m), d = I(!1), p = I(!1), v = I(null), g = I(0), x = V(() => g.value > 0), T = V(() => [
2163
+ { value: 1280, icon: "monitor", ariaLabel: i("field.width-desktop") },
2164
+ { value: 834, icon: "tablet", ariaLabel: i("field.width-tablet") },
2165
+ { value: 390, icon: "smartphone", ariaLabel: i("field.width-phone") }
2166
+ ]), w = V(() => v.value !== null ? v.value : s.compact ? c.value > 0 && c.value < 560 ? 390 : 834 : 1280), y = V(() => c.value === 0 ? 1 : Math.min(1, c.value / w.value)), _ = V(() => ({
2167
+ width: `${w.value}px`,
2168
+ transform: `scale(${y.value})`,
2169
+ ...x.value ? { height: `${g.value}px` } : {}
2170
+ })), R = V(() => ({
2171
+ width: `${Math.round(w.value * y.value)}px`,
2172
+ ...x.value ? { height: `${Math.round(g.value * y.value)}px` } : {}
2173
+ })), K = V(() => {
2174
+ if (!s.url) return "";
1840
2175
  try {
1841
- return `${new URL(a.url, location.origin).pathname} · ${x.value} px`;
2176
+ return `${new URL(s.url, location.origin).pathname} · ${w.value} px`;
1842
2177
  } catch {
1843
- return a.url;
2178
+ return s.url;
1844
2179
  }
1845
2180
  });
1846
- function J() {
2181
+ function Y() {
1847
2182
  try {
1848
- return n.value?.contentDocument ?? null;
2183
+ return o.value?.contentDocument ?? null;
1849
2184
  } catch {
1850
2185
  return null;
1851
2186
  }
1852
2187
  }
1853
- let Z = null, c = null;
1854
- function B(z) {
1855
- z.documentElement.scrollTop !== 0 && (z.documentElement.scrollTop = 0);
2188
+ let X = null, h = null;
2189
+ function A(W) {
2190
+ W.documentElement.scrollTop !== 0 && (W.documentElement.scrollTop = 0);
1856
2191
  }
1857
- function D() {
1858
- const z = J(), O = z?.body;
1859
- if (!O || !z?.defaultView) return;
1860
- B(z);
1861
- const H = z.defaultView.getComputedStyle(O), Y = (parseFloat(H.marginTop) || 0) + (parseFloat(H.marginBottom) || 0), ve = Math.ceil(O.scrollHeight + Y);
1862
- ve !== k.value && (k.value = ve, pe !== null && Gt(() => requestAnimationFrame(te)));
2192
+ function P() {
2193
+ const W = Y(), O = W?.body;
2194
+ if (!O || !W?.defaultView) return;
2195
+ A(W);
2196
+ const j = W.defaultView.getComputedStyle(O), G = (parseFloat(j.marginTop) || 0) + (parseFloat(j.marginBottom) || 0), fe = Math.ceil(O.scrollHeight + G);
2197
+ fe !== g.value && (g.value = fe, ne !== null && ol(() => requestAnimationFrame(Q)));
1863
2198
  }
1864
- function K(z) {
1865
- c?.disconnect();
1866
- const O = z.defaultView;
1867
- !O || !z.body || (c = new O.ResizeObserver(D), c.observe(z.body), D());
2199
+ function J(W) {
2200
+ h?.disconnect();
2201
+ const O = W.defaultView;
2202
+ !O || !W.body || (h = new O.ResizeObserver(P), h.observe(W.body), P());
1868
2203
  }
1869
2204
  function Se() {
1870
- g.value = !0;
1871
- const z = J();
1872
- z && (K(z), Z?.release(), Z = Tl(z, {
2205
+ p.value = !0;
2206
+ const W = Y();
2207
+ W && (J(W), X?.release(), X = Pl(W, {
1873
2208
  /* No guard against answering a click with a scroll: `bring` moves nothing that is already
1874
2209
  readable, and a block clicked at the very bottom of the window, half under the action
1875
2210
  bar, is exactly the one worth moving. */
1876
- select: (O) => s("select", O)
1877
- }), et(z, a.selected ?? null), _e(a.selected ?? null));
2211
+ select: (O) => a("select", O)
2212
+ }), st(W, s.selected ?? null), ye(s.selected ?? null));
1878
2213
  }
1879
- let pe = null, se = null;
1880
- function _e(z) {
1881
- z !== null && (pe = z, se !== null && clearTimeout(se), se = window.setTimeout(() => {
1882
- pe = null, se = null;
1883
- }, 400), te());
2214
+ let ne = null, pe = null;
2215
+ function ye(W) {
2216
+ W !== null && (ne = W, pe !== null && clearTimeout(pe), pe = window.setTimeout(() => {
2217
+ ne = null, pe = null;
2218
+ }, 400), Q());
1884
2219
  }
1885
- function Te(z) {
1886
- const O = n.value?.getBoundingClientRect();
2220
+ function Ee(W) {
2221
+ const O = o.value?.getBoundingClientRect();
1887
2222
  if (!O) return null;
1888
- const H = z.getBoundingClientRect();
1889
- return { top: O.top + H.top * m.value, height: H.height * m.value };
1890
- }
1891
- function ke() {
1892
- let z = n.value?.parentElement ?? null;
1893
- for (; z; ) {
1894
- const O = getComputedStyle(z).overflowY;
1895
- if ((O === "auto" || O === "scroll") && z.scrollHeight > z.clientHeight)
1896
- return z;
1897
- z = z.parentElement;
2223
+ const j = W.getBoundingClientRect();
2224
+ return { top: O.top + j.top * y.value, height: j.height * y.value };
2225
+ }
2226
+ function Te() {
2227
+ let W = o.value?.parentElement ?? null;
2228
+ for (; W; ) {
2229
+ const O = getComputedStyle(W).overflowY;
2230
+ if ((O === "auto" || O === "scroll") && W.scrollHeight > W.clientHeight)
2231
+ return W;
2232
+ W = W.parentElement;
1898
2233
  }
1899
2234
  return null;
1900
2235
  }
1901
- function te() {
1902
- const z = J();
1903
- if (pe === null || !z) return;
1904
- B(z);
1905
- const O = at(z, pe), H = O ? Te(O) : null;
1906
- if (!H) return;
1907
- const Y = ke(), ve = Y?.getBoundingClientRect(), me = b.value?.getBoundingClientRect().height ?? 0, ie = {
1908
- top: (ve?.top ?? 0) + me,
1909
- bottom: (ve ? ve.bottom : window.innerHeight) - me
1910
- }, we = H.top + H.height, Ve = H.top < ie.top, Ee = H.height > ie.bottom - ie.top, w = Ve || Ee ? H.top - ie.top : we > ie.bottom ? we - ie.bottom : 0;
1911
- w !== 0 && (Y ?? window).scrollBy({ top: w, behavior: "smooth" });
1912
- }
1913
- function Ce(z, O) {
1914
- const H = J();
1915
- if (!H || !g.value) return !1;
1916
- const Y = Nt(H, z, O);
1917
- return Y && et(H, a.selected ?? null), Y;
1918
- }
1919
- function ye() {
1920
- g.value = !1, c?.disconnect(), c = null, n.value && a.url && (n.value.src = a.url);
1921
- }
1922
- function fe(z) {
1923
- z.key === "Escape" && p.value && (p.value = !1, z.stopPropagation());
1924
- }
1925
- return X(
1926
- () => a.selected,
1927
- (z) => {
1928
- const O = J();
1929
- !O || !g.value || (et(O, z ?? null), _e(z ?? null));
2236
+ function Q() {
2237
+ const W = Y();
2238
+ if (ne === null || !W) return;
2239
+ A(W);
2240
+ const O = ct(W, ne), j = O ? Ee(O) : null;
2241
+ if (!j) return;
2242
+ const G = Te(), fe = G?.getBoundingClientRect(), we = r.value?.getBoundingClientRect().height ?? 0, se = {
2243
+ top: (fe?.top ?? 0) + we,
2244
+ bottom: (fe ? fe.bottom : window.innerHeight) - we
2245
+ }, ve = j.top + j.height, Ve = j.top < se.top, Me = j.height > se.bottom - se.top, $ = Ve || Me ? j.top - se.top : ve > se.bottom ? ve - se.bottom : 0;
2246
+ $ !== 0 && (G ?? window).scrollBy({ top: $, behavior: "smooth" });
2247
+ }
2248
+ function ke(W, O) {
2249
+ const j = Y();
2250
+ if (!j || !p.value) return !1;
2251
+ const G = Rt(j, W, O);
2252
+ return G && st(j, s.selected ?? null), G;
2253
+ }
2254
+ function Ce() {
2255
+ p.value = !1, h?.disconnect(), h = null, o.value && s.url && (o.value.src = s.url);
2256
+ }
2257
+ function ge(W) {
2258
+ W.key === "Escape" && d.value && (d.value = !1, W.stopPropagation());
2259
+ }
2260
+ return te(
2261
+ () => s.selected,
2262
+ (W) => {
2263
+ const O = Y();
2264
+ !O || !p.value || (st(O, W ?? null), ye(W ?? null));
1930
2265
  }
1931
- ), X(() => a.reload, ye), X(
1932
- () => a.url,
1933
- () => g.value = !1
1934
- ), Ue(() => window.addEventListener("keydown", fe)), Ge(() => {
1935
- window.removeEventListener("keydown", fe), se !== null && clearTimeout(se), c?.disconnect(), Z?.release();
1936
- }), l({ replace: Ce, refresh: ye, open: () => p.value = !0 }), (z, O) => (i(), S("div", {
1937
- class: $e(["wx-blocks-preview", { "is-fullscreen": p.value, "is-grown": C.value, "is-compact": t.compact }]),
1938
- style: xe({ "--wx-preview-scale": m.value })
2266
+ ), te(() => s.reload, Ce), te(
2267
+ () => s.url,
2268
+ () => p.value = !1
2269
+ ), Ue(() => window.addEventListener("keydown", ge)), Qe(() => {
2270
+ window.removeEventListener("keydown", ge), pe !== null && clearTimeout(pe), h?.disconnect(), X?.release();
2271
+ }), n({ replace: ke, refresh: Ce, open: () => d.value = !0 }), (W, O) => (u(), C("div", {
2272
+ class: $e(["wx-blocks-preview", { "is-fullscreen": d.value, "is-grown": x.value, "is-compact": e.compact }]),
2273
+ style: xe({ "--wx-preview-scale": y.value })
1939
2274
  }, [
1940
- E("div", {
2275
+ B("div", {
1941
2276
  ref_key: "bar",
1942
- ref: b,
2277
+ ref: r,
1943
2278
  class: "wx-blocks-preview__bar"
1944
2279
  }, [
1945
- u(e(F), {
2280
+ f(l(q), {
1946
2281
  size: "xs",
1947
2282
  tone: "muted",
1948
2283
  class: "wx-blocks-preview__label",
1949
2284
  truncate: ""
1950
2285
  }, {
1951
- default: d(() => [
1952
- W(_(q.value), 1)
2286
+ default: b(() => [
2287
+ z(S(K.value), 1)
1953
2288
  ]),
1954
2289
  _: 1
1955
2290
  }),
1956
- u(e(Ct), {
2291
+ f(l(Wt), {
1957
2292
  class: "wx-blocks-preview__widths",
1958
- "model-value": x.value,
1959
- options: V.value,
2293
+ "model-value": w.value,
2294
+ options: T.value,
1960
2295
  size: "sm",
1961
- "aria-label": e(r)("field.width"),
1962
- "onUpdate:modelValue": O[0] || (O[0] = (H) => f.value = Number(H))
2296
+ "aria-label": l(i)("field.width"),
2297
+ "onUpdate:modelValue": O[0] || (O[0] = (j) => v.value = Number(j))
1963
2298
  }, null, 8, ["model-value", "options", "aria-label"]),
1964
- E("div", xn, [
1965
- t.compact ? (i(), I(e(Ie), {
2299
+ B("div", ls, [
2300
+ e.compact ? (u(), M(l(Ne), {
1966
2301
  key: 0,
1967
2302
  size: "sm",
1968
2303
  tone: "primary",
1969
2304
  icon: "edit",
1970
- title: e(r)("field.blocks"),
1971
- onClick: O[1] || (O[1] = (H) => s("edit"))
2305
+ title: l(i)("field.blocks"),
2306
+ onClick: O[1] || (O[1] = (j) => a("edit"))
1972
2307
  }, null, 8, ["title"])) : N("", !0),
1973
- t.url ? (i(), I(e(Ie), {
2308
+ e.url ? (u(), M(l(Ne), {
1974
2309
  key: 1,
1975
2310
  size: "sm",
1976
2311
  icon: "external-link",
1977
2312
  tone: "neutral",
1978
- title: e(r)("field.open-site"),
1979
- href: t.url,
2313
+ title: l(i)("field.open-site"),
2314
+ href: e.url,
1980
2315
  target: "_blank",
1981
2316
  rel: "noopener"
1982
2317
  }, null, 8, ["title", "href"])) : N("", !0),
1983
- u(e(Ie), {
2318
+ f(l(Ne), {
1984
2319
  size: "sm",
1985
- icon: p.value ? "minimize" : "maximize",
2320
+ icon: d.value ? "minimize" : "maximize",
1986
2321
  tone: "neutral",
1987
- title: p.value ? e(r)("field.close") : e(r)("field.fullscreen"),
1988
- onClick: O[2] || (O[2] = (H) => p.value = !p.value)
2322
+ title: d.value ? l(i)("field.close") : l(i)("field.fullscreen"),
2323
+ onClick: O[2] || (O[2] = (j) => d.value = !d.value)
1989
2324
  }, null, 8, ["icon", "title"])
1990
2325
  ])
1991
2326
  ], 512),
1992
- E("div", {
2327
+ B("div", {
1993
2328
  ref_key: "box",
1994
- ref: P,
2329
+ ref: m,
1995
2330
  class: "wx-blocks-preview__ground"
1996
2331
  }, [
1997
- E("div", {
2332
+ B("div", {
1998
2333
  class: "wx-blocks-preview__clip",
1999
2334
  style: xe(R.value)
2000
2335
  }, [
2001
- t.url ? (i(), S("iframe", {
2336
+ e.url ? (u(), C("iframe", {
2002
2337
  key: 0,
2003
2338
  ref_key: "frame",
2004
- ref: n,
2339
+ ref: o,
2005
2340
  class: "wx-blocks-preview__frame",
2006
- src: t.url,
2007
- style: xe(y.value),
2008
- title: e(r)("field.preview"),
2341
+ src: e.url,
2342
+ style: xe(_.value),
2343
+ title: l(i)("field.preview"),
2009
2344
  onLoad: Se
2010
- }, null, 44, $n)) : N("", !0)
2345
+ }, null, 44, ns)) : N("", !0)
2011
2346
  ], 4)
2012
2347
  ], 512)
2013
2348
  ], 6));
2014
2349
  }
2015
- }), Tn = /* @__PURE__ */ oe(Sn, [["__scopeId", "data-v-398e4cef"]]), Cn = { class: "wx-blocks-tree__node" }, Vn = ["onClick", "onKeydown"], En = { class: "wx-blocks-tree__name" }, Bn = ["title"], Ln = ["title"], Wn = ["title"], An = ["title"], zn = {
2350
+ }), os = /* @__PURE__ */ ie(ss, [["__scopeId", "data-v-398e4cef"]]), as = { class: "wx-blocks-tree__node" }, is = ["onClick", "onKeydown"], rs = { class: "wx-blocks-tree__name" }, us = ["title"], cs = ["title"], ds = ["title"], ps = ["title"], fs = {
2016
2351
  key: 4,
2017
2352
  class: "wx-blocks-tree__actions"
2018
- }, In = ["onClick"], Nn = /* @__PURE__ */ ae({
2353
+ }, vs = ["onClick"], ms = /* @__PURE__ */ ae({
2019
2354
  __name: "BlocksTree",
2020
2355
  props: {
2021
2356
  nodes: {},
@@ -2027,134 +2362,134 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
2027
2362
  depth: { default: 0 }
2028
2363
  },
2029
2364
  emits: ["select", "add", "remove", "duplicate", "visibility", "reorder"],
2030
- setup(t, { emit: l }) {
2031
- const o = t, a = l, s = de("webx-blocks");
2032
- function r(p) {
2033
- return o.catalog.find((g) => g.slug === p.type) ?? null;
2365
+ setup(e, { emit: n }) {
2366
+ const t = e, s = n, a = de("webx-blocks");
2367
+ function i(d) {
2368
+ return t.catalog.find((p) => p.slug === d.type) ?? null;
2034
2369
  }
2035
- function n(p) {
2036
- return r(p)?.title ?? p.type;
2370
+ function o(d) {
2371
+ return i(d)?.title ?? d.type;
2037
2372
  }
2038
- function b(p) {
2039
- const g = r(p);
2040
- return g?.content ? Dt(g.content.schema) : [];
2373
+ function r(d) {
2374
+ const p = i(d);
2375
+ return p?.content ? qt(p.content.schema) : [];
2041
2376
  }
2042
- function P(p, g) {
2043
- const f = p.values[g.id];
2044
- return Array.isArray(f) ? f : [];
2377
+ function m(d, p) {
2378
+ const v = d.values[p.id];
2379
+ return Array.isArray(v) ? v : [];
2045
2380
  }
2046
- function v(p) {
2381
+ function c(d) {
2047
2382
  return [
2048
2383
  {
2049
2384
  key: "visibility",
2050
- icon: p.hidden === !0 ? "eye" : "eye-off",
2051
- label: p.hidden === !0 ? s("field.show") : s("field.hide"),
2052
- run: () => a("visibility", p.key, p.hidden !== !0)
2385
+ icon: d.hidden === !0 ? "eye" : "eye-off",
2386
+ label: d.hidden === !0 ? a("field.show") : a("field.hide"),
2387
+ run: () => s("visibility", d.key, d.hidden !== !0)
2053
2388
  },
2054
2389
  {
2055
2390
  key: "duplicate",
2056
2391
  icon: "copy",
2057
- label: s("field.duplicate"),
2058
- run: () => a("duplicate", p.key)
2392
+ label: a("field.duplicate"),
2393
+ run: () => s("duplicate", d.key)
2059
2394
  },
2060
2395
  {
2061
2396
  key: "remove",
2062
2397
  icon: "trash",
2063
- label: s("field.remove"),
2398
+ label: a("field.remove"),
2064
2399
  danger: !0,
2065
- run: () => a("remove", p.key)
2400
+ run: () => s("remove", d.key)
2066
2401
  }
2067
2402
  ];
2068
2403
  }
2069
- return (p, g) => {
2070
- const f = xt("blocks-tree", !0);
2071
- return i(), I(e(ml), {
2072
- "model-value": t.nodes,
2404
+ return (d, p) => {
2405
+ const v = Vt("blocks-tree", !0);
2406
+ return u(), M(l(Sl), {
2407
+ "model-value": e.nodes,
2073
2408
  "item-key": "key",
2074
- "item-label": (k) => n(k),
2075
- disabled: t.disabled,
2409
+ "item-label": (g) => o(g),
2410
+ disabled: e.disabled,
2076
2411
  plain: "",
2077
2412
  size: "sm",
2078
- "empty-text": t.depth === 0 ? e(s)("field.empty") : "",
2079
- class: $e(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
2080
- "onUpdate:modelValue": g[6] || (g[6] = (k) => a("reorder", t.parentKey, t.field, k))
2413
+ "empty-text": e.depth === 0 ? l(a)("field.empty") : "",
2414
+ class: $e(["wx-blocks-tree", { "is-nested": e.depth > 0 }]),
2415
+ "onUpdate:modelValue": p[6] || (p[6] = (g) => s("reorder", e.parentKey, e.field, g))
2081
2416
  }, {
2082
- default: d(({ item: k }) => [
2083
- E("div", Cn, [
2084
- E("div", {
2085
- class: $e(["wx-blocks-tree__row", { "is-selected": t.selected === k.key, "is-hidden": k.hidden === !0 }]),
2417
+ default: b(({ item: g }) => [
2418
+ B("div", as, [
2419
+ B("div", {
2420
+ class: $e(["wx-blocks-tree__row", { "is-selected": e.selected === g.key, "is-hidden": g.hidden === !0 }]),
2086
2421
  role: "button",
2087
2422
  tabindex: "0",
2088
- onClick: (C) => a("select", k.key),
2423
+ onClick: (x) => s("select", g.key),
2089
2424
  onKeydown: [
2090
- ut(ct((C) => a("select", k.key), ["prevent"]), ["enter"]),
2091
- ut(ct((C) => a("select", k.key), ["prevent"]), ["space"])
2425
+ vt(mt((x) => s("select", g.key), ["prevent"]), ["enter"]),
2426
+ vt(mt((x) => s("select", g.key), ["prevent"]), ["space"])
2092
2427
  ]
2093
2428
  }, [
2094
- E("span", En, _(n(k)), 1),
2095
- r(k) ? r(k)?.draft ? (i(), S("span", {
2429
+ B("span", rs, S(o(g)), 1),
2430
+ i(g) ? i(g)?.draft ? (u(), C("span", {
2096
2431
  key: 1,
2097
2432
  class: "wx-blocks-tree__flag is-warning",
2098
- title: e(s)("field.draft-type")
2433
+ title: l(a)("field.draft-type")
2099
2434
  }, [
2100
- u(e(be), { name: "warning" })
2101
- ], 8, Ln)) : r(k)?.is_enabled === !1 ? (i(), S("span", {
2435
+ f(l(he), { name: "warning" })
2436
+ ], 8, cs)) : i(g)?.is_enabled === !1 ? (u(), C("span", {
2102
2437
  key: 2,
2103
2438
  class: "wx-blocks-tree__flag",
2104
- title: e(s)("field.disabled-type")
2439
+ title: l(a)("field.disabled-type")
2105
2440
  }, [
2106
- u(e(be), { name: "lock" })
2107
- ], 8, Wn)) : N("", !0) : (i(), S("span", {
2441
+ f(l(he), { name: "lock" })
2442
+ ], 8, ds)) : N("", !0) : (u(), C("span", {
2108
2443
  key: 0,
2109
2444
  class: "wx-blocks-tree__flag is-danger",
2110
- title: e(s)("field.unknown-type", { type: k.type })
2445
+ title: l(a)("field.unknown-type", { type: g.type })
2111
2446
  }, [
2112
- u(e(be), { name: "close-circle" })
2113
- ], 8, Bn)),
2114
- k.hidden === !0 ? (i(), S("span", {
2447
+ f(l(he), { name: "close-circle" })
2448
+ ], 8, us)),
2449
+ g.hidden === !0 ? (u(), C("span", {
2115
2450
  key: 3,
2116
2451
  class: "wx-blocks-tree__flag",
2117
- title: e(s)("field.hidden-note")
2452
+ title: l(a)("field.hidden-note")
2118
2453
  }, [
2119
- u(e(be), { name: "eye-off" })
2120
- ], 8, An)) : N("", !0),
2121
- t.disabled ? N("", !0) : (i(), S("span", zn, [
2122
- u(e(sl), {
2123
- actions: v(k),
2124
- label: n(k)
2454
+ f(l(he), { name: "eye-off" })
2455
+ ], 8, ps)) : N("", !0),
2456
+ e.disabled ? N("", !0) : (u(), C("span", fs, [
2457
+ f(l(hl), {
2458
+ actions: c(g),
2459
+ label: o(g)
2125
2460
  }, null, 8, ["actions", "label"])
2126
2461
  ]))
2127
- ], 42, Vn),
2128
- (i(!0), S(j, null, ee(b(k), (C) => (i(), S("div", {
2129
- key: C.id,
2462
+ ], 42, is),
2463
+ (u(!0), C(F, null, le(r(g), (x) => (u(), C("div", {
2464
+ key: x.id,
2130
2465
  class: "wx-blocks-tree__kids"
2131
2466
  }, [
2132
- u(f, {
2133
- nodes: P(k, C),
2134
- catalog: t.catalog,
2135
- "parent-key": k.key,
2136
- field: C.id,
2137
- selected: t.selected,
2138
- disabled: t.disabled,
2139
- depth: t.depth + 1,
2140
- onSelect: g[0] || (g[0] = (V) => a("select", V)),
2141
- onAdd: g[1] || (g[1] = (V, x, m) => a("add", V, x, m)),
2142
- onRemove: g[2] || (g[2] = (V) => a("remove", V)),
2143
- onDuplicate: g[3] || (g[3] = (V) => a("duplicate", V)),
2144
- onVisibility: g[4] || (g[4] = (V, x) => a("visibility", V, x)),
2145
- onReorder: g[5] || (g[5] = (V, x, m) => a("reorder", V, x, m))
2467
+ f(v, {
2468
+ nodes: m(g, x),
2469
+ catalog: e.catalog,
2470
+ "parent-key": g.key,
2471
+ field: x.id,
2472
+ selected: e.selected,
2473
+ disabled: e.disabled,
2474
+ depth: e.depth + 1,
2475
+ onSelect: p[0] || (p[0] = (T) => s("select", T)),
2476
+ onAdd: p[1] || (p[1] = (T, w, y) => s("add", T, w, y)),
2477
+ onRemove: p[2] || (p[2] = (T) => s("remove", T)),
2478
+ onDuplicate: p[3] || (p[3] = (T) => s("duplicate", T)),
2479
+ onVisibility: p[4] || (p[4] = (T, w) => s("visibility", T, w)),
2480
+ onReorder: p[5] || (p[5] = (T, w, y) => s("reorder", T, w, y))
2146
2481
  }, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
2147
- t.disabled ? N("", !0) : (i(), S("button", {
2482
+ e.disabled ? N("", !0) : (u(), C("button", {
2148
2483
  key: 0,
2149
2484
  type: "button",
2150
2485
  class: "wx-blocks-tree__add is-inner",
2151
- onClick: (V) => a("add", k.key, C.id, C)
2486
+ onClick: (T) => s("add", g.key, x.id, x)
2152
2487
  }, [
2153
- W(" + " + _(e(s)("field.add-inside")), 1),
2154
- b(k).length > 1 ? (i(), S(j, { key: 0 }, [
2155
- W(" · " + _(C.label ?? C.id), 1)
2488
+ z(" + " + S(l(a)("field.add-inside")), 1),
2489
+ r(g).length > 1 ? (u(), C(F, { key: 0 }, [
2490
+ z(" · " + S(x.label ?? x.id), 1)
2156
2491
  ], 64)) : N("", !0)
2157
- ], 8, In))
2492
+ ], 8, vs))
2158
2493
  ]))), 128))
2159
2494
  ])
2160
2495
  ]),
@@ -2162,33 +2497,33 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
2162
2497
  }, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
2163
2498
  };
2164
2499
  }
2165
- }), Pn = /* @__PURE__ */ oe(Nn, [["__scopeId", "data-v-590fa1d6"]]), it = /* @__PURE__ */ Symbol("wx-blocks-preview");
2166
- function _a(t) {
2167
- St(it, t);
2500
+ }), hs = /* @__PURE__ */ ie(ms, [["__scopeId", "data-v-590fa1d6"]]), ft = /* @__PURE__ */ Symbol("wx-blocks-preview");
2501
+ function no(e) {
2502
+ At(ft, e);
2168
2503
  }
2169
- function xa() {
2170
- return qe(it, null);
2504
+ function so() {
2505
+ return Ye(ft, null);
2171
2506
  }
2172
- const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2507
+ const Ct = /* @__PURE__ */ Symbol("wx-blocks-root"), bs = {
2173
2508
  key: 0,
2174
2509
  class: "wx-blocks-nested"
2175
- }, Mn = {
2510
+ }, gs = {
2176
2511
  key: 0,
2177
2512
  class: "wx-blocks__tree"
2178
- }, Dn = { class: "wx-blocks__panel-head" }, On = { class: "wx-blocks__panel-title" }, Rn = { class: "wx-blocks__tools" }, Hn = {
2513
+ }, ys = { class: "wx-blocks__panel-head" }, ks = { class: "wx-blocks__panel-title" }, ws = { class: "wx-blocks__tools" }, _s = {
2179
2514
  key: 1,
2180
2515
  class: "wx-blocks__fields"
2181
- }, jn = { class: "wx-blocks__panel-head" }, Fn = { class: "wx-blocks__panel-title" }, qn = {
2516
+ }, xs = { class: "wx-blocks__panel-head" }, $s = { class: "wx-blocks__panel-title" }, Ss = {
2182
2517
  key: 0,
2183
2518
  class: "wx-blocks__trail"
2184
- }, Jn = ["onClick"], Kn = { class: "wx-blocks__panel-name" }, Gn = { class: "wx-blocks__panel-extra" }, Yn = { key: 0 }, Zn = { class: "wx-blocks__form" }, Qn = {
2519
+ }, Es = ["onClick"], Ts = { class: "wx-blocks__panel-name" }, Cs = { class: "wx-blocks__panel-extra" }, Vs = { key: 0 }, Bs = { class: "wx-blocks__form" }, As = {
2185
2520
  key: 0,
2186
2521
  class: "wx-blocks__preview"
2187
- }, Xn = /* @__PURE__ */ ae({
2522
+ }, Ls = /* @__PURE__ */ ae({
2188
2523
  name: "WxBlocks",
2189
2524
  inheritAttrs: !1,
2190
2525
  __name: "BlocksField",
2191
- props: /* @__PURE__ */ el({
2526
+ props: /* @__PURE__ */ cl({
2192
2527
  node: { default: void 0 },
2193
2528
  context: { default: void 0 },
2194
2529
  name: { default: void 0 },
@@ -2203,38 +2538,38 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2203
2538
  modelModifiers: {}
2204
2539
  }),
2205
2540
  emits: ["update:modelValue"],
2206
- setup(t) {
2207
- const l = t, o = Yt(t, "modelValue"), a = qe(_t, !1);
2208
- St(_t, !0), Re();
2209
- const s = de("webx-blocks"), r = De(), n = qe(il, null);
2210
- let b = null;
2211
- const P = U([]), v = T(() => l.catalog ?? P.value), p = T(() => Array.isArray(o.value) ? o.value : []), g = U(null), f = T(() => g.value ? re(p.value, g.value) : null), k = T(
2212
- () => f.value ? v.value.find((w) => w.slug === f.value?.node.type) ?? null : null
2541
+ setup(e) {
2542
+ const n = e, t = al(e, "modelValue"), s = Ye(Ct, !1);
2543
+ At(Ct, !0), He();
2544
+ const a = de("webx-blocks"), i = je(), o = Ye(bl, null);
2545
+ let r = null;
2546
+ const m = I([]), c = V(() => n.catalog ?? m.value), d = V(() => Array.isArray(t.value) ? t.value : []), p = I(null), v = V(() => p.value ? re(d.value, p.value) : null), g = V(
2547
+ () => v.value ? c.value.find(($) => $.slug === v.value?.node.type) ?? null : null
2213
2548
  );
2214
- function C(w) {
2215
- return v.value.find((L) => L.slug === w.type)?.title ?? w.type;
2216
- }
2217
- const V = T(() => {
2218
- const w = [];
2219
- return Oe(p.value, (L) => w.push(L.key)), w;
2220
- }), x = T(() => {
2221
- const w = g.value ? V.value.indexOf(g.value) : -1;
2549
+ function x($) {
2550
+ return c.value.find((D) => D.slug === $.type)?.title ?? $.type;
2551
+ }
2552
+ const T = V(() => {
2553
+ const $ = [];
2554
+ return Fe(d.value, (D) => $.push(D.key)), $;
2555
+ }), w = V(() => {
2556
+ const $ = p.value ? T.value.indexOf(p.value) : -1;
2222
2557
  return {
2223
- previous: w > 0 ? V.value[w - 1] : null,
2224
- next: w >= 0 && w < V.value.length - 1 ? V.value[w + 1] : null
2558
+ previous: $ > 0 ? T.value[$ - 1] : null,
2559
+ next: $ >= 0 && $ < T.value.length - 1 ? T.value[$ + 1] : null
2225
2560
  };
2226
- }), m = T(() => {
2227
- const w = [];
2228
- let L = f.value?.parent ?? null;
2229
- for (; L; )
2230
- w.unshift({ key: L.key, title: C(L) }), L = re(p.value, L.key)?.parent ?? null;
2231
- return w;
2232
- }), y = qe(it, null), R = U(null), q = U(null), J = Ye(q), Z = T(() => y !== null && y.url.value !== null), c = T(() => Z.value && J.value > 0 && J.value <= 900), B = U(!1), D = T(() => {
2233
- if (!f.value) return;
2234
- const w = k.value?.title ?? f.value.node.type;
2235
- return [...m.value.map((L) => L.title), w].join(" / ");
2236
- }), K = T(
2237
- () => c.value ? {
2561
+ }), y = V(() => {
2562
+ const $ = [];
2563
+ let D = v.value?.parent ?? null;
2564
+ for (; D; )
2565
+ $.unshift({ key: D.key, title: x(D) }), D = re(d.value, D.key)?.parent ?? null;
2566
+ return $;
2567
+ }), _ = Ye(ft, null), R = I(null), K = I(null), Y = Xe(K), X = V(() => _ !== null && _.url.value !== null), h = V(() => X.value && Y.value > 0 && Y.value <= 900), A = I(!1), P = V(() => {
2568
+ if (!v.value) return;
2569
+ const $ = g.value?.title ?? v.value.node.type;
2570
+ return [...y.value.map((D) => D.title), $].join(" / ");
2571
+ }), J = V(
2572
+ () => h.value ? {
2238
2573
  /* Up from the bottom, and not all the way: the strip of page left above it is what
2239
2574
  says the sheet is over the page rather than instead of it. No heading of its own —
2240
2575
  the panels inside carry theirs, and the × is the one thing the sheet has to add. */
@@ -2244,266 +2579,266 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2244
2579
  takes a narrow screen whole unless it is told not to. */
2245
2580
  fullScreen: !1,
2246
2581
  closable: !0,
2247
- closeLabel: s("field.close"),
2248
- ariaLabel: s("field.blocks"),
2582
+ closeLabel: a("field.close"),
2583
+ ariaLabel: a("field.blocks"),
2249
2584
  /* The open block's name goes in the sheet's own head, where there is a whole line for
2250
2585
  it: in the form's head it shared a row with four controls and wrapped onto two. With
2251
2586
  the blocks it is inside spelled out in front of it, because the trail that says so
2252
2587
  in the column is part of the heading this replaces. The tree keeps its own heading,
2253
2588
  which already says what it is and how many. */
2254
- title: D.value,
2255
- open: B.value,
2256
- "onUpdate:open": (w) => B.value = w
2589
+ title: P.value,
2590
+ open: A.value,
2591
+ "onUpdate:open": ($) => A.value = $
2257
2592
  } : {}
2258
- ), Se = T(
2259
- () => n?.state.manifest?.modules.find((w) => w.id === "blocks")?.meta?.groups ?? []
2260
- ), pe = Zt()?.type, se = T(() => l.context?.types ? l.context.types : n?.types ? { ...Xe, ...n.types } : pe ? { ...Xe, "wx-blocks": { component: pe, kind: "field", nested: !0 } } : Xe), _e = T(
2261
- () => l.context?.translate ?? n?.i18n.t ?? ((w) => w)
2262
- ), Te = T(() => l.context?.can ?? n?.can ?? (() => !0)), ke = At(_n);
2263
- function te(w) {
2264
- o.value = w;
2265
- }
2266
- async function Ce(w, L, M) {
2267
- const Q = w ? re(p.value, w) : null, le = Q ? v.value.find((qt) => qt.slug === Q.node.type) ?? null : null, A = w === null ? l.allow : M?.props?.allow ?? null, h = w === null ? l.max : M?.props?.max ?? null, $ = w === null ? p.value : Q && L ? Q.node.values[L] ?? [] : [];
2268
- if (h != null && $.length >= h) return;
2269
- const He = await ke({
2270
- catalog: v.value,
2271
- parent: le,
2272
- allow: A,
2273
- tree: p.value,
2593
+ ), Se = V(
2594
+ () => o?.state.manifest?.modules.find(($) => $.id === "blocks")?.meta?.groups ?? []
2595
+ ), ne = il()?.type, pe = V(() => n.context?.types ? n.context.types : o?.types ? { ...Je, ...o.types } : ne ? { ...Je, "wx-blocks": { component: ne, kind: "field", nested: !0 } } : Je), ye = V(
2596
+ () => n.context?.translate ?? o?.i18n.t ?? (($) => $)
2597
+ ), Ee = V(() => n.context?.can ?? o?.can ?? (() => !0)), Te = Pt(ts);
2598
+ function Q($) {
2599
+ t.value = $;
2600
+ }
2601
+ async function ke($, D, U) {
2602
+ const H = $ ? re(d.value, $) : null, ee = H ? c.value.find((ll) => ll.slug === H.node.type) ?? null : null, tt = $ === null ? n.allow : U?.props?.allow ?? null, L = $ === null ? n.max : U?.props?.max ?? null, k = $ === null ? d.value : H && D ? H.node.values[D] ?? [] : [];
2603
+ if (L != null && k.length >= L) return;
2604
+ const E = await Te({
2605
+ catalog: c.value,
2606
+ parent: ee,
2607
+ allow: tt,
2608
+ tree: d.value,
2274
2609
  groups: Se.value,
2275
- blocksPath: l.blocksPath
2610
+ blocksPath: n.blocksPath
2276
2611
  });
2277
- if (!He) return;
2278
- const rt = Il(He.slug, ye(He));
2279
- te(kt(p.value, w, L, $.length, rt)), g.value = rt.key;
2280
- }
2281
- function ye(w) {
2282
- const L = w.content?.sample ?? {}, M = {};
2283
- for (const [Q, le] of Object.entries(L))
2284
- (!Array.isArray(le) || le.length === 0 || typeof le[0] != "object") && (M[Q] = le);
2285
- return M;
2286
- }
2287
- async function fe(w) {
2288
- const L = re(p.value, w);
2289
- if (!L) return;
2290
- const M = Pl(L.node);
2291
- await Ke({
2292
- title: s("field.remove-title", {
2293
- title: v.value.find((le) => le.slug === L.node.type)?.title ?? L.node.type
2612
+ if (!E) return;
2613
+ const lt = Yl(E.slug, Ce(E));
2614
+ Q($t(d.value, $, D, k.length, lt)), p.value = lt.key;
2615
+ }
2616
+ function Ce($) {
2617
+ const D = $.content?.sample ?? {}, U = {};
2618
+ for (const [H, ee] of Object.entries(D))
2619
+ (!Array.isArray(ee) || ee.length === 0 || typeof ee[0] != "object") && (U[H] = ee);
2620
+ return U;
2621
+ }
2622
+ async function ge($) {
2623
+ const D = re(d.value, $);
2624
+ if (!D) return;
2625
+ const U = Gl(D.node);
2626
+ await Ze({
2627
+ title: a("field.remove-title", {
2628
+ title: c.value.find((ee) => ee.slug === D.node.type)?.title ?? D.node.type
2294
2629
  }),
2295
- message: M > 0 ? s("field.remove-text", { count: M }) : s("field.remove-alone"),
2296
- confirmText: s("field.remove"),
2297
- cancelText: s("page.cancel"),
2630
+ message: U > 0 ? a("field.remove-text", { count: U }) : a("field.remove-alone"),
2631
+ confirmText: a("field.remove"),
2632
+ cancelText: a("page.cancel"),
2298
2633
  tone: "danger"
2299
- }) && (g.value === w && (g.value = null), te(Dl(p.value, w)));
2634
+ }) && (p.value === $ && (p.value = null), Q(Xl(d.value, $)));
2300
2635
  }
2301
- function z(w) {
2302
- const L = re(p.value, w);
2303
- if (!L) return;
2304
- const M = Ot(L.node);
2305
- te(kt(p.value, L.parent?.key ?? null, L.field, L.index + 1, M)), g.value = M.key;
2636
+ function W($) {
2637
+ const D = re(d.value, $);
2638
+ if (!D) return;
2639
+ const U = Kt(D.node);
2640
+ Q($t(d.value, D.parent?.key ?? null, D.field, D.index + 1, U)), p.value = U.key;
2306
2641
  }
2307
- function O(w, L) {
2308
- te(Ul(p.value, w, L));
2642
+ function O($, D) {
2643
+ Q(Zl(d.value, $, D));
2309
2644
  }
2310
- function H(w, L, M) {
2311
- te(Rl(p.value, w, L, M));
2645
+ function j($, D, U) {
2646
+ Q(tn(d.value, $, D, U));
2312
2647
  }
2313
- function Y(w) {
2314
- g.value = g.value === w ? null : w;
2648
+ function G($) {
2649
+ p.value = p.value === $ ? null : $;
2315
2650
  }
2316
- function ve(w) {
2317
- w === null || !re(p.value, w) || (g.value = w, c.value && (B.value = !0));
2651
+ function fe($) {
2652
+ $ === null || !re(d.value, $) || (p.value = $, h.value && (A.value = !0));
2318
2653
  }
2319
- function me() {
2320
- g.value = null;
2654
+ function we() {
2655
+ p.value = null;
2321
2656
  }
2322
- function ie(w) {
2323
- g.value && te(Ol(p.value, g.value, w));
2657
+ function se($) {
2658
+ p.value && Q(en(d.value, p.value, $));
2324
2659
  }
2325
- let we;
2326
- X(
2327
- () => f.value?.node.values,
2328
- (w, L) => {
2329
- if (!w || !L || !k.value || !b || !y) return;
2330
- const M = g.value, Q = k.value.id;
2331
- clearTimeout(we), we = setTimeout(() => {
2332
- !M || !b || b.render(Q, { values: w, key: M }).then((le) => {
2333
- R.value?.replace(M, le.html) || R.value?.refresh();
2660
+ let ve;
2661
+ te(
2662
+ () => v.value?.node.values,
2663
+ ($, D) => {
2664
+ if (!$ || !D || !g.value || !r || !_) return;
2665
+ const U = p.value, H = g.value.id;
2666
+ clearTimeout(ve), ve = setTimeout(() => {
2667
+ !U || !r || r.render(H, { values: $, key: U }).then((ee) => {
2668
+ R.value?.replace(U, ee.html) || R.value?.refresh();
2334
2669
  }).catch(() => {
2335
2670
  });
2336
2671
  }, 300);
2337
2672
  },
2338
2673
  { deep: !0 }
2339
2674
  );
2340
- function Ve(w) {
2341
- w.key === "Escape" && g.value && me();
2675
+ function Ve($) {
2676
+ $.key === "Escape" && p.value && we();
2342
2677
  }
2343
2678
  Ue(async () => {
2344
- if (window.addEventListener("keydown", Ve), l.catalog === null && n) {
2345
- b = Ae(n);
2679
+ if (window.addEventListener("keydown", Ve), n.catalog === null && o) {
2680
+ r = ze(o);
2346
2681
  try {
2347
- P.value = await b.catalog();
2348
- } catch (w) {
2349
- G.danger(r(w));
2682
+ m.value = await r.catalog();
2683
+ } catch ($) {
2684
+ Z.danger(i($));
2350
2685
  }
2351
- } else n && (b = Ae(n));
2352
- }), Ge(() => {
2353
- clearTimeout(we), window.removeEventListener("keydown", Ve);
2686
+ } else o && (r = ze(o));
2687
+ }), Qe(() => {
2688
+ clearTimeout(ve), window.removeEventListener("keydown", Ve);
2354
2689
  });
2355
- const Ee = T(
2356
- () => k.value?.content ? st(k.value.content.schema) : []
2690
+ const Me = V(
2691
+ () => g.value?.content ? pt(g.value.content.schema) : []
2357
2692
  );
2358
- return (w, L) => e(a) ? (i(), S("div", Un, [
2359
- u(e(F), {
2693
+ return ($, D) => l(s) ? (u(), C("div", bs, [
2694
+ f(l(q), {
2360
2695
  size: "sm",
2361
2696
  tone: "muted"
2362
2697
  }, {
2363
- default: d(() => [
2364
- W(_(e(s)("field.nested-note")), 1)
2698
+ default: b(() => [
2699
+ z(S(l(a)("field.nested-note")), 1)
2365
2700
  ]),
2366
2701
  _: 1
2367
2702
  })
2368
- ])) : (i(), S("div", {
2703
+ ])) : (u(), C("div", {
2369
2704
  key: 1,
2370
2705
  ref_key: "host",
2371
- ref: q,
2372
- class: $e(["wx-blocks-host", { "is-compact": c.value }])
2706
+ ref: K,
2707
+ class: $e(["wx-blocks-host", { "is-compact": h.value }])
2373
2708
  }, [
2374
- E("div", {
2709
+ B("div", {
2375
2710
  class: $e(["wx-blocks", {
2376
- "is-editing": f.value !== null,
2377
- "has-preview": e(y) !== null && e(y).url.value !== null
2711
+ "is-editing": v.value !== null,
2712
+ "has-preview": l(_) !== null && l(_).url.value !== null
2378
2713
  }])
2379
2714
  }, [
2380
- (i(), I(Qt(c.value ? e(hl) : "div"), Xt(K.value, { class: "wx-blocks__side" }), {
2381
- default: d(() => [
2382
- f.value ? N("", !0) : (i(), S("div", Mn, [
2383
- E("div", Dn, [
2384
- E("span", On, _(e(s)("field.blocks")), 1),
2385
- u(e(F), {
2715
+ (u(), M(rl(h.value ? l(El) : "div"), ul(J.value, { class: "wx-blocks__side" }), {
2716
+ default: b(() => [
2717
+ v.value ? N("", !0) : (u(), C("div", gs, [
2718
+ B("div", ys, [
2719
+ B("span", ks, S(l(a)("field.blocks")), 1),
2720
+ f(l(q), {
2386
2721
  size: "sm",
2387
2722
  tone: "muted"
2388
2723
  }, {
2389
- default: d(() => [
2390
- W(_(p.value.length), 1)
2724
+ default: b(() => [
2725
+ z(S(d.value.length), 1)
2391
2726
  ]),
2392
2727
  _: 1
2393
2728
  })
2394
2729
  ]),
2395
- u(Pn, {
2396
- nodes: p.value,
2397
- catalog: v.value,
2398
- selected: g.value,
2399
- disabled: t.disabled,
2400
- onSelect: Y,
2401
- onAdd: Ce,
2402
- onRemove: fe,
2403
- onDuplicate: z,
2730
+ f(hs, {
2731
+ nodes: d.value,
2732
+ catalog: c.value,
2733
+ selected: p.value,
2734
+ disabled: e.disabled,
2735
+ onSelect: G,
2736
+ onAdd: ke,
2737
+ onRemove: ge,
2738
+ onDuplicate: W,
2404
2739
  onVisibility: O,
2405
- onReorder: H
2740
+ onReorder: j
2406
2741
  }, null, 8, ["nodes", "catalog", "selected", "disabled"]),
2407
- E("div", Rn, [
2408
- !t.disabled && (t.max === null || p.value.length < t.max) ? (i(), I(e(ce), {
2742
+ B("div", ws, [
2743
+ !e.disabled && (e.max === null || d.value.length < e.max) ? (u(), M(l(ce), {
2409
2744
  key: 0,
2410
2745
  variant: "outline",
2411
2746
  icon: "plus",
2412
2747
  class: "wx-blocks__add",
2413
- onClick: L[0] || (L[0] = (M) => Ce(null, null, null))
2748
+ onClick: D[0] || (D[0] = (U) => ke(null, null, null))
2414
2749
  }, {
2415
- default: d(() => [
2416
- W(_(e(s)("field.add")), 1)
2750
+ default: b(() => [
2751
+ z(S(l(a)("field.add")), 1)
2417
2752
  ]),
2418
2753
  _: 1
2419
2754
  })) : N("", !0),
2420
- !c.value && e(y) && e(y).url.value ? (i(), I(e(ce), {
2755
+ !h.value && l(_) && l(_).url.value ? (u(), M(l(ce), {
2421
2756
  key: 1,
2422
2757
  variant: "outline",
2423
2758
  icon: "eye",
2424
2759
  class: "wx-blocks__preview-button",
2425
- onClick: L[1] || (L[1] = (M) => R.value?.open())
2760
+ onClick: D[1] || (D[1] = (U) => R.value?.open())
2426
2761
  }, {
2427
- default: d(() => [
2428
- W(_(e(s)("field.preview")), 1)
2762
+ default: b(() => [
2763
+ z(S(l(a)("field.preview")), 1)
2429
2764
  ]),
2430
2765
  _: 1
2431
2766
  })) : N("", !0)
2432
2767
  ])
2433
2768
  ])),
2434
- f.value ? (i(), S("div", Hn, [
2435
- E("div", jn, [
2436
- E("span", Fn, [
2437
- m.value.length ? (i(), S("span", qn, [
2438
- (i(!0), S(j, null, ee(m.value, (M) => (i(), S(j, {
2439
- key: M.key
2769
+ v.value ? (u(), C("div", _s, [
2770
+ B("div", xs, [
2771
+ B("span", $s, [
2772
+ y.value.length ? (u(), C("span", Ss, [
2773
+ (u(!0), C(F, null, le(y.value, (U) => (u(), C(F, {
2774
+ key: U.key
2440
2775
  }, [
2441
- E("button", {
2776
+ B("button", {
2442
2777
  type: "button",
2443
2778
  class: "wx-blocks__trail-step",
2444
- onClick: (Q) => Y(M.key)
2445
- }, _(M.title), 9, Jn),
2446
- u(e(be), { name: "chevron-right" })
2779
+ onClick: (H) => G(U.key)
2780
+ }, S(U.title), 9, Es),
2781
+ f(l(he), { name: "chevron-right" })
2447
2782
  ], 64))), 128))
2448
2783
  ])) : N("", !0),
2449
- E("span", Kn, _(k.value?.title ?? f.value.node.type), 1)
2784
+ B("span", Ts, S(g.value?.title ?? v.value.node.type), 1)
2450
2785
  ]),
2451
- E("span", Gn, [
2452
- c.value ? N("", !0) : (i(), S("code", Yn, _(f.value.node.type), 1)),
2453
- u(e(Ie), {
2786
+ B("span", Cs, [
2787
+ h.value ? N("", !0) : (u(), C("code", Vs, S(v.value.node.type), 1)),
2788
+ f(l(Ne), {
2454
2789
  size: "sm",
2455
2790
  tone: "neutral",
2456
2791
  icon: "chevron-up",
2457
- title: e(s)("field.previous"),
2458
- disabled: x.value.previous === null,
2459
- onClick: L[2] || (L[2] = (M) => x.value.previous && Y(x.value.previous))
2792
+ title: l(a)("field.previous"),
2793
+ disabled: w.value.previous === null,
2794
+ onClick: D[2] || (D[2] = (U) => w.value.previous && G(w.value.previous))
2460
2795
  }, null, 8, ["title", "disabled"]),
2461
- u(e(Ie), {
2796
+ f(l(Ne), {
2462
2797
  size: "sm",
2463
2798
  tone: "neutral",
2464
2799
  icon: "chevron-down",
2465
- title: e(s)("field.next"),
2466
- disabled: x.value.next === null,
2467
- onClick: L[3] || (L[3] = (M) => x.value.next && Y(x.value.next))
2800
+ title: l(a)("field.next"),
2801
+ disabled: w.value.next === null,
2802
+ onClick: D[3] || (D[3] = (U) => w.value.next && G(w.value.next))
2468
2803
  }, null, 8, ["title", "disabled"]),
2469
- !c.value && e(y) && e(y).url.value ? (i(), I(e(ce), {
2804
+ !h.value && l(_) && l(_).url.value ? (u(), M(l(ce), {
2470
2805
  key: 1,
2471
2806
  size: "sm",
2472
2807
  variant: "outline",
2473
2808
  icon: "eye",
2474
2809
  class: "wx-blocks__preview-button",
2475
- "aria-label": e(s)("field.preview"),
2476
- onClick: L[4] || (L[4] = (M) => R.value?.open())
2810
+ "aria-label": l(a)("field.preview"),
2811
+ onClick: D[4] || (D[4] = (U) => R.value?.open())
2477
2812
  }, null, 8, ["aria-label"])) : N("", !0),
2478
- u(e(ce), {
2813
+ f(l(ce), {
2479
2814
  size: "sm",
2480
2815
  variant: "outline",
2481
- onClick: me
2816
+ onClick: we
2482
2817
  }, {
2483
- default: d(() => [
2484
- W(_(c.value ? e(s)("field.done") : `${e(s)("field.done")} · Esc`), 1)
2818
+ default: b(() => [
2819
+ z(S(h.value ? l(a)("field.done") : `${l(a)("field.done")} · Esc`), 1)
2485
2820
  ]),
2486
2821
  _: 1
2487
2822
  })
2488
2823
  ])
2489
2824
  ]),
2490
- E("div", Zn, [
2491
- k.value?.content ? (i(), I(e(zt), {
2492
- key: f.value.node.key,
2493
- "model-value": f.value.node.values,
2494
- root: Ee.value,
2495
- types: se.value,
2496
- translate: _e.value,
2497
- can: Te.value,
2498
- disabled: t.disabled,
2499
- "onUpdate:modelValue": ie
2500
- }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (i(), I(e(F), {
2825
+ B("div", Bs, [
2826
+ g.value?.content ? (u(), M(l(Ot), {
2827
+ key: v.value.node.key,
2828
+ "model-value": v.value.node.values,
2829
+ root: Me.value,
2830
+ types: pe.value,
2831
+ translate: ye.value,
2832
+ can: Ee.value,
2833
+ disabled: e.disabled,
2834
+ "onUpdate:modelValue": se
2835
+ }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (u(), M(l(q), {
2501
2836
  key: 1,
2502
2837
  size: "sm",
2503
2838
  tone: "danger"
2504
2839
  }, {
2505
- default: d(() => [
2506
- W(_(e(s)("field.unknown-type", { type: f.value.node.type })), 1)
2840
+ default: b(() => [
2841
+ z(S(l(a)("field.unknown-type", { type: v.value.node.type })), 1)
2507
2842
  ]),
2508
2843
  _: 1
2509
2844
  }))
@@ -2512,86 +2847,86 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2512
2847
  ]),
2513
2848
  _: 1
2514
2849
  }, 16)),
2515
- e(y) && e(y).url.value ? (i(), S("div", Qn, [
2516
- u(Tn, {
2850
+ l(_) && l(_).url.value ? (u(), C("div", As, [
2851
+ f(os, {
2517
2852
  ref_key: "previewEl",
2518
2853
  ref: R,
2519
- url: e(y).url.value,
2520
- selected: g.value,
2521
- reload: e(y).reload?.value ?? 0,
2522
- compact: c.value,
2523
- onSelect: ve,
2524
- onEdit: L[5] || (L[5] = (M) => B.value = !0)
2854
+ url: l(_).url.value,
2855
+ selected: p.value,
2856
+ reload: l(_).reload?.value ?? 0,
2857
+ compact: h.value,
2858
+ onSelect: fe,
2859
+ onEdit: D[5] || (D[5] = (U) => A.value = !0)
2525
2860
  }, null, 8, ["url", "selected", "reload", "compact"])
2526
2861
  ])) : N("", !0)
2527
2862
  ], 2)
2528
2863
  ], 2));
2529
2864
  }
2530
- }), ea = /* @__PURE__ */ oe(Xn, [["__scopeId", "data-v-613ad857"]]), ta = { class: "wx-block-card__body" }, la = { class: "wx-block-card__title" }, na = { class: "wx-block-card__chips" }, aa = /* @__PURE__ */ ae({
2865
+ }), Ws = /* @__PURE__ */ ie(Ls, [["__scopeId", "data-v-613ad857"]]), zs = { class: "wx-block-card__body" }, Ds = { class: "wx-block-card__title" }, Ms = { class: "wx-block-card__chips" }, Ns = /* @__PURE__ */ ae({
2531
2866
  __name: "BlockCard",
2532
2867
  props: {
2533
2868
  block: {}
2534
2869
  },
2535
2870
  emits: ["open"],
2536
- setup(t, { emit: l }) {
2537
- const o = l, a = de("webx-blocks");
2538
- return (s, r) => (i(), S("button", {
2871
+ setup(e, { emit: n }) {
2872
+ const t = n, s = de("webx-blocks");
2873
+ return (a, i) => (u(), C("button", {
2539
2874
  type: "button",
2540
2875
  class: "wx-block-card",
2541
- onClick: r[0] || (r[0] = (n) => o("open", t.block))
2876
+ onClick: i[0] || (i[0] = (o) => t("open", e.block))
2542
2877
  }, [
2543
- u(Ft, {
2544
- thumbnail: t.block.thumbnail,
2878
+ f(tl, {
2879
+ thumbnail: e.block.thumbnail,
2545
2880
  height: 120
2546
2881
  }, null, 8, ["thumbnail"]),
2547
- E("div", ta, [
2548
- E("div", la, _(t.block.title), 1),
2549
- u(e(F), {
2882
+ B("div", zs, [
2883
+ B("div", Ds, S(e.block.title), 1),
2884
+ f(l(q), {
2550
2885
  size: "sm",
2551
2886
  tone: "muted"
2552
2887
  }, {
2553
- default: d(() => [
2554
- E("code", null, _(t.block.slug), 1),
2555
- W(" · " + _(e(nt)(t.block.usage_count, e(a))), 1)
2888
+ default: b(() => [
2889
+ B("code", null, S(e.block.slug), 1),
2890
+ z(" · " + S(l(rt)(e.block.usage_count, l(s))), 1)
2556
2891
  ]),
2557
2892
  _: 1
2558
2893
  }),
2559
- E("div", na, [
2560
- t.block.draft ? (i(), I(e(ue), {
2894
+ B("div", Ms, [
2895
+ e.block.draft ? (u(), M(l(ue), {
2561
2896
  key: 0,
2562
2897
  type: "warning",
2563
2898
  dot: ""
2564
2899
  }, {
2565
- default: d(() => [
2566
- W(_(e(a)("page.draft", { number: t.block.draft.number })), 1)
2900
+ default: b(() => [
2901
+ z(S(l(s)("page.draft", { number: e.block.draft.number })), 1)
2567
2902
  ]),
2568
2903
  _: 1
2569
2904
  })) : N("", !0),
2570
- t.block.published ? (i(), I(e(ue), {
2905
+ e.block.published ? (u(), M(l(ue), {
2571
2906
  key: 1,
2572
2907
  type: "success",
2573
2908
  dot: ""
2574
2909
  }, {
2575
- default: d(() => [
2576
- W(_(e(a)("page.live", { number: t.block.published.number })), 1)
2910
+ default: b(() => [
2911
+ z(S(l(s)("page.live", { number: e.block.published.number })), 1)
2577
2912
  ]),
2578
2913
  _: 1
2579
- })) : (i(), I(e(ue), {
2914
+ })) : (u(), M(l(ue), {
2580
2915
  key: 2,
2581
2916
  type: "default"
2582
2917
  }, {
2583
- default: d(() => [
2584
- W(_(e(a)("page.never-published")), 1)
2918
+ default: b(() => [
2919
+ z(S(l(s)("page.never-published")), 1)
2585
2920
  ]),
2586
2921
  _: 1
2587
2922
  })),
2588
- t.block.is_enabled ? N("", !0) : (i(), I(e(ue), {
2923
+ e.block.is_enabled ? N("", !0) : (u(), M(l(ue), {
2589
2924
  key: 3,
2590
2925
  type: "default",
2591
2926
  variant: "outline"
2592
2927
  }, {
2593
- default: d(() => [
2594
- W(_(e(a)("page.hidden")), 1)
2928
+ default: b(() => [
2929
+ z(S(l(s)("page.hidden")), 1)
2595
2930
  ]),
2596
2931
  _: 1
2597
2932
  }))
@@ -2599,62 +2934,62 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2599
2934
  ])
2600
2935
  ]));
2601
2936
  }
2602
- }), oa = /* @__PURE__ */ oe(aa, [["__scopeId", "data-v-3d94f339"]]), sa = { class: "wx-block-create" }, ia = /* @__PURE__ */ ae({
2937
+ }), Is = /* @__PURE__ */ ie(Ns, [["__scopeId", "data-v-3d94f339"]]), Ps = { class: "wx-block-create" }, Os = /* @__PURE__ */ ae({
2603
2938
  __name: "BlockCreateDialog",
2604
- setup(t) {
2605
- const { resolve: l, dismiss: o, open: a } = Bt(), s = Me(), r = Ae(s);
2606
- Re();
2607
- const n = de("webx-blocks"), b = De(), P = T(() => s.state.manifest?.modules.find((y) => y.id === "blocks")?.meta?.groups ?? ["content"]), v = U({ title: "", slug: "", group: P.value[0] ?? "content" }), p = U({}), g = U(!1), f = U(!1), k = T(
2608
- () => P.value.map((m) => ({ value: m, label: ze(m, n) }))
2939
+ setup(e) {
2940
+ const { resolve: n, dismiss: t, open: s } = Mt(), a = Re(), i = ze(a);
2941
+ He();
2942
+ const o = de("webx-blocks"), r = je(), m = V(() => a.state.manifest?.modules.find((_) => _.id === "blocks")?.meta?.groups ?? ["content"]), c = I({ title: "", slug: "", group: m.value[0] ?? "content" }), d = I({}), p = I(!1), v = I(!1), g = V(
2943
+ () => m.value.map((y) => ({ value: y, label: De(y, o) }))
2609
2944
  );
2610
- function C(m) {
2611
- return m.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
2945
+ function x(y) {
2946
+ return y.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
2612
2947
  }
2613
- X(
2614
- () => v.value.title,
2615
- (m) => {
2616
- f.value || (v.value.slug = C(m));
2948
+ te(
2949
+ () => c.value.title,
2950
+ (y) => {
2951
+ v.value || (c.value.slug = x(y));
2617
2952
  }
2618
2953
  );
2619
- function V(m) {
2620
- return p.value[m]?.[0];
2954
+ function T(y) {
2955
+ return d.value[y]?.[0];
2621
2956
  }
2622
- async function x() {
2623
- g.value = !0, p.value = {};
2957
+ async function w() {
2958
+ p.value = !0, d.value = {};
2624
2959
  try {
2625
- l(await r.create(v.value));
2626
- } catch (m) {
2627
- const y = m.body;
2628
- y?.errors ? p.value = y.errors : G.danger(b(m, n("page.failed")));
2960
+ n(await i.create(c.value));
2961
+ } catch (y) {
2962
+ const _ = y.body;
2963
+ _?.errors ? d.value = _.errors : Z.danger(r(y, o("page.failed")));
2629
2964
  } finally {
2630
- g.value = !1;
2965
+ p.value = !1;
2631
2966
  }
2632
2967
  }
2633
- return (m, y) => (i(), I(e(Lt), {
2634
- open: e(a),
2635
- "onUpdate:open": y[5] || (y[5] = (R) => $t(a) ? a.value = R : null),
2636
- title: e(n)("page.new"),
2968
+ return (y, _) => (u(), M(l(Nt), {
2969
+ open: l(s),
2970
+ "onUpdate:open": _[5] || (_[5] = (R) => Bt(s) ? s.value = R : null),
2971
+ title: l(o)("page.new"),
2637
2972
  width: 520
2638
2973
  }, {
2639
- footer: d(() => [
2640
- u(e(bl), { size: "sm" }, {
2641
- default: d(() => [
2642
- u(e(ce), {
2974
+ footer: b(() => [
2975
+ f(l(Tl), { size: "sm" }, {
2976
+ default: b(() => [
2977
+ f(l(ce), {
2643
2978
  variant: "outline",
2644
- onClick: y[4] || (y[4] = (R) => e(o)())
2979
+ onClick: _[4] || (_[4] = (R) => l(t)())
2645
2980
  }, {
2646
- default: d(() => [
2647
- W(_(e(n)("page.cancel")), 1)
2981
+ default: b(() => [
2982
+ z(S(l(o)("page.cancel")), 1)
2648
2983
  ]),
2649
2984
  _: 1
2650
2985
  }),
2651
- u(e(ce), {
2986
+ f(l(ce), {
2652
2987
  type: "primary",
2653
- loading: g.value,
2654
- onClick: x
2988
+ loading: p.value,
2989
+ onClick: w
2655
2990
  }, {
2656
- default: d(() => [
2657
- W(_(e(n)("page.create")), 1)
2991
+ default: b(() => [
2992
+ z(S(l(o)("page.create")), 1)
2658
2993
  ]),
2659
2994
  _: 1
2660
2995
  }, 8, ["loading"])
@@ -2662,46 +2997,46 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2662
2997
  _: 1
2663
2998
  })
2664
2999
  ]),
2665
- default: d(() => [
2666
- E("div", sa, [
2667
- u(e(ne), {
2668
- label: e(n)("page.title"),
2669
- error: V("title")
3000
+ default: b(() => [
3001
+ B("div", Ps, [
3002
+ f(l(oe), {
3003
+ label: l(o)("page.title"),
3004
+ error: T("title")
2670
3005
  }, {
2671
- default: d(() => [
2672
- u(e(Pe), {
2673
- modelValue: v.value.title,
2674
- "onUpdate:modelValue": y[0] || (y[0] = (R) => v.value.title = R),
3006
+ default: b(() => [
3007
+ f(l(Oe), {
3008
+ modelValue: c.value.title,
3009
+ "onUpdate:modelValue": _[0] || (_[0] = (R) => c.value.title = R),
2675
3010
  autofocus: ""
2676
3011
  }, null, 8, ["modelValue"])
2677
3012
  ]),
2678
3013
  _: 1
2679
3014
  }, 8, ["label", "error"]),
2680
- u(e(ne), {
2681
- label: e(n)("page.identifier"),
2682
- help: e(n)("page.identifier-help"),
2683
- error: V("slug")
3015
+ f(l(oe), {
3016
+ label: l(o)("page.identifier"),
3017
+ help: l(o)("page.identifier-help"),
3018
+ error: T("slug")
2684
3019
  }, {
2685
- default: d(() => [
2686
- u(e(Pe), {
2687
- modelValue: v.value.slug,
2688
- "onUpdate:modelValue": y[1] || (y[1] = (R) => v.value.slug = R),
3020
+ default: b(() => [
3021
+ f(l(Oe), {
3022
+ modelValue: c.value.slug,
3023
+ "onUpdate:modelValue": _[1] || (_[1] = (R) => c.value.slug = R),
2689
3024
  placeholder: "hero",
2690
- onInput: y[2] || (y[2] = (R) => f.value = !0)
3025
+ onInput: _[2] || (_[2] = (R) => v.value = !0)
2691
3026
  }, null, 8, ["modelValue"])
2692
3027
  ]),
2693
3028
  _: 1
2694
3029
  }, 8, ["label", "help", "error"]),
2695
- u(e(ne), {
2696
- label: e(n)("page.group"),
2697
- help: e(n)("page.group-help"),
2698
- error: V("group")
3030
+ f(l(oe), {
3031
+ label: l(o)("page.group"),
3032
+ help: l(o)("page.group-help"),
3033
+ error: T("group")
2699
3034
  }, {
2700
- default: d(() => [
2701
- u(e(Et), {
2702
- modelValue: v.value.group,
2703
- "onUpdate:modelValue": y[3] || (y[3] = (R) => v.value.group = R),
2704
- options: k.value
3035
+ default: b(() => [
3036
+ f(l(Dt), {
3037
+ modelValue: c.value.group,
3038
+ "onUpdate:modelValue": _[3] || (_[3] = (R) => c.value.group = R),
3039
+ options: g.value
2705
3040
  }, null, 8, ["modelValue", "options"])
2706
3041
  ]),
2707
3042
  _: 1
@@ -2711,121 +3046,121 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2711
3046
  _: 1
2712
3047
  }, 8, ["open", "title"]));
2713
3048
  }
2714
- }), ra = /* @__PURE__ */ oe(ia, [["__scopeId", "data-v-a4c0d44c"]]), ua = {
3049
+ }), Us = /* @__PURE__ */ ie(Os, [["__scopeId", "data-v-a4c0d44c"]]), Rs = {
2715
3050
  key: 1,
2716
3051
  class: "wx-blocks-page__toolbar"
2717
- }, ca = { class: "wx-blocks-page__cards" }, da = { class: "wx-blocks-page__ghost-body" }, pa = {
3052
+ }, js = { class: "wx-blocks-page__cards" }, Fs = { class: "wx-blocks-page__ghost-body" }, Hs = {
2718
3053
  key: 0,
2719
3054
  class: "wx-blocks-page__group-title"
2720
- }, va = { class: "wx-blocks-page__cards" }, fa = /* @__PURE__ */ ae({
3055
+ }, qs = { class: "wx-blocks-page__cards" }, Ks = /* @__PURE__ */ ae({
2721
3056
  __name: "BlocksPage",
2722
3057
  props: {
2723
3058
  base: { default: "/blocks" }
2724
3059
  },
2725
- setup(t) {
2726
- const l = t, o = Me(), a = Ae(o), s = Tt();
2727
- Re();
2728
- const r = de("webx-blocks"), n = De(), b = U([]), P = U(!0), v = U(""), p = U(""), g = At(ra), f = T(() => {
2729
- const c = o.state.manifest?.modules.find((B) => B.id === "blocks")?.meta;
3060
+ setup(e) {
3061
+ const n = e, t = Re(), s = ze(t), a = Lt();
3062
+ He();
3063
+ const i = de("webx-blocks"), o = je(), r = I([]), m = I(!0), c = I(""), d = I(""), p = Pt(Us), v = V(() => {
3064
+ const h = t.state.manifest?.modules.find((A) => A.id === "blocks")?.meta;
2730
3065
  return {
2731
- groups: c?.groups ?? [],
2732
- editing: c?.editing ?? !0,
2733
- provides: c?.provides ?? []
3066
+ groups: h?.groups ?? [],
3067
+ editing: h?.editing ?? !0,
3068
+ provides: h?.provides ?? []
2734
3069
  };
2735
- }), k = T(() => o.can("blocks.manage") && f.value.editing), C = T(
2736
- () => o.state.manifest?.modules.find((c) => c.id === "blocks")?.title ?? r("module.title")
2737
- ), V = T(() => {
2738
- const c = v.value.trim().toLowerCase(), B = p.value === "" ? b.value : b.value.filter((D) => D.group === p.value);
2739
- return c === "" ? B : B.filter(
2740
- (D) => D.title.toLowerCase().includes(c) || D.slug.includes(c) || (D.description ?? "").toLowerCase().includes(c)
3070
+ }), g = V(() => t.can("blocks.manage") && v.value.editing), x = V(
3071
+ () => t.state.manifest?.modules.find((h) => h.id === "blocks")?.title ?? i("module.title")
3072
+ ), T = V(() => {
3073
+ const h = c.value.trim().toLowerCase(), A = d.value === "" ? r.value : r.value.filter((P) => P.group === d.value);
3074
+ return h === "" ? A : A.filter(
3075
+ (P) => P.title.toLowerCase().includes(h) || P.slug.includes(h) || (P.description ?? "").toLowerCase().includes(h)
2741
3076
  );
2742
- }), x = T(() => {
2743
- const c = [...f.value.groups];
2744
- for (const B of b.value)
2745
- c.includes(B.group) || c.push(B.group);
2746
- return c.filter((B) => b.value.some((D) => D.group === B));
2747
- }), m = T(
2748
- () => x.value.length < 2 ? [] : [
2749
- { value: "", label: r("page.all-groups") },
2750
- ...x.value.map((c) => ({ value: c, label: ze(c, r) }))
3077
+ }), w = V(() => {
3078
+ const h = [...v.value.groups];
3079
+ for (const A of r.value)
3080
+ h.includes(A.group) || h.push(A.group);
3081
+ return h.filter((A) => r.value.some((P) => P.group === A));
3082
+ }), y = V(
3083
+ () => w.value.length < 2 ? [] : [
3084
+ { value: "", label: i("page.all-groups") },
3085
+ ...w.value.map((h) => ({ value: h, label: De(h, i) }))
2751
3086
  ]
2752
- ), y = T(() => {
2753
- const c = x.value.map((D) => ({
2754
- id: D,
2755
- label: ze(D, r),
2756
- blocks: V.value.filter((K) => K.group === D)
2757
- })).filter((D) => D.blocks.length > 0);
2758
- return p.value !== "" || V.value.length <= 5 || v.value.trim() !== "" || c.length < 2 ? [{ id: "", label: "", blocks: V.value }] : c;
3087
+ ), _ = V(() => {
3088
+ const h = w.value.map((P) => ({
3089
+ id: P,
3090
+ label: De(P, i),
3091
+ blocks: T.value.filter((J) => J.group === P)
3092
+ })).filter((P) => P.blocks.length > 0);
3093
+ return d.value !== "" || T.value.length <= 5 || c.value.trim() !== "" || h.length < 2 ? [{ id: "", label: "", blocks: T.value }] : h;
2759
3094
  });
2760
3095
  async function R() {
2761
- P.value = !0;
3096
+ m.value = !0;
2762
3097
  try {
2763
- b.value = await a.list();
2764
- } catch (c) {
2765
- G.danger(n(c));
3098
+ r.value = await s.list();
3099
+ } catch (h) {
3100
+ Z.danger(o(h));
2766
3101
  } finally {
2767
- P.value = !1;
3102
+ m.value = !1;
2768
3103
  }
2769
3104
  }
2770
- function q(c) {
2771
- s.push(`${l.base}/${c.id}`);
3105
+ function K(h) {
3106
+ a.push(`${n.base}/${h.id}`);
2772
3107
  }
2773
- async function J() {
2774
- const c = await g({});
2775
- c && q(c);
3108
+ async function Y() {
3109
+ const h = await p({});
3110
+ h && K(h);
2776
3111
  }
2777
3112
  Ue(R);
2778
- const Z = T(
2779
- () => k.value ? [{ key: "new", label: r("page.new"), icon: "plus", primary: !0, run: () => {
2780
- J();
3113
+ const X = V(
3114
+ () => g.value ? [{ key: "new", label: i("page.new"), icon: "plus", primary: !0, run: () => {
3115
+ Y();
2781
3116
  } }] : []
2782
3117
  );
2783
- return (c, B) => (i(), I(e(rl), {
2784
- view: p.value,
2785
- "onUpdate:view": B[1] || (B[1] = (D) => p.value = D),
3118
+ return (h, A) => (u(), M(l(gl), {
3119
+ view: d.value,
3120
+ "onUpdate:view": A[1] || (A[1] = (P) => d.value = P),
2786
3121
  class: "wx-blocks-page",
2787
- title: C.value,
2788
- views: m.value,
2789
- actions: Z.value
3122
+ title: x.value,
3123
+ views: y.value,
3124
+ actions: X.value
2790
3125
  }, {
2791
- default: d(() => [
2792
- f.value.editing ? N("", !0) : (i(), I(e(Vt), {
3126
+ default: b(() => [
3127
+ v.value.editing ? N("", !0) : (u(), M(l(zt), {
2793
3128
  key: 0,
2794
3129
  type: "info",
2795
3130
  variant: "soft",
2796
- description: e(r)("page.editing-off")
3131
+ description: l(i)("page.editing-off")
2797
3132
  }, null, 8, ["description"])),
2798
- P.value || b.value.length > 0 ? (i(), S("div", ua, [
2799
- u(e(Pe), {
2800
- modelValue: v.value,
2801
- "onUpdate:modelValue": B[0] || (B[0] = (D) => v.value = D),
3133
+ m.value || r.value.length > 0 ? (u(), C("div", Rs, [
3134
+ f(l(Oe), {
3135
+ modelValue: c.value,
3136
+ "onUpdate:modelValue": A[0] || (A[0] = (P) => c.value = P),
2802
3137
  class: "wx-blocks-page__search",
2803
- placeholder: e(r)("page.search"),
3138
+ placeholder: l(i)("page.search"),
2804
3139
  clearable: ""
2805
3140
  }, null, 8, ["modelValue", "placeholder"])
2806
3141
  ])) : N("", !0),
2807
- P.value ? (i(), I(e(We), { key: 2 }, {
2808
- template: d(() => [
2809
- E("div", ca, [
2810
- (i(), S(j, null, ee(4, (D) => E("div", {
2811
- key: D,
3142
+ m.value ? (u(), M(l(Le), { key: 2 }, {
3143
+ template: b(() => [
3144
+ B("div", js, [
3145
+ (u(), C(F, null, le(4, (P) => B("div", {
3146
+ key: P,
2812
3147
  class: "wx-blocks-page__ghost"
2813
3148
  }, [
2814
- u(e(Fe), {
3149
+ f(l(Ke), {
2815
3150
  variant: "image",
2816
3151
  height: 120,
2817
3152
  class: "wx-blocks-page__ghost-thumb"
2818
3153
  }),
2819
- E("div", da, [
2820
- u(e(Fe), {
3154
+ B("div", Fs, [
3155
+ f(l(Ke), {
2821
3156
  variant: "title",
2822
3157
  width: "45%"
2823
3158
  }),
2824
- u(e(Fe), {
3159
+ f(l(Ke), {
2825
3160
  variant: "text",
2826
3161
  width: "70%"
2827
3162
  }),
2828
- u(e(Fe), {
3163
+ f(l(Ke), {
2829
3164
  variant: "button",
2830
3165
  width: "64px",
2831
3166
  height: "22px"
@@ -2835,21 +3170,21 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2835
3170
  ])
2836
3171
  ]),
2837
3172
  _: 1
2838
- })) : b.value.length === 0 ? (i(), I(e(Wt), {
3173
+ })) : r.value.length === 0 ? (u(), M(l(It), {
2839
3174
  key: 3,
2840
3175
  icon: "grid",
2841
- title: e(r)("page.empty"),
2842
- description: e(r)("page.empty-help")
2843
- }, null, 8, ["title", "description"])) : (i(!0), S(j, { key: 4 }, ee(y.value, (D) => (i(), S("section", {
2844
- key: D.id,
3176
+ title: l(i)("page.empty"),
3177
+ description: l(i)("page.empty-help")
3178
+ }, null, 8, ["title", "description"])) : (u(!0), C(F, { key: 4 }, le(_.value, (P) => (u(), C("section", {
3179
+ key: P.id,
2845
3180
  class: "wx-blocks-page__group"
2846
3181
  }, [
2847
- D.label ? (i(), S("div", pa, _(D.label), 1)) : N("", !0),
2848
- E("div", va, [
2849
- (i(!0), S(j, null, ee(D.blocks, (K) => (i(), I(oa, {
2850
- key: K.id,
2851
- block: K,
2852
- onOpen: q
3182
+ P.label ? (u(), C("div", Hs, S(P.label), 1)) : N("", !0),
3183
+ B("div", qs, [
3184
+ (u(!0), C(F, null, le(P.blocks, (J) => (u(), M(Is, {
3185
+ key: J.id,
3186
+ block: J,
3187
+ onOpen: K
2853
3188
  }, null, 8, ["block"]))), 128))
2854
3189
  ])
2855
3190
  ]))), 128))
@@ -2857,19 +3192,19 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2857
3192
  _: 1
2858
3193
  }, 8, ["view", "title", "views", "actions"]));
2859
3194
  }
2860
- }), ma = /* @__PURE__ */ oe(fa, [["__scopeId", "data-v-553b680f"]]);
2861
- function $a(t = {}) {
2862
- const l = t.path ?? "/blocks";
3195
+ }), Ys = /* @__PURE__ */ ie(Ks, [["__scopeId", "data-v-553b680f"]]);
3196
+ function oo(e = {}) {
3197
+ const n = e.path ?? "/blocks";
2863
3198
  return {
2864
3199
  id: "blocks",
2865
- path: l,
3200
+ path: n,
2866
3201
  routes: [
2867
- { path: l, name: "webx.blocks", component: ma, props: { base: l } },
3202
+ { path: n, name: "webx.blocks", component: Ys, props: { base: n } },
2868
3203
  {
2869
- path: `${l}/:id(\\d+)`,
3204
+ path: `${n}/:id(\\d+)`,
2870
3205
  name: "webx.blocks.edit",
2871
- component: dn,
2872
- props: { base: l }
3206
+ component: Fn,
3207
+ props: { base: n }
2873
3208
  }
2874
3209
  ],
2875
3210
  // What a screen means by `wx-blocks`: the content of an entity as a tree of blocks. A
@@ -2877,47 +3212,47 @@ function $a(t = {}) {
2877
3212
  // draws its children through the renderer; it needs the node for `props.allow` alone.
2878
3213
  types: {
2879
3214
  "wx-blocks": {
2880
- component: ea,
3215
+ component: Ws,
2881
3216
  kind: "field",
2882
3217
  nested: !0,
2883
3218
  wide: !0,
2884
- bind: () => ({ blocksPath: l })
3219
+ bind: () => ({ blocksPath: n })
2885
3220
  }
2886
3221
  }
2887
3222
  };
2888
3223
  }
2889
3224
  export {
2890
- dn as WxBlockEditorPage,
2891
- _n as WxBlockPicker,
2892
- zl as WxBlockStage,
2893
- Ft as WxBlockThumb,
2894
- ea as WxBlocks,
2895
- ma as WxBlocksPage,
2896
- $a as blocks,
2897
- Hl as blocksMessages,
2898
- it as blocksPreviewKey,
2899
- Ot as cloneNode,
2900
- Nl as countType,
2901
- Ae as createBlocksApi,
2902
- It as findRange,
2903
- st as formSchema,
2904
- et as highlightBlock,
2905
- kt as insertNode,
2906
- Ut as isNode,
2907
- Ze as isNodeList,
2908
- Fl as lintBlock,
3225
+ Fn as WxBlockEditorPage,
3226
+ ts as WxBlockPicker,
3227
+ Kl as WxBlockStage,
3228
+ tl as WxBlockThumb,
3229
+ Ws as WxBlocks,
3230
+ Ys as WxBlocksPage,
3231
+ oo as blocks,
3232
+ ln as blocksMessages,
3233
+ ft as blocksPreviewKey,
3234
+ Kt as cloneNode,
3235
+ Jl as countType,
3236
+ ze as createBlocksApi,
3237
+ Ut as findRange,
3238
+ pt as formSchema,
3239
+ st as highlightBlock,
3240
+ $t as insertNode,
3241
+ Ft as isNode,
3242
+ et as isNodeList,
3243
+ Sn as lintBlock,
2909
3244
  re as locate,
2910
- Il as makeNode,
2911
- lt as newKey,
2912
- _a as provideBlocksPreview,
2913
- Dl as removeNode,
2914
- Nt as replaceBlock,
2915
- Rl as replaceList,
2916
- Pt as stageDocument,
2917
- wa as typesIn,
2918
- ql as undeclared,
2919
- Ol as updateValues,
2920
- xa as useBlocksPreview,
2921
- Oe as walk
3245
+ Yl as makeNode,
3246
+ it as newKey,
3247
+ no as provideBlocksPreview,
3248
+ Xl as removeNode,
3249
+ Rt as replaceBlock,
3250
+ tn as replaceList,
3251
+ jt as stageDocument,
3252
+ lo as typesIn,
3253
+ En as undeclared,
3254
+ en as updateValues,
3255
+ so as useBlocksPreview,
3256
+ Fe as walk
2922
3257
  };
2923
3258
  //# sourceMappingURL=index.js.map