@emailmaker/filemanager 1.1.69 → 1.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core.esm.js CHANGED
@@ -168,28 +168,61 @@ function b(e) {
168
168
  };
169
169
  }
170
170
  //#endregion
171
- //#region packages/file-manager/src/adapters/TreeCache.ts
172
- var x = "", S = 1800 * 1e3;
171
+ //#region packages/file-manager/src/utils/urlNormalization.ts
172
+ var x = /^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;
173
+ function S(e) {
174
+ try {
175
+ return decodeURIComponent(e.replace(/\+/g, " "));
176
+ } catch {
177
+ return e;
178
+ }
179
+ }
173
180
  function C(e) {
174
- return e == null || e === "" ? x : e;
181
+ let t = new URL(e.trim());
182
+ t.hash = "", t.hostname = t.hostname.toLowerCase(), (t.protocol === "https:" && t.port === "443" || t.protocol === "http:" && t.port === "80") && (t.port = "");
183
+ let n = (t.search.startsWith("?") ? t.search.slice(1) : t.search).split("&").filter(Boolean).map((e) => {
184
+ let t = e.indexOf("="), n = t === -1 ? e : e.slice(0, t), r = t === -1 ? "" : e.slice(t + 1);
185
+ return {
186
+ pair: e,
187
+ key: S(n),
188
+ value: S(r)
189
+ };
190
+ }).filter(({ key: e }) => !x.test(e)).sort((e, t) => {
191
+ let n = e.key.localeCompare(t.key);
192
+ return n === 0 ? e.value.localeCompare(t.value) : n;
193
+ });
194
+ return t.search = n.length ? `?${n.map(({ pair: e }) => e).join("&")}` : "", t.toString();
175
195
  }
176
196
  function w(e) {
197
+ try {
198
+ return C(e);
199
+ } catch {
200
+ return e.trim();
201
+ }
202
+ }
203
+ //#endregion
204
+ //#region packages/file-manager/src/adapters/TreeCache.ts
205
+ var T = "", E = 1800 * 1e3;
206
+ function D(e) {
207
+ return e == null || e === "" ? T : e;
208
+ }
209
+ function O(e) {
177
210
  if (e == null) return Infinity;
178
211
  let t = Number(e);
179
212
  return Number.isFinite(t) && t >= 0 ? t : Infinity;
180
213
  }
