@templatical/media-library 0.0.2 → 0.0.4

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.
@@ -1,10 +1,10 @@
1
1
  import { API_ROUTES as e, ApiClient as t, buildUrl as n, createSdkAuthManager as r } from "@templatical/core/cloud";
2
2
  import { Fragment as i, Teleport as a, Transition as o, computed as s, createApp as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, h as g, inject as _, isRef as v, normalizeClass as y, normalizeStyle as b, onMounted as x, openBlock as S, provide as C, ref as w, renderList as T, resolveComponent as E, toDisplayString as D, unref as O, vModelText as k, watch as A, withCtx as j, withDirectives as M, withKeys as N, withModifiers as P } from "vue";
3
- import { Check as F, ChevronRight as I, Copy as L, File as R, Folder as z, Grid2x2 as B, Link as ee, List as V, LoaderCircle as H, PanelLeft as U, Pencil as W, Plus as G, RefreshCw as K, Search as q, Star as J, Trash2 as Y, Upload as X, X as te } from "@lucide/vue";
3
+ import { Check as F, ChevronRight as I, Copy as L, File as R, Folder as z, Grid2x2 as B, Link as V, List as H, LoaderCircle as U, PanelLeft as W, Pencil as G, Plus as K, RefreshCw as q, Search as J, Star as ee, Trash2 as Y, Upload as X, X as te } from "@lucide/vue";
4
4
  import { Cropper as ne } from "vue-advanced-cropper";
5
- import { onClickOutside as re, useClipboard as ie, useDebounceFn as ae, useDropZone as oe, useEventListener as se, useFileDialog as Z, useIntersectionObserver as ce } from "@vueuse/core";
5
+ import { onClickOutside as re, useClipboard as ie, useDebounceFn as ae, useDropZone as oe, useEventListener as se, useFileDialog as ce, useIntersectionObserver as le } from "@vueuse/core";
6
6
  //#region src/api-client.ts
7
- var le = class {
7
+ var ue = class {
8
8
  constructor(e) {
9
9
  this.authManager = e;
10
10
  }
@@ -160,9 +160,9 @@ var le = class {
160
160
  };
161
161
  //#endregion
162
162
  //#region src/composable.ts
163
- function ue(e) {
163
+ function de(e) {
164
164
  if (!e.projectId) throw Error("projectId is required for useMediaLibrary");
165
- let t = new le(e.authManager), n = w([]), r = w([]), i = w(null), a = w("files"), o = w(""), s = w(null), c = w("newest"), l = w(!1), u = w(!1), d = w(!1), f = w(null), p = w(null), m = w(/* @__PURE__ */ new Set()), h = w(null), g = w([]), _ = w({}), v = w(!1), y = w([]), b = w(!1), x = w(null), S = w(!1), C = w(null), T = w(!1), E = w(null), D = w(null);
165
+ let t = new ue(e.authManager), n = w([]), r = w([]), i = w(null), a = w("files"), o = w(""), s = w(null), c = w("newest"), l = w(!1), u = w(!1), d = w(!1), f = w(null), p = w(null), m = w(/* @__PURE__ */ new Set()), h = w(null), g = w([]), _ = w({}), v = w(!1), y = w([]), b = w(!1), x = w(null), S = w(!1), C = w(null), T = w(!1), E = w(null), D = w(null);
166
166
  async function O() {
167
167
  l.value = !0;
168
168
  try {
@@ -279,7 +279,7 @@ function ue(e) {
279
279
  e.onError?.(t);
280
280
  }
281
281
  }
282
- async function ee() {
282
+ async function V() {
283
283
  if (m.value.size === 0) return !1;
284
284
  y.value = [...m.value];
285
285
  try {
@@ -291,17 +291,17 @@ function ue(e) {
291
291
  return e.onError?.(t), !1;
292
292
  }
293
293
  }
294
- async function V() {
294
+ async function H() {
295
295
  if (v.value = !1, y.value.length !== 0) try {
296
296
  await t.deleteMedia(y.value), n.value = n.value.filter((e) => !y.value.includes(e.id)), g.value = g.value.filter((e) => !y.value.includes(e.id)), m.value = /* @__PURE__ */ new Set(), h.value = null, y.value = [], _.value = {};
297
297
  } catch (t) {
298
298
  e.onError?.(t);
299
299
  }
300
300
  }
301
- function H() {
301
+ function U() {
302
302
  v.value = !1, y.value = [], _.value = {};
303
303
  }
304
- async function U(r) {
304
+ async function W(r) {
305
305
  b.value = !0, x.value = null;
306
306
  try {
307
307
  let e = await t.importFromUrl(r, i.value);
@@ -312,27 +312,27 @@ function ue(e) {
312
312
  b.value = !1;
313
313
  }
314
314
  }
315
- function W(e) {
315
+ function G(e) {
316
316
  let t = new Set(m.value);
317
317
  t.has(e) ? t.delete(e) : t.add(e), m.value = t;
318
318
  }
319
- function G() {
319
+ function K() {
320
320
  m.value = /* @__PURE__ */ new Set(), h.value = null;
321
321
  }
322
- function K(e) {
322
+ function q(e) {
323
323
  h.value = e, m.value = new Set([e.id]);
324
324
  }
325
- async function q() {
325
+ async function J() {
326
326
  try {
327
327
  r.value = await t.getMediaFolders();
328
328
  } catch (t) {
329
329
  e.onError?.(t);
330
330
  }
331
331
  }
332
- async function J(n, r) {
332
+ async function ee(n, r) {
333
333
  try {
334
334
  let e = await t.createMediaFolder(n, r);
335
- return await q(), e;
335
+ return await J(), e;
336
336
  } catch (t) {
337
337
  return e.onError?.(t), null;
338
338
  }
@@ -349,7 +349,7 @@ function ue(e) {
349
349
  }
350
350
  async function X(n, r) {
351
351
  try {
352
- await t.renameMediaFolder(n, r), await q();
352
+ await t.renameMediaFolder(n, r), await J();
353
353
  } catch (t) {
354
354
  e.onError?.(t);
355
355
  }
@@ -357,7 +357,7 @@ function ue(e) {
357
357
  async function te(n) {
358
358
  try {
359
359
  let e = Y(r.value, n)?.parent_id ?? null;
360
- await t.deleteMediaFolder(n), i.value === n && (i.value = e), await q(), await O();
360
+ await t.deleteMediaFolder(n), i.value === n && (i.value = e), await J(), await O();
361
361
  } catch (t) {
362
362
  e.onError?.(t);
363
363
  }
@@ -424,19 +424,19 @@ function ue(e) {
424
424
  deleteSelected: z,
425
425
  isImportingFromUrl: b,
426
426
  importFromUrlError: x,
427
- importFromUrl: U,
428
- toggleSelection: W,
429
- clearSelection: G,
430
- selectItem: K,
431
- loadFolders: q,
432
- createFolder: J,
427
+ importFromUrl: W,
428
+ toggleSelection: G,
429
+ clearSelection: K,
430
+ selectItem: q,
431
+ loadFolders: J,
432
+ createFolder: ee,
433
433
  renameFolder: X,
434
434
  deleteFolder: te,
435
435
  findFolderInTree: Y,
436
436
  loadFrequentlyUsed: B,
437
- checkUsageBeforeDelete: ee,
438
- confirmDelete: V,
439
- cancelDelete: H,
437
+ checkUsageBeforeDelete: V,
438
+ confirmDelete: H,
439
+ cancelDelete: U,
440
440
  isReplacing: S,
441
441
  replaceError: C,
442
442
  showReplaceWarning: T,
@@ -450,7 +450,7 @@ function ue(e) {
450
450
  }
451
451
  //#endregion
452
452
  //#region src/composables/useI18n.ts
453
- function Q(e) {
453
+ function Z(e) {
454
454
  let t = e ?? _("translations"), n = v(t) ? t.value : t;
455
455
  function r(e, t) {
456
456
  return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : `{${n}}`);
@@ -462,14 +462,14 @@ function Q(e) {
462
462
  }
463
463
  //#endregion
464
464
  //#region src/components/media/MediaBreadcrumb.vue?vue&type=script&setup=true&lang.ts
465
- var de = {
465
+ var fe = {
466
466
  key: 0,
467
467
  class: "tpl:flex tpl:items-center tpl:gap-1 tpl:text-xs",
468
468
  style: { color: "var(--tpl-text-muted)" }
469
- }, fe = ["onClick"], pe = {
469
+ }, pe = ["onClick"], me = {
470
470
  key: 1,
471
471
  style: { color: "var(--tpl-text)" }
472
- }, me = /* @__PURE__ */ h({
472
+ }, he = /* @__PURE__ */ h({
473
473
  __name: "MediaBreadcrumb",
474
474
  props: {
475
475
  folders: {},
@@ -477,7 +477,7 @@ var de = {
477
477
  },
478
478
  emits: ["navigate"],
479
479
  setup(e, { emit: t }) {
480
- let n = e, r = t, { t: a } = Q(), o = s(() => {
480
+ let n = e, r = t, { t: a } = Z(), o = s(() => {
481
481
  if (!n.currentFolderId) return [];
482
482
  let e = [];
483
483
  return c(n.folders, n.currentFolderId, e), e;
@@ -489,7 +489,7 @@ var de = {
489
489
  }
490
490
  return !1;
491
491
  }
492
- return (e, t) => o.value.length > 0 ? (S(), d("div", de, [f("button", {
492
+ return (e, t) => o.value.length > 0 ? (S(), d("div", fe, [f("button", {
493
493
  class: "tpl:transition-colors tpl:duration-150 tpl:hover:underline",
494
494
  style: { color: "var(--tpl-primary)" },
495
495
  onClick: t[0] ||= (e) => r("navigate", null)
@@ -501,12 +501,12 @@ var de = {
501
501
  class: "tpl:transition-colors tpl:duration-150 tpl:hover:underline",
502
502
  style: { color: "var(--tpl-primary)" },
503
503
  onClick: (t) => r("navigate", e.id)
504
- }, D(e.name), 9, fe)) : (S(), d("span", pe, D(e.name), 1))], 64))), 128))])) : u("", !0);
504
+ }, D(e.name), 9, pe)) : (S(), d("span", me, D(e.name), 1))], 64))), 128))])) : u("", !0);
505
505
  }
506
506
  });
507
507
  //#endregion
508
508
  //#region src/composables/useMediaCategories.ts
509
- function he() {
509
+ function Q() {
510
510
  let e = _("planConfig"), t = s(() => e.config.value?.media ?? null), n = s(() => t.value?.use_media_library ?? !0), r = s(() => t.value?.categories ?? null), i = s(() => r.value ? Object.values(r.value).flatMap((e) => e.mime_types) : []), a = s(() => i.value.join(",")), o = s(() => t.value?.max_file_size ?? 0);
511
511
  function c(e, t) {
512
512
  return r.value ? !t || t.length === 0 ? i.value.includes(e) : t.some((t) => r.value[t]?.mime_types.includes(e)) : !1;
@@ -573,7 +573,7 @@ function ye(e, t, n) {
573
573
  }, n.mimeType, n.quality);
574
574
  });
575
575
  }
576
- function $(e, t, n, r) {
576
+ function be(e, t, n, r) {
577
577
  let i = e, a = t;
578
578
  if (n && i > n) {
579
579
  let e = n / i;
@@ -590,57 +590,57 @@ function $(e, t, n, r) {
590
590
  }
591
591
  //#endregion
592
592
  //#region src/components/media/MediaEditModal.vue?vue&type=script&setup=true&lang.ts
593
- var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se = {
593
+ var xe = ["data-tpl-theme"], Se = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ce = {
594
594
  class: "tpl:text-sm tpl:font-semibold",
595
595
  style: { color: "var(--tpl-text)" }
596
- }, Ce = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:px-5" }, we = {
596
+ }, we = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:px-5" }, Te = {
597
597
  key: 0,
598
598
  class: "tpl:mb-4"
599
- }, Te = {
599
+ }, Ee = {
600
600
  class: "tpl:relative tpl:mb-3 tpl:overflow-hidden tpl:rounded-md tpl:border",
601
601
  style: {
602
602
  "border-color": "var(--tpl-border)",
603
603
  height: "300px",
604
604
  "background-color": "var(--tpl-bg)"
605
605
  }
606
- }, Ee = { class: "tpl:space-y-3" }, De = {
606
+ }, De = { class: "tpl:space-y-3" }, Oe = {
607
607
  class: "tpl:mb-1.5 tpl:block tpl:text-xs tpl:font-medium",
608
608
  style: { color: "var(--tpl-text-muted)" }
609
- }, Oe = { class: "tpl:flex tpl:flex-wrap tpl:gap-1.5" }, ke = ["onClick"], Ae = { class: "tpl:flex tpl:gap-3" }, je = { class: "tpl:flex-1" }, Me = {
609
+ }, ke = { class: "tpl:flex tpl:flex-wrap tpl:gap-1.5" }, Ae = ["onClick"], je = { class: "tpl:flex tpl:gap-3" }, Me = { class: "tpl:flex-1" }, Ne = {
610
610
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
611
611
  style: { color: "var(--tpl-text-muted)" }
612
- }, Ne = {
612
+ }, Pe = {
613
613
  class: "tpl:font-normal",
614
614
  style: { color: "var(--tpl-text-dim)" }
615
- }, Pe = { class: "tpl:relative" }, Fe = ["value", "placeholder"], Ie = {
615
+ }, Fe = { class: "tpl:relative" }, Ie = ["value", "placeholder"], Le = {
616
616
  class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
617
617
  style: { color: "var(--tpl-text-dim)" }
618
- }, Le = { class: "tpl:flex-1" }, Re = {
618
+ }, Re = { class: "tpl:flex-1" }, ze = {
619
619
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
620
620
  style: { color: "var(--tpl-text-muted)" }
621
- }, ze = {
621
+ }, Be = {
622
622
  class: "tpl:font-normal",
623
623
  style: { color: "var(--tpl-text-dim)" }
624
- }, Be = { class: "tpl:relative" }, Ve = ["value", "placeholder"], He = {
624
+ }, Ve = { class: "tpl:relative" }, He = ["value", "placeholder"], Ue = {
625
625
  class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
626
626
  style: { color: "var(--tpl-text-dim)" }
627
- }, Ue = {
627
+ }, We = {
628
628
  key: 0,
629
629
  class: "tpl:flex tpl:items-center tpl:gap-1 tpl:text-xs",
630
630
  style: { color: "var(--tpl-text-muted)" }
631
- }, We = {
631
+ }, Ge = {
632
632
  class: "tpl:font-medium",
633
633
  style: { color: "var(--tpl-text)" }
634
- }, Ge = { class: "tpl:mb-3" }, Ke = {
634
+ }, Ke = { class: "tpl:mb-3" }, qe = {
635
635
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
636
636
  style: { color: "var(--tpl-text-muted)" }
637
- }, qe = ["autofocus"], Je = {
637
+ }, Je = ["autofocus"], Ye = {
638
638
  key: 1,
639
639
  class: "tpl:mb-4"
640
- }, Ye = {
640
+ }, Xe = {
641
641
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
642
642
  style: { color: "var(--tpl-text-muted)" }
643
- }, Xe = ["placeholder"], Ze = { class: "tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2 tpl:p-5 tpl:pt-4" }, Qe = ["disabled"], $e = /* @__PURE__ */ h({
643
+ }, Ze = ["placeholder"], Qe = { class: "tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2 tpl:p-5 tpl:pt-4" }, $e = ["disabled"], et = /* @__PURE__ */ h({
644
644
  __name: "MediaEditModal",
645
645
  props: {
646
646
  visible: { type: Boolean },
@@ -648,25 +648,25 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
648
648
  },
649
649
  emits: ["save", "close"],
650
650
  setup(e, { emit: t }) {
651
- let n = e, r = t, { t: c } = Q(), h = _("tplUiTheme"), g = c.mediaLibrary, { isImageMimeType: v } = he(), x = w(""), C = w(""), E = w(null), N = w("free"), F = w(void 0), I = w(void 0), L = w(""), R = w(""), z = w(void 0), B = w(null), ee = w(!1), V = w(!1), H = w(!1), U = s(() => n.item ? [
651
+ let n = e, r = t, { t: c } = Z(), h = _("tplUiTheme"), g = c.mediaLibrary, { isImageMimeType: v } = Q(), x = w(""), C = w(""), E = w(null), N = w("free"), F = w(void 0), I = w(void 0), L = w(""), R = w(""), z = w(void 0), B = w(null), V = w(!1), H = w(!1), U = w(!1), W = s(() => n.item ? [
652
652
  "image/jpeg",
653
653
  "image/png",
654
654
  "image/webp",
655
655
  "image/gif"
656
- ].includes(n.item.mime_type) : !1), W = s(() => N.value === "original" ? z.value : ge[N.value]), G = s(() => B.value ? $(B.value.width, B.value.height, F.value, I.value) : null);
656
+ ].includes(n.item.mime_type) : !1), G = s(() => N.value === "original" ? z.value : ge[N.value]), K = s(() => B.value ? be(B.value.width, B.value.height, F.value, I.value) : null);
657
657
  A(() => n.visible, (e) => {
658
- e && n.item && (x.value = n.item.filename, C.value = n.item.alt_text || "", N.value = "free", F.value = void 0, I.value = void 0, L.value = "", R.value = "", z.value = void 0, B.value = null, ee.value = !1, H.value = !1, n.item.width && n.item.height && (z.value = n.item.width / n.item.height));
658
+ e && n.item && (x.value = n.item.filename, C.value = n.item.alt_text || "", N.value = "free", F.value = void 0, I.value = void 0, L.value = "", R.value = "", z.value = void 0, B.value = null, V.value = !1, U.value = !1, n.item.width && n.item.height && (z.value = n.item.width / n.item.height));
659
659
  });
660
- function K(e) {
660
+ function q(e) {
661
661
  e.coordinates && (B.value = {
662
662
  width: Math.round(e.coordinates.width),
663
663
  height: Math.round(e.coordinates.height)
664
- }, H.value = !0);
664
+ }, U.value = !0);
665
665
  }
666
- function q() {
667
- ee.value = !0, !z.value && n.item?.width && n.item?.height && (z.value = n.item.width / n.item.height);
666
+ function J() {
667
+ V.value = !0, !z.value && n.item?.width && n.item?.height && (z.value = n.item.width / n.item.height);
668
668
  }
669
- function J(e) {
669
+ function ee(e) {
670
670
  let t = e.target.value;
671
671
  L.value = t, F.value = t && parseInt(t, 10) || void 0;
672
672
  }
@@ -676,10 +676,10 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
676
676
  }
677
677
  async function X() {
678
678
  let e = x.value.trim();
679
- if (!e || !n.item || V.value) return;
679
+ if (!e || !n.item || H.value) return;
680
680
  let t = v(n.item.mime_type), i;
681
- if (U.value && E.value && H.value) {
682
- V.value = !0;
681
+ if (W.value && E.value && U.value) {
682
+ H.value = !0;
683
683
  try {
684
684
  let { canvas: e } = E.value.getResult();
685
685
  if (e) {
@@ -687,15 +687,15 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
687
687
  i = { file: await ye(t, n.item.filename, r) };
688
688
  }
689
689
  } catch {
690
- V.value = !1;
690
+ H.value = !1;
691
691
  return;
692
692
  }
693
- V.value = !1;
693
+ H.value = !1;
694
694
  }
695
695
  r("save", n.item.id, e, t ? C.value : void 0, i), r("close");
696
696
  }
697
697
  function te(e) {
698
- e.key === "Enter" && !V.value && (e.preventDefault(), X()), e.key === "Escape" && r("close");
698
+ e.key === "Enter" && !H.value && (e.preventDefault(), X()), e.key === "Escape" && r("close");
699
699
  }
700
700
  return (t, n) => (S(), l(a, { to: "body" }, [m(o, {
701
701
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
@@ -713,22 +713,22 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
713
713
  onClick: n[3] ||= P((e) => r("close"), ["self"]),
714
714
  onKeydown: te
715
715
  }, [f("div", {
716
- class: y(["tpl:mx-4 tpl:flex tpl:max-h-[90vh] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", U.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
716
+ class: y(["tpl:mx-4 tpl:flex tpl:max-h-[90vh] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", W.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
717
717
  style: { "background-color": "var(--tpl-bg-elevated)" }
718
718
  }, [
719
- f("div", xe, [f("h3", Se, D(O(c).mediaLibrary.editFile), 1)]),
720
- f("div", Ce, [
721
- U.value ? (S(), d("div", we, [f("div", Te, [m(O(ne), {
719
+ f("div", Se, [f("h3", Ce, D(O(c).mediaLibrary.editFile), 1)]),
720
+ f("div", we, [
721
+ W.value ? (S(), d("div", Te, [f("div", Ee, [m(O(ne), {
722
722
  ref_key: "cropperRef",
723
723
  ref: E,
724
724
  src: e.item.url,
725
- "stencil-props": { aspectRatio: W.value },
725
+ "stencil-props": { aspectRatio: G.value },
726
726
  class: "tpl:h-full tpl:w-full",
727
727
  "background-class": "tpl-cropper-background",
728
- onChange: K,
729
- onReady: q
730
- }, null, 8, ["src", "stencil-props"])]), f("div", Ee, [
731
- f("div", null, [f("label", De, D(O(c).mediaLibrary.cropAspectRatio), 1), f("div", Oe, [(S(), d(i, null, T([
728
+ onChange: q,
729
+ onReady: J
730
+ }, null, 8, ["src", "stencil-props"])]), f("div", De, [
731
+ f("div", null, [f("label", Oe, D(O(c).mediaLibrary.cropAspectRatio), 1), f("div", ke, [(S(), d(i, null, T([
732
732
  "free",
733
733
  "square",
734
734
  "landscape43",
@@ -744,8 +744,8 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
744
744
  color: N.value === e ? "var(--tpl-primary)" : "var(--tpl-text)"
745
745
  }),
746
746
  onClick: (t) => N.value = e
747
- }, D(O(g)[`crop${e.charAt(0).toUpperCase()}${e.slice(1)}`]), 13, ke)), 64))])]),
748
- f("div", Ae, [f("div", je, [f("label", Me, [p(D(O(c).mediaLibrary.cropMaxWidth) + " ", 1), f("span", Ne, D(O(c).mediaLibrary.cropOptional), 1)]), f("div", Pe, [f("input", {
747
+ }, D(O(g)[`crop${e.charAt(0).toUpperCase()}${e.slice(1)}`]), 13, Ae)), 64))])]),
748
+ f("div", je, [f("div", Me, [f("label", Ne, [p(D(O(c).mediaLibrary.cropMaxWidth) + " ", 1), f("span", Pe, D(O(c).mediaLibrary.cropOptional), 1)]), f("div", Fe, [f("input", {
749
749
  value: L.value,
750
750
  type: "number",
751
751
  min: "1",
@@ -756,8 +756,8 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
756
756
  color: "var(--tpl-text)"
757
757
  },
758
758
  placeholder: B.value?.width?.toString() || "",
759
- onInput: J
760
- }, null, 40, Fe), f("span", Ie, D(O(c).mediaLibrary.cropPixels), 1)])]), f("div", Le, [f("label", Re, [p(D(O(c).mediaLibrary.cropMaxHeight) + " ", 1), f("span", ze, D(O(c).mediaLibrary.cropOptional), 1)]), f("div", Be, [f("input", {
759
+ onInput: ee
760
+ }, null, 40, Ie), f("span", Le, D(O(c).mediaLibrary.cropPixels), 1)])]), f("div", Re, [f("label", ze, [p(D(O(c).mediaLibrary.cropMaxHeight) + " ", 1), f("span", Be, D(O(c).mediaLibrary.cropOptional), 1)]), f("div", Ve, [f("input", {
761
761
  value: R.value,
762
762
  type: "number",
763
763
  min: "1",
@@ -769,10 +769,10 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
769
769
  },
770
770
  placeholder: B.value?.height?.toString() || "",
771
771
  onInput: Y
772
- }, null, 40, Ve), f("span", He, D(O(c).mediaLibrary.cropPixels), 1)])])]),
773
- G.value ? (S(), d("div", Ue, [f("span", null, D(O(c).mediaLibrary.cropOutputSize) + ": ", 1), f("span", We, D(G.value.width) + " x " + D(G.value.height) + " " + D(O(c).mediaLibrary.cropPixels), 1)])) : u("", !0)
772
+ }, null, 40, He), f("span", Ue, D(O(c).mediaLibrary.cropPixels), 1)])])]),
773
+ K.value ? (S(), d("div", We, [f("span", null, D(O(c).mediaLibrary.cropOutputSize) + ": ", 1), f("span", Ge, D(K.value.width) + " x " + D(K.value.height) + " " + D(O(c).mediaLibrary.cropPixels), 1)])) : u("", !0)
774
774
  ])])) : u("", !0),
775
- f("div", Ge, [f("label", Ke, D(O(c).mediaLibrary.fileName), 1), M(f("input", {
775
+ f("div", Ke, [f("label", qe, D(O(c).mediaLibrary.fileName), 1), M(f("input", {
776
776
  "onUpdate:modelValue": n[0] ||= (e) => x.value = e,
777
777
  type: "text",
778
778
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
@@ -781,9 +781,9 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
781
781
  "background-color": "var(--tpl-bg)",
782
782
  color: "var(--tpl-text)"
783
783
  },
784
- autofocus: !U.value
785
- }, null, 8, qe), [[k, x.value]])]),
786
- O(v)(e.item.mime_type) ? (S(), d("div", Je, [f("label", Ye, D(O(c).mediaLibrary.altText), 1), M(f("input", {
784
+ autofocus: !W.value
785
+ }, null, 8, Je), [[k, x.value]])]),
786
+ O(v)(e.item.mime_type) ? (S(), d("div", Ye, [f("label", Xe, D(O(c).mediaLibrary.altText), 1), M(f("input", {
787
787
  "onUpdate:modelValue": n[1] ||= (e) => C.value = e,
788
788
  type: "text",
789
789
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
@@ -793,9 +793,9 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
793
793
  color: "var(--tpl-text)"
794
794
  },
795
795
  placeholder: O(c).mediaLibrary.altTextPlaceholder
796
- }, null, 8, Xe), [[k, C.value]])])) : u("", !0)
796
+ }, null, 8, Ze), [[k, C.value]])])) : u("", !0)
797
797
  ]),
798
- f("div", Ze, [f("button", {
798
+ f("div", Qe, [f("button", {
799
799
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
800
800
  style: {
801
801
  "border-color": "var(--tpl-border)",
@@ -806,27 +806,27 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
806
806
  }, D(O(c).mediaLibrary.cancel), 1), f("button", {
807
807
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
808
808
  style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
809
- disabled: V.value,
809
+ disabled: H.value,
810
810
  onClick: X
811
- }, D(V.value ? O(c).mediaLibrary.saving : O(c).mediaLibrary.saveChanges), 9, Qe)])
812
- ], 2)], 40, be)) : u("", !0)]),
811
+ }, D(H.value ? O(c).mediaLibrary.saving : O(c).mediaLibrary.saveChanges), 9, $e)])
812
+ ], 2)], 40, xe)) : u("", !0)]),
813
813
  _: 1
814
814
  })]));
815
815
  }
816
- }), et = (e, t) => {
816
+ }), tt = (e, t) => {
817
817
  let n = e.__vccOpts || e;
818
818
  for (let [e, r] of t) n[e] = r;
819
819
  return n;
820
- }, tt = /* @__PURE__ */ et($e, [["__scopeId", "data-v-bd5f2e31"]]), nt = {
820
+ }, nt = /* @__PURE__ */ tt(et, [["__scopeId", "data-v-bd5f2e31"]]), rt = {
821
821
  key: 1,
822
822
  class: "tpl:size-4 tpl:shrink-0"
823
- }, rt = {
823
+ }, it = {
824
824
  key: 0,
825
825
  class: "tpl:truncate"
826
- }, it = {
826
+ }, at = {
827
827
  key: 3,
828
828
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:gap-0.5 tpl:opacity-0 tpl:transition-opacity tpl:group-hover:opacity-100"
829
- }, at = ["title"], ot = ["title"], st = { key: 0 }, ct = ["placeholder"], lt = 5, ut = /* @__PURE__ */ h({
829
+ }, ot = ["title"], st = ["title"], ct = { key: 0 }, lt = ["placeholder"], ut = 5, dt = /* @__PURE__ */ h({
830
830
  __name: "MediaFolderTreeNode",
831
831
  props: {
832
832
  folder: {},
@@ -840,7 +840,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
840
840
  "deleteFolder"
841
841
  ],
842
842
  setup(e, { emit: t }) {
843
- let n = e, r = t, { t: a } = Q(), o = w(!1), c = w(!1), p = w(""), h = w(!1), g = w(""), _ = s(() => (n.folder.children?.length ?? 0) > 0), v = s(() => n.depth < lt - 1), x = s(() => n.currentFolderId === n.folder.id), C = s(() => !n.currentFolderId || !n.folder.children ? !1 : j(n.folder.children, n.currentFolderId)), A = s(() => o.value || C.value);
843
+ let n = e, r = t, { t: a } = Z(), o = w(!1), c = w(!1), p = w(""), h = w(!1), g = w(""), _ = s(() => (n.folder.children?.length ?? 0) > 0), v = s(() => n.depth < ut - 1), x = s(() => n.currentFolderId === n.folder.id), C = s(() => !n.currentFolderId || !n.folder.children ? !1 : j(n.folder.children, n.currentFolderId)), A = s(() => o.value || C.value);
844
844
  function j(e, t) {
845
845
  for (let n of e) if (n.id === t || n.children && j(n.children, t)) return !0;
846
846
  return !1;
@@ -858,13 +858,13 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
858
858
  function B() {
859
859
  c.value = !1, p.value = "";
860
860
  }
861
- function ee() {
861
+ function V() {
862
862
  h.value = !0, g.value = "", o.value = !0;
863
863
  }
864
- function V() {
864
+ function H() {
865
865
  g.value.trim() && r("createFolder", g.value.trim(), n.folder.id), h.value = !1, g.value = "";
866
866
  }
867
- function H() {
867
+ function U() {
868
868
  h.value = !1, g.value = "";
869
869
  }
870
870
  return (t, n) => {
@@ -885,7 +885,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
885
885
  class: y(["tpl:transition-transform tpl:duration-150", { "tpl:rotate-90": A.value }]),
886
886
  size: 10,
887
887
  "stroke-width": 2
888
- }, null, 8, ["class"])])) : (S(), d("span", nt)),
888
+ }, null, 8, ["class"])])) : (S(), d("span", rt)),
889
889
  f("button", {
890
890
  class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-1.5",
891
891
  onClick: n[0] ||= (t) => r("navigate", e.folder.id)
@@ -893,7 +893,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
893
893
  class: "tpl:shrink-0",
894
894
  size: 14,
895
895
  "stroke-width": 1.5
896
- }), c.value ? u("", !0) : (S(), d("span", rt, D(e.folder.name), 1))]),
896
+ }), c.value ? u("", !0) : (S(), d("span", it, D(e.folder.name), 1))]),
897
897
  c.value ? M((S(), d("input", {
898
898
  key: 2,
899
899
  "onUpdate:modelValue": n[1] ||= (e) => p.value = e,
@@ -909,24 +909,24 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
909
909
  onBlur: R,
910
910
  onClick: n[2] ||= P(() => {}, ["stop"])
911
911
  }, null, 544)), [[k, p.value]]) : u("", !0),
912
- c.value ? u("", !0) : (S(), d("span", it, [
912
+ c.value ? u("", !0) : (S(), d("span", at, [
913
913
  v.value ? (S(), d("button", {
914
914
  key: 0,
915
915
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
916
916
  title: O(a).mediaLibrary.addSubfolder,
917
- onClick: P(ee, ["stop"])
918
- }, [m(O(G), {
917
+ onClick: P(V, ["stop"])
918
+ }, [m(O(K), {
919
919
  size: 12,
920
920
  "stroke-width": 2
921
- })], 8, at)) : u("", !0),
921
+ })], 8, ot)) : u("", !0),
922
922
  f("button", {
923
923
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
924
924
  title: O(a).mediaLibrary.renameFolder,
925
925
  onClick: P(L, ["stop"])
926
- }, [m(O(W), {
926
+ }, [m(O(G), {
927
927
  size: 12,
928
928
  "stroke-width": 2
929
- })], 8, ot),
929
+ })], 8, st),
930
930
  f("button", {
931
931
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
932
932
  onClick: n[3] ||= P((t) => r("deleteFolder", e.folder.id), ["stop"])
@@ -936,7 +936,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
936
936
  style: { color: "var(--tpl-danger)" }
937
937
  })])
938
938
  ]))
