ode-explorer 1.3.2-dev.202401091605 → 1.3.2-dev.202401101530

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.
Files changed (80) hide show
  1. package/dist/index.js +3 -3
  2. package/dist/version.txt +1 -1
  3. package/explorer.d.ts +1 -0
  4. package/lib/ActionBarContainer.js +281 -0
  5. package/lib/AppAction.js +34 -0
  6. package/lib/DeleteModal.js +52 -0
  7. package/lib/DisableModal.js +20 -0
  8. package/lib/EmptyScreenApp.js +37 -0
  9. package/lib/EmptyScreenError.js +12 -0
  10. package/lib/EmptyScreenNoContentInFolder.js +18 -0
  11. package/lib/EmptyScreenSearch.js +18 -0
  12. package/lib/EmptyScreenTrash.js +16 -0
  13. package/lib/FolderModal.js +119 -0
  14. package/lib/FoldersList.js +64 -0
  15. package/lib/Library.js +16 -0
  16. package/lib/MoveModal.js +78 -0
  17. package/lib/ResourcesList.js +249 -0
  18. package/lib/TrashModal.js +20 -0
  19. package/lib/app/root/index.d.ts +2 -0
  20. package/lib/components/AppAction/AppAction.d.ts +1 -0
  21. package/lib/components/EmptyScreens/EmptyScreenApp.d.ts +2 -0
  22. package/lib/components/EmptyScreens/EmptyScreenError.d.ts +2 -0
  23. package/lib/components/EmptyScreens/EmptyScreenNoContentInFolder.d.ts +2 -0
  24. package/lib/components/EmptyScreens/EmptyScreenSearch.d.ts +2 -0
  25. package/lib/components/EmptyScreens/EmptyScreenTrash.d.ts +1 -0
  26. package/lib/components/Explorer.d.ts +5 -0
  27. package/lib/components/ExplorerBreadcrumb.d.ts +1 -0
  28. package/lib/components/LoadMore.d.ts +3 -0
  29. package/lib/config/getExplorerConfig.d.ts +11 -0
  30. package/lib/config/index.d.ts +3 -0
  31. package/lib/features/AccessControl/AccessControl.d.ts +12 -0
  32. package/lib/features/AccessControl/useAccessControl.d.ts +14 -0
  33. package/lib/features/ActionBar/ActionBarContainer.d.ts +1 -0
  34. package/lib/features/ActionBar/Delete/DeleteModal.d.ts +8 -0
  35. package/lib/features/ActionBar/Delete/useDeleteModal.d.ts +8 -0
  36. package/lib/features/ActionBar/Disable/DisableModal.d.ts +5 -0
  37. package/lib/features/ActionBar/Disable/useDisableModal.d.ts +4 -0
  38. package/lib/features/ActionBar/Folder/FolderModal.d.ts +9 -0
  39. package/lib/features/ActionBar/Folder/useFolderModal.d.ts +22 -0
  40. package/lib/features/ActionBar/Move/MoveModal.d.ts +8 -0
  41. package/lib/features/ActionBar/Move/useMoveModal.d.ts +12 -0
  42. package/lib/features/ActionBar/Trash/TrashModal.d.ts +5 -0
  43. package/lib/features/ActionBar/Trash/useTrashModal.d.ts +4 -0
  44. package/lib/features/ActionBar/useActionBar.d.ts +30 -0
  45. package/lib/features/List/FolderCard.d.ts +17 -0
  46. package/lib/features/List/FoldersList.d.ts +7 -0
  47. package/lib/features/List/List.d.ts +1 -0
  48. package/lib/features/List/ResourceCard.d.ts +22 -0
  49. package/lib/features/List/ResourcesList.d.ts +8 -0
  50. package/lib/features/SearchForm/SearchForm.d.ts +1 -0
  51. package/lib/features/SearchForm/useSearchForm.d.ts +8 -0
  52. package/lib/features/SearchForm/useSelectedFilters.d.ts +8 -0
  53. package/lib/features/SideBar/Library/Library.d.ts +2 -0
  54. package/lib/features/SideBar/TrashButton.d.ts +7 -0
  55. package/lib/features/SideBar/TreeViewContainer.d.ts +1 -0
  56. package/lib/i18n.d.ts +2 -0
  57. package/lib/index.d.ts +1 -0
  58. package/lib/index.js +13 -0
  59. package/lib/index2.js +1376 -0
  60. package/lib/main.d.ts +0 -0
  61. package/lib/services/api/index.d.ts +129 -0
  62. package/lib/store/index.d.ts +98 -0
  63. package/lib/style.css +1 -0
  64. package/lib/utils/TreeNodeFolderWrapper.d.ts +12 -0
  65. package/lib/utils/addNode.d.ts +6 -0
  66. package/lib/utils/arrayUnique.d.ts +1 -0
  67. package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
  68. package/lib/utils/deleteNode.d.ts +4 -0
  69. package/lib/utils/findNodeById.d.ts +2 -0
  70. package/lib/utils/fullTextSearch.d.ts +1 -0
  71. package/lib/utils/getAncestors.d.ts +2 -0
  72. package/lib/utils/getAppParams.d.ts +10 -0
  73. package/lib/utils/hasChildren.d.ts +2 -0
  74. package/lib/utils/isResourceShared.d.ts +2 -0
  75. package/lib/utils/modifyNode.d.ts +2 -0
  76. package/lib/utils/moveNode.d.ts +5 -0
  77. package/lib/utils/scrollToTop.d.ts +1 -0
  78. package/lib/utils/updateNode.d.ts +6 -0
  79. package/lib/utils/wrapTreeNode.d.ts +3 -0
  80. package/package.json +33 -4
