@webx-ui/module-media 0.6.1 → 0.6.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,17 +1,17 @@
1
- import { defineComponent as O, useModel as I, ref as L, watch as K, openBlock as b, createBlock as T, unref as e, mergeModels as j, computed as U, resolveDirective as Ke, withCtx as x, createElementBlock as W, Fragment as se, renderList as re, withDirectives as je, createCommentVNode as R, createVNode as v, createTextVNode as N, toDisplayString as z, isRef as me, useTemplateRef as de, onMounted as Fe, nextTick as Ge, createElementVNode as M, withKeys as Ye, normalizeClass as ue, createSlots as Je, inject as Qe, normalizeStyle as ce, mergeProps as pe } from "vue";
2
- import { useTranslate as X, useAdmin as fe, adminKey as Ze } from "@webx-ui/module-admin";
3
- import { WxTree as et, WxSelectionArea as tt, WxFileCard as Ue, WxEmpty as lt, toast as Q, WxAction as D, WxInput as Z, WxDropdown as Ce, WxDropdownItem as Ve, WxActions as le, useModal as ve, WxDialog as ge, WxSelect as at, WxSpace as ye, WxButton as H, useElementWidth as it, createModal as ae, WxPagination as nt, WxDrawer as ot, confirm as Me, openImageEditor as st, WxSortableList as rt, WxPopover as We, WxPopconfirm as Le, WxImage as dt, WxCard as ut } from "@webx-ui/core";
4
- function he(t) {
5
- const i = `${t.apiPath}/media`, o = (l) => l.data;
1
+ import { defineComponent as S, useModel as A, ref as R, watch as G, openBlock as h, 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 B, 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 D, WxInput as Z, WxDropdown as Ve, WxDropdownItem as Te, WxActions as le, useModal as ye, WxDialog as he, WxSelect as ot, WxSpace as be, 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 Be, WxImage as mt, WxCard as pt } from "@webx-ui/core";
4
+ function we(a) {
5
+ const i = `${a.apiPath}/media`, n = (l) => l.data;
6
6
  return {
7
- directories: () => t.http.get(`${i}/directories`).then(o),
8
- createDirectory: (l, c) => t.http.post(`${i}/directories`, { parent_id: l, title: c }).then(o),
9
- renameDirectory: (l, c) => t.http.patch(`${i}/directories/${l}`, { title: c }).then(o),
10
- moveDirectory: (l, c) => t.http.patch(`${i}/directories/${l}/move`, { parent_id: c }).then(o),
11
- deleteDirectory: (l, c = !1) => t.http.delete(`${i}/directories/${l}`, {
12
- query: { force: c ? 1 : void 0 }
7
+ directories: () => a.http.get(`${i}/directories`).then(n),
8
+ createDirectory: (l, r) => a.http.post(`${i}/directories`, { parent_id: l, title: r }).then(n),
9
+ renameDirectory: (l, r) => a.http.patch(`${i}/directories/${l}`, { title: r }).then(n),
10
+ moveDirectory: (l, r) => a.http.patch(`${i}/directories/${l}/move`, { parent_id: r }).then(n),
11
+ deleteDirectory: (l, r = !1) => a.http.delete(`${i}/directories/${l}`, {
12
+ query: { force: r ? 1 : void 0 }
13
13
  }),
14
- files: (l = {}) => t.http.get(`${i}/files`, {
14
+ files: (l = {}) => a.http.get(`${i}/files`, {
15
15
  query: {
16
16
  directory_id: l.directory_id ?? void 0,
17
17
  q: l.q || void 0,
@@ -21,111 +21,111 @@ function he(t) {
21
21
  per_page: l.per_page
22
22
  }
23
23
  }),
24
- file: (l) => t.http.get(`${i}/files/${l}`).then(o),
25
- fileByPath: (l) => t.http.get(`${i}/files/by-path?path=${encodeURIComponent(l)}`).then(o).catch(() => null),
26
- async upload(l, c, s) {
27
- const a = new FormData();
28
- return a.append("directory_id", String(l)), c.forEach((n) => a.append("files[]", n)), new Promise((n, k) => {
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", t.i18n.state.locale);
31
- const u = ct();
32
- u && w.setRequestHeader("X-XSRF-TOKEN", u), w.upload.addEventListener("progress", (r) => {
33
- r.lengthComputable && s?.(Math.round(r.loaded / r.total * 100));
34
- }), w.addEventListener("load", () => {
35
- const r = w.response;
36
- if (w.status >= 200 && w.status < 300 && r?.data) {
37
- n(r.data);
24
+ file: (l) => a.http.get(`${i}/files/${l}`).then(n),
25
+ fileByPath: (l) => a.http.get(`${i}/files/by-path?path=${encodeURIComponent(l)}`).then(n).catch(() => null),
26
+ async upload(l, r, d) {
27
+ const v = new FormData();
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) => {
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) {
37
+ t(u.data);
38
38
  return;
39
39
  }
40
- k(
41
- Object.assign(new Error(r?.message ?? "Upload failed"), {
42
- status: w.status,
43
- body: r
40
+ x(
41
+ Object.assign(new Error(u?.message ?? "Upload failed"), {
42
+ status: y.status,
43
+ body: u
44
44
  })
45
45
  );
46
- }), w.addEventListener("error", () => k(new Error("Upload failed"))), w.send(a);
46
+ }), y.addEventListener("error", () => x(new Error("Upload failed"))), y.send(v);
47
47
  });
48
48
  },
49
- rename: (l, c) => t.http.patch(`${i}/files/${l}`, { name: c }).then(o),
50
- move: (l, c) => t.http.post(`${i}/files/move`, { ids: l, directory_id: c }).then((s) => s.data.moved),
49
+ rename: (l, r) => a.http.patch(`${i}/files/${l}`, { name: r }).then(n),
50
+ move: (l, r) => a.http.post(`${i}/files/move`, { ids: l, directory_id: r }).then((d) => d.data.moved),
51
51
  // A POST for the batch, not a DELETE: the panel's own client sends no body on DELETE, and
52
52
  // a list of ids in a query string is a worse answer than an honest verb.
53
- remove: (l) => t.http.post(`${i}/files/delete`, { ids: l }).then((c) => c.data.deleted),
54
- removeOne: (l) => t.http.delete(`${i}/files/${l}`),
55
- edit: (l, c) => t.http.post(`${i}/files/${l}/edit`, c).then(o),
56
- copy: (l) => t.http.post(`${i}/files/${l}/copy`).then(o),
57
- restoreOriginal: (l) => t.http.post(`${i}/files/${l}/restore-original`).then(o),
58
- thumb(l, c, s, a = "cover") {
53
+ remove: (l) => a.http.post(`${i}/files/delete`, { ids: l }).then((r) => r.data.deleted),
54
+ removeOne: (l) => a.http.delete(`${i}/files/${l}`),
55
+ edit: (l, r) => a.http.post(`${i}/files/${l}/edit`, r).then(n),
56
+ copy: (l) => a.http.post(`${i}/files/${l}/copy`).then(n),
57
+ restoreOriginal: (l) => a.http.post(`${i}/files/${l}/restore-original`).then(n),
58
+ thumb(l, r, d, v = "cover") {
59
59
  if (!l.thumb)
60
60
  return null;
61
- const n = new URL(l.thumb, window.location.origin);
62
- return n.searchParams.set("w", String(c)), s && n.searchParams.set("h", String(s)), n.searchParams.set("fit", a), n.pathname + n.search;
61
+ const t = new URL(l.thumb, window.location.origin);
62
+ return t.searchParams.set("w", String(r)), d && t.searchParams.set("h", String(d)), t.searchParams.set("fit", v), t.pathname + t.search;
63
63
  }
64
64
  };
65
65
  }
66
- function ct() {
67
- const t = document.cookie.split("; ").find((i) => i.startsWith("XSRF-TOKEN="));
68
- return t ? decodeURIComponent(t.slice(11)) : null;
66
+ function ft() {
67
+ const a = document.cookie.split("; ").find((i) => i.startsWith("XSRF-TOKEN="));
68
+ return a ? decodeURIComponent(a.slice(11)) : null;
69
69
  }
70
- function Re(t) {
70
+ function De(a) {
71
71
  const i = ["B", "KB", "MB", "GB", "TB"];
72
- let o = t, l = 0;
73
- for (; o >= 1024 && l < i.length - 1; )
74
- o /= 1024, l++;
75
- return `${o >= 10 || l === 0 ? Math.round(o) : o.toFixed(1)} ${i[l]}`;
72
+ let n = a, l = 0;
73
+ for (; n >= 1024 && l < i.length - 1; )
74
+ n /= 1024, l++;
75
+ return `${n >= 10 || l === 0 ? Math.round(n) : n.toFixed(1)} ${i[l]}`;
76
76
  }
77
- function mt(t) {
78
- return t.split("/").pop() || t;
77
+ function vt(a) {
78
+ return a.split("/").pop() || a;
79
79
  }
80
- const Te = /* @__PURE__ */ O({
80
+ const ze = /* @__PURE__ */ S({
81
81
  __name: "DirectoryTree",
82
- props: /* @__PURE__ */ j({
82
+ props: /* @__PURE__ */ q({
83
83
  directories: {}
84
84
  }, {
85
85
  selected: { default: null },
86
86
  selectedModifiers: {}
87
87
  }),
88
- emits: /* @__PURE__ */ j(["move"], ["update:selected"]),
89
- setup(t, { emit: i }) {
90
- const o = t, l = I(t, "selected"), c = i, s = X("webx-media"), a = L([]), n = L([]);
91
- K(
92
- () => o.directories,
93
- (r) => {
94
- a.value = r.map(k), n.value = w(r);
88
+ emits: /* @__PURE__ */ q(["move"], ["update:selected"]),
89
+ setup(a, { emit: i }) {
90
+ const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = R([]), t = R([]);
91
+ G(
92
+ () => n.directories,
93
+ (u) => {
94
+ v.value = u.map(x), t.value = y(u);
95
95
  },
96
96
  { immediate: !0, deep: !0 }
97
97
  );
98
- function k(r) {
98
+ function x(u) {
99
99
  return {
100
- ...r,
101
- label: r.is_root ? s("manager.root") : r.title,
102
- children: (r.children ?? []).map(k)
100
+ ...u,
101
+ label: u.is_root ? d("manager.root") : u.title,
102
+ children: (u.children ?? []).map(x)
103
103
  };
104
104
  }
105
- function w(r) {
106
- return r.flatMap((g) => [g.id, ...w(g.children ?? [])]);
105
+ function y(u) {
106
+ return u.flatMap((k) => [k.id, ...y(k.children ?? [])]);
107
107
  }
108
- function u(r) {
109
- const g = r.zone === "inside" ? r.target : r.parent;
110
- g && c("move", r.node.id, g.id);
108
+ function s(u) {
109
+ const k = u.zone === "inside" ? u.target : u.parent;
110
+ k && r("move", u.node.id, k.id);
111
111
  }
112
- return (r, g) => (b(), T(e(et), {
112
+ return (u, k) => (h(), T(e(at), {
113
113
  selected: l.value,
114
- "onUpdate:selected": g[0] || (g[0] = (f) => l.value = f),
115
- expanded: n.value,
116
- "onUpdate:expanded": g[1] || (g[1] = (f) => n.value = f),
117
- modelValue: a.value,
118
- "onUpdate:modelValue": g[2] || (g[2] = (f) => a.value = f),
114
+ "onUpdate:selected": k[0] || (k[0] = (w) => l.value = w),
115
+ expanded: t.value,
116
+ "onUpdate:expanded": k[1] || (k[1] = (w) => t.value = w),
117
+ modelValue: v.value,
118
+ "onUpdate:modelValue": k[2] || (k[2] = (w) => v.value = w),
119
119
  class: "wx-media-tree",
120
120
  "node-key": "id",
121
121
  draggable: "",
122
122
  "show-lines": "",
123
- onDrop: u
123
+ onDrop: s
124
124
  }, null, 8, ["selected", "expanded", "modelValue"]));
125
125
  }
126
- }), pt = /* @__PURE__ */ O({
126
+ }), gt = /* @__PURE__ */ S({
127
127
  __name: "FileGrid",
128
- props: /* @__PURE__ */ j({
128
+ props: /* @__PURE__ */ q({
129
129
  files: {},
130
130
  api: {},
131
131
  query: {},
@@ -134,79 +134,80 @@ const Te = /* @__PURE__ */ O({
134
134
  selected: { default: () => [] },
135
135
  selectedModifiers: {}
136
136
  }),
137
- emits: /* @__PURE__ */ j(["open", "rename", "edit", "remove"], ["update:selected"]),
138
- setup(t, { emit: i }) {
139
- const o = t, l = I(t, "selected"), c = i, s = X("webx-media"), a = U(
140
- () => o.query ? s("manager.empty-search", { query: o.query }) : s("manager.empty")
137
+ emits: /* @__PURE__ */ q(["open", "rename", "edit", "remove"], ["update:selected"]),
138
+ setup(a, { emit: i }) {
139
+ const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = z(
140
+ () => n.query ? d("manager.empty-search", { query: n.query }) : d("manager.empty")
141
141
  );
142
- function n() {
143
- Q.success(s("manager.link-copied"));
142
+ function t() {
143
+ J.success(d("manager.link-copied"));
144
144
  }
145
- function k(w) {
146
- const u = document.createElement("textarea");
147
- u.value = w.url, u.setAttribute("readonly", ""), u.style.position = "fixed", u.style.opacity = "0", document.body.appendChild(u), u.select();
148
- let r = !1;
145
+ function x(y) {
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();
148
+ let u = !1;
149
149
  try {
150
- r = document.execCommand("copy");
150
+ u = document.execCommand("copy");
151
151
  } catch {
152
- r = !1;
152
+ u = !1;
153
153
  }
154
- if (u.remove(), r) {
155
- n();
154
+ if (s.remove(), u) {
155
+ t();
156
156
  return;
157
157
  }
158
- Q.danger(`${s("errors.copy")} ${w.url}`, { duration: 0 });
158
+ J.danger(`${d("errors.copy")} ${y.url}`, { duration: 0 });
159
159
  }
160
- return (w, u) => {
161
- const r = Ke("wx-select");
162
- return t.files.length > 0 ? (b(), T(e(tt), {
160
+ return (y, s) => {
161
+ const u = Ge("wx-select");
162
+ return a.files.length > 0 ? (h(), T(e(it), {
163
163
  key: 0,
164
164
  modelValue: l.value,
165
- "onUpdate:modelValue": u[0] || (u[0] = (g) => l.value = g),
165
+ "onUpdate:modelValue": s[0] || (s[0] = (k) => l.value = k),
166
166
  class: "wx-media-grid",
167
- multiple: !t.single
167
+ multiple: !a.single
168
168
  }, {
169
- default: x(({ isSelected: g }) => [
170
- (b(!0), W(se, null, re(t.files, (f) => je((b(), T(e(Ue), {
171
- key: f.id,
169
+ default: b(({ isSelected: k }) => [
170
+ (h(!0), L(ce, null, me(a.files, (w) => Ye((h(), T(e(Le), {
171
+ key: w.id,
172
172
  class: "wx-media-grid__card",
173
- name: f.name,
174
- url: f.url,
175
- thumbnail: t.api.thumb(f, 320, 320) ?? void 0,
176
- type: f.mime,
177
- selected: g(f.id),
173
+ name: w.name,
174
+ url: w.url,
175
+ thumbnail: a.api.thumb(w, 320, 320) ?? void 0,
176
+ type: w.mime,
177
+ selected: k(w.id),
178
178
  renamable: "",
179
- editable: f.editable,
179
+ editable: w.editable,
180
180
  removable: "",
181
181
  copyable: "",
182
- "rename-label": e(s)("manager.rename"),
183
- "edit-label": e(s)("manager.edit"),
184
- "remove-label": e(s)("manager.delete"),
185
- "remove-confirm-text": e(s)("dialogs.delete-file", { name: f.name }),
186
- "cancel-label": e(s)("manager.cancel"),
187
- "save-label": e(s)("manager.save"),
188
- "copy-label": e(s)("manager.copy-link"),
189
- "copied-label": e(s)("manager.link-copied"),
190
- onRename: (d) => c("rename", f, d),
191
- onEdit: (d) => c("edit", f),
192
- onRemove: (d) => c("remove", f),
193
- onCopy: n,
194
- onCopyError: (d) => k(f),
195
- onDblclick: (d) => c("open", f)
182
+ "actions-menu": "",
183
+ "rename-label": e(d)("manager.rename"),
184
+ "edit-label": e(d)("manager.edit"),
185
+ "remove-label": e(d)("manager.delete"),
186
+ "remove-confirm-text": e(d)("dialogs.delete-file", { name: w.name }),
187
+ "cancel-label": e(d)("manager.cancel"),
188
+ "save-label": e(d)("manager.save"),
189
+ "copy-label": e(d)("manager.copy-link"),
190
+ "copied-label": e(d)("manager.link-copied"),
191
+ onRename: (o) => r("rename", w, o),
192
+ onEdit: (o) => r("edit", w),
193
+ onRemove: (o) => r("remove", w),
194
+ onCopy: t,
195
+ onCopyError: (o) => x(w),
196
+ onDblclick: (o) => r("open", w)
196
197
  }, null, 8, ["name", "url", "thumbnail", "type", "selected", "editable", "rename-label", "edit-label", "remove-label", "remove-confirm-text", "cancel-label", "save-label", "copy-label", "copied-label", "onRename", "onEdit", "onRemove", "onCopyError", "onDblclick"])), [
197
- [r, f.id]
198
+ [u, w.id]
198
199
  ])), 128))
199
200
  ]),
200
201
  _: 1
201
- }, 8, ["modelValue", "multiple"])) : (b(), T(e(lt), {
202
+ }, 8, ["modelValue", "multiple"])) : (h(), T(e(nt), {
202
203
  key: 1,
203
- description: a.value
204
+ description: v.value
204
205
  }, null, 8, ["description"]));
205
206
  };
206
207
  }
207
- }), ft = { class: "wx-media-toolbar" }, vt = /* @__PURE__ */ O({
208
+ }), yt = { class: "wx-media-toolbar" }, ht = /* @__PURE__ */ S({
208
209
  __name: "MediaToolbar",
209
- props: /* @__PURE__ */ j({
210
+ props: /* @__PURE__ */ q({
210
211
  canUpload: { type: Boolean },
211
212
  canManage: { type: Boolean },
212
213
  selected: {},
@@ -220,155 +221,155 @@ const Te = /* @__PURE__ */ O({
220
221
  sort: { default: "-created_at" },
221
222
  sortModifiers: {}
222
223
  }),
223
- emits: /* @__PURE__ */ j(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
224
- setup(t, { emit: i }) {
225
- const o = t, l = I(t, "search"), c = I(t, "type"), s = I(t, "sort"), a = i, n = X("webx-media"), k = U(() => [
226
- { value: "all", label: n("manager.all-types") },
227
- ...["image", "video", "audio", "document", "other"].map((g) => ({
228
- value: g,
229
- label: n(`manager.${g}`)
224
+ emits: /* @__PURE__ */ q(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
225
+ setup(a, { emit: i }) {
226
+ const n = a, l = A(a, "search"), r = A(a, "type"), d = A(a, "sort"), v = i, t = H("webx-media"), x = z(() => [
227
+ { value: "all", label: t("manager.all-types") },
228
+ ...["image", "video", "audio", "document", "other"].map((k) => ({
229
+ value: k,
230
+ label: t(`manager.${k}`)
230
231
  }))
231
- ]), w = U(() => [
232
- { value: "-created_at", label: n("manager.sort-newest") },
233
- { value: "created_at", label: n("manager.sort-oldest") },
234
- { value: "name", label: n("manager.sort-name") },
235
- { value: "-size", label: n("manager.sort-size") }
236
- ]), u = U(() => k.value.find((g) => g.value === c.value)?.label ?? ""), r = U(() => w.value.find((g) => g.value === s.value)?.label ?? "");
237
- return (g, f) => (b(), W("header", ft, [
238
- t.compact ? (b(), T(e(D), {
232
+ ]), y = z(() => [
233
+ { value: "-created_at", label: t("manager.sort-newest") },
234
+ { value: "created_at", label: t("manager.sort-oldest") },
235
+ { value: "name", label: t("manager.sort-name") },
236
+ { value: "-size", label: t("manager.sort-size") }
237
+ ]), s = z(() => x.value.find((k) => k.value === r.value)?.label ?? ""), u = z(() => y.value.find((k) => k.value === d.value)?.label ?? "");
238
+ return (k, w) => (h(), L("header", yt, [
239
+ a.compact ? (h(), T(e(D), {
239
240
  key: 0,
240
- icon: "folder",
241
- title: e(n)("manager.folders"),
241
+ icon: "sidebar",
242
+ title: e(t)("manager.folders"),
242
243
  size: "sm",
243
- onClick: f[0] || (f[0] = (d) => a("folders"))
244
- }, null, 8, ["title"])) : R("", !0),
245
- v(e(Z), {
244
+ onClick: w[0] || (w[0] = (o) => v("folders"))
245
+ }, null, 8, ["title"])) : B("", !0),
246
+ g(e(Z), {
246
247
  modelValue: l.value,
247
- "onUpdate:modelValue": f[1] || (f[1] = (d) => l.value = d),
248
+ "onUpdate:modelValue": w[1] || (w[1] = (o) => l.value = o),
248
249
  class: "wx-media-toolbar__search",
249
- placeholder: e(n)("manager.search"),
250
+ placeholder: e(t)("manager.search"),
250
251
  clearable: "",
251
252
  size: "sm"
252
253
  }, null, 8, ["modelValue", "placeholder"]),
253
- t.fixedType ? R("", !0) : (b(), T(e(Ce), { key: 1 }, {
254
- trigger: x(() => [
255
- v(e(D), {
254
+ a.fixedType ? B("", !0) : (h(), T(e(Ve), { key: 1 }, {
255
+ trigger: b(() => [
256
+ g(e(D), {
256
257
  icon: "filter",
257
- title: `${e(n)("manager.all-types")}: ${u.value}`,
258
+ title: `${e(t)("manager.all-types")}: ${s.value}`,
258
259
  size: "sm"
259
260
  }, null, 8, ["title"])
260
261
  ]),
261
- default: x(() => [
262
- (b(!0), W(se, null, re(k.value, (d) => (b(), T(e(Ve), {
263
- key: String(d.value),
264
- active: d.value === c.value,
265
- onClick: ($) => c.value = d.value
262
+ default: b(() => [
263
+ (h(!0), L(ce, null, me(x.value, (o) => (h(), T(e(Te), {
264
+ key: String(o.value),
265
+ active: o.value === r.value,
266
+ onClick: ($) => r.value = o.value
266
267
  }, {
267
- default: x(() => [
268
- N(z(d.label), 1)
268
+ default: b(() => [
269
+ O(U(o.label), 1)
269
270
  ]),
270
271
  _: 2
271
272
  }, 1032, ["active", "onClick"]))), 128))
272
273
  ]),
273
274
  _: 1
274
275
  })),
275
- v(e(Ce), null, {
276
- trigger: x(() => [
277
- v(e(D), {
276
+ g(e(Ve), null, {
277
+ trigger: b(() => [
278
+ g(e(D), {
278
279
  icon: "arrow-down",
279
- title: r.value,
280
+ title: u.value,
280
281
  size: "sm"
281
282
  }, null, 8, ["title"])
282
283
  ]),
283
- default: x(() => [
284
- (b(!0), W(se, null, re(w.value, (d) => (b(), T(e(Ve), {
285
- key: d.value,
286
- active: d.value === s.value,
287
- onClick: ($) => s.value = d.value
284
+ default: b(() => [
285
+ (h(!0), L(ce, null, me(y.value, (o) => (h(), T(e(Te), {
286
+ key: o.value,
287
+ active: o.value === d.value,
288
+ onClick: ($) => d.value = o.value
288
289
  }, {
289
- default: x(() => [
290
- N(z(d.label), 1)
290
+ default: b(() => [
291
+ O(U(o.label), 1)
291
292
  ]),
292
293
  _: 2
293
294
  }, 1032, ["active", "onClick"]))), 128))
294
295
  ]),
295
296
  _: 1
296
297
  }),
297
- t.canUpload ? (b(), T(e(D), {
298
+ a.canUpload ? (h(), T(e(D), {
298
299
  key: 2,
299
300
  type: "upload",
300
- title: e(n)("manager.upload"),
301
+ title: e(t)("manager.upload"),
301
302
  size: "sm",
302
- onClick: f[2] || (f[2] = (d) => a("upload"))
303
- }, null, 8, ["title"])) : R("", !0),
304
- t.canManage ? (b(), T(e(le), {
303
+ onClick: w[2] || (w[2] = (o) => v("upload"))
304
+ }, null, 8, ["title"])) : B("", !0),
305
+ a.canManage ? (h(), T(e(le), {
305
306
  key: 3,
306
307
  size: "sm"
307
308
  }, {
308
- default: x(() => [
309
- v(e(D), {
310
- icon: "folder",
311
- title: e(n)("manager.move"),
312
- disabled: o.selected === 0,
313
- onClick: f[3] || (f[3] = (d) => a("move"))
309
+ default: b(() => [
310
+ g(e(D), {
311
+ icon: "folder-move",
312
+ title: e(t)("manager.move"),
313
+ disabled: n.selected === 0,
314
+ onClick: w[3] || (w[3] = (o) => v("move"))
314
315
  }, null, 8, ["title", "disabled"]),
315
- v(e(D), {
316
+ g(e(D), {
316
317
  type: "remove",
317
- title: e(n)("manager.delete"),
318
- disabled: o.selected === 0,
319
- onClick: f[4] || (f[4] = (d) => a("remove"))
318
+ title: e(t)("manager.delete"),
319
+ disabled: n.selected === 0,
320
+ onClick: w[4] || (w[4] = (o) => v("remove"))
320
321
  }, null, 8, ["title", "disabled"])
321
322
  ]),
322
323
  _: 1
323
- })) : R("", !0)
324
+ })) : B("", !0)
324
325
  ]));
325
326
  }
326
- }), gt = /* @__PURE__ */ O({
327
+ }), bt = /* @__PURE__ */ S({
327
328
  __name: "MoveDialog",
328
329
  props: {
329
330
  directories: {},
330
331
  from: {},
331
332
  count: {}
332
333
  },
333
- setup(t) {
334
- const i = t, { open: o, resolve: l, dismiss: c } = ve(), s = X("webx-media"), a = U(
335
- () => k(i.directories).filter((w) => w.value !== i.from)
336
- ), n = L(a.value[0]?.value ?? null);
337
- function k(w) {
338
- return w.flatMap((u) => [
334
+ setup(a) {
335
+ const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = z(
336
+ () => x(i.directories).filter((y) => y.value !== i.from)
337
+ ), t = R(v.value[0]?.value ?? null);
338
+ function x(y) {
339
+ return y.flatMap((s) => [
339
340
  {
340
- value: u.id,
341
+ value: s.id,
341
342
  // Indented, so the tree is still readable once it is a flat list.
342
- label: " ".repeat(u.depth * 3) + (u.is_root ? s("manager.root") : u.title)
343
+ label: " ".repeat(s.depth * 3) + (s.is_root ? d("manager.root") : s.title)
343
344
  },
344
- ...k(u.children ?? [])
345
+ ...x(s.children ?? [])
345
346
  ]);
346
347
  }
347
- return (w, u) => (b(), T(e(ge), {
348
- open: e(o),
349
- "onUpdate:open": u[3] || (u[3] = (r) => me(o) ? o.value = r : null),
350
- title: e(s)("manager.move-to"),
348
+ return (y, s) => (h(), T(e(he), {
349
+ open: e(n),
350
+ "onUpdate:open": s[3] || (s[3] = (u) => ve(n) ? n.value = u : null),
351
+ title: e(d)("manager.move-to"),
351
352
  width: 420
352
353
  }, {
353
- footer: x(() => [
354
- v(e(ye), { size: "sm" }, {
355
- default: x(() => [
356
- v(e(H), {
354
+ footer: b(() => [
355
+ g(e(be), { size: "sm" }, {
356
+ default: b(() => [
357
+ g(e(I), {
357
358
  variant: "outline",
358
- onClick: u[1] || (u[1] = (r) => e(c)())
359
+ onClick: s[1] || (s[1] = (u) => e(r)())
359
360
  }, {
360
- default: x(() => [
361
- N(z(e(s)("manager.cancel")), 1)
361
+ default: b(() => [
362
+ O(U(e(d)("manager.cancel")), 1)
362
363
  ]),
363
364
  _: 1
364
365
  }),
365
- v(e(H), {
366
+ g(e(I), {
366
367
  type: "primary",
367
- disabled: n.value === null,
368
- onClick: u[2] || (u[2] = (r) => e(l)(n.value))
368
+ disabled: t.value === null,
369
+ onClick: s[2] || (s[2] = (u) => e(l)(t.value))
369
370
  }, {
370
- default: x(() => [
371
- N(z(e(s)("manager.move")), 1)
371
+ default: b(() => [
372
+ O(U(e(d)("manager.move")), 1)
372
373
  ]),
373
374
  _: 1
374
375
  }, 8, ["disabled"])
@@ -376,17 +377,17 @@ const Te = /* @__PURE__ */ O({
376
377
  _: 1
377
378
  })
378
379
  ]),
379
- default: x(() => [
380
- v(e(at), {
381
- modelValue: n.value,
382
- "onUpdate:modelValue": u[0] || (u[0] = (r) => n.value = r),
383
- options: a.value
380
+ default: b(() => [
381
+ g(e(ot), {
382
+ modelValue: t.value,
383
+ "onUpdate:modelValue": s[0] || (s[0] = (u) => t.value = u),
384
+ options: v.value
384
385
  }, null, 8, ["modelValue", "options"])
385
386
  ]),
386
387
  _: 1
387
388
  }, 8, ["open", "title"]));
388
389
  }
389
- }), yt = /* @__PURE__ */ O({
390
+ }), wt = /* @__PURE__ */ S({
390
391
  __name: "NameDialog",
391
392
  props: {
392
393
  title: {},
@@ -394,40 +395,40 @@ const Te = /* @__PURE__ */ O({
394
395
  value: { default: "" },
395
396
  confirmText: { default: void 0 }
396
397
  },
397
- setup(t) {
398
- const i = t, { open: o, resolve: l, dismiss: c } = ve(), s = X("webx-media"), a = L(i.value), n = de("input");
398
+ setup(a) {
399
+ const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = R(i.value), t = oe("input");
399
400
  Fe(async () => {
400
- await Ge(), n.value?.querySelector("input")?.focus();
401
+ await Je(), t.value?.querySelector("input")?.focus();
401
402
  });
402
- function k() {
403
- const w = a.value.trim();
404
- w !== "" && l(w);
403
+ function x() {
404
+ const y = v.value.trim();
405
+ y !== "" && l(y);
405
406
  }
406
- return (w, u) => (b(), T(e(ge), {
407
- open: e(o),
408
- "onUpdate:open": u[2] || (u[2] = (r) => me(o) ? o.value = r : null),
409
- title: t.title,
407
+ return (y, s) => (h(), T(e(he), {
408
+ open: e(n),
409
+ "onUpdate:open": s[2] || (s[2] = (u) => ve(n) ? n.value = u : null),
410
+ title: a.title,
410
411
  width: 420
411
412
  }, {
412
- footer: x(() => [
413
- v(e(ye), { size: "sm" }, {
414
- default: x(() => [
415
- v(e(H), {
413
+ footer: b(() => [
414
+ g(e(be), { size: "sm" }, {
415
+ default: b(() => [
416
+ g(e(I), {
416
417
  variant: "outline",
417
- onClick: u[1] || (u[1] = (r) => e(c)())
418
+ onClick: s[1] || (s[1] = (u) => e(r)())
418
419
  }, {
419
- default: x(() => [
420
- N(z(e(s)("manager.cancel")), 1)
420
+ default: b(() => [
421
+ O(U(e(d)("manager.cancel")), 1)
421
422
  ]),
422
423
  _: 1
423
424
  }),
424
- v(e(H), {
425
+ g(e(I), {
425
426
  type: "primary",
426
- disabled: a.value.trim() === "",
427
- onClick: k
427
+ disabled: v.value.trim() === "",
428
+ onClick: x
428
429
  }, {
429
- default: x(() => [
430
- N(z(t.confirmText ?? e(s)("manager.save")), 1)
430
+ default: b(() => [
431
+ O(U(a.confirmText ?? e(d)("manager.save")), 1)
431
432
  ]),
432
433
  _: 1
433
434
  }, 8, ["disabled"])
@@ -435,24 +436,24 @@ const Te = /* @__PURE__ */ O({
435
436
  _: 1
436
437
  })
437
438
  ]),
438
- default: x(() => [
439
- M("div", {
439
+ default: b(() => [
440
+ V("div", {
440
441
  ref_key: "input",
441
- ref: n
442
+ ref: t
442
443
  }, [
443
- v(e(Z), {
444
- modelValue: a.value,
445
- "onUpdate:modelValue": u[0] || (u[0] = (r) => a.value = r),
446
- placeholder: t.label ?? e(s)("manager.folder-name"),
447
- "aria-label": t.label ?? e(s)("manager.folder-name"),
448
- onKeyup: Ye(k, ["enter"])
444
+ g(e(Z), {
445
+ modelValue: v.value,
446
+ "onUpdate:modelValue": s[0] || (s[0] = (u) => v.value = u),
447
+ placeholder: a.label ?? e(d)("manager.folder-name"),
448
+ "aria-label": a.label ?? e(d)("manager.folder-name"),
449
+ onKeyup: Qe(x, ["enter"])
449
450
  }, null, 8, ["modelValue", "placeholder", "aria-label"])
450
451
  ], 512)
451
452
  ]),
452
453
  _: 1
453
454
  }, 8, ["open", "title"]));
454
455
  }
455
- }), ht = {
456
+ }), xt = {
456
457
  module: {
457
458
  title: "Files"
458
459
  },
@@ -543,6 +544,7 @@ const Te = /* @__PURE__ */ O({
543
544
  "delete-files-title": "Delete :count file(s)?",
544
545
  "delete-files-text": "Anywhere they are already used, they will stop opening.",
545
546
  "delete-folder-title": "Delete the folder :title?",
547
+ "delete-folder-text": "It goes for good, and so does whatever is inside it.",
546
548
  "delete-folder-contents": "It holds :files file(s) and :directories folder(s).",
547
549
  "delete-folder-warning": "Everything inside goes too, and pictures already placed in content will stop opening.",
548
550
  confirm: "Delete",
@@ -581,374 +583,384 @@ const Te = /* @__PURE__ */ O({
581
583
  other: "other files"
582
584
  }
583
585
  }
584
- }, ze = /* @__PURE__ */ new WeakSet();
585
- function be() {
586
+ }, Ue = /* @__PURE__ */ new WeakSet();
587
+ function re() {
586
588
  try {
587
- const { i18n: t } = fe();
588
- ze.has(t) || (t.defaults("webx-media", ht), ze.add(t));
589
+ const { i18n: a } = se();
590
+ Ue.has(a) || (a.defaults("webx-media", xt), Ue.add(a));
589
591
  } catch {
590
592
  }
591
593
  }
592
- const bt = {
594
+ const kt = {
593
595
  key: 0,
594
596
  class: "wx-media__folders"
595
- }, wt = { class: "wx-media__files" }, xt = ["accept"], kt = { class: "wx-media__status" }, $t = { key: 0 }, _t = { class: "wx-media__drawer" }, De = /* @__PURE__ */ O({
597
+ }, $t = { class: "wx-media__files" }, _t = ["accept"], Ct = { class: "wx-media__status" }, Mt = { key: 0 }, Vt = { class: "wx-media__drawer" }, Se = /* @__PURE__ */ S({
596
598
  __name: "MediaManager",
597
- props: {
599
+ props: /* @__PURE__ */ q({
598
600
  picking: { type: Boolean, default: !1 },
599
601
  accept: { default: null },
600
602
  multiple: { type: Boolean, default: !1 },
601
- max: { default: null }
602
- },
603
- emits: ["pick", "selection"],
604
- setup(t, { emit: i }) {
605
- const o = t, l = i, c = fe(), s = he(c);
606
- be();
607
- const a = X("webx-media");
608
- function n() {
603
+ max: { default: null },
604
+ inPage: { type: Boolean, default: !1 }
605
+ }, {
606
+ type: { default: "all" },
607
+ typeModifiers: {}
608
+ }),
609
+ emits: /* @__PURE__ */ q(["pick", "selection"], ["update:type"]),
610
+ setup(a, { expose: i, emit: n }) {
611
+ const l = a, r = n, d = se(), v = we(d);
612
+ re();
613
+ const t = H("webx-media"), x = et();
614
+ function y() {
609
615
  return {
610
- title: a("editor.title"),
611
- saveLabel: a("editor.save"),
612
- cancelLabel: a("editor.cancel"),
613
- resetLabel: a("editor.reset"),
614
- rotateLeftLabel: a("editor.rotate-left"),
615
- rotateRightLabel: a("editor.rotate-right"),
616
- flipHorizontalLabel: a("editor.flip-horizontal"),
617
- flipVerticalLabel: a("editor.flip-vertical"),
618
- ratioLabel: a("editor.ratio"),
619
- cropLabel: a("editor.crop"),
620
- outputLabel: a("editor.output"),
621
- outputHint: a("editor.output-hint"),
622
- widthLabel: a("editor.width"),
623
- heightLabel: a("editor.height"),
624
- freeLabel: a("editor.free"),
625
- originalLabel: a("editor.original"),
626
- errorText: a("editor.error")
616
+ title: t("editor.title"),
617
+ saveLabel: t("editor.save"),
618
+ cancelLabel: t("editor.cancel"),
619
+ resetLabel: t("editor.reset"),
620
+ rotateLeftLabel: t("editor.rotate-left"),
621
+ rotateRightLabel: t("editor.rotate-right"),
622
+ flipHorizontalLabel: t("editor.flip-horizontal"),
623
+ flipVerticalLabel: t("editor.flip-vertical"),
624
+ ratioLabel: t("editor.ratio"),
625
+ cropLabel: t("editor.crop"),
626
+ outputLabel: t("editor.output"),
627
+ outputHint: t("editor.output-hint"),
628
+ widthLabel: t("editor.width"),
629
+ heightLabel: t("editor.height"),
630
+ freeLabel: t("editor.free"),
631
+ originalLabel: t("editor.original"),
632
+ errorText: t("editor.error")
627
633
  };
628
634
  }
629
- const k = de("root"), w = it(k), u = U(() => w.value > 0 && w.value < 640), r = L([]), g = L(null), f = L(null), d = L([]), $ = L(""), B = L(o.accept ?? "all");
630
- K(
631
- () => o.accept,
632
- (m) => {
633
- B.value = m ?? "all";
635
+ const s = oe("root"), u = st(s), k = z(() => u.value > 0 && u.value < 640), w = R([]), o = R(null), $ = R(null), F = R([]), K = R(""), X = A(a, "type");
636
+ l.accept && (X.value = l.accept), G(
637
+ () => l.accept,
638
+ (p) => {
639
+ X.value = p ?? "all";
634
640
  }
635
641
  );
636
- const Y = L("-created_at"), ee = L(!1), P = L(!1), ie = de("picker"), te = U(() => f.value?.data ?? []), G = U(() => c.can("media.manage")), ne = U(() => c.can("media.upload") || G.value), E = U(() => qe(g.value)), oe = U(() => o.picking && !o.multiple);
637
- K(d, (m) => {
638
- if (o.max !== null && o.max > 0 && m.length > o.max) {
639
- d.value = m.slice(0, o.max);
642
+ 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);
643
+ G(F, (p) => {
644
+ if (l.max !== null && l.max > 0 && p.length > l.max) {
645
+ F.value = p.slice(0, l.max);
640
646
  return;
641
647
  }
642
- l(
648
+ r(
643
649
  "selection",
644
- te.value.filter((p) => m.includes(p.id))
650
+ ie.value.filter((f) => p.includes(f.id))
645
651
  );
646
- }), Fe(A), K([g, B, Y], () => S(1)), K(
647
- $,
648
- He(() => S(1), 300)
649
- ), K(u, (m) => {
650
- m || (P.value = !1);
652
+ }), Fe(c), G([o, X, N], () => m(1)), G(
653
+ K,
654
+ Ke(() => m(1), 300)
655
+ ), G(k, (p) => {
656
+ p || (j.value = !1);
651
657
  });
652
- async function A() {
653
- r.value = await s.directories(), g.value ??= r.value[0]?.id ?? null, await S(1);
658
+ async function c() {
659
+ w.value = await v.directories(), o.value ??= w.value[0]?.id ?? null, await m(1);
654
660
  }
655
- async function S(m = f.value?.meta.current_page ?? 1) {
661
+ async function m(p = $.value?.meta.current_page ?? 1) {
656
662
  ee.value = !0;
657
663
  try {
658
- f.value = await s.files({
659
- directory_id: $.value ? null : g.value,
660
- q: $.value,
661
- type: B.value === "all" ? null : B.value,
662
- sort: Y.value,
663
- page: m
664
- }), d.value = [];
664
+ $.value = await v.files({
665
+ directory_id: K.value ? null : o.value,
666
+ q: K.value,
667
+ type: X.value === "all" ? null : X.value,
668
+ sort: N.value,
669
+ page: p
670
+ }), F.value = [];
665
671
  } finally {
666
672
  ee.value = !1;
667
673
  }
668
674
  }
669
- function y() {
670
- ie.value?.click();
675
+ function M() {
676
+ te.value?.click();
671
677
  }
672
- async function h(m) {
673
- const p = m.target, _ = Array.from(p.files ?? []);
674
- if (p.value = "", !(_.length === 0 || g.value === null))
678
+ async function C(p) {
679
+ const f = p.target, _ = Array.from(f.files ?? []);
680
+ if (f.value = "", !(_.length === 0 || o.value === null))
675
681
  try {
676
- const q = await s.upload(g.value, _), J = q.filter((Xe) => Xe.duplicate).length;
677
- q.length > J && Q.success(a("manager.uploaded", { count: q.length - J })), J > 0 && Q.info(a("manager.duplicate-added")), await Promise.all([A(), S(1)]);
678
- } catch (q) {
679
- Q.danger(_e(q) ?? a("errors.upload"));
682
+ const P = await v.upload(o.value, _), Y = P.filter((je) => je.duplicate).length;
683
+ P.length > Y && J.success(t("manager.uploaded", { count: P.length - Y })), Y > 0 && J.info(t("manager.duplicate-added")), await Promise.all([c(), m(1)]);
684
+ } catch (P) {
685
+ J.danger(x(P, t("errors.upload")));
680
686
  }
681
687
  }
682
- const V = ae(yt);
683
- async function C() {
684
- const m = await V({
685
- title: a("manager.new-folder"),
686
- confirmText: a("manager.new-folder")
688
+ const W = ae(wt);
689
+ async function $e() {
690
+ const p = await W({
691
+ title: t("manager.new-folder"),
692
+ confirmText: t("manager.new-folder")
687
693
  });
688
- m === void 0 || g.value === null || (await s.createDirectory(g.value, m), await A());
694
+ p === void 0 || o.value === null || (await v.createDirectory(o.value, p), await c());
689
695
  }
690
- async function F() {
691
- const m = E.value;
692
- if (!m || m.is_root)
696
+ async function _e() {
697
+ const p = E.value;
698
+ if (!p || p.is_root)
693
699
  return;
694
- const p = await V({
695
- title: a("manager.rename"),
696
- value: m.title,
697
- confirmText: a("manager.save")
700
+ const f = await W({
701
+ title: t("manager.rename"),
702
+ value: p.title,
703
+ confirmText: t("manager.save")
698
704
  });
699
- p !== void 0 && (await s.renameDirectory(m.id, p), await A());
705
+ f !== void 0 && (await v.renameDirectory(p.id, f), await c());
700
706
  }
701
- async function ke() {
702
- const m = E.value;
703
- if (!(!m || m.is_root)) {
707
+ async function Ce() {
708
+ const p = E.value;
709
+ if (!(!p || p.is_root || !await ue({
710
+ title: t("dialogs.delete-folder-title", { title: p.title }),
711
+ message: t("dialogs.delete-folder-text"),
712
+ confirmText: t("dialogs.confirm"),
713
+ cancelText: t("manager.cancel"),
714
+ tone: "danger"
715
+ }))) {
704
716
  try {
705
- await s.deleteDirectory(m.id);
706
- } catch (p) {
707
- const _ = Ie(p);
708
- if (!_)
709
- throw p;
710
- if (!await Me({
711
- title: a("dialogs.delete-folder-title", { title: m.title }),
712
- message: `${a("dialogs.delete-folder-contents", _)} ${a("dialogs.delete-folder-warning")}`,
713
- confirmText: a("dialogs.confirm"),
714
- cancelText: a("manager.cancel"),
717
+ await v.deleteDirectory(p.id);
718
+ } catch (_) {
719
+ const P = Xe(_);
720
+ if (!P) {
721
+ J.danger(x(_));
722
+ return;
723
+ }
724
+ if (!await ue({
725
+ title: t("dialogs.delete-folder-title", { title: p.title }),
726
+ message: `${t("dialogs.delete-folder-contents", P)} ${t("dialogs.delete-folder-warning")}`,
727
+ confirmText: t("dialogs.confirm"),
728
+ cancelText: t("manager.cancel"),
715
729
  tone: "danger"
716
730
  }))
717
731
  return;
718
- await s.deleteDirectory(m.id, !0);
732
+ await v.deleteDirectory(p.id, !0);
719
733
  }
720
- g.value = null, await A();
734
+ o.value = null, await c();
721
735
  }
722
736
  }
723
- async function $e(m, p) {
737
+ async function Me(p, f) {
724
738
  try {
725
- await s.moveDirectory(m, p);
739
+ await v.moveDirectory(p, f);
726
740
  } catch (_) {
727
- Q.danger(_e(_) ?? a("errors.directory-into-itself"));
741
+ J.danger(x(_, t("errors.directory-into-itself")));
728
742
  }
729
- await A();
743
+ await c();
730
744
  }
731
- const Be = ae(gt);
732
- async function Se() {
733
- const m = await Be({
734
- directories: r.value,
735
- from: g.value,
736
- count: d.value.length
745
+ const Ee = ae(bt);
746
+ async function Pe() {
747
+ const p = await Ee({
748
+ directories: w.value,
749
+ from: o.value,
750
+ count: F.value.length
737
751
  });
738
- m !== void 0 && (await s.move([...d.value], m), await Promise.all([A(), S()]));
752
+ p !== void 0 && (await v.move([...F.value], p), await Promise.all([c(), m()]));
739
753
  }
740
754
  async function Oe() {
741
- const m = [...d.value];
742
- await Me({
743
- title: a("dialogs.delete-files-title", { count: m.length }),
744
- message: a("dialogs.delete-files-text"),
745
- confirmText: a("dialogs.confirm"),
746
- cancelText: a("manager.cancel"),
755
+ const p = [...F.value];
756
+ await ue({
757
+ title: t("dialogs.delete-files-title", { count: p.length }),
758
+ message: t("dialogs.delete-files-text"),
759
+ confirmText: t("dialogs.confirm"),
760
+ cancelText: t("manager.cancel"),
747
761
  tone: "danger"
748
- }) && (await s.remove(m), await Promise.all([A(), S()]));
762
+ }) && (await v.remove(p), await Promise.all([c(), m()]));
749
763
  }
750
- async function Ee(m, p) {
751
- await s.rename(m.id, p), await S();
764
+ async function Ae(p, f) {
765
+ await v.rename(p.id, f), await m();
752
766
  }
753
- async function Pe(m) {
754
- await s.removeOne(m.id), await Promise.all([A(), S()]);
767
+ async function Ne(p) {
768
+ await v.removeOne(p.id), await Promise.all([c(), m()]);
755
769
  }
756
- async function Ae(m) {
757
- const p = await st({
758
- src: m.source ?? m.url,
759
- fileName: m.file_name,
770
+ async function qe(p) {
771
+ const f = await ut({
772
+ src: p.source ?? p.url,
773
+ fileName: p.file_name,
760
774
  filters: !1,
761
775
  // The editor is a component of the design system: its words are props with English
762
776
  // defaults, not lines in the panel's dictionary. Whoever opens it is the one who knows
763
777
  // what language the panel is being read in.
764
- ...n()
778
+ ...y()
765
779
  });
766
- p && (await s.edit(m.id, {
780
+ f && (await v.edit(p.id, {
767
781
  // The editor's frame is read against the picture as it is on screen — already turned — and
768
782
  // the server applies the operations in that order for the same reason.
769
- crop: p.crop,
770
- rotate: (p.rotation % 360 + 360) % 360,
771
- flip: p.flipX ? "horizontal" : p.flipY ? "vertical" : void 0,
772
- resize: { width: p.width, height: p.height }
773
- }), await S());
783
+ crop: f.crop,
784
+ rotate: (f.rotation % 360 + 360) % 360,
785
+ flip: f.flipX ? "horizontal" : f.flipY ? "vertical" : void 0,
786
+ resize: { width: f.width, height: f.height }
787
+ }), await m());
774
788
  }
775
- function Ne(m) {
776
- o.multiple || l("pick", m);
789
+ function Ie(p) {
790
+ l.multiple || r("pick", p);
777
791
  }
778
- function qe(m) {
779
- const p = (_) => {
780
- for (const q of _) {
781
- if (q.id === m)
782
- return q;
783
- const J = p(q.children ?? []);
784
- if (J)
785
- return J;
792
+ function He(p) {
793
+ const f = (_) => {
794
+ for (const P of _) {
795
+ if (P.id === p)
796
+ return P;
797
+ const Y = f(P.children ?? []);
798
+ if (Y)
799
+ return Y;
786
800
  }
787
801
  return null;
788
802
  };
789
- return m === null ? null : p(r.value);
790
- }
791
- function Ie(m) {
792
- const p = m?.body;
793
- return p?.code === "directory_not_empty" ? p.counts ?? null : null;
803
+ return p === null ? null : f(w.value);
794
804
  }
795
- function _e(m) {
796
- return m?.message ?? null;
805
+ function Xe(p) {
806
+ const f = p?.body;
807
+ return f?.code === "directory_not_empty" ? f.counts ?? null : null;
797
808
  }
798
- function He(m, p) {
809
+ i({ upload: M });
810
+ function Ke(p, f) {
799
811
  let _;
800
812
  return () => {
801
- clearTimeout(_), _ = setTimeout(m, p);
813
+ clearTimeout(_), _ = setTimeout(p, f);
802
814
  };
803
815
  }
804
- return (m, p) => (b(), W("div", {
816
+ return (p, f) => (h(), L("div", {
805
817
  ref_key: "root",
806
- ref: k,
807
- class: ue(["wx-media", { "wx-media--compact": u.value }])
818
+ ref: s,
819
+ class: pe(["wx-media", { "wx-media--compact": k.value }])
808
820
  }, [
809
- u.value ? R("", !0) : (b(), W("aside", bt, [
810
- v(Te, {
811
- selected: g.value,
812
- "onUpdate:selected": p[0] || (p[0] = (_) => g.value = _),
813
- directories: r.value,
814
- onMove: $e
821
+ k.value ? B("", !0) : (h(), L("aside", kt, [
822
+ g(ze, {
823
+ selected: o.value,
824
+ "onUpdate:selected": f[0] || (f[0] = (_) => o.value = _),
825
+ directories: w.value,
826
+ onMove: Me
815
827
  }, null, 8, ["selected", "directories"]),
816
- G.value ? (b(), T(e(le), {
828
+ Q.value ? (h(), T(e(le), {
817
829
  key: 0,
818
830
  size: "sm",
819
831
  align: "start"
820
832
  }, {
821
- default: x(() => [
822
- v(e(D), {
833
+ default: b(() => [
834
+ g(e(D), {
823
835
  type: "add",
824
- title: e(a)("manager.new-folder"),
825
- onClick: C
836
+ title: e(t)("manager.new-folder"),
837
+ onClick: $e
826
838
  }, null, 8, ["title"]),
827
- v(e(D), {
839
+ g(e(D), {
828
840
  type: "edit",
829
- title: e(a)("manager.rename"),
841
+ title: e(t)("manager.rename"),
830
842
  disabled: !E.value || E.value.is_root,
831
- onClick: F
843
+ onClick: _e
832
844
  }, null, 8, ["title", "disabled"]),
833
- v(e(D), {
845
+ g(e(D), {
834
846
  type: "remove",
835
- title: e(a)("manager.delete"),
847
+ title: e(t)("manager.delete"),
836
848
  disabled: !E.value || E.value.is_root,
837
- onClick: ke
849
+ onClick: Ce
838
850
  }, null, 8, ["title", "disabled"])
839
851
  ]),
840
852
  _: 1
841
- })) : R("", !0)
853
+ })) : B("", !0)
842
854
  ])),
843
- M("section", wt, [
844
- v(vt, {
845
- search: $.value,
846
- "onUpdate:search": p[1] || (p[1] = (_) => $.value = _),
847
- type: B.value,
848
- "onUpdate:type": p[2] || (p[2] = (_) => B.value = _),
849
- sort: Y.value,
850
- "onUpdate:sort": p[3] || (p[3] = (_) => Y.value = _),
851
- "can-upload": ne.value,
852
- "fixed-type": t.accept !== null,
853
- "can-manage": G.value,
854
- selected: d.value.length,
855
- compact: u.value,
856
- onUpload: y,
857
- onMove: Se,
855
+ V("section", $t, [
856
+ g(ht, {
857
+ search: K.value,
858
+ "onUpdate:search": f[1] || (f[1] = (_) => K.value = _),
859
+ type: X.value,
860
+ "onUpdate:type": f[2] || (f[2] = (_) => X.value = _),
861
+ sort: N.value,
862
+ "onUpdate:sort": f[3] || (f[3] = (_) => N.value = _),
863
+ "can-upload": de.value && !a.inPage,
864
+ "fixed-type": a.accept !== null || a.inPage,
865
+ "can-manage": Q.value,
866
+ selected: F.value.length,
867
+ compact: k.value,
868
+ onUpload: M,
869
+ onMove: Pe,
858
870
  onRemove: Oe,
859
- onFolders: p[4] || (p[4] = (_) => P.value = !0)
871
+ onFolders: f[4] || (f[4] = (_) => j.value = !0)
860
872
  }, null, 8, ["search", "type", "sort", "can-upload", "fixed-type", "can-manage", "selected", "compact"]),
861
- M("input", {
873
+ V("input", {
862
874
  ref_key: "picker",
863
- ref: ie,
875
+ ref: te,
864
876
  type: "file",
865
877
  multiple: "",
866
878
  hidden: "",
867
- accept: t.accept === null ? void 0 : `${t.accept}/*`,
868
- onChange: h
869
- }, null, 40, xt),
870
- v(pt, {
871
- selected: d.value,
872
- "onUpdate:selected": p[5] || (p[5] = (_) => d.value = _),
873
- files: te.value,
874
- api: e(s),
875
- query: $.value,
876
- single: oe.value,
877
- onRename: Ee,
878
- onEdit: Ae,
879
- onRemove: Pe,
880
- onOpen: Ne
879
+ accept: a.accept === null ? void 0 : `${a.accept}/*`,
880
+ onChange: C
881
+ }, null, 40, _t),
882
+ g(gt, {
883
+ selected: F.value,
884
+ "onUpdate:selected": f[5] || (f[5] = (_) => F.value = _),
885
+ files: ie.value,
886
+ api: e(v),
887
+ query: K.value,
888
+ single: ne.value,
889
+ onRename: Ae,
890
+ onEdit: qe,
891
+ onRemove: Ne,
892
+ onOpen: Ie
881
893
  }, null, 8, ["selected", "files", "api", "query", "single"]),
882
- M("footer", kt, [
883
- M("span", null, z(e(a)("manager.status-files", { count: f.value?.stats.files ?? 0 })), 1),
884
- d.value.length > 0 ? (b(), W("span", $t, z(e(a)("manager.status-selected", { count: d.value.length })), 1)) : R("", !0),
885
- M("span", null, z(e(a)("manager.status-size", { size: e(Re)(f.value?.stats.size ?? 0) })), 1)
894
+ V("footer", Ct, [
895
+ V("span", null, U(e(t)("manager.status-files", { count: $.value?.stats.files ?? 0 })), 1),
896
+ F.value.length > 0 ? (h(), L("span", Mt, U(e(t)("manager.status-selected", { count: F.value.length })), 1)) : B("", !0),
897
+ V("span", null, U(e(t)("manager.status-size", { size: e(De)($.value?.stats.size ?? 0) })), 1)
886
898
  ]),
887
- f.value && f.value.meta.last_page > 1 ? (b(), T(e(nt), {
899
+ $.value && $.value.meta.last_page > 1 ? (h(), T(e(rt), {
888
900
  key: 0,
889
- page: f.value.meta.current_page,
890
- "per-page": f.value.meta.per_page,
891
- total: f.value.meta.total,
892
- "last-page": f.value.meta.last_page,
901
+ page: $.value.meta.current_page,
902
+ "per-page": $.value.meta.per_page,
903
+ total: $.value.meta.total,
904
+ "last-page": $.value.meta.last_page,
893
905
  disabled: ee.value,
894
906
  size: "sm",
895
- onChange: p[6] || (p[6] = ({ page: _ }) => S(_))
896
- }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : R("", !0)
907
+ onChange: f[6] || (f[6] = ({ page: _ }) => m(_))
908
+ }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : B("", !0)
897
909
  ]),
898
- v(e(ot), {
899
- open: P.value,
900
- "onUpdate:open": p[9] || (p[9] = (_) => P.value = _),
910
+ g(e(dt), {
911
+ open: j.value,
912
+ "onUpdate:open": f[9] || (f[9] = (_) => j.value = _),
901
913
  side: "left",
902
- title: e(a)("manager.folders"),
914
+ title: e(t)("manager.folders"),
903
915
  size: 280
904
916
  }, {
905
- default: x(() => [
906
- M("div", _t, [
907
- v(Te, {
908
- selected: g.value,
917
+ default: b(() => [
918
+ V("div", Vt, [
919
+ g(ze, {
920
+ selected: o.value,
909
921
  "onUpdate:selected": [
910
- p[7] || (p[7] = (_) => g.value = _),
911
- p[8] || (p[8] = (_) => P.value = !1)
922
+ f[7] || (f[7] = (_) => o.value = _),
923
+ f[8] || (f[8] = (_) => j.value = !1)
912
924
  ],
913
- directories: r.value,
914
- onMove: $e
925
+ directories: w.value,
926
+ onMove: Me
915
927
  }, null, 8, ["selected", "directories"]),
916
- G.value ? (b(), T(e(le), {
928
+ Q.value ? (h(), T(e(le), {
917
929
  key: 0,
918
930
  size: "sm",
919
931
  align: "start"
920
932
  }, {
921
- default: x(() => [
922
- v(e(D), {
933
+ default: b(() => [
934
+ g(e(D), {
923
935
  type: "add",
924
- title: e(a)("manager.new-folder"),
925
- onClick: C
936
+ title: e(t)("manager.new-folder"),
937
+ onClick: $e
926
938
  }, null, 8, ["title"]),
927
- v(e(D), {
939
+ g(e(D), {
928
940
  type: "edit",
929
- title: e(a)("manager.rename"),
941
+ title: e(t)("manager.rename"),
930
942
  disabled: !E.value || E.value.is_root,
931
- onClick: F
943
+ onClick: _e
932
944
  }, null, 8, ["title", "disabled"]),
933
- v(e(D), {
945
+ g(e(D), {
934
946
  type: "remove",
935
- title: e(a)("manager.delete"),
947
+ title: e(t)("manager.delete"),
936
948
  disabled: !E.value || E.value.is_root,
937
- onClick: ke
949
+ onClick: Ce
938
950
  }, null, 8, ["title", "disabled"])
939
951
  ]),
940
952
  _: 1
941
- })) : R("", !0)
953
+ })) : B("", !0)
942
954
  ])
943
955
  ]),
944
956
  _: 1
945
957
  }, 8, ["open", "title"])
946
958
  ], 2));
947
959
  }
948
- }), Ct = { class: "wx-media-picker" }, Vt = {
960
+ }), Tt = { class: "wx-media-picker" }, zt = {
949
961
  key: 0,
950
962
  class: "wx-media-picker__count"
951
- }, we = /* @__PURE__ */ O({
963
+ }, xe = /* @__PURE__ */ S({
952
964
  __name: "MediaPicker",
953
965
  props: {
954
966
  accept: { default: "image" },
@@ -957,51 +969,51 @@ const bt = {
957
969
  multiple: { type: Boolean, default: !1 },
958
970
  max: { default: null }
959
971
  },
960
- setup(t) {
961
- const { open: i, resolve: o, dismiss: l } = ve(), c = X("webx-media"), s = L([]);
962
- return (a, n) => (b(), T(e(ge), {
972
+ setup(a) {
973
+ const { open: i, resolve: n, dismiss: l } = ye(), r = H("webx-media"), d = R([]);
974
+ return (v, t) => (h(), T(e(he), {
963
975
  open: e(i),
964
- "onUpdate:open": n[4] || (n[4] = (k) => me(i) ? i.value = k : null),
965
- title: t.title ?? e(c)("module.title"),
976
+ "onUpdate:open": t[4] || (t[4] = (x) => ve(i) ? i.value = x : null),
977
+ title: a.title ?? e(r)("module.title"),
966
978
  width: 960
967
- }, Je({
968
- default: x(() => [
969
- M("div", Ct, [
970
- v(De, {
971
- picking: !t.manage,
972
- accept: t.manage ? null : t.accept,
973
- multiple: t.multiple && !t.manage,
974
- max: t.max,
975
- onPick: n[0] || (n[0] = (k) => e(o)(k)),
976
- onSelection: n[1] || (n[1] = (k) => s.value = k)
979
+ }, We({
980
+ default: b(() => [
981
+ V("div", Tt, [
982
+ g(Se, {
983
+ picking: !a.manage,
984
+ accept: a.manage ? null : a.accept,
985
+ multiple: a.multiple && !a.manage,
986
+ max: a.max,
987
+ onPick: t[0] || (t[0] = (x) => e(n)(x)),
988
+ onSelection: t[1] || (t[1] = (x) => d.value = x)
977
989
  }, null, 8, ["picking", "accept", "multiple", "max"])
978
990
  ])
979
991
  ]),
980
992
  _: 2
981
993
  }, [
982
- t.multiple && !t.manage ? {
994
+ a.multiple && !a.manage ? {
983
995
  name: "footer",
984
- fn: x(() => [
985
- v(e(ye), { size: "sm" }, {
986
- default: x(() => [
987
- t.max !== null && t.max > 0 ? (b(), W("span", Vt, z(e(c)("manager.chosen", { count: s.value.length, max: t.max })), 1)) : R("", !0),
988
- v(e(H), {
996
+ fn: b(() => [
997
+ g(e(be), { size: "sm" }, {
998
+ default: b(() => [
999
+ a.max !== null && a.max > 0 ? (h(), L("span", zt, U(e(r)("manager.chosen", { count: d.value.length, max: a.max })), 1)) : B("", !0),
1000
+ g(e(I), {
989
1001
  variant: "outline",
990
- onClick: n[2] || (n[2] = (k) => e(l)())
1002
+ onClick: t[2] || (t[2] = (x) => e(l)())
991
1003
  }, {
992
- default: x(() => [
993
- N(z(e(c)("manager.cancel")), 1)
1004
+ default: b(() => [
1005
+ O(U(e(r)("manager.cancel")), 1)
994
1006
  ]),
995
1007
  _: 1
996
1008
  }),
997
- v(e(H), {
1009
+ g(e(I), {
998
1010
  class: "wx-media-picker__confirm",
999
1011
  type: "primary",
1000
- disabled: s.value.length === 0,
1001
- onClick: n[3] || (n[3] = (k) => e(o)(s.value))
1012
+ disabled: d.value.length === 0,
1013
+ onClick: t[3] || (t[3] = (x) => e(n)(d.value))
1002
1014
  }, {
1003
- default: x(() => [
1004
- N(z(e(c)("manager.pick", { count: s.value.length })), 1)
1015
+ default: b(() => [
1016
+ O(U(e(r)("manager.pick", { count: d.value.length })), 1)
1005
1017
  ]),
1006
1018
  _: 1
1007
1019
  }, 8, ["disabled"])
@@ -1013,26 +1025,26 @@ const bt = {
1013
1025
  } : void 0
1014
1026
  ]), 1032, ["open", "title"]));
1015
1027
  }
1016
- }), Mt = ae(we), Tt = ae(we, {
1028
+ }), Ut = ae(xe), Ft = ae(xe, {
1017
1029
  props: { multiple: !0 }
1018
- }), zt = ae(
1019
- we,
1030
+ }), Wt = ae(
1031
+ xe,
1020
1032
  { props: { manage: !0 } }
1021
- ), Ft = {
1033
+ ), Lt = {
1022
1034
  key: 0,
1023
1035
  class: "wx-media-list__label"
1024
- }, Ut = {
1036
+ }, Rt = {
1025
1037
  key: 0,
1026
1038
  class: "wx-media-list__missing"
1027
- }, Wt = { key: 1 }, Lt = {
1039
+ }, Bt = { key: 1 }, Dt = {
1028
1040
  key: 0,
1029
1041
  class: "wx-media-list__tools"
1030
- }, Rt = { class: "wx-media-list__captions" }, Dt = { class: "wx-media-list__caption" }, Bt = { class: "wx-media-list__caption" }, St = { class: "wx-media-list__captions-footer" }, Ot = { class: "wx-media-list__footer" }, Et = {
1042
+ }, St = { class: "wx-media-list__captions" }, Et = { class: "wx-media-list__caption" }, Pt = { class: "wx-media-list__caption" }, Ot = { class: "wx-media-list__captions-footer" }, At = { class: "wx-media-list__footer" }, Nt = {
1031
1043
  key: 0,
1032
1044
  class: "wx-media-list__hint"
1033
- }, xe = /* @__PURE__ */ O({
1045
+ }, ke = /* @__PURE__ */ S({
1034
1046
  __name: "MediaList",
1035
- props: /* @__PURE__ */ j({
1047
+ props: /* @__PURE__ */ q({
1036
1048
  label: { default: void 0 },
1037
1049
  layout: { default: "grid" },
1038
1050
  accept: { default: null },
@@ -1048,174 +1060,174 @@ const bt = {
1048
1060
  modelModifiers: {}
1049
1061
  }),
1050
1062
  emits: ["update:modelValue"],
1051
- setup(t) {
1052
- const i = t, o = I(t, "modelValue");
1053
- be();
1054
- const l = X("webx-media"), c = Qe(Ze, null), s = c ? he(c) : null, a = {
1063
+ setup(a) {
1064
+ const i = a, n = A(a, "modelValue");
1065
+ re();
1066
+ const l = H("webx-media"), r = Ze(tt, null), d = r ? we(r) : null, v = {
1055
1067
  "16/9": "16 / 9",
1056
1068
  "4/3": "4 / 3",
1057
1069
  "1/1": "1 / 1"
1058
- }, n = U({
1059
- get: () => Array.isArray(o.value) ? o.value : [],
1060
- set: (y) => {
1061
- o.value = y;
1070
+ }, t = z({
1071
+ get: () => Array.isArray(n.value) ? n.value : [],
1072
+ set: (c) => {
1073
+ n.value = c;
1062
1074
  }
1063
- }), k = U(() => i.single ? 1 : i.max ?? null), w = U(() => k.value !== null && n.value.length >= k.value), u = L({}), r = /* @__PURE__ */ new Set();
1064
- async function g(y) {
1065
- if (!s) return;
1066
- const h = y.filter((C) => !(C in u.value) && !r.has(C));
1067
- if (h.length === 0) return;
1068
- h.forEach((C) => r.add(C));
1069
- const V = await Promise.all(
1070
- h.map(async (C) => [C, await s.fileByPath(C)])
1075
+ }), x = z(() => i.single ? 1 : i.max ?? null), y = z(() => x.value !== null && t.value.length >= x.value), s = R({}), u = /* @__PURE__ */ new Set();
1076
+ async function k(c) {
1077
+ if (!d) return;
1078
+ const m = c.filter((C) => !(C in s.value) && !u.has(C));
1079
+ if (m.length === 0) return;
1080
+ m.forEach((C) => u.add(C));
1081
+ const M = await Promise.all(
1082
+ m.map(async (C) => [C, await d.fileByPath(C)])
1071
1083
  );
1072
- h.forEach((C) => r.delete(C)), u.value = { ...u.value, ...Object.fromEntries(V) };
1084
+ m.forEach((C) => u.delete(C)), s.value = { ...s.value, ...Object.fromEntries(M) };
1073
1085
  }
1074
- K(
1075
- () => n.value.map((y) => y.path),
1076
- (y) => {
1077
- g(y.filter(Boolean));
1086
+ G(
1087
+ () => t.value.map((c) => c.path),
1088
+ (c) => {
1089
+ k(c.filter(Boolean));
1078
1090
  },
1079
1091
  { immediate: !0 }
1080
1092
  );
1081
- function f(y) {
1082
- u.value = { ...u.value, ...Object.fromEntries(y.map((h) => [h.path, h])) };
1093
+ function w(c) {
1094
+ s.value = { ...s.value, ...Object.fromEntries(c.map((m) => [m.path, m])) };
1083
1095
  }
1084
- function d(y) {
1085
- return u.value[y.path];
1096
+ function o(c) {
1097
+ return s.value[c.path];
1086
1098
  }
1087
- function $(y) {
1088
- return d(y) === null;
1099
+ function $(c) {
1100
+ return o(c) === null;
1089
1101
  }
1090
- function B(y) {
1091
- return d(y)?.name ?? mt(y.path);
1102
+ function F(c) {
1103
+ return o(c)?.name ?? vt(c.path);
1092
1104
  }
1093
- function Y(y) {
1094
- const h = d(y);
1095
- return h && s ? s.thumb(h, 320, 320) ?? void 0 : void 0;
1105
+ function K(c) {
1106
+ const m = o(c);
1107
+ return m && d ? d.thumb(m, 320, 320) ?? void 0 : void 0;
1096
1108
  }
1097
- function ee(y) {
1098
- const h = d(y);
1099
- if (!h) return "";
1100
- const V = Re(h.size);
1101
- return h.width && h.height ? `${h.width}×${h.height} · ${V}` : V;
1109
+ function X(c) {
1110
+ const m = o(c);
1111
+ if (!m) return "";
1112
+ const M = De(m.size);
1113
+ return m.width && m.height ? `${m.width}×${m.height} · ${M}` : M;
1102
1114
  }
1103
- const P = L(null);
1104
- function ie(y, h) {
1105
- return n.value.findIndex((C) => C.path === y.path) === h ? y.path : `${y.path}#${h}`;
1115
+ const N = R(null);
1116
+ function ee(c, m) {
1117
+ return t.value.findIndex((C) => C.path === c.path) === m ? c.path : `${c.path}#${m}`;
1106
1118
  }
1107
- function te(y, h) {
1108
- return n.value[y]?.[h] ?? {};
1119
+ function j(c, m) {
1120
+ return t.value[c]?.[m] ?? {};
1109
1121
  }
1110
- function G(y, h, V) {
1111
- const C = n.value[y];
1122
+ function te(c, m, M) {
1123
+ const C = t.value[c];
1112
1124
  if (!C) return;
1113
- const F = [...n.value];
1114
- F[y] = { ...C, [h]: V }, n.value = F;
1125
+ const W = [...t.value];
1126
+ W[c] = { ...C, [m]: M }, t.value = W;
1115
1127
  }
1116
- async function ne() {
1128
+ async function ie() {
1117
1129
  if (i.disabled) return;
1118
- const y = k.value === null ? null : k.value - n.value.length, h = await Tt({ accept: i.accept, max: y });
1119
- if (!h || h.length === 0) return;
1120
- f(h);
1121
- const V = new Set(n.value.map((F) => F.path)), C = h.filter((F) => !V.has(F.path)).map((F) => ({ path: F.path }));
1122
- n.value = i.single ? C.slice(0, 1) : [...n.value, ...C];
1130
+ const c = x.value === null ? null : x.value - t.value.length, m = await Ft({ accept: i.accept, max: c });
1131
+ if (!m || m.length === 0) return;
1132
+ w(m);
1133
+ const M = new Set(t.value.map((W) => W.path)), C = m.filter((W) => !M.has(W.path)).map((W) => ({ path: W.path }));
1134
+ t.value = i.single ? C.slice(0, 1) : [...t.value, ...C];
1123
1135
  }
1124
- function E(y) {
1125
- n.value = n.value.filter((h, V) => V !== y), P.value = null;
1136
+ function Q(c) {
1137
+ t.value = t.value.filter((m, M) => M !== c), N.value = null;
1126
1138
  }
1127
- async function oe(y) {
1128
- await zt({});
1129
- const h = { ...u.value };
1130
- delete h[y.path], u.value = h, g([y.path]);
1139
+ async function de(c) {
1140
+ await Wt({});
1141
+ const m = { ...s.value };
1142
+ delete m[c.path], s.value = m, k([c.path]);
1131
1143
  }
1132
- const A = U(() => {
1133
- const y = i.columns ? `repeat(${i.columns}, minmax(0, 1fr))` : "repeat(auto-fill, minmax(140px, 1fr))";
1144
+ const E = z(() => {
1145
+ const c = i.columns ? `repeat(${i.columns}, minmax(0, 1fr))` : "repeat(auto-fill, minmax(140px, 1fr))";
1134
1146
  return i.aspect ? {
1135
- "--wx-media-list-columns": y,
1136
- "--wx-media-list-aspect": a[i.aspect] ?? i.aspect
1137
- } : { "--wx-media-list-columns": y };
1138
- }), S = U(() => {
1139
- const y = n.value.length;
1140
- return i.min && y < i.min ? l("field.at-least", { count: i.min }) : k.value === null ? "" : l("field.count", { count: y, max: k.value });
1147
+ "--wx-media-list-columns": c,
1148
+ "--wx-media-list-aspect": v[i.aspect] ?? i.aspect
1149
+ } : { "--wx-media-list-columns": c };
1150
+ }), ne = z(() => {
1151
+ const c = t.value.length;
1152
+ return i.min && c < i.min ? l("field.at-least", { count: i.min }) : x.value === null ? "" : l("field.count", { count: c, max: x.value });
1141
1153
  });
1142
- return (y, h) => (b(), W("div", {
1143
- class: ue(["wx-media-list", [`wx-media-list--${t.layout}`, { "is-disabled": t.disabled }]]),
1144
- style: ce(A.value)
1154
+ return (c, m) => (h(), L("div", {
1155
+ class: pe(["wx-media-list", [`wx-media-list--${a.layout}`, { "is-disabled": a.disabled }]]),
1156
+ style: fe(E.value)
1145
1157
  }, [
1146
- t.label ? (b(), W("span", Ft, z(t.label), 1)) : R("", !0),
1147
- v(e(rt), {
1148
- modelValue: n.value,
1149
- "onUpdate:modelValue": h[1] || (h[1] = (V) => n.value = V),
1158
+ a.label ? (h(), L("span", Lt, U(a.label), 1)) : B("", !0),
1159
+ g(e(ct), {
1160
+ modelValue: t.value,
1161
+ "onUpdate:modelValue": m[1] || (m[1] = (M) => t.value = M),
1150
1162
  plain: "",
1151
- disabled: t.disabled,
1152
- handle: t.layout === "grid" ? "row" : "grip",
1153
- "item-key": ie,
1154
- "item-label": B,
1163
+ disabled: a.disabled,
1164
+ handle: a.layout === "grid" ? "row" : "grip",
1165
+ "item-key": ee,
1166
+ "item-label": F,
1155
1167
  "drag-label": e(l)("field.reorder"),
1156
1168
  "empty-text": e(l)("field.empty")
1157
1169
  }, {
1158
- default: x(({ item: V, index: C }) => [
1159
- M("div", {
1160
- class: ue(["wx-media-list__cell", { "is-broken": $(V), "is-busy": P.value === C }])
1170
+ default: b(({ item: M, index: C }) => [
1171
+ V("div", {
1172
+ class: pe(["wx-media-list__cell", { "is-broken": $(M), "is-busy": N.value === C }])
1161
1173
  }, [
1162
- v(e(Ue), {
1163
- name: B(V),
1164
- thumbnail: Y(V),
1165
- type: d(V)?.mime,
1166
- size: t.layout === "rows" ? "sm" : "md"
1174
+ g(e(Le), {
1175
+ name: F(M),
1176
+ thumbnail: K(M),
1177
+ type: o(M)?.mime,
1178
+ size: a.layout === "rows" ? "sm" : "md"
1167
1179
  }, {
1168
- meta: x(() => [
1169
- $(V) ? (b(), W("span", Ut, z(e(l)("field.missing")), 1)) : (b(), W("span", Wt, z(ee(V)), 1))
1180
+ meta: b(() => [
1181
+ $(M) ? (h(), L("span", Rt, U(e(l)("field.missing")), 1)) : (h(), L("span", Bt, U(X(M)), 1))
1170
1182
  ]),
1171
1183
  _: 2
1172
1184
  }, 1032, ["name", "thumbnail", "type", "size"]),
1173
- t.disabled ? R("", !0) : (b(), W("div", Lt, [
1174
- v(e(le), { size: "sm" }, {
1175
- default: x(() => [
1176
- t.captions ? (b(), T(e(We), {
1185
+ a.disabled ? B("", !0) : (h(), L("div", Dt, [
1186
+ g(e(le), { size: "sm" }, {
1187
+ default: b(() => [
1188
+ a.captions ? (h(), T(e(Re), {
1177
1189
  key: 0,
1178
- open: P.value === C,
1190
+ open: N.value === C,
1179
1191
  title: e(l)("field.captions"),
1180
1192
  width: 360,
1181
1193
  side: "top",
1182
1194
  teleport: "",
1183
- "onUpdate:open": (F) => P.value = F ? C : null
1195
+ "onUpdate:open": (W) => N.value = W ? C : null
1184
1196
  }, {
1185
- trigger: x(() => [
1186
- v(e(D), {
1197
+ trigger: b(() => [
1198
+ g(e(D), {
1187
1199
  type: "edit",
1188
1200
  title: e(l)("field.captions")
1189
1201
  }, null, 8, ["title"])
1190
1202
  ]),
1191
- default: x(() => [
1192
- M("div", Rt, [
1193
- M("div", Dt, [
1194
- h[2] || (h[2] = M("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
1195
- v(e(Z), {
1203
+ default: b(() => [
1204
+ V("div", St, [
1205
+ V("div", Et, [
1206
+ m[2] || (m[2] = V("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
1207
+ g(e(Z), {
1196
1208
  localized: "",
1197
- "model-value": te(C, "alt"),
1209
+ "model-value": j(C, "alt"),
1198
1210
  placeholder: e(l)("field.alt-hint"),
1199
- "onUpdate:modelValue": (F) => G(C, "alt", F)
1211
+ "onUpdate:modelValue": (W) => te(C, "alt", W)
1200
1212
  }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1201
1213
  ]),
1202
- M("div", Bt, [
1203
- h[3] || (h[3] = M("span", { class: "wx-media-list__caption-label" }, "title", -1)),
1204
- v(e(Z), {
1214
+ V("div", Pt, [
1215
+ m[3] || (m[3] = V("span", { class: "wx-media-list__caption-label" }, "title", -1)),
1216
+ g(e(Z), {
1205
1217
  localized: "",
1206
- "model-value": te(C, "title"),
1218
+ "model-value": j(C, "title"),
1207
1219
  placeholder: e(l)("field.title-hint"),
1208
- "onUpdate:modelValue": (F) => G(C, "title", F)
1220
+ "onUpdate:modelValue": (W) => te(C, "title", W)
1209
1221
  }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1210
1222
  ]),
1211
- M("div", St, [
1212
- v(e(H), {
1223
+ V("div", Ot, [
1224
+ g(e(I), {
1213
1225
  size: "sm",
1214
1226
  type: "primary",
1215
- onClick: h[0] || (h[0] = (F) => P.value = null)
1227
+ onClick: m[0] || (m[0] = (W) => N.value = null)
1216
1228
  }, {
1217
- default: x(() => [
1218
- N(z(e(l)("manager.save")), 1)
1229
+ default: b(() => [
1230
+ O(U(e(l)("manager.save")), 1)
1219
1231
  ]),
1220
1232
  _: 1
1221
1233
  })
@@ -1223,24 +1235,24 @@ const bt = {
1223
1235
  ])
1224
1236
  ]),
1225
1237
  _: 2
1226
- }, 1032, ["open", "title", "onUpdate:open"])) : R("", !0),
1227
- $(V) ? R("", !0) : (b(), T(e(D), {
1238
+ }, 1032, ["open", "title", "onUpdate:open"])) : B("", !0),
1239
+ $(M) ? B("", !0) : (h(), T(e(D), {
1228
1240
  key: 1,
1229
1241
  type: "goto",
1230
1242
  title: e(l)("field.open"),
1231
- onClick: (F) => oe(V)
1243
+ onClick: (W) => de(M)
1232
1244
  }, null, 8, ["title", "onClick"])),
1233
- v(e(Le), {
1245
+ g(e(Be), {
1234
1246
  title: e(l)("field.remove-title"),
1235
1247
  description: e(l)("field.remove-text"),
1236
1248
  "confirm-text": e(l)("field.remove-confirm"),
1237
1249
  "cancel-text": e(l)("manager.cancel"),
1238
1250
  "confirm-type": "danger",
1239
1251
  side: "top",
1240
- onConfirm: (F) => E(C)
1252
+ onConfirm: (W) => Q(C)
1241
1253
  }, {
1242
- trigger: x(() => [
1243
- v(e(D), {
1254
+ trigger: b(() => [
1255
+ g(e(D), {
1244
1256
  type: "remove",
1245
1257
  title: e(l)("field.remove-confirm")
1246
1258
  }, null, 8, ["title"])
@@ -1255,23 +1267,23 @@ const bt = {
1255
1267
  ]),
1256
1268
  _: 1
1257
1269
  }, 8, ["modelValue", "disabled", "handle", "drag-label", "empty-text"]),
1258
- M("div", Ot, [
1259
- v(e(H), {
1270
+ V("div", At, [
1271
+ g(e(I), {
1260
1272
  size: "sm",
1261
1273
  variant: "outline",
1262
- disabled: t.disabled || w.value,
1263
- onClick: ne
1274
+ disabled: a.disabled || y.value,
1275
+ onClick: ie
1264
1276
  }, {
1265
- default: x(() => [
1266
- N(z(e(l)("field.add")), 1)
1277
+ default: b(() => [
1278
+ O(U(e(l)("field.add")), 1)
1267
1279
  ]),
1268
1280
  _: 1
1269
1281
  }, 8, ["disabled"]),
1270
- S.value ? (b(), W("span", Et, z(S.value), 1)) : R("", !0)
1282
+ ne.value ? (h(), L("span", Nt, U(ne.value), 1)) : B("", !0)
1271
1283
  ])
1272
1284
  ], 6));
1273
1285
  }
1274
- }), Pt = /* @__PURE__ */ O({
1286
+ }), qt = /* @__PURE__ */ S({
1275
1287
  name: "WxFileField",
1276
1288
  inheritAttrs: !1,
1277
1289
  __name: "FileField",
@@ -1280,21 +1292,21 @@ const bt = {
1280
1292
  modelModifiers: {}
1281
1293
  },
1282
1294
  emits: ["update:modelValue"],
1283
- setup(t) {
1284
- const i = I(t, "modelValue"), o = U({
1295
+ setup(a) {
1296
+ const i = A(a, "modelValue"), n = z({
1285
1297
  get: () => i.value ? [i.value] : [],
1286
1298
  set: (l) => {
1287
1299
  i.value = l[0] ?? null;
1288
1300
  }
1289
1301
  });
1290
- return (l, c) => (b(), T(xe, pe(l.$attrs, {
1291
- modelValue: o.value,
1292
- "onUpdate:modelValue": c[0] || (c[0] = (s) => o.value = s),
1302
+ return (l, r) => (h(), T(ke, ge(l.$attrs, {
1303
+ modelValue: n.value,
1304
+ "onUpdate:modelValue": r[0] || (r[0] = (d) => n.value = d),
1293
1305
  layout: "rows",
1294
1306
  single: ""
1295
1307
  }), null, 16, ["modelValue"]));
1296
1308
  }
1297
- }), At = /* @__PURE__ */ O({
1309
+ }), It = /* @__PURE__ */ S({
1298
1310
  name: "WxFilesField",
1299
1311
  inheritAttrs: !1,
1300
1312
  __name: "FilesField",
@@ -1303,15 +1315,15 @@ const bt = {
1303
1315
  modelModifiers: {}
1304
1316
  },
1305
1317
  emits: ["update:modelValue"],
1306
- setup(t) {
1307
- const i = I(t, "modelValue");
1308
- return (o, l) => (b(), T(xe, pe(o.$attrs, {
1318
+ setup(a) {
1319
+ const i = A(a, "modelValue");
1320
+ return (n, l) => (h(), T(ke, ge(n.$attrs, {
1309
1321
  modelValue: i.value,
1310
- "onUpdate:modelValue": l[0] || (l[0] = (c) => i.value = c),
1322
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1311
1323
  layout: "rows"
1312
1324
  }), null, 16, ["modelValue"]));
1313
1325
  }
1314
- }), Nt = /* @__PURE__ */ O({
1326
+ }), Ht = /* @__PURE__ */ S({
1315
1327
  name: "WxGalleryField",
1316
1328
  inheritAttrs: !1,
1317
1329
  __name: "GalleryField",
@@ -1320,27 +1332,27 @@ const bt = {
1320
1332
  modelModifiers: {}
1321
1333
  },
1322
1334
  emits: ["update:modelValue"],
1323
- setup(t) {
1324
- const i = I(t, "modelValue");
1325
- return (o, l) => (b(), T(xe, pe(o.$attrs, {
1335
+ setup(a) {
1336
+ const i = A(a, "modelValue");
1337
+ return (n, l) => (h(), T(ke, ge(n.$attrs, {
1326
1338
  modelValue: i.value,
1327
- "onUpdate:modelValue": l[0] || (l[0] = (c) => i.value = c),
1339
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1328
1340
  layout: "grid",
1329
1341
  accept: "image"
1330
1342
  }), null, 16, ["modelValue"]));
1331
1343
  }
1332
- }), qt = { class: "wx-media-field" }, It = {
1344
+ }), Xt = { class: "wx-media-field" }, Kt = {
1333
1345
  key: 0,
1334
1346
  class: "wx-media-field__label"
1335
- }, Ht = ["disabled"], Xt = ["disabled", "title"], Kt = {
1347
+ }, jt = ["disabled"], Gt = ["disabled", "title"], Yt = {
1336
1348
  key: 1,
1337
1349
  class: "wx-media-field__missing"
1338
- }, jt = {
1350
+ }, Jt = {
1339
1351
  key: 0,
1340
1352
  class: "wx-media-field__bar"
1341
- }, Gt = { class: "wx-media-field__captions" }, Yt = { class: "wx-media-field__caption" }, Jt = { class: "wx-media-field__caption" }, Qt = { class: "wx-media-field__captions-footer" }, Zt = /* @__PURE__ */ O({
1353
+ }, Qt = { class: "wx-media-field__captions" }, Zt = { class: "wx-media-field__caption" }, el = { class: "wx-media-field__caption" }, tl = { class: "wx-media-field__captions-footer" }, ll = /* @__PURE__ */ S({
1342
1354
  __name: "MediaField",
1343
- props: /* @__PURE__ */ j({
1355
+ props: /* @__PURE__ */ q({
1344
1356
  label: { default: void 0 },
1345
1357
  accept: { default: "image" },
1346
1358
  captions: { type: Boolean, default: !0 },
@@ -1352,119 +1364,119 @@ const bt = {
1352
1364
  modelModifiers: {}
1353
1365
  }),
1354
1366
  emits: ["update:modelValue"],
1355
- setup(t) {
1356
- const i = t, o = I(t, "modelValue");
1357
- be();
1358
- const l = X("webx-media"), c = he(fe()), s = {
1367
+ setup(a) {
1368
+ const i = a, n = A(a, "modelValue");
1369
+ re();
1370
+ const l = H("webx-media"), r = we(se()), d = {
1359
1371
  "16/9": "16 / 9",
1360
1372
  "4/3": "4 / 3",
1361
1373
  "1/1": "1 / 1"
1362
- }, a = L(!1), n = L({});
1363
- K(
1364
- () => o.value?.path,
1365
- async (d) => {
1366
- if (!d || o.value?.url || n.value[d]) return;
1367
- const $ = await c.fileByPath(d);
1368
- $ && (n.value = { ...n.value, [d]: $.url });
1374
+ }, v = R(!1), t = R({});
1375
+ G(
1376
+ () => n.value?.path,
1377
+ async (o) => {
1378
+ if (!o || n.value?.url || t.value[o]) return;
1379
+ const $ = await r.fileByPath(o);
1380
+ $ && (t.value = { ...t.value, [o]: $.url });
1369
1381
  },
1370
1382
  { immediate: !0 }
1371
1383
  );
1372
- const k = U(() => {
1373
- const d = o.value;
1374
- return d ? d.url ?? n.value[d.path] ?? null : null;
1375
- }), w = U(
1376
- () => i.aspect ? { aspectRatio: s[i.aspect] ?? i.aspect } : { height: typeof i.height == "number" ? `${i.height}px` : i.height }
1384
+ const x = z(() => {
1385
+ const o = n.value;
1386
+ return o ? o.url ?? t.value[o.path] ?? null : null;
1387
+ }), y = z(
1388
+ () => i.aspect ? { aspectRatio: d[i.aspect] ?? i.aspect } : { height: typeof i.height == "number" ? `${i.height}px` : i.height }
1377
1389
  );
1378
- function u(d) {
1379
- return o.value?.[d] ?? {};
1390
+ function s(o) {
1391
+ return n.value?.[o] ?? {};
1380
1392
  }
1381
- function r(d, $) {
1382
- o.value && (o.value = { ...o.value, [d]: $ });
1393
+ function u(o, $) {
1394
+ n.value && (n.value = { ...n.value, [o]: $ });
1383
1395
  }
1384
- async function g() {
1396
+ async function k() {
1385
1397
  if (i.disabled) return;
1386
- const d = await Mt({ accept: i.accept });
1387
- d && (o.value = { ...o.value, path: d.path, url: d.url });
1398
+ const o = await Ut({ accept: i.accept });
1399
+ o && (n.value = { ...n.value, path: o.path, url: o.url });
1388
1400
  }
1389
- function f() {
1390
- o.value = null, a.value = !1;
1401
+ function w() {
1402
+ n.value = null, v.value = !1;
1391
1403
  }
1392
- return (d, $) => (b(), W("div", qt, [
1393
- t.label ? (b(), W("span", It, z(t.label), 1)) : R("", !0),
1394
- o.value ? (b(), W("div", {
1404
+ return (o, $) => (h(), L("div", Xt, [
1405
+ a.label ? (h(), L("span", Kt, U(a.label), 1)) : B("", !0),
1406
+ n.value ? (h(), L("div", {
1395
1407
  key: 2,
1396
1408
  class: "wx-media-field__frame",
1397
- style: ce(w.value)
1409
+ style: fe(y.value)
1398
1410
  }, [
1399
- M("button", {
1411
+ V("button", {
1400
1412
  type: "button",
1401
1413
  class: "wx-media-field__picture",
1402
- disabled: t.disabled,
1414
+ disabled: a.disabled,
1403
1415
  title: e(l)("field.replace"),
1404
- onClick: g
1416
+ onClick: k
1405
1417
  }, [
1406
- k.value ? (b(), T(e(dt), {
1418
+ x.value ? (h(), T(e(mt), {
1407
1419
  key: 0,
1408
- src: k.value,
1420
+ src: x.value,
1409
1421
  fit: "contain",
1410
1422
  width: "100%",
1411
1423
  height: "100%"
1412
- }, null, 8, ["src"])) : (b(), W("span", Kt, z(e(l)("field.no-preview")), 1))
1413
- ], 8, Xt),
1414
- t.disabled ? R("", !0) : (b(), W("div", jt, [
1415
- v(e(le), { size: "sm" }, {
1416
- default: x(() => [
1417
- t.captions ? (b(), T(e(We), {
1424
+ }, null, 8, ["src"])) : (h(), L("span", Yt, U(e(l)("field.no-preview")), 1))
1425
+ ], 8, Gt),
1426
+ a.disabled ? B("", !0) : (h(), L("div", Jt, [
1427
+ g(e(le), { size: "sm" }, {
1428
+ default: b(() => [
1429
+ a.captions ? (h(), T(e(Re), {
1418
1430
  key: 0,
1419
- open: a.value,
1420
- "onUpdate:open": $[3] || ($[3] = (B) => a.value = B),
1431
+ open: v.value,
1432
+ "onUpdate:open": $[3] || ($[3] = (F) => v.value = F),
1421
1433
  title: e(l)("field.captions"),
1422
1434
  width: 360,
1423
1435
  side: "top",
1424
1436
  teleport: ""
1425
1437
  }, {
1426
- trigger: x(() => [
1427
- v(e(D), {
1438
+ trigger: b(() => [
1439
+ g(e(D), {
1428
1440
  type: "edit",
1429
1441
  title: e(l)("field.edit")
1430
1442
  }, null, 8, ["title"])
1431
1443
  ]),
1432
- default: x(() => [
1433
- M("div", Gt, [
1434
- M("div", Yt, [
1435
- $[4] || ($[4] = M("label", {
1444
+ default: b(() => [
1445
+ V("div", Qt, [
1446
+ V("div", Zt, [
1447
+ $[4] || ($[4] = V("label", {
1436
1448
  class: "wx-media-field__caption-label",
1437
1449
  for: "wx-media-alt"
1438
1450
  }, "alt", -1)),
1439
- v(e(Z), {
1451
+ g(e(Z), {
1440
1452
  id: "wx-media-alt",
1441
1453
  localized: "",
1442
- "model-value": u("alt"),
1454
+ "model-value": s("alt"),
1443
1455
  placeholder: e(l)("field.alt-hint"),
1444
- "onUpdate:modelValue": $[0] || ($[0] = (B) => r("alt", B))
1456
+ "onUpdate:modelValue": $[0] || ($[0] = (F) => u("alt", F))
1445
1457
  }, null, 8, ["model-value", "placeholder"])
1446
1458
  ]),
1447
- M("div", Jt, [
1448
- $[5] || ($[5] = M("label", {
1459
+ V("div", el, [
1460
+ $[5] || ($[5] = V("label", {
1449
1461
  class: "wx-media-field__caption-label",
1450
1462
  for: "wx-media-title"
1451
1463
  }, "title", -1)),
1452
- v(e(Z), {
1464
+ g(e(Z), {
1453
1465
  id: "wx-media-title",
1454
1466
  localized: "",
1455
- "model-value": u("title"),
1467
+ "model-value": s("title"),
1456
1468
  placeholder: e(l)("field.title-hint"),
1457
- "onUpdate:modelValue": $[1] || ($[1] = (B) => r("title", B))
1469
+ "onUpdate:modelValue": $[1] || ($[1] = (F) => u("title", F))
1458
1470
  }, null, 8, ["model-value", "placeholder"])
1459
1471
  ]),
1460
- M("div", Qt, [
1461
- v(e(H), {
1472
+ V("div", tl, [
1473
+ g(e(I), {
1462
1474
  size: "sm",
1463
1475
  type: "primary",
1464
- onClick: $[2] || ($[2] = (B) => a.value = !1)
1476
+ onClick: $[2] || ($[2] = (F) => v.value = !1)
1465
1477
  }, {
1466
- default: x(() => [
1467
- N(z(e(l)("manager.save")), 1)
1478
+ default: b(() => [
1479
+ O(U(e(l)("manager.save")), 1)
1468
1480
  ]),
1469
1481
  _: 1
1470
1482
  })
@@ -1472,18 +1484,18 @@ const bt = {
1472
1484
  ])
1473
1485
  ]),
1474
1486
  _: 1
1475
- }, 8, ["open", "title"])) : R("", !0),
1476
- v(e(Le), {
1487
+ }, 8, ["open", "title"])) : B("", !0),
1488
+ g(e(Be), {
1477
1489
  title: e(l)("field.clear-title"),
1478
1490
  description: e(l)("field.clear-text"),
1479
1491
  "confirm-text": e(l)("field.clear-confirm"),
1480
1492
  "cancel-text": e(l)("manager.cancel"),
1481
1493
  "confirm-type": "danger",
1482
1494
  side: "top",
1483
- onConfirm: f
1495
+ onConfirm: w
1484
1496
  }, {
1485
- trigger: x(() => [
1486
- v(e(D), {
1497
+ trigger: b(() => [
1498
+ g(e(D), {
1487
1499
  type: "remove",
1488
1500
  title: e(l)("field.clear-confirm")
1489
1501
  }, null, 8, ["title"])
@@ -1494,36 +1506,81 @@ const bt = {
1494
1506
  _: 1
1495
1507
  })
1496
1508
  ]))
1497
- ], 4)) : (b(), W("div", {
1509
+ ], 4)) : (h(), L("div", {
1498
1510
  key: 1,
1499
1511
  class: "wx-media-field__frame is-empty",
1500
- style: ce(w.value)
1512
+ style: fe(y.value)
1501
1513
  }, [
1502
- M("button", {
1514
+ V("button", {
1503
1515
  type: "button",
1504
1516
  class: "wx-media-field__pick",
1505
- disabled: t.disabled,
1506
- onClick: g
1507
- }, z(e(l)("field.select")), 9, Ht)
1517
+ disabled: a.disabled,
1518
+ onClick: k
1519
+ }, U(e(l)("field.select")), 9, jt)
1508
1520
  ], 4))
1509
1521
  ]));
1510
1522
  }
1511
- }), el = /* @__PURE__ */ O({
1523
+ }), al = /* @__PURE__ */ S({
1512
1524
  __name: "MediaPage",
1513
- setup(t) {
1514
- return (i, o) => (b(), T(e(ut), {
1515
- class: "wx-media-page",
1516
- padding: "md"
1517
- }, {
1518
- default: x(() => [
1519
- v(De)
1525
+ setup(a) {
1526
+ const i = se();
1527
+ re();
1528
+ 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(
1529
+ () => i.state.manifest?.modules.find((y) => y.id === "media")?.title ?? n("module.title")
1530
+ ), x = z(() => [
1531
+ { value: "all", label: n("manager.all-types") },
1532
+ ...["image", "video", "audio", "document", "other"].map((y) => ({
1533
+ value: y,
1534
+ label: n(`manager.${y}`)
1535
+ }))
1536
+ ]);
1537
+ return (y, s) => (h(), T(e(lt), {
1538
+ view: r.value,
1539
+ "onUpdate:view": s[1] || (s[1] = (u) => r.value = u),
1540
+ title: t.value,
1541
+ views: x.value,
1542
+ card: !1,
1543
+ fill: ""
1544
+ }, We({
1545
+ default: b(() => [
1546
+ g(e(pt), {
1547
+ class: "wx-media-page",
1548
+ padding: "md"
1549
+ }, {
1550
+ default: b(() => [
1551
+ g(Se, {
1552
+ ref_key: "manager",
1553
+ ref: l,
1554
+ type: d.value,
1555
+ "in-page": ""
1556
+ }, null, 8, ["type"])
1557
+ ]),
1558
+ _: 1
1559
+ })
1520
1560
  ]),
1521
- _: 1
1522
- }));
1561
+ _: 2
1562
+ }, [
1563
+ v.value ? {
1564
+ name: "actions",
1565
+ fn: b(() => [
1566
+ g(e(I), {
1567
+ type: "primary",
1568
+ icon: "upload",
1569
+ onClick: s[0] || (s[0] = (u) => l.value?.upload())
1570
+ }, {
1571
+ default: b(() => [
1572
+ O(U(e(n)("manager.upload")), 1)
1573
+ ]),
1574
+ _: 1
1575
+ })
1576
+ ]),
1577
+ key: "0"
1578
+ } : void 0
1579
+ ]), 1032, ["view", "title", "views"]));
1523
1580
  }
1524
1581
  });
1525
- function il(t = {}) {
1526
- const i = t.path ?? "/media";
1582
+ function sl(a = {}) {
1583
+ const i = a.path ?? "/media";
1527
1584
  return {
1528
1585
  id: "media",
1529
1586
  path: i,
@@ -1531,7 +1588,7 @@ function il(t = {}) {
1531
1588
  {
1532
1589
  path: i,
1533
1590
  name: "webx.media",
1534
- component: el
1591
+ component: al
1535
1592
  }
1536
1593
  ],
1537
1594
  // What a screen means by these four: the fields over the library. The server registers the
@@ -1539,26 +1596,26 @@ function il(t = {}) {
1539
1596
  // limit — the names are what an author picks from a list, and nobody picks "media with
1540
1597
  // `multiple: true` and `accept: document`".
1541
1598
  types: {
1542
- "wx-media": { component: Zt, kind: "field" },
1543
- "wx-gallery": { component: Nt, kind: "field" },
1544
- "wx-file": { component: Pt, kind: "field" },
1545
- "wx-files": { component: At, kind: "field" }
1599
+ "wx-media": { component: ll, kind: "field" },
1600
+ "wx-gallery": { component: Ht, kind: "field" },
1601
+ "wx-file": { component: qt, kind: "field" },
1602
+ "wx-files": { component: It, kind: "field" }
1546
1603
  }
1547
1604
  };
1548
1605
  }
1549
1606
  export {
1550
- Pt as WxFileField,
1551
- At as WxFilesField,
1552
- Nt as WxGalleryField,
1553
- Zt as WxMediaField,
1554
- De as WxMediaManager,
1555
- el as WxMediaPage,
1556
- we as WxMediaPicker,
1557
- he as createMediaApi,
1558
- il as media,
1559
- ht as mediaMessages,
1560
- Tt as openMediaFiles,
1561
- zt as openMediaLibrary,
1562
- Mt as openMediaPicker
1607
+ qt as WxFileField,
1608
+ It as WxFilesField,
1609
+ Ht as WxGalleryField,
1610
+ ll as WxMediaField,
1611
+ Se as WxMediaManager,
1612
+ al as WxMediaPage,
1613
+ xe as WxMediaPicker,
1614
+ we as createMediaApi,
1615
+ sl as media,
1616
+ xt as mediaMessages,
1617
+ Ft as openMediaFiles,
1618
+ Wt as openMediaLibrary,
1619
+ Ut as openMediaPicker
1563
1620
  };
1564
1621
  //# sourceMappingURL=index.js.map