181
- function T(e) {
214
+ function k(e) {
182
215
  return !e || typeof e.search != "string" ? !1 : e.search.trim().length > 0;
183
216
  }
184
- function E(e) {
217
+ function A(e) {
185
218
  if (!e) return null;
186
219
  let t = e.folderId;
187
220
  return t == null ? null : String(t);
188
221
  }
189
- function D(e) {
222
+ function j(e) {
190
223
  return !!e && !!e.isFolder;
191
224
  }
192
- function O() {
225
+ function M() {
193
226
  if (typeof globalThis?.crypto?.randomUUID == "function") return globalThis.crypto.randomUUID();
194
227
  try {
195
228
  let e = globalThis.crypto || globalThis.msCrypto;
@@ -203,17 +236,17 @@ function O() {
203
236
  } catch {}
204
237
  return `id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random() * (2 ** 53 - 1)).toString(36).slice(0, 8)}`;
205
238
  }
206
- function k(e) {
239
+ function N(e) {
207
240
  if (!e || typeof e != "object") return !1;
208
241
  let t = e;
209
242
  return t.code === "path_folder_not_found" || t.code === "folder_not_found" || t.code === "FolderNotFound" || t.data?.code === "path_folder_not_found" || t.data?.code === "folder_not_found" || t.status === 404 || t.data?.data?.status === 404;
210
243
  }
211
- function A(e) {
244
+ function P(e) {
212
245
  let t = 2166136261;
213
246
  for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = t + ((t << 1) + (t << 4) + (t << 7) + (t << 8) + (t << 24)) >>> 0;
214
247
  return t.toString(36);
215
248
  }
216
- function j(e) {
249
+ function F(e) {
217
250
  if (!e || typeof e != "object") return String(e ?? "");
218
251
  let t = e, n = [], r = {}, i = [
219
252
  "page",
@@ -228,10 +261,10 @@ function j(e) {
228
261
  let a = t[e];
229
262
  i.includes(e) ? n.push(`${e}=${String(a ?? "")}`) : r[e] = a;
230
263
  }
231
- let a = Object.keys(r).length ? JSON.stringify(r) : "", o = n.join("|"), s = a ? A(a) : "";
264
+ let a = Object.keys(r).length ? JSON.stringify(r) : "", o = n.join("|"), s = a ? P(a) : "";
232
265
  return `${o}${s ? `|${s}` : ""}`;
233
266
  }
234
- var M = class e {
267
+ var I = class e {
235
268
  constructor() {
236
269
  this.entities = /* @__PURE__ */ new Map(), this.childrenByParent = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e4;
237
270
  }
@@ -255,28 +288,32 @@ var M = class e {
255
288
  }
256
289
  getFileSystemItem(e) {
257
290
  let t = this.getEntity(e);
258
- return t && !D(t) ? t : void 0;
291
+ return t && !j(t) ? t : void 0;
259
292
  }
260
293
  getFolder(e) {
261
294
  let t = this.getEntity(e);
262
- return t && D(t) ? t : void 0;
295
+ return t && j(t) ? t : void 0;
263
296
  }
264
297
  getChildrenIds(e, t = {}) {
265
- let n = C(e), r = this.childrenByParent.get(n);
298
+ let n = D(e), r = this.childrenByParent.get(n);
266
299
  return r ? t.onlyFileSystemItems ? Array.from(r.files) : t.onlyFolders ? Array.from(r.folders) : [...Array.from(r.folders), ...Array.from(r.files)] : [];
267
300
  }
268
301
  searchByUrl(e) {
269
- for (let t of this.entities.values()) if (t.value.url === e) return t.value;
302
+ let t = w(e);
303
+ for (let n of this.entities.values()) {
304
+ let r = n.value.url;
305
+ if (r && (r === e || w(r) === t)) return n.value;
306
+ }
270
307
  return null;
271
308
  }
272
309
  upsertEntity(e) {
273
- let t = this.entities.get(e.id) ?? null, n = t ? t.value : null, r = n ? E(n) : null, i = E(e), a = n ? D(n) : !1, o = D(e), s;
274
- if (n && D(n) && o) {
310
+ let t = this.entities.get(e.id) ?? null, n = t ? t.value : null, r = n ? A(n) : null, i = A(e), a = n ? j(n) : !1, o = j(e), s;
311
+ if (n && j(n) && o) {
275
312
  let t = n.childrenCount, r = e.childrenCount;
276
313
  t !== void 0 && r === void 0 && (s = t);
277
314
  }
278
315
  if (n && (r !== i || a !== o)) {
279
- let t = C(r), n = this.childrenByParent.get(t);
316
+ let t = D(r), n = this.childrenByParent.get(t);
280
317
  n && (a ? n.folders.delete(e.id) : n.files.delete(e.id), n.files.size === 0 && n.folders.size === 0 && this.childrenByParent.delete(t));
281
318
  }
282
319
  let c = e;
@@ -287,7 +324,7 @@ var M = class e {
287
324
  value: { ...c },
288
325
  updatedAt: this.now()
289
326
  }), this.checkCacheSize();
290
- let l = C(i), u = this.childrenByParent.get(l);
327
+ let l = D(i), u = this.childrenByParent.get(l);
291
328
  u || (u = {
292
329
  files: /* @__PURE__ */ new Set(),
293
330
  folders: /* @__PURE__ */ new Set()
@@ -296,7 +333,7 @@ var M = class e {
296
333
  updateServerChildrenCount(e, t) {
297
334
  if (e == null || t == null || Number.isNaN(t)) return;
298
335
  let n = this.entities.get(e);
299
- if (!n || !D(n.value)) return;
336
+ if (!n || !j(n.value)) return;
300
337
  let r = {
301
338
  ...n.value,
302
339
  childrenCount: t
@@ -312,32 +349,32 @@ var M = class e {
312
349
  entity: null,
313
350
  parentId: null
314
351
  };
315
- let n = t.value, r = E(n), i = C(r), a = this.childrenByParent.get(i);
316
- return a && (D(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), {
352
+ let n = t.value, r = A(n), i = D(r), a = this.childrenByParent.get(i);
353
+ return a && (j(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), {
317
354
  entity: { ...n },
318
355
  parentId: r
319
356
  };
320
357
  }
321
358
  deleteFolderRecursive(e) {
322
359
  let t = this.entities.get(e);
323
- if (!t || !D(t.value)) return {
360
+ if (!t || !j(t.value)) return {
324
361
  deletedFolderRecords: [],
325
362
  deletedFileSystemItemRecords: []
326
363
  };
327
364
  let n = [{
328
365
  id: e,
329
- parentId: E(t.value)
366
+ parentId: A(t.value)
330
367
  }], r = [], i = [];
331
368
  for (; n.length;) {
332
369
  let e = n.shift();
333
370
  r.push(e);
334
- let t = this.childrenByParent.get(C(e.id));
371
+ let t = this.childrenByParent.get(D(e.id));
335
372
  if (t) {
336
373
  for (let e of Array.from(t.folders)) {
337
374
  let t = this.entities.get(e);
338
375
  t && n.push({
339
376
  id: e,
340
- parentId: E(t.value)
377
+ parentId: A(t.value)
341
378
  });
342
379
  }
343
380
  for (let e of Array.from(t.files)) i.push(e);
@@ -347,16 +384,16 @@ var M = class e {
347
384
  for (let e of i) {
348
385
  let t = this.entities.get(e);
349
386
  if (!t) continue;
350
- let n = t.value, r = C(E(n)), i = this.childrenByParent.get(r);
387
+ let n = t.value, r = D(A(n)), i = this.childrenByParent.get(r);
351
388
  i && (i.files.delete(e), i.files.size === 0 && i.folders.size === 0 && this.childrenByParent.delete(r)), this.entities.delete(e), a.push({ ...n });
352
389
  }
353
390
  let o = [];
354
391
  for (let e = r.length - 1; e >= 0; e--) {
355
392
  let { id: t, parentId: n } = r[e], i = this.entities.get(t);
356
393
  if (!i) continue;
357
- let a = i.value, s = C(a.id);
394
+ let a = i.value, s = D(a.id);
358
395
  this.childrenByParent.delete(s);
359
- let c = C(n), l = this.childrenByParent.get(c);
396
+ let c = D(n), l = this.childrenByParent.get(c);
360
397
  l && (l.folders.delete(t), l.files.size === 0 && l.folders.size === 0 && this.childrenByParent.delete(c)), this.entities.delete(t), o.push({ ...a });
361
398
  }
362
399
  return {
@@ -367,13 +404,13 @@ var M = class e {
367
404
  moveEntityById(e, t) {
368
405
  let n = this.entities.get(e) ?? null;
369
406
  if (!n) return null;
370
- let r = n.value, i = C(E(r)), a = this.childrenByParent.get(i);
371
- a && (D(r) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i));
407
+ let r = n.value, i = D(A(r)), a = this.childrenByParent.get(i);
408
+ a && (j(r) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i));
372
409
  let o = {
373
410
  ...r,
374
411
  folderId: t
375
412
  };
376
- if (D(r) && D(o)) {
413
+ if (j(r) && j(o)) {
377
414
  let e = r.childrenCount;
378
415
  e !== void 0 && (o.childrenCount = e);
379
416
  }
@@ -381,15 +418,15 @@ var M = class e {
381
418
  value: o,
382
419
  updatedAt: this.now()
383
420
  });
384
- let s = C(t), c = this.childrenByParent.get(s);
421
+ let s = D(t), c = this.childrenByParent.get(s);
385
422
  return c || (c = {
386
423
  files: /* @__PURE__ */ new Set(),
387
424
  folders: /* @__PURE__ */ new Set()
388
- }, this.childrenByParent.set(s, c)), D(o) ? c.folders.add(e) : c.files.add(e), { ...o };
425
+ }, this.childrenByParent.set(s, c)), j(o) ? c.folders.add(e) : c.files.add(e), { ...o };
389
426
  }
390
427
  copyFileSystemItem(e, t, n) {
391
428
  let r = this.entities.get(e) ?? null;
392
- if (!r || D(r.value)) return null;
429
+ if (!r || j(r.value)) return null;
393
430
  let i = {
394
431
  ...r.value,
395
432
  id: t,
@@ -399,7 +436,7 @@ var M = class e {
399
436
  }
400
437
  copyFolderShallow(e, t, n) {
401
438
  let r = this.entities.get(e) ?? null;
402
- if (!r || !D(r.value)) return null;
439
+ if (!r || !j(r.value)) return null;
403
440
  let i = {
404
441
  ...r.value,
405
442
  id: t,
@@ -423,7 +460,7 @@ var M = class e {
423
460
  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;
424
461
  if (n !== void 0) {
425
462
  l = /* @__PURE__ */ new Set();
426
- let e = C(n);
463
+ let e = D(n);
427
464
  if (l.add(e), r) {
428
465
  let t = [e], n = /* @__PURE__ */ new Set();
429
466
  for (; t.length > 0;) {
@@ -439,10 +476,10 @@ var M = class e {
439
476
  if (c.length >= o) break;
440
477
  let t = e.value;
441
478
  if (l !== null) {
442
- let e = C(E(t));
479
+ let e = D(A(t));
443
480
  if (!l.has(e)) continue;
444
481
  }
445
- if (i === "file" && D(t) || i === "folder" && !D(t)) continue;
482
+ if (i === "file" && j(t) || i === "folder" && !j(t)) continue;
446
483
  let n = t.name ?? "";
447
484
  (a ? n : n.toLowerCase()).includes(s) && c.push({ ...t });
448
485
  }
@@ -469,8 +506,8 @@ var M = class e {
469
506
  });
470
507
  return n;
471
508
  }
472
- }, N = class e {
473
- constructor(e = {}, t = S, n, r, i = new o(), a = k) {
509
+ }, L = class e {
510
+ constructor(e = {}, t = E, n, r, i = new o(), a = N) {
474
511
  this.views = /* @__PURE__ */ new Map(), this.maxViewsPerParent = 50;
475
512
  let s = g(e);
476
513
  this.strategy = {
@@ -494,7 +531,7 @@ var M = class e {
494
531
  return Date.now();
495
532
  }
496
533
  parentKey(e) {
497
- return C(e ?? null);
534
+ return D(e ?? null);
498
535
  }
499
536
  isExpired(e) {
500
537
  return e == null || this.ttl !== Infinity && this.now() - e > this.ttl;
@@ -503,13 +540,13 @@ var M = class e {
503
540
  return !e || e.some((e) => !t.getEntity(e) || t.isEntityStale(e, this.entityTtl));
504
541
  }
505
542
  isEntityTypeCompatible(e, t) {
506
- return !!(!t || t === "all" || t === "file" && !D(e) || t === "folder" && D(e));
543
+ return !!(!t || t === "all" || t === "file" && !j(e) || t === "folder" && j(e));
507
544
  }
508
545
  markViewStaleForReload(e) {
509
546
  e.view.meta = {
510
547
  ...e.view.meta ?? {},
511
548
  stale: !0
512
- }, e.view.updatedAt = this.now(), e.view.loadId = O(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
549
+ }, e.view.updatedAt = this.now(), e.view.loadId = M(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
513
550
  }
514
551
  cleanupOldViews(e) {
515
552
  if (e.size <= this.maxViewsPerParent) return;
@@ -520,7 +557,7 @@ var M = class e {
520
557
  }
521
558
  }
522
559
  async getOrCreateChildren(e, t, n, r) {
523
- let i = this.parentKey(e), a = j(t ?? {}), s = this.views.get(i);
560
+ let i = this.parentKey(e), a = F(t ?? {}), s = this.views.get(i);
524
561
  s || (s = /* @__PURE__ */ new Map(), this.views.set(i, s));
525
562
  let c = o.childrenViewKey(i, a), l = s.get(a);
526
563
  l || (l = {
@@ -543,14 +580,14 @@ var M = class e {
543
580
  };
544
581
  }
545
582
  if (l.view.promise) return l.view.promise;
546
- let d = O();
583
+ let d = M();
547
584
  l.view.loadId = d;
548
585
  let f = (async () => {
549
586
  try {
550
- let a = await n(e, t), o = T(t), s = o ? {
587
+ let a = await n(e, t), o = k(t), s = o ? {
551
588
  ...a,
552
589
  total: void 0
553
- } : a, u = this.views.get(i)?.get(j(t));
590
+ } : a, u = this.views.get(i)?.get(F(t));
554
591
  if (!u || u.view.loadId !== d) {
555
592
  let e = /* @__PURE__ */ Error("StaleLoad");
556
593
  throw e.name = "StaleLoad", e;
@@ -559,7 +596,7 @@ var M = class e {
559
596
  l.view.value = s.items.map((e) => e.id);
560
597
  let { items: f, ...p } = s, m = { ...p };
561
598
  l.view.meta = m, l.view.meta && (l.view.meta.stale = !1), this.failedRequests.delete(c), l.view.updatedAt = this.now(), !o && typeof m.total == "number" && (this.serverChildrenCountHandler ? this.serverChildrenCountHandler(e ?? null, m.total, r) : r.updateServerChildrenCount(e, m.total));
562
- let h = this.strategy.preloadPagesAfter ?? 0, g = this.strategy.preloadPagesBefore ?? 0, _ = w(t?.pageSize);
599
+ let h = this.strategy.preloadPagesAfter ?? 0, g = this.strategy.preloadPagesBefore ?? 0, _ = O(t?.pageSize);
563
600
  if ((h > 0 || g > 0) && Number.isFinite(_)) {
564
601
  let i = e, a = { ...t }, o = typeof m.totalPages == "number" ? m.totalPages : 1, s = t?.page ?? 1, c = _, l = n, u = d;
565
602
  setTimeout(() => {
@@ -588,9 +625,9 @@ var M = class e {
588
625
  try {
589
626
  let i = this.parentKey(e), c = this.views.get(i);
590
627
  if (!c) return;
591
- let d = c.get(j(t));
628
+ let d = c.get(F(t));
592
629
  if (!d || u != null && d.view.loadId !== u) return;
593
- let f = c.get(j(t));
630
+ let f = c.get(F(t));
594
631
  if (!f?.view.meta) return;
595
632
  let p = typeof f.view.meta.totalPages == "number" ? f.view.meta.totalPages : 1;
596
633
  if (p !== r) return;
@@ -602,10 +639,10 @@ var M = class e {
602
639
  try {
603
640
  let a = await l(e, r), o = this.views.get(i);
604
641
  if (!o) return;
605
- let c = o.get(j(t));
642
+ let c = o.get(F(t));
606
643
  if (!c || u != null && c.view.loadId !== u || c.view.loadId !== u) return;
607
644
  for (let e of a.items) s.upsertEntity(e);
608
- let d = j(r), f = o.get(d);
645
+ let d = F(r), f = o.get(d);
609
646
  if (f || (f = {
610
647
  params: r,
611
648
  view: {
@@ -629,14 +666,14 @@ var M = class e {
629
666
  }
630
667
  };
631
668
  if (a > 0 && n < p) for (let e = 1; e <= Math.min(a, p - n); e++) {
632
- let r = n + e, i = j({
669
+ let r = n + e, i = F({
633
670
  ...t,
634
671
  page: r
635
672
  }), a = c.get(i);
636
673
  (!a?.view.value || this.isExpired(a.view.updatedAt)) && m(r);
637
674
  }
638
675
  if (o > 0 && n > 1) for (let e = 1; e <= Math.min(o, n - 1); e++) {
639
- let r = n - e, i = j({
676
+ let r = n - e, i = F({
640
677
  ...t,
641
678
  page: r
642
679
  }), a = c.get(i);
@@ -648,7 +685,7 @@ var M = class e {
648
685
  }
649
686
  removeEmptyPageIfNeeded(e, t, n, r, i) {
650
687
  if (t.view.value && t.view.value.length === 0 && n < r) {
651
- let t = j({
688
+ let t = F({
652
689
  ...i,
653
690
  page: n
654
691
  });
@@ -670,14 +707,14 @@ var M = class e {
670
707
  syncTotalsInSameViews(e, t) {
671
708
  let n = t.view.meta;
672
709
  if (!n || typeof n.total != "number") return;
673
- let r = Number(n.total), i = w(t.params?.pageSize), a = Number.isFinite(i) && i > 0 ? Math.max(1, Math.ceil(r / i)) : void 0;
710
+ let r = Number(n.total), i = O(t.params?.pageSize), a = Number.isFinite(i) && i > 0 ? Math.max(1, Math.ceil(r / i)) : void 0;
674
711
  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));
675
712
  }
676
713
  cascadeShiftPages(e, t, n, r, i, a, o) {
677
714
  let s = t, c = n, l = !1, u = 0;
678
715
  for (; s.view.value && s.view.value.length < r && c < i && u < 100;) {
679
716
  u++;
680
- let t = j({
717
+ let t = F({
681
718
  ...o,
682
719
  page: c + 1
683
720
  }), n = e.get(t);
@@ -699,7 +736,7 @@ var M = class e {
699
736
  if (s.view.value = [...s.view.value, ...d], s.view.updatedAt = Date.now(), n.view.value = n.view.value.slice(d.length), n.view.updatedAt = Date.now(), n.view.value.length === 0) {
700
737
  let t = c + 1, r = n.view.meta;
701
738
  if (t < (r && typeof r.totalPages == "number" ? r.totalPages : 1)) {
702
- let n = j({
739
+ let n = F({
703
740
  ...o,
704
741
  page: t
705
742
  });
@@ -723,7 +760,7 @@ var M = class e {
723
760
  let s = {
724
761
  ...o,
725
762
  page: n + 1
726
- }, c = j(s), l = e.get(c), u = !1;
763
+ }, c = F(s), l = e.get(c), u = !1;
727
764
  if (!l?.view.value || this.isExpired(l.view.updatedAt)) if (n >= i) {
728
765
  l = {
729
766
  params: s,
@@ -787,7 +824,7 @@ var M = class e {
787
824
  ], e.view.updatedAt = this.now(), !0);
788
825
  }
789
826
  updateChildrenCountForOperation(e, t, n, r) {
790
- let i = E(t);
827
+ let i = A(t);
791
828
  switch (e) {
792
829
  case "delete":
793
830
  this.adjustChildrenCount(r, i, -1), this.childrenCountInvalidator?.(i);
@@ -814,14 +851,14 @@ var M = class e {
814
851
  this.updateChildrenCountForOperation(n, t, i, r);
815
852
  let o = this.parentKey(e), s = this.views.get(o);
816
853
  if (s) for (let [, e] of s) {
817
- let a = e.params ?? {}, o = a?.page ?? 1, c = w(a?.pageSize), l = Number.isFinite(c), u = !!(a?.sortBy || a?.sortOrder), d = !!a?.search, f = a?.itemType || "all";
854
+ let a = e.params ?? {}, o = a?.page ?? 1, c = O(a?.pageSize), l = Number.isFinite(c), u = !!(a?.sortBy || a?.sortOrder), d = !!a?.search, f = a?.itemType || "all";
818
855
  if (this.isEntityTypeCompatible(t, f)) {
819
856
  if (d && this.strategy.filterMatch && !this.strategy.filterMatch(t, e.params)) {
820
857
  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));
821
858
  continue;
822
859
  }
823
860
  if (!e.view.value) {
824
- e.view.meta && (e.view.meta.stale = !0), e.view.loadId = O(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
861
+ e.view.meta && (e.view.meta.stale = !0), e.view.loadId = M(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
825
862
  continue;
826
863
  }
827
864
  if (e.view.value.includes(t.id), this.shouldInvalidateCompletely(e, n, t, u, l, o)) {
@@ -871,7 +908,7 @@ var M = class e {
871
908
  t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
872
909
  }
873
910
  }
874
- t.view.loadId = O(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
911
+ t.view.loadId = M(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
875
912
  }
876
913
  handleInsert(e, t, n, r, i, a, o, s) {
877
914
  if (!t.view.value.includes(o.id)) {
@@ -901,7 +938,7 @@ var M = class e {
901
938
  }
902
939
  t.view.updatedAt = Date.now();
903
940
  } else this.markViewStaleForReload(t);
904
- t.view.loadId = O(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
941
+ t.view.loadId = M(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
905
942
  }
906
943
  }
907
944
  handleUpdate(e, t, n, r, i, a, o, s, c) {
@@ -918,15 +955,15 @@ var M = class e {
918
955
  t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
919
956
  }
920
957
  }
921
- t.view.loadId = O(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
958
+ t.view.loadId = M(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
922
959
  return;
923
960
  }
924
961
  if (l && (a || o)) {
925
- 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 = O(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0)) : this.markViewStaleForReload(t);
962
+ 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 = M(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0)) : this.markViewStaleForReload(t);
926
963
  return;
927
964
  }
928
965
  if (l) {
929
- t.view.updatedAt = Date.now(), t.view.loadId = O(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
966
+ t.view.updatedAt = Date.now(), t.view.loadId = M(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
930
967
  return;
931
968
  }
932
969
  if (u && !o) {
@@ -950,7 +987,7 @@ var M = class e {
950
987
  }
951
988
  t.view.updatedAt = Date.now();
952
989
  } else this.markViewStaleForReload(t);
953
- t.view.loadId = O(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
990
+ t.view.loadId = M(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
954
991
  }
955
992
  }
956
993
  handleMove(e, t, n, r, i, a, o, s, c) {
@@ -968,13 +1005,13 @@ var M = class e {
968
1005
  }
969
1006
  this.syncTotalsInSameViews(e, t);
970
1007
  }
971
- t.view.loadId = O(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
1008
+ t.view.loadId = M(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
972
1009
  }
973
1010
  forceInvalidateChildrenViews(e) {
974
1011
  let t = this.parentKey(e ?? null);
975
1012
  this.failedRequests.clearChildrenViewErrorsForParent(t);
976
1013
  let n = this.views.get(t);
977
- 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 = O(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
1014
+ 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 = M(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
978
1015
  }
979
1016
  getKnownTotal(e) {
980
1017
  let t = this.parentKey(e ?? null), n = this.views.get(t);
@@ -1016,13 +1053,13 @@ var M = class e {
1016
1053
  }
1017
1054
  return s;
1018
1055
  }
1019
- }, P = class e {
1056
+ }, R = class e {
1020
1057
  invalidateChildrenCountCache(e) {
1021
- let t = C(e ?? "");
1058
+ let t = D(e ?? "");
1022
1059
  this.childrenCountPromises.delete(t), this.failedRequests.delete(o.childrenCountKey(t));
1023
1060
  }
1024
- constructor(e = {}, t = S, n, r) {
1025
- this.childrenCountPromises = /* @__PURE__ */ new Map(), this.isFolderNotFoundError = r?.isFolderNotFoundError ?? k, this.failedRequests = new o(), this.ttl = r?.ttl ?? t, this.errorTtl = r?.errorTtl ?? n ?? this.ttl, this.entities = new M(), this.views = new N(e, this.ttl, this.errorTtl, void 0, this.failedRequests, this.isFolderNotFoundError), this.views.setServerChildrenCountHandler((e, t, n) => {
1061
+ constructor(e = {}, t = E, n, r) {
1062
+ this.childrenCountPromises = /* @__PURE__ */ new Map(), this.isFolderNotFoundError = r?.isFolderNotFoundError ?? N, this.failedRequests = new o(), this.ttl = r?.ttl ?? t, this.errorTtl = r?.errorTtl ?? n ?? this.ttl, this.entities = new I(), this.views = new L(e, this.ttl, this.errorTtl, void 0, this.failedRequests, this.isFolderNotFoundError), this.views.setServerChildrenCountHandler((e, t, n) => {
1026
1063
  this.handleServerReportedChildrenCount(e, t, n ?? this.entities);
1027
1064
  }), this.views.setChildrenCountInvalidator((e) => {
1028
1065
  this.invalidateChildrenCountCache(e);
@@ -1041,7 +1078,7 @@ var M = class e {
1041
1078
  return this.views.getOrCreateChildren(e, t, n, this.entities);
1042
1079
  }
1043
1080
  upsertEntity(e) {
1044
- let t = this.entities.getEntity(e.id), n = t ? E(t) : null, r = E(e), i = t ? D(t) : !1, a = D(e);
1081
+ let t = this.entities.getEntity(e.id), n = t ? A(t) : null, r = A(e), i = t ? j(t) : !1, a = j(e);
1045
1082
  if (this.entities.upsertEntity(e), t) {
1046
1083
  if (n !== r || i !== a) {
1047
1084
  this.views.smartInvalidateChildrenViews(n, t, "delete", this.entities), this.views.smartInvalidateChildrenViews(r, e, "insert", this.entities);
@@ -1053,24 +1090,24 @@ var M = class e {
1053
1090
  isAncestor(e, t) {
1054
1091
  let n = t, r = /* @__PURE__ */ new Set();
1055
1092
  for (; n && !r.has(n);) {
1056
- if (r.add(n), C(n) === C(e)) return !0;
1093
+ if (r.add(n), D(n) === D(e)) return !0;
1057
1094
  let t = this.entities.getEntity(n);
1058
1095
  if (!t) break;
1059
- n = E(t), n === null && (n = x);
1096
+ n = A(t), n === null && (n = T);
1060
1097
  }
1061
1098
  return !1;
1062
1099
  }
1063
1100
  moveEntity(e, t) {
1064
1101
  let n = this.entities.getEntity(e);
1065
- if (!n || D(n) && t !== null && this.isAncestor(e, t)) return null;
1066
- let r = E(n), i = this.entities.moveEntityById(e, t);
1102
+ if (!n || j(n) && t !== null && this.isAncestor(e, t)) return null;
1103
+ let r = A(n), i = this.entities.moveEntityById(e, t);
1067
1104
  return i ? (this.views.smartInvalidateChildrenViews(r, n, "delete", this.entities), this.views.smartInvalidateChildrenViews(t, i, "insert", this.entities), i) : null;
1068
1105
  }
1069
1106
  copyEntity(e, t, n, r) {
1070
1107
  let i = this.entities.getEntity(e);
1071
1108
  if (!i) return null;
1072
1109
  let a = null;
1073
- if (D(i)) {
1110
+ if (j(i)) {
1074
1111
  let n = [e], i = [];
1075
1112
  for (; n.length;) {
1076
1113
  let e = n.shift();
@@ -1079,9 +1116,9 @@ var M = class e {
1079
1116
  for (let e of t) n.push(e);
1080
1117
  }
1081
1118
  let o = /* @__PURE__ */ new Map();
1082
- for (let e of i) o.set(e, O());
1119
+ for (let e of i) o.set(e, M());
1083
1120
  for (let n of i) {
1084
- let i = this.entities.getFolder(n), a = o.get(n), s = E(i), c = s === null ? t : o.get(s) ?? null, l = {
1121
+ let i = this.entities.getFolder(n), a = o.get(n), s = A(i), c = s === null ? t : o.get(s) ?? null, l = {
1085
1122
  ...i,
1086
1123
  ...n === e ? r : void 0,
1087
1124
  id: a,
@@ -1094,7 +1131,7 @@ var M = class e {
1094
1131
  for (let e of n) {
1095
1132
  let n = this.entities.getFileSystemItem(e);
1096
1133
  if (!n) continue;
1097
- let r = O(), i = {
1134
+ let r = M(), i = {
1098
1135
  ...n,
1099
1136
  id: r,
1100
1137
  folderId: t
@@ -1104,7 +1141,7 @@ var M = class e {
1104
1141
  }
1105
1142
  a = this.entities.getEntity(o.get(e)) ?? null;
1106
1143
  } else {
1107
- let i = n ?? O();
1144
+ let i = n ?? M();
1108
1145
  if (a = this.entities.copyFileSystemItem(e, i, t ?? null), a && r) {
1109
1146
  let e = {
1110
1147
  ...a,
@@ -1123,7 +1160,7 @@ var M = class e {
1123
1160
  deleteEntity(e) {
1124
1161
  let t = this.entities.getEntity(e);
1125
1162
  if (!t) return null;
1126
- if (D(t)) {
1163
+ if (j(t)) {
1127
1164
  let { deletedFolderRecords: n, deletedFileSystemItemRecords: r } = this.entities.deleteFolderRecursive(e);
1128
1165
  for (let e of r) this.views.smartInvalidateChildrenViews(e.folderId, e, "delete", this.entities);
1129
1166
  for (let e of n) this.views.smartInvalidateChildrenViews(e.folderId, e, "delete", this.entities);
@@ -1151,7 +1188,7 @@ var M = class e {
1151
1188
  return;
1152
1189
  }
1153
1190
  let n = /* @__PURE__ */ new Set();
1154
- if (D(t)) {
1191
+ if (j(t)) {
1155
1192
  let t = [e];
1156
1193
  for (; t.length;) {
1157
1194
  let e = t.pop();
@@ -1175,7 +1212,7 @@ var M = class e {
1175
1212
  return this.entities.searchByName(e, t);
1176
1213
  }
1177
1214
  async getChildrenCount(e = "", t) {
1178
- let n = C(e), r = o.childrenCountKey(n), i = this.failedRequests.getFreshError(r, this.errorTtl);
1215
+ let n = D(e), r = o.childrenCountKey(n), i = this.failedRequests.getFreshError(r, this.errorTtl);
1179
1216
  if (i != null) return Promise.reject(i);
1180
1217
  let a = this.childrenCountPromises.get(n);
1181
1218
  if (a) return a;
@@ -1208,7 +1245,7 @@ var M = class e {
1208
1245
  };
1209
1246
  }
1210
1247
  static fromJSON(t, n, r) {
1211
- let i = r?.ttl ?? t?.ttl ?? 18e5, a = r?.errorTtl ?? t?.errorTtl ?? i, o = new e(n ?? {}, i, a, r), s = M.fromJSON(t?.entities ?? {}), c = N.fromJSON(t?.views ?? {}, {
1248
+ let i = r?.ttl ?? t?.ttl ?? 18e5, a = r?.errorTtl ?? t?.errorTtl ?? i, o = new e(n ?? {}, i, a, r), s = I.fromJSON(t?.entities ?? {}), c = L.fromJSON(t?.views ?? {}, {
1212
1249
  failedRequests: o.failedRequests,
1213
1250
  ttl: i,
1214
1251
  errorTtl: a,
@@ -1245,8 +1282,8 @@ var M = class e {
1245
1282
  let i = n.getFolder(r)?.childrenCount;
1246
1283
  i !== void 0 && i !== t && (console.warn(`Conflict: folder "${r}" has childrenCount=${i} but server says total=${t}`), this.views.forceInvalidateChildrenViews(r)), n.updateServerChildrenCount(r, t);
1247
1284
  }
1248
- }, F = "", I = "Trash", L = "Edited", R = 1e4, z = 1e4, B = 25, V = 10;
1249
- function H(e, t) {
1285
+ }, ee = "", te = "Trash", ne = "Edited", z = 1e4, B = 1e4, V = 25, H = 10;
1286
+ function U(e, t) {
1250
1287
  let n = e ?? {}, r = Array.isArray(n.detailed) ? n.detailed.map((e) => ({
1251
1288
  requestId: e.requestId ?? e.id,
1252
1289
  success: !!e.success,
@@ -1259,30 +1296,30 @@ function H(e, t) {
1259
1296
  detailed: r
1260
1297
  };
1261
1298
  }
1262
- function U(e) {
1299
+ function W(e) {
1263
1300
  return e == null ? "" : String(e);
1264
1301
  }
1265
- function W(e) {
1302
+ function G(e) {
1266
1303
  return {
1267
1304
  ...e,
1268
- name: U(e.name)
1305
+ name: W(e.name)
1269
1306
  };
1270
1307
  }
1271
- function G(e) {
1272
- return (e ?? []).map(W);
1273
- }
1274
1308
  function K(e) {
1309
+ return (e ?? []).map(G);
1310
+ }
1311
+ function q(e) {
1275
1312
  return !e || typeof e != "object" || !("name" in e) ? e : {
1276
1313
  ...e,
1277
- name: U(e.name)
1314
+ name: W(e.name)
1278
1315
  };
1279
1316
  }
1280
- function q(e) {
1317
+ function J(e) {
1281
1318
  return e ? e.replaceAll("\\", "/").split("/").filter(Boolean) : [];
1282
1319
  }
1283
- for (var J = class {
1320
+ for (var re = class {
1284
1321
  _getTrashPath() {
1285
- return this._pathOptions.trashPath || I;
1322
+ return this._pathOptions.trashPath || te;
1286
1323
  }
1287
1324
  _getPathLookupCandidates(e) {
1288
1325
  return y(e, this._getTrashPath(), _);
@@ -1295,7 +1332,7 @@ for (var J = class {
1295
1332
  name: t.name || t.id,
1296
1333
  parentId: t.folderId
1297
1334
  };
1298
- return this._cache.upsertEntity(W({
1335
+ return this._cache.upsertEntity(G({
1299
1336
  id: r.id,
1300
1337
  name: r.name,
1301
1338
  folderId: r.parentId ?? null,
@@ -1309,8 +1346,8 @@ for (var J = class {
1309
1346
  }
1310
1347
  }
1311
1348
  async _findOrCreateFolderByPath(t) {
1312
- let n = q(t);
1313
- if (n.length > V) throw new e("Path depth exceeds maximum limit of %s".replace("%s", String(V)), "ValidationError");
1349
+ let n = J(t);
1350
+ if (n.length > H) throw new e("Path depth exceeds maximum limit of %s".replace("%s", String(H)), "ValidationError");
1314
1351
  let r = await this._resolveFolderByPath(t);
1315
1352
  if (r) return r;
1316
1353
  let i;
@@ -1342,7 +1379,7 @@ for (var J = class {
1342
1379
  return t;
1343
1380
  }
1344
1381
  async getTempFolder() {
1345
- let t = this._pathOptions.tempPath ?? L;
1382
+ let t = this._pathOptions.tempPath ?? ne;
1346
1383
  if (t) try {
1347
1384
  return await this._findOrCreateFolderByPath(t);
1348
1385
  } catch (t) {
@@ -1353,7 +1390,7 @@ for (var J = class {
1353
1390
  }
1354
1391
  constructor(e, t = {}, n, r = {}) {
1355
1392
  this._dataProvider = e, this._options = t, this._pathOptions = n, this._blobFetchForceReloadOnceIds = /* @__PURE__ */ new Set(), this._mutationRegistry = new s(), this._mapItem = async ({ childrenCount: e, ...t }) => {
1356
- let n = W(t);
1393
+ let n = G(t);
1357
1394
  if (n.isFolder) return {
1358
1395
  ...n,
1359
1396
  childCount: e,
@@ -1367,7 +1404,7 @@ for (var J = class {
1367
1404
  url: r,
1368
1405
  thumbnailUrl: i
1369
1406
  };
1370
- }, this._config = r, this._useSoftDelete = this._pathOptions.useSoftDelete, this._rootId = this._pathOptions.rootId || F, this._enableTrash = this._options.enableTrash === void 0 || this._options.enableTrash, this._validateDuplicates = this._dataProvider.validateDuplicates, this._cache = new P(t.cacheStrategy || {}, t.cacheStrategy?.ttl, t.cacheStrategy?.errorTtl), this.setController({
1407
+ }, this._config = r, this._useSoftDelete = this._pathOptions.useSoftDelete, this._rootId = this._pathOptions.rootId || ee, this._enableTrash = this._options.enableTrash === void 0 || this._options.enableTrash, this._validateDuplicates = this._dataProvider.validateDuplicates, this._cache = new R(t.cacheStrategy || {}, t.cacheStrategy?.ttl, t.cacheStrategy?.errorTtl), this.setController({
1371
1408
  invalidateItemCache: (e) => {
1372
1409
  this._cache.forceInvalidate(e);
1373
1410
  },
@@ -1492,7 +1529,7 @@ for (var J = class {
1492
1529
  if (!this._dataProvider.pathMode) return null;
1493
1530
  let r = await this._getFileByPathStyleId(t);
1494
1531
  if (r && !r.isFolder) {
1495
- let e = W(r);
1532
+ let e = G(r);
1496
1533
  return this._cache.upsertEntity(e), await this._mapItem(e);
1497
1534
  }
1498
1535
  return null;
@@ -1507,14 +1544,14 @@ for (var J = class {
1507
1544
  }
1508
1545
  async getFiles({ folderId: e, search: t, sortBy: n, sortOrder: r, page: i, limit: a, itemType: o = "all", noFolder: s = !1 }) {
1509
1546
  s && (e = (await this.getTempFolder())?.id);
1510
- let c = this.normalizeId(e ?? this._rootId), l = this._options.enablePagination === !1, u = l ? 1 : i, d = l ? R : a, f = this._options.clientSideFilter, p = this._options.clientSideSorting, m = this._options.clientSidePaging, h = m ? Math.max(1, i ?? 1) : void 0, g = m ? typeof a == "number" && Number.isFinite(a) && a > 0 ? a : B : void 0, _ = this._emptyFilesResult(m ? h : u, m ? g : d);
1547
+ let c = this.normalizeId(e ?? this._rootId), l = this._options.enablePagination === !1, u = l ? 1 : i, d = l ? z : a, f = this._options.clientSideFilter, p = this._options.clientSideSorting, m = this._options.clientSidePaging, h = m ? Math.max(1, i ?? 1) : void 0, g = m ? typeof a == "number" && Number.isFinite(a) && a > 0 ? a : V : void 0, _ = this._emptyFilesResult(m ? h : u, m ? g : d);
1511
1548
  if (this._isDeletingId(c)) return _;
1512
1549
  let v = this._options.unifiedCatalogFetch !== !1 && l && (o === "folder" || o === "file"), y = v ? "all" : o, b = {
1513
1550
  folderId: c,
1514
1551
  itemType: y
1515
1552
  };
1516
- f || (b.search = t), p || (b.sortBy = n ?? (y === "folder" ? void 0 : "date"), b.sortOrder = r ?? (y === "folder" ? void 0 : "desc")), m || (b.page = u, b.limit = v ? z : d);
1517
- let x = v ? z : m ? void 0 : d, S = {
1553
+ f || (b.search = t), p || (b.sortBy = n ?? (y === "folder" ? void 0 : "date"), b.sortOrder = r ?? (y === "folder" ? void 0 : "desc")), m || (b.page = u, b.limit = v ? B : d);
1554
+ let x = v ? B : m ? void 0 : d, S = {
1518
1555
  folderId: c,
1519
1556
  itemType: y,
1520
1557
  search: f ? void 0 : t,
@@ -1525,11 +1562,11 @@ for (var J = class {
1525
1562
  }, C;
1526
1563
  try {
1527
1564
  C = await this._cache.getOrCreateChildren(c, S, async (e, t) => {
1528
- let n = t.pageSize, r = n != null && Number.isFinite(Number(n)) ? Number(n) : R, i = await this._dataProvider.getItems({
1565
+ let n = t.pageSize, r = n != null && Number.isFinite(Number(n)) ? Number(n) : z, i = await this._dataProvider.getItems({
1529
1566
  ...t,
1530
1567
  folderId: e,
1531
1568
  limit: r
1532
- }), a = G(i.items);
1569
+ }), a = K(i.items);
1533
1570
  return m ? {
1534
1571
  items: a,
1535
1572
  total: typeof i.pagination?.total == "number" ? i.pagination.total : a.length
@@ -1623,7 +1660,7 @@ for (var J = class {
1623
1660
  if (typeof this._dataProvider.findFileByUrl == "function") try {
1624
1661
  let t = await this._dataProvider.findFileByUrl(e);
1625
1662
  if (t) {
1626
- let e = W(t);
1663
+ let e = G(t);
1627
1664
  return this._cache.upsertEntity(e), e;
1628
1665
  }
1629
1666
  } catch (e) {
@@ -1641,7 +1678,7 @@ for (var J = class {
1641
1678
  folderId: t,
1642
1679
  itemType: "all",
1643
1680
  page: 1,
1644
- limit: B
1681
+ limit: V
1645
1682
  });
1646
1683
  return e.pagination.total ?? e.files.length;
1647
1684
  }
@@ -1669,7 +1706,7 @@ for (var J = class {
1669
1706
  let r = await this._dataProvider.uploadFile({
1670
1707
  ...t,
1671
1708
  folderId: n
1672
- }), i = W({
1709
+ }), i = G({
1673
1710
  name: t.name,
1674
1711
  size: t.size,
1675
1712
  ...r,
@@ -1707,10 +1744,10 @@ for (var J = class {
1707
1744
  folderId: a,
1708
1745
  items: e
1709
1746
  });
1710
- o = H(t, (e) => {
1747
+ o = U(t, (e) => {
1711
1748
  if (e) return {
1712
1749
  id: e.id,
1713
- name: U(e.name),
1750
+ name: W(e.name),
1714
1751
  folderId: e.folderId,
1715
1752
  url: e.url,
1716
1753
  thumbnailUrl: e.thumbnailUrl,
@@ -1722,7 +1759,7 @@ for (var J = class {
1722
1759
  for (let e = 0; e < o.detailed.length; e++) {
1723
1760
  let t = o.detailed[e];
1724
1761
  if (t && t.success) {
1725
- let r = t.data, i = r?.id ?? t.requestId, o = n?.[e]?.data, s = W({
1762
+ let r = t.data, i = r?.id ?? t.requestId, o = n?.[e]?.data, s = G({
1726
1763
  ...o,
1727
1764
  ...r,
1728
1765
  id: i,
@@ -1796,7 +1833,7 @@ for (var J = class {
1796
1833
  detailed: []
1797
1834
  }, i = n.permanent ? null : await this.getTrashFolder();
1798
1835
  if (typeof this._dataProvider.deleteItems == "function") {
1799
- if (r = H(await this._dataProvider.deleteItems(t.map((e) => this._cache.getEntity(e)), n), (e) => e), r.success) {
1836
+ if (r = U(await this._dataProvider.deleteItems(t.map((e) => this._cache.getEntity(e)), n), (e) => e), r.success) {
1800
1837
  let e = r.detailed || t.map((e) => ({
1801
1838
  requestId: e,
1802
1839
  success: !0,
@@ -1854,7 +1891,7 @@ for (var J = class {
1854
1891
  async createFolder({ name: t, parentId: n, is_force_create: r }) {
1855
1892
  let i = this.normalizeId(n ?? this._rootId);
1856
1893
  if (this._validateName(t, !0), this._validateDuplicates && this._checkNameExistsInCache(i, t, !0)) throw new e("Folder '%s' already exists in parent folder".replace("%s", t), "FolderAlreadyExists");
1857
- let a = await this._dataProvider.createFolder(t, i, r), o = W({
1894
+ let a = await this._dataProvider.createFolder(t, i, r), o = G({
1858
1895
  id: a.id,
1859
1896
  folderId: i,
1860
1897
  name: a.name,
@@ -1893,8 +1930,8 @@ for (var J = class {
1893
1930
  let t = this.normalizeId(i.folderId);
1894
1931
  if (this._checkNameExistsInCache(t, n, !0, r)) throw new e("Folder '%s' already exists in parent folder".replace("%s", n), "FolderAlreadyExists");
1895
1932
  }
1896
- let a = K(await this._dataProvider.renameItem(i, n));
1897
- return this._cache.upsertEntity(W({
1933
+ let a = q(await this._dataProvider.renameItem(i, n));
1934
+ return this._cache.upsertEntity(G({
1898
1935
  ...this._cache.getEntity(a.id),
1899
1936
  ...a
1900
1937
  })), this._cache.getEntity(a.id);
@@ -1908,8 +1945,8 @@ for (var J = class {
1908
1945
  let t = this.normalizeId(r.folderId);
1909
1946
  if (this._checkNameExistsInCache(t, n, !1, i)) throw new e("File '%s' already exists in parent folder".replace("%s", n), "FileAlreadyExists");
1910
1947
  }
1911
- let a = K(await this._dataProvider.renameItem(r, n));
1912
- return a && this._cache.upsertEntity(W({
1948
+ let a = q(await this._dataProvider.renameItem(r, n));
1949
+ return a && this._cache.upsertEntity(G({
1913
1950
  ...this._cache.getEntity(i),
1914
1951
  ...a
1915
1952
  })), this._cache.getEntity(i);
@@ -1920,12 +1957,12 @@ for (var J = class {
1920
1957
  this._validateTargetFolderType(n);
1921
1958
  let a = this._cache.getEntity(t);
1922
1959
  if (!a) {
1923
- let e = K(await this._dataProvider.moveItem({
1960
+ let e = q(await this._dataProvider.moveItem({
1924
1961
  id: t,
1925
1962
  folderId: i,
1926
1963
  isFolder: r
1927
1964
  }, i));
1928
- if (e.id === t) this._cache.upsertEntity(W({
1965
+ if (e.id === t) this._cache.upsertEntity(G({
1929
1966
  ...e,
1930
1967
  folderId: i
1931
1968
  }));
@@ -1933,7 +1970,7 @@ for (var J = class {
1933
1970
  try {
1934
1971
  this._cache.deleteEntity(t);
1935
1972
  } catch {}
1936
- this._cache.upsertEntity(W({
1973
+ this._cache.upsertEntity(G({
1937
1974
  ...e,
1938
1975
  folderId: i
1939
1976
  }));
@@ -1948,16 +1985,16 @@ for (var J = class {
1948
1985
  let t = a.isFolder ? "FolderAlreadyExists" : "FileAlreadyExists";
1949
1986
  throw new e(`${a.isFolder ? "Folder" : "File"} '${a.name}' already exists in target folder`, t);
1950
1987
  }
1951
- let o = K(await this._dataProvider.moveItem(a, i));
1988
+ let o = q(await this._dataProvider.moveItem(a, i));
1952
1989
  if (o.id === t) {
1953
1990
  let e = this._cache.moveEntity(t, i);
1954
- return this._cache.upsertEntity(W({
1991
+ return this._cache.upsertEntity(G({
1955
1992
  ...e,
1956
1993
  ...o
1957
1994
  })), !0;
1958
1995
  } else {
1959
1996
  let e = this._cache.deleteEntity(t);
1960
- return this._cache.upsertEntity(W({
1997
+ return this._cache.upsertEntity(G({
1961
1998
  ...e,
1962
1999
  ...o,
1963
2000
  folderId: i
@@ -1982,7 +2019,7 @@ for (var J = class {
1982
2019
  detailed: Array(i.length),
1983
2020
  success: !0
1984
2021
  };
1985
- if (typeof this._dataProvider.moveItems == "function") a = H(await this._dataProvider.moveItems(i, r), (e) => e);
2022
+ if (typeof this._dataProvider.moveItems == "function") a = U(await this._dataProvider.moveItems(i, r), (e) => e);
1986
2023
  else if (typeof this._dataProvider.moveItem == "function") a.detailed = await Promise.all(n.map(async (e, t) => {
1987
2024
  let n = i[t] || {
1988
2025
  id: e,
@@ -1993,7 +2030,7 @@ for (var J = class {
1993
2030
  try {
1994
2031
  return {
1995
2032
  requestId: e,
1996
- data: K(await this._dataProvider.moveItem(n, r)),
2033
+ data: q(await this._dataProvider.moveItem(n, r)),
1997
2034
  success: !0
1998
2035
  };
1999
2036
  } catch (t) {
@@ -2011,14 +2048,14 @@ for (var J = class {
2011
2048
  success: !0,
2012
2049
  data: void 0
2013
2050
  }));
2014
- for (let t of e) if (t.success) if (!t.data || t.data.id === t.requestId) this._cache.moveEntity(t.requestId, r), t.data && this._cache.upsertEntity(W({
2051
+ for (let t of e) if (t.success) if (!t.data || t.data.id === t.requestId) this._cache.moveEntity(t.requestId, r), t.data && this._cache.upsertEntity(G({
2015
2052
  ...this._cache.getEntity(t.requestId),
2016
2053
  ...t.data,
2017
2054
  folderId: r
2018
2055
  }));
2019
2056
  else {
2020
2057
  let e = this._cache.deleteEntity(t.requestId);
2021
- this._cache.upsertEntity(W({
2058
+ this._cache.upsertEntity(G({
2022
2059
  ...e,
2023
2060
  ...t.data,
2024
2061
  folderId: r
@@ -2036,11 +2073,11 @@ for (var J = class {
2036
2073
  this._validateTargetFolderType(n);
2037
2074
  let i = this._cache.getEntity(t);
2038
2075
  if (!i) {
2039
- let e = K(await this._dataProvider.copyItem({
2076
+ let e = q(await this._dataProvider.copyItem({
2040
2077
  id: t,
2041
2078
  folderId: r
2042
2079
  }, r));
2043
- return this._cache.copyEntity(t, r, e.id), this._cache.upsertEntity(W({
2080
+ return this._cache.copyEntity(t, r, e.id), this._cache.upsertEntity(G({
2044
2081
  ...e,
2045
2082
  folderId: r
2046
2083
  })), !0;
@@ -2052,11 +2089,11 @@ for (var J = class {
2052
2089
  throw new e(`${i.isFolder ? "Folder" : "File"} '${i.name}' already exists in target folder`, t);
2053
2090
  }
2054
2091
  }
2055
- let a = K(await this._dataProvider.copyItem(i, r));
2092
+ let a = q(await this._dataProvider.copyItem(i, r));
2056
2093
  return this._cache.copyEntity(t, r, a.id, {
2057
2094
  ...a,
2058
2095
  folderId: r
2059
- }) || this._cache.upsertEntity(W({
2096
+ }) || this._cache.upsertEntity(G({
2060
2097
  ...a,
2061
2098
  folderId: r
2062
2099
  })), !0;
@@ -2085,7 +2122,7 @@ for (var J = class {
2085
2122
  detailed: Array(o.length),
2086
2123
  success: !0
2087
2124
  };
2088
- if (typeof this._dataProvider.copyItems == "function") s = H(await this._dataProvider.copyItems(o, r), (e) => e);
2125
+ if (typeof this._dataProvider.copyItems == "function") s = U(await this._dataProvider.copyItems(o, r), (e) => e);
2089
2126
  else if (typeof this._dataProvider.copyItem == "function") s.detailed = await Promise.all(a.map(async (e, t) => {
2090
2127
  let n = o[t] || {
2091
2128
  id: e,
@@ -2095,7 +2132,7 @@ for (var J = class {
2095
2132
  try {
2096
2133
  return {
2097
2134
  requestId: e,
2098
- data: K(await this._dataProvider.copyItem(n, r)),
2135
+ data: q(await this._dataProvider.copyItem(n, r)),
2099
2136
  success: !0
2100
2137
  };
2101
2138
  } catch (t) {
@@ -2114,7 +2151,7 @@ for (var J = class {
2114
2151
  !this._cache.copyEntity(t.requestId, e, t.data.id, {
2115
2152
  ...t.data,
2116
2153
  folderId: e
2117
- }) && t.data && this._cache.upsertEntity(W({
2154
+ }) && t.data && this._cache.upsertEntity(G({
2118
2155
  ...t.data,
2119
2156
  folderId: e
2120
2157
  }));
@@ -2133,7 +2170,7 @@ for (var J = class {
2133
2170
  }
2134
2171
  let t = this.normalizeId(e.folderId ?? this._rootId);
2135
2172
  try {
2136
- let n = W({
2173
+ let n = G({
2137
2174
  ...await this._dataProvider.uploadFileByUrl(e.url, t, { eventSource: e.eventSource }),
2138
2175
  folderId: t
2139
2176
  });
@@ -2150,42 +2187,42 @@ for (var J = class {
2150
2187
  let t = this.normalizeId(i.folderId);
2151
2188
  if (this._checkNameExistsInCache(t, n.name, !1, r)) throw new e("File '%s' already exists in parent folder".replace("%s", n.name), "FileAlreadyExists");
2152
2189
  }
2153
- let a = K(await this._dataProvider.updateFile(i, { ...n }));
2154
- return this._cache.upsertEntity(W({
2190
+ let a = q(await this._dataProvider.updateFile(i, { ...n }));
2191
+ return this._cache.upsertEntity(G({
2155
2192
  ...this._cache.getEntity(r),
2156
2193
  ...a,
2157
2194
  ...n
2158
2195
  })), this._cache.getEntity(r);
2159
2196
  }
2160
2197
  }, Y = [], X = 0; X < 256; ++X) Y.push((X + 256).toString(16).slice(1));
2161
- function ee(e, t = 0) {
2198
+ function ie(e, t = 0) {
2162
2199
  return (Y[e[t + 0]] + Y[e[t + 1]] + Y[e[t + 2]] + Y[e[t + 3]] + "-" + Y[e[t + 4]] + Y[e[t + 5]] + "-" + Y[e[t + 6]] + Y[e[t + 7]] + "-" + Y[e[t + 8]] + Y[e[t + 9]] + "-" + Y[e[t + 10]] + Y[e[t + 11]] + Y[e[t + 12]] + Y[e[t + 13]] + Y[e[t + 14]] + Y[e[t + 15]]).toLowerCase();
2163
2200
  }
2164
2201
  //#endregion
2165
2202
  //#region packages/file-manager/node_modules/uuid/dist/esm-browser/rng.js
2166
- var Z, te = /* @__PURE__ */ new Uint8Array(16);
2167
- function ne() {
2203
+ var Z, ae = /* @__PURE__ */ new Uint8Array(16);
2204
+ function oe() {
2168
2205
  if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z)) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
2169
- return Z(te);
2206
+ return Z(ae);
2170
2207
  }
2171
2208
  var Q = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
2172
2209
  //#endregion
2173
2210
  //#region packages/file-manager/node_modules/uuid/dist/esm-browser/v4.js
2174
- function re(e, t, n) {
2211
+ function se(e, t, n) {
2175
2212
  if (Q.randomUUID && !t && !e) return Q.randomUUID();
2176
2213
  e ||= {};
2177
- var r = e.random || (e.rng || ne)();
2214
+ var r = e.random || (e.rng || oe)();
2178
2215
  if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
2179
2216
  n ||= 0;
2180
2217
  for (var i = 0; i < 16; ++i) t[n + i] = r[i];
2181
2218
  return t;
2182
2219
  }
2183
- return ee(r);
2220
+ return ie(r);
2184
2221
  }
2185
2222
  //#endregion
2186
2223
  //#region packages/file-manager/src/adapters/PathAwareStorageAdapter.ts
2187
- var ie = "", ae = "Trash", oe = class {
2188
- constructor(e, t = ie, n = _, r = ae, i = !0) {
2224
+ var ce = "", le = "Trash", ue = class {
2225
+ constructor(e, t = ce, n = _, r = le, i = !0) {
2189
2226
  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({
2190
2227
  ...t,
2191
2228
  id: this.pathForId(t.id, !1),
@@ -2246,7 +2283,7 @@ var ie = "", ae = "Trash", oe = class {
2246
2283
  let t = v(e);
2247
2284
  if (t === v(this.trashPath)) return this.trashId;
2248
2285
  if (this._pathToId.has(t)) return this._pathToId.get(t);
2249
- let n = re();
2286
+ let n = se();
2250
2287
  return this._pathToId.set(t, n), this._idToPath.set(n, t), n;
2251
2288
  }
2252
2289
  pathForId(t, n, r) {
@@ -2645,15 +2682,15 @@ var ie = "", ae = "Trash", oe = class {
2645
2682
  };
2646
2683
  //#endregion
2647
2684
  //#region packages/file-manager/src/utils/directResourceFetchError.ts
2648
- function se(e) {
2685
+ function de(e) {
2649
2686
  return typeof e != "object" || !e ? !1 : "name" in e && e.name === "DirectResourceFetchError" ? !("final" in e) || e.final !== !1 : "final" in e && e.final === !0;
2650
2687
  }
2651
2688
  //#endregion
2652
2689
  //#region packages/file-manager/src/utils/remoteFileFetchPipeline.ts
2653
2690
  function $(t) {
2654
- if (se(t) || t instanceof e) throw t;
2691
+ if (de(t) || t instanceof e) throw t;
2655
2692
  }
2656
- async function ce(e, t, n, r, i) {
2693
+ async function fe(e, t, n, r, i) {
2657
2694
  let { fetchWithProxy: a, handleFileProxy: o, handleProxyUrl: s } = t, c = {
2658
2695
  mode: "cors",
2659
2696
  ...i?.fetchInit
@@ -2685,6 +2722,6 @@ async function ce(e, t, n, r, i) {
2685
2722
  throw l instanceof Error ? l : /* @__PURE__ */ Error("Failed to download file from the URL");
2686
2723
  }
2687
2724
  //#endregion
2688
- export { S as DEFAULT_FILE_MANAGER_CACHE_TTL_MS, J as DataSourceProxyBase, o as FailedRequestCache, e as FileManagerApiError, s as MutationRegistry, oe as PathAwareStorageAdapter, _ as TRASH_FOLDER_ID, P as TreeCache, N as ViewCacheManager, i as buildAssetsPath, l as compareFileSystemItems, b as createSystemFolderByPathResolver, m as defaultChildrenViewFilterMatch, p as defaultFileSystemItemComparator, h as defaultHasSortValue, k as defaultIsFolderNotFoundError, ce as fetchRemoteImageBlobByUrl, r as getAssetsBase, y as getTrashFolderLookupCandidates, d as hasComparableSortValue, n as joinUrls, t as mapHttpStatusToErrorCode, f as matchesChildrenViewFilter, v as normalizeSystemFolderPath, c as resolveSortParams, g as resolveViewStrategyOptions };
2725
+ export { E as DEFAULT_FILE_MANAGER_CACHE_TTL_MS, re as DataSourceProxyBase, o as FailedRequestCache, e as FileManagerApiError, s as MutationRegistry, ue as PathAwareStorageAdapter, _ as TRASH_FOLDER_ID, R as TreeCache, L as ViewCacheManager, i as buildAssetsPath, l as compareFileSystemItems, b as createSystemFolderByPathResolver, m as defaultChildrenViewFilterMatch, p as defaultFileSystemItemComparator, h as defaultHasSortValue, N as defaultIsFolderNotFoundError, fe as fetchRemoteImageBlobByUrl, r as getAssetsBase, y as getTrashFolderLookupCandidates, d as hasComparableSortValue, n as joinUrls, t as mapHttpStatusToErrorCode, f as matchesChildrenViewFilter, v as normalizeSystemFolderPath, c as resolveSortParams, g as resolveViewStrategyOptions };
2689
2726
 
2690
2727
  //# sourceMappingURL=core.esm.js.map