939
- ], 4), A.value ? (S(), d("div", st, [(S(!0), d(i, null, T(e.folder.children, (t) => (S(), l(o, {
939
+ ], 4), A.value ? (S(), d("div", ct, [(S(!0), d(i, null, T(e.folder.children, (t) => (S(), l(o, {
940
940
  key: t.id,
941
941
  folder: t,
942
942
  "current-folder-id": e.currentFolderId,
@@ -964,15 +964,15 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
964
964
  },
965
965
  placeholder: O(a).mediaLibrary.subfolderName,
966
966
  autofocus: "",
967
- onKeydown: [N(V, ["enter"]), N(H, ["escape"])],
968
- onBlur: V
969
- }, null, 40, ct), [[k, g.value]])], 4)) : u("", !0)])) : u("", !0)]);
967
+ onKeydown: [N(H, ["enter"]), N(U, ["escape"])],
968
+ onBlur: H
969
+ }, null, 40, lt), [[k, g.value]])], 4)) : u("", !0)])) : u("", !0)]);
970
970
  };
971
971
  }
972
- }), dt = { class: "tpl:flex tpl:h-full tpl:flex-col tpl:overflow-y-auto" }, ft = {
972
+ }), ft = { class: "tpl:flex tpl:h-full tpl:flex-col tpl:overflow-y-auto" }, pt = {
973
973
  key: 0,
974
974
  class: "tpl:px-3 tpl:py-2"
975
- }, pt = ["placeholder"], mt = /* @__PURE__ */ h({
975
+ }, mt = ["placeholder"], ht = /* @__PURE__ */ h({
976
976
  __name: "MediaFolderTree",
977
977
  props: {
978
978
  folders: {},
@@ -988,7 +988,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
988
988
  "showFrequentlyUsed"
989
989
  ],
990
990
  setup(e, { emit: t }) {
991
- let n = t, { t: r } = Q(), a = w(!1), o = w("");
991
+ let n = t, { t: r } = Z(), a = w(!1), o = w("");
992
992
  function s() {
993
993
  a.value = !0, o.value = "";
994
994
  }
@@ -998,7 +998,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
998
998
  function h() {
999
999
  a.value = !1, o.value = "";
1000
1000
  }
1001
- return (t, g) => (S(), d("div", dt, [
1001
+ return (t, g) => (S(), d("div", ft, [
1002
1002
  f("button", {
1003
1003
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
1004
1004
  style: b({
@@ -1010,7 +1010,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1010
1010
  size: 14,
1011
1011
  "stroke-width": 1.5
1012
1012
  }), p(" " + D(O(r).mediaLibrary.allFiles), 1)], 4),
1013
- (S(!0), d(i, null, T(e.folders, (t) => (S(), l(ut, {
1013
+ (S(!0), d(i, null, T(e.folders, (t) => (S(), l(dt, {
1014
1014
  key: t.id,
1015
1015
  folder: t,
1016
1016
  "current-folder-id": e.currentFolderId,
@@ -1020,7 +1020,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1020
1020
  onRenameFolder: g[3] ||= (e, t) => n("renameFolder", e, t),
1021
1021
  onDeleteFolder: g[4] ||= (e) => n("deleteFolder", e)
1022
1022
  }, null, 8, ["folder", "current-folder-id"]))), 128)),
1023
- a.value ? (S(), d("div", ft, [M(f("input", {
1023
+ a.value ? (S(), d("div", pt, [M(f("input", {
1024
1024
  "onUpdate:modelValue": g[5] ||= (e) => o.value = e,
1025
1025
  type: "text",
1026
1026
  class: "tpl:w-full tpl:rounded tpl:border tpl:px-2 tpl:py-1 tpl:text-xs tpl:outline-none",
@@ -1033,13 +1033,13 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1033
1033
  autofocus: "",
1034
1034
  onKeydown: [N(c, ["enter"]), N(h, ["escape"])],
1035
1035
  onBlur: c
1036
- }, null, 40, pt), [[k, o.value]])])) : u("", !0),
1036
+ }, null, 40, mt), [[k, o.value]])])) : u("", !0),
1037
1037
  a.value ? u("", !0) : (S(), d("button", {
1038
1038
  key: 1,
1039
1039
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:transition-all tpl:duration-150",
1040
1040
  style: { color: "var(--tpl-text-muted)" },
1041
1041
  onClick: s
1042
- }, [m(O(G), {
1042
+ }, [m(O(K), {
1043
1043
  size: 14,
1044
1044
  "stroke-width": 1.5
1045
1045
  }), p(" " + D(O(r).mediaLibrary.newFolder), 1)])),
@@ -1053,13 +1053,13 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1053
1053
  color: e.viewMode === "frequently-used" ? "var(--tpl-primary)" : "var(--tpl-text)"
1054
1054
  }),
1055
1055
  onClick: g[6] ||= (e) => n("showFrequentlyUsed")
1056
- }, [m(O(J), {
1056
+ }, [m(O(ee), {
1057
1057
  size: 14,
1058
1058
  "stroke-width": 1.5
1059
1059
  }), p(" " + D(O(r).mediaLibrary.frequentlyUsed), 1)], 4)) : u("", !0)
1060
1060
  ]));
1061
1061
  }
1062
- }), ht = { class: "tpl:flex tpl:aspect-square tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2" }, gt = /* @__PURE__ */ h({
1062
+ }), gt = { class: "tpl:flex tpl:aspect-square tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2" }, _t = /* @__PURE__ */ h({
1063
1063
  __name: "MediaFileIcon",
1064
1064
  props: { mimeType: {} },
1065
1065
  setup(e) {
@@ -1160,7 +1160,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1160
1160
  bgColor: "#f9fafb",
1161
1161
  icon: "document"
1162
1162
  }, i = s(() => n[t.mimeType] ?? r);
1163
- return (e, t) => (S(), d("div", ht, [i.value.icon === "document" ? (S(), d("svg", {
1163
+ return (e, t) => (S(), d("div", gt, [i.value.icon === "document" ? (S(), d("svg", {
1164
1164
  key: 0,
1165
1165
  width: "60",
1166
1166
  height: "60",
@@ -1229,48 +1229,48 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1229
1229
  style: b({ color: i.value.color })
1230
1230
  }, D(i.value.label), 5)]));
1231
1231
  }
1232
- }), _t = { class: "tpl:p-4" }, vt = {
1232
+ }), vt = { class: "tpl:p-4" }, yt = {
1233
1233
  key: 1,
1234
1234
  class: "tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-16"
1235
- }, yt = {
1235
+ }, bt = {
1236
1236
  class: "tpl:text-xs",
1237
1237
  style: { color: "var(--tpl-text-muted)" }
1238
- }, bt = {
1238
+ }, xt = {
1239
1239
  key: 2,
1240
1240
  class: "tpl:grid tpl:grid-cols-4 tpl:gap-3"
1241
- }, xt = ["onClick"], St = { class: "tpl:aspect-square" }, Ct = ["src", "alt"], wt = { class: "tpl:px-2 tpl:py-1.5" }, Tt = {
1241
+ }, St = ["onClick"], Ct = { class: "tpl:aspect-square" }, wt = ["src", "alt"], Tt = { class: "tpl:px-2 tpl:py-1.5" }, Et = {
1242
1242
  class: "tpl:truncate tpl:text-[10px] tpl:font-medium",
1243
1243
  style: { color: "var(--tpl-text)" }
1244
- }, Et = {
1244
+ }, Dt = {
1245
1245
  class: "tpl:flex tpl:justify-between tpl:text-[9px]",
1246
1246
  style: { color: "var(--tpl-text-muted)" }
1247
- }, Dt = { key: 0 }, Ot = { class: "tpl:absolute tpl:top-1.5 tpl:left-1.5 tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, kt = ["title", "onClick"], At = ["title", "onClick"], jt = {
1247
+ }, Ot = { key: 0 }, kt = { class: "tpl:absolute tpl:top-1.5 tpl:left-1.5 tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, At = ["title", "onClick"], jt = ["title", "onClick"], Mt = {
1248
1248
  key: 0,
1249
1249
  class: "tpl:absolute tpl:top-1.5 tpl:right-1.5 tpl:flex tpl:size-5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1250
1250
  style: { "background-color": "var(--tpl-primary)" }
1251
- }, Mt = {
1251
+ }, Nt = {
1252
1252
  key: 3,
1253
1253
  class: "tpl:flex tpl:flex-col tpl:gap-1"
1254
- }, Nt = ["onClick"], Pt = {
1254
+ }, Pt = ["onClick"], Ft = {
1255
1255
  class: "tpl:size-10 tpl:shrink-0 tpl:overflow-hidden tpl:rounded",
1256
1256
  style: { "background-color": "var(--tpl-bg-hover)" }
1257
- }, Ft = ["src", "alt"], It = {
1257
+ }, It = ["src", "alt"], Lt = {
1258
1258
  key: 1,
1259
1259
  class: "tpl-list-icon tpl:size-full"
1260
- }, Lt = { class: "tpl:min-w-0 tpl:flex-1" }, Rt = {
1260
+ }, Rt = { class: "tpl:min-w-0 tpl:flex-1" }, zt = {
1261
1261
  class: "tpl:truncate tpl:text-xs tpl:font-medium",
1262
1262
  style: { color: "var(--tpl-text)" }
1263
- }, zt = {
1263
+ }, Bt = {
1264
1264
  class: "tpl:text-[10px]",
1265
1265
  style: { color: "var(--tpl-text-muted)" }
1266
- }, Bt = { class: "tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Vt = ["title", "onClick"], Ht = ["title", "onClick"], Ut = {
1266
+ }, Vt = { class: "tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Ht = ["title", "onClick"], Ut = ["title", "onClick"], Wt = {
1267
1267
  key: 0,
1268
1268
  class: "tpl:flex tpl:size-5 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1269
1269
  style: { "background-color": "var(--tpl-primary)" }
1270
- }, Wt = {
1270
+ }, Gt = {
1271
1271
  key: 4,
1272
1272
  class: "tpl:flex tpl:justify-center tpl:py-4"
1273
- }, Gt = /* @__PURE__ */ et(/* @__PURE__ */ h({
1273
+ }, Kt = /* @__PURE__ */ tt(/* @__PURE__ */ h({
1274
1274
  __name: "MediaGrid",
1275
1275
  props: {
1276
1276
  items: {},
@@ -1288,15 +1288,15 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1288
1288
  "replace"
1289
1289
  ],
1290
1290
  setup(e, { emit: t }) {
1291
- let n = e, r = t, { isAcceptedMimeType: a, isImageMimeType: o } = he();
1291
+ let n = e, r = t, { isAcceptedMimeType: a, isImageMimeType: o } = Q();
1292
1292
  function s(e) {
1293
1293
  return !n.accept || n.accept.length === 0 ? !0 : a(e.mime_type, n.accept);
1294
1294
  }
1295
1295
  function c(e) {
1296
1296
  r("select", e);
1297
1297
  }
1298
- let { t: h } = Q(), g = w(null);
1299
- ce(g, ([{ isIntersecting: e }]) => {
1298
+ let { t: h } = Z(), g = w(null);
1299
+ le(g, ([{ isIntersecting: e }]) => {
1300
1300
  e && n.hasMore && !n.isLoading && r("loadMore");
1301
1301
  }, { threshold: .1 });
1302
1302
  function _(e) {
@@ -1309,7 +1309,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1309
1309
  day: "numeric"
1310
1310
  });
1311
1311
  }
1312
- return (t, n) => (S(), d("div", _t, [
1312
+ return (t, n) => (S(), d("div", vt, [
1313
1313
  e.isLoading && e.items.length === 0 ? (S(), d("div", {
1314
1314
  key: 0,
1315
1315
  class: y(e.layout === "list" ? "tpl:flex tpl:flex-col tpl:gap-1" : "tpl:grid tpl:grid-cols-4 tpl:gap-3")
@@ -1317,47 +1317,47 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1317
1317
  key: t,
1318
1318
  class: y(["tpl-pulse tpl:rounded-lg", e.layout === "list" ? "tpl:h-12" : "tpl:aspect-square"]),
1319
1319
  style: { "background-color": "var(--tpl-bg-hover)" }
1320
- }, null, 2)), 64))], 2)) : e.items.length === 0 ? (S(), d("div", vt, [m(O(R), {
1320
+ }, null, 2)), 64))], 2)) : e.items.length === 0 ? (S(), d("div", yt, [m(O(R), {
1321
1321
  class: "tpl:mb-3",
1322
1322
  size: 40,
1323
1323
  "stroke-width": 1,
1324
1324
  style: { color: "var(--tpl-text-dim)" }
1325
- }), f("p", yt, D(O(h).mediaLibrary.noFiles), 1)])) : e.layout === "list" ? (S(), d("div", Mt, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
1325
+ }), f("p", bt, D(O(h).mediaLibrary.noFiles), 1)])) : e.layout === "list" ? (S(), d("div", Nt, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
1326
1326
  key: t.id,
1327
1327
  class: y(["tpl-media-list-item tpl:group tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-3 tpl:rounded-lg tpl:px-3 tpl:py-2 tpl:transition-all tpl:duration-150", [!s(t) && !e.selectedIds.has(t.id) ? "tpl:opacity-60" : ""]]),
1328
1328
  style: b({ backgroundColor: e.selectedIds.has(t.id) ? "var(--tpl-bg-hover)" : "transparent" }),
1329
1329
  onClick: (e) => c(t)
1330
1330
  }, [
1331
- f("div", Pt, [O(o)(t.mime_type) ? (S(), d("img", {
1331
+ f("div", Ft, [O(o)(t.mime_type) ? (S(), d("img", {
1332
1332
  key: 0,
1333
1333
  src: t.small_url || t.url,
1334
1334
  alt: t.filename,
1335
1335
  class: "tpl:size-full tpl:object-cover",
1336
1336
  loading: "lazy"
1337
- }, null, 8, Ft)) : (S(), d("div", It, [m(gt, { "mime-type": t.mime_type }, null, 8, ["mime-type"])]))]),
1338
- f("div", Lt, [f("p", Rt, D(t.filename), 1), f("p", zt, [p(D(_(t.size)) + " · " + D(v(t.created_at)) + " ", 1), O(o)(t.mime_type) && t.width && t.height ? (S(), d(i, { key: 0 }, [p(" · " + D(t.width) + "×" + D(t.height), 1)], 64)) : u("", !0)])]),
1339
- f("div", Bt, [f("button", {
1337
+ }, null, 8, It)) : (S(), d("div", Lt, [m(_t, { "mime-type": t.mime_type }, null, 8, ["mime-type"])]))]),
1338
+ f("div", Rt, [f("p", zt, D(t.filename), 1), f("p", Bt, [p(D(_(t.size)) + " · " + D(v(t.created_at)) + " ", 1), O(o)(t.mime_type) && t.width && t.height ? (S(), d(i, { key: 0 }, [p(" · " + D(t.width) + "×" + D(t.height), 1)], 64)) : u("", !0)])]),
1339
+ f("div", Vt, [f("button", {
1340
1340
  class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
1341
1341
  style: { color: "var(--tpl-text-muted)" },
1342
1342
  title: O(h).mediaLibrary.editFile,
1343
1343
  onClick: P((e) => r("edit", t), ["stop"])
1344
- }, [m(O(W), {
1344
+ }, [m(O(G), {
1345
1345
  size: 12,
1346
1346
  "stroke-width": 2
1347
- })], 8, Vt), f("button", {
1347
+ })], 8, Ht), f("button", {
1348
1348
  class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
1349
1349
  style: { color: "var(--tpl-text-muted)" },
1350
1350
  title: O(h).mediaLibrary.replaceFile,
1351
1351
  onClick: P((e) => r("replace", t), ["stop"])
1352
- }, [m(O(K), {
1352
+ }, [m(O(q), {
1353
1353
  size: 12,
1354
1354
  "stroke-width": 2
1355
- })], 8, Ht)]),
1356
- e.selectedIds.has(t.id) ? (S(), d("div", Ut, [m(O(F), {
1355
+ })], 8, Ut)]),
1356
+ e.selectedIds.has(t.id) ? (S(), d("div", Wt, [m(O(F), {
1357
1357
  size: 12,
1358
1358
  "stroke-width": 3
1359
1359
  })])) : u("", !0)
1360
- ], 14, Nt))), 128))])) : (S(), d("div", bt, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
1360
+ ], 14, Pt))), 128))])) : (S(), d("div", xt, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
1361
1361
  key: t.id,
1362
1362
  class: y(["tpl-media-item tpl:group tpl:relative tpl:overflow-hidden tpl:rounded-lg tpl:border-2 tpl:transition-all tpl:duration-150", [
1363
1363
  "tpl:cursor-pointer",
@@ -1370,45 +1370,45 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1370
1370
  }),
1371
1371
  onClick: (e) => c(t)
1372
1372
  }, [
1373
- f("div", St, [O(o)(t.mime_type) ? (S(), d("img", {
1373
+ f("div", Ct, [O(o)(t.mime_type) ? (S(), d("img", {
1374
1374
  key: 0,
1375
1375
  src: t.small_url || t.url,
1376
1376
  alt: t.filename,
1377
1377
  class: "tpl:size-full tpl:object-cover",
1378
1378
  loading: "lazy"
1379
- }, null, 8, Ct)) : (S(), l(gt, {
1379
+ }, null, 8, wt)) : (S(), l(_t, {
1380
1380
  key: 1,
1381
1381
  "mime-type": t.mime_type
1382
1382
  }, null, 8, ["mime-type"]))]),
1383
- f("div", wt, [f("p", Tt, D(t.filename), 1), f("p", Et, [f("span", null, D(_(t.size)), 1), O(o)(t.mime_type) && t.width && t.height ? (S(), d("span", Dt, D(t.width) + "×" + D(t.height), 1)) : u("", !0)])]),
1384
- f("div", Ot, [f("button", {
1383
+ f("div", Tt, [f("p", Et, D(t.filename), 1), f("p", Dt, [f("span", null, D(_(t.size)), 1), O(o)(t.mime_type) && t.width && t.height ? (S(), d("span", Ot, D(t.width) + "×" + D(t.height), 1)) : u("", !0)])]),
1384
+ f("div", kt, [f("button", {
1385
1385
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1386
1386
  style: { "background-color": "rgba(0, 0, 0, 0.6)" },
1387
1387
  title: O(h).mediaLibrary.editFile,
1388
1388
  onClick: P((e) => r("edit", t), ["stop"])
1389
- }, [m(O(W), {
1389
+ }, [m(O(G), {
1390
1390
  size: 11,
1391
1391
  "stroke-width": 2
1392
- })], 8, kt), f("button", {
1392
+ })], 8, At), f("button", {
1393
1393
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1394
1394
  style: { "background-color": "rgba(0, 0, 0, 0.6)" },
1395
1395
  title: O(h).mediaLibrary.replaceFile,
1396
1396
  onClick: P((e) => r("replace", t), ["stop"])
1397
- }, [m(O(K), {
1397
+ }, [m(O(q), {
1398
1398
  size: 11,
1399
1399
  "stroke-width": 2
1400
- })], 8, At)]),
1401
- e.selectedIds.has(t.id) ? (S(), d("div", jt, [m(O(F), {
1400
+ })], 8, jt)]),
1401
+ e.selectedIds.has(t.id) ? (S(), d("div", Mt, [m(O(F), {
1402
1402
  size: 12,
1403
1403
  "stroke-width": 3
1404
1404
  })])) : u("", !0)
1405
- ], 14, xt))), 128))])),
1405
+ ], 14, St))), 128))])),
1406
1406
  f("div", {
1407
1407
  ref_key: "sentinelRef",
1408
1408
  ref: g,
1409
1409
  class: "tpl:h-4"
1410
1410
  }, null, 512),
1411
- e.isLoading && e.items.length > 0 ? (S(), d("div", Wt, [m(O(H), {
1411
+ e.isLoading && e.items.length > 0 ? (S(), d("div", Gt, [m(O(U), {
1412
1412
  class: "tpl-spinner",
1413
1413
  size: 20,
1414
1414
  "stroke-width": 2,
@@ -1416,20 +1416,20 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1416
1416
  })])) : u("", !0)
1417
1417
  ]));
1418
1418
  }
1419
- }), [["__scopeId", "data-v-9db961d1"]]), Kt = ["data-tpl-theme"], qt = {
1419
+ }), [["__scopeId", "data-v-9db961d1"]]), qt = ["data-tpl-theme"], Jt = {
1420
1420
  class: "tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-lg tpl:p-5 tpl:shadow-xl",
1421
1421
  style: { "background-color": "var(--tpl-bg-elevated)" }
1422
- }, Jt = {
1422
+ }, Yt = {
1423
1423
  class: "tpl:mb-4 tpl:text-sm tpl:font-semibold",
1424
1424
  style: { color: "var(--tpl-text)" }
1425
- }, Yt = { class: "tpl:mb-3" }, Xt = ["placeholder", "disabled"], Zt = {
1425
+ }, Xt = { class: "tpl:mb-3" }, Zt = ["placeholder", "disabled"], Qt = {
1426
1426
  key: 0,
1427
1427
  class: "tpl:mb-3 tpl:text-xs",
1428
1428
  style: { color: "var(--tpl-danger)" }
1429
- }, Qt = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, $t = ["disabled"], en = ["disabled"], tn = {
1429
+ }, $t = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, en = ["disabled"], tn = ["disabled"], nn = {
1430
1430
  key: 0,
1431
1431
  class: "tpl:flex tpl:items-center tpl:gap-1.5"
1432
- }, nn = { key: 1 }, rn = /* @__PURE__ */ h({
1432
+ }, rn = { key: 1 }, an = /* @__PURE__ */ h({
1433
1433
  __name: "MediaImportUrlModal",
1434
1434
  props: {
1435
1435
  visible: { type: Boolean },
@@ -1438,7 +1438,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1438
1438
  },
1439
1439
  emits: ["import", "close"],
1440
1440
  setup(e, { emit: t }) {
1441
- let n = e, r = t, { t: i } = Q(), s = _("tplUiTheme"), c = w("");
1441
+ let n = e, r = t, { t: i } = Z(), s = _("tplUiTheme"), c = w("");
1442
1442
  A(() => n.visible, (e) => {
1443
1443
  e && (c.value = "");
1444
1444
  });
@@ -1467,9 +1467,9 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1467
1467
  style: { "background-color": "var(--tpl-overlay)" },
1468
1468
  onClick: P(g, ["self"]),
1469
1469
  onKeydown: v
1470
- }, [f("div", qt, [
1471
- f("h3", Jt, D(O(i).mediaLibrary.importFromUrl), 1),
1472
- f("div", Yt, [M(f("input", {
1470
+ }, [f("div", Jt, [
1471
+ f("h3", Yt, D(O(i).mediaLibrary.importFromUrl), 1),
1472
+ f("div", Xt, [M(f("input", {
1473
1473
  "onUpdate:modelValue": n[0] ||= (e) => c.value = e,
1474
1474
  type: "url",
1475
1475
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
@@ -1481,9 +1481,9 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1481
1481
  placeholder: O(i).mediaLibrary.importUrlPlaceholder,
1482
1482
  disabled: e.isImporting,
1483
1483
  autofocus: ""
1484
- }, null, 8, Xt), [[k, c.value]])]),
1485
- e.error ? (S(), d("p", Zt, D(e.error), 1)) : u("", !0),
1486
- f("div", Qt, [f("button", {
1484
+ }, null, 8, Zt), [[k, c.value]])]),
1485
+ e.error ? (S(), d("p", Qt, D(e.error), 1)) : u("", !0),
1486
+ f("div", $t, [f("button", {
1487
1487
  class: y(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150", { "tpl:cursor-not-allowed tpl:opacity-50": e.isImporting }]),
1488
1488
  style: {
1489
1489
  "border-color": "var(--tpl-border)",
@@ -1492,25 +1492,25 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1492
1492
  },
1493
1493
  disabled: e.isImporting,
1494
1494
  onClick: g
1495
- }, D(O(i).mediaLibrary.cancel), 11, $t), f("button", {
1495
+ }, D(O(i).mediaLibrary.cancel), 11, en), f("button", {
1496
1496
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
1497
1497
  style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
1498
1498
  disabled: !c.value.trim() || e.isImporting,
1499
1499
  onClick: h
1500
- }, [e.isImporting ? (S(), d("span", tn, [m(O(H), {
1500
+ }, [e.isImporting ? (S(), d("span", nn, [m(O(U), {
1501
1501
  class: "tpl:animate-spin",
1502
1502
  size: 12,
1503
1503
  "stroke-width": 2
1504
- }), p(" " + D(O(i).mediaLibrary.importing), 1)])) : (S(), d("span", nn, D(O(i).mediaLibrary.import), 1))], 8, en)])
1505
- ])], 40, Kt)) : u("", !0)]),
1504
+ }), p(" " + D(O(i).mediaLibrary.importing), 1)])) : (S(), d("span", rn, D(O(i).mediaLibrary.import), 1))], 8, tn)])
1505
+ ])], 40, qt)) : u("", !0)]),
1506
1506
  _: 1