package/lib/index2.js ADDED
@@ -0,0 +1,1376 @@
1
+ var fe = Object.defineProperty;
2
+ var pe = (e, s, t) => s in e ? fe(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var $ = (e, s, t) => (pe(e, typeof s != "symbol" ? s + "" : s, t), t);
4
+ import { jsx as l, jsxs as C, Fragment as ae } from "react/jsx-runtime";
5
+ import { useState as ce, useRef as me, useEffect as U, lazy as b, Suspense as v, Fragment as ye } from "react";
6
+ import { useScrollToTop as ge, useOdeClient as M, IconButton as Ie, useToast as q, useUser as Se, LoadingScreen as A, FormControl as we, Input as xe, SearchButton as De, Dropdown as j, useToggle as be, TreeView as Te, Button as Fe, useXitiTrackPageLoad as Ce, isActionAvailable as oe, AppHeader as Ne, Breadcrumb as Re, Grid as ee } from "@edifice-ui/react";
7
+ import { ArrowLeft as Pe, Filter as Ae, Delete as Ee, Plus as Qe } from "@edifice-ui/icons";
8
+ import { useTranslation as z } from "react-i18next";
9
+ import { odeServices as N, FOLDER as F, APP as se } from "edifice-ts-client";
10
+ import { t as D } from "i18next";
11
+ import { create as ve } from "zustand";
12
+ import { useQuery as qe, useInfiniteQuery as Oe, useQueryClient as O, useMutation as L } from "@tanstack/react-query";
13
+ const le = async (e) => {
14
+ const s = await N.resource(e.app).searchContext(e);
15
+ return {
16
+ ...s,
17
+ folders: s.folders.filter((t) => !t.trashed)
18
+ };
19
+ }, Le = async ({
20
+ searchParams: e,
21
+ name: s,
22
+ parentId: t
23
+ }) => {
24
+ const r = {
25
+ name: s,
26
+ parentId: t,
27
+ app: e.app,
28
+ type: e.types[0]
29
+ };
30
+ return await N.resource(e.app).createFolder(r);
31
+ }, ke = async ({
32
+ folderId: e,
33
+ searchParams: s,
34
+ parentId: t,
35
+ name: r
36
+ }) => {
37
+ const n = {
38
+ folderId: e,
39
+ name: r,
40
+ parentId: t,
41
+ app: s.app,
42
+ type: s.types[0]
43
+ };
44
+ return await N.resource(s.app).updateFolder(n);
45
+ }, Ue = async ({
46
+ searchParams: e,
47
+ resourceIds: s,
48
+ useAssetIds: t,
49
+ folderIds: r
50
+ }) => {
51
+ const n = {
52
+ application: e.app,
53
+ resourceType: e.types[0],
54
+ resourceIds: s,
55
+ folderIds: r
56
+ };
57
+ return await N.resource(e.app).trashAll(n, t);
58
+ }, Me = async ({
59
+ searchParams: e,
60
+ resourceIds: s,
61
+ useAssetIds: t,
62
+ folderIds: r
63
+ }) => {
64
+ const n = {
65
+ application: e.app,
66
+ resourceType: e.types[0],
67
+ resourceIds: s,
68
+ folderIds: r
69
+ };
70
+ return await N.resource(e.app).deleteAll(n, t);
71
+ }, Be = async ({
72
+ searchParams: e,
73
+ resourceIds: s,
74
+ folderIds: t,
75
+ useAssetIds: r
76
+ }) => {
77
+ const n = {
78
+ application: e.app,
79
+ resourceType: e.types[0],
80
+ resourceIds: s,
81
+ folderIds: t
82
+ };
83
+ return await N.resource(e.app).restoreAll(n, r);
84
+ }, Ke = async ({
85
+ searchParams: e,
86
+ resourceIds: s,
87
+ folderId: t,
88
+ folderIds: r,
89
+ useAssetIds: n
90
+ }) => {
91
+ const i = {
92
+ application: e.app,
93
+ folderId: t,
94
+ resourceIds: s,
95
+ folderIds: r
96
+ };
97
+ return await N.resource(e.app).moveToFolder(i, n);
98
+ }, $e = async ({
99
+ app: e,
100
+ resourceId: s,
101
+ rights: t
102
+ }) => await N.share().saveRights(e, s, t), je = async ({
103
+ app: e,
104
+ params: s
105
+ }) => await N.resource(e).update(s), ze = async (e) => await N.rights().sessionHasWorkflowRights(e), Ve = ({
106
+ searchParams: e,
107
+ assetId: s
108
+ }) => N.resource(e.app).gotoView(s), _e = ({
109
+ searchParams: e,
110
+ params: s
111
+ }) => N.resource(e.app).create(s), He = ({
112
+ searchParams: e,
113
+ assetId: s
114
+ }) => N.resource(e.app).gotoPrint(s);
115
+ function te(e) {
116
+ return e.filter((s, t) => e.indexOf(s) === t);
117
+ }
118
+ function _(e, s) {
119
+ var r, n;
120
+ let t;
121
+ return (s == null ? void 0 : s.id) === e ? s : ((r = s == null ? void 0 : s.children) != null && r.length && ((n = s == null ? void 0 : s.children) == null || n.every((i) => (t = _(e, i), t === void 0))), t);
122
+ }
123
+ function We(e, s) {
124
+ var r;
125
+ const t = _(e, s);
126
+ return (r = t == null ? void 0 : t.folder) != null && r.ancestors ? [...(t == null ? void 0 : t.folder.ancestors) || [], e] : e === F.BIN ? [F.BIN] : [F.DEFAULT];
127
+ }
128
+ function ie(e, s) {
129
+ return s.id === e && s.children ? s.children.length > 0 : s.children ? s.children.some((t) => ie(s.id, t)) : !1;
130
+ }
131
+ function H(e, s) {
132
+ return de(e, s) || e;
133
+ }
134
+ function de(e, s, t) {
135
+ var n;
136
+ const r = s(e, t);
137
+ if ((n = r == null ? void 0 : r.children) != null && n.length) {
138
+ const i = [];
139
+ for (const o of (r == null ? void 0 : r.children) || []) {
140
+ const d = de(o, s, r);
141
+ d && i.push(d);
142
+ }
143
+ return {
144
+ ...r,
145
+ children: i
146
+ };
147
+ }
148
+ return r;
149
+ }
150
+ class X {
151
+ constructor(s) {
152
+ $(this, "id");
153
+ $(this, "name");
154
+ $(this, "childNumber");
155
+ $(this, "section", !1);
156
+ $(this, "children", []);
157
+ this.folder = s, this.id = s.id, this.name = s.name, this.childNumber = s.childNumber;
158
+ }
159
+ }
160
+ const ue = (e, s, t) => H(e, (r) => (r.id === t && (r.children = s == null ? void 0 : s.map((n) => new X(n))), r)), S = ve()((e, s) => ({
161
+ config: null,
162
+ searchConfig: {
163
+ minLength: 1
164
+ },
165
+ searchParams: {
166
+ app: "",
167
+ types: [],
168
+ filters: {
169
+ folder: "default",
170
+ owner: void 0,
171
+ shared: void 0,
172
+ public: void 0
173
+ },
174
+ orders: {
175
+ updatedAt: "desc"
176
+ },
177
+ pagination: {
178
+ startIdx: 0,
179
+ pageSize: 48,
180
+ maxIdx: 0
181
+ },
182
+ trashed: !1
183
+ },
184
+ treeData: {
185
+ id: F.DEFAULT,
186
+ name: D("explorer.filters.mine"),
187
+ section: !0,
188
+ children: []
189
+ },
190
+ selectedNodesIds: ["default"],
191
+ currentFolder: {
192
+ id: "default"
193
+ },
194
+ selectedFolders: [],
195
+ selectedResources: [],
196
+ folderIds: [],
197
+ resourceIds: [],
198
+ resourceIsTrash: !1,
199
+ resourceActionDisable: !1,
200
+ status: void 0,
201
+ updaters: {
202
+ setConfig: (t) => e({
203
+ config: t
204
+ }),
205
+ setSearchConfig: (t) => e((r) => ({
206
+ searchConfig: {
207
+ ...r.searchConfig,
208
+ ...t
209
+ }
210
+ })),
211
+ setTreeData: (t) => e(() => ({
212
+ treeData: t
213
+ })),
214
+ setSearchParams: (t) => {
215
+ e((r) => {
216
+ const {
217
+ searchParams: n
218
+ } = r;
219
+ return n.search !== t.search ? t.search ? {
220
+ ...r,
221
+ selectedFolders: [],
222
+ selectedNodesIds: [],
223
+ selectedResources: [],
224
+ currentFolder: void 0,
225
+ searchParams: {
226
+ ...n,
227
+ ...t,
228
+ trashed: !1,
229
+ filters: {
230
+ ...n.filters,
231
+ folder: void 0
232
+ }
233
+ }
234
+ } : {
235
+ ...r,
236
+ selectedFolders: [],
237
+ selectedNodesIds: ["default"],
238
+ selectedResources: [],
239
+ currentFolder: {
240
+ id: "default"
241
+ },
242
+ searchParams: {
243
+ ...n,
244
+ ...t,
245
+ trashed: !1,
246
+ filters: {
247
+ ...n.filters
248
+ }
249
+ }
250
+ } : {
251
+ searchParams: {
252
+ ...n,
253
+ ...t
254
+ }
255
+ };
256
+ });
257
+ },
258
+ setSelectedFolders: (t) => e(() => ({
259
+ selectedFolders: t
260
+ })),
261
+ setSelectedResources: (t) => e(() => ({
262
+ selectedResources: t
263
+ })),
264
+ setFolderIds: (t) => e(() => ({
265
+ folderIds: t
266
+ })),
267
+ setResourceIds: (t) => e(() => ({
268
+ resourceIds: t
269
+ })),
270
+ setResourceIsTrash: (t) => e(() => ({
271
+ resourceIsTrash: t
272
+ })),
273
+ setResourceActionDisable: (t) => e(() => ({
274
+ resourceActionDisable: t
275
+ })),
276
+ setCurrentFolder: (t) => e(() => ({
277
+ currentFolder: t
278
+ })),
279
+ clearSelectedItems: () => e(() => ({
280
+ selectedFolders: [],
281
+ selectedResources: []
282
+ })),
283
+ clearSelectedIds: () => e(() => ({
284
+ resourceIds: [],
285
+ folderIds: []
286
+ })),
287
+ openResource: (t) => {
288
+ try {
289
+ const {
290
+ searchParams: r
291
+ } = s();
292
+ Ve({
293
+ searchParams: r,
294
+ assetId: t.assetId
295
+ });
296
+ } catch (r) {
297
+ console.error("explorer open failed: ", r);
298
+ }
299
+ },
300
+ printSelectedResource: () => {
301
+ try {
302
+ const {
303
+ searchParams: t,
304
+ selectedResources: r,
305
+ resourceIds: n
306
+ } = s();
307
+ if (r.length !== 1)
308
+ throw new Error("Cannot open more than 1 resource");
309
+ const i = r.find((o) => o.id === n[0]);
310
+ He({
311
+ searchParams: t,
312
+ assetId: i.assetId
313
+ });
314
+ } catch (t) {
315
+ console.error("explorer print failed: ", t);
316
+ }
317
+ },
318
+ openFolder: ({
319
+ folderId: t,
320
+ folder: r
321
+ }) => {
322
+ const {
323
+ searchParams: n,
324
+ treeData: i
325
+ } = s(), o = n.filters.folder, d = We(t, i), u = te([...d, t]);
326
+ o !== t && e((h) => ({
327
+ ...h,
328
+ // reset selection when changing folder
329
+ folderIds: [],
330
+ resourceIds: [],
331
+ selectedNodesIds: u,
332
+ currentFolder: r || {
333
+ id: t
334
+ },
335
+ searchParams: {
336
+ ...n,
337
+ search: void 0,
338
+ filters: {
339
+ ...n.filters,
340
+ folder: t
341
+ },
342
+ trashed: t === F.BIN
343
+ }
344
+ }));
345
+ },
346
+ foldTreeItem: () => e((t) => ({
347
+ ...t,
348
+ status: "fold"
349
+ })),
350
+ unfoldTreeItem: async (t, r) => {
351
+ const {
352
+ treeData: n,
353
+ searchParams: i
354
+ } = s();
355
+ if (e((o) => ({
356
+ ...o,
357
+ status: "unfold"
358
+ })), !ie(t, n)) {
359
+ await r.prefetchInfiniteQuery({
360
+ queryKey: ["prefetchContext", {
361
+ folderId: t,
362
+ trashed: !1
363
+ }],
364
+ queryFn: async () => await le({
365
+ ...i,
366
+ filters: {
367
+ ...i.filters,
368
+ folder: t
369
+ }
370
+ })
371
+ });
372
+ const o = r.getQueryData(["prefetchContext", {
373
+ folderId: t,
374
+ trashed: !1
375
+ }]);
376
+ e((d) => {
377
+ var u;
378
+ return {
379
+ ...d,
380
+ treeData: ue(n, (u = o == null ? void 0 : o.pages[0]) == null ? void 0 : u.folders, t || F.DEFAULT)
381
+ };
382
+ });
383
+ }
384
+ },
385
+ selectTreeItem: (t) => {
386
+ const {
387
+ treeData: r
388
+ } = s(), {
389
+ openFolder: n
390
+ } = s().updaters, i = _(t, r);
391
+ ge()(), e((d) => ({
392
+ ...d,
393
+ searchParams: {
394
+ ...d.searchParams,
395
+ search: void 0
396
+ },
397
+ status: "select",
398
+ selectedResources: []
399
+ })), n({
400
+ folder: i,
401
+ folderId: t
402
+ });
403
+ },
404
+ gotoPreviousFolder: () => {
405
+ const {
406
+ selectedNodesIds: t,
407
+ treeData: r
408
+ } = s(), {
409
+ openFolder: n
410
+ } = s().updaters, i = t.length;
411
+ if (i < 2)
412
+ return;
413
+ const o = _(t[i - 2], r);
414
+ n({
415
+ folder: o,
416
+ folderId: (o == null ? void 0 : o.id) || F.DEFAULT
417
+ });
418
+ },
419
+ goToTrash: () => e((t) => ({
420
+ ...t,
421
+ selectedNodesIds: [],
422
+ selectedResources: [],
423
+ resourceIds: [],
424
+ folderIds: [],
425
+ status: "select",
426
+ searchParams: {
427
+ ...t.searchParams,
428
+ search: void 0,
429
+ filters: {
430
+ folder: F.BIN
431
+ },
432
+ trashed: !0
433
+ },
434
+ currentFolder: {
435
+ id: F.BIN
436
+ }
437
+ }))
438
+ }
439
+ })), T = () => S((e) => e.searchParams), re = () => S((e) => e.selectedNodesIds), V = () => S((e) => e.treeData), Ms = () => S((e) => e.selectedFolders), Bs = () => S((e) => e.selectedResources), Xe = () => S((e) => e.searchConfig), G = () => S((e) => e.folderIds), Z = () => S((e) => e.resourceIds), J = () => S((e) => e.selectedResources.map((s) => s.assetId)), Y = () => S((e) => e.selectedResources.filter((s) => s.assetId === s.id)), W = () => S((e) => e.currentFolder), x = () => S((e) => e.updaters), ne = () => {
440
+ const e = W();
441
+ return (e == null ? void 0 : e.id) === F.BIN;
442
+ }, Ge = () => S((e) => e.resourceIsTrash), Ze = () => S((e) => e.resourceActionDisable), Je = () => {
443
+ const e = W();
444
+ return (e == null ? void 0 : e.id) === "default";
445
+ }, Ye = () => re().length > 1, es = () => S((e) => e.status), he = () => {
446
+ const e = T(), [s, t] = ce(""), r = Xe(), n = es(), i = me(null), {
447
+ setSearchParams: o
448
+ } = x(), d = (c) => {
449
+ const f = c.target.value;
450
+ t(f.toString());
451
+ }, u = (c) => {
452
+ (c.key === "Enter" || c.key === "Return") && (c.preventDefault(), o({
453
+ search: s || void 0
454
+ }));
455
+ }, h = (c) => {
456
+ c.preventDefault(), o({
457
+ search: s || void 0
458
+ });
459
+ };
460
+ return U(() => {
461
+ const f = s.length == 0 || s.length >= r.minLength ? {
462
+ search: s || void 0
463
+ } : {};
464
+ o({
465
+ ...e,
466
+ ...f
467
+ });
468
+ }, [s, r.minLength]), U(() => {
469
+ n === "select" && t("");
470
+ }, [n]), U(() => {
471
+ t(() => {
472
+ var c;
473
+ return ((c = e.search) == null ? void 0 : c.toString()) ?? "";
474
+ });
475
+ }, [e]), {
476
+ formRef: i,
477
+ inputSearch: s,
478
+ handleInputSearchChange: d,
479
+ handleKeyPress: u,
480
+ handleSearchSubmit: h
481
+ };
482
+ };
483
+ function ss() {
484
+ const {
485
+ appCode: e
486
+ } = M(), {
487
+ gotoPreviousFolder: s
488
+ } = x(), {
489
+ t
490
+ } = z(), {
491
+ inputSearch: r
492
+ } = he(), n = re(), i = ne(), o = W(), d = t("explorer.tree.trash"), u = t("explorer.tree.search"), h = t("explorer.filters.mine", {
493
+ ns: e
494
+ }), c = (o == null ? void 0 : o.name) || h;
495
+ return /* @__PURE__ */ l("div", { className: "py-16", children: n.length > 1 && !i ? /* @__PURE__ */ C("div", { className: "d-flex align-items-center gap-8", children: [
496
+ /* @__PURE__ */ l(Ie, { icon: /* @__PURE__ */ l(Pe, {}), variant: "ghost", color: "tertiary", "aria-label": t("back"), className: "ms-n16", onClick: s }),
497
+ /* @__PURE__ */ l("p", { className: "body py-8 text-truncate", children: /* @__PURE__ */ l("strong", { children: c }) })
498
+ ] }) : /* @__PURE__ */ l("h2", { className: "body py-8 fw-bold", children: r.length !== 0 ? u : i ? d : h }) });
499
+ }
500
+ const ts = () => {
501
+ const e = Ze(), {
502
+ clearSelectedIds: s,
503
+ setResourceActionDisable: t,
504
+ clearSelectedItems: r
505
+ } = x();
506
+ return {
507
+ isActionDisableModalOpen: e,
508
+ onActionDisableCancel: () => {
509
+ s(), r(), t(!1);
510
+ }
511
+ };
512
+ }, rs = () => {
513
+ const e = Ge(), {
514
+ clearSelectedIds: s,
515
+ setResourceIsTrash: t,
516
+ clearSelectedItems: r
517
+ } = x();
518
+ return {
519
+ isTrashedModalOpen: e,
520
+ onTrashedCancel: () => {
521
+ s(), r(), t(!1);
522
+ }
523
+ };
524
+ };
525
+ function ns(e, {
526
+ parentId: s,
527
+ newFolder: t
528
+ }) {
529
+ return H(e, (r) => {
530
+ var n;
531
+ if (r.id === s) {
532
+ const i = [...((n = r.folder) == null ? void 0 : n.ancestors) || []], o = te([...i, r.id]);
533
+ return {
534
+ ...r,
535
+ children: [...r.children || [], new X({
536
+ ...t,
537
+ ancestors: o
538
+ })]
539
+ };
540
+ } else
541
+ return r;
542
+ });
543
+ }
544
+ function os(e, {
545
+ folders: s
546
+ }) {
547
+ return H(e, (t) => {
548
+ if (!s.includes(t.id))
549
+ return t;
550
+ });
551
+ }
552
+ function as(e, {
553
+ destinationId: s,
554
+ folders: t
555
+ }) {
556
+ return H(e, (r, n) => {
557
+ var i, o;
558
+ if (s === r.id) {
559
+ const d = [...((i = r.folder) == null ? void 0 : i.ancestors) || []], u = te([...d, r.id]), h = [...r.children || []], c = ((o = r.children) == null ? void 0 : o.map((a) => a.id)) || [];
560
+ for (const a of t)
561
+ if (!c.includes(a)) {
562
+ const m = _(a, e);
563
+ m && h.push({
564
+ ...m,
565
+ folder: {
566
+ ...m == null ? void 0 : m.folder,
567
+ ancestors: u
568
+ }
569
+ });
570
+ }
571
+ return {
572
+ ...r,
573
+ children: h
574
+ };
575
+ } else
576
+ return t.includes(r.id) && s !== (n == null ? void 0 : n.id) ? void 0 : r;
577
+ });
578
+ }
579
+ function cs(e, {
580
+ folderId: s,
581
+ newFolder: t
582
+ }) {
583
+ return H(e, (r) => r.id === s ? new X(t) : r);
584
+ }
585
+ const ls = () => {
586
+ const e = S((s) => s.config);
587
+ return qe({
588
+ queryKey: ["actions"],
589
+ queryFn: async () => {
590
+ const s = e == null ? void 0 : e.actions.map((r) => r.workflow);
591
+ return await ze(s);
592
+ },
593
+ select: (s) => e == null ? void 0 : e.actions.map((t) => ({
594
+ ...t,
595
+ available: s[t.workflow]
596
+ })),
597
+ staleTime: 1 / 0,
598
+ enabled: !!e
599
+ });
600
+ }, is = () => {
601
+ const e = S((o) => o.config), s = T(), {
602
+ filters: t,
603
+ trashed: r,
604
+ search: n
605
+ } = s, i = ["context", {
606
+ folderId: t.folder,
607
+ filters: t,
608
+ trashed: r,
609
+ search: n
610
+ }];
611
+ return Oe({
612
+ queryKey: i,
613
+ queryFn: async ({
614
+ pageParam: o
615
+ }) => await le({
616
+ ...s,
617
+ app: e == null ? void 0 : e.app,
618
+ types: e == null ? void 0 : e.types,
619
+ pagination: {
620
+ ...s.pagination,
621
+ startIdx: o
622
+ }
623
+ }),
624
+ initialPageParam: 0,
625
+ enabled: !!e,
626
+ retry: !1,
627
+ getNextPageParam: (o) => o.pagination.startIdx + o.pagination.pageSize
628
+ });
629
+ }, Ks = () => {
630
+ const e = q(), s = O(), t = T(), r = V(), n = G(), i = J(), o = Z(), d = Y().length > 0, u = d ? i : o, {
631
+ clearSelectedItems: h,
632
+ clearSelectedIds: c,
633
+ setTreeData: f,
634
+ setSearchParams: a
635
+ } = x(), {
636
+ filters: m,
637
+ trashed: p
638
+ } = t, g = ["context", {
639
+ folderId: m.folder,
640
+ filters: m,
641
+ trashed: p
642
+ }];
643
+ return L({
644
+ mutationFn: async () => await Ue({
645
+ searchParams: t,
646
+ folderIds: n,
647
+ resourceIds: u,
648
+ useAssetIds: d
649
+ }),
650
+ onError(y) {
651
+ typeof y == "string" && e.error(D(y));
652
+ },
653
+ onSuccess: async (y) => {
654
+ if (await s.cancelQueries({
655
+ queryKey: g
656
+ }), s.getQueryData(g))
657
+ return e.success(D("explorer.trash.title")), s.setQueryData(g, (w) => {
658
+ var E;
659
+ if (w) {
660
+ const k = {
661
+ ...w,
662
+ pages: w == null ? void 0 : w.pages.map((R) => {
663
+ var P;
664
+ return {
665
+ ...R,
666
+ folders: R.folders.filter((Q) => !n.includes(Q.id)),
667
+ pagination: {
668
+ ...R.pagination,
669
+ // @ts-ignore
670
+ maxIdx: ((P = R == null ? void 0 : R.pagination) == null ? void 0 : P.maxIdx) - y.resources.length
671
+ },
672
+ resources: R.resources.filter((Q) => d ? !i.includes(Q.assetId) : !u.includes(Q.id))
673
+ };
674
+ })
675
+ }, B = os(r, {
676
+ folders: n
677
+ });
678
+ return f(B), a({
679
+ ...t,
680
+ pagination: {
681
+ ...t.pagination,
682
+ // @ts-ignore
683
+ maxIdx: ((E = t.pagination) == null ? void 0 : E.maxIdx) - y.resources.length
684
+ }
685
+ }), k;
686
+ }
687
+ });
688
+ },
689
+ onSettled: () => {
690
+ h(), c();
691
+ }
692
+ });
693
+ }, $s = () => {
694
+ const e = q(), s = O(), t = T(), r = G(), n = J(), i = Z(), o = Y().length > 0, d = o ? n : i, {
695
+ setFolderIds: u,
696
+ setResourceIds: h,
697
+ setSelectedResources: c,
698
+ setSelectedFolders: f
699
+ } = x(), {
700
+ filters: a,
701
+ trashed: m
702
+ } = t, p = ["context", {
703
+ folderId: a.folder,
704
+ filters: a,
705
+ trashed: m
706
+ }];
707
+ return L({
708
+ mutationFn: async () => await Be({
709
+ searchParams: t,
710
+ folderIds: r,
711
+ resourceIds: d,
712
+ useAssetIds: o
713
+ }),
714
+ onError(g) {
715
+ typeof g == "string" && e.error(D(g));
716
+ },
717
+ onSuccess: async () => {
718
+ if (await s.cancelQueries({
719
+ queryKey: p
720
+ }), s.getQueryData(p))
721
+ return e.success(D("explorer.trash.toast")), s.setQueryData(p, (y) => {
722
+ if (y)
723
+ return {
724
+ ...y,
725
+ pages: y == null ? void 0 : y.pages.map((I) => ({
726
+ ...I,
727
+ folders: I.folders.filter((w) => !r.includes(w.id)),
728
+ resources: I.resources.filter((w) => o ? !n.includes(w.assetId) : !d.includes(w.id))
729
+ }))
730
+ };
731
+ });
732
+ },
733
+ onSettled: () => {
734
+ h([]), c([]), u([]), f([]);
735
+ }
736
+ });
737
+ }, js = () => {
738
+ const e = q(), s = O(), t = T(), r = G(), n = J(), i = Z(), o = Y().length > 0, d = o ? n : i, {
739
+ clearSelectedItems: u,
740
+ clearSelectedIds: h
741
+ } = x(), {
742
+ filters: c,
743
+ trashed: f
744
+ } = t, a = ["context", {
745
+ folderId: c.folder,
746
+ filters: c,
747
+ trashed: f
748
+ }];
749
+ return L({
750
+ mutationFn: async () => await Me({
751
+ searchParams: t,
752
+ folderIds: r,
753
+ resourceIds: d,
754
+ useAssetIds: o
755
+ }),
756
+ onError(m) {
757
+ typeof m == "string" && e.error(D(m));
758
+ },
759
+ onSuccess: async () => {
760
+ if (await s.cancelQueries({
761
+ queryKey: a
762
+ }), s.getQueryData(a))
763
+ return e.success(D("explorer.removed.from.trash")), s.setQueryData(a, (p) => {
764
+ if (p)
765
+ return {
766
+ ...p,
767
+ pages: p == null ? void 0 : p.pages.map((y) => ({
768
+ ...y,
769
+ folders: y.folders.filter((I) => !r.includes(I.id)),
770
+ resources: y.resources.filter((I) => o ? !n.includes(I.assetId) : !d.includes(I.id))
771
+ }))
772
+ };
773
+ });
774
+ },
775
+ onSettled: () => {
776
+ u(), h();
777
+ }
778
+ });
779
+ }, zs = () => {
780
+ const e = q(), s = O(), t = T(), r = V(), n = G(), i = J(), o = Z(), d = Y().length > 0, u = d ? i : o, {
781
+ clearSelectedIds: h,
782
+ clearSelectedItems: c,
783
+ setTreeData: f,
784
+ setSearchParams: a
785
+ } = x(), {
786
+ filters: m,
787
+ trashed: p
788
+ } = t, g = ["context", {
789
+ folderId: m.folder,
790
+ filters: m,
791
+ trashed: p
792
+ }];
793
+ return L({
794
+ mutationFn: async (y) => await Ke({
795
+ searchParams: t,
796
+ folderId: y,
797
+ folderIds: n,
798
+ resourceIds: u,
799
+ useAssetIds: d
800
+ }),
801
+ onError(y) {
802
+ typeof y == "string" && e.error(D(y));
803
+ },
804
+ onSuccess: async (y, I) => {
805
+ if (s.getQueryData(g))
806
+ return s.setQueryData(g, (E) => {
807
+ var k;
808
+ if (E) {
809
+ const B = as(r, {
810
+ destinationId: I,
811
+ folders: n
812
+ }), R = {
813
+ ...E,
814
+ pages: E == null ? void 0 : E.pages.map((P) => {
815
+ var Q;
816
+ return {
817
+ ...P,
818
+ folders: P.folders.filter((K) => !n.includes(K.id)),
819
+ pagination: {
820
+ ...P.pagination,
821
+ // @ts-ignore
822
+ maxIdx: ((Q = P.pagination) == null ? void 0 : Q.maxIdx) - y.resources.length
823
+ },
824
+ resources: P.resources.filter((K) => d ? !i.includes(K.assetId) : !u.includes(K.id))
825
+ };
826
+ })
827
+ };
828
+ return f(B), a({
829
+ ...t,
830
+ pagination: {
831
+ ...t.pagination,
832
+ // @ts-ignore
833
+ maxIdx: ((k = t.pagination) == null ? void 0 : k.maxIdx) - y.resources.length
834
+ }
835
+ }), R;
836
+ }
837
+ });
838
+ },
839
+ onSettled: () => {
840
+ c(), h();
841
+ }
842
+ });
843
+ }, Vs = () => {
844
+ const e = q(), s = O(), t = T(), r = V(), {
845
+ setTreeData: n
846
+ } = x(), {
847
+ filters: i,
848
+ trashed: o
849
+ } = t, d = ["context", {
850
+ folderId: i.folder,
851
+ filters: i,
852
+ trashed: o
853
+ }];
854
+ return L({
855
+ mutationFn: async ({
856
+ name: u,
857
+ parentId: h
858
+ }) => await Le({
859
+ searchParams: t,
860
+ name: u,
861
+ parentId: h
862
+ }),
863
+ onError(u) {
864
+ typeof u == "string" && e.error(D(u));
865
+ },
866
+ onSuccess: async (u, h) => {
867
+ await s.cancelQueries({
868
+ queryKey: d
869
+ });
870
+ const c = s.getQueryData(d), f = {
871
+ ...u,
872
+ parentId: h.parentId,
873
+ children: [],
874
+ rights: [`creator:${u == null ? void 0 : u.creator_id}`]
875
+ };
876
+ if (c)
877
+ return s.setQueryData(d, (a) => {
878
+ if (a) {
879
+ const m = {
880
+ ...a,
881
+ pages: a == null ? void 0 : a.pages.map((g) => ({
882
+ ...g,
883
+ folders: [...g.folders, f]
884
+ }))
885
+ }, p = ns(r, {
886
+ parentId: h.parentId,
887
+ newFolder: f
888
+ });
889
+ return n(p), m;
890
+ }
891
+ });
892
+ }
893
+ });
894
+ }, _s = () => {
895
+ const e = q(), s = O(), t = T(), r = V(), {
896
+ setFolderIds: n,
897
+ setSelectedFolders: i,
898
+ setTreeData: o
899
+ } = x(), {
900
+ filters: d,
901
+ trashed: u
902
+ } = t, h = ["context", {
903
+ folderId: d.folder,
904
+ filters: d,
905
+ trashed: u
906
+ }];
907
+ return L({
908
+ mutationFn: async ({
909
+ folderId: c,
910
+ name: f,
911
+ parentId: a
912
+ }) => await ke({
913
+ searchParams: t,
914
+ folderId: c,
915
+ parentId: a,
916
+ name: f
917
+ }),
918
+ onError(c) {
919
+ typeof c == "string" && e.error(D(c));
920
+ },
921
+ onSuccess: async (c, f) => {
922
+ if (await s.cancelQueries({
923
+ queryKey: h
924
+ }), s.getQueryData(h))
925
+ return s.setQueryData(h, (m) => {
926
+ if (m) {
927
+ const p = {
928
+ ...m,
929
+ pages: m == null ? void 0 : m.pages.map((y) => ({
930
+ ...y,
931
+ folders: y.folders.map((I) => I.id === c.id ? {
932
+ ...c,
933
+ parentId: f.parentId,
934
+ rights: I.rights
935
+ } : I)
936
+ }))
937
+ }, g = cs(r, {
938
+ folderId: f.folderId,
939
+ newFolder: c
940
+ });
941
+ return o(g), p;
942
+ }
943
+ });
944
+ },
945
+ onSettled: () => {
946
+ n([]), i([]);
947
+ }
948
+ });
949
+ }, Hs = () => {
950
+ const e = q(), s = O(), t = T(), {
951
+ setResourceIds: r,
952
+ setSelectedResources: n
953
+ } = x(), {
954
+ filters: i,
955
+ trashed: o,
956
+ app: d
957
+ } = t, u = ["context", {
958
+ folderId: i.folder,
959
+ filters: i,
960
+ trashed: o
961
+ }];
962
+ return L({
963
+ mutationFn: async ({
964
+ resourceId: h,
965
+ rights: c
966
+ }) => await $e({
967
+ app: d,
968
+ resourceId: h,
969
+ rights: c
970
+ }),
971
+ onError(h) {
972
+ typeof h == "string" && e.error(D("explorer.shared.status.error"));
973
+ },
974
+ onSuccess: async (h, c) => {
975
+ if (await s.cancelQueries({
976
+ queryKey: u
977
+ }), s.getQueryData(u))
978
+ return e.success(D("explorer.shared.status.saved")), s.setQueryData(u, (a) => {
979
+ if (a)
980
+ return {
981
+ ...a,
982
+ pages: a == null ? void 0 : a.pages.map((m) => ({
983
+ ...m,
984
+ resources: m.resources.map((p) => {
985
+ if (p.assetId === (c == null ? void 0 : c.resourceId)) {
986
+ let g = [`creator:${p.creatorId}`];
987
+ return (c == null ? void 0 : c.rights.length) >= 1 && (g = [...g, ...c.rights.flatMap((y) => y.actions.map((I) => `${y.type}:${y.id}:${I.id}`))]), {
988
+ ...p,
989
+ rights: g
990
+ };
991
+ } else
992
+ return p;
993
+ })
994
+ }))
995
+ };
996
+ });
997
+ },
998
+ onSettled: () => {
999
+ r([]), n([]);
1000
+ }
1001
+ });
1002
+ }, Ws = () => {
1003
+ const e = q(), s = O(), t = T(), {
1004
+ filters: r,
1005
+ trashed: n,
1006
+ app: i
1007
+ } = t, o = ["context", {
1008
+ folderId: r.folder,
1009
+ filters: r,
1010
+ trashed: n
1011
+ }];
1012
+ return L({
1013
+ mutationFn: async (d) => await je({
1014
+ app: i,
1015
+ params: d
1016
+ }),
1017
+ onError(d) {
1018
+ typeof d == "string" && e.error(D(d));
1019
+ },
1020
+ onSuccess: async (d, u) => {
1021
+ if (await s.cancelQueries({
1022
+ queryKey: o
1023
+ }), s.getQueryData(o))
1024
+ return s.setQueryData(o, (c) => {
1025
+ if (c)
1026
+ return {
1027
+ ...c,
1028
+ pages: c == null ? void 0 : c.pages.map((f) => ({
1029
+ ...f,
1030
+ resources: f.resources.map((a) => {
1031
+ if (a.assetId === (u == null ? void 0 : u.entId)) {
1032
+ const {
1033
+ name: m,
1034
+ thumbnail: p,
1035
+ public: g,
1036
+ description: y,
1037
+ slug: I,
1038
+ ...w
1039
+ } = u;
1040
+ return {
1041
+ ...a,
1042
+ ...w,
1043
+ // add any custom field
1044
+ name: m,
1045
+ thumbnail: typeof p == "string" ? p : URL.createObjectURL(p),
1046
+ public: g,
1047
+ description: y,
1048
+ slug: I
1049
+ };
1050
+ } else
1051
+ return a;
1052
+ })
1053
+ }))
1054
+ };
1055
+ });
1056
+ }
1057
+ });
1058
+ }, Xs = () => {
1059
+ const e = q(), s = O(), t = T(), {
1060
+ user: r
1061
+ } = Se(), {
1062
+ appCode: n
1063
+ } = M(), i = ["context", {
1064
+ folderId: t.filters.folder,
1065
+ filters: t.filters,
1066
+ trashed: t.trashed
1067
+ }];
1068
+ return L({
1069
+ mutationFn: async (o) => await _e({
1070
+ searchParams: t,
1071
+ params: o
1072
+ }),
1073
+ onError(o) {
1074
+ typeof o == "string" && e.error(D(o));
1075
+ },
1076
+ onSuccess: async (o, d) => {
1077
+ var f, a, m;
1078
+ await s.cancelQueries({
1079
+ queryKey: i
1080
+ });
1081
+ const u = s.getQueryData(i), {
1082
+ thumbnail: h
1083
+ } = d, c = {
1084
+ ...d,
1085
+ thumbnail: h ? URL.createObjectURL(h) : "",
1086
+ application: n,
1087
+ assetId: o._id || o.entId || "",
1088
+ id: o._id || o.entId || "",
1089
+ creatorId: r == null ? void 0 : r.userId,
1090
+ creatorName: r == null ? void 0 : r.username,
1091
+ createdAt: Date.now(),
1092
+ slug: d.slug || "",
1093
+ modifiedAt: ((f = o.modified) == null ? void 0 : f.$date) || "",
1094
+ modifierId: ((a = o.author) == null ? void 0 : a.userId) || "",
1095
+ modifierName: ((m = o.author) == null ? void 0 : m.username) || "",
1096
+ updatedAt: Date.now(),
1097
+ trashed: !1,
1098
+ rights: [`creator:${r == null ? void 0 : r.userId}`]
1099
+ };
1100
+ if (u)
1101
+ return s.setQueryData(i, (p) => {
1102
+ if (p)
1103
+ return {
1104
+ ...p,
1105
+ pages: p == null ? void 0 : p.pages.map((g) => ({
1106
+ ...g,
1107
+ resources: [c, ...g.resources]
1108
+ }))
1109
+ };
1110
+ });
1111
+ }
1112
+ });
1113
+ }, ds = /* @__PURE__ */ b(async () => await import("./EmptyScreenApp.js")), us = /* @__PURE__ */ b(async () => await import("./EmptyScreenSearch.js")), hs = /* @__PURE__ */ b(async () => await import("./EmptyScreenError.js")), fs = /* @__PURE__ */ b(async () => await import("./EmptyScreenNoContentInFolder.js")), ps = /* @__PURE__ */ b(async () => await import("./EmptyScreenTrash.js")), ms = /* @__PURE__ */ b(async () => await import("./FoldersList.js")), ys = /* @__PURE__ */ b(async () => await import("./ResourcesList.js")), gs = () => {
1114
+ const e = Je(), s = ne(), t = Ye(), r = T(), n = W(), i = V(), o = q(), {
1115
+ appCode: d
1116
+ } = M(), {
1117
+ t: u
1118
+ } = z(), {
1119
+ setSearchParams: h,
1120
+ setSearchConfig: c,
1121
+ setTreeData: f
1122
+ } = x(), {
1123
+ data: a,
1124
+ isError: m,
1125
+ error: p,
1126
+ isLoading: g,
1127
+ isFetching: y,
1128
+ fetchNextPage: I
1129
+ } = is(), w = (a == null ? void 0 : a.pages[0].folders.length) === 0, E = (a == null ? void 0 : a.pages[0].resources.length) === 0, k = w && E;
1130
+ return U(() => {
1131
+ var B, R, P;
1132
+ if (a) {
1133
+ const Q = [...((B = a == null ? void 0 : a.pages[0]) == null ? void 0 : B.folders) ?? []];
1134
+ (R = a == null ? void 0 : a.pages[0]) != null && R.searchConfig && c(a.pages[0].searchConfig), r.search || ((n == null ? void 0 : n.id) === "default" ? f({
1135
+ id: F.DEFAULT,
1136
+ section: !0,
1137
+ children: Q.map((K) => new X(K)),
1138
+ name: u("explorer.filters.mine", {
1139
+ ns: d
1140
+ })
1141
+ }) : f(ue(i, Q, r.filters.folder || F.DEFAULT))), h({
1142
+ ...r,
1143
+ pagination: (P = a == null ? void 0 : a.pages[(a == null ? void 0 : a.pages.length) - 1]) == null ? void 0 : P.pagination
1144
+ });
1145
+ }
1146
+ }, [a]), U(() => {
1147
+ p && typeof p == "string" && o.error(u(p));
1148
+ }, [p]), g ? /* @__PURE__ */ l(A, {}) : m ? /* @__PURE__ */ l(v, { fallback: /* @__PURE__ */ l(A, {}), children: /* @__PURE__ */ l(hs, {}) }) : r.search && k ? /* @__PURE__ */ l(v, { fallback: /* @__PURE__ */ l(A, {}), children: /* @__PURE__ */ l(us, {}) }) : e && k ? /* @__PURE__ */ l(v, { fallback: /* @__PURE__ */ l(A, {}), children: /* @__PURE__ */ l(ds, {}) }) : t && k && !s ? /* @__PURE__ */ l(v, { fallback: /* @__PURE__ */ l(A, {}), children: /* @__PURE__ */ l(fs, {}) }) : s && (a == null ? void 0 : a.pages[0].resources.length) === 0 ? /* @__PURE__ */ l(v, { fallback: /* @__PURE__ */ l(A, {}), children: /* @__PURE__ */ l(ps, {}) }) : /* @__PURE__ */ C(v, { fallback: /* @__PURE__ */ l(A, {}), children: [
1149
+ /* @__PURE__ */ l(ms, { data: a, isFetching: y }),
1150
+ /* @__PURE__ */ l(ys, { data: a, isFetching: y, fetchNextPage: I })
1151
+ ] });
1152
+ }, Is = () => {
1153
+ const {
1154
+ appCode: e,
1155
+ currentApp: s
1156
+ } = M(), {
1157
+ t
1158
+ } = z(), [r, n] = ce(""), i = (c) => {
1159
+ if (c === "0") {
1160
+ n("");
1161
+ return;
1162
+ }
1163
+ n(c);
1164
+ }, o = W(), d = T(), {
1165
+ setSearchParams: u
1166
+ } = x();
1167
+ U(() => {
1168
+ const c = () => r.includes("1") ? !0 : void 0, f = () => r.includes("2") ? !0 : void 0, a = () => r.includes("7") ? !0 : void 0;
1169
+ u({
1170
+ ...d,
1171
+ filters: {
1172
+ owner: c(),
1173
+ public: a(),
1174
+ shared: f(),
1175
+ folder: o ? o.id : "default"
1176
+ }
1177
+ });
1178
+ }, [o, u, r]);
1179
+ const h = [{
1180
+ label: t("explorer.filter.all", {
1181
+ ns: e
1182
+ }),
1183
+ value: "0"
1184
+ }, {
1185
+ label: t("explorer.filter.owner", {
1186
+ ns: e
1187
+ }),
1188
+ value: "1"
1189
+ }, {
1190
+ label: t("explorer.filter.shared", {
1191
+ ns: e
1192
+ }),
1193
+ value: "2"
1194
+ }, ...(s == null ? void 0 : s.displayName) == se.EXERCIZER ? [{
1195
+ label: "Exercices interactifs",
1196
+ value: "3"
1197
+ }] : [], ...(s == null ? void 0 : s.displayName) == se.EXERCIZER ? [{
1198
+ label: "Exercices à rendre",
1199
+ value: "4"
1200
+ }] : [], ...(s == null ? void 0 : s.displayName) == "pages" ? [{
1201
+ label: "Projets publics",
1202
+ value: "5"
1203
+ }] : [], ...(s == null ? void 0 : s.displayName) == "pages" ? [{
1204
+ label: "Projets internes",
1205
+ value: "6"
1206
+ }] : [], ...(s == null ? void 0 : s.displayName) == se.BLOG ? [{
1207
+ label: t("explorer.filter.public", {
1208
+ ns: e
1209
+ }),
1210
+ value: "7"
1211
+ }] : []];
1212
+ return {
1213
+ selectedFilters: r,
1214
+ options: h,
1215
+ handleOnSelectFilter: i
1216
+ };
1217
+ }, Ss = () => {
1218
+ const {
1219
+ appCode: e
1220
+ } = M(), {
1221
+ t: s
1222
+ } = z(), {
1223
+ selectedFilters: t,
1224
+ options: r,
1225
+ handleOnSelectFilter: n
1226
+ } = Is(), {
1227
+ formRef: i,
1228
+ inputSearch: o,
1229
+ handleInputSearchChange: d,
1230
+ handleKeyPress: u,
1231
+ handleSearchSubmit: h
1232
+ } = he(), c = t.length > 0 ? t.length : void 0;
1233
+ return /* @__PURE__ */ C("form", { noValidate: !0, className: "bg-light p-16 ps-24 ms-n16 ms-lg-n24 me-n16 position-relative z-3 d-flex gap-8", ref: i, children: [
1234
+ /* @__PURE__ */ C(we, { id: "search", className: "input-group", children: [
1235
+ /* @__PURE__ */ l(xe, { type: "search", placeholder: s("explorer.label.search", {
1236
+ ns: e
1237
+ }), size: "lg", noValidationIcon: !0, value: o, onChange: d, onKeyDown: u }),
1238
+ /* @__PURE__ */ l(De, { type: "submit", "aria-label": s("explorer.label.search", {
1239
+ ns: e
1240
+ }), onClick: h })
1241
+ ] }),
1242
+ /* @__PURE__ */ C(j, { placement: "bottom-end", children: [
1243
+ /* @__PURE__ */ l(j.Trigger, { label: s("explorer.filters"), icon: /* @__PURE__ */ l(Ae, { width: 20 }), variant: "ghost", badgeContent: c }),
1244
+ /* @__PURE__ */ l(j.Menu, { children: r.map((f) => f.value === "0" ? /* @__PURE__ */ C(ye, { children: [
1245
+ /* @__PURE__ */ l(j.RadioItem, { value: f.value, model: t, onChange: () => n(f.value), children: f.label }),
1246
+ /* @__PURE__ */ l(j.Separator, {})
1247
+ ] }, "0") : /* @__PURE__ */ l(j.RadioItem, { value: f.value, model: t, onChange: () => n(f.value), children: f.label }, f.value)) })
1248
+ ] })
1249
+ ] });
1250
+ }, ws = ({
1251
+ id: e,
1252
+ selected: s,
1253
+ onSelect: t
1254
+ }) => {
1255
+ const {
1256
+ t: r
1257
+ } = z();
1258
+ return /* @__PURE__ */ l("div", { className: "treeview", children: /* @__PURE__ */ l("ul", { role: "tree", className: "m-0 p-0", children: /* @__PURE__ */ l("li", { id: e, role: "treeitem", "aria-selected": s, children: /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l("div", { className: "action-container", children: /* @__PURE__ */ l("div", { onClick: t, role: "button", tabIndex: 0, children: /* @__PURE__ */ C("div", { className: "d-flex align-items-center gap-8 py-8 ps-24", children: [
1259
+ /* @__PURE__ */ l(Ee, { width: "20", height: "20" }),
1260
+ /* @__PURE__ */ l("span", { children: r("explorer.tree.trash") })
1261
+ ] }) }) }) }) }) }) });
1262
+ }, xs = /* @__PURE__ */ b(async () => await import("./FolderModal.js")), Ds = () => {
1263
+ const e = O(), [s, t] = be(), r = V(), n = ne(), i = re(), {
1264
+ appCode: o
1265
+ } = M(), {
1266
+ t: d
1267
+ } = z(["common", o]), {
1268
+ goToTrash: u,
1269
+ selectTreeItem: h,
1270
+ unfoldTreeItem: c,
1271
+ foldTreeItem: f,
1272
+ clearSelectedItems: a,
1273
+ clearSelectedIds: m
1274
+ } = x(), p = async (y) => {
1275
+ await c(y, e);
1276
+ }, g = () => {
1277
+ a(), m(), t();
1278
+ };
1279
+ return /* @__PURE__ */ C(ae, { children: [
1280
+ /* @__PURE__ */ l(Te, { data: r, selectedNodesIds: i, onTreeItemSelect: h, onTreeItemFold: f, onTreeItemUnfold: p }),
1281
+ /* @__PURE__ */ l(ws, { id: F.BIN, selected: n, onSelect: u }),
1282
+ /* @__PURE__ */ l("div", { className: "d-grid my-16", children: /* @__PURE__ */ l(Fe, { disabled: n, type: "button", color: "primary", variant: "outline", leftIcon: /* @__PURE__ */ l(Qe, {}), onClick: g, children: d("explorer.folder.new") }) }),
1283
+ /* @__PURE__ */ l(v, { fallback: /* @__PURE__ */ l(A, {}), children: s && /* @__PURE__ */ l(xs, { edit: !1, isOpen: s, onSuccess: t, onCancel: t }) })
1284
+ ] });
1285
+ };
1286
+ const bs = /* @__PURE__ */ b(async () => ({
1287
+ default: (await import("@edifice-ui/react")).OnboardingModal
1288
+ })), Ts = /* @__PURE__ */ b(async () => await import("./AppAction.js")), Fs = /* @__PURE__ */ b(async () => await import("./Library.js")), Cs = /* @__PURE__ */ b(async () => await import("./ActionBarContainer.js")), Ns = /* @__PURE__ */ b(async () => await import("./DisableModal.js")), Rs = /* @__PURE__ */ b(async () => await import("./TrashModal.js")), Gs = ({
1289
+ config: e
1290
+ }) => {
1291
+ const s = T(), {
1292
+ setConfig: t,
1293
+ setSearchParams: r
1294
+ } = x();
1295
+ U(() => {
1296
+ t(e || {}), r({
1297
+ ...s,
1298
+ app: e.app,
1299
+ types: e.types
1300
+ });
1301
+ }, [e]);
1302
+ const {
1303
+ currentApp: n
1304
+ } = M(), {
1305
+ data: i
1306
+ } = ls(), {
1307
+ isTrashedModalOpen: o,
1308
+ onTrashedCancel: d
1309
+ } = rs(), {
1310
+ isActionDisableModalOpen: u,
1311
+ onActionDisableCancel: h
1312
+ } = ts();
1313
+ Ce();
1314
+ const c = oe("publish", i), f = oe("create", i);
1315
+ return e && /* @__PURE__ */ C(ae, { children: [
1316
+ /* @__PURE__ */ l(Ne, { render: () => f ? /* @__PURE__ */ l(v, { fallback: /* @__PURE__ */ l(A, {}), children: /* @__PURE__ */ l(Ts, {}) }) : null, children: /* @__PURE__ */ l(Re, { app: n }) }),
1317
+ /* @__PURE__ */ C(ee, { className: "flex-grow-1", children: [
1318
+ /* @__PURE__ */ l(ee.Col, { sm: "3", lg: "2", xl: "3", className: "border-end pt-16 pe-16 d-none d-lg-block", as: "aside", children: /* @__PURE__ */ C(v, { fallback: /* @__PURE__ */ l(A, {}), children: [
1319
+ /* @__PURE__ */ l(Ds, {}),
1320
+ c && /* @__PURE__ */ l(Fs, {})
1321
+ ] }) }),
1322
+ /* @__PURE__ */ C(ee.Col, { sm: "4", md: "8", lg: "6", xl: "9", children: [
1323
+ /* @__PURE__ */ l(Ss, {}),
1324
+ /* @__PURE__ */ l(ss, {}),
1325
+ /* @__PURE__ */ l(gs, {})
1326
+ ] }),
1327
+ /* @__PURE__ */ C(v, { fallback: /* @__PURE__ */ l(A, {}), children: [
1328
+ /* @__PURE__ */ l(Cs, {}),
1329
+ /* @__PURE__ */ l(bs, { id: "showOnboardingTrash", items: [{
1330
+ src: "onboarding/illu-trash-menu.svg",
1331
+ alt: "explorer.modal.onboarding.trash.screen1.alt",
1332
+ text: "explorer.modal.onboarding.trash.screen1.title"
1333
+ }, {
1334
+ src: "onboarding/illu-trash-notif.svg",
1335
+ alt: "explorer.modal.onboarding.trash.screen2.alt",
1336
+ text: "explorer.modal.onboarding.trash.screen2.alt"
1337
+ }, {
1338
+ src: "onboarding/illu-trash-delete.svg",
1339
+ alt: "explorer.modal.onboarding.trash.screen3.alt",
1340
+ text: "explorer.modal.onboarding.trash.screen3.title"
1341
+ }], modalOptions: {
1342
+ title: "explorer.modal.onboarding.trash.title",
1343
+ prevText: "explorer.modal.onboarding.trash.prev",
1344
+ nextText: "explorer.modal.onboarding.trash.next",
1345
+ closeText: "explorer.modal.onboarding.trash.close"
1346
+ } }),
1347
+ o && /* @__PURE__ */ l(Rs, { isOpen: o, onCancel: d }),
1348
+ u && /* @__PURE__ */ l(Ns, { isOpen: u, onCancel: h })
1349
+ ] })
1350
+ ] })
1351
+ ] });
1352
+ };
1353
+ export {
1354
+ Gs as E,
1355
+ ls as a,
1356
+ W as b,
1357
+ Xs as c,
1358
+ ne as d,
1359
+ S as e,
1360
+ Z as f,
1361
+ Bs as g,
1362
+ Ms as h,
1363
+ G as i,
1364
+ $s as j,
1365
+ Ge as k,
1366
+ Hs as l,
1367
+ Ws as m,
1368
+ T as n,
1369
+ Vs as o,
1370
+ _s as p,
1371
+ js as q,
1372
+ Ks as r,
1373
+ zs as s,
1374
+ V as t,
1375
+ x as u
1376
+ };