@webx-ui/module-media 0.7.2 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { defineComponent as S, useModel as A, ref as R, watch as G, openBlock as w, createBlock as T, unref as e, mergeModels as q, computed as z, resolveDirective as Ge, withCtx as b, createElementBlock as L, Fragment as ce, renderList as me, withDirectives as Ye, createCommentVNode as D, createVNode as g, createTextVNode as O, toDisplayString as U, isRef as ve, useTemplateRef as oe, onMounted as Fe, nextTick as Je, createElementVNode as V, withKeys as Qe, normalizeClass as pe, createSlots as We, inject as Ze, normalizeStyle as fe, mergeProps as ge } from "vue";
2
- import { useTranslate as H, useAdmin as se, useErrorText as et, adminKey as tt, WxListScreen as lt } from "@webx-ui/module-admin";
3
- import { WxTree as at, WxSelectionArea as it, WxFileCard as Le, WxEmpty as nt, toast as J, WxAction as B, WxInput as Z, WxDropdown as Ve, WxDropdownItem as Te, WxActions as le, useModal as ye, WxDialog as he, WxSelect as ot, WxSpace as we, WxButton as I, useElementWidth as st, createModal as ae, WxPagination as rt, WxDrawer as dt, confirm as ue, openImageEditor as ut, WxSortableList as ct, WxPopover as Re, WxPopconfirm as De, WxImage as mt, WxCard as pt } from "@webx-ui/core";
1
+ import { defineComponent as S, useModel as O, ref as R, watch as G, openBlock as h, createBlock as z, unref as e, mergeModels as q, computed as V, resolveDirective as Ge, withCtx as b, createElementBlock as L, Fragment as ce, renderList as me, withDirectives as Ye, createCommentVNode as D, createVNode as g, createTextVNode as A, toDisplayString as U, isRef as ve, useTemplateRef as oe, onMounted as Fe, nextTick as Je, createElementVNode as T, withKeys as Qe, normalizeClass as pe, createSlots as Ze, inject as et, normalizeStyle as fe, mergeProps as ge } from "vue";
2
+ import { useTranslate as I, useAdmin as se, useErrorText as tt, adminKey as lt, WxListScreen as at } from "@webx-ui/module-admin";
3
+ import { WxTree as it, WxSelectionArea as nt, WxFileCard as We, WxEmpty as ot, toast as J, WxAction as B, WxInput as Z, WxDropdown as Ve, WxDropdownItem as Te, WxActions as le, useModal as ye, WxDialog as he, WxSelect as st, WxSpace as we, WxButton as X, useElementWidth as rt, createModal as ae, WxPagination as dt, WxDrawer as ut, confirm as ue, openImageEditor as ct, WxSortableList as mt, WxPopover as Le, WxPopconfirm as Re, WxImage as pt, WxCard as ft } from "@webx-ui/core";
4
4
  function be(a) {
5
5
  const i = `${a.apiPath}/media`, n = (l) => l.data;
6
6
  return {
@@ -26,24 +26,24 @@ function be(a) {
26
26
  async upload(l, r, d) {
27
27
  const v = new FormData();
28
28
  return v.append("directory_id", String(l)), r.forEach((t) => v.append("files[]", t)), new Promise((t, x) => {
29
- const y = new XMLHttpRequest();
30
- y.open("POST", `${i}/files`), y.responseType = "json", y.withCredentials = !0, y.setRequestHeader("Accept", "application/json"), y.setRequestHeader("X-Requested-With", "XMLHttpRequest"), y.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
31
- const s = ft();
32
- s && y.setRequestHeader("X-XSRF-TOKEN", s), y.upload.addEventListener("progress", (u) => {
29
+ const w = new XMLHttpRequest();
30
+ w.open("POST", `${i}/files`), w.responseType = "json", w.withCredentials = !0, w.setRequestHeader("Accept", "application/json"), w.setRequestHeader("X-Requested-With", "XMLHttpRequest"), w.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
31
+ const s = vt();
32
+ s && w.setRequestHeader("X-XSRF-TOKEN", s), w.upload.addEventListener("progress", (u) => {
33
33
  u.lengthComputable && d?.(Math.round(u.loaded / u.total * 100));
34
- }), y.addEventListener("load", () => {
35
- const u = y.response;
36
- if (y.status >= 200 && y.status < 300 && u?.data) {
34
+ }), w.addEventListener("load", () => {
35
+ const u = w.response;
36
+ if (w.status >= 200 && w.status < 300 && u?.data) {
37
37
  t(u.data);
38
38
  return;
39
39
  }
40
40
  x(
41
41
  Object.assign(new Error(u?.message ?? "Upload failed"), {
42
- status: y.status,
42
+ status: w.status,
43
43
  body: u
44
44
  })
45
45
  );
46
- }), y.addEventListener("error", () => x(new Error("Upload failed"))), y.send(v);
46
+ }), w.addEventListener("error", () => x(new Error("Upload failed"))), w.send(v);
47
47
  });
48
48
  },
49
49
  rename: (l, r) => a.http.patch(`${i}/files/${l}`, { name: r }).then(n),
@@ -63,18 +63,18 @@ function be(a) {
63
63
  }
64
64
  };
65
65
  }
66
- function ft() {
66
+ function vt() {
67
67
  const a = document.cookie.split("; ").find((i) => i.startsWith("XSRF-TOKEN="));
68
68
  return a ? decodeURIComponent(a.slice(11)) : null;
69
69
  }
70
- function Be(a) {
70
+ function De(a) {
71
71
  const i = ["B", "KB", "MB", "GB", "TB"];
72
72
  let n = a, l = 0;
73
73
  for (; n >= 1024 && l < i.length - 1; )
74
74
  n /= 1024, l++;
75
75
  return `${n >= 10 || l === 0 ? Math.round(n) : n.toFixed(1)} ${i[l]}`;
76
76
  }
77
- function vt(a) {
77
+ function gt(a) {
78
78
  return a.split("/").pop() || a;
79
79
  }
80
80
  const ze = /* @__PURE__ */ S({
@@ -87,11 +87,11 @@ const ze = /* @__PURE__ */ S({
87
87
  }),
88
88
  emits: /* @__PURE__ */ q(["move"], ["update:selected"]),
89
89
  setup(a, { emit: i }) {
90
- const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = R([]), t = R([]);
90
+ const n = a, l = O(a, "selected"), r = i, d = I("webx-media"), v = R([]), t = R([]);
91
91
  G(
92
92
  () => n.directories,
93
93
  (u) => {
94
- v.value = u.map(x), t.value = y(u);
94
+ v.value = u.map(x), t.value = w(u);
95
95
  },
96
96
  { immediate: !0, deep: !0 }
97
97
  );
@@ -102,20 +102,20 @@ const ze = /* @__PURE__ */ S({
102
102
  children: (u.children ?? []).map(x)
103
103
  };
104
104
  }
105
- function y(u) {
106
- return u.flatMap((k) => [k.id, ...y(k.children ?? [])]);
105
+ function w(u) {
106
+ return u.flatMap((k) => [k.id, ...w(k.children ?? [])]);
107
107
  }
108
108
  function s(u) {
109
109
  const k = u.zone === "inside" ? u.target : u.parent;
110
110
  k && r("move", u.node.id, k.id);
111
111
  }
112
- return (u, k) => (w(), T(e(at), {
112
+ return (u, k) => (h(), z(e(it), {
113
113
  selected: l.value,
114
- "onUpdate:selected": k[0] || (k[0] = (h) => l.value = h),
114
+ "onUpdate:selected": k[0] || (k[0] = (y) => l.value = y),
115
115
  expanded: t.value,
116
- "onUpdate:expanded": k[1] || (k[1] = (h) => t.value = h),
116
+ "onUpdate:expanded": k[1] || (k[1] = (y) => t.value = y),
117
117
  modelValue: v.value,
118
- "onUpdate:modelValue": k[2] || (k[2] = (h) => v.value = h),
118
+ "onUpdate:modelValue": k[2] || (k[2] = (y) => v.value = y),
119
119
  class: "wx-media-tree",
120
120
  "node-key": "id",
121
121
  draggable: "",
@@ -123,7 +123,7 @@ const ze = /* @__PURE__ */ S({
123
123
  onDrop: s
124
124
  }, null, 8, ["selected", "expanded", "modelValue"]));
125
125
  }
126
- }), gt = /* @__PURE__ */ S({
126
+ }), yt = /* @__PURE__ */ S({
127
127
  __name: "FileGrid",
128
128
  props: /* @__PURE__ */ q({
129
129
  files: {},
@@ -136,15 +136,15 @@ const ze = /* @__PURE__ */ S({
136
136
  }),
137
137
  emits: /* @__PURE__ */ q(["open", "rename", "edit", "remove"], ["update:selected"]),
138
138
  setup(a, { emit: i }) {
139
- const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = z(
139
+ const n = a, l = O(a, "selected"), r = i, d = I("webx-media"), v = V(
140
140
  () => n.query ? d("manager.empty-search", { query: n.query }) : d("manager.empty")
141
141
  );
142
142
  function t() {
143
143
  J.success(d("manager.link-copied"));
144
144
  }
145
- function x(y) {
145
+ function x(w) {
146
146
  const s = document.createElement("textarea");
147
- s.value = y.url, s.setAttribute("readonly", ""), s.style.position = "fixed", s.style.opacity = "0", document.body.appendChild(s), s.select();
147
+ s.value = w.url, s.setAttribute("readonly", ""), s.style.position = "fixed", s.style.opacity = "0", document.body.appendChild(s), s.select();
148
148
  let u = !1;
149
149
  try {
150
150
  u = document.execCommand("copy");
@@ -155,11 +155,11 @@ const ze = /* @__PURE__ */ S({
155
155
  t();
156
156
  return;
157
157
  }
158
- J.danger(`${d("errors.copy")} ${y.url}`, { duration: 0 });
158
+ J.danger(`${d("errors.copy")} ${w.url}`, { duration: 0 });
159
159
  }
160
- return (y, s) => {
160
+ return (w, s) => {
161
161
  const u = Ge("wx-select");
162
- return a.files.length > 0 ? (w(), T(e(it), {
162
+ return a.files.length > 0 ? (h(), z(e(nt), {
163
163
  key: 0,
164
164
  modelValue: l.value,
165
165
  "onUpdate:modelValue": s[0] || (s[0] = (k) => l.value = k),
@@ -167,47 +167,47 @@ const ze = /* @__PURE__ */ S({
167
167
  multiple: !a.single
168
168
  }, {
169
169
  default: b(({ isSelected: k }) => [
170
- (w(!0), L(ce, null, me(a.files, (h) => Ye((w(), T(e(Le), {
171
- key: h.id,
170
+ (h(!0), L(ce, null, me(a.files, (y) => Ye((h(), z(e(We), {
171
+ key: y.id,
172
172
  class: "wx-media-grid__card",
173
- name: h.name,
174
- url: h.url,
175
- thumbnail: a.api.thumb(h, 320, 320) ?? void 0,
176
- type: h.mime,
177
- selected: k(h.id),
173
+ name: y.name,
174
+ url: y.url,
175
+ thumbnail: a.api.thumb(y, 320, 320) ?? void 0,
176
+ type: y.mime,
177
+ selected: k(y.id),
178
178
  renamable: "",
179
- editable: h.editable,
179
+ editable: y.editable,
180
180
  removable: "",
181
181
  copyable: "",
182
182
  "actions-menu": "",
183
183
  "rename-label": e(d)("manager.rename"),
184
184
  "edit-label": e(d)("manager.edit"),
185
185
  "remove-label": e(d)("manager.delete"),
186
- "remove-confirm-text": e(d)("dialogs.delete-file", { name: h.name }),
186
+ "remove-confirm-text": e(d)("dialogs.delete-file", { name: y.name }),
187
187
  "cancel-label": e(d)("manager.cancel"),
188
188
  "save-label": e(d)("manager.save"),
189
- "download-url": h.source ?? h.url,
189
+ "download-url": y.source ?? y.url,
190
190
  "copy-label": e(d)("manager.copy-link"),
191
191
  "download-label": e(d)("manager.download"),
192
192
  "copied-label": e(d)("manager.link-copied"),
193
- onRename: (o) => r("rename", h, o),
194
- onEdit: (o) => r("edit", h),
195
- onRemove: (o) => r("remove", h),
193
+ onRename: (o) => r("rename", y, o),
194
+ onEdit: (o) => r("edit", y),
195
+ onRemove: (o) => r("remove", y),
196
196
  onCopy: t,
197
- onCopyError: (o) => x(h),
198
- onDblclick: (o) => r("open", h)
197
+ onCopyError: (o) => x(y),
198
+ onDblclick: (o) => r("open", y)
199
199
  }, null, 8, ["name", "url", "thumbnail", "type", "selected", "editable", "rename-label", "edit-label", "remove-label", "remove-confirm-text", "cancel-label", "save-label", "download-url", "copy-label", "download-label", "copied-label", "onRename", "onEdit", "onRemove", "onCopyError", "onDblclick"])), [
200
- [u, h.id]
200
+ [u, y.id]
201
201
  ])), 128))
202
202
  ]),
203
203
  _: 1
204
- }, 8, ["modelValue", "multiple"])) : (w(), T(e(nt), {
204
+ }, 8, ["modelValue", "multiple"])) : (h(), z(e(ot), {
205
205
  key: 1,
206
206
  description: v.value
207
207
  }, null, 8, ["description"]));
208
208
  };
209
209
  }
210
- }), yt = { class: "wx-media-toolbar" }, ht = /* @__PURE__ */ S({
210
+ }), ht = { class: "wx-media-toolbar" }, wt = /* @__PURE__ */ S({
211
211
  __name: "MediaToolbar",
212
212
  props: /* @__PURE__ */ q({
213
213
  canUpload: { type: Boolean },
@@ -225,35 +225,35 @@ const ze = /* @__PURE__ */ S({
225
225
  }),
226
226
  emits: /* @__PURE__ */ q(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
227
227
  setup(a, { emit: i }) {
228
- const n = a, l = A(a, "search"), r = A(a, "type"), d = A(a, "sort"), v = i, t = H("webx-media"), x = z(() => [
228
+ const n = a, l = O(a, "search"), r = O(a, "type"), d = O(a, "sort"), v = i, t = I("webx-media"), x = V(() => [
229
229
  { value: "all", label: t("manager.all-types") },
230
230
  ...["image", "video", "audio", "document", "other"].map((k) => ({
231
231
  value: k,
232
232
  label: t(`manager.${k}`)
233
233
  }))
234
- ]), y = z(() => [
234
+ ]), w = V(() => [
235
235
  { value: "-created_at", label: t("manager.sort-newest") },
236
236
  { value: "created_at", label: t("manager.sort-oldest") },
237
237
  { value: "name", label: t("manager.sort-name") },
238
238
  { value: "-size", label: t("manager.sort-size") }
239
- ]), s = z(() => x.value.find((k) => k.value === r.value)?.label ?? ""), u = z(() => y.value.find((k) => k.value === d.value)?.label ?? "");
240
- return (k, h) => (w(), L("header", yt, [
241
- a.compact ? (w(), T(e(B), {
239
+ ]), s = V(() => x.value.find((k) => k.value === r.value)?.label ?? ""), u = V(() => w.value.find((k) => k.value === d.value)?.label ?? "");
240
+ return (k, y) => (h(), L("header", ht, [
241
+ a.compact ? (h(), z(e(B), {
242
242
  key: 0,
243
243
  icon: "sidebar",
244
244
  title: e(t)("manager.folders"),
245
245
  size: "sm",
246
- onClick: h[0] || (h[0] = (o) => v("folders"))
246
+ onClick: y[0] || (y[0] = (o) => v("folders"))
247
247
  }, null, 8, ["title"])) : D("", !0),
248
248
  g(e(Z), {
249
249
  modelValue: l.value,
250
- "onUpdate:modelValue": h[1] || (h[1] = (o) => l.value = o),
250
+ "onUpdate:modelValue": y[1] || (y[1] = (o) => l.value = o),
251
251
  class: "wx-media-toolbar__search",
252
252
  placeholder: e(t)("manager.search"),
253
253
  clearable: "",
254
254
  size: "sm"
255
255
  }, null, 8, ["modelValue", "placeholder"]),
256
- a.fixedType ? D("", !0) : (w(), T(e(Ve), { key: 1 }, {
256
+ a.fixedType ? D("", !0) : (h(), z(e(Ve), { key: 1 }, {
257
257
  trigger: b(() => [
258
258
  g(e(B), {
259
259
  icon: "filter",
@@ -262,13 +262,13 @@ const ze = /* @__PURE__ */ S({
262
262
  }, null, 8, ["title"])
263
263
  ]),
264
264
  default: b(() => [
265
- (w(!0), L(ce, null, me(x.value, (o) => (w(), T(e(Te), {
265
+ (h(!0), L(ce, null, me(x.value, (o) => (h(), z(e(Te), {
266
266
  key: String(o.value),
267
267
  active: o.value === r.value,
268
268
  onClick: ($) => r.value = o.value
269
269
  }, {
270
270
  default: b(() => [
271
- O(U(o.label), 1)
271
+ A(U(o.label), 1)
272
272
  ]),
273
273
  _: 2
274
274
  }, 1032, ["active", "onClick"]))), 128))
@@ -284,27 +284,27 @@ const ze = /* @__PURE__ */ S({
284
284
  }, null, 8, ["title"])
285
285
  ]),
286
286
  default: b(() => [
287
- (w(!0), L(ce, null, me(y.value, (o) => (w(), T(e(Te), {
287
+ (h(!0), L(ce, null, me(w.value, (o) => (h(), z(e(Te), {
288
288
  key: o.value,
289
289
  active: o.value === d.value,
290
290
  onClick: ($) => d.value = o.value
291
291
  }, {
292
292
  default: b(() => [
293
- O(U(o.label), 1)
293
+ A(U(o.label), 1)
294
294
  ]),
295
295
  _: 2
296
296
  }, 1032, ["active", "onClick"]))), 128))
297
297
  ]),
298
298
  _: 1
299
299
  }),
300
- a.canUpload ? (w(), T(e(B), {
300
+ a.canUpload ? (h(), z(e(B), {
301
301
  key: 2,
302
302
  type: "upload",
303
303
  title: e(t)("manager.upload"),
304
304
  size: "sm",
305
- onClick: h[2] || (h[2] = (o) => v("upload"))
305
+ onClick: y[2] || (y[2] = (o) => v("upload"))
306
306
  }, null, 8, ["title"])) : D("", !0),
307
- a.canManage ? (w(), T(e(le), {
307
+ a.canManage ? (h(), z(e(le), {
308
308
  key: 3,
309
309
  size: "sm"
310
310
  }, {
@@ -313,20 +313,20 @@ const ze = /* @__PURE__ */ S({
313
313
  icon: "folder-move",
314
314
  title: e(t)("manager.move"),
315
315
  disabled: n.selected === 0,
316
- onClick: h[3] || (h[3] = (o) => v("move"))
316
+ onClick: y[3] || (y[3] = (o) => v("move"))
317
317
  }, null, 8, ["title", "disabled"]),
318
318
  g(e(B), {
319
319
  type: "remove",
320
320
  title: e(t)("manager.delete"),
321
321
  disabled: n.selected === 0,
322
- onClick: h[4] || (h[4] = (o) => v("remove"))
322
+ onClick: y[4] || (y[4] = (o) => v("remove"))
323
323
  }, null, 8, ["title", "disabled"])
324
324
  ]),
325
325
  _: 1
326
326
  })) : D("", !0)
327
327
  ]));
328
328
  }
329
- }), wt = /* @__PURE__ */ S({
329
+ }), bt = /* @__PURE__ */ S({
330
330
  __name: "MoveDialog",
331
331
  props: {
332
332
  directories: {},
@@ -334,11 +334,11 @@ const ze = /* @__PURE__ */ S({
334
334
  count: {}
335
335
  },
336
336
  setup(a) {
337
- const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = z(
338
- () => x(i.directories).filter((y) => y.value !== i.from)
337
+ const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = I("webx-media"), v = V(
338
+ () => x(i.directories).filter((w) => w.value !== i.from)
339
339
  ), t = R(v.value[0]?.value ?? null);
340
- function x(y) {
341
- return y.flatMap((s) => [
340
+ function x(w) {
341
+ return w.flatMap((s) => [
342
342
  {
343
343
  value: s.id,
344
344
  // Indented, so the tree is still readable once it is a flat list.
@@ -347,7 +347,7 @@ const ze = /* @__PURE__ */ S({
347
347
  ...x(s.children ?? [])
348
348
  ]);
349
349
  }
350
- return (y, s) => (w(), T(e(he), {
350
+ return (w, s) => (h(), z(e(he), {
351
351
  open: e(n),
352
352
  "onUpdate:open": s[3] || (s[3] = (u) => ve(n) ? n.value = u : null),
353
353
  title: e(d)("manager.move-to"),
@@ -356,22 +356,22 @@ const ze = /* @__PURE__ */ S({
356
356
  footer: b(() => [
357
357
  g(e(we), { size: "sm" }, {
358
358
  default: b(() => [
359
- g(e(I), {
359
+ g(e(X), {
360
360
  variant: "outline",
361
361
  onClick: s[1] || (s[1] = (u) => e(r)())
362
362
  }, {
363
363
  default: b(() => [
364
- O(U(e(d)("manager.cancel")), 1)
364
+ A(U(e(d)("manager.cancel")), 1)
365
365
  ]),
366
366
  _: 1
367
367
  }),
368
- g(e(I), {
368
+ g(e(X), {
369
369
  type: "primary",
370
370
  disabled: t.value === null,
371
371
  onClick: s[2] || (s[2] = (u) => e(l)(t.value))
372
372
  }, {
373
373
  default: b(() => [
374
- O(U(e(d)("manager.move")), 1)
374
+ A(U(e(d)("manager.move")), 1)
375
375
  ]),
376
376
  _: 1
377
377
  }, 8, ["disabled"])
@@ -380,7 +380,7 @@ const ze = /* @__PURE__ */ S({
380
380
  })
381
381
  ]),
382
382
  default: b(() => [
383
- g(e(ot), {
383
+ g(e(st), {
384
384
  modelValue: t.value,
385
385
  "onUpdate:modelValue": s[0] || (s[0] = (u) => t.value = u),
386
386
  options: v.value
@@ -389,7 +389,7 @@ const ze = /* @__PURE__ */ S({
389
389
  _: 1
390
390
  }, 8, ["open", "title"]));
391
391
  }
392
- }), bt = /* @__PURE__ */ S({
392
+ }), xt = /* @__PURE__ */ S({
393
393
  __name: "NameDialog",
394
394
  props: {
395
395
  title: {},
@@ -398,15 +398,15 @@ const ze = /* @__PURE__ */ S({
398
398
  confirmText: { default: void 0 }
399
399
  },
400
400
  setup(a) {
401
- const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = R(i.value), t = oe("input");
401
+ const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = I("webx-media"), v = R(i.value), t = oe("input");
402
402
  Fe(async () => {
403
403
  await Je(), t.value?.querySelector("input")?.focus();
404
404
  });
405
405
  function x() {
406
- const y = v.value.trim();
407
- y !== "" && l(y);
406
+ const w = v.value.trim();
407
+ w !== "" && l(w);
408
408
  }
409
- return (y, s) => (w(), T(e(he), {
409
+ return (w, s) => (h(), z(e(he), {
410
410
  open: e(n),
411
411
  "onUpdate:open": s[2] || (s[2] = (u) => ve(n) ? n.value = u : null),
412
412
  title: a.title,
@@ -415,22 +415,22 @@ const ze = /* @__PURE__ */ S({
415
415
  footer: b(() => [
416
416
  g(e(we), { size: "sm" }, {
417
417
  default: b(() => [
418
- g(e(I), {
418
+ g(e(X), {
419
419
  variant: "outline",
420
420
  onClick: s[1] || (s[1] = (u) => e(r)())
421
421
  }, {
422
422
  default: b(() => [
423
- O(U(e(d)("manager.cancel")), 1)
423
+ A(U(e(d)("manager.cancel")), 1)
424
424
  ]),
425
425
  _: 1
426
426
  }),
427
- g(e(I), {
427
+ g(e(X), {
428
428
  type: "primary",
429
429
  disabled: v.value.trim() === "",
430
430
  onClick: x
431
431
  }, {
432
432
  default: b(() => [
433
- O(U(a.confirmText ?? e(d)("manager.save")), 1)
433
+ A(U(a.confirmText ?? e(d)("manager.save")), 1)
434
434
  ]),
435
435
  _: 1
436
436
  }, 8, ["disabled"])
@@ -439,7 +439,7 @@ const ze = /* @__PURE__ */ S({
439
439
  })
440
440
  ]),
441
441
  default: b(() => [
442
- V("div", {
442
+ T("div", {
443
443
  ref_key: "input",
444
444
  ref: t
445
445
  }, [
@@ -455,7 +455,7 @@ const ze = /* @__PURE__ */ S({
455
455
  _: 1
456
456
  }, 8, ["open", "title"]));
457
457
  }
458
- }), xt = {
458
+ }), kt = {
459
459
  module: {
460
460
  title: "Files"
461
461
  },
@@ -590,14 +590,14 @@ const ze = /* @__PURE__ */ S({
590
590
  function re() {
591
591
  try {
592
592
  const { i18n: a } = se();
593
- Ue.has(a) || (a.defaults("webx-media", xt), Ue.add(a));
593
+ Ue.has(a) || (a.defaults("webx-media", kt), Ue.add(a));
594
594
  } catch {
595
595
  }
596
596
  }
597
- const kt = {
597
+ const $t = {
598
598
  key: 0,
599
599
  class: "wx-media__folders"
600
- }, $t = { class: "wx-media__files" }, _t = ["accept"], Ct = { class: "wx-media__status" }, Mt = { key: 0 }, Vt = { class: "wx-media__drawer" }, Se = /* @__PURE__ */ S({
600
+ }, _t = { class: "wx-media__files" }, Ct = ["accept"], Mt = { class: "wx-media__status" }, Vt = { key: 0 }, Tt = { class: "wx-media__drawer" }, Be = /* @__PURE__ */ S({
601
601
  __name: "MediaManager",
602
602
  props: /* @__PURE__ */ q({
603
603
  picking: { type: Boolean, default: !1 },
@@ -613,8 +613,8 @@ const kt = {
613
613
  setup(a, { expose: i, emit: n }) {
614
614
  const l = a, r = n, d = se(), v = be(d);
615
615
  re();
616
- const t = H("webx-media"), x = et();
617
- function y() {
616
+ const t = I("webx-media"), x = tt();
617
+ function w() {
618
618
  return {
619
619
  title: t("editor.title"),
620
620
  saveLabel: t("editor.save"),
@@ -635,14 +635,14 @@ const kt = {
635
635
  errorText: t("editor.error")
636
636
  };
637
637
  }
638
- const s = oe("root"), u = st(s), k = z(() => u.value > 0 && u.value < 640), h = R([]), o = R(null), $ = R(null), F = R([]), K = R(""), X = A(a, "type");
639
- l.accept && (X.value = l.accept), G(
638
+ const s = oe("root"), u = rt(s), k = V(() => u.value > 0 && u.value < 640), y = R([]), o = R(null), $ = R(null), F = R([]), K = R(""), H = O(a, "type");
639
+ l.accept && (H.value = l.accept), G(
640
640
  () => l.accept,
641
641
  (p) => {
642
- X.value = p ?? "all";
642
+ H.value = p ?? "all";
643
643
  }
644
644
  );
645
- const N = R("-created_at"), ee = R(!1), j = R(!1), te = oe("picker"), ie = z(() => $.value?.data ?? []), Q = z(() => d.can("media.manage")), de = z(() => d.can("media.upload") || Q.value), E = z(() => He(o.value)), ne = z(() => l.picking && !l.multiple);
645
+ const N = R("-created_at"), ee = R(!1), j = R(!1), te = oe("picker"), ie = V(() => $.value?.data ?? []), Q = V(() => d.can("media.manage")), de = V(() => d.can("media.upload") || Q.value), E = V(() => He(o.value)), ne = V(() => l.picking && !l.multiple);
646
646
  G(F, (p) => {
647
647
  if (l.max !== null && l.max > 0 && p.length > l.max) {
648
648
  F.value = p.slice(0, l.max);
@@ -652,14 +652,14 @@ const kt = {
652
652
  "selection",
653
653
  ie.value.filter((f) => p.includes(f.id))
654
654
  );
655
- }), Fe(c), G([o, X, N], () => m(1)), G(
655
+ }), Fe(c), G([o, H, N], () => m(1)), G(
656
656
  K,
657
657
  Ke(() => m(1), 300)
658
658
  ), G(k, (p) => {
659
659
  p || (j.value = !1);
660
660
  });
661
661
  async function c() {
662
- h.value = await v.directories(), o.value ??= h.value[0]?.id ?? null, await m(1);
662
+ y.value = await v.directories(), o.value ??= y.value[0]?.id ?? null, await m(1);
663
663
  }
664
664
  async function m(p = $.value?.meta.current_page ?? 1) {
665
665
  ee.value = !0;
@@ -667,7 +667,7 @@ const kt = {
667
667
  $.value = await v.files({
668
668
  directory_id: K.value ? null : o.value,
669
669
  q: K.value,
670
- type: X.value === "all" ? null : X.value,
670
+ type: H.value === "all" ? null : H.value,
671
671
  sort: N.value,
672
672
  page: p
673
673
  }), F.value = [];
@@ -688,7 +688,7 @@ const kt = {
688
688
  J.danger(x(P, t("errors.upload")));
689
689
  }
690
690
  }
691
- const W = ae(bt);
691
+ const W = ae(xt);
692
692
  async function $e() {
693
693
  const p = await W({
694
694
  title: t("manager.new-folder"),
@@ -745,10 +745,10 @@ const kt = {
745
745
  }
746
746
  await c();
747
747
  }
748
- const Ee = ae(wt);
748
+ const Ee = ae(bt);
749
749
  async function Pe() {
750
750
  const p = await Ee({
751
- directories: h.value,
751
+ directories: y.value,
752
752
  from: o.value,
753
753
  count: F.value.length
754
754
  });
@@ -771,14 +771,14 @@ const kt = {
771
771
  await v.removeOne(p.id), await Promise.all([c(), m()]);
772
772
  }
773
773
  async function qe(p) {
774
- const f = await ut({
774
+ const f = await ct({
775
775
  src: p.source ?? p.url,
776
776
  fileName: p.file_name,
777
777
  filters: !1,
778
778
  // The editor is a component of the design system: its words are props with English
779
779
  // defaults, not lines in the panel's dictionary. Whoever opens it is the one who knows
780
780
  // what language the panel is being read in.
781
- ...y()
781
+ ...w()
782
782
  });
783
783
  f && (await v.edit(p.id, {
784
784
  // The editor's frame is read against the picture as it is on screen — already turned — and
@@ -803,7 +803,7 @@ const kt = {
803
803
  }
804
804
  return null;
805
805
  };
806
- return p === null ? null : f(h.value);
806
+ return p === null ? null : f(y.value);
807
807
  }
808
808
  function Xe(p) {
809
809
  const f = p?.body;
@@ -816,19 +816,19 @@ const kt = {
816
816
  clearTimeout(_), _ = setTimeout(p, f);
817
817
  };
818
818
  }
819
- return (p, f) => (w(), L("div", {
819
+ return (p, f) => (h(), L("div", {
820
820
  ref_key: "root",
821
821
  ref: s,
822
822
  class: pe(["wx-media", { "wx-media--compact": k.value }])
823
823
  }, [
824
- k.value ? D("", !0) : (w(), L("aside", kt, [
824
+ k.value ? D("", !0) : (h(), L("aside", $t, [
825
825
  g(ze, {
826
826
  selected: o.value,
827
827
  "onUpdate:selected": f[0] || (f[0] = (_) => o.value = _),
828
- directories: h.value,
828
+ directories: y.value,
829
829
  onMove: Me
830
830
  }, null, 8, ["selected", "directories"]),
831
- Q.value ? (w(), T(e(le), {
831
+ Q.value ? (h(), z(e(le), {
832
832
  key: 0,
833
833
  size: "sm",
834
834
  align: "start"
@@ -855,12 +855,12 @@ const kt = {
855
855
  _: 1
856
856
  })) : D("", !0)
857
857
  ])),
858
- V("section", $t, [
859
- g(ht, {
858
+ T("section", _t, [
859
+ g(wt, {
860
860
  search: K.value,
861
861
  "onUpdate:search": f[1] || (f[1] = (_) => K.value = _),
862
- type: X.value,
863
- "onUpdate:type": f[2] || (f[2] = (_) => X.value = _),
862
+ type: H.value,
863
+ "onUpdate:type": f[2] || (f[2] = (_) => H.value = _),
864
864
  sort: N.value,
865
865
  "onUpdate:sort": f[3] || (f[3] = (_) => N.value = _),
866
866
  "can-upload": de.value && !a.inPage,
@@ -873,7 +873,7 @@ const kt = {
873
873
  onRemove: Oe,
874
874
  onFolders: f[4] || (f[4] = (_) => j.value = !0)
875
875
  }, null, 8, ["search", "type", "sort", "can-upload", "fixed-type", "can-manage", "selected", "compact"]),
876
- V("input", {
876
+ T("input", {
877
877
  ref_key: "picker",
878
878
  ref: te,
879
879
  type: "file",
@@ -881,8 +881,8 @@ const kt = {
881
881
  hidden: "",
882
882
  accept: a.accept === null ? void 0 : `${a.accept}/*`,
883
883
  onChange: C
884
- }, null, 40, _t),
885
- g(gt, {
884
+ }, null, 40, Ct),
885
+ g(yt, {
886
886
  selected: F.value,
887
887
  "onUpdate:selected": f[5] || (f[5] = (_) => F.value = _),
888
888
  files: ie.value,
@@ -894,12 +894,12 @@ const kt = {
894
894
  onRemove: Ne,
895
895
  onOpen: Ie
896
896
  }, null, 8, ["selected", "files", "api", "query", "single"]),
897
- V("footer", Ct, [
898
- V("span", null, U(e(t)("manager.status-files", { count: $.value?.stats.files ?? 0 })), 1),
899
- F.value.length > 0 ? (w(), L("span", Mt, U(e(t)("manager.status-selected", { count: F.value.length })), 1)) : D("", !0),
900
- V("span", null, U(e(t)("manager.status-size", { size: e(Be)($.value?.stats.size ?? 0) })), 1)
897
+ T("footer", Mt, [
898
+ T("span", null, U(e(t)("manager.status-files", { count: $.value?.stats.files ?? 0 })), 1),
899
+ F.value.length > 0 ? (h(), L("span", Vt, U(e(t)("manager.status-selected", { count: F.value.length })), 1)) : D("", !0),
900
+ T("span", null, U(e(t)("manager.status-size", { size: e(De)($.value?.stats.size ?? 0) })), 1)
901
901
  ]),
902
- $.value && $.value.meta.last_page > 1 ? (w(), T(e(rt), {
902
+ $.value && $.value.meta.last_page > 1 ? (h(), z(e(dt), {
903
903
  key: 0,
904
904
  page: $.value.meta.current_page,
905
905
  "per-page": $.value.meta.per_page,
@@ -910,7 +910,7 @@ const kt = {
910
910
  onChange: f[6] || (f[6] = ({ page: _ }) => m(_))
911
911
  }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : D("", !0)
912
912
  ]),
913
- g(e(dt), {
913
+ g(e(ut), {
914
914
  open: j.value,
915
915
  "onUpdate:open": f[9] || (f[9] = (_) => j.value = _),
916
916
  side: "left",
@@ -918,17 +918,17 @@ const kt = {
918
918
  size: 280
919
919
  }, {
920
920
  default: b(() => [
921
- V("div", Vt, [
921
+ T("div", Tt, [
922
922
  g(ze, {
923
923
  selected: o.value,
924
924
  "onUpdate:selected": [
925
925
  f[7] || (f[7] = (_) => o.value = _),
926
926
  f[8] || (f[8] = (_) => j.value = !1)
927
927
  ],
928
- directories: h.value,
928
+ directories: y.value,
929
929
  onMove: Me
930
930
  }, null, 8, ["selected", "directories"]),
931
- Q.value ? (w(), T(e(le), {
931
+ Q.value ? (h(), z(e(le), {
932
932
  key: 0,
933
933
  size: "sm",
934
934
  align: "start"
@@ -960,7 +960,7 @@ const kt = {
960
960
  }, 8, ["open", "title"])
961
961
  ], 2));
962
962
  }
963
- }), Tt = { class: "wx-media-picker" }, zt = {
963
+ }), zt = { class: "wx-media-picker" }, Ut = {
964
964
  key: 0,
965
965
  class: "wx-media-picker__count"
966
966
  }, xe = /* @__PURE__ */ S({
@@ -973,16 +973,16 @@ const kt = {
973
973
  max: { default: null }
974
974
  },
975
975
  setup(a) {
976
- const { open: i, resolve: n, dismiss: l } = ye(), r = H("webx-media"), d = R([]);
977
- return (v, t) => (w(), T(e(he), {
976
+ const { open: i, resolve: n, dismiss: l } = ye(), r = I("webx-media"), d = R([]);
977
+ return (v, t) => (h(), z(e(he), {
978
978
  open: e(i),
979
979
  "onUpdate:open": t[4] || (t[4] = (x) => ve(i) ? i.value = x : null),
980
980
  title: a.title ?? e(r)("module.title"),
981
981
  width: 960
982
- }, We({
982
+ }, Ze({
983
983
  default: b(() => [
984
- V("div", Tt, [
985
- g(Se, {
984
+ T("div", zt, [
985
+ g(Be, {
986
986
  picking: !a.manage,
987
987
  accept: a.manage ? null : a.accept,
988
988
  multiple: a.multiple && !a.manage,
@@ -999,24 +999,24 @@ const kt = {
999
999
  fn: b(() => [
1000
1000
  g(e(we), { size: "sm" }, {
1001
1001
  default: b(() => [
1002
- a.max !== null && a.max > 0 ? (w(), L("span", zt, U(e(r)("manager.chosen", { count: d.value.length, max: a.max })), 1)) : D("", !0),
1003
- g(e(I), {
1002
+ a.max !== null && a.max > 0 ? (h(), L("span", Ut, U(e(r)("manager.chosen", { count: d.value.length, max: a.max })), 1)) : D("", !0),
1003
+ g(e(X), {
1004
1004
  variant: "outline",
1005
1005
  onClick: t[2] || (t[2] = (x) => e(l)())
1006
1006
  }, {
1007
1007
  default: b(() => [
1008
- O(U(e(r)("manager.cancel")), 1)
1008
+ A(U(e(r)("manager.cancel")), 1)
1009
1009
  ]),
1010
1010
  _: 1
1011
1011
  }),
1012
- g(e(I), {
1012
+ g(e(X), {
1013
1013
  class: "wx-media-picker__confirm",
1014
1014
  type: "primary",
1015
1015
  disabled: d.value.length === 0,
1016
1016
  onClick: t[3] || (t[3] = (x) => e(n)(d.value))
1017
1017
  }, {
1018
1018
  default: b(() => [
1019
- O(U(e(r)("manager.pick", { count: d.value.length })), 1)
1019
+ A(U(e(r)("manager.pick", { count: d.value.length })), 1)
1020
1020
  ]),
1021
1021
  _: 1
1022
1022
  }, 8, ["disabled"])
@@ -1028,7 +1028,7 @@ const kt = {
1028
1028
  } : void 0
1029
1029
  ]), 1032, ["open", "title"]));
1030
1030
  }
1031
- }), Ut = ae(xe), Ft = ae(xe, {
1031
+ }), Se = ae(xe), Ft = ae(xe, {
1032
1032
  props: { multiple: !0 }
1033
1033
  }), Wt = ae(
1034
1034
  xe,
@@ -1064,18 +1064,18 @@ const kt = {
1064
1064
  }),
1065
1065
  emits: ["update:modelValue"],
1066
1066
  setup(a) {
1067
- const i = a, n = A(a, "modelValue");
1067
+ const i = a, n = O(a, "modelValue");
1068
1068
  re();
1069
- const l = H("webx-media"), r = Ze(tt, null), d = r ? be(r) : null, v = {
1069
+ const l = I("webx-media"), r = et(lt, null), d = r ? be(r) : null, v = {
1070
1070
  "16/9": "16 / 9",
1071
1071
  "4/3": "4 / 3",
1072
1072
  "1/1": "1 / 1"
1073
- }, t = z({
1073
+ }, t = V({
1074
1074
  get: () => Array.isArray(n.value) ? n.value : [],
1075
1075
  set: (c) => {
1076
1076
  n.value = c;
1077
1077
  }
1078
- }), x = z(() => i.single ? 1 : i.max ?? null), y = z(() => x.value !== null && t.value.length >= x.value), s = R({}), u = /* @__PURE__ */ new Set();
1078
+ }), x = V(() => i.single ? 1 : i.max ?? null), w = V(() => x.value !== null && t.value.length >= x.value), s = R({}), u = /* @__PURE__ */ new Set();
1079
1079
  async function k(c) {
1080
1080
  if (!d) return;
1081
1081
  const m = c.filter((C) => !(C in s.value) && !u.has(C));
@@ -1093,7 +1093,7 @@ const kt = {
1093
1093
  },
1094
1094
  { immediate: !0 }
1095
1095
  );
1096
- function h(c) {
1096
+ function y(c) {
1097
1097
  s.value = { ...s.value, ...Object.fromEntries(c.map((m) => [m.path, m])) };
1098
1098
  }
1099
1099
  function o(c) {
@@ -1103,16 +1103,16 @@ const kt = {
1103
1103
  return o(c) === null;
1104
1104
  }
1105
1105
  function F(c) {
1106
- return o(c)?.name ?? vt(c.path);
1106
+ return o(c)?.name ?? gt(c.path);
1107
1107
  }
1108
1108
  function K(c) {
1109
1109
  const m = o(c);
1110
1110
  return m && d ? d.thumb(m, 320, 320) ?? void 0 : void 0;
1111
1111
  }
1112
- function X(c) {
1112
+ function H(c) {
1113
1113
  const m = o(c);
1114
1114
  if (!m) return "";
1115
- const M = Be(m.size);
1115
+ const M = De(m.size);
1116
1116
  return m.width && m.height ? `${m.width}×${m.height} · ${M}` : M;
1117
1117
  }
1118
1118
  const N = R(null);
@@ -1132,7 +1132,7 @@ const kt = {
1132
1132
  if (i.disabled) return;
1133
1133
  const c = x.value === null ? null : x.value - t.value.length, m = await Ft({ accept: i.accept, max: c });
1134
1134
  if (!m || m.length === 0) return;
1135
- h(m);
1135
+ y(m);
1136
1136
  const M = new Set(t.value.map((W) => W.path)), C = m.filter((W) => !M.has(W.path)).map((W) => ({ path: W.path }));
1137
1137
  t.value = i.single ? C.slice(0, 1) : [...t.value, ...C];
1138
1138
  }
@@ -1144,22 +1144,22 @@ const kt = {
1144
1144
  const m = { ...s.value };
1145
1145
  delete m[c.path], s.value = m, k([c.path]);
1146
1146
  }
1147
- const E = z(() => {
1147
+ const E = V(() => {
1148
1148
  const c = i.columns ? `repeat(${i.columns}, minmax(0, 1fr))` : "repeat(auto-fill, minmax(140px, 1fr))";
1149
1149
  return i.aspect ? {
1150
1150
  "--wx-media-list-columns": c,
1151
1151
  "--wx-media-list-aspect": v[i.aspect] ?? i.aspect
1152
1152
  } : { "--wx-media-list-columns": c };
1153
- }), ne = z(() => {
1153
+ }), ne = V(() => {
1154
1154
  const c = t.value.length;
1155
1155
  return i.min && c < i.min ? l("field.at-least", { count: i.min }) : x.value === null ? "" : l("field.count", { count: c, max: x.value });
1156
1156
  });
1157
- return (c, m) => (w(), L("div", {
1157
+ return (c, m) => (h(), L("div", {
1158
1158
  class: pe(["wx-media-list", [`wx-media-list--${a.layout}`, { "is-disabled": a.disabled }]]),
1159
1159
  style: fe(E.value)
1160
1160
  }, [
1161
- a.label ? (w(), L("span", Lt, U(a.label), 1)) : D("", !0),
1162
- g(e(ct), {
1161
+ a.label ? (h(), L("span", Lt, U(a.label), 1)) : D("", !0),
1162
+ g(e(mt), {
1163
1163
  modelValue: t.value,
1164
1164
  "onUpdate:modelValue": m[1] || (m[1] = (M) => t.value = M),
1165
1165
  plain: "",
@@ -1171,24 +1171,24 @@ const kt = {
1171
1171
  "empty-text": e(l)("field.empty")
1172
1172
  }, {
1173
1173
  default: b(({ item: M, index: C }) => [
1174
- V("div", {
1174
+ T("div", {
1175
1175
  class: pe(["wx-media-list__cell", { "is-broken": $(M), "is-busy": N.value === C }])
1176
1176
  }, [
1177
- g(e(Le), {
1177
+ g(e(We), {
1178
1178
  name: F(M),
1179
1179
  thumbnail: K(M),
1180
1180
  type: o(M)?.mime,
1181
1181
  size: a.layout === "rows" ? "sm" : "md"
1182
1182
  }, {
1183
1183
  meta: b(() => [
1184
- $(M) ? (w(), L("span", Rt, U(e(l)("field.missing")), 1)) : (w(), L("span", Dt, U(X(M)), 1))
1184
+ $(M) ? (h(), L("span", Rt, U(e(l)("field.missing")), 1)) : (h(), L("span", Dt, U(H(M)), 1))
1185
1185
  ]),
1186
1186
  _: 2
1187
1187
  }, 1032, ["name", "thumbnail", "type", "size"]),
1188
- a.disabled ? D("", !0) : (w(), L("div", Bt, [
1188
+ a.disabled ? D("", !0) : (h(), L("div", Bt, [
1189
1189
  g(e(le), { size: "sm" }, {
1190
1190
  default: b(() => [
1191
- a.captions ? (w(), T(e(Re), {
1191
+ a.captions ? (h(), z(e(Le), {
1192
1192
  key: 0,
1193
1193
  open: N.value === C,
1194
1194
  title: e(l)("field.captions"),
@@ -1204,9 +1204,9 @@ const kt = {
1204
1204
  }, null, 8, ["title"])
1205
1205
  ]),
1206
1206
  default: b(() => [
1207
- V("div", St, [
1208
- V("div", Et, [
1209
- m[2] || (m[2] = V("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
1207
+ T("div", St, [
1208
+ T("div", Et, [
1209
+ m[2] || (m[2] = T("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
1210
1210
  g(e(Z), {
1211
1211
  localized: "",
1212
1212
  "model-value": j(C, "alt"),
@@ -1214,8 +1214,8 @@ const kt = {
1214
1214
  "onUpdate:modelValue": (W) => te(C, "alt", W)
1215
1215
  }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1216
1216
  ]),
1217
- V("div", Pt, [
1218
- m[3] || (m[3] = V("span", { class: "wx-media-list__caption-label" }, "title", -1)),
1217
+ T("div", Pt, [
1218
+ m[3] || (m[3] = T("span", { class: "wx-media-list__caption-label" }, "title", -1)),
1219
1219
  g(e(Z), {
1220
1220
  localized: "",
1221
1221
  "model-value": j(C, "title"),
@@ -1223,14 +1223,14 @@ const kt = {
1223
1223
  "onUpdate:modelValue": (W) => te(C, "title", W)
1224
1224
  }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1225
1225
  ]),
1226
- V("div", Ot, [
1227
- g(e(I), {
1226
+ T("div", Ot, [
1227
+ g(e(X), {
1228
1228
  size: "sm",
1229
1229
  type: "primary",
1230
1230
  onClick: m[0] || (m[0] = (W) => N.value = null)
1231
1231
  }, {
1232
1232
  default: b(() => [
1233
- O(U(e(l)("manager.save")), 1)
1233
+ A(U(e(l)("manager.save")), 1)
1234
1234
  ]),
1235
1235
  _: 1
1236
1236
  })
@@ -1239,13 +1239,13 @@ const kt = {
1239
1239
  ]),
1240
1240
  _: 2
1241
1241
  }, 1032, ["open", "title", "onUpdate:open"])) : D("", !0),
1242
- $(M) ? D("", !0) : (w(), T(e(B), {
1242
+ $(M) ? D("", !0) : (h(), z(e(B), {
1243
1243
  key: 1,
1244
1244
  type: "goto",
1245
1245
  title: e(l)("field.open"),
1246
1246
  onClick: (W) => de(M)
1247
1247
  }, null, 8, ["title", "onClick"])),
1248
- g(e(De), {
1248
+ g(e(Re), {
1249
1249
  title: e(l)("field.remove-title"),
1250
1250
  description: e(l)("field.remove-text"),
1251
1251
  "confirm-text": e(l)("field.remove-confirm"),
@@ -1270,19 +1270,19 @@ const kt = {
1270
1270
  ]),
1271
1271
  _: 1
1272
1272
  }, 8, ["modelValue", "disabled", "handle", "drag-label", "empty-text"]),
1273
- V("div", At, [
1274
- g(e(I), {
1273
+ T("div", At, [
1274
+ g(e(X), {
1275
1275
  size: "sm",
1276
1276
  variant: "outline",
1277
- disabled: a.disabled || y.value,
1277
+ disabled: a.disabled || w.value,
1278
1278
  onClick: ie
1279
1279
  }, {
1280
1280
  default: b(() => [
1281
- O(U(e(l)("field.add")), 1)
1281
+ A(U(e(l)("field.add")), 1)
1282
1282
  ]),
1283
1283
  _: 1
1284
1284
  }, 8, ["disabled"]),
1285
- ne.value ? (w(), L("span", Nt, U(ne.value), 1)) : D("", !0)
1285
+ ne.value ? (h(), L("span", Nt, U(ne.value), 1)) : D("", !0)
1286
1286
  ])
1287
1287
  ], 6));
1288
1288
  }
@@ -1296,13 +1296,13 @@ const kt = {
1296
1296
  },
1297
1297
  emits: ["update:modelValue"],
1298
1298
  setup(a) {
1299
- const i = A(a, "modelValue"), n = z({
1299
+ const i = O(a, "modelValue"), n = V({
1300
1300
  get: () => i.value ? [i.value] : [],
1301
1301
  set: (l) => {
1302
1302
  i.value = l[0] ?? null;
1303
1303
  }
1304
1304
  });
1305
- return (l, r) => (w(), T(ke, ge(l.$attrs, {
1305
+ return (l, r) => (h(), z(ke, ge(l.$attrs, {
1306
1306
  modelValue: n.value,
1307
1307
  "onUpdate:modelValue": r[0] || (r[0] = (d) => n.value = d),
1308
1308
  layout: "rows",
@@ -1319,8 +1319,8 @@ const kt = {
1319
1319
  },
1320
1320
  emits: ["update:modelValue"],
1321
1321
  setup(a) {
1322
- const i = A(a, "modelValue");
1323
- return (n, l) => (w(), T(ke, ge(n.$attrs, {
1322
+ const i = O(a, "modelValue");
1323
+ return (n, l) => (h(), z(ke, ge(n.$attrs, {
1324
1324
  modelValue: i.value,
1325
1325
  "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1326
1326
  layout: "rows"
@@ -1336,8 +1336,8 @@ const kt = {
1336
1336
  },
1337
1337
  emits: ["update:modelValue"],
1338
1338
  setup(a) {
1339
- const i = A(a, "modelValue");
1340
- return (n, l) => (w(), T(ke, ge(n.$attrs, {
1339
+ const i = O(a, "modelValue");
1340
+ return (n, l) => (h(), z(ke, ge(n.$attrs, {
1341
1341
  modelValue: i.value,
1342
1342
  "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1343
1343
  layout: "grid",
@@ -1368,9 +1368,9 @@ const kt = {
1368
1368
  }),
1369
1369
  emits: ["update:modelValue"],
1370
1370
  setup(a) {
1371
- const i = a, n = A(a, "modelValue");
1371
+ const i = a, n = O(a, "modelValue");
1372
1372
  re();
1373
- const l = H("webx-media"), r = be(se()), d = {
1373
+ const l = I("webx-media"), r = be(se()), d = {
1374
1374
  "16/9": "16 / 9",
1375
1375
  "4/3": "4 / 3",
1376
1376
  "1/1": "1 / 1"
@@ -1384,10 +1384,10 @@ const kt = {
1384
1384
  },
1385
1385
  { immediate: !0 }
1386
1386
  );
1387
- const x = z(() => {
1387
+ const x = V(() => {
1388
1388
  const o = n.value;
1389
1389
  return o ? o.url ?? t.value[o.path] ?? null : null;
1390
- }), y = z(
1390
+ }), w = V(
1391
1391
  () => i.aspect ? { aspectRatio: d[i.aspect] ?? i.aspect } : { height: typeof i.height == "number" ? `${i.height}px` : i.height }
1392
1392
  );
1393
1393
  function s(o) {
@@ -1398,38 +1398,38 @@ const kt = {
1398
1398
  }
1399
1399
  async function k() {
1400
1400
  if (i.disabled) return;
1401
- const o = await Ut({ accept: i.accept });
1401
+ const o = await Se({ accept: i.accept });
1402
1402
  o && (t.value = { ...t.value, [o.path]: o.url }, n.value = { ...n.value, path: o.path, url: o.url });
1403
1403
  }
1404
- function h() {
1404
+ function y() {
1405
1405
  n.value = null, v.value = !1;
1406
1406
  }
1407
- return (o, $) => (w(), L("div", Xt, [
1408
- a.label ? (w(), L("span", Kt, U(a.label), 1)) : D("", !0),
1409
- n.value ? (w(), L("div", {
1407
+ return (o, $) => (h(), L("div", Xt, [
1408
+ a.label ? (h(), L("span", Kt, U(a.label), 1)) : D("", !0),
1409
+ n.value ? (h(), L("div", {
1410
1410
  key: 2,
1411
1411
  class: "wx-media-field__frame",
1412
- style: fe(y.value)
1412
+ style: fe(w.value)
1413
1413
  }, [
1414
- V("button", {
1414
+ T("button", {
1415
1415
  type: "button",
1416
1416
  class: "wx-media-field__picture",
1417
1417
  disabled: a.disabled,
1418
1418
  title: e(l)("field.replace"),
1419
1419
  onClick: k
1420
1420
  }, [
1421
- x.value ? (w(), T(e(mt), {
1421
+ x.value ? (h(), z(e(pt), {
1422
1422
  key: 0,
1423
1423
  src: x.value,
1424
1424
  fit: "contain",
1425
1425
  width: "100%",
1426
1426
  height: "100%"
1427
- }, null, 8, ["src"])) : (w(), L("span", Yt, U(e(l)("field.no-preview")), 1))
1427
+ }, null, 8, ["src"])) : (h(), L("span", Yt, U(e(l)("field.no-preview")), 1))
1428
1428
  ], 8, Gt),
1429
- a.disabled ? D("", !0) : (w(), L("div", Jt, [
1429
+ a.disabled ? D("", !0) : (h(), L("div", Jt, [
1430
1430
  g(e(le), { size: "sm" }, {
1431
1431
  default: b(() => [
1432
- a.captions ? (w(), T(e(Re), {
1432
+ a.captions ? (h(), z(e(Le), {
1433
1433
  key: 0,
1434
1434
  open: v.value,
1435
1435
  "onUpdate:open": $[3] || ($[3] = (F) => v.value = F),
@@ -1445,9 +1445,9 @@ const kt = {
1445
1445
  }, null, 8, ["title"])
1446
1446
  ]),
1447
1447
  default: b(() => [
1448
- V("div", Qt, [
1449
- V("div", Zt, [
1450
- $[4] || ($[4] = V("label", {
1448
+ T("div", Qt, [
1449
+ T("div", Zt, [
1450
+ $[4] || ($[4] = T("label", {
1451
1451
  class: "wx-media-field__caption-label",
1452
1452
  for: "wx-media-alt"
1453
1453
  }, "alt", -1)),
@@ -1459,8 +1459,8 @@ const kt = {
1459
1459
  "onUpdate:modelValue": $[0] || ($[0] = (F) => u("alt", F))
1460
1460
  }, null, 8, ["model-value", "placeholder"])
1461
1461
  ]),
1462
- V("div", el, [
1463
- $[5] || ($[5] = V("label", {
1462
+ T("div", el, [
1463
+ $[5] || ($[5] = T("label", {
1464
1464
  class: "wx-media-field__caption-label",
1465
1465
  for: "wx-media-title"
1466
1466
  }, "title", -1)),
@@ -1472,14 +1472,14 @@ const kt = {
1472
1472
  "onUpdate:modelValue": $[1] || ($[1] = (F) => u("title", F))
1473
1473
  }, null, 8, ["model-value", "placeholder"])
1474
1474
  ]),
1475
- V("div", tl, [
1476
- g(e(I), {
1475
+ T("div", tl, [
1476
+ g(e(X), {
1477
1477
  size: "sm",
1478
1478
  type: "primary",
1479
1479
  onClick: $[2] || ($[2] = (F) => v.value = !1)
1480
1480
  }, {
1481
1481
  default: b(() => [
1482
- O(U(e(l)("manager.save")), 1)
1482
+ A(U(e(l)("manager.save")), 1)
1483
1483
  ]),
1484
1484
  _: 1
1485
1485
  })
@@ -1488,14 +1488,14 @@ const kt = {
1488
1488
  ]),
1489
1489
  _: 1
1490
1490
  }, 8, ["open", "title"])) : D("", !0),
1491
- g(e(De), {
1491
+ g(e(Re), {
1492
1492
  title: e(l)("field.clear-title"),
1493
1493
  description: e(l)("field.clear-text"),
1494
1494
  "confirm-text": e(l)("field.clear-confirm"),
1495
1495
  "cancel-text": e(l)("manager.cancel"),
1496
1496
  "confirm-type": "danger",
1497
1497
  side: "top",
1498
- onConfirm: h
1498
+ onConfirm: y
1499
1499
  }, {
1500
1500
  trigger: b(() => [
1501
1501
  g(e(B), {
@@ -1509,12 +1509,12 @@ const kt = {
1509
1509
  _: 1
1510
1510
  })
1511
1511
  ]))
1512
- ], 4)) : (w(), L("div", {
1512
+ ], 4)) : (h(), L("div", {
1513
1513
  key: 1,
1514
1514
  class: "wx-media-field__frame is-empty",
1515
- style: fe(y.value)
1515
+ style: fe(w.value)
1516
1516
  }, [
1517
- V("button", {
1517
+ T("button", {
1518
1518
  type: "button",
1519
1519
  class: "wx-media-field__pick",
1520
1520
  disabled: a.disabled,
@@ -1528,30 +1528,41 @@ const kt = {
1528
1528
  setup(a) {
1529
1529
  const i = se();
1530
1530
  re();
1531
- const n = H("webx-media"), l = oe("manager"), r = R("all"), d = z(() => r.value), v = z(() => i.can("media.upload") || i.can("media.manage")), t = z(
1532
- () => i.state.manifest?.modules.find((y) => y.id === "media")?.title ?? n("module.title")
1533
- ), x = z(() => [
1531
+ const n = I("webx-media"), l = oe("manager"), r = R("all"), d = V(() => r.value), v = V(() => i.can("media.upload") || i.can("media.manage")), t = V(
1532
+ () => i.state.manifest?.modules.find((s) => s.id === "media")?.title ?? n("module.title")
1533
+ ), x = V(() => [
1534
1534
  { value: "all", label: n("manager.all-types") },
1535
- ...["image", "video", "audio", "document", "other"].map((y) => ({
1536
- value: y,
1537
- label: n(`manager.${y}`)
1535
+ ...["image", "video", "audio", "document", "other"].map((s) => ({
1536
+ value: s,
1537
+ label: n(`manager.${s}`)
1538
1538
  }))
1539
- ]);
1540
- return (y, s) => (w(), T(e(lt), {
1539
+ ]), w = V(
1540
+ () => v.value ? [
1541
+ {
1542
+ key: "upload",
1543
+ label: n("manager.upload"),
1544
+ icon: "upload",
1545
+ primary: !0,
1546
+ run: () => l.value?.upload()
1547
+ }
1548
+ ] : []
1549
+ );
1550
+ return (s, u) => (h(), z(e(at), {
1541
1551
  view: r.value,
1542
- "onUpdate:view": s[1] || (s[1] = (u) => r.value = u),
1552
+ "onUpdate:view": u[0] || (u[0] = (k) => r.value = k),
1543
1553
  title: t.value,
1544
1554
  views: x.value,
1555
+ actions: w.value,
1545
1556
  card: !1,
1546
1557
  fill: ""
1547
- }, We({
1558
+ }, {
1548
1559
  default: b(() => [
1549
- g(e(pt), {
1560
+ g(e(ft), {
1550
1561
  class: "wx-media-page",
1551
1562
  padding: "md"
1552
1563
  }, {
1553
1564
  default: b(() => [
1554
- g(Se, {
1565
+ g(Be, {
1555
1566
  ref_key: "manager",
1556
1567
  ref: l,
1557
1568
  type: d.value,
@@ -1561,25 +1572,8 @@ const kt = {
1561
1572
  _: 1
1562
1573
  })
1563
1574
  ]),
1564
- _: 2
1565
- }, [
1566
- v.value ? {
1567
- name: "actions",
1568
- fn: b(() => [
1569
- g(e(I), {
1570
- type: "primary",
1571
- icon: "upload",
1572
- onClick: s[0] || (s[0] = (u) => l.value?.upload())
1573
- }, {
1574
- default: b(() => [
1575
- O(U(e(n)("manager.upload")), 1)
1576
- ]),
1577
- _: 1
1578
- })
1579
- ]),
1580
- key: "0"
1581
- } : void 0
1582
- ]), 1032, ["view", "title", "views"]));
1575
+ _: 1
1576
+ }, 8, ["view", "title", "views", "actions"]));
1583
1577
  }
1584
1578
  });
1585
1579
  function sl(a = {}) {
@@ -1603,6 +1597,16 @@ function sl(a = {}) {
1603
1597
  "wx-gallery": { component: Ht, kind: "field", wide: !0 },
1604
1598
  "wx-file": { component: qt, kind: "field" },
1605
1599
  "wx-files": { component: It, kind: "field", wide: !0 }
1600
+ },
1601
+ /**
1602
+ * Where the panel's own fields get a picture from. `wx-rich-text` lives in
1603
+ * `module-admin`, which cannot reach the library — the dependency runs this way — so the
1604
+ * module that has the files hands the way in, and a panel without a file manager simply
1605
+ * has no image button in its editors.
1606
+ */
1607
+ pickImage: async () => {
1608
+ const n = await Se({ accept: "image" });
1609
+ return n ? { url: n.url, path: n.path } : null;
1606
1610
  }
1607
1611
  };
1608
1612
  }
@@ -1611,14 +1615,14 @@ export {
1611
1615
  It as WxFilesField,
1612
1616
  Ht as WxGalleryField,
1613
1617
  ll as WxMediaField,
1614
- Se as WxMediaManager,
1618
+ Be as WxMediaManager,
1615
1619
  al as WxMediaPage,
1616
1620
  xe as WxMediaPicker,
1617
1621
  be as createMediaApi,
1618
1622
  sl as media,
1619
- xt as mediaMessages,
1623
+ kt as mediaMessages,
1620
1624
  Ft as openMediaFiles,
1621
1625
  Wt as openMediaLibrary,
1622
- Ut as openMediaPicker
1626
+ Se as openMediaPicker
1623
1627
  };
1624
1628
  //# sourceMappingURL=index.js.map