1507
1507
  })]));
1508
1508
  }
1509
- }), an = { class: "tpl:max-h-56 tpl:overflow-y-auto tpl:py-1" }, on = ["disabled", "onClick"], sn = { class: "tpl:truncate" }, cn = {
1509
+ }), on = { class: "tpl:max-h-56 tpl:overflow-y-auto tpl:py-1" }, sn = ["disabled", "onClick"], cn = { class: "tpl:truncate" }, ln = {
1510
1510
  key: 0,
1511
1511
  class: "tpl:shrink-0",
1512
1512
  style: { color: "var(--tpl-text-dim)" }
1513
- }, ln = /* @__PURE__ */ h({
1513
+ }, un = /* @__PURE__ */ h({
1514
1514
  __name: "MediaMovePicker",
1515
1515
  props: {
1516
1516
  folders: {},
@@ -1518,7 +1518,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1518
1518
  },
1519
1519
  emits: ["select", "close"],
1520
1520
  setup(e, { emit: t }) {
1521
- let n = t, { t: r } = Q(), a = w(null);
1521
+ let n = t, { t: r } = Z(), a = w(null);
1522
1522
  function o(e, t = 0) {
1523
1523
  let n = [];
1524
1524
  for (let r of e) n.push({
@@ -1538,7 +1538,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1538
1538
  "border-color": "var(--tpl-border)",
1539
1539
  "background-color": "var(--tpl-bg-elevated)"
1540
1540
  }
1541
- }, [f("div", an, [e.currentFolderId === null ? u("", !0) : (S(), d("button", {
1541
+ }, [f("div", on, [e.currentFolderId === null ? u("", !0) : (S(), d("button", {
1542
1542
  key: 0,
1543
1543
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-1.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors tpl:duration-100",
1544
1544
  style: { color: "var(--tpl-text)" },
@@ -1563,27 +1563,27 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1563
1563
  size: 14,
1564
1564
  "stroke-width": 1.5
1565
1565
  }),
1566
- f("span", sn, D(t.name), 1),
1567
- t.id === e.currentFolderId ? (S(), d("span", cn, D(O(r).mediaLibrary.currentFolder), 1)) : u("", !0)
1568
- ], 12, on))), 128))])], 512));
1566
+ f("span", cn, D(t.name), 1),
1567
+ t.id === e.currentFolderId ? (S(), d("span", ln, D(O(r).mediaLibrary.currentFolder), 1)) : u("", !0)
1568
+ ], 12, sn))), 128))])], 512));
1569
1569
  }
