ode-explorer 1.4.2-develop-pedago.202404301615 → 1.4.2-develop-integration.202405161426

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,277 +1,280 @@
1
- import { jsx as a, Fragment as G, jsxs as Q } from "react/jsx-runtime";
2
- import { useState as L, useEffect as Z, Suspense as de, lazy as y } from "react";
3
- import { useUser as pe, Button as W, useOdeClient as he, ActionBar as fe, LoadingScreen as me, isActionAvailable as Re, BlogPublic as Se, ShareModal as Ee, ShareBlog as Ce } from "@edifice-ui/react";
4
- import { useTransition as Oe, animated as ye } from "@react-spring/web";
5
- import { useTranslation as ee } from "react-i18next";
6
- import { odeServices as D, ACTION as c } from "edifice-ts-client";
7
- import { e as X, f as be, b as ve, h as Ae, i as se, j as Ie, k as Me, l as ge, m as Pe, d as we, n as Fe, u as te, a as xe, o as Te, p as Be, q as De } from "./index2.js";
1
+ import { jsx as i, Fragment as $, jsxs as J } from "react/jsx-runtime";
2
+ import { useState as B, useEffect as K, Suspense as ue, lazy as g } from "react";
3
+ import { useUser as de, Button as Q, useOdeClient as pe, ActionBar as he, LoadingScreen as fe, isActionAvailable as me, BlogPublic as Re, ShareModal as Se, ShareBlog as Ce } from "@edifice-ui/react";
4
+ import { useTransition as Ee, animated as Oe } from "@react-spring/web";
5
+ import { useTranslation as X } from "react-i18next";
6
+ import { odeServices as T, ACTION as a } from "edifice-ts-client";
7
+ import { e as q, f as be, b as ye, h as Ie, i as Z, j as ve, k as Ae, l as ge, m as Pe, d as Me, n as we, u as W, a as Fe, o as Te, p as Be, q as xe, r as De } from "./index2.js";
8
8
  import "@edifice-ui/icons";
9
9
  import "i18next";
10
10
  import "zustand";
11
11
  import "@tanstack/react-query";
