@emailmaker/filemanager 1.1.81 → 1.1.85-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
- import { $ as e, A as t, B as n, G as r, H as i, I as a, J as o, K as s, M as c, N as l, O as u, P as d, R as f, U as p, V as m, W as h, X as g, Y as _, Z as v, _ as y, a as b, bt as x, c as S, ct as C, d as w, dt as ee, f as T, ft as E, g as D, gt as O, h as k, i as A, it as te, j, k as M, l as ne, lt as N, m as re, mt as ie, n as P, o as ae, ot as oe, p as se, pt as ce, q as le, r as ue, s as de, st as fe, t as pe, tt as F, u as I, ut as L, v as me, vt as he, w as ge, yt as _e, z as ve } from "./file-manager-hooks-B_xL38Y5.js";
2
- import { a as ye, i as be, n as xe, o as Se, r as R, s as Ce, t as we } from "./file-manager-useMediaListEngine-DqKdMklL.js";
3
- import { i as Te, n as Ee, r as De, t as Oe } from "./file-manager-urls-DN9gaYil.js";
1
+ import { $ as e, A as t, B as n, G as r, H as i, I as a, J as o, K as s, M as c, N as l, O as u, P as d, R as f, U as p, V as m, W as h, X as g, Y as _, Z as v, _ as y, a as b, bt as x, c as S, ct as C, d as w, dt as ee, f as T, ft as E, g as D, gt as O, h as k, i as A, it as te, j, k as M, l as ne, lt as N, m as re, mt as ie, n as P, o as ae, ot as oe, p as se, pt as ce, q as le, r as ue, s as de, st as fe, t as pe, tt as F, u as I, ut as L, v as me, vt as he, w as ge, yt as _e, z as ve } from "./file-manager-hooks-D9OOfpfX.js";
2
+ import { a as ye, i as be, n as xe, o as Se, r as R, s as Ce, t as we } from "./file-manager-useMediaListEngine-B_YxvsBO.js";
3
+ import { t as Te } from "./file-manager-PageLoader-C55pqnwT.js";
4
+ import { n as Ee, r as De, t as Oe } from "./file-manager-urls-C8FU4GJ1.js";
4
5
  import * as ke from "react";
5
6
  import z, { Suspense as Ae, createElement as je, forwardRef as Me, memo as Ne, useCallback as B, useEffect as V, useImperativeHandle as Pe, useLayoutEffect as Fe, useMemo as H, useRef as U, useState as W } from "react";
6
7
  import { createRoot as Ie } from "react-dom/client";
@@ -9,7 +10,7 @@ import { Fragment as ft, jsx as J, jsxs as Y } from "react/jsx-runtime";
9
10
  import { ArrowLeftOutlined as pt, ArrowRightOutlined as X, CheckCircleOutlined as mt, CheckOutlined as ht, CloseOutlined as gt, ExclamationCircleOutlined as _t, EyeOutlined as vt, FileImageOutlined as yt, LoadingOutlined as bt } from "@ant-design/icons";
10
11
  import { StyleProvider as xt } from "@ant-design/cssinjs";
11
12
  import { createPortal as St } from "react-dom";
12
- import { ChevronDown as Ct, Colors as wt, Copy04 as Tt, Crop02 as Et, DotsVertical as Dt, FolderDownload as Ot, FolderPlus as kt, Grid01 as At, Image03 as jt, Link01 as Mt, List as Nt, Lock01 as Pt, PlaySquare as Ft, PlusCircle as It, QrCode02 as Lt, RefreshCw05 as Rt, Scale01 as zt, SearchMd as Bt, Stars02 as Vt, TextInput as Ht, ThumbsUp as Ut, Trash03 as Wt, Trash04 as Gt } from "@untitledui/icons";
13
+ import { ChevronDown as Ct, Colors as wt, Copy04 as Tt, Crop02 as Et, DotsVertical as Dt, FolderDownload as Ot, FolderPlus as kt, Grid01 as At, Image03 as jt, Link01 as Mt, List as Nt, Lock01 as Pt, PlaySquare as Ft, PlusCircle as It, QrCode02 as Lt, RefreshCw05 as Rt, Scale01 as zt, SearchMd as Bt, Star06 as Vt, TextInput as Ht, ThumbsUp as Ut, Trash03 as Wt, Trash04 as Gt } from "@untitledui/icons";
13
14
  //#region packages/file-manager/src/components/CustomSpinIndicator/CustomSpinIndicator.tsx
14
15
  var Kt = () => /* @__PURE__ */ J(bt, {
15
16
  style: {
@@ -61,7 +62,7 @@ function en(e) {
61
62
  done: !1,
62
63
  value: r.value
63
64
  };
64
- } while (!0);
65
+ } while (1);
65
66
  } };
66
67
  } };
67
68
  }