1570
- }), un = { class: "tpl:flex tpl:items-center tpl:gap-3" }, dn = ["src", "alt"], fn = {
1570
+ }), dn = { class: "tpl:flex tpl:items-center tpl:gap-3" }, fn = ["src", "alt"], pn = {
1571
1571
  key: 1,
1572
1572
  class: "tpl:flex tpl:size-10 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:overflow-hidden tpl:rounded",
1573
1573
  style: { border: "1px solid var(--tpl-border)" }
1574
- }, pn = { class: "tpl:min-w-0 tpl:flex-1" }, mn = {
1574
+ }, mn = { class: "tpl:min-w-0 tpl:flex-1" }, hn = {
1575
1575
  class: "tpl:truncate tpl:text-xs tpl:font-medium",
1576
1576
  style: { color: "var(--tpl-text)" }
1577
- }, hn = {
1577
+ }, gn = {
1578
1578
  class: "tpl:mt-0.5 tpl:text-[10px]",
1579
1579
  style: { color: "var(--tpl-text-muted)" }
1580
- }, gn = {
1580
+ }, _n = {
1581
1581
  key: 2,
1582
1582
  class: "tpl:shrink-0"
1583
- }, _n = {
1583
+ }, vn = {
1584
1584
  class: "tpl:block tpl:text-[10px]",
1585
1585
  style: { color: "var(--tpl-text-muted)" }
1586
- }, vn = ["value"], yn = ["value"], bn = /* @__PURE__ */ et(/* @__PURE__ */ h({
1586
+ }, yn = ["value"], bn = ["value"], xn = /* @__PURE__ */ tt(/* @__PURE__ */ h({
1587
1587
  __name: "MediaPreviewPanel",
1588
1588
  props: {
1589
1589
  item: {},
@@ -1592,7 +1592,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1592
1592
  },
1593
1593
  emits: ["update:selectedConversion"],
1594
1594
  setup(e, { emit: t }) {
1595
- let n = e, r = t, { t: a } = Q(), { isImageMimeType: o } = he(), c = s(() => {
1595
+ let n = e, r = t, { t: a } = Z(), { isImageMimeType: o } = Q(), c = s(() => {
1596
1596
  if (!b.value || !n.item.conversions_generated) return [];
1597
1597
  let e = [];
1598
1598
  return n.item.small_url && e.push({
@@ -1651,20 +1651,20 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1651
1651
  day: "numeric"
1652
1652
  });
1653
1653
  }
1654
- return (t, n) => (S(), d("div", un, [
1654
+ return (t, n) => (S(), d("div", dn, [
1655
1655
  b.value ? (S(), d("img", {
1656
1656
  key: 0,
1657
1657
  src: h.value ?? void 0,
1658
1658
  alt: e.item.alt_text || e.item.filename,
1659
1659
  class: "tpl:size-10 tpl:shrink-0 tpl:rounded tpl:object-cover",
1660
1660
  style: { border: "1px solid var(--tpl-border)" }
1661
- }, null, 8, dn)) : (S(), d("div", fn, [m(gt, {
1661
+ }, null, 8, fn)) : (S(), d("div", pn, [m(_t, {
1662
1662
  "mime-type": e.item.mime_type,
1663
1663
  class: "tpl-preview-icon"
1664
1664
  }, null, 8, ["mime-type"])])),
1665
- f("div", pn, [
1666
- f("p", mn, D(e.item.filename), 1),
1667
- f("p", hn, [
1665
+ f("div", mn, [
1666
+ f("p", hn, D(e.item.filename), 1),
1667
+ f("p", gn, [
1668
1668
  p(D(x(e.item.size)) + " · " + D(C(e.item.created_at)) + " ", 1),
1669
1669
  b.value && e.item.width && e.item.height ? (S(), d(i, { key: 0 }, [p(" · " + D(e.item.width) + "×" + D(e.item.height) + "px ", 1)], 64)) : u("", !0),
1670
1670
  v.value ? (S(), d(i, { key: 1 }, [
@@ -1683,7 +1683,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1683
1683
  style: { color: "var(--tpl-text-dim)" }
1684
1684
  }, D(e.item.alt_text || "\xA0"), 3)) : u("", !0)
1685
1685
  ]),
1686
- l.value ? (S(), d("div", gn, [f("label", _n, D(O(a).mediaLibrary.conversionLabel), 1), f("select", {
1686
+ l.value ? (S(), d("div", _n, [f("label", vn, D(O(a).mediaLibrary.conversionLabel), 1), f("select", {
1687
1687
  class: "tpl:mt-0.5 tpl:rounded-md tpl:border tpl:py-1 tpl:pr-6 tpl:pl-2 tpl:text-xs tpl:outline-none",
1688
1688
  style: {
1689
1689
  "border-color": "var(--tpl-border)",
@@ -1695,36 +1695,36 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1695
1695
  }, [(S(!0), d(i, null, T(c.value, (e) => (S(), d("option", {
1696
1696
  key: e.value,
1697
1697
  value: e.value
1698
- }, D(e.label), 9, yn))), 128))], 40, vn)])) : u("", !0)
1698
+ }, D(e.label), 9, bn))), 128))], 40, yn)])) : u("", !0)
1699
1699
  ]));
1700
1700
  }
1701
- }), [["__scopeId", "data-v-060e36cd"]]), xn = ["data-tpl-theme"], Sn = {
1701
+ }), [["__scopeId", "data-v-060e36cd"]]), Sn = ["data-tpl-theme"], Cn = {
1702
1702
  class: "tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-lg tpl:p-5 tpl:shadow-xl",
1703
1703
  style: { "background-color": "var(--tpl-bg-elevated)" }
1704
- }, Cn = {
1704
+ }, wn = {
1705
1705
  class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
1706
1706
  style: { color: "var(--tpl-text)" }
1707
- }, wn = {
1707
+ }, Tn = {
1708
1708
  class: "tpl:mb-2 tpl:text-xs",
1709
1709
  style: { color: "var(--tpl-text-muted)" }
1710
- }, Tn = {
1710
+ }, En = {
1711
1711
  key: 0,
1712
1712
  class: "tpl:mb-3 tpl:text-xs",
1713
1713
  style: { color: "var(--tpl-warning)" }
1714
- }, En = {
1714
+ }, Dn = {
1715
1715
  class: "tpl:mb-3 tpl:rounded tpl:border tpl:p-2",
1716
1716
  style: { "border-color": "var(--tpl-border)" }
1717
- }, Dn = {
1717
+ }, On = {
1718
1718
  class: "tpl:truncate tpl:text-xs tpl:font-medium",
1719
1719
  style: { color: "var(--tpl-text)" }
1720
- }, On = { class: "tpl:mb-4" }, kn = {
1720
+ }, kn = { class: "tpl:mb-4" }, An = {
1721
1721
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
1722
1722
  style: { color: "var(--tpl-text-muted)" }
1723
- }, An = ["accept"], jn = {
1723
+ }, jn = ["accept"], Mn = {
1724
1724
  key: 1,
1725
1725
  class: "tpl:mb-3 tpl:text-xs",
1726
1726
  style: { color: "var(--tpl-danger)" }
1727
- }, Mn = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Nn = ["disabled"], Pn = ["disabled"], Fn = /* @__PURE__ */ h({
1727
+ }, Nn = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Pn = ["disabled"], Fn = ["disabled"], In = /* @__PURE__ */ h({
1728
1728
  __name: "MediaReplaceModal",
1729
1729
  props: {
1730
1730
  visible: { type: Boolean },
@@ -1735,7 +1735,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1735
1735
  },
1736
1736
  emits: ["replace", "close"],
1737
1737
  setup(e, { emit: t }) {
1738
- let n = e, r = t, { t: i } = Q(), c = _("tplUiTheme"), p = w(null), h = w(null), g = s(() => {
1738
+ let n = e, r = t, { t: i } = Z(), c = _("tplUiTheme"), p = w(null), h = w(null), g = s(() => {
1739
1739
  if (!n.item) return "";
1740
1740
  let e = n.item.filename.split(".");
1741
1741
  return e.length > 1 ? e[e.length - 1].toLowerCase() : "";
@@ -1768,12 +1768,12 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1768
1768
  style: { "background-color": "var(--tpl-overlay)" },
1769
1769
  onClick: n[1] ||= P((e) => r("close"), ["self"]),
1770
1770
  onKeydown: C
1771
- }, [f("div", Sn, [
1772
- f("h3", Cn, D(O(i).mediaLibrary.replaceWarningTitle), 1),
1773
- f("p", wn, D(O(i).mediaLibrary.replaceWarningMessage.replace("{extension}", `.${g.value}`)), 1),
1774
- y.value ? (S(), d("p", Tn, D(O(i).mediaLibrary.replaceWarningUsageNote.replace("{count}", e.usageInfo.template_count.toString())), 1)) : u("", !0),
1775
- f("div", En, [f("p", Dn, D(e.item.filename), 1)]),
1776
- f("div", On, [f("label", kn, D(O(i).mediaLibrary.replaceSelectFile), 1), f("input", {
1771
+ }, [f("div", Cn, [
1772
+ f("h3", wn, D(O(i).mediaLibrary.replaceWarningTitle), 1),
1773
+ f("p", Tn, D(O(i).mediaLibrary.replaceWarningMessage.replace("{extension}", `.${g.value}`)), 1),
1774
+ y.value ? (S(), d("p", En, D(O(i).mediaLibrary.replaceWarningUsageNote.replace("{count}", e.usageInfo.template_count.toString())), 1)) : u("", !0),
1775
+ f("div", Dn, [f("p", On, D(e.item.filename), 1)]),
1776
+ f("div", kn, [f("label", An, D(O(i).mediaLibrary.replaceSelectFile), 1), f("input", {
1777
1777
  ref_key: "fileInputRef",
1778
1778
  ref: p,
1779
1779
  type: "file",
@@ -1785,9 +1785,9 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1785
1785
  color: "var(--tpl-text)"
1786
1786
  },
1787
1787
  onChange: b
1788
- }, null, 40, An)]),
1789
- e.error ? (S(), d("p", jn, D(e.error), 1)) : u("", !0),
1790
- f("div", Mn, [f("button", {
1788
+ }, null, 40, jn)]),
1789
+ e.error ? (S(), d("p", Mn, D(e.error), 1)) : u("", !0),
1790
+ f("div", Nn, [f("button", {
1791
1791
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
1792
1792
  style: {
1793
1793
  "border-color": "var(--tpl-border)",
@@ -1796,29 +1796,29 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1796
1796
  },
1797
1797
  disabled: e.isReplacing,
1798
1798
  onClick: n[0] ||= (e) => r("close")
1799
- }, D(O(i).mediaLibrary.cancel), 9, Nn), f("button", {
1799
+ }, D(O(i).mediaLibrary.cancel), 9, Pn), f("button", {
1800
1800
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
1801
1801
  style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
1802
1802
  disabled: !h.value || e.isReplacing,
1803
1803
  onClick: x
1804
- }, D(e.isReplacing ? O(i).mediaLibrary.replacing : O(i).mediaLibrary.replace), 9, Pn)])
1805
- ])], 40, xn)) : u("", !0)]),
1804
+ }, D(e.isReplacing ? O(i).mediaLibrary.replacing : O(i).mediaLibrary.replace), 9, Fn)])
1805
+ ])], 40, Sn)) : u("", !0)]),
1806
1806
  _: 1
1807
1807
  })]));
1808
1808
  }