12
12
  function Le({
13
13
  roles: n,
14
- rights: o,
15
- action: s
14
+ rights: t,
15
+ action: o
16
16
  }) {
17
- const [d, t] = L(!1), {
18
- user: S
19
- } = pe(), h = X();
20
- Z(() => {
21
- f();
22
- }, [n, o]);
17
+ const [h, s] = B(!1), {
18
+ user: C
19
+ } = de(), f = q();
20
+ K(() => {
21
+ d();
22
+ }, [n, t]);
23
23
  const R = async function(l) {
24
24
  const r = l instanceof Array ? l : [l];
25
25
  if (n instanceof Array) {
26
- const m = await D.rights().sessionHasAtLeastOneResourceRight(n, r);
27
- t(m);
26
+ const m = await T.rights().sessionHasAtLeastOneResourceRight(n, r);
27
+ s(m);
28
28
  } else {
29
- const m = await D.rights().sessionHasResourceRight(n, r);
30
- t(m);
29
+ const m = await T.rights().sessionHasResourceRight(n, r);
30
+ s(m);
31
31
  }
32
- }, p = async function(l) {
32
+ }, c = async function(l) {
33
33
  if (n instanceof Array) {
34
- const r = await D.rights().sessionHasAtLeastOneResourceRightForEachList(n, l);
35
- t(r);
34
+ const r = await T.rights().sessionHasAtLeastOneResourceRightForEachList(n, l);
35
+ s(r);
36
36
  } else {
37
- const r = await D.rights().sessionHasResourceRightForEachList(n, l);
38
- t(r);
37
+ const r = await T.rights().sessionHasResourceRightForEachList(n, l);
38
+ s(r);
39
39
  }
40
- }, f = async function() {
40
+ }, d = async function() {
41
41
  var l, r, m;
42
42
  if (n === void 0) {
43
- t(!0);
43
+ s(!0);
44
44
  return;
45
45
  }
46
- if (h && ((r = (l = o[0]) == null ? void 0 : l.trashedBy) != null && r.includes(S == null ? void 0 : S.userId)) && s === "restore" && !((m = o[0]) != null && m.trashed)) {
47
- t(!0);
46
+ if (f && ((r = (l = t[0]) == null ? void 0 : l.trashedBy) != null && r.includes(C == null ? void 0 : C.userId)) && o === "restore" && !((m = t[0]) != null && m.trashed)) {
47
+ s(!0);
48
48
  return;
49
49
  }
50
- if (o instanceof Array)
51
- if (o.length > 0)
52
- if (typeof o[0] == "string")
53
- await R(o);
50
+ if (t instanceof Array)
51
+ if (t.length > 0)
52
+ if (typeof t[0] == "string")
53
+ await R(t);
54
54
  else {
55
- const b = o.map((v) => v.rights);
56
- await p(b);
55
+ const b = t.map((y) => y.rights);
56
+ await c(b);
57
57
  }
58
58
  else
59
- t(!1);
59
+ s(!1);
60
60
  else
61
- typeof o == "string" ? await R(o) : await R(o.rights);
61
+ typeof t == "string" ? await R(t) : await R(t.rights);
62
62
  };
63
63
  return {
64
- visible: d,
65
- refreshState: f
64
+ visible: h,
65
+ refreshState: d
66
66
  };
67
67
  }
68
- function oe() {
69
- const [n, o] = L(!1), [s, d] = L("void"), [t, S] = L(), h = be((e) => e.config), R = ve(), p = Ae(), f = se(), l = Ie(), r = Me(), m = X(), b = ge(), v = Pe(), g = we(), _ = Fe(), {
70
- openResource: N,
71
- printSelectedResource: P,
72
- openFolder: k,
73
- clearSelectedItems: w,
74
- clearSelectedIds: F
75
- } = te(), {
76
- data: H
77
- } = xe();
78
- Z(() => {
79
- if (p.length === 0 && r.length === 0) {
80
- o(!1);
68
+ function ee() {
69
+ const [n, t] = B(!1), [o, h] = B("void"), [s, C] = B(), f = be((e) => e.config), R = ye(), c = Ie(), d = Z(), l = ve(), r = Ae(), m = q(), b = ge(), y = Pe(), I = Me(), x = we(), {
70
+ openResource: D,
71
+ printSelectedResource: L,
72
+ openFolder: _,
73
+ clearSelectedItems: P,
74
+ clearSelectedIds: M
75
+ } = W(), {
76
+ data: N
77
+ } = Fe();
78
+ K(() => {
79
+ if (c.length === 0 && r.length === 0) {
80
+ t(!1);
81
81
  return;
82
82
  }
83
- if (v) {
84
- o(!1);
83
+ if (y) {
84
+ t(!1);
85
85
  return;
86
86
  }
87
- o(!0);
88
- }, [p, r]);
89
- async function U(e) {
90
- var B;
91
- switch ((B = document.getElementById("root")) == null || B.setAttribute("aria-hidden", "true"), S(e), e.id) {
92
- case c.OPEN:
93
- return p.length > 0 ? N(f[0]) : k({
87
+ t(!0);
88
+ }, [c, r]);
89
+ async function k(e) {
90
+ var F;
91
+ switch ((F = document.getElementById("root")) == null || F.setAttribute("aria-hidden", "true"), C(e), e.id) {
92
+ case a.OPEN:
93
+ return c.length > 0 ? D(d[0]) : _({
94
94
  folder: l[0],
95
95
  folderId: l[0].id
96
96
  });
97
- case c.COPY:
98
- return ie();
99
- case c.MOVE:
100
- return d("move");
101
- case c.PRINT:
102
- return P();
103
- case c.DELETE:
104
- return d("delete");
105
- case c.RESTORE:
106
- return await x();
107
- case c.PUBLISH:
108
- return d("publish");
109
- case c.UPD_PROPS:
97
+ case a.COPY:
98
+ return ce();
99
+ case a.MOVE:
100
+ return h("move");
101
+ case a.PRINT:
102
+ return L();
103
+ case a.DELETE:
104
+ return h("delete");
105
+ case a.RESTORE:
106
+ return await Y();
107
+ case a.PUBLISH:
108
+ return h("publish");
109
+ case a.UPD_PROPS:
110
110
  case "edit":
111
- return le();
112
- case c.SHARE:
113
- return d("share");
114
- case c.EXPORT:
115
- return d("export");
111
+ return ae();
112
+ case "export":
113
+ return c.length > 0 ? ie() : null;
114
+ case a.SHARE:
115
+ return h("share");
116
116
  default:
117
117
  throw Error(`Unknown action: ${e.id}`);
118
118
  }
119
119
  }
120
- function Y(e) {
121
- const B = p.length + r.length, C = p.length === 1 || r.length === 1, K = B === 1, O = r.length === 0;
120
+ function H(e) {
121
+ const F = c.length + r.length, E = c.length === 1 || r.length === 1, G = F === 1, O = r.length === 0;
122
122
  switch (e.id) {
123
- case c.OPEN:
124
- return K;
125
- case c.MANAGE:
126
- return C;
127
- case c.COPY:
128
- return C && O;
129
- case c.PUBLISH:
130
- return C && O;
131
- case c.UPD_PROPS:
132
- return C && O;
133
- case c.SHARE:
134
- return O && C;
123
+ case a.OPEN:
124
+ return G;
125
+ case a.MANAGE:
126
+ return E;
127
+ case a.COPY:
128
+ return E && O;
129
+ case a.PUBLISH:
130
+ return E && O;
131
+ case a.UPD_PROPS:
132
+ return E && O;
133
+ case a.SHARE:
134
+ return O && E;
135
135
  case "export":
136
- return C && O;
137
- case c.PRINT:
138
- return C && O;
136
+ return E && O;
137
+ case a.PRINT:
138
+ return E && O;
139
139
  case "edit":
140
- return K;
140
+ return G;
141
141
  default:
142
142
  return !0;
143
143
  }
144
144
  }
145
- const j = () => !0;
146
- async function x() {
145
+ const U = () => !0;
146
+ async function Y() {
147
147
  try {
148
148
  if (m)
149
149
  await b.mutate();
150
150
  else
151
151
  throw new Error("Cannot restore untrashed resources");
152
- A();
152
+ S();
153
153
  } catch (e) {
154
154
  console.error(e);
155
155
  }
156
156
  }
157
- function A() {
157
+ function S() {
158
158
  var e;
159
- d("void"), t != null && t.id && ((e = document.getElementById(t == null ? void 0 : t.id)) == null || e.focus());
159
+ h("void"), s != null && s.id && ((e = document.getElementById(s == null ? void 0 : s.id)) == null || e.focus());
160
160
  }
161
- const i = (e) => () => {
162
- s === e && (A(), w(), F());
163
- }, J = i("move"), E = i("move"), z = i("delete"), T = i("delete"), V = i("publish"), I = i("publish"), M = i("edit_folder"), u = i("edit_folder"), $ = i("edit_resource"), q = i("edit_resource"), ne = i("share"), re = i("share"), ce = i("export"), ae = i("export");
164
- async function ie() {
165
- if (f && f.length > 0) {
166
- const e = f[0];
167
- await _.mutate(e), w(), F();
161
+ const p = (e) => () => {
162
+ o === e && (S(), P(), M());
163
+ }, w = p("move"), j = p("move"), v = p("delete"), A = p("delete"), u = p("publish"), z = p("publish"), V = p("edit_folder"), se = p("edit_folder"), te = p("edit_resource"), oe = p("edit_resource"), ne = p("share"), re = p("share");
164
+ async function ce() {
165
+ if (d && d.length > 0) {
166
+ const e = d[0];
167
+ await x.mutate(e), P(), M();
168
168
  }
169
169
  }
170
- function le() {
171
- if (p && p.length > 0) {
172
- const e = f[0].assetId;
173
- (h == null ? void 0 : h.app) == "scrapbook" ? Te({
174
- searchParams: g,
170
+ function ae() {
171
+ if (c && c.length > 0) {
172
+ const e = d[0].assetId;
173
+ (f == null ? void 0 : f.app) == "scrapbook" ? Te({
174
+ searchParams: I,
175
175
  assetId: e
176
- }) : d("edit_resource");
176
+ }) : h("edit_resource");
177
177
  } else
178
- d("edit_folder");
178
+ h("edit_folder");
179
179
  }
180
- function ue(e) {
180
+ function ie() {
181
+ if (c && c.length > 0) {
182
+ const e = d[0].assetId;
183
+ Be({
184
+ searchParams: I,
185
+ assetId: e
186
+ });
187
+ }
188
+ }
189
+ function le(e) {
181
190
  return e.id === "edit" && r.length > 0 ? "explorer.rename" : `explorer.actions.${e.id}`;
182
191
  }
183
192
  return {
184
- onRestore: x,
185
- actions: m ? h == null ? void 0 : h.trashActions : H,
186
- selectedElement: [...f, ...l],
193
+ onRestore: Y,
194
+ actions: m ? f == null ? void 0 : f.trashActions : N,
195
+ selectedElement: [...d, ...l],
187
196
  currentFolderId: R == null ? void 0 : R.id,
188
- overrideLabel: ue,
189
- handleClick: U,
190
- isActivable: m ? j : Y,
197
+ overrideLabel: le,
198
+ handleClick: k,
199
+ isActivable: m ? U : H,
191
200
  isActionBarOpen: n,
192
- isMoveModalOpen: s === "move",
193
- onMoveCancel: J,
194
- onMoveSuccess: E,
195
- isDeleteModalOpen: s === "delete",
196
- onDeleteCancel: T,
197
- onDeleteSuccess: z,
198
- isPublishModalOpen: s === "publish",
199
- onPublishCancel: I,
200
- onPublishSuccess: V,
201
- isEditFolderOpen: s === "edit_folder",
202
- onEditFolderCancel: u,
203
- onEditFolderSuccess: M,
204
- isEditResourceOpen: s === "edit_resource",
205
- onEditResourceCancel: q,
206
- onEditResourceSuccess: $,
207
- isShareResourceOpen: s === "share",
201
+ isMoveModalOpen: o === "move",
202
+ onMoveCancel: w,
203
+ onMoveSuccess: j,
204
+ isDeleteModalOpen: o === "delete",
205
+ onDeleteCancel: A,
206
+ onDeleteSuccess: v,
207
+ isPublishModalOpen: o === "publish",
208
+ onPublishCancel: z,
209
+ onPublishSuccess: u,
210
+ isEditFolderOpen: o === "edit_folder",
211
+ onEditFolderCancel: se,
212
+ onEditFolderSuccess: V,
213
+ isEditResourceOpen: o === "edit_resource",
214
+ onEditResourceCancel: oe,
215
+ onEditResourceSuccess: te,
216
+ isShareResourceOpen: o === "share",
208
217
  onShareResourceCancel: re,
209
218
  onShareResourceSuccess: ne,
210
- isExportModalOpen: s === "export",
211
- onExportCancel: ce,
212
- onExportSuccess: ae,
213
- onClearActionBar: A
219
+ onClearActionBar: S
214
220
  };
215
221
  }
216
222
  function _e({
217
223
  resourceRights: n,
218
- roleExpected: o,
219
- action: s,
220
- children: d,
221
- renderWhenForbidden: t
224
+ roleExpected: t,
225
+ action: o,
226
+ children: h,
227
+ renderWhenForbidden: s
222
228
  }) {
223
229
  const {
224
- t: S
230
+ t: C
231
+ } = X(), {
232
+ overrideLabel: f
225
233
  } = ee(), {
226
- overrideLabel: h
227
- } = oe(), {
228
234
  visible: R
229
235
  } = Le({
230
- roles: o,
236
+ roles: t,
231
237
  rights: n,
232
- action: s == null ? void 0 : s.id
238
+ action: o == null ? void 0 : o.id
233
239
  }), {
234
- setResourceActionDisable: p
235
- } = te(), f = X();
236
- return R ? /* @__PURE__ */ a(G, { children: d }) : t ? t() : f && !R ? /* @__PURE__ */ a(W, { type: "button", color: "primary", variant: "filled", onClick: () => {
237
- p(!0);
238
- }, children: S(h(s)) }) : /* @__PURE__ */ a(G, {});
240
+ setResourceActionDisable: c
241
+ } = W(), d = q();
242
+ return R ? /* @__PURE__ */ i($, { children: h }) : s ? s() : d && !R ? /* @__PURE__ */ i(Q, { type: "button", color: "primary", variant: "filled", onClick: () => {
243
+ c(!0);
244
+ }, children: C(f(o)) }) : /* @__PURE__ */ i($, {});
239
245
  }
240
- const Ne = /* @__PURE__ */ y(async () => await import("./PublishModal.js")), ke = /* @__PURE__ */ y(async () => await import("./ResourceModal.js")), He = /* @__PURE__ */ y(async () => await import("./DeleteModal.js")), Ue = /* @__PURE__ */ y(async () => await import("./MoveModal.js")), Ye = /* @__PURE__ */ y(async () => await import("./FolderModal.js")), je = /* @__PURE__ */ y(async () => await import("./ExportModal.js"));
241
- function es() {
246
+ const Ne = /* @__PURE__ */ g(async () => await import("./PublishModal.js")), ke = /* @__PURE__ */ g(async () => await import("./ResourceModal.js")), He = /* @__PURE__ */ g(async () => await import("./DeleteModal.js")), Ue = /* @__PURE__ */ g(async () => await import("./MoveModal.js")), Ye = /* @__PURE__ */ g(async () => await import("./FolderModal.js"));
247
+ function We() {
242
248
  const {
243
249
  appCode: n
244
- } = he(), {
245
- t: o
246
- } = ee(), {
247
- actions: s,
248
- selectedElement: d,
249
- isMoveModalOpen: t,
250
- isDeleteModalOpen: S,
251
- isPublishModalOpen: h,
250
+ } = pe(), {
251
+ t
252
+ } = X(), {
253
+ actions: o,
254
+ selectedElement: h,
255
+ isMoveModalOpen: s,
256
+ isDeleteModalOpen: C,
257
+ isPublishModalOpen: f,
252
258
  isActionBarOpen: R,
253
- isEditFolderOpen: p,
254
- overrideLabel: f,
259
+ isEditFolderOpen: c,
260
+ overrideLabel: d,
255
261
  onEditFolderCancel: l,
256
262
  onEditFolderSuccess: r,
257
263
  isEditResourceOpen: m,
258
264
  onEditResourceCancel: b,
259
- onEditResourceSuccess: v,
260
- isShareResourceOpen: g,
261
- onShareResourceCancel: _,
262
- onShareResourceSuccess: N,
263
- isExportModalOpen: P,
264
- onExportCancel: k,
265
- onExportSuccess: w,
266
- onMoveCancel: F,
267
- onMoveSuccess: H,
268
- onDeleteCancel: U,
269
- onDeleteSuccess: Y,
270
- onPublishCancel: j,
271
- onPublishSuccess: x,
272
- isActivable: A,
273
- handleClick: i
274
- } = oe(), E = se()[0], z = Be(n), T = De(n), V = Oe(R, {
265
+ onEditResourceSuccess: y,
266
+ isShareResourceOpen: I,
267
+ onShareResourceCancel: x,
268
+ onShareResourceSuccess: D,
269
+ onMoveCancel: L,
270
+ onMoveSuccess: _,
271
+ onDeleteCancel: P,
272
+ onDeleteSuccess: M,
273
+ onPublishCancel: N,
274
+ onPublishSuccess: k,
275
+ isActivable: H,
276
+ handleClick: U
277
+ } = ee(), S = Z()[0], p = xe(n), w = De(n), j = Ee(R, {
275
278
  from: {
276
279
  opacity: 0,
277
280
  transform: "translateY(100%)"
@@ -285,21 +288,20 @@ function es() {
285
288
  transform: "translateY(100%)"
286
289
  }
287
290
  });
288
- return /* @__PURE__ */ Q(G, { children: [
289
- V((I, M) => M && /* @__PURE__ */ a(ye.div, { className: "position-fixed bottom-0 start-0 end-0 z-3", style: I, children: /* @__PURE__ */ a(fe, { children: s == null ? void 0 : s.filter((u) => u.available && u.target === "actionbar").map((u) => A(u) && /* @__PURE__ */ a(_e, { resourceRights: d, roleExpected: u.right, action: u, children: /* @__PURE__ */ a(W, { id: u.id, type: "button", color: "primary", variant: "filled", onClick: () => {
290
- i(u);
291
- }, children: o(f(u)) }, u.id) }, u.id)) }) })),
292
- /* @__PURE__ */ Q(de, { fallback: /* @__PURE__ */ a(me, {}), children: [
293
- t && /* @__PURE__ */ a(Ue, { isOpen: t, onCancel: F, onSuccess: H }),
294
- S && /* @__PURE__ */ a(He, { isOpen: S, onCancel: U, onSuccess: Y }),
295
- h && E && /* @__PURE__ */ a(Ne, { isOpen: h, resourceId: E.assetId, onCancel: j, onSuccess: x }),
296
- p && /* @__PURE__ */ a(Ye, { edit: !0, isOpen: p, onCancel: l, onSuccess: r }),
297
- m && E && /* @__PURE__ */ a(ke, { mode: "update", isOpen: m, resourceId: E.assetId, updateResource: T, onCancel: b, onSuccess: v, children: (I, M, u, $, q) => n === "blog" && Re("createPublic", s) && /* @__PURE__ */ a(Se, { appCode: n, isUpdating: M, resource: I, watch: u, setValue: $, register: q }) }),
298
- g && E && /* @__PURE__ */ a(Ee, { isOpen: g, resourceId: E.assetId, shareResource: z, onCancel: _, onSuccess: N, children: n === "blog" ? /* @__PURE__ */ a(Ce, { resource: E, updateResource: T }) : null }),
299
- P && E && /* @__PURE__ */ a(je, { isOpen: P, onCancel: k, onSuccess: w })
291
+ return /* @__PURE__ */ J($, { children: [
292
+ j((v, A) => A && /* @__PURE__ */ i(Oe.div, { className: "position-fixed bottom-0 start-0 end-0 z-3", style: v, children: /* @__PURE__ */ i(he, { children: o == null ? void 0 : o.filter((u) => u.available && u.target === "actionbar").map((u) => H(u) && /* @__PURE__ */ i(_e, { resourceRights: h, roleExpected: u.right, action: u, children: /* @__PURE__ */ i(Q, { id: u.id, type: "button", color: "primary", variant: "filled", onClick: () => {
293
+ U(u);
294
+ }, children: t(d(u)) }, u.id) }, u.id)) }) })),
295
+ /* @__PURE__ */ J(ue, { fallback: /* @__PURE__ */ i(fe, {}), children: [
296
+ s && /* @__PURE__ */ i(Ue, { isOpen: s, onCancel: L, onSuccess: _ }),
297
+ C && /* @__PURE__ */ i(He, { isOpen: C, onCancel: P, onSuccess: M }),
298
+ f && S && /* @__PURE__ */ i(Ne, { isOpen: f, resourceId: S.assetId, onCancel: N, onSuccess: k }),
299
+ c && /* @__PURE__ */ i(Ye, { edit: !0, isOpen: c, onCancel: l, onSuccess: r }),
300
+ m && S && /* @__PURE__ */ i(ke, { mode: "update", isOpen: m, resourceId: S.assetId, updateResource: w, onCancel: b, onSuccess: y, children: (v, A, u, z, V) => n === "blog" && me("createPublic", o) && /* @__PURE__ */ i(Re, { appCode: n, isUpdating: A, resource: v, watch: u, setValue: z, register: V }) }),
301
+ I && S && /* @__PURE__ */ i(Se, { isOpen: I, resourceId: S.assetId, shareResource: p, onCancel: x, onSuccess: D, children: n === "blog" ? /* @__PURE__ */ i(Ce, { resource: S, updateResource: w }) : null })
300
302
  ] })
301
303
  ] });
302
304
  }
303
305
  export {
304
- es as default
306
+ We as default
305
307
  };
@@ -2,7 +2,7 @@ import { jsxs as s, jsx as l } from "react/jsx-runtime";
2
2
  import { Modal as a, Button as d } from "@edifice-ui/react";
3
3
  import { createPortal as m } from "react-dom";
4
4
  import { useTranslation as p } from "react-i18next";
5
- import { t as c, v as h, e as u } from "./index2.js";
5
+ import { v as c, w as h, e as u } from "./index2.js";
6
6
  import "react";
7
7
  import "@edifice-ui/icons";
8
8
  import "edifice-ts-client";
@@ -25,7 +25,7 @@ function f({
25
25
  onDelete: o
26
26
  };
27
27
  }
28
- function j({
28
+ function F({
29
29
  isOpen: t,
30
30
  onSuccess: i = () => ({}),
31
31
  onCancel: r = () => ({})
@@ -48,5 +48,5 @@ function j({
48
48
  ] }), document.getElementById("portal"));
49
49
  }
50
50
  export {
51
- j as default
51
+ F as default
52
52
  };
@@ -5,19 +5,19 @@ import { createPortal as T } from "react-dom";
5
5
  import { useTranslation as U } from "react-i18next";
6
6
  import { FOLDER as V } from "edifice-ts-client";
7
7
  import { useForm as _ } from "react-hook-form";
8
- import { j as k, b as z, r as A, s as H } from "./index2.js";
8
+ import { j as k, b as z, s as A, t as H } from "./index2.js";
9
9
  import "@edifice-ui/icons";
10
10
  import "i18next";
11
11
  import "zustand";
12
12
  import "@tanstack/react-query";
13
13
  function P({
14
- edit: o,
14
+ edit: t,
15
15
  onSuccess: e,
16
16
  onClose: s
17
17
  }) {
18
18
  var x;
19
- const l = k(), r = z(), c = A(), f = H(), u = o ? (x = l[0]) == null ? void 0 : x.name : void 0, {
20
- reset: t,
19
+ const l = k(), r = z(), c = A(), f = H(), u = t ? (x = l[0]) == null ? void 0 : x.name : void 0, {
20
+ reset: o,
21
21
  register: p,
22
22
  handleSubmit: n,
23
23
  setFocus: h,
@@ -37,26 +37,26 @@ function P({
37
37
  }) {
38
38
  var C;
39
39
  try {
40
- if (o) {
40
+ if (t) {
41
41
  const i = (C = l[0]) == null ? void 0 : C.parentId, j = l[0].id;
42
42
  await f.mutate({
43
43
  folderId: j,
44
44
  parentId: i,
45
45
  name: y
46
- }), t(), e == null || e();
46
+ }), o(), e == null || e();
47
47
  } else {
48
48
  const i = (r == null ? void 0 : r.id) || V.DEFAULT;
49
49
  await c.mutate({
50
50
  name: y,
51
51
  parentId: i
52
- }), t(), e == null || e();
52
+ }), o(), e == null || e();
53
53
  }
54
54
  } catch (i) {
55
55
  console.error(i);
56
56
  }
57
57
  };
58
58
  function E() {
59
- t(), s();
59
+ o(), s();
60
60
  }
61
61
  return {
62
62
  formId: `createModal_${M}`,
@@ -71,8 +71,8 @@ function P({
71
71
  onSubmit: D
72
72
  };
73
73
  }
74
- function oe({
75
- isOpen: o,
74
+ function te({
75
+ isOpen: t,
76
76
  edit: e,
77
77
  onSuccess: s,
78
78
  onCancel: l
@@ -83,7 +83,7 @@ function oe({
83
83
  isDirty: c,
84
84
  isValid: f,
85
85
  isSubmitting: u,
86
- formId: t,
86
+ formId: o,
87
87
  onSubmit: p,
88
88
  onCancel: n,
89
89
  handleSubmit: h,
@@ -95,10 +95,10 @@ function oe({
95
95
  onClose: l
96
96
  });
97
97
  return B(() => {
98
- o && d("name");
99
- }, [o, d]), o ? /* @__PURE__ */ T(/* @__PURE__ */ b(m, { isOpen: o, onModalClose: n, id: "modal_" + t, children: [
98
+ t && d("name");
99
+ }, [t, d]), t ? /* @__PURE__ */ T(/* @__PURE__ */ b(m, { isOpen: t, onModalClose: n, id: "modal_" + o, children: [
100
100
  /* @__PURE__ */ a(m.Header, { onModalClose: n, children: r(e ? "explorer.rename.folder" : "explorer.create.folder") }),
101
- /* @__PURE__ */ a(m.Body, { children: /* @__PURE__ */ a("form", { id: t, onSubmit: h(p), children: /* @__PURE__ */ b(L, { id: "nameFolder", isRequired: !0, children: [
101
+ /* @__PURE__ */ a(m.Body, { children: /* @__PURE__ */ a("form", { id: o, onSubmit: h(p), children: /* @__PURE__ */ b(L, { id: "nameFolder", isRequired: !0, children: [
102
102
  /* @__PURE__ */ a(w, { children: r("explorer.create.folder.name") }),
103
103
  /* @__PURE__ */ a(R, { type: "text", ...F("name", {
104
104
  required: !0,
@@ -110,10 +110,10 @@ function oe({
110
110
  ] }) }) }),
111
111
  /* @__PURE__ */ b(m.Footer, { children: [
112
112
  /* @__PURE__ */ a(I, { color: "tertiary", onClick: n, type: "button", variant: "ghost", children: r("explorer.cancel") }),
113
- /* @__PURE__ */ a(I, { form: t, type: "submit", color: "primary", variant: "filled", disabled: !c || !f || u, children: r(e ? "explorer.rename" : "explorer.create") })
113
+ /* @__PURE__ */ a(I, { form: o, type: "submit", color: "primary", variant: "filled", disabled: !c || !f || u, children: r(e ? "explorer.rename" : "explorer.create") })
114
114
  ] })
115
115
  ] }), document.getElementById("portal")) : null;
116
116
  }
117
117
  export {
118
- oe as default
118
+ te as default
119
119
  };