@edifice.io/client 2.0.4 → 2.0.5-develop-pedago.20250123145105

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 v = Object.defineProperty;
2
2
  var T = (o, e, t) => e in o ? v(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var n = (o, e, t) => T(o, typeof e != "symbol" ? e + "" : e, t);
3
+ var u = (o, e, t) => T(o, typeof e != "symbol" ? e + "" : e, t);
4
4
  import axios from "axios";
5
5
  import { MimeTypeUtils } from "@edifice.io/utilities";
6
6
  const ERROR_CODE = {
@@ -14,7 +14,7 @@ const ERROR_CODE = {
14
14
  TIME_OUT: "0070",
15
15
  MALFORMED_DATA: "0080",
16
16
  NOT_LOGGED_IN: "0090"
17
- }, APP$1 = {
17
+ }, APP$3 = {
18
18
  ADMIN: "admin",
19
19
  ARCHIVE: "archive",
20
20
  AUTH: "auth",
@@ -30,11 +30,13 @@ const ERROR_CODE = {
30
30
  WORKSPACE: "workspace",
31
31
  // -- a few others commonly used apps
32
32
  EXPLORER: "explorer",
33
+ HOMEWORKS: "homeworks",
33
34
  VIDEO: "video",
34
35
  MINDMAP: "mindmap",
35
36
  SCRAPBOOK: "scrapbook",
36
37
  COLLABORATIVEWALL: "collaborativewall",
37
- WIKI: "wiki"
38
+ WIKI: "wiki",
39
+ TIMELINEGENERATOR: "timelinegenerator"
38
40
  // TODO compléter/trier les apps suivantes
39
41
  /*
40
42
  "competences"
@@ -97,7 +99,7 @@ const ERROR_CODE = {
97
99
  };
98
100
  class Subscription {
99
101
  constructor(e, t) {
100
- n(this, "revoke");
102
+ u(this, "revoke");
101
103
  this._channel = e, this.revoke = this.setReceiver(
102
104
  (s) => t == null ? void 0 : t(s.data)
103
105
  );
@@ -115,7 +117,7 @@ class Subject {
115
117
  * => We maintain here channels for *sending* messages.
116
118
  * *Receiving* channels will be instantiated while subscribing.
117
119
  */
118
- n(this, "publishChannels", /* @__PURE__ */ new Map());
120
+ u(this, "publishChannels", /* @__PURE__ */ new Map());
119
121
  }
120
122
  getChannelName(e) {
121
123
  return "Subject:" + e;
@@ -150,9 +152,9 @@ const ASYNC_DATA_NAME = {
150
152
  class Promisified {
151
153
  constructor() {
152
154
  //-------------------------------------
153
- n(this, "_resolution");
154
- n(this, "_rejection");
155
- n(this, "_promise", new Promise((e, t) => {
155
+ u(this, "_resolution");
156
+ u(this, "_rejection");
157
+ u(this, "_promise", new Promise((e, t) => {
156
158
  this._resolution = e, this._rejection = t;
157
159
  }));
158
160
  }
@@ -169,8 +171,8 @@ class Promisified {
169
171
  class NotifyFramework {
170
172
  constructor() {
171
173
  //-------------------------------------
172
- n(this, "promises", {});
173
- n(this, "subject", new Subject());
174
+ u(this, "promises", {});
175
+ u(this, "subject", new Subject());
174
176
  }
175
177
  asyncData(e) {
176
178
  return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
@@ -201,8 +203,8 @@ const notify = new NotifyFramework(), loadedScripts$1 = {};
201
203
  class Http {
202
204
  constructor(e) {
203
205
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
204
- n(this, "axios");
205
- n(this, "_latestResponse");
206
+ u(this, "axios");
207
+ u(this, "_latestResponse");
206
208
  this.axios = axios.create(e);
207
209
  }
208
210
  setCdn(e) {
@@ -280,15 +282,15 @@ class Http {
280
282
  }
281
283
  getScript(e, t, s) {
282
284
  const r = s ?? "exports", i = this.toAxiosConfig(t);
283
- return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((u) => this.mapAxiosResponse(u, t)).then((u) => {
285
+ return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((n) => this.mapAxiosResponse(n, t)).then((n) => {
284
286
  try {
285
- const a = `"use strict";var ${r.split(".")[0]}={};${u};return ${r};`;
287
+ const a = `"use strict";var ${r.split(".")[0]}={};${n};return ${r};`;
286
288
  return Function(a)();
287
289
  } catch {
288
- return u;
290
+ return n;
289
291
  }
290
- }).catch((u) => {
291
- throw this.mapAxiosError(u, t), u;
292
+ }).catch((n) => {
293
+ throw this.mapAxiosError(n, t), n;
292
294
  });
293
295
  }
294
296
  loadScript(e, t) {
@@ -299,7 +301,7 @@ class Http {
299
301
  }
300
302
  class TransportFramework {
301
303
  constructor() {
302
- n(this, "_http", new Http());
304
+ u(this, "_http", new Http());
303
305
  }
304
306
  get http() {
305
307
  return this._http;
@@ -318,11 +320,11 @@ class ConfigurationFrameworkFactory {
318
320
  const http$2 = transport.http;
319
321
  class Session {
320
322
  constructor() {
321
- n(this, "_me", null);
322
- n(this, "_currentLanguage", "");
323
- n(this, "_notLoggedIn", !0);
324
- n(this, "_description");
325
- n(this, "_profile");
323
+ u(this, "_me", null);
324
+ u(this, "_currentLanguage", "");
325
+ u(this, "_notLoggedIn", !0);
326
+ u(this, "_description");
327
+ u(this, "_profile");
326
328
  }
327
329
  get currentLanguage() {
328
330
  return this._currentLanguage;
@@ -367,8 +369,8 @@ class Session {
367
369
  hasRight(e, t) {
368
370
  if (t === "owner")
369
371
  return e.owner && e.owner.userId === this._me.userId;
370
- 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, u = t.workflow ? this.hasWorkflow(t.workflow) : !0;
371
- return i && u;
372
+ 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, n = t.workflow ? this.hasWorkflow(t.workflow) : !0;
373
+ return i && n;
372
374
  }
373
375
  ////////////////////////////////////////////////////////// Storage management
374
376
  get latestQuotaAndUsage() {
@@ -440,7 +442,7 @@ class Session {
440
442
  }
441
443
  class SessionFramework {
442
444
  constructor() {
443
- n(this, "session", new Session());
445
+ u(this, "session", new Session());
444
446
  }
445
447
  initialize() {
446
448
  return this.session.initialize();
@@ -464,22 +466,22 @@ class SessionFramework {
464
466
  const session = new SessionFramework();
465
467
  class Theme {
466
468
  constructor() {
467
- n(this, "_conf");
468
- n(this, "_loaded");
469
+ u(this, "_conf");
470
+ u(this, "_loaded");
469
471
  // legacy (readonly)
470
- n(this, "skinName", "");
471
- n(this, "themeName", "");
472
- n(this, "skin", "raw");
473
- n(this, "themeUrl", "/assets/themes/raw/default/");
474
- n(this, "templateOverrides", {});
475
- n(this, "portalTemplate", "/assets/themes/raw/portal.html");
476
- n(this, "basePath", "");
477
- n(this, "logoutCallback", "/");
478
- n(this, "skins", []);
479
- n(this, "is1D", !1);
480
- n(this, "is2D", !1);
481
- n(this, "_onSkinReady", notify.onSkinReady());
482
- n(this, "_onOverrideReady", notify.onOverridesReady());
472
+ u(this, "skinName", "");
473
+ u(this, "themeName", "");
474
+ u(this, "skin", "raw");
475
+ u(this, "themeUrl", "/assets/themes/raw/default/");
476
+ u(this, "templateOverrides", {});
477
+ u(this, "portalTemplate", "/assets/themes/raw/portal.html");
478
+ u(this, "basePath", "");
479
+ u(this, "logoutCallback", "/");
480
+ u(this, "skins", []);
481
+ u(this, "is1D", !1);
482
+ u(this, "is2D", !1);
483
+ u(this, "_onSkinReady", notify.onSkinReady());
484
+ u(this, "_onOverrideReady", notify.onOverridesReady());
483
485
  }
484
486
  initialize(e) {
485
487
  return notify.onSessionReady().promise.then(() => this.load(e));
@@ -789,7 +791,7 @@ class Idiom {
789
791
  e = e ?? "";
790
792
  let s = bundle$1[e] === void 0 ? e : bundle$1[e];
791
793
  if (t && typeof t == "object")
792
- for (let r in t)
794
+ for (const r in t)
793
795
  typeof t[r] < "u" && (s = s.replace(
794
796
  new RegExp("\\${" + r + "}", "g"),
795
797
  "" + t[r]
@@ -812,8 +814,8 @@ class Idiom {
812
814
  else {
813
815
  const i = new Promisified();
814
816
  promises$1[t] = i.promise;
815
- const u = {};
816
- e && (u["Accept-Language"] = e), transport.http.get(t, { headers: u }).then((a) => {
817
+ const n = {};
818
+ e && (n["Accept-Language"] = e), transport.http.get(t, { headers: n }).then((a) => {
817
819
  Object.assign(bundle$1, a), typeof s == "function" && s(), i.resolve();
818
820
  }).catch((a) => {
819
821
  typeof s == "function" && s(), i.reject();
@@ -836,11 +838,11 @@ class Idiom {
836
838
  }) : Promise.reject();
837
839
  }
838
840
  addKeys(e) {
839
- for (var t in e)
841
+ for (const t in e)
840
842
  typeof bundle$1[t] != "string" && (bundle$1[t] = e[t]);
841
843
  }
842
844
  removeAccents(e) {
843
- for (var t = 0; t < defaultDiacriticsRemovalMap$1.length; t++)
845
+ for (let t = 0; t < defaultDiacriticsRemovalMap$1.length; t++)
844
846
  e = e.replace(
845
847
  defaultDiacriticsRemovalMap$1[t].letters,
846
848
  defaultDiacriticsRemovalMap$1[t].base
@@ -851,7 +853,7 @@ class Idiom {
851
853
  class UserPreferences {
852
854
  constructor() {
853
855
  //-------------------------------------
854
- n(this, "data", {});
856
+ u(this, "data", {});
855
857
  }
856
858
  get(e) {
857
859
  return this.data[e];
@@ -878,10 +880,10 @@ class UserPreferences {
878
880
  class User {
879
881
  constructor() {
880
882
  //-------------------------------------
881
- n(this, "_me", null);
882
- n(this, "_keepOpenOnLogout", !1);
883
- n(this, "_preferences", new UserPreferences());
884
- n(this, "_bookmarkedApps", []);
883
+ u(this, "_me", null);
884
+ u(this, "_keepOpenOnLogout", !1);
885
+ u(this, "_preferences", new UserPreferences());
886
+ u(this, "_bookmarkedApps", []);
885
887
  }
886
888
  get keepOpenOnLogout() {
887
889
  return this._keepOpenOnLogout;
@@ -913,7 +915,7 @@ class User {
913
915
  let s;
914
916
  if (t && t.length && typeof t.concat == "function") {
915
917
  this._bookmarkedApps = t, s = {
916
- bookmarks: t.map((u) => u.name),
918
+ bookmarks: t.map((n) => n.name),
917
919
  applications: []
918
920
  }, transport.http.putJson("/userbook/preference/apps", s);
919
921
  return;
@@ -925,15 +927,15 @@ class User {
925
927
  });
926
928
  let r = !0;
927
929
  const i = [];
928
- s.bookmarks.forEach((u, a) => {
929
- const c = this._me.apps.find((h) => h.name === u);
930
+ s.bookmarks.forEach((n, a) => {
931
+ const c = this._me.apps.find((h) => h.name === n);
930
932
  if (c) {
931
- let h = Object.assign({}, c);
933
+ const h = Object.assign({}, c);
932
934
  this._bookmarkedApps.push(h);
933
935
  } else
934
- i.push(u), r = !1;
935
- }), i.forEach((u) => {
936
- let a = s.bookmarks.indexOf(u);
936
+ i.push(n), r = !1;
937
+ }), i.forEach((n) => {
938
+ const a = s.bookmarks.indexOf(n);
937
939
  a !== -1 && s.bookmarks.splice(a, 1);
938
940
  }), r || transport.http.putJson("/userbook/preference/apps", s);
939
941
  });
@@ -955,9 +957,9 @@ const http$1 = transport == null ? void 0 : transport.http;
955
957
  class AppConf {
956
958
  constructor() {
957
959
  //-------------------------------------
958
- n(this, "_publicConf", {});
959
- n(this, "_currentApp");
960
- n(this, "_appConf", {});
960
+ u(this, "_publicConf", {});
961
+ u(this, "_currentApp");
962
+ u(this, "_appConf", {});
961
963
  }
962
964
  /**
963
965
  * Get the currently initialized App.
@@ -995,8 +997,8 @@ class AppConf {
995
997
  class Analytics {
996
998
  constructor() {
997
999
  //-------------------------------------
998
- n(this, "_status", "void");
999
- n(this, "_params");
1000
+ u(this, "_status", "void");
1001
+ u(this, "_params");
1000
1002
  }
1001
1003
  get status() {
1002
1004
  return this._status;
@@ -1036,7 +1038,7 @@ class Analytics {
1036
1038
  if (!e.structureMap || !configure.Platform.apps.currentApp) return;
1037
1039
  const t = await notify.onSessionReady().promise, s = session.session.description;
1038
1040
  let r;
1039
- for (let h of t.structures) {
1041
+ for (const h of t.structures) {
1040
1042
  const l = e.structureMap[h];
1041
1043
  if (l && l.collectiviteId && l.UAI) {
1042
1044
  r = l;
@@ -1048,8 +1050,8 @@ class Analytics {
1048
1050
  configure.Platform.apps.currentApp
1049
1051
  );
1050
1052
  if (!i) return;
1051
- const u = i.xiti;
1052
- if (!u || !u.LIBELLE_SERVICE || !r.UAI) return;
1053
+ const n = i.xiti;
1054
+ if (!n || !n.LIBELLE_SERVICE || !r.UAI) return;
1053
1055
  function a(h) {
1054
1056
  let l = "";
1055
1057
  for (let E = 0; E < h.length; E++)
@@ -1064,10 +1066,10 @@ class Analytics {
1064
1066
  Guest: "AUTRE"
1065
1067
  };
1066
1068
  return {
1067
- LIBELLE_SERVICE: u.LIBELLE_SERVICE,
1069
+ LIBELLE_SERVICE: n.LIBELLE_SERVICE,
1068
1070
  // Which property of LIBELLE_SERVICE to use depends on the frontend.
1069
- TYPE: u.OUTIL ? "TIERS" : "NATIF",
1070
- OUTIL: u.OUTIL ? u.OUTIL : "",
1071
+ TYPE: n.OUTIL ? "TIERS" : "NATIF",
1072
+ OUTIL: n.OUTIL ? n.OUTIL : "",
1071
1073
  STRUCT_ID: r.collectiviteId,
1072
1074
  STRUCT_UAI: r.UAI,
1073
1075
  PROJET: r.projetId ? r.projetId : e.ID_PROJET,
@@ -1081,7 +1083,7 @@ class Analytics {
1081
1083
  class ConfigurationFramework {
1082
1084
  constructor() {
1083
1085
  //-------------------------------------
1084
- n(this, "Platform", {
1086
+ u(this, "Platform", {
1085
1087
  deploymentTag: "",
1086
1088
  cdnDomain: "",
1087
1089
  apps: new AppConf(),
@@ -1090,15 +1092,15 @@ class ConfigurationFramework {
1090
1092
  idiom: new Idiom(),
1091
1093
  listLanguages: () => transport.http.get("/languages")
1092
1094
  });
1093
- n(this, "School", {
1095
+ u(this, "School", {
1094
1096
  //apps; -> pinnedApps;
1095
1097
  });
1096
- n(this, "User", new User());
1098
+ u(this, "User", new User());
1097
1099
  }
1098
1100
  async initialize(e, t) {
1099
1101
  if (!e) {
1100
- const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(), u = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
1101
- e = `${u}${r(a)}${r(c)}`;
1102
+ const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(), n = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
1103
+ e = `${n}${r(a)}${r(c)}`;
1102
1104
  }
1103
1105
  const s = e;
1104
1106
  this.Platform.deploymentTag = e, typeof t == "string" && t.length > 0 && (this.Platform.cdnDomain = t), transport.http.setCdn(this.Platform.cdnDomain), await Promise.all([
@@ -1140,8 +1142,8 @@ var _;
1140
1142
  const me = (_ = session == null ? void 0 : session.session) == null ? void 0 : _.user;
1141
1143
  class Notification {
1142
1144
  constructor(e) {
1143
- n(this, "_id");
1144
- n(this, "model");
1145
+ u(this, "_id");
1146
+ u(this, "model");
1145
1147
  e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
1146
1148
  }
1147
1149
  isUnread() {
@@ -1161,14 +1163,14 @@ class Notification {
1161
1163
  class TimelineApp {
1162
1164
  constructor() {
1163
1165
  //-------------------------------------
1164
- n(this, "_notifications", []);
1165
- n(this, "_notificationTypes", []);
1166
+ u(this, "_notifications", []);
1167
+ u(this, "_notificationTypes", []);
1166
1168
  // ex: ["BLOG"]
1167
- n(this, "_flashMessages", []);
1168
- n(this, "_pageNumber", 0);
1169
- n(this, "_lastPage", !1);
1170
- n(this, "_loading", !1);
1171
- n(this, "showMine", !1);
1169
+ u(this, "_flashMessages", []);
1170
+ u(this, "_pageNumber", 0);
1171
+ u(this, "_lastPage", !1);
1172
+ u(this, "_loading", !1);
1173
+ u(this, "showMine", !1);
1172
1174
  }
1173
1175
  get notifications() {
1174
1176
  return this._notifications;
@@ -1189,20 +1191,20 @@ class TimelineApp {
1189
1191
  return this.preferences.type = this.preferences.type || [], this.preferences.type;
1190
1192
  }
1191
1193
  get preferences() {
1192
- return configure.User.preferences.get(APP$1.TIMELINE);
1194
+ return configure.User.preferences.get(APP$3.TIMELINE);
1193
1195
  }
1194
1196
  get flashMessages() {
1195
1197
  return this._flashMessages;
1196
1198
  }
1197
1199
  savePreferences() {
1198
- return configure.User.saveAppPrefs(APP$1.TIMELINE);
1200
+ return configure.User.saveAppPrefs(APP$3.TIMELINE);
1199
1201
  }
1200
1202
  resetPagination() {
1201
1203
  this._pageNumber = 0, this._lastPage = !1, this._loading = !1;
1202
1204
  }
1203
1205
  initialize() {
1204
1206
  return Promise.all([
1205
- configure.User.loadAppPrefs(APP$1.TIMELINE),
1207
+ configure.User.loadAppPrefs(APP$3.TIMELINE),
1206
1208
  transport.http.get("/timeline/types")
1207
1209
  ]).then((e) => {
1208
1210
  this._notificationTypes = e[1];
@@ -1212,10 +1214,10 @@ class TimelineApp {
1212
1214
  if (this._loading || this._lastPage)
1213
1215
  return Promise.resolve();
1214
1216
  e && (this._pageNumber++, this._lastPage = !1);
1215
- let t = this.selectedNotificationTypes;
1217
+ const t = this.selectedNotificationTypes;
1216
1218
  if (t.length === 0)
1217
1219
  return this._lastPage = !0, Promise.resolve();
1218
- let s = {
1220
+ const s = {
1219
1221
  page: this.page,
1220
1222
  mine: 1
1221
1223
  };
@@ -1226,10 +1228,10 @@ class TimelineApp {
1226
1228
  if (this._loading = !1, r.status === "ok")
1227
1229
  if (r.number && r.results) {
1228
1230
  const i = r.results.filter(
1229
- (u) => this._notifications.findIndex(
1230
- (a) => a._id === u._id
1231
+ (n) => this._notifications.findIndex(
1232
+ (a) => a._id === n._id
1231
1233
  ) === -1
1232
- ).map((u) => new Notification(u));
1234
+ ).map((n) => new Notification(n));
1233
1235
  this._notifications = this._notifications.concat(i), this._pageNumber++;
1234
1236
  } else
1235
1237
  this._lastPage = !0;
@@ -1317,7 +1319,7 @@ const f = class f {
1317
1319
  //
1318
1320
  // PROTECTED HELPERS
1319
1321
  //
1320
- n(this, "checkHttpResponse", (e) => {
1322
+ u(this, "checkHttpResponse", (e) => {
1321
1323
  if (this.http.latestResponse.status >= 300)
1322
1324
  throw this.http.latestResponse.statusText;
1323
1325
  return e;
@@ -1469,7 +1471,7 @@ const f = class f {
1469
1471
  });
1470
1472
  return t.map((r) => {
1471
1473
  const i = s.resources.find(
1472
- (u) => u.assetId === r
1474
+ (n) => n.assetId === r
1473
1475
  );
1474
1476
  if (i === void 0)
1475
1477
  throw "explorer.assetid.notfound";
@@ -1535,10 +1537,10 @@ const f = class f {
1535
1537
  //
1536
1538
  // STATIC REGISTRY
1537
1539
  //
1538
- n(f, "registry", new ServiceRegistry()), // Expose some useful functions
1539
- n(f, "register", f.registry.register.bind(f.registry)), n(f, "findService", f.registry.findService.bind(f.registry)), n(f, "findMainService", f.registry.findMainService.bind(f.registry)), n(f, "isRegistered", f.registry.isRegistered.bind(f.registry));
1540
+ u(f, "registry", new ServiceRegistry()), // Expose some useful functions
1541
+ u(f, "register", f.registry.register.bind(f.registry)), u(f, "findService", f.registry.findService.bind(f.registry)), u(f, "findMainService", f.registry.findMainService.bind(f.registry)), u(f, "isRegistered", f.registry.isRegistered.bind(f.registry));
1540
1542
  let ResourceService = f;
1541
- const APP = "scrapbook", RESOURCE = "scrapbook";
1543
+ const APP$2 = "scrapbook", RESOURCE$2 = "scrapbook";
1542
1544
  class ScrapbookResourceService extends ResourceService {
1543
1545
  create(e) {
1544
1546
  throw new Error("Method not implemented.");
@@ -1556,10 +1558,10 @@ class ScrapbookResourceService extends ResourceService {
1556
1558
  return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
1557
1559
  }
1558
1560
  getResourceType() {
1559
- return RESOURCE;
1561
+ return RESOURCE$2;
1560
1562
  }
1561
1563
  getApplication() {
1562
- return APP;
1564
+ return APP$2;
1563
1565
  }
1564
1566
  getFormUrl(e) {
1565
1567
  return e ? `/scrapbook?folderid=${e}#/create-scrapbook/` : "/scrapbook#/create-scrapbook/";
@@ -1578,9 +1580,112 @@ class ScrapbookResourceService extends ResourceService {
1578
1580
  }
1579
1581
  }
1580
1582
  ResourceService.register(
1581
- { application: RESOURCE, resourceType: RESOURCE },
1583
+ { application: RESOURCE$2, resourceType: RESOURCE$2 },
1582
1584
  (o) => new ScrapbookResourceService(o)
1583
1585
  );
1586
+ const APP$1 = "homeworks", RESOURCE$1 = "homeworks";
1587
+ class HomeworksResourceService extends ResourceService {
1588
+ async create(e) {
1589
+ const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.post("/homeworks", {
1590
+ title: e.name,
1591
+ thumbnail: t,
1592
+ description: e.description,
1593
+ repeats: e.repeats
1594
+ });
1595
+ return this.checkHttpResponse(s), { thumbnail: t, entId: s._id };
1596
+ }
1597
+ async update(e) {
1598
+ const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.put(
1599
+ `/homeworks/${e.entId}`,
1600
+ {
1601
+ title: e.name,
1602
+ thumbnail: t,
1603
+ repeats: e.repeats
1604
+ }
1605
+ );
1606
+ return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
1607
+ }
1608
+ getResourceType() {
1609
+ return RESOURCE$1;
1610
+ }
1611
+ getApplication() {
1612
+ return APP$1;
1613
+ }
1614
+ getFormUrl(e) {
1615
+ return e ? `/homeworks?folderid=${e}#/create-homeworks/` : "/homeworks#/create-homeworks/";
1616
+ }
1617
+ getViewUrl(e) {
1618
+ return `/homeworks#/view-homeworks/${e}`;
1619
+ }
1620
+ getPrintUrl(e) {
1621
+ return `/homeworks/print#/print-homeworks/${e}`;
1622
+ }
1623
+ getEditUrl(e) {
1624
+ return `/homeworks#/edit-homeworks/${e}`;
1625
+ }
1626
+ getExportUrl() {
1627
+ throw new Error("Export not implemented.");
1628
+ }
1629
+ }
1630
+ ResourceService.register(
1631
+ { application: RESOURCE$1, resourceType: RESOURCE$1 },
1632
+ (o) => new HomeworksResourceService(o)
1633
+ );
1634
+ const APP = "timelinegenerator", RESOURCE = "timelinegenerator";
1635
+ class TimelineGeneratorResourceService extends ResourceService {
1636
+ async create(e) {
1637
+ const t = e.thumbnail ? await this.getThumbnailPath(e.thumbnail) : "", s = await this.http.post(
1638
+ "/timelinegenerator/timelines",
1639
+ {
1640
+ headline: e.name,
1641
+ text: e.description,
1642
+ icon: t,
1643
+ type: "default",
1644
+ folder: e.folder
1645
+ }
1646
+ );
1647
+ return this.checkHttpResponse(s), s;
1648
+ }
1649
+ async update(e) {
1650
+ const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.put(
1651
+ `/timelinegenerator/timeline/${e.entId}`,
1652
+ {
1653
+ headline: e.name,
1654
+ text: e.description,
1655
+ icon: t,
1656
+ trashed: !!e.trashed,
1657
+ _id: e.entId,
1658
+ type: "default"
1659
+ }
1660
+ );
1661
+ return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
1662
+ }
1663
+ getResourceType() {
1664
+ return RESOURCE;
1665
+ }
1666
+ getApplication() {
1667
+ return APP;
1668
+ }
1669
+ getFormUrl() {
1670
+ throw new Error("Method not implemented.");
1671
+ }
1672
+ getViewUrl(e) {
1673
+ return `/timelinegenerator#/view/${e}`;
1674
+ }
1675
+ getPrintUrl(e) {
1676
+ return `/timelinegenerator/print#/print/${e}`;
1677
+ }
1678
+ getEditUrl() {
1679
+ throw new Error("Method not implemented.");
1680
+ }
1681
+ getExportUrl() {
1682
+ throw new Error("Method not implemented.");
1683
+ }
1684
+ }
1685
+ ResourceService.register(
1686
+ { application: RESOURCE, resourceType: RESOURCE },
1687
+ (o) => new TimelineGeneratorResourceService(o)
1688
+ );
1584
1689
  const globalCache = {}, mutexPromise = {};
1585
1690
  class CacheService {
1586
1691
  constructor(e) {
@@ -1590,7 +1695,7 @@ class CacheService {
1590
1695
  return this.context.http();
1591
1696
  }
1592
1697
  async fromCacheIfPossible(e, t, s) {
1593
- if (mutexPromise[e] && await mutexPromise[e], globalCache[e])
1698
+ if (mutexPromise[e] !== void 0 && await mutexPromise[e], globalCache[e])
1594
1699
  return globalCache[e];
1595
1700
  try {
1596
1701
  const r = t();
@@ -1648,14 +1753,14 @@ class ConfService {
1648
1753
  ]), [r, i] = await Promise.all([
1649
1754
  this.getTheme({ conf: t, publicTheme: s === void 0 }),
1650
1755
  this.getWebAppConf({ app: e, applications: s ?? [] })
1651
- ]), u = {
1756
+ ]), n = {
1652
1757
  app: e,
1653
1758
  applications: s ?? [],
1654
1759
  conf: t,
1655
1760
  currentApp: i,
1656
1761
  theme: r
1657
1762
  };
1658
- return this.notify.onAppConfReady().resolve(u), u;
1763
+ return this.notify.onAppConfReady().resolve(n), n;
1659
1764
  }
1660
1765
  async getPublicConf(e) {
1661
1766
  const { response: t, value: s } = await this.cache.httpGet(
@@ -1707,25 +1812,23 @@ class ConfService {
1707
1812
  conf: t,
1708
1813
  publicTheme: s
1709
1814
  }) {
1710
- const { value: r } = await this.cache.httpGet("/theme", {
1711
- queryParams: { _: e }
1712
- }), i = s ? null : r, u = t == null ? void 0 : t.overriding.find(
1815
+ const r = await this.http.get("/theme"), i = s ? null : r, n = t == null ? void 0 : t.overriding.find(
1713
1816
  (p) => (
1714
1817
  // Public access => simply use the 1st override
1715
1818
  i === null || p.child === i.themeName
1716
1819
  )
1717
- ), a = (i == null ? void 0 : i.skinName) || u.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${u.child}/skins/${a}/`, h = u.skins, l = u.bootstrapVersion.split("-").slice(-1)[0], E = u.parent === "panda";
1820
+ ), a = (i == null ? void 0 : i.skinName) || n.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${n.child}/skins/${a}/`, h = n.skins, l = n.bootstrapVersion.split("-").slice(-1)[0], E = n.parent === "panda";
1718
1821
  return {
1719
1822
  basePath: `${this.cdnDomain}${c}../../`,
1720
1823
  bootstrapVersion: l,
1721
1824
  is1d: E,
1722
1825
  logoutCallback: (i == null ? void 0 : i.logoutCallback) || "/",
1723
- skin: u.child,
1826
+ skin: n.child,
1724
1827
  skinName: a,
1725
1828
  skins: h,
1726
- themeName: u.child,
1829
+ themeName: n.child,
1727
1830
  themeUrl: c,
1728
- npmTheme: u.npmTheme ?? void 0
1831
+ npmTheme: n.npmTheme ?? void 0
1729
1832
  };
1730
1833
  }
1731
1834
  async getLogoutCallback(e) {
@@ -1770,13 +1873,13 @@ class DirectoryService {
1770
1873
  return {
1771
1874
  id: s,
1772
1875
  displayName: r,
1773
- groups: t.map(({ name: u, id: a }) => ({
1774
- displayName: u,
1876
+ groups: t.map(({ name: n, id: a }) => ({
1877
+ displayName: n,
1775
1878
  id: a
1776
1879
  })),
1777
- users: i.map(({ displayName: u, id: a, profile: c }) => ({
1880
+ users: i.map(({ displayName: n, id: a, profile: c }) => ({
1778
1881
  profile: c,
1779
- displayName: u,
1882
+ displayName: n,
1780
1883
  // these info are missing from api
1781
1884
  firstName: "",
1782
1885
  lastName: "",
@@ -1791,19 +1894,19 @@ class DirectoryService {
1791
1894
  users: r
1792
1895
  }) {
1793
1896
  this.cache.clearCache("/directory/sharebookmark/all");
1794
- const i = r.map((p) => typeof p == "string" ? p : p.id), u = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
1897
+ const i = r.map((p) => typeof p == "string" ? p : p.id), n = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
1795
1898
  if (typeof p == "string") {
1796
- const { displayName: d, groups: g, id: A, users: m } = await this.getBookMarkById(p), b = m.map((F) => F.id), R = g.map((F) => F.id);
1899
+ const { displayName: d, groups: g, id: A, users: m } = await this.getBookMarkById(p), b = m.map((F) => F.id), C = g.map((F) => F.id);
1797
1900
  return {
1798
1901
  displayName: d,
1799
1902
  id: A,
1800
- members: [...R, ...b]
1903
+ members: [...C, ...b]
1801
1904
  };
1802
1905
  } else
1803
1906
  return Promise.resolve(p);
1804
1907
  }), h = (await Promise.all(a)).map((p) => p.members).reduce((p, d) => [...p, ...d], []), l = {
1805
1908
  name: e,
1806
- members: [...i, ...u, ...h]
1909
+ members: [...i, ...n, ...h]
1807
1910
  }, { id: E } = await this.http.postJson(
1808
1911
  "/directory/sharebookmark",
1809
1912
  l
@@ -1819,10 +1922,10 @@ const loadedScripts = {};
1819
1922
  class HttpService {
1820
1923
  constructor(e, t) {
1821
1924
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
1822
- n(this, "axios");
1823
- n(this, "baseUrl");
1824
- n(this, "headers", {});
1825
- n(this, "_latestResponse");
1925
+ u(this, "axios");
1926
+ u(this, "baseUrl");
1927
+ u(this, "headers", {});
1928
+ u(this, "_latestResponse");
1826
1929
  this.context = e, this.axios = axios.create(t);
1827
1930
  }
1828
1931
  fixBaseUrl(e) {
@@ -1867,15 +1970,15 @@ class HttpService {
1867
1970
  status: 500,
1868
1971
  statusText: ERROR_CODE.UNKNOWN
1869
1972
  };
1870
- const { status: s, statusText: r, headers: i, data: u } = this._latestResponse;
1973
+ const { status: s, statusText: r, headers: i, data: n } = this._latestResponse;
1871
1974
  return t != null && t.disableNotifications || notify.events().publish(LAYER_NAME.TRANSPORT, {
1872
1975
  name: EVENT_NAME.ERROR_OCCURED,
1873
1976
  data: {
1874
1977
  params: t,
1875
1978
  response: { status: s, statusText: r, headers: i },
1876
- payload: u
1979
+ payload: n
1877
1980
  }
1878
- }), u;
1981
+ }), n;
1879
1982
  }
1880
1983
  mapAxiosResponse(e, t) {
1881
1984
  return this._latestResponse = e, e.data;
@@ -1998,15 +2101,15 @@ class HttpService {
1998
2101
  }
1999
2102
  getScript(e, t, s) {
2000
2103
  const r = s ?? "exports", i = this.toAxiosConfig(t);
2001
- return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((u) => this.mapAxiosResponse(u, t)).then((u) => {
2104
+ return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((n) => this.mapAxiosResponse(n, t)).then((n) => {
2002
2105
  try {
2003
- const a = `"use strict";var ${r.split(".")[0]}={};${u};return ${r};`;
2106
+ const a = `"use strict";var ${r.split(".")[0]}={};${n};return ${r};`;
2004
2107
  return Function(a)();
2005
2108
  } catch {
2006
- return u;
2109
+ return n;
2007
2110
  }
2008
- }).catch((u) => {
2009
- throw this.mapAxiosError(u, t), u;
2111
+ }).catch((n) => {
2112
+ throw this.mapAxiosError(n, t), n;
2010
2113
  });
2011
2114
  }
2012
2115
  loadScript(e, t) {
@@ -2066,13 +2169,13 @@ class RightService {
2066
2169
  * @returns true if has rights
2067
2170
  */
2068
2171
  hasResourceRight({ id: e, groupIds: t }, s, r) {
2069
- const i = r.map((u) => typeof u == "string" ? this.parseResourceRight(u) : u).filter((u) => u !== void 0);
2070
- for (const u of i) {
2071
- if (u.id === e && u.type === "creator")
2172
+ const i = r.map((n) => typeof n == "string" ? this.parseResourceRight(n) : n).filter((n) => n !== void 0);
2173
+ for (const n of i) {
2174
+ if (n.id === e && n.type === "creator")
2072
2175
  return !0;
2073
- if (u.id === e && u.type === "user" && u.right === s)
2176
+ if (n.id === e && n.type === "user" && n.right === s)
2074
2177
  return !0;
2075
- if (t.includes(u.id) && u.type === "group" && u.right === s)
2178
+ if (t.includes(n.id) && n.type === "group" && n.right === s)
2076
2179
  return !0;
2077
2180
  }
2078
2181
  return !1;
@@ -2209,7 +2312,7 @@ class SessionService {
2209
2312
  s,
2210
2313
  r,
2211
2314
  i,
2212
- u
2315
+ n
2213
2316
  ] = await Promise.all([
2214
2317
  this.getCurrentLanguage(e),
2215
2318
  this.latestQuotaAndUsage(e),
@@ -2223,7 +2326,7 @@ class SessionService {
2223
2326
  currentLanguage: t,
2224
2327
  userDescription: r,
2225
2328
  userProfile: i,
2226
- bookmarkedApps: u
2329
+ bookmarkedApps: n
2227
2330
  };
2228
2331
  }
2229
2332
  login(e, t, s, r) {
@@ -2317,9 +2420,9 @@ class SessionService {
2317
2420
  applications: []
2318
2421
  });
2319
2422
  const i = [];
2320
- return r.bookmarks.forEach((u, a) => {
2423
+ return r.bookmarks.forEach((n, a) => {
2321
2424
  const c = ((e == null ? void 0 : e.apps) || []).find(
2322
- (h) => h.name === u
2425
+ (h) => h.name === n
2323
2426
  );
2324
2427
  if (c) {
2325
2428
  const h = Object.assign({}, c);
@@ -2329,8 +2432,8 @@ class SessionService {
2329
2432
  }
2330
2433
  async getUserProfile(e = {}) {
2331
2434
  var c, h;
2332
- const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: u, value: a } = await this.cache.httpGet(i, t);
2333
- return u.status < 200 || u.status >= 300 || typeof a == "string" ? ["Guest"] : ((h = (c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) == null ? void 0 : h.type) || ["Guest"];
2435
+ const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: n, value: a } = await this.cache.httpGet(i, t);
2436
+ return n.status < 200 || n.status >= 300 || typeof a == "string" ? ["Guest"] : ((h = (c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) == null ? void 0 : h.type) || ["Guest"];
2334
2437
  }
2335
2438
  async isAdml() {
2336
2439
  const e = await this.getUser();
@@ -2348,384 +2451,20 @@ class SessionService {
2348
2451
  });
2349
2452
  }
2350
2453
  }
2351
- class StringUtils {
2352
- static removeAccents(e) {
2353
- for (let t = 0; t < defaultDiacriticsRemovalMap$1.length; t++)
2354
- e = e.replace(
2355
- defaultDiacriticsRemovalMap$1[t].letters,
2356
- defaultDiacriticsRemovalMap$1[t].base
2357
- );
2358
- return e;
2359
- }
2360
- }
2361
- class ShareService {
2362
- //
2363
- // IMPLEMENTATION
2364
- //
2365
- constructor(e) {
2366
- this.context = e;
2367
- }
2368
- get directory() {
2369
- return this.context.directory();
2370
- }
2371
- get http() {
2372
- return this.context.http();
2373
- }
2374
- get cache() {
2375
- return this.context.cache();
2376
- }
2377
- async searchShareSubjects(e, t, s) {
2378
- const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
2379
- `/${e}/share/json/${t}?search=${s}`
2380
- ), u = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
2381
- const g = StringUtils.removeAccents(
2382
- p || ""
2383
- ).toLowerCase(), A = StringUtils.removeAccents(
2384
- E || ""
2385
- ).toLowerCase(), m = StringUtils.removeAccents(
2386
- l || ""
2387
- ).toLowerCase(), b = StringUtils.removeAccents(d || "").toLowerCase();
2388
- return m.includes(r) || A.includes(r) || g.includes(r) || b.includes(r);
2389
- }).map((l) => ({
2390
- avatarUrl: this.directory.getAvatarUrl(l.id, "user"),
2391
- directoryUrl: this.directory.getDirectoryUrl(l.id, "user"),
2392
- displayName: l.username,
2393
- id: l.id,
2394
- profile: l.profile,
2395
- type: "user"
2396
- })), a = i.groups.visibles.filter(({ name: l }) => StringUtils.removeAccents(l || "").toLowerCase().includes(r)).map((l) => ({
2397
- avatarUrl: this.directory.getAvatarUrl(l.id, "group"),
2398
- directoryUrl: this.directory.getDirectoryUrl(l.id, "group"),
2399
- displayName: l.name,
2400
- id: l.id,
2401
- type: "group",
2402
- structureName: l.structureName
2403
- }));
2404
- return [...(await this.directory.getBookMarks()).filter(({ displayName: l }) => StringUtils.removeAccents(
2405
- l || ""
2406
- ).toLowerCase().includes(r)).map((l) => ({
2407
- avatarUrl: "",
2408
- directoryUrl: "",
2409
- profile: "",
2410
- displayName: l.displayName,
2411
- id: l.id,
2412
- type: "sharebookmark"
2413
- })), ...u, ...a];
2414
- }
2415
- async getShareMapping(e) {
2416
- const t = await this.cache.httpGetJson(
2417
- `/${e}/rights/sharing`
2418
- );
2419
- for (const s of Object.keys(t))
2420
- if (s.includes(".")) {
2421
- const r = s.split(".")[1], i = t[s];
2422
- delete t[s], t[r] = i;
2423
- }
2424
- return t;
2425
- }
2426
- getActionsAvailableFor({ id: e, type: t }, s, r) {
2427
- const u = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
2428
- for (const h of a)
2429
- r[h].filter(
2430
- (p) => u.includes(p)
2431
- ).length > 0 && c.push(h);
2432
- return c;
2433
- }
2434
- async getRightsForResource(e, t) {
2435
- const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), u = await this.getShareMapping(e), a = await this.cache.httpGetJson(
2436
- "/infra/public/json/sharing-rights.json"
2437
- ), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
2438
- (A) => A.id === d
2439
- )).filter((d) => d !== void 0).map((d) => {
2440
- const g = this.getActionsAvailableFor(
2441
- { id: d.id, type: "user" },
2442
- i,
2443
- u
2444
- );
2445
- return {
2446
- id: d.id,
2447
- type: "user",
2448
- displayName: d.username,
2449
- profile: d.profile,
2450
- avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
2451
- directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
2452
- actions: g.map((m) => {
2453
- const b = a[m];
2454
- return {
2455
- displayName: m,
2456
- id: m,
2457
- priority: b.priority
2458
- };
2459
- })
2460
- };
2461
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(i.groups.checked).map((d) => i.groups.visibles.find(
2462
- (A) => A.id === d
2463
- )).filter((d) => d !== void 0).map((d) => {
2464
- const g = this.getActionsAvailableFor(
2465
- { id: d.id, type: "group" },
2466
- i,
2467
- u
2468
- );
2469
- return {
2470
- id: d.id,
2471
- type: "group",
2472
- displayName: d.name,
2473
- profile: void 0,
2474
- avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
2475
- directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
2476
- actions: g.map((m) => {
2477
- const b = a[m];
2478
- return {
2479
- displayName: m,
2480
- id: m,
2481
- priority: b.priority
2482
- };
2483
- })
2484
- };
2485
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), l = [...c, ...h], E = i.groups.visibles.map(
2486
- ({ groupDisplayName: d, id: g, name: A }) => ({
2487
- displayName: d || A,
2488
- id: g
2489
- })
2490
- ), p = i.users.visibles.map(
2491
- ({ id: d, profile: g, username: A, firstName: m, lastName: b, login: R }) => ({
2492
- displayName: A,
2493
- firstName: m,
2494
- lastName: b,
2495
- login: R,
2496
- profile: g,
2497
- id: d
2498
- })
2499
- );
2500
- return {
2501
- rights: l,
2502
- visibleBookmarks: s,
2503
- visibleGroups: E,
2504
- visibleUsers: p
2505
- };
2506
- }
2507
- async saveRights(e, t, s) {
2508
- const r = await this.getShareMapping(e), i = {
2509
- bookmarks: {},
2510
- groups: {},
2511
- users: {}
2512
- };
2513
- for (const c of s) {
2514
- const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
2515
- l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
2516
- }
2517
- const u = `/${e}/share/resource/${t}`;
2518
- return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(u, i);
2519
- }
2520
- async getActionsForApp(e) {
2521
- const t = await this.cache.httpGetJson(
2522
- "/infra/public/json/sharing-rights.json"
2523
- ), s = await this.getShareMapping(e);
2524
- return Object.keys(t).map((i) => {
2525
- const u = t[i];
2526
- return {
2527
- displayName: i,
2528
- id: i,
2529
- priority: u.priority,
2530
- requires: u.requires
2531
- };
2532
- }).filter((i) => {
2533
- var u;
2534
- return ((u = s[i.id]) == null ? void 0 : u.length) > 0;
2535
- }).sort((i, u) => i.priority - u.priority);
2536
- }
2537
- }
2538
- const defaultMappers = {
2539
- csv: function({ type: o, extension: e }) {
2540
- return MimeTypeUtils.INSTANCE.isCsvLike(o, e);
2541
- },
2542
- doc: function({ type: o, extension: e }) {
2543
- return MimeTypeUtils.INSTANCE.isWordLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("wordprocessing") !== -1;
2454
+ const bundle = {}, promises = {}, defaultDiacriticsRemovalMap = [
2455
+ {
2456
+ base: "A",
2457
+ letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
2544
2458
  },
2545
- xls: function({ type: o, extension: e }) {
2546
- return MimeTypeUtils.INSTANCE.isExcelLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("spreadsheet") !== -1 || o.indexOf("ms-excel") !== -1;
2547
- },
2548
- img: function({ type: o }) {
2549
- return o.indexOf("image") !== -1;
2550
- },
2551
- pdf: function({ type: o }) {
2552
- return o.indexOf("pdf") !== -1 || o === "application/x-download";
2553
- },
2554
- ppt: function({ type: o, extension: e }) {
2555
- return MimeTypeUtils.INSTANCE.isPowerpointLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("presentation") !== -1 || o.indexOf("powerpoint") !== -1;
2556
- },
2557
- txt: function({ type: o, extension: e }) {
2558
- return MimeTypeUtils.INSTANCE.isTxtLike(o, e);
2559
- },
2560
- md: function({ type: o, extension: e }) {
2561
- return MimeTypeUtils.INSTANCE.isMdLike(o, e);
2562
- },
2563
- video: function({ type: o }) {
2564
- return o.indexOf("video") !== -1;
2565
- },
2566
- audio: function({ type: o }) {
2567
- return o.indexOf("audio") !== -1;
2568
- },
2569
- zip: function({ type: o }) {
2570
- return o.indexOf("zip") !== -1 || o.indexOf("rar") !== -1 || o.indexOf("tar") !== -1 || o.indexOf("7z") !== -1;
2571
- }
2572
- }, w = class w {
2573
- /* Similar role notion as in infra-front > workspace > Model.ts */
2574
- static getRole(e) {
2575
- var t, s;
2576
- return w.role(
2577
- (t = e.metadata) == null ? void 0 : t["content-type"],
2578
- !1,
2579
- (s = e.metadata) == null ? void 0 : s.extension
2580
- );
2581
- }
2582
- /* Similar role notion as in infra-front > workspace > Model.ts */
2583
- static role(e, t = !1, s) {
2584
- if (s && (s = s.trim()), !e) return "unknown";
2585
- this.roleMappers || console.warn("[DocumentHelper.role] should not have empty roles", this);
2586
- const r = { type: e, previewRole: t, extension: s };
2587
- for (const i of this.roleMappers) {
2588
- const u = i(r);
2589
- if (u)
2590
- return u;
2591
- }
2592
- return "unknown";
2593
- }
2594
- };
2595
- // FIXME add edumedia support
2596
- n(w, "roleMappers", [
2597
- (e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
2598
- ]);
2599
- let DocumentHelper = w;
2600
- class WorkspaceService {
2601
- constructor(e) {
2602
- this.context = e;
2603
- }
2604
- get http() {
2605
- return this.context.http();
2606
- }
2607
- extractMetadata(e) {
2608
- const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "", u = {
2609
- "content-type": r,
2610
- filename: t,
2611
- size: e.size,
2612
- extension: i,
2613
- role: DocumentHelper.role(r, !1, i)
2614
- }, a = t.replace("." + u.extension, ""), c = u.extension ? a + "." + u.extension : a;
2615
- return { basename: a, fullname: c, metadata: u };
2616
- }
2617
- async saveFile(e, t) {
2618
- const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
2619
- i.append("file", e, s);
2620
- const u = [];
2621
- ((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && u.push(`${t.visibility}=true`), t != null && t.application && u.push(`application=${t.application}`), r.role === "img" && u.push("quality=1"), t != null && t.parentId && u.push(`parentId=${t.parentId}`);
2622
- const a = await this.http.postFile(
2623
- `/workspace/document?${u.join("&")}`,
2624
- i
2625
- );
2626
- if (this.http.isResponseError())
2627
- throw this.http.latestResponse.statusText;
2628
- return a;
2629
- }
2630
- async updateFile(e, t, s) {
2631
- const { fullname: r, metadata: i } = this.extractMetadata(t), u = new FormData();
2632
- u.append("file", t, r);
2633
- const a = [];
2634
- 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}`);
2635
- const c = await this.http.putFile(
2636
- `/workspace/document/${e}?${a.join("&")}`,
2637
- u
2638
- );
2639
- if (this.http.isResponseError())
2640
- throw this.http.latestResponse.statusText;
2641
- return c;
2642
- }
2643
- async deleteFile(e) {
2644
- const t = e.map((s) => s._id);
2645
- if (t.length == 0)
2646
- Promise.resolve(null);
2647
- else if (await this.http.deleteJson("/workspace/documents", {
2648
- ids: t
2649
- }), this.http.isResponseError())
2650
- throw this.http.latestResponse.statusText;
2651
- }
2652
- async acceptDocuments(e) {
2653
- const t = await this.context.session().getUser();
2654
- return (s) => s.deleted && s.trasher ? (t == null ? void 0 : t.userId) == s.trasher : !0;
2655
- }
2656
- async searchDocuments(e) {
2657
- const t = e.filter !== "external" || e.parentId ? await this.http.get("/workspace/documents", {
2658
- queryParams: { ...e, _: (/* @__PURE__ */ new Date()).getTime() }
2659
- }) : [], s = await this.acceptDocuments(e);
2660
- return t.filter(s);
2661
- }
2662
- async listDocuments(e, t) {
2663
- return this.searchDocuments({ filter: e, parentId: t, includeall: !0 });
2664
- }
2665
- /**
2666
- * Duplicate and transfers documents if needed to a different folder with the specified application and visibility.
2667
- * @param documents - The array of documents to transfer.
2668
- * @param application - The application to associate with the transferred documents.
2669
- * @param visibility - The visibility of the transferred documents. Defaults to "protected".
2670
- * @returns A Promise that resolves to an array of transferred WorkspaceElements.
2671
- */
2672
- async transferDocuments(e, t, s = "protected") {
2673
- const r = [];
2674
- if (e.forEach((i) => {
2675
- (s === "public" && !i.public || !i.public && !i.protected) && r.push(i);
2676
- }), r.length > 0) {
2677
- const i = await this.http.post(
2678
- "/workspace/documents/transfer",
2679
- {
2680
- application: t,
2681
- visibility: s,
2682
- ids: r.map((u) => u._id)
2683
- }
2684
- );
2685
- if (this.http.isResponseError())
2686
- throw this.http.latestResponse.statusText;
2687
- return r.forEach((u, a) => {
2688
- const c = e.findIndex(
2689
- (h) => h._id === u._id
2690
- );
2691
- 0 <= c && c < e.length && (e[c] = i[a]);
2692
- }), e.filter((u) => !!u);
2693
- }
2694
- return e;
2695
- }
2696
- /**
2697
- * Get the URL of the thumbnail of a workspace element (or its URL),
2698
- * or `null` if none exists or can be created.
2699
- */
2700
- getThumbnailUrl(e, t = 0, s = 0) {
2701
- var i, u;
2702
- const r = t > 0 || s > 0 ? `${t}x${s}` : "120x120";
2703
- if (typeof e == "string")
2704
- return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
2705
- {
2706
- const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
2707
- if ((u = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && u.includes("video")) {
2708
- const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
2709
- return h ? a + h : null;
2710
- } else
2711
- return a + r;
2712
- }
2713
- }
2714
- }
2715
- const bundle = {}, promises = {}, defaultDiacriticsRemovalMap = [
2716
- {
2717
- base: "A",
2718
- letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
2719
- },
2720
- { base: "AA", letters: /[\uA732]/g },
2721
- { base: "AE", letters: /[\u00C6\u01FC\u01E2]/g },
2722
- { base: "AO", letters: /[\uA734]/g },
2723
- { base: "AU", letters: /[\uA736]/g },
2724
- { base: "AV", letters: /[\uA738\uA73A]/g },
2725
- { base: "AY", letters: /[\uA73C]/g },
2726
- {
2727
- base: "B",
2728
- letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
2459
+ { base: "AA", letters: /[\uA732]/g },
2460
+ { base: "AE", letters: /[\u00C6\u01FC\u01E2]/g },
2461
+ { base: "AO", letters: /[\uA734]/g },
2462
+ { base: "AU", letters: /[\uA736]/g },
2463
+ { base: "AV", letters: /[\uA738\uA73A]/g },
2464
+ { base: "AY", letters: /[\uA73C]/g },
2465
+ {
2466
+ base: "B",
2467
+ letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
2729
2468
  },
2730
2469
  {
2731
2470
  base: "C",
@@ -2935,7 +2674,7 @@ class IdiomService {
2935
2674
  e = e ?? "";
2936
2675
  let s = bundle[e] === void 0 ? e : bundle[e];
2937
2676
  if (t && typeof t == "object")
2938
- for (let r in t)
2677
+ for (const r in t)
2939
2678
  typeof t[r] < "u" && (s = s.replace(
2940
2679
  new RegExp("\\${" + r + "}", "g"),
2941
2680
  "" + t[r]
@@ -2958,8 +2697,8 @@ class IdiomService {
2958
2697
  else {
2959
2698
  const i = new Promisified();
2960
2699
  promises[t] = i.promise;
2961
- const u = {};
2962
- e && (u["Accept-Language"] = e), this.http.get(t, { headers: u }).then((a) => {
2700
+ const n = {};
2701
+ e && (n["Accept-Language"] = e), this.http.get(t, { headers: n }).then((a) => {
2963
2702
  Object.assign(bundle, a), typeof s == "function" && s(), i.resolve();
2964
2703
  }).catch((a) => {
2965
2704
  typeof s == "function" && s(), i.reject();
@@ -2982,11 +2721,21 @@ class IdiomService {
2982
2721
  }) : Promise.reject();
2983
2722
  }
2984
2723
  addKeys(e) {
2985
- for (var t in e)
2724
+ for (const t in e)
2986
2725
  typeof bundle[t] != "string" && (bundle[t] = e[t]);
2987
2726
  }
2988
2727
  removeAccents(e) {
2989
- for (var t = 0; t < defaultDiacriticsRemovalMap.length; t++)
2728
+ for (let t = 0; t < defaultDiacriticsRemovalMap.length; t++)
2729
+ e = e.replace(
2730
+ defaultDiacriticsRemovalMap[t].letters,
2731
+ defaultDiacriticsRemovalMap[t].base
2732
+ );
2733
+ return e;
2734
+ }
2735
+ }
2736
+ class StringUtils {
2737
+ static removeAccents(e) {
2738
+ for (let t = 0; t < defaultDiacriticsRemovalMap.length; t++)
2990
2739
  e = e.replace(
2991
2740
  defaultDiacriticsRemovalMap[t].letters,
2992
2741
  defaultDiacriticsRemovalMap[t].base
@@ -2994,6 +2743,360 @@ class IdiomService {
2994
2743
  return e;
2995
2744
  }
2996
2745
  }
2746
+ class ShareService {
2747
+ //
2748
+ // IMPLEMENTATION
2749
+ //
2750
+ constructor(e) {
2751
+ this.context = e;
2752
+ }
2753
+ get directory() {
2754
+ return this.context.directory();
2755
+ }
2756
+ get http() {
2757
+ return this.context.http();
2758
+ }
2759
+ get cache() {
2760
+ return this.context.cache();
2761
+ }
2762
+ async searchShareSubjects(e, t, s) {
2763
+ const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
2764
+ `/${e}/share/json/${t}?search=${s}`
2765
+ ), n = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
2766
+ const g = StringUtils.removeAccents(
2767
+ p || ""
2768
+ ).toLowerCase(), A = StringUtils.removeAccents(
2769
+ E || ""
2770
+ ).toLowerCase(), m = StringUtils.removeAccents(
2771
+ l || ""
2772
+ ).toLowerCase(), b = StringUtils.removeAccents(d || "").toLowerCase();
2773
+ return m.includes(r) || A.includes(r) || g.includes(r) || b.includes(r);
2774
+ }).map((l) => ({
2775
+ avatarUrl: this.directory.getAvatarUrl(l.id, "user"),
2776
+ directoryUrl: this.directory.getDirectoryUrl(l.id, "user"),
2777
+ displayName: l.username,
2778
+ id: l.id,
2779
+ profile: l.profile,
2780
+ type: "user"
2781
+ })), a = i.groups.visibles.filter(({ name: l }) => StringUtils.removeAccents(l || "").toLowerCase().includes(r)).map((l) => ({
2782
+ avatarUrl: this.directory.getAvatarUrl(l.id, "group"),
2783
+ directoryUrl: this.directory.getDirectoryUrl(l.id, "group"),
2784
+ displayName: l.name,
2785
+ id: l.id,
2786
+ type: "group",
2787
+ structureName: l.structureName
2788
+ }));
2789
+ return [...(await this.directory.getBookMarks()).filter(({ displayName: l }) => StringUtils.removeAccents(
2790
+ l || ""
2791
+ ).toLowerCase().includes(r)).map((l) => ({
2792
+ avatarUrl: "",
2793
+ directoryUrl: "",
2794
+ profile: "",
2795
+ displayName: l.displayName,
2796
+ id: l.id,
2797
+ type: "sharebookmark"
2798
+ })), ...n, ...a];
2799
+ }
2800
+ async getShareMapping(e) {
2801
+ const t = await this.cache.httpGetJson(
2802
+ `/${e}/rights/sharing`
2803
+ );
2804
+ for (const s of Object.keys(t))
2805
+ if (s.includes(".")) {
2806
+ const r = s.split(".")[1], i = t[s];
2807
+ delete t[s], t[r] = i;
2808
+ }
2809
+ return t;
2810
+ }
2811
+ getActionsAvailableFor({ id: e, type: t }, s, r) {
2812
+ const n = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
2813
+ for (const h of a)
2814
+ r[h].filter(
2815
+ (p) => n.includes(p)
2816
+ ).length > 0 && c.push(h);
2817
+ return c;
2818
+ }
2819
+ async getRightsForResource(e, t) {
2820
+ const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), n = await this.getShareMapping(e), a = await this.cache.httpGetJson(
2821
+ "/infra/public/json/sharing-rights.json"
2822
+ ), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
2823
+ (A) => A.id === d
2824
+ )).filter((d) => d !== void 0).map((d) => {
2825
+ const g = this.getActionsAvailableFor(
2826
+ { id: d.id, type: "user" },
2827
+ i,
2828
+ n
2829
+ );
2830
+ return {
2831
+ id: d.id,
2832
+ type: "user",
2833
+ displayName: d.username,
2834
+ profile: d.profile,
2835
+ avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
2836
+ directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
2837
+ actions: g.map((m) => {
2838
+ const b = a[m];
2839
+ return {
2840
+ displayName: m,
2841
+ id: m,
2842
+ priority: b.priority
2843
+ };
2844
+ })
2845
+ };
2846
+ }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(i.groups.checked).map((d) => i.groups.visibles.find(
2847
+ (A) => A.id === d
2848
+ )).filter((d) => d !== void 0).map((d) => {
2849
+ const g = this.getActionsAvailableFor(
2850
+ { id: d.id, type: "group" },
2851
+ i,
2852
+ n
2853
+ );
2854
+ return {
2855
+ id: d.id,
2856
+ type: "group",
2857
+ displayName: d.name,
2858
+ profile: void 0,
2859
+ avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
2860
+ directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
2861
+ actions: g.map((m) => {
2862
+ const b = a[m];
2863
+ return {
2864
+ displayName: m,
2865
+ id: m,
2866
+ priority: b.priority
2867
+ };
2868
+ })
2869
+ };
2870
+ }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), l = [...c, ...h], E = i.groups.visibles.map(
2871
+ ({ groupDisplayName: d, id: g, name: A }) => ({
2872
+ displayName: d || A,
2873
+ id: g
2874
+ })
2875
+ ), p = i.users.visibles.map(
2876
+ ({ id: d, profile: g, username: A, firstName: m, lastName: b, login: C }) => ({
2877
+ displayName: A,
2878
+ firstName: m,
2879
+ lastName: b,
2880
+ login: C,
2881
+ profile: g,
2882
+ id: d
2883
+ })
2884
+ );
2885
+ return {
2886
+ rights: l,
2887
+ visibleBookmarks: s,
2888
+ visibleGroups: E,
2889
+ visibleUsers: p
2890
+ };
2891
+ }
2892
+ async saveRights(e, t, s) {
2893
+ const r = await this.getShareMapping(e), i = {
2894
+ bookmarks: {},
2895
+ groups: {},
2896
+ users: {}
2897
+ };
2898
+ for (const c of s) {
2899
+ const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
2900
+ l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
2901
+ }
2902
+ const n = `/${e}/share/resource/${t}`;
2903
+ return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(n, i);
2904
+ }
2905
+ async getActionsForApp(e) {
2906
+ const t = await this.cache.httpGetJson(
2907
+ "/infra/public/json/sharing-rights.json"
2908
+ ), s = await this.getShareMapping(e);
2909
+ return Object.keys(t).map((i) => {
2910
+ const n = t[i];
2911
+ return {
2912
+ displayName: i,
2913
+ id: i,
2914
+ priority: n.priority,
2915
+ requires: n.requires
2916
+ };
2917
+ }).filter((i) => {
2918
+ var n;
2919
+ return ((n = s[i.id]) == null ? void 0 : n.length) > 0;
2920
+ }).sort((i, n) => i.priority - n.priority);
2921
+ }
2922
+ }
2923
+ const defaultMappers = {
2924
+ csv: function({ type: o, extension: e }) {
2925
+ return MimeTypeUtils.INSTANCE.isCsvLike(o, e);
2926
+ },
2927
+ doc: function({ type: o, extension: e }) {
2928
+ return MimeTypeUtils.INSTANCE.isWordLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("wordprocessing") !== -1;
2929
+ },
2930
+ xls: function({ type: o, extension: e }) {
2931
+ return MimeTypeUtils.INSTANCE.isExcelLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("spreadsheet") !== -1 || o.indexOf("ms-excel") !== -1;
2932
+ },
2933
+ img: function({ type: o }) {
2934
+ return o.indexOf("image") !== -1;
2935
+ },
2936
+ pdf: function({ type: o }) {
2937
+ return o.indexOf("pdf") !== -1 || o === "application/x-download";
2938
+ },
2939
+ ppt: function({ type: o, extension: e }) {
2940
+ return MimeTypeUtils.INSTANCE.isPowerpointLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("presentation") !== -1 || o.indexOf("powerpoint") !== -1;
2941
+ },
2942
+ txt: function({ type: o, extension: e }) {
2943
+ return MimeTypeUtils.INSTANCE.isTxtLike(o, e);
2944
+ },
2945
+ md: function({ type: o, extension: e }) {
2946
+ return MimeTypeUtils.INSTANCE.isMdLike(o, e);
2947
+ },
2948
+ video: function({ type: o }) {
2949
+ return o.indexOf("video") !== -1;
2950
+ },
2951
+ audio: function({ type: o }) {
2952
+ return o.indexOf("audio") !== -1;
2953
+ },
2954
+ zip: function({ type: o }) {
2955
+ return o.indexOf("zip") !== -1 || o.indexOf("rar") !== -1 || o.indexOf("tar") !== -1 || o.indexOf("7z") !== -1;
2956
+ }
2957
+ }, R = class R {
2958
+ /* Similar role notion as in infra-front > workspace > Model.ts */
2959
+ static getRole(e) {
2960
+ var t, s;
2961
+ return R.role(
2962
+ (t = e.metadata) == null ? void 0 : t["content-type"],
2963
+ !1,
2964
+ (s = e.metadata) == null ? void 0 : s.extension
2965
+ );
2966
+ }
2967
+ /* Similar role notion as in infra-front > workspace > Model.ts */
2968
+ static role(e, t = !1, s) {
2969
+ if (s && (s = s.trim()), !e) return "unknown";
2970
+ this.roleMappers || console.warn("[DocumentHelper.role] should not have empty roles", this);
2971
+ const r = { type: e, previewRole: t, extension: s };
2972
+ for (const i of this.roleMappers) {
2973
+ const n = i(r);
2974
+ if (n)
2975
+ return n;
2976
+ }
2977
+ return "unknown";
2978
+ }
2979
+ };
2980
+ // FIXME add edumedia support
2981
+ u(R, "roleMappers", [
2982
+ (e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
2983
+ ]);
2984
+ let DocumentHelper = R;
2985
+ class WorkspaceService {
2986
+ constructor(e) {
2987
+ this.context = e;
2988
+ }
2989
+ get http() {
2990
+ return this.context.http();
2991
+ }
2992
+ extractMetadata(e) {
2993
+ const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "", n = {
2994
+ "content-type": r,
2995
+ filename: t,
2996
+ size: e.size,
2997
+ extension: i,
2998
+ role: DocumentHelper.role(r, !1, i)
2999
+ }, a = t.replace("." + n.extension, ""), c = n.extension ? a + "." + n.extension : a;
3000
+ return { basename: a, fullname: c, metadata: n };
3001
+ }
3002
+ async saveFile(e, t) {
3003
+ const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
3004
+ i.append("file", e, s);
3005
+ const n = [];
3006
+ ((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && n.push(`${t.visibility}=true`), t != null && t.application && n.push(`application=${t.application}`), r.role === "img" && n.push("quality=1"), t != null && t.parentId && n.push(`parentId=${t.parentId}`);
3007
+ const a = await this.http.postFile(
3008
+ `/workspace/document?${n.join("&")}`,
3009
+ i
3010
+ );
3011
+ if (this.http.isResponseError())
3012
+ throw this.http.latestResponse.statusText;
3013
+ return a;
3014
+ }
3015
+ async updateFile(e, t, s) {
3016
+ const { fullname: r, metadata: i } = this.extractMetadata(t), n = new FormData();
3017
+ n.append("file", t, r);
3018
+ const a = [];
3019
+ 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}`);
3020
+ const c = await this.http.putFile(
3021
+ `/workspace/document/${e}?${a.join("&")}`,
3022
+ n
3023
+ );
3024
+ if (this.http.isResponseError())
3025
+ throw this.http.latestResponse.statusText;
3026
+ return c;
3027
+ }
3028
+ async deleteFile(e) {
3029
+ const t = e.map((s) => s._id);
3030
+ if (t.length == 0)
3031
+ Promise.resolve(null);
3032
+ else if (await this.http.deleteJson("/workspace/documents", {
3033
+ ids: t
3034
+ }), this.http.isResponseError())
3035
+ throw this.http.latestResponse.statusText;
3036
+ }
3037
+ async acceptDocuments(e) {
3038
+ const t = await this.context.session().getUser();
3039
+ return (s) => s.deleted && s.trasher ? (t == null ? void 0 : t.userId) == s.trasher : !0;
3040
+ }
3041
+ async searchDocuments(e) {
3042
+ const t = e.filter !== "external" || e.parentId ? await this.http.get("/workspace/documents", {
3043
+ queryParams: { ...e, _: (/* @__PURE__ */ new Date()).getTime() }
3044
+ }) : [], s = await this.acceptDocuments(e);
3045
+ return t.filter(s);
3046
+ }
3047
+ async listDocuments(e, t) {
3048
+ return this.searchDocuments({ filter: e, parentId: t, includeall: !0 });
3049
+ }
3050
+ /**
3051
+ * Duplicate and transfers documents if needed to a different folder with the specified application and visibility.
3052
+ * @param documents - The array of documents to transfer.
3053
+ * @param application - The application to associate with the transferred documents.
3054
+ * @param visibility - The visibility of the transferred documents. Defaults to "protected".
3055
+ * @returns A Promise that resolves to an array of transferred WorkspaceElements.
3056
+ */
3057
+ async transferDocuments(e, t, s = "protected") {
3058
+ const r = [];
3059
+ if (e.forEach((i) => {
3060
+ (s === "public" && !i.public || !i.public && !i.protected) && r.push(i);
3061
+ }), r.length > 0) {
3062
+ const i = await this.http.post(
3063
+ "/workspace/documents/transfer",
3064
+ {
3065
+ application: t,
3066
+ visibility: s,
3067
+ ids: r.map((n) => n._id)
3068
+ }
3069
+ );
3070
+ if (this.http.isResponseError())
3071
+ throw this.http.latestResponse.statusText;
3072
+ return r.forEach((n, a) => {
3073
+ const c = e.findIndex(
3074
+ (h) => h._id === n._id
3075
+ );
3076
+ 0 <= c && c < e.length && (e[c] = i[a]);
3077
+ }), e.filter((n) => !!n);
3078
+ }
3079
+ return e;
3080
+ }
3081
+ /**
3082
+ * Get the URL of the thumbnail of a workspace element (or its URL),
3083
+ * or `null` if none exists or can be created.
3084
+ */
3085
+ getThumbnailUrl(e, t = 0, s = 0) {
3086
+ var i, n;
3087
+ const r = t > 0 || s > 0 ? `${t}x${s}` : "120x120";
3088
+ if (typeof e == "string")
3089
+ return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
3090
+ {
3091
+ const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
3092
+ if ((n = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && n.includes("video")) {
3093
+ const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
3094
+ return h ? a + h : null;
3095
+ } else
3096
+ return a + r;
3097
+ }
3098
+ }
3099
+ }
2997
3100
  let ATTag;
2998
3101
  class AnalyticsService {
2999
3102
  constructor(o) {
@@ -3082,8 +3185,8 @@ class AnalyticsService {
3082
3185
  if (!r || !r.active) return;
3083
3186
  const i = await configure.Platform.apps.getPublicConf(e);
3084
3187
  if (!i) return;
3085
- const u = i.xiti;
3086
- if (!u || !u.LIBELLE_SERVICE || !r.UAI) return;
3188
+ const n = i.xiti;
3189
+ if (!n || !n.LIBELLE_SERVICE || !r.UAI) return;
3087
3190
  function a(h) {
3088
3191
  let l = "";
3089
3192
  for (let E = 0; E < h.length; E++)
@@ -3098,10 +3201,10 @@ class AnalyticsService {
3098
3201
  Guest: "AUTRE"
3099
3202
  };
3100
3203
  return {
3101
- LIBELLE_SERVICE: u.LIBELLE_SERVICE,
3204
+ LIBELLE_SERVICE: n.LIBELLE_SERVICE,
3102
3205
  // Which property of LIBELLE_SERVICE to use depends on the frontend.
3103
- TYPE: u.OUTIL ? "TIERS" : "NATIF",
3104
- OUTIL: u.OUTIL ? u.OUTIL : "",
3206
+ TYPE: n.OUTIL ? "TIERS" : "NATIF",
3207
+ OUTIL: n.OUTIL ? n.OUTIL : "",
3105
3208
  STRUCT_ID: r.collectiviteId,
3106
3209
  STRUCT_UAI: r.UAI,
3107
3210
  PROJET: r.projetId ? r.projetId : o.ID_PROJET,
@@ -3112,7 +3215,7 @@ class AnalyticsService {
3112
3215
  };
3113
3216
  }
3114
3217
  }
3115
- const C = class C {
3218
+ const w = class w {
3116
3219
  // in minutes. Applies to recorded videos.
3117
3220
  constructor(e) {
3118
3221
  this.context = e;
@@ -3130,11 +3233,11 @@ const C = class C {
3130
3233
  async getVideoConf() {
3131
3234
  var t;
3132
3235
  const e = await this.conf.getPublicConf(
3133
- APP$1.VIDEO
3236
+ APP$3.VIDEO
3134
3237
  );
3135
3238
  return {
3136
- maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? C.MAX_WEIGHT,
3137
- maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? C.MAX_DURATION,
3239
+ maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? w.MAX_WEIGHT,
3240
+ maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? w.MAX_DURATION,
3138
3241
  acceptVideoUploadExtensions: ((t = e == null ? void 0 : e["accept-videoupload-extensions"]) == null ? void 0 : t.map(
3139
3242
  (s) => s.toUpperCase()
3140
3243
  )) ?? []
@@ -3155,13 +3258,13 @@ const C = class C {
3155
3258
  throw new Error("Invalid video file.");
3156
3259
  if (!e.filename)
3157
3260
  throw new Error("Invalid video filename");
3158
- const i = `${e.browser.name} ${e.browser.version}`, u = new FormData();
3159
- u.append("device", e.device || ""), u.append("browser", i), u.append("url", e.url), u.append("app", t), u.append("file", e.file, e.filename), u.append("weight", "" + e.file.size), u.append("captation", "" + s);
3261
+ const i = `${e.browser.name} ${e.browser.version}`, n = new FormData();
3262
+ n.append("device", e.device || ""), n.append("browser", i), n.append("url", e.url), n.append("app", t), n.append("file", e.file, e.filename), n.append("weight", "" + e.file.size), n.append("captation", "" + s);
3160
3263
  let a = `/video/encode?captation=${s}`;
3161
3264
  r && (a += `&duration=${r}`);
3162
3265
  const c = await this.http.post(
3163
3266
  a,
3164
- u,
3267
+ n,
3165
3268
  { headers: { "Content-Type": "multipart/form-data" } }
3166
3269
  );
3167
3270
  if (c.state == "running") {
@@ -3191,9 +3294,9 @@ const C = class C {
3191
3294
  throw new Error("Video cannot be uploaded.");
3192
3295
  }
3193
3296
  };
3194
- n(C, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
3195
- n(C, "MAX_DURATION", 3);
3196
- let VideoService = C;
3297
+ u(w, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
3298
+ u(w, "MAX_DURATION", 3);
3299
+ let VideoService = w;
3197
3300
  class EmbedderService {
3198
3301
  constructor(e) {
3199
3302
  this.context = e;
@@ -3229,9 +3332,9 @@ class EmbedderService {
3229
3332
  urlIsFromPattern(e, t) {
3230
3333
  const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
3231
3334
  let i = !0;
3232
- const u = t.match(s) || [], a = [];
3335
+ const n = t.match(s) || [], a = [];
3233
3336
  return (t.match(r) || []).forEach((h, l) => {
3234
- h.includes("ignore") || a.push(u[l]);
3337
+ h.includes("ignore") || a.push(n[l]);
3235
3338
  }), a.forEach((h) => {
3236
3339
  if (!e.includes(h)) {
3237
3340
  i = !1;
@@ -3262,7 +3365,7 @@ class EmbedderService {
3262
3365
  for (const s of e.url)
3263
3366
  if (this.urlIsFromPattern(t, s)) {
3264
3367
  const r = new RegExp("{[a-zA-Z0-9_.]+}", "g"), i = s.match(r) || [];
3265
- let u = e.embed;
3368
+ let n = e.embed;
3266
3369
  for (const a of i) {
3267
3370
  let c = s.split(a)[0];
3268
3371
  const h = c.split("}");
@@ -3273,9 +3376,9 @@ class EmbedderService {
3273
3376
  const E = s.split(a)[1].split("{")[0];
3274
3377
  E && (l = l.split(E)[0]);
3275
3378
  const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
3276
- u = u.replace(p, l);
3379
+ n = n.replace(p, l);
3277
3380
  }
3278
- return u;
3381
+ return n;
3279
3382
  }
3280
3383
  return "";
3281
3384
  }
@@ -3288,7 +3391,7 @@ class AbstractBehaviourService {
3288
3391
  //-----------------
3289
3392
  //--- Utilities ---
3290
3393
  //-----------------
3291
- n(this, "_cache");
3394
+ u(this, "_cache");
3292
3395
  this.context = e, this._cache = new CacheService(this.context);
3293
3396
  }
3294
3397
  getApplication() {
@@ -3322,14 +3425,14 @@ class AbstractBehaviourService {
3322
3425
  class ActualitesBehaviour extends AbstractBehaviourService {
3323
3426
  constructor() {
3324
3427
  super(...arguments);
3325
- n(this, "APP", "actualites");
3326
- n(this, "RESOURCE", "actualites");
3428
+ u(this, "APP", "actualites");
3429
+ u(this, "RESOURCE", "actualites");
3327
3430
  }
3328
3431
  async loadResources() {
3329
3432
  return (await this.httpGet(
3330
3433
  "/actualites/linker/infos"
3331
3434
  )).map((s) => {
3332
- var r;
3435
+ let r;
3333
3436
  return s.thread_icon ? r = s.thread_icon + "?thumbnail=48x48" : r = "/img/icons/glyphicons_036_file.png", this.dataToResource({
3334
3437
  title: s.title + " [" + s.thread_title + "]",
3335
3438
  ownerName: s.username,
@@ -3346,24 +3449,24 @@ class ActualitesBehaviour extends AbstractBehaviourService {
3346
3449
  class BlogBehaviour extends AbstractBehaviourService {
3347
3450
  constructor() {
3348
3451
  super(...arguments);
3349
- n(this, "APP", "blog");
3350
- n(this, "RESOURCE", "blog");
3452
+ u(this, "APP", "blog");
3453
+ u(this, "RESOURCE", "blog");
3351
3454
  }
3352
3455
  loadResources() {
3353
3456
  return new Promise(async (t, s) => {
3354
3457
  try {
3355
3458
  const r = await this.httpGet("/blog/linker"), i = [];
3356
- r.forEach((u) => {
3357
- u.thumbnail ? u.thumbnail = u.thumbnail + "?thumbnail=48x48" : u.thumbnail = "/img/illustrations/blog.svg";
3358
- const a = u.fetchPosts.map((c) => this.dataToResource({
3359
- owner: u.author.userId,
3360
- ownerName: u.author.username,
3361
- title: c.title + " [" + u.title + "]",
3362
- _id: `${u._id}#${c._id}`,
3363
- icon: u.thumbnail,
3364
- path: `/blog/id/${u._id}/post/${c._id}`,
3365
- shared: !!(u.shared && u.shared.length >= 0),
3366
- modified: u.modified
3459
+ r.forEach((n) => {
3460
+ n.thumbnail ? n.thumbnail = n.thumbnail + "?thumbnail=48x48" : n.thumbnail = "/img/illustrations/blog.svg";
3461
+ const a = n.fetchPosts.map((c) => this.dataToResource({
3462
+ owner: n.author.userId,
3463
+ ownerName: n.author.username,
3464
+ title: c.title + " [" + n.title + "]",
3465
+ _id: `${n._id}#${c._id}`,
3466
+ icon: n.thumbnail,
3467
+ path: `/blog/id/${n._id}/post/${c._id}`,
3468
+ shared: !!(n.shared && n.shared.length >= 0),
3469
+ modified: n.modified
3367
3470
  }));
3368
3471
  i.push(...a);
3369
3472
  }), t(i);
@@ -3376,8 +3479,8 @@ class BlogBehaviour extends AbstractBehaviourService {
3376
3479
  class CollaborativewallBehaviour extends AbstractBehaviourService {
3377
3480
  constructor() {
3378
3481
  super(...arguments);
3379
- n(this, "APP", "collaborativewall");
3380
- n(this, "RESOURCE", "collaborativewall");
3482
+ u(this, "APP", "collaborativewall");
3483
+ u(this, "RESOURCE", "collaborativewall");
3381
3484
  }
3382
3485
  async loadResources() {
3383
3486
  return (await this.httpGet(
@@ -3399,14 +3502,14 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
3399
3502
  class CommunityBehaviour extends AbstractBehaviourService {
3400
3503
  constructor() {
3401
3504
  super(...arguments);
3402
- n(this, "APP", "community");
3403
- n(this, "RESOURCE", "community");
3505
+ u(this, "APP", "community");
3506
+ u(this, "RESOURCE", "community");
3404
3507
  }
3405
3508
  async loadResources() {
3406
3509
  return (await this.httpGet(
3407
3510
  "/community/listallpages"
3408
3511
  )).map((s) => {
3409
- var r;
3512
+ let r;
3410
3513
  return typeof s.thumbnail > "u" || s.thumbnail === "" ? r = "/img/icons/glyphicons_036_file.png" : r = s.thumbnail + "?thumbnail=48x48", this.dataToResource({
3411
3514
  title: s.name,
3412
3515
  icon: r,
@@ -3424,23 +3527,24 @@ class CommunityBehaviour extends AbstractBehaviourService {
3424
3527
  class ExercizerBehaviour extends AbstractBehaviourService {
3425
3528
  constructor() {
3426
3529
  super(...arguments);
3427
- n(this, "APP", "exercizer");
3428
- n(this, "RESOURCE", "exercizer");
3530
+ u(this, "APP", "exercizer");
3531
+ u(this, "RESOURCE", "exercizer");
3429
3532
  }
3430
3533
  async loadResources() {
3431
3534
  return (await this.httpGet(
3432
3535
  "/exercizer/subjects-scheduled"
3433
3536
  )).map((s) => {
3434
3537
  const r = s.picture ? s.picture + "?thumbnail=48x48" : "/img/illustrations/exercizer.svg";
3435
- let i, u = !1, a = JSON.parse(s.scheduled_at);
3436
- return a.groupList.length > 0 ? (u = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (u = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
3538
+ let i, n = !1;
3539
+ const a = JSON.parse(s.scheduled_at);
3540
+ return a.groupList.length > 0 ? (n = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (n = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
3437
3541
  title: s.title,
3438
3542
  owner: s.owner,
3439
3543
  ownerName: i,
3440
3544
  icon: r,
3441
3545
  path: "/exercizer#/linker/" + s.id,
3442
3546
  _id: "" + s.id,
3443
- shared: u,
3547
+ shared: n,
3444
3548
  modified: s.modified
3445
3549
  });
3446
3550
  });
@@ -3449,8 +3553,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
3449
3553
  class FormulaireBehaviour extends AbstractBehaviourService {
3450
3554
  constructor() {
3451
3555
  super(...arguments);
3452
- n(this, "APP", "formulaire");
3453
- n(this, "RESOURCE", "formulaire");
3556
+ u(this, "APP", "formulaire");
3557
+ u(this, "RESOURCE", "formulaire");
3454
3558
  }
3455
3559
  async loadResources() {
3456
3560
  return (await this.httpGet(
@@ -3470,8 +3574,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
3470
3574
  class ForumBehaviour extends AbstractBehaviourService {
3471
3575
  constructor() {
3472
3576
  super(...arguments);
3473
- n(this, "APP", "forum");
3474
- n(this, "RESOURCE", "forum");
3577
+ u(this, "APP", "forum");
3578
+ u(this, "RESOURCE", "forum");
3475
3579
  }
3476
3580
  async loadResources() {
3477
3581
  return (await this.httpGet("/forum/categories")).map(
@@ -3491,8 +3595,8 @@ class ForumBehaviour extends AbstractBehaviourService {
3491
3595
  class HomeworksBehaviour extends AbstractBehaviourService {
3492
3596
  constructor() {
3493
3597
  super(...arguments);
3494
- n(this, "APP", "homeworks");
3495
- n(this, "RESOURCE", "homeworks");
3598
+ u(this, "APP", "homeworks");
3599
+ u(this, "RESOURCE", "homeworks");
3496
3600
  }
3497
3601
  async loadResources() {
3498
3602
  return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
@@ -3510,8 +3614,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
3510
3614
  class MagnetoBehaviour extends AbstractBehaviourService {
3511
3615
  constructor() {
3512
3616
  super(...arguments);
3513
- n(this, "APP", "magneto");
3514
- n(this, "RESOURCE", "magneto");
3617
+ u(this, "APP", "magneto");
3618
+ u(this, "RESOURCE", "magneto");
3515
3619
  }
3516
3620
  async loadResources() {
3517
3621
  const { all: t } = await this.httpGet(
@@ -3532,8 +3636,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
3532
3636
  class MindmapBehaviour extends AbstractBehaviourService {
3533
3637
  constructor() {
3534
3638
  super(...arguments);
3535
- n(this, "APP", "mindmap");
3536
- n(this, "RESOURCE", "mindmap");
3639
+ u(this, "APP", "mindmap");
3640
+ u(this, "RESOURCE", "mindmap");
3537
3641
  }
3538
3642
  async loadResources() {
3539
3643
  return (await this.httpGet("/mindmap/list/all")).map(
@@ -3553,13 +3657,13 @@ class MindmapBehaviour extends AbstractBehaviourService {
3553
3657
  class PagesBehaviour extends AbstractBehaviourService {
3554
3658
  constructor() {
3555
3659
  super(...arguments);
3556
- n(this, "APP", "pages");
3557
- n(this, "RESOURCE", "pages");
3660
+ u(this, "APP", "pages");
3661
+ u(this, "RESOURCE", "pages");
3558
3662
  }
3559
3663
  async loadResources() {
3560
3664
  const t = await this.httpGet("/pages/list/all"), s = [];
3561
3665
  return t.forEach((r) => {
3562
- var u;
3666
+ var n;
3563
3667
  const i = r.thumbnail ? r.thumbnail + "?thumbnail=48x48" : "/img/illustrations/pages.svg";
3564
3668
  s.push(
3565
3669
  this.dataToResource({
@@ -3572,7 +3676,7 @@ class PagesBehaviour extends AbstractBehaviourService {
3572
3676
  shared: typeof r.shared < "u",
3573
3677
  modified: r.modified
3574
3678
  })
3575
- ), (u = r.pages) == null || u.forEach((a) => {
3679
+ ), (n = r.pages) == null || n.forEach((a) => {
3576
3680
  s.push(
3577
3681
  this.dataToResource({
3578
3682
  title: a.title,
@@ -3592,8 +3696,8 @@ class PagesBehaviour extends AbstractBehaviourService {
3592
3696
  class PollBehaviour extends AbstractBehaviourService {
3593
3697
  constructor() {
3594
3698
  super(...arguments);
3595
- n(this, "APP", "poll");
3596
- n(this, "RESOURCE", "poll");
3699
+ u(this, "APP", "poll");
3700
+ u(this, "RESOURCE", "poll");
3597
3701
  }
3598
3702
  async loadResources() {
3599
3703
  return (await this.httpGet("/poll/list/all")).map((s) => {
@@ -3614,8 +3718,8 @@ class PollBehaviour extends AbstractBehaviourService {
3614
3718
  class ScrapbookBehaviour extends AbstractBehaviourService {
3615
3719
  constructor() {
3616
3720
  super(...arguments);
3617
- n(this, "APP", "scrapbook");
3618
- n(this, "RESOURCE", "scrapbook");
3721
+ u(this, "APP", "scrapbook");
3722
+ u(this, "RESOURCE", "scrapbook");
3619
3723
  }
3620
3724
  async loadResources() {
3621
3725
  return (await this.httpGet(
@@ -3638,25 +3742,25 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
3638
3742
  class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3639
3743
  constructor() {
3640
3744
  super(...arguments);
3641
- n(this, "APP", "timelinegenerator");
3642
- n(this, "RESOURCE", "timelinegenerator");
3745
+ u(this, "APP", "timelinegenerator");
3746
+ u(this, "RESOURCE", "timelinegenerator");
3643
3747
  }
3644
3748
  loadResources() {
3645
3749
  return new Promise(async (t, s) => {
3646
3750
  try {
3647
3751
  const i = (await this.httpGet(
3648
3752
  "/timelinegenerator/timelines"
3649
- )).map((u) => {
3650
- const a = u.icon || "/img/illustrations/timeline-default.png";
3753
+ )).map((n) => {
3754
+ const a = n.icon || "/img/illustrations/timeline-default.png";
3651
3755
  return this.dataToResource({
3652
- title: u.headline,
3653
- ownerName: u.owner.displayName,
3654
- owner: u.owner.userId,
3756
+ title: n.headline,
3757
+ ownerName: n.owner.displayName,
3758
+ owner: n.owner.userId,
3655
3759
  icon: a,
3656
- path: "/timelinegenerator#/view/" + u._id,
3657
- _id: u._id,
3658
- shared: typeof u.shared < "u",
3659
- modified: u.modified
3760
+ path: "/timelinegenerator#/view/" + n._id,
3761
+ _id: n._id,
3762
+ shared: typeof n.shared < "u",
3763
+ modified: n.modified
3660
3764
  });
3661
3765
  });
3662
3766
  t(i);
@@ -3669,8 +3773,8 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3669
3773
  class WikiBehaviour extends AbstractBehaviourService {
3670
3774
  constructor() {
3671
3775
  super(...arguments);
3672
- n(this, "APP", "wiki");
3673
- n(this, "RESOURCE", "wiki");
3776
+ u(this, "APP", "wiki");
3777
+ u(this, "RESOURCE", "wiki");
3674
3778
  }
3675
3779
  async loadResources() {
3676
3780
  return (await this.httpGet(
@@ -3693,15 +3797,15 @@ class WikiBehaviour extends AbstractBehaviourService {
3693
3797
  class WorkspaceBehaviour extends AbstractBehaviourService {
3694
3798
  constructor() {
3695
3799
  super(...arguments);
3696
- n(this, "APP", "workspace");
3697
- n(this, "RESOURCE", "workspace");
3800
+ u(this, "APP", "workspace");
3801
+ u(this, "RESOURCE", "workspace");
3698
3802
  }
3699
3803
  loadResources({ search: t, asset_id: s }) {
3700
3804
  return new Promise(async (r, i) => {
3701
3805
  try {
3702
- let u = "/workspace/documents?filter=all&hierarchical=true";
3703
- s && s.length ? u += `&search=${t}` : t && t.length && (u += `&search=${t}`);
3704
- const c = (await this.httpGet(u)).filter((h) => !h.deleted).map((h) => {
3806
+ let n = "/workspace/documents?filter=all&hierarchical=true";
3807
+ s && s.length ? n += `&search=${t}` : t && t.length && (n += `&search=${t}`);
3808
+ const c = (await this.httpGet(n)).filter((h) => !h.deleted).map((h) => {
3705
3809
  const l = h.metadata["content-type"] && h.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${h._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
3706
3810
  return this.dataToResource({
3707
3811
  title: h.name,
@@ -3715,8 +3819,8 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
3715
3819
  });
3716
3820
  });
3717
3821
  r(c);
3718
- } catch (u) {
3719
- i(u);
3822
+ } catch (n) {
3823
+ i(n);
3720
3824
  }
3721
3825
  });
3722
3826
  }
@@ -3732,7 +3836,7 @@ const y = class y {
3732
3836
  e.session().getUser()
3733
3837
  ]);
3734
3838
  i != null && i.apps && (r != null && r.length) && (this.resourceProducingApps = r.filter(
3735
- (u) => i.apps.some((a) => a.address.includes(u))
3839
+ (n) => i.apps.some((a) => a.address.includes(n))
3736
3840
  ));
3737
3841
  } catch (r) {
3738
3842
  console.warn("Failed to load resource-producing apps:", r);
@@ -3809,13 +3913,13 @@ const y = class y {
3809
3913
  //
3810
3914
  // STATIC REGISTRY
3811
3915
  //
3812
- n(y, "registry", new ServiceRegistry()), // Expose some useful functions
3813
- n(y, "findBehaviour", y.registry.findService.bind(y.registry)), n(y, "hasBehaviour", y.registry.isRegistered.bind(y.registry)), n(y, "resourceProducingApps", []);
3916
+ u(y, "registry", new ServiceRegistry()), // Expose some useful functions
3917
+ u(y, "findBehaviour", y.registry.findService.bind(y.registry)), u(y, "hasBehaviour", y.registry.isRegistered.bind(y.registry)), u(y, "resourceProducingApps", []);
3814
3918
  let SnipletsService = y;
3815
3919
  const SEND_ALL = "*";
3816
3920
  class WebBroker {
3817
3921
  constructor(e) {
3818
- n(this, "subscription");
3922
+ u(this, "subscription");
3819
3923
  this.odeServices = e;
3820
3924
  }
3821
3925
  get http() {
@@ -3847,10 +3951,10 @@ class WebBroker {
3847
3951
  }
3848
3952
  class DataService {
3849
3953
  constructor(e) {
3850
- n(this, "_webBroker");
3851
- n(this, "app");
3852
- n(this, "user");
3853
- n(this, "profile");
3954
+ u(this, "_webBroker");
3955
+ u(this, "app");
3956
+ u(this, "user");
3957
+ u(this, "profile");
3854
3958
  this.odeServices = e;
3855
3959
  }
3856
3960
  get conf() {
@@ -3884,12 +3988,12 @@ class DataService {
3884
3988
  addUserInfos(e) {
3885
3989
  return this.user && (e.userId = this.user.userId, e.structure = this.user.structureNames[0]), this.profile && (e.profil = this.profile[0]), e;
3886
3990
  }
3887
- trackVideoSave(e, t, s, r, i, u, a) {
3991
+ trackVideoSave(e, t, s, r, i, n, a) {
3888
3992
  const c = this.addUserInfos({
3889
3993
  "event-type": "VIDEO_SAVE",
3890
3994
  module: "video",
3891
3995
  video_id: e,
3892
- browser: u,
3996
+ browser: n,
3893
3997
  duration: Math.round(t),
3894
3998
  weight: s,
3895
3999
  source: r ? "CAPTURED" : "UPLOADED",
@@ -3898,7 +4002,7 @@ class DataService {
3898
4002
  this.app && (c["override-module"] = this.app), a && (c.device_type = a), this.trackWebEvent(c);
3899
4003
  }
3900
4004
  trackVideoRead(e, t, s, r, i) {
3901
- const u = this.addUserInfos({
4005
+ const n = this.addUserInfos({
3902
4006
  "event-type": "VIDEO_READ",
3903
4007
  module: "video",
3904
4008
  video_id: e,
@@ -3906,7 +4010,7 @@ class DataService {
3906
4010
  source: t ? "CAPTURED" : "UPLOADED",
3907
4011
  url: s
3908
4012
  });
3909
- this.app && (u["override-module"] = this.app), i && (u.device_type = i), this.trackWebEvent(u);
4013
+ this.app && (n["override-module"] = this.app), i && (n.device_type = i), this.trackWebEvent(n);
3910
4014
  }
3911
4015
  trackSpeechAndText(e) {
3912
4016
  const t = this.addUserInfos({
@@ -4012,20 +4116,20 @@ class AudienceService {
4012
4116
  }
4013
4117
  class OdeServices {
4014
4118
  constructor() {
4015
- n(this, "_analytics");
4016
- n(this, "_cache");
4017
- n(this, "_conf");
4018
- n(this, "_data");
4019
- n(this, "_directory");
4020
- n(this, "_http");
4021
- n(this, "_idiom");
4022
- n(this, "_notify");
4023
- n(this, "_rights");
4024
- n(this, "_session");
4025
- n(this, "_share");
4026
- n(this, "_video");
4027
- n(this, "_workspace");
4028
- n(this, "_embedder");
4119
+ u(this, "_analytics");
4120
+ u(this, "_cache");
4121
+ u(this, "_conf");
4122
+ u(this, "_data");
4123
+ u(this, "_directory");
4124
+ u(this, "_http");
4125
+ u(this, "_idiom");
4126
+ u(this, "_notify");
4127
+ u(this, "_rights");
4128
+ u(this, "_session");
4129
+ u(this, "_share");
4130
+ u(this, "_video");
4131
+ u(this, "_workspace");
4132
+ u(this, "_embedder");
4029
4133
  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._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
4030
4134
  }
4031
4135
  initialize() {
@@ -4227,10 +4331,10 @@ const isActionAvailable = (o, e) => {
4227
4331
  class WidgetFramework {
4228
4332
  constructor() {
4229
4333
  //-------------------------------------
4230
- n(this, "_initialized");
4231
- n(this, "_widgets", []);
4334
+ u(this, "_initialized");
4335
+ u(this, "_widgets", []);
4232
4336
  ////////////////////////////////////// USER PREFERENCES
4233
- n(this, "_userPrefs", {});
4337
+ u(this, "_userPrefs", {});
4234
4338
  }
4235
4339
  initialize(e, t) {
4236
4340
  return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
@@ -4241,8 +4345,8 @@ class WidgetFramework {
4241
4345
  var i;
4242
4346
  (i = this._initialized) == null || i.resolve();
4243
4347
  }).catch((i) => {
4244
- var u;
4245
- (u = this._initialized) == null || u.reject();
4348
+ var n;
4349
+ (n = this._initialized) == null || n.reject();
4246
4350
  })) : (r = this._initialized) == null || r.reject();
4247
4351
  })), this._initialized.promise;
4248
4352
  }
@@ -4283,9 +4387,9 @@ class WidgetFramework {
4283
4387
  position: c.platformConf.position
4284
4388
  }), c.platformConf.mandatory && (this._userPrefs[l].show = !0, this._userPrefs[l].index = defaultWidgetOrder[l] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[l]), !0);
4285
4389
  });
4286
- const u = new Idiom();
4390
+ const n = new Idiom();
4287
4391
  this._widgets = this._widgets.sort((c, h) => {
4288
- const l = u.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = u.translate(`timeline.settings.${h.platformConf.name}`).toLowerCase();
4392
+ const l = n.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = n.translate(`timeline.settings.${h.platformConf.name}`).toLowerCase();
4289
4393
  return l < E ? -1 : l > E ? 1 : 0;
4290
4394
  });
4291
4395
  });
@@ -4294,8 +4398,8 @@ class WidgetFramework {
4294
4398
  class Widget {
4295
4399
  //-------------------------------------
4296
4400
  constructor(e) {
4297
- n(this, "_schoolConf", {});
4298
- n(this, "_userPref");
4401
+ u(this, "_schoolConf", {});
4402
+ u(this, "_userPref");
4299
4403
  this._platformConf = e, this._userPref = null;
4300
4404
  }
4301
4405
  get platformConf() {
@@ -4354,7 +4458,7 @@ class WidgetFrameworkFactory {
4354
4458
  }
4355
4459
  export {
4356
4460
  ACTION,
4357
- APP$1 as APP,
4461
+ APP$3 as APP,
4358
4462
  BOOLEAN_FILTER,
4359
4463
  ConfigurationFrameworkFactory,
4360
4464
  DocumentHelper,