@edifice.io/client 2.6.7-develop-pedago.20260930173910 → 2.6.7-develop-integration.20261001195124

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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var P = Object.defineProperty;
2
2
  var I = (n, e, t) => e in n ? P(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var u = (n, e, t) => I(n, typeof e != "symbol" ? e + "" : e, t);
3
+ var a = (n, e, t) => I(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import axios from "axios";
5
5
  import { MimeTypeUtils } from "@edifice.io/utilities";
6
6
  import { UAParser } from "ua-parser-js";
@@ -100,8 +100,8 @@ const ERROR_CODE = {
100
100
  // TODO compléter
101
101
  }, C = class C {
102
102
  constructor(e) {
103
- u(this, "name");
104
- u(this, "listeners", /* @__PURE__ */ new Set());
103
+ a(this, "name");
104
+ a(this, "listeners", /* @__PURE__ */ new Set());
105
105
  this.name = e;
106
106
  }
107
107
  /**
@@ -139,11 +139,11 @@ const ERROR_CODE = {
139
139
  this.listeners.clear(), C.channels.delete(this.name);
140
140
  }
141
141
  };
142
- u(C, "channels", /* @__PURE__ */ new Map());
142
+ a(C, "channels", /* @__PURE__ */ new Map());
143
143
  let SimpleChannel = C;
144
144
  class Subscription {
145
145
  constructor(e, t) {
146
- u(this, "revoke");
146
+ a(this, "revoke");
147
147
  this._channel = e, this.revoke = this.setReceiver((s) => t == null ? void 0 : t(s));
148
148
  }
149
149
  setReceiver(e) {
@@ -160,7 +160,7 @@ class Subject {
160
160
  /* We maintain channels for sending messages.
161
161
  * Receiving channels are instantiated per subscription.
162
162
  */
163
- u(this, "publishChannels", /* @__PURE__ */ new Map());
163
+ a(this, "publishChannels", /* @__PURE__ */ new Map());
164
164
  }
165
165
  getChannelName(e) {
166
166
  return "Subject:" + e;
@@ -195,9 +195,9 @@ const ASYNC_DATA_NAME = {
195
195
  class Promisified {
196
196
  constructor() {
197
197
  //-------------------------------------
198
- u(this, "_resolution");
199
- u(this, "_rejection");
200
- u(this, "_promise", new Promise((e, t) => {
198
+ a(this, "_resolution");
199
+ a(this, "_rejection");
200
+ a(this, "_promise", new Promise((e, t) => {
201
201
  this._resolution = e, this._rejection = t;
202
202
  }));
203
203
  }
@@ -214,8 +214,8 @@ class Promisified {
214
214
  class NotifyFramework {
215
215
  constructor() {
216
216
  //-------------------------------------
217
- u(this, "promises", {});
218
- u(this, "subject", new Subject());
217
+ a(this, "promises", {});
218
+ a(this, "subject", new Subject());
219
219
  }
220
220
  asyncData(e) {
221
221
  return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
@@ -246,8 +246,8 @@ const notify = new NotifyFramework(), loadedScripts$1 = {};
246
246
  class Http {
247
247
  constructor(e) {
248
248
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
249
- u(this, "axios");
250
- u(this, "_latestResponse");
249
+ a(this, "axios");
250
+ a(this, "_latestResponse");
251
251
  this.axios = axios.create(e);
252
252
  }
253
253
  setCdn(e) {
@@ -327,8 +327,8 @@ class Http {
327
327
  const r = s ?? "exports", i = this.toAxiosConfig(t);
328
328
  return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
329
329
  try {
330
- const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
331
- return Function(a)();
330
+ const u = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
331
+ return Function(u)();
332
332
  } catch {
333
333
  return o;
334
334
  }
@@ -344,7 +344,7 @@ class Http {
344
344
  }
345
345
  class TransportFramework {
346
346
  constructor() {
347
- u(this, "_http", new Http());
347
+ a(this, "_http", new Http());
348
348
  }
349
349
  get http() {
350
350
  return this._http;
@@ -363,11 +363,11 @@ class ConfigurationFrameworkFactory {
363
363
  const http$2 = transport.http;
364
364
  class Session {
365
365
  constructor() {
366
- u(this, "_me", null);
367
- u(this, "_currentLanguage", "");
368
- u(this, "_notLoggedIn", !0);
369
- u(this, "_description");
370
- u(this, "_profile");
366
+ a(this, "_me", null);
367
+ a(this, "_currentLanguage", "");
368
+ a(this, "_notLoggedIn", !0);
369
+ a(this, "_description");
370
+ a(this, "_profile");
371
371
  }
372
372
  get currentLanguage() {
373
373
  return this._currentLanguage;
@@ -412,7 +412,7 @@ class Session {
412
412
  hasRight(e, t) {
413
413
  if (t === "owner")
414
414
  return e.owner && e.owner.userId === this._me.userId;
415
- const s = t.right || t, i = e.shared.filter((a) => (this._me.groupsIds || []).indexOf(a.groupId) !== -1 || a.userId === this._me.userId).find((a) => a[s] || a.manager) !== void 0, o = t.workflow ? this.hasWorkflow(t.workflow) : !0;
415
+ const s = t.right || t, i = e.shared.filter((u) => (this._me.groupsIds || []).indexOf(u.groupId) !== -1 || u.userId === this._me.userId).find((u) => u[s] || u.manager) !== void 0, o = t.workflow ? this.hasWorkflow(t.workflow) : !0;
416
416
  return i && o;
417
417
  }
418
418
  ////////////////////////////////////////////////////////// Storage management
@@ -485,7 +485,7 @@ class Session {
485
485
  }
486
486
  class SessionFramework {
487
487
  constructor() {
488
- u(this, "session", new Session());
488
+ a(this, "session", new Session());
489
489
  }
490
490
  initialize() {
491
491
  return this.session.initialize();
@@ -509,22 +509,22 @@ class SessionFramework {
509
509
  const session = new SessionFramework();
510
510
  class Theme {
511
511
  constructor() {
512
- u(this, "_conf");
513
- u(this, "_loaded");
512
+ a(this, "_conf");
513
+ a(this, "_loaded");
514
514
  // legacy (readonly)
515
- u(this, "skinName", "");
516
- u(this, "themeName", "");
517
- u(this, "skin", "raw");
518
- u(this, "themeUrl", "/assets/themes/raw/default/");
519
- u(this, "templateOverrides", {});
520
- u(this, "portalTemplate", "/assets/themes/raw/portal.html");
521
- u(this, "basePath", "");
522
- u(this, "logoutCallback", "");
523
- u(this, "skins", []);
524
- u(this, "is1D", !1);
525
- u(this, "is2D", !1);
526
- u(this, "_onSkinReady", notify.onSkinReady());
527
- u(this, "_onOverrideReady", notify.onOverridesReady());
515
+ a(this, "skinName", "");
516
+ a(this, "themeName", "");
517
+ a(this, "skin", "raw");
518
+ a(this, "themeUrl", "/assets/themes/raw/default/");
519
+ a(this, "templateOverrides", {});
520
+ a(this, "portalTemplate", "/assets/themes/raw/portal.html");
521
+ a(this, "basePath", "");
522
+ a(this, "logoutCallback", "");
523
+ a(this, "skins", []);
524
+ a(this, "is1D", !1);
525
+ a(this, "is2D", !1);
526
+ a(this, "_onSkinReady", notify.onSkinReady());
527
+ a(this, "_onOverrideReady", notify.onOverridesReady());
528
528
  }
529
529
  initialize(e) {
530
530
  return notify.onSessionReady().promise.then(() => this.load(e));
@@ -858,9 +858,9 @@ class Idiom {
858
858
  const i = new Promisified();
859
859
  promises$1[t] = i.promise;
860
860
  const o = {};
861
- e && (o["Accept-Language"] = e), transport.http.get(t, { headers: o }).then((a) => {
862
- Object.assign(bundle$1, a), typeof s == "function" && s(), i.resolve();
863
- }).catch((a) => {
861
+ e && (o["Accept-Language"] = e), transport.http.get(t, { headers: o }).then((u) => {
862
+ Object.assign(bundle$1, u), typeof s == "function" && s(), i.resolve();
863
+ }).catch((u) => {
864
864
  typeof s == "function" && s(), i.reject();
865
865
  });
866
866
  }
@@ -896,7 +896,7 @@ class Idiom {
896
896
  class UserPreferences {
897
897
  constructor() {
898
898
  //-------------------------------------
899
- u(this, "data", {});
899
+ a(this, "data", {});
900
900
  }
901
901
  get(e) {
902
902
  return this.data[e];
@@ -923,10 +923,10 @@ class UserPreferences {
923
923
  class User {
924
924
  constructor() {
925
925
  //-------------------------------------
926
- u(this, "_me", null);
927
- u(this, "_keepOpenOnLogout", !1);
928
- u(this, "_preferences", new UserPreferences());
929
- u(this, "_bookmarkedApps", []);
926
+ a(this, "_me", null);
927
+ a(this, "_keepOpenOnLogout", !1);
928
+ a(this, "_preferences", new UserPreferences());
929
+ a(this, "_bookmarkedApps", []);
930
930
  }
931
931
  get keepOpenOnLogout() {
932
932
  return this._keepOpenOnLogout;
@@ -970,7 +970,7 @@ class User {
970
970
  });
971
971
  let r = !0;
972
972
  const i = [];
973
- s.bookmarks.forEach((o, a) => {
973
+ s.bookmarks.forEach((o, u) => {
974
974
  const c = this._me.apps.find((l) => l.name === o);
975
975
  if (c) {
976
976
  const l = Object.assign({}, c);
@@ -978,8 +978,8 @@ class User {
978
978
  } else
979
979
  i.push(o), r = !1;
980
980
  }), i.forEach((o) => {
981
- const a = s.bookmarks.indexOf(o);
982
- a !== -1 && s.bookmarks.splice(a, 1);
981
+ const u = s.bookmarks.indexOf(o);
982
+ u !== -1 && s.bookmarks.splice(u, 1);
983
983
  }), r || transport.http.putJson("/userbook/preference/apps", s);
984
984
  });
985
985
  }
@@ -1000,9 +1000,9 @@ const http$1 = transport == null ? void 0 : transport.http;
1000
1000
  class AppConf {
1001
1001
  constructor() {
1002
1002
  //-------------------------------------
1003
- u(this, "_publicConf", {});
1004
- u(this, "_currentApp");
1005
- u(this, "_appConf", {});
1003
+ a(this, "_publicConf", {});
1004
+ a(this, "_currentApp");
1005
+ a(this, "_appConf", {});
1006
1006
  }
1007
1007
  /**
1008
1008
  * Get the currently initialized App.
@@ -1040,8 +1040,8 @@ class AppConf {
1040
1040
  class Analytics {
1041
1041
  constructor() {
1042
1042
  //-------------------------------------
1043
- u(this, "_status", "void");
1044
- u(this, "_params");
1043
+ a(this, "_status", "void");
1044
+ a(this, "_params");
1045
1045
  }
1046
1046
  get status() {
1047
1047
  return this._status;
@@ -1082,9 +1082,9 @@ class Analytics {
1082
1082
  const t = await notify.onSessionReady().promise, s = session.session.description;
1083
1083
  let r;
1084
1084
  for (const l of t.structures) {
1085
- const h = e.structureMap[l];
1086
- if (h && h.collectiviteId && h.UAI) {
1087
- r = h;
1085
+ const p = e.structureMap[l];
1086
+ if (p && p.collectiviteId && p.UAI) {
1087
+ r = p;
1088
1088
  break;
1089
1089
  }
1090
1090
  }
@@ -1095,11 +1095,11 @@ class Analytics {
1095
1095
  if (!i) return;
1096
1096
  const o = i.xiti;
1097
1097
  if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
1098
- function a(l) {
1099
- let h = "";
1100
- for (let E = 0; E < l.length; E++)
1101
- h += l.charCodeAt(E);
1102
- return h;
1098
+ function u(l) {
1099
+ let p = "";
1100
+ for (let d = 0; d < l.length; d++)
1101
+ p += l.charCodeAt(d);
1102
+ return p;
1103
1103
  }
1104
1104
  const c = {
1105
1105
  Student: "ELEVE",
@@ -1118,7 +1118,7 @@ class Analytics {
1118
1118
  PROJET: r.projetId ? r.projetId : e.ID_PROJET,
1119
1119
  EXPLOITANT: e.ID_EXPLOITANT,
1120
1120
  PLATFORME: r.plateformeId ? r.plateformeId : e.ID_PLATEFORME,
1121
- ID_PERSO: a(t.userId),
1121
+ ID_PERSO: u(t.userId),
1122
1122
  PROFILE: s.profiles && s.profiles.length > 0 ? c[s.profiles[0]] ?? "" : ""
1123
1123
  };
1124
1124
  }
@@ -1146,12 +1146,12 @@ function detectDevice() {
1146
1146
  if (typeof window > "u")
1147
1147
  return { osName: "", osVersion: "", deviceType: "", deviceName: "" };
1148
1148
  const n = UAParser(), e = isPad(), t = n.device.vendor || "", s = n.device.model || "", r = t && s ? `${t} ${s}` : s || t || "Unknown";
1149
- let i = n.os.name || "Unknown", o = n.device.type || (e ? "tablet" : "desktop"), a = r;
1150
- return e && i.toLowerCase() == "macos" && (i = "iPadOS", o = "tablet", a = "iPad"), {
1149
+ let i = n.os.name || "Unknown", o = n.device.type || (e ? "tablet" : "desktop"), u = r;
1150
+ return e && i.toLowerCase() == "macos" && (i = "iPadOS", o = "tablet", u = "iPad"), {
1151
1151
  osName: i,
1152
1152
  osVersion: n.os.version || "Unknown",
1153
1153
  deviceType: o,
1154
- deviceName: a
1154
+ deviceName: u
1155
1155
  };
1156
1156
  }
1157
1157
  function readDeviceCookies() {
@@ -1177,7 +1177,7 @@ function setDeviceCookies() {
1177
1177
  class ConfigurationFramework {
1178
1178
  constructor() {
1179
1179
  //-------------------------------------
1180
- u(this, "Platform", {
1180
+ a(this, "Platform", {
1181
1181
  deploymentTag: "",
1182
1182
  cdnDomain: "",
1183
1183
  apps: new AppConf(),
@@ -1186,16 +1186,16 @@ class ConfigurationFramework {
1186
1186
  idiom: new Idiom(),
1187
1187
  listLanguages: () => transport.http.get("/languages")
1188
1188
  });
1189
- u(this, "School", {
1189
+ a(this, "School", {
1190
1190
  //apps; -> pinnedApps;
1191
1191
  });
1192
- u(this, "User", new User());
1192
+ a(this, "User", new User());
1193
1193
  setDeviceCookies();
1194
1194
  }
1195
1195
  async initialize(e, t) {
1196
1196
  if (!e) {
1197
- const r = (l) => (l < 10 ? "0" : "") + l.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
1198
- e = `${o}${r(a)}${r(c)}`;
1197
+ const r = (l) => (l < 10 ? "0" : "") + l.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), u = i.getMonth() + 1, c = i.getDate();
1198
+ e = `${o}${r(u)}${r(c)}`;
1199
1199
  }
1200
1200
  const s = e;
1201
1201
  this.Platform.deploymentTag = e, typeof t == "string" && t.length > 0 && (this.Platform.cdnDomain = t), transport.http.setCdn(this.Platform.cdnDomain), await Promise.all([
@@ -1237,8 +1237,8 @@ var _;
1237
1237
  const me = (_ = session == null ? void 0 : session.session) == null ? void 0 : _.user;
1238
1238
  class Notification {
1239
1239
  constructor(e) {
1240
- u(this, "_id");
1241
- u(this, "model");
1240
+ a(this, "_id");
1241
+ a(this, "model");
1242
1242
  e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
1243
1243
  }
1244
1244
  isUnread() {
@@ -1258,14 +1258,14 @@ class Notification {
1258
1258
  class TimelineApp {
1259
1259
  constructor() {
1260
1260
  //-------------------------------------
1261
- u(this, "_notifications", []);
1262
- u(this, "_notificationTypes", []);
1261
+ a(this, "_notifications", []);
1262
+ a(this, "_notificationTypes", []);
1263
1263
  // ex: ["BLOG"]
1264
- u(this, "_flashMessages", []);
1265
- u(this, "_pageNumber", 0);
1266
- u(this, "_lastPage", !1);
1267
- u(this, "_loading", !1);
1268
- u(this, "showMine", !1);
1264
+ a(this, "_flashMessages", []);
1265
+ a(this, "_pageNumber", 0);
1266
+ a(this, "_lastPage", !1);
1267
+ a(this, "_loading", !1);
1268
+ a(this, "showMine", !1);
1269
1269
  }
1270
1270
  get notifications() {
1271
1271
  return this._notifications;
@@ -1324,7 +1324,7 @@ class TimelineApp {
1324
1324
  if (r.number && r.results) {
1325
1325
  const i = r.results.filter(
1326
1326
  (o) => this._notifications.findIndex(
1327
- (a) => a._id === o._id
1327
+ (u) => u._id === o._id
1328
1328
  ) === -1
1329
1329
  ).map((o) => new Notification(o));
1330
1330
  this._notifications = this._notifications.concat(i), this._pageNumber++;
@@ -1355,7 +1355,97 @@ const ReactionTypes = [
1355
1355
  "REACTION_2",
1356
1356
  "REACTION_3",
1357
1357
  "REACTION_4"
1358
- ];
1358
+ ], GOOGLE_DRIVE_FOLDER_MIME_TYPE = "application/vnd.google-apps.folder";
1359
+ function toGoogleDriveDocument(n) {
1360
+ return {
1361
+ id: n.id,
1362
+ name: n.name,
1363
+ ownerDisplayName: n.ownerDisplayName,
1364
+ contentType: n.mimeType,
1365
+ size: n.size,
1366
+ isFolder: n.mimeType === GOOGLE_DRIVE_FOLDER_MIME_TYPE,
1367
+ lastModified: n.modifiedTime,
1368
+ shared: n.shared
1369
+ };
1370
+ }
1371
+ class GoogleDriveCopyError extends Error {
1372
+ constructor(e, t, s) {
1373
+ super(e), this.copied = t, this.failures = s, this.name = "GoogleDriveCopyError";
1374
+ }
1375
+ }
1376
+ class GoogleDriveService {
1377
+ constructor(e) {
1378
+ this.context = e;
1379
+ }
1380
+ get http() {
1381
+ return this.context.http();
1382
+ }
1383
+ /**
1384
+ * List a user's Google Drive documents and folders inside a given folder.
1385
+ *
1386
+ * Google Drive addresses its entries by opaque id, not by path: `parentId` is
1387
+ * the id of the folder to list. The query param is nonetheless named `path`,
1388
+ * as the backend kept the name it uses for Nextcloud.
1389
+ *
1390
+ * @param userId - the id of the user whose files are listed.
1391
+ * @param parentId - id of the folder to list; the Drive root when omitted.
1392
+ */
1393
+ async listDocuments(e, t) {
1394
+ return (await this.http.get(
1395
+ `/googledrive/files/user/${e}`,
1396
+ { queryParams: t ? { path: t } : void 0 }
1397
+ )).data.map(toGoogleDriveDocument);
1398
+ }
1399
+ /**
1400
+ * Copy Google Drive documents into the entcore workspace.
1401
+ *
1402
+ * @param userId - the id of the user whose files are copied.
1403
+ * @param ids - Drive ids of the documents to copy.
1404
+ * @param parentId - the workspace folder to copy into; user's root when omitted.
1405
+ * @param params.application - the application the documents are added from.
1406
+ * @param params.visibility - "protected" files the documents under the
1407
+ * documents added from applications, the way an upload does.
1408
+ * @throws GoogleDriveCopyError when the backend reports at least one failure.
1409
+ */
1410
+ async copyDocumentToWorkspace(e, t, s, r) {
1411
+ const i = t.map((d) => `id=${encodeURIComponent(d)}`).join("&"), u = (await this.http.put(
1412
+ `/googledrive/files/user/${e}/copy/workspace?${i}`,
1413
+ void 0,
1414
+ {
1415
+ queryParams: {
1416
+ ...s ? { parentId: s } : {},
1417
+ ...r != null && r.application ? { application: r.application } : {},
1418
+ ...(r == null ? void 0 : r.visibility) === "protected" ? { protected: !0 } : {}
1419
+ }
1420
+ }
1421
+ )).data ?? [], c = u.map((d) => d.workspace).filter((d) => !!(d != null && d._id)), l = new Set(u.map((d) => d.id)), p = [
1422
+ ...u.filter((d) => {
1423
+ var h;
1424
+ return d.status === "error" || !((h = d.workspace) != null && h._id);
1425
+ }).map(({ id: d, message: h }) => ({ id: d, message: h })),
1426
+ ...t.filter((d) => !l.has(d)).map((d) => ({ id: d, message: void 0 }))
1427
+ ];
1428
+ if (p.length > 0)
1429
+ throw new GoogleDriveCopyError(
1430
+ `Failed to copy ${p.length} of ${t.length} Google Drive document(s) to the workspace`,
1431
+ c,
1432
+ p
1433
+ );
1434
+ return c;
1435
+ }
1436
+ /**
1437
+ * Build the URL to download/preview a Google Drive document.
1438
+ * There is no dedicated thumbnail endpoint on the backend, so this is also
1439
+ * used as an image preview source for image documents.
1440
+ * @param userId - the id of the user who owns the file.
1441
+ * @param doc - the document to build the URL for.
1442
+ */
1443
+ getFileUrl(e, t) {
1444
+ return `/googledrive/files/user/${e}/file/${encodeURIComponent(
1445
+ t.id
1446
+ )}/download?isFolder=${t.isFolder}`;
1447
+ }
1448
+ }
1359
1449
  class NotifyFrameworkFactory {
1360
1450
  static instance() {
1361
1451
  return notify;
@@ -1414,7 +1504,7 @@ const m = class m {
1414
1504
  //
1415
1505
  // PROTECTED HELPERS
1416
1506
  //
1417
- u(this, "checkHttpResponse", (e) => {
1507
+ a(this, "checkHttpResponse", (e) => {
1418
1508
  if (this.http.latestResponse.status >= 300)
1419
1509
  throw this.http.latestResponse.statusText;
1420
1510
  return e;
@@ -1632,22 +1722,22 @@ const m = class m {
1632
1722
  //
1633
1723
  // STATIC REGISTRY
1634
1724
  //
1635
- u(m, "registry", new ServiceRegistry()), // Expose some useful functions
1636
- u(m, "register", m.registry.register.bind(m.registry)), u(m, "findService", m.registry.findService.bind(m.registry)), u(m, "findMainService", m.registry.findMainService.bind(m.registry)), u(m, "isRegistered", m.registry.isRegistered.bind(m.registry));
1725
+ a(m, "registry", new ServiceRegistry()), // Expose some useful functions
1726
+ a(m, "register", m.registry.register.bind(m.registry)), a(m, "findService", m.registry.findService.bind(m.registry)), a(m, "findMainService", m.registry.findMainService.bind(m.registry)), a(m, "isRegistered", m.registry.isRegistered.bind(m.registry));
1637
1727
  let ResourceService = m;
1638
1728
  const APP$3 = "collaborativeeditor", RESOURCE$3 = "collaborativeeditor";
1639
1729
  class CollaborativeEditorResourceService extends ResourceService {
1640
1730
  async create(e) {
1641
- const { name: t, description: s, thumbnail: r, folder: i } = e, o = r ? await this.getThumbnailPath(r) : "", a = await this.http.post("/collaborativeeditor", {
1731
+ const { name: t, description: s, thumbnail: r, folder: i } = e, o = r ? await this.getThumbnailPath(r) : "", u = await this.http.post("/collaborativeeditor", {
1642
1732
  name: t,
1643
1733
  description: s,
1644
1734
  thumbnail: o,
1645
1735
  folder: i
1646
1736
  });
1647
- return this.checkHttpResponse(a), a;
1737
+ return this.checkHttpResponse(u), u;
1648
1738
  }
1649
1739
  async update(e) {
1650
- const { name: t, description: s, thumbnail: r, entId: i } = e, o = await this.getThumbnailPath(r), a = await this.http.put(
1740
+ const { name: t, description: s, thumbnail: r, entId: i } = e, o = await this.getThumbnailPath(r), u = await this.http.put(
1651
1741
  `/collaborativeeditor/${i}`,
1652
1742
  {
1653
1743
  name: t,
@@ -1655,7 +1745,7 @@ class CollaborativeEditorResourceService extends ResourceService {
1655
1745
  thumbnail: o
1656
1746
  }
1657
1747
  );
1658
- return this.checkHttpResponse(a), { thumbnail: o, entId: i };
1748
+ return this.checkHttpResponse(u), { thumbnail: o, entId: i };
1659
1749
  }
1660
1750
  getResourceType() {
1661
1751
  return RESOURCE$3;
@@ -1910,9 +2000,9 @@ class AnalyticsService {
1910
2000
  let r;
1911
2001
  if (!(t != null && t.structures)) return;
1912
2002
  for (const l of t.structures) {
1913
- const h = n.structureMap[l];
1914
- if (h && h.collectiviteId && h.UAI) {
1915
- r = h;
2003
+ const p = n.structureMap[l];
2004
+ if (p && p.collectiviteId && p.UAI) {
2005
+ r = p;
1916
2006
  break;
1917
2007
  }
1918
2008
  }
@@ -1921,11 +2011,11 @@ class AnalyticsService {
1921
2011
  if (!i) return;
1922
2012
  const o = i.xiti;
1923
2013
  if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
1924
- function a(l) {
1925
- let h = "";
1926
- for (let E = 0; E < l.length; E++)
1927
- h += l.charCodeAt(E);
1928
- return h;
2014
+ function u(l) {
2015
+ let p = "";
2016
+ for (let d = 0; d < l.length; d++)
2017
+ p += l.charCodeAt(d);
2018
+ return p;
1929
2019
  }
1930
2020
  const c = {
1931
2021
  Student: "ELEVE",
@@ -1944,7 +2034,7 @@ class AnalyticsService {
1944
2034
  PROJET: r.projetId ? r.projetId : n.ID_PROJET,
1945
2035
  EXPLOITANT: n.ID_EXPLOITANT,
1946
2036
  PLATFORME: r.plateformeId ? r.plateformeId : n.ID_PLATEFORME,
1947
- ID_PERSO: a(t.userId),
2037
+ ID_PERSO: u(t.userId),
1948
2038
  PROFILE: s && s.length > 0 ? c[s[0]] ?? "" : ""
1949
2039
  };
1950
2040
  }
@@ -2163,25 +2253,25 @@ class ConfService {
2163
2253
  conf: t,
2164
2254
  publicTheme: s
2165
2255
  }) {
2166
- var E;
2167
- const r = await this.http.get("/theme"), i = (E = t == null ? void 0 : t.overriding) == null ? void 0 : E.find(
2168
- (p) => (
2256
+ var d;
2257
+ const r = await this.http.get("/theme"), i = (d = t == null ? void 0 : t.overriding) == null ? void 0 : d.find(
2258
+ (h) => (
2169
2259
  // Fix #WB2-2660:
2170
2260
  // If Public access => get the neo theme
2171
2261
  // Else get the theme from the user preference
2172
- s ? p.parent === "theme-open-ent" && p.bootstrapVersion === "ode-bootstrap-neo" : p.child === (r == null ? void 0 : r.themeName)
2262
+ s ? h.parent === "theme-open-ent" && h.bootstrapVersion === "ode-bootstrap-neo" : h.child === (r == null ? void 0 : r.themeName)
2173
2263
  )
2174
- ), o = s ? "default" : (r == null ? void 0 : r.skinName) || (i == null ? void 0 : i.skins[0]), a = (r == null ? void 0 : r.skin) || `/assets/themes/${i == null ? void 0 : i.child}/skins/${o}/`, c = i == null ? void 0 : i.skins, l = i == null ? void 0 : i.bootstrapVersion.split("-").slice(-1)[0], h = (i == null ? void 0 : i.parent) === "panda";
2264
+ ), o = s ? "default" : (r == null ? void 0 : r.skinName) || (i == null ? void 0 : i.skins[0]), u = (r == null ? void 0 : r.skin) || `/assets/themes/${i == null ? void 0 : i.child}/skins/${o}/`, c = i == null ? void 0 : i.skins, l = i == null ? void 0 : i.bootstrapVersion.split("-").slice(-1)[0], p = (i == null ? void 0 : i.parent) === "panda";
2175
2265
  return {
2176
- basePath: `${this.cdnDomain}${a}../../`,
2266
+ basePath: `${this.cdnDomain}${u}../../`,
2177
2267
  bootstrapVersion: l,
2178
- is1d: h,
2268
+ is1d: p,
2179
2269
  logoutCallback: (r == null ? void 0 : r.logoutCallback) || "",
2180
2270
  skin: i == null ? void 0 : i.child,
2181
2271
  skinName: o,
2182
2272
  skins: c,
2183
2273
  themeName: i == null ? void 0 : i.child,
2184
- themeUrl: a,
2274
+ themeUrl: u,
2185
2275
  npmTheme: (i == null ? void 0 : i.npmTheme) ?? void 0,
2186
2276
  uiOverrides: i == null ? void 0 : i.uiOverrides
2187
2277
  };
@@ -2198,7 +2288,7 @@ class ConfService {
2198
2288
  const SEND_ALL = "*";
2199
2289
  class WebBroker {
2200
2290
  constructor(e) {
2201
- u(this, "subscription");
2291
+ a(this, "subscription");
2202
2292
  this.odeServices = e;
2203
2293
  }
2204
2294
  get http() {
@@ -2230,10 +2320,10 @@ class WebBroker {
2230
2320
  }
2231
2321
  class DataService {
2232
2322
  constructor(e) {
2233
- u(this, "_webBroker");
2234
- u(this, "app");
2235
- u(this, "user");
2236
- u(this, "profile");
2323
+ a(this, "_webBroker");
2324
+ a(this, "app");
2325
+ a(this, "user");
2326
+ a(this, "profile");
2237
2327
  this.odeServices = e;
2238
2328
  }
2239
2329
  get conf() {
@@ -2267,7 +2357,7 @@ class DataService {
2267
2357
  addUserInfos(e) {
2268
2358
  return this.user && (e.userId = this.user.userId, e.structure = this.user.structureNames[0]), this.profile && (e.profil = this.profile[0]), e;
2269
2359
  }
2270
- trackVideoSave(e, t, s, r, i, o, a) {
2360
+ trackVideoSave(e, t, s, r, i, o, u) {
2271
2361
  const c = this.addUserInfos({
2272
2362
  "event-type": "VIDEO_SAVE",
2273
2363
  module: this.app || "video",
@@ -2278,7 +2368,7 @@ class DataService {
2278
2368
  source: r ? "CAPTURED" : "UPLOADED",
2279
2369
  url: i
2280
2370
  });
2281
- a && (c.device_type = a), this.trackWebEvent(c);
2371
+ u && (c.device_type = u), this.trackWebEvent(c);
2282
2372
  }
2283
2373
  trackVideoRead(e, t, s, r, i) {
2284
2374
  const o = this.addUserInfos({
@@ -2346,14 +2436,14 @@ class DirectoryService {
2346
2436
  id: s,
2347
2437
  displayName: r,
2348
2438
  notVisibleCount: o,
2349
- groups: t.map(({ name: a, id: c, nbUsers: l }) => ({
2439
+ groups: t.map(({ name: u, id: c, nbUsers: l }) => ({
2350
2440
  nbUsers: l,
2351
- displayName: a,
2441
+ displayName: u,
2352
2442
  id: c
2353
2443
  })),
2354
- users: i.map(({ displayName: a, id: c, profile: l }) => ({
2444
+ users: i.map(({ displayName: u, id: c, profile: l }) => ({
2355
2445
  profile: l,
2356
- displayName: a,
2446
+ displayName: u,
2357
2447
  // these info are missing from api
2358
2448
  firstName: "",
2359
2449
  lastName: "",
@@ -2368,9 +2458,9 @@ class DirectoryService {
2368
2458
  users: r
2369
2459
  }) {
2370
2460
  this.cache.clearCache("/directory/sharebookmark/all");
2371
- const i = r.map((p) => typeof p == "string" ? p : p.id), o = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
2372
- if (typeof p == "string") {
2373
- const { displayName: y, groups: d, id: g, notVisibleCount: A, users: f } = await this.getBookMarkById(p), w = f.map((D) => D.id), F = d.map((D) => D.id);
2461
+ const i = r.map((h) => typeof h == "string" ? h : h.id), o = s.map((h) => typeof h == "string" ? h : h.id), u = t.map(async (h) => {
2462
+ if (typeof h == "string") {
2463
+ const { displayName: y, groups: E, id: g, notVisibleCount: A, users: f } = await this.getBookMarkById(h), w = f.map((D) => D.id), F = E.map((D) => D.id);
2374
2464
  return {
2375
2465
  displayName: y,
2376
2466
  id: g,
@@ -2378,19 +2468,19 @@ class DirectoryService {
2378
2468
  members: [...F, ...w]
2379
2469
  };
2380
2470
  } else
2381
- return Promise.resolve(p);
2382
- }), l = (await Promise.all(a)).map((p) => p.members).reduce((p, y) => [...p, ...y], []), h = {
2471
+ return Promise.resolve(h);
2472
+ }), l = (await Promise.all(u)).map((h) => h.members).reduce((h, y) => [...h, ...y], []), p = {
2383
2473
  name: e,
2384
2474
  members: [...i, ...o, ...l]
2385
- }, { id: E } = await this.http.postJson(
2475
+ }, { id: d } = await this.http.postJson(
2386
2476
  "/directory/sharebookmark",
2387
- h
2477
+ p
2388
2478
  );
2389
2479
  return {
2390
- id: E,
2480
+ id: d,
2391
2481
  displayName: e,
2392
2482
  notVisibleCount: 0,
2393
- members: h.members
2483
+ members: p.members
2394
2484
  };
2395
2485
  }
2396
2486
  }
@@ -2429,10 +2519,10 @@ class EmbedderService {
2429
2519
  urlIsFromPattern(e, t) {
2430
2520
  const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
2431
2521
  let i = !0;
2432
- const o = t.match(s) || [], a = [];
2433
- return (t.match(r) || []).forEach((l, h) => {
2434
- l.includes("ignore") || a.push(o[h]);
2435
- }), a.forEach((l) => {
2522
+ const o = t.match(s) || [], u = [];
2523
+ return (t.match(r) || []).forEach((l, p) => {
2524
+ l.includes("ignore") || u.push(o[p]);
2525
+ }), u.forEach((l) => {
2436
2526
  if (!e.includes(l)) {
2437
2527
  i = !1;
2438
2528
  return;
@@ -2463,17 +2553,17 @@ class EmbedderService {
2463
2553
  if (this.urlIsFromPattern(t, s)) {
2464
2554
  const r = new RegExp("{[a-zA-Z0-9_.]+}", "g"), i = s.match(r) || [];
2465
2555
  let o = e.embed;
2466
- for (const a of i) {
2467
- let c = s.split(a)[0];
2556
+ for (const u of i) {
2557
+ let c = s.split(u)[0];
2468
2558
  const l = c.split("}");
2469
2559
  l.length > 1 && (c = l[l.length - 1]);
2470
- let h = t.split(c)[1];
2471
- if (!h)
2560
+ let p = t.split(c)[1];
2561
+ if (!p)
2472
2562
  continue;
2473
- const E = s.split(a)[1].split("{")[0];
2474
- E && (h = h.split(E)[0]);
2475
- const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
2476
- o = o.replace(p, h);
2563
+ const d = s.split(u)[1].split("{")[0];
2564
+ d && (p = p.split(d)[0]);
2565
+ const h = new RegExp("\\" + u.replace(/}/, "\\}"), "g");
2566
+ o = o.replace(h, p);
2477
2567
  }
2478
2568
  return o;
2479
2569
  }
@@ -2727,9 +2817,9 @@ class IdiomService {
2727
2817
  const i = new Promisified();
2728
2818
  promises[t] = i.promise;
2729
2819
  const o = {};
2730
- e && (o["Accept-Language"] = e), this.http.get(t, { headers: o }).then((a) => {
2731
- Object.assign(bundle, a), typeof s == "function" && s(), i.resolve();
2732
- }).catch((a) => {
2820
+ e && (o["Accept-Language"] = e), this.http.get(t, { headers: o }).then((u) => {
2821
+ Object.assign(bundle, u), typeof s == "function" && s(), i.resolve();
2822
+ }).catch((u) => {
2733
2823
  typeof s == "function" && s(), i.reject();
2734
2824
  });
2735
2825
  }
@@ -2762,6 +2852,89 @@ class IdiomService {
2762
2852
  return e;
2763
2853
  }
2764
2854
  }
2855
+ function toRelativePath(n, e) {
2856
+ const t = `/remote.php/dav/files/${e}`, s = n.startsWith(t) ? n.slice(t.length) : n;
2857
+ return decodeURIComponent(s || "/");
2858
+ }
2859
+ function toNextcloudDocument(n, e) {
2860
+ return {
2861
+ path: toRelativePath(n.path, e),
2862
+ name: decodeURIComponent(n.displayname),
2863
+ ownerDisplayName: n.ownerDisplayName,
2864
+ contentType: n.contentType,
2865
+ size: n.size,
2866
+ favorite: n.favorite,
2867
+ etag: n.etag,
2868
+ fileId: n.fileId,
2869
+ isFolder: n.isFolder,
2870
+ lastModified: n.lastModified
2871
+ };
2872
+ }
2873
+ class NextcloudService {
2874
+ constructor(e) {
2875
+ this.context = e;
2876
+ }
2877
+ get http() {
2878
+ return this.context.http();
2879
+ }
2880
+ /**
2881
+ * List a user's Nextcloud documents and folders at a given path.
2882
+ * @param userId - the id of the user whose files are listed.
2883
+ * @param path - path to list, relative to the user's Nextcloud root; root when omitted.
2884
+ */
2885
+ async listDocuments(e, t) {
2886
+ return (await this.http.get(
2887
+ `/nextcloud/files/user/${e}`,
2888
+ { queryParams: t ? { path: t } : void 0 }
2889
+ )).data.map((r) => toNextcloudDocument(r, e));
2890
+ }
2891
+ /**
2892
+ * Copy Nextcloud documents into the entcore workspace.
2893
+ * @param userId - the id of the user whose files are copied.
2894
+ * @param paths - paths of the documents to copy, relative to the user's Nextcloud root.
2895
+ * @param parentId - the workspace folder to copy into; user's root when omitted.
2896
+ * @param params.application - the application the documents are added from.
2897
+ * @param params.visibility - "protected" files the documents under the
2898
+ * documents added from applications, the way an upload does.
2899
+ */
2900
+ async copyDocumentToWorkspace(e, t, s, r) {
2901
+ const i = t.map((u) => `path=${encodeURIComponent(u)}`).join("&");
2902
+ return (await this.http.put(
2903
+ `/nextcloud/files/user/${e}/copy/workspace?${i}`,
2904
+ void 0,
2905
+ {
2906
+ queryParams: {
2907
+ ...s ? { parentId: s } : {},
2908
+ ...r != null && r.application ? { application: r.application } : {},
2909
+ ...(r == null ? void 0 : r.visibility) === "protected" ? { protected: !0 } : {}
2910
+ }
2911
+ }
2912
+ )).data.filter((u) => !!(u != null && u._id));
2913
+ }
2914
+ /**
2915
+ * Check whether a user has an active Nextcloud OAuth2 connection.
2916
+ * @param userId - the id of the user to check.
2917
+ */
2918
+ async getOauth2Status(e) {
2919
+ return this.http.get(
2920
+ `/nextcloud/user/${e}/oauth2/status`
2921
+ );
2922
+ }
2923
+ /**
2924
+ * Build the URL to download/preview a Nextcloud document.
2925
+ * There is no dedicated thumbnail endpoint on the backend, so this is also
2926
+ * used as an image preview source for image documents.
2927
+ * @param userId - the id of the user who owns the file.
2928
+ * @param doc - the document to build the URL for.
2929
+ */
2930
+ getFileUrl(e, t) {
2931
+ return `/nextcloud/files/user/${e}/file/${encodeURIComponent(
2932
+ t.name
2933
+ )}/download?path=${encodeURIComponent(
2934
+ t.path
2935
+ )}&contentType=${encodeURIComponent(t.contentType ?? "")}&isFolder=${t.isFolder}`;
2936
+ }
2937
+ }
2765
2938
  class AbstractBehaviourService {
2766
2939
  //
2767
2940
  // IMPLEMENTATION
@@ -2770,7 +2943,7 @@ class AbstractBehaviourService {
2770
2943
  //-----------------
2771
2944
  //--- Utilities ---
2772
2945
  //-----------------
2773
- u(this, "_cache");
2946
+ a(this, "_cache");
2774
2947
  this.context = e, this._cache = new CacheService(this.context);
2775
2948
  }
2776
2949
  getApplication() {
@@ -2804,8 +2977,8 @@ class AbstractBehaviourService {
2804
2977
  class ActualitesBehaviour extends AbstractBehaviourService {
2805
2978
  constructor() {
2806
2979
  super(...arguments);
2807
- u(this, "APP", "actualites");
2808
- u(this, "RESOURCE", "actualites");
2980
+ a(this, "APP", "actualites");
2981
+ a(this, "RESOURCE", "actualites");
2809
2982
  }
2810
2983
  async loadResources() {
2811
2984
  const [t, s] = await Promise.all([
@@ -2816,10 +2989,10 @@ class ActualitesBehaviour extends AbstractBehaviourService {
2816
2989
  /* @__PURE__ */ new Map()
2817
2990
  );
2818
2991
  return t.map((i) => {
2819
- var a;
2992
+ var u;
2820
2993
  let o;
2821
2994
  return i.threadIcon ? o = i.threadIcon + "?thumbnail=48x48" : o = "/img/icons/glyphicons_036_file.png", this.dataToResource({
2822
- title: i.title + " [" + ((a = r.get(i.threadId)) == null ? void 0 : a.title) + "]",
2995
+ title: i.title + " [" + ((u = r.get(i.threadId)) == null ? void 0 : u.title) + "]",
2823
2996
  ownerName: i.owner.displayName,
2824
2997
  owner: i.owner.id,
2825
2998
  icon: o,
@@ -2840,8 +3013,8 @@ const hexToDataUrl = (n, e = 1, t = 1) => {
2840
3013
  class AppointmentsBehaviour extends AbstractBehaviourService {
2841
3014
  constructor() {
2842
3015
  super(...arguments);
2843
- u(this, "APP", "appointments");
2844
- u(this, "RESOURCE", "appointments");
3016
+ a(this, "APP", "appointments");
3017
+ a(this, "RESOURCE", "appointments");
2845
3018
  }
2846
3019
  async loadResources() {
2847
3020
  return (await this.httpGet("/appointments/grids/linker")).map((s) => this.dataToResource({
@@ -2859,8 +3032,8 @@ class AppointmentsBehaviour extends AbstractBehaviourService {
2859
3032
  class BlogBehaviour extends AbstractBehaviourService {
2860
3033
  constructor() {
2861
3034
  super(...arguments);
2862
- u(this, "APP", "blog");
2863
- u(this, "RESOURCE", "blog");
3035
+ a(this, "APP", "blog");
3036
+ a(this, "RESOURCE", "blog");
2864
3037
  }
2865
3038
  loadResources() {
2866
3039
  return new Promise(async (t, s) => {
@@ -2868,7 +3041,7 @@ class BlogBehaviour extends AbstractBehaviourService {
2868
3041
  const r = await this.httpGet("/blog/linker"), i = [];
2869
3042
  r.forEach((o) => {
2870
3043
  o.thumbnail ? o.thumbnail = o.thumbnail + "?thumbnail=48x48" : o.thumbnail = "/img/illustrations/blog.svg";
2871
- const a = o.fetchPosts.map((c) => this.dataToResource({
3044
+ const u = o.fetchPosts.map((c) => this.dataToResource({
2872
3045
  owner: o.author.userId,
2873
3046
  ownerName: o.author.username,
2874
3047
  title: c.title + " [" + o.title + "]",
@@ -2878,7 +3051,7 @@ class BlogBehaviour extends AbstractBehaviourService {
2878
3051
  shared: !!(o.shared && o.shared.length >= 0),
2879
3052
  modified: o.modified
2880
3053
  }));
2881
- i.push(...a);
3054
+ i.push(...u);
2882
3055
  }), t(i);
2883
3056
  } catch (r) {
2884
3057
  s(r);
@@ -2889,8 +3062,8 @@ class BlogBehaviour extends AbstractBehaviourService {
2889
3062
  class CollaborativewallBehaviour extends AbstractBehaviourService {
2890
3063
  constructor() {
2891
3064
  super(...arguments);
2892
- u(this, "APP", "collaborativewall");
2893
- u(this, "RESOURCE", "collaborativewall");
3065
+ a(this, "APP", "collaborativewall");
3066
+ a(this, "RESOURCE", "collaborativewall");
2894
3067
  }
2895
3068
  async loadResources() {
2896
3069
  return (await this.httpGet(
@@ -2912,8 +3085,8 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
2912
3085
  class CommunityBehaviour extends AbstractBehaviourService {
2913
3086
  constructor() {
2914
3087
  super(...arguments);
2915
- u(this, "APP", "community");
2916
- u(this, "RESOURCE", "community");
3088
+ a(this, "APP", "community");
3089
+ a(this, "RESOURCE", "community");
2917
3090
  }
2918
3091
  async loadResources() {
2919
3092
  return (await this.httpGet(
@@ -2937,8 +3110,8 @@ class CommunityBehaviour extends AbstractBehaviourService {
2937
3110
  class ExercizerBehaviour extends AbstractBehaviourService {
2938
3111
  constructor() {
2939
3112
  super(...arguments);
2940
- u(this, "APP", "exercizer");
2941
- u(this, "RESOURCE", "exercizer");
3113
+ a(this, "APP", "exercizer");
3114
+ a(this, "RESOURCE", "exercizer");
2942
3115
  }
2943
3116
  async loadResources() {
2944
3117
  return (await this.httpGet(
@@ -2946,8 +3119,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
2946
3119
  )).map((s) => {
2947
3120
  const r = s.picture ? s.picture + "?thumbnail=48x48" : "/img/illustrations/exercizer.svg";
2948
3121
  let i, o = !1;
2949
- const a = JSON.parse(s.scheduled_at);
2950
- return a.groupList.length > 0 ? (o = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (o = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
3122
+ const u = JSON.parse(s.scheduled_at);
3123
+ return u.groupList.length > 0 ? (o = !0, i = u.groupList[0].name) : u.userList.length > 0 ? (o = !0, i = u.userList[0].name) : i = "", u.groupList.length + u.userList.length > 1 && (i += "..."), this.dataToResource({
2951
3124
  title: s.title,
2952
3125
  owner: s.owner,
2953
3126
  ownerName: i,
@@ -2963,8 +3136,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
2963
3136
  class FormulaireBehaviour extends AbstractBehaviourService {
2964
3137
  constructor() {
2965
3138
  super(...arguments);
2966
- u(this, "APP", "formulaire");
2967
- u(this, "RESOURCE", "formulaire");
3139
+ a(this, "APP", "formulaire");
3140
+ a(this, "RESOURCE", "formulaire");
2968
3141
  }
2969
3142
  async loadResources() {
2970
3143
  return (await this.httpGet(
@@ -2984,8 +3157,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
2984
3157
  class ForumBehaviour extends AbstractBehaviourService {
2985
3158
  constructor() {
2986
3159
  super(...arguments);
2987
- u(this, "APP", "forum");
2988
- u(this, "RESOURCE", "forum");
3160
+ a(this, "APP", "forum");
3161
+ a(this, "RESOURCE", "forum");
2989
3162
  }
2990
3163
  async loadResources() {
2991
3164
  return (await this.httpGet("/forum/categories")).map(
@@ -3005,8 +3178,8 @@ class ForumBehaviour extends AbstractBehaviourService {
3005
3178
  class HomeworksBehaviour extends AbstractBehaviourService {
3006
3179
  constructor() {
3007
3180
  super(...arguments);
3008
- u(this, "APP", "homeworks");
3009
- u(this, "RESOURCE", "homeworks");
3181
+ a(this, "APP", "homeworks");
3182
+ a(this, "RESOURCE", "homeworks");
3010
3183
  }
3011
3184
  async loadResources() {
3012
3185
  return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
@@ -3024,8 +3197,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
3024
3197
  class MagnetoBehaviour extends AbstractBehaviourService {
3025
3198
  constructor() {
3026
3199
  super(...arguments);
3027
- u(this, "APP", "magneto");
3028
- u(this, "RESOURCE", "magneto");
3200
+ a(this, "APP", "magneto");
3201
+ a(this, "RESOURCE", "magneto");
3029
3202
  }
3030
3203
  async loadResources() {
3031
3204
  const { all: t } = await this.httpGet(
@@ -3046,8 +3219,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
3046
3219
  class MindmapBehaviour extends AbstractBehaviourService {
3047
3220
  constructor() {
3048
3221
  super(...arguments);
3049
- u(this, "APP", "mindmap");
3050
- u(this, "RESOURCE", "mindmap");
3222
+ a(this, "APP", "mindmap");
3223
+ a(this, "RESOURCE", "mindmap");
3051
3224
  }
3052
3225
  async loadResources() {
3053
3226
  return (await this.httpGet("/mindmap/list/all")).map(
@@ -3067,8 +3240,8 @@ class MindmapBehaviour extends AbstractBehaviourService {
3067
3240
  class PagesBehaviour extends AbstractBehaviourService {
3068
3241
  constructor() {
3069
3242
  super(...arguments);
3070
- u(this, "APP", "pages");
3071
- u(this, "RESOURCE", "pages");
3243
+ a(this, "APP", "pages");
3244
+ a(this, "RESOURCE", "pages");
3072
3245
  }
3073
3246
  async loadResources() {
3074
3247
  const t = await this.httpGet("/pages/list/all"), s = [];
@@ -3086,15 +3259,15 @@ class PagesBehaviour extends AbstractBehaviourService {
3086
3259
  shared: typeof r.shared < "u",
3087
3260
  modified: r.modified
3088
3261
  })
3089
- ), (o = r.pages) == null || o.forEach((a) => {
3262
+ ), (o = r.pages) == null || o.forEach((u) => {
3090
3263
  s.push(
3091
3264
  this.dataToResource({
3092
- title: a.title,
3265
+ title: u.title,
3093
3266
  owner: r.owner.userId,
3094
3267
  ownerName: r.owner.displayName,
3095
3268
  icon: i,
3096
- path: "/pages#/website/" + r._id + "/" + a.titleLink,
3097
- _id: r._id + "/" + a.titleLink,
3269
+ path: "/pages#/website/" + r._id + "/" + u.titleLink,
3270
+ _id: r._id + "/" + u.titleLink,
3098
3271
  shared: typeof r.shared < "u",
3099
3272
  modified: r.modified
3100
3273
  })
@@ -3106,8 +3279,8 @@ class PagesBehaviour extends AbstractBehaviourService {
3106
3279
  class PollBehaviour extends AbstractBehaviourService {
3107
3280
  constructor() {
3108
3281
  super(...arguments);
3109
- u(this, "APP", "poll");
3110
- u(this, "RESOURCE", "poll");
3282
+ a(this, "APP", "poll");
3283
+ a(this, "RESOURCE", "poll");
3111
3284
  }
3112
3285
  async loadResources() {
3113
3286
  return (await this.httpGet("/poll/list/all")).map((s) => {
@@ -3128,8 +3301,8 @@ class PollBehaviour extends AbstractBehaviourService {
3128
3301
  class ScrapbookBehaviour extends AbstractBehaviourService {
3129
3302
  constructor() {
3130
3303
  super(...arguments);
3131
- u(this, "APP", "scrapbook");
3132
- u(this, "RESOURCE", "scrapbook");
3304
+ a(this, "APP", "scrapbook");
3305
+ a(this, "RESOURCE", "scrapbook");
3133
3306
  }
3134
3307
  async loadResources() {
3135
3308
  return (await this.httpGet(
@@ -3152,8 +3325,8 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
3152
3325
  class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3153
3326
  constructor() {
3154
3327
  super(...arguments);
3155
- u(this, "APP", "timelinegenerator");
3156
- u(this, "RESOURCE", "timelinegenerator");
3328
+ a(this, "APP", "timelinegenerator");
3329
+ a(this, "RESOURCE", "timelinegenerator");
3157
3330
  }
3158
3331
  loadResources() {
3159
3332
  return new Promise(async (t, s) => {
@@ -3161,12 +3334,12 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3161
3334
  const i = (await this.httpGet(
3162
3335
  "/timelinegenerator/timelines"
3163
3336
  )).map((o) => {
3164
- const a = o.icon || "/img/illustrations/timeline-default.png";
3337
+ const u = o.icon || "/img/illustrations/timeline-default.png";
3165
3338
  return this.dataToResource({
3166
3339
  title: o.headline,
3167
3340
  ownerName: o.owner.displayName,
3168
3341
  owner: o.owner.userId,
3169
- icon: a,
3342
+ icon: u,
3170
3343
  path: "/timelinegenerator#/view/" + o._id,
3171
3344
  _id: o._id,
3172
3345
  shared: typeof o.shared < "u",
@@ -3183,8 +3356,8 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3183
3356
  class WikiBehaviour extends AbstractBehaviourService {
3184
3357
  constructor() {
3185
3358
  super(...arguments);
3186
- u(this, "APP", "wiki");
3187
- u(this, "RESOURCE", "wiki");
3359
+ a(this, "APP", "wiki");
3360
+ a(this, "RESOURCE", "wiki");
3188
3361
  }
3189
3362
  async loadResources() {
3190
3363
  return (await this.httpGet(
@@ -3207,8 +3380,8 @@ class WikiBehaviour extends AbstractBehaviourService {
3207
3380
  class WorkspaceBehaviour extends AbstractBehaviourService {
3208
3381
  constructor() {
3209
3382
  super(...arguments);
3210
- u(this, "APP", "workspace");
3211
- u(this, "RESOURCE", "workspace");
3383
+ a(this, "APP", "workspace");
3384
+ a(this, "RESOURCE", "workspace");
3212
3385
  }
3213
3386
  loadResources({ search: t, asset_id: s }) {
3214
3387
  return new Promise(async (r, i) => {
@@ -3216,12 +3389,12 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
3216
3389
  let o = "/workspace/documents?filter=all&hierarchical=true";
3217
3390
  s && s.length ? o += `&search=${t}` : t && t.length && (o += `&search=${t}`);
3218
3391
  const c = (await this.httpGet(o)).filter((l) => !l.deleted).map((l) => {
3219
- const h = l.metadata["content-type"] && l.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${l._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
3392
+ const p = l.metadata["content-type"] && l.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${l._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
3220
3393
  return this.dataToResource({
3221
3394
  title: l.name,
3222
3395
  ownerName: l.ownerName,
3223
3396
  owner: l.owner,
3224
- icon: h,
3397
+ icon: p,
3225
3398
  path: `/workspace/document/${l._id}`,
3226
3399
  _id: l._id,
3227
3400
  shared: !!(l.shared && l.shared.length >= 0),
@@ -3246,7 +3419,7 @@ const b = class b {
3246
3419
  e.session().getUser()
3247
3420
  ]);
3248
3421
  i != null && i.apps && (r != null && r.length) && (this.resourceProducingApps = r.filter(
3249
- (o) => i.apps.some((a) => a.address.includes(o))
3422
+ (o) => i.apps.some((u) => u.address.includes(o))
3250
3423
  ));
3251
3424
  } catch (r) {
3252
3425
  console.warn("Failed to load resource-producing apps:", r);
@@ -3329,8 +3502,8 @@ const b = class b {
3329
3502
  //
3330
3503
  // STATIC REGISTRY
3331
3504
  //
3332
- u(b, "registry", new ServiceRegistry()), // Expose some useful functions
3333
- u(b, "findBehaviour", b.registry.findService.bind(b.registry)), u(b, "hasBehaviour", b.registry.isRegistered.bind(b.registry)), u(b, "resourceProducingApps", []);
3505
+ a(b, "registry", new ServiceRegistry()), // Expose some useful functions
3506
+ a(b, "findBehaviour", b.registry.findService.bind(b.registry)), a(b, "hasBehaviour", b.registry.isRegistered.bind(b.registry)), a(b, "resourceProducingApps", []);
3334
3507
  let SnipletsService = b;
3335
3508
  class RightService {
3336
3509
  constructor(e) {
@@ -3529,14 +3702,14 @@ class SessionService {
3529
3702
  r,
3530
3703
  i,
3531
3704
  o,
3532
- a
3705
+ u
3533
3706
  ] = await Promise.all([
3534
3707
  this.getCurrentLanguage(e),
3535
3708
  this.latestQuotaAndUsage(e),
3536
3709
  this.loadDescription(e),
3537
3710
  this.getUserProfile(),
3538
3711
  this.getBookmarks(e)
3539
- ]), { type: c, ...l } = t || {}, h = {
3712
+ ]), { type: c, ...l } = t || {}, p = {
3540
3713
  ...l,
3541
3714
  profiles: c || ["Guest"],
3542
3715
  // "type" field from /userbook/api/person becomes "profiles"
@@ -3547,9 +3720,9 @@ class SessionService {
3547
3720
  user: e,
3548
3721
  quotaAndUsage: r,
3549
3722
  currentLanguage: s,
3550
- userDescription: h,
3723
+ userDescription: p,
3551
3724
  userProfile: o,
3552
- bookmarkedApps: a
3725
+ bookmarkedApps: u
3553
3726
  };
3554
3727
  }
3555
3728
  login(e, t, s, r) {
@@ -3643,7 +3816,7 @@ class SessionService {
3643
3816
  applications: []
3644
3817
  });
3645
3818
  const i = [];
3646
- return r.bookmarks.forEach((o, a) => {
3819
+ return r.bookmarks.forEach((o, u) => {
3647
3820
  const c = ((e == null ? void 0 : e.apps) || []).find(
3648
3821
  (l) => l.name === o
3649
3822
  );
@@ -3659,11 +3832,11 @@ class SessionService {
3659
3832
  }
3660
3833
  async getPerson(e = {}) {
3661
3834
  var c;
3662
- const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: o, value: a } = await this.cache.httpGet(
3835
+ const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: o, value: u } = await this.cache.httpGet(
3663
3836
  i,
3664
3837
  t
3665
3838
  );
3666
- return o.status < 200 || o.status >= 300 || typeof a == "string" ? null : ((c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) || null;
3839
+ return o.status < 200 || o.status >= 300 || typeof u == "string" ? null : ((c = u == null ? void 0 : u.result) == null ? void 0 : c[0]) || null;
3667
3840
  }
3668
3841
  async isAdml() {
3669
3842
  const e = await this.getUser();
@@ -3721,38 +3894,38 @@ class ShareService {
3721
3894
  t,
3722
3895
  s,
3723
3896
  r
3724
- ), a = await this.cache.httpGetJson(o), c = a.users.visibles.filter(({ username: p, firstName: y, lastName: d, login: g }) => {
3897
+ ), u = await this.cache.httpGetJson(o), c = u.users.visibles.filter(({ username: h, firstName: y, lastName: E, login: g }) => {
3725
3898
  const A = StringUtils.removeAccents(
3726
- d || ""
3899
+ E || ""
3727
3900
  ).toLowerCase(), f = StringUtils.removeAccents(
3728
3901
  y || ""
3729
3902
  ).toLowerCase(), w = StringUtils.removeAccents(
3730
- p || ""
3903
+ h || ""
3731
3904
  ).toLowerCase(), F = StringUtils.removeAccents(g || "").toLowerCase();
3732
3905
  return w.includes(i) || f.includes(i) || A.includes(i) || F.includes(i);
3733
- }).map((p) => ({
3734
- avatarUrl: this.directory.getAvatarUrl(p.id, "user"),
3735
- directoryUrl: this.directory.getDirectoryUrl(p.id, "user"),
3736
- displayName: p.username,
3737
- id: p.id,
3738
- profile: p.profile,
3906
+ }).map((h) => ({
3907
+ avatarUrl: this.directory.getAvatarUrl(h.id, "user"),
3908
+ directoryUrl: this.directory.getDirectoryUrl(h.id, "user"),
3909
+ displayName: h.username,
3910
+ id: h.id,
3911
+ profile: h.profile,
3739
3912
  type: "user"
3740
- })), l = a.groups.visibles.filter(({ name: p }) => StringUtils.removeAccents(p || "").toLowerCase().includes(i)).map((p) => ({
3741
- avatarUrl: this.directory.getAvatarUrl(p.id, "group"),
3742
- directoryUrl: this.directory.getDirectoryUrl(p.id, "group"),
3743
- displayName: p.name,
3744
- id: p.id,
3913
+ })), l = u.groups.visibles.filter(({ name: h }) => StringUtils.removeAccents(h || "").toLowerCase().includes(i)).map((h) => ({
3914
+ avatarUrl: this.directory.getAvatarUrl(h.id, "group"),
3915
+ directoryUrl: this.directory.getDirectoryUrl(h.id, "group"),
3916
+ displayName: h.name,
3917
+ id: h.id,
3745
3918
  type: "group",
3746
- structureName: p.structureName
3919
+ structureName: h.structureName
3747
3920
  }));
3748
- return [...(await this.directory.getBookMarks()).filter(({ displayName: p }) => StringUtils.removeAccents(
3749
- p || ""
3750
- ).toLowerCase().includes(i)).map((p) => ({
3921
+ return [...(await this.directory.getBookMarks()).filter(({ displayName: h }) => StringUtils.removeAccents(
3922
+ h || ""
3923
+ ).toLowerCase().includes(i)).map((h) => ({
3751
3924
  avatarUrl: "",
3752
3925
  directoryUrl: "",
3753
3926
  profile: "",
3754
- displayName: p.displayName,
3755
- id: p.id,
3927
+ displayName: h.displayName,
3928
+ id: h.id,
3756
3929
  type: "sharebookmark"
3757
3930
  })), ...c, ...l];
3758
3931
  }
@@ -3768,10 +3941,10 @@ class ShareService {
3768
3941
  return s;
3769
3942
  }
3770
3943
  getActionsAvailableFor({ id: e, type: t }, s, r) {
3771
- const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
3772
- for (const l of a)
3944
+ const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], u = Object.keys(r), c = [];
3945
+ for (const l of u)
3773
3946
  r[l].filter(
3774
- (p) => o.includes(p)
3947
+ (h) => o.includes(h)
3775
3948
  ).length > 0 && c.push(l);
3776
3949
  return c;
3777
3950
  }
@@ -3783,26 +3956,26 @@ class ShareService {
3783
3956
  s == null ? void 0 : s.getResourceRights
3784
3957
  ), o = await this.cache.httpGetJson(
3785
3958
  i
3786
- ), a = await this.getShareMapping(
3959
+ ), u = await this.getShareMapping(
3787
3960
  e,
3788
3961
  s == null ? void 0 : s.getShareMapping
3789
3962
  ), c = await this.cache.httpGetJson(
3790
3963
  "/infra/public/json/sharing-rights.json"
3791
- ), l = Object.keys(o.users.checked).map((d) => o.users.visibles.find(
3792
- (A) => A.id === d
3793
- )).filter((d) => d !== void 0).map((d) => {
3964
+ ), l = Object.keys(o.users.checked).map((E) => o.users.visibles.find(
3965
+ (A) => A.id === E
3966
+ )).filter((E) => E !== void 0).map((E) => {
3794
3967
  const g = this.getActionsAvailableFor(
3795
- { id: d.id, type: "user" },
3968
+ { id: E.id, type: "user" },
3796
3969
  o,
3797
- a
3970
+ u
3798
3971
  );
3799
3972
  return {
3800
- id: d.id,
3973
+ id: E.id,
3801
3974
  type: "user",
3802
- displayName: d.username,
3803
- profile: d.profile,
3804
- avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
3805
- directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
3975
+ displayName: E.username,
3976
+ profile: E.profile,
3977
+ avatarUrl: this.directory.getAvatarUrl(E.id, "user"),
3978
+ directoryUrl: this.directory.getDirectoryUrl(E.id, "user"),
3806
3979
  actions: g.map((f) => {
3807
3980
  const w = c[f];
3808
3981
  return {
@@ -3812,21 +3985,21 @@ class ShareService {
3812
3985
  };
3813
3986
  })
3814
3987
  };
3815
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(o.groups.checked).map((d) => o.groups.visibles.find(
3816
- (A) => A.id === d
3817
- )).filter((d) => d !== void 0).map((d) => {
3988
+ }).sort((E, g) => (E.displayName || "").localeCompare(g.displayName)), p = Object.keys(o.groups.checked).map((E) => o.groups.visibles.find(
3989
+ (A) => A.id === E
3990
+ )).filter((E) => E !== void 0).map((E) => {
3818
3991
  const g = this.getActionsAvailableFor(
3819
- { id: d.id, type: "group" },
3992
+ { id: E.id, type: "group" },
3820
3993
  o,
3821
- a
3994
+ u
3822
3995
  );
3823
3996
  return {
3824
- id: d.id,
3997
+ id: E.id,
3825
3998
  type: "group",
3826
- displayName: d.name,
3999
+ displayName: E.name,
3827
4000
  profile: void 0,
3828
- avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
3829
- directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
4001
+ avatarUrl: this.directory.getAvatarUrl(E.id, "group"),
4002
+ directoryUrl: this.directory.getDirectoryUrl(E.id, "group"),
3830
4003
  actions: g.map((f) => {
3831
4004
  const w = c[f];
3832
4005
  return {
@@ -3836,26 +4009,26 @@ class ShareService {
3836
4009
  };
3837
4010
  })
3838
4011
  };
3839
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), E = [...l, ...h], p = o.groups.visibles.map(
3840
- ({ groupDisplayName: d, id: g, name: A, labels: f }) => ({
4012
+ }).sort((E, g) => (E.displayName || "").localeCompare(g.displayName)), d = [...l, ...p], h = o.groups.visibles.map(
4013
+ ({ groupDisplayName: E, id: g, name: A, labels: f }) => ({
3841
4014
  labels: f,
3842
- displayName: d || A,
4015
+ displayName: E || A,
3843
4016
  id: g
3844
4017
  })
3845
4018
  ), y = o.users.visibles.map(
3846
- ({ id: d, profile: g, username: A, firstName: f, lastName: w, login: F }) => ({
4019
+ ({ id: E, profile: g, username: A, firstName: f, lastName: w, login: F }) => ({
3847
4020
  displayName: A,
3848
4021
  firstName: f,
3849
4022
  lastName: w,
3850
4023
  login: F,
3851
4024
  profile: g,
3852
- id: d
4025
+ id: E
3853
4026
  })
3854
4027
  );
3855
4028
  return {
3856
- rights: E,
4029
+ rights: d,
3857
4030
  visibleBookmarks: r,
3858
- visibleGroups: p,
4031
+ visibleGroups: h,
3859
4032
  visibleUsers: y
3860
4033
  };
3861
4034
  }
@@ -3866,7 +4039,7 @@ class ShareService {
3866
4039
  bookmarks: {}
3867
4040
  }, i = await this.getShareMapping(e, s);
3868
4041
  for (const o of t) {
3869
- const a = o.actions.map((l) => i[l.id]).reduce((l, h) => Array.isArray(h) ? [...l, ...h] : l, []), c = [...new Set(a)];
4042
+ const u = o.actions.map((l) => i[l.id]).reduce((l, p) => Array.isArray(p) ? [...l, ...p] : l, []), c = [...new Set(u)];
3870
4043
  c.length > 0 && (o.type === "user" ? r.users[o.id] = c : o.type === "group" ? r.groups[o.id] = c : r.bookmarks[o.id] = c);
3871
4044
  }
3872
4045
  return r;
@@ -3876,40 +4049,40 @@ class ShareService {
3876
4049
  e,
3877
4050
  s,
3878
4051
  r == null ? void 0 : r.getShareMapping
3879
- ), o = (r == null ? void 0 : r.saveResourceRights) || `/${e}/share/resource/${t}`, a = this.getSearchUrl(
4052
+ ), o = (r == null ? void 0 : r.saveResourceRights) || `/${e}/share/resource/${t}`, u = this.getSearchUrl(
3880
4053
  e,
3881
4054
  t,
3882
4055
  "",
3883
4056
  r == null ? void 0 : r.getResourceRights
3884
4057
  );
3885
- return this.cache.clearCache(a), await this.http.putJson(o, i);
4058
+ return this.cache.clearCache(u), await this.http.putJson(o, i);
3886
4059
  }
3887
4060
  async getActionsForApp(e, t) {
3888
4061
  const s = await this.cache.httpGetJson(
3889
4062
  "/infra/public/json/sharing-rights.json"
3890
4063
  ), r = await this.getShareMapping(e, t);
3891
4064
  return Object.keys(s).map((o) => {
3892
- const a = s[o];
4065
+ const u = s[o];
3893
4066
  return {
3894
4067
  displayName: o,
3895
4068
  id: o,
3896
- priority: a.priority,
3897
- requires: a.requires
4069
+ priority: u.priority,
4070
+ requires: u.requires
3898
4071
  };
3899
4072
  }).filter((o) => {
3900
- var a;
3901
- return ((a = r[o.id]) == null ? void 0 : a.length) > 0;
3902
- }).sort((o, a) => o.priority - a.priority);
4073
+ var u;
4074
+ return ((u = r[o.id]) == null ? void 0 : u.length) > 0;
4075
+ }).sort((o, u) => o.priority - u.priority);
3903
4076
  }
3904
4077
  }
3905
4078
  const loadedScripts = {};
3906
4079
  class HttpService {
3907
4080
  constructor(e, t) {
3908
4081
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
3909
- u(this, "axios");
3910
- u(this, "baseUrl");
3911
- u(this, "headers", {});
3912
- u(this, "_latestResponse");
4082
+ a(this, "axios");
4083
+ a(this, "baseUrl");
4084
+ a(this, "headers", {});
4085
+ a(this, "_latestResponse");
3913
4086
  this.context = e, this.axios = axios.create(t);
3914
4087
  }
3915
4088
  fixBaseUrl(e) {
@@ -4124,8 +4297,8 @@ class HttpService {
4124
4297
  const r = s ?? "exports", i = this.toAxiosConfig(t);
4125
4298
  return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
4126
4299
  try {
4127
- const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
4128
- return Function(a)();
4300
+ const u = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
4301
+ return Function(u)();
4129
4302
  } catch {
4130
4303
  return o;
4131
4304
  }
@@ -4184,42 +4357,42 @@ const R = class R {
4184
4357
  throw new Error("Invalid video filename");
4185
4358
  const i = `${e.browser.name} ${e.browser.version}`, o = new FormData();
4186
4359
  o.append("device", e.device || ""), o.append("browser", i), o.append("url", e.url), o.append("app", t), o.append("file", e.file, e.filename), o.append("weight", "" + e.file.size), o.append("captation", "" + s);
4187
- let a = `/video/encode?captation=${s}`;
4188
- r && (a += `&duration=${r}`);
4360
+ let u = `/video/encode?captation=${s}`;
4361
+ r && (u += `&duration=${r}`);
4189
4362
  const c = await this.http.post(
4190
- a,
4363
+ u,
4191
4364
  o,
4192
4365
  { headers: { "Content-Type": "multipart/form-data" } }
4193
4366
  );
4194
4367
  if (c.state == "running") {
4195
- let l = 0, h = 1;
4368
+ let l = 0, p = 1;
4196
4369
  do {
4197
- const E = h + l;
4370
+ const d = p + l;
4198
4371
  await new Promise(
4199
- (y) => setTimeout(y, E * 1e3)
4200
- ), l = h, h = Math.min(8, E);
4201
- const p = await this.http.get(
4372
+ (y) => setTimeout(y, d * 1e3)
4373
+ ), l = p, p = Math.min(8, d);
4374
+ const h = await this.http.get(
4202
4375
  `/video/status/${c.processid}`
4203
4376
  );
4204
- if (p.state == "succeed")
4205
- return p.videoworkspaceid && p.videosize && this.context.data().trackVideoSave(
4206
- p.videoworkspaceid,
4377
+ if (h.state == "succeed")
4378
+ return h.videoworkspaceid && h.videosize && this.context.data().trackVideoSave(
4379
+ h.videoworkspaceid,
4207
4380
  Math.round(r),
4208
- p.videosize,
4381
+ h.videosize,
4209
4382
  s,
4210
4383
  e.url,
4211
4384
  i,
4212
4385
  e.device
4213
- ), p;
4214
- if (p.state == "error")
4386
+ ), h;
4387
+ if (h.state == "error")
4215
4388
  break;
4216
4389
  } while (!0);
4217
4390
  }
4218
4391
  throw new Error("Video cannot be uploaded.");
4219
4392
  }
4220
4393
  };
4221
- u(R, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
4222
- u(R, "MAX_DURATION", 3);
4394
+ a(R, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
4395
+ a(R, "MAX_DURATION", 3);
4223
4396
  let VideoService = R;
4224
4397
  class WidgetService {
4225
4398
  constructor(e) {
@@ -4301,7 +4474,7 @@ const defaultMappers = {
4301
4474
  }
4302
4475
  };
4303
4476
  // FIXME add edumedia support
4304
- u(v, "roleMappers", [
4477
+ a(v, "roleMappers", [
4305
4478
  (e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
4306
4479
  ]);
4307
4480
  let DocumentHelper = v;
@@ -4319,29 +4492,29 @@ class WorkspaceService {
4319
4492
  size: e.size,
4320
4493
  extension: i,
4321
4494
  role: DocumentHelper.role(r, !1, i)
4322
- }, a = t.replace("." + o.extension, ""), c = o.extension ? a + "." + o.extension : a;
4323
- return { basename: a, fullname: c, metadata: o };
4495
+ }, u = t.replace("." + o.extension, ""), c = o.extension ? u + "." + o.extension : u;
4496
+ return { basename: u, fullname: c, metadata: o };
4324
4497
  }
4325
4498
  async saveFile(e, t) {
4326
4499
  const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
4327
4500
  i.append("file", e, s);
4328
4501
  const o = [];
4329
4502
  ((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && o.push(`${t.visibility}=true`), t != null && t.application && o.push(`application=${t.application}`), r.role === "img" && o.push("quality=1"), t != null && t.parentId && o.push(`parentId=${t.parentId}`);
4330
- const a = await this.http.postFile(
4503
+ const u = await this.http.postFile(
4331
4504
  `/workspace/document?${o.join("&")}`,
4332
4505
  i
4333
4506
  );
4334
4507
  if (this.http.isResponseError())
4335
4508
  throw this.http.latestResponse.statusText;
4336
- return a;
4509
+ return u;
4337
4510
  }
4338
4511
  async updateFile(e, t, s) {
4339
4512
  const { fullname: r, metadata: i } = this.extractMetadata(t), o = new FormData();
4340
4513
  o.append("file", t, r);
4341
- const a = [];
4342
- i.role === "img" && a.push("quality=1"), s != null && s.alt && a.push(`alt=${s.alt}`), s != null && s.legend && a.push(`legend=${s.legend}`), s != null && s.name && a.push(`name=${s.name}`);
4514
+ const u = [];
4515
+ i.role === "img" && u.push("quality=1"), s != null && s.alt && u.push(`alt=${s.alt}`), s != null && s.legend && u.push(`legend=${s.legend}`), s != null && s.name && u.push(`name=${s.name}`);
4343
4516
  const c = await this.http.putFile(
4344
- `/workspace/document/${e}?${a.join("&")}`,
4517
+ `/workspace/document/${e}?${u.join("&")}`,
4345
4518
  o
4346
4519
  );
4347
4520
  if (this.http.isResponseError())
@@ -4392,11 +4565,11 @@ class WorkspaceService {
4392
4565
  );
4393
4566
  if (this.http.isResponseError())
4394
4567
  throw this.http.latestResponse.statusText;
4395
- return r.forEach((o, a) => {
4568
+ return r.forEach((o, u) => {
4396
4569
  const c = e.findIndex(
4397
4570
  (l) => l._id === o._id
4398
4571
  );
4399
- 0 <= c && c < e.length && (e[c] = i[a]);
4572
+ 0 <= c && c < e.length && (e[c] = i[u]);
4400
4573
  }), e.filter((o) => !!o);
4401
4574
  }
4402
4575
  return e;
@@ -4411,12 +4584,12 @@ class WorkspaceService {
4411
4584
  if (typeof e == "string")
4412
4585
  return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
4413
4586
  {
4414
- const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
4587
+ const u = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
4415
4588
  if ((o = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && o.includes("video")) {
4416
4589
  const l = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
4417
- return l ? a + l : null;
4590
+ return l ? u + l : null;
4418
4591
  } else
4419
- return a + r;
4592
+ return u + r;
4420
4593
  }
4421
4594
  }
4422
4595
  /**
@@ -4470,22 +4643,24 @@ class WorkspaceService {
4470
4643
  }
4471
4644
  class OdeServices {
4472
4645
  constructor() {
4473
- u(this, "_analytics");
4474
- u(this, "_cache");
4475
- u(this, "_conf");
4476
- u(this, "_data");
4477
- u(this, "_directory");
4478
- u(this, "_http");
4479
- u(this, "_idiom");
4480
- u(this, "_notify");
4481
- u(this, "_rights");
4482
- u(this, "_session");
4483
- u(this, "_share");
4484
- u(this, "_video");
4485
- u(this, "_widget");
4486
- u(this, "_workspace");
4487
- u(this, "_embedder");
4488
- this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._data = new DataService(this), this._directory = new DirectoryService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), this._notify = NotifyFrameworkFactory.instance(), this._rights = new RightService(this), this._session = new SessionService(this), this._share = new ShareService(this), this._video = new VideoService(this), this._widget = new WidgetService(this), this._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
4646
+ a(this, "_analytics");
4647
+ a(this, "_cache");
4648
+ a(this, "_conf");
4649
+ a(this, "_data");
4650
+ a(this, "_directory");
4651
+ a(this, "_googledrive");
4652
+ a(this, "_http");
4653
+ a(this, "_idiom");
4654
+ a(this, "_nextcloud");
4655
+ a(this, "_notify");
4656
+ a(this, "_rights");
4657
+ a(this, "_session");
4658
+ a(this, "_share");
4659
+ a(this, "_video");
4660
+ a(this, "_widget");
4661
+ a(this, "_workspace");
4662
+ a(this, "_embedder");
4663
+ this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._data = new DataService(this), this._directory = new DirectoryService(this), this._googledrive = new GoogleDriveService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), this._nextcloud = new NextcloudService(this), this._notify = NotifyFrameworkFactory.instance(), this._rights = new RightService(this), this._session = new SessionService(this), this._share = new ShareService(this), this._video = new VideoService(this), this._widget = new WidgetService(this), this._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
4489
4664
  }
4490
4665
  initialize() {
4491
4666
  return this._data.initialize(), this;
@@ -4508,12 +4683,18 @@ class OdeServices {
4508
4683
  directory() {
4509
4684
  return this._directory;
4510
4685
  }
4686
+ googledrive() {
4687
+ return this._googledrive;
4688
+ }
4511
4689
  http() {
4512
4690
  return this._http;
4513
4691
  }
4514
4692
  idiom() {
4515
4693
  return this._idiom;
4516
4694
  }
4695
+ nextcloud() {
4696
+ return this._nextcloud;
4697
+ }
4517
4698
  notify() {
4518
4699
  return this._notify;
4519
4700
  }
@@ -4689,10 +4870,10 @@ const isActionAvailable = (n, e) => {
4689
4870
  class WidgetFramework {
4690
4871
  constructor() {
4691
4872
  //-------------------------------------
4692
- u(this, "_initialized");
4693
- u(this, "_widgets", []);
4873
+ a(this, "_initialized");
4874
+ a(this, "_widgets", []);
4694
4875
  ////////////////////////////////////// USER PREFERENCES
4695
- u(this, "_userPrefs", {});
4876
+ a(this, "_userPrefs", {});
4696
4877
  }
4697
4878
  initialize(e, t) {
4698
4879
  return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
@@ -4735,20 +4916,20 @@ class WidgetFramework {
4735
4916
  this._userPrefs = e ?? this._userPrefs;
4736
4917
  const t = configure.Platform.theme, s = [];
4737
4918
  t.listSkins().then((r) => {
4738
- var a;
4739
- const i = ((a = r.find((c) => c.child === t.skin)) == null ? void 0 : a.parent) === "panda" ? secondLevelWidgets : firstLevelWidgets;
4919
+ var u;
4920
+ const i = ((u = r.find((c) => c.child === t.skin)) == null ? void 0 : u.parent) === "panda" ? secondLevelWidgets : firstLevelWidgets;
4740
4921
  this._widgets = this._widgets.filter((c, l) => {
4741
- const h = c.platformConf.name;
4742
- return i.indexOf(h) !== -1 ? !1 : (this._userPrefs[h] || (this._userPrefs[h] = {
4743
- index: defaultWidgetOrder[h] ?? 999,
4922
+ const p = c.platformConf.name;
4923
+ return i.indexOf(p) !== -1 ? !1 : (this._userPrefs[p] || (this._userPrefs[p] = {
4924
+ index: defaultWidgetOrder[p] ?? 999,
4744
4925
  show: !0,
4745
4926
  position: c.platformConf.position
4746
- }), c.platformConf.mandatory && (this._userPrefs[h].show = !0, this._userPrefs[h].index = defaultWidgetOrder[h] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[h]), !0);
4927
+ }), c.platformConf.mandatory && (this._userPrefs[p].show = !0, this._userPrefs[p].index = defaultWidgetOrder[p] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[p]), !0);
4747
4928
  });
4748
4929
  const o = new Idiom();
4749
4930
  this._widgets = this._widgets.sort((c, l) => {
4750
- const h = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();
4751
- return h < E ? -1 : h > E ? 1 : 0;
4931
+ const p = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), d = o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();
4932
+ return p < d ? -1 : p > d ? 1 : 0;
4752
4933
  });
4753
4934
  });
4754
4935
  }
@@ -4756,8 +4937,8 @@ class WidgetFramework {
4756
4937
  class Widget {
4757
4938
  //-------------------------------------
4758
4939
  constructor(e) {
4759
- u(this, "_schoolConf", {});
4760
- u(this, "_userPref");
4940
+ a(this, "_schoolConf", {});
4941
+ a(this, "_userPref");
4761
4942
  this._platformConf = e, this._userPref = null;
4762
4943
  }
4763
4944
  get platformConf() {
@@ -4808,6 +4989,8 @@ export {
4808
4989
  ERROR_CODE,
4809
4990
  EVENT_NAME,
4810
4991
  FOLDER,
4992
+ GOOGLE_DRIVE_FOLDER_MIME_TYPE,
4993
+ GoogleDriveCopyError,
4811
4994
  ITimelineFactory,
4812
4995
  LAYER_NAME,
4813
4996
  NotifyFrameworkFactory,