1809
- }), In = {
1809
+ }), Ln = {
1810
1810
  key: 0,
1811
1811
  class: "tpl:flex tpl:items-center tpl:gap-2"
1812
- }, Ln = {
1813
- class: "tpl:text-xs",
1814
- style: { color: "var(--tpl-text-muted)" }
1815
1812
  }, Rn = {
1816
1813
  class: "tpl:text-xs",
1817
1814
  style: { color: "var(--tpl-text-muted)" }
1818
1815
  }, zn = {
1816
+ class: "tpl:text-xs",
1817
+ style: { color: "var(--tpl-text-muted)" }
1818
+ }, Bn = {
1819
1819
  class: "tpl:mt-1 tpl:text-[10px]",
1820
1820
  style: { color: "var(--tpl-text-dim)" }
1821
- }, Bn = /* @__PURE__ */ h({
1821
+ }, Vn = /* @__PURE__ */ h({
1822
1822
  __name: "MediaUploadZone",
1823
1823
  props: {
1824
1824
  isUploading: { type: Boolean },
@@ -1826,7 +1826,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1826
1826
  },
1827
1827
  emits: ["upload"],
1828
1828
  setup(e, { emit: t }) {
1829
- let n = t, { t: r, format: a } = Q(), { allAcceptedMimeTypes: o, allAcceptedInputString: s, maxFileSize: c } = he(), l = w();
1829
+ let n = t, { t: r, format: a } = Z(), { allAcceptedMimeTypes: o, allAcceptedInputString: s, maxFileSize: c } = Q(), l = w();
1830
1830
  function u(e) {
1831
1831
  let t = [];
1832
1832
  for (let n of Array.from(e)) o.value.includes(n.type) && n.size <= c.value && t.push(n);
@@ -1838,7 +1838,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1838
1838
  }
1839
1839
  let { isOverDropZone: h } = oe(l, { onDrop: (e) => {
1840
1840
  e?.length && p(e);
1841
- } }), { open: g, onChange: _ } = Z({
1841
+ } }), { open: g, onChange: _ } = ce({
1842
1842
  accept: s.value,
1843
1843
  multiple: !0
1844
1844
  });
@@ -1853,12 +1853,12 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1853
1853
  "background-color": "var(--tpl-bg)"
1854
1854
  },
1855
1855
  onClick: n[0] ||= (e) => O(g)()
1856
- }, [e.isUploading ? (S(), d("div", In, [m(O(H), {
1856
+ }, [e.isUploading ? (S(), d("div", Ln, [m(O(U), {
1857
1857
  class: "tpl-spinner",
1858
1858
  size: 20,
1859
1859
  "stroke-width": 2,
1860
1860
  style: { color: "var(--tpl-primary)" }
1861
- }), f("span", Ln, D(e.uploadProgress && e.uploadProgress.total > 1 ? O(a)(O(r).mediaLibrary.uploadingProgress, {
1861
+ }), f("span", Rn, D(e.uploadProgress && e.uploadProgress.total > 1 ? O(a)(O(r).mediaLibrary.uploadingProgress, {
1862
1862
  current: e.uploadProgress.current,
1863
1863
  total: e.uploadProgress.total
1864
1864
  }) : O(r).mediaLibrary.uploading), 1)])) : (S(), d(i, { key: 1 }, [
@@ -1868,20 +1868,20 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1868
1868
  "stroke-width": 1.5,
1869
1869
  style: { color: "var(--tpl-text-dim)" }
1870
1870
  }),
1871
- f("p", Rn, D(O(r).mediaLibrary.dropOrClick), 1),
1872
- f("p", zn, D(O(r).mediaLibrary.acceptedFormats), 1)
1871
+ f("p", zn, D(O(r).mediaLibrary.dropOrClick), 1),
1872
+ f("p", Bn, D(O(r).mediaLibrary.acceptedFormats), 1)
1873
1873
  ], 64))], 2));
1874
1874
  }
1875
- }), Vn = [
1875
+ }), Hn = [
1876
1876
  "width",
1877
1877
  "height",
1878
1878
  "viewBox"
1879
- ], Hn = [
1879
+ ], Un = [
1880
1880
  "cx",
1881
1881
  "cy",
1882
1882
  "r",
1883
1883
  "stroke-width"
1884
- ], Un = [
1884
+ ], Wn = [
1885
1885
  "cx",
1886
1886
  "cy",
1887
1887
  "r",
@@ -1889,14 +1889,14 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1889
1889
  "stroke",
1890
1890
  "stroke-dasharray",
1891
1891
  "stroke-dashoffset"
1892
- ], Wn = {
1892
+ ], Gn = {
1893
1893
  key: 0,
1894
1894
  class: "tpl:absolute tpl:top-full tpl:left-1/2 tpl:z-50 tpl:mt-2 tpl:-translate-x-1/2 tpl:rounded-md tpl:px-2.5 tpl:py-1.5 tpl:text-xs tpl:whitespace-nowrap tpl:shadow-lg",
1895
1895
  style: {
1896
1896
  "background-color": "var(--tpl-text)",
1897
1897
  color: "var(--tpl-bg-elevated)"
1898
1898
  }
1899
- }, Gn = /* @__PURE__ */ h({
1899
+ }, Kn = /* @__PURE__ */ h({
1900
1900
  __name: "StorageProgressRing",
1901
1901
  props: {
1902
1902
  usedBytes: {},
@@ -1904,7 +1904,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1904
1904
  size: {}
1905
1905
  },
1906
1906
  setup(e) {
1907
- let t = e, { t: n, format: r } = Q(), i = w(!1), a = s(() => t.size ?? 24), c = s(() => Math.max(2, a.value / 8)), l = s(() => (a.value - c.value) / 2), h = s(() => 2 * Math.PI * l.value), g = s(() => t.limitBytes <= 0 ? 0 : Math.min(100, t.usedBytes / t.limitBytes * 100)), _ = s(() => h.value - g.value / 100 * h.value), v = s(() => g.value >= 95 ? "var(--tpl-danger)" : g.value >= 75 ? "var(--tpl-warning, #f59e0b)" : "var(--tpl-primary)");
1907
+ let t = e, { t: n, format: r } = Z(), i = w(!1), a = s(() => t.size ?? 24), c = s(() => Math.max(2, a.value / 8)), l = s(() => (a.value - c.value) / 2), h = s(() => 2 * Math.PI * l.value), g = s(() => t.limitBytes <= 0 ? 0 : Math.min(100, t.usedBytes / t.limitBytes * 100)), _ = s(() => h.value - g.value / 100 * h.value), v = s(() => g.value >= 95 ? "var(--tpl-danger)" : g.value >= 75 ? "var(--tpl-warning, #f59e0b)" : "var(--tpl-primary)");
1908
1908
  function y(e) {
1909
1909
  if (e === 0) return "0 B";
1910
1910
  let t = 1024, n = [
@@ -1936,7 +1936,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1936
1936
  fill: "none",
1937
1937
  "stroke-width": c.value,
1938
1938
  style: { stroke: "var(--tpl-border)" }
1939
- }, null, 8, Hn), f("circle", {
1939
+ }, null, 8, Un), f("circle", {
1940
1940
  cx: a.value / 2,
1941
1941
  cy: a.value / 2,
1942
1942
  r: l.value,
@@ -1947,7 +1947,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1947
1947
  "stroke-dasharray": h.value,
1948
1948
  "stroke-dashoffset": _.value,
1949
1949
  class: "tpl:transition-all tpl:duration-300 tpl:ease-out"
1950
- }, null, 8, Un)], 8, Vn)), m(o, {
1950
+ }, null, 8, Wn)], 8, Hn)), m(o, {
1951
1951
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
1952
1952
  "enter-from-class": "tpl:opacity-0 tpl:translate-y-1",
1953
1953
  "enter-to-class": "tpl:opacity-100 tpl:translate-y-0",
@@ -1955,14 +1955,127 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1955
1955
  "leave-from-class": "tpl:opacity-100 tpl:translate-y-0",
1956
1956
  "leave-to-class": "tpl:opacity-0 tpl:translate-y-1"
1957
1957
  }, {
1958
- default: j(() => [i.value ? (S(), d("div", Wn, [p(D(E.value) + " ", 1), t[2] ||= f("div", {
1958
+ default: j(() => [i.value ? (S(), d("div", Gn, [p(D(E.value) + " ", 1), t[2] ||= f("div", {
1959
1959
  class: "tpl:absolute tpl:-top-1 tpl:left-1/2 tpl:size-2 tpl:-translate-x-1/2 tpl:rotate-45",
1960
1960
  style: { "background-color": "var(--tpl-text)" }
1961
1961
  }, null, -1)])) : u("", !0)]),
1962
1962
  _: 1
1963
1963
  })], 32));
1964
1964
  }
1965
- }), Kn = ["data-tpl-theme"], qn = {
1965
+ });
1966
+ //#endregion
1967
+ //#region src/composables/useMediaLibraryUI.ts
1968
+ function qn(e) {
1969
+ let { library: t, canUseMediaFolders: n, translations: r } = e;
1970
+ function i() {
1971
+ return "value" in r && typeof r.value == "object" ? r.value : r;
1972
+ }
1973
+ let a = w("grid"), o = w(!1), c = w(""), l = w("original"), u = w(null), d = w(!1), f = w(!1), p = s(() => {
1974
+ let e = t.previewItem.value;
1975
+ if (!e) return null;
1976
+ switch (l.value) {
1977
+ case "small": return e.small_url || e.url;
1978
+ case "medium": return e.medium_url || e.url;
1979
+ case "large": return e.large_url || e.url;
1980
+ default: return e.url;
1981
+ }
1982
+ }), m = s(() => t.frequentlyUsedItems.value.length > 0), h = s(() => t.viewMode.value === "frequently-used" ? t.frequentlyUsedItems.value : t.items.value), g = s(() => Object.values(t.deleteUsageInfo.value).some((e) => e.template_count > 0)), _ = {
1983
+ images: () => i().mediaLibrary.filterImages,
1984
+ documents: () => i().mediaLibrary.filterDocuments,
1985
+ videos: () => i().mediaLibrary.filterVideos,
1986
+ audio: () => i().mediaLibrary.filterAudio
1987
+ };
1988
+ function v(e) {
1989
+ return _[e]?.() ?? e;
1990
+ }
1991
+ A(o, (e) => {
1992
+ e && n.value && t.loadFolders();
1993
+ }), A(() => t.previewItem.value?.id, () => {
1994
+ l.value = "original";
1995
+ });
1996
+ let y = ae((e) => {
1997
+ t.search(e);
1998
+ }, 300);
1999
+ function b(e) {
2000
+ c.value = e, y(e);
2001
+ }
2002
+ let { copy: x, copied: S } = ie({
2003
+ copiedDuring: 2e3,
2004
+ legacy: !0
2005
+ });
2006
+ async function C(e) {
2007
+ await t.uploadFiles(e);
2008
+ }
2009
+ function T(e) {
2010
+ t.selectItem(e);
2011
+ }
2012
+ async function E(e, n) {
2013
+ await t.createFolder(e, n);
2014
+ }
2015
+ async function D(e, n) {
2016
+ await t.renameFolder(e, n);
2017
+ }
2018
+ async function O(e) {
2019
+ await t.deleteFolder(e);
2020
+ }
2021
+ function k(e) {
2022
+ u.value = e;
2023
+ }
2024
+ async function j(e, n, r, i) {
2025
+ i && await t.replaceMediaDirectly(e, i.file), await t.updateFile(e, n, r), u.value = null;
2026
+ }
2027
+ async function M(e) {
2028
+ await t.importFromUrl(e) && (d.value = !1);
2029
+ }
2030
+ async function N(e) {
2031
+ f.value = !1, await t.moveSelected(e);
2032
+ }
2033
+ async function P() {
2034
+ await t.checkUsageBeforeDelete();
2035
+ }
2036
+ function F(e) {
2037
+ t.checkUsageBeforeReplace(e);
2038
+ }
2039
+ async function I(e) {
2040
+ await t.replaceFile(e);
2041
+ }
2042
+ function L() {
2043
+ t.clearSelection(), t.cancelDelete(), t.cancelReplace(), c.value = "", t.categoryFilter.value = null, t.sortOption.value = "newest", t.viewMode.value = "files", u.value = null, d.value = !1, l.value = "original";
2044
+ }
2045
+ return {
2046
+ layoutMode: a,
2047
+ showSidebar: o,
2048
+ searchInput: c,
2049
+ selectedConversion: l,
2050
+ editingItem: u,
2051
+ showImportUrlModal: d,
2052
+ showMovePicker: f,
2053
+ selectedUrl: p,
2054
+ hasFrequentlyUsed: m,
2055
+ displayItems: h,
2056
+ hasUsedFiles: g,
2057
+ copy: x,
2058
+ copied: S,
2059
+ getCategoryLabel: v,
2060
+ handleSearchInput: b,
2061
+ handleUpload: C,
2062
+ handleSelect: T,
2063
+ handleCreateFolder: E,
2064
+ handleRenameFolder: D,
2065
+ handleDeleteFolder: O,
2066
+ handleEditItem: k,
2067
+ handleEditSave: j,
2068
+ handleImportFromUrl: M,
2069
+ handleMoveToFolder: N,
2070
+ handleDeleteClick: P,
2071
+ handleReplaceItem: F,
2072
+ handleReplaceFile: I,
2073
+ resetUI: L
2074
+ };
2075
+ }
2076
+ //#endregion
2077
+ //#region src/components/MediaLibraryModal.vue?vue&type=script&setup=true&lang.ts
2078
+ var Jn = ["data-tpl-theme"], Yn = {
1966
2079
  class: "tpl-media-modal tpl-scale-in tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
1967
2080
  style: {
1968
2081
  width: "900px",
@@ -1973,62 +2086,62 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
1973
2086
  border: "1px solid var(--tpl-border)",
1974
2087
  "box-shadow": "var(--tpl-shadow-xl)"
1975
2088
  }
1976
- }, Jn = {
2089
+ }, Xn = {
1977
2090
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
1978
2091
  style: { "border-color": "var(--tpl-border)" }
1979
- }, Yn = {
2092
+ }, Zn = {
1980
2093
  class: "tpl:text-sm tpl:font-semibold",
1981
2094
  style: { color: "var(--tpl-text)" }
1982
- }, Xn = { class: "tpl:flex tpl:items-center tpl:gap-3" }, Zn = { class: "tpl:relative" }, Qn = ["value", "placeholder"], $n = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, er = {
2095
+ }, Qn = { class: "tpl:flex tpl:items-center tpl:gap-3" }, $n = { class: "tpl:relative" }, er = ["value", "placeholder"], tr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, nr = {
1983
2096
  key: 0,
1984
2097
  class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
1985
2098
  style: {
1986
2099
  "border-color": "var(--tpl-border)",
1987
2100
  "background-color": "var(--tpl-bg)"
1988
2101
  }
1989
- }, tr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, nr = {
2102
+ }, rr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, ir = {
1990
2103
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
1991
2104
  style: { "border-color": "var(--tpl-border)" }
1992
- }, rr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ir = ["title"], ar = {
2105
+ }, ar = { class: "tpl:flex tpl:items-center tpl:gap-2" }, or = ["title"], sr = {
1993
2106
  key: 1,
1994
2107
  class: "tpl:text-xs tpl:font-medium",
1995
2108
  style: { color: "var(--tpl-text)" }
1996
- }, or = {
2109
+ }, cr = {
1997
2110
  class: "tpl:flex tpl:rounded-md tpl:p-0.5",
1998
2111
  style: {
1999
2112
  border: "1px solid var(--tpl-border)",
2000
2113
  "background-color": "var(--tpl-bg)"
2001
2114
  }
2002
- }, sr = ["title"], cr = ["title"], lr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ur = ["value"], dr = { value: "" }, fr = ["value"], pr = ["value"], mr = { value: "newest" }, hr = { value: "oldest" }, gr = { value: "name_asc" }, _r = { value: "name_desc" }, vr = { value: "size_asc" }, yr = { value: "size_desc" }, br = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, xr = {
2115
+ }, lr = ["title"], ur = ["title"], dr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, fr = ["value"], pr = { value: "" }, mr = ["value"], hr = ["value"], gr = { value: "newest" }, _r = { value: "oldest" }, vr = { value: "name_asc" }, yr = { value: "name_desc" }, br = { value: "size_asc" }, xr = { value: "size_desc" }, Sr = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, Cr = {
2003
2116
  key: 0,
2004
2117
  class: "tpl:px-4 tpl:pt-3"
2005
- }, Sr = {
2118
+ }, wr = {
2006
2119
  class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
2007
2120
  style: {
2008
2121
  "background-color": "var(--tpl-bg-elevated)",
2009
2122
  "box-shadow": "var(--tpl-shadow-xl)"
2010
2123
  }
2011
- }, Cr = {
2124
+ }, Tr = {
2012
2125
  class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
2013
2126
  style: { color: "var(--tpl-text)" }
2014
- }, wr = {
2127
+ }, Er = {
2015
2128
  key: 0,
2016
2129
  class: "tpl:mb-4 tpl:text-xs",
2017
2130
  style: { color: "var(--tpl-text-muted)" }
2018
- }, Tr = {
2131
+ }, Dr = {
2019
2132
  key: 1,
2020
2133
  class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
2021
2134
  style: { "border-color": "var(--tpl-border)" }
2022
- }, Er = { class: "tpl:font-medium" }, Dr = { style: { color: "var(--tpl-text-muted)" } }, Or = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, kr = {
2135
+ }, Or = { class: "tpl:font-medium" }, kr = { style: { color: "var(--tpl-text-muted)" } }, Ar = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, jr = {
2023
2136
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
2024
2137
  style: { "border-color": "var(--tpl-border)" }
2025
- }, Ar = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, jr = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Mr = {
2138
+ }, Mr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Nr = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Pr = {
2026
2139
  key: 0,
2027
2140
  class: "tpl:flex tpl:items-center tpl:gap-2"
2028
- }, Nr = {
2141
+ }, Fr = {
2029
2142
  key: 1,
2030
2143
  class: "tpl:relative"
2031
- }, Pr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Fr = ["disabled"], Ir = /* @__PURE__ */ h({
2144
+ }, Ir = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Lr = ["disabled"], Rr = /* @__PURE__ */ h({
2032
2145
  __name: "MediaLibraryModal",
2033
2146
  props: {
2034
2147
  visible: { type: Boolean },
@@ -2036,99 +2149,34 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2036
2149
  },
2037
2150
  emits: ["close", "select"],
2038
2151
  setup(e, { emit: t }) {
2039
- let n = e, r = t, { t: c } = Q(), h = _("tplUiTheme"), g = _("authManager"), v = _("projectId"), x = s(() => v.value), C = _("planConfig"), E = s(() => C.hasFeature("media_folders")), k = s(() => C.hasFeature("import_from_url")), M = s(() => C.config.value?.storage.used_bytes ?? 0), N = s(() => C.config.value?.storage.limit_bytes ?? 0), { isAcceptedMimeType: I, availableCategories: R } = he(), z = {
2040
- images: () => c.mediaLibrary.filterImages,
2041
- documents: () => c.mediaLibrary.filterDocuments,
2042
- videos: () => c.mediaLibrary.filterVideos,
2043
- audio: () => c.mediaLibrary.filterAudio
2044
- };
2045
- function H(e) {
2046
- return z[e]?.() ?? e;
2047
- }
2048
- let W = w("grid"), G = w(!1), K = w(""), J = w("original"), Y = ue({
2152
+ let n = e, r = t, { t: c } = Z(), h = _("tplUiTheme"), g = _("authManager"), v = _("projectId"), x = s(() => v.value), C = _("planConfig"), w = s(() => C.hasFeature("media_folders")), E = s(() => C.hasFeature("import_from_url")), k = s(() => C.config.value?.storage.used_bytes ?? 0), M = s(() => C.config.value?.storage.limit_bytes ?? 0), { isAcceptedMimeType: N, availableCategories: I } = Q(), R = de({
2049
2153
  projectId: x.value,
2050
2154
  authManager: g
2051
- }), X = s(() => {
2052
- let e = Y.previewItem.value;
2053
- if (!e) return null;
2054
- switch (J.value) {
2055
- case "small": return e.small_url || e.url;
2056
- case "medium": return e.medium_url || e.url;
2057
- case "large": return e.large_url || e.url;
2058
- default: return e.url;
2059
- }
2060
- }), ne = s(() => Y.frequentlyUsedItems.value.length > 0), re = s(() => Y.viewMode.value === "frequently-used" ? Y.frequentlyUsedItems.value : Y.items.value), oe = s(() => Object.values(Y.deleteUsageInfo.value).some((e) => e.template_count > 0));
2155
+ }), z = qn({
2156
+ library: R,
2157
+ canUseMediaFolders: w,
2158
+ translations: c
2159
+ });
2061
2160
  A(() => n.visible, (e) => {
2062
- e ? (Y.loadItems(), Y.loadFrequentlyUsed()) : (Y.clearSelection(), Y.cancelDelete(), Y.cancelReplace(), K.value = "", Y.categoryFilter.value = null, Y.sortOption.value = "newest", Y.viewMode.value = "files", $.value = null, we.value = !1, J.value = "original");
2063
- }), A(G, (e) => {
2064
- e && E.value && Y.loadFolders();
2065
- }), A(() => Y.previewItem.value?.id, () => {
2066
- J.value = "original";
2161
+ e ? (R.loadItems(), R.loadFrequentlyUsed()) : z.resetUI();
2067
2162
  });
2068
- let Z = ae((e) => {
2069
- Y.search(e);
2070
- }, 300);
2071
- function ce(e) {
2072
- K.value = e, Z(e);
2073
- }
2074
- function le(e) {
2163
+ function U(e) {
2075
2164
  e.key === "Escape" && r("close");
2076
2165
  }
2077
- async function de(e) {
2078
- await Y.uploadFiles(e);
2079
- }
2080
- function fe(e) {
2081
- Y.selectItem(e);
2166
+ se(document, "keydown", U);
2167
+ function G() {
2168
+ return R.previewItem.value ? n.accept?.length ? N(R.previewItem.value.mime_type, n.accept) : !0 : !1;
2082
2169
  }
2083
- function pe() {
2084
- return Y.previewItem.value ? n.accept?.length ? I(Y.previewItem.value.mime_type, n.accept) : !0 : !1;
2085
- }
2086
- function ge() {
2087
- if (pe()) {
2088
- let e = Y.previewItem.value;
2170
+ function K() {
2171
+ if (G()) {
2172
+ let e = R.previewItem.value;
2089
2173
  r("select", {
2090
2174
  ...e,
2091
- url: X.value || e.url
2175
+ url: z.selectedUrl.value || e.url
2092
2176
  }), r("close");
2093
2177
  }
2094
2178
  }
2095
- async function _e(e, t) {
2096
- await Y.createFolder(e, t);
2097
- }
2098
- async function ve(e, t) {
2099
- await Y.renameFolder(e, t);
2100
- }
2101
- async function ye(e) {
2102
- await Y.deleteFolder(e);
2103
- }
2104
- let $ = w(null);
2105
- function be(e) {
2106
- $.value = e;
2107
- }
2108
- async function xe(e, t, n, r) {
2109
- r && await Y.replaceMediaDirectly(e, r.file), await Y.updateFile(e, t, n), $.value = null;
2110
- }
2111
- let { copy: Se, copied: Ce } = ie({
2112
- copiedDuring: 2e3,
2113
- legacy: !0
2114
- }), we = w(!1);
2115
- async function Te(e) {
2116
- await Y.importFromUrl(e) && (we.value = !1);
2117
- }
2118
- let Ee = w(!1);
2119
- async function De(e) {
2120
- Ee.value = !1, await Y.moveSelected(e);
2121
- }
2122
- async function Oe() {
2123
- await Y.checkUsageBeforeDelete();
2124
- }
2125
- function ke(e) {
2126
- Y.checkUsageBeforeReplace(e);
2127
- }
2128
- async function Ae(e) {
2129
- await Y.replaceFile(e);
2130
- }
2131
- return se(document, "keydown", le), (t, n) => (S(), l(a, { to: "body" }, [m(o, {
2179
+ return (t, n) => (S(), l(a, { to: "body" }, [m(o, {
2132
2180
  "enter-active-class": "tpl:transition tpl:duration-200",
2133
2181
  "enter-from-class": "tpl:opacity-0",
2134
2182
  "enter-to-class": "tpl:opacity-100",
@@ -2140,16 +2188,16 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2140
2188
  key: 0,
2141
2189
  "data-tpl-theme": O(h),
2142
2190
  class: "tpl tpl-media-overlay tpl:fixed tpl:inset-0 tpl:z-[9999]",
2143
- onClick: n[17] ||= P((e) => r("close"), ["self"])
2144
- }, [f("div", qn, [
2145
- f("div", Jn, [f("h2", Yn, D(O(c).mediaLibrary.title), 1), f("div", Xn, [
2146
- m(Gn, {
2147
- "used-bytes": M.value,
2148
- "limit-bytes": N.value,
2191
+ onClick: n[18] ||= P((e) => r("close"), ["self"])
2192
+ }, [f("div", Yn, [
2193
+ f("div", Xn, [f("h2", Zn, D(O(c).mediaLibrary.title), 1), f("div", Qn, [
2194
+ m(Kn, {
2195
+ "used-bytes": k.value,
2196
+ "limit-bytes": M.value,
2149
2197
  size: 22
2150
2198
  }, null, 8, ["used-bytes", "limit-bytes"]),
2151
- f("div", Zn, [f("input", {
2152
- value: K.value,
2199
+ f("div", $n, [f("input", {
2200
+ value: O(z).searchInput.value,
2153
2201
  type: "text",
2154
2202
  class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)]",
2155
2203
  style: {
@@ -2158,8 +2206,8 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2158
2206
  color: "var(--tpl-text)"
2159
2207
  },
2160
2208
  placeholder: O(c).mediaLibrary.searchPlaceholder,
2161
- onInput: n[0] ||= (e) => ce(e.target.value)
2162
- }, null, 40, Qn), m(O(q), {
2209
+ onInput: n[0] ||= (e) => O(z).handleSearchInput(e.target.value)
2210
+ }, null, 40, er), m(O(J), {
2163
2211
  class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
2164
2212
  size: 13,
2165
2213
  "stroke-width": 2,
@@ -2174,7 +2222,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2174
2222
  "stroke-width": 2
2175
2223
  })])
2176
2224
  ])]),
2177
- f("div", $n, [m(o, {
2225
+ f("div", tr, [m(o, {
2178
2226
  "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
2179
2227
  "enter-from-class": "tpl:-ml-48 tpl:opacity-0",
2180
2228
  "enter-to-class": "tpl:ml-0 tpl:opacity-100",
@@ -2182,74 +2230,77 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2182
2230
  "leave-from-class": "tpl:ml-0 tpl:opacity-100",
2183
2231
  "leave-to-class": "tpl:-ml-48 tpl:opacity-0"
2184
2232
  }, {
2185
- default: j(() => [E.value && G.value ? (S(), d("div", er, [m(mt, {
2186
- folders: O(Y).folders.value,
2187
- "current-folder-id": O(Y).currentFolderId.value,
2188
- "view-mode": O(Y).viewMode.value,
2189
- "has-frequently-used": ne.value,
2190
- onNavigate: O(Y).navigateToFolder,
2191
- onCreateFolder: _e,
2192
- onRenameFolder: ve,
2193
- onDeleteFolder: ye,
2194
- onShowFrequentlyUsed: O(Y).showFrequentlyUsed
2233
+ default: j(() => [w.value && O(z).showSidebar.value ? (S(), d("div", nr, [m(ht, {
2234
+ folders: O(R).folders.value,
2235
+ "current-folder-id": O(R).currentFolderId.value,
2236
+ "view-mode": O(R).viewMode.value,
2237
+ "has-frequently-used": O(z).hasFrequentlyUsed.value,
2238
+ onNavigate: O(R).navigateToFolder,
2239
+ onCreateFolder: O(z).handleCreateFolder,
2240
+ onRenameFolder: O(z).handleRenameFolder,
2241
+ onDeleteFolder: O(z).handleDeleteFolder,
2242
+ onShowFrequentlyUsed: O(R).showFrequentlyUsed
2195
2243
  }, null, 8, [
2196
2244
  "folders",
2197
2245
  "current-folder-id",
2198
2246
  "view-mode",
2199
2247
  "has-frequently-used",
2200
2248
  "onNavigate",
2249
+ "onCreateFolder",
2250
+ "onRenameFolder",
2251
+ "onDeleteFolder",
2201
2252
  "onShowFrequentlyUsed"
2202
2253
  ])])) : u("", !0)]),
2203
2254
  _: 1
2204
- }), f("div", tr, [f("div", nr, [f("div", rr, [
2205
- E.value ? (S(), d("button", {
2255
+ }), f("div", rr, [f("div", ir, [f("div", ar, [
2256
+ w.value ? (S(), d("button", {
2206
2257
  key: 0,
2207
2258
  class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
2208
2259
  style: b({
2209
- color: G.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2210
- backgroundColor: G.value ? "var(--tpl-bg)" : "transparent",
2211
- border: G.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2260
+ color: O(z).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2261
+ backgroundColor: O(z).showSidebar.value ? "var(--tpl-bg)" : "transparent",
2262
+ border: O(z).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2212
2263
  }),
2213
- title: G.value ? O(c).mediaLibrary.hideFolders : O(c).mediaLibrary.showFolders,
2214
- onClick: n[2] ||= (e) => G.value = !G.value
2215
- }, [m(O(U), {
2264
+ title: O(z).showSidebar.value ? O(c).mediaLibrary.hideFolders : O(c).mediaLibrary.showFolders,
2265
+ onClick: n[2] ||= (e) => O(z).showSidebar.value = !O(z).showSidebar.value
2266
+ }, [m(O(W), {
2216
2267
  size: 16,
2217
2268
  "stroke-width": 2
2218
- })], 12, ir)) : u("", !0),
2219
- O(Y).viewMode.value === "frequently-used" ? (S(), d("span", ar, D(O(c).mediaLibrary.frequentlyUsed), 1)) : (S(), l(me, {
2269
+ })], 12, or)) : u("", !0),
2270
+ O(R).viewMode.value === "frequently-used" ? (S(), d("span", sr, D(O(c).mediaLibrary.frequentlyUsed), 1)) : (S(), l(he, {
2220
2271
  key: 2,
2221
- folders: O(Y).folders.value,
2222
- "current-folder-id": O(Y).currentFolderId.value,
2223
- onNavigate: O(Y).navigateToFolder
2272
+ folders: O(R).folders.value,
2273
+ "current-folder-id": O(R).currentFolderId.value,
2274
+ onNavigate: O(R).navigateToFolder
2224
2275
  }, null, 8, [
2225
2276
  "folders",
2226
2277
  "current-folder-id",
2227
2278
  "onNavigate"
2228
2279
  ])),
2229
- f("div", or, [f("button", {
2280
+ f("div", cr, [f("button", {
2230
2281
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2231
2282
  style: b({
2232
- color: W.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2233
- backgroundColor: W.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2283
+ color: O(z).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2284
+ backgroundColor: O(z).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2234
2285
  }),
2235
2286
  title: O(c).mediaLibrary.viewGrid,
2236
- onClick: n[3] ||= (e) => W.value = "grid"
2287
+ onClick: n[3] ||= (e) => O(z).layoutMode.value = "grid"
2237
2288
  }, [m(O(B), {
2238
2289
  size: 14,
2239
2290
  "stroke-width": 2
2240
- })], 12, sr), f("button", {
2291
+ })], 12, lr), f("button", {
2241
2292
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2242
2293
  style: b({
2243
- color: W.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2244
- backgroundColor: W.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2294
+ color: O(z).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2295
+ backgroundColor: O(z).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2245
2296
  }),
2246
2297
  title: O(c).mediaLibrary.viewList,
2247
- onClick: n[4] ||= (e) => W.value = "list"
2248
- }, [m(O(V), {
2298
+ onClick: n[4] ||= (e) => O(z).layoutMode.value = "list"
2299
+ }, [m(O(H), {
2249
2300
  size: 14,
2250
2301
  "stroke-width": 2
2251
- })], 12, cr)])
2252
- ]), f("div", lr, [O(R).length > 1 ? (S(), d("select", {
2302
+ })], 12, ur)])
2303
+ ]), f("div", dr, [O(I).length > 1 ? (S(), d("select", {
2253
2304
  key: 0,
2254
2305
  class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2255
2306
  style: {
@@ -2257,32 +2308,36 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2257
2308
  "background-color": "var(--tpl-bg)",
2258
2309
  color: "var(--tpl-text)"
2259
2310
  },
2260
- value: O(Y).categoryFilter.value ?? "",
2261
- onChange: n[5] ||= (e) => O(Y).filterByCategory(e.target.value || null)
2262
- }, [f("option", dr, D(O(c).mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(O(R), (e) => (S(), d("option", {
2311
+ value: O(R).categoryFilter.value ?? "",
2312
+ onChange: n[5] ||= (e) => O(R).filterByCategory(e.target.value || null)
2313
+ }, [f("option", pr, D(O(c).mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(O(I), (e) => (S(), d("option", {
2263
2314
  key: e,
2264
2315
  value: e
2265
- }, D(H(e)), 9, fr))), 128))], 40, ur)) : u("", !0), f("select", {
2316
+ }, D(O(z).getCategoryLabel(e)), 9, mr))), 128))], 40, fr)) : u("", !0), f("select", {
2266
2317
  class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2267
2318
  style: {
2268
2319
  "border-color": "var(--tpl-border)",
2269
2320
  "background-color": "var(--tpl-bg)",
2270
2321
  color: "var(--tpl-text)"
2271
2322
  },
2272
- value: O(Y).sortOption.value,
2273
- onChange: n[6] ||= (e) => O(Y).sortBy(e.target.value)
2323
+ value: O(R).sortOption.value,
2324
+ onChange: n[6] ||= (e) => O(R).sortBy(e.target.value)
2274
2325
  }, [
2275
- f("option", mr, D(O(c).mediaLibrary.sortNewest), 1),
2276
- f("option", hr, D(O(c).mediaLibrary.sortOldest), 1),
2277
- f("option", gr, D(O(c).mediaLibrary.sortNameAsc), 1),
2278
- f("option", _r, D(O(c).mediaLibrary.sortNameDesc), 1),
2279
- f("option", vr, D(O(c).mediaLibrary.sortSizeAsc), 1),
2280
- f("option", yr, D(O(c).mediaLibrary.sortSizeDesc), 1)
2281
- ], 40, pr)])]), f("div", br, [O(Y).viewMode.value === "files" ? (S(), d("div", xr, [m(Bn, {
2282
- "is-uploading": O(Y).isUploading.value,
2283
- "upload-progress": O(Y).uploadProgress.value,
2284
- onUpload: de
2285
- }, null, 8, ["is-uploading", "upload-progress"]), k.value ? (S(), d("button", {
2326
+ f("option", gr, D(O(c).mediaLibrary.sortNewest), 1),
2327
+ f("option", _r, D(O(c).mediaLibrary.sortOldest), 1),
2328
+ f("option", vr, D(O(c).mediaLibrary.sortNameAsc), 1),
2329
+ f("option", yr, D(O(c).mediaLibrary.sortNameDesc), 1),
2330
+ f("option", br, D(O(c).mediaLibrary.sortSizeAsc), 1),
2331
+ f("option", xr, D(O(c).mediaLibrary.sortSizeDesc), 1)
2332
+ ], 40, hr)])]), f("div", Sr, [O(R).viewMode.value === "files" ? (S(), d("div", Cr, [m(Vn, {
2333
+ "is-uploading": O(R).isUploading.value,
2334
+ "upload-progress": O(R).uploadProgress.value,
2335
+ onUpload: O(z).handleUpload
2336
+ }, null, 8, [
2337
+ "is-uploading",
2338
+ "upload-progress",
2339
+ "onUpload"
2340
+ ]), E.value ? (S(), d("button", {
2286
2341
  key: 0,
2287
2342
  class: "tpl:mt-2 tpl:flex tpl:w-full tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2288
2343
  style: {
@@ -2290,22 +2345,22 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2290
2345
  color: "var(--tpl-text-muted)",
2291
2346
  "background-color": "var(--tpl-bg)"
2292
2347
  },
2293
- onClick: n[7] ||= (e) => we.value = !0
2294
- }, [m(O(ee), {
2348
+ onClick: n[7] ||= (e) => O(z).showImportUrlModal.value = !0
2349
+ }, [m(O(V), {
2295
2350
  size: 14,
2296
2351
  "stroke-width": 2
2297
- }), p(" " + D(O(c).mediaLibrary.importFromUrl), 1)])) : u("", !0)])) : u("", !0), m(Gt, {
2298
- items: re.value,
2299
- "selected-ids": O(Y).selectedItems.value,
2300
- "is-loading": O(Y).isLoading.value,
2301
- "has-more": O(Y).viewMode.value === "files" && O(Y).hasMore.value,
2352
+ }), p(" " + D(O(c).mediaLibrary.importFromUrl), 1)])) : u("", !0)])) : u("", !0), m(Kt, {
2353
+ items: O(z).displayItems.value,
2354
+ "selected-ids": O(R).selectedItems.value,
2355
+ "is-loading": O(R).isLoading.value,
2356
+ "has-more": O(R).viewMode.value === "files" && O(R).hasMore.value,
2302
2357
  accept: e.accept,
2303
- layout: W.value,
2304
- onSelect: fe,
2305
- onToggle: O(Y).toggleSelection,
2306
- onLoadMore: O(Y).loadMore,
2307
- onEdit: be,
2308
- onReplace: ke
2358
+ layout: O(z).layoutMode.value,
2359
+ onSelect: O(z).handleSelect,
2360
+ onToggle: O(R).toggleSelection,
2361
+ onLoadMore: O(R).loadMore,
2362
+ onEdit: O(z).handleEditItem,
2363
+ onReplace: O(z).handleReplaceItem
2309
2364
  }, null, 8, [
2310
2365
  "items",
2311
2366
  "selected-ids",
@@ -2313,40 +2368,49 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2313
2368
  "has-more",
2314
2369
  "accept",
2315
2370
  "layout",
2371
+ "onSelect",
2316
2372
  "onToggle",
2317
- "onLoadMore"
2373
+ "onLoadMore",
2374
+ "onEdit",
2375
+ "onReplace"
2318
2376
  ])])])]),
2319
- m(rn, {
2320
- visible: we.value,
2321
- "is-importing": O(Y).isImportingFromUrl.value,
2322
- error: O(Y).importFromUrlError.value,
2323
- onImport: Te,
2324
- onClose: n[8] ||= (e) => we.value = !1
2377
+ m(an, {
2378
+ visible: O(z).showImportUrlModal.value,
2379
+ "is-importing": O(R).isImportingFromUrl.value,
2380
+ error: O(R).importFromUrlError.value,
2381
+ onImport: O(z).handleImportFromUrl,
2382
+ onClose: n[8] ||= (e) => O(z).showImportUrlModal.value = !1
2325
2383
  }, null, 8, [
2326
2384
  "visible",
2327
2385
  "is-importing",
2328
- "error"
2386
+ "error",
2387
+ "onImport"
2329
2388
  ]),
2330
- m(tt, {
2331
- visible: !!$.value,
2332
- item: $.value,
2333
- onSave: xe,
2334
- onClose: n[9] ||= (e) => $.value = null
2335
- }, null, 8, ["visible", "item"]),
2336
- m(Fn, {
2337
- visible: O(Y).showReplaceWarning.value,
2338
- item: O(Y).pendingReplaceItem.value,
2339
- "usage-info": O(Y).replaceUsageInfo.value,
2340
- "is-replacing": O(Y).isReplacing.value,
2341
- error: O(Y).replaceError.value,
2342
- onReplace: Ae,
2343
- onClose: O(Y).cancelReplace
2389
+ m(nt, {
2390
+ visible: !!O(z).editingItem.value,
2391
+ item: O(z).editingItem.value,
2392
+ onSave: O(z).handleEditSave,
2393
+ onClose: n[9] ||= (e) => O(z).editingItem.value = null
2394
+ }, null, 8, [
2395
+ "visible",
2396
+ "item",
2397
+ "onSave"
2398
+ ]),
2399
+ m(In, {
2400
+ visible: O(R).showReplaceWarning.value,
2401
+ item: O(R).pendingReplaceItem.value,
2402
+ "usage-info": O(R).replaceUsageInfo.value,
2403
+ "is-replacing": O(R).isReplacing.value,
2404
+ error: O(R).replaceError.value,
2405
+ onReplace: O(z).handleReplaceFile,
2406
+ onClose: O(R).cancelReplace
2344
2407
  }, null, 8, [
2345
2408
  "visible",
2346
2409
  "item",
2347
2410
  "usage-info",
2348
2411
  "is-replacing",
2349
2412
  "error",
2413
+ "onReplace",
2350
2414
  "onClose"
2351
2415
  ]),
2352
2416
  m(o, {
@@ -2357,7 +2421,7 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2357
2421
  "leave-from-class": "tpl:opacity-100",
2358
2422
  "leave-to-class": "tpl:opacity-0"
2359
2423
  }, {
2360
- default: j(() => [O(Y).showDeleteWarning.value ? (S(), d("div", {
2424
+ default: j(() => [O(R).showDeleteWarning.value ? (S(), d("div", {
2361
2425
  key: 0,
2362
2426
  class: "tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-lg)]",
2363
2427
  style: {
@@ -2365,27 +2429,27 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2365
2429
  "backdrop-filter": "blur(8px)",
2366
2430
  "-webkit-backdrop-filter": "blur(8px)"
2367
2431
  },
2368
- onClick: n[12] ||= P((...e) => O(Y).cancelDelete && O(Y).cancelDelete(...e), ["self"])
2369
- }, [f("div", Sr, [
2370
- f("h3", Cr, D(O(c).mediaLibrary.deleteWarningTitle), 1),
2432
+ onClick: n[12] ||= P((...e) => O(R).cancelDelete && O(R).cancelDelete(...e), ["self"])
2433
+ }, [f("div", wr, [
2434
+ f("h3", Tr, D(O(c).mediaLibrary.deleteWarningTitle), 1),
2371
2435
  f("p", {
2372
- class: y(["tpl:text-xs", oe.value ? "tpl:mb-2" : "tpl:mb-4"]),
2436
+ class: y(["tpl:text-xs", O(z).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
2373
2437
  style: { color: "var(--tpl-text-muted)" }
2374
2438
  }, D(O(c).mediaLibrary.deleteWarningMessage), 3),
2375
- oe.value ? (S(), d("p", wr, D(O(c).mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
2376
- oe.value ? (S(), d("div", Tr, [(S(!0), d(i, null, T(O(Y).deleteUsageInfo.value, (e, t) => (S(), d("div", {
2439
+ O(z).hasUsedFiles.value ? (S(), d("p", Er, D(O(c).mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
2440
+ O(z).hasUsedFiles.value ? (S(), d("div", Dr, [(S(!0), d(i, null, T(O(R).deleteUsageInfo.value, (e, t) => (S(), d("div", {
2377
2441
  key: t,
2378
2442
  class: "tpl:text-xs",
2379
2443
  style: { color: "var(--tpl-text)" }
2380
- }, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", Er, D(re.value.find((e) => e.id === t)?.filename || t), 1), f("span", Dr, " - " + D(O(c).mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
2381
- f("div", Or, [f("button", {
2444
+ }, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", Or, D(O(z).displayItems.value.find((e) => e.id === t)?.filename || t), 1), f("span", kr, " - " + D(O(c).mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
2445
+ f("div", Ar, [f("button", {
2382
2446
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2383
2447
  style: {
2384
2448
  "border-color": "var(--tpl-border)",
2385
2449
  color: "var(--tpl-text)",
2386
2450
  "background-color": "var(--tpl-bg)"
2387
2451
  },
2388
- onClick: n[10] ||= (...e) => O(Y).cancelDelete && O(Y).cancelDelete(...e)
2452
+ onClick: n[10] ||= (...e) => O(R).cancelDelete && O(R).cancelDelete(...e)
2389
2453
  }, D(O(c).mediaLibrary.cancel), 1), f("button", {
2390
2454
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2391
2455
  style: {
@@ -2393,31 +2457,31 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2393
2457
  color: "var(--tpl-danger)",
2394
2458
  "background-color": "var(--tpl-danger-light)"
2395
2459
  },
2396
- onClick: n[11] ||= (...e) => O(Y).confirmDelete && O(Y).confirmDelete(...e)
2397
- }, D(oe.value ? O(c).mediaLibrary.deleteAnyway : O(c).mediaLibrary.confirmDelete), 1)])
2460
+ onClick: n[11] ||= (...e) => O(R).confirmDelete && O(R).confirmDelete(...e)
2461
+ }, D(O(z).hasUsedFiles.value ? O(c).mediaLibrary.deleteAnyway : O(c).mediaLibrary.confirmDelete), 1)])
2398
2462
  ])])) : u("", !0)]),
2399
2463
  _: 1
2400
2464
  }),
2401
- f("div", kr, [f("div", Ar, [O(Y).previewItem.value ? (S(), l(bn, {
2465
+ f("div", jr, [f("div", Mr, [O(R).previewItem.value ? (S(), l(xn, {
2402
2466
  key: 0,
2403
- "selected-conversion": J.value,
2404
- "onUpdate:selectedConversion": n[13] ||= (e) => J.value = e,
2405
- item: O(Y).previewItem.value,
2406
- folders: O(Y).folders.value
2467
+ "selected-conversion": O(z).selectedConversion.value,
2468
+ "onUpdate:selectedConversion": n[13] ||= (e) => O(z).selectedConversion.value = e,
2469
+ item: O(R).previewItem.value,
2470
+ folders: O(R).folders.value
2407
2471
  }, null, 8, [
2408
2472
  "selected-conversion",
2409
2473
  "item",
2410
2474
  "folders"
2411
- ])) : u("", !0)]), f("div", jr, [O(Y).selectedItems.value.size > 0 ? (S(), d("div", Mr, [O(Y).previewItem.value ? (S(), d("button", {
2475
+ ])) : u("", !0)]), f("div", Nr, [O(R).selectedItems.value.size > 0 ? (S(), d("div", Pr, [O(R).previewItem.value ? (S(), d("button", {
2412
2476
  key: 0,
2413
2477
  class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-1 tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2414
2478
  style: b({
2415
- borderColor: O(Ce) ? "var(--tpl-success)" : "var(--tpl-border)",
2416
- color: O(Ce) ? "var(--tpl-success)" : "var(--tpl-text)",
2479
+ borderColor: O(z).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
2480
+ color: O(z).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
2417
2481
  backgroundColor: "var(--tpl-bg)"
2418
2482
  }),
2419
- onClick: n[14] ||= (e) => O(Se)(X.value)
2420
- }, [O(Ce) ? (S(), l(O(F), {
2483
+ onClick: n[14] ||= (e) => O(z).copy(O(z).selectedUrl.value)
2484
+ }, [O(z).copied.value ? (S(), l(O(F), {
2421
2485
  key: 1,
2422
2486
  size: 12,
2423
2487
  "stroke-width": 2
@@ -2425,21 +2489,25 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2425
2489
  key: 0,
2426
2490
  size: 12,
2427
2491
  "stroke-width": 2
2428
- })), p(" " + D(O(Ce) ? O(c).mediaLibrary.copied : O(c).mediaLibrary.copyUrl), 1)], 4)) : u("", !0), E.value ? (S(), d("div", Nr, [f("button", {
2492
+ })), p(" " + D(O(z).copied.value ? O(c).mediaLibrary.copied : O(c).mediaLibrary.copyUrl), 1)], 4)) : u("", !0), w.value ? (S(), d("div", Fr, [f("button", {
2429
2493
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2430
2494
  style: {
2431
2495
  "border-color": "var(--tpl-border)",
2432
2496
  color: "var(--tpl-text)",
2433
2497
  "background-color": "var(--tpl-bg)"
2434
2498
  },
2435
- onClick: n[15] ||= (e) => Ee.value = !Ee.value
2436
- }, D(O(c).mediaLibrary.moveSelected), 1), Ee.value ? (S(), l(ln, {
2499
+ onClick: n[15] ||= (e) => O(z).showMovePicker.value = !O(z).showMovePicker.value
2500
+ }, D(O(c).mediaLibrary.moveSelected), 1), O(z).showMovePicker.value ? (S(), l(un, {
2437
2501
  key: 0,
2438
- folders: O(Y).folders.value,
2439
- "current-folder-id": O(Y).currentFolderId.value,
2440
- onSelect: De,
2441
- onClose: n[16] ||= (e) => Ee.value = !1
2442
- }, null, 8, ["folders", "current-folder-id"])) : u("", !0)])) : u("", !0)])) : u("", !0), f("div", Pr, [O(Y).selectedItems.value.size > 0 ? (S(), d("button", {
2502
+ folders: O(R).folders.value,
2503
+ "current-folder-id": O(R).currentFolderId.value,
2504
+ onSelect: O(z).handleMoveToFolder,
2505
+ onClose: n[16] ||= (e) => O(z).showMovePicker.value = !1
2506
+ }, null, 8, [
2507
+ "folders",
2508
+ "current-folder-id",
2509
+ "onSelect"
2510
+ ])) : u("", !0)])) : u("", !0)])) : u("", !0), f("div", Ir, [O(R).selectedItems.value.size > 0 ? (S(), d("button", {
2443
2511
  key: 0,
2444
2512
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2445
2513
  style: {
@@ -2447,24 +2515,24 @@ var be = ["data-tpl-theme"], xe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Se
2447
2515
  color: "var(--tpl-danger)",
2448
2516
  "background-color": "var(--tpl-danger-light)"
2449
2517
  },
2450
- onClick: Oe
2518
+ onClick: n[17] ||= (...e) => O(z).handleDeleteClick && O(z).handleDeleteClick(...e)
2451
2519
  }, D(O(c).mediaLibrary.deleteSelected), 1)) : u("", !0), f("button", {
2452
2520
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-4 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
2453
2521
  style: {
2454
2522
  "background-color": "var(--tpl-primary)",
2455
2523
  color: "var(--tpl-bg)"
2456
2524
  },
2457
- disabled: !pe(),
2458
- onClick: ge
2459
- }, D(e.accept?.length ? O(c).mediaLibrary.selectImage : O(c).mediaLibrary.selectFile), 9, Fr)])])])
2460
- ])], 8, Kn)) : u("", !0)]),
2525
+ disabled: !G(),
2526
+ onClick: K
2527
+ }, D(e.accept?.length ? O(c).mediaLibrary.selectImage : O(c).mediaLibrary.selectFile), 9, Lr)])])])
2528
+ ])], 8, Jn)) : u("", !0)]),
2461
2529
  _: 1
2462
2530
  })]));
2463
2531
  }
2464
2532
  });
2465
2533
  //#endregion
2466
2534
  //#region src/composables/useMediaPicker.ts
2467
- function Lr() {
2535
+ function zr() {
2468
2536
  let e = _("onRequestMedia"), t = _("planConfig"), n = w(!1), r = s(() => !!e && t.hasFeature("pluggable_media"));
2469
2537
  async function i(t) {
2470
2538
  if (!e) return null;
@@ -2483,7 +2551,7 @@ function Lr() {
2483
2551
  }
2484
2552
  //#endregion
2485
2553
  //#region src/standalone/MediaLibrary.vue?vue&type=script&setup=true&lang.ts
2486
- var Rr = {
2554
+ var Br = {
2487
2555
  class: "tpl tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
2488
2556
  style: {
2489
2557
  width: "100%",
@@ -2491,62 +2559,62 @@ var Rr = {
2491
2559
  "background-color": "var(--tpl-bg-elevated)",
2492
2560
  border: "1px solid var(--tpl-border)"
2493
2561
  }
2494
- }, zr = {
2562
+ }, Vr = {
2495
2563
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
2496
2564
  style: { "border-color": "var(--tpl-border)" }
2497
- }, Br = {
2565
+ }, Hr = {
2498
2566
  class: "tpl:text-sm tpl:font-semibold",
2499
2567
  style: { color: "var(--tpl-text)" }
2500
- }, Vr = { class: "tpl:flex tpl:items-center tpl:gap-3" }, Hr = { class: "tpl:relative" }, Ur = ["value", "placeholder"], Wr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, Gr = {
2568
+ }, Ur = { class: "tpl:flex tpl:items-center tpl:gap-3" }, Wr = { class: "tpl:relative" }, Gr = ["value", "placeholder"], Kr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, qr = {
2501
2569
  key: 0,
2502
2570
  class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
2503
2571
  style: {
2504
2572
  "border-color": "var(--tpl-border)",
2505
2573
  "background-color": "var(--tpl-bg)"
2506
2574
  }
2507
- }, Kr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, qr = {
2575
+ }, Jr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, Yr = {
2508
2576
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
2509
2577
  style: { "border-color": "var(--tpl-border)" }
2510
- }, Jr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Yr = ["title"], Xr = {
2578
+ }, Xr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Zr = ["title"], Qr = {
2511
2579
  key: 1,
2512
2580
  class: "tpl:text-xs tpl:font-medium",
2513
2581
  style: { color: "var(--tpl-text)" }
2514
- }, Zr = {
2582
+ }, $r = {
2515
2583
  class: "tpl:flex tpl:rounded-md tpl:p-0.5",
2516
2584
  style: {
2517
2585
  border: "1px solid var(--tpl-border)",
2518
2586
  "background-color": "var(--tpl-bg)"
2519
2587
  }
2520
- }, Qr = ["title"], $r = ["title"], ei = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ti = ["value"], ni = { value: "" }, ri = ["value"], ii = ["value"], ai = { value: "newest" }, oi = { value: "oldest" }, si = { value: "name_asc" }, ci = { value: "name_desc" }, li = { value: "size_asc" }, ui = { value: "size_desc" }, di = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, fi = {
2588
+ }, ei = ["title"], ti = ["title"], ni = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ri = ["value"], ii = { value: "" }, ai = ["value"], oi = ["value"], si = { value: "newest" }, ci = { value: "oldest" }, li = { value: "name_asc" }, ui = { value: "name_desc" }, di = { value: "size_asc" }, fi = { value: "size_desc" }, pi = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, mi = {
2521
2589
  key: 0,
2522
2590
  class: "tpl:px-4 tpl:pt-3"
2523
- }, pi = {
2591
+ }, hi = {
2524
2592
  class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
2525
2593
  style: {
2526
2594
  "background-color": "var(--tpl-bg-elevated)",
2527
2595
  "box-shadow": "var(--tpl-shadow-xl)"
2528
2596
  }
2529
- }, mi = {
2597
+ }, gi = {
2530
2598
  class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
2531
2599
  style: { color: "var(--tpl-text)" }
2532
- }, hi = {
2600
+ }, _i = {
2533
2601
  key: 0,
2534
2602
  class: "tpl:mb-4 tpl:text-xs",
2535
2603
  style: { color: "var(--tpl-text-muted)" }
2536
- }, gi = {
2604
+ }, vi = {
2537
2605
  key: 1,
2538
2606
  class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
2539
2607
  style: { "border-color": "var(--tpl-border)" }
2540
- }, _i = { class: "tpl:font-medium" }, vi = { style: { color: "var(--tpl-text-muted)" } }, yi = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, bi = {
2608
+ }, yi = { class: "tpl:font-medium" }, bi = { style: { color: "var(--tpl-text-muted)" } }, xi = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Si = {
2541
2609
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
2542
2610
  style: { "border-color": "var(--tpl-border)" }
2543
- }, xi = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Si = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Ci = {
2611
+ }, Ci = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, wi = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Ti = {
2544
2612
  key: 0,
2545
2613
  class: "tpl:flex tpl:items-center tpl:gap-2"
2546
- }, wi = {
2614
+ }, Ei = {
2547
2615
  key: 1,
2548
2616
  class: "tpl:relative"
2549
- }, Ti = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Ei = ["disabled"], Di = /* @__PURE__ */ h({
2617
+ }, Di = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Oi = ["disabled"], ki = /* @__PURE__ */ h({
2550
2618
  __name: "MediaLibrary",
2551
2619
  props: {
2552
2620
  authManager: {},
@@ -2566,99 +2634,32 @@ var Rr = {
2566
2634
  features: s(() => n.planConfig.features),
2567
2635
  fetchConfig: async () => {}
2568
2636
  });
2569
- let c = s(() => n.planConfig.features.media_folders ?? !1), h = s(() => n.planConfig.features.import_from_url ?? !1), g = s(() => n.planConfig.storage.used_bytes ?? 0), _ = s(() => n.planConfig.storage.limit_bytes ?? 0), { availableCategories: v } = he(), E = {
2570
- images: () => a.value.mediaLibrary.filterImages,
2571
- documents: () => a.value.mediaLibrary.filterDocuments,
2572
- videos: () => a.value.mediaLibrary.filterVideos,
2573
- audio: () => a.value.mediaLibrary.filterAudio
2574
- };
2575
- function k(e) {
2576
- return E[e]?.() ?? e;
2577
- }
2578
- let M = w("grid"), N = w(!1), I = w(""), R = w("original"), z = ue({
2637
+ let c = s(() => n.planConfig.features.media_folders ?? !1), h = s(() => n.planConfig.features.import_from_url ?? !1), g = s(() => n.planConfig.storage.used_bytes ?? 0), _ = s(() => n.planConfig.storage.limit_bytes ?? 0), { availableCategories: v } = Q(), E = de({
2579
2638
  projectId: n.projectId,
2580
2639
  authManager: n.authManager,
2581
2640
  onError: n.onError
2582
- }), H = s(() => {
2583
- let e = z.previewItem.value;
2584
- if (!e) return null;
2585
- switch (R.value) {
2586
- case "small": return e.small_url || e.url;
2587
- case "medium": return e.medium_url || e.url;
2588
- case "large": return e.large_url || e.url;
2589
- default: return e.url;
2590
- }
2591
- }), W = s(() => z.frequentlyUsedItems.value.length > 0), G = s(() => z.viewMode.value === "frequently-used" ? z.frequentlyUsedItems.value : z.items.value), K = s(() => Object.values(z.deleteUsageInfo.value).some((e) => e.template_count > 0));
2592
- A(N, (e) => {
2593
- e && c.value && z.loadFolders();
2594
- }), A(() => z.previewItem.value?.id, () => {
2595
- R.value = "original";
2641
+ }), k = qn({
2642
+ library: E,
2643
+ canUseMediaFolders: c,
2644
+ translations: a
2596
2645
  });
2597
- let J = ae((e) => {
2598
- z.search(e);
2599
- }, 300);
2600
- function Y(e) {
2601
- I.value = e, J(e);
2602
- }
2603
- async function X(e) {
2604
- await z.uploadFiles(e);
2605
- }
2606
- function te(e) {
2607
- z.selectItem(e);
2608
- }
2609
- function ne() {
2610
- if (!z.previewItem.value) return;
2611
- let e = z.previewItem.value, t = {
2646
+ function A() {
2647
+ if (!E.previewItem.value) return;
2648
+ let e = E.previewItem.value, t = {
2612
2649
  ...e,
2613
- url: H.value || e.url
2650
+ url: k.selectedUrl.value || e.url
2614
2651
  };
2615
2652
  n.onSelect?.(t);
2616
2653
  }
2617
- async function re(e, t) {
2618
- await z.createFolder(e, t);
2619
- }
2620
- async function oe(e, t) {
2621
- await z.renameFolder(e, t);
2622
- }
2623
- async function se(e) {
2624
- await z.deleteFolder(e);
2625
- }
2626
- let Z = w(null);
2627
- function ce(e) {
2628
- Z.value = e;
2629
- }
2630
- async function le(e, t, n, r) {
2631
- r && await z.replaceMediaDirectly(e, r.file), await z.updateFile(e, t, n), Z.value = null;
2632
- }
2633
- let { copy: Q, copied: de } = ie({
2634
- copiedDuring: 2e3,
2635
- legacy: !0
2636
- }), fe = w(!1);
2637
- async function pe(e) {
2638
- await z.importFromUrl(e) && (fe.value = !1);
2639
- }
2640
- let ge = w(!1);
2641
- async function _e(e) {
2642
- ge.value = !1, await z.moveSelected(e);
2643
- }
2644
- async function ve() {
2645
- await z.checkUsageBeforeDelete();
2646
- }
2647
- function ye(e) {
2648
- z.checkUsageBeforeReplace(e);
2649
- }
2650
- async function $(e) {
2651
- await z.replaceFile(e);
2652
- }
2653
2654
  return x(() => {
2654
- z.loadItems(), z.loadFrequentlyUsed(), r("ready");
2655
- }), (t, n) => (S(), d("div", Rr, [
2656
- f("div", zr, [f("h2", Br, D(a.value.mediaLibrary.title), 1), f("div", Vr, [m(Gn, {
2655
+ E.loadItems(), E.loadFrequentlyUsed(), r("ready");
2656
+ }), (t, n) => (S(), d("div", Br, [
2657
+ f("div", Vr, [f("h2", Hr, D(a.value.mediaLibrary.title), 1), f("div", Ur, [m(Kn, {
2657
2658
  "used-bytes": g.value,
2658
2659
  "limit-bytes": _.value,
2659
2660
  size: 22
2660
- }, null, 8, ["used-bytes", "limit-bytes"]), f("div", Hr, [f("input", {
2661
- value: I.value,
2661
+ }, null, 8, ["used-bytes", "limit-bytes"]), f("div", Wr, [f("input", {
2662
+ value: O(k).searchInput.value,
2662
2663
  type: "text",
2663
2664
  class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)]",
2664
2665
  style: {
@@ -2667,14 +2668,14 @@ var Rr = {
2667
2668
  color: "var(--tpl-text)"
2668
2669
  },
2669
2670
  placeholder: a.value.mediaLibrary.searchPlaceholder,
2670
- onInput: n[0] ||= (e) => Y(e.target.value)
2671
- }, null, 40, Ur), m(O(q), {
2671
+ onInput: n[0] ||= (e) => O(k).handleSearchInput(e.target.value)
2672
+ }, null, 40, Gr), m(O(J), {
2672
2673
  class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
2673
2674
  size: 13,
2674
2675
  "stroke-width": 2,
2675
2676
  style: { color: "var(--tpl-text-dim)" }
2676
2677
  })])])]),
2677
- f("div", Wr, [m(o, {
2678
+ f("div", Kr, [m(o, {
2678
2679
  "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
2679
2680
  "enter-from-class": "tpl:-ml-48 tpl:opacity-0",
2680
2681
  "enter-to-class": "tpl:ml-0 tpl:opacity-100",
@@ -2682,74 +2683,77 @@ var Rr = {
2682
2683
  "leave-from-class": "tpl:ml-0 tpl:opacity-100",
2683
2684
  "leave-to-class": "tpl:-ml-48 tpl:opacity-0"
2684
2685
  }, {
2685
- default: j(() => [c.value && N.value ? (S(), d("div", Gr, [m(mt, {
2686
- folders: O(z).folders.value,
2687
- "current-folder-id": O(z).currentFolderId.value,
2688
- "view-mode": O(z).viewMode.value,
2689
- "has-frequently-used": W.value,
2690
- onNavigate: O(z).navigateToFolder,
2691
- onCreateFolder: re,
2692
- onRenameFolder: oe,
2693
- onDeleteFolder: se,
2694
- onShowFrequentlyUsed: O(z).showFrequentlyUsed
2686
+ default: j(() => [c.value && O(k).showSidebar.value ? (S(), d("div", qr, [m(ht, {
2687
+ folders: O(E).folders.value,
2688
+ "current-folder-id": O(E).currentFolderId.value,
2689
+ "view-mode": O(E).viewMode.value,
2690
+ "has-frequently-used": O(k).hasFrequentlyUsed.value,
2691
+ onNavigate: O(E).navigateToFolder,
2692
+ onCreateFolder: O(k).handleCreateFolder,
2693
+ onRenameFolder: O(k).handleRenameFolder,
2694
+ onDeleteFolder: O(k).handleDeleteFolder,
2695
+ onShowFrequentlyUsed: O(E).showFrequentlyUsed
2695
2696
  }, null, 8, [
2696
2697
  "folders",
2697
2698
  "current-folder-id",
2698
2699
  "view-mode",
2699
2700
  "has-frequently-used",
2700
2701
  "onNavigate",
2702
+ "onCreateFolder",
2703
+ "onRenameFolder",
2704
+ "onDeleteFolder",
2701
2705
  "onShowFrequentlyUsed"
2702
2706
  ])])) : u("", !0)]),
2703
2707
  _: 1
2704
- }), f("div", Kr, [f("div", qr, [f("div", Jr, [
2708
+ }), f("div", Jr, [f("div", Yr, [f("div", Xr, [
2705
2709
  c.value ? (S(), d("button", {
2706
2710
  key: 0,
2707
2711
  class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
2708
2712
  style: b({
2709
- color: N.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2710
- backgroundColor: N.value ? "var(--tpl-bg)" : "transparent",
2711
- border: N.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2713
+ color: O(k).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2714
+ backgroundColor: O(k).showSidebar.value ? "var(--tpl-bg)" : "transparent",
2715
+ border: O(k).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2712
2716
  }),
2713
- title: N.value ? a.value.mediaLibrary.hideFolders : a.value.mediaLibrary.showFolders,
2714
- onClick: n[1] ||= (e) => N.value = !N.value
2715
- }, [m(O(U), {
2717
+ title: O(k).showSidebar.value ? a.value.mediaLibrary.hideFolders : a.value.mediaLibrary.showFolders,
2718
+ onClick: n[1] ||= (e) => O(k).showSidebar.value = !O(k).showSidebar.value
2719
+ }, [m(O(W), {
2716
2720
  size: 16,
2717
2721
  "stroke-width": 2
2718
- })], 12, Yr)) : u("", !0),
2719
- O(z).viewMode.value === "frequently-used" ? (S(), d("span", Xr, D(a.value.mediaLibrary.frequentlyUsed), 1)) : (S(), l(me, {
2722
+ })], 12, Zr)) : u("", !0),
2723
+ O(E).viewMode.value === "frequently-used" ? (S(), d("span", Qr, D(a.value.mediaLibrary.frequentlyUsed), 1)) : (S(), l(he, {
2720
2724
  key: 2,
2721
- folders: O(z).folders.value,
2722
- "current-folder-id": O(z).currentFolderId.value,
2723
- onNavigate: O(z).navigateToFolder
2725
+ folders: O(E).folders.value,
2726
+ "current-folder-id": O(E).currentFolderId.value,
2727
+ onNavigate: O(E).navigateToFolder
2724
2728
  }, null, 8, [
2725
2729
  "folders",
2726
2730
  "current-folder-id",
2727
2731
  "onNavigate"
2728
2732
  ])),
2729
- f("div", Zr, [f("button", {
2733
+ f("div", $r, [f("button", {
2730
2734
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2731
2735
  style: b({
2732
- color: M.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2733
- backgroundColor: M.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2736
+ color: O(k).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2737
+ backgroundColor: O(k).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2734
2738
  }),
2735
2739
  title: a.value.mediaLibrary.viewGrid,
2736
- onClick: n[2] ||= (e) => M.value = "grid"
2740
+ onClick: n[2] ||= (e) => O(k).layoutMode.value = "grid"
2737
2741
  }, [m(O(B), {
2738
2742
  size: 14,
2739
2743
  "stroke-width": 2
2740
- })], 12, Qr), f("button", {
2744
+ })], 12, ei), f("button", {
2741
2745
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2742
2746
  style: b({
2743
- color: M.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2744
- backgroundColor: M.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2747
+ color: O(k).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2748
+ backgroundColor: O(k).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2745
2749
  }),
2746
2750
  title: a.value.mediaLibrary.viewList,
2747
- onClick: n[3] ||= (e) => M.value = "list"
2748
- }, [m(O(V), {
2751
+ onClick: n[3] ||= (e) => O(k).layoutMode.value = "list"
2752
+ }, [m(O(H), {
2749
2753
  size: 14,
2750
2754
  "stroke-width": 2
2751
- })], 12, $r)])
2752
- ]), f("div", ei, [O(v).length > 1 ? (S(), d("select", {
2755
+ })], 12, ti)])
2756
+ ]), f("div", ni, [O(v).length > 1 ? (S(), d("select", {
2753
2757
  key: 0,
2754
2758
  class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2755
2759
  style: {
@@ -2757,32 +2761,36 @@ var Rr = {
2757
2761
  "background-color": "var(--tpl-bg)",
2758
2762
  color: "var(--tpl-text)"
2759
2763
  },
2760
- value: O(z).categoryFilter.value ?? "",
2761
- onChange: n[4] ||= (e) => O(z).filterByCategory(e.target.value || null)
2762
- }, [f("option", ni, D(a.value.mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(O(v), (e) => (S(), d("option", {
2764
+ value: O(E).categoryFilter.value ?? "",
2765
+ onChange: n[4] ||= (e) => O(E).filterByCategory(e.target.value || null)
2766
+ }, [f("option", ii, D(a.value.mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(O(v), (e) => (S(), d("option", {
2763
2767
  key: e,
2764
2768
  value: e
2765
- }, D(k(e)), 9, ri))), 128))], 40, ti)) : u("", !0), f("select", {
2769
+ }, D(O(k).getCategoryLabel(e)), 9, ai))), 128))], 40, ri)) : u("", !0), f("select", {
2766
2770
  class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2767
2771
  style: {
2768
2772
  "border-color": "var(--tpl-border)",
2769
2773
  "background-color": "var(--tpl-bg)",
2770
2774
  color: "var(--tpl-text)"
2771
2775
  },
2772
- value: O(z).sortOption.value,
2773
- onChange: n[5] ||= (e) => O(z).sortBy(e.target.value)
2776
+ value: O(E).sortOption.value,
2777
+ onChange: n[5] ||= (e) => O(E).sortBy(e.target.value)
2774
2778
  }, [
2775
- f("option", ai, D(a.value.mediaLibrary.sortNewest), 1),
2776
- f("option", oi, D(a.value.mediaLibrary.sortOldest), 1),
2777
- f("option", si, D(a.value.mediaLibrary.sortNameAsc), 1),
2778
- f("option", ci, D(a.value.mediaLibrary.sortNameDesc), 1),
2779
- f("option", li, D(a.value.mediaLibrary.sortSizeAsc), 1),
2780
- f("option", ui, D(a.value.mediaLibrary.sortSizeDesc), 1)
2781
- ], 40, ii)])]), f("div", di, [O(z).viewMode.value === "files" ? (S(), d("div", fi, [m(Bn, {
2782
- "is-uploading": O(z).isUploading.value,
2783
- "upload-progress": O(z).uploadProgress.value,
2784
- onUpload: X
2785
- }, null, 8, ["is-uploading", "upload-progress"]), h.value ? (S(), d("button", {
2779
+ f("option", si, D(a.value.mediaLibrary.sortNewest), 1),
2780
+ f("option", ci, D(a.value.mediaLibrary.sortOldest), 1),
2781
+ f("option", li, D(a.value.mediaLibrary.sortNameAsc), 1),
2782
+ f("option", ui, D(a.value.mediaLibrary.sortNameDesc), 1),
2783
+ f("option", di, D(a.value.mediaLibrary.sortSizeAsc), 1),
2784
+ f("option", fi, D(a.value.mediaLibrary.sortSizeDesc), 1)
2785
+ ], 40, oi)])]), f("div", pi, [O(E).viewMode.value === "files" ? (S(), d("div", mi, [m(Vn, {
2786
+ "is-uploading": O(E).isUploading.value,
2787
+ "upload-progress": O(E).uploadProgress.value,
2788
+ onUpload: O(k).handleUpload
2789
+ }, null, 8, [
2790
+ "is-uploading",
2791
+ "upload-progress",
2792
+ "onUpload"
2793
+ ]), h.value ? (S(), d("button", {
2786
2794
  key: 0,
2787
2795
  class: "tpl:mt-2 tpl:flex tpl:w-full tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2788
2796
  style: {
@@ -2790,61 +2798,70 @@ var Rr = {
2790
2798
  color: "var(--tpl-text-muted)",
2791
2799
  "background-color": "var(--tpl-bg)"
2792
2800
  },
2793
- onClick: n[6] ||= (e) => fe.value = !0
2794
- }, [m(O(ee), {
2801
+ onClick: n[6] ||= (e) => O(k).showImportUrlModal.value = !0
2802
+ }, [m(O(V), {
2795
2803
  size: 14,
2796
2804
  "stroke-width": 2
2797
- }), p(" " + D(a.value.mediaLibrary.importFromUrl), 1)])) : u("", !0)])) : u("", !0), m(Gt, {
2798
- items: G.value,
2799
- "selected-ids": O(z).selectedItems.value,
2800
- "is-loading": O(z).isLoading.value,
2801
- "has-more": O(z).viewMode.value === "files" && O(z).hasMore.value,
2802
- layout: M.value,
2803
- onSelect: te,
2804
- onToggle: O(z).toggleSelection,
2805
- onLoadMore: O(z).loadMore,
2806
- onEdit: ce,
2807
- onReplace: ye
2805
+ }), p(" " + D(a.value.mediaLibrary.importFromUrl), 1)])) : u("", !0)])) : u("", !0), m(Kt, {
2806
+ items: O(k).displayItems.value,
2807
+ "selected-ids": O(E).selectedItems.value,
2808
+ "is-loading": O(E).isLoading.value,
2809
+ "has-more": O(E).viewMode.value === "files" && O(E).hasMore.value,
2810
+ layout: O(k).layoutMode.value,
2811
+ onSelect: O(k).handleSelect,
2812
+ onToggle: O(E).toggleSelection,
2813
+ onLoadMore: O(E).loadMore,
2814
+ onEdit: O(k).handleEditItem,
2815
+ onReplace: O(k).handleReplaceItem
2808
2816
  }, null, 8, [
2809
2817
  "items",
2810
2818
  "selected-ids",
2811
2819
  "is-loading",
2812
2820
  "has-more",
2813
2821
  "layout",
2822
+ "onSelect",
2814
2823
  "onToggle",
2815
- "onLoadMore"
2824
+ "onLoadMore",
2825
+ "onEdit",
2826
+ "onReplace"
2816
2827
  ])])])]),
2817
- m(rn, {
2818
- visible: fe.value,
2819
- "is-importing": O(z).isImportingFromUrl.value,
2820
- error: O(z).importFromUrlError.value,
2821
- onImport: pe,
2822
- onClose: n[7] ||= (e) => fe.value = !1
2828
+ m(an, {
2829
+ visible: O(k).showImportUrlModal.value,
2830
+ "is-importing": O(E).isImportingFromUrl.value,
2831
+ error: O(E).importFromUrlError.value,
2832
+ onImport: O(k).handleImportFromUrl,
2833
+ onClose: n[7] ||= (e) => O(k).showImportUrlModal.value = !1
2823
2834
  }, null, 8, [
2824
2835
  "visible",
2825
2836
  "is-importing",
2826
- "error"
2837
+ "error",
2838
+ "onImport"
2839
+ ]),
2840
+ m(nt, {
2841
+ visible: !!O(k).editingItem.value,
2842
+ item: O(k).editingItem.value,
2843
+ onSave: O(k).handleEditSave,
2844
+ onClose: n[8] ||= (e) => O(k).editingItem.value = null
2845
+ }, null, 8, [
2846
+ "visible",
2847
+ "item",
2848
+ "onSave"
2827
2849
  ]),
2828
- m(tt, {
2829
- visible: !!Z.value,
2830
- item: Z.value,
2831
- onSave: le,
2832
- onClose: n[8] ||= (e) => Z.value = null
2833
- }, null, 8, ["visible", "item"]),
2834
- m(Fn, {
2835
- visible: O(z).showReplaceWarning.value,
2836
- item: O(z).pendingReplaceItem.value,
2837
- "usage-info": O(z).replaceUsageInfo.value,
2838
- "is-replacing": O(z).isReplacing.value,
2839
- error: O(z).replaceError.value,
2840
- onReplace: $,
2841
- onClose: O(z).cancelReplace
2850
+ m(In, {
2851
+ visible: O(E).showReplaceWarning.value,
2852
+ item: O(E).pendingReplaceItem.value,
2853
+ "usage-info": O(E).replaceUsageInfo.value,
2854
+ "is-replacing": O(E).isReplacing.value,
2855
+ error: O(E).replaceError.value,
2856
+ onReplace: O(k).handleReplaceFile,
2857
+ onClose: O(E).cancelReplace
2842
2858
  }, null, 8, [
2843
2859
  "visible",
2844
2860
  "item",
2845
2861
  "usage-info",
2846
2862
  "is-replacing",
2847
2863
  "error",
2864
+ "onReplace",
2848
2865
  "onClose"
2849
2866
  ]),
2850
2867
  m(o, {
@@ -2855,7 +2872,7 @@ var Rr = {
2855
2872
  "leave-from-class": "tpl:opacity-100",
2856
2873
  "leave-to-class": "tpl:opacity-0"
2857
2874
  }, {
2858
- default: j(() => [O(z).showDeleteWarning.value ? (S(), d("div", {
2875
+ default: j(() => [O(E).showDeleteWarning.value ? (S(), d("div", {
2859
2876
  key: 0,
2860
2877
  class: "tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-lg)]",
2861
2878
  style: {
@@ -2863,27 +2880,27 @@ var Rr = {
2863
2880
  "backdrop-filter": "blur(8px)",
2864
2881
  "-webkit-backdrop-filter": "blur(8px)"
2865
2882
  },
2866
- onClick: n[11] ||= P((...e) => O(z).cancelDelete && O(z).cancelDelete(...e), ["self"])
2867
- }, [f("div", pi, [
2868
- f("h3", mi, D(a.value.mediaLibrary.deleteWarningTitle), 1),
2883
+ onClick: n[11] ||= P((...e) => O(E).cancelDelete && O(E).cancelDelete(...e), ["self"])
2884
+ }, [f("div", hi, [
2885
+ f("h3", gi, D(a.value.mediaLibrary.deleteWarningTitle), 1),
2869
2886
  f("p", {
2870
- class: y(["tpl:text-xs", K.value ? "tpl:mb-2" : "tpl:mb-4"]),
2887
+ class: y(["tpl:text-xs", O(k).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
2871
2888
  style: { color: "var(--tpl-text-muted)" }
2872
2889
  }, D(a.value.mediaLibrary.deleteWarningMessage), 3),
2873
- K.value ? (S(), d("p", hi, D(a.value.mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
2874
- K.value ? (S(), d("div", gi, [(S(!0), d(i, null, T(O(z).deleteUsageInfo.value, (e, t) => (S(), d("div", {
2890
+ O(k).hasUsedFiles.value ? (S(), d("p", _i, D(a.value.mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
2891
+ O(k).hasUsedFiles.value ? (S(), d("div", vi, [(S(!0), d(i, null, T(O(E).deleteUsageInfo.value, (e, t) => (S(), d("div", {
2875
2892
  key: t,
2876
2893
  class: "tpl:text-xs",
2877
2894
  style: { color: "var(--tpl-text)" }
2878
- }, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", _i, D(G.value.find((e) => e.id === t)?.filename || t), 1), f("span", vi, " - " + D(a.value.mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
2879
- f("div", yi, [f("button", {
2895
+ }, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", yi, D(O(k).displayItems.value.find((e) => e.id === t)?.filename || t), 1), f("span", bi, " - " + D(a.value.mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
2896
+ f("div", xi, [f("button", {
2880
2897
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2881
2898
  style: {
2882
2899
  "border-color": "var(--tpl-border)",
2883
2900
  color: "var(--tpl-text)",
2884
2901
  "background-color": "var(--tpl-bg)"
2885
2902
  },
2886
- onClick: n[9] ||= (...e) => O(z).cancelDelete && O(z).cancelDelete(...e)
2903
+ onClick: n[9] ||= (...e) => O(E).cancelDelete && O(E).cancelDelete(...e)
2887
2904
  }, D(a.value.mediaLibrary.cancel), 1), f("button", {
2888
2905
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2889
2906
  style: {
@@ -2891,31 +2908,31 @@ var Rr = {
2891
2908
  color: "var(--tpl-danger)",
2892
2909
  "background-color": "var(--tpl-danger-light)"
2893
2910
  },
2894
- onClick: n[10] ||= (...e) => O(z).confirmDelete && O(z).confirmDelete(...e)
2895
- }, D(K.value ? a.value.mediaLibrary.deleteAnyway : a.value.mediaLibrary.confirmDelete), 1)])
2911
+ onClick: n[10] ||= (...e) => O(E).confirmDelete && O(E).confirmDelete(...e)
2912
+ }, D(O(k).hasUsedFiles.value ? a.value.mediaLibrary.deleteAnyway : a.value.mediaLibrary.confirmDelete), 1)])
2896
2913
  ])])) : u("", !0)]),
2897
2914
  _: 1
2898
2915
  }),
2899
- f("div", bi, [f("div", xi, [O(z).previewItem.value ? (S(), l(bn, {
2916
+ f("div", Si, [f("div", Ci, [O(E).previewItem.value ? (S(), l(xn, {
2900
2917
  key: 0,
2901
- "selected-conversion": R.value,
2902
- "onUpdate:selectedConversion": n[12] ||= (e) => R.value = e,
2903
- item: O(z).previewItem.value,
2904
- folders: O(z).folders.value
2918
+ "selected-conversion": O(k).selectedConversion.value,
2919
+ "onUpdate:selectedConversion": n[12] ||= (e) => O(k).selectedConversion.value = e,
2920
+ item: O(E).previewItem.value,
2921
+ folders: O(E).folders.value
2905
2922
  }, null, 8, [
2906
2923
  "selected-conversion",
2907
2924
  "item",
2908
2925
  "folders"
2909
- ])) : u("", !0)]), f("div", Si, [O(z).selectedItems.value.size > 0 ? (S(), d("div", Ci, [O(z).previewItem.value ? (S(), d("button", {
2926
+ ])) : u("", !0)]), f("div", wi, [O(E).selectedItems.value.size > 0 ? (S(), d("div", Ti, [O(E).previewItem.value ? (S(), d("button", {
2910
2927
  key: 0,
2911
2928
  class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-1 tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2912
2929
  style: b({
2913
- borderColor: O(de) ? "var(--tpl-success)" : "var(--tpl-border)",
2914
- color: O(de) ? "var(--tpl-success)" : "var(--tpl-text)",
2930
+ borderColor: O(k).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
2931
+ color: O(k).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
2915
2932
  backgroundColor: "var(--tpl-bg)"
2916
2933
  }),
2917
- onClick: n[13] ||= (e) => O(Q)(H.value)
2918
- }, [O(de) ? (S(), l(O(F), {
2934
+ onClick: n[13] ||= (e) => O(k).copy(O(k).selectedUrl.value)
2935
+ }, [O(k).copied.value ? (S(), l(O(F), {
2919
2936
  key: 1,
2920
2937
  size: 12,
2921
2938
  "stroke-width": 2
@@ -2923,21 +2940,25 @@ var Rr = {
2923
2940
  key: 0,
2924
2941
  size: 12,
2925
2942
  "stroke-width": 2
2926
- })), p(" " + D(O(de) ? a.value.mediaLibrary.copied : a.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), c.value ? (S(), d("div", wi, [f("button", {
2943
+ })), p(" " + D(O(k).copied.value ? a.value.mediaLibrary.copied : a.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), c.value ? (S(), d("div", Ei, [f("button", {
2927
2944
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2928
2945
  style: {
2929
2946
  "border-color": "var(--tpl-border)",
2930
2947
  color: "var(--tpl-text)",
2931
2948
  "background-color": "var(--tpl-bg)"
2932
2949
  },
2933
- onClick: n[14] ||= (e) => ge.value = !ge.value
2934
- }, D(a.value.mediaLibrary.moveSelected), 1), ge.value ? (S(), l(ln, {
2950
+ onClick: n[14] ||= (e) => O(k).showMovePicker.value = !O(k).showMovePicker.value
2951
+ }, D(a.value.mediaLibrary.moveSelected), 1), O(k).showMovePicker.value ? (S(), l(un, {
2935
2952
  key: 0,
2936
- folders: O(z).folders.value,
2937
- "current-folder-id": O(z).currentFolderId.value,
2938
- onSelect: _e,
2939
- onClose: n[15] ||= (e) => ge.value = !1
2940
- }, null, 8, ["folders", "current-folder-id"])) : u("", !0)])) : u("", !0)])) : u("", !0), f("div", Ti, [O(z).selectedItems.value.size > 0 ? (S(), d("button", {
2953
+ folders: O(E).folders.value,
2954
+ "current-folder-id": O(E).currentFolderId.value,
2955
+ onSelect: O(k).handleMoveToFolder,
2956
+ onClose: n[15] ||= (e) => O(k).showMovePicker.value = !1
2957
+ }, null, 8, [
2958
+ "folders",
2959
+ "current-folder-id",
2960
+ "onSelect"
2961
+ ])) : u("", !0)])) : u("", !0)])) : u("", !0), f("div", Di, [O(E).selectedItems.value.size > 0 ? (S(), d("button", {
2941
2962
  key: 0,
2942
2963
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2943
2964
  style: {
@@ -2945,7 +2966,7 @@ var Rr = {
2945
2966
  color: "var(--tpl-danger)",
2946
2967
  "background-color": "var(--tpl-danger-light)"
2947
2968
  },
2948
- onClick: ve
2969
+ onClick: n[16] ||= (...e) => O(k).handleDeleteClick && O(k).handleDeleteClick(...e)
2949
2970
  }, D(a.value.mediaLibrary.deleteSelected), 1)) : u("", !0), e.onSelect ? (S(), d("button", {
2950
2971
  key: 1,
2951
2972
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-4 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
@@ -2953,71 +2974,71 @@ var Rr = {
2953
2974
  "background-color": "var(--tpl-primary)",
2954
2975
  color: "var(--tpl-bg)"
2955
2976
  },
2956
- disabled: !O(z).previewItem.value,
2957
- onClick: ne
2958
- }, D(a.value.mediaLibrary.selectFile), 9, Ei)) : u("", !0)])])])
2977
+ disabled: !O(E).previewItem.value,
2978
+ onClick: A
2979
+ }, D(a.value.mediaLibrary.selectFile), 9, Oi)) : u("", !0)])])])
2959
2980
  ]));
2960
2981
  }
2961
- }), Oi = (e, t, n) => {
2982
+ }), Ai = (e, t, n) => {
2962
2983
  let r = t.lastIndexOf("?"), i = e[r === -1 || r < t.lastIndexOf("/") ? t : t.slice(0, r)];
2963
2984
  return i ? typeof i == "function" ? i() : Promise.resolve(i) : new Promise((e, r) => {
2964
2985
  (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(r.bind(null, /* @__PURE__ */ Error("Unknown variable dynamic import: " + t + (t.split("/").length === n ? "" : ". Note that variables only represent file names one level deep."))));
2965
2986
  });
2966
- }, ki = ["en", "de"];
2967
- function Ai(e) {
2987
+ }, ji = ["en", "de"];
2988
+ function Mi(e) {
2968
2989
  return e.split("-")[0].toLowerCase();
2969
2990
  }
2970
- async function ji(e) {
2971
- let t = Ai(e), n = ki.includes(t) ? t : "en";
2972
- return (await Oi(/* @__PURE__ */ Object.assign({
2991
+ async function Ni(e) {
2992
+ let t = Mi(e), n = ji.includes(t) ? t : "en";
2993
+ return (await Ai(/* @__PURE__ */ Object.assign({
2973
2994
  "./locales/de.ts": () => import("./de-BULkjF_s.js"),
2974
2995
  "./locales/en.ts": () => import("./en-ivlOqPuR.js")
2975
2996
  }), `./locales/${n}.ts`, 3)).default;
2976
2997
  }
2977
2998
  //#endregion
2978
2999
  //#region src/standalone/visual.ts
2979
- var Mi = null, Ni = w(null);
2980
- async function Pi(e) {
3000
+ var $ = null, Pi = w(null);
3001
+ async function Fi(e) {
2981
3002
  let n = typeof e.container == "string" ? document.querySelector(e.container) : e.container;
2982
3003
  if (!n) throw Error(`Container element not found: ${e.container}`);
2983
- Mi && Fi();
3004
+ $ && Ii();
2984
3005
  let i = r(e.auth, e.onError);
2985
3006
  await i.initialize();
2986
- let a = await new t(i).fetchConfig(), o = await ji(e.locale ?? "en");
2987
- return Ii(n, e.theme), new Promise((t, r) => {
3007
+ let a = await new t(i).fetchConfig(), o = await Ni(e.locale ?? "en");
3008
+ return Li(n, e.theme), new Promise((t, r) => {
2988
3009
  try {
2989
- Mi = c({ setup() {
3010
+ $ = c({ setup() {
2990
3011
  let r = () => {
2991
3012
  t({
2992
- setTheme: (e) => Ii(n, e),
2993
- unmount: Fi
3013
+ setTheme: (e) => Li(n, e),
3014
+ unmount: Ii
2994
3015
  });
2995
3016
  };
2996
- return () => g(Di, {
3017
+ return () => g(ki, {
2997
3018
  authManager: i,
2998
3019
  projectId: i.projectId,
2999
3020
  planConfig: a,
3000
3021
  translations: o,
3001
3022
  onSelect: e.onSelect,
3002
3023
  onError: e.onError,
3003
- ref: Ni,
3024
+ ref: Pi,
3004
3025
  onReady: r
3005
3026
  });
3006
- } }), Mi.mount(n);
3027
+ } }), $.mount(n);
3007
3028
  } catch (e) {
3008
3029
  r(e);
3009
3030
  }
3010
3031
  });
3011
3032
  }
3012
- function Fi() {
3013
- Mi && (Mi.unmount(), Mi = null, Ni.value = null);
3033
+ function Ii() {
3034
+ $ && ($.unmount(), $ = null, Pi.value = null);
3014
3035
  }
3015
- function Ii(e, t) {
3036
+ function Li(e, t) {
3016
3037
  t && (t.primaryColor && e.style.setProperty("--tpl-primary", t.primaryColor), t.borderRadius !== void 0 && (e.style.setProperty("--tpl-radius", `${t.borderRadius}px`), e.style.setProperty("--tpl-radius-sm", `${Math.max(0, t.borderRadius - 3)}px`), e.style.setProperty("--tpl-radius-lg", `${t.borderRadius + 4}px`)));
3017
3038
  }
3018
3039
  typeof window < "u" && (window.TemplaticalMedia = {
3019
- init: Pi,
3020
- unmount: Fi
3040
+ init: Fi,
3041
+ unmount: Ii
3021
3042
  });
3022
3043
  //#endregion
3023
- export { le as MediaApiClient, Ir as MediaLibraryModal, Pi as init, Fi as unmount, Q as useI18n, he as useMediaCategories, ue as useMediaLibrary, Lr as useMediaPicker };
3044
+ export { ue as MediaApiClient, Rr as MediaLibraryModal, Fi as init, Ii as unmount, Z as useI18n, Q as useMediaCategories, de as useMediaLibrary, zr as useMediaPicker };