@@ -734,9 +735,7 @@ var Rn = z.memo(({ item: e, variant: t = "table", t: n, iconStrokeWidth: r, setC
734
735
  case "delete":
735
736
  c?.();
736
737
  break;
737
- default:
738
- i?.("");
739
- break;
738
+ default: i?.("");
740
739
  }
741
740
  }, [
742
741
  e,
@@ -746,14 +745,14 @@ var Rn = z.memo(({ item: e, variant: t = "table", t: n, iconStrokeWidth: r, setC
746
745
  c,
747
746
  a,
748
747
  s
749
- ]);
748
+ ]), m = H(() => ({
749
+ items: f,
750
+ onClick: p
751
+ }), [p, f]);
750
752
  return /* @__PURE__ */ J(Ke, {
751
753
  arrow: !0,
752
754
  placement: "bottom",
753
- menu: H(() => ({
754
- items: f,
755
- onClick: p
756
- }), [p, f]),
755
+ menu: m,
757
756
  trigger: ["hover"],
758
757
  onOpenChange: d,
759
758
  children: t === "grid" ? /* @__PURE__ */ J(G, {
@@ -810,6 +809,16 @@ var zn = ({ thumbnailSrc: e, previewSrc: t, lightboxSrc: n, alt: r, className: i
810
809
  h,
811
810
  f,
812
811
  p
812
+ ]), v = H(() => s && h ? {
813
+ src: h,
814
+ actionsRender: () => null,
815
+ destroyOnHidden: !0,
816
+ cover: /* @__PURE__ */ J(vt, { style: { fontSize: "20px" } }),
817
+ imageRender: _
818
+ } : !1, [
819
+ s,
820
+ h,
821
+ _
813
822
  ]);
814
823
  return /* @__PURE__ */ J(Je, {
815
824
  className: i,
@@ -817,17 +826,7 @@ var zn = ({ thumbnailSrc: e, previewSrc: t, lightboxSrc: n, alt: r, className: i
817
826
  alt: r,
818
827
  width: a,
819
828
  height: o,
820
- preview: H(() => s && h ? {
821
- src: h,
822
- actionsRender: () => null,
823
- destroyOnHidden: !0,
824
- cover: /* @__PURE__ */ J(vt, { style: { fontSize: "20px" } }),
825
- imageRender: _
826
- } : !1, [
827
- s,
828
- h,
829
- _
830
- ]),
829
+ preview: v,
831
830
  onLoad: u.handleLoad,
832
831
  onError: () => {
833
832
  u.handleError().catch(() => {});
@@ -2194,10 +2193,13 @@ var vr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
2194
2193
  }),
2195
2194
  /* @__PURE__ */ J($e, {
2196
2195
  className: `${R.deleteModal} deleteModal`,
2197
- title: /* @__PURE__ */ J("div", {
2198
- className: "modal-title",
2199
- children: ue?.enableTrashFolder && a === "Trash" || !ue?.enableTrashFolder ? P("Permanently delete") : P("Move to Trash")
2200
- }),
2196
+ title: (() => {
2197
+ let e = ue?.enableTrashFolder && a === "Trash" || !ue?.enableTrashFolder ? P("Permanently delete") : P("Move to Trash");
2198
+ return /* @__PURE__ */ J("div", {
2199
+ className: "modal-title",
2200
+ children: e
2201
+ });
2202
+ })(),
2201
2203
  open: !!te,
2202
2204
  onOk: () => {
2203
2205
  L(!0);
@@ -2521,7 +2523,7 @@ var vr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
2521
2523
  }
2522
2524
  ].filter((e) => !e.disabled), de = B(async (e) => {
2523
2525
  let t = e[0];
2524
- !t || t === "empty" || (l !== "my_files" && u(ce), n?.(t), await a?.(t === "folders" ? null : t));
2526
+ t && t !== "empty" && (l !== "my_files" && u(ce), n?.(t), await a?.(t === "folders" ? null : t));
2525
2527
  }, [
2526
2528
  n,
2527
2529
  l,
@@ -2536,7 +2538,7 @@ var vr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
2536
2538
  }, [S, u]), pe = B(async (e, t) => {
2537
2539
  if (M(e), S?.folderTreeLoading !== "lazy") return;
2538
2540
  let n = t?.node?.key || void 0;
2539
- if (!(!n || n === "folders")) try {
2541
+ if (n && n !== "folders") try {
2540
2542
  await a?.(n);
2541
2543
  } catch (e) {
2542
2544
  console.warn("Could not load the child folders for", n, e);
@@ -2644,7 +2646,7 @@ var vr = ({ isModalVisible: e, handleModalOk: t, handleModalCancel: n, form: r,
2644
2646
  br.displayName = "FolderSidebar";
2645
2647
  //#endregion
2646
2648
  //#region packages/file-manager/src/components/PixieEditor/index.tsx
2647
- var xr = z.lazy(async () => ({ default: (await import("./file-manager-PixieEditor-D7KvwgMy.js")).PixieEditor })), Sr = {
2649
+ var xr = z.lazy(async () => ({ default: (await import("./file-manager-PixieEditor.js")).PixieEditor })), Sr = {
2648
2650
  position: "fixed",
2649
2651
  inset: 0,
2650
2652
  display: "flex",
@@ -2911,8 +2913,8 @@ var xr = z.lazy(async () => ({ default: (await import("./file-manager-PixieEdito
2911
2913
  })
2912
2914
  });
2913
2915
  }, Ar = ({ imageId: e, sourceUrl: t, shouldLoad: n = !0, loader: r, onLoad: i, ...a }) => {
2914
- let o = A(H(() => [t], [t])), [s, c] = W(() => r.getSnapshot(e, t)), l = U(null);
2915
- return V(() => (c(r.getSnapshot(e, t)), r.subscribe(e, t, c)), [
2916
+ let o = H(() => [t], [t]), s = A(o), [c, l] = W(() => r.getSnapshot(e, t)), u = U(null);
2917
+ return V(() => (l(r.getSnapshot(e, t)), r.subscribe(e, t, l)), [
2916
2918
  e,
2917
2919
  r,
2918
2920
  t
@@ -2923,16 +2925,16 @@ var xr = z.lazy(async () => ({ default: (await import("./file-manager-PixieEdito
2923
2925
  r,
2924
2926
  n,
2925
2927
  t
2926
- ]), !s.shouldLoad || !o.src ? null : /* @__PURE__ */ J("img", {
2928
+ ]), !c.shouldLoad || !s.src ? null : /* @__PURE__ */ J("img", {
2927
2929
  ...a,
2928
- ref: l,
2929
- src: o.src,
2930
+ ref: u,
2931
+ src: s.src,
2930
2932
  loading: a.loading ?? "lazy",
2931
2933
  onLoad: (t) => {
2932
- o.handleLoad(), r.markLoaded(e), i?.(t);
2934
+ s.handleLoad(), r.markLoaded(e), i?.(t);
2933
2935
  },
2934
2936
  onError: async (t) => {
2935
- (await o.handleError()).exhausted && r.markError(e), a.onError?.(t);
2937
+ (await s.handleError()).exhausted && r.markError(e), a.onError?.(t);
2936
2938
  }
2937
2939
  });
2938
2940
  }, jr = 42, Mr = 6;
@@ -2980,8 +2982,8 @@ var Fr = {
2980
2982
  let A = u?.handleProxyUrl, te = u?.fetchWithProxy, j = async (e) => A ? await Promise.resolve(A(e)) ?? e : e, M = B(async (e) => te ? Promise.resolve(te(e, void 0, { intent: "metadata" })) : fetch(await j(e)), [te, j]), ne = async function({ query: e, page: t }) {
2981
2983
  let n = e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g, "").replace(/[\s_-]+/g, " ");
2982
2984
  try {
2983
- let e = `${_e}/search?api_key=${u?.REACT_APP_GIPHY_KEY ?? "Nh77eBlPeMn1ed9MBAvL542NUGeNO26F"}&q=${encodeURIComponent(n)}&limit=${Ir}&offset=${t}&lang=en`;
2984
- return { data: await (await M(e)).json() };
2985
+ let e = u?.REACT_APP_GIPHY_KEY ?? "Nh77eBlPeMn1ed9MBAvL542NUGeNO26F", r = `${_e}/search?api_key=${e}&q=${encodeURIComponent(n)}&limit=${Ir}&offset=${t}&lang=en`;
2986
+ return { data: await (await M(r)).json() };
2985
2987
  } catch (e) {
2986
2988
  console.warn(e);
2987
2989
  }
@@ -2999,7 +3001,7 @@ var Fr = {
2999
3001
  resolveColumnCount: Br
3000
3002
  }), oe = pe(ae, [t.length]), se = () => {
3001
3003
  ee.current &&= (clearTimeout(ee.current), null);
3002
- }, ce = (e) => k.current.has(e) ? !1 : (k.current.add(e), !0), ue = (e) => {
3004
+ }, ce = (e) => !k.current.has(e) && (k.current.add(e), !0), ue = (e) => {
3003
3005
  k.current.delete(e);
3004
3006
  }, de = B(async () => {
3005
3007
  let t = w.current.keywords?.trim();
@@ -3235,7 +3237,7 @@ var Fr = {
3235
3237
  }, Qr = ({ imageStockList: e, setImageStockList: t, currentReq: n, setCurrentReq: r, inputRef: a, customRequest: o }) => {
3236
3238
  let { t: s } = le(), { StockBigIcon: c, MixedViewIcon: l, LandscapeViewIcon: u, PortraitViewIcon: d, SquareViewIcon: f } = Ce(), { options: p } = i(), { config: m } = p, h = b({ maxConcurrent: Gr }), [g, _] = W(!1), [v, y] = W(!1), [S, C] = W(!1), [w, ee] = W(null), [T, E] = W(/* @__PURE__ */ new Set()), [D] = K.useForm(), O = m?.fetchWithProxy, k = m?.handleProxyUrl, A = m?.UNSPLASH_KEY ?? "HX2_qqq3F3ljmtYtfmb9P6h0dn2u9mnnOl36IdV8el0", te = m?.locale?.slice(0, 2) || "ru", j = U(n), M = U(null), ne = U(null), N = U(0), ie = U(1), P = U(/* @__PURE__ */ new Set()), ae = async (e) => k ? await Promise.resolve(k(e)) ?? e : e, oe = B(async (e) => O ? Promise.resolve(O(e, void 0, { intent: "metadata" })) : fetch(await ae(e)), [O, ae]), se = () => {
3237
3239
  M.current &&= (clearTimeout(M.current), null);
3238
- }, ce = (e) => P.current.has(e) ? !1 : (P.current.add(e), !0), ue = (e) => {
3240
+ }, ce = (e) => !P.current.has(e) && (P.current.add(e), !0), ue = (e) => {
3239
3241
  P.current.delete(e);
3240
3242
  }, de = (e) => e.map((e) => ({
3241
3243
  ...e,
@@ -3685,11 +3687,26 @@ function ri({ setFrameHeight: e, customRequest: t, aiTabRef: n, isImageUploaded:
3685
3687
  }, [s, C]);
3686
3688
  let M = H(() => h && typeof h?.sendAIImageRequest == "function" ? h?.sendAIImageRequest : () => Promise.resolve({}), [h]), ne = B((e) => {
3687
3689
  let t = `${C}-${e.progress}-${JSON.stringify(e.images || e.data)}`;
3688
- if (!j.current.has(t)) if (j.current.add(t), e.status !== "error" && e.status !== "Canceled") {
3689
- if (e.images) {
3690
- if (D(String(e.status)), e.progress === 100) {
3691
- u(!1), c(e.images);
3692
- let t = C, n = Array.isArray(e.images) ? e.images : [];
3690
+ if (!j.current.has(t)) {
3691
+ if (j.current.add(t), e.status !== "error" && e.status !== "Canceled") {
3692
+ if (e.images) {
3693
+ if (D(String(e.status)), e.progress === 100) {
3694
+ u(!1), c(e.images);
3695
+ let t = C, n = Array.isArray(e.images) ? e.images : [];
3696
+ n.length > 0 && t && !A.current.has(t) && (A.current.add(t), g.success({
3697
+ id: "AI_IMAGE_GENERERATION_SUCCESS",
3698
+ message: p("Images generated successfully"),
3699
+ placement: "bottomRight",
3700
+ data: {
3701
+ request: o,
3702
+ taskId: t,
3703
+ images: n
3704
+ }
3705
+ })), w(null), k(!1);
3706
+ }
3707
+ } else if (e.data && (c([String(e.data)]), e.progress === 100)) {
3708
+ u(!1);
3709
+ let t = C, n = e.data ? [String(e.data)] : [];
3693
3710
  n.length > 0 && t && !A.current.has(t) && (A.current.add(t), g.success({
3694
3711
  id: "AI_IMAGE_GENERERATION_SUCCESS",
3695
3712
  message: p("Images generated successfully"),
@@ -3701,32 +3718,19 @@ function ri({ setFrameHeight: e, customRequest: t, aiTabRef: n, isImageUploaded:
3701
3718
  }
3702
3719
  })), w(null), k(!1);
3703
3720
  }
3704
- } else if (e.data && (c([String(e.data)]), e.progress === 100)) {
3705
- u(!1);
3706
- let t = C, n = e.data ? [String(e.data)] : [];
3707
- n.length > 0 && t && !A.current.has(t) && (A.current.add(t), g.success({
3708
- id: "AI_IMAGE_GENERERATION_SUCCESS",
3709
- message: p("Images generated successfully"),
3710
- placement: "bottomRight",
3711
- data: {
3712
- request: o,
3713
- taskId: t,
3714
- images: n
3715
- }
3716
- })), w(null), k(!1);
3717
- }
3718
- } else u(!1), k(!1), C && !te.current.has(C) && (te.current.add(C), g.error({
3719
- id: "AI_RESPONSE_INVALID",
3720
- message: p("Something went wrong, please try again"),
3721
- placement: "bottomRight",
3722
- description: String(C) || void 0,
3723
- data: {
3724
- requestId: C,
3725
- request: o,
3726
- response: e
3727
- },
3728
- innerException: e
3729
- }));
3721
+ } else u(!1), k(!1), C && !te.current.has(C) && (te.current.add(C), g.error({
3722
+ id: "AI_RESPONSE_INVALID",
3723
+ message: p("Something went wrong, please try again"),
3724
+ placement: "bottomRight",
3725
+ description: String(C) || void 0,
3726
+ data: {
3727
+ requestId: C,
3728
+ request: o,
3729
+ response: e
3730
+ },
3731
+ innerException: e
3732
+ }));
3733
+ }
3730
3734
  }, [
3731
3735
  o,
3732
3736
  c,
@@ -3986,13 +3990,13 @@ var ii = {
3986
3990
  children: o
3987
3991
  });
3988
3992
  }, si = ({ text: e, counter: t, limits: n, wrapperStyles: r }) => {
3989
- let { t: a } = le(), { options: o } = i(), s = o.config, { token: c } = dt.useToken(), l = +n > 0, u = !l || t < +n, d = s?.billingPageUrl || "/billing";
3993
+ let { t: a } = le(), { options: o } = i(), s = o.config, { token: c } = dt.useToken(), l = +n > 0, u = !l || t < +n, d = s?.billingPageUrl || "/billing", f = t + " " + a("of") + " " + (l ? n : "∞") + " " + (e || a("tests", { count: n })) + " " + a("was used", { count: t });
3990
3994
  return /* @__PURE__ */ Y("div", {
3991
3995
  className: "limits-couter-wrapper",
3992
3996
  style: r,
3993
3997
  children: [/* @__PURE__ */ J(oi, {
3994
3998
  variant: "filled",
3995
- text: t + " " + a("of") + " " + (l ? n : "∞") + " " + (e || a("tests", { count: n })) + " " + a("was used", { count: t }),
3999
+ text: f,
3996
4000
  className: "limit-counter",
3997
4001
  style: { color: u ? c.colorText : "white" },
3998
4002
  color: u ? c.colorFillSecondary : "rgb(255, 77, 79)"
@@ -4181,7 +4185,7 @@ var di = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
4181
4185
  d,
4182
4186
  l
4183
4187
  ]), y = B(async () => {
4184
- if (!(!c || !l)) try {
4188
+ if (c && l) try {
4185
4189
  let t = await l.validateFields();
4186
4190
  if (!t?.newFolderName) {
4187
4191
  o.warning({
@@ -4355,10 +4359,10 @@ var di = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
4355
4359
  document.documentElement.setAttribute("data-theme", e);
4356
4360
  }, { Sider: _i, Content: vi } = Xe, yi = z.lazy(() => import(
4357
4361
  /* webpackChunkName: "fm-icons-tab" */
4358
- "./file-manager-IconsTab-B-SBqKG5.js"
4362
+ "./file-manager-IconsTab.js"
4359
4363
  )), bi = z.lazy(() => import(
4360
4364
  /* webpackChunkName: "fm-image-code-generator" */
4361
- "./file-manager-ImageCodeGenerator-Bz0238mQ.js"
4365
+ "./file-manager-ImageCodeGenerator.js"
4362
4366
  )), xi = { keywords: "" }, Si = {
4363
4367
  imageStock: "jpg",
4364
4368
  gif: "gif"
@@ -4681,8 +4685,8 @@ var di = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
4681
4685
  } else s.markAsSuccess(l);
4682
4686
  await Oe.current?.refreshFileCounts();
4683
4687
  } catch (e) {
4684
- let t = a(d(e), h);
4685
- s.markAsError(l, t);
4688
+ let t = d(e), n = a(t, h);
4689
+ s.markAsError(l, n);
4686
4690
  }
4687
4691
  } finally {
4688
4692
  je(!1);
@@ -5266,43 +5270,43 @@ var di = ({ customRequest: e, inputAiRef: t, isImageUploaded: n, setIsImageUploa
5266
5270
  }, [h]), V(() => {
5267
5271
  h.locale && h.locale !== s.language && s.changeLanguage(h.locale), h.customLocale && h.locale && s.addResourceBundle(h.locale, "translation", h.customLocale, !0, !0);
5268
5272
  }, [h.locale, h.customLocale]);
5269
- let g = U(null), _ = B(() => g.current ?? document.body, []);
5273
+ let g = U(null), _ = B(() => g.current ?? document.body, []), v = z.useMemo(() => ({
5274
+ apiEndpoints: o,
5275
+ searchQuery: i,
5276
+ sortBySize: a,
5277
+ onPathChange: t,
5278
+ onChangeSelection: n,
5279
+ onEditorOk: r,
5280
+ config: h,
5281
+ customIcons: c,
5282
+ dragDropIcon: l,
5283
+ dataProviders: u,
5284
+ handleNotify: d,
5285
+ handleError: f,
5286
+ handleSuccess: p,
5287
+ getModalContainer: _
5288
+ }), [
5289
+ o,
5290
+ i,
5291
+ a,
5292
+ t,
5293
+ n,
5294
+ r,
5295
+ h,
5296
+ c,
5297
+ l,
5298
+ u,
5299
+ d,
5300
+ f,
5301
+ p,
5302
+ _
5303
+ ]);
5270
5304
  return /* @__PURE__ */ J(Re, {
5271
5305
  className: "em-filemanager",
5272
5306
  children: /* @__PURE__ */ Y(ft, { children: [/* @__PURE__ */ J(We, {
5273
5307
  getPopupContainer: () => g.current || document.body,
5274
5308
  children: /* @__PURE__ */ J(m, {
5275
- options: z.useMemo(() => ({
5276
- apiEndpoints: o,
5277
- searchQuery: i,
5278
- sortBySize: a,
5279
- onPathChange: t,
5280
- onChangeSelection: n,
5281
- onEditorOk: r,
5282
- config: h,
5283
- customIcons: c,
5284
- dragDropIcon: l,
5285
- dataProviders: u,
5286
- handleNotify: d,
5287
- handleError: f,
5288
- handleSuccess: p,
5289
- getModalContainer: _
5290
- }), [
5291
- o,
5292
- i,
5293
- a,
5294
- t,
5295
- n,
5296
- r,
5297
- h,
5298
- c,
5299
- l,
5300
- u,
5301
- d,
5302
- f,
5303
- p,
5304
- _
5305
- ]),
5309
+ options: v,
5306
5310
  children: /* @__PURE__ */ J(Ci, {})
5307
5311
  })
5308
5312
  }), /* @__PURE__ */ J("div", {
@@ -5791,41 +5795,43 @@ function Qi(e) {
5791
5795
  };
5792
5796
  }
5793
5797
  //#endregion
5794
- //#region packages/file-manager/src/adapters/TreeCache.ts
5795
- var $i = "", ea = 1800 * 1e3;
5796
- function ta(e) {
5797
- return e == null || e === "" ? $i : e;
5798
+ //#region packages/file-manager/src/utils/generateId.ts
5799
+ function $i() {
5800
+ if (typeof globalThis?.crypto?.randomUUID == "function") return globalThis.crypto.randomUUID();
5801
+ try {
5802
+ let e = globalThis.crypto || globalThis.msCrypto;
5803
+ if (e && typeof e.getRandomValues == "function") {
5804
+ let t = /* @__PURE__ */ new Uint8Array(16);
5805
+ e.getRandomValues(t);
5806
+ let n = "";
5807
+ for (let e = 0; e < t.length; e++) n += t[e].toString(16).padStart(2, "0");
5808
+ return `id_${n}`;
5809
+ }
5810
+ } catch {}
5811
+ return `id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random() * (2 ** 53 - 1)).toString(36).slice(0, 8)}`;
5798
5812
  }
5813
+ //#endregion
5814
+ //#region packages/file-manager/src/adapters/TreeCache.ts
5815
+ var ea = "", ta = 18e5;
5799
5816
  function na(e) {
5817
+ return e == null || e === "" ? ea : e;
5818
+ }
5819
+ function ra(e) {
5800
5820
  if (e == null) return Infinity;
5801
5821
  let t = Number(e);
5802
5822
  return Number.isFinite(t) && t >= 0 ? t : Infinity;
5803
5823
  }
5804
- function ra(e) {
5824
+ function ia(e) {
5805
5825
  return !e || typeof e.search != "string" ? !1 : e.search.trim().length > 0;
5806
5826
  }
5807
- function ia(e) {
5827
+ function aa(e) {
5808
5828
  if (!e) return null;
5809
5829
  let t = e.folderId;
5810
5830
  return t == null ? null : String(t);
5811
5831
  }
5812
- function aa(e) {
5832
+ function oa(e) {
5813
5833
  return !!e && !!e.isFolder;
5814
5834
  }
5815
- function oa() {
5816
- if (typeof globalThis?.crypto?.randomUUID == "function") return globalThis.crypto.randomUUID();
5817
- try {
5818
- let e = globalThis.crypto || globalThis.msCrypto;
5819
- if (e && typeof e.getRandomValues == "function") {
5820
- let t = /* @__PURE__ */ new Uint8Array(16);
5821
- e.getRandomValues(t);
5822
- let n = "";
5823
- for (let e = 0; e < t.length; e++) n += t[e].toString(16).padStart(2, "0");
5824
- return `id_${n}`;
5825
- }
5826
- } catch {}
5827
- return `id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random() * (2 ** 53 - 1)).toString(36).slice(0, 8)}`;
5828
- }
5829
5835
  function sa(e) {
5830
5836
  if (!e || typeof e != "object") return !1;
5831
5837
  let t = e;
@@ -5878,14 +5884,14 @@ var ua = class e {
5878
5884
  }
5879
5885
  getFileSystemItem(e) {
5880
5886
  let t = this.getEntity(e);
5881
- return t && !aa(t) ? t : void 0;
5887
+ return t && !oa(t) ? t : void 0;
5882
5888
  }
5883
5889
  getFolder(e) {
5884
5890
  let t = this.getEntity(e);
5885
- return t && aa(t) ? t : void 0;
5891
+ return t && oa(t) ? t : void 0;
5886
5892
  }
5887
5893
  getChildrenIds(e, t = {}) {
5888
- let n = ta(e), r = this.childrenByParent.get(n);
5894
+ let n = na(e), r = this.childrenByParent.get(n);
5889
5895
  return r ? t.onlyFileSystemItems ? Array.from(r.files) : t.onlyFolders ? Array.from(r.folders) : [...Array.from(r.folders), ...Array.from(r.files)] : [];
5890
5896
  }
5891
5897
  searchByUrl(e) {
@@ -5897,13 +5903,13 @@ var ua = class e {
5897
5903
  return null;
5898
5904
  }
5899
5905
  upsertEntity(e) {
5900
- let t = this.entities.get(e.id) ?? null, n = t ? t.value : null, r = n ? ia(n) : null, i = ia(e), a = n ? aa(n) : !1, o = aa(e), s;
5901
- if (n && aa(n) && o) {
5906
+ let t = this.entities.get(e.id) ?? null, n = t ? t.value : null, r = n ? aa(n) : null, i = aa(e), a = n ? oa(n) : !1, o = oa(e), s;
5907
+ if (n && oa(n) && o) {
5902
5908
  let t = n.childrenCount, r = e.childrenCount;
5903
5909
  t !== void 0 && r === void 0 && (s = t);
5904
5910
  }
5905
5911
  if (n && (r !== i || a !== o)) {
5906
- let t = ta(r), n = this.childrenByParent.get(t);
5912
+ let t = na(r), n = this.childrenByParent.get(t);
5907
5913
  n && (a ? n.folders.delete(e.id) : n.files.delete(e.id), n.files.size === 0 && n.folders.size === 0 && this.childrenByParent.delete(t));
5908
5914
  }
5909
5915
  let c = e;
@@ -5914,7 +5920,7 @@ var ua = class e {
5914
5920
  value: { ...c },
5915
5921
  updatedAt: this.now()
5916
5922
  }), this.checkCacheSize();
5917
- let l = ta(i), u = this.childrenByParent.get(l);
5923
+ let l = na(i), u = this.childrenByParent.get(l);
5918
5924
  u || (u = {
5919
5925
  files: /* @__PURE__ */ new Set(),
5920
5926
  folders: /* @__PURE__ */ new Set()
@@ -5923,7 +5929,7 @@ var ua = class e {
5923
5929
  updateServerChildrenCount(e, t) {
5924
5930
  if (e == null || t == null || Number.isNaN(t)) return;
5925
5931
  let n = this.entities.get(e);
5926
- if (!n || !aa(n.value)) return;
5932
+ if (!n || !oa(n.value)) return;
5927
5933
  let r = {
5928
5934
  ...n.value,
5929
5935
  childrenCount: t
@@ -5939,32 +5945,32 @@ var ua = class e {
5939
5945
  entity: null,
5940
5946
  parentId: null
5941
5947
  };
5942
- let n = t.value, r = ia(n), i = ta(r), a = this.childrenByParent.get(i);
5943
- return a && (aa(n) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i)), this.entities.delete(e), {
5948
+ let n = t.value, r = aa(n), i = na(r), a = this.childrenByParent.get(i);
5949
+ return a && (oa(n) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i)), this.entities.delete(e), {
5944
5950
  entity: { ...n },
5945
5951
  parentId: r
5946
5952
  };
5947
5953
  }
5948
5954
  deleteFolderRecursive(e) {
5949
5955
  let t = this.entities.get(e);
5950
- if (!t || !aa(t.value)) return {
5956
+ if (!t || !oa(t.value)) return {
5951
5957
  deletedFolderRecords: [],
5952
5958
  deletedFileSystemItemRecords: []
5953
5959
  };
5954
5960
  let n = [{
5955
5961
  id: e,
5956
- parentId: ia(t.value)
5962
+ parentId: aa(t.value)
5957
5963
  }], r = [], i = [];
5958
5964
  for (; n.length;) {
5959
5965
  let e = n.shift();
5960
5966
  r.push(e);
5961
- let t = this.childrenByParent.get(ta(e.id));
5967
+ let t = this.childrenByParent.get(na(e.id));
5962
5968
  if (t) {
5963
5969
  for (let e of Array.from(t.folders)) {
5964
5970
  let t = this.entities.get(e);
5965
5971
  t && n.push({
5966
5972
  id: e,
5967
- parentId: ia(t.value)
5973
+ parentId: aa(t.value)
5968
5974
  });
5969
5975
  }
5970
5976
  for (let e of Array.from(t.files)) i.push(e);
@@ -5974,16 +5980,16 @@ var ua = class e {
5974
5980
  for (let e of i) {
5975
5981
  let t = this.entities.get(e);
5976
5982
  if (!t) continue;
5977
- let n = t.value, r = ta(ia(n)), i = this.childrenByParent.get(r);
5983
+ let n = t.value, r = na(aa(n)), i = this.childrenByParent.get(r);
5978
5984
  i && (i.files.delete(e), i.files.size === 0 && i.folders.size === 0 && this.childrenByParent.delete(r)), this.entities.delete(e), a.push({ ...n });
5979
5985
  }
5980
5986
  let o = [];
5981
5987
  for (let e = r.length - 1; e >= 0; e--) {
5982
5988
  let { id: t, parentId: n } = r[e], i = this.entities.get(t);
5983
5989
  if (!i) continue;
5984
- let a = i.value, s = ta(a.id);
5990
+ let a = i.value, s = na(a.id);
5985
5991
  this.childrenByParent.delete(s);
5986
- let c = ta(n), l = this.childrenByParent.get(c);
5992
+ let c = na(n), l = this.childrenByParent.get(c);
5987
5993
  l && (l.folders.delete(t), l.files.size === 0 && l.folders.size === 0 && this.childrenByParent.delete(c)), this.entities.delete(t), o.push({ ...a });
5988
5994
  }
5989
5995
  return {
@@ -5994,13 +6000,13 @@ var ua = class e {
5994
6000
  moveEntityById(e, t) {
5995
6001
  let n = this.entities.get(e) ?? null;
5996
6002
  if (!n) return null;
5997
- let r = n.value, i = ta(ia(r)), a = this.childrenByParent.get(i);
5998
- a && (aa(r) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i));
6003
+ let r = n.value, i = na(aa(r)), a = this.childrenByParent.get(i);
6004
+ a && (oa(r) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i));
5999
6005
  let o = {
6000
6006
  ...r,
6001
6007
  folderId: t
6002
6008
  };
6003
- if (aa(r) && aa(o)) {
6009
+ if (oa(r) && oa(o)) {
6004
6010
  let e = r.childrenCount;
6005
6011
  e !== void 0 && (o.childrenCount = e);
6006
6012
  }
@@ -6008,15 +6014,15 @@ var ua = class e {
6008
6014
  value: o,
6009
6015
  updatedAt: this.now()
6010
6016
  });
6011
- let s = ta(t), c = this.childrenByParent.get(s);
6017
+ let s = na(t), c = this.childrenByParent.get(s);
6012
6018
  return c || (c = {
6013
6019
  files: /* @__PURE__ */ new Set(),
6014
6020
  folders: /* @__PURE__ */ new Set()
6015
- }, this.childrenByParent.set(s, c)), aa(o) ? c.folders.add(e) : c.files.add(e), { ...o };
6021
+ }, this.childrenByParent.set(s, c)), oa(o) ? c.folders.add(e) : c.files.add(e), { ...o };
6016
6022
  }
6017
6023
  copyFileSystemItem(e, t, n) {
6018
6024
  let r = this.entities.get(e) ?? null;
6019
- if (!r || aa(r.value)) return null;
6025
+ if (!r || oa(r.value)) return null;
6020
6026
  let i = {
6021
6027
  ...r.value,
6022
6028
  id: t,
@@ -6026,7 +6032,7 @@ var ua = class e {
6026
6032
  }
6027
6033
  copyFolderShallow(e, t, n) {
6028
6034
  let r = this.entities.get(e) ?? null;
6029
- if (!r || !aa(r.value)) return null;
6035
+ if (!r || !oa(r.value)) return null;
6030
6036
  let i = {
6031
6037
  ...r.value,
6032
6038
  id: t,
@@ -6050,7 +6056,7 @@ var ua = class e {
6050
6056
  let n = t?.parentId, r = t?.recursive ?? !1, i = t?.itemType ?? "all", a = t?.caseSensitive ?? !1, o = t?.limit ?? Infinity, s = a ? e.trim() : e.trim().toLowerCase(), c = [], l = null;
6051
6057
  if (n !== void 0) {
6052
6058
  l = /* @__PURE__ */ new Set();
6053
- let e = ta(n);
6059
+ let e = na(n);
6054
6060
  if (l.add(e), r) {
6055
6061
  let t = [e], n = /* @__PURE__ */ new Set();
6056
6062
  for (; t.length > 0;) {
@@ -6066,10 +6072,10 @@ var ua = class e {
6066
6072
  if (c.length >= o) break;
6067
6073
  let t = e.value;
6068
6074
  if (l !== null) {
6069
- let e = ta(ia(t));
6075
+ let e = na(aa(t));
6070
6076
  if (!l.has(e)) continue;
6071
6077
  }
6072
- if (i === "file" && aa(t) || i === "folder" && !aa(t)) continue;
6078
+ if (i === "file" && oa(t) || i === "folder" && !oa(t)) continue;
6073
6079
  let n = t.name ?? "";
6074
6080
  (a ? n : n.toLowerCase()).includes(s) && c.push({ ...t });
6075
6081
  }
@@ -6097,7 +6103,7 @@ var ua = class e {
6097
6103
  return n;
6098
6104
  }
6099
6105
  }, da = class e {
6100
- constructor(e = {}, t = ea, n, r, i = new Ri(), a = sa) {
6106
+ constructor(e = {}, t = ta, n, r, i = new Ri(), a = sa) {
6101
6107
  this.views = /* @__PURE__ */ new Map(), this.maxViewsPerParent = 50;
6102
6108
  let o = Ji(e);
6103
6109
  this.strategy = {
@@ -6121,7 +6127,7 @@ var ua = class e {
6121
6127
  return Date.now();
6122
6128
  }
6123
6129
  parentKey(e) {
6124
- return ta(e ?? null);
6130
+ return na(e ?? null);
6125
6131
  }
6126
6132
  isExpired(e) {
6127
6133
  return e == null || this.ttl !== Infinity && this.now() - e > this.ttl;
@@ -6130,13 +6136,13 @@ var ua = class e {
6130
6136
  return !e || e.some((e) => !t.getEntity(e) || t.isEntityStale(e, this.entityTtl));
6131
6137
  }
6132
6138
  isEntityTypeCompatible(e, t) {
6133
- return !!(!t || t === "all" || t === "file" && !aa(e) || t === "folder" && aa(e));
6139
+ return !!(!t || t === "all" || t === "file" && !oa(e) || t === "folder" && oa(e));
6134
6140
  }
6135
6141
  markViewStaleForReload(e) {
6136
6142
  e.view.meta = {
6137
6143
  ...e.view.meta ?? {},
6138
6144
  stale: !0
6139
- }, e.view.updatedAt = this.now(), e.view.loadId = oa(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
6145
+ }, e.view.updatedAt = this.now(), e.view.loadId = $i(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
6140
6146
  }
6141
6147
  cleanupOldViews(e) {
6142
6148
  if (e.size <= this.maxViewsPerParent) return;
@@ -6170,11 +6176,11 @@ var ua = class e {
6170
6176
  };
6171
6177
  }
6172
6178
  if (c.view.promise) return c.view.promise;
6173
- let u = oa();
6179
+ let u = $i();
6174
6180
  c.view.loadId = u;
6175
6181
  let d = (async () => {
6176
6182
  try {
6177
- let a = await n(e, t), o = ra(t), l = o ? {
6183
+ let a = await n(e, t), o = ia(t), l = o ? {
6178
6184
  ...a,
6179
6185
  total: void 0
6180
6186
  } : a, d = this.views.get(i)?.get(la(t));
@@ -6186,7 +6192,7 @@ var ua = class e {
6186
6192
  c.view.value = l.items.map((e) => e.id);
6187
6193
  let { items: f, ...p } = l, m = { ...p };
6188
6194
  c.view.meta = m, c.view.meta && (c.view.meta.stale = !1), this.failedRequests.delete(s), c.view.updatedAt = this.now(), !o && typeof m.total == "number" && (this.serverChildrenCountHandler ? this.serverChildrenCountHandler(e ?? null, m.total, r) : r.updateServerChildrenCount(e, m.total));
6189
- let h = this.strategy.preloadPagesAfter ?? 0, g = this.strategy.preloadPagesBefore ?? 0, _ = na(t?.pageSize);
6195
+ let h = this.strategy.preloadPagesAfter ?? 0, g = this.strategy.preloadPagesBefore ?? 0, _ = ra(t?.pageSize);
6190
6196
  if ((h > 0 || g > 0) && Number.isFinite(_)) {
6191
6197
  let i = e, a = { ...t }, o = typeof m.totalPages == "number" ? m.totalPages : 1, s = t?.page ?? 1, c = _, l = n, d = u;
6192
6198
  setTimeout(() => {
@@ -6297,7 +6303,7 @@ var ua = class e {
6297
6303
  syncTotalsInSameViews(e, t) {
6298
6304
  let n = t.view.meta;
6299
6305
  if (!n || typeof n.total != "number") return;
6300
- let r = Number(n.total), i = na(t.params?.pageSize), a = Number.isFinite(i) && i > 0 ? Math.max(1, Math.ceil(r / i)) : void 0;
6306
+ let r = Number(n.total), i = ra(t.params?.pageSize), a = Number.isFinite(i) && i > 0 ? Math.max(1, Math.ceil(r / i)) : void 0;
6301
6307
  for (let [, n] of e) this.isParamsSame(n.params ?? {}, t.params ?? {}) && (n.view.meta || (n.view.meta = {}), n.view.meta.total = r, a !== void 0 && (n.view.meta.totalPages = a));
6302
6308
  }
6303
6309
  cascadeShiftPages(e, t, n, r, i, a, o) {
@@ -6351,26 +6357,28 @@ var ua = class e {
6351
6357
  ...o,
6352
6358
  page: n + 1
6353
6359
  }, c = la(s), l = e.get(c), u = !1;
6354
- if (!l?.view.value || this.isExpired(l.view.updatedAt)) if (n >= i) {
6355
- l = {
6356
- params: s,
6357
- view: {
6358
- promise: null,
6359
- value: void 0,
6360
- meta: void 0,
6361
- updatedAt: 0,
6362
- loadId: null
6363
- }
6364
- }, e.set(c, l), this.cleanupOldViews(e);
6365
- let r = t.view.meta;
6366
- r && (l.view.meta = {
6367
- ...r,
6368
- page: n + 1
6369
- }), u = !0;
6370
- } else return t.view.meta = {
6371
- ...t.view.meta ?? {},
6372
- stale: !0
6373
- }, !1;
6360
+ if (!l?.view.value || this.isExpired(l.view.updatedAt)) {
6361
+ if (n >= i) {
6362
+ l = {
6363
+ params: s,
6364
+ view: {
6365
+ promise: null,
6366
+ value: void 0,
6367
+ meta: void 0,
6368
+ updatedAt: 0,
6369
+ loadId: null
6370
+ }
6371
+ }, e.set(c, l), this.cleanupOldViews(e);
6372
+ let r = t.view.meta;
6373
+ r && (l.view.meta = {
6374
+ ...r,
6375
+ page: n + 1
6376
+ }), u = !0;
6377
+ } else return t.view.meta = {
6378
+ ...t.view.meta ?? {},
6379
+ stale: !0
6380
+ }, !1;
6381
+ }
6374
6382
  let d = t.view.value.slice(r).filter((e) => a.getEntity(e));
6375
6383
  if (d.length === 0) return u && e.delete(c), !1;
6376
6384
  t.view.value = t.view.value.slice(0, r), t.view.updatedAt = Date.now(), l.view.value = [...d, ...l.view.value ?? []], l.view.updatedAt = Date.now();
@@ -6414,7 +6422,7 @@ var ua = class e {
6414
6422
  ], e.view.updatedAt = this.now(), !0);
6415
6423
  }
6416
6424
  updateChildrenCountForOperation(e, t, n, r) {
6417
- let i = ia(t);
6425
+ let i = aa(t);
6418
6426
  switch (e) {
6419
6427
  case "delete":
6420
6428
  this.adjustChildrenCount(r, i, -1), this.childrenCountInvalidator?.(i);
@@ -6423,9 +6431,7 @@ var ua = class e {
6423
6431
  case "copy":
6424
6432
  this.adjustChildrenCount(r, i, 1), this.childrenCountInvalidator?.(i);
6425
6433
  break;
6426
- case "move":
6427
- this.adjustChildrenCount(r, n ?? null, -1), this.adjustChildrenCount(r, i, 1), this.childrenCountInvalidator?.(n ?? null), this.childrenCountInvalidator?.(i);
6428
- break;
6434
+ case "move": this.adjustChildrenCount(r, n ?? null, -1), this.adjustChildrenCount(r, i, 1), this.childrenCountInvalidator?.(n ?? null), this.childrenCountInvalidator?.(i);
6429
6435
  }
6430
6436
  }
6431
6437
  adjustChildrenCount(e, t, n) {
@@ -6441,14 +6447,14 @@ var ua = class e {
6441
6447
  this.updateChildrenCountForOperation(n, t, i, r);
6442
6448
  let o = this.parentKey(e), s = this.views.get(o);
6443
6449
  if (s) for (let [, e] of s) {
6444
- let a = e.params ?? {}, o = a?.page ?? 1, c = na(a?.pageSize), l = Number.isFinite(c), u = !!(a?.sortBy || a?.sortOrder), d = !!a?.search, f = a?.itemType || "all";
6450
+ let a = e.params ?? {}, o = a?.page ?? 1, c = ra(a?.pageSize), l = Number.isFinite(c), u = !!(a?.sortBy || a?.sortOrder), d = !!a?.search, f = a?.itemType || "all";
6445
6451
  if (this.isEntityTypeCompatible(t, f)) {
6446
6452
  if (d && this.strategy.filterMatch && !this.strategy.filterMatch(t, e.params)) {
6447
6453
  e.view.value?.includes(t.id) && (e.view.value = e.view.value.filter((e) => e !== t.id), e.view.meta && typeof e.view.meta.total == "number" && (e.view.meta.total = Math.max(0, e.view.meta.total - 1)), this.markViewStaleForReload(e));
6448
6454
  continue;
6449
6455
  }
6450
6456
  if (!e.view.value) {
6451
- e.view.meta && (e.view.meta.stale = !0), e.view.loadId = oa(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
6457
+ e.view.meta && (e.view.meta.stale = !0), e.view.loadId = $i(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
6452
6458
  continue;
6453
6459
  }
6454
6460
  if (e.view.value.includes(t.id), this.shouldInvalidateCompletely(e, n, t, u, l, o)) {
@@ -6466,9 +6472,7 @@ var ua = class e {
6466
6472
  case "update":
6467
6473
  this.handleUpdate(s, e, o, c, l, u, d, t, r);
6468
6474
  break;
6469
- case "move":
6470
- this.handleMove(s, e, o, c, l, u, t, i, r);
6471
- break;
6475
+ case "move": this.handleMove(s, e, o, c, l, u, t, i, r);
6472
6476
  }
6473
6477
  }
6474
6478
  }
@@ -6498,27 +6502,28 @@ var ua = class e {
6498
6502
  t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
6499
6503
  }
6500
6504
  }
6501
- t.view.loadId = oa(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6505
+ t.view.loadId = $i(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6502
6506
  }
6503
6507
  handleInsert(e, t, n, r, i, a, o, s) {
6504
6508
  if (!t.view.value.includes(o.id)) {
6505
- if (a && this.strategy.allowSortedInsert && this.strategy.comparator && s) if (this.tryInsertSorted(t, o, s)) {
6506
- if (t.view.meta && typeof t.view.meta.total == "number") {
6507
- if (t.view.meta.total += 1, i && Number.isFinite(r)) {
6508
- let e = r;
6509
- e > 0 && (t.view.meta.totalPages = Math.max(1, Math.ceil(t.view.meta.total / e)));
6509
+ if (a && this.strategy.allowSortedInsert && this.strategy.comparator && s) {
6510
+ if (this.tryInsertSorted(t, o, s)) {
6511
+ if (t.view.meta && typeof t.view.meta.total == "number") {
6512
+ if (t.view.meta.total += 1, i && Number.isFinite(r)) {
6513
+ let e = r;
6514
+ e > 0 && (t.view.meta.totalPages = Math.max(1, Math.ceil(t.view.meta.total / e)));
6515
+ }
6516
+ this.syncTotalsInSameViews(e, t);
6510
6517
  }
6511
- this.syncTotalsInSameViews(e, t);
6512
- }
6513
- if (t.view.updatedAt = Date.now(), i && (t.view.value?.length ?? 0) > r && s) {
6514
- let i = t.view.meta, a = i && typeof i.totalPages == "number" ? i.totalPages : 1;
6515
- if (this.cascadeShiftToNextPage(e, t, n, r, a, s, t.params ?? {}) && t.view.meta && typeof t.view.meta.totalPages == "number") {
6516
- let n = t.view.meta.totalPages + 1;
6517
- t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
6518
+ if (t.view.updatedAt = Date.now(), i && (t.view.value?.length ?? 0) > r && s) {
6519
+ let i = t.view.meta, a = i && typeof i.totalPages == "number" ? i.totalPages : 1;
6520
+ if (this.cascadeShiftToNextPage(e, t, n, r, a, s, t.params ?? {}) && t.view.meta && typeof t.view.meta.totalPages == "number") {
6521
+ let n = t.view.meta.totalPages + 1;
6522
+ t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
6523
+ }
6518
6524
  }
6519
- }
6520
- } else this.markViewStaleForReload(t);
6521
- else if (!i || t.view.value.length < r) {
6525
+ } else this.markViewStaleForReload(t);
6526
+ } else if (!i || t.view.value.length < r) {
6522
6527
  if (t.view.value.push(o.id), t.view.meta && typeof t.view.meta.total == "number") {
6523
6528
  if (t.view.meta.total += 1, i && Number.isFinite(r)) {
6524
6529
  let e = r;
@@ -6528,7 +6533,7 @@ var ua = class e {
6528
6533
  }
6529
6534
  t.view.updatedAt = Date.now();
6530
6535
  } else this.markViewStaleForReload(t);
6531
- t.view.loadId = oa(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6536
+ t.view.loadId = $i(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6532
6537
  }
6533
6538
  }
6534
6539
  handleUpdate(e, t, n, r, i, a, o, s, c) {
@@ -6545,29 +6550,30 @@ var ua = class e {
6545
6550
  t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
6546
6551
  }
6547
6552
  }
6548
- t.view.loadId = oa(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6553
+ t.view.loadId = $i(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6549
6554
  return;
6550
6555
  }
6551
6556
  if (l && (a || o)) {
6552
- t.view.value = t.view.value.filter((e) => e !== s.id), this.tryReinsertEntity(t, s, c, i, r) ? (t.view.updatedAt = Date.now(), t.view.loadId = oa(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0)) : this.markViewStaleForReload(t);
6557
+ t.view.value = t.view.value.filter((e) => e !== s.id), this.tryReinsertEntity(t, s, c, i, r) ? (t.view.updatedAt = Date.now(), t.view.loadId = $i(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0)) : this.markViewStaleForReload(t);
6553
6558
  return;
6554
6559
  }
6555
6560
  if (l) {
6556
- t.view.updatedAt = Date.now(), t.view.loadId = oa(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6561
+ t.view.updatedAt = Date.now(), t.view.loadId = $i(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6557
6562
  return;
6558
6563
  }
6559
6564
  if (u && !o) {
6560
- if (a && this.strategy.allowSortedInsert && this.strategy.comparator && c) if (this.tryInsertSorted(t, s, c)) {
6561
- if (t.view.meta && typeof t.view.meta.total == "number") {
6562
- if (t.view.meta.total += 1, i && Number.isFinite(r)) {
6563
- let e = r;
6564
- e > 0 && (t.view.meta.totalPages = Math.max(1, Math.ceil(t.view.meta.total / e)));
6565
+ if (a && this.strategy.allowSortedInsert && this.strategy.comparator && c) {
6566
+ if (this.tryInsertSorted(t, s, c)) {
6567
+ if (t.view.meta && typeof t.view.meta.total == "number") {
6568
+ if (t.view.meta.total += 1, i && Number.isFinite(r)) {
6569
+ let e = r;
6570
+ e > 0 && (t.view.meta.totalPages = Math.max(1, Math.ceil(t.view.meta.total / e)));
6571
+ }
6572
+ this.syncTotalsInSameViews(e, t);
6565
6573
  }
6566
- this.syncTotalsInSameViews(e, t);
6567
- }
6568
- t.view.updatedAt = Date.now();
6569
- } else this.markViewStaleForReload(t);
6570
- else if (!i || t.view.value.length < r) {
6574
+ t.view.updatedAt = Date.now();
6575
+ } else this.markViewStaleForReload(t);
6576
+ } else if (!i || t.view.value.length < r) {
6571
6577
  if (t.view.value.push(s.id), t.view.meta && typeof t.view.meta.total == "number") {
6572
6578
  if (t.view.meta.total += 1, i && Number.isFinite(r)) {
6573
6579
  let e = r;
@@ -6577,7 +6583,7 @@ var ua = class e {
6577
6583
  }
6578
6584
  t.view.updatedAt = Date.now();
6579
6585
  } else this.markViewStaleForReload(t);
6580
- t.view.loadId = oa(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6586
+ t.view.loadId = $i(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6581
6587
  }
6582
6588
  }
6583
6589
  handleMove(e, t, n, r, i, a, o, s, c) {
@@ -6595,13 +6601,13 @@ var ua = class e {
6595
6601
  }
6596
6602
  this.syncTotalsInSameViews(e, t);
6597
6603
  }
6598
- t.view.loadId = oa(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6604
+ t.view.loadId = $i(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
6599
6605
  }
6600
6606
  forceInvalidateChildrenViews(e) {
6601
6607
  let t = this.parentKey(e ?? null);
6602
6608
  this.failedRequests.clearChildrenViewErrorsForParent(t);
6603
6609
  let n = this.views.get(t);
6604
- if (n) for (let [, e] of n) e.view.value = void 0, e.view.meta = void 0, e.view.promise = null, e.view.updatedAt = 0, e.view.loadId = oa(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
6610
+ if (n) for (let [, e] of n) e.view.value = void 0, e.view.meta = void 0, e.view.promise = null, e.view.updatedAt = 0, e.view.loadId = $i(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
6605
6611
  }
6606
6612
  getKnownTotal(e) {
6607
6613
  let t = this.parentKey(e ?? null), n = this.views.get(t);
@@ -6645,10 +6651,10 @@ var ua = class e {
6645
6651
  }
6646
6652
  }, fa = class e {
6647
6653
  invalidateChildrenCountCache(e) {
6648
- let t = ta(e ?? "");
6654
+ let t = na(e ?? "");
6649
6655
  this.childrenCountPromises.delete(t), this.failedRequests.delete(Ri.childrenCountKey(t));
6650
6656
  }
6651
- constructor(e = {}, t = ea, n, r) {
6657
+ constructor(e = {}, t = ta, n, r) {
6652
6658
  this.childrenCountPromises = /* @__PURE__ */ new Map(), this.isFolderNotFoundError = r?.isFolderNotFoundError ?? sa, this.failedRequests = new Ri(), this.ttl = r?.ttl ?? t, this.errorTtl = r?.errorTtl ?? n ?? this.ttl, this.entities = new ua(), this.views = new da(e, this.ttl, this.errorTtl, void 0, this.failedRequests, this.isFolderNotFoundError), this.views.setServerChildrenCountHandler((e, t, n) => {
6653
6659
  this.handleServerReportedChildrenCount(e, t, n ?? this.entities);
6654
6660
  }), this.views.setChildrenCountInvalidator((e) => {
@@ -6668,7 +6674,7 @@ var ua = class e {
6668
6674
  return this.views.getOrCreateChildren(e, t, n, this.entities);
6669
6675
  }
6670
6676
  upsertEntity(e) {
6671
- let t = this.entities.getEntity(e.id), n = t ? ia(t) : null, r = ia(e), i = t ? aa(t) : !1, a = aa(e);
6677
+ let t = this.entities.getEntity(e.id), n = t ? aa(t) : null, r = aa(e), i = t ? oa(t) : !1, a = oa(e);
6672
6678
  if (this.entities.upsertEntity(e), t) {
6673
6679
  if (n !== r || i !== a) {
6674
6680
  this.views.smartInvalidateChildrenViews(n, t, "delete", this.entities), this.views.smartInvalidateChildrenViews(r, e, "insert", this.entities);
@@ -6680,24 +6686,24 @@ var ua = class e {
6680
6686
  isAncestor(e, t) {
6681
6687
  let n = t, r = /* @__PURE__ */ new Set();
6682
6688
  for (; n && !r.has(n);) {
6683
- if (r.add(n), ta(n) === ta(e)) return !0;
6689
+ if (r.add(n), na(n) === na(e)) return !0;
6684
6690
  let t = this.entities.getEntity(n);
6685
6691
  if (!t) break;
6686
- n = ia(t), n === null && (n = $i);
6692
+ n = aa(t), n === null && (n = ea);
6687
6693
  }
6688
6694
  return !1;
6689
6695
  }
6690
6696
  moveEntity(e, t) {
6691
6697
  let n = this.entities.getEntity(e);
6692
- if (!n || aa(n) && t !== null && this.isAncestor(e, t)) return null;
6693
- let r = ia(n), i = this.entities.moveEntityById(e, t);
6698
+ if (!n || oa(n) && t !== null && this.isAncestor(e, t)) return null;
6699
+ let r = aa(n), i = this.entities.moveEntityById(e, t);
6694
6700
  return i ? (this.views.smartInvalidateChildrenViews(r, n, "delete", this.entities), this.views.smartInvalidateChildrenViews(t, i, "insert", this.entities), i) : null;
6695
6701
  }
6696
6702
  copyEntity(e, t, n, r) {
6697
6703
  let i = this.entities.getEntity(e);
6698
6704
  if (!i) return null;
6699
6705
  let a = null;
6700
- if (aa(i)) {
6706
+ if (oa(i)) {
6701
6707
  let n = [e], i = [];
6702
6708
  for (; n.length;) {
6703
6709
  let e = n.shift();
@@ -6706,9 +6712,9 @@ var ua = class e {
6706
6712
  for (let e of t) n.push(e);
6707
6713
  }
6708
6714
  let o = /* @__PURE__ */ new Map();
6709
- for (let e of i) o.set(e, oa());
6715
+ for (let e of i) o.set(e, $i());
6710
6716
  for (let n of i) {
6711
- let i = this.entities.getFolder(n), a = o.get(n), s = ia(i), c = s === null ? t : o.get(s) ?? null, l = {
6717
+ let i = this.entities.getFolder(n), a = o.get(n), s = aa(i), c = s === null ? t : o.get(s) ?? null, l = {
6712
6718
  ...i,
6713
6719
  ...n === e ? r : void 0,
6714
6720
  id: a,
@@ -6721,7 +6727,7 @@ var ua = class e {
6721
6727
  for (let e of n) {
6722
6728
  let n = this.entities.getFileSystemItem(e);
6723
6729
  if (!n) continue;
6724
- let r = oa(), i = {
6730
+ let r = $i(), i = {
6725
6731
  ...n,
6726
6732
  id: r,
6727
6733
  folderId: t
@@ -6731,7 +6737,7 @@ var ua = class e {
6731
6737
  }
6732
6738
  a = this.entities.getEntity(o.get(e)) ?? null;
6733
6739
  } else {
6734
- let i = n ?? oa();
6740
+ let i = n ?? $i();
6735
6741
  if (a = this.entities.copyFileSystemItem(e, i, t ?? null), a && r) {
6736
6742
  let e = {
6737
6743
  ...a,
@@ -6750,13 +6756,14 @@ var ua = class e {
6750
6756
  deleteEntity(e) {
6751
6757
  let t = this.entities.getEntity(e);
6752
6758
  if (!t) return null;
6753
- if (aa(t)) {
6759
+ if (oa(t)) {
6754
6760
  let { deletedFolderRecords: n, deletedFileSystemItemRecords: r } = this.entities.deleteFolderRecursive(e);
6755
6761
  for (let e of r) this.views.smartInvalidateChildrenViews(e.folderId, e, "delete", this.entities);
6756
6762
  for (let e of n) this.views.smartInvalidateChildrenViews(e.folderId, e, "delete", this.entities);
6757
6763
  for (let e of n) this.views.forceInvalidateChildrenViews(e.id);
6758
6764
  return t;
6759
- } else {
6765
+ }
6766
+ {
6760
6767
  let { entity: t, parentId: n } = this.entities.deleteEntityById(e);
6761
6768
  return t && this.views.smartInvalidateChildrenViews(n, t, "delete", this.entities), t;
6762
6769
  }
@@ -6778,7 +6785,7 @@ var ua = class e {
6778
6785
  return;
6779
6786
  }
6780
6787
  let n = /* @__PURE__ */ new Set();
6781
- if (aa(t)) {
6788
+ if (oa(t)) {
6782
6789
  let t = [e];
6783
6790
  for (; t.length;) {
6784
6791
  let e = t.pop();
@@ -6802,7 +6809,7 @@ var ua = class e {
6802
6809
  return this.entities.searchByName(e, t);
6803
6810
  }
6804
6811
  async getChildrenCount(e = "", t) {
6805
- let n = ta(e), r = Ri.childrenCountKey(n), i = this.failedRequests.getFreshError(r, this.errorTtl);
6812
+ let n = na(e), r = Ri.childrenCountKey(n), i = this.failedRequests.getFreshError(r, this.errorTtl);
6806
6813
  if (i != null) return Promise.reject(i);
6807
6814
  let a = this.childrenCountPromises.get(n);
6808
6815
  if (a) return a;
@@ -6907,7 +6914,7 @@ function wa(e) {
6907
6914
  function Ta(e) {
6908
6915
  return e ? e.replaceAll("\\", "/").split("/").filter(Boolean) : [];
6909
6916
  }
6910
- for (var Ea = class {
6917
+ var Ea = class {
6911
6918
  _getTrashPath() {
6912
6919
  return this._pathOptions.trashPath || ma;
6913
6920
  }
@@ -6915,8 +6922,14 @@ for (var Ea = class {
6915
6922
  return Zi(e, this._getTrashPath(), Yi);
6916
6923
  }
6917
6924
  _folderFromResolvedPath(e, t) {
6918
- if (e.isFolder !== !0) throw new M(e.isFolder === !1 ? "Path '%s' resolves to a file, not a folder".replace("%s", t) : "Path '%s' resolved to an item that is not marked as a folder".replace("%s", t), "ValidationError");
6919
- if (!e.id) throw new M("Path '%s' resolved to a folder without id".replace("%s", t), "ValidationError");
6925
+ if (e.isFolder !== !0) {
6926
+ let n = e.isFolder === !1 ? "Path '%s' resolves to a file, not a folder".replace("%s", t) : "Path '%s' resolved to an item that is not marked as a folder".replace("%s", t);
6927
+ throw new M(n, "ValidationError");
6928
+ }
6929
+ if (!e.id) {
6930
+ let e = "Path '%s' resolved to a folder without id".replace("%s", t);
6931
+ throw new M(e, "ValidationError");
6932
+ }
6920
6933
  let n = {
6921
6934
  id: e.id,
6922
6935
  name: e.name || e.id,
@@ -6937,7 +6950,10 @@ for (var Ea = class {
6937
6950
  }
6938
6951
  async _findOrCreateFolderByPath(e) {
6939
6952
  let t = Ta(e);
6940
- if (t.length > ya) throw new M("Path depth exceeds maximum limit of %s".replace("%s", String(ya)), "ValidationError");
6953
+ if (t.length > ya) {
6954
+ let e = "Path depth exceeds maximum limit of %s".replace("%s", String(ya));
6955
+ throw new M(e, "ValidationError");
6956
+ }
6941
6957
  let n = await this._resolveFolderByPath(e);
6942
6958
  if (n) return n;
6943
6959
  let r;
@@ -6947,7 +6963,10 @@ for (var Ea = class {
6947
6963
  itemType: "folder"
6948
6964
  }), i = t.find((e) => e.name === n);
6949
6965
  if (i) {
6950
- if (!i.isFolder) throw new M("Path component '%s' in '%s' is not a folder".replace("%s", n).replace("%s", e), "ValidationError");
6966
+ if (!i.isFolder) {
6967
+ let t = "Path component '%s' in '%s' is not a folder".replace("%s", n).replace("%s", e);
6968
+ throw new M(t, "ValidationError");
6969
+ }
6951
6970
  r = {
6952
6971
  id: i.id,
6953
6972
  name: i.name,
@@ -6965,7 +6984,10 @@ for (var Ea = class {
6965
6984
  }
6966
6985
  async getTrashFolder() {
6967
6986
  let e = await this._findOrCreateFolderByPath(this._getTrashPath());
6968
- if (!e) throw new M("Trash folder path '%s' could not be resolved".replace("%s", this._getTrashPath()), "FolderNotFound");
6987
+ if (!e) {
6988
+ let e = "Trash folder path '%s' could not be resolved".replace("%s", this._getTrashPath());
6989
+ throw new M(e, "FolderNotFound");
6990
+ }
6969
6991
  return e;
6970
6992
  }
6971
6993
  async getTempFolder() {
@@ -7048,15 +7070,18 @@ for (var Ea = class {
7048
7070
  _validateName(e, t = !1) {
7049
7071
  if (!e || e.trim().length === 0) throw new M(t ? "Folder name cannot be empty" : "File name cannot be empty", t ? "FolderInvalidName" : "FileInvalidName");
7050
7072
  if (/[/\\:*?"<>|]/.test(e)) {
7051
- let n = t ? "FolderInvalidName" : "FileInvalidName";
7052
- throw new M(t ? "Folder name contains invalid characters: %s".replace("%s", e) : "File name contains invalid characters: %s".replace("%s", e), n);
7073
+ let n = t ? "FolderInvalidName" : "FileInvalidName", r = t ? "Folder name contains invalid characters: %s".replace("%s", e) : "File name contains invalid characters: %s".replace("%s", e);
7074
+ throw new M(r, n);
7053
7075
  }
7054
7076
  }
7055
7077
  _validateTargetFolderType(e) {
7056
7078
  let t = this.normalizeId(e);
7057
7079
  if (t === this._rootId) return;
7058
7080
  let n = this._cache.getEntity(t);
7059
- if (n && !n.isFolder) throw new M("Target item with id '%s' is not a folder".replace("%s", e), "ValidationError");
7081
+ if (n && !n.isFolder) {
7082
+ let t = "Target item with id '%s' is not a folder".replace("%s", e);
7083
+ throw new M(t, "ValidationError");
7084
+ }
7060
7085
  }
7061
7086
  _checkNameExistsInCache(e, t, n, r) {
7062
7087
  let i = this.normalizeId(e), a = this._cache.getChildrenIds(i);
@@ -7181,10 +7206,12 @@ for (var Ea = class {
7181
7206
  let ee;
7182
7207
  ee = m || f || v ? w.length : C.total ?? w.length;
7183
7208
  let T = w;
7184
- if (m) if (typeof this._options.clientSidePaging == "function") T = this._options.clientSidePaging(w, h, g);
7185
- else {
7186
- let e = (h - 1) * g, t = e + g;
7187
- T = w.slice(e, t);
7209
+ if (m) {
7210
+ if (typeof this._options.clientSidePaging == "function") T = this._options.clientSidePaging(w, h, g);
7211
+ else {
7212
+ let e = (h - 1) * g, t = e + g;
7213
+ T = w.slice(e, t);
7214
+ }
7188
7215
  }
7189
7216
  if (typeof this._dataProvider.getUrl == "function" || typeof this._dataProvider.getThumbnailUrl == "function") {
7190
7217
  let e = T.map(async (e) => {
@@ -7292,7 +7319,10 @@ for (var Ea = class {
7292
7319
  async _uploadFile(e) {
7293
7320
  let t = this.normalizeId(e.folderId ?? this._rootId);
7294
7321
  if (typeof this._dataProvider.uploadFile != "function") throw new M("Upload file operation is not supported by data provider", "UnsupportedOperation");
7295
- if (this._validateName(e.name, !1), this._validateDuplicates && this._checkNameExistsInCache(t, e.name, !1)) throw new M("File '%s' already exists in target folder".replace("%s", e.name), "FileAlreadyExists");
7322
+ if (this._validateName(e.name, !1), this._validateDuplicates && this._checkNameExistsInCache(t, e.name, !1)) {
7323
+ let t = "File '%s' already exists in target folder".replace("%s", e.name);
7324
+ throw new M(t, "FileAlreadyExists");
7325
+ }
7296
7326
  let n = await this._dataProvider.uploadFile({
7297
7327
  ...e,
7298
7328
  folderId: t
@@ -7319,7 +7349,10 @@ for (var Ea = class {
7319
7349
  for (let e of n) if (e.name) {
7320
7350
  this._validateName(e.name, !1);
7321
7351
  let t = this.normalizeId(e.folderId ?? i);
7322
- if (this._checkNameExistsInCache(t, e.name, !1)) throw new M("File '%s' already exists in target folder".replace("%s", e.name), "FileAlreadyExists");
7352
+ if (this._checkNameExistsInCache(t, e.name, !1)) {
7353
+ let t = "File '%s' already exists in target folder".replace("%s", e.name);
7354
+ throw new M(t, "FileAlreadyExists");
7355
+ }
7323
7356
  }
7324
7357
  }
7325
7358
  let a = {
@@ -7433,11 +7466,14 @@ for (var Ea = class {
7433
7466
  }
7434
7467
  } else typeof this._dataProvider.deleteItem == "function" && (n.detailed = await Promise.all(e.map(async (e) => {
7435
7468
  let n = this._cache.getEntity(e);
7436
- if (!n) return {
7437
- requestId: e,
7438
- success: !1,
7439
- error: new M("Item with id '%s' not found".replace("%s", e), "FileNotFound")
7440
- };
7469
+ if (!n) {
7470
+ let t = "Item with id '%s' not found".replace("%s", e);
7471
+ return {
7472
+ requestId: e,
7473
+ success: !1,
7474
+ error: new M(t, "FileNotFound")
7475
+ };
7476
+ }
7441
7477
  try {
7442
7478
  return await this._dataProvider.deleteItem(n, t), r ? this._cache.moveEntity(e, r.id) : this._cache.deleteEntity(e), {
7443
7479
  requestId: e,
@@ -7458,7 +7494,10 @@ for (var Ea = class {
7458
7494
  }
7459
7495
  async hardDeleteItem(e) {
7460
7496
  let t = this._cache.getEntity(e);
7461
- if (!t) throw new M("Item with id '%s' not found in cache".replace("%s", e), "FileNotFound");
7497
+ if (!t) {
7498
+ let t = "Item with id '%s' not found in cache".replace("%s", e);
7499
+ throw new M(t, "FileNotFound");
7500
+ }
7462
7501
  if (typeof this._dataProvider.deleteItem != "function") throw new M("Delete item operation is not supported by data provider", "DeleteNotAllowed");
7463
7502
  if (await this._dataProvider.deleteItem(t, { permanent: !0 }), this._cache.deleteEntity(e), this._enableTrash) try {
7464
7503
  let e = await this.getTrashFolder();
@@ -7480,7 +7519,10 @@ for (var Ea = class {
7480
7519
  }
7481
7520
  async createFolder({ name: e, parentId: t, is_force_create: n }) {
7482
7521
  let r = this.normalizeId(t ?? this._rootId);
7483
- if (this._validateName(e, !0), this._validateDuplicates && this._checkNameExistsInCache(r, e, !0)) throw new M("Folder '%s' already exists in parent folder".replace("%s", e), "FolderAlreadyExists");
7522
+ if (this._validateName(e, !0), this._validateDuplicates && this._checkNameExistsInCache(r, e, !0)) {
7523
+ let t = "Folder '%s' already exists in parent folder".replace("%s", e);
7524
+ throw new M(t, "FolderAlreadyExists");
7525
+ }
7484
7526
  let i = await this._dataProvider.createFolder(e, r, n), a = Sa({
7485
7527
  id: i.id,
7486
7528
  folderId: r,
@@ -7515,10 +7557,16 @@ for (var Ea = class {
7515
7557
  async renameFolder(e, t) {
7516
7558
  if (typeof this._dataProvider.renameItem != "function") throw new M("Rename folder is not supported", "RenameNotAllowed");
7517
7559
  let n = this.normalizeId(e), r = this._cache.getEntity(n);
7518
- if (!r) throw new M("Folder with id '%s' not found in cache".replace("%s", e), "FolderNotFound");
7560
+ if (!r) {
7561
+ let t = "Folder with id '%s' not found in cache".replace("%s", e);
7562
+ throw new M(t, "FolderNotFound");
7563
+ }
7519
7564
  if (this._validateName(t, !0), this._validateDuplicates) {
7520
7565
  let e = this.normalizeId(r.folderId);
7521
- if (this._checkNameExistsInCache(e, t, !0, n)) throw new M("Folder '%s' already exists in parent folder".replace("%s", t), "FolderAlreadyExists");
7566
+ if (this._checkNameExistsInCache(e, t, !0, n)) {
7567
+ let e = "Folder '%s' already exists in parent folder".replace("%s", t);
7568
+ throw new M(e, "FolderAlreadyExists");
7569
+ }
7522
7570
  }
7523
7571
  let i = wa(await this._dataProvider.renameItem(r, t));
7524
7572
  return this._cache.upsertEntity(Sa({
@@ -7529,11 +7577,17 @@ for (var Ea = class {
7529
7577
  async renameFile(e, t) {
7530
7578
  if (typeof this._dataProvider.renameItem != "function") throw new M("Rename file is not supported", "RenameNotAllowed");
7531
7579
  let n = this._cache.getEntity(e);
7532
- if (!n) throw new M("File with id '%s' not found in cache".replace("%s", e), "FileNotFound");
7580
+ if (!n) {
7581
+ let t = "File with id '%s' not found in cache".replace("%s", e);
7582
+ throw new M(t, "FileNotFound");
7583
+ }
7533
7584
  let r = this.normalizeId(e);
7534
7585
  if (this._validateName(t, !1), this._validateDuplicates) {
7535
7586
  let e = this.normalizeId(n.folderId);
7536
- if (this._checkNameExistsInCache(e, t, !1, r)) throw new M("File '%s' already exists in parent folder".replace("%s", t), "FileAlreadyExists");
7587
+ if (this._checkNameExistsInCache(e, t, !1, r)) {
7588
+ let e = "File '%s' already exists in parent folder".replace("%s", t);
7589
+ throw new M(e, "FileAlreadyExists");
7590
+ }
7537
7591
  }
7538
7592
  let i = wa(await this._dataProvider.renameItem(n, t));
7539
7593
  return i && this._cache.upsertEntity(Sa({
@@ -7582,7 +7636,8 @@ for (var Ea = class {
7582
7636
  ...t,
7583
7637
  ...a
7584
7638
  })), !0;
7585
- } else {
7639
+ }
7640
+ {
7586
7641
  let t = this._cache.deleteEntity(e);
7587
7642
  return this._cache.upsertEntity(Sa({
7588
7643
  ...t,
@@ -7597,8 +7652,14 @@ for (var Ea = class {
7597
7652
  let r = t.map((e) => this._cache.getEntity(e));
7598
7653
  for (let e of r) if (e) {
7599
7654
  if (e.isFolder) {
7600
- if (e.id === n) throw new M("Cannot move folder '%s' into itself".replace("%s", e.name), "MoveIntoSelf");
7601
- if (this._isAncestor(e.id, n)) throw new M("Cannot move folder '%s' into its descendant".replace("%s", e.name), "MoveIntoDescendant");
7655
+ if (e.id === n) {
7656
+ let t = "Cannot move folder '%s' into itself".replace("%s", e.name);
7657
+ throw new M(t, "MoveIntoSelf");
7658
+ }
7659
+ if (this._isAncestor(e.id, n)) {
7660
+ let t = "Cannot move folder '%s' into its descendant".replace("%s", e.name);
7661
+ throw new M(t, "MoveIntoDescendant");
7662
+ }
7602
7663
  }
7603
7664
  if (this._validateDuplicates && n !== this.normalizeId(e.folderId) && e.name && this._checkNameExistsInCache(n, e.name, !!e.isFolder, e.id)) {
7604
7665
  let t = e.isFolder ? "FolderAlreadyExists" : "FileAlreadyExists";
@@ -7638,21 +7699,24 @@ for (var Ea = class {
7638
7699
  success: !0,
7639
7700
  data: void 0
7640
7701
  }));
7641
- for (let t of e) if (t.success) if (!t.data || t.data.id === t.requestId) this._cache.moveEntity(t.requestId, n), t.data && this._cache.upsertEntity(Sa({
7642
- ...this._cache.getEntity(t.requestId),
7643
- ...t.data,
7644
- folderId: n
7645
- }));
7646
- else {
7647
- let e = this._cache.deleteEntity(t.requestId);
7648
- this._cache.upsertEntity(Sa({
7649
- ...e,
7702
+ for (let t of e) if (t.success) {
7703
+ if (!t.data || t.data.id === t.requestId) this._cache.moveEntity(t.requestId, n), t.data && this._cache.upsertEntity(Sa({
7704
+ ...this._cache.getEntity(t.requestId),
7650
7705
  ...t.data,
7651
7706
  folderId: n
7652
7707
  }));
7708
+ else {
7709
+ let e = this._cache.deleteEntity(t.requestId);
7710
+ this._cache.upsertEntity(Sa({
7711
+ ...e,
7712
+ ...t.data,
7713
+ folderId: n
7714
+ }));
7715
+ }
7653
7716
  }
7654
7717
  return i;
7655
- } else return {
7718
+ }
7719
+ return {
7656
7720
  success: !1,
7657
7721
  error: i.error || new M("Move items failed", "MoveNotAllowed")
7658
7722
  };
@@ -7736,16 +7800,18 @@ for (var Ea = class {
7736
7800
  else throw new M("Copy items is not supported", "CopyNotAllowed");
7737
7801
  if (o.success && o.detailed) for (let e = 0, t = o.detailed.length; e < t; e++) {
7738
7802
  let t = o.detailed[e];
7739
- if (t.success) if (t.data?.id) {
7740
- let e = t.data.folderId || n;
7741
- !this._cache.copyEntity(t.requestId, e, t.data.id, {
7742
- ...t.data,
7743
- folderId: e
7744
- }) && t.data && this._cache.upsertEntity(Sa({
7745
- ...t.data,
7746
- folderId: e
7747
- }));
7748
- } else console.error("batchResult in copy method must have ids");
7803
+ if (t.success) {
7804
+ if (t.data?.id) {
7805
+ let e = t.data.folderId || n;
7806
+ !this._cache.copyEntity(t.requestId, e, t.data.id, {
7807
+ ...t.data,
7808
+ folderId: e
7809
+ }) && t.data && this._cache.upsertEntity(Sa({
7810
+ ...t.data,
7811
+ folderId: e
7812
+ }));
7813
+ } else console.error("batchResult in copy method must have ids");
7814
+ }
7749
7815
  }
7750
7816
  else if (!o.detailed) throw new M("batchResult in copy method must have detailed results", "ValidationError");
7751
7817
  return o;
@@ -7772,10 +7838,16 @@ for (var Ea = class {
7772
7838
  async updateFile(e, t) {
7773
7839
  if (typeof this._dataProvider.updateFile != "function") throw new M("Update file is not supported", "UnsupportedOperation");
7774
7840
  let n = this.normalizeId(e), r = this._cache.getEntity(n);
7775
- if (!r) throw new M("File with id '%s' not found in cache".replace("%s", e), "FileNotFound");
7841
+ if (!r) {
7842
+ let t = "File with id '%s' not found in cache".replace("%s", e);
7843
+ throw new M(t, "FileNotFound");
7844
+ }
7776
7845
  if (t.name && t.name !== r.name && this._validateName(t.name, !1), this._validateDuplicates && t.name && t.name !== r.name) {
7777
7846
  let e = this.normalizeId(r.folderId);
7778
- if (this._checkNameExistsInCache(e, t.name, !1, n)) throw new M("File '%s' already exists in parent folder".replace("%s", t.name), "FileAlreadyExists");
7847
+ if (this._checkNameExistsInCache(e, t.name, !1, n)) {
7848
+ let e = "File '%s' already exists in parent folder".replace("%s", t.name);
7849
+ throw new M(e, "FileAlreadyExists");
7850
+ }
7779
7851
  }
7780
7852
  let i = wa(await this._dataProvider.updateFile(r, { ...t }));
7781
7853
  return this._cache.upsertEntity(Sa({
@@ -7784,35 +7856,8 @@ for (var Ea = class {
7784
7856
  ...t
7785
7857
  })), this._cache.getEntity(n);
7786
7858
  }
7787
- }, Da = [], Oa = 0; Oa < 256; ++Oa) Da.push((Oa + 256).toString(16).slice(1));
7788
- function ka(e, t = 0) {
7789
- return (Da[e[t + 0]] + Da[e[t + 1]] + Da[e[t + 2]] + Da[e[t + 3]] + "-" + Da[e[t + 4]] + Da[e[t + 5]] + "-" + Da[e[t + 6]] + Da[e[t + 7]] + "-" + Da[e[t + 8]] + Da[e[t + 9]] + "-" + Da[e[t + 10]] + Da[e[t + 11]] + Da[e[t + 12]] + Da[e[t + 13]] + Da[e[t + 14]] + Da[e[t + 15]]).toLowerCase();
7790
- }
7791
- //#endregion
7792
- //#region packages/file-manager/node_modules/uuid/dist/esm-browser/rng.js
7793
- var Aa, ja = /* @__PURE__ */ new Uint8Array(16);
7794
- function Ma() {
7795
- if (!Aa && (Aa = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Aa)) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
7796
- return Aa(ja);
7797
- }
7798
- var Na = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
7799
- //#endregion
7800
- //#region packages/file-manager/node_modules/uuid/dist/esm-browser/v4.js
7801
- function Pa(e, t, n) {
7802
- if (Na.randomUUID && !t && !e) return Na.randomUUID();
7803
- e ||= {};
7804
- var r = e.random || (e.rng || Ma)();
7805
- if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
7806
- n ||= 0;
7807
- for (var i = 0; i < 16; ++i) t[n + i] = r[i];
7808
- return t;
7809
- }
7810
- return ka(r);
7811
- }
7812
- //#endregion
7813
- //#region packages/file-manager/src/adapters/PathAwareStorageAdapter.ts
7814
- var Fa = "", Ia = "Trash", La = class {
7815
- constructor(e, t = Fa, n = Yi, r = Ia, i = !0) {
7859
+ }, Da = "", Oa = "Trash", ka = class {
7860
+ constructor(e, t = Da, n = Yi, r = Oa, i = !0) {
7816
7861
  this._inner = e, this.rootPath = t, this.trashId = n, this.trashPath = r, this.ensureFolderTrailingSlash = i, this._pathToId = /* @__PURE__ */ new Map(), this._idToPath = /* @__PURE__ */ new Map(), this.validateDuplicates = this._inner.validateDuplicates ?? !1, typeof e.getUrl == "function" && (this.getUrl = (t) => e.getUrl({
7817
7862
  ...t,
7818
7863
  id: this.pathForId(t.id, !1),
@@ -7873,7 +7918,7 @@ var Fa = "", Ia = "Trash", La = class {
7873
7918
  let t = Xi(e);
7874
7919
  if (t === Xi(this.trashPath)) return this.trashId;
7875
7920
  if (this._pathToId.has(t)) return this._pathToId.get(t);
7876
- let n = Pa();
7921
+ let n = $i();
7877
7922
  return this._pathToId.set(t, n), this._idToPath.set(n, t), n;
7878
7923
  }
7879
7924
  pathForId(e, t, n) {
@@ -7882,7 +7927,10 @@ var Fa = "", Ia = "Trash", La = class {
7882
7927
  let r = this._idToPath.get(e);
7883
7928
  if (!r) {
7884
7929
  if (n) return `unknown folder ${e}`;
7885
- throw new M(`Path for id '${e}' not found in mapping`, "FileNotFound");
7930
+ {
7931
+ let t = `Path for id '${e}' not found in mapping`;
7932
+ throw new M(t, "FileNotFound");
7933
+ }
7886
7934
  }
7887
7935
  let i = 0;
7888
7936
  for (; i < this.rootPath.length && this.rootPath[i] === "/";) i++;
@@ -8269,7 +8317,7 @@ var Fa = "", Ia = "Trash", La = class {
8269
8317
  if (typeof this._inner.cleanTrash != "function") throw new M("Clean trash is not supported by inner storage", "UnsupportedOperation");
8270
8318
  return await this._inner.cleanTrash();
8271
8319
  }
8272
- }, Ra = {
8320
+ }, Aa = {
8273
8321
  init: ki,
8274
8322
  unmount: Ai,
8275
8323
  initPixieEditor: Ni,
@@ -8277,6 +8325,6 @@ var Fa = "", Ia = "Trash", La = class {
8277
8325
  initFileManager: Fi
8278
8326
  };
8279
8327
  //#endregion
8280
- export { ea as DEFAULT_FILE_MANAGER_CACHE_TTL_MS, Ea as DataSourceProxyBase, Ri as FailedRequestCache, gr as FileContent, M as FileManagerApiError, wi as FileManagerApp, Di as FileManagerAppWithContext, vr as FileModals, br as FolderSidebar, zi as MutationRegistry, La as PathAwareStorageAdapter, Mi as PixieOnlyApp, Yi as TRASH_FOLDER_ID, fa as TreeCache, da as ViewCacheManager, Oe as buildAssetsPath, Vi as compareFileSystemItems, Qi as createSystemFolderByPathResolver, Ra as default, Ki as defaultChildrenViewFilterMatch, Gi as defaultFileSystemItemComparator, qi as defaultHasSortValue, sa as defaultIsFolderNotFoundError, se as fetchRemoteImageBlobByUrl, Ee as getAssetsBase, Zi as getTrashFolderLookupCandidates, Ui as hasComparableSortValue, ki as init, Fi as initFileManager, Ni as initPixieEditor, Tn as installResizeObserverErrorHandler, De as joinUrls, Ii as mapHttpStatusToErrorCode, Wi as matchesChildrenViewFilter, Xi as normalizeSystemFolderPath, Bi as resolveSortParams, Ji as resolveViewStrategyOptions, En as uninstallResizeObserverErrorHandler, Ai as unmount, Pi as unmountPixieEditor };
8328
+ export { ta as DEFAULT_FILE_MANAGER_CACHE_TTL_MS, Ea as DataSourceProxyBase, Ri as FailedRequestCache, gr as FileContent, M as FileManagerApiError, wi as FileManagerApp, Di as FileManagerAppWithContext, vr as FileModals, br as FolderSidebar, zi as MutationRegistry, ka as PathAwareStorageAdapter, Mi as PixieOnlyApp, Yi as TRASH_FOLDER_ID, fa as TreeCache, da as ViewCacheManager, Oe as buildAssetsPath, Vi as compareFileSystemItems, Qi as createSystemFolderByPathResolver, Aa as default, Ki as defaultChildrenViewFilterMatch, Gi as defaultFileSystemItemComparator, qi as defaultHasSortValue, sa as defaultIsFolderNotFoundError, se as fetchRemoteImageBlobByUrl, Ee as getAssetsBase, Zi as getTrashFolderLookupCandidates, Ui as hasComparableSortValue, ki as init, Fi as initFileManager, Ni as initPixieEditor, Tn as installResizeObserverErrorHandler, De as joinUrls, Ii as mapHttpStatusToErrorCode, Wi as matchesChildrenViewFilter, Xi as normalizeSystemFolderPath, Bi as resolveSortParams, Ji as resolveViewStrategyOptions, En as uninstallResizeObserverErrorHandler, Ai as unmount, Pi as unmountPixieEditor };
8281
8329
 
8282
8330
  //# sourceMappingURL=file-manager.esm.js.map