@webx-ui/module-blocks 0.8.5 → 0.